Imported Upstream version 4.5.2
[platform/upstream/python-lxml.git] / src / lxml / sax.c
1 /* Generated by Cython 0.29.21 */
2
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "CYTHON_CLINE_IN_TRACEBACK",
9                 "0"
10             ]
11         ],
12         "extra_compile_args": [
13             "-w"
14         ],
15         "include_dirs": [
16             "/usr/include/libxml2",
17             "src",
18             "src/lxml/includes"
19         ],
20         "name": "lxml.sax",
21         "sources": [
22             "src/lxml/sax.py"
23         ]
24     },
25     "module_name": "lxml.sax"
26 }
27 END: Cython Metadata */
28
29 #define PY_SSIZE_T_CLEAN
30 #include "Python.h"
31 #ifndef Py_PYTHON_H
32     #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34     #error Cython requires Python 2.6+ or Python 3.3+.
35 #else
36 #define CYTHON_ABI "0_29_21"
37 #define CYTHON_HEX_VERSION 0x001D15F0
38 #define CYTHON_FUTURE_DIVISION 0
39 #include <stddef.h>
40 #ifndef offsetof
41   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
42 #endif
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
44   #ifndef __stdcall
45     #define __stdcall
46   #endif
47   #ifndef __cdecl
48     #define __cdecl
49   #endif
50   #ifndef __fastcall
51     #define __fastcall
52   #endif
53 #endif
54 #ifndef DL_IMPORT
55   #define DL_IMPORT(t) t
56 #endif
57 #ifndef DL_EXPORT
58   #define DL_EXPORT(t) t
59 #endif
60 #define __PYX_COMMA ,
61 #ifndef HAVE_LONG_LONG
62   #if PY_VERSION_HEX >= 0x02070000
63     #define HAVE_LONG_LONG
64   #endif
65 #endif
66 #ifndef PY_LONG_LONG
67   #define PY_LONG_LONG LONG_LONG
68 #endif
69 #ifndef Py_HUGE_VAL
70   #define Py_HUGE_VAL HUGE_VAL
71 #endif
72 #ifdef PYPY_VERSION
73   #define CYTHON_COMPILING_IN_PYPY 1
74   #define CYTHON_COMPILING_IN_PYSTON 0
75   #define CYTHON_COMPILING_IN_CPYTHON 0
76   #undef CYTHON_USE_TYPE_SLOTS
77   #define CYTHON_USE_TYPE_SLOTS 0
78   #undef CYTHON_USE_PYTYPE_LOOKUP
79   #define CYTHON_USE_PYTYPE_LOOKUP 0
80   #if PY_VERSION_HEX < 0x03050000
81     #undef CYTHON_USE_ASYNC_SLOTS
82     #define CYTHON_USE_ASYNC_SLOTS 0
83   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84     #define CYTHON_USE_ASYNC_SLOTS 1
85   #endif
86   #undef CYTHON_USE_PYLIST_INTERNALS
87   #define CYTHON_USE_PYLIST_INTERNALS 0
88   #undef CYTHON_USE_UNICODE_INTERNALS
89   #define CYTHON_USE_UNICODE_INTERNALS 0
90   #undef CYTHON_USE_UNICODE_WRITER
91   #define CYTHON_USE_UNICODE_WRITER 0
92   #undef CYTHON_USE_PYLONG_INTERNALS
93   #define CYTHON_USE_PYLONG_INTERNALS 0
94   #undef CYTHON_AVOID_BORROWED_REFS
95   #define CYTHON_AVOID_BORROWED_REFS 1
96   #undef CYTHON_ASSUME_SAFE_MACROS
97   #define CYTHON_ASSUME_SAFE_MACROS 0
98   #undef CYTHON_UNPACK_METHODS
99   #define CYTHON_UNPACK_METHODS 0
100   #undef CYTHON_FAST_THREAD_STATE
101   #define CYTHON_FAST_THREAD_STATE 0
102   #undef CYTHON_FAST_PYCALL
103   #define CYTHON_FAST_PYCALL 0
104   #undef CYTHON_PEP489_MULTI_PHASE_INIT
105   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106   #undef CYTHON_USE_TP_FINALIZE
107   #define CYTHON_USE_TP_FINALIZE 0
108   #undef CYTHON_USE_DICT_VERSIONS
109   #define CYTHON_USE_DICT_VERSIONS 0
110   #undef CYTHON_USE_EXC_INFO_STACK
111   #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113   #define CYTHON_COMPILING_IN_PYPY 0
114   #define CYTHON_COMPILING_IN_PYSTON 1
115   #define CYTHON_COMPILING_IN_CPYTHON 0
116   #ifndef CYTHON_USE_TYPE_SLOTS
117     #define CYTHON_USE_TYPE_SLOTS 1
118   #endif
119   #undef CYTHON_USE_PYTYPE_LOOKUP
120   #define CYTHON_USE_PYTYPE_LOOKUP 0
121   #undef CYTHON_USE_ASYNC_SLOTS
122   #define CYTHON_USE_ASYNC_SLOTS 0
123   #undef CYTHON_USE_PYLIST_INTERNALS
124   #define CYTHON_USE_PYLIST_INTERNALS 0
125   #ifndef CYTHON_USE_UNICODE_INTERNALS
126     #define CYTHON_USE_UNICODE_INTERNALS 1
127   #endif
128   #undef CYTHON_USE_UNICODE_WRITER
129   #define CYTHON_USE_UNICODE_WRITER 0
130   #undef CYTHON_USE_PYLONG_INTERNALS
131   #define CYTHON_USE_PYLONG_INTERNALS 0
132   #ifndef CYTHON_AVOID_BORROWED_REFS
133     #define CYTHON_AVOID_BORROWED_REFS 0
134   #endif
135   #ifndef CYTHON_ASSUME_SAFE_MACROS
136     #define CYTHON_ASSUME_SAFE_MACROS 1
137   #endif
138   #ifndef CYTHON_UNPACK_METHODS
139     #define CYTHON_UNPACK_METHODS 1
140   #endif
141   #undef CYTHON_FAST_THREAD_STATE
142   #define CYTHON_FAST_THREAD_STATE 0
143   #undef CYTHON_FAST_PYCALL
144   #define CYTHON_FAST_PYCALL 0
145   #undef CYTHON_PEP489_MULTI_PHASE_INIT
146   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147   #undef CYTHON_USE_TP_FINALIZE
148   #define CYTHON_USE_TP_FINALIZE 0
149   #undef CYTHON_USE_DICT_VERSIONS
150   #define CYTHON_USE_DICT_VERSIONS 0
151   #undef CYTHON_USE_EXC_INFO_STACK
152   #define CYTHON_USE_EXC_INFO_STACK 0
153 #else
154   #define CYTHON_COMPILING_IN_PYPY 0
155   #define CYTHON_COMPILING_IN_PYSTON 0
156   #define CYTHON_COMPILING_IN_CPYTHON 1
157   #ifndef CYTHON_USE_TYPE_SLOTS
158     #define CYTHON_USE_TYPE_SLOTS 1
159   #endif
160   #if PY_VERSION_HEX < 0x02070000
161     #undef CYTHON_USE_PYTYPE_LOOKUP
162     #define CYTHON_USE_PYTYPE_LOOKUP 0
163   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164     #define CYTHON_USE_PYTYPE_LOOKUP 1
165   #endif
166   #if PY_MAJOR_VERSION < 3
167     #undef CYTHON_USE_ASYNC_SLOTS
168     #define CYTHON_USE_ASYNC_SLOTS 0
169   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170     #define CYTHON_USE_ASYNC_SLOTS 1
171   #endif
172   #if PY_VERSION_HEX < 0x02070000
173     #undef CYTHON_USE_PYLONG_INTERNALS
174     #define CYTHON_USE_PYLONG_INTERNALS 0
175   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176     #define CYTHON_USE_PYLONG_INTERNALS 1
177   #endif
178   #ifndef CYTHON_USE_PYLIST_INTERNALS
179     #define CYTHON_USE_PYLIST_INTERNALS 1
180   #endif
181   #ifndef CYTHON_USE_UNICODE_INTERNALS
182     #define CYTHON_USE_UNICODE_INTERNALS 1
183   #endif
184   #if PY_VERSION_HEX < 0x030300F0
185     #undef CYTHON_USE_UNICODE_WRITER
186     #define CYTHON_USE_UNICODE_WRITER 0
187   #elif !defined(CYTHON_USE_UNICODE_WRITER)
188     #define CYTHON_USE_UNICODE_WRITER 1
189   #endif
190   #ifndef CYTHON_AVOID_BORROWED_REFS
191     #define CYTHON_AVOID_BORROWED_REFS 0
192   #endif
193   #ifndef CYTHON_ASSUME_SAFE_MACROS
194     #define CYTHON_ASSUME_SAFE_MACROS 1
195   #endif
196   #ifndef CYTHON_UNPACK_METHODS
197     #define CYTHON_UNPACK_METHODS 1
198   #endif
199   #ifndef CYTHON_FAST_THREAD_STATE
200     #define CYTHON_FAST_THREAD_STATE 1
201   #endif
202   #ifndef CYTHON_FAST_PYCALL
203     #define CYTHON_FAST_PYCALL 1
204   #endif
205   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
207   #endif
208   #ifndef CYTHON_USE_TP_FINALIZE
209     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
210   #endif
211   #ifndef CYTHON_USE_DICT_VERSIONS
212     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
213   #endif
214   #ifndef CYTHON_USE_EXC_INFO_STACK
215     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
216   #endif
217 #endif
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
220 #endif
221 #if CYTHON_USE_PYLONG_INTERNALS
222   #include "longintrepr.h"
223   #undef SHIFT
224   #undef BASE
225   #undef MASK
226   #ifdef SIZEOF_VOID_P
227     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
228   #endif
229 #endif
230 #ifndef __has_attribute
231   #define __has_attribute(x) 0
232 #endif
233 #ifndef __has_cpp_attribute
234   #define __has_cpp_attribute(x) 0
235 #endif
236 #ifndef CYTHON_RESTRICT
237   #if defined(__GNUC__)
238     #define CYTHON_RESTRICT __restrict__
239   #elif defined(_MSC_VER) && _MSC_VER >= 1400
240     #define CYTHON_RESTRICT __restrict
241   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242     #define CYTHON_RESTRICT restrict
243   #else
244     #define CYTHON_RESTRICT
245   #endif
246 #endif
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 #     define CYTHON_UNUSED __attribute__ ((__unused__))
251 #   else
252 #     define CYTHON_UNUSED
253 #   endif
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 #   define CYTHON_UNUSED __attribute__ ((__unused__))
256 # else
257 #   define CYTHON_UNUSED
258 # endif
259 #endif
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 #  if defined(__cplusplus)
262      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
263 #  else
264 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
265 #  endif
266 #endif
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 #  define CYTHON_NCP_UNUSED
270 # else
271 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
272 # endif
273 #endif
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
275 #ifdef _MSC_VER
276     #ifndef _MSC_STDINT_H_
277         #if _MSC_VER < 1300
278            typedef unsigned char     uint8_t;
279            typedef unsigned int      uint32_t;
280         #else
281            typedef unsigned __int8   uint8_t;
282            typedef unsigned __int32  uint32_t;
283         #endif
284     #endif
285 #else
286    #include <stdint.h>
287 #endif
288 #ifndef CYTHON_FALLTHROUGH
289   #if defined(__cplusplus) && __cplusplus >= 201103L
290     #if __has_cpp_attribute(fallthrough)
291       #define CYTHON_FALLTHROUGH [[fallthrough]]
292     #elif __has_cpp_attribute(clang::fallthrough)
293       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294     #elif __has_cpp_attribute(gnu::fallthrough)
295       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
296     #endif
297   #endif
298   #ifndef CYTHON_FALLTHROUGH
299     #if __has_attribute(fallthrough)
300       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
301     #else
302       #define CYTHON_FALLTHROUGH
303     #endif
304   #endif
305   #if defined(__clang__ ) && defined(__apple_build_version__)
306     #if __apple_build_version__ < 7000000
307       #undef  CYTHON_FALLTHROUGH
308       #define CYTHON_FALLTHROUGH
309     #endif
310   #endif
311 #endif
312
313 #ifndef CYTHON_INLINE
314   #if defined(__clang__)
315     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
316   #elif defined(__GNUC__)
317     #define CYTHON_INLINE __inline__
318   #elif defined(_MSC_VER)
319     #define CYTHON_INLINE __inline
320   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
321     #define CYTHON_INLINE inline
322   #else
323     #define CYTHON_INLINE
324   #endif
325 #endif
326
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328   #define Py_OptimizeFlag 0
329 #endif
330 #define __PYX_BUILD_PY_SSIZE_T "n"
331 #define CYTHON_FORMAT_SSIZE_T "z"
332 #if PY_MAJOR_VERSION < 3
333   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
334   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
335           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
336   #define __Pyx_DefaultClassType PyClass_Type
337 #else
338   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
339 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
340   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
342 #else
343   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
345 #endif
346   #define __Pyx_DefaultClassType PyType_Type
347 #endif
348 #ifndef Py_TPFLAGS_CHECKTYPES
349   #define Py_TPFLAGS_CHECKTYPES 0
350 #endif
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352   #define Py_TPFLAGS_HAVE_INDEX 0
353 #endif
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
356 #endif
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358   #define Py_TPFLAGS_HAVE_FINALIZE 0
359 #endif
360 #ifndef METH_STACKLESS
361   #define METH_STACKLESS 0
362 #endif
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364   #ifndef METH_FASTCALL
365      #define METH_FASTCALL 0x80
366   #endif
367   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
368   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
369                                                           Py_ssize_t nargs, PyObject *kwnames);
370 #else
371   #define __Pyx_PyCFunctionFast _PyCFunctionFast
372   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
373 #endif
374 #if CYTHON_FAST_PYCCALL
375 #define __Pyx_PyFastCFunction_Check(func)\
376     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
377 #else
378 #define __Pyx_PyFastCFunction_Check(func) 0
379 #endif
380 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
381   #define PyObject_Malloc(s)   PyMem_Malloc(s)
382   #define PyObject_Free(p)     PyMem_Free(p)
383   #define PyObject_Realloc(p)  PyMem_Realloc(p)
384 #endif
385 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
386   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
387   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
388   #define PyMem_RawFree(p)             PyMem_Free(p)
389 #endif
390 #if CYTHON_COMPILING_IN_PYSTON
391   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
392   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
393 #else
394   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
395   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
396 #endif
397 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
398   #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #elif PY_VERSION_HEX >= 0x03060000
400   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
401 #elif PY_VERSION_HEX >= 0x03000000
402   #define __Pyx_PyThreadState_Current PyThreadState_GET()
403 #else
404   #define __Pyx_PyThreadState_Current _PyThreadState_Current
405 #endif
406 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
407 #include "pythread.h"
408 #define Py_tss_NEEDS_INIT 0
409 typedef int Py_tss_t;
410 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
411   *key = PyThread_create_key();
412   return 0;
413 }
414 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
415   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
416   *key = Py_tss_NEEDS_INIT;
417   return key;
418 }
419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
420   PyObject_Free(key);
421 }
422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423   return *key != Py_tss_NEEDS_INIT;
424 }
425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426   PyThread_delete_key(*key);
427   *key = Py_tss_NEEDS_INIT;
428 }
429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430   return PyThread_set_key_value(*key, value);
431 }
432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433   return PyThread_get_key_value(*key);
434 }
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
438 #else
439 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
440 #endif
441 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
442   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
443   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
444 #else
445   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
446   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
447 #endif
448 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
449 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
450 #else
451 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
452 #endif
453 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
454   #define CYTHON_PEP393_ENABLED 1
455   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
456                                               0 : _PyUnicode_Ready((PyObject *)(op)))
457   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
458   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
459   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
460   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
461   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
462   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
463   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
464   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
465   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
466   #else
467   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
468   #endif
469 #else
470   #define CYTHON_PEP393_ENABLED 0
471   #define PyUnicode_1BYTE_KIND  1
472   #define PyUnicode_2BYTE_KIND  2
473   #define PyUnicode_4BYTE_KIND  4
474   #define __Pyx_PyUnicode_READY(op)       (0)
475   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
476   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
477   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
478   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
479   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
480   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
481   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
482   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
483 #endif
484 #if CYTHON_COMPILING_IN_PYPY
485   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
486   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
487 #else
488   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
489   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
490       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
491 #endif
492 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
493   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
494 #endif
495 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
496   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
497 #endif
498 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
499   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
500 #endif
501 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
502 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
503 #if PY_MAJOR_VERSION >= 3
504   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
505 #else
506   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
507 #endif
508 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
509   #define PyObject_ASCII(o)            PyObject_Repr(o)
510 #endif
511 #if PY_MAJOR_VERSION >= 3
512   #define PyBaseString_Type            PyUnicode_Type
513   #define PyStringObject               PyUnicodeObject
514   #define PyString_Type                PyUnicode_Type
515   #define PyString_Check               PyUnicode_Check
516   #define PyString_CheckExact          PyUnicode_CheckExact
517 #ifndef PyObject_Unicode
518   #define PyObject_Unicode             PyObject_Str
519 #endif
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
523   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
524 #else
525   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
526   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
527 #endif
528 #ifndef PySet_CheckExact
529   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
530 #endif
531 #if PY_VERSION_HEX >= 0x030900A4
532   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
533   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
534 #else
535   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
536   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
537 #endif
538 #if CYTHON_ASSUME_SAFE_MACROS
539   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
540 #else
541   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
542 #endif
543 #if PY_MAJOR_VERSION >= 3
544   #define PyIntObject                  PyLongObject
545   #define PyInt_Type                   PyLong_Type
546   #define PyInt_Check(op)              PyLong_Check(op)
547   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
548   #define PyInt_FromString             PyLong_FromString
549   #define PyInt_FromUnicode            PyLong_FromUnicode
550   #define PyInt_FromLong               PyLong_FromLong
551   #define PyInt_FromSize_t             PyLong_FromSize_t
552   #define PyInt_FromSsize_t            PyLong_FromSsize_t
553   #define PyInt_AsLong                 PyLong_AsLong
554   #define PyInt_AS_LONG                PyLong_AS_LONG
555   #define PyInt_AsSsize_t              PyLong_AsSsize_t
556   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
557   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
558   #define PyNumber_Int                 PyNumber_Long
559 #endif
560 #if PY_MAJOR_VERSION >= 3
561   #define PyBoolObject                 PyLongObject
562 #endif
563 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
564   #ifndef PyUnicode_InternFromString
565     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
566   #endif
567 #endif
568 #if PY_VERSION_HEX < 0x030200A4
569   typedef long Py_hash_t;
570   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
571   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
572 #else
573   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
574   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
575 #endif
576 #if PY_MAJOR_VERSION >= 3
577   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
578 #else
579   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
580 #endif
581 #if CYTHON_USE_ASYNC_SLOTS
582   #if PY_VERSION_HEX >= 0x030500B1
583     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
584     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
585   #else
586     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
587   #endif
588 #else
589   #define __Pyx_PyType_AsAsync(obj) NULL
590 #endif
591 #ifndef __Pyx_PyAsyncMethodsStruct
592     typedef struct {
593         unaryfunc am_await;
594         unaryfunc am_aiter;
595         unaryfunc am_anext;
596     } __Pyx_PyAsyncMethodsStruct;
597 #endif
598
599 #if defined(WIN32) || defined(MS_WINDOWS)
600   #define _USE_MATH_DEFINES
601 #endif
602 #include <math.h>
603 #ifdef NAN
604 #define __PYX_NAN() ((float) NAN)
605 #else
606 static CYTHON_INLINE float __PYX_NAN() {
607   float value;
608   memset(&value, 0xFF, sizeof(value));
609   return value;
610 }
611 #endif
612 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
613 #define __Pyx_truncl trunc
614 #else
615 #define __Pyx_truncl truncl
616 #endif
617
618 #define __PYX_MARK_ERR_POS(f_index, lineno) \
619     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
620 #define __PYX_ERR(f_index, lineno, Ln_error) \
621     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
622
623 #ifndef __PYX_EXTERN_C
624   #ifdef __cplusplus
625     #define __PYX_EXTERN_C extern "C"
626   #else
627     #define __PYX_EXTERN_C extern
628   #endif
629 #endif
630
631 #define __PYX_HAVE__lxml__sax
632 #define __PYX_HAVE_API__lxml__sax
633 /* Early includes */
634 #ifdef _OPENMP
635 #include <omp.h>
636 #endif /* _OPENMP */
637
638 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
639 #define CYTHON_WITHOUT_ASSERTIONS
640 #endif
641
642 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
643                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
644
645 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
646 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
647 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
648 #define __PYX_DEFAULT_STRING_ENCODING ""
649 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
650 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
651 #define __Pyx_uchar_cast(c) ((unsigned char)c)
652 #define __Pyx_long_cast(x) ((long)x)
653 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
654     (sizeof(type) < sizeof(Py_ssize_t))  ||\
655     (sizeof(type) > sizeof(Py_ssize_t) &&\
656           likely(v < (type)PY_SSIZE_T_MAX ||\
657                  v == (type)PY_SSIZE_T_MAX)  &&\
658           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
659                                 v == (type)PY_SSIZE_T_MIN)))  ||\
660     (sizeof(type) == sizeof(Py_ssize_t) &&\
661           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
662                                v == (type)PY_SSIZE_T_MAX)))  )
663 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
664     return (size_t) i < (size_t) limit;
665 }
666 #if defined (__cplusplus) && __cplusplus >= 201103L
667     #include <cstdlib>
668     #define __Pyx_sst_abs(value) std::abs(value)
669 #elif SIZEOF_INT >= SIZEOF_SIZE_T
670     #define __Pyx_sst_abs(value) abs(value)
671 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
672     #define __Pyx_sst_abs(value) labs(value)
673 #elif defined (_MSC_VER)
674     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
675 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
676     #define __Pyx_sst_abs(value) llabs(value)
677 #elif defined (__GNUC__)
678     #define __Pyx_sst_abs(value) __builtin_llabs(value)
679 #else
680     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
681 #endif
682 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
683 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
684 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
685 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
686 #define __Pyx_PyBytes_FromString        PyBytes_FromString
687 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
688 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
689 #if PY_MAJOR_VERSION < 3
690     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
691     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
692 #else
693     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
694     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
695 #endif
696 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
697 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
698 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
699 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
700 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
701 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
702 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
703 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
704 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
705 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
706 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
707 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
708 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
709 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
710 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
711 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
712 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
713     const Py_UNICODE *u_end = u;
714     while (*u_end++) ;
715     return (size_t)(u_end - u - 1);
716 }
717 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
718 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
719 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
720 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
721 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
722 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
723 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
724 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
725 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
726 #define __Pyx_PySequence_Tuple(obj)\
727     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
728 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
729 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
730 #if CYTHON_ASSUME_SAFE_MACROS
731 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
732 #else
733 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
734 #endif
735 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
736 #if PY_MAJOR_VERSION >= 3
737 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
738 #else
739 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
740 #endif
741 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
742 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
743 static int __Pyx_sys_getdefaultencoding_not_ascii;
744 static int __Pyx_init_sys_getdefaultencoding_params(void) {
745     PyObject* sys;
746     PyObject* default_encoding = NULL;
747     PyObject* ascii_chars_u = NULL;
748     PyObject* ascii_chars_b = NULL;
749     const char* default_encoding_c;
750     sys = PyImport_ImportModule("sys");
751     if (!sys) goto bad;
752     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
753     Py_DECREF(sys);
754     if (!default_encoding) goto bad;
755     default_encoding_c = PyBytes_AsString(default_encoding);
756     if (!default_encoding_c) goto bad;
757     if (strcmp(default_encoding_c, "ascii") == 0) {
758         __Pyx_sys_getdefaultencoding_not_ascii = 0;
759     } else {
760         char ascii_chars[128];
761         int c;
762         for (c = 0; c < 128; c++) {
763             ascii_chars[c] = c;
764         }
765         __Pyx_sys_getdefaultencoding_not_ascii = 1;
766         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
767         if (!ascii_chars_u) goto bad;
768         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
769         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
770             PyErr_Format(
771                 PyExc_ValueError,
772                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
773                 default_encoding_c);
774             goto bad;
775         }
776         Py_DECREF(ascii_chars_u);
777         Py_DECREF(ascii_chars_b);
778     }
779     Py_DECREF(default_encoding);
780     return 0;
781 bad:
782     Py_XDECREF(default_encoding);
783     Py_XDECREF(ascii_chars_u);
784     Py_XDECREF(ascii_chars_b);
785     return -1;
786 }
787 #endif
788 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
789 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
790 #else
791 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
792 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
793 static char* __PYX_DEFAULT_STRING_ENCODING;
794 static int __Pyx_init_sys_getdefaultencoding_params(void) {
795     PyObject* sys;
796     PyObject* default_encoding = NULL;
797     char* default_encoding_c;
798     sys = PyImport_ImportModule("sys");
799     if (!sys) goto bad;
800     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
801     Py_DECREF(sys);
802     if (!default_encoding) goto bad;
803     default_encoding_c = PyBytes_AsString(default_encoding);
804     if (!default_encoding_c) goto bad;
805     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
806     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
807     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
808     Py_DECREF(default_encoding);
809     return 0;
810 bad:
811     Py_XDECREF(default_encoding);
812     return -1;
813 }
814 #endif
815 #endif
816
817
818 /* Test for GCC > 2.95 */
819 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
820   #define likely(x)   __builtin_expect(!!(x), 1)
821   #define unlikely(x) __builtin_expect(!!(x), 0)
822 #else /* !__GNUC__ or GCC < 2.95 */
823   #define likely(x)   (x)
824   #define unlikely(x) (x)
825 #endif /* __GNUC__ */
826 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
827
828 static PyObject *__pyx_m = NULL;
829 static PyObject *__pyx_d;
830 static PyObject *__pyx_b;
831 static PyObject *__pyx_cython_runtime = NULL;
832 static PyObject *__pyx_empty_tuple;
833 static PyObject *__pyx_empty_bytes;
834 static PyObject *__pyx_empty_unicode;
835 static int __pyx_lineno;
836 static int __pyx_clineno = 0;
837 static const char * __pyx_cfilenm= __FILE__;
838 static const char *__pyx_filename;
839
840
841 static const char *__pyx_f[] = {
842   "src/lxml/sax.py",
843   "stringsource",
844 };
845
846 /*--- Type declarations ---*/
847 struct __pyx_obj_4lxml_3sax_ElementTreeProducer;
848
849 /* "lxml/sax.pxd":7
850  * cdef tuple _getNsTag(tag)
851  * 
852  * cdef class ElementTreeProducer:             # <<<<<<<<<<<<<<
853  *     cdef _element
854  *     cdef _content_handler
855  */
856 struct __pyx_obj_4lxml_3sax_ElementTreeProducer {
857   PyObject_HEAD
858   struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtab;
859   PyObject *_element;
860   PyObject *_content_handler;
861   PyObject *_attr_class;
862   PyObject *_empty_attributes;
863 };
864
865
866
867 /* "lxml/sax.py":159
868  * 
869  * 
870  * class ElementTreeProducer(object):             # <<<<<<<<<<<<<<
871  *     """Produces SAX events for an element and children.
872  *     """
873  */
874
875 struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer {
876   PyObject *(*_recursive_saxify)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
877   PyObject *(*_build_qname)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
878 };
879 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
880 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
881 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
882
883 /* --- Runtime support code (head) --- */
884 /* Refnanny.proto */
885 #ifndef CYTHON_REFNANNY
886   #define CYTHON_REFNANNY 0
887 #endif
888 #if CYTHON_REFNANNY
889   typedef struct {
890     void (*INCREF)(void*, PyObject*, int);
891     void (*DECREF)(void*, PyObject*, int);
892     void (*GOTREF)(void*, PyObject*, int);
893     void (*GIVEREF)(void*, PyObject*, int);
894     void* (*SetupContext)(const char*, int, const char*);
895     void (*FinishContext)(void**);
896   } __Pyx_RefNannyAPIStruct;
897   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
898   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
899   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
900 #ifdef WITH_THREAD
901   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
902           if (acquire_gil) {\
903               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
904               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
905               PyGILState_Release(__pyx_gilstate_save);\
906           } else {\
907               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
908           }
909 #else
910   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
911           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
912 #endif
913   #define __Pyx_RefNannyFinishContext()\
914           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
915   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
916   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
917   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
918   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
919   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
920   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
921   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
922   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
923 #else
924   #define __Pyx_RefNannyDeclarations
925   #define __Pyx_RefNannySetupContext(name, acquire_gil)
926   #define __Pyx_RefNannyFinishContext()
927   #define __Pyx_INCREF(r) Py_INCREF(r)
928   #define __Pyx_DECREF(r) Py_DECREF(r)
929   #define __Pyx_GOTREF(r)
930   #define __Pyx_GIVEREF(r)
931   #define __Pyx_XINCREF(r) Py_XINCREF(r)
932   #define __Pyx_XDECREF(r) Py_XDECREF(r)
933   #define __Pyx_XGOTREF(r)
934   #define __Pyx_XGIVEREF(r)
935 #endif
936 #define __Pyx_XDECREF_SET(r, v) do {\
937         PyObject *tmp = (PyObject *) r;\
938         r = v; __Pyx_XDECREF(tmp);\
939     } while (0)
940 #define __Pyx_DECREF_SET(r, v) do {\
941         PyObject *tmp = (PyObject *) r;\
942         r = v; __Pyx_DECREF(tmp);\
943     } while (0)
944 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
945 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
946
947 /* PyObjectGetAttrStr.proto */
948 #if CYTHON_USE_TYPE_SLOTS
949 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
950 #else
951 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
952 #endif
953
954 /* GetBuiltinName.proto */
955 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
956
957 /* GetItemInt.proto */
958 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
959     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
960     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
961     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
962                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
963 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
964     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
965     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
966     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
967 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
968                                                               int wraparound, int boundscheck);
969 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
970     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
971     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
972     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
973 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
974                                                               int wraparound, int boundscheck);
975 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
976 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
977                                                      int is_list, int wraparound, int boundscheck);
978
979 /* IncludeStringH.proto */
980 #include <string.h>
981
982 /* BytesEquals.proto */
983 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
984
985 /* UnicodeEquals.proto */
986 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
987
988 /* StrEquals.proto */
989 #if PY_MAJOR_VERSION >= 3
990 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
991 #else
992 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
993 #endif
994
995 /* SliceObject.proto */
996 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
997         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
998         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
999         int has_cstart, int has_cstop, int wraparound);
1000
1001 /* PyObjectCall.proto */
1002 #if CYTHON_COMPILING_IN_CPYTHON
1003 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1004 #else
1005 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1006 #endif
1007
1008 /* RaiseDoubleKeywords.proto */
1009 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1010
1011 /* ParseKeywords.proto */
1012 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1013     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1014     const char* function_name);
1015
1016 /* RaiseArgTupleInvalid.proto */
1017 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1018     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1019
1020 /* PyDictVersioning.proto */
1021 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1022 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1023 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1024 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1025     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1026     (cache_var) = (value);
1027 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1028     static PY_UINT64_T __pyx_dict_version = 0;\
1029     static PyObject *__pyx_dict_cached_value = NULL;\
1030     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1031         (VAR) = __pyx_dict_cached_value;\
1032     } else {\
1033         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1034         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1035     }\
1036 }
1037 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1038 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1039 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1040 #else
1041 #define __PYX_GET_DICT_VERSION(dict)  (0)
1042 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1043 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1044 #endif
1045
1046 /* GetModuleGlobalName.proto */
1047 #if CYTHON_USE_DICT_VERSIONS
1048 #define __Pyx_GetModuleGlobalName(var, name)  {\
1049     static PY_UINT64_T __pyx_dict_version = 0;\
1050     static PyObject *__pyx_dict_cached_value = NULL;\
1051     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1052         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1053         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1054 }
1055 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1056     PY_UINT64_T __pyx_dict_version;\
1057     PyObject *__pyx_dict_cached_value;\
1058     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1059 }
1060 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1061 #else
1062 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1063 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1064 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1065 #endif
1066
1067 /* PyCFunctionFastCall.proto */
1068 #if CYTHON_FAST_PYCCALL
1069 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1070 #else
1071 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1072 #endif
1073
1074 /* PyFunctionFastCall.proto */
1075 #if CYTHON_FAST_PYCALL
1076 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1077     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1078 #if 1 || PY_VERSION_HEX < 0x030600B1
1079 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1080 #else
1081 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1082 #endif
1083 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1084     (sizeof(char [1 - 2*!(cond)]) - 1)
1085 #ifndef Py_MEMBER_SIZE
1086 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1087 #endif
1088   static size_t __pyx_pyframe_localsplus_offset = 0;
1089   #include "frameobject.h"
1090   #define __Pxy_PyFrame_Initialize_Offsets()\
1091     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1092      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1093   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1094     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1095 #endif
1096
1097 /* PyObjectCall2Args.proto */
1098 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1099
1100 /* PyObjectCallMethO.proto */
1101 #if CYTHON_COMPILING_IN_CPYTHON
1102 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1103 #endif
1104
1105 /* PyObjectCallOneArg.proto */
1106 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1107
1108 /* PyObjectSetAttrStr.proto */
1109 #if CYTHON_USE_TYPE_SLOTS
1110 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1111 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1112 #else
1113 #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
1114 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1115 #endif
1116
1117 /* ListAppend.proto */
1118 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1119 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1120     PyListObject* L = (PyListObject*) list;
1121     Py_ssize_t len = Py_SIZE(list);
1122     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1123         Py_INCREF(x);
1124         PyList_SET_ITEM(list, len, x);
1125         __Pyx_SET_SIZE(list, len + 1);
1126         return 0;
1127     }
1128     return PyList_Append(list, x);
1129 }
1130 #else
1131 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1132 #endif
1133
1134 /* PyObjectGetMethod.proto */
1135 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1136
1137 /* PyObjectCallMethod1.proto */
1138 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1139
1140 /* append.proto */
1141 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1142
1143 /* ObjectGetItem.proto */
1144 #if CYTHON_USE_TYPE_SLOTS
1145 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1146 #else
1147 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1148 #endif
1149
1150 /* GetTopmostException.proto */
1151 #if CYTHON_USE_EXC_INFO_STACK
1152 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1153 #endif
1154
1155 /* PyThreadStateGet.proto */
1156 #if CYTHON_FAST_THREAD_STATE
1157 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1158 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1159 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1160 #else
1161 #define __Pyx_PyThreadState_declare
1162 #define __Pyx_PyThreadState_assign
1163 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1164 #endif
1165
1166 /* SaveResetException.proto */
1167 #if CYTHON_FAST_THREAD_STATE
1168 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1169 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1170 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1171 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1172 #else
1173 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1174 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1175 #endif
1176
1177 /* PyErrExceptionMatches.proto */
1178 #if CYTHON_FAST_THREAD_STATE
1179 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1180 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1181 #else
1182 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1183 #endif
1184
1185 /* GetException.proto */
1186 #if CYTHON_FAST_THREAD_STATE
1187 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1188 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1189 #else
1190 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1191 #endif
1192
1193 /* PyObjectCallNoArg.proto */
1194 #if CYTHON_COMPILING_IN_CPYTHON
1195 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1196 #else
1197 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1198 #endif
1199
1200 /* PyObjectCallMethod0.proto */
1201 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1202
1203 /* pop.proto */
1204 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1205 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1206 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1207 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1208     __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1209 #else
1210 #define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
1211 #define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
1212 #endif
1213
1214 /* UnpackUnboundCMethod.proto */
1215 typedef struct {
1216     PyObject *type;
1217     PyObject **method_name;
1218     PyCFunction func;
1219     PyObject *method;
1220     int flag;
1221 } __Pyx_CachedCFunction;
1222
1223 /* CallUnboundCMethod0.proto */
1224 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1225 #if CYTHON_COMPILING_IN_CPYTHON
1226 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1227     (likely((cfunc)->func) ?\
1228         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1229          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1230             (PY_VERSION_HEX >= 0x030700A0 ?\
1231                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1232                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1233           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1234             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1235             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1236                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1237                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1238         __Pyx__CallUnboundCMethod0(cfunc, self))
1239 #else
1240 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1241 #endif
1242
1243 /* RaiseTooManyValuesToUnpack.proto */
1244 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1245
1246 /* RaiseNeedMoreValuesToUnpack.proto */
1247 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1248
1249 /* IterFinish.proto */
1250 static CYTHON_INLINE int __Pyx_IterFinish(void);
1251
1252 /* UnpackItemEndCheck.proto */
1253 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1254
1255 /* GetAttr.proto */
1256 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1257
1258 /* HasAttr.proto */
1259 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1260
1261 /* SliceObject.proto */
1262 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1263     __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1264 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1265         PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1266         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1267         int has_cstart, int has_cstop, int wraparound);
1268
1269 /* PyErrFetchRestore.proto */
1270 #if CYTHON_FAST_THREAD_STATE
1271 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1272 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1273 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1274 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1275 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1276 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1277 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1278 #if CYTHON_COMPILING_IN_CPYTHON
1279 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1280 #else
1281 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1282 #endif
1283 #else
1284 #define __Pyx_PyErr_Clear() PyErr_Clear()
1285 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1286 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1287 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1288 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1289 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1290 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1291 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1292 #endif
1293
1294 /* RaiseException.proto */
1295 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1296
1297 /* ListCompAppend.proto */
1298 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1299 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1300     PyListObject* L = (PyListObject*) list;
1301     Py_ssize_t len = Py_SIZE(list);
1302     if (likely(L->allocated > len)) {
1303         Py_INCREF(x);
1304         PyList_SET_ITEM(list, len, x);
1305         __Pyx_SET_SIZE(list, len + 1);
1306         return 0;
1307     }
1308     return PyList_Append(list, x);
1309 }
1310 #else
1311 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1312 #endif
1313
1314 /* Import.proto */
1315 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1316
1317 /* ImportFrom.proto */
1318 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1319
1320 /* GetAttr3.proto */
1321 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1322
1323 /* py_dict_items.proto */
1324 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1325
1326 /* dict_getitem_default.proto */
1327 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1328
1329 /* CallUnboundCMethod1.proto */
1330 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1331 #if CYTHON_COMPILING_IN_CPYTHON
1332 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1333 #else
1334 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1335 #endif
1336
1337 /* CallUnboundCMethod2.proto */
1338 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1339 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1340 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1341 #else
1342 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1343 #endif
1344
1345 /* RaiseNoneIterError.proto */
1346 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1347
1348 /* PyObject_GenericGetAttrNoDict.proto */
1349 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1350 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1351 #else
1352 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1353 #endif
1354
1355 /* PyObject_GenericGetAttr.proto */
1356 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1357 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1358 #else
1359 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1360 #endif
1361
1362 /* SetVTable.proto */
1363 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1364
1365 /* PyObjectGetAttrStrNoError.proto */
1366 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1367
1368 /* SetupReduce.proto */
1369 static int __Pyx_setup_reduce(PyObject* type_obj);
1370
1371 /* CalculateMetaclass.proto */
1372 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1373
1374 /* Py3ClassCreate.proto */
1375 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1376                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1377 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1378                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1379
1380 /* FetchCommonType.proto */
1381 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1382
1383 /* CythonFunctionShared.proto */
1384 #define __Pyx_CyFunction_USED 1
1385 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1386 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1387 #define __Pyx_CYFUNCTION_CCLASS        0x04
1388 #define __Pyx_CyFunction_GetClosure(f)\
1389     (((__pyx_CyFunctionObject *) (f))->func_closure)
1390 #define __Pyx_CyFunction_GetClassObj(f)\
1391     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1392 #define __Pyx_CyFunction_Defaults(type, f)\
1393     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1394 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1395     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1396 typedef struct {
1397     PyCFunctionObject func;
1398 #if PY_VERSION_HEX < 0x030500A0
1399     PyObject *func_weakreflist;
1400 #endif
1401     PyObject *func_dict;
1402     PyObject *func_name;
1403     PyObject *func_qualname;
1404     PyObject *func_doc;
1405     PyObject *func_globals;
1406     PyObject *func_code;
1407     PyObject *func_closure;
1408     PyObject *func_classobj;
1409     void *defaults;
1410     int defaults_pyobjects;
1411     size_t defaults_size;  // used by FusedFunction for copying defaults
1412     int flags;
1413     PyObject *defaults_tuple;
1414     PyObject *defaults_kwdict;
1415     PyObject *(*defaults_getter)(PyObject *);
1416     PyObject *func_annotations;
1417 } __pyx_CyFunctionObject;
1418 static PyTypeObject *__pyx_CyFunctionType = 0;
1419 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1420 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1421                                       int flags, PyObject* qualname,
1422                                       PyObject *self,
1423                                       PyObject *module, PyObject *globals,
1424                                       PyObject* code);
1425 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1426                                                          size_t size,
1427                                                          int pyobjects);
1428 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1429                                                             PyObject *tuple);
1430 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1431                                                              PyObject *dict);
1432 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1433                                                               PyObject *dict);
1434 static int __pyx_CyFunction_init(void);
1435
1436 /* CythonFunction.proto */
1437 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1438                                       int flags, PyObject* qualname,
1439                                       PyObject *closure,
1440                                       PyObject *module, PyObject *globals,
1441                                       PyObject* code);
1442
1443 /* SetNameInClass.proto */
1444 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1445 #define __Pyx_SetNameInClass(ns, name, value)\
1446     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1447 #elif CYTHON_COMPILING_IN_CPYTHON
1448 #define __Pyx_SetNameInClass(ns, name, value)\
1449     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1450 #else
1451 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1452 #endif
1453
1454 /* RegisterModuleCleanup.proto */
1455 static void __pyx_module_cleanup(PyObject *self);
1456 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1457 static int __Pyx_RegisterCleanup(void);
1458 #else
1459 #define __Pyx_RegisterCleanup() (0)
1460 #endif
1461
1462 /* CLineInTraceback.proto */
1463 #ifdef CYTHON_CLINE_IN_TRACEBACK
1464 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1465 #else
1466 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1467 #endif
1468
1469 /* CodeObjectCache.proto */
1470 typedef struct {
1471     PyCodeObject* code_object;
1472     int code_line;
1473 } __Pyx_CodeObjectCacheEntry;
1474 struct __Pyx_CodeObjectCache {
1475     int count;
1476     int max_count;
1477     __Pyx_CodeObjectCacheEntry* entries;
1478 };
1479 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1480 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1481 static PyCodeObject *__pyx_find_code_object(int code_line);
1482 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1483
1484 /* AddTraceback.proto */
1485 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1486                                int py_line, const char *filename);
1487
1488 /* CIntToPy.proto */
1489 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1490
1491 /* CIntFromPy.proto */
1492 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1493
1494 /* CIntFromPy.proto */
1495 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1496
1497 /* FastTypeChecks.proto */
1498 #if CYTHON_COMPILING_IN_CPYTHON
1499 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1500 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1501 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1502 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1503 #else
1504 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1505 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1506 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1507 #endif
1508 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1509
1510 /* CheckBinaryVersion.proto */
1511 static int __Pyx_check_binary_version(void);
1512
1513 /* FunctionExport.proto */
1514 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1515
1516 /* InitStrings.proto */
1517 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1518
1519 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_parent_nsmap); /* proto*/
1520 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(CYTHON_UNUSED struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_ns_uri, PyObject *__pyx_v_local_name, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_preferred_prefix, int __pyx_v_is_attribute); /* proto*/
1521
1522 /* Module declarations from 'cython' */
1523
1524 /* Module declarations from 'lxml.sax' */
1525 static PyTypeObject *__pyx_ptype_4lxml_3sax_ElementTreeProducer = 0;
1526 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *); /*proto*/
1527 static PyObject *__pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *); /*proto*/
1528 #define __Pyx_MODULE_NAME "lxml.sax"
1529 extern int __pyx_module_is_main_lxml__sax;
1530 int __pyx_module_is_main_lxml__sax = 0;
1531
1532 /* Implementation of 'lxml.sax' */
1533 static PyObject *__pyx_builtin_property;
1534 static PyObject *__pyx_builtin_KeyError;
1535 static PyObject *__pyx_builtin_AttributeError;
1536 static PyObject *__pyx_builtin_IndexError;
1537 static PyObject *__pyx_builtin_min;
1538 static const char __pyx_k_[] = "{";
1539   static const char __pyx_k_k[] = "k";
1540   static const char __pyx_k_v[] = "v";
1541 static const char __pyx_k__3[] = "}";
1542 static const char __pyx_k__6[] = "";
1543 static const char __pyx_k__8[] = ":";
1544 static const char __pyx_k_pi[] = "pi";
1545 static const char __pyx_k_doc[] = "__doc__";
1546 static const char __pyx_k_get[] = "get";
1547 static const char __pyx_k_min[] = "min";
1548 static const char __pyx_k_new[] = "__new__";
1549 static const char __pyx_k_pop[] = "pop";
1550 static const char __pyx_k_s_s[] = "{%s}%s";
1551 static const char __pyx_k_tag[] = "tag";
1552 static const char __pyx_k_uri[] = "uri";
1553 static const char __pyx_k_data[] = "data";
1554 static const char __pyx_k_dict[] = "__dict__";
1555 static const char __pyx_k_init[] = "__init__";
1556 static const char __pyx_k_lxml[] = "lxml";
1557 static const char __pyx_k_main[] = "__main__";
1558 static const char __pyx_k_name[] = "name";
1559 static const char __pyx_k_root[] = "_root";
1560 static const char __pyx_k_self[] = "self";
1561 static const char __pyx_k_tail[] = "tail";
1562 static const char __pyx_k_test[] = "__test__";
1563 static const char __pyx_k_text[] = "text";
1564 static const char __pyx_k_attrs[] = "attrs";
1565 static const char __pyx_k_clear[] = "clear";
1566 static const char __pyx_k_doc_2[] = "doc";
1567 static const char __pyx_k_etree[] = "etree";
1568 static const char __pyx_k_items[] = "items";
1569 static const char __pyx_k_nsmap[] = "nsmap";
1570 static const char __pyx_k_qname[] = "qname";
1571 static const char __pyx_k_split[] = "split";
1572 static const char __pyx_k_state[] = "state";
1573 static const char __pyx_k_value[] = "value";
1574 static const char __pyx_k_append[] = "append";
1575 static const char __pyx_k_dict_2[] = "_dict";
1576 static const char __pyx_k_el_tag[] = "el_tag";
1577 static const char __pyx_k_import[] = "__import__";
1578 static const char __pyx_k_module[] = "__module__";
1579 static const char __pyx_k_name_2[] = "__name__";
1580 static const char __pyx_k_ns_uri[] = "ns_uri";
1581 static const char __pyx_k_pickle[] = "pickle";
1582 static const char __pyx_k_prefix[] = "prefix";
1583 static const char __pyx_k_reduce[] = "__reduce__";
1584 static const char __pyx_k_saxify[] = "saxify";
1585 static const char __pyx_k_target[] = "target";
1586 static const char __pyx_k_update[] = "update";
1587 static const char __pyx_k_Comment[] = "Comment";
1588 static const char __pyx_k_Element[] = "Element";
1589 static const char __pyx_k_el_name[] = "el_name";
1590 static const char __pyx_k_element[] = "element";
1591 static const char __pyx_k_getnext[] = "getnext";
1592 static const char __pyx_k_getroot[] = "getroot";
1593 static const char __pyx_k_locator[] = "locator";
1594 static const char __pyx_k_ns_name[] = "ns_name";
1595 static const char __pyx_k_prepare[] = "__prepare__";
1596 static const char __pyx_k_sibling[] = "sibling";
1597 static const char __pyx_k_KeyError[] = "KeyError";
1598 static const char __pyx_k_SaxError[] = "SaxError";
1599 static const char __pyx_k_buildTag[] = "_buildTag";
1600 static const char __pyx_k_getstate[] = "__getstate__";
1601 static const char __pyx_k_lxml_sax[] = "lxml.sax";
1602 static const char __pyx_k_property[] = "property";
1603 static const char __pyx_k_pyx_type[] = "__pyx_type";
1604 static const char __pyx_k_qualname[] = "__qualname__";
1605 static const char __pyx_k_setstate[] = "__setstate__";
1606 static const char __pyx_k_siblings[] = "siblings";
1607 static const char __pyx_k_LxmlError[] = "LxmlError";
1608 static const char __pyx_k_attr_name[] = "attr_name";
1609 static const char __pyx_k_get_etree[] = "_get_etree";
1610 static const char __pyx_k_iteritems[] = "iteritems";
1611 static const char __pyx_k_metaclass[] = "__metaclass__";
1612 static const char __pyx_k_pyx_state[] = "__pyx_state";
1613 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1614 static const char __pyx_k_IndexError[] = "IndexError";
1615 static const char __pyx_k_SubElement[] = "SubElement";
1616 static const char __pyx_k_attributes[] = "attributes";
1617 static const char __pyx_k_characters[] = "characters";
1618 static const char __pyx_k_default_ns[] = "_default_ns";
1619 static const char __pyx_k_endElement[] = "endElement";
1620 static const char __pyx_k_local_name[] = "local_name";
1621 static const char __pyx_k_lxml_etree[] = "lxml.etree";
1622 static const char __pyx_k_name_tuple[] = "name_tuple";
1623 static const char __pyx_k_ns_mapping[] = "_ns_mapping";
1624 static const char __pyx_k_pyx_result[] = "__pyx_result";
1625 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1626 static const char __pyx_k_ElementTree[] = "ElementTree";
1627 static const char __pyx_k_PickleError[] = "PickleError";
1628 static const char __pyx_k_addprevious[] = "addprevious";
1629 static const char __pyx_k_endDocument[] = "endDocument";
1630 static const char __pyx_k_getprevious[] = "getprevious";
1631 static const char __pyx_k_makeelement[] = "makeelement";
1632 static const char __pyx_k_ns_uri_list[] = "ns_uri_list";
1633 static const char __pyx_k_endElementNS[] = "endElementNS";
1634 static const char __pyx_k_last_element[] = "last_element";
1635 static const char __pyx_k_new_mappings[] = "_new_mappings";
1636 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1637 static const char __pyx_k_startElement[] = "startElement";
1638 static const char __pyx_k_stringsource[] = "stringsource";
1639 static const char __pyx_k_use_setstate[] = "use_setstate";
1640 static const char __pyx_k_element_stack[] = "_element_stack";
1641 static const char __pyx_k_makeelement_2[] = "_makeelement";
1642 static const char __pyx_k_ns_name_tuple[] = "ns_name_tuple";
1643 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1644 static const char __pyx_k_root_siblings[] = "_root_siblings";
1645 static const char __pyx_k_startDocument[] = "startDocument";
1646 static const char __pyx_k_AttributeError[] = "AttributeError";
1647 static const char __pyx_k_ContentHandler[] = "ContentHandler";
1648 static const char __pyx_k_startElementNS[] = "startElementNS";
1649 static const char __pyx_k_content_handler[] = "content_handler";
1650 static const char __pyx_k_element_or_tree[] = "element_or_tree";
1651 static const char __pyx_k_element_stack_2[] = "element_stack";
1652 static const char __pyx_k_iter_attributes[] = "iter_attributes";
1653 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1654 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1655 static const char __pyx_k_src_lxml_sax_py[] = "src/lxml/sax.py";
1656 static const char __pyx_k_xml_sax_handler[] = "xml.sax.handler";
1657 static const char __pyx_k_AttributesNSImpl[] = "AttributesNSImpl";
1658 static const char __pyx_k_endPrefixMapping[] = "endPrefixMapping";
1659 static const char __pyx_k_General_SAX_error[] = "General SAX error.\n    ";
1660 static const char __pyx_k_xml_sax_xmlreader[] = "xml.sax.xmlreader";
1661 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1662 static const char __pyx_k_setDocumentLocator[] = "setDocumentLocator";
1663 static const char __pyx_k_startPrefixMapping[] = "startPrefixMapping";
1664 static const char __pyx_k_ElementTreeProducer[] = "ElementTreeProducer";
1665 static const char __pyx_k_ignorableWhitespace[] = "ignorableWhitespace";
1666 static const char __pyx_k_ProcessingInstruction[] = "ProcessingInstruction";
1667 static const char __pyx_k_processingInstruction[] = "processingInstruction";
1668 static const char __pyx_k_ElementTreeContentHandler[] = "ElementTreeContentHandler";
1669 static const char __pyx_k_Unexpected_element_closed[] = "Unexpected element closed: ";
1670 static const char __pyx_k_ElementTreeProducer_saxify[] = "ElementTreeProducer.saxify";
1671 static const char __pyx_k_pyx_unpickle_ElementTreeProduc[] = "__pyx_unpickle_ElementTreeProducer";
1672 static const char __pyx_k_SAX_based_adapter_to_copy_trees[] = "\nSAX-based adapter to copy trees from/to the Python standard library.\n\nUse the `ElementTreeContentHandler` class to build an ElementTree from\nSAX events.\n\nUse the `ElementTreeProducer` class or the `saxify()` function to fire\nthe SAX events of an ElementTree against a SAX ContentHandler.\n\nSee http://codespeak.net/lxml/sax.html\n";
1673 static const char __pyx_k_Build_an_lxml_ElementTree_from_S[] = "Build an lxml ElementTree from SAX events.\n    ";
1674 static const char __pyx_k_ElementTreeContentHandler___init[] = "ElementTreeContentHandler.__init__";
1675 static const char __pyx_k_ElementTreeContentHandler__build[] = "ElementTreeContentHandler._buildTag";
1676 static const char __pyx_k_ElementTreeContentHandler__get_e[] = "ElementTreeContentHandler._get_etree";
1677 static const char __pyx_k_ElementTreeContentHandler_charac[] = "ElementTreeContentHandler.characters";
1678 static const char __pyx_k_ElementTreeContentHandler_endDoc[] = "ElementTreeContentHandler.endDocument";
1679 static const char __pyx_k_ElementTreeContentHandler_endEle[] = "ElementTreeContentHandler.endElementNS";
1680 static const char __pyx_k_ElementTreeContentHandler_endPre[] = "ElementTreeContentHandler.endPrefixMapping";
1681 static const char __pyx_k_ElementTreeContentHandler_proces[] = "ElementTreeContentHandler.processingInstruction";
1682 static const char __pyx_k_ElementTreeContentHandler_setDoc[] = "ElementTreeContentHandler.setDocumentLocator";
1683 static const char __pyx_k_ElementTreeContentHandler_startD[] = "ElementTreeContentHandler.startDocument";
1684 static const char __pyx_k_ElementTreeContentHandler_startE[] = "ElementTreeContentHandler.startElementNS";
1685 static const char __pyx_k_ElementTreeContentHandler_startP[] = "ElementTreeContentHandler.startPrefixMapping";
1686 static const char __pyx_k_ElementTreeProducer___reduce_cyt[] = "ElementTreeProducer.__reduce_cython__";
1687 static const char __pyx_k_ElementTreeProducer___setstate_c[] = "ElementTreeProducer.__setstate_cython__";
1688 static const char __pyx_k_Incompatible_checksums_s_vs_0x1d[] = "Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))";
1689 static const char __pyx_k_ElementTreeContentHandler_endEle_2[] = "ElementTreeContentHandler.endElement";
1690 static const char __pyx_k_ElementTreeContentHandler_startE_2[] = "ElementTreeContentHandler.startElement";
1691 static PyObject *__pyx_kp_s_;
1692 static PyObject *__pyx_n_s_AttributeError;
1693 static PyObject *__pyx_n_s_AttributesNSImpl;
1694 static PyObject *__pyx_kp_s_Build_an_lxml_ElementTree_from_S;
1695 static PyObject *__pyx_n_s_Comment;
1696 static PyObject *__pyx_n_s_ContentHandler;
1697 static PyObject *__pyx_n_s_Element;
1698 static PyObject *__pyx_n_s_ElementTree;
1699 static PyObject *__pyx_n_s_ElementTreeContentHandler;
1700 static PyObject *__pyx_n_s_ElementTreeContentHandler___init;
1701 static PyObject *__pyx_n_s_ElementTreeContentHandler__build;
1702 static PyObject *__pyx_n_s_ElementTreeContentHandler__get_e;
1703 static PyObject *__pyx_n_s_ElementTreeContentHandler_charac;
1704 static PyObject *__pyx_n_s_ElementTreeContentHandler_endDoc;
1705 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle;
1706 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle_2;
1707 static PyObject *__pyx_n_s_ElementTreeContentHandler_endPre;
1708 static PyObject *__pyx_n_s_ElementTreeContentHandler_proces;
1709 static PyObject *__pyx_n_s_ElementTreeContentHandler_setDoc;
1710 static PyObject *__pyx_n_s_ElementTreeContentHandler_startD;
1711 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE;
1712 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE_2;
1713 static PyObject *__pyx_n_s_ElementTreeContentHandler_startP;
1714 static PyObject *__pyx_n_s_ElementTreeProducer;
1715 static PyObject *__pyx_n_s_ElementTreeProducer___reduce_cyt;
1716 static PyObject *__pyx_n_s_ElementTreeProducer___setstate_c;
1717 static PyObject *__pyx_n_s_ElementTreeProducer_saxify;
1718 static PyObject *__pyx_kp_s_General_SAX_error;
1719 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x1d;
1720 static PyObject *__pyx_n_s_IndexError;
1721 static PyObject *__pyx_n_s_KeyError;
1722 static PyObject *__pyx_n_s_LxmlError;
1723 static PyObject *__pyx_n_s_PickleError;
1724 static PyObject *__pyx_n_s_ProcessingInstruction;
1725 static PyObject *__pyx_n_s_SaxError;
1726 static PyObject *__pyx_n_s_SubElement;
1727 static PyObject *__pyx_kp_s_Unexpected_element_closed;
1728 static PyObject *__pyx_kp_s__3;
1729 static PyObject *__pyx_kp_s__6;
1730 static PyObject *__pyx_kp_s__8;
1731 static PyObject *__pyx_n_s_addprevious;
1732 static PyObject *__pyx_n_s_append;
1733 static PyObject *__pyx_n_s_attr_name;
1734 static PyObject *__pyx_n_s_attributes;
1735 static PyObject *__pyx_n_s_attrs;
1736 static PyObject *__pyx_n_s_buildTag;
1737 static PyObject *__pyx_n_s_characters;
1738 static PyObject *__pyx_n_s_clear;
1739 static PyObject *__pyx_n_s_cline_in_traceback;
1740 static PyObject *__pyx_n_s_content_handler;
1741 static PyObject *__pyx_n_s_data;
1742 static PyObject *__pyx_n_s_default_ns;
1743 static PyObject *__pyx_n_s_dict;
1744 static PyObject *__pyx_n_s_dict_2;
1745 static PyObject *__pyx_n_s_doc;
1746 static PyObject *__pyx_n_s_doc_2;
1747 static PyObject *__pyx_n_s_el_name;
1748 static PyObject *__pyx_n_s_el_tag;
1749 static PyObject *__pyx_n_s_element;
1750 static PyObject *__pyx_n_s_element_or_tree;
1751 static PyObject *__pyx_n_s_element_stack;
1752 static PyObject *__pyx_n_s_element_stack_2;
1753 static PyObject *__pyx_n_s_endDocument;
1754 static PyObject *__pyx_n_s_endElement;
1755 static PyObject *__pyx_n_s_endElementNS;
1756 static PyObject *__pyx_n_s_endPrefixMapping;
1757 static PyObject *__pyx_n_s_etree;
1758 static PyObject *__pyx_n_s_get;
1759 static PyObject *__pyx_n_s_get_etree;
1760 static PyObject *__pyx_n_s_getnext;
1761 static PyObject *__pyx_n_s_getprevious;
1762 static PyObject *__pyx_n_s_getroot;
1763 static PyObject *__pyx_n_s_getstate;
1764 static PyObject *__pyx_n_s_ignorableWhitespace;
1765 static PyObject *__pyx_n_s_import;
1766 static PyObject *__pyx_n_s_init;
1767 static PyObject *__pyx_n_s_items;
1768 static PyObject *__pyx_n_s_iter_attributes;
1769 static PyObject *__pyx_n_s_iteritems;
1770 static PyObject *__pyx_n_s_k;
1771 static PyObject *__pyx_n_s_last_element;
1772 static PyObject *__pyx_n_s_local_name;
1773 static PyObject *__pyx_n_s_locator;
1774 static PyObject *__pyx_n_s_lxml;
1775 static PyObject *__pyx_n_s_lxml_etree;
1776 static PyObject *__pyx_n_s_lxml_sax;
1777 static PyObject *__pyx_n_s_main;
1778 static PyObject *__pyx_n_s_makeelement;
1779 static PyObject *__pyx_n_s_makeelement_2;
1780 static PyObject *__pyx_n_s_metaclass;
1781 static PyObject *__pyx_n_s_min;
1782 static PyObject *__pyx_n_s_module;
1783 static PyObject *__pyx_n_s_name;
1784 static PyObject *__pyx_n_s_name_2;
1785 static PyObject *__pyx_n_s_name_tuple;
1786 static PyObject *__pyx_n_s_new;
1787 static PyObject *__pyx_n_s_new_mappings;
1788 static PyObject *__pyx_n_s_ns_mapping;
1789 static PyObject *__pyx_n_s_ns_name;
1790 static PyObject *__pyx_n_s_ns_name_tuple;
1791 static PyObject *__pyx_n_s_ns_uri;
1792 static PyObject *__pyx_n_s_ns_uri_list;
1793 static PyObject *__pyx_n_s_nsmap;
1794 static PyObject *__pyx_n_s_pi;
1795 static PyObject *__pyx_n_s_pickle;
1796 static PyObject *__pyx_n_s_pop;
1797 static PyObject *__pyx_n_s_prefix;
1798 static PyObject *__pyx_n_s_prepare;
1799 static PyObject *__pyx_n_s_processingInstruction;
1800 static PyObject *__pyx_n_s_property;
1801 static PyObject *__pyx_n_s_pyx_PickleError;
1802 static PyObject *__pyx_n_s_pyx_checksum;
1803 static PyObject *__pyx_n_s_pyx_result;
1804 static PyObject *__pyx_n_s_pyx_state;
1805 static PyObject *__pyx_n_s_pyx_type;
1806 static PyObject *__pyx_n_s_pyx_unpickle_ElementTreeProduc;
1807 static PyObject *__pyx_n_s_pyx_vtable;
1808 static PyObject *__pyx_n_s_qname;
1809 static PyObject *__pyx_n_s_qualname;
1810 static PyObject *__pyx_n_s_reduce;
1811 static PyObject *__pyx_n_s_reduce_cython;
1812 static PyObject *__pyx_n_s_reduce_ex;
1813 static PyObject *__pyx_n_s_root;
1814 static PyObject *__pyx_n_s_root_siblings;
1815 static PyObject *__pyx_kp_s_s_s;
1816 static PyObject *__pyx_n_s_saxify;
1817 static PyObject *__pyx_n_s_self;
1818 static PyObject *__pyx_n_s_setDocumentLocator;
1819 static PyObject *__pyx_n_s_setstate;
1820 static PyObject *__pyx_n_s_setstate_cython;
1821 static PyObject *__pyx_n_s_sibling;
1822 static PyObject *__pyx_n_s_siblings;
1823 static PyObject *__pyx_n_s_split;
1824 static PyObject *__pyx_kp_s_src_lxml_sax_py;
1825 static PyObject *__pyx_n_s_startDocument;
1826 static PyObject *__pyx_n_s_startElement;
1827 static PyObject *__pyx_n_s_startElementNS;
1828 static PyObject *__pyx_n_s_startPrefixMapping;
1829 static PyObject *__pyx_n_s_state;
1830 static PyObject *__pyx_kp_s_stringsource;
1831 static PyObject *__pyx_n_s_tag;
1832 static PyObject *__pyx_n_s_tail;
1833 static PyObject *__pyx_n_s_target;
1834 static PyObject *__pyx_n_s_test;
1835 static PyObject *__pyx_n_s_text;
1836 static PyObject *__pyx_n_s_update;
1837 static PyObject *__pyx_n_s_uri;
1838 static PyObject *__pyx_n_s_use_setstate;
1839 static PyObject *__pyx_n_s_v;
1840 static PyObject *__pyx_n_s_value;
1841 static PyObject *__pyx_n_s_xml_sax_handler;
1842 static PyObject *__pyx_n_s_xml_sax_xmlreader;
1843 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement); /* proto */
1844 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1845 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_locator); /* proto */
1846 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1847 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1848 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri); /* proto */
1849 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1850 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name_tuple); /* proto */
1851 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname, PyObject *__pyx_v_attributes); /* proto */
1852 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data); /* proto */
1853 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname); /* proto */
1854 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attributes); /* proto */
1855 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
1856 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
1857 static int __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler); /* proto */
1858 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1859 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1860 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1861 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler); /* proto */
1862 static PyObject *__pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1863 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1864 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
1865 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
1866 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
1867 static PyObject *__pyx_int_1;
1868 static PyObject *__pyx_int_30712058;
1869 static PyObject *__pyx_int_neg_1;
1870 static PyObject *__pyx_slice__2;
1871 static PyObject *__pyx_slice__5;
1872 static PyObject *__pyx_slice__7;
1873 static PyObject *__pyx_tuple__4;
1874 static PyObject *__pyx_tuple__9;
1875 static PyObject *__pyx_tuple__11;
1876 static PyObject *__pyx_tuple__12;
1877 static PyObject *__pyx_tuple__14;
1878 static PyObject *__pyx_tuple__16;
1879 static PyObject *__pyx_tuple__18;
1880 static PyObject *__pyx_tuple__20;
1881 static PyObject *__pyx_tuple__22;
1882 static PyObject *__pyx_tuple__24;
1883 static PyObject *__pyx_tuple__26;
1884 static PyObject *__pyx_tuple__28;
1885 static PyObject *__pyx_tuple__29;
1886 static PyObject *__pyx_tuple__31;
1887 static PyObject *__pyx_tuple__33;
1888 static PyObject *__pyx_tuple__35;
1889 static PyObject *__pyx_tuple__36;
1890 static PyObject *__pyx_tuple__38;
1891 static PyObject *__pyx_tuple__40;
1892 static PyObject *__pyx_tuple__42;
1893 static PyObject *__pyx_tuple__44;
1894 static PyObject *__pyx_tuple__46;
1895 static PyObject *__pyx_tuple__48;
1896 static PyObject *__pyx_codeobj__10;
1897 static PyObject *__pyx_codeobj__13;
1898 static PyObject *__pyx_codeobj__15;
1899 static PyObject *__pyx_codeobj__17;
1900 static PyObject *__pyx_codeobj__19;
1901 static PyObject *__pyx_codeobj__21;
1902 static PyObject *__pyx_codeobj__23;
1903 static PyObject *__pyx_codeobj__25;
1904 static PyObject *__pyx_codeobj__27;
1905 static PyObject *__pyx_codeobj__30;
1906 static PyObject *__pyx_codeobj__32;
1907 static PyObject *__pyx_codeobj__34;
1908 static PyObject *__pyx_codeobj__37;
1909 static PyObject *__pyx_codeobj__39;
1910 static PyObject *__pyx_codeobj__41;
1911 static PyObject *__pyx_codeobj__43;
1912 static PyObject *__pyx_codeobj__45;
1913 static PyObject *__pyx_codeobj__47;
1914 static PyObject *__pyx_codeobj__49;
1915 /* Late includes */
1916
1917 /* "lxml/sax.py":28
1918  * 
1919  * 
1920  * def _getNsTag(tag):             # <<<<<<<<<<<<<<
1921  *     if tag[0] == '{':
1922  *         return tuple(tag[1:].split('}', 1))
1923  */
1924
1925 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *__pyx_v_tag) {
1926   PyObject *__pyx_r = NULL;
1927   __Pyx_RefNannyDeclarations
1928   PyObject *__pyx_t_1 = NULL;
1929   int __pyx_t_2;
1930   PyObject *__pyx_t_3 = NULL;
1931   int __pyx_lineno = 0;
1932   const char *__pyx_filename = NULL;
1933   int __pyx_clineno = 0;
1934   __Pyx_RefNannySetupContext("_getNsTag", 0);
1935
1936   /* "lxml/sax.py":29
1937  * 
1938  * def _getNsTag(tag):
1939  *     if tag[0] == '{':             # <<<<<<<<<<<<<<
1940  *         return tuple(tag[1:].split('}', 1))
1941  *     else:
1942  */
1943   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_tag, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1944   __Pyx_GOTREF(__pyx_t_1);
1945   __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 29, __pyx_L1_error)
1946   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1947   if (__pyx_t_2) {
1948
1949     /* "lxml/sax.py":30
1950  * def _getNsTag(tag):
1951  *     if tag[0] == '{':
1952  *         return tuple(tag[1:].split('}', 1))             # <<<<<<<<<<<<<<
1953  *     else:
1954  *         return None, tag
1955  */
1956     __Pyx_XDECREF(__pyx_r);
1957     __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_tag, 1, 0, NULL, NULL, &__pyx_slice__2, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
1958     __Pyx_GOTREF(__pyx_t_1);
1959     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
1960     __Pyx_GOTREF(__pyx_t_3);
1961     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1962     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
1963     __Pyx_GOTREF(__pyx_t_1);
1964     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1965     __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
1966     __Pyx_GOTREF(__pyx_t_3);
1967     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1968     __pyx_r = ((PyObject*)__pyx_t_3);
1969     __pyx_t_3 = 0;
1970     goto __pyx_L0;
1971
1972     /* "lxml/sax.py":29
1973  * 
1974  * def _getNsTag(tag):
1975  *     if tag[0] == '{':             # <<<<<<<<<<<<<<
1976  *         return tuple(tag[1:].split('}', 1))
1977  *     else:
1978  */
1979   }
1980
1981   /* "lxml/sax.py":32
1982  *         return tuple(tag[1:].split('}', 1))
1983  *     else:
1984  *         return None, tag             # <<<<<<<<<<<<<<
1985  * 
1986  * 
1987  */
1988   /*else*/ {
1989     __Pyx_XDECREF(__pyx_r);
1990     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
1991     __Pyx_GOTREF(__pyx_t_3);
1992     __Pyx_INCREF(Py_None);
1993     __Pyx_GIVEREF(Py_None);
1994     PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
1995     __Pyx_INCREF(__pyx_v_tag);
1996     __Pyx_GIVEREF(__pyx_v_tag);
1997     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag);
1998     __pyx_r = ((PyObject*)__pyx_t_3);
1999     __pyx_t_3 = 0;
2000     goto __pyx_L0;
2001   }
2002
2003   /* "lxml/sax.py":28
2004  * 
2005  * 
2006  * def _getNsTag(tag):             # <<<<<<<<<<<<<<
2007  *     if tag[0] == '{':
2008  *         return tuple(tag[1:].split('}', 1))
2009  */
2010
2011   /* function exit code */
2012   __pyx_L1_error:;
2013   __Pyx_XDECREF(__pyx_t_1);
2014   __Pyx_XDECREF(__pyx_t_3);
2015   __Pyx_AddTraceback("lxml.sax._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
2016   __pyx_r = 0;
2017   __pyx_L0:;
2018   __Pyx_XGIVEREF(__pyx_r);
2019   __Pyx_RefNannyFinishContext();
2020   return __pyx_r;
2021 }
2022
2023 /* "lxml/sax.py":38
2024  *     """Build an lxml ElementTree from SAX events.
2025  *     """
2026  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
2027  *         ContentHandler.__init__(self)
2028  *         self._root = None
2029  */
2030
2031 /* Python wrapper */
2032 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2033 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2034 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2035   PyObject *__pyx_v_self = 0;
2036   PyObject *__pyx_v_makeelement = 0;
2037   int __pyx_lineno = 0;
2038   const char *__pyx_filename = NULL;
2039   int __pyx_clineno = 0;
2040   PyObject *__pyx_r = 0;
2041   __Pyx_RefNannyDeclarations
2042   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2043   {
2044     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_makeelement,0};
2045     PyObject* values[2] = {0,0};
2046     values[1] = ((PyObject *)((PyObject *)Py_None));
2047     if (unlikely(__pyx_kwds)) {
2048       Py_ssize_t kw_args;
2049       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2050       switch (pos_args) {
2051         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2052         CYTHON_FALLTHROUGH;
2053         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2054         CYTHON_FALLTHROUGH;
2055         case  0: break;
2056         default: goto __pyx_L5_argtuple_error;
2057       }
2058       kw_args = PyDict_Size(__pyx_kwds);
2059       switch (pos_args) {
2060         case  0:
2061         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2062         else goto __pyx_L5_argtuple_error;
2063         CYTHON_FALLTHROUGH;
2064         case  1:
2065         if (kw_args > 0) {
2066           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_makeelement);
2067           if (value) { values[1] = value; kw_args--; }
2068         }
2069       }
2070       if (unlikely(kw_args > 0)) {
2071         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 38, __pyx_L3_error)
2072       }
2073     } else {
2074       switch (PyTuple_GET_SIZE(__pyx_args)) {
2075         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2076         CYTHON_FALLTHROUGH;
2077         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2078         break;
2079         default: goto __pyx_L5_argtuple_error;
2080       }
2081     }
2082     __pyx_v_self = values[0];
2083     __pyx_v_makeelement = values[1];
2084   }
2085   goto __pyx_L4_argument_unpacking_done;
2086   __pyx_L5_argtuple_error:;
2087   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error)
2088   __pyx_L3_error:;
2089   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2090   __Pyx_RefNannyFinishContext();
2091   return NULL;
2092   __pyx_L4_argument_unpacking_done:;
2093   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_makeelement);
2094
2095   /* function exit code */
2096   __Pyx_RefNannyFinishContext();
2097   return __pyx_r;
2098 }
2099
2100 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement) {
2101   PyObject *__pyx_r = NULL;
2102   __Pyx_RefNannyDeclarations
2103   PyObject *__pyx_t_1 = NULL;
2104   PyObject *__pyx_t_2 = NULL;
2105   PyObject *__pyx_t_3 = NULL;
2106   int __pyx_t_4;
2107   int __pyx_t_5;
2108   int __pyx_lineno = 0;
2109   const char *__pyx_filename = NULL;
2110   int __pyx_clineno = 0;
2111   __Pyx_RefNannySetupContext("__init__", 0);
2112   __Pyx_INCREF(__pyx_v_makeelement);
2113
2114   /* "lxml/sax.py":39
2115  *     """
2116  *     def __init__(self, makeelement=None):
2117  *         ContentHandler.__init__(self)             # <<<<<<<<<<<<<<
2118  *         self._root = None
2119  *         self._root_siblings = []
2120  */
2121   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
2122   __Pyx_GOTREF(__pyx_t_2);
2123   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
2124   __Pyx_GOTREF(__pyx_t_3);
2125   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2126   __pyx_t_2 = NULL;
2127   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2128     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2129     if (likely(__pyx_t_2)) {
2130       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2131       __Pyx_INCREF(__pyx_t_2);
2132       __Pyx_INCREF(function);
2133       __Pyx_DECREF_SET(__pyx_t_3, function);
2134     }
2135   }
2136   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self);
2137   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2138   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2139   __Pyx_GOTREF(__pyx_t_1);
2140   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2141   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2142
2143   /* "lxml/sax.py":40
2144  *     def __init__(self, makeelement=None):
2145  *         ContentHandler.__init__(self)
2146  *         self._root = None             # <<<<<<<<<<<<<<
2147  *         self._root_siblings = []
2148  *         self._element_stack = []
2149  */
2150   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, Py_None) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
2151
2152   /* "lxml/sax.py":41
2153  *         ContentHandler.__init__(self)
2154  *         self._root = None
2155  *         self._root_siblings = []             # <<<<<<<<<<<<<<
2156  *         self._element_stack = []
2157  *         self._default_ns = None
2158  */
2159   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
2160   __Pyx_GOTREF(__pyx_t_1);
2161   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
2162   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2163
2164   /* "lxml/sax.py":42
2165  *         self._root = None
2166  *         self._root_siblings = []
2167  *         self._element_stack = []             # <<<<<<<<<<<<<<
2168  *         self._default_ns = None
2169  *         self._ns_mapping = { None : [None] }
2170  */
2171   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2172   __Pyx_GOTREF(__pyx_t_1);
2173   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_element_stack, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
2174   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2175
2176   /* "lxml/sax.py":43
2177  *         self._root_siblings = []
2178  *         self._element_stack = []
2179  *         self._default_ns = None             # <<<<<<<<<<<<<<
2180  *         self._ns_mapping = { None : [None] }
2181  *         self._new_mappings = {}
2182  */
2183   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, Py_None) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
2184
2185   /* "lxml/sax.py":44
2186  *         self._element_stack = []
2187  *         self._default_ns = None
2188  *         self._ns_mapping = { None : [None] }             # <<<<<<<<<<<<<<
2189  *         self._new_mappings = {}
2190  *         if makeelement is None:
2191  */
2192   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
2193   __Pyx_GOTREF(__pyx_t_1);
2194   __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
2195   __Pyx_GOTREF(__pyx_t_3);
2196   __Pyx_INCREF(Py_None);
2197   __Pyx_GIVEREF(Py_None);
2198   PyList_SET_ITEM(__pyx_t_3, 0, Py_None);
2199   if (PyDict_SetItem(__pyx_t_1, Py_None, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2200   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2201   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2202   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2203
2204   /* "lxml/sax.py":45
2205  *         self._default_ns = None
2206  *         self._ns_mapping = { None : [None] }
2207  *         self._new_mappings = {}             # <<<<<<<<<<<<<<
2208  *         if makeelement is None:
2209  *             makeelement = etree.Element
2210  */
2211   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2212   __Pyx_GOTREF(__pyx_t_1);
2213   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
2214   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2215
2216   /* "lxml/sax.py":46
2217  *         self._ns_mapping = { None : [None] }
2218  *         self._new_mappings = {}
2219  *         if makeelement is None:             # <<<<<<<<<<<<<<
2220  *             makeelement = etree.Element
2221  *         self._makeelement = makeelement
2222  */
2223   __pyx_t_4 = (__pyx_v_makeelement == Py_None);
2224   __pyx_t_5 = (__pyx_t_4 != 0);
2225   if (__pyx_t_5) {
2226
2227     /* "lxml/sax.py":47
2228  *         self._new_mappings = {}
2229  *         if makeelement is None:
2230  *             makeelement = etree.Element             # <<<<<<<<<<<<<<
2231  *         self._makeelement = makeelement
2232  * 
2233  */
2234     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
2235     __Pyx_GOTREF(__pyx_t_1);
2236     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Element); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
2237     __Pyx_GOTREF(__pyx_t_3);
2238     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2239     __Pyx_DECREF_SET(__pyx_v_makeelement, __pyx_t_3);
2240     __pyx_t_3 = 0;
2241
2242     /* "lxml/sax.py":46
2243  *         self._ns_mapping = { None : [None] }
2244  *         self._new_mappings = {}
2245  *         if makeelement is None:             # <<<<<<<<<<<<<<
2246  *             makeelement = etree.Element
2247  *         self._makeelement = makeelement
2248  */
2249   }
2250
2251   /* "lxml/sax.py":48
2252  *         if makeelement is None:
2253  *             makeelement = etree.Element
2254  *         self._makeelement = makeelement             # <<<<<<<<<<<<<<
2255  * 
2256  *     def _get_etree(self):
2257  */
2258   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2, __pyx_v_makeelement) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
2259
2260   /* "lxml/sax.py":38
2261  *     """Build an lxml ElementTree from SAX events.
2262  *     """
2263  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
2264  *         ContentHandler.__init__(self)
2265  *         self._root = None
2266  */
2267
2268   /* function exit code */
2269   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2270   goto __pyx_L0;
2271   __pyx_L1_error:;
2272   __Pyx_XDECREF(__pyx_t_1);
2273   __Pyx_XDECREF(__pyx_t_2);
2274   __Pyx_XDECREF(__pyx_t_3);
2275   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2276   __pyx_r = NULL;
2277   __pyx_L0:;
2278   __Pyx_XDECREF(__pyx_v_makeelement);
2279   __Pyx_XGIVEREF(__pyx_r);
2280   __Pyx_RefNannyFinishContext();
2281   return __pyx_r;
2282 }
2283
2284 /* "lxml/sax.py":50
2285  *         self._makeelement = makeelement
2286  * 
2287  *     def _get_etree(self):             # <<<<<<<<<<<<<<
2288  *         "Contains the generated ElementTree after parsing is finished."
2289  *         return ElementTree(self._root)
2290  */
2291
2292 /* Python wrapper */
2293 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2294 static char __pyx_doc_4lxml_3sax_25ElementTreeContentHandler_2_get_etree[] = "Contains the generated ElementTree after parsing is finished.";
2295 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_3_get_etree = {"_get_etree", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree, METH_O, __pyx_doc_4lxml_3sax_25ElementTreeContentHandler_2_get_etree};
2296 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2297   PyObject *__pyx_r = 0;
2298   __Pyx_RefNannyDeclarations
2299   __Pyx_RefNannySetupContext("_get_etree (wrapper)", 0);
2300   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(__pyx_self, ((PyObject *)__pyx_v_self));
2301
2302   /* function exit code */
2303   __Pyx_RefNannyFinishContext();
2304   return __pyx_r;
2305 }
2306
2307 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2308   PyObject *__pyx_r = NULL;
2309   __Pyx_RefNannyDeclarations
2310   PyObject *__pyx_t_1 = NULL;
2311   PyObject *__pyx_t_2 = NULL;
2312   PyObject *__pyx_t_3 = NULL;
2313   PyObject *__pyx_t_4 = NULL;
2314   int __pyx_lineno = 0;
2315   const char *__pyx_filename = NULL;
2316   int __pyx_clineno = 0;
2317   __Pyx_RefNannySetupContext("_get_etree", 0);
2318
2319   /* "lxml/sax.py":52
2320  *     def _get_etree(self):
2321  *         "Contains the generated ElementTree after parsing is finished."
2322  *         return ElementTree(self._root)             # <<<<<<<<<<<<<<
2323  * 
2324  *     etree = property(_get_etree, doc=_get_etree.__doc__)
2325  */
2326   __Pyx_XDECREF(__pyx_r);
2327   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
2328   __Pyx_GOTREF(__pyx_t_2);
2329   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
2330   __Pyx_GOTREF(__pyx_t_3);
2331   __pyx_t_4 = NULL;
2332   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2333     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
2334     if (likely(__pyx_t_4)) {
2335       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2336       __Pyx_INCREF(__pyx_t_4);
2337       __Pyx_INCREF(function);
2338       __Pyx_DECREF_SET(__pyx_t_2, function);
2339     }
2340   }
2341   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
2342   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2343   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2344   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
2345   __Pyx_GOTREF(__pyx_t_1);
2346   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2347   __pyx_r = __pyx_t_1;
2348   __pyx_t_1 = 0;
2349   goto __pyx_L0;
2350
2351   /* "lxml/sax.py":50
2352  *         self._makeelement = makeelement
2353  * 
2354  *     def _get_etree(self):             # <<<<<<<<<<<<<<
2355  *         "Contains the generated ElementTree after parsing is finished."
2356  *         return ElementTree(self._root)
2357  */
2358
2359   /* function exit code */
2360   __pyx_L1_error:;
2361   __Pyx_XDECREF(__pyx_t_1);
2362   __Pyx_XDECREF(__pyx_t_2);
2363   __Pyx_XDECREF(__pyx_t_3);
2364   __Pyx_XDECREF(__pyx_t_4);
2365   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._get_etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
2366   __pyx_r = NULL;
2367   __pyx_L0:;
2368   __Pyx_XGIVEREF(__pyx_r);
2369   __Pyx_RefNannyFinishContext();
2370   return __pyx_r;
2371 }
2372
2373 /* "lxml/sax.py":56
2374  *     etree = property(_get_etree, doc=_get_etree.__doc__)
2375  * 
2376  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
2377  *         pass
2378  * 
2379  */
2380
2381 /* Python wrapper */
2382 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2383 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator = {"setDocumentLocator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator, METH_VARARGS|METH_KEYWORDS, 0};
2384 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2385   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
2386   CYTHON_UNUSED PyObject *__pyx_v_locator = 0;
2387   int __pyx_lineno = 0;
2388   const char *__pyx_filename = NULL;
2389   int __pyx_clineno = 0;
2390   PyObject *__pyx_r = 0;
2391   __Pyx_RefNannyDeclarations
2392   __Pyx_RefNannySetupContext("setDocumentLocator (wrapper)", 0);
2393   {
2394     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_locator,0};
2395     PyObject* values[2] = {0,0};
2396     if (unlikely(__pyx_kwds)) {
2397       Py_ssize_t kw_args;
2398       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2399       switch (pos_args) {
2400         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2401         CYTHON_FALLTHROUGH;
2402         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2403         CYTHON_FALLTHROUGH;
2404         case  0: break;
2405         default: goto __pyx_L5_argtuple_error;
2406       }
2407       kw_args = PyDict_Size(__pyx_kwds);
2408       switch (pos_args) {
2409         case  0:
2410         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2411         else goto __pyx_L5_argtuple_error;
2412         CYTHON_FALLTHROUGH;
2413         case  1:
2414         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_locator)) != 0)) kw_args--;
2415         else {
2416           __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
2417         }
2418       }
2419       if (unlikely(kw_args > 0)) {
2420         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDocumentLocator") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
2421       }
2422     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2423       goto __pyx_L5_argtuple_error;
2424     } else {
2425       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2426       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2427     }
2428     __pyx_v_self = values[0];
2429     __pyx_v_locator = values[1];
2430   }
2431   goto __pyx_L4_argument_unpacking_done;
2432   __pyx_L5_argtuple_error:;
2433   __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
2434   __pyx_L3_error:;
2435   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.setDocumentLocator", __pyx_clineno, __pyx_lineno, __pyx_filename);
2436   __Pyx_RefNannyFinishContext();
2437   return NULL;
2438   __pyx_L4_argument_unpacking_done:;
2439   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(__pyx_self, __pyx_v_self, __pyx_v_locator);
2440
2441   /* function exit code */
2442   __Pyx_RefNannyFinishContext();
2443   return __pyx_r;
2444 }
2445
2446 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_locator) {
2447   PyObject *__pyx_r = NULL;
2448   __Pyx_RefNannyDeclarations
2449   __Pyx_RefNannySetupContext("setDocumentLocator", 0);
2450
2451   /* function exit code */
2452   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2453   __Pyx_XGIVEREF(__pyx_r);
2454   __Pyx_RefNannyFinishContext();
2455   return __pyx_r;
2456 }
2457
2458 /* "lxml/sax.py":59
2459  *         pass
2460  * 
2461  *     def startDocument(self):             # <<<<<<<<<<<<<<
2462  *         pass
2463  * 
2464  */
2465
2466 /* Python wrapper */
2467 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2468 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_7startDocument = {"startDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument, METH_O, 0};
2469 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2470   PyObject *__pyx_r = 0;
2471   __Pyx_RefNannyDeclarations
2472   __Pyx_RefNannySetupContext("startDocument (wrapper)", 0);
2473   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2474
2475   /* function exit code */
2476   __Pyx_RefNannyFinishContext();
2477   return __pyx_r;
2478 }
2479
2480 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2481   PyObject *__pyx_r = NULL;
2482   __Pyx_RefNannyDeclarations
2483   __Pyx_RefNannySetupContext("startDocument", 0);
2484
2485   /* function exit code */
2486   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2487   __Pyx_XGIVEREF(__pyx_r);
2488   __Pyx_RefNannyFinishContext();
2489   return __pyx_r;
2490 }
2491
2492 /* "lxml/sax.py":62
2493  *         pass
2494  * 
2495  *     def endDocument(self):             # <<<<<<<<<<<<<<
2496  *         pass
2497  * 
2498  */
2499
2500 /* Python wrapper */
2501 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2502 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_9endDocument = {"endDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument, METH_O, 0};
2503 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2504   PyObject *__pyx_r = 0;
2505   __Pyx_RefNannyDeclarations
2506   __Pyx_RefNannySetupContext("endDocument (wrapper)", 0);
2507   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2508
2509   /* function exit code */
2510   __Pyx_RefNannyFinishContext();
2511   return __pyx_r;
2512 }
2513
2514 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2515   PyObject *__pyx_r = NULL;
2516   __Pyx_RefNannyDeclarations
2517   __Pyx_RefNannySetupContext("endDocument", 0);
2518
2519   /* function exit code */
2520   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2521   __Pyx_XGIVEREF(__pyx_r);
2522   __Pyx_RefNannyFinishContext();
2523   return __pyx_r;
2524 }
2525
2526 /* "lxml/sax.py":65
2527  *         pass
2528  * 
2529  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
2530  *         self._new_mappings[prefix] = uri
2531  *         try:
2532  */
2533
2534 /* Python wrapper */
2535 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2536 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping = {"startPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2537 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2538   PyObject *__pyx_v_self = 0;
2539   PyObject *__pyx_v_prefix = 0;
2540   PyObject *__pyx_v_uri = 0;
2541   int __pyx_lineno = 0;
2542   const char *__pyx_filename = NULL;
2543   int __pyx_clineno = 0;
2544   PyObject *__pyx_r = 0;
2545   __Pyx_RefNannyDeclarations
2546   __Pyx_RefNannySetupContext("startPrefixMapping (wrapper)", 0);
2547   {
2548     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
2549     PyObject* values[3] = {0,0,0};
2550     if (unlikely(__pyx_kwds)) {
2551       Py_ssize_t kw_args;
2552       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2553       switch (pos_args) {
2554         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2555         CYTHON_FALLTHROUGH;
2556         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2557         CYTHON_FALLTHROUGH;
2558         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2559         CYTHON_FALLTHROUGH;
2560         case  0: break;
2561         default: goto __pyx_L5_argtuple_error;
2562       }
2563       kw_args = PyDict_Size(__pyx_kwds);
2564       switch (pos_args) {
2565         case  0:
2566         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2567         else goto __pyx_L5_argtuple_error;
2568         CYTHON_FALLTHROUGH;
2569         case  1:
2570         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2571         else {
2572           __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 1); __PYX_ERR(0, 65, __pyx_L3_error)
2573         }
2574         CYTHON_FALLTHROUGH;
2575         case  2:
2576         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
2577         else {
2578           __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 2); __PYX_ERR(0, 65, __pyx_L3_error)
2579         }
2580       }
2581       if (unlikely(kw_args > 0)) {
2582         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startPrefixMapping") < 0)) __PYX_ERR(0, 65, __pyx_L3_error)
2583       }
2584     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2585       goto __pyx_L5_argtuple_error;
2586     } else {
2587       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2588       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2589       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2590     }
2591     __pyx_v_self = values[0];
2592     __pyx_v_prefix = values[1];
2593     __pyx_v_uri = values[2];
2594   }
2595   goto __pyx_L4_argument_unpacking_done;
2596   __pyx_L5_argtuple_error:;
2597   __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 65, __pyx_L3_error)
2598   __pyx_L3_error:;
2599   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2600   __Pyx_RefNannyFinishContext();
2601   return NULL;
2602   __pyx_L4_argument_unpacking_done:;
2603   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix, __pyx_v_uri);
2604
2605   /* function exit code */
2606   __Pyx_RefNannyFinishContext();
2607   return __pyx_r;
2608 }
2609
2610 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix, PyObject *__pyx_v_uri) {
2611   PyObject *__pyx_r = NULL;
2612   __Pyx_RefNannyDeclarations
2613   PyObject *__pyx_t_1 = NULL;
2614   PyObject *__pyx_t_2 = NULL;
2615   PyObject *__pyx_t_3 = NULL;
2616   PyObject *__pyx_t_4 = NULL;
2617   PyObject *__pyx_t_5 = NULL;
2618   int __pyx_t_6;
2619   int __pyx_t_7;
2620   PyObject *__pyx_t_8 = NULL;
2621   PyObject *__pyx_t_9 = NULL;
2622   PyObject *__pyx_t_10 = NULL;
2623   int __pyx_t_11;
2624   int __pyx_t_12;
2625   int __pyx_lineno = 0;
2626   const char *__pyx_filename = NULL;
2627   int __pyx_clineno = 0;
2628   __Pyx_RefNannySetupContext("startPrefixMapping", 0);
2629
2630   /* "lxml/sax.py":66
2631  * 
2632  *     def startPrefixMapping(self, prefix, uri):
2633  *         self._new_mappings[prefix] = uri             # <<<<<<<<<<<<<<
2634  *         try:
2635  *             self._ns_mapping[prefix].append(uri)
2636  */
2637   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
2638   __Pyx_GOTREF(__pyx_t_1);
2639   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_prefix, __pyx_v_uri) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
2640   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2641
2642   /* "lxml/sax.py":67
2643  *     def startPrefixMapping(self, prefix, uri):
2644  *         self._new_mappings[prefix] = uri
2645  *         try:             # <<<<<<<<<<<<<<
2646  *             self._ns_mapping[prefix].append(uri)
2647  *         except KeyError:
2648  */
2649   {
2650     __Pyx_PyThreadState_declare
2651     __Pyx_PyThreadState_assign
2652     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
2653     __Pyx_XGOTREF(__pyx_t_2);
2654     __Pyx_XGOTREF(__pyx_t_3);
2655     __Pyx_XGOTREF(__pyx_t_4);
2656     /*try:*/ {
2657
2658       /* "lxml/sax.py":68
2659  *         self._new_mappings[prefix] = uri
2660  *         try:
2661  *             self._ns_mapping[prefix].append(uri)             # <<<<<<<<<<<<<<
2662  *         except KeyError:
2663  *             self._ns_mapping[prefix] = [uri]
2664  */
2665       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L3_error)
2666       __Pyx_GOTREF(__pyx_t_1);
2667       __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L3_error)
2668       __Pyx_GOTREF(__pyx_t_5);
2669       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2670       __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_5, __pyx_v_uri); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 68, __pyx_L3_error)
2671       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2672
2673       /* "lxml/sax.py":67
2674  *     def startPrefixMapping(self, prefix, uri):
2675  *         self._new_mappings[prefix] = uri
2676  *         try:             # <<<<<<<<<<<<<<
2677  *             self._ns_mapping[prefix].append(uri)
2678  *         except KeyError:
2679  */
2680     }
2681     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2682     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2683     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2684     goto __pyx_L8_try_end;
2685     __pyx_L3_error:;
2686     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2687     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2688
2689     /* "lxml/sax.py":69
2690  *         try:
2691  *             self._ns_mapping[prefix].append(uri)
2692  *         except KeyError:             # <<<<<<<<<<<<<<
2693  *             self._ns_mapping[prefix] = [uri]
2694  *         if prefix is None:
2695  */
2696     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
2697     if (__pyx_t_7) {
2698       __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2699       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 69, __pyx_L5_except_error)
2700       __Pyx_GOTREF(__pyx_t_5);
2701       __Pyx_GOTREF(__pyx_t_1);
2702       __Pyx_GOTREF(__pyx_t_8);
2703
2704       /* "lxml/sax.py":70
2705  *             self._ns_mapping[prefix].append(uri)
2706  *         except KeyError:
2707  *             self._ns_mapping[prefix] = [uri]             # <<<<<<<<<<<<<<
2708  *         if prefix is None:
2709  *             self._default_ns = uri
2710  */
2711       __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2712       __Pyx_GOTREF(__pyx_t_9);
2713       __Pyx_INCREF(__pyx_v_uri);
2714       __Pyx_GIVEREF(__pyx_v_uri);
2715       PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_uri);
2716       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2717       __Pyx_GOTREF(__pyx_t_10);
2718       if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_prefix, __pyx_t_9) < 0)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2719       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2720       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2721       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2722       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2723       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2724       goto __pyx_L4_exception_handled;
2725     }
2726     goto __pyx_L5_except_error;
2727     __pyx_L5_except_error:;
2728
2729     /* "lxml/sax.py":67
2730  *     def startPrefixMapping(self, prefix, uri):
2731  *         self._new_mappings[prefix] = uri
2732  *         try:             # <<<<<<<<<<<<<<
2733  *             self._ns_mapping[prefix].append(uri)
2734  *         except KeyError:
2735  */
2736     __Pyx_XGIVEREF(__pyx_t_2);
2737     __Pyx_XGIVEREF(__pyx_t_3);
2738     __Pyx_XGIVEREF(__pyx_t_4);
2739     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2740     goto __pyx_L1_error;
2741     __pyx_L4_exception_handled:;
2742     __Pyx_XGIVEREF(__pyx_t_2);
2743     __Pyx_XGIVEREF(__pyx_t_3);
2744     __Pyx_XGIVEREF(__pyx_t_4);
2745     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2746     __pyx_L8_try_end:;
2747   }
2748
2749   /* "lxml/sax.py":71
2750  *         except KeyError:
2751  *             self._ns_mapping[prefix] = [uri]
2752  *         if prefix is None:             # <<<<<<<<<<<<<<
2753  *             self._default_ns = uri
2754  * 
2755  */
2756   __pyx_t_11 = (__pyx_v_prefix == Py_None);
2757   __pyx_t_12 = (__pyx_t_11 != 0);
2758   if (__pyx_t_12) {
2759
2760     /* "lxml/sax.py":72
2761  *             self._ns_mapping[prefix] = [uri]
2762  *         if prefix is None:
2763  *             self._default_ns = uri             # <<<<<<<<<<<<<<
2764  * 
2765  *     def endPrefixMapping(self, prefix):
2766  */
2767     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_v_uri) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
2768
2769     /* "lxml/sax.py":71
2770  *         except KeyError:
2771  *             self._ns_mapping[prefix] = [uri]
2772  *         if prefix is None:             # <<<<<<<<<<<<<<
2773  *             self._default_ns = uri
2774  * 
2775  */
2776   }
2777
2778   /* "lxml/sax.py":65
2779  *         pass
2780  * 
2781  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
2782  *         self._new_mappings[prefix] = uri
2783  *         try:
2784  */
2785
2786   /* function exit code */
2787   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2788   goto __pyx_L0;
2789   __pyx_L1_error:;
2790   __Pyx_XDECREF(__pyx_t_1);
2791   __Pyx_XDECREF(__pyx_t_5);
2792   __Pyx_XDECREF(__pyx_t_8);
2793   __Pyx_XDECREF(__pyx_t_9);
2794   __Pyx_XDECREF(__pyx_t_10);
2795   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2796   __pyx_r = NULL;
2797   __pyx_L0:;
2798   __Pyx_XGIVEREF(__pyx_r);
2799   __Pyx_RefNannyFinishContext();
2800   return __pyx_r;
2801 }
2802
2803 /* "lxml/sax.py":74
2804  *             self._default_ns = uri
2805  * 
2806  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
2807  *         ns_uri_list = self._ns_mapping[prefix]
2808  *         ns_uri_list.pop()
2809  */
2810
2811 /* Python wrapper */
2812 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2813 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping = {"endPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2814 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2815   PyObject *__pyx_v_self = 0;
2816   PyObject *__pyx_v_prefix = 0;
2817   int __pyx_lineno = 0;
2818   const char *__pyx_filename = NULL;
2819   int __pyx_clineno = 0;
2820   PyObject *__pyx_r = 0;
2821   __Pyx_RefNannyDeclarations
2822   __Pyx_RefNannySetupContext("endPrefixMapping (wrapper)", 0);
2823   {
2824     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
2825     PyObject* values[2] = {0,0};
2826     if (unlikely(__pyx_kwds)) {
2827       Py_ssize_t kw_args;
2828       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2829       switch (pos_args) {
2830         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2831         CYTHON_FALLTHROUGH;
2832         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2833         CYTHON_FALLTHROUGH;
2834         case  0: break;
2835         default: goto __pyx_L5_argtuple_error;
2836       }
2837       kw_args = PyDict_Size(__pyx_kwds);
2838       switch (pos_args) {
2839         case  0:
2840         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2841         else goto __pyx_L5_argtuple_error;
2842         CYTHON_FALLTHROUGH;
2843         case  1:
2844         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2845         else {
2846           __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, 1); __PYX_ERR(0, 74, __pyx_L3_error)
2847         }
2848       }
2849       if (unlikely(kw_args > 0)) {
2850         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endPrefixMapping") < 0)) __PYX_ERR(0, 74, __pyx_L3_error)
2851       }
2852     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2853       goto __pyx_L5_argtuple_error;
2854     } else {
2855       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2856       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2857     }
2858     __pyx_v_self = values[0];
2859     __pyx_v_prefix = values[1];
2860   }
2861   goto __pyx_L4_argument_unpacking_done;
2862   __pyx_L5_argtuple_error:;
2863   __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
2864   __pyx_L3_error:;
2865   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2866   __Pyx_RefNannyFinishContext();
2867   return NULL;
2868   __pyx_L4_argument_unpacking_done:;
2869   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix);
2870
2871   /* function exit code */
2872   __Pyx_RefNannyFinishContext();
2873   return __pyx_r;
2874 }
2875
2876 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
2877   PyObject *__pyx_v_ns_uri_list = NULL;
2878   PyObject *__pyx_r = NULL;
2879   __Pyx_RefNannyDeclarations
2880   PyObject *__pyx_t_1 = NULL;
2881   PyObject *__pyx_t_2 = NULL;
2882   int __pyx_t_3;
2883   int __pyx_t_4;
2884   int __pyx_lineno = 0;
2885   const char *__pyx_filename = NULL;
2886   int __pyx_clineno = 0;
2887   __Pyx_RefNannySetupContext("endPrefixMapping", 0);
2888
2889   /* "lxml/sax.py":75
2890  * 
2891  *     def endPrefixMapping(self, prefix):
2892  *         ns_uri_list = self._ns_mapping[prefix]             # <<<<<<<<<<<<<<
2893  *         ns_uri_list.pop()
2894  *         if prefix is None:
2895  */
2896   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
2897   __Pyx_GOTREF(__pyx_t_1);
2898   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
2899   __Pyx_GOTREF(__pyx_t_2);
2900   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2901   __pyx_v_ns_uri_list = __pyx_t_2;
2902   __pyx_t_2 = 0;
2903
2904   /* "lxml/sax.py":76
2905  *     def endPrefixMapping(self, prefix):
2906  *         ns_uri_list = self._ns_mapping[prefix]
2907  *         ns_uri_list.pop()             # <<<<<<<<<<<<<<
2908  *         if prefix is None:
2909  *             self._default_ns = ns_uri_list[-1]
2910  */
2911   __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_ns_uri_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
2912   __Pyx_GOTREF(__pyx_t_2);
2913   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2914
2915   /* "lxml/sax.py":77
2916  *         ns_uri_list = self._ns_mapping[prefix]
2917  *         ns_uri_list.pop()
2918  *         if prefix is None:             # <<<<<<<<<<<<<<
2919  *             self._default_ns = ns_uri_list[-1]
2920  * 
2921  */
2922   __pyx_t_3 = (__pyx_v_prefix == Py_None);
2923   __pyx_t_4 = (__pyx_t_3 != 0);
2924   if (__pyx_t_4) {
2925
2926     /* "lxml/sax.py":78
2927  *         ns_uri_list.pop()
2928  *         if prefix is None:
2929  *             self._default_ns = ns_uri_list[-1]             # <<<<<<<<<<<<<<
2930  * 
2931  *     def _buildTag(self, ns_name_tuple):
2932  */
2933     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ns_uri_list, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
2934     __Pyx_GOTREF(__pyx_t_2);
2935     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_t_2) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
2936     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2937
2938     /* "lxml/sax.py":77
2939  *         ns_uri_list = self._ns_mapping[prefix]
2940  *         ns_uri_list.pop()
2941  *         if prefix is None:             # <<<<<<<<<<<<<<
2942  *             self._default_ns = ns_uri_list[-1]
2943  * 
2944  */
2945   }
2946
2947   /* "lxml/sax.py":74
2948  *             self._default_ns = uri
2949  * 
2950  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
2951  *         ns_uri_list = self._ns_mapping[prefix]
2952  *         ns_uri_list.pop()
2953  */
2954
2955   /* function exit code */
2956   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2957   goto __pyx_L0;
2958   __pyx_L1_error:;
2959   __Pyx_XDECREF(__pyx_t_1);
2960   __Pyx_XDECREF(__pyx_t_2);
2961   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2962   __pyx_r = NULL;
2963   __pyx_L0:;
2964   __Pyx_XDECREF(__pyx_v_ns_uri_list);
2965   __Pyx_XGIVEREF(__pyx_r);
2966   __Pyx_RefNannyFinishContext();
2967   return __pyx_r;
2968 }
2969
2970 /* "lxml/sax.py":80
2971  *             self._default_ns = ns_uri_list[-1]
2972  * 
2973  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
2974  *         ns_uri, local_name = ns_name_tuple
2975  *         if ns_uri:
2976  */
2977
2978 /* Python wrapper */
2979 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2980 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_15_buildTag = {"_buildTag", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag, METH_VARARGS|METH_KEYWORDS, 0};
2981 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2982   PyObject *__pyx_v_self = 0;
2983   PyObject *__pyx_v_ns_name_tuple = 0;
2984   int __pyx_lineno = 0;
2985   const char *__pyx_filename = NULL;
2986   int __pyx_clineno = 0;
2987   PyObject *__pyx_r = 0;
2988   __Pyx_RefNannyDeclarations
2989   __Pyx_RefNannySetupContext("_buildTag (wrapper)", 0);
2990   {
2991     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name_tuple,0};
2992     PyObject* values[2] = {0,0};
2993     if (unlikely(__pyx_kwds)) {
2994       Py_ssize_t kw_args;
2995       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2996       switch (pos_args) {
2997         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2998         CYTHON_FALLTHROUGH;
2999         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3000         CYTHON_FALLTHROUGH;
3001         case  0: break;
3002         default: goto __pyx_L5_argtuple_error;
3003       }
3004       kw_args = PyDict_Size(__pyx_kwds);
3005       switch (pos_args) {
3006         case  0:
3007         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3008         else goto __pyx_L5_argtuple_error;
3009         CYTHON_FALLTHROUGH;
3010         case  1:
3011         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name_tuple)) != 0)) kw_args--;
3012         else {
3013           __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, 1); __PYX_ERR(0, 80, __pyx_L3_error)
3014         }
3015       }
3016       if (unlikely(kw_args > 0)) {
3017         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_buildTag") < 0)) __PYX_ERR(0, 80, __pyx_L3_error)
3018       }
3019     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3020       goto __pyx_L5_argtuple_error;
3021     } else {
3022       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3023       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3024     }
3025     __pyx_v_self = values[0];
3026     __pyx_v_ns_name_tuple = values[1];
3027   }
3028   goto __pyx_L4_argument_unpacking_done;
3029   __pyx_L5_argtuple_error:;
3030   __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 80, __pyx_L3_error)
3031   __pyx_L3_error:;
3032   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3033   __Pyx_RefNannyFinishContext();
3034   return NULL;
3035   __pyx_L4_argument_unpacking_done:;
3036   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(__pyx_self, __pyx_v_self, __pyx_v_ns_name_tuple);
3037
3038   /* function exit code */
3039   __Pyx_RefNannyFinishContext();
3040   return __pyx_r;
3041 }
3042
3043 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name_tuple) {
3044   PyObject *__pyx_v_ns_uri = NULL;
3045   PyObject *__pyx_v_local_name = NULL;
3046   PyObject *__pyx_v_el_tag = NULL;
3047   PyObject *__pyx_r = NULL;
3048   __Pyx_RefNannyDeclarations
3049   PyObject *__pyx_t_1 = NULL;
3050   PyObject *__pyx_t_2 = NULL;
3051   PyObject *__pyx_t_3 = NULL;
3052   PyObject *(*__pyx_t_4)(PyObject *);
3053   int __pyx_t_5;
3054   int __pyx_lineno = 0;
3055   const char *__pyx_filename = NULL;
3056   int __pyx_clineno = 0;
3057   __Pyx_RefNannySetupContext("_buildTag", 0);
3058
3059   /* "lxml/sax.py":81
3060  * 
3061  *     def _buildTag(self, ns_name_tuple):
3062  *         ns_uri, local_name = ns_name_tuple             # <<<<<<<<<<<<<<
3063  *         if ns_uri:
3064  *             el_tag = "{%s}%s" % ns_name_tuple
3065  */
3066   if ((likely(PyTuple_CheckExact(__pyx_v_ns_name_tuple))) || (PyList_CheckExact(__pyx_v_ns_name_tuple))) {
3067     PyObject* sequence = __pyx_v_ns_name_tuple;
3068     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3069     if (unlikely(size != 2)) {
3070       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3071       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3072       __PYX_ERR(0, 81, __pyx_L1_error)
3073     }
3074     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3075     if (likely(PyTuple_CheckExact(sequence))) {
3076       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
3077       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
3078     } else {
3079       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
3080       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
3081     }
3082     __Pyx_INCREF(__pyx_t_1);
3083     __Pyx_INCREF(__pyx_t_2);
3084     #else
3085     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
3086     __Pyx_GOTREF(__pyx_t_1);
3087     __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
3088     __Pyx_GOTREF(__pyx_t_2);
3089     #endif
3090   } else {
3091     Py_ssize_t index = -1;
3092     __pyx_t_3 = PyObject_GetIter(__pyx_v_ns_name_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
3093     __Pyx_GOTREF(__pyx_t_3);
3094     __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
3095     index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
3096     __Pyx_GOTREF(__pyx_t_1);
3097     index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
3098     __Pyx_GOTREF(__pyx_t_2);
3099     if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
3100     __pyx_t_4 = NULL;
3101     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3102     goto __pyx_L4_unpacking_done;
3103     __pyx_L3_unpacking_failed:;
3104     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3105     __pyx_t_4 = NULL;
3106     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3107     __PYX_ERR(0, 81, __pyx_L1_error)
3108     __pyx_L4_unpacking_done:;
3109   }
3110   __pyx_v_ns_uri = __pyx_t_1;
3111   __pyx_t_1 = 0;
3112   __pyx_v_local_name = __pyx_t_2;
3113   __pyx_t_2 = 0;
3114
3115   /* "lxml/sax.py":82
3116  *     def _buildTag(self, ns_name_tuple):
3117  *         ns_uri, local_name = ns_name_tuple
3118  *         if ns_uri:             # <<<<<<<<<<<<<<
3119  *             el_tag = "{%s}%s" % ns_name_tuple
3120  *         elif self._default_ns:
3121  */
3122   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
3123   if (__pyx_t_5) {
3124
3125     /* "lxml/sax.py":83
3126  *         ns_uri, local_name = ns_name_tuple
3127  *         if ns_uri:
3128  *             el_tag = "{%s}%s" % ns_name_tuple             # <<<<<<<<<<<<<<
3129  *         elif self._default_ns:
3130  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3131  */
3132     __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s_s, __pyx_v_ns_name_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
3133     __Pyx_GOTREF(__pyx_t_2);
3134     __pyx_v_el_tag = __pyx_t_2;
3135     __pyx_t_2 = 0;
3136
3137     /* "lxml/sax.py":82
3138  *     def _buildTag(self, ns_name_tuple):
3139  *         ns_uri, local_name = ns_name_tuple
3140  *         if ns_uri:             # <<<<<<<<<<<<<<
3141  *             el_tag = "{%s}%s" % ns_name_tuple
3142  *         elif self._default_ns:
3143  */
3144     goto __pyx_L5;
3145   }
3146
3147   /* "lxml/sax.py":84
3148  *         if ns_uri:
3149  *             el_tag = "{%s}%s" % ns_name_tuple
3150  *         elif self._default_ns:             # <<<<<<<<<<<<<<
3151  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3152  *         else:
3153  */
3154   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
3155   __Pyx_GOTREF(__pyx_t_2);
3156   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
3157   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3158   if (__pyx_t_5) {
3159
3160     /* "lxml/sax.py":85
3161  *             el_tag = "{%s}%s" % ns_name_tuple
3162  *         elif self._default_ns:
3163  *             el_tag = "{%s}%s" % (self._default_ns, local_name)             # <<<<<<<<<<<<<<
3164  *         else:
3165  *             el_tag = local_name
3166  */
3167     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_default_ns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3168     __Pyx_GOTREF(__pyx_t_2);
3169     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
3170     __Pyx_GOTREF(__pyx_t_1);
3171     __Pyx_GIVEREF(__pyx_t_2);
3172     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3173     __Pyx_INCREF(__pyx_v_local_name);
3174     __Pyx_GIVEREF(__pyx_v_local_name);
3175     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
3176     __pyx_t_2 = 0;
3177     __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3178     __Pyx_GOTREF(__pyx_t_2);
3179     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3180     __pyx_v_el_tag = __pyx_t_2;
3181     __pyx_t_2 = 0;
3182
3183     /* "lxml/sax.py":84
3184  *         if ns_uri:
3185  *             el_tag = "{%s}%s" % ns_name_tuple
3186  *         elif self._default_ns:             # <<<<<<<<<<<<<<
3187  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3188  *         else:
3189  */
3190     goto __pyx_L5;
3191   }
3192
3193   /* "lxml/sax.py":87
3194  *             el_tag = "{%s}%s" % (self._default_ns, local_name)
3195  *         else:
3196  *             el_tag = local_name             # <<<<<<<<<<<<<<
3197  *         return el_tag
3198  * 
3199  */
3200   /*else*/ {
3201     __Pyx_INCREF(__pyx_v_local_name);
3202     __pyx_v_el_tag = __pyx_v_local_name;
3203   }
3204   __pyx_L5:;
3205
3206   /* "lxml/sax.py":88
3207  *         else:
3208  *             el_tag = local_name
3209  *         return el_tag             # <<<<<<<<<<<<<<
3210  * 
3211  *     def startElementNS(self, ns_name, qname, attributes=None):
3212  */
3213   __Pyx_XDECREF(__pyx_r);
3214   __Pyx_INCREF(__pyx_v_el_tag);
3215   __pyx_r = __pyx_v_el_tag;
3216   goto __pyx_L0;
3217
3218   /* "lxml/sax.py":80
3219  *             self._default_ns = ns_uri_list[-1]
3220  * 
3221  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
3222  *         ns_uri, local_name = ns_name_tuple
3223  *         if ns_uri:
3224  */
3225
3226   /* function exit code */
3227   __pyx_L1_error:;
3228   __Pyx_XDECREF(__pyx_t_1);
3229   __Pyx_XDECREF(__pyx_t_2);
3230   __Pyx_XDECREF(__pyx_t_3);
3231   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3232   __pyx_r = NULL;
3233   __pyx_L0:;
3234   __Pyx_XDECREF(__pyx_v_ns_uri);
3235   __Pyx_XDECREF(__pyx_v_local_name);
3236   __Pyx_XDECREF(__pyx_v_el_tag);
3237   __Pyx_XGIVEREF(__pyx_r);
3238   __Pyx_RefNannyFinishContext();
3239   return __pyx_r;
3240 }
3241
3242 /* "lxml/sax.py":90
3243  *         return el_tag
3244  * 
3245  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
3246  *         el_name = self._buildTag(ns_name)
3247  *         if attributes:
3248  */
3249
3250 /* Python wrapper */
3251 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3252 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_17startElementNS = {"startElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS, METH_VARARGS|METH_KEYWORDS, 0};
3253 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3254   PyObject *__pyx_v_self = 0;
3255   PyObject *__pyx_v_ns_name = 0;
3256   CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
3257   PyObject *__pyx_v_attributes = 0;
3258   int __pyx_lineno = 0;
3259   const char *__pyx_filename = NULL;
3260   int __pyx_clineno = 0;
3261   PyObject *__pyx_r = 0;
3262   __Pyx_RefNannyDeclarations
3263   __Pyx_RefNannySetupContext("startElementNS (wrapper)", 0);
3264   {
3265     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,&__pyx_n_s_attributes,0};
3266     PyObject* values[4] = {0,0,0,0};
3267     values[3] = ((PyObject *)((PyObject *)Py_None));
3268     if (unlikely(__pyx_kwds)) {
3269       Py_ssize_t kw_args;
3270       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3271       switch (pos_args) {
3272         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3273         CYTHON_FALLTHROUGH;
3274         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3275         CYTHON_FALLTHROUGH;
3276         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3277         CYTHON_FALLTHROUGH;
3278         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3279         CYTHON_FALLTHROUGH;
3280         case  0: break;
3281         default: goto __pyx_L5_argtuple_error;
3282       }
3283       kw_args = PyDict_Size(__pyx_kwds);
3284       switch (pos_args) {
3285         case  0:
3286         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3287         else goto __pyx_L5_argtuple_error;
3288         CYTHON_FALLTHROUGH;
3289         case  1:
3290         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
3291         else {
3292           __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 1); __PYX_ERR(0, 90, __pyx_L3_error)
3293         }
3294         CYTHON_FALLTHROUGH;
3295         case  2:
3296         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
3297         else {
3298           __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 2); __PYX_ERR(0, 90, __pyx_L3_error)
3299         }
3300         CYTHON_FALLTHROUGH;
3301         case  3:
3302         if (kw_args > 0) {
3303           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
3304           if (value) { values[3] = value; kw_args--; }
3305         }
3306       }
3307       if (unlikely(kw_args > 0)) {
3308         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElementNS") < 0)) __PYX_ERR(0, 90, __pyx_L3_error)
3309       }
3310     } else {
3311       switch (PyTuple_GET_SIZE(__pyx_args)) {
3312         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3313         CYTHON_FALLTHROUGH;
3314         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3315         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3316         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3317         break;
3318         default: goto __pyx_L5_argtuple_error;
3319       }
3320     }
3321     __pyx_v_self = values[0];
3322     __pyx_v_ns_name = values[1];
3323     __pyx_v_qname = values[2];
3324     __pyx_v_attributes = values[3];
3325   }
3326   goto __pyx_L4_argument_unpacking_done;
3327   __pyx_L5_argtuple_error:;
3328   __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error)
3329   __pyx_L3_error:;
3330   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3331   __Pyx_RefNannyFinishContext();
3332   return NULL;
3333   __pyx_L4_argument_unpacking_done:;
3334   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname, __pyx_v_attributes);
3335
3336   /* function exit code */
3337   __Pyx_RefNannyFinishContext();
3338   return __pyx_r;
3339 }
3340
3341 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname, PyObject *__pyx_v_attributes) {
3342   PyObject *__pyx_v_el_name = NULL;
3343   PyObject *__pyx_v_attrs = NULL;
3344   PyObject *__pyx_v_iter_attributes = NULL;
3345   PyObject *__pyx_v_name_tuple = NULL;
3346   PyObject *__pyx_v_value = NULL;
3347   PyObject *__pyx_v_attr_name = NULL;
3348   PyObject *__pyx_v_element_stack = NULL;
3349   PyObject *__pyx_v_element = NULL;
3350   PyObject *__pyx_v_sibling = NULL;
3351   PyObject *__pyx_r = NULL;
3352   __Pyx_RefNannyDeclarations
3353   PyObject *__pyx_t_1 = NULL;
3354   PyObject *__pyx_t_2 = NULL;
3355   PyObject *__pyx_t_3 = NULL;
3356   int __pyx_t_4;
3357   PyObject *__pyx_t_5 = NULL;
3358   PyObject *__pyx_t_6 = NULL;
3359   PyObject *__pyx_t_7 = NULL;
3360   int __pyx_t_8;
3361   PyObject *__pyx_t_9 = NULL;
3362   PyObject *__pyx_t_10 = NULL;
3363   PyObject *__pyx_t_11 = NULL;
3364   Py_ssize_t __pyx_t_12;
3365   PyObject *(*__pyx_t_13)(PyObject *);
3366   PyObject *(*__pyx_t_14)(PyObject *);
3367   int __pyx_t_15;
3368   int __pyx_t_16;
3369   int __pyx_t_17;
3370   int __pyx_lineno = 0;
3371   const char *__pyx_filename = NULL;
3372   int __pyx_clineno = 0;
3373   __Pyx_RefNannySetupContext("startElementNS", 0);
3374
3375   /* "lxml/sax.py":91
3376  * 
3377  *     def startElementNS(self, ns_name, qname, attributes=None):
3378  *         el_name = self._buildTag(ns_name)             # <<<<<<<<<<<<<<
3379  *         if attributes:
3380  *             attrs = {}
3381  */
3382   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_buildTag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
3383   __Pyx_GOTREF(__pyx_t_2);
3384   __pyx_t_3 = NULL;
3385   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3386     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3387     if (likely(__pyx_t_3)) {
3388       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3389       __Pyx_INCREF(__pyx_t_3);
3390       __Pyx_INCREF(function);
3391       __Pyx_DECREF_SET(__pyx_t_2, function);
3392     }
3393   }
3394   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_ns_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ns_name);
3395   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3396   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
3397   __Pyx_GOTREF(__pyx_t_1);
3398   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3399   __pyx_v_el_name = __pyx_t_1;
3400   __pyx_t_1 = 0;
3401
3402   /* "lxml/sax.py":92
3403  *     def startElementNS(self, ns_name, qname, attributes=None):
3404  *         el_name = self._buildTag(ns_name)
3405  *         if attributes:             # <<<<<<<<<<<<<<
3406  *             attrs = {}
3407  *             try:
3408  */
3409   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 92, __pyx_L1_error)
3410   if (__pyx_t_4) {
3411
3412     /* "lxml/sax.py":93
3413  *         el_name = self._buildTag(ns_name)
3414  *         if attributes:
3415  *             attrs = {}             # <<<<<<<<<<<<<<
3416  *             try:
3417  *                 iter_attributes = attributes.iteritems()
3418  */
3419     __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
3420     __Pyx_GOTREF(__pyx_t_1);
3421     __pyx_v_attrs = ((PyObject*)__pyx_t_1);
3422     __pyx_t_1 = 0;
3423
3424     /* "lxml/sax.py":94
3425  *         if attributes:
3426  *             attrs = {}
3427  *             try:             # <<<<<<<<<<<<<<
3428  *                 iter_attributes = attributes.iteritems()
3429  *             except AttributeError:
3430  */
3431     {
3432       __Pyx_PyThreadState_declare
3433       __Pyx_PyThreadState_assign
3434       __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
3435       __Pyx_XGOTREF(__pyx_t_5);
3436       __Pyx_XGOTREF(__pyx_t_6);
3437       __Pyx_XGOTREF(__pyx_t_7);
3438       /*try:*/ {
3439
3440         /* "lxml/sax.py":95
3441  *             attrs = {}
3442  *             try:
3443  *                 iter_attributes = attributes.iteritems()             # <<<<<<<<<<<<<<
3444  *             except AttributeError:
3445  *                 iter_attributes = attributes.items()
3446  */
3447         __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L4_error)
3448         __Pyx_GOTREF(__pyx_t_2);
3449         __pyx_t_3 = NULL;
3450         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3451           __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3452           if (likely(__pyx_t_3)) {
3453             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3454             __Pyx_INCREF(__pyx_t_3);
3455             __Pyx_INCREF(function);
3456             __Pyx_DECREF_SET(__pyx_t_2, function);
3457           }
3458         }
3459         __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3460         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3461         if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L4_error)
3462         __Pyx_GOTREF(__pyx_t_1);
3463         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3464         __pyx_v_iter_attributes = __pyx_t_1;
3465         __pyx_t_1 = 0;
3466
3467         /* "lxml/sax.py":94
3468  *         if attributes:
3469  *             attrs = {}
3470  *             try:             # <<<<<<<<<<<<<<
3471  *                 iter_attributes = attributes.iteritems()
3472  *             except AttributeError:
3473  */
3474       }
3475       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3476       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3477       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3478       goto __pyx_L9_try_end;
3479       __pyx_L4_error:;
3480       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3481       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3482       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3483
3484       /* "lxml/sax.py":96
3485  *             try:
3486  *                 iter_attributes = attributes.iteritems()
3487  *             except AttributeError:             # <<<<<<<<<<<<<<
3488  *                 iter_attributes = attributes.items()
3489  * 
3490  */
3491       __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
3492       if (__pyx_t_8) {
3493         __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3494         if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 96, __pyx_L6_except_error)
3495         __Pyx_GOTREF(__pyx_t_1);
3496         __Pyx_GOTREF(__pyx_t_2);
3497         __Pyx_GOTREF(__pyx_t_3);
3498
3499         /* "lxml/sax.py":97
3500  *                 iter_attributes = attributes.iteritems()
3501  *             except AttributeError:
3502  *                 iter_attributes = attributes.items()             # <<<<<<<<<<<<<<
3503  * 
3504  *             for name_tuple, value in iter_attributes:
3505  */
3506         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_items); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 97, __pyx_L6_except_error)
3507         __Pyx_GOTREF(__pyx_t_10);
3508         __pyx_t_11 = NULL;
3509         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3510           __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
3511           if (likely(__pyx_t_11)) {
3512             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3513             __Pyx_INCREF(__pyx_t_11);
3514             __Pyx_INCREF(function);
3515             __Pyx_DECREF_SET(__pyx_t_10, function);
3516           }
3517         }
3518         __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
3519         __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3520         if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L6_except_error)
3521         __Pyx_GOTREF(__pyx_t_9);
3522         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3523         __Pyx_XDECREF_SET(__pyx_v_iter_attributes, __pyx_t_9);
3524         __pyx_t_9 = 0;
3525         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3526         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3527         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3528         goto __pyx_L5_exception_handled;
3529       }
3530       goto __pyx_L6_except_error;
3531       __pyx_L6_except_error:;
3532
3533       /* "lxml/sax.py":94
3534  *         if attributes:
3535  *             attrs = {}
3536  *             try:             # <<<<<<<<<<<<<<
3537  *                 iter_attributes = attributes.iteritems()
3538  *             except AttributeError:
3539  */
3540       __Pyx_XGIVEREF(__pyx_t_5);
3541       __Pyx_XGIVEREF(__pyx_t_6);
3542       __Pyx_XGIVEREF(__pyx_t_7);
3543       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3544       goto __pyx_L1_error;
3545       __pyx_L5_exception_handled:;
3546       __Pyx_XGIVEREF(__pyx_t_5);
3547       __Pyx_XGIVEREF(__pyx_t_6);
3548       __Pyx_XGIVEREF(__pyx_t_7);
3549       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3550       __pyx_L9_try_end:;
3551     }
3552
3553     /* "lxml/sax.py":99
3554  *                 iter_attributes = attributes.items()
3555  * 
3556  *             for name_tuple, value in iter_attributes:             # <<<<<<<<<<<<<<
3557  *                 if name_tuple[0]:
3558  *                     attr_name = "{%s}%s" % name_tuple
3559  */
3560     if (likely(PyList_CheckExact(__pyx_v_iter_attributes)) || PyTuple_CheckExact(__pyx_v_iter_attributes)) {
3561       __pyx_t_3 = __pyx_v_iter_attributes; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
3562       __pyx_t_13 = NULL;
3563     } else {
3564       __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_iter_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
3565       __Pyx_GOTREF(__pyx_t_3);
3566       __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 99, __pyx_L1_error)
3567     }
3568     for (;;) {
3569       if (likely(!__pyx_t_13)) {
3570         if (likely(PyList_CheckExact(__pyx_t_3))) {
3571           if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
3572           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3573           __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
3574           #else
3575           __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
3576           __Pyx_GOTREF(__pyx_t_2);
3577           #endif
3578         } else {
3579           if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3580           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3581           __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
3582           #else
3583           __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
3584           __Pyx_GOTREF(__pyx_t_2);
3585           #endif
3586         }
3587       } else {
3588         __pyx_t_2 = __pyx_t_13(__pyx_t_3);
3589         if (unlikely(!__pyx_t_2)) {
3590           PyObject* exc_type = PyErr_Occurred();
3591           if (exc_type) {
3592             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3593             else __PYX_ERR(0, 99, __pyx_L1_error)
3594           }
3595           break;
3596         }
3597         __Pyx_GOTREF(__pyx_t_2);
3598       }
3599       if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3600         PyObject* sequence = __pyx_t_2;
3601         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3602         if (unlikely(size != 2)) {
3603           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3604           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3605           __PYX_ERR(0, 99, __pyx_L1_error)
3606         }
3607         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3608         if (likely(PyTuple_CheckExact(sequence))) {
3609           __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
3610           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
3611         } else {
3612           __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
3613           __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
3614         }
3615         __Pyx_INCREF(__pyx_t_1);
3616         __Pyx_INCREF(__pyx_t_9);
3617         #else
3618         __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
3619         __Pyx_GOTREF(__pyx_t_1);
3620         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error)
3621         __Pyx_GOTREF(__pyx_t_9);
3622         #endif
3623         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3624       } else {
3625         Py_ssize_t index = -1;
3626         __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 99, __pyx_L1_error)
3627         __Pyx_GOTREF(__pyx_t_10);
3628         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3629         __pyx_t_14 = Py_TYPE(__pyx_t_10)->tp_iternext;
3630         index = 0; __pyx_t_1 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L14_unpacking_failed;
3631         __Pyx_GOTREF(__pyx_t_1);
3632         index = 1; __pyx_t_9 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
3633         __Pyx_GOTREF(__pyx_t_9);
3634         if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_10), 2) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
3635         __pyx_t_14 = NULL;
3636         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3637         goto __pyx_L15_unpacking_done;
3638         __pyx_L14_unpacking_failed:;
3639         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3640         __pyx_t_14 = NULL;
3641         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3642         __PYX_ERR(0, 99, __pyx_L1_error)
3643         __pyx_L15_unpacking_done:;
3644       }
3645       __Pyx_XDECREF_SET(__pyx_v_name_tuple, __pyx_t_1);
3646       __pyx_t_1 = 0;
3647       __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
3648       __pyx_t_9 = 0;
3649
3650       /* "lxml/sax.py":100
3651  * 
3652  *             for name_tuple, value in iter_attributes:
3653  *                 if name_tuple[0]:             # <<<<<<<<<<<<<<
3654  *                     attr_name = "{%s}%s" % name_tuple
3655  *                 else:
3656  */
3657       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_name_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
3658       __Pyx_GOTREF(__pyx_t_2);
3659       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
3660       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3661       if (__pyx_t_4) {
3662
3663         /* "lxml/sax.py":101
3664  *             for name_tuple, value in iter_attributes:
3665  *                 if name_tuple[0]:
3666  *                     attr_name = "{%s}%s" % name_tuple             # <<<<<<<<<<<<<<
3667  *                 else:
3668  *                     attr_name = name_tuple[1]
3669  */
3670         __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s_s, __pyx_v_name_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
3671         __Pyx_GOTREF(__pyx_t_2);
3672         __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3673         __pyx_t_2 = 0;
3674
3675         /* "lxml/sax.py":100
3676  * 
3677  *             for name_tuple, value in iter_attributes:
3678  *                 if name_tuple[0]:             # <<<<<<<<<<<<<<
3679  *                     attr_name = "{%s}%s" % name_tuple
3680  *                 else:
3681  */
3682         goto __pyx_L16;
3683       }
3684
3685       /* "lxml/sax.py":103
3686  *                     attr_name = "{%s}%s" % name_tuple
3687  *                 else:
3688  *                     attr_name = name_tuple[1]             # <<<<<<<<<<<<<<
3689  *                 attrs[attr_name] = value
3690  *         else:
3691  */
3692       /*else*/ {
3693         __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_name_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
3694         __Pyx_GOTREF(__pyx_t_2);
3695         __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3696         __pyx_t_2 = 0;
3697       }
3698       __pyx_L16:;
3699
3700       /* "lxml/sax.py":104
3701  *                 else:
3702  *                     attr_name = name_tuple[1]
3703  *                 attrs[attr_name] = value             # <<<<<<<<<<<<<<
3704  *         else:
3705  *             attrs = None
3706  */
3707       if (unlikely(PyDict_SetItem(__pyx_v_attrs, __pyx_v_attr_name, __pyx_v_value) < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
3708
3709       /* "lxml/sax.py":99
3710  *                 iter_attributes = attributes.items()
3711  * 
3712  *             for name_tuple, value in iter_attributes:             # <<<<<<<<<<<<<<
3713  *                 if name_tuple[0]:
3714  *                     attr_name = "{%s}%s" % name_tuple
3715  */
3716     }
3717     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3718
3719     /* "lxml/sax.py":92
3720  *     def startElementNS(self, ns_name, qname, attributes=None):
3721  *         el_name = self._buildTag(ns_name)
3722  *         if attributes:             # <<<<<<<<<<<<<<
3723  *             attrs = {}
3724  *             try:
3725  */
3726     goto __pyx_L3;
3727   }
3728
3729   /* "lxml/sax.py":106
3730  *                 attrs[attr_name] = value
3731  *         else:
3732  *             attrs = None             # <<<<<<<<<<<<<<
3733  * 
3734  *         element_stack = self._element_stack
3735  */
3736   /*else*/ {
3737     __Pyx_INCREF(Py_None);
3738     __pyx_v_attrs = ((PyObject*)Py_None);
3739   }
3740   __pyx_L3:;
3741
3742   /* "lxml/sax.py":108
3743  *             attrs = None
3744  * 
3745  *         element_stack = self._element_stack             # <<<<<<<<<<<<<<
3746  *         if self._root is None:
3747  *             element = self._root = \
3748  */
3749   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
3750   __Pyx_GOTREF(__pyx_t_3);
3751   __pyx_v_element_stack = __pyx_t_3;
3752   __pyx_t_3 = 0;
3753
3754   /* "lxml/sax.py":109
3755  * 
3756  *         element_stack = self._element_stack
3757  *         if self._root is None:             # <<<<<<<<<<<<<<
3758  *             element = self._root = \
3759  *                       self._makeelement(el_name, attrs, self._new_mappings)
3760  */
3761   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
3762   __Pyx_GOTREF(__pyx_t_3);
3763   __pyx_t_4 = (__pyx_t_3 == Py_None);
3764   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3765   __pyx_t_15 = (__pyx_t_4 != 0);
3766   if (__pyx_t_15) {
3767
3768     /* "lxml/sax.py":111
3769  *         if self._root is None:
3770  *             element = self._root = \
3771  *                       self._makeelement(el_name, attrs, self._new_mappings)             # <<<<<<<<<<<<<<
3772  *             if self._root_siblings and hasattr(element, 'addprevious'):
3773  *                 for sibling in self._root_siblings:
3774  */
3775     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
3776     __Pyx_GOTREF(__pyx_t_2);
3777     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error)
3778     __Pyx_GOTREF(__pyx_t_9);
3779     __pyx_t_1 = NULL;
3780     __pyx_t_8 = 0;
3781     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3782       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3783       if (likely(__pyx_t_1)) {
3784         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3785         __Pyx_INCREF(__pyx_t_1);
3786         __Pyx_INCREF(function);
3787         __Pyx_DECREF_SET(__pyx_t_2, function);
3788         __pyx_t_8 = 1;
3789       }
3790     }
3791     #if CYTHON_FAST_PYCALL
3792     if (PyFunction_Check(__pyx_t_2)) {
3793       PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3794       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3795       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3796       __Pyx_GOTREF(__pyx_t_3);
3797       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3798     } else
3799     #endif
3800     #if CYTHON_FAST_PYCCALL
3801     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3802       PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3803       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3804       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3805       __Pyx_GOTREF(__pyx_t_3);
3806       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3807     } else
3808     #endif
3809     {
3810       __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L1_error)
3811       __Pyx_GOTREF(__pyx_t_10);
3812       if (__pyx_t_1) {
3813         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
3814       }
3815       __Pyx_INCREF(__pyx_v_el_name);
3816       __Pyx_GIVEREF(__pyx_v_el_name);
3817       PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_el_name);
3818       __Pyx_INCREF(__pyx_v_attrs);
3819       __Pyx_GIVEREF(__pyx_v_attrs);
3820       PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_attrs);
3821       __Pyx_GIVEREF(__pyx_t_9);
3822       PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_9);
3823       __pyx_t_9 = 0;
3824       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
3825       __Pyx_GOTREF(__pyx_t_3);
3826       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3827     }
3828     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3829     __Pyx_INCREF(__pyx_t_3);
3830     __pyx_v_element = __pyx_t_3;
3831
3832     /* "lxml/sax.py":110
3833  *         element_stack = self._element_stack
3834  *         if self._root is None:
3835  *             element = self._root = \             # <<<<<<<<<<<<<<
3836  *                       self._makeelement(el_name, attrs, self._new_mappings)
3837  *             if self._root_siblings and hasattr(element, 'addprevious'):
3838  */
3839     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, __pyx_t_3) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
3840     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3841
3842     /* "lxml/sax.py":112
3843  *             element = self._root = \
3844  *                       self._makeelement(el_name, attrs, self._new_mappings)
3845  *             if self._root_siblings and hasattr(element, 'addprevious'):             # <<<<<<<<<<<<<<
3846  *                 for sibling in self._root_siblings:
3847  *                     element.addprevious(sibling)
3848  */
3849     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
3850     __Pyx_GOTREF(__pyx_t_3);
3851     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
3852     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3853     if (__pyx_t_4) {
3854     } else {
3855       __pyx_t_15 = __pyx_t_4;
3856       goto __pyx_L19_bool_binop_done;
3857     }
3858     __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_addprevious); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 112, __pyx_L1_error)
3859     __pyx_t_16 = (__pyx_t_4 != 0);
3860     __pyx_t_15 = __pyx_t_16;
3861     __pyx_L19_bool_binop_done:;
3862     if (__pyx_t_15) {
3863
3864       /* "lxml/sax.py":113
3865  *                       self._makeelement(el_name, attrs, self._new_mappings)
3866  *             if self._root_siblings and hasattr(element, 'addprevious'):
3867  *                 for sibling in self._root_siblings:             # <<<<<<<<<<<<<<
3868  *                     element.addprevious(sibling)
3869  *             del self._root_siblings[:]
3870  */
3871       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3872       __Pyx_GOTREF(__pyx_t_3);
3873       if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
3874         __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
3875         __pyx_t_13 = NULL;
3876       } else {
3877         __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
3878         __Pyx_GOTREF(__pyx_t_2);
3879         __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 113, __pyx_L1_error)
3880       }
3881       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3882       for (;;) {
3883         if (likely(!__pyx_t_13)) {
3884           if (likely(PyList_CheckExact(__pyx_t_2))) {
3885             if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
3886             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3887             __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
3888             #else
3889             __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3890             __Pyx_GOTREF(__pyx_t_3);
3891             #endif
3892           } else {
3893             if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3894             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3895             __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
3896             #else
3897             __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
3898             __Pyx_GOTREF(__pyx_t_3);
3899             #endif
3900           }
3901         } else {
3902           __pyx_t_3 = __pyx_t_13(__pyx_t_2);
3903           if (unlikely(!__pyx_t_3)) {
3904             PyObject* exc_type = PyErr_Occurred();
3905             if (exc_type) {
3906               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3907               else __PYX_ERR(0, 113, __pyx_L1_error)
3908             }
3909             break;
3910           }
3911           __Pyx_GOTREF(__pyx_t_3);
3912         }
3913         __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
3914         __pyx_t_3 = 0;
3915
3916         /* "lxml/sax.py":114
3917  *             if self._root_siblings and hasattr(element, 'addprevious'):
3918  *                 for sibling in self._root_siblings:
3919  *                     element.addprevious(sibling)             # <<<<<<<<<<<<<<
3920  *             del self._root_siblings[:]
3921  *         else:
3922  */
3923         __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_addprevious); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 114, __pyx_L1_error)
3924         __Pyx_GOTREF(__pyx_t_10);
3925         __pyx_t_9 = NULL;
3926         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3927           __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
3928           if (likely(__pyx_t_9)) {
3929             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3930             __Pyx_INCREF(__pyx_t_9);
3931             __Pyx_INCREF(function);
3932             __Pyx_DECREF_SET(__pyx_t_10, function);
3933           }
3934         }
3935         __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_sibling) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_sibling);
3936         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3937         if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
3938         __Pyx_GOTREF(__pyx_t_3);
3939         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3940         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3941
3942         /* "lxml/sax.py":113
3943  *                       self._makeelement(el_name, attrs, self._new_mappings)
3944  *             if self._root_siblings and hasattr(element, 'addprevious'):
3945  *                 for sibling in self._root_siblings:             # <<<<<<<<<<<<<<
3946  *                     element.addprevious(sibling)
3947  *             del self._root_siblings[:]
3948  */
3949       }
3950       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3951
3952       /* "lxml/sax.py":112
3953  *             element = self._root = \
3954  *                       self._makeelement(el_name, attrs, self._new_mappings)
3955  *             if self._root_siblings and hasattr(element, 'addprevious'):             # <<<<<<<<<<<<<<
3956  *                 for sibling in self._root_siblings:
3957  *                     element.addprevious(sibling)
3958  */
3959     }
3960
3961     /* "lxml/sax.py":115
3962  *                 for sibling in self._root_siblings:
3963  *                     element.addprevious(sibling)
3964  *             del self._root_siblings[:]             # <<<<<<<<<<<<<<
3965  *         else:
3966  *             element = SubElement(element_stack[-1], el_name,
3967  */
3968     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
3969     __Pyx_GOTREF(__pyx_t_2);
3970     if (__Pyx_PyObject_DelSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 115, __pyx_L1_error)
3971     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3972
3973     /* "lxml/sax.py":109
3974  * 
3975  *         element_stack = self._element_stack
3976  *         if self._root is None:             # <<<<<<<<<<<<<<
3977  *             element = self._root = \
3978  *                       self._makeelement(el_name, attrs, self._new_mappings)
3979  */
3980     goto __pyx_L17;
3981   }
3982
3983   /* "lxml/sax.py":117
3984  *             del self._root_siblings[:]
3985  *         else:
3986  *             element = SubElement(element_stack[-1], el_name,             # <<<<<<<<<<<<<<
3987  *                                  attrs, self._new_mappings)
3988  *         element_stack.append(element)
3989  */
3990   /*else*/ {
3991     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
3992     __Pyx_GOTREF(__pyx_t_3);
3993     __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_element_stack, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 117, __pyx_L1_error)
3994     __Pyx_GOTREF(__pyx_t_10);
3995
3996     /* "lxml/sax.py":118
3997  *         else:
3998  *             element = SubElement(element_stack[-1], el_name,
3999  *                                  attrs, self._new_mappings)             # <<<<<<<<<<<<<<
4000  *         element_stack.append(element)
4001  * 
4002  */
4003     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error)
4004     __Pyx_GOTREF(__pyx_t_9);
4005     __pyx_t_1 = NULL;
4006     __pyx_t_8 = 0;
4007     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4008       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
4009       if (likely(__pyx_t_1)) {
4010         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4011         __Pyx_INCREF(__pyx_t_1);
4012         __Pyx_INCREF(function);
4013         __Pyx_DECREF_SET(__pyx_t_3, function);
4014         __pyx_t_8 = 1;
4015       }
4016     }
4017     #if CYTHON_FAST_PYCALL
4018     if (PyFunction_Check(__pyx_t_3)) {
4019       PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4020       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4021       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4022       __Pyx_GOTREF(__pyx_t_2);
4023       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4024       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4025     } else
4026     #endif
4027     #if CYTHON_FAST_PYCCALL
4028     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
4029       PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4030       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4031       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4032       __Pyx_GOTREF(__pyx_t_2);
4033       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4034       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4035     } else
4036     #endif
4037     {
4038       __pyx_t_11 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L1_error)
4039       __Pyx_GOTREF(__pyx_t_11);
4040       if (__pyx_t_1) {
4041         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
4042       }
4043       __Pyx_GIVEREF(__pyx_t_10);
4044       PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_t_10);
4045       __Pyx_INCREF(__pyx_v_el_name);
4046       __Pyx_GIVEREF(__pyx_v_el_name);
4047       PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_v_el_name);
4048       __Pyx_INCREF(__pyx_v_attrs);
4049       __Pyx_GIVEREF(__pyx_v_attrs);
4050       PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_v_attrs);
4051       __Pyx_GIVEREF(__pyx_t_9);
4052       PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_8, __pyx_t_9);
4053       __pyx_t_10 = 0;
4054       __pyx_t_9 = 0;
4055       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
4056       __Pyx_GOTREF(__pyx_t_2);
4057       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4058     }
4059     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4060     __pyx_v_element = __pyx_t_2;
4061     __pyx_t_2 = 0;
4062   }
4063   __pyx_L17:;
4064
4065   /* "lxml/sax.py":119
4066  *             element = SubElement(element_stack[-1], el_name,
4067  *                                  attrs, self._new_mappings)
4068  *         element_stack.append(element)             # <<<<<<<<<<<<<<
4069  * 
4070  *         self._new_mappings.clear()
4071  */
4072   __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_element_stack, __pyx_v_element); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 119, __pyx_L1_error)
4073
4074   /* "lxml/sax.py":121
4075  *         element_stack.append(element)
4076  * 
4077  *         self._new_mappings.clear()             # <<<<<<<<<<<<<<
4078  * 
4079  *     def processingInstruction(self, target, data):
4080  */
4081   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
4082   __Pyx_GOTREF(__pyx_t_3);
4083   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_clear); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error)
4084   __Pyx_GOTREF(__pyx_t_11);
4085   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4086   __pyx_t_3 = NULL;
4087   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
4088     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
4089     if (likely(__pyx_t_3)) {
4090       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
4091       __Pyx_INCREF(__pyx_t_3);
4092       __Pyx_INCREF(function);
4093       __Pyx_DECREF_SET(__pyx_t_11, function);
4094     }
4095   }
4096   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
4097   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4098   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
4099   __Pyx_GOTREF(__pyx_t_2);
4100   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4101   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4102
4103   /* "lxml/sax.py":90
4104  *         return el_tag
4105  * 
4106  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
4107  *         el_name = self._buildTag(ns_name)
4108  *         if attributes:
4109  */
4110
4111   /* function exit code */
4112   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4113   goto __pyx_L0;
4114   __pyx_L1_error:;
4115   __Pyx_XDECREF(__pyx_t_1);
4116   __Pyx_XDECREF(__pyx_t_2);
4117   __Pyx_XDECREF(__pyx_t_3);
4118   __Pyx_XDECREF(__pyx_t_9);
4119   __Pyx_XDECREF(__pyx_t_10);
4120   __Pyx_XDECREF(__pyx_t_11);
4121   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4122   __pyx_r = NULL;
4123   __pyx_L0:;
4124   __Pyx_XDECREF(__pyx_v_el_name);
4125   __Pyx_XDECREF(__pyx_v_attrs);
4126   __Pyx_XDECREF(__pyx_v_iter_attributes);
4127   __Pyx_XDECREF(__pyx_v_name_tuple);
4128   __Pyx_XDECREF(__pyx_v_value);
4129   __Pyx_XDECREF(__pyx_v_attr_name);
4130   __Pyx_XDECREF(__pyx_v_element_stack);
4131   __Pyx_XDECREF(__pyx_v_element);
4132   __Pyx_XDECREF(__pyx_v_sibling);
4133   __Pyx_XGIVEREF(__pyx_r);
4134   __Pyx_RefNannyFinishContext();
4135   return __pyx_r;
4136 }
4137
4138 /* "lxml/sax.py":123
4139  *         self._new_mappings.clear()
4140  * 
4141  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
4142  *         pi = ProcessingInstruction(target, data)
4143  *         if self._root is None:
4144  */
4145
4146 /* Python wrapper */
4147 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4148 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction = {"processingInstruction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction, METH_VARARGS|METH_KEYWORDS, 0};
4149 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4150   PyObject *__pyx_v_self = 0;
4151   PyObject *__pyx_v_target = 0;
4152   PyObject *__pyx_v_data = 0;
4153   int __pyx_lineno = 0;
4154   const char *__pyx_filename = NULL;
4155   int __pyx_clineno = 0;
4156   PyObject *__pyx_r = 0;
4157   __Pyx_RefNannyDeclarations
4158   __Pyx_RefNannySetupContext("processingInstruction (wrapper)", 0);
4159   {
4160     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_target,&__pyx_n_s_data,0};
4161     PyObject* values[3] = {0,0,0};
4162     if (unlikely(__pyx_kwds)) {
4163       Py_ssize_t kw_args;
4164       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4165       switch (pos_args) {
4166         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4167         CYTHON_FALLTHROUGH;
4168         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4169         CYTHON_FALLTHROUGH;
4170         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4171         CYTHON_FALLTHROUGH;
4172         case  0: break;
4173         default: goto __pyx_L5_argtuple_error;
4174       }
4175       kw_args = PyDict_Size(__pyx_kwds);
4176       switch (pos_args) {
4177         case  0:
4178         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4179         else goto __pyx_L5_argtuple_error;
4180         CYTHON_FALLTHROUGH;
4181         case  1:
4182         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
4183         else {
4184           __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 1); __PYX_ERR(0, 123, __pyx_L3_error)
4185         }
4186         CYTHON_FALLTHROUGH;
4187         case  2:
4188         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4189         else {
4190           __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 2); __PYX_ERR(0, 123, __pyx_L3_error)
4191         }
4192       }
4193       if (unlikely(kw_args > 0)) {
4194         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "processingInstruction") < 0)) __PYX_ERR(0, 123, __pyx_L3_error)
4195       }
4196     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4197       goto __pyx_L5_argtuple_error;
4198     } else {
4199       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4200       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4201       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4202     }
4203     __pyx_v_self = values[0];
4204     __pyx_v_target = values[1];
4205     __pyx_v_data = values[2];
4206   }
4207   goto __pyx_L4_argument_unpacking_done;
4208   __pyx_L5_argtuple_error:;
4209   __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 123, __pyx_L3_error)
4210   __pyx_L3_error:;
4211   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4212   __Pyx_RefNannyFinishContext();
4213   return NULL;
4214   __pyx_L4_argument_unpacking_done:;
4215   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(__pyx_self, __pyx_v_self, __pyx_v_target, __pyx_v_data);
4216
4217   /* function exit code */
4218   __Pyx_RefNannyFinishContext();
4219   return __pyx_r;
4220 }
4221
4222 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_target, PyObject *__pyx_v_data) {
4223   PyObject *__pyx_v_pi = NULL;
4224   PyObject *__pyx_r = NULL;
4225   __Pyx_RefNannyDeclarations
4226   PyObject *__pyx_t_1 = NULL;
4227   PyObject *__pyx_t_2 = NULL;
4228   PyObject *__pyx_t_3 = NULL;
4229   int __pyx_t_4;
4230   PyObject *__pyx_t_5 = NULL;
4231   int __pyx_t_6;
4232   int __pyx_t_7;
4233   int __pyx_t_8;
4234   int __pyx_lineno = 0;
4235   const char *__pyx_filename = NULL;
4236   int __pyx_clineno = 0;
4237   __Pyx_RefNannySetupContext("processingInstruction", 0);
4238
4239   /* "lxml/sax.py":124
4240  * 
4241  *     def processingInstruction(self, target, data):
4242  *         pi = ProcessingInstruction(target, data)             # <<<<<<<<<<<<<<
4243  *         if self._root is None:
4244  *             self._root_siblings.append(pi)
4245  */
4246   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
4247   __Pyx_GOTREF(__pyx_t_2);
4248   __pyx_t_3 = NULL;
4249   __pyx_t_4 = 0;
4250   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4251     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4252     if (likely(__pyx_t_3)) {
4253       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4254       __Pyx_INCREF(__pyx_t_3);
4255       __Pyx_INCREF(function);
4256       __Pyx_DECREF_SET(__pyx_t_2, function);
4257       __pyx_t_4 = 1;
4258     }
4259   }
4260   #if CYTHON_FAST_PYCALL
4261   if (PyFunction_Check(__pyx_t_2)) {
4262     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4263     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4264     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4265     __Pyx_GOTREF(__pyx_t_1);
4266   } else
4267   #endif
4268   #if CYTHON_FAST_PYCCALL
4269   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4270     PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4271     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4272     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4273     __Pyx_GOTREF(__pyx_t_1);
4274   } else
4275   #endif
4276   {
4277     __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
4278     __Pyx_GOTREF(__pyx_t_5);
4279     if (__pyx_t_3) {
4280       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4281     }
4282     __Pyx_INCREF(__pyx_v_target);
4283     __Pyx_GIVEREF(__pyx_v_target);
4284     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_target);
4285     __Pyx_INCREF(__pyx_v_data);
4286     __Pyx_GIVEREF(__pyx_v_data);
4287     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_data);
4288     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4289     __Pyx_GOTREF(__pyx_t_1);
4290     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4291   }
4292   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4293   __pyx_v_pi = __pyx_t_1;
4294   __pyx_t_1 = 0;
4295
4296   /* "lxml/sax.py":125
4297  *     def processingInstruction(self, target, data):
4298  *         pi = ProcessingInstruction(target, data)
4299  *         if self._root is None:             # <<<<<<<<<<<<<<
4300  *             self._root_siblings.append(pi)
4301  *         else:
4302  */
4303   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
4304   __Pyx_GOTREF(__pyx_t_1);
4305   __pyx_t_6 = (__pyx_t_1 == Py_None);
4306   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4307   __pyx_t_7 = (__pyx_t_6 != 0);
4308   if (__pyx_t_7) {
4309
4310     /* "lxml/sax.py":126
4311  *         pi = ProcessingInstruction(target, data)
4312  *         if self._root is None:
4313  *             self._root_siblings.append(pi)             # <<<<<<<<<<<<<<
4314  *         else:
4315  *             self._element_stack[-1].append(pi)
4316  */
4317     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4318     __Pyx_GOTREF(__pyx_t_1);
4319     __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_pi); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error)
4320     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4321
4322     /* "lxml/sax.py":125
4323  *     def processingInstruction(self, target, data):
4324  *         pi = ProcessingInstruction(target, data)
4325  *         if self._root is None:             # <<<<<<<<<<<<<<
4326  *             self._root_siblings.append(pi)
4327  *         else:
4328  */
4329     goto __pyx_L3;
4330   }
4331
4332   /* "lxml/sax.py":128
4333  *             self._root_siblings.append(pi)
4334  *         else:
4335  *             self._element_stack[-1].append(pi)             # <<<<<<<<<<<<<<
4336  * 
4337  *     def endElementNS(self, ns_name, qname):
4338  */
4339   /*else*/ {
4340     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
4341     __Pyx_GOTREF(__pyx_t_1);
4342     __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
4343     __Pyx_GOTREF(__pyx_t_2);
4344     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4345     __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_v_pi); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 128, __pyx_L1_error)
4346     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4347   }
4348   __pyx_L3:;
4349
4350   /* "lxml/sax.py":123
4351  *         self._new_mappings.clear()
4352  * 
4353  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
4354  *         pi = ProcessingInstruction(target, data)
4355  *         if self._root is None:
4356  */
4357
4358   /* function exit code */
4359   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4360   goto __pyx_L0;
4361   __pyx_L1_error:;
4362   __Pyx_XDECREF(__pyx_t_1);
4363   __Pyx_XDECREF(__pyx_t_2);
4364   __Pyx_XDECREF(__pyx_t_3);
4365   __Pyx_XDECREF(__pyx_t_5);
4366   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4367   __pyx_r = NULL;
4368   __pyx_L0:;
4369   __Pyx_XDECREF(__pyx_v_pi);
4370   __Pyx_XGIVEREF(__pyx_r);
4371   __Pyx_RefNannyFinishContext();
4372   return __pyx_r;
4373 }
4374
4375 /* "lxml/sax.py":130
4376  *             self._element_stack[-1].append(pi)
4377  * 
4378  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
4379  *         element = self._element_stack.pop()
4380  *         el_tag = self._buildTag(ns_name)
4381  */
4382
4383 /* Python wrapper */
4384 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4385 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_21endElementNS = {"endElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS, METH_VARARGS|METH_KEYWORDS, 0};
4386 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4387   PyObject *__pyx_v_self = 0;
4388   PyObject *__pyx_v_ns_name = 0;
4389   CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
4390   int __pyx_lineno = 0;
4391   const char *__pyx_filename = NULL;
4392   int __pyx_clineno = 0;
4393   PyObject *__pyx_r = 0;
4394   __Pyx_RefNannyDeclarations
4395   __Pyx_RefNannySetupContext("endElementNS (wrapper)", 0);
4396   {
4397     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,0};
4398     PyObject* values[3] = {0,0,0};
4399     if (unlikely(__pyx_kwds)) {
4400       Py_ssize_t kw_args;
4401       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4402       switch (pos_args) {
4403         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4404         CYTHON_FALLTHROUGH;
4405         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4406         CYTHON_FALLTHROUGH;
4407         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4408         CYTHON_FALLTHROUGH;
4409         case  0: break;
4410         default: goto __pyx_L5_argtuple_error;
4411       }
4412       kw_args = PyDict_Size(__pyx_kwds);
4413       switch (pos_args) {
4414         case  0:
4415         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4416         else goto __pyx_L5_argtuple_error;
4417         CYTHON_FALLTHROUGH;
4418         case  1:
4419         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
4420         else {
4421           __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 1); __PYX_ERR(0, 130, __pyx_L3_error)
4422         }
4423         CYTHON_FALLTHROUGH;
4424         case  2:
4425         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
4426         else {
4427           __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 2); __PYX_ERR(0, 130, __pyx_L3_error)
4428         }
4429       }
4430       if (unlikely(kw_args > 0)) {
4431         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElementNS") < 0)) __PYX_ERR(0, 130, __pyx_L3_error)
4432       }
4433     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4434       goto __pyx_L5_argtuple_error;
4435     } else {
4436       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4437       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4438       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4439     }
4440     __pyx_v_self = values[0];
4441     __pyx_v_ns_name = values[1];
4442     __pyx_v_qname = values[2];
4443   }
4444   goto __pyx_L4_argument_unpacking_done;
4445   __pyx_L5_argtuple_error:;
4446   __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 130, __pyx_L3_error)
4447   __pyx_L3_error:;
4448   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4449   __Pyx_RefNannyFinishContext();
4450   return NULL;
4451   __pyx_L4_argument_unpacking_done:;
4452   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname);
4453
4454   /* function exit code */
4455   __Pyx_RefNannyFinishContext();
4456   return __pyx_r;
4457 }
4458
4459 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name, CYTHON_UNUSED PyObject *__pyx_v_qname) {
4460   PyObject *__pyx_v_element = NULL;
4461   PyObject *__pyx_v_el_tag = NULL;
4462   PyObject *__pyx_r = NULL;
4463   __Pyx_RefNannyDeclarations
4464   PyObject *__pyx_t_1 = NULL;
4465   PyObject *__pyx_t_2 = NULL;
4466   PyObject *__pyx_t_3 = NULL;
4467   int __pyx_t_4;
4468   PyObject *__pyx_t_5 = NULL;
4469   int __pyx_lineno = 0;
4470   const char *__pyx_filename = NULL;
4471   int __pyx_clineno = 0;
4472   __Pyx_RefNannySetupContext("endElementNS", 0);
4473
4474   /* "lxml/sax.py":131
4475  * 
4476  *     def endElementNS(self, ns_name, qname):
4477  *         element = self._element_stack.pop()             # <<<<<<<<<<<<<<
4478  *         el_tag = self._buildTag(ns_name)
4479  *         if el_tag != element.tag:
4480  */
4481   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
4482   __Pyx_GOTREF(__pyx_t_1);
4483   __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
4484   __Pyx_GOTREF(__pyx_t_2);
4485   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4486   __pyx_v_element = __pyx_t_2;
4487   __pyx_t_2 = 0;
4488
4489   /* "lxml/sax.py":132
4490  *     def endElementNS(self, ns_name, qname):
4491  *         element = self._element_stack.pop()
4492  *         el_tag = self._buildTag(ns_name)             # <<<<<<<<<<<<<<
4493  *         if el_tag != element.tag:
4494  *             raise SaxError("Unexpected element closed: " + el_tag)
4495  */
4496   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_buildTag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
4497   __Pyx_GOTREF(__pyx_t_1);
4498   __pyx_t_3 = NULL;
4499   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4500     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
4501     if (likely(__pyx_t_3)) {
4502       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4503       __Pyx_INCREF(__pyx_t_3);
4504       __Pyx_INCREF(function);
4505       __Pyx_DECREF_SET(__pyx_t_1, function);
4506     }
4507   }
4508   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_ns_name) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ns_name);
4509   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4510   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
4511   __Pyx_GOTREF(__pyx_t_2);
4512   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4513   __pyx_v_el_tag = __pyx_t_2;
4514   __pyx_t_2 = 0;
4515
4516   /* "lxml/sax.py":133
4517  *         element = self._element_stack.pop()
4518  *         el_tag = self._buildTag(ns_name)
4519  *         if el_tag != element.tag:             # <<<<<<<<<<<<<<
4520  *             raise SaxError("Unexpected element closed: " + el_tag)
4521  * 
4522  */
4523   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
4524   __Pyx_GOTREF(__pyx_t_2);
4525   __pyx_t_1 = PyObject_RichCompare(__pyx_v_el_tag, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
4526   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4527   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 133, __pyx_L1_error)
4528   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4529   if (unlikely(__pyx_t_4)) {
4530
4531     /* "lxml/sax.py":134
4532  *         el_tag = self._buildTag(ns_name)
4533  *         if el_tag != element.tag:
4534  *             raise SaxError("Unexpected element closed: " + el_tag)             # <<<<<<<<<<<<<<
4535  * 
4536  *     def startElement(self, name, attributes=None):
4537  */
4538     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
4539     __Pyx_GOTREF(__pyx_t_2);
4540     __pyx_t_3 = PyNumber_Add(__pyx_kp_s_Unexpected_element_closed, __pyx_v_el_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
4541     __Pyx_GOTREF(__pyx_t_3);
4542     __pyx_t_5 = NULL;
4543     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4544       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
4545       if (likely(__pyx_t_5)) {
4546         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4547         __Pyx_INCREF(__pyx_t_5);
4548         __Pyx_INCREF(function);
4549         __Pyx_DECREF_SET(__pyx_t_2, function);
4550       }
4551     }
4552     __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
4553     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4554     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4555     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
4556     __Pyx_GOTREF(__pyx_t_1);
4557     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4558     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4559     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4560     __PYX_ERR(0, 134, __pyx_L1_error)
4561
4562     /* "lxml/sax.py":133
4563  *         element = self._element_stack.pop()
4564  *         el_tag = self._buildTag(ns_name)
4565  *         if el_tag != element.tag:             # <<<<<<<<<<<<<<
4566  *             raise SaxError("Unexpected element closed: " + el_tag)
4567  * 
4568  */
4569   }
4570
4571   /* "lxml/sax.py":130
4572  *             self._element_stack[-1].append(pi)
4573  * 
4574  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
4575  *         element = self._element_stack.pop()
4576  *         el_tag = self._buildTag(ns_name)
4577  */
4578
4579   /* function exit code */
4580   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4581   goto __pyx_L0;
4582   __pyx_L1_error:;
4583   __Pyx_XDECREF(__pyx_t_1);
4584   __Pyx_XDECREF(__pyx_t_2);
4585   __Pyx_XDECREF(__pyx_t_3);
4586   __Pyx_XDECREF(__pyx_t_5);
4587   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4588   __pyx_r = NULL;
4589   __pyx_L0:;
4590   __Pyx_XDECREF(__pyx_v_element);
4591   __Pyx_XDECREF(__pyx_v_el_tag);
4592   __Pyx_XGIVEREF(__pyx_r);
4593   __Pyx_RefNannyFinishContext();
4594   return __pyx_r;
4595 }
4596
4597 /* "lxml/sax.py":136
4598  *             raise SaxError("Unexpected element closed: " + el_tag)
4599  * 
4600  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
4601  *         if attributes:
4602  *             attributes = dict(
4603  */
4604
4605 /* Python wrapper */
4606 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4607 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_23startElement = {"startElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement, METH_VARARGS|METH_KEYWORDS, 0};
4608 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4609   PyObject *__pyx_v_self = 0;
4610   PyObject *__pyx_v_name = 0;
4611   PyObject *__pyx_v_attributes = 0;
4612   int __pyx_lineno = 0;
4613   const char *__pyx_filename = NULL;
4614   int __pyx_clineno = 0;
4615   PyObject *__pyx_r = 0;
4616   __Pyx_RefNannyDeclarations
4617   __Pyx_RefNannySetupContext("startElement (wrapper)", 0);
4618   {
4619     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_attributes,0};
4620     PyObject* values[3] = {0,0,0};
4621     values[2] = ((PyObject *)((PyObject *)Py_None));
4622     if (unlikely(__pyx_kwds)) {
4623       Py_ssize_t kw_args;
4624       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4625       switch (pos_args) {
4626         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4627         CYTHON_FALLTHROUGH;
4628         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4629         CYTHON_FALLTHROUGH;
4630         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4631         CYTHON_FALLTHROUGH;
4632         case  0: break;
4633         default: goto __pyx_L5_argtuple_error;
4634       }
4635       kw_args = PyDict_Size(__pyx_kwds);
4636       switch (pos_args) {
4637         case  0:
4638         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4639         else goto __pyx_L5_argtuple_error;
4640         CYTHON_FALLTHROUGH;
4641         case  1:
4642         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
4643         else {
4644           __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4645         }
4646         CYTHON_FALLTHROUGH;
4647         case  2:
4648         if (kw_args > 0) {
4649           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
4650           if (value) { values[2] = value; kw_args--; }
4651         }
4652       }
4653       if (unlikely(kw_args > 0)) {
4654         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElement") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
4655       }
4656     } else {
4657       switch (PyTuple_GET_SIZE(__pyx_args)) {
4658         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4659         CYTHON_FALLTHROUGH;
4660         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4661         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4662         break;
4663         default: goto __pyx_L5_argtuple_error;
4664       }
4665     }
4666     __pyx_v_self = values[0];
4667     __pyx_v_name = values[1];
4668     __pyx_v_attributes = values[2];
4669   }
4670   goto __pyx_L4_argument_unpacking_done;
4671   __pyx_L5_argtuple_error:;
4672   __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
4673   __pyx_L3_error:;
4674   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4675   __Pyx_RefNannyFinishContext();
4676   return NULL;
4677   __pyx_L4_argument_unpacking_done:;
4678   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_attributes);
4679
4680   /* function exit code */
4681   __Pyx_RefNannyFinishContext();
4682   return __pyx_r;
4683 }
4684
4685 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_attributes) {
4686   PyObject *__pyx_v_k = NULL;
4687   PyObject *__pyx_v_v = NULL;
4688   PyObject *__pyx_r = NULL;
4689   __Pyx_RefNannyDeclarations
4690   int __pyx_t_1;
4691   PyObject *__pyx_t_2 = NULL;
4692   PyObject *__pyx_t_3 = NULL;
4693   PyObject *__pyx_t_4 = NULL;
4694   PyObject *__pyx_t_5 = NULL;
4695   Py_ssize_t __pyx_t_6;
4696   PyObject *(*__pyx_t_7)(PyObject *);
4697   PyObject *__pyx_t_8 = NULL;
4698   PyObject *__pyx_t_9 = NULL;
4699   PyObject *(*__pyx_t_10)(PyObject *);
4700   int __pyx_t_11;
4701   int __pyx_lineno = 0;
4702   const char *__pyx_filename = NULL;
4703   int __pyx_clineno = 0;
4704   __Pyx_RefNannySetupContext("startElement", 0);
4705   __Pyx_INCREF(__pyx_v_attributes);
4706
4707   /* "lxml/sax.py":137
4708  * 
4709  *     def startElement(self, name, attributes=None):
4710  *         if attributes:             # <<<<<<<<<<<<<<
4711  *             attributes = dict(
4712  *                     [((None, k), v) for k, v in attributes.items()]
4713  */
4714   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 137, __pyx_L1_error)
4715   if (__pyx_t_1) {
4716
4717     /* "lxml/sax.py":139
4718  *         if attributes:
4719  *             attributes = dict(
4720  *                     [((None, k), v) for k, v in attributes.items()]             # <<<<<<<<<<<<<<
4721  *                 )
4722  *         self.startElementNS((None, name), name, attributes)
4723  */
4724     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4725     __Pyx_GOTREF(__pyx_t_2);
4726     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_attributes, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4727     __Pyx_GOTREF(__pyx_t_4);
4728     __pyx_t_5 = NULL;
4729     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4730       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4731       if (likely(__pyx_t_5)) {
4732         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4733         __Pyx_INCREF(__pyx_t_5);
4734         __Pyx_INCREF(function);
4735         __Pyx_DECREF_SET(__pyx_t_4, function);
4736       }
4737     }
4738     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
4739     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4740     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4741     __Pyx_GOTREF(__pyx_t_3);
4742     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4743     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
4744       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
4745       __pyx_t_7 = NULL;
4746     } else {
4747       __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4748       __Pyx_GOTREF(__pyx_t_4);
4749       __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L1_error)
4750     }
4751     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4752     for (;;) {
4753       if (likely(!__pyx_t_7)) {
4754         if (likely(PyList_CheckExact(__pyx_t_4))) {
4755           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
4756           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4757           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
4758           #else
4759           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4760           __Pyx_GOTREF(__pyx_t_3);
4761           #endif
4762         } else {
4763           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
4764           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4765           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 139, __pyx_L1_error)
4766           #else
4767           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4768           __Pyx_GOTREF(__pyx_t_3);
4769           #endif
4770         }
4771       } else {
4772         __pyx_t_3 = __pyx_t_7(__pyx_t_4);
4773         if (unlikely(!__pyx_t_3)) {
4774           PyObject* exc_type = PyErr_Occurred();
4775           if (exc_type) {
4776             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4777             else __PYX_ERR(0, 139, __pyx_L1_error)
4778           }
4779           break;
4780         }
4781         __Pyx_GOTREF(__pyx_t_3);
4782       }
4783       if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
4784         PyObject* sequence = __pyx_t_3;
4785         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4786         if (unlikely(size != 2)) {
4787           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4788           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4789           __PYX_ERR(0, 139, __pyx_L1_error)
4790         }
4791         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4792         if (likely(PyTuple_CheckExact(sequence))) {
4793           __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
4794           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
4795         } else {
4796           __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
4797           __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
4798         }
4799         __Pyx_INCREF(__pyx_t_5);
4800         __Pyx_INCREF(__pyx_t_8);
4801         #else
4802         __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
4803         __Pyx_GOTREF(__pyx_t_5);
4804         __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4805         __Pyx_GOTREF(__pyx_t_8);
4806         #endif
4807         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4808       } else {
4809         Py_ssize_t index = -1;
4810         __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 139, __pyx_L1_error)
4811         __Pyx_GOTREF(__pyx_t_9);
4812         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4813         __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
4814         index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
4815         __Pyx_GOTREF(__pyx_t_5);
4816         index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
4817         __Pyx_GOTREF(__pyx_t_8);
4818         if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
4819         __pyx_t_10 = NULL;
4820         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4821         goto __pyx_L7_unpacking_done;
4822         __pyx_L6_unpacking_failed:;
4823         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4824         __pyx_t_10 = NULL;
4825         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4826         __PYX_ERR(0, 139, __pyx_L1_error)
4827         __pyx_L7_unpacking_done:;
4828       }
4829       __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
4830       __pyx_t_5 = 0;
4831       __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
4832       __pyx_t_8 = 0;
4833       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4834       __Pyx_GOTREF(__pyx_t_3);
4835       __Pyx_INCREF(Py_None);
4836       __Pyx_GIVEREF(Py_None);
4837       PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
4838       __Pyx_INCREF(__pyx_v_k);
4839       __Pyx_GIVEREF(__pyx_v_k);
4840       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_k);
4841       __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4842       __Pyx_GOTREF(__pyx_t_8);
4843       __Pyx_GIVEREF(__pyx_t_3);
4844       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
4845       __Pyx_INCREF(__pyx_v_v);
4846       __Pyx_GIVEREF(__pyx_v_v);
4847       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v);
4848       __pyx_t_3 = 0;
4849       if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 139, __pyx_L1_error)
4850       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4851     }
4852     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4853
4854     /* "lxml/sax.py":138
4855  *     def startElement(self, name, attributes=None):
4856  *         if attributes:
4857  *             attributes = dict(             # <<<<<<<<<<<<<<
4858  *                     [((None, k), v) for k, v in attributes.items()]
4859  *                 )
4860  */
4861     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
4862     __Pyx_GOTREF(__pyx_t_4);
4863     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4864     __Pyx_DECREF_SET(__pyx_v_attributes, __pyx_t_4);
4865     __pyx_t_4 = 0;
4866
4867     /* "lxml/sax.py":137
4868  * 
4869  *     def startElement(self, name, attributes=None):
4870  *         if attributes:             # <<<<<<<<<<<<<<
4871  *             attributes = dict(
4872  *                     [((None, k), v) for k, v in attributes.items()]
4873  */
4874   }
4875
4876   /* "lxml/sax.py":141
4877  *                     [((None, k), v) for k, v in attributes.items()]
4878  *                 )
4879  *         self.startElementNS((None, name), name, attributes)             # <<<<<<<<<<<<<<
4880  * 
4881  *     def endElement(self, name):
4882  */
4883   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_startElementNS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
4884   __Pyx_GOTREF(__pyx_t_2);
4885   __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
4886   __Pyx_GOTREF(__pyx_t_8);
4887   __Pyx_INCREF(Py_None);
4888   __Pyx_GIVEREF(Py_None);
4889   PyTuple_SET_ITEM(__pyx_t_8, 0, Py_None);
4890   __Pyx_INCREF(__pyx_v_name);
4891   __Pyx_GIVEREF(__pyx_v_name);
4892   PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name);
4893   __pyx_t_3 = NULL;
4894   __pyx_t_11 = 0;
4895   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4896     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4897     if (likely(__pyx_t_3)) {
4898       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4899       __Pyx_INCREF(__pyx_t_3);
4900       __Pyx_INCREF(function);
4901       __Pyx_DECREF_SET(__pyx_t_2, function);
4902       __pyx_t_11 = 1;
4903     }
4904   }
4905   #if CYTHON_FAST_PYCALL
4906   if (PyFunction_Check(__pyx_t_2)) {
4907     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4908     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4909     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4910     __Pyx_GOTREF(__pyx_t_4);
4911     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4912   } else
4913   #endif
4914   #if CYTHON_FAST_PYCCALL
4915   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4916     PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4917     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4918     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4919     __Pyx_GOTREF(__pyx_t_4);
4920     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4921   } else
4922   #endif
4923   {
4924     __pyx_t_5 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
4925     __Pyx_GOTREF(__pyx_t_5);
4926     if (__pyx_t_3) {
4927       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4928     }
4929     __Pyx_GIVEREF(__pyx_t_8);
4930     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_t_8);
4931     __Pyx_INCREF(__pyx_v_name);
4932     __Pyx_GIVEREF(__pyx_v_name);
4933     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_name);
4934     __Pyx_INCREF(__pyx_v_attributes);
4935     __Pyx_GIVEREF(__pyx_v_attributes);
4936     PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_attributes);
4937     __pyx_t_8 = 0;
4938     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
4939     __Pyx_GOTREF(__pyx_t_4);
4940     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4941   }
4942   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4943   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4944
4945   /* "lxml/sax.py":136
4946  *             raise SaxError("Unexpected element closed: " + el_tag)
4947  * 
4948  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
4949  *         if attributes:
4950  *             attributes = dict(
4951  */
4952
4953   /* function exit code */
4954   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4955   goto __pyx_L0;
4956   __pyx_L1_error:;
4957   __Pyx_XDECREF(__pyx_t_2);
4958   __Pyx_XDECREF(__pyx_t_3);
4959   __Pyx_XDECREF(__pyx_t_4);
4960   __Pyx_XDECREF(__pyx_t_5);
4961   __Pyx_XDECREF(__pyx_t_8);
4962   __Pyx_XDECREF(__pyx_t_9);
4963   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4964   __pyx_r = NULL;
4965   __pyx_L0:;
4966   __Pyx_XDECREF(__pyx_v_k);
4967   __Pyx_XDECREF(__pyx_v_v);
4968   __Pyx_XDECREF(__pyx_v_attributes);
4969   __Pyx_XGIVEREF(__pyx_r);
4970   __Pyx_RefNannyFinishContext();
4971   return __pyx_r;
4972 }
4973
4974 /* "lxml/sax.py":143
4975  *         self.startElementNS((None, name), name, attributes)
4976  * 
4977  *     def endElement(self, name):             # <<<<<<<<<<<<<<
4978  *         self.endElementNS((None, name), name)
4979  * 
4980  */
4981
4982 /* Python wrapper */
4983 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4984 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_25endElement = {"endElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement, METH_VARARGS|METH_KEYWORDS, 0};
4985 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4986   PyObject *__pyx_v_self = 0;
4987   PyObject *__pyx_v_name = 0;
4988   int __pyx_lineno = 0;
4989   const char *__pyx_filename = NULL;
4990   int __pyx_clineno = 0;
4991   PyObject *__pyx_r = 0;
4992   __Pyx_RefNannyDeclarations
4993   __Pyx_RefNannySetupContext("endElement (wrapper)", 0);
4994   {
4995     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,0};
4996     PyObject* values[2] = {0,0};
4997     if (unlikely(__pyx_kwds)) {
4998       Py_ssize_t kw_args;
4999       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5000       switch (pos_args) {
5001         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5002         CYTHON_FALLTHROUGH;
5003         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5004         CYTHON_FALLTHROUGH;
5005         case  0: break;
5006         default: goto __pyx_L5_argtuple_error;
5007       }
5008       kw_args = PyDict_Size(__pyx_kwds);
5009       switch (pos_args) {
5010         case  0:
5011         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5012         else goto __pyx_L5_argtuple_error;
5013         CYTHON_FALLTHROUGH;
5014         case  1:
5015         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
5016         else {
5017           __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, 1); __PYX_ERR(0, 143, __pyx_L3_error)
5018         }
5019       }
5020       if (unlikely(kw_args > 0)) {
5021         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElement") < 0)) __PYX_ERR(0, 143, __pyx_L3_error)
5022       }
5023     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5024       goto __pyx_L5_argtuple_error;
5025     } else {
5026       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5027       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5028     }
5029     __pyx_v_self = values[0];
5030     __pyx_v_name = values[1];
5031   }
5032   goto __pyx_L4_argument_unpacking_done;
5033   __pyx_L5_argtuple_error:;
5034   __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error)
5035   __pyx_L3_error:;
5036   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5037   __Pyx_RefNannyFinishContext();
5038   return NULL;
5039   __pyx_L4_argument_unpacking_done:;
5040   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(__pyx_self, __pyx_v_self, __pyx_v_name);
5041
5042   /* function exit code */
5043   __Pyx_RefNannyFinishContext();
5044   return __pyx_r;
5045 }
5046
5047 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
5048   PyObject *__pyx_r = NULL;
5049   __Pyx_RefNannyDeclarations
5050   PyObject *__pyx_t_1 = NULL;
5051   PyObject *__pyx_t_2 = NULL;
5052   PyObject *__pyx_t_3 = NULL;
5053   PyObject *__pyx_t_4 = NULL;
5054   int __pyx_t_5;
5055   PyObject *__pyx_t_6 = NULL;
5056   int __pyx_lineno = 0;
5057   const char *__pyx_filename = NULL;
5058   int __pyx_clineno = 0;
5059   __Pyx_RefNannySetupContext("endElement", 0);
5060
5061   /* "lxml/sax.py":144
5062  * 
5063  *     def endElement(self, name):
5064  *         self.endElementNS((None, name), name)             # <<<<<<<<<<<<<<
5065  * 
5066  *     def characters(self, data):
5067  */
5068   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_endElementNS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
5069   __Pyx_GOTREF(__pyx_t_2);
5070   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
5071   __Pyx_GOTREF(__pyx_t_3);
5072   __Pyx_INCREF(Py_None);
5073   __Pyx_GIVEREF(Py_None);
5074   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
5075   __Pyx_INCREF(__pyx_v_name);
5076   __Pyx_GIVEREF(__pyx_v_name);
5077   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name);
5078   __pyx_t_4 = NULL;
5079   __pyx_t_5 = 0;
5080   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5081     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
5082     if (likely(__pyx_t_4)) {
5083       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5084       __Pyx_INCREF(__pyx_t_4);
5085       __Pyx_INCREF(function);
5086       __Pyx_DECREF_SET(__pyx_t_2, function);
5087       __pyx_t_5 = 1;
5088     }
5089   }
5090   #if CYTHON_FAST_PYCALL
5091   if (PyFunction_Check(__pyx_t_2)) {
5092     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5093     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5094     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5095     __Pyx_GOTREF(__pyx_t_1);
5096     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5097   } else
5098   #endif
5099   #if CYTHON_FAST_PYCCALL
5100   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
5101     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5102     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5103     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5104     __Pyx_GOTREF(__pyx_t_1);
5105     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5106   } else
5107   #endif
5108   {
5109     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
5110     __Pyx_GOTREF(__pyx_t_6);
5111     if (__pyx_t_4) {
5112       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
5113     }
5114     __Pyx_GIVEREF(__pyx_t_3);
5115     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
5116     __Pyx_INCREF(__pyx_v_name);
5117     __Pyx_GIVEREF(__pyx_v_name);
5118     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_name);
5119     __pyx_t_3 = 0;
5120     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
5121     __Pyx_GOTREF(__pyx_t_1);
5122     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5123   }
5124   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5125   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5126
5127   /* "lxml/sax.py":143
5128  *         self.startElementNS((None, name), name, attributes)
5129  * 
5130  *     def endElement(self, name):             # <<<<<<<<<<<<<<
5131  *         self.endElementNS((None, name), name)
5132  * 
5133  */
5134
5135   /* function exit code */
5136   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5137   goto __pyx_L0;
5138   __pyx_L1_error:;
5139   __Pyx_XDECREF(__pyx_t_1);
5140   __Pyx_XDECREF(__pyx_t_2);
5141   __Pyx_XDECREF(__pyx_t_3);
5142   __Pyx_XDECREF(__pyx_t_4);
5143   __Pyx_XDECREF(__pyx_t_6);
5144   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5145   __pyx_r = NULL;
5146   __pyx_L0:;
5147   __Pyx_XGIVEREF(__pyx_r);
5148   __Pyx_RefNannyFinishContext();
5149   return __pyx_r;
5150 }
5151
5152 /* "lxml/sax.py":146
5153  *         self.endElementNS((None, name), name)
5154  * 
5155  *     def characters(self, data):             # <<<<<<<<<<<<<<
5156  *         last_element = self._element_stack[-1]
5157  *         try:
5158  */
5159
5160 /* Python wrapper */
5161 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5162 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_27characters = {"characters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters, METH_VARARGS|METH_KEYWORDS, 0};
5163 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5164   PyObject *__pyx_v_self = 0;
5165   PyObject *__pyx_v_data = 0;
5166   int __pyx_lineno = 0;
5167   const char *__pyx_filename = NULL;
5168   int __pyx_clineno = 0;
5169   PyObject *__pyx_r = 0;
5170   __Pyx_RefNannyDeclarations
5171   __Pyx_RefNannySetupContext("characters (wrapper)", 0);
5172   {
5173     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
5174     PyObject* values[2] = {0,0};
5175     if (unlikely(__pyx_kwds)) {
5176       Py_ssize_t kw_args;
5177       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5178       switch (pos_args) {
5179         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5180         CYTHON_FALLTHROUGH;
5181         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5182         CYTHON_FALLTHROUGH;
5183         case  0: break;
5184         default: goto __pyx_L5_argtuple_error;
5185       }
5186       kw_args = PyDict_Size(__pyx_kwds);
5187       switch (pos_args) {
5188         case  0:
5189         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5190         else goto __pyx_L5_argtuple_error;
5191         CYTHON_FALLTHROUGH;
5192         case  1:
5193         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
5194         else {
5195           __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, 1); __PYX_ERR(0, 146, __pyx_L3_error)
5196         }
5197       }
5198       if (unlikely(kw_args > 0)) {
5199         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "characters") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
5200       }
5201     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5202       goto __pyx_L5_argtuple_error;
5203     } else {
5204       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5205       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5206     }
5207     __pyx_v_self = values[0];
5208     __pyx_v_data = values[1];
5209   }
5210   goto __pyx_L4_argument_unpacking_done;
5211   __pyx_L5_argtuple_error:;
5212   __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
5213   __pyx_L3_error:;
5214   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5215   __Pyx_RefNannyFinishContext();
5216   return NULL;
5217   __pyx_L4_argument_unpacking_done:;
5218   __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(__pyx_self, __pyx_v_self, __pyx_v_data);
5219
5220   /* function exit code */
5221   __Pyx_RefNannyFinishContext();
5222   return __pyx_r;
5223 }
5224
5225 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
5226   PyObject *__pyx_v_last_element = NULL;
5227   PyObject *__pyx_r = NULL;
5228   __Pyx_RefNannyDeclarations
5229   PyObject *__pyx_t_1 = NULL;
5230   PyObject *__pyx_t_2 = NULL;
5231   PyObject *__pyx_t_3 = NULL;
5232   PyObject *__pyx_t_4 = NULL;
5233   PyObject *__pyx_t_5 = NULL;
5234   int __pyx_t_6;
5235   int __pyx_t_7;
5236   PyObject *__pyx_t_8 = NULL;
5237   PyObject *__pyx_t_9 = NULL;
5238   PyObject *__pyx_t_10 = NULL;
5239   int __pyx_lineno = 0;
5240   const char *__pyx_filename = NULL;
5241   int __pyx_clineno = 0;
5242   __Pyx_RefNannySetupContext("characters", 0);
5243
5244   /* "lxml/sax.py":147
5245  * 
5246  *     def characters(self, data):
5247  *         last_element = self._element_stack[-1]             # <<<<<<<<<<<<<<
5248  *         try:
5249  *             # if there already is a child element, we must append to its tail
5250  */
5251   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_element_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
5252   __Pyx_GOTREF(__pyx_t_1);
5253   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
5254   __Pyx_GOTREF(__pyx_t_2);
5255   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5256   __pyx_v_last_element = __pyx_t_2;
5257   __pyx_t_2 = 0;
5258
5259   /* "lxml/sax.py":148
5260  *     def characters(self, data):
5261  *         last_element = self._element_stack[-1]
5262  *         try:             # <<<<<<<<<<<<<<
5263  *             # if there already is a child element, we must append to its tail
5264  *             last_element = last_element[-1]
5265  */
5266   {
5267     __Pyx_PyThreadState_declare
5268     __Pyx_PyThreadState_assign
5269     __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
5270     __Pyx_XGOTREF(__pyx_t_3);
5271     __Pyx_XGOTREF(__pyx_t_4);
5272     __Pyx_XGOTREF(__pyx_t_5);
5273     /*try:*/ {
5274
5275       /* "lxml/sax.py":150
5276  *         try:
5277  *             # if there already is a child element, we must append to its tail
5278  *             last_element = last_element[-1]             # <<<<<<<<<<<<<<
5279  *             last_element.tail = (last_element.tail or '') + data
5280  *         except IndexError:
5281  */
5282       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_last_element, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L3_error)
5283       __Pyx_GOTREF(__pyx_t_2);
5284       __Pyx_DECREF_SET(__pyx_v_last_element, __pyx_t_2);
5285       __pyx_t_2 = 0;
5286
5287       /* "lxml/sax.py":151
5288  *             # if there already is a child element, we must append to its tail
5289  *             last_element = last_element[-1]
5290  *             last_element.tail = (last_element.tail or '') + data             # <<<<<<<<<<<<<<
5291  *         except IndexError:
5292  *             # otherwise: append to the text
5293  */
5294       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_last_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L3_error)
5295       __Pyx_GOTREF(__pyx_t_1);
5296       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 151, __pyx_L3_error)
5297       if (!__pyx_t_6) {
5298         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5299       } else {
5300         __Pyx_INCREF(__pyx_t_1);
5301         __pyx_t_2 = __pyx_t_1;
5302         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5303         goto __pyx_L9_bool_binop_done;
5304       }
5305       __Pyx_INCREF(__pyx_kp_s__6);
5306       __pyx_t_2 = __pyx_kp_s__6;
5307       __pyx_L9_bool_binop_done:;
5308       __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L3_error)
5309       __Pyx_GOTREF(__pyx_t_1);
5310       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5311       if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_tail, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
5312       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5313
5314       /* "lxml/sax.py":148
5315  *     def characters(self, data):
5316  *         last_element = self._element_stack[-1]
5317  *         try:             # <<<<<<<<<<<<<<
5318  *             # if there already is a child element, we must append to its tail
5319  *             last_element = last_element[-1]
5320  */
5321     }
5322     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5323     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5324     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5325     goto __pyx_L8_try_end;
5326     __pyx_L3_error:;
5327     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5328     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5329
5330     /* "lxml/sax.py":152
5331  *             last_element = last_element[-1]
5332  *             last_element.tail = (last_element.tail or '') + data
5333  *         except IndexError:             # <<<<<<<<<<<<<<
5334  *             # otherwise: append to the text
5335  *             last_element.text = (last_element.text or '') + data
5336  */
5337     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
5338     if (__pyx_t_7) {
5339       __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5340       if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_8) < 0) __PYX_ERR(0, 152, __pyx_L5_except_error)
5341       __Pyx_GOTREF(__pyx_t_1);
5342       __Pyx_GOTREF(__pyx_t_2);
5343       __Pyx_GOTREF(__pyx_t_8);
5344
5345       /* "lxml/sax.py":154
5346  *         except IndexError:
5347  *             # otherwise: append to the text
5348  *             last_element.text = (last_element.text or '') + data             # <<<<<<<<<<<<<<
5349  * 
5350  *     ignorableWhitespace = characters
5351  */
5352       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_last_element, __pyx_n_s_text); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5353       __Pyx_GOTREF(__pyx_t_10);
5354       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5355       if (!__pyx_t_6) {
5356         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5357       } else {
5358         __Pyx_INCREF(__pyx_t_10);
5359         __pyx_t_9 = __pyx_t_10;
5360         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5361         goto __pyx_L13_bool_binop_done;
5362       }
5363       __Pyx_INCREF(__pyx_kp_s__6);
5364       __pyx_t_9 = __pyx_kp_s__6;
5365       __pyx_L13_bool_binop_done:;
5366       __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_v_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5367       __Pyx_GOTREF(__pyx_t_10);
5368       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5369       if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_text, __pyx_t_10) < 0) __PYX_ERR(0, 154, __pyx_L5_except_error)
5370       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5371       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5372       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5373       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5374       goto __pyx_L4_exception_handled;
5375     }
5376     goto __pyx_L5_except_error;
5377     __pyx_L5_except_error:;
5378
5379     /* "lxml/sax.py":148
5380  *     def characters(self, data):
5381  *         last_element = self._element_stack[-1]
5382  *         try:             # <<<<<<<<<<<<<<
5383  *             # if there already is a child element, we must append to its tail
5384  *             last_element = last_element[-1]
5385  */
5386     __Pyx_XGIVEREF(__pyx_t_3);
5387     __Pyx_XGIVEREF(__pyx_t_4);
5388     __Pyx_XGIVEREF(__pyx_t_5);
5389     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5390     goto __pyx_L1_error;
5391     __pyx_L4_exception_handled:;
5392     __Pyx_XGIVEREF(__pyx_t_3);
5393     __Pyx_XGIVEREF(__pyx_t_4);
5394     __Pyx_XGIVEREF(__pyx_t_5);
5395     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5396     __pyx_L8_try_end:;
5397   }
5398
5399   /* "lxml/sax.py":146
5400  *         self.endElementNS((None, name), name)
5401  * 
5402  *     def characters(self, data):             # <<<<<<<<<<<<<<
5403  *         last_element = self._element_stack[-1]
5404  *         try:
5405  */
5406
5407   /* function exit code */
5408   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5409   goto __pyx_L0;
5410   __pyx_L1_error:;
5411   __Pyx_XDECREF(__pyx_t_1);
5412   __Pyx_XDECREF(__pyx_t_2);
5413   __Pyx_XDECREF(__pyx_t_8);
5414   __Pyx_XDECREF(__pyx_t_9);
5415   __Pyx_XDECREF(__pyx_t_10);
5416   __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5417   __pyx_r = NULL;
5418   __pyx_L0:;
5419   __Pyx_XDECREF(__pyx_v_last_element);
5420   __Pyx_XGIVEREF(__pyx_r);
5421   __Pyx_RefNannyFinishContext();
5422   return __pyx_r;
5423 }
5424
5425 /* "lxml/sax.py":162
5426  *     """Produces SAX events for an element and children.
5427  *     """
5428  *     def __init__(self, element_or_tree, content_handler):             # <<<<<<<<<<<<<<
5429  *         try:
5430  *             element = element_or_tree.getroot()
5431  */
5432
5433 /* Python wrapper */
5434 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5435 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5436   PyObject *__pyx_v_element_or_tree = 0;
5437   PyObject *__pyx_v_content_handler = 0;
5438   int __pyx_lineno = 0;
5439   const char *__pyx_filename = NULL;
5440   int __pyx_clineno = 0;
5441   int __pyx_r;
5442   __Pyx_RefNannyDeclarations
5443   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
5444   {
5445     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
5446     PyObject* values[2] = {0,0};
5447     if (unlikely(__pyx_kwds)) {
5448       Py_ssize_t kw_args;
5449       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5450       switch (pos_args) {
5451         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5452         CYTHON_FALLTHROUGH;
5453         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5454         CYTHON_FALLTHROUGH;
5455         case  0: break;
5456         default: goto __pyx_L5_argtuple_error;
5457       }
5458       kw_args = PyDict_Size(__pyx_kwds);
5459       switch (pos_args) {
5460         case  0:
5461         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
5462         else goto __pyx_L5_argtuple_error;
5463         CYTHON_FALLTHROUGH;
5464         case  1:
5465         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
5466         else {
5467           __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 162, __pyx_L3_error)
5468         }
5469       }
5470       if (unlikely(kw_args > 0)) {
5471         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 162, __pyx_L3_error)
5472       }
5473     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5474       goto __pyx_L5_argtuple_error;
5475     } else {
5476       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5477       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5478     }
5479     __pyx_v_element_or_tree = values[0];
5480     __pyx_v_content_handler = values[1];
5481   }
5482   goto __pyx_L4_argument_unpacking_done;
5483   __pyx_L5_argtuple_error:;
5484   __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error)
5485   __pyx_L3_error:;
5486   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5487   __Pyx_RefNannyFinishContext();
5488   return -1;
5489   __pyx_L4_argument_unpacking_done:;
5490   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self), __pyx_v_element_or_tree, __pyx_v_content_handler);
5491
5492   /* function exit code */
5493   __Pyx_RefNannyFinishContext();
5494   return __pyx_r;
5495 }
5496
5497 static int __pyx_pf_4lxml_3sax_19ElementTreeProducer___init__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler) {
5498   PyObject *__pyx_v_element = NULL;
5499   PyObject *__pyx_v_attr_class = NULL;
5500   int __pyx_r;
5501   __Pyx_RefNannyDeclarations
5502   PyObject *__pyx_t_1 = NULL;
5503   PyObject *__pyx_t_2 = NULL;
5504   PyObject *__pyx_t_3 = NULL;
5505   PyObject *__pyx_t_4 = NULL;
5506   PyObject *__pyx_t_5 = NULL;
5507   PyObject *__pyx_t_6 = NULL;
5508   int __pyx_t_7;
5509   PyObject *__pyx_t_8 = NULL;
5510   PyObject *__pyx_t_9 = NULL;
5511   PyObject *__pyx_t_10 = NULL;
5512   int __pyx_lineno = 0;
5513   const char *__pyx_filename = NULL;
5514   int __pyx_clineno = 0;
5515   __Pyx_RefNannySetupContext("__init__", 0);
5516
5517   /* "lxml/sax.py":163
5518  *     """
5519  *     def __init__(self, element_or_tree, content_handler):
5520  *         try:             # <<<<<<<<<<<<<<
5521  *             element = element_or_tree.getroot()
5522  *         except AttributeError:
5523  */
5524   {
5525     __Pyx_PyThreadState_declare
5526     __Pyx_PyThreadState_assign
5527     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5528     __Pyx_XGOTREF(__pyx_t_1);
5529     __Pyx_XGOTREF(__pyx_t_2);
5530     __Pyx_XGOTREF(__pyx_t_3);
5531     /*try:*/ {
5532
5533       /* "lxml/sax.py":164
5534  *     def __init__(self, element_or_tree, content_handler):
5535  *         try:
5536  *             element = element_or_tree.getroot()             # <<<<<<<<<<<<<<
5537  *         except AttributeError:
5538  *             element = element_or_tree
5539  */
5540       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_element_or_tree, __pyx_n_s_getroot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L3_error)
5541       __Pyx_GOTREF(__pyx_t_5);
5542       __pyx_t_6 = NULL;
5543       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5544         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5545         if (likely(__pyx_t_6)) {
5546           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5547           __Pyx_INCREF(__pyx_t_6);
5548           __Pyx_INCREF(function);
5549           __Pyx_DECREF_SET(__pyx_t_5, function);
5550         }
5551       }
5552       __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5553       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5554       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L3_error)
5555       __Pyx_GOTREF(__pyx_t_4);
5556       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5557       __pyx_v_element = __pyx_t_4;
5558       __pyx_t_4 = 0;
5559
5560       /* "lxml/sax.py":163
5561  *     """
5562  *     def __init__(self, element_or_tree, content_handler):
5563  *         try:             # <<<<<<<<<<<<<<
5564  *             element = element_or_tree.getroot()
5565  *         except AttributeError:
5566  */
5567     }
5568     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5569     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5570     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5571     goto __pyx_L8_try_end;
5572     __pyx_L3_error:;
5573     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5574     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5575     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5576
5577     /* "lxml/sax.py":165
5578  *         try:
5579  *             element = element_or_tree.getroot()
5580  *         except AttributeError:             # <<<<<<<<<<<<<<
5581  *             element = element_or_tree
5582  *         self._element = element
5583  */
5584     __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
5585     if (__pyx_t_7) {
5586       __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5587       if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 165, __pyx_L5_except_error)
5588       __Pyx_GOTREF(__pyx_t_4);
5589       __Pyx_GOTREF(__pyx_t_5);
5590       __Pyx_GOTREF(__pyx_t_6);
5591
5592       /* "lxml/sax.py":166
5593  *             element = element_or_tree.getroot()
5594  *         except AttributeError:
5595  *             element = element_or_tree             # <<<<<<<<<<<<<<
5596  *         self._element = element
5597  *         self._content_handler = content_handler
5598  */
5599       __Pyx_INCREF(__pyx_v_element_or_tree);
5600       __Pyx_XDECREF_SET(__pyx_v_element, __pyx_v_element_or_tree);
5601       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5602       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5603       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5604       goto __pyx_L4_exception_handled;
5605     }
5606     goto __pyx_L5_except_error;
5607     __pyx_L5_except_error:;
5608
5609     /* "lxml/sax.py":163
5610  *     """
5611  *     def __init__(self, element_or_tree, content_handler):
5612  *         try:             # <<<<<<<<<<<<<<
5613  *             element = element_or_tree.getroot()
5614  *         except AttributeError:
5615  */
5616     __Pyx_XGIVEREF(__pyx_t_1);
5617     __Pyx_XGIVEREF(__pyx_t_2);
5618     __Pyx_XGIVEREF(__pyx_t_3);
5619     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5620     goto __pyx_L1_error;
5621     __pyx_L4_exception_handled:;
5622     __Pyx_XGIVEREF(__pyx_t_1);
5623     __Pyx_XGIVEREF(__pyx_t_2);
5624     __Pyx_XGIVEREF(__pyx_t_3);
5625     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5626     __pyx_L8_try_end:;
5627   }
5628
5629   /* "lxml/sax.py":167
5630  *         except AttributeError:
5631  *             element = element_or_tree
5632  *         self._element = element             # <<<<<<<<<<<<<<
5633  *         self._content_handler = content_handler
5634  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5635  */
5636   __Pyx_INCREF(__pyx_v_element);
5637   __Pyx_GIVEREF(__pyx_v_element);
5638   __Pyx_GOTREF(__pyx_v_self->_element);
5639   __Pyx_DECREF(__pyx_v_self->_element);
5640   __pyx_v_self->_element = __pyx_v_element;
5641
5642   /* "lxml/sax.py":168
5643  *             element = element_or_tree
5644  *         self._element = element
5645  *         self._content_handler = content_handler             # <<<<<<<<<<<<<<
5646  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5647  *         self._attr_class = attr_class
5648  */
5649   __Pyx_INCREF(__pyx_v_content_handler);
5650   __Pyx_GIVEREF(__pyx_v_content_handler);
5651   __Pyx_GOTREF(__pyx_v_self->_content_handler);
5652   __Pyx_DECREF(__pyx_v_self->_content_handler);
5653   __pyx_v_self->_content_handler = __pyx_v_content_handler;
5654
5655   /* "lxml/sax.py":169
5656  *         self._element = element
5657  *         self._content_handler = content_handler
5658  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class             # <<<<<<<<<<<<<<
5659  *         self._attr_class = attr_class
5660  *         self._empty_attributes = attr_class({}, {})
5661  */
5662   __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5663   __Pyx_GOTREF(__pyx_t_6);
5664   __Pyx_INCREF(__pyx_n_s_AttributesNSImpl);
5665   __Pyx_GIVEREF(__pyx_n_s_AttributesNSImpl);
5666   PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_AttributesNSImpl);
5667   __pyx_t_5 = __Pyx_Import(__pyx_n_s_xml_sax_xmlreader, __pyx_t_6, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
5668   __Pyx_GOTREF(__pyx_t_5);
5669   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5670   __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_AttributesNSImpl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5671   __Pyx_GOTREF(__pyx_t_6);
5672   __Pyx_INCREF(__pyx_t_6);
5673   __pyx_v_attr_class = __pyx_t_6;
5674   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5675   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5676
5677   /* "lxml/sax.py":170
5678  *         self._content_handler = content_handler
5679  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5680  *         self._attr_class = attr_class             # <<<<<<<<<<<<<<
5681  *         self._empty_attributes = attr_class({}, {})
5682  * 
5683  */
5684   __Pyx_INCREF(__pyx_v_attr_class);
5685   __Pyx_GIVEREF(__pyx_v_attr_class);
5686   __Pyx_GOTREF(__pyx_v_self->_attr_class);
5687   __Pyx_DECREF(__pyx_v_self->_attr_class);
5688   __pyx_v_self->_attr_class = __pyx_v_attr_class;
5689
5690   /* "lxml/sax.py":171
5691  *         from xml.sax.xmlreader import AttributesNSImpl as attr_class
5692  *         self._attr_class = attr_class
5693  *         self._empty_attributes = attr_class({}, {})             # <<<<<<<<<<<<<<
5694  * 
5695  *     def saxify(self):
5696  */
5697   __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error)
5698   __Pyx_GOTREF(__pyx_t_6);
5699   __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
5700   __Pyx_GOTREF(__pyx_t_4);
5701   __Pyx_INCREF(__pyx_v_attr_class);
5702   __pyx_t_8 = __pyx_v_attr_class; __pyx_t_9 = NULL;
5703   __pyx_t_7 = 0;
5704   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5705     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
5706     if (likely(__pyx_t_9)) {
5707       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5708       __Pyx_INCREF(__pyx_t_9);
5709       __Pyx_INCREF(function);
5710       __Pyx_DECREF_SET(__pyx_t_8, function);
5711       __pyx_t_7 = 1;
5712     }
5713   }
5714   #if CYTHON_FAST_PYCALL
5715   if (PyFunction_Check(__pyx_t_8)) {
5716     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5717     __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5718     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5719     __Pyx_GOTREF(__pyx_t_5);
5720     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5721     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5722   } else
5723   #endif
5724   #if CYTHON_FAST_PYCCALL
5725   if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5726     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5727     __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5728     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5729     __Pyx_GOTREF(__pyx_t_5);
5730     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5731     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5732   } else
5733   #endif
5734   {
5735     __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error)
5736     __Pyx_GOTREF(__pyx_t_10);
5737     if (__pyx_t_9) {
5738       __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
5739     }
5740     __Pyx_GIVEREF(__pyx_t_6);
5741     PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_6);
5742     __Pyx_GIVEREF(__pyx_t_4);
5743     PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_4);
5744     __pyx_t_6 = 0;
5745     __pyx_t_4 = 0;
5746     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5747     __Pyx_GOTREF(__pyx_t_5);
5748     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5749   }
5750   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5751   __Pyx_GIVEREF(__pyx_t_5);
5752   __Pyx_GOTREF(__pyx_v_self->_empty_attributes);
5753   __Pyx_DECREF(__pyx_v_self->_empty_attributes);
5754   __pyx_v_self->_empty_attributes = __pyx_t_5;
5755   __pyx_t_5 = 0;
5756
5757   /* "lxml/sax.py":162
5758  *     """Produces SAX events for an element and children.
5759  *     """
5760  *     def __init__(self, element_or_tree, content_handler):             # <<<<<<<<<<<<<<
5761  *         try:
5762  *             element = element_or_tree.getroot()
5763  */
5764
5765   /* function exit code */
5766   __pyx_r = 0;
5767   goto __pyx_L0;
5768   __pyx_L1_error:;
5769   __Pyx_XDECREF(__pyx_t_4);
5770   __Pyx_XDECREF(__pyx_t_5);
5771   __Pyx_XDECREF(__pyx_t_6);
5772   __Pyx_XDECREF(__pyx_t_8);
5773   __Pyx_XDECREF(__pyx_t_9);
5774   __Pyx_XDECREF(__pyx_t_10);
5775   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5776   __pyx_r = -1;
5777   __pyx_L0:;
5778   __Pyx_XDECREF(__pyx_v_element);
5779   __Pyx_XDECREF(__pyx_v_attr_class);
5780   __Pyx_RefNannyFinishContext();
5781   return __pyx_r;
5782 }
5783
5784 /* "lxml/sax.py":173
5785  *         self._empty_attributes = attr_class({}, {})
5786  * 
5787  *     def saxify(self):             # <<<<<<<<<<<<<<
5788  *         self._content_handler.startDocument()
5789  * 
5790  */
5791
5792 /* Python wrapper */
5793 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5794 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_3saxify = {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0};
5795 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5796   PyObject *__pyx_r = 0;
5797   __Pyx_RefNannyDeclarations
5798   __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
5799   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
5800
5801   /* function exit code */
5802   __Pyx_RefNannyFinishContext();
5803   return __pyx_r;
5804 }
5805
5806 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
5807   PyObject *__pyx_v_element = NULL;
5808   PyObject *__pyx_v_siblings = NULL;
5809   PyObject *__pyx_v_sibling = NULL;
5810   PyObject *__pyx_r = NULL;
5811   __Pyx_RefNannyDeclarations
5812   PyObject *__pyx_t_1 = NULL;
5813   PyObject *__pyx_t_2 = NULL;
5814   PyObject *__pyx_t_3 = NULL;
5815   int __pyx_t_4;
5816   int __pyx_t_5;
5817   int __pyx_t_6;
5818   Py_ssize_t __pyx_t_7;
5819   int __pyx_lineno = 0;
5820   const char *__pyx_filename = NULL;
5821   int __pyx_clineno = 0;
5822   __Pyx_RefNannySetupContext("saxify", 0);
5823
5824   /* "lxml/sax.py":174
5825  * 
5826  *     def saxify(self):
5827  *         self._content_handler.startDocument()             # <<<<<<<<<<<<<<
5828  * 
5829  *         element = self._element
5830  */
5831   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_content_handler, __pyx_n_s_startDocument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
5832   __Pyx_GOTREF(__pyx_t_2);
5833   __pyx_t_3 = NULL;
5834   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5835     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5836     if (likely(__pyx_t_3)) {
5837       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5838       __Pyx_INCREF(__pyx_t_3);
5839       __Pyx_INCREF(function);
5840       __Pyx_DECREF_SET(__pyx_t_2, function);
5841     }
5842   }
5843   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5844   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5845   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
5846   __Pyx_GOTREF(__pyx_t_1);
5847   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5848   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5849
5850   /* "lxml/sax.py":176
5851  *         self._content_handler.startDocument()
5852  * 
5853  *         element = self._element             # <<<<<<<<<<<<<<
5854  *         if hasattr(element, 'getprevious'):
5855  *             siblings = []
5856  */
5857   __pyx_t_1 = __pyx_v_self->_element;
5858   __Pyx_INCREF(__pyx_t_1);
5859   __pyx_v_element = __pyx_t_1;
5860   __pyx_t_1 = 0;
5861
5862   /* "lxml/sax.py":177
5863  * 
5864  *         element = self._element
5865  *         if hasattr(element, 'getprevious'):             # <<<<<<<<<<<<<<
5866  *             siblings = []
5867  *             sibling = element.getprevious()
5868  */
5869   __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_getprevious); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 177, __pyx_L1_error)
5870   __pyx_t_5 = (__pyx_t_4 != 0);
5871   if (__pyx_t_5) {
5872
5873     /* "lxml/sax.py":178
5874  *         element = self._element
5875  *         if hasattr(element, 'getprevious'):
5876  *             siblings = []             # <<<<<<<<<<<<<<
5877  *             sibling = element.getprevious()
5878  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5879  */
5880     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5881     __Pyx_GOTREF(__pyx_t_1);
5882     __pyx_v_siblings = ((PyObject*)__pyx_t_1);
5883     __pyx_t_1 = 0;
5884
5885     /* "lxml/sax.py":179
5886  *         if hasattr(element, 'getprevious'):
5887  *             siblings = []
5888  *             sibling = element.getprevious()             # <<<<<<<<<<<<<<
5889  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5890  *                 siblings.append(sibling)
5891  */
5892     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_getprevious); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
5893     __Pyx_GOTREF(__pyx_t_2);
5894     __pyx_t_3 = NULL;
5895     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5896       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5897       if (likely(__pyx_t_3)) {
5898         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5899         __Pyx_INCREF(__pyx_t_3);
5900         __Pyx_INCREF(function);
5901         __Pyx_DECREF_SET(__pyx_t_2, function);
5902       }
5903     }
5904     __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5905     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5906     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
5907     __Pyx_GOTREF(__pyx_t_1);
5908     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5909     __pyx_v_sibling = __pyx_t_1;
5910     __pyx_t_1 = 0;
5911
5912     /* "lxml/sax.py":180
5913  *             siblings = []
5914  *             sibling = element.getprevious()
5915  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:             # <<<<<<<<<<<<<<
5916  *                 siblings.append(sibling)
5917  *                 sibling = sibling.getprevious()
5918  */
5919     while (1) {
5920       __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_sibling, __pyx_n_s_tag, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
5921       __Pyx_GOTREF(__pyx_t_1);
5922       __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
5923       __Pyx_GOTREF(__pyx_t_2);
5924       __pyx_t_5 = (__pyx_t_1 == __pyx_t_2);
5925       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5926       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5927       __pyx_t_4 = (__pyx_t_5 != 0);
5928       if (!__pyx_t_4) break;
5929
5930       /* "lxml/sax.py":181
5931  *             sibling = element.getprevious()
5932  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5933  *                 siblings.append(sibling)             # <<<<<<<<<<<<<<
5934  *                 sibling = sibling.getprevious()
5935  *             for sibling in siblings[::-1]:
5936  */
5937       __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_siblings, __pyx_v_sibling); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 181, __pyx_L1_error)
5938
5939       /* "lxml/sax.py":182
5940  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
5941  *                 siblings.append(sibling)
5942  *                 sibling = sibling.getprevious()             # <<<<<<<<<<<<<<
5943  *             for sibling in siblings[::-1]:
5944  *                 self._recursive_saxify(sibling, {})
5945  */
5946       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sibling, __pyx_n_s_getprevious); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
5947       __Pyx_GOTREF(__pyx_t_1);
5948       __pyx_t_3 = NULL;
5949       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
5950         __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
5951         if (likely(__pyx_t_3)) {
5952           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
5953           __Pyx_INCREF(__pyx_t_3);
5954           __Pyx_INCREF(function);
5955           __Pyx_DECREF_SET(__pyx_t_1, function);
5956         }
5957       }
5958       __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
5959       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5960       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
5961       __Pyx_GOTREF(__pyx_t_2);
5962       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5963       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5964       __pyx_t_2 = 0;
5965     }
5966
5967     /* "lxml/sax.py":183
5968  *                 siblings.append(sibling)
5969  *                 sibling = sibling.getprevious()
5970  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
5971  *                 self._recursive_saxify(sibling, {})
5972  * 
5973  */
5974     __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_siblings, __pyx_slice__7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
5975     __Pyx_GOTREF(__pyx_t_2);
5976     __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
5977     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5978     for (;;) {
5979       if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
5980       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5981       __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
5982       #else
5983       __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
5984       __Pyx_GOTREF(__pyx_t_2);
5985       #endif
5986       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5987       __pyx_t_2 = 0;
5988
5989       /* "lxml/sax.py":184
5990  *                 sibling = sibling.getprevious()
5991  *             for sibling in siblings[::-1]:
5992  *                 self._recursive_saxify(sibling, {})             # <<<<<<<<<<<<<<
5993  * 
5994  *         self._recursive_saxify(element, {})
5995  */
5996       __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5997       __Pyx_GOTREF(__pyx_t_2);
5998       __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_sibling, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5999       __Pyx_GOTREF(__pyx_t_3);
6000       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6001       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6002
6003       /* "lxml/sax.py":183
6004  *                 siblings.append(sibling)
6005  *                 sibling = sibling.getprevious()
6006  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
6007  *                 self._recursive_saxify(sibling, {})
6008  * 
6009  */
6010     }
6011     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6012
6013     /* "lxml/sax.py":177
6014  * 
6015  *         element = self._element
6016  *         if hasattr(element, 'getprevious'):             # <<<<<<<<<<<<<<
6017  *             siblings = []
6018  *             sibling = element.getprevious()
6019  */
6020   }
6021
6022   /* "lxml/sax.py":186
6023  *                 self._recursive_saxify(sibling, {})
6024  * 
6025  *         self._recursive_saxify(element, {})             # <<<<<<<<<<<<<<
6026  * 
6027  *         if hasattr(element, 'getnext'):
6028  */
6029   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
6030   __Pyx_GOTREF(__pyx_t_1);
6031   __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_element, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
6032   __Pyx_GOTREF(__pyx_t_3);
6033   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6034   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6035
6036   /* "lxml/sax.py":188
6037  *         self._recursive_saxify(element, {})
6038  * 
6039  *         if hasattr(element, 'getnext'):             # <<<<<<<<<<<<<<
6040  *             sibling = element.getnext()
6041  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6042  */
6043   __pyx_t_4 = __Pyx_HasAttr(__pyx_v_element, __pyx_n_s_getnext); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 188, __pyx_L1_error)
6044   __pyx_t_5 = (__pyx_t_4 != 0);
6045   if (__pyx_t_5) {
6046
6047     /* "lxml/sax.py":189
6048  * 
6049  *         if hasattr(element, 'getnext'):
6050  *             sibling = element.getnext()             # <<<<<<<<<<<<<<
6051  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6052  *                 self._recursive_saxify(sibling, {})
6053  */
6054     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_getnext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
6055     __Pyx_GOTREF(__pyx_t_1);
6056     __pyx_t_2 = NULL;
6057     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6058       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6059       if (likely(__pyx_t_2)) {
6060         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6061         __Pyx_INCREF(__pyx_t_2);
6062         __Pyx_INCREF(function);
6063         __Pyx_DECREF_SET(__pyx_t_1, function);
6064       }
6065     }
6066     __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6067     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6068     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
6069     __Pyx_GOTREF(__pyx_t_3);
6070     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6071     __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
6072     __pyx_t_3 = 0;
6073
6074     /* "lxml/sax.py":190
6075  *         if hasattr(element, 'getnext'):
6076  *             sibling = element.getnext()
6077  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:             # <<<<<<<<<<<<<<
6078  *                 self._recursive_saxify(sibling, {})
6079  *                 sibling = sibling.getnext()
6080  */
6081     while (1) {
6082       __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_sibling, __pyx_n_s_tag, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
6083       __Pyx_GOTREF(__pyx_t_3);
6084       __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
6085       __Pyx_GOTREF(__pyx_t_1);
6086       __pyx_t_5 = (__pyx_t_3 == __pyx_t_1);
6087       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6088       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6089       __pyx_t_4 = (__pyx_t_5 != 0);
6090       if (!__pyx_t_4) break;
6091
6092       /* "lxml/sax.py":191
6093  *             sibling = element.getnext()
6094  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6095  *                 self._recursive_saxify(sibling, {})             # <<<<<<<<<<<<<<
6096  *                 sibling = sibling.getnext()
6097  * 
6098  */
6099       __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
6100       __Pyx_GOTREF(__pyx_t_1);
6101       __pyx_t_3 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_sibling, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
6102       __Pyx_GOTREF(__pyx_t_3);
6103       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6104       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6105
6106       /* "lxml/sax.py":192
6107  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6108  *                 self._recursive_saxify(sibling, {})
6109  *                 sibling = sibling.getnext()             # <<<<<<<<<<<<<<
6110  * 
6111  *         self._content_handler.endDocument()
6112  */
6113       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sibling, __pyx_n_s_getnext); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
6114       __Pyx_GOTREF(__pyx_t_1);
6115       __pyx_t_2 = NULL;
6116       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6117         __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6118         if (likely(__pyx_t_2)) {
6119           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6120           __Pyx_INCREF(__pyx_t_2);
6121           __Pyx_INCREF(function);
6122           __Pyx_DECREF_SET(__pyx_t_1, function);
6123         }
6124       }
6125       __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6126       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6127       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
6128       __Pyx_GOTREF(__pyx_t_3);
6129       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6130       __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_3);
6131       __pyx_t_3 = 0;
6132     }
6133
6134     /* "lxml/sax.py":188
6135  *         self._recursive_saxify(element, {})
6136  * 
6137  *         if hasattr(element, 'getnext'):             # <<<<<<<<<<<<<<
6138  *             sibling = element.getnext()
6139  *             while getattr(sibling, 'tag', None) is ProcessingInstruction:
6140  */
6141   }
6142
6143   /* "lxml/sax.py":194
6144  *                 sibling = sibling.getnext()
6145  * 
6146  *         self._content_handler.endDocument()             # <<<<<<<<<<<<<<
6147  * 
6148  *     def _recursive_saxify(self, element, parent_nsmap):
6149  */
6150   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_content_handler, __pyx_n_s_endDocument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
6151   __Pyx_GOTREF(__pyx_t_1);
6152   __pyx_t_2 = NULL;
6153   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6154     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6155     if (likely(__pyx_t_2)) {
6156       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6157       __Pyx_INCREF(__pyx_t_2);
6158       __Pyx_INCREF(function);
6159       __Pyx_DECREF_SET(__pyx_t_1, function);
6160     }
6161   }
6162   __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6163   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6164   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
6165   __Pyx_GOTREF(__pyx_t_3);
6166   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6167   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6168
6169   /* "lxml/sax.py":173
6170  *         self._empty_attributes = attr_class({}, {})
6171  * 
6172  *     def saxify(self):             # <<<<<<<<<<<<<<
6173  *         self._content_handler.startDocument()
6174  * 
6175  */
6176
6177   /* function exit code */
6178   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6179   goto __pyx_L0;
6180   __pyx_L1_error:;
6181   __Pyx_XDECREF(__pyx_t_1);
6182   __Pyx_XDECREF(__pyx_t_2);
6183   __Pyx_XDECREF(__pyx_t_3);
6184   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
6185   __pyx_r = NULL;
6186   __pyx_L0:;
6187   __Pyx_XDECREF(__pyx_v_element);
6188   __Pyx_XDECREF(__pyx_v_siblings);
6189   __Pyx_XDECREF(__pyx_v_sibling);
6190   __Pyx_XGIVEREF(__pyx_r);
6191   __Pyx_RefNannyFinishContext();
6192   return __pyx_r;
6193 }
6194
6195 /* "lxml/sax.py":196
6196  *         self._content_handler.endDocument()
6197  * 
6198  *     def _recursive_saxify(self, element, parent_nsmap):             # <<<<<<<<<<<<<<
6199  *         content_handler = self._content_handler
6200  *         tag = element.tag
6201  */
6202
6203 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_element, PyObject *__pyx_v_parent_nsmap) {
6204   PyObject *__pyx_v_element_nsmap = 0;
6205   PyObject *__pyx_v_content_handler = NULL;
6206   PyObject *__pyx_v_tag = NULL;
6207   PyObject *__pyx_v_tail = NULL;
6208   PyObject *__pyx_v_new_prefixes = NULL;
6209   PyObject *__pyx_v_prefix = NULL;
6210   PyObject *__pyx_v_ns_uri = NULL;
6211   PyObject *__pyx_v_attribs = NULL;
6212   PyObject *__pyx_v_attr_values = NULL;
6213   PyObject *__pyx_v_attr_qnames = NULL;
6214   PyObject *__pyx_v_attr_ns_name = NULL;
6215   PyObject *__pyx_v_value = NULL;
6216   PyObject *__pyx_v_attr_ns_tuple = NULL;
6217   PyObject *__pyx_v_sax_attributes = NULL;
6218   PyObject *__pyx_v_local_name = NULL;
6219   PyObject *__pyx_v_qname = NULL;
6220   PyObject *__pyx_v_uri = NULL;
6221   PyObject *__pyx_v_text = NULL;
6222   PyObject *__pyx_v_child = NULL;
6223   PyObject *__pyx_r = NULL;
6224   __Pyx_RefNannyDeclarations
6225   PyObject *__pyx_t_1 = NULL;
6226   int __pyx_t_2;
6227   int __pyx_t_3;
6228   int __pyx_t_4;
6229   PyObject *__pyx_t_5 = NULL;
6230   PyObject *__pyx_t_6 = NULL;
6231   PyObject *__pyx_t_7 = NULL;
6232   PyObject *__pyx_t_8 = NULL;
6233   int __pyx_t_9;
6234   PyObject *__pyx_t_10 = NULL;
6235   Py_ssize_t __pyx_t_11;
6236   PyObject *(*__pyx_t_12)(PyObject *);
6237   PyObject *(*__pyx_t_13)(PyObject *);
6238   int __pyx_t_14;
6239   int __pyx_lineno = 0;
6240   const char *__pyx_filename = NULL;
6241   int __pyx_clineno = 0;
6242   __Pyx_RefNannySetupContext("_recursive_saxify", 0);
6243
6244   /* "lxml/sax.py":197
6245  * 
6246  *     def _recursive_saxify(self, element, parent_nsmap):
6247  *         content_handler = self._content_handler             # <<<<<<<<<<<<<<
6248  *         tag = element.tag
6249  *         if tag is Comment or tag is ProcessingInstruction:
6250  */
6251   __pyx_t_1 = __pyx_v_self->_content_handler;
6252   __Pyx_INCREF(__pyx_t_1);
6253   __pyx_v_content_handler = __pyx_t_1;
6254   __pyx_t_1 = 0;
6255
6256   /* "lxml/sax.py":198
6257  *     def _recursive_saxify(self, element, parent_nsmap):
6258  *         content_handler = self._content_handler
6259  *         tag = element.tag             # <<<<<<<<<<<<<<
6260  *         if tag is Comment or tag is ProcessingInstruction:
6261  *             if tag is ProcessingInstruction:
6262  */
6263   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
6264   __Pyx_GOTREF(__pyx_t_1);
6265   __pyx_v_tag = __pyx_t_1;
6266   __pyx_t_1 = 0;
6267
6268   /* "lxml/sax.py":199
6269  *         content_handler = self._content_handler
6270  *         tag = element.tag
6271  *         if tag is Comment or tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6272  *             if tag is ProcessingInstruction:
6273  *                 content_handler.processingInstruction(
6274  */
6275   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6276   __Pyx_GOTREF(__pyx_t_1);
6277   __pyx_t_3 = (__pyx_v_tag == __pyx_t_1);
6278   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6279   __pyx_t_4 = (__pyx_t_3 != 0);
6280   if (!__pyx_t_4) {
6281   } else {
6282     __pyx_t_2 = __pyx_t_4;
6283     goto __pyx_L4_bool_binop_done;
6284   }
6285   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6286   __Pyx_GOTREF(__pyx_t_1);
6287   __pyx_t_4 = (__pyx_v_tag == __pyx_t_1);
6288   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6289   __pyx_t_3 = (__pyx_t_4 != 0);
6290   __pyx_t_2 = __pyx_t_3;
6291   __pyx_L4_bool_binop_done:;
6292   if (__pyx_t_2) {
6293
6294     /* "lxml/sax.py":200
6295  *         tag = element.tag
6296  *         if tag is Comment or tag is ProcessingInstruction:
6297  *             if tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6298  *                 content_handler.processingInstruction(
6299  *                     element.target, element.text)
6300  */
6301     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
6302     __Pyx_GOTREF(__pyx_t_1);
6303     __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
6304     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6305     __pyx_t_3 = (__pyx_t_2 != 0);
6306     if (__pyx_t_3) {
6307
6308       /* "lxml/sax.py":201
6309  *         if tag is Comment or tag is ProcessingInstruction:
6310  *             if tag is ProcessingInstruction:
6311  *                 content_handler.processingInstruction(             # <<<<<<<<<<<<<<
6312  *                     element.target, element.text)
6313  *             tail = element.tail
6314  */
6315       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_processingInstruction); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
6316       __Pyx_GOTREF(__pyx_t_5);
6317
6318       /* "lxml/sax.py":202
6319  *             if tag is ProcessingInstruction:
6320  *                 content_handler.processingInstruction(
6321  *                     element.target, element.text)             # <<<<<<<<<<<<<<
6322  *             tail = element.tail
6323  *             if tail:
6324  */
6325       __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_target); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
6326       __Pyx_GOTREF(__pyx_t_6);
6327       __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
6328       __Pyx_GOTREF(__pyx_t_7);
6329       __pyx_t_8 = NULL;
6330       __pyx_t_9 = 0;
6331       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6332         __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
6333         if (likely(__pyx_t_8)) {
6334           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6335           __Pyx_INCREF(__pyx_t_8);
6336           __Pyx_INCREF(function);
6337           __Pyx_DECREF_SET(__pyx_t_5, function);
6338           __pyx_t_9 = 1;
6339         }
6340       }
6341       #if CYTHON_FAST_PYCALL
6342       if (PyFunction_Check(__pyx_t_5)) {
6343         PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6344         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6345         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6346         __Pyx_GOTREF(__pyx_t_1);
6347         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6348         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6349       } else
6350       #endif
6351       #if CYTHON_FAST_PYCCALL
6352       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6353         PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6354         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6355         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6356         __Pyx_GOTREF(__pyx_t_1);
6357         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6358         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6359       } else
6360       #endif
6361       {
6362         __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error)
6363         __Pyx_GOTREF(__pyx_t_10);
6364         if (__pyx_t_8) {
6365           __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
6366         }
6367         __Pyx_GIVEREF(__pyx_t_6);
6368         PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_6);
6369         __Pyx_GIVEREF(__pyx_t_7);
6370         PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
6371         __pyx_t_6 = 0;
6372         __pyx_t_7 = 0;
6373         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
6374         __Pyx_GOTREF(__pyx_t_1);
6375         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6376       }
6377       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6378       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6379
6380       /* "lxml/sax.py":200
6381  *         tag = element.tag
6382  *         if tag is Comment or tag is ProcessingInstruction:
6383  *             if tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6384  *                 content_handler.processingInstruction(
6385  *                     element.target, element.text)
6386  */
6387     }
6388
6389     /* "lxml/sax.py":203
6390  *                 content_handler.processingInstruction(
6391  *                     element.target, element.text)
6392  *             tail = element.tail             # <<<<<<<<<<<<<<
6393  *             if tail:
6394  *                 content_handler.characters(tail)
6395  */
6396     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
6397     __Pyx_GOTREF(__pyx_t_1);
6398     __pyx_v_tail = __pyx_t_1;
6399     __pyx_t_1 = 0;
6400
6401     /* "lxml/sax.py":204
6402  *                     element.target, element.text)
6403  *             tail = element.tail
6404  *             if tail:             # <<<<<<<<<<<<<<
6405  *                 content_handler.characters(tail)
6406  *             return
6407  */
6408     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
6409     if (__pyx_t_3) {
6410
6411       /* "lxml/sax.py":205
6412  *             tail = element.tail
6413  *             if tail:
6414  *                 content_handler.characters(tail)             # <<<<<<<<<<<<<<
6415  *             return
6416  * 
6417  */
6418       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
6419       __Pyx_GOTREF(__pyx_t_5);
6420       __pyx_t_10 = NULL;
6421       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6422         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
6423         if (likely(__pyx_t_10)) {
6424           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6425           __Pyx_INCREF(__pyx_t_10);
6426           __Pyx_INCREF(function);
6427           __Pyx_DECREF_SET(__pyx_t_5, function);
6428         }
6429       }
6430       __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_tail) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tail);
6431       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6432       if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
6433       __Pyx_GOTREF(__pyx_t_1);
6434       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6435       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6436
6437       /* "lxml/sax.py":204
6438  *                     element.target, element.text)
6439  *             tail = element.tail
6440  *             if tail:             # <<<<<<<<<<<<<<
6441  *                 content_handler.characters(tail)
6442  *             return
6443  */
6444     }
6445
6446     /* "lxml/sax.py":206
6447  *             if tail:
6448  *                 content_handler.characters(tail)
6449  *             return             # <<<<<<<<<<<<<<
6450  * 
6451  *         element_nsmap = element.nsmap
6452  */
6453     __Pyx_XDECREF(__pyx_r);
6454     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6455     goto __pyx_L0;
6456
6457     /* "lxml/sax.py":199
6458  *         content_handler = self._content_handler
6459  *         tag = element.tag
6460  *         if tag is Comment or tag is ProcessingInstruction:             # <<<<<<<<<<<<<<
6461  *             if tag is ProcessingInstruction:
6462  *                 content_handler.processingInstruction(
6463  */
6464   }
6465
6466   /* "lxml/sax.py":208
6467  *             return
6468  * 
6469  *         element_nsmap = element.nsmap             # <<<<<<<<<<<<<<
6470  *         new_prefixes = []
6471  *         if element_nsmap != parent_nsmap:
6472  */
6473   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
6474   __Pyx_GOTREF(__pyx_t_1);
6475   if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 208, __pyx_L1_error)
6476   __pyx_v_element_nsmap = ((PyObject*)__pyx_t_1);
6477   __pyx_t_1 = 0;
6478
6479   /* "lxml/sax.py":209
6480  * 
6481  *         element_nsmap = element.nsmap
6482  *         new_prefixes = []             # <<<<<<<<<<<<<<
6483  *         if element_nsmap != parent_nsmap:
6484  *             # There have been updates to the namespace
6485  */
6486   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
6487   __Pyx_GOTREF(__pyx_t_1);
6488   __pyx_v_new_prefixes = ((PyObject*)__pyx_t_1);
6489   __pyx_t_1 = 0;
6490
6491   /* "lxml/sax.py":210
6492  *         element_nsmap = element.nsmap
6493  *         new_prefixes = []
6494  *         if element_nsmap != parent_nsmap:             # <<<<<<<<<<<<<<
6495  *             # There have been updates to the namespace
6496  *             for prefix, ns_uri in element_nsmap.items():
6497  */
6498   __pyx_t_1 = PyObject_RichCompare(__pyx_v_element_nsmap, __pyx_v_parent_nsmap, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
6499   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
6500   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6501   if (__pyx_t_3) {
6502
6503     /* "lxml/sax.py":212
6504  *         if element_nsmap != parent_nsmap:
6505  *             # There have been updates to the namespace
6506  *             for prefix, ns_uri in element_nsmap.items():             # <<<<<<<<<<<<<<
6507  *                 if parent_nsmap.get(prefix) != ns_uri:
6508  *                     new_prefixes.append( (prefix, ns_uri) )
6509  */
6510     if (unlikely(__pyx_v_element_nsmap == Py_None)) {
6511       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
6512       __PYX_ERR(0, 212, __pyx_L1_error)
6513     }
6514     __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_element_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6515     __Pyx_GOTREF(__pyx_t_1);
6516     if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
6517       __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6518       __pyx_t_12 = NULL;
6519     } else {
6520       __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
6521       __Pyx_GOTREF(__pyx_t_5);
6522       __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 212, __pyx_L1_error)
6523     }
6524     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6525     for (;;) {
6526       if (likely(!__pyx_t_12)) {
6527         if (likely(PyList_CheckExact(__pyx_t_5))) {
6528           if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6529           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6530           __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
6531           #else
6532           __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6533           __Pyx_GOTREF(__pyx_t_1);
6534           #endif
6535         } else {
6536           if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6537           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6538           __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
6539           #else
6540           __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6541           __Pyx_GOTREF(__pyx_t_1);
6542           #endif
6543         }
6544       } else {
6545         __pyx_t_1 = __pyx_t_12(__pyx_t_5);
6546         if (unlikely(!__pyx_t_1)) {
6547           PyObject* exc_type = PyErr_Occurred();
6548           if (exc_type) {
6549             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6550             else __PYX_ERR(0, 212, __pyx_L1_error)
6551           }
6552           break;
6553         }
6554         __Pyx_GOTREF(__pyx_t_1);
6555       }
6556       if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
6557         PyObject* sequence = __pyx_t_1;
6558         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6559         if (unlikely(size != 2)) {
6560           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6561           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6562           __PYX_ERR(0, 212, __pyx_L1_error)
6563         }
6564         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6565         if (likely(PyTuple_CheckExact(sequence))) {
6566           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
6567           __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
6568         } else {
6569           __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
6570           __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
6571         }
6572         __Pyx_INCREF(__pyx_t_10);
6573         __Pyx_INCREF(__pyx_t_7);
6574         #else
6575         __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 212, __pyx_L1_error)
6576         __Pyx_GOTREF(__pyx_t_10);
6577         __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error)
6578         __Pyx_GOTREF(__pyx_t_7);
6579         #endif
6580         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6581       } else {
6582         Py_ssize_t index = -1;
6583         __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error)
6584         __Pyx_GOTREF(__pyx_t_6);
6585         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6586         __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6587         index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
6588         __Pyx_GOTREF(__pyx_t_10);
6589         index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
6590         __Pyx_GOTREF(__pyx_t_7);
6591         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
6592         __pyx_t_13 = NULL;
6593         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6594         goto __pyx_L12_unpacking_done;
6595         __pyx_L11_unpacking_failed:;
6596         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6597         __pyx_t_13 = NULL;
6598         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6599         __PYX_ERR(0, 212, __pyx_L1_error)
6600         __pyx_L12_unpacking_done:;
6601       }
6602       __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
6603       __pyx_t_10 = 0;
6604       __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_7);
6605       __pyx_t_7 = 0;
6606
6607       /* "lxml/sax.py":213
6608  *             # There have been updates to the namespace
6609  *             for prefix, ns_uri in element_nsmap.items():
6610  *                 if parent_nsmap.get(prefix) != ns_uri:             # <<<<<<<<<<<<<<
6611  *                     new_prefixes.append( (prefix, ns_uri) )
6612  * 
6613  */
6614       if (unlikely(__pyx_v_parent_nsmap == Py_None)) {
6615         PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
6616         __PYX_ERR(0, 213, __pyx_L1_error)
6617       }
6618       __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_parent_nsmap, __pyx_v_prefix, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
6619       __Pyx_GOTREF(__pyx_t_1);
6620       __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_ns_uri, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 213, __pyx_L1_error)
6621       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6622       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
6623       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6624       if (__pyx_t_3) {
6625
6626         /* "lxml/sax.py":214
6627  *             for prefix, ns_uri in element_nsmap.items():
6628  *                 if parent_nsmap.get(prefix) != ns_uri:
6629  *                     new_prefixes.append( (prefix, ns_uri) )             # <<<<<<<<<<<<<<
6630  * 
6631  *         attribs = element.items()
6632  */
6633         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error)
6634         __Pyx_GOTREF(__pyx_t_7);
6635         __Pyx_INCREF(__pyx_v_prefix);
6636         __Pyx_GIVEREF(__pyx_v_prefix);
6637         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_prefix);
6638         __Pyx_INCREF(__pyx_v_ns_uri);
6639         __Pyx_GIVEREF(__pyx_v_ns_uri);
6640         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ns_uri);
6641         __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_new_prefixes, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error)
6642         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6643
6644         /* "lxml/sax.py":213
6645  *             # There have been updates to the namespace
6646  *             for prefix, ns_uri in element_nsmap.items():
6647  *                 if parent_nsmap.get(prefix) != ns_uri:             # <<<<<<<<<<<<<<
6648  *                     new_prefixes.append( (prefix, ns_uri) )
6649  * 
6650  */
6651       }
6652
6653       /* "lxml/sax.py":212
6654  *         if element_nsmap != parent_nsmap:
6655  *             # There have been updates to the namespace
6656  *             for prefix, ns_uri in element_nsmap.items():             # <<<<<<<<<<<<<<
6657  *                 if parent_nsmap.get(prefix) != ns_uri:
6658  *                     new_prefixes.append( (prefix, ns_uri) )
6659  */
6660     }
6661     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6662
6663     /* "lxml/sax.py":210
6664  *         element_nsmap = element.nsmap
6665  *         new_prefixes = []
6666  *         if element_nsmap != parent_nsmap:             # <<<<<<<<<<<<<<
6667  *             # There have been updates to the namespace
6668  *             for prefix, ns_uri in element_nsmap.items():
6669  */
6670   }
6671
6672   /* "lxml/sax.py":216
6673  *                     new_prefixes.append( (prefix, ns_uri) )
6674  * 
6675  *         attribs = element.items()             # <<<<<<<<<<<<<<
6676  *         if attribs:
6677  *             attr_values = {}
6678  */
6679   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_items); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error)
6680   __Pyx_GOTREF(__pyx_t_7);
6681   __pyx_t_1 = NULL;
6682   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
6683     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
6684     if (likely(__pyx_t_1)) {
6685       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6686       __Pyx_INCREF(__pyx_t_1);
6687       __Pyx_INCREF(function);
6688       __Pyx_DECREF_SET(__pyx_t_7, function);
6689     }
6690   }
6691   __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
6692   __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6693   if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
6694   __Pyx_GOTREF(__pyx_t_5);
6695   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6696   __pyx_v_attribs = __pyx_t_5;
6697   __pyx_t_5 = 0;
6698
6699   /* "lxml/sax.py":217
6700  * 
6701  *         attribs = element.items()
6702  *         if attribs:             # <<<<<<<<<<<<<<
6703  *             attr_values = {}
6704  *             attr_qnames = {}
6705  */
6706   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attribs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
6707   if (__pyx_t_3) {
6708
6709     /* "lxml/sax.py":218
6710  *         attribs = element.items()
6711  *         if attribs:
6712  *             attr_values = {}             # <<<<<<<<<<<<<<
6713  *             attr_qnames = {}
6714  *             for attr_ns_name, value in attribs:
6715  */
6716     __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error)
6717     __Pyx_GOTREF(__pyx_t_5);
6718     __pyx_v_attr_values = ((PyObject*)__pyx_t_5);
6719     __pyx_t_5 = 0;
6720
6721     /* "lxml/sax.py":219
6722  *         if attribs:
6723  *             attr_values = {}
6724  *             attr_qnames = {}             # <<<<<<<<<<<<<<
6725  *             for attr_ns_name, value in attribs:
6726  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6727  */
6728     __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
6729     __Pyx_GOTREF(__pyx_t_5);
6730     __pyx_v_attr_qnames = ((PyObject*)__pyx_t_5);
6731     __pyx_t_5 = 0;
6732
6733     /* "lxml/sax.py":220
6734  *             attr_values = {}
6735  *             attr_qnames = {}
6736  *             for attr_ns_name, value in attribs:             # <<<<<<<<<<<<<<
6737  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6738  *                 attr_values[attr_ns_tuple] = value
6739  */
6740     if (likely(PyList_CheckExact(__pyx_v_attribs)) || PyTuple_CheckExact(__pyx_v_attribs)) {
6741       __pyx_t_5 = __pyx_v_attribs; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6742       __pyx_t_12 = NULL;
6743     } else {
6744       __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_attribs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
6745       __Pyx_GOTREF(__pyx_t_5);
6746       __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 220, __pyx_L1_error)
6747     }
6748     for (;;) {
6749       if (likely(!__pyx_t_12)) {
6750         if (likely(PyList_CheckExact(__pyx_t_5))) {
6751           if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6752           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6753           __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
6754           #else
6755           __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error)
6756           __Pyx_GOTREF(__pyx_t_7);
6757           #endif
6758         } else {
6759           if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6760           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6761           __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_7); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
6762           #else
6763           __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error)
6764           __Pyx_GOTREF(__pyx_t_7);
6765           #endif
6766         }
6767       } else {
6768         __pyx_t_7 = __pyx_t_12(__pyx_t_5);
6769         if (unlikely(!__pyx_t_7)) {
6770           PyObject* exc_type = PyErr_Occurred();
6771           if (exc_type) {
6772             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6773             else __PYX_ERR(0, 220, __pyx_L1_error)
6774           }
6775           break;
6776         }
6777         __Pyx_GOTREF(__pyx_t_7);
6778       }
6779       if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
6780         PyObject* sequence = __pyx_t_7;
6781         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6782         if (unlikely(size != 2)) {
6783           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6784           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6785           __PYX_ERR(0, 220, __pyx_L1_error)
6786         }
6787         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6788         if (likely(PyTuple_CheckExact(sequence))) {
6789           __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
6790           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
6791         } else {
6792           __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
6793           __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
6794         }
6795         __Pyx_INCREF(__pyx_t_1);
6796         __Pyx_INCREF(__pyx_t_10);
6797         #else
6798         __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
6799         __Pyx_GOTREF(__pyx_t_1);
6800         __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error)
6801         __Pyx_GOTREF(__pyx_t_10);
6802         #endif
6803         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6804       } else {
6805         Py_ssize_t index = -1;
6806         __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
6807         __Pyx_GOTREF(__pyx_t_6);
6808         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6809         __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6810         index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
6811         __Pyx_GOTREF(__pyx_t_1);
6812         index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
6813         __Pyx_GOTREF(__pyx_t_10);
6814         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
6815         __pyx_t_13 = NULL;
6816         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6817         goto __pyx_L18_unpacking_done;
6818         __pyx_L17_unpacking_failed:;
6819         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6820         __pyx_t_13 = NULL;
6821         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6822         __PYX_ERR(0, 220, __pyx_L1_error)
6823         __pyx_L18_unpacking_done:;
6824       }
6825       __Pyx_XDECREF_SET(__pyx_v_attr_ns_name, __pyx_t_1);
6826       __pyx_t_1 = 0;
6827       __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
6828       __pyx_t_10 = 0;
6829
6830       /* "lxml/sax.py":221
6831  *             attr_qnames = {}
6832  *             for attr_ns_name, value in attribs:
6833  *                 attr_ns_tuple = _getNsTag(attr_ns_name)             # <<<<<<<<<<<<<<
6834  *                 attr_values[attr_ns_tuple] = value
6835  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6836  */
6837       __pyx_t_7 = __pyx_f_4lxml_3sax__getNsTag(__pyx_v_attr_ns_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error)
6838       __Pyx_GOTREF(__pyx_t_7);
6839       __Pyx_XDECREF_SET(__pyx_v_attr_ns_tuple, ((PyObject*)__pyx_t_7));
6840       __pyx_t_7 = 0;
6841
6842       /* "lxml/sax.py":222
6843  *             for attr_ns_name, value in attribs:
6844  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6845  *                 attr_values[attr_ns_tuple] = value             # <<<<<<<<<<<<<<
6846  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6847  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6848  */
6849       if (unlikely(PyDict_SetItem(__pyx_v_attr_values, __pyx_v_attr_ns_tuple, __pyx_v_value) < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
6850
6851       /* "lxml/sax.py":224
6852  *                 attr_values[attr_ns_tuple] = value
6853  *                 attr_qnames[attr_ns_tuple] = self._build_qname(
6854  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,             # <<<<<<<<<<<<<<
6855  *                     preferred_prefix=None, is_attribute=True)
6856  *             sax_attributes = self._attr_class(attr_values, attr_qnames)
6857  */
6858       if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6859         PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6860         __PYX_ERR(0, 224, __pyx_L1_error)
6861       }
6862       __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_attr_ns_tuple, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
6863       __Pyx_GOTREF(__pyx_t_7);
6864       if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6865         PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6866         __PYX_ERR(0, 224, __pyx_L1_error)
6867       }
6868       __pyx_t_10 = __Pyx_GetItemInt_Tuple(__pyx_v_attr_ns_tuple, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error)
6869       __Pyx_GOTREF(__pyx_t_10);
6870
6871       /* "lxml/sax.py":223
6872  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6873  *                 attr_values[attr_ns_tuple] = value
6874  *                 attr_qnames[attr_ns_tuple] = self._build_qname(             # <<<<<<<<<<<<<<
6875  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6876  *                     preferred_prefix=None, is_attribute=True)
6877  */
6878       __pyx_t_1 = __pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(__pyx_v_self, __pyx_t_7, __pyx_t_10, __pyx_v_element_nsmap, Py_None, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
6879       __Pyx_GOTREF(__pyx_t_1);
6880       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6881       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6882       if (unlikely(PyDict_SetItem(__pyx_v_attr_qnames, __pyx_v_attr_ns_tuple, __pyx_t_1) < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
6883       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6884
6885       /* "lxml/sax.py":220
6886  *             attr_values = {}
6887  *             attr_qnames = {}
6888  *             for attr_ns_name, value in attribs:             # <<<<<<<<<<<<<<
6889  *                 attr_ns_tuple = _getNsTag(attr_ns_name)
6890  *                 attr_values[attr_ns_tuple] = value
6891  */
6892     }
6893     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6894
6895     /* "lxml/sax.py":226
6896  *                     attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6897  *                     preferred_prefix=None, is_attribute=True)
6898  *             sax_attributes = self._attr_class(attr_values, attr_qnames)             # <<<<<<<<<<<<<<
6899  *         else:
6900  *             sax_attributes = self._empty_attributes
6901  */
6902     __Pyx_INCREF(__pyx_v_self->_attr_class);
6903     __pyx_t_1 = __pyx_v_self->_attr_class; __pyx_t_10 = NULL;
6904     __pyx_t_9 = 0;
6905     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6906       __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
6907       if (likely(__pyx_t_10)) {
6908         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6909         __Pyx_INCREF(__pyx_t_10);
6910         __Pyx_INCREF(function);
6911         __Pyx_DECREF_SET(__pyx_t_1, function);
6912         __pyx_t_9 = 1;
6913       }
6914     }
6915     #if CYTHON_FAST_PYCALL
6916     if (PyFunction_Check(__pyx_t_1)) {
6917       PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6918       __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6919       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6920       __Pyx_GOTREF(__pyx_t_5);
6921     } else
6922     #endif
6923     #if CYTHON_FAST_PYCCALL
6924     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6925       PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6926       __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6927       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6928       __Pyx_GOTREF(__pyx_t_5);
6929     } else
6930     #endif
6931     {
6932       __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error)
6933       __Pyx_GOTREF(__pyx_t_7);
6934       if (__pyx_t_10) {
6935         __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
6936       }
6937       __Pyx_INCREF(__pyx_v_attr_values);
6938       __Pyx_GIVEREF(__pyx_v_attr_values);
6939       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_attr_values);
6940       __Pyx_INCREF(__pyx_v_attr_qnames);
6941       __Pyx_GIVEREF(__pyx_v_attr_qnames);
6942       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_attr_qnames);
6943       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6944       __Pyx_GOTREF(__pyx_t_5);
6945       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6946     }
6947     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6948     __pyx_v_sax_attributes = __pyx_t_5;
6949     __pyx_t_5 = 0;
6950
6951     /* "lxml/sax.py":217
6952  * 
6953  *         attribs = element.items()
6954  *         if attribs:             # <<<<<<<<<<<<<<
6955  *             attr_values = {}
6956  *             attr_qnames = {}
6957  */
6958     goto __pyx_L14;
6959   }
6960
6961   /* "lxml/sax.py":228
6962  *             sax_attributes = self._attr_class(attr_values, attr_qnames)
6963  *         else:
6964  *             sax_attributes = self._empty_attributes             # <<<<<<<<<<<<<<
6965  * 
6966  *         ns_uri, local_name = _getNsTag(tag)
6967  */
6968   /*else*/ {
6969     __pyx_t_5 = __pyx_v_self->_empty_attributes;
6970     __Pyx_INCREF(__pyx_t_5);
6971     __pyx_v_sax_attributes = __pyx_t_5;
6972     __pyx_t_5 = 0;
6973   }
6974   __pyx_L14:;
6975
6976   /* "lxml/sax.py":230
6977  *             sax_attributes = self._empty_attributes
6978  * 
6979  *         ns_uri, local_name = _getNsTag(tag)             # <<<<<<<<<<<<<<
6980  *         qname = self._build_qname(
6981  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
6982  */
6983   __pyx_t_5 = __pyx_f_4lxml_3sax__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
6984   __Pyx_GOTREF(__pyx_t_5);
6985   if (likely(__pyx_t_5 != Py_None)) {
6986     PyObject* sequence = __pyx_t_5;
6987     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6988     if (unlikely(size != 2)) {
6989       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6990       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6991       __PYX_ERR(0, 230, __pyx_L1_error)
6992     }
6993     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6994     __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
6995     __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
6996     __Pyx_INCREF(__pyx_t_1);
6997     __Pyx_INCREF(__pyx_t_7);
6998     #else
6999     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
7000     __Pyx_GOTREF(__pyx_t_1);
7001     __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
7002     __Pyx_GOTREF(__pyx_t_7);
7003     #endif
7004     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7005   } else {
7006     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 230, __pyx_L1_error)
7007   }
7008   __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_1);
7009   __pyx_t_1 = 0;
7010   __pyx_v_local_name = __pyx_t_7;
7011   __pyx_t_7 = 0;
7012
7013   /* "lxml/sax.py":232
7014  *         ns_uri, local_name = _getNsTag(tag)
7015  *         qname = self._build_qname(
7016  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)             # <<<<<<<<<<<<<<
7017  * 
7018  *         for prefix, uri in new_prefixes:
7019  */
7020   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
7021   __Pyx_GOTREF(__pyx_t_5);
7022
7023   /* "lxml/sax.py":231
7024  * 
7025  *         ns_uri, local_name = _getNsTag(tag)
7026  *         qname = self._build_qname(             # <<<<<<<<<<<<<<
7027  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7028  * 
7029  */
7030   __pyx_t_7 = __pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(__pyx_v_self, __pyx_v_ns_uri, __pyx_v_local_name, __pyx_v_element_nsmap, __pyx_t_5, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
7031   __Pyx_GOTREF(__pyx_t_7);
7032   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7033   __pyx_v_qname = __pyx_t_7;
7034   __pyx_t_7 = 0;
7035
7036   /* "lxml/sax.py":234
7037  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7038  * 
7039  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7040  *             content_handler.startPrefixMapping(prefix, uri)
7041  *         content_handler.startElementNS(
7042  */
7043   __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7044   for (;;) {
7045     if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7046     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7047     __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
7048     #else
7049     __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
7050     __Pyx_GOTREF(__pyx_t_5);
7051     #endif
7052     if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7053       PyObject* sequence = __pyx_t_5;
7054       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7055       if (unlikely(size != 2)) {
7056         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7057         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7058         __PYX_ERR(0, 234, __pyx_L1_error)
7059       }
7060       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7061       if (likely(PyTuple_CheckExact(sequence))) {
7062         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
7063         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
7064       } else {
7065         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
7066         __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
7067       }
7068       __Pyx_INCREF(__pyx_t_1);
7069       __Pyx_INCREF(__pyx_t_10);
7070       #else
7071       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
7072       __Pyx_GOTREF(__pyx_t_1);
7073       __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 234, __pyx_L1_error)
7074       __Pyx_GOTREF(__pyx_t_10);
7075       #endif
7076       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7077     } else {
7078       Py_ssize_t index = -1;
7079       __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
7080       __Pyx_GOTREF(__pyx_t_6);
7081       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7082       __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
7083       index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed;
7084       __Pyx_GOTREF(__pyx_t_1);
7085       index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed;
7086       __Pyx_GOTREF(__pyx_t_10);
7087       if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
7088       __pyx_t_13 = NULL;
7089       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7090       goto __pyx_L22_unpacking_done;
7091       __pyx_L21_unpacking_failed:;
7092       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7093       __pyx_t_13 = NULL;
7094       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7095       __PYX_ERR(0, 234, __pyx_L1_error)
7096       __pyx_L22_unpacking_done:;
7097     }
7098     __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_1);
7099     __pyx_t_1 = 0;
7100     __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_10);
7101     __pyx_t_10 = 0;
7102
7103     /* "lxml/sax.py":235
7104  * 
7105  *         for prefix, uri in new_prefixes:
7106  *             content_handler.startPrefixMapping(prefix, uri)             # <<<<<<<<<<<<<<
7107  *         content_handler.startElementNS(
7108  *             (ns_uri, local_name), qname, sax_attributes)
7109  */
7110     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_startPrefixMapping); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
7111     __Pyx_GOTREF(__pyx_t_10);
7112     __pyx_t_1 = NULL;
7113     __pyx_t_9 = 0;
7114     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
7115       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
7116       if (likely(__pyx_t_1)) {
7117         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7118         __Pyx_INCREF(__pyx_t_1);
7119         __Pyx_INCREF(function);
7120         __Pyx_DECREF_SET(__pyx_t_10, function);
7121         __pyx_t_9 = 1;
7122       }
7123     }
7124     #if CYTHON_FAST_PYCALL
7125     if (PyFunction_Check(__pyx_t_10)) {
7126       PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7127       __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7128       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7129       __Pyx_GOTREF(__pyx_t_5);
7130     } else
7131     #endif
7132     #if CYTHON_FAST_PYCCALL
7133     if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
7134       PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7135       __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7136       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7137       __Pyx_GOTREF(__pyx_t_5);
7138     } else
7139     #endif
7140     {
7141       __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
7142       __Pyx_GOTREF(__pyx_t_6);
7143       if (__pyx_t_1) {
7144         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
7145       }
7146       __Pyx_INCREF(__pyx_v_prefix);
7147       __Pyx_GIVEREF(__pyx_v_prefix);
7148       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_v_prefix);
7149       __Pyx_INCREF(__pyx_v_uri);
7150       __Pyx_GIVEREF(__pyx_v_uri);
7151       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_uri);
7152       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
7153       __Pyx_GOTREF(__pyx_t_5);
7154       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7155     }
7156     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7157     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7158
7159     /* "lxml/sax.py":234
7160  *             ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7161  * 
7162  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7163  *             content_handler.startPrefixMapping(prefix, uri)
7164  *         content_handler.startElementNS(
7165  */
7166   }
7167   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7168
7169   /* "lxml/sax.py":236
7170  *         for prefix, uri in new_prefixes:
7171  *             content_handler.startPrefixMapping(prefix, uri)
7172  *         content_handler.startElementNS(             # <<<<<<<<<<<<<<
7173  *             (ns_uri, local_name), qname, sax_attributes)
7174  *         text = element.text
7175  */
7176   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_startElementNS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
7177   __Pyx_GOTREF(__pyx_t_5);
7178
7179   /* "lxml/sax.py":237
7180  *             content_handler.startPrefixMapping(prefix, uri)
7181  *         content_handler.startElementNS(
7182  *             (ns_uri, local_name), qname, sax_attributes)             # <<<<<<<<<<<<<<
7183  *         text = element.text
7184  *         if text:
7185  */
7186   __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error)
7187   __Pyx_GOTREF(__pyx_t_10);
7188   __Pyx_INCREF(__pyx_v_ns_uri);
7189   __Pyx_GIVEREF(__pyx_v_ns_uri);
7190   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ns_uri);
7191   __Pyx_INCREF(__pyx_v_local_name);
7192   __Pyx_GIVEREF(__pyx_v_local_name);
7193   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_local_name);
7194   __pyx_t_6 = NULL;
7195   __pyx_t_9 = 0;
7196   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7197     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7198     if (likely(__pyx_t_6)) {
7199       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7200       __Pyx_INCREF(__pyx_t_6);
7201       __Pyx_INCREF(function);
7202       __Pyx_DECREF_SET(__pyx_t_5, function);
7203       __pyx_t_9 = 1;
7204     }
7205   }
7206   #if CYTHON_FAST_PYCALL
7207   if (PyFunction_Check(__pyx_t_5)) {
7208     PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7209     __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7210     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7211     __Pyx_GOTREF(__pyx_t_7);
7212     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7213   } else
7214   #endif
7215   #if CYTHON_FAST_PYCCALL
7216   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7217     PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7218     __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7219     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7220     __Pyx_GOTREF(__pyx_t_7);
7221     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7222   } else
7223   #endif
7224   {
7225     __pyx_t_1 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
7226     __Pyx_GOTREF(__pyx_t_1);
7227     if (__pyx_t_6) {
7228       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
7229     }
7230     __Pyx_GIVEREF(__pyx_t_10);
7231     PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_t_10);
7232     __Pyx_INCREF(__pyx_v_qname);
7233     __Pyx_GIVEREF(__pyx_v_qname);
7234     PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_v_qname);
7235     __Pyx_INCREF(__pyx_v_sax_attributes);
7236     __Pyx_GIVEREF(__pyx_v_sax_attributes);
7237     PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_9, __pyx_v_sax_attributes);
7238     __pyx_t_10 = 0;
7239     __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
7240     __Pyx_GOTREF(__pyx_t_7);
7241     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7242   }
7243   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7244   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7245
7246   /* "lxml/sax.py":238
7247  *         content_handler.startElementNS(
7248  *             (ns_uri, local_name), qname, sax_attributes)
7249  *         text = element.text             # <<<<<<<<<<<<<<
7250  *         if text:
7251  *             content_handler.characters(text)
7252  */
7253   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error)
7254   __Pyx_GOTREF(__pyx_t_7);
7255   __pyx_v_text = __pyx_t_7;
7256   __pyx_t_7 = 0;
7257
7258   /* "lxml/sax.py":239
7259  *             (ns_uri, local_name), qname, sax_attributes)
7260  *         text = element.text
7261  *         if text:             # <<<<<<<<<<<<<<
7262  *             content_handler.characters(text)
7263  *         for child in element:
7264  */
7265   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
7266   if (__pyx_t_3) {
7267
7268     /* "lxml/sax.py":240
7269  *         text = element.text
7270  *         if text:
7271  *             content_handler.characters(text)             # <<<<<<<<<<<<<<
7272  *         for child in element:
7273  *             self._recursive_saxify(child, element_nsmap)
7274  */
7275     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
7276     __Pyx_GOTREF(__pyx_t_5);
7277     __pyx_t_1 = NULL;
7278     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7279       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7280       if (likely(__pyx_t_1)) {
7281         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7282         __Pyx_INCREF(__pyx_t_1);
7283         __Pyx_INCREF(function);
7284         __Pyx_DECREF_SET(__pyx_t_5, function);
7285       }
7286     }
7287     __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_text) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_text);
7288     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7289     if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
7290     __Pyx_GOTREF(__pyx_t_7);
7291     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7292     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7293
7294     /* "lxml/sax.py":239
7295  *             (ns_uri, local_name), qname, sax_attributes)
7296  *         text = element.text
7297  *         if text:             # <<<<<<<<<<<<<<
7298  *             content_handler.characters(text)
7299  *         for child in element:
7300  */
7301   }
7302
7303   /* "lxml/sax.py":241
7304  *         if text:
7305  *             content_handler.characters(text)
7306  *         for child in element:             # <<<<<<<<<<<<<<
7307  *             self._recursive_saxify(child, element_nsmap)
7308  *         content_handler.endElementNS((ns_uri, local_name), qname)
7309  */
7310   if (likely(PyList_CheckExact(__pyx_v_element)) || PyTuple_CheckExact(__pyx_v_element)) {
7311     __pyx_t_7 = __pyx_v_element; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7312     __pyx_t_12 = NULL;
7313   } else {
7314     __pyx_t_11 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_element); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
7315     __Pyx_GOTREF(__pyx_t_7);
7316     __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 241, __pyx_L1_error)
7317   }
7318   for (;;) {
7319     if (likely(!__pyx_t_12)) {
7320       if (likely(PyList_CheckExact(__pyx_t_7))) {
7321         if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7322         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7323         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
7324         #else
7325         __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
7326         __Pyx_GOTREF(__pyx_t_5);
7327         #endif
7328       } else {
7329         if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
7330         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7331         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
7332         #else
7333         __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
7334         __Pyx_GOTREF(__pyx_t_5);
7335         #endif
7336       }
7337     } else {
7338       __pyx_t_5 = __pyx_t_12(__pyx_t_7);
7339       if (unlikely(!__pyx_t_5)) {
7340         PyObject* exc_type = PyErr_Occurred();
7341         if (exc_type) {
7342           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7343           else __PYX_ERR(0, 241, __pyx_L1_error)
7344         }
7345         break;
7346       }
7347       __Pyx_GOTREF(__pyx_t_5);
7348     }
7349     __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
7350     __pyx_t_5 = 0;
7351
7352     /* "lxml/sax.py":242
7353  *             content_handler.characters(text)
7354  *         for child in element:
7355  *             self._recursive_saxify(child, element_nsmap)             # <<<<<<<<<<<<<<
7356  *         content_handler.endElementNS((ns_uri, local_name), qname)
7357  *         for prefix, uri in new_prefixes:
7358  */
7359     __pyx_t_5 = __pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(__pyx_v_self, __pyx_v_child, __pyx_v_element_nsmap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error)
7360     __Pyx_GOTREF(__pyx_t_5);
7361     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7362
7363     /* "lxml/sax.py":241
7364  *         if text:
7365  *             content_handler.characters(text)
7366  *         for child in element:             # <<<<<<<<<<<<<<
7367  *             self._recursive_saxify(child, element_nsmap)
7368  *         content_handler.endElementNS((ns_uri, local_name), qname)
7369  */
7370   }
7371   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7372
7373   /* "lxml/sax.py":243
7374  *         for child in element:
7375  *             self._recursive_saxify(child, element_nsmap)
7376  *         content_handler.endElementNS((ns_uri, local_name), qname)             # <<<<<<<<<<<<<<
7377  *         for prefix, uri in new_prefixes:
7378  *             content_handler.endPrefixMapping(prefix)
7379  */
7380   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_endElementNS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __pyx_L1_error)
7381   __Pyx_GOTREF(__pyx_t_5);
7382   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
7383   __Pyx_GOTREF(__pyx_t_1);
7384   __Pyx_INCREF(__pyx_v_ns_uri);
7385   __Pyx_GIVEREF(__pyx_v_ns_uri);
7386   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ns_uri);
7387   __Pyx_INCREF(__pyx_v_local_name);
7388   __Pyx_GIVEREF(__pyx_v_local_name);
7389   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
7390   __pyx_t_10 = NULL;
7391   __pyx_t_9 = 0;
7392   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7393     __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
7394     if (likely(__pyx_t_10)) {
7395       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7396       __Pyx_INCREF(__pyx_t_10);
7397       __Pyx_INCREF(function);
7398       __Pyx_DECREF_SET(__pyx_t_5, function);
7399       __pyx_t_9 = 1;
7400     }
7401   }
7402   #if CYTHON_FAST_PYCALL
7403   if (PyFunction_Check(__pyx_t_5)) {
7404     PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7405     __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7406     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7407     __Pyx_GOTREF(__pyx_t_7);
7408     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7409   } else
7410   #endif
7411   #if CYTHON_FAST_PYCCALL
7412   if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7413     PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7414     __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7415     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7416     __Pyx_GOTREF(__pyx_t_7);
7417     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7418   } else
7419   #endif
7420   {
7421     __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error)
7422     __Pyx_GOTREF(__pyx_t_6);
7423     if (__pyx_t_10) {
7424       __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
7425     }
7426     __Pyx_GIVEREF(__pyx_t_1);
7427     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_1);
7428     __Pyx_INCREF(__pyx_v_qname);
7429     __Pyx_GIVEREF(__pyx_v_qname);
7430     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_qname);
7431     __pyx_t_1 = 0;
7432     __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 243, __pyx_L1_error)
7433     __Pyx_GOTREF(__pyx_t_7);
7434     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7435   }
7436   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7437   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7438
7439   /* "lxml/sax.py":244
7440  *             self._recursive_saxify(child, element_nsmap)
7441  *         content_handler.endElementNS((ns_uri, local_name), qname)
7442  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7443  *             content_handler.endPrefixMapping(prefix)
7444  *         tail = element.tail
7445  */
7446   __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7447   for (;;) {
7448     if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7449     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7450     __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
7451     #else
7452     __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
7453     __Pyx_GOTREF(__pyx_t_5);
7454     #endif
7455     if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7456       PyObject* sequence = __pyx_t_5;
7457       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7458       if (unlikely(size != 2)) {
7459         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7460         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7461         __PYX_ERR(0, 244, __pyx_L1_error)
7462       }
7463       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7464       if (likely(PyTuple_CheckExact(sequence))) {
7465         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
7466         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
7467       } else {
7468         __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
7469         __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
7470       }
7471       __Pyx_INCREF(__pyx_t_6);
7472       __Pyx_INCREF(__pyx_t_1);
7473       #else
7474       __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error)
7475       __Pyx_GOTREF(__pyx_t_6);
7476       __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
7477       __Pyx_GOTREF(__pyx_t_1);
7478       #endif
7479       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7480     } else {
7481       Py_ssize_t index = -1;
7482       __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 244, __pyx_L1_error)
7483       __Pyx_GOTREF(__pyx_t_10);
7484       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7485       __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext;
7486       index = 0; __pyx_t_6 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L28_unpacking_failed;
7487       __Pyx_GOTREF(__pyx_t_6);
7488       index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L28_unpacking_failed;
7489       __Pyx_GOTREF(__pyx_t_1);
7490       if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_10), 2) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
7491       __pyx_t_13 = NULL;
7492       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7493       goto __pyx_L29_unpacking_done;
7494       __pyx_L28_unpacking_failed:;
7495       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7496       __pyx_t_13 = NULL;
7497       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7498       __PYX_ERR(0, 244, __pyx_L1_error)
7499       __pyx_L29_unpacking_done:;
7500     }
7501     __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
7502     __pyx_t_6 = 0;
7503     __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
7504     __pyx_t_1 = 0;
7505
7506     /* "lxml/sax.py":245
7507  *         content_handler.endElementNS((ns_uri, local_name), qname)
7508  *         for prefix, uri in new_prefixes:
7509  *             content_handler.endPrefixMapping(prefix)             # <<<<<<<<<<<<<<
7510  *         tail = element.tail
7511  *         if tail:
7512  */
7513     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_endPrefixMapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
7514     __Pyx_GOTREF(__pyx_t_1);
7515     __pyx_t_6 = NULL;
7516     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
7517       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
7518       if (likely(__pyx_t_6)) {
7519         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
7520         __Pyx_INCREF(__pyx_t_6);
7521         __Pyx_INCREF(function);
7522         __Pyx_DECREF_SET(__pyx_t_1, function);
7523       }
7524     }
7525     __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_prefix) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_prefix);
7526     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7527     if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
7528     __Pyx_GOTREF(__pyx_t_5);
7529     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7530     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7531
7532     /* "lxml/sax.py":244
7533  *             self._recursive_saxify(child, element_nsmap)
7534  *         content_handler.endElementNS((ns_uri, local_name), qname)
7535  *         for prefix, uri in new_prefixes:             # <<<<<<<<<<<<<<
7536  *             content_handler.endPrefixMapping(prefix)
7537  *         tail = element.tail
7538  */
7539   }
7540   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7541
7542   /* "lxml/sax.py":246
7543  *         for prefix, uri in new_prefixes:
7544  *             content_handler.endPrefixMapping(prefix)
7545  *         tail = element.tail             # <<<<<<<<<<<<<<
7546  *         if tail:
7547  *             content_handler.characters(tail)
7548  */
7549   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_element, __pyx_n_s_tail); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
7550   __Pyx_GOTREF(__pyx_t_7);
7551   __pyx_v_tail = __pyx_t_7;
7552   __pyx_t_7 = 0;
7553
7554   /* "lxml/sax.py":247
7555  *             content_handler.endPrefixMapping(prefix)
7556  *         tail = element.tail
7557  *         if tail:             # <<<<<<<<<<<<<<
7558  *             content_handler.characters(tail)
7559  * 
7560  */
7561   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7562   if (__pyx_t_3) {
7563
7564     /* "lxml/sax.py":248
7565  *         tail = element.tail
7566  *         if tail:
7567  *             content_handler.characters(tail)             # <<<<<<<<<<<<<<
7568  * 
7569  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7570  */
7571     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_content_handler, __pyx_n_s_characters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
7572     __Pyx_GOTREF(__pyx_t_5);
7573     __pyx_t_1 = NULL;
7574     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7575       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7576       if (likely(__pyx_t_1)) {
7577         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7578         __Pyx_INCREF(__pyx_t_1);
7579         __Pyx_INCREF(function);
7580         __Pyx_DECREF_SET(__pyx_t_5, function);
7581       }
7582     }
7583     __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_tail) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tail);
7584     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7585     if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
7586     __Pyx_GOTREF(__pyx_t_7);
7587     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7588     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7589
7590     /* "lxml/sax.py":247
7591  *             content_handler.endPrefixMapping(prefix)
7592  *         tail = element.tail
7593  *         if tail:             # <<<<<<<<<<<<<<
7594  *             content_handler.characters(tail)
7595  * 
7596  */
7597   }
7598
7599   /* "lxml/sax.py":196
7600  *         self._content_handler.endDocument()
7601  * 
7602  *     def _recursive_saxify(self, element, parent_nsmap):             # <<<<<<<<<<<<<<
7603  *         content_handler = self._content_handler
7604  *         tag = element.tag
7605  */
7606
7607   /* function exit code */
7608   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7609   goto __pyx_L0;
7610   __pyx_L1_error:;
7611   __Pyx_XDECREF(__pyx_t_1);
7612   __Pyx_XDECREF(__pyx_t_5);
7613   __Pyx_XDECREF(__pyx_t_6);
7614   __Pyx_XDECREF(__pyx_t_7);
7615   __Pyx_XDECREF(__pyx_t_8);
7616   __Pyx_XDECREF(__pyx_t_10);
7617   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._recursive_saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
7618   __pyx_r = 0;
7619   __pyx_L0:;
7620   __Pyx_XDECREF(__pyx_v_element_nsmap);
7621   __Pyx_XDECREF(__pyx_v_content_handler);
7622   __Pyx_XDECREF(__pyx_v_tag);
7623   __Pyx_XDECREF(__pyx_v_tail);
7624   __Pyx_XDECREF(__pyx_v_new_prefixes);
7625   __Pyx_XDECREF(__pyx_v_prefix);
7626   __Pyx_XDECREF(__pyx_v_ns_uri);
7627   __Pyx_XDECREF(__pyx_v_attribs);
7628   __Pyx_XDECREF(__pyx_v_attr_values);
7629   __Pyx_XDECREF(__pyx_v_attr_qnames);
7630   __Pyx_XDECREF(__pyx_v_attr_ns_name);
7631   __Pyx_XDECREF(__pyx_v_value);
7632   __Pyx_XDECREF(__pyx_v_attr_ns_tuple);
7633   __Pyx_XDECREF(__pyx_v_sax_attributes);
7634   __Pyx_XDECREF(__pyx_v_local_name);
7635   __Pyx_XDECREF(__pyx_v_qname);
7636   __Pyx_XDECREF(__pyx_v_uri);
7637   __Pyx_XDECREF(__pyx_v_text);
7638   __Pyx_XDECREF(__pyx_v_child);
7639   __Pyx_XGIVEREF(__pyx_r);
7640   __Pyx_RefNannyFinishContext();
7641   return __pyx_r;
7642 }
7643
7644 /* "lxml/sax.py":250
7645  *             content_handler.characters(tail)
7646  * 
7647  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):             # <<<<<<<<<<<<<<
7648  *         if ns_uri is None:
7649  *             return local_name
7650  */
7651
7652 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(CYTHON_UNUSED struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v_ns_uri, PyObject *__pyx_v_local_name, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_preferred_prefix, int __pyx_v_is_attribute) {
7653   PyObject *__pyx_v_prefix = NULL;
7654   PyObject *__pyx_v_candidates = NULL;
7655   PyObject *__pyx_v_pfx = NULL;
7656   PyObject *__pyx_v_uri = NULL;
7657   PyObject *__pyx_r = NULL;
7658   __Pyx_RefNannyDeclarations
7659   int __pyx_t_1;
7660   int __pyx_t_2;
7661   PyObject *__pyx_t_3 = NULL;
7662   PyObject *__pyx_t_4 = NULL;
7663   PyObject *__pyx_t_5 = NULL;
7664   Py_ssize_t __pyx_t_6;
7665   PyObject *(*__pyx_t_7)(PyObject *);
7666   PyObject *__pyx_t_8 = NULL;
7667   PyObject *__pyx_t_9 = NULL;
7668   PyObject *__pyx_t_10 = NULL;
7669   PyObject *(*__pyx_t_11)(PyObject *);
7670   int __pyx_t_12;
7671   int __pyx_lineno = 0;
7672   const char *__pyx_filename = NULL;
7673   int __pyx_clineno = 0;
7674   __Pyx_RefNannySetupContext("_build_qname", 0);
7675
7676   /* "lxml/sax.py":251
7677  * 
7678  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7679  *         if ns_uri is None:             # <<<<<<<<<<<<<<
7680  *             return local_name
7681  * 
7682  */
7683   __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
7684   __pyx_t_2 = (__pyx_t_1 != 0);
7685   if (__pyx_t_2) {
7686
7687     /* "lxml/sax.py":252
7688  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7689  *         if ns_uri is None:
7690  *             return local_name             # <<<<<<<<<<<<<<
7691  * 
7692  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7693  */
7694     __Pyx_XDECREF(__pyx_r);
7695     __Pyx_INCREF(__pyx_v_local_name);
7696     __pyx_r = __pyx_v_local_name;
7697     goto __pyx_L0;
7698
7699     /* "lxml/sax.py":251
7700  * 
7701  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7702  *         if ns_uri is None:             # <<<<<<<<<<<<<<
7703  *             return local_name
7704  * 
7705  */
7706   }
7707
7708   /* "lxml/sax.py":254
7709  *             return local_name
7710  * 
7711  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:             # <<<<<<<<<<<<<<
7712  *             prefix = preferred_prefix
7713  *         else:
7714  */
7715   __pyx_t_1 = ((!(__pyx_v_is_attribute != 0)) != 0);
7716   if (__pyx_t_1) {
7717   } else {
7718     __pyx_t_2 = __pyx_t_1;
7719     goto __pyx_L5_bool_binop_done;
7720   }
7721   if (unlikely(__pyx_v_nsmap == Py_None)) {
7722     PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
7723     __PYX_ERR(0, 254, __pyx_L1_error)
7724   }
7725   __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_nsmap, __pyx_v_preferred_prefix, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
7726   __Pyx_GOTREF(__pyx_t_3);
7727   __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_ns_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
7728   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7729   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
7730   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7731   __pyx_t_2 = __pyx_t_1;
7732   __pyx_L5_bool_binop_done:;
7733   if (__pyx_t_2) {
7734
7735     /* "lxml/sax.py":255
7736  * 
7737  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7738  *             prefix = preferred_prefix             # <<<<<<<<<<<<<<
7739  *         else:
7740  *             # Pick the first matching prefix, in alphabetical order.
7741  */
7742     __Pyx_INCREF(__pyx_v_preferred_prefix);
7743     __pyx_v_prefix = __pyx_v_preferred_prefix;
7744
7745     /* "lxml/sax.py":254
7746  *             return local_name
7747  * 
7748  *         if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:             # <<<<<<<<<<<<<<
7749  *             prefix = preferred_prefix
7750  *         else:
7751  */
7752     goto __pyx_L4;
7753   }
7754
7755   /* "lxml/sax.py":258
7756  *         else:
7757  *             # Pick the first matching prefix, in alphabetical order.
7758  *             candidates = [             # <<<<<<<<<<<<<<
7759  *                 pfx for (pfx, uri) in nsmap.items()
7760  *                 if pfx is not None and uri == ns_uri
7761  */
7762   /*else*/ {
7763     __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
7764     __Pyx_GOTREF(__pyx_t_4);
7765
7766     /* "lxml/sax.py":259
7767  *             # Pick the first matching prefix, in alphabetical order.
7768  *             candidates = [
7769  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7770  *                 if pfx is not None and uri == ns_uri
7771  *             ]
7772  */
7773     if (unlikely(__pyx_v_nsmap == Py_None)) {
7774       PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
7775       __PYX_ERR(0, 259, __pyx_L1_error)
7776     }
7777     __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_nsmap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7778     __Pyx_GOTREF(__pyx_t_3);
7779     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
7780       __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
7781       __pyx_t_7 = NULL;
7782     } else {
7783       __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error)
7784       __Pyx_GOTREF(__pyx_t_5);
7785       __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
7786     }
7787     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7788     for (;;) {
7789       if (likely(!__pyx_t_7)) {
7790         if (likely(PyList_CheckExact(__pyx_t_5))) {
7791           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
7792           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7793           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
7794           #else
7795           __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7796           __Pyx_GOTREF(__pyx_t_3);
7797           #endif
7798         } else {
7799           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7800           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7801           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
7802           #else
7803           __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7804           __Pyx_GOTREF(__pyx_t_3);
7805           #endif
7806         }
7807       } else {
7808         __pyx_t_3 = __pyx_t_7(__pyx_t_5);
7809         if (unlikely(!__pyx_t_3)) {
7810           PyObject* exc_type = PyErr_Occurred();
7811           if (exc_type) {
7812             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7813             else __PYX_ERR(0, 259, __pyx_L1_error)
7814           }
7815           break;
7816         }
7817         __Pyx_GOTREF(__pyx_t_3);
7818       }
7819       if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
7820         PyObject* sequence = __pyx_t_3;
7821         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7822         if (unlikely(size != 2)) {
7823           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7824           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7825           __PYX_ERR(0, 259, __pyx_L1_error)
7826         }
7827         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7828         if (likely(PyTuple_CheckExact(sequence))) {
7829           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
7830           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
7831         } else {
7832           __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
7833           __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
7834         }
7835         __Pyx_INCREF(__pyx_t_8);
7836         __Pyx_INCREF(__pyx_t_9);
7837         #else
7838         __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error)
7839         __Pyx_GOTREF(__pyx_t_8);
7840         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error)
7841         __Pyx_GOTREF(__pyx_t_9);
7842         #endif
7843         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7844       } else {
7845         Py_ssize_t index = -1;
7846         __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
7847         __Pyx_GOTREF(__pyx_t_10);
7848         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7849         __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
7850         index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
7851         __Pyx_GOTREF(__pyx_t_8);
7852         index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
7853         __Pyx_GOTREF(__pyx_t_9);
7854         if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
7855         __pyx_t_11 = NULL;
7856         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7857         goto __pyx_L10_unpacking_done;
7858         __pyx_L9_unpacking_failed:;
7859         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7860         __pyx_t_11 = NULL;
7861         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7862         __PYX_ERR(0, 259, __pyx_L1_error)
7863         __pyx_L10_unpacking_done:;
7864       }
7865       __Pyx_XDECREF_SET(__pyx_v_pfx, __pyx_t_8);
7866       __pyx_t_8 = 0;
7867       __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_9);
7868       __pyx_t_9 = 0;
7869
7870       /* "lxml/sax.py":260
7871  *             candidates = [
7872  *                 pfx for (pfx, uri) in nsmap.items()
7873  *                 if pfx is not None and uri == ns_uri             # <<<<<<<<<<<<<<
7874  *             ]
7875  *             prefix = (
7876  */
7877       __pyx_t_1 = (__pyx_v_pfx != Py_None);
7878       __pyx_t_12 = (__pyx_t_1 != 0);
7879       if (__pyx_t_12) {
7880       } else {
7881         __pyx_t_2 = __pyx_t_12;
7882         goto __pyx_L12_bool_binop_done;
7883       }
7884       __pyx_t_3 = PyObject_RichCompare(__pyx_v_uri, __pyx_v_ns_uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
7885       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
7886       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7887       __pyx_t_2 = __pyx_t_12;
7888       __pyx_L12_bool_binop_done:;
7889       if (__pyx_t_2) {
7890
7891         /* "lxml/sax.py":259
7892  *             # Pick the first matching prefix, in alphabetical order.
7893  *             candidates = [
7894  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7895  *                 if pfx is not None and uri == ns_uri
7896  *             ]
7897  */
7898         if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_pfx))) __PYX_ERR(0, 258, __pyx_L1_error)
7899
7900         /* "lxml/sax.py":260
7901  *             candidates = [
7902  *                 pfx for (pfx, uri) in nsmap.items()
7903  *                 if pfx is not None and uri == ns_uri             # <<<<<<<<<<<<<<
7904  *             ]
7905  *             prefix = (
7906  */
7907       }
7908
7909       /* "lxml/sax.py":259
7910  *             # Pick the first matching prefix, in alphabetical order.
7911  *             candidates = [
7912  *                 pfx for (pfx, uri) in nsmap.items()             # <<<<<<<<<<<<<<
7913  *                 if pfx is not None and uri == ns_uri
7914  *             ]
7915  */
7916     }
7917     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7918     __pyx_v_candidates = ((PyObject*)__pyx_t_4);
7919     __pyx_t_4 = 0;
7920
7921     /* "lxml/sax.py":263
7922  *             ]
7923  *             prefix = (
7924  *                 candidates[0] if len(candidates) == 1             # <<<<<<<<<<<<<<
7925  *                 else min(candidates) if candidates
7926  *                 else None
7927  */
7928     __pyx_t_6 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 263, __pyx_L1_error)
7929     if (((__pyx_t_6 == 1) != 0)) {
7930       __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error)
7931       __Pyx_GOTREF(__pyx_t_5);
7932       __pyx_t_4 = __pyx_t_5;
7933       __pyx_t_5 = 0;
7934     } else {
7935
7936       /* "lxml/sax.py":264
7937  *             prefix = (
7938  *                 candidates[0] if len(candidates) == 1
7939  *                 else min(candidates) if candidates             # <<<<<<<<<<<<<<
7940  *                 else None
7941  *             )
7942  */
7943       __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
7944       if (__pyx_t_2) {
7945         __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_v_candidates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7946         __Pyx_GOTREF(__pyx_t_3);
7947         __pyx_t_5 = __pyx_t_3;
7948         __pyx_t_3 = 0;
7949       } else {
7950
7951         /* "lxml/sax.py":265
7952  *                 candidates[0] if len(candidates) == 1
7953  *                 else min(candidates) if candidates
7954  *                 else None             # <<<<<<<<<<<<<<
7955  *             )
7956  * 
7957  */
7958         __Pyx_INCREF(Py_None);
7959         __pyx_t_5 = Py_None;
7960       }
7961       __pyx_t_4 = __pyx_t_5;
7962       __pyx_t_5 = 0;
7963     }
7964     __pyx_v_prefix = __pyx_t_4;
7965     __pyx_t_4 = 0;
7966   }
7967   __pyx_L4:;
7968
7969   /* "lxml/sax.py":268
7970  *             )
7971  * 
7972  *         if prefix is None:             # <<<<<<<<<<<<<<
7973  *             # Default namespace
7974  *             return local_name
7975  */
7976   __pyx_t_2 = (__pyx_v_prefix == Py_None);
7977   __pyx_t_12 = (__pyx_t_2 != 0);
7978   if (__pyx_t_12) {
7979
7980     /* "lxml/sax.py":270
7981  *         if prefix is None:
7982  *             # Default namespace
7983  *             return local_name             # <<<<<<<<<<<<<<
7984  *         return prefix + ':' + local_name
7985  * 
7986  */
7987     __Pyx_XDECREF(__pyx_r);
7988     __Pyx_INCREF(__pyx_v_local_name);
7989     __pyx_r = __pyx_v_local_name;
7990     goto __pyx_L0;
7991
7992     /* "lxml/sax.py":268
7993  *             )
7994  * 
7995  *         if prefix is None:             # <<<<<<<<<<<<<<
7996  *             # Default namespace
7997  *             return local_name
7998  */
7999   }
8000
8001   /* "lxml/sax.py":271
8002  *             # Default namespace
8003  *             return local_name
8004  *         return prefix + ':' + local_name             # <<<<<<<<<<<<<<
8005  * 
8006  * 
8007  */
8008   __Pyx_XDECREF(__pyx_r);
8009   __pyx_t_4 = PyNumber_Add(__pyx_v_prefix, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
8010   __Pyx_GOTREF(__pyx_t_4);
8011   __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_v_local_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8012   __Pyx_GOTREF(__pyx_t_5);
8013   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8014   __pyx_r = __pyx_t_5;
8015   __pyx_t_5 = 0;
8016   goto __pyx_L0;
8017
8018   /* "lxml/sax.py":250
8019  *             content_handler.characters(tail)
8020  * 
8021  *     def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):             # <<<<<<<<<<<<<<
8022  *         if ns_uri is None:
8023  *             return local_name
8024  */
8025
8026   /* function exit code */
8027   __pyx_L1_error:;
8028   __Pyx_XDECREF(__pyx_t_3);
8029   __Pyx_XDECREF(__pyx_t_4);
8030   __Pyx_XDECREF(__pyx_t_5);
8031   __Pyx_XDECREF(__pyx_t_8);
8032   __Pyx_XDECREF(__pyx_t_9);
8033   __Pyx_XDECREF(__pyx_t_10);
8034   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._build_qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
8035   __pyx_r = 0;
8036   __pyx_L0:;
8037   __Pyx_XDECREF(__pyx_v_prefix);
8038   __Pyx_XDECREF(__pyx_v_candidates);
8039   __Pyx_XDECREF(__pyx_v_pfx);
8040   __Pyx_XDECREF(__pyx_v_uri);
8041   __Pyx_XGIVEREF(__pyx_r);
8042   __Pyx_RefNannyFinishContext();
8043   return __pyx_r;
8044 }
8045
8046 /* "(tree fragment)":1
8047  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8048  *     cdef tuple state
8049  *     cdef object _dict
8050  */
8051
8052 /* Python wrapper */
8053 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8054 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0};
8055 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8056   PyObject *__pyx_r = 0;
8057   __Pyx_RefNannyDeclarations
8058   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8059   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
8060
8061   /* function exit code */
8062   __Pyx_RefNannyFinishContext();
8063   return __pyx_r;
8064 }
8065
8066 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
8067   PyObject *__pyx_v_state = 0;
8068   PyObject *__pyx_v__dict = 0;
8069   int __pyx_v_use_setstate;
8070   PyObject *__pyx_r = NULL;
8071   __Pyx_RefNannyDeclarations
8072   PyObject *__pyx_t_1 = NULL;
8073   int __pyx_t_2;
8074   int __pyx_t_3;
8075   PyObject *__pyx_t_4 = NULL;
8076   int __pyx_t_5;
8077   PyObject *__pyx_t_6 = NULL;
8078   int __pyx_lineno = 0;
8079   const char *__pyx_filename = NULL;
8080   int __pyx_clineno = 0;
8081   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8082
8083   /* "(tree fragment)":5
8084  *     cdef object _dict
8085  *     cdef bint use_setstate
8086  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)             # <<<<<<<<<<<<<<
8087  *     _dict = getattr(self, '__dict__', None)
8088  *     if _dict is not None:
8089  */
8090   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
8091   __Pyx_GOTREF(__pyx_t_1);
8092   __Pyx_INCREF(__pyx_v_self->_attr_class);
8093   __Pyx_GIVEREF(__pyx_v_self->_attr_class);
8094   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_attr_class);
8095   __Pyx_INCREF(__pyx_v_self->_content_handler);
8096   __Pyx_GIVEREF(__pyx_v_self->_content_handler);
8097   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_content_handler);
8098   __Pyx_INCREF(__pyx_v_self->_element);
8099   __Pyx_GIVEREF(__pyx_v_self->_element);
8100   PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->_element);
8101   __Pyx_INCREF(__pyx_v_self->_empty_attributes);
8102   __Pyx_GIVEREF(__pyx_v_self->_empty_attributes);
8103   PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->_empty_attributes);
8104   __pyx_v_state = ((PyObject*)__pyx_t_1);
8105   __pyx_t_1 = 0;
8106
8107   /* "(tree fragment)":6
8108  *     cdef bint use_setstate
8109  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8110  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
8111  *     if _dict is not None:
8112  *         state += (_dict,)
8113  */
8114   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
8115   __Pyx_GOTREF(__pyx_t_1);
8116   __pyx_v__dict = __pyx_t_1;
8117   __pyx_t_1 = 0;
8118
8119   /* "(tree fragment)":7
8120  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8121  *     _dict = getattr(self, '__dict__', None)
8122  *     if _dict is not None:             # <<<<<<<<<<<<<<
8123  *         state += (_dict,)
8124  *         use_setstate = True
8125  */
8126   __pyx_t_2 = (__pyx_v__dict != Py_None);
8127   __pyx_t_3 = (__pyx_t_2 != 0);
8128   if (__pyx_t_3) {
8129
8130     /* "(tree fragment)":8
8131  *     _dict = getattr(self, '__dict__', None)
8132  *     if _dict is not None:
8133  *         state += (_dict,)             # <<<<<<<<<<<<<<
8134  *         use_setstate = True
8135  *     else:
8136  */
8137     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
8138     __Pyx_GOTREF(__pyx_t_1);
8139     __Pyx_INCREF(__pyx_v__dict);
8140     __Pyx_GIVEREF(__pyx_v__dict);
8141     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8142     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
8143     __Pyx_GOTREF(__pyx_t_4);
8144     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8145     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8146     __pyx_t_4 = 0;
8147
8148     /* "(tree fragment)":9
8149  *     if _dict is not None:
8150  *         state += (_dict,)
8151  *         use_setstate = True             # <<<<<<<<<<<<<<
8152  *     else:
8153  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8154  */
8155     __pyx_v_use_setstate = 1;
8156
8157     /* "(tree fragment)":7
8158  *     state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8159  *     _dict = getattr(self, '__dict__', None)
8160  *     if _dict is not None:             # <<<<<<<<<<<<<<
8161  *         state += (_dict,)
8162  *         use_setstate = True
8163  */
8164     goto __pyx_L3;
8165   }
8166
8167   /* "(tree fragment)":11
8168  *         use_setstate = True
8169  *     else:
8170  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None             # <<<<<<<<<<<<<<
8171  *     if use_setstate:
8172  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8173  */
8174   /*else*/ {
8175     __pyx_t_2 = (__pyx_v_self->_attr_class != Py_None);
8176     __pyx_t_5 = (__pyx_t_2 != 0);
8177     if (!__pyx_t_5) {
8178     } else {
8179       __pyx_t_3 = __pyx_t_5;
8180       goto __pyx_L4_bool_binop_done;
8181     }
8182     __pyx_t_5 = (__pyx_v_self->_content_handler != Py_None);
8183     __pyx_t_2 = (__pyx_t_5 != 0);
8184     if (!__pyx_t_2) {
8185     } else {
8186       __pyx_t_3 = __pyx_t_2;
8187       goto __pyx_L4_bool_binop_done;
8188     }
8189     __pyx_t_2 = (__pyx_v_self->_element != Py_None);
8190     __pyx_t_5 = (__pyx_t_2 != 0);
8191     if (!__pyx_t_5) {
8192     } else {
8193       __pyx_t_3 = __pyx_t_5;
8194       goto __pyx_L4_bool_binop_done;
8195     }
8196     __pyx_t_5 = (__pyx_v_self->_empty_attributes != Py_None);
8197     __pyx_t_2 = (__pyx_t_5 != 0);
8198     __pyx_t_3 = __pyx_t_2;
8199     __pyx_L4_bool_binop_done:;
8200     __pyx_v_use_setstate = __pyx_t_3;
8201   }
8202   __pyx_L3:;
8203
8204   /* "(tree fragment)":12
8205  *     else:
8206  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8207  *     if use_setstate:             # <<<<<<<<<<<<<<
8208  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8209  *     else:
8210  */
8211   __pyx_t_3 = (__pyx_v_use_setstate != 0);
8212   if (__pyx_t_3) {
8213
8214     /* "(tree fragment)":13
8215  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8216  *     if use_setstate:
8217  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state             # <<<<<<<<<<<<<<
8218  *     else:
8219  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8220  */
8221     __Pyx_XDECREF(__pyx_r);
8222     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
8223     __Pyx_GOTREF(__pyx_t_4);
8224     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
8225     __Pyx_GOTREF(__pyx_t_1);
8226     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8227     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8228     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8229     __Pyx_INCREF(__pyx_int_30712058);
8230     __Pyx_GIVEREF(__pyx_int_30712058);
8231     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8232     __Pyx_INCREF(Py_None);
8233     __Pyx_GIVEREF(Py_None);
8234     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8235     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
8236     __Pyx_GOTREF(__pyx_t_6);
8237     __Pyx_GIVEREF(__pyx_t_4);
8238     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
8239     __Pyx_GIVEREF(__pyx_t_1);
8240     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
8241     __Pyx_INCREF(__pyx_v_state);
8242     __Pyx_GIVEREF(__pyx_v_state);
8243     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
8244     __pyx_t_4 = 0;
8245     __pyx_t_1 = 0;
8246     __pyx_r = __pyx_t_6;
8247     __pyx_t_6 = 0;
8248     goto __pyx_L0;
8249
8250     /* "(tree fragment)":12
8251  *     else:
8252  *         use_setstate = self._attr_class is not None or self._content_handler is not None or self._element is not None or self._empty_attributes is not None
8253  *     if use_setstate:             # <<<<<<<<<<<<<<
8254  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8255  *     else:
8256  */
8257   }
8258
8259   /* "(tree fragment)":15
8260  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8261  *     else:
8262  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)             # <<<<<<<<<<<<<<
8263  * def __setstate_cython__(self, __pyx_state):
8264  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8265  */
8266   /*else*/ {
8267     __Pyx_XDECREF(__pyx_r);
8268     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
8269     __Pyx_GOTREF(__pyx_t_6);
8270     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
8271     __Pyx_GOTREF(__pyx_t_1);
8272     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8273     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8274     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8275     __Pyx_INCREF(__pyx_int_30712058);
8276     __Pyx_GIVEREF(__pyx_int_30712058);
8277     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8278     __Pyx_INCREF(__pyx_v_state);
8279     __Pyx_GIVEREF(__pyx_v_state);
8280     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8281     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
8282     __Pyx_GOTREF(__pyx_t_4);
8283     __Pyx_GIVEREF(__pyx_t_6);
8284     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
8285     __Pyx_GIVEREF(__pyx_t_1);
8286     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8287     __pyx_t_6 = 0;
8288     __pyx_t_1 = 0;
8289     __pyx_r = __pyx_t_4;
8290     __pyx_t_4 = 0;
8291     goto __pyx_L0;
8292   }
8293
8294   /* "(tree fragment)":1
8295  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8296  *     cdef tuple state
8297  *     cdef object _dict
8298  */
8299
8300   /* function exit code */
8301   __pyx_L1_error:;
8302   __Pyx_XDECREF(__pyx_t_1);
8303   __Pyx_XDECREF(__pyx_t_4);
8304   __Pyx_XDECREF(__pyx_t_6);
8305   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8306   __pyx_r = NULL;
8307   __pyx_L0:;
8308   __Pyx_XDECREF(__pyx_v_state);
8309   __Pyx_XDECREF(__pyx_v__dict);
8310   __Pyx_XGIVEREF(__pyx_r);
8311   __Pyx_RefNannyFinishContext();
8312   return __pyx_r;
8313 }
8314
8315 /* "(tree fragment)":16
8316  *     else:
8317  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8318  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8319  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8320  */
8321
8322 /* Python wrapper */
8323 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
8324 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0};
8325 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8326   PyObject *__pyx_r = 0;
8327   __Pyx_RefNannyDeclarations
8328   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8329   __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8330
8331   /* function exit code */
8332   __Pyx_RefNannyFinishContext();
8333   return __pyx_r;
8334 }
8335
8336 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8337   PyObject *__pyx_r = NULL;
8338   __Pyx_RefNannyDeclarations
8339   PyObject *__pyx_t_1 = NULL;
8340   int __pyx_lineno = 0;
8341   const char *__pyx_filename = NULL;
8342   int __pyx_clineno = 0;
8343   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8344
8345   /* "(tree fragment)":17
8346  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8347  * def __setstate_cython__(self, __pyx_state):
8348  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
8349  */
8350   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
8351   __pyx_t_1 = __pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
8352   __Pyx_GOTREF(__pyx_t_1);
8353   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8354
8355   /* "(tree fragment)":16
8356  *     else:
8357  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8358  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8359  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8360  */
8361
8362   /* function exit code */
8363   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8364   goto __pyx_L0;
8365   __pyx_L1_error:;
8366   __Pyx_XDECREF(__pyx_t_1);
8367   __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8368   __pyx_r = NULL;
8369   __pyx_L0:;
8370   __Pyx_XGIVEREF(__pyx_r);
8371   __Pyx_RefNannyFinishContext();
8372   return __pyx_r;
8373 }
8374
8375 /* "lxml/sax.py":274
8376  * 
8377  * 
8378  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
8379  *     """One-shot helper to generate SAX events from an XML tree and fire
8380  *     them against a SAX ContentHandler.
8381  */
8382
8383 /* Python wrapper */
8384 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8385 static char __pyx_doc_4lxml_3sax_saxify[] = "One-shot helper to generate SAX events from an XML tree and fire\n    them against a SAX ContentHandler.\n    ";
8386 static PyMethodDef __pyx_mdef_4lxml_3sax_1saxify = {"saxify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_1saxify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_3sax_saxify};
8387 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8388   PyObject *__pyx_v_element_or_tree = 0;
8389   PyObject *__pyx_v_content_handler = 0;
8390   int __pyx_lineno = 0;
8391   const char *__pyx_filename = NULL;
8392   int __pyx_clineno = 0;
8393   PyObject *__pyx_r = 0;
8394   __Pyx_RefNannyDeclarations
8395   __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
8396   {
8397     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
8398     PyObject* values[2] = {0,0};
8399     if (unlikely(__pyx_kwds)) {
8400       Py_ssize_t kw_args;
8401       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8402       switch (pos_args) {
8403         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8404         CYTHON_FALLTHROUGH;
8405         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8406         CYTHON_FALLTHROUGH;
8407         case  0: break;
8408         default: goto __pyx_L5_argtuple_error;
8409       }
8410       kw_args = PyDict_Size(__pyx_kwds);
8411       switch (pos_args) {
8412         case  0:
8413         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
8414         else goto __pyx_L5_argtuple_error;
8415         CYTHON_FALLTHROUGH;
8416         case  1:
8417         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
8418         else {
8419           __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, 1); __PYX_ERR(0, 274, __pyx_L3_error)
8420         }
8421       }
8422       if (unlikely(kw_args > 0)) {
8423         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "saxify") < 0)) __PYX_ERR(0, 274, __pyx_L3_error)
8424       }
8425     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8426       goto __pyx_L5_argtuple_error;
8427     } else {
8428       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8429       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8430     }
8431     __pyx_v_element_or_tree = values[0];
8432     __pyx_v_content_handler = values[1];
8433   }
8434   goto __pyx_L4_argument_unpacking_done;
8435   __pyx_L5_argtuple_error:;
8436   __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 274, __pyx_L3_error)
8437   __pyx_L3_error:;
8438   __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8439   __Pyx_RefNannyFinishContext();
8440   return NULL;
8441   __pyx_L4_argument_unpacking_done:;
8442   __pyx_r = __pyx_pf_4lxml_3sax_saxify(__pyx_self, __pyx_v_element_or_tree, __pyx_v_content_handler);
8443
8444   /* function exit code */
8445   __Pyx_RefNannyFinishContext();
8446   return __pyx_r;
8447 }
8448
8449 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler) {
8450   PyObject *__pyx_r = NULL;
8451   __Pyx_RefNannyDeclarations
8452   PyObject *__pyx_t_1 = NULL;
8453   PyObject *__pyx_t_2 = NULL;
8454   PyObject *__pyx_t_3 = NULL;
8455   int __pyx_lineno = 0;
8456   const char *__pyx_filename = NULL;
8457   int __pyx_clineno = 0;
8458   __Pyx_RefNannySetupContext("saxify", 0);
8459
8460   /* "lxml/sax.py":278
8461  *     them against a SAX ContentHandler.
8462  *     """
8463  *     return ElementTreeProducer(element_or_tree, content_handler).saxify()             # <<<<<<<<<<<<<<
8464  */
8465   __Pyx_XDECREF(__pyx_r);
8466   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
8467   __Pyx_GOTREF(__pyx_t_2);
8468   __Pyx_INCREF(__pyx_v_element_or_tree);
8469   __Pyx_GIVEREF(__pyx_v_element_or_tree);
8470   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree);
8471   __Pyx_INCREF(__pyx_v_content_handler);
8472   __Pyx_GIVEREF(__pyx_v_content_handler);
8473   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_content_handler);
8474   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error)
8475   __Pyx_GOTREF(__pyx_t_3);
8476   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8477   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_saxify); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
8478   __Pyx_GOTREF(__pyx_t_2);
8479   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8480   __pyx_t_3 = NULL;
8481   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8482     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8483     if (likely(__pyx_t_3)) {
8484       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8485       __Pyx_INCREF(__pyx_t_3);
8486       __Pyx_INCREF(function);
8487       __Pyx_DECREF_SET(__pyx_t_2, function);
8488     }
8489   }
8490   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8491   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8492   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
8493   __Pyx_GOTREF(__pyx_t_1);
8494   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8495   __pyx_r = __pyx_t_1;
8496   __pyx_t_1 = 0;
8497   goto __pyx_L0;
8498
8499   /* "lxml/sax.py":274
8500  * 
8501  * 
8502  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
8503  *     """One-shot helper to generate SAX events from an XML tree and fire
8504  *     them against a SAX ContentHandler.
8505  */
8506
8507   /* function exit code */
8508   __pyx_L1_error:;
8509   __Pyx_XDECREF(__pyx_t_1);
8510   __Pyx_XDECREF(__pyx_t_2);
8511   __Pyx_XDECREF(__pyx_t_3);
8512   __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8513   __pyx_r = NULL;
8514   __pyx_L0:;
8515   __Pyx_XGIVEREF(__pyx_r);
8516   __Pyx_RefNannyFinishContext();
8517   return __pyx_r;
8518 }
8519
8520 /* "(tree fragment)":1
8521  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
8522  *     cdef object __pyx_PickleError
8523  *     cdef object __pyx_result
8524  */
8525
8526 /* Python wrapper */
8527 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8528 static PyMethodDef __pyx_mdef_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer = {"__pyx_unpickle_ElementTreeProducer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer, METH_VARARGS|METH_KEYWORDS, 0};
8529 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8530   PyObject *__pyx_v___pyx_type = 0;
8531   long __pyx_v___pyx_checksum;
8532   PyObject *__pyx_v___pyx_state = 0;
8533   int __pyx_lineno = 0;
8534   const char *__pyx_filename = NULL;
8535   int __pyx_clineno = 0;
8536   PyObject *__pyx_r = 0;
8537   __Pyx_RefNannyDeclarations
8538   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer (wrapper)", 0);
8539   {
8540     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
8541     PyObject* values[3] = {0,0,0};
8542     if (unlikely(__pyx_kwds)) {
8543       Py_ssize_t kw_args;
8544       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8545       switch (pos_args) {
8546         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8547         CYTHON_FALLTHROUGH;
8548         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8549         CYTHON_FALLTHROUGH;
8550         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8551         CYTHON_FALLTHROUGH;
8552         case  0: break;
8553         default: goto __pyx_L5_argtuple_error;
8554       }
8555       kw_args = PyDict_Size(__pyx_kwds);
8556       switch (pos_args) {
8557         case  0:
8558         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
8559         else goto __pyx_L5_argtuple_error;
8560         CYTHON_FALLTHROUGH;
8561         case  1:
8562         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
8563         else {
8564           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
8565         }
8566         CYTHON_FALLTHROUGH;
8567         case  2:
8568         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8569         else {
8570           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
8571         }
8572       }
8573       if (unlikely(kw_args > 0)) {
8574         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ElementTreeProducer") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
8575       }
8576     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8577       goto __pyx_L5_argtuple_error;
8578     } else {
8579       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8580       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8581       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8582     }
8583     __pyx_v___pyx_type = values[0];
8584     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
8585     __pyx_v___pyx_state = values[2];
8586   }
8587   goto __pyx_L4_argument_unpacking_done;
8588   __pyx_L5_argtuple_error:;
8589   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
8590   __pyx_L3_error:;
8591   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8592   __Pyx_RefNannyFinishContext();
8593   return NULL;
8594   __pyx_L4_argument_unpacking_done:;
8595   __pyx_r = __pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
8596
8597   /* function exit code */
8598   __Pyx_RefNannyFinishContext();
8599   return __pyx_r;
8600 }
8601
8602 static PyObject *__pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
8603   PyObject *__pyx_v___pyx_PickleError = 0;
8604   PyObject *__pyx_v___pyx_result = 0;
8605   PyObject *__pyx_r = NULL;
8606   __Pyx_RefNannyDeclarations
8607   int __pyx_t_1;
8608   PyObject *__pyx_t_2 = NULL;
8609   PyObject *__pyx_t_3 = NULL;
8610   PyObject *__pyx_t_4 = NULL;
8611   PyObject *__pyx_t_5 = NULL;
8612   int __pyx_t_6;
8613   int __pyx_lineno = 0;
8614   const char *__pyx_filename = NULL;
8615   int __pyx_clineno = 0;
8616   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer", 0);
8617
8618   /* "(tree fragment)":4
8619  *     cdef object __pyx_PickleError
8620  *     cdef object __pyx_result
8621  *     if __pyx_checksum != 0x1d4a0fa:             # <<<<<<<<<<<<<<
8622  *         from pickle import PickleError as __pyx_PickleError
8623  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8624  */
8625   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x1d4a0fa) != 0);
8626   if (__pyx_t_1) {
8627
8628     /* "(tree fragment)":5
8629  *     cdef object __pyx_result
8630  *     if __pyx_checksum != 0x1d4a0fa:
8631  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
8632  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8633  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8634  */
8635     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8636     __Pyx_GOTREF(__pyx_t_2);
8637     __Pyx_INCREF(__pyx_n_s_PickleError);
8638     __Pyx_GIVEREF(__pyx_n_s_PickleError);
8639     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
8640     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
8641     __Pyx_GOTREF(__pyx_t_3);
8642     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8643     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8644     __Pyx_GOTREF(__pyx_t_2);
8645     __Pyx_INCREF(__pyx_t_2);
8646     __pyx_v___pyx_PickleError = __pyx_t_2;
8647     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8648     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8649
8650     /* "(tree fragment)":6
8651  *     if __pyx_checksum != 0x1d4a0fa:
8652  *         from pickle import PickleError as __pyx_PickleError
8653  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)             # <<<<<<<<<<<<<<
8654  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8655  *     if __pyx_state is not None:
8656  */
8657     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
8658     __Pyx_GOTREF(__pyx_t_2);
8659     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x1d, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
8660     __Pyx_GOTREF(__pyx_t_4);
8661     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8662     __Pyx_INCREF(__pyx_v___pyx_PickleError);
8663     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
8664     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
8665       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
8666       if (likely(__pyx_t_5)) {
8667         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8668         __Pyx_INCREF(__pyx_t_5);
8669         __Pyx_INCREF(function);
8670         __Pyx_DECREF_SET(__pyx_t_2, function);
8671       }
8672     }
8673     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
8674     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8675     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8676     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
8677     __Pyx_GOTREF(__pyx_t_3);
8678     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8679     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8680     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8681     __PYX_ERR(1, 6, __pyx_L1_error)
8682
8683     /* "(tree fragment)":4
8684  *     cdef object __pyx_PickleError
8685  *     cdef object __pyx_result
8686  *     if __pyx_checksum != 0x1d4a0fa:             # <<<<<<<<<<<<<<
8687  *         from pickle import PickleError as __pyx_PickleError
8688  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8689  */
8690   }
8691
8692   /* "(tree fragment)":7
8693  *         from pickle import PickleError as __pyx_PickleError
8694  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8695  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)             # <<<<<<<<<<<<<<
8696  *     if __pyx_state is not None:
8697  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8698  */
8699   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
8700   __Pyx_GOTREF(__pyx_t_2);
8701   __pyx_t_4 = NULL;
8702   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8703     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
8704     if (likely(__pyx_t_4)) {
8705       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8706       __Pyx_INCREF(__pyx_t_4);
8707       __Pyx_INCREF(function);
8708       __Pyx_DECREF_SET(__pyx_t_2, function);
8709     }
8710   }
8711   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
8712   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8713   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
8714   __Pyx_GOTREF(__pyx_t_3);
8715   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8716   __pyx_v___pyx_result = __pyx_t_3;
8717   __pyx_t_3 = 0;
8718
8719   /* "(tree fragment)":8
8720  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8721  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8722  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
8723  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8724  *     return __pyx_result
8725  */
8726   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
8727   __pyx_t_6 = (__pyx_t_1 != 0);
8728   if (__pyx_t_6) {
8729
8730     /* "(tree fragment)":9
8731  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8732  *     if __pyx_state is not None:
8733  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
8734  *     return __pyx_result
8735  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8736  */
8737     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
8738     __pyx_t_3 = __pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
8739     __Pyx_GOTREF(__pyx_t_3);
8740     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8741
8742     /* "(tree fragment)":8
8743  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8744  *     __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8745  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
8746  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8747  *     return __pyx_result
8748  */
8749   }
8750
8751   /* "(tree fragment)":10
8752  *     if __pyx_state is not None:
8753  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8754  *     return __pyx_result             # <<<<<<<<<<<<<<
8755  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8756  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8757  */
8758   __Pyx_XDECREF(__pyx_r);
8759   __Pyx_INCREF(__pyx_v___pyx_result);
8760   __pyx_r = __pyx_v___pyx_result;
8761   goto __pyx_L0;
8762
8763   /* "(tree fragment)":1
8764  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
8765  *     cdef object __pyx_PickleError
8766  *     cdef object __pyx_result
8767  */
8768
8769   /* function exit code */
8770   __pyx_L1_error:;
8771   __Pyx_XDECREF(__pyx_t_2);
8772   __Pyx_XDECREF(__pyx_t_3);
8773   __Pyx_XDECREF(__pyx_t_4);
8774   __Pyx_XDECREF(__pyx_t_5);
8775   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8776   __pyx_r = NULL;
8777   __pyx_L0:;
8778   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
8779   __Pyx_XDECREF(__pyx_v___pyx_result);
8780   __Pyx_XGIVEREF(__pyx_r);
8781   __Pyx_RefNannyFinishContext();
8782   return __pyx_r;
8783 }
8784
8785 /* "(tree fragment)":11
8786  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8787  *     return __pyx_result
8788  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
8789  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8790  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8791  */
8792
8793 static PyObject *__pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
8794   PyObject *__pyx_r = NULL;
8795   __Pyx_RefNannyDeclarations
8796   PyObject *__pyx_t_1 = NULL;
8797   int __pyx_t_2;
8798   Py_ssize_t __pyx_t_3;
8799   int __pyx_t_4;
8800   int __pyx_t_5;
8801   PyObject *__pyx_t_6 = NULL;
8802   PyObject *__pyx_t_7 = NULL;
8803   PyObject *__pyx_t_8 = NULL;
8804   int __pyx_lineno = 0;
8805   const char *__pyx_filename = NULL;
8806   int __pyx_clineno = 0;
8807   __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer__set_state", 0);
8808
8809   /* "(tree fragment)":12
8810  *     return __pyx_result
8811  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8812  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]             # <<<<<<<<<<<<<<
8813  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8814  *         __pyx_result.__dict__.update(__pyx_state[4])
8815  */
8816   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8817     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8818     __PYX_ERR(1, 12, __pyx_L1_error)
8819   }
8820   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8821   __Pyx_GOTREF(__pyx_t_1);
8822   __Pyx_GIVEREF(__pyx_t_1);
8823   __Pyx_GOTREF(__pyx_v___pyx_result->_attr_class);
8824   __Pyx_DECREF(__pyx_v___pyx_result->_attr_class);
8825   __pyx_v___pyx_result->_attr_class = __pyx_t_1;
8826   __pyx_t_1 = 0;
8827   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8828     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8829     __PYX_ERR(1, 12, __pyx_L1_error)
8830   }
8831   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8832   __Pyx_GOTREF(__pyx_t_1);
8833   __Pyx_GIVEREF(__pyx_t_1);
8834   __Pyx_GOTREF(__pyx_v___pyx_result->_content_handler);
8835   __Pyx_DECREF(__pyx_v___pyx_result->_content_handler);
8836   __pyx_v___pyx_result->_content_handler = __pyx_t_1;
8837   __pyx_t_1 = 0;
8838   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8839     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8840     __PYX_ERR(1, 12, __pyx_L1_error)
8841   }
8842   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8843   __Pyx_GOTREF(__pyx_t_1);
8844   __Pyx_GIVEREF(__pyx_t_1);
8845   __Pyx_GOTREF(__pyx_v___pyx_result->_element);
8846   __Pyx_DECREF(__pyx_v___pyx_result->_element);
8847   __pyx_v___pyx_result->_element = __pyx_t_1;
8848   __pyx_t_1 = 0;
8849   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8850     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8851     __PYX_ERR(1, 12, __pyx_L1_error)
8852   }
8853   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
8854   __Pyx_GOTREF(__pyx_t_1);
8855   __Pyx_GIVEREF(__pyx_t_1);
8856   __Pyx_GOTREF(__pyx_v___pyx_result->_empty_attributes);
8857   __Pyx_DECREF(__pyx_v___pyx_result->_empty_attributes);
8858   __pyx_v___pyx_result->_empty_attributes = __pyx_t_1;
8859   __pyx_t_1 = 0;
8860
8861   /* "(tree fragment)":13
8862  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8863  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8864  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
8865  *         __pyx_result.__dict__.update(__pyx_state[4])
8866  */
8867   if (unlikely(__pyx_v___pyx_state == Py_None)) {
8868     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8869     __PYX_ERR(1, 13, __pyx_L1_error)
8870   }
8871   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
8872   __pyx_t_4 = ((__pyx_t_3 > 4) != 0);
8873   if (__pyx_t_4) {
8874   } else {
8875     __pyx_t_2 = __pyx_t_4;
8876     goto __pyx_L4_bool_binop_done;
8877   }
8878   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
8879   __pyx_t_5 = (__pyx_t_4 != 0);
8880   __pyx_t_2 = __pyx_t_5;
8881   __pyx_L4_bool_binop_done:;
8882   if (__pyx_t_2) {
8883
8884     /* "(tree fragment)":14
8885  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8886  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8887  *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
8888  */
8889     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
8890     __Pyx_GOTREF(__pyx_t_6);
8891     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
8892     __Pyx_GOTREF(__pyx_t_7);
8893     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8894     if (unlikely(__pyx_v___pyx_state == Py_None)) {
8895       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8896       __PYX_ERR(1, 14, __pyx_L1_error)
8897     }
8898     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
8899     __Pyx_GOTREF(__pyx_t_6);
8900     __pyx_t_8 = NULL;
8901     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
8902       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
8903       if (likely(__pyx_t_8)) {
8904         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8905         __Pyx_INCREF(__pyx_t_8);
8906         __Pyx_INCREF(function);
8907         __Pyx_DECREF_SET(__pyx_t_7, function);
8908       }
8909     }
8910     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
8911     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8912     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8913     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
8914     __Pyx_GOTREF(__pyx_t_1);
8915     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8916     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8917
8918     /* "(tree fragment)":13
8919  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8920  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8921  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
8922  *         __pyx_result.__dict__.update(__pyx_state[4])
8923  */
8924   }
8925
8926   /* "(tree fragment)":11
8927  *         __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8928  *     return __pyx_result
8929  * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
8930  *     __pyx_result._attr_class = __pyx_state[0]; __pyx_result._content_handler = __pyx_state[1]; __pyx_result._element = __pyx_state[2]; __pyx_result._empty_attributes = __pyx_state[3]
8931  *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8932  */
8933
8934   /* function exit code */
8935   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8936   goto __pyx_L0;
8937   __pyx_L1_error:;
8938   __Pyx_XDECREF(__pyx_t_1);
8939   __Pyx_XDECREF(__pyx_t_6);
8940   __Pyx_XDECREF(__pyx_t_7);
8941   __Pyx_XDECREF(__pyx_t_8);
8942   __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
8943   __pyx_r = 0;
8944   __pyx_L0:;
8945   __Pyx_XGIVEREF(__pyx_r);
8946   __Pyx_RefNannyFinishContext();
8947   return __pyx_r;
8948 }
8949 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer __pyx_vtable_4lxml_3sax_ElementTreeProducer;
8950
8951 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8952   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p;
8953   PyObject *o;
8954   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
8955     o = (*t->tp_alloc)(t, 0);
8956   } else {
8957     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
8958   }
8959   if (unlikely(!o)) return 0;
8960   p = ((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o);
8961   p->__pyx_vtab = __pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
8962   p->_element = Py_None; Py_INCREF(Py_None);
8963   p->_content_handler = Py_None; Py_INCREF(Py_None);
8964   p->_attr_class = Py_None; Py_INCREF(Py_None);
8965   p->_empty_attributes = Py_None; Py_INCREF(Py_None);
8966   return o;
8967 }
8968
8969 static void __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer(PyObject *o) {
8970   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8971   #if CYTHON_USE_TP_FINALIZE
8972   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
8973     if (PyObject_CallFinalizerFromDealloc(o)) return;
8974   }
8975   #endif
8976   PyObject_GC_UnTrack(o);
8977   Py_CLEAR(p->_element);
8978   Py_CLEAR(p->_content_handler);
8979   Py_CLEAR(p->_attr_class);
8980   Py_CLEAR(p->_empty_attributes);
8981   (*Py_TYPE(o)->tp_free)(o);
8982 }
8983
8984 static int __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer(PyObject *o, visitproc v, void *a) {
8985   int e;
8986   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8987   if (p->_element) {
8988     e = (*v)(p->_element, a); if (e) return e;
8989   }
8990   if (p->_content_handler) {
8991     e = (*v)(p->_content_handler, a); if (e) return e;
8992   }
8993   if (p->_attr_class) {
8994     e = (*v)(p->_attr_class, a); if (e) return e;
8995   }
8996   if (p->_empty_attributes) {
8997     e = (*v)(p->_empty_attributes, a); if (e) return e;
8998   }
8999   return 0;
9000 }
9001
9002 static int __pyx_tp_clear_4lxml_3sax_ElementTreeProducer(PyObject *o) {
9003   struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
9004   Py_CLEAR(p->_element);
9005   Py_CLEAR(p->_content_handler);
9006   Py_CLEAR(p->_attr_class);
9007   Py_CLEAR(p->_empty_attributes);
9008   return 0;
9009 }
9010
9011 static PyMethodDef __pyx_methods_4lxml_3sax_ElementTreeProducer[] = {
9012   {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0},
9013   {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0},
9014   {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0},
9015   {0, 0, 0, 0}
9016 };
9017
9018 static PyTypeObject __pyx_type_4lxml_3sax_ElementTreeProducer = {
9019   PyVarObject_HEAD_INIT(0, 0)
9020   "lxml.sax.ElementTreeProducer", /*tp_name*/
9021   sizeof(struct __pyx_obj_4lxml_3sax_ElementTreeProducer), /*tp_basicsize*/
9022   0, /*tp_itemsize*/
9023   __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer, /*tp_dealloc*/
9024   #if PY_VERSION_HEX < 0x030800b4
9025   0, /*tp_print*/
9026   #endif
9027   #if PY_VERSION_HEX >= 0x030800b4
9028   0, /*tp_vectorcall_offset*/
9029   #endif
9030   0, /*tp_getattr*/
9031   0, /*tp_setattr*/
9032   #if PY_MAJOR_VERSION < 3
9033   0, /*tp_compare*/
9034   #endif
9035   #if PY_MAJOR_VERSION >= 3
9036   0, /*tp_as_async*/
9037   #endif
9038   0, /*tp_repr*/
9039   0, /*tp_as_number*/
9040   0, /*tp_as_sequence*/
9041   0, /*tp_as_mapping*/
9042   0, /*tp_hash*/
9043   0, /*tp_call*/
9044   0, /*tp_str*/
9045   0, /*tp_getattro*/
9046   0, /*tp_setattro*/
9047   0, /*tp_as_buffer*/
9048   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9049   "Produces SAX events for an element and children.\n    ", /*tp_doc*/
9050   __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer, /*tp_traverse*/
9051   __pyx_tp_clear_4lxml_3sax_ElementTreeProducer, /*tp_clear*/
9052   0, /*tp_richcompare*/
9053   0, /*tp_weaklistoffset*/
9054   0, /*tp_iter*/
9055   0, /*tp_iternext*/
9056   __pyx_methods_4lxml_3sax_ElementTreeProducer, /*tp_methods*/
9057   0, /*tp_members*/
9058   0, /*tp_getset*/
9059   0, /*tp_base*/
9060   0, /*tp_dict*/
9061   0, /*tp_descr_get*/
9062   0, /*tp_descr_set*/
9063   0, /*tp_dictoffset*/
9064   __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__, /*tp_init*/
9065   0, /*tp_alloc*/
9066   __pyx_tp_new_4lxml_3sax_ElementTreeProducer, /*tp_new*/
9067   0, /*tp_free*/
9068   0, /*tp_is_gc*/
9069   0, /*tp_bases*/
9070   0, /*tp_mro*/
9071   0, /*tp_cache*/
9072   0, /*tp_subclasses*/
9073   0, /*tp_weaklist*/
9074   0, /*tp_del*/
9075   0, /*tp_version_tag*/
9076   #if PY_VERSION_HEX >= 0x030400a1
9077   0, /*tp_finalize*/
9078   #endif
9079   #if PY_VERSION_HEX >= 0x030800b1
9080   0, /*tp_vectorcall*/
9081   #endif
9082   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9083   0, /*tp_print*/
9084   #endif
9085 };
9086
9087 static PyMethodDef __pyx_methods[] = {
9088   {0, 0, 0, 0}
9089 };
9090
9091 #if PY_MAJOR_VERSION >= 3
9092 #if CYTHON_PEP489_MULTI_PHASE_INIT
9093 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9094 static int __pyx_pymod_exec_sax(PyObject* module); /*proto*/
9095 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9096   {Py_mod_create, (void*)__pyx_pymod_create},
9097   {Py_mod_exec, (void*)__pyx_pymod_exec_sax},
9098   {0, NULL}
9099 };
9100 #endif
9101
9102 static struct PyModuleDef __pyx_moduledef = {
9103     PyModuleDef_HEAD_INIT,
9104     "sax",
9105     __pyx_k_SAX_based_adapter_to_copy_trees, /* m_doc */
9106   #if CYTHON_PEP489_MULTI_PHASE_INIT
9107     0, /* m_size */
9108   #else
9109     -1, /* m_size */
9110   #endif
9111     __pyx_methods /* m_methods */,
9112   #if CYTHON_PEP489_MULTI_PHASE_INIT
9113     __pyx_moduledef_slots, /* m_slots */
9114   #else
9115     NULL, /* m_reload */
9116   #endif
9117     NULL, /* m_traverse */
9118     NULL, /* m_clear */
9119     (freefunc)__pyx_module_cleanup /* m_free */
9120 };
9121 #endif
9122 #ifndef CYTHON_SMALL_CODE
9123 #if defined(__clang__)
9124     #define CYTHON_SMALL_CODE
9125 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9126     #define CYTHON_SMALL_CODE __attribute__((cold))
9127 #else
9128     #define CYTHON_SMALL_CODE
9129 #endif
9130 #endif
9131
9132 static __Pyx_StringTabEntry __pyx_string_tab[] = {
9133   {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
9134   {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
9135   {&__pyx_n_s_AttributesNSImpl, __pyx_k_AttributesNSImpl, sizeof(__pyx_k_AttributesNSImpl), 0, 0, 1, 1},
9136   {&__pyx_kp_s_Build_an_lxml_ElementTree_from_S, __pyx_k_Build_an_lxml_ElementTree_from_S, sizeof(__pyx_k_Build_an_lxml_ElementTree_from_S), 0, 0, 1, 0},
9137   {&__pyx_n_s_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 0, 1, 1},
9138   {&__pyx_n_s_ContentHandler, __pyx_k_ContentHandler, sizeof(__pyx_k_ContentHandler), 0, 0, 1, 1},
9139   {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
9140   {&__pyx_n_s_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 0, 1, 1},
9141   {&__pyx_n_s_ElementTreeContentHandler, __pyx_k_ElementTreeContentHandler, sizeof(__pyx_k_ElementTreeContentHandler), 0, 0, 1, 1},
9142   {&__pyx_n_s_ElementTreeContentHandler___init, __pyx_k_ElementTreeContentHandler___init, sizeof(__pyx_k_ElementTreeContentHandler___init), 0, 0, 1, 1},
9143   {&__pyx_n_s_ElementTreeContentHandler__build, __pyx_k_ElementTreeContentHandler__build, sizeof(__pyx_k_ElementTreeContentHandler__build), 0, 0, 1, 1},
9144   {&__pyx_n_s_ElementTreeContentHandler__get_e, __pyx_k_ElementTreeContentHandler__get_e, sizeof(__pyx_k_ElementTreeContentHandler__get_e), 0, 0, 1, 1},
9145   {&__pyx_n_s_ElementTreeContentHandler_charac, __pyx_k_ElementTreeContentHandler_charac, sizeof(__pyx_k_ElementTreeContentHandler_charac), 0, 0, 1, 1},
9146   {&__pyx_n_s_ElementTreeContentHandler_endDoc, __pyx_k_ElementTreeContentHandler_endDoc, sizeof(__pyx_k_ElementTreeContentHandler_endDoc), 0, 0, 1, 1},
9147   {&__pyx_n_s_ElementTreeContentHandler_endEle, __pyx_k_ElementTreeContentHandler_endEle, sizeof(__pyx_k_ElementTreeContentHandler_endEle), 0, 0, 1, 1},
9148   {&__pyx_n_s_ElementTreeContentHandler_endEle_2, __pyx_k_ElementTreeContentHandler_endEle_2, sizeof(__pyx_k_ElementTreeContentHandler_endEle_2), 0, 0, 1, 1},
9149   {&__pyx_n_s_ElementTreeContentHandler_endPre, __pyx_k_ElementTreeContentHandler_endPre, sizeof(__pyx_k_ElementTreeContentHandler_endPre), 0, 0, 1, 1},
9150   {&__pyx_n_s_ElementTreeContentHandler_proces, __pyx_k_ElementTreeContentHandler_proces, sizeof(__pyx_k_ElementTreeContentHandler_proces), 0, 0, 1, 1},
9151   {&__pyx_n_s_ElementTreeContentHandler_setDoc, __pyx_k_ElementTreeContentHandler_setDoc, sizeof(__pyx_k_ElementTreeContentHandler_setDoc), 0, 0, 1, 1},
9152   {&__pyx_n_s_ElementTreeContentHandler_startD, __pyx_k_ElementTreeContentHandler_startD, sizeof(__pyx_k_ElementTreeContentHandler_startD), 0, 0, 1, 1},
9153   {&__pyx_n_s_ElementTreeContentHandler_startE, __pyx_k_ElementTreeContentHandler_startE, sizeof(__pyx_k_ElementTreeContentHandler_startE), 0, 0, 1, 1},
9154   {&__pyx_n_s_ElementTreeContentHandler_startE_2, __pyx_k_ElementTreeContentHandler_startE_2, sizeof(__pyx_k_ElementTreeContentHandler_startE_2), 0, 0, 1, 1},
9155   {&__pyx_n_s_ElementTreeContentHandler_startP, __pyx_k_ElementTreeContentHandler_startP, sizeof(__pyx_k_ElementTreeContentHandler_startP), 0, 0, 1, 1},
9156   {&__pyx_n_s_ElementTreeProducer, __pyx_k_ElementTreeProducer, sizeof(__pyx_k_ElementTreeProducer), 0, 0, 1, 1},
9157   {&__pyx_n_s_ElementTreeProducer___reduce_cyt, __pyx_k_ElementTreeProducer___reduce_cyt, sizeof(__pyx_k_ElementTreeProducer___reduce_cyt), 0, 0, 1, 1},
9158   {&__pyx_n_s_ElementTreeProducer___setstate_c, __pyx_k_ElementTreeProducer___setstate_c, sizeof(__pyx_k_ElementTreeProducer___setstate_c), 0, 0, 1, 1},
9159   {&__pyx_n_s_ElementTreeProducer_saxify, __pyx_k_ElementTreeProducer_saxify, sizeof(__pyx_k_ElementTreeProducer_saxify), 0, 0, 1, 1},
9160   {&__pyx_kp_s_General_SAX_error, __pyx_k_General_SAX_error, sizeof(__pyx_k_General_SAX_error), 0, 0, 1, 0},
9161   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x1d, __pyx_k_Incompatible_checksums_s_vs_0x1d, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x1d), 0, 0, 1, 0},
9162   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
9163   {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
9164   {&__pyx_n_s_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 0, 1, 1},
9165   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9166   {&__pyx_n_s_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 0, 1, 1},
9167   {&__pyx_n_s_SaxError, __pyx_k_SaxError, sizeof(__pyx_k_SaxError), 0, 0, 1, 1},
9168   {&__pyx_n_s_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 0, 0, 1, 1},
9169   {&__pyx_kp_s_Unexpected_element_closed, __pyx_k_Unexpected_element_closed, sizeof(__pyx_k_Unexpected_element_closed), 0, 0, 1, 0},
9170   {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
9171   {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
9172   {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
9173   {&__pyx_n_s_addprevious, __pyx_k_addprevious, sizeof(__pyx_k_addprevious), 0, 0, 1, 1},
9174   {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
9175   {&__pyx_n_s_attr_name, __pyx_k_attr_name, sizeof(__pyx_k_attr_name), 0, 0, 1, 1},
9176   {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
9177   {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
9178   {&__pyx_n_s_buildTag, __pyx_k_buildTag, sizeof(__pyx_k_buildTag), 0, 0, 1, 1},
9179   {&__pyx_n_s_characters, __pyx_k_characters, sizeof(__pyx_k_characters), 0, 0, 1, 1},
9180   {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
9181   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9182   {&__pyx_n_s_content_handler, __pyx_k_content_handler, sizeof(__pyx_k_content_handler), 0, 0, 1, 1},
9183   {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
9184   {&__pyx_n_s_default_ns, __pyx_k_default_ns, sizeof(__pyx_k_default_ns), 0, 0, 1, 1},
9185   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9186   {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
9187   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9188   {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1},
9189   {&__pyx_n_s_el_name, __pyx_k_el_name, sizeof(__pyx_k_el_name), 0, 0, 1, 1},
9190   {&__pyx_n_s_el_tag, __pyx_k_el_tag, sizeof(__pyx_k_el_tag), 0, 0, 1, 1},
9191   {&__pyx_n_s_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 0, 1, 1},
9192   {&__pyx_n_s_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 0, 0, 1, 1},
9193   {&__pyx_n_s_element_stack, __pyx_k_element_stack, sizeof(__pyx_k_element_stack), 0, 0, 1, 1},
9194   {&__pyx_n_s_element_stack_2, __pyx_k_element_stack_2, sizeof(__pyx_k_element_stack_2), 0, 0, 1, 1},
9195   {&__pyx_n_s_endDocument, __pyx_k_endDocument, sizeof(__pyx_k_endDocument), 0, 0, 1, 1},
9196   {&__pyx_n_s_endElement, __pyx_k_endElement, sizeof(__pyx_k_endElement), 0, 0, 1, 1},
9197   {&__pyx_n_s_endElementNS, __pyx_k_endElementNS, sizeof(__pyx_k_endElementNS), 0, 0, 1, 1},
9198   {&__pyx_n_s_endPrefixMapping, __pyx_k_endPrefixMapping, sizeof(__pyx_k_endPrefixMapping), 0, 0, 1, 1},
9199   {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
9200   {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
9201   {&__pyx_n_s_get_etree, __pyx_k_get_etree, sizeof(__pyx_k_get_etree), 0, 0, 1, 1},
9202   {&__pyx_n_s_getnext, __pyx_k_getnext, sizeof(__pyx_k_getnext), 0, 0, 1, 1},
9203   {&__pyx_n_s_getprevious, __pyx_k_getprevious, sizeof(__pyx_k_getprevious), 0, 0, 1, 1},
9204   {&__pyx_n_s_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 0, 0, 1, 1},
9205   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9206   {&__pyx_n_s_ignorableWhitespace, __pyx_k_ignorableWhitespace, sizeof(__pyx_k_ignorableWhitespace), 0, 0, 1, 1},
9207   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9208   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
9209   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
9210   {&__pyx_n_s_iter_attributes, __pyx_k_iter_attributes, sizeof(__pyx_k_iter_attributes), 0, 0, 1, 1},
9211   {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
9212   {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
9213   {&__pyx_n_s_last_element, __pyx_k_last_element, sizeof(__pyx_k_last_element), 0, 0, 1, 1},
9214   {&__pyx_n_s_local_name, __pyx_k_local_name, sizeof(__pyx_k_local_name), 0, 0, 1, 1},
9215   {&__pyx_n_s_locator, __pyx_k_locator, sizeof(__pyx_k_locator), 0, 0, 1, 1},
9216   {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
9217   {&__pyx_n_s_lxml_etree, __pyx_k_lxml_etree, sizeof(__pyx_k_lxml_etree), 0, 0, 1, 1},
9218   {&__pyx_n_s_lxml_sax, __pyx_k_lxml_sax, sizeof(__pyx_k_lxml_sax), 0, 0, 1, 1},
9219   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9220   {&__pyx_n_s_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 0, 0, 1, 1},
9221   {&__pyx_n_s_makeelement_2, __pyx_k_makeelement_2, sizeof(__pyx_k_makeelement_2), 0, 0, 1, 1},
9222   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9223   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
9224   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9225   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9226   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
9227   {&__pyx_n_s_name_tuple, __pyx_k_name_tuple, sizeof(__pyx_k_name_tuple), 0, 0, 1, 1},
9228   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9229   {&__pyx_n_s_new_mappings, __pyx_k_new_mappings, sizeof(__pyx_k_new_mappings), 0, 0, 1, 1},
9230   {&__pyx_n_s_ns_mapping, __pyx_k_ns_mapping, sizeof(__pyx_k_ns_mapping), 0, 0, 1, 1},
9231   {&__pyx_n_s_ns_name, __pyx_k_ns_name, sizeof(__pyx_k_ns_name), 0, 0, 1, 1},
9232   {&__pyx_n_s_ns_name_tuple, __pyx_k_ns_name_tuple, sizeof(__pyx_k_ns_name_tuple), 0, 0, 1, 1},
9233   {&__pyx_n_s_ns_uri, __pyx_k_ns_uri, sizeof(__pyx_k_ns_uri), 0, 0, 1, 1},
9234   {&__pyx_n_s_ns_uri_list, __pyx_k_ns_uri_list, sizeof(__pyx_k_ns_uri_list), 0, 0, 1, 1},
9235   {&__pyx_n_s_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 0, 0, 1, 1},
9236   {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
9237   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9238   {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
9239   {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
9240   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9241   {&__pyx_n_s_processingInstruction, __pyx_k_processingInstruction, sizeof(__pyx_k_processingInstruction), 0, 0, 1, 1},
9242   {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
9243   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9244   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9245   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9246   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9247   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9248   {&__pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_k_pyx_unpickle_ElementTreeProduc, sizeof(__pyx_k_pyx_unpickle_ElementTreeProduc), 0, 0, 1, 1},
9249   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
9250   {&__pyx_n_s_qname, __pyx_k_qname, sizeof(__pyx_k_qname), 0, 0, 1, 1},
9251   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9252   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9253   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9254   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9255   {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
9256   {&__pyx_n_s_root_siblings, __pyx_k_root_siblings, sizeof(__pyx_k_root_siblings), 0, 0, 1, 1},
9257   {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
9258   {&__pyx_n_s_saxify, __pyx_k_saxify, sizeof(__pyx_k_saxify), 0, 0, 1, 1},
9259   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9260   {&__pyx_n_s_setDocumentLocator, __pyx_k_setDocumentLocator, sizeof(__pyx_k_setDocumentLocator), 0, 0, 1, 1},
9261   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9262   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9263   {&__pyx_n_s_sibling, __pyx_k_sibling, sizeof(__pyx_k_sibling), 0, 0, 1, 1},
9264   {&__pyx_n_s_siblings, __pyx_k_siblings, sizeof(__pyx_k_siblings), 0, 0, 1, 1},
9265   {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
9266   {&__pyx_kp_s_src_lxml_sax_py, __pyx_k_src_lxml_sax_py, sizeof(__pyx_k_src_lxml_sax_py), 0, 0, 1, 0},
9267   {&__pyx_n_s_startDocument, __pyx_k_startDocument, sizeof(__pyx_k_startDocument), 0, 0, 1, 1},
9268   {&__pyx_n_s_startElement, __pyx_k_startElement, sizeof(__pyx_k_startElement), 0, 0, 1, 1},
9269   {&__pyx_n_s_startElementNS, __pyx_k_startElementNS, sizeof(__pyx_k_startElementNS), 0, 0, 1, 1},
9270   {&__pyx_n_s_startPrefixMapping, __pyx_k_startPrefixMapping, sizeof(__pyx_k_startPrefixMapping), 0, 0, 1, 1},
9271   {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9272   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9273   {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
9274   {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
9275   {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
9276   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9277   {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
9278   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9279   {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
9280   {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
9281   {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
9282   {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9283   {&__pyx_n_s_xml_sax_handler, __pyx_k_xml_sax_handler, sizeof(__pyx_k_xml_sax_handler), 0, 0, 1, 1},
9284   {&__pyx_n_s_xml_sax_xmlreader, __pyx_k_xml_sax_xmlreader, sizeof(__pyx_k_xml_sax_xmlreader), 0, 0, 1, 1},
9285   {0, 0, 0, 0, 0, 0, 0}
9286 };
9287 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9288   __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 54, __pyx_L1_error)
9289   __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 69, __pyx_L1_error)
9290   __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 96, __pyx_L1_error)
9291   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 152, __pyx_L1_error)
9292   __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 264, __pyx_L1_error)
9293   return 0;
9294   __pyx_L1_error:;
9295   return -1;
9296 }
9297
9298 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9299   __Pyx_RefNannyDeclarations
9300   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9301
9302   /* "lxml/sax.py":30
9303  * def _getNsTag(tag):
9304  *     if tag[0] == '{':
9305  *         return tuple(tag[1:].split('}', 1))             # <<<<<<<<<<<<<<
9306  *     else:
9307  *         return None, tag
9308  */
9309   __pyx_slice__2 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 30, __pyx_L1_error)
9310   __Pyx_GOTREF(__pyx_slice__2);
9311   __Pyx_GIVEREF(__pyx_slice__2);
9312   __pyx_tuple__4 = PyTuple_Pack(2, __pyx_kp_s__3, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 30, __pyx_L1_error)
9313   __Pyx_GOTREF(__pyx_tuple__4);
9314   __Pyx_GIVEREF(__pyx_tuple__4);
9315
9316   /* "lxml/sax.py":115
9317  *                 for sibling in self._root_siblings:
9318  *                     element.addprevious(sibling)
9319  *             del self._root_siblings[:]             # <<<<<<<<<<<<<<
9320  *         else:
9321  *             element = SubElement(element_stack[-1], el_name,
9322  */
9323   __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 115, __pyx_L1_error)
9324   __Pyx_GOTREF(__pyx_slice__5);
9325   __Pyx_GIVEREF(__pyx_slice__5);
9326
9327   /* "lxml/sax.py":183
9328  *                 siblings.append(sibling)
9329  *                 sibling = sibling.getprevious()
9330  *             for sibling in siblings[::-1]:             # <<<<<<<<<<<<<<
9331  *                 self._recursive_saxify(sibling, {})
9332  * 
9333  */
9334   __pyx_slice__7 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 183, __pyx_L1_error)
9335   __Pyx_GOTREF(__pyx_slice__7);
9336   __Pyx_GIVEREF(__pyx_slice__7);
9337
9338   /* "lxml/sax.py":38
9339  *     """Build an lxml ElementTree from SAX events.
9340  *     """
9341  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
9342  *         ContentHandler.__init__(self)
9343  *         self._root = None
9344  */
9345   __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_makeelement); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 38, __pyx_L1_error)
9346   __Pyx_GOTREF(__pyx_tuple__9);
9347   __Pyx_GIVEREF(__pyx_tuple__9);
9348   __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_init, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 38, __pyx_L1_error)
9349   __pyx_tuple__11 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 38, __pyx_L1_error)
9350   __Pyx_GOTREF(__pyx_tuple__11);
9351   __Pyx_GIVEREF(__pyx_tuple__11);
9352
9353   /* "lxml/sax.py":50
9354  *         self._makeelement = makeelement
9355  * 
9356  *     def _get_etree(self):             # <<<<<<<<<<<<<<
9357  *         "Contains the generated ElementTree after parsing is finished."
9358  *         return ElementTree(self._root)
9359  */
9360   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 50, __pyx_L1_error)
9361   __Pyx_GOTREF(__pyx_tuple__12);
9362   __Pyx_GIVEREF(__pyx_tuple__12);
9363   __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_get_etree, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 50, __pyx_L1_error)
9364
9365   /* "lxml/sax.py":56
9366  *     etree = property(_get_etree, doc=_get_etree.__doc__)
9367  * 
9368  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
9369  *         pass
9370  * 
9371  */
9372   __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_locator); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 56, __pyx_L1_error)
9373   __Pyx_GOTREF(__pyx_tuple__14);
9374   __Pyx_GIVEREF(__pyx_tuple__14);
9375   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_setDocumentLocator, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 56, __pyx_L1_error)
9376
9377   /* "lxml/sax.py":59
9378  *         pass
9379  * 
9380  *     def startDocument(self):             # <<<<<<<<<<<<<<
9381  *         pass
9382  * 
9383  */
9384   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 59, __pyx_L1_error)
9385   __Pyx_GOTREF(__pyx_tuple__16);
9386   __Pyx_GIVEREF(__pyx_tuple__16);
9387   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startDocument, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 59, __pyx_L1_error)
9388
9389   /* "lxml/sax.py":62
9390  *         pass
9391  * 
9392  *     def endDocument(self):             # <<<<<<<<<<<<<<
9393  *         pass
9394  * 
9395  */
9396   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 62, __pyx_L1_error)
9397   __Pyx_GOTREF(__pyx_tuple__18);
9398   __Pyx_GIVEREF(__pyx_tuple__18);
9399   __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endDocument, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 62, __pyx_L1_error)
9400
9401   /* "lxml/sax.py":65
9402  *         pass
9403  * 
9404  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
9405  *         self._new_mappings[prefix] = uri
9406  *         try:
9407  */
9408   __pyx_tuple__20 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_uri); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 65, __pyx_L1_error)
9409   __Pyx_GOTREF(__pyx_tuple__20);
9410   __Pyx_GIVEREF(__pyx_tuple__20);
9411   __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startPrefixMapping, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 65, __pyx_L1_error)
9412
9413   /* "lxml/sax.py":74
9414  *             self._default_ns = uri
9415  * 
9416  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
9417  *         ns_uri_list = self._ns_mapping[prefix]
9418  *         ns_uri_list.pop()
9419  */
9420   __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_prefix, __pyx_n_s_ns_uri_list); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 74, __pyx_L1_error)
9421   __Pyx_GOTREF(__pyx_tuple__22);
9422   __Pyx_GIVEREF(__pyx_tuple__22);
9423   __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endPrefixMapping, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 74, __pyx_L1_error)
9424
9425   /* "lxml/sax.py":80
9426  *             self._default_ns = ns_uri_list[-1]
9427  * 
9428  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
9429  *         ns_uri, local_name = ns_name_tuple
9430  *         if ns_uri:
9431  */
9432   __pyx_tuple__24 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_ns_name_tuple, __pyx_n_s_ns_uri, __pyx_n_s_local_name, __pyx_n_s_el_tag); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 80, __pyx_L1_error)
9433   __Pyx_GOTREF(__pyx_tuple__24);
9434   __Pyx_GIVEREF(__pyx_tuple__24);
9435   __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_buildTag, 80, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 80, __pyx_L1_error)
9436
9437   /* "lxml/sax.py":90
9438  *         return el_tag
9439  * 
9440  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
9441  *         el_name = self._buildTag(ns_name)
9442  *         if attributes:
9443  */
9444   __pyx_tuple__26 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_ns_name, __pyx_n_s_qname, __pyx_n_s_attributes, __pyx_n_s_el_name, __pyx_n_s_attrs, __pyx_n_s_iter_attributes, __pyx_n_s_name_tuple, __pyx_n_s_value, __pyx_n_s_attr_name, __pyx_n_s_element_stack_2, __pyx_n_s_element, __pyx_n_s_sibling); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 90, __pyx_L1_error)
9445   __Pyx_GOTREF(__pyx_tuple__26);
9446   __Pyx_GIVEREF(__pyx_tuple__26);
9447   __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startElementNS, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 90, __pyx_L1_error)
9448   __pyx_tuple__28 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 90, __pyx_L1_error)
9449   __Pyx_GOTREF(__pyx_tuple__28);
9450   __Pyx_GIVEREF(__pyx_tuple__28);
9451
9452   /* "lxml/sax.py":123
9453  *         self._new_mappings.clear()
9454  * 
9455  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
9456  *         pi = ProcessingInstruction(target, data)
9457  *         if self._root is None:
9458  */
9459   __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_target, __pyx_n_s_data, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 123, __pyx_L1_error)
9460   __Pyx_GOTREF(__pyx_tuple__29);
9461   __Pyx_GIVEREF(__pyx_tuple__29);
9462   __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_processingInstruction, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 123, __pyx_L1_error)
9463
9464   /* "lxml/sax.py":130
9465  *             self._element_stack[-1].append(pi)
9466  * 
9467  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
9468  *         element = self._element_stack.pop()
9469  *         el_tag = self._buildTag(ns_name)
9470  */
9471   __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_ns_name, __pyx_n_s_qname, __pyx_n_s_element, __pyx_n_s_el_tag); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 130, __pyx_L1_error)
9472   __Pyx_GOTREF(__pyx_tuple__31);
9473   __Pyx_GIVEREF(__pyx_tuple__31);
9474   __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endElementNS, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 130, __pyx_L1_error)
9475
9476   /* "lxml/sax.py":136
9477  *             raise SaxError("Unexpected element closed: " + el_tag)
9478  * 
9479  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
9480  *         if attributes:
9481  *             attributes = dict(
9482  */
9483   __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_attributes, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 136, __pyx_L1_error)
9484   __Pyx_GOTREF(__pyx_tuple__33);
9485   __Pyx_GIVEREF(__pyx_tuple__33);
9486   __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_startElement, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 136, __pyx_L1_error)
9487   __pyx_tuple__35 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error)
9488   __Pyx_GOTREF(__pyx_tuple__35);
9489   __Pyx_GIVEREF(__pyx_tuple__35);
9490
9491   /* "lxml/sax.py":143
9492  *         self.startElementNS((None, name), name, attributes)
9493  * 
9494  *     def endElement(self, name):             # <<<<<<<<<<<<<<
9495  *         self.endElementNS((None, name), name)
9496  * 
9497  */
9498   __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_name); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 143, __pyx_L1_error)
9499   __Pyx_GOTREF(__pyx_tuple__36);
9500   __Pyx_GIVEREF(__pyx_tuple__36);
9501   __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_endElement, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 143, __pyx_L1_error)
9502
9503   /* "lxml/sax.py":146
9504  *         self.endElementNS((None, name), name)
9505  * 
9506  *     def characters(self, data):             # <<<<<<<<<<<<<<
9507  *         last_element = self._element_stack[-1]
9508  *         try:
9509  */
9510   __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_last_element); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 146, __pyx_L1_error)
9511   __Pyx_GOTREF(__pyx_tuple__38);
9512   __Pyx_GIVEREF(__pyx_tuple__38);
9513   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_characters, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 146, __pyx_L1_error)
9514
9515   /* "lxml/sax.py":173
9516  *         self._empty_attributes = attr_class({}, {})
9517  * 
9518  *     def saxify(self):             # <<<<<<<<<<<<<<
9519  *         self._content_handler.startDocument()
9520  * 
9521  */
9522   __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_element, __pyx_n_s_siblings, __pyx_n_s_sibling); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 173, __pyx_L1_error)
9523   __Pyx_GOTREF(__pyx_tuple__40);
9524   __Pyx_GIVEREF(__pyx_tuple__40);
9525   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_saxify, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 173, __pyx_L1_error)
9526
9527   /* "(tree fragment)":1
9528  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9529  *     cdef tuple state
9530  *     cdef object _dict
9531  */
9532   __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_dict_2, __pyx_n_s_use_setstate); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 1, __pyx_L1_error)
9533   __Pyx_GOTREF(__pyx_tuple__42);
9534   __Pyx_GIVEREF(__pyx_tuple__42);
9535   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 1, __pyx_L1_error)
9536
9537   /* "(tree fragment)":16
9538  *     else:
9539  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
9540  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9541  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
9542  */
9543   __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 16, __pyx_L1_error)
9544   __Pyx_GOTREF(__pyx_tuple__44);
9545   __Pyx_GIVEREF(__pyx_tuple__44);
9546   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 16, __pyx_L1_error)
9547
9548   /* "lxml/sax.py":274
9549  * 
9550  * 
9551  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
9552  *     """One-shot helper to generate SAX events from an XML tree and fire
9553  *     them against a SAX ContentHandler.
9554  */
9555   __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_element_or_tree, __pyx_n_s_content_handler); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 274, __pyx_L1_error)
9556   __Pyx_GOTREF(__pyx_tuple__46);
9557   __Pyx_GIVEREF(__pyx_tuple__46);
9558   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_sax_py, __pyx_n_s_saxify, 274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 274, __pyx_L1_error)
9559
9560   /* "(tree fragment)":1
9561  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
9562  *     cdef object __pyx_PickleError
9563  *     cdef object __pyx_result
9564  */
9565   __pyx_tuple__48 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 1, __pyx_L1_error)
9566   __Pyx_GOTREF(__pyx_tuple__48);
9567   __Pyx_GIVEREF(__pyx_tuple__48);
9568   __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ElementTreeProduc, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 1, __pyx_L1_error)
9569   __Pyx_RefNannyFinishContext();
9570   return 0;
9571   __pyx_L1_error:;
9572   __Pyx_RefNannyFinishContext();
9573   return -1;
9574 }
9575
9576 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9577   __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
9578   __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
9579   __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
9580   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9581   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9582   __pyx_int_30712058 = PyInt_FromLong(30712058L); if (unlikely(!__pyx_int_30712058)) __PYX_ERR(0, 1, __pyx_L1_error)
9583   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9584   return 0;
9585   __pyx_L1_error:;
9586   return -1;
9587 }
9588
9589 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9590 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9591 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9592 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9593 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9594 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9595 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9596
9597 static int __Pyx_modinit_global_init_code(void) {
9598   __Pyx_RefNannyDeclarations
9599   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9600   /*--- Global init code ---*/
9601   __Pyx_RefNannyFinishContext();
9602   return 0;
9603 }
9604
9605 static int __Pyx_modinit_variable_export_code(void) {
9606   __Pyx_RefNannyDeclarations
9607   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9608   /*--- Variable export code ---*/
9609   __Pyx_RefNannyFinishContext();
9610   return 0;
9611 }
9612
9613 static int __Pyx_modinit_function_export_code(void) {
9614   __Pyx_RefNannyDeclarations
9615   int __pyx_lineno = 0;
9616   const char *__pyx_filename = NULL;
9617   int __pyx_clineno = 0;
9618   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9619   /*--- Function export code ---*/
9620   if (__Pyx_ExportFunction("_getNsTag", (void (*)(void))__pyx_f_4lxml_3sax__getNsTag, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9621   __Pyx_RefNannyFinishContext();
9622   return 0;
9623   __pyx_L1_error:;
9624   __Pyx_RefNannyFinishContext();
9625   return -1;
9626 }
9627
9628 static int __Pyx_modinit_type_init_code(void) {
9629   __Pyx_RefNannyDeclarations
9630   int __pyx_lineno = 0;
9631   const char *__pyx_filename = NULL;
9632   int __pyx_clineno = 0;
9633   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9634   /*--- Type init code ---*/
9635   __pyx_vtabptr_4lxml_3sax_ElementTreeProducer = &__pyx_vtable_4lxml_3sax_ElementTreeProducer;
9636   __pyx_vtable_4lxml_3sax_ElementTreeProducer._recursive_saxify = (PyObject *(*)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *))__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify;
9637   __pyx_vtable_4lxml_3sax_ElementTreeProducer._build_qname = (PyObject *(*)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int))__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname;
9638   if (PyType_Ready(&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9639   #if PY_VERSION_HEX < 0x030800B1
9640   __pyx_type_4lxml_3sax_ElementTreeProducer.tp_print = 0;
9641   #endif
9642   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_3sax_ElementTreeProducer.tp_dictoffset && __pyx_type_4lxml_3sax_ElementTreeProducer.tp_getattro == PyObject_GenericGetAttr)) {
9643     __pyx_type_4lxml_3sax_ElementTreeProducer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9644   }
9645   if (__Pyx_SetVtable(__pyx_type_4lxml_3sax_ElementTreeProducer.tp_dict, __pyx_vtabptr_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9646   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTreeProducer, (PyObject *)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9647   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9648   __pyx_ptype_4lxml_3sax_ElementTreeProducer = &__pyx_type_4lxml_3sax_ElementTreeProducer;
9649   __Pyx_RefNannyFinishContext();
9650   return 0;
9651   __pyx_L1_error:;
9652   __Pyx_RefNannyFinishContext();
9653   return -1;
9654 }
9655
9656 static int __Pyx_modinit_type_import_code(void) {
9657   __Pyx_RefNannyDeclarations
9658   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9659   /*--- Type import code ---*/
9660   __Pyx_RefNannyFinishContext();
9661   return 0;
9662 }
9663
9664 static int __Pyx_modinit_variable_import_code(void) {
9665   __Pyx_RefNannyDeclarations
9666   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9667   /*--- Variable import code ---*/
9668   __Pyx_RefNannyFinishContext();
9669   return 0;
9670 }
9671
9672 static int __Pyx_modinit_function_import_code(void) {
9673   __Pyx_RefNannyDeclarations
9674   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9675   /*--- Function import code ---*/
9676   __Pyx_RefNannyFinishContext();
9677   return 0;
9678 }
9679
9680
9681 #ifndef CYTHON_NO_PYINIT_EXPORT
9682 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9683 #elif PY_MAJOR_VERSION < 3
9684 #ifdef __cplusplus
9685 #define __Pyx_PyMODINIT_FUNC extern "C" void
9686 #else
9687 #define __Pyx_PyMODINIT_FUNC void
9688 #endif
9689 #else
9690 #ifdef __cplusplus
9691 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9692 #else
9693 #define __Pyx_PyMODINIT_FUNC PyObject *
9694 #endif
9695 #endif
9696
9697
9698 #if PY_MAJOR_VERSION < 3
9699 __Pyx_PyMODINIT_FUNC initsax(void) CYTHON_SMALL_CODE; /*proto*/
9700 __Pyx_PyMODINIT_FUNC initsax(void)
9701 #else
9702 __Pyx_PyMODINIT_FUNC PyInit_sax(void) CYTHON_SMALL_CODE; /*proto*/
9703 __Pyx_PyMODINIT_FUNC PyInit_sax(void)
9704 #if CYTHON_PEP489_MULTI_PHASE_INIT
9705 {
9706   return PyModuleDef_Init(&__pyx_moduledef);
9707 }
9708 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
9709     #if PY_VERSION_HEX >= 0x030700A1
9710     static PY_INT64_T main_interpreter_id = -1;
9711     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
9712     if (main_interpreter_id == -1) {
9713         main_interpreter_id = current_id;
9714         return (unlikely(current_id == -1)) ? -1 : 0;
9715     } else if (unlikely(main_interpreter_id != current_id))
9716     #else
9717     static PyInterpreterState *main_interpreter = NULL;
9718     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
9719     if (!main_interpreter) {
9720         main_interpreter = current_interpreter;
9721     } else if (unlikely(main_interpreter != current_interpreter))
9722     #endif
9723     {
9724         PyErr_SetString(
9725             PyExc_ImportError,
9726             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
9727         return -1;
9728     }
9729     return 0;
9730 }
9731 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) {
9732     PyObject *value = PyObject_GetAttrString(spec, from_name);
9733     int result = 0;
9734     if (likely(value)) {
9735         if (allow_none || value != Py_None) {
9736             result = PyDict_SetItemString(moddict, to_name, value);
9737         }
9738         Py_DECREF(value);
9739     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
9740         PyErr_Clear();
9741     } else {
9742         result = -1;
9743     }
9744     return result;
9745 }
9746 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
9747     PyObject *module = NULL, *moddict, *modname;
9748     if (__Pyx_check_single_interpreter())
9749         return NULL;
9750     if (__pyx_m)
9751         return __Pyx_NewRef(__pyx_m);
9752     modname = PyObject_GetAttrString(spec, "name");
9753     if (unlikely(!modname)) goto bad;
9754     module = PyModule_NewObject(modname);
9755     Py_DECREF(modname);
9756     if (unlikely(!module)) goto bad;
9757     moddict = PyModule_GetDict(module);
9758     if (unlikely(!moddict)) goto bad;
9759     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
9760     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
9761     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
9762     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
9763     return module;
9764 bad:
9765     Py_XDECREF(module);
9766     return NULL;
9767 }
9768
9769
9770 static CYTHON_SMALL_CODE int __pyx_pymod_exec_sax(PyObject *__pyx_pyinit_module)
9771 #endif
9772 #endif
9773 {
9774   PyObject *__pyx_t_1 = NULL;
9775   PyObject *__pyx_t_2 = NULL;
9776   PyObject *__pyx_t_3 = NULL;
9777   PyObject *__pyx_t_4 = NULL;
9778   PyObject *__pyx_t_5 = NULL;
9779   PyObject *__pyx_t_6 = NULL;
9780   PyObject *__pyx_t_7 = NULL;
9781   int __pyx_lineno = 0;
9782   const char *__pyx_filename = NULL;
9783   int __pyx_clineno = 0;
9784   __Pyx_RefNannyDeclarations
9785   #if CYTHON_PEP489_MULTI_PHASE_INIT
9786   if (__pyx_m) {
9787     if (__pyx_m == __pyx_pyinit_module) return 0;
9788     PyErr_SetString(PyExc_RuntimeError, "Module 'sax' has already been imported. Re-initialisation is not supported.");
9789     return -1;
9790   }
9791   #elif PY_MAJOR_VERSION >= 3
9792   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
9793   #endif
9794   #if CYTHON_REFNANNY
9795 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9796 if (!__Pyx_RefNanny) {
9797   PyErr_Clear();
9798   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9799   if (!__Pyx_RefNanny)
9800       Py_FatalError("failed to import 'refnanny' module");
9801 }
9802 #endif
9803   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_sax(void)", 0);
9804   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9805   #ifdef __Pxy_PyFrame_Initialize_Offsets
9806   __Pxy_PyFrame_Initialize_Offsets();
9807   #endif
9808   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
9809   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
9810   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
9811   #ifdef __Pyx_CyFunction_USED
9812   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9813   #endif
9814   #ifdef __Pyx_FusedFunction_USED
9815   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9816   #endif
9817   #ifdef __Pyx_Coroutine_USED
9818   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9819   #endif
9820   #ifdef __Pyx_Generator_USED
9821   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9822   #endif
9823   #ifdef __Pyx_AsyncGen_USED
9824   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9825   #endif
9826   #ifdef __Pyx_StopAsyncIteration_USED
9827   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9828   #endif
9829   /*--- Library function declarations ---*/
9830   /*--- Threads initialization code ---*/
9831   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
9832   #ifdef WITH_THREAD /* Python build with threading support? */
9833   PyEval_InitThreads();
9834   #endif
9835   #endif
9836   /*--- Module creation code ---*/
9837   #if CYTHON_PEP489_MULTI_PHASE_INIT
9838   __pyx_m = __pyx_pyinit_module;
9839   Py_INCREF(__pyx_m);
9840   #else
9841   #if PY_MAJOR_VERSION < 3
9842   __pyx_m = Py_InitModule4("sax", __pyx_methods, __pyx_k_SAX_based_adapter_to_copy_trees, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
9843   #else
9844   __pyx_m = PyModule_Create(&__pyx_moduledef);
9845   #endif
9846   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
9847   #endif
9848   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
9849   Py_INCREF(__pyx_d);
9850   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
9851   Py_INCREF(__pyx_b);
9852   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
9853   Py_INCREF(__pyx_cython_runtime);
9854   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9855   /*--- Initialize various global constants etc. ---*/
9856   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9857   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
9858   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9859   #endif
9860   if (__pyx_module_is_main_lxml__sax) {
9861     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9862   }
9863   #if PY_MAJOR_VERSION >= 3
9864   {
9865     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
9866     if (!PyDict_GetItemString(modules, "lxml.sax")) {
9867       if (unlikely(PyDict_SetItemString(modules, "lxml.sax", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9868     }
9869   }
9870   #endif
9871   /*--- Builtin init code ---*/
9872   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9873   /*--- Constants init code ---*/
9874   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9875   /*--- Global type/function init code ---*/
9876   (void)__Pyx_modinit_global_init_code();
9877   (void)__Pyx_modinit_variable_export_code();
9878   if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9879   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9880   (void)__Pyx_modinit_type_import_code();
9881   (void)__Pyx_modinit_variable_import_code();
9882   (void)__Pyx_modinit_function_import_code();
9883   /*--- Execution code ---*/
9884   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
9885   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9886   #endif
9887
9888   /* "lxml/sax.py":17
9889  * from __future__ import absolute_import
9890  * 
9891  * from xml.sax.handler import ContentHandler             # <<<<<<<<<<<<<<
9892  * from lxml import etree
9893  * from lxml.etree import ElementTree, SubElement
9894  */
9895   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9896   __Pyx_GOTREF(__pyx_t_1);
9897   __Pyx_INCREF(__pyx_n_s_ContentHandler);
9898   __Pyx_GIVEREF(__pyx_n_s_ContentHandler);
9899   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ContentHandler);
9900   __pyx_t_2 = __Pyx_Import(__pyx_n_s_xml_sax_handler, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
9901   __Pyx_GOTREF(__pyx_t_2);
9902   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9903   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9904   __Pyx_GOTREF(__pyx_t_1);
9905   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ContentHandler, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
9906   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9907   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9908
9909   /* "lxml/sax.py":18
9910  * 
9911  * from xml.sax.handler import ContentHandler
9912  * from lxml import etree             # <<<<<<<<<<<<<<
9913  * from lxml.etree import ElementTree, SubElement
9914  * from lxml.etree import Comment, ProcessingInstruction
9915  */
9916   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9917   __Pyx_GOTREF(__pyx_t_2);
9918   __Pyx_INCREF(__pyx_n_s_etree);
9919   __Pyx_GIVEREF(__pyx_n_s_etree);
9920   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_etree);
9921   __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
9922   __Pyx_GOTREF(__pyx_t_1);
9923   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9924   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9925   __Pyx_GOTREF(__pyx_t_2);
9926   if (PyDict_SetItem(__pyx_d, __pyx_n_s_etree, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
9927   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9928   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9929
9930   /* "lxml/sax.py":19
9931  * from xml.sax.handler import ContentHandler
9932  * from lxml import etree
9933  * from lxml.etree import ElementTree, SubElement             # <<<<<<<<<<<<<<
9934  * from lxml.etree import Comment, ProcessingInstruction
9935  * 
9936  */
9937   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9938   __Pyx_GOTREF(__pyx_t_1);
9939   __Pyx_INCREF(__pyx_n_s_ElementTree);
9940   __Pyx_GIVEREF(__pyx_n_s_ElementTree);
9941   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ElementTree);
9942   __Pyx_INCREF(__pyx_n_s_SubElement);
9943   __Pyx_GIVEREF(__pyx_n_s_SubElement);
9944   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_SubElement);
9945   __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml_etree, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
9946   __Pyx_GOTREF(__pyx_t_2);
9947   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9948   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9949   __Pyx_GOTREF(__pyx_t_1);
9950   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTree, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9951   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9952   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9953   __Pyx_GOTREF(__pyx_t_1);
9954   if (PyDict_SetItem(__pyx_d, __pyx_n_s_SubElement, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9955   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9956   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9957
9958   /* "lxml/sax.py":20
9959  * from lxml import etree
9960  * from lxml.etree import ElementTree, SubElement
9961  * from lxml.etree import Comment, ProcessingInstruction             # <<<<<<<<<<<<<<
9962  * 
9963  * 
9964  */
9965   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9966   __Pyx_GOTREF(__pyx_t_2);
9967   __Pyx_INCREF(__pyx_n_s_Comment);
9968   __Pyx_GIVEREF(__pyx_n_s_Comment);
9969   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Comment);
9970   __Pyx_INCREF(__pyx_n_s_ProcessingInstruction);
9971   __Pyx_GIVEREF(__pyx_n_s_ProcessingInstruction);
9972   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ProcessingInstruction);
9973   __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml_etree, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
9974   __Pyx_GOTREF(__pyx_t_1);
9975   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9976   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9977   __Pyx_GOTREF(__pyx_t_2);
9978   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comment, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9979   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9980   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9981   __Pyx_GOTREF(__pyx_t_2);
9982   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProcessingInstruction, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9983   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9984   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9985
9986   /* "lxml/sax.py":23
9987  * 
9988  * 
9989  * class SaxError(etree.LxmlError):             # <<<<<<<<<<<<<<
9990  *     """General SAX error.
9991  *     """
9992  */
9993   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9994   __Pyx_GOTREF(__pyx_t_1);
9995   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_LxmlError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
9996   __Pyx_GOTREF(__pyx_t_2);
9997   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9998   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9999   __Pyx_GOTREF(__pyx_t_1);
10000   __Pyx_GIVEREF(__pyx_t_2);
10001   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
10002   __pyx_t_2 = 0;
10003   __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
10004   __Pyx_GOTREF(__pyx_t_2);
10005   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SaxError, __pyx_n_s_SaxError, (PyObject *) NULL, __pyx_n_s_lxml_sax, __pyx_kp_s_General_SAX_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
10006   __Pyx_GOTREF(__pyx_t_3);
10007   __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SaxError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
10008   __Pyx_GOTREF(__pyx_t_4);
10009   if (PyDict_SetItem(__pyx_d, __pyx_n_s_SaxError, __pyx_t_4) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
10010   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10011   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10012   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10013   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10014
10015   /* "lxml/sax.py":35
10016  * 
10017  * 
10018  * class ElementTreeContentHandler(ContentHandler):             # <<<<<<<<<<<<<<
10019  *     """Build an lxml ElementTree from SAX events.
10020  *     """
10021  */
10022   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10023   __Pyx_GOTREF(__pyx_t_1);
10024   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
10025   __Pyx_GOTREF(__pyx_t_2);
10026   __Pyx_GIVEREF(__pyx_t_1);
10027   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
10028   __pyx_t_1 = 0;
10029   __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10030   __Pyx_GOTREF(__pyx_t_1);
10031   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_ElementTreeContentHandler, __pyx_n_s_ElementTreeContentHandler, (PyObject *) NULL, __pyx_n_s_lxml_sax, __pyx_kp_s_Build_an_lxml_ElementTree_from_S); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
10032   __Pyx_GOTREF(__pyx_t_3);
10033
10034   /* "lxml/sax.py":38
10035  *     """Build an lxml ElementTree from SAX events.
10036  *     """
10037  *     def __init__(self, makeelement=None):             # <<<<<<<<<<<<<<
10038  *         ContentHandler.__init__(self)
10039  *         self._root = None
10040  */
10041   __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_1__init__, 0, __pyx_n_s_ElementTreeContentHandler___init, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
10042   __Pyx_GOTREF(__pyx_t_4);
10043   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__11);
10044   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
10045   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10046
10047   /* "lxml/sax.py":50
10048  *         self._makeelement = makeelement
10049  * 
10050  *     def _get_etree(self):             # <<<<<<<<<<<<<<
10051  *         "Contains the generated ElementTree after parsing is finished."
10052  *         return ElementTree(self._root)
10053  */
10054   __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_3_get_etree, 0, __pyx_n_s_ElementTreeContentHandler__get_e, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
10055   __Pyx_GOTREF(__pyx_t_4);
10056   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_etree, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10057   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10058
10059   /* "lxml/sax.py":54
10060  *         return ElementTree(self._root)
10061  * 
10062  *     etree = property(_get_etree, doc=_get_etree.__doc__)             # <<<<<<<<<<<<<<
10063  * 
10064  *     def setDocumentLocator(self, locator):
10065  */
10066   __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10067   if (unlikely(!__pyx_t_4)) {
10068     PyErr_Clear();
10069     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_etree);
10070   }
10071   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10072   __Pyx_GOTREF(__pyx_t_4);
10073   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
10074   __Pyx_GOTREF(__pyx_t_5);
10075   __Pyx_GIVEREF(__pyx_t_4);
10076   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10077   __pyx_t_4 = 0;
10078   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10079   __Pyx_GOTREF(__pyx_t_4);
10080   __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10081   if (unlikely(!__pyx_t_6)) {
10082     PyErr_Clear();
10083     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_etree);
10084   }
10085   if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
10086   __Pyx_GOTREF(__pyx_t_6);
10087   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_doc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
10088   __Pyx_GOTREF(__pyx_t_7);
10089   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10090   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_doc_2, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10091   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10092   __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
10093   __Pyx_GOTREF(__pyx_t_7);
10094   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10095   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10096   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_etree, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10097   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10098
10099   /* "lxml/sax.py":56
10100  *     etree = property(_get_etree, doc=_get_etree.__doc__)
10101  * 
10102  *     def setDocumentLocator(self, locator):             # <<<<<<<<<<<<<<
10103  *         pass
10104  * 
10105  */
10106   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator, 0, __pyx_n_s_ElementTreeContentHandler_setDoc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error)
10107   __Pyx_GOTREF(__pyx_t_7);
10108   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_setDocumentLocator, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
10109   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10110
10111   /* "lxml/sax.py":59
10112  *         pass
10113  * 
10114  *     def startDocument(self):             # <<<<<<<<<<<<<<
10115  *         pass
10116  * 
10117  */
10118   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_7startDocument, 0, __pyx_n_s_ElementTreeContentHandler_startD, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error)
10119   __Pyx_GOTREF(__pyx_t_7);
10120   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startDocument, __pyx_t_7) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
10121   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10122
10123   /* "lxml/sax.py":62
10124  *         pass
10125  * 
10126  *     def endDocument(self):             # <<<<<<<<<<<<<<
10127  *         pass
10128  * 
10129  */
10130   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_9endDocument, 0, __pyx_n_s_ElementTreeContentHandler_endDoc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error)
10131   __Pyx_GOTREF(__pyx_t_7);
10132   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endDocument, __pyx_t_7) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
10133   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10134
10135   /* "lxml/sax.py":65
10136  *         pass
10137  * 
10138  *     def startPrefixMapping(self, prefix, uri):             # <<<<<<<<<<<<<<
10139  *         self._new_mappings[prefix] = uri
10140  *         try:
10141  */
10142   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping, 0, __pyx_n_s_ElementTreeContentHandler_startP, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error)
10143   __Pyx_GOTREF(__pyx_t_7);
10144   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
10145   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10146
10147   /* "lxml/sax.py":74
10148  *             self._default_ns = uri
10149  * 
10150  *     def endPrefixMapping(self, prefix):             # <<<<<<<<<<<<<<
10151  *         ns_uri_list = self._ns_mapping[prefix]
10152  *         ns_uri_list.pop()
10153  */
10154   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping, 0, __pyx_n_s_ElementTreeContentHandler_endPre, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
10155   __Pyx_GOTREF(__pyx_t_7);
10156   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
10157   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10158
10159   /* "lxml/sax.py":80
10160  *             self._default_ns = ns_uri_list[-1]
10161  * 
10162  *     def _buildTag(self, ns_name_tuple):             # <<<<<<<<<<<<<<
10163  *         ns_uri, local_name = ns_name_tuple
10164  *         if ns_uri:
10165  */
10166   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_15_buildTag, 0, __pyx_n_s_ElementTreeContentHandler__build, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 80, __pyx_L1_error)
10167   __Pyx_GOTREF(__pyx_t_7);
10168   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_buildTag, __pyx_t_7) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
10169   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10170
10171   /* "lxml/sax.py":90
10172  *         return el_tag
10173  * 
10174  *     def startElementNS(self, ns_name, qname, attributes=None):             # <<<<<<<<<<<<<<
10175  *         el_name = self._buildTag(ns_name)
10176  *         if attributes:
10177  */
10178   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_17startElementNS, 0, __pyx_n_s_ElementTreeContentHandler_startE, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
10179   __Pyx_GOTREF(__pyx_t_7);
10180   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__28);
10181   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
10182   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10183
10184   /* "lxml/sax.py":123
10185  *         self._new_mappings.clear()
10186  * 
10187  *     def processingInstruction(self, target, data):             # <<<<<<<<<<<<<<
10188  *         pi = ProcessingInstruction(target, data)
10189  *         if self._root is None:
10190  */
10191   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction, 0, __pyx_n_s_ElementTreeContentHandler_proces, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error)
10192   __Pyx_GOTREF(__pyx_t_7);
10193   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_processingInstruction, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
10194   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10195
10196   /* "lxml/sax.py":130
10197  *             self._element_stack[-1].append(pi)
10198  * 
10199  *     def endElementNS(self, ns_name, qname):             # <<<<<<<<<<<<<<
10200  *         element = self._element_stack.pop()
10201  *         el_tag = self._buildTag(ns_name)
10202  */
10203   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_21endElementNS, 0, __pyx_n_s_ElementTreeContentHandler_endEle, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 130, __pyx_L1_error)
10204   __Pyx_GOTREF(__pyx_t_7);
10205   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
10206   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10207
10208   /* "lxml/sax.py":136
10209  *             raise SaxError("Unexpected element closed: " + el_tag)
10210  * 
10211  *     def startElement(self, name, attributes=None):             # <<<<<<<<<<<<<<
10212  *         if attributes:
10213  *             attributes = dict(
10214  */
10215   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_23startElement, 0, __pyx_n_s_ElementTreeContentHandler_startE_2, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L1_error)
10216   __Pyx_GOTREF(__pyx_t_7);
10217   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__35);
10218   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElement, __pyx_t_7) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
10219   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10220
10221   /* "lxml/sax.py":143
10222  *         self.startElementNS((None, name), name, attributes)
10223  * 
10224  *     def endElement(self, name):             # <<<<<<<<<<<<<<
10225  *         self.endElementNS((None, name), name)
10226  * 
10227  */
10228   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_25endElement, 0, __pyx_n_s_ElementTreeContentHandler_endEle_2, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
10229   __Pyx_GOTREF(__pyx_t_7);
10230   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElement, __pyx_t_7) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
10231   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10232
10233   /* "lxml/sax.py":146
10234  *         self.endElementNS((None, name), name)
10235  * 
10236  *     def characters(self, data):             # <<<<<<<<<<<<<<
10237  *         last_element = self._element_stack[-1]
10238  *         try:
10239  */
10240   __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_27characters, 0, __pyx_n_s_ElementTreeContentHandler_charac, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
10241   __Pyx_GOTREF(__pyx_t_7);
10242   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_characters, __pyx_t_7) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
10243   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10244
10245   /* "lxml/sax.py":156
10246  *             last_element.text = (last_element.text or '') + data
10247  * 
10248  *     ignorableWhitespace = characters             # <<<<<<<<<<<<<<
10249  * 
10250  * 
10251  */
10252   __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_characters);
10253   if (unlikely(!__pyx_t_7)) {
10254     PyErr_Clear();
10255     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_characters);
10256   }
10257   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error)
10258   __Pyx_GOTREF(__pyx_t_7);
10259   if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ignorableWhitespace, __pyx_t_7) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
10260   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10261
10262   /* "lxml/sax.py":35
10263  * 
10264  * 
10265  * class ElementTreeContentHandler(ContentHandler):             # <<<<<<<<<<<<<<
10266  *     """Build an lxml ElementTree from SAX events.
10267  *     """
10268  */
10269   __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ElementTreeContentHandler, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error)
10270   __Pyx_GOTREF(__pyx_t_7);
10271   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTreeContentHandler, __pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
10272   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10273   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10274   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10275   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10276
10277   /* "lxml/sax.py":173
10278  *         self._empty_attributes = attr_class({}, {})
10279  * 
10280  *     def saxify(self):             # <<<<<<<<<<<<<<
10281  *         self._content_handler.startDocument()
10282  * 
10283  */
10284   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_3saxify, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer_saxify, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
10285   __Pyx_GOTREF(__pyx_t_2);
10286   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_saxify, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
10287   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10288   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10289
10290   /* "(tree fragment)":1
10291  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10292  *     cdef tuple state
10293  *     cdef object _dict
10294  */
10295   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer___reduce_cyt, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
10296   __Pyx_GOTREF(__pyx_t_2);
10297   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10298   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10299   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10300
10301   /* "(tree fragment)":16
10302  *     else:
10303  *         return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
10304  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10305  *     __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
10306  */
10307   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementTreeProducer___setstate_c, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error)
10308   __Pyx_GOTREF(__pyx_t_2);
10309   if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_3sax_ElementTreeProducer->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error)
10310   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10311   PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10312
10313   /* "lxml/sax.py":274
10314  * 
10315  * 
10316  * def saxify(element_or_tree, content_handler):             # <<<<<<<<<<<<<<
10317  *     """One-shot helper to generate SAX events from an XML tree and fire
10318  *     them against a SAX ContentHandler.
10319  */
10320   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_1saxify, 0, __pyx_n_s_saxify, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
10321   __Pyx_GOTREF(__pyx_t_2);
10322   if (PyDict_SetItem(__pyx_d, __pyx_n_s_saxify, __pyx_t_2) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
10323   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10324
10325   /* "(tree fragment)":1
10326  * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10327  *     cdef object __pyx_PickleError
10328  *     cdef object __pyx_result
10329  */
10330   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer, 0, __pyx_n_s_pyx_unpickle_ElementTreeProduc, NULL, __pyx_n_s_lxml_sax, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
10331   __Pyx_GOTREF(__pyx_t_2);
10332   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10333   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10334
10335   /* "lxml/sax.py":1
10336  * # cython: language_level=2             # <<<<<<<<<<<<<<
10337  * 
10338  * """
10339  */
10340   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
10341   __Pyx_GOTREF(__pyx_t_2);
10342   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10343   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10344
10345   /*--- Wrapped vars code ---*/
10346
10347   if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
10348   goto __pyx_L0;
10349   __pyx_L1_error:;
10350   __Pyx_XDECREF(__pyx_t_1);
10351   __Pyx_XDECREF(__pyx_t_2);
10352   __Pyx_XDECREF(__pyx_t_3);
10353   __Pyx_XDECREF(__pyx_t_4);
10354   __Pyx_XDECREF(__pyx_t_5);
10355   __Pyx_XDECREF(__pyx_t_6);
10356   __Pyx_XDECREF(__pyx_t_7);
10357   if (__pyx_m) {
10358     if (__pyx_d) {
10359       __Pyx_AddTraceback("init lxml.sax", __pyx_clineno, __pyx_lineno, __pyx_filename);
10360     }
10361     Py_CLEAR(__pyx_m);
10362   } else if (!PyErr_Occurred()) {
10363     PyErr_SetString(PyExc_ImportError, "init lxml.sax");
10364   }
10365   __pyx_L0:;
10366   __Pyx_RefNannyFinishContext();
10367   #if CYTHON_PEP489_MULTI_PHASE_INIT
10368   return (__pyx_m != NULL) ? 0 : -1;
10369   #elif PY_MAJOR_VERSION >= 3
10370   return __pyx_m;
10371   #else
10372   return;
10373   #endif
10374 }
10375
10376 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
10377   Py_CLEAR(__pyx_slice__2);
10378   Py_CLEAR(__pyx_tuple__4);
10379   Py_CLEAR(__pyx_slice__5);
10380   Py_CLEAR(__pyx_slice__7);
10381   Py_CLEAR(__pyx_tuple__9);
10382   Py_CLEAR(__pyx_codeobj__10);
10383   Py_CLEAR(__pyx_tuple__11);
10384   Py_CLEAR(__pyx_tuple__12);
10385   Py_CLEAR(__pyx_codeobj__13);
10386   Py_CLEAR(__pyx_tuple__14);
10387   Py_CLEAR(__pyx_codeobj__15);
10388   Py_CLEAR(__pyx_tuple__16);
10389   Py_CLEAR(__pyx_codeobj__17);
10390   Py_CLEAR(__pyx_tuple__18);
10391   Py_CLEAR(__pyx_codeobj__19);
10392   Py_CLEAR(__pyx_tuple__20);
10393   Py_CLEAR(__pyx_codeobj__21);
10394   Py_CLEAR(__pyx_tuple__22);
10395   Py_CLEAR(__pyx_codeobj__23);
10396   Py_CLEAR(__pyx_tuple__24);
10397   Py_CLEAR(__pyx_codeobj__25);
10398   Py_CLEAR(__pyx_tuple__26);
10399   Py_CLEAR(__pyx_codeobj__27);
10400   Py_CLEAR(__pyx_tuple__28);
10401   Py_CLEAR(__pyx_tuple__29);
10402   Py_CLEAR(__pyx_codeobj__30);
10403   Py_CLEAR(__pyx_tuple__31);
10404   Py_CLEAR(__pyx_codeobj__32);
10405   Py_CLEAR(__pyx_tuple__33);
10406   Py_CLEAR(__pyx_codeobj__34);
10407   Py_CLEAR(__pyx_tuple__35);
10408   Py_CLEAR(__pyx_tuple__36);
10409   Py_CLEAR(__pyx_codeobj__37);
10410   Py_CLEAR(__pyx_tuple__38);
10411   Py_CLEAR(__pyx_codeobj__39);
10412   Py_CLEAR(__pyx_tuple__40);
10413   Py_CLEAR(__pyx_codeobj__41);
10414   Py_CLEAR(__pyx_tuple__42);
10415   Py_CLEAR(__pyx_codeobj__43);
10416   Py_CLEAR(__pyx_tuple__44);
10417   Py_CLEAR(__pyx_codeobj__45);
10418   Py_CLEAR(__pyx_tuple__46);
10419   Py_CLEAR(__pyx_codeobj__47);
10420   Py_CLEAR(__pyx_tuple__48);
10421   Py_CLEAR(__pyx_codeobj__49);
10422   /* CodeObjectCache.cleanup */
10423   if (__pyx_code_cache.entries) {
10424       __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10425       int i, count = __pyx_code_cache.count;
10426       __pyx_code_cache.count = 0;
10427       __pyx_code_cache.max_count = 0;
10428       __pyx_code_cache.entries = NULL;
10429       for (i=0; i<count; i++) {
10430           Py_DECREF(entries[i].code_object);
10431       }
10432       PyMem_Free(entries);
10433   }
10434
10435 Py_CLEAR(__pyx_umethod_PyDict_Type_get.method);
10436   Py_CLEAR(__pyx_umethod_PyDict_Type_items.method);
10437   Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
10438 }
10439 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
10440   /*--- Global cleanup code ---*/
10441   __Pyx_CleanupGlobals();
10442   /*--- Type import cleanup code ---*/
10443   /*--- Builtin cleanup code ---*/
10444   Py_CLEAR(__pyx_builtin_property);
10445   Py_CLEAR(__pyx_builtin_KeyError);
10446   Py_CLEAR(__pyx_builtin_AttributeError);
10447   Py_CLEAR(__pyx_builtin_IndexError);
10448   Py_CLEAR(__pyx_builtin_min);
10449   /*--- Intern cleanup code ---*/
10450   Py_CLEAR(__pyx_empty_tuple);
10451   Py_CLEAR(__pyx_d);
10452   Py_CLEAR(__pyx_cython_runtime);
10453   Py_CLEAR(__pyx_b);
10454 }
10455
10456 /* --- Runtime support code --- */
10457 /* Refnanny */
10458 #if CYTHON_REFNANNY
10459 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10460     PyObject *m = NULL, *p = NULL;
10461     void *r = NULL;
10462     m = PyImport_ImportModule(modname);
10463     if (!m) goto end;
10464     p = PyObject_GetAttrString(m, "RefNannyAPI");
10465     if (!p) goto end;
10466     r = PyLong_AsVoidPtr(p);
10467 end:
10468     Py_XDECREF(p);
10469     Py_XDECREF(m);
10470     return (__Pyx_RefNannyAPIStruct *)r;
10471 }
10472 #endif
10473
10474 /* PyObjectGetAttrStr */
10475 #if CYTHON_USE_TYPE_SLOTS
10476 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
10477     PyTypeObject* tp = Py_TYPE(obj);
10478     if (likely(tp->tp_getattro))
10479         return tp->tp_getattro(obj, attr_name);
10480 #if PY_MAJOR_VERSION < 3
10481     if (likely(tp->tp_getattr))
10482         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
10483 #endif
10484     return PyObject_GetAttr(obj, attr_name);
10485 }
10486 #endif
10487
10488 /* GetBuiltinName */
10489 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
10490     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
10491     if (unlikely(!result)) {
10492         PyErr_Format(PyExc_NameError,
10493 #if PY_MAJOR_VERSION >= 3
10494             "name '%U' is not defined", name);
10495 #else
10496             "name '%.200s' is not defined", PyString_AS_STRING(name));
10497 #endif
10498     }
10499     return result;
10500 }
10501
10502 /* GetItemInt */
10503 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
10504     PyObject *r;
10505     if (!j) return NULL;
10506     r = PyObject_GetItem(o, j);
10507     Py_DECREF(j);
10508     return r;
10509 }
10510 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
10511                                                               CYTHON_NCP_UNUSED int wraparound,
10512                                                               CYTHON_NCP_UNUSED int boundscheck) {
10513 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10514     Py_ssize_t wrapped_i = i;
10515     if (wraparound & unlikely(i < 0)) {
10516         wrapped_i += PyList_GET_SIZE(o);
10517     }
10518     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
10519         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
10520         Py_INCREF(r);
10521         return r;
10522     }
10523     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10524 #else
10525     return PySequence_GetItem(o, i);
10526 #endif
10527 }
10528 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
10529                                                               CYTHON_NCP_UNUSED int wraparound,
10530                                                               CYTHON_NCP_UNUSED int boundscheck) {
10531 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10532     Py_ssize_t wrapped_i = i;
10533     if (wraparound & unlikely(i < 0)) {
10534         wrapped_i += PyTuple_GET_SIZE(o);
10535     }
10536     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
10537         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
10538         Py_INCREF(r);
10539         return r;
10540     }
10541     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10542 #else
10543     return PySequence_GetItem(o, i);
10544 #endif
10545 }
10546 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
10547                                                      CYTHON_NCP_UNUSED int wraparound,
10548                                                      CYTHON_NCP_UNUSED int boundscheck) {
10549 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
10550     if (is_list || PyList_CheckExact(o)) {
10551         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
10552         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
10553             PyObject *r = PyList_GET_ITEM(o, n);
10554             Py_INCREF(r);
10555             return r;
10556         }
10557     }
10558     else if (PyTuple_CheckExact(o)) {
10559         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
10560         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
10561             PyObject *r = PyTuple_GET_ITEM(o, n);
10562             Py_INCREF(r);
10563             return r;
10564         }
10565     } else {
10566         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
10567         if (likely(m && m->sq_item)) {
10568             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
10569                 Py_ssize_t l = m->sq_length(o);
10570                 if (likely(l >= 0)) {
10571                     i += l;
10572                 } else {
10573                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10574                         return NULL;
10575                     PyErr_Clear();
10576                 }
10577             }
10578             return m->sq_item(o, i);
10579         }
10580     }
10581 #else
10582     if (is_list || PySequence_Check(o)) {
10583         return PySequence_GetItem(o, i);
10584     }
10585 #endif
10586     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10587 }
10588
10589 /* BytesEquals */
10590 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10591 #if CYTHON_COMPILING_IN_PYPY
10592     return PyObject_RichCompareBool(s1, s2, equals);
10593 #else
10594     if (s1 == s2) {
10595         return (equals == Py_EQ);
10596     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10597         const char *ps1, *ps2;
10598         Py_ssize_t length = PyBytes_GET_SIZE(s1);
10599         if (length != PyBytes_GET_SIZE(s2))
10600             return (equals == Py_NE);
10601         ps1 = PyBytes_AS_STRING(s1);
10602         ps2 = PyBytes_AS_STRING(s2);
10603         if (ps1[0] != ps2[0]) {
10604             return (equals == Py_NE);
10605         } else if (length == 1) {
10606             return (equals == Py_EQ);
10607         } else {
10608             int result;
10609 #if CYTHON_USE_UNICODE_INTERNALS
10610             Py_hash_t hash1, hash2;
10611             hash1 = ((PyBytesObject*)s1)->ob_shash;
10612             hash2 = ((PyBytesObject*)s2)->ob_shash;
10613             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10614                 return (equals == Py_NE);
10615             }
10616 #endif
10617             result = memcmp(ps1, ps2, (size_t)length);
10618             return (equals == Py_EQ) ? (result == 0) : (result != 0);
10619         }
10620     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10621         return (equals == Py_NE);
10622     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10623         return (equals == Py_NE);
10624     } else {
10625         int result;
10626         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10627         if (!py_result)
10628             return -1;
10629         result = __Pyx_PyObject_IsTrue(py_result);
10630         Py_DECREF(py_result);
10631         return result;
10632     }
10633 #endif
10634 }
10635
10636 /* UnicodeEquals */
10637 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10638 #if CYTHON_COMPILING_IN_PYPY
10639     return PyObject_RichCompareBool(s1, s2, equals);
10640 #else
10641 #if PY_MAJOR_VERSION < 3
10642     PyObject* owned_ref = NULL;
10643 #endif
10644     int s1_is_unicode, s2_is_unicode;
10645     if (s1 == s2) {
10646         goto return_eq;
10647     }
10648     s1_is_unicode = PyUnicode_CheckExact(s1);
10649     s2_is_unicode = PyUnicode_CheckExact(s2);
10650 #if PY_MAJOR_VERSION < 3
10651     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10652         owned_ref = PyUnicode_FromObject(s2);
10653         if (unlikely(!owned_ref))
10654             return -1;
10655         s2 = owned_ref;
10656         s2_is_unicode = 1;
10657     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10658         owned_ref = PyUnicode_FromObject(s1);
10659         if (unlikely(!owned_ref))
10660             return -1;
10661         s1 = owned_ref;
10662         s1_is_unicode = 1;
10663     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10664         return __Pyx_PyBytes_Equals(s1, s2, equals);
10665     }
10666 #endif
10667     if (s1_is_unicode & s2_is_unicode) {
10668         Py_ssize_t length;
10669         int kind;
10670         void *data1, *data2;
10671         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10672             return -1;
10673         length = __Pyx_PyUnicode_GET_LENGTH(s1);
10674         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10675             goto return_ne;
10676         }
10677 #if CYTHON_USE_UNICODE_INTERNALS
10678         {
10679             Py_hash_t hash1, hash2;
10680         #if CYTHON_PEP393_ENABLED
10681             hash1 = ((PyASCIIObject*)s1)->hash;
10682             hash2 = ((PyASCIIObject*)s2)->hash;
10683         #else
10684             hash1 = ((PyUnicodeObject*)s1)->hash;
10685             hash2 = ((PyUnicodeObject*)s2)->hash;
10686         #endif
10687             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10688                 goto return_ne;
10689             }
10690         }
10691 #endif
10692         kind = __Pyx_PyUnicode_KIND(s1);
10693         if (kind != __Pyx_PyUnicode_KIND(s2)) {
10694             goto return_ne;
10695         }
10696         data1 = __Pyx_PyUnicode_DATA(s1);
10697         data2 = __Pyx_PyUnicode_DATA(s2);
10698         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
10699             goto return_ne;
10700         } else if (length == 1) {
10701             goto return_eq;
10702         } else {
10703             int result = memcmp(data1, data2, (size_t)(length * kind));
10704             #if PY_MAJOR_VERSION < 3
10705             Py_XDECREF(owned_ref);
10706             #endif
10707             return (equals == Py_EQ) ? (result == 0) : (result != 0);
10708         }
10709     } else if ((s1 == Py_None) & s2_is_unicode) {
10710         goto return_ne;
10711     } else if ((s2 == Py_None) & s1_is_unicode) {
10712         goto return_ne;
10713     } else {
10714         int result;
10715         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10716         #if PY_MAJOR_VERSION < 3
10717         Py_XDECREF(owned_ref);
10718         #endif
10719         if (!py_result)
10720             return -1;
10721         result = __Pyx_PyObject_IsTrue(py_result);
10722         Py_DECREF(py_result);
10723         return result;
10724     }
10725 return_eq:
10726     #if PY_MAJOR_VERSION < 3
10727     Py_XDECREF(owned_ref);
10728     #endif
10729     return (equals == Py_EQ);
10730 return_ne:
10731     #if PY_MAJOR_VERSION < 3
10732     Py_XDECREF(owned_ref);
10733     #endif
10734     return (equals == Py_NE);
10735 #endif
10736 }
10737
10738 /* SliceObject */
10739 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
10740         Py_ssize_t cstart, Py_ssize_t cstop,
10741         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
10742         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
10743 #if CYTHON_USE_TYPE_SLOTS
10744     PyMappingMethods* mp;
10745 #if PY_MAJOR_VERSION < 3
10746     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
10747     if (likely(ms && ms->sq_slice)) {
10748         if (!has_cstart) {
10749             if (_py_start && (*_py_start != Py_None)) {
10750                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
10751                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10752             } else
10753                 cstart = 0;
10754         }
10755         if (!has_cstop) {
10756             if (_py_stop && (*_py_stop != Py_None)) {
10757                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
10758                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10759             } else
10760                 cstop = PY_SSIZE_T_MAX;
10761         }
10762         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
10763             Py_ssize_t l = ms->sq_length(obj);
10764             if (likely(l >= 0)) {
10765                 if (cstop < 0) {
10766                     cstop += l;
10767                     if (cstop < 0) cstop = 0;
10768                 }
10769                 if (cstart < 0) {
10770                     cstart += l;
10771                     if (cstart < 0) cstart = 0;
10772                 }
10773             } else {
10774                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10775                     goto bad;
10776                 PyErr_Clear();
10777             }
10778         }
10779         return ms->sq_slice(obj, cstart, cstop);
10780     }
10781 #endif
10782     mp = Py_TYPE(obj)->tp_as_mapping;
10783     if (likely(mp && mp->mp_subscript))
10784 #endif
10785     {
10786         PyObject* result;
10787         PyObject *py_slice, *py_start, *py_stop;
10788         if (_py_slice) {
10789             py_slice = *_py_slice;
10790         } else {
10791             PyObject* owned_start = NULL;
10792             PyObject* owned_stop = NULL;
10793             if (_py_start) {
10794                 py_start = *_py_start;
10795             } else {
10796                 if (has_cstart) {
10797                     owned_start = py_start = PyInt_FromSsize_t(cstart);
10798                     if (unlikely(!py_start)) goto bad;
10799                 } else
10800                     py_start = Py_None;
10801             }
10802             if (_py_stop) {
10803                 py_stop = *_py_stop;
10804             } else {
10805                 if (has_cstop) {
10806                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
10807                     if (unlikely(!py_stop)) {
10808                         Py_XDECREF(owned_start);
10809                         goto bad;
10810                     }
10811                 } else
10812                     py_stop = Py_None;
10813             }
10814             py_slice = PySlice_New(py_start, py_stop, Py_None);
10815             Py_XDECREF(owned_start);
10816             Py_XDECREF(owned_stop);
10817             if (unlikely(!py_slice)) goto bad;
10818         }
10819 #if CYTHON_USE_TYPE_SLOTS
10820         result = mp->mp_subscript(obj, py_slice);
10821 #else
10822         result = PyObject_GetItem(obj, py_slice);
10823 #endif
10824         if (!_py_slice) {
10825             Py_DECREF(py_slice);
10826         }
10827         return result;
10828     }
10829     PyErr_Format(PyExc_TypeError,
10830         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
10831 bad:
10832     return NULL;
10833 }
10834
10835 /* PyObjectCall */
10836 #if CYTHON_COMPILING_IN_CPYTHON
10837 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
10838     PyObject *result;
10839     ternaryfunc call = func->ob_type->tp_call;
10840     if (unlikely(!call))
10841         return PyObject_Call(func, arg, kw);
10842     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
10843         return NULL;
10844     result = (*call)(func, arg, kw);
10845     Py_LeaveRecursiveCall();
10846     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10847         PyErr_SetString(
10848             PyExc_SystemError,
10849             "NULL result without error in PyObject_Call");
10850     }
10851     return result;
10852 }
10853 #endif
10854
10855 /* RaiseDoubleKeywords */
10856 static void __Pyx_RaiseDoubleKeywordsError(
10857     const char* func_name,
10858     PyObject* kw_name)
10859 {
10860     PyErr_Format(PyExc_TypeError,
10861         #if PY_MAJOR_VERSION >= 3
10862         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
10863         #else
10864         "%s() got multiple values for keyword argument '%s'", func_name,
10865         PyString_AsString(kw_name));
10866         #endif
10867 }
10868
10869 /* ParseKeywords */
10870 static int __Pyx_ParseOptionalKeywords(
10871     PyObject *kwds,
10872     PyObject **argnames[],
10873     PyObject *kwds2,
10874     PyObject *values[],
10875     Py_ssize_t num_pos_args,
10876     const char* function_name)
10877 {
10878     PyObject *key = 0, *value = 0;
10879     Py_ssize_t pos = 0;
10880     PyObject*** name;
10881     PyObject*** first_kw_arg = argnames + num_pos_args;
10882     while (PyDict_Next(kwds, &pos, &key, &value)) {
10883         name = first_kw_arg;
10884         while (*name && (**name != key)) name++;
10885         if (*name) {
10886             values[name-argnames] = value;
10887             continue;
10888         }
10889         name = first_kw_arg;
10890         #if PY_MAJOR_VERSION < 3
10891         if (likely(PyString_Check(key))) {
10892             while (*name) {
10893                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
10894                         && _PyString_Eq(**name, key)) {
10895                     values[name-argnames] = value;
10896                     break;
10897                 }
10898                 name++;
10899             }
10900             if (*name) continue;
10901             else {
10902                 PyObject*** argname = argnames;
10903                 while (argname != first_kw_arg) {
10904                     if ((**argname == key) || (
10905                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
10906                              && _PyString_Eq(**argname, key))) {
10907                         goto arg_passed_twice;
10908                     }
10909                     argname++;
10910                 }
10911             }
10912         } else
10913         #endif
10914         if (likely(PyUnicode_Check(key))) {
10915             while (*name) {
10916                 int cmp = (**name == key) ? 0 :
10917                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10918                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10919                 #endif
10920                     PyUnicode_Compare(**name, key);
10921                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10922                 if (cmp == 0) {
10923                     values[name-argnames] = value;
10924                     break;
10925                 }
10926                 name++;
10927             }
10928             if (*name) continue;
10929             else {
10930                 PyObject*** argname = argnames;
10931                 while (argname != first_kw_arg) {
10932                     int cmp = (**argname == key) ? 0 :
10933                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10934                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10935                     #endif
10936                         PyUnicode_Compare(**argname, key);
10937                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10938                     if (cmp == 0) goto arg_passed_twice;
10939                     argname++;
10940                 }
10941             }
10942         } else
10943             goto invalid_keyword_type;
10944         if (kwds2) {
10945             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10946         } else {
10947             goto invalid_keyword;
10948         }
10949     }
10950     return 0;
10951 arg_passed_twice:
10952     __Pyx_RaiseDoubleKeywordsError(function_name, key);
10953     goto bad;
10954 invalid_keyword_type:
10955     PyErr_Format(PyExc_TypeError,
10956         "%.200s() keywords must be strings", function_name);
10957     goto bad;
10958 invalid_keyword:
10959     PyErr_Format(PyExc_TypeError,
10960     #if PY_MAJOR_VERSION < 3
10961         "%.200s() got an unexpected keyword argument '%.200s'",
10962         function_name, PyString_AsString(key));
10963     #else
10964         "%s() got an unexpected keyword argument '%U'",
10965         function_name, key);
10966     #endif
10967 bad:
10968     return -1;
10969 }
10970
10971 /* RaiseArgTupleInvalid */
10972 static void __Pyx_RaiseArgtupleInvalid(
10973     const char* func_name,
10974     int exact,
10975     Py_ssize_t num_min,
10976     Py_ssize_t num_max,
10977     Py_ssize_t num_found)
10978 {
10979     Py_ssize_t num_expected;
10980     const char *more_or_less;
10981     if (num_found < num_min) {
10982         num_expected = num_min;
10983         more_or_less = "at least";
10984     } else {
10985         num_expected = num_max;
10986         more_or_less = "at most";
10987     }
10988     if (exact) {
10989         more_or_less = "exactly";
10990     }
10991     PyErr_Format(PyExc_TypeError,
10992                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
10993                  func_name, more_or_less, num_expected,
10994                  (num_expected == 1) ? "" : "s", num_found);
10995 }
10996
10997 /* PyDictVersioning */
10998 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
10999 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
11000     PyObject *dict = Py_TYPE(obj)->tp_dict;
11001     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
11002 }
11003 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
11004     PyObject **dictptr = NULL;
11005     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
11006     if (offset) {
11007 #if CYTHON_COMPILING_IN_CPYTHON
11008         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
11009 #else
11010         dictptr = _PyObject_GetDictPtr(obj);
11011 #endif
11012     }
11013     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
11014 }
11015 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
11016     PyObject *dict = Py_TYPE(obj)->tp_dict;
11017     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
11018         return 0;
11019     return obj_dict_version == __Pyx_get_object_dict_version(obj);
11020 }
11021 #endif
11022
11023 /* GetModuleGlobalName */
11024 #if CYTHON_USE_DICT_VERSIONS
11025 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11026 #else
11027 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
11028 #endif
11029 {
11030     PyObject *result;
11031 #if !CYTHON_AVOID_BORROWED_REFS
11032 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
11033     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
11034     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11035     if (likely(result)) {
11036         return __Pyx_NewRef(result);
11037     } else if (unlikely(PyErr_Occurred())) {
11038         return NULL;
11039     }
11040 #else
11041     result = PyDict_GetItem(__pyx_d, name);
11042     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11043     if (likely(result)) {
11044         return __Pyx_NewRef(result);
11045     }
11046 #endif
11047 #else
11048     result = PyObject_GetItem(__pyx_d, name);
11049     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11050     if (likely(result)) {
11051         return __Pyx_NewRef(result);
11052     }
11053     PyErr_Clear();
11054 #endif
11055     return __Pyx_GetBuiltinName(name);
11056 }
11057
11058 /* PyCFunctionFastCall */
11059 #if CYTHON_FAST_PYCCALL
11060 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
11061     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
11062     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
11063     PyObject *self = PyCFunction_GET_SELF(func);
11064     int flags = PyCFunction_GET_FLAGS(func);
11065     assert(PyCFunction_Check(func));
11066     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
11067     assert(nargs >= 0);
11068     assert(nargs == 0 || args != NULL);
11069     /* _PyCFunction_FastCallDict() must not be called with an exception set,
11070        because it may clear it (directly or indirectly) and so the
11071        caller loses its exception */
11072     assert(!PyErr_Occurred());
11073     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
11074         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
11075     } else {
11076         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
11077     }
11078 }
11079 #endif
11080
11081 /* PyFunctionFastCall */
11082 #if CYTHON_FAST_PYCALL
11083 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11084                                                PyObject *globals) {
11085     PyFrameObject *f;
11086     PyThreadState *tstate = __Pyx_PyThreadState_Current;
11087     PyObject **fastlocals;
11088     Py_ssize_t i;
11089     PyObject *result;
11090     assert(globals != NULL);
11091     /* XXX Perhaps we should create a specialized
11092        PyFrame_New() that doesn't take locals, but does
11093        take builtins without sanity checking them.
11094        */
11095     assert(tstate != NULL);
11096     f = PyFrame_New(tstate, co, globals, NULL);
11097     if (f == NULL) {
11098         return NULL;
11099     }
11100     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11101     for (i = 0; i < na; i++) {
11102         Py_INCREF(*args);
11103         fastlocals[i] = *args++;
11104     }
11105     result = PyEval_EvalFrameEx(f,0);
11106     ++tstate->recursion_depth;
11107     Py_DECREF(f);
11108     --tstate->recursion_depth;
11109     return result;
11110 }
11111 #if 1 || PY_VERSION_HEX < 0x030600B1
11112 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11113     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11114     PyObject *globals = PyFunction_GET_GLOBALS(func);
11115     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11116     PyObject *closure;
11117 #if PY_MAJOR_VERSION >= 3
11118     PyObject *kwdefs;
11119 #endif
11120     PyObject *kwtuple, **k;
11121     PyObject **d;
11122     Py_ssize_t nd;
11123     Py_ssize_t nk;
11124     PyObject *result;
11125     assert(kwargs == NULL || PyDict_Check(kwargs));
11126     nk = kwargs ? PyDict_Size(kwargs) : 0;
11127     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
11128         return NULL;
11129     }
11130     if (
11131 #if PY_MAJOR_VERSION >= 3
11132             co->co_kwonlyargcount == 0 &&
11133 #endif
11134             likely(kwargs == NULL || nk == 0) &&
11135             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11136         if (argdefs == NULL && co->co_argcount == nargs) {
11137             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11138             goto done;
11139         }
11140         else if (nargs == 0 && argdefs != NULL
11141                  && co->co_argcount == Py_SIZE(argdefs)) {
11142             /* function called with no arguments, but all parameters have
11143                a default value: use default values as arguments .*/
11144             args = &PyTuple_GET_ITEM(argdefs, 0);
11145             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11146             goto done;
11147         }
11148     }
11149     if (kwargs != NULL) {
11150         Py_ssize_t pos, i;
11151         kwtuple = PyTuple_New(2 * nk);
11152         if (kwtuple == NULL) {
11153             result = NULL;
11154             goto done;
11155         }
11156         k = &PyTuple_GET_ITEM(kwtuple, 0);
11157         pos = i = 0;
11158         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11159             Py_INCREF(k[i]);
11160             Py_INCREF(k[i+1]);
11161             i += 2;
11162         }
11163         nk = i / 2;
11164     }
11165     else {
11166         kwtuple = NULL;
11167         k = NULL;
11168     }
11169     closure = PyFunction_GET_CLOSURE(func);
11170 #if PY_MAJOR_VERSION >= 3
11171     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11172 #endif
11173     if (argdefs != NULL) {
11174         d = &PyTuple_GET_ITEM(argdefs, 0);
11175         nd = Py_SIZE(argdefs);
11176     }
11177     else {
11178         d = NULL;
11179         nd = 0;
11180     }
11181 #if PY_MAJOR_VERSION >= 3
11182     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11183                                args, (int)nargs,
11184                                k, (int)nk,
11185                                d, (int)nd, kwdefs, closure);
11186 #else
11187     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11188                                args, (int)nargs,
11189                                k, (int)nk,
11190                                d, (int)nd, closure);
11191 #endif
11192     Py_XDECREF(kwtuple);
11193 done:
11194     Py_LeaveRecursiveCall();
11195     return result;
11196 }
11197 #endif
11198 #endif
11199
11200 /* PyObjectCall2Args */
11201 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
11202     PyObject *args, *result = NULL;
11203     #if CYTHON_FAST_PYCALL
11204     if (PyFunction_Check(function)) {
11205         PyObject *args[2] = {arg1, arg2};
11206         return __Pyx_PyFunction_FastCall(function, args, 2);
11207     }
11208     #endif
11209     #if CYTHON_FAST_PYCCALL
11210     if (__Pyx_PyFastCFunction_Check(function)) {
11211         PyObject *args[2] = {arg1, arg2};
11212         return __Pyx_PyCFunction_FastCall(function, args, 2);
11213     }
11214     #endif
11215     args = PyTuple_New(2);
11216     if (unlikely(!args)) goto done;
11217     Py_INCREF(arg1);
11218     PyTuple_SET_ITEM(args, 0, arg1);
11219     Py_INCREF(arg2);
11220     PyTuple_SET_ITEM(args, 1, arg2);
11221     Py_INCREF(function);
11222     result = __Pyx_PyObject_Call(function, args, NULL);
11223     Py_DECREF(args);
11224     Py_DECREF(function);
11225 done:
11226     return result;
11227 }
11228
11229 /* PyObjectCallMethO */
11230 #if CYTHON_COMPILING_IN_CPYTHON
11231 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11232     PyObject *self, *result;
11233     PyCFunction cfunc;
11234     cfunc = PyCFunction_GET_FUNCTION(func);
11235     self = PyCFunction_GET_SELF(func);
11236     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11237         return NULL;
11238     result = cfunc(self, arg);
11239     Py_LeaveRecursiveCall();
11240     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11241         PyErr_SetString(
11242             PyExc_SystemError,
11243             "NULL result without error in PyObject_Call");
11244     }
11245     return result;
11246 }
11247 #endif
11248
11249 /* PyObjectCallOneArg */
11250 #if CYTHON_COMPILING_IN_CPYTHON
11251 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11252     PyObject *result;
11253     PyObject *args = PyTuple_New(1);
11254     if (unlikely(!args)) return NULL;
11255     Py_INCREF(arg);
11256     PyTuple_SET_ITEM(args, 0, arg);
11257     result = __Pyx_PyObject_Call(func, args, NULL);
11258     Py_DECREF(args);
11259     return result;
11260 }
11261 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11262 #if CYTHON_FAST_PYCALL
11263     if (PyFunction_Check(func)) {
11264         return __Pyx_PyFunction_FastCall(func, &arg, 1);
11265     }
11266 #endif
11267     if (likely(PyCFunction_Check(func))) {
11268         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
11269             return __Pyx_PyObject_CallMethO(func, arg);
11270 #if CYTHON_FAST_PYCCALL
11271         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
11272             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
11273 #endif
11274         }
11275     }
11276     return __Pyx__PyObject_CallOneArg(func, arg);
11277 }
11278 #else
11279 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11280     PyObject *result;
11281     PyObject *args = PyTuple_Pack(1, arg);
11282     if (unlikely(!args)) return NULL;
11283     result = __Pyx_PyObject_Call(func, args, NULL);
11284     Py_DECREF(args);
11285     return result;
11286 }
11287 #endif
11288
11289 /* PyObjectSetAttrStr */
11290 #if CYTHON_USE_TYPE_SLOTS
11291 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
11292     PyTypeObject* tp = Py_TYPE(obj);
11293     if (likely(tp->tp_setattro))
11294         return tp->tp_setattro(obj, attr_name, value);
11295 #if PY_MAJOR_VERSION < 3
11296     if (likely(tp->tp_setattr))
11297         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
11298 #endif
11299     return PyObject_SetAttr(obj, attr_name, value);
11300 }
11301 #endif
11302
11303 /* PyObjectGetMethod */
11304 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
11305     PyObject *attr;
11306 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
11307     PyTypeObject *tp = Py_TYPE(obj);
11308     PyObject *descr;
11309     descrgetfunc f = NULL;
11310     PyObject **dictptr, *dict;
11311     int meth_found = 0;
11312     assert (*method == NULL);
11313     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
11314         attr = __Pyx_PyObject_GetAttrStr(obj, name);
11315         goto try_unpack;
11316     }
11317     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
11318         return 0;
11319     }
11320     descr = _PyType_Lookup(tp, name);
11321     if (likely(descr != NULL)) {
11322         Py_INCREF(descr);
11323 #if PY_MAJOR_VERSION >= 3
11324         #ifdef __Pyx_CyFunction_USED
11325         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
11326         #else
11327         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
11328         #endif
11329 #else
11330         #ifdef __Pyx_CyFunction_USED
11331         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
11332         #else
11333         if (likely(PyFunction_Check(descr)))
11334         #endif
11335 #endif
11336         {
11337             meth_found = 1;
11338         } else {
11339             f = Py_TYPE(descr)->tp_descr_get;
11340             if (f != NULL && PyDescr_IsData(descr)) {
11341                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11342                 Py_DECREF(descr);
11343                 goto try_unpack;
11344             }
11345         }
11346     }
11347     dictptr = _PyObject_GetDictPtr(obj);
11348     if (dictptr != NULL && (dict = *dictptr) != NULL) {
11349         Py_INCREF(dict);
11350         attr = __Pyx_PyDict_GetItemStr(dict, name);
11351         if (attr != NULL) {
11352             Py_INCREF(attr);
11353             Py_DECREF(dict);
11354             Py_XDECREF(descr);
11355             goto try_unpack;
11356         }
11357         Py_DECREF(dict);
11358     }
11359     if (meth_found) {
11360         *method = descr;
11361         return 1;
11362     }
11363     if (f != NULL) {
11364         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11365         Py_DECREF(descr);
11366         goto try_unpack;
11367     }
11368     if (descr != NULL) {
11369         *method = descr;
11370         return 0;
11371     }
11372     PyErr_Format(PyExc_AttributeError,
11373 #if PY_MAJOR_VERSION >= 3
11374                  "'%.50s' object has no attribute '%U'",
11375                  tp->tp_name, name);
11376 #else
11377                  "'%.50s' object has no attribute '%.400s'",
11378                  tp->tp_name, PyString_AS_STRING(name));
11379 #endif
11380     return 0;
11381 #else
11382     attr = __Pyx_PyObject_GetAttrStr(obj, name);
11383     goto try_unpack;
11384 #endif
11385 try_unpack:
11386 #if CYTHON_UNPACK_METHODS
11387     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
11388         PyObject *function = PyMethod_GET_FUNCTION(attr);
11389         Py_INCREF(function);
11390         Py_DECREF(attr);
11391         *method = function;
11392         return 1;
11393     }
11394 #endif
11395     *method = attr;
11396     return 0;
11397 }
11398
11399 /* PyObjectCallMethod1 */
11400 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
11401     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
11402     Py_DECREF(method);
11403     return result;
11404 }
11405 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
11406     PyObject *method = NULL, *result;
11407     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11408     if (likely(is_method)) {
11409         result = __Pyx_PyObject_Call2Args(method, obj, arg);
11410         Py_DECREF(method);
11411         return result;
11412     }
11413     if (unlikely(!method)) return NULL;
11414     return __Pyx__PyObject_CallMethod1(method, arg);
11415 }
11416
11417 /* append */
11418 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
11419     if (likely(PyList_CheckExact(L))) {
11420         if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
11421     } else {
11422         PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
11423         if (unlikely(!retval))
11424             return -1;
11425         Py_DECREF(retval);
11426     }
11427     return 0;
11428 }
11429
11430 /* ObjectGetItem */
11431 #if CYTHON_USE_TYPE_SLOTS
11432 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
11433     PyObject *runerr;
11434     Py_ssize_t key_value;
11435     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
11436     if (unlikely(!(m && m->sq_item))) {
11437         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
11438         return NULL;
11439     }
11440     key_value = __Pyx_PyIndex_AsSsize_t(index);
11441     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
11442         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
11443     }
11444     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
11445         PyErr_Clear();
11446         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
11447     }
11448     return NULL;
11449 }
11450 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
11451     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
11452     if (likely(m && m->mp_subscript)) {
11453         return m->mp_subscript(obj, key);
11454     }
11455     return __Pyx_PyObject_GetIndex(obj, key);
11456 }
11457 #endif
11458
11459 /* GetTopmostException */
11460 #if CYTHON_USE_EXC_INFO_STACK
11461 static _PyErr_StackItem *
11462 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
11463 {
11464     _PyErr_StackItem *exc_info = tstate->exc_info;
11465     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
11466            exc_info->previous_item != NULL)
11467     {
11468         exc_info = exc_info->previous_item;
11469     }
11470     return exc_info;
11471 }
11472 #endif
11473
11474 /* SaveResetException */
11475 #if CYTHON_FAST_THREAD_STATE
11476 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11477     #if CYTHON_USE_EXC_INFO_STACK
11478     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
11479     *type = exc_info->exc_type;
11480     *value = exc_info->exc_value;
11481     *tb = exc_info->exc_traceback;
11482     #else
11483     *type = tstate->exc_type;
11484     *value = tstate->exc_value;
11485     *tb = tstate->exc_traceback;
11486     #endif
11487     Py_XINCREF(*type);
11488     Py_XINCREF(*value);
11489     Py_XINCREF(*tb);
11490 }
11491 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11492     PyObject *tmp_type, *tmp_value, *tmp_tb;
11493     #if CYTHON_USE_EXC_INFO_STACK
11494     _PyErr_StackItem *exc_info = tstate->exc_info;
11495     tmp_type = exc_info->exc_type;
11496     tmp_value = exc_info->exc_value;
11497     tmp_tb = exc_info->exc_traceback;
11498     exc_info->exc_type = type;
11499     exc_info->exc_value = value;
11500     exc_info->exc_traceback = tb;
11501     #else
11502     tmp_type = tstate->exc_type;
11503     tmp_value = tstate->exc_value;
11504     tmp_tb = tstate->exc_traceback;
11505     tstate->exc_type = type;
11506     tstate->exc_value = value;
11507     tstate->exc_traceback = tb;
11508     #endif
11509     Py_XDECREF(tmp_type);
11510     Py_XDECREF(tmp_value);
11511     Py_XDECREF(tmp_tb);
11512 }
11513 #endif
11514
11515 /* PyErrExceptionMatches */
11516 #if CYTHON_FAST_THREAD_STATE
11517 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
11518     Py_ssize_t i, n;
11519     n = PyTuple_GET_SIZE(tuple);
11520 #if PY_MAJOR_VERSION >= 3
11521     for (i=0; i<n; i++) {
11522         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
11523     }
11524 #endif
11525     for (i=0; i<n; i++) {
11526         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
11527     }
11528     return 0;
11529 }
11530 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
11531     PyObject *exc_type = tstate->curexc_type;
11532     if (exc_type == err) return 1;
11533     if (unlikely(!exc_type)) return 0;
11534     if (unlikely(PyTuple_Check(err)))
11535         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
11536     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
11537 }
11538 #endif
11539
11540 /* GetException */
11541 #if CYTHON_FAST_THREAD_STATE
11542 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
11543 #else
11544 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
11545 #endif
11546 {
11547     PyObject *local_type, *local_value, *local_tb;
11548 #if CYTHON_FAST_THREAD_STATE
11549     PyObject *tmp_type, *tmp_value, *tmp_tb;
11550     local_type = tstate->curexc_type;
11551     local_value = tstate->curexc_value;
11552     local_tb = tstate->curexc_traceback;
11553     tstate->curexc_type = 0;
11554     tstate->curexc_value = 0;
11555     tstate->curexc_traceback = 0;
11556 #else
11557     PyErr_Fetch(&local_type, &local_value, &local_tb);
11558 #endif
11559     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
11560 #if CYTHON_FAST_THREAD_STATE
11561     if (unlikely(tstate->curexc_type))
11562 #else
11563     if (unlikely(PyErr_Occurred()))
11564 #endif
11565         goto bad;
11566     #if PY_MAJOR_VERSION >= 3
11567     if (local_tb) {
11568         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
11569             goto bad;
11570     }
11571     #endif
11572     Py_XINCREF(local_tb);
11573     Py_XINCREF(local_type);
11574     Py_XINCREF(local_value);
11575     *type = local_type;
11576     *value = local_value;
11577     *tb = local_tb;
11578 #if CYTHON_FAST_THREAD_STATE
11579     #if CYTHON_USE_EXC_INFO_STACK
11580     {
11581         _PyErr_StackItem *exc_info = tstate->exc_info;
11582         tmp_type = exc_info->exc_type;
11583         tmp_value = exc_info->exc_value;
11584         tmp_tb = exc_info->exc_traceback;
11585         exc_info->exc_type = local_type;
11586         exc_info->exc_value = local_value;
11587         exc_info->exc_traceback = local_tb;
11588     }
11589     #else
11590     tmp_type = tstate->exc_type;
11591     tmp_value = tstate->exc_value;
11592     tmp_tb = tstate->exc_traceback;
11593     tstate->exc_type = local_type;
11594     tstate->exc_value = local_value;
11595     tstate->exc_traceback = local_tb;
11596     #endif
11597     Py_XDECREF(tmp_type);
11598     Py_XDECREF(tmp_value);
11599     Py_XDECREF(tmp_tb);
11600 #else
11601     PyErr_SetExcInfo(local_type, local_value, local_tb);
11602 #endif
11603     return 0;
11604 bad:
11605     *type = 0;
11606     *value = 0;
11607     *tb = 0;
11608     Py_XDECREF(local_type);
11609     Py_XDECREF(local_value);
11610     Py_XDECREF(local_tb);
11611     return -1;
11612 }
11613
11614 /* PyObjectCallNoArg */
11615 #if CYTHON_COMPILING_IN_CPYTHON
11616 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
11617 #if CYTHON_FAST_PYCALL
11618     if (PyFunction_Check(func)) {
11619         return __Pyx_PyFunction_FastCall(func, NULL, 0);
11620     }
11621 #endif
11622 #ifdef __Pyx_CyFunction_USED
11623     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
11624 #else
11625     if (likely(PyCFunction_Check(func)))
11626 #endif
11627     {
11628         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11629             return __Pyx_PyObject_CallMethO(func, NULL);
11630         }
11631     }
11632     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
11633 }
11634 #endif
11635
11636 /* PyObjectCallMethod0 */
11637 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
11638     PyObject *method = NULL, *result = NULL;
11639     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11640     if (likely(is_method)) {
11641         result = __Pyx_PyObject_CallOneArg(method, obj);
11642         Py_DECREF(method);
11643         return result;
11644     }
11645     if (unlikely(!method)) goto bad;
11646     result = __Pyx_PyObject_CallNoArg(method);
11647     Py_DECREF(method);
11648 bad:
11649     return result;
11650 }
11651
11652 /* UnpackUnboundCMethod */
11653 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
11654     PyObject *method;
11655     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
11656     if (unlikely(!method))
11657         return -1;
11658     target->method = method;
11659 #if CYTHON_COMPILING_IN_CPYTHON
11660     #if PY_MAJOR_VERSION >= 3
11661     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
11662     #endif
11663     {
11664         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
11665         target->func = descr->d_method->ml_meth;
11666         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
11667     }
11668 #endif
11669     return 0;
11670 }
11671
11672 /* CallUnboundCMethod0 */
11673 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
11674     PyObject *args, *result = NULL;
11675     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
11676 #if CYTHON_ASSUME_SAFE_MACROS
11677     args = PyTuple_New(1);
11678     if (unlikely(!args)) goto bad;
11679     Py_INCREF(self);
11680     PyTuple_SET_ITEM(args, 0, self);
11681 #else
11682     args = PyTuple_Pack(1, self);
11683     if (unlikely(!args)) goto bad;
11684 #endif
11685     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
11686     Py_DECREF(args);
11687 bad:
11688     return result;
11689 }
11690
11691 /* pop */
11692 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
11693     if (Py_TYPE(L) == &PySet_Type) {
11694         return PySet_Pop(L);
11695     }
11696     return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
11697 }
11698 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
11699 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
11700     if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
11701         __Pyx_SET_SIZE(L, Py_SIZE(L) - 1);
11702         return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
11703     }
11704     return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
11705 }
11706 #endif
11707
11708 /* RaiseTooManyValuesToUnpack */
11709 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
11710     PyErr_Format(PyExc_ValueError,
11711                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
11712 }
11713
11714 /* RaiseNeedMoreValuesToUnpack */
11715 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
11716     PyErr_Format(PyExc_ValueError,
11717                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
11718                  index, (index == 1) ? "" : "s");
11719 }
11720
11721 /* IterFinish */
11722 static CYTHON_INLINE int __Pyx_IterFinish(void) {
11723 #if CYTHON_FAST_THREAD_STATE
11724     PyThreadState *tstate = __Pyx_PyThreadState_Current;
11725     PyObject* exc_type = tstate->curexc_type;
11726     if (unlikely(exc_type)) {
11727         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
11728             PyObject *exc_value, *exc_tb;
11729             exc_value = tstate->curexc_value;
11730             exc_tb = tstate->curexc_traceback;
11731             tstate->curexc_type = 0;
11732             tstate->curexc_value = 0;
11733             tstate->curexc_traceback = 0;
11734             Py_DECREF(exc_type);
11735             Py_XDECREF(exc_value);
11736             Py_XDECREF(exc_tb);
11737             return 0;
11738         } else {
11739             return -1;
11740         }
11741     }
11742     return 0;
11743 #else
11744     if (unlikely(PyErr_Occurred())) {
11745         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
11746             PyErr_Clear();
11747             return 0;
11748         } else {
11749             return -1;
11750         }
11751     }
11752     return 0;
11753 #endif
11754 }
11755
11756 /* UnpackItemEndCheck */
11757 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
11758     if (unlikely(retval)) {
11759         Py_DECREF(retval);
11760         __Pyx_RaiseTooManyValuesError(expected);
11761         return -1;
11762     } else {
11763         return __Pyx_IterFinish();
11764     }
11765     return 0;
11766 }
11767
11768 /* GetAttr */
11769 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
11770 #if CYTHON_USE_TYPE_SLOTS
11771 #if PY_MAJOR_VERSION >= 3
11772     if (likely(PyUnicode_Check(n)))
11773 #else
11774     if (likely(PyString_Check(n)))
11775 #endif
11776         return __Pyx_PyObject_GetAttrStr(o, n);
11777 #endif
11778     return PyObject_GetAttr(o, n);
11779 }
11780
11781 /* HasAttr */
11782 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
11783     PyObject *r;
11784     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
11785         PyErr_SetString(PyExc_TypeError,
11786                         "hasattr(): attribute name must be string");
11787         return -1;
11788     }
11789     r = __Pyx_GetAttr(o, n);
11790     if (unlikely(!r)) {
11791         PyErr_Clear();
11792         return 0;
11793     } else {
11794         Py_DECREF(r);
11795         return 1;
11796     }
11797 }
11798
11799 /* SliceObject */
11800 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
11801         Py_ssize_t cstart, Py_ssize_t cstop,
11802         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
11803         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
11804 #if CYTHON_USE_TYPE_SLOTS
11805     PyMappingMethods* mp;
11806 #if PY_MAJOR_VERSION < 3
11807     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
11808     if (likely(ms && ms->sq_ass_slice)) {
11809         if (!has_cstart) {
11810             if (_py_start && (*_py_start != Py_None)) {
11811                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
11812                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11813             } else
11814                 cstart = 0;
11815         }
11816         if (!has_cstop) {
11817             if (_py_stop && (*_py_stop != Py_None)) {
11818                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
11819                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11820             } else
11821                 cstop = PY_SSIZE_T_MAX;
11822         }
11823         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
11824             Py_ssize_t l = ms->sq_length(obj);
11825             if (likely(l >= 0)) {
11826                 if (cstop < 0) {
11827                     cstop += l;
11828                     if (cstop < 0) cstop = 0;
11829                 }
11830                 if (cstart < 0) {
11831                     cstart += l;
11832                     if (cstart < 0) cstart = 0;
11833                 }
11834             } else {
11835                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11836                     goto bad;
11837                 PyErr_Clear();
11838             }
11839         }
11840         return ms->sq_ass_slice(obj, cstart, cstop, value);
11841     }
11842 #endif
11843     mp = Py_TYPE(obj)->tp_as_mapping;
11844     if (likely(mp && mp->mp_ass_subscript))
11845 #endif
11846     {
11847         int result;
11848         PyObject *py_slice, *py_start, *py_stop;
11849         if (_py_slice) {
11850             py_slice = *_py_slice;
11851         } else {
11852             PyObject* owned_start = NULL;
11853             PyObject* owned_stop = NULL;
11854             if (_py_start) {
11855                 py_start = *_py_start;
11856             } else {
11857                 if (has_cstart) {
11858                     owned_start = py_start = PyInt_FromSsize_t(cstart);
11859                     if (unlikely(!py_start)) goto bad;
11860                 } else
11861                     py_start = Py_None;
11862             }
11863             if (_py_stop) {
11864                 py_stop = *_py_stop;
11865             } else {
11866                 if (has_cstop) {
11867                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
11868                     if (unlikely(!py_stop)) {
11869                         Py_XDECREF(owned_start);
11870                         goto bad;
11871                     }
11872                 } else
11873                     py_stop = Py_None;
11874             }
11875             py_slice = PySlice_New(py_start, py_stop, Py_None);
11876             Py_XDECREF(owned_start);
11877             Py_XDECREF(owned_stop);
11878             if (unlikely(!py_slice)) goto bad;
11879         }
11880 #if CYTHON_USE_TYPE_SLOTS
11881         result = mp->mp_ass_subscript(obj, py_slice, value);
11882 #else
11883         result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
11884 #endif
11885         if (!_py_slice) {
11886             Py_DECREF(py_slice);
11887         }
11888         return result;
11889     }
11890     PyErr_Format(PyExc_TypeError,
11891         "'%.200s' object does not support slice %.10s",
11892         Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
11893 bad:
11894     return -1;
11895 }
11896
11897 /* PyErrFetchRestore */
11898 #if CYTHON_FAST_THREAD_STATE
11899 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11900     PyObject *tmp_type, *tmp_value, *tmp_tb;
11901     tmp_type = tstate->curexc_type;
11902     tmp_value = tstate->curexc_value;
11903     tmp_tb = tstate->curexc_traceback;
11904     tstate->curexc_type = type;
11905     tstate->curexc_value = value;
11906     tstate->curexc_traceback = tb;
11907     Py_XDECREF(tmp_type);
11908     Py_XDECREF(tmp_value);
11909     Py_XDECREF(tmp_tb);
11910 }
11911 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11912     *type = tstate->curexc_type;
11913     *value = tstate->curexc_value;
11914     *tb = tstate->curexc_traceback;
11915     tstate->curexc_type = 0;
11916     tstate->curexc_value = 0;
11917     tstate->curexc_traceback = 0;
11918 }
11919 #endif
11920
11921 /* RaiseException */
11922 #if PY_MAJOR_VERSION < 3
11923 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
11924                         CYTHON_UNUSED PyObject *cause) {
11925     __Pyx_PyThreadState_declare
11926     Py_XINCREF(type);
11927     if (!value || value == Py_None)
11928         value = NULL;
11929     else
11930         Py_INCREF(value);
11931     if (!tb || tb == Py_None)
11932         tb = NULL;
11933     else {
11934         Py_INCREF(tb);
11935         if (!PyTraceBack_Check(tb)) {
11936             PyErr_SetString(PyExc_TypeError,
11937                 "raise: arg 3 must be a traceback or None");
11938             goto raise_error;
11939         }
11940     }
11941     if (PyType_Check(type)) {
11942 #if CYTHON_COMPILING_IN_PYPY
11943         if (!value) {
11944             Py_INCREF(Py_None);
11945             value = Py_None;
11946         }
11947 #endif
11948         PyErr_NormalizeException(&type, &value, &tb);
11949     } else {
11950         if (value) {
11951             PyErr_SetString(PyExc_TypeError,
11952                 "instance exception may not have a separate value");
11953             goto raise_error;
11954         }
11955         value = type;
11956         type = (PyObject*) Py_TYPE(type);
11957         Py_INCREF(type);
11958         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
11959             PyErr_SetString(PyExc_TypeError,
11960                 "raise: exception class must be a subclass of BaseException");
11961             goto raise_error;
11962         }
11963     }
11964     __Pyx_PyThreadState_assign
11965     __Pyx_ErrRestore(type, value, tb);
11966     return;
11967 raise_error:
11968     Py_XDECREF(value);
11969     Py_XDECREF(type);
11970     Py_XDECREF(tb);
11971     return;
11972 }
11973 #else
11974 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11975     PyObject* owned_instance = NULL;
11976     if (tb == Py_None) {
11977         tb = 0;
11978     } else if (tb && !PyTraceBack_Check(tb)) {
11979         PyErr_SetString(PyExc_TypeError,
11980             "raise: arg 3 must be a traceback or None");
11981         goto bad;
11982     }
11983     if (value == Py_None)
11984         value = 0;
11985     if (PyExceptionInstance_Check(type)) {
11986         if (value) {
11987             PyErr_SetString(PyExc_TypeError,
11988                 "instance exception may not have a separate value");
11989             goto bad;
11990         }
11991         value = type;
11992         type = (PyObject*) Py_TYPE(value);
11993     } else if (PyExceptionClass_Check(type)) {
11994         PyObject *instance_class = NULL;
11995         if (value && PyExceptionInstance_Check(value)) {
11996             instance_class = (PyObject*) Py_TYPE(value);
11997             if (instance_class != type) {
11998                 int is_subclass = PyObject_IsSubclass(instance_class, type);
11999                 if (!is_subclass) {
12000                     instance_class = NULL;
12001                 } else if (unlikely(is_subclass == -1)) {
12002                     goto bad;
12003                 } else {
12004                     type = instance_class;
12005                 }
12006             }
12007         }
12008         if (!instance_class) {
12009             PyObject *args;
12010             if (!value)
12011                 args = PyTuple_New(0);
12012             else if (PyTuple_Check(value)) {
12013                 Py_INCREF(value);
12014                 args = value;
12015             } else
12016                 args = PyTuple_Pack(1, value);
12017             if (!args)
12018                 goto bad;
12019             owned_instance = PyObject_Call(type, args, NULL);
12020             Py_DECREF(args);
12021             if (!owned_instance)
12022                 goto bad;
12023             value = owned_instance;
12024             if (!PyExceptionInstance_Check(value)) {
12025                 PyErr_Format(PyExc_TypeError,
12026                              "calling %R should have returned an instance of "
12027                              "BaseException, not %R",
12028                              type, Py_TYPE(value));
12029                 goto bad;
12030             }
12031         }
12032     } else {
12033         PyErr_SetString(PyExc_TypeError,
12034             "raise: exception class must be a subclass of BaseException");
12035         goto bad;
12036     }
12037     if (cause) {
12038         PyObject *fixed_cause;
12039         if (cause == Py_None) {
12040             fixed_cause = NULL;
12041         } else if (PyExceptionClass_Check(cause)) {
12042             fixed_cause = PyObject_CallObject(cause, NULL);
12043             if (fixed_cause == NULL)
12044                 goto bad;
12045         } else if (PyExceptionInstance_Check(cause)) {
12046             fixed_cause = cause;
12047             Py_INCREF(fixed_cause);
12048         } else {
12049             PyErr_SetString(PyExc_TypeError,
12050                             "exception causes must derive from "
12051                             "BaseException");
12052             goto bad;
12053         }
12054         PyException_SetCause(value, fixed_cause);
12055     }
12056     PyErr_SetObject(type, value);
12057     if (tb) {
12058 #if CYTHON_COMPILING_IN_PYPY
12059         PyObject *tmp_type, *tmp_value, *tmp_tb;
12060         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12061         Py_INCREF(tb);
12062         PyErr_Restore(tmp_type, tmp_value, tb);
12063         Py_XDECREF(tmp_tb);
12064 #else
12065         PyThreadState *tstate = __Pyx_PyThreadState_Current;
12066         PyObject* tmp_tb = tstate->curexc_traceback;
12067         if (tb != tmp_tb) {
12068             Py_INCREF(tb);
12069             tstate->curexc_traceback = tb;
12070             Py_XDECREF(tmp_tb);
12071         }
12072 #endif
12073     }
12074 bad:
12075     Py_XDECREF(owned_instance);
12076     return;
12077 }
12078 #endif
12079
12080 /* Import */
12081 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
12082     PyObject *empty_list = 0;
12083     PyObject *module = 0;
12084     PyObject *global_dict = 0;
12085     PyObject *empty_dict = 0;
12086     PyObject *list;
12087     #if PY_MAJOR_VERSION < 3
12088     PyObject *py_import;
12089     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12090     if (!py_import)
12091         goto bad;
12092     #endif
12093     if (from_list)
12094         list = from_list;
12095     else {
12096         empty_list = PyList_New(0);
12097         if (!empty_list)
12098             goto bad;
12099         list = empty_list;
12100     }
12101     global_dict = PyModule_GetDict(__pyx_m);
12102     if (!global_dict)
12103         goto bad;
12104     empty_dict = PyDict_New();
12105     if (!empty_dict)
12106         goto bad;
12107     {
12108         #if PY_MAJOR_VERSION >= 3
12109         if (level == -1) {
12110             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12111                 module = PyImport_ImportModuleLevelObject(
12112                     name, global_dict, empty_dict, list, 1);
12113                 if (!module) {
12114                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
12115                         goto bad;
12116                     PyErr_Clear();
12117                 }
12118             }
12119             level = 0;
12120         }
12121         #endif
12122         if (!module) {
12123             #if PY_MAJOR_VERSION < 3
12124             PyObject *py_level = PyInt_FromLong(level);
12125             if (!py_level)
12126                 goto bad;
12127             module = PyObject_CallFunctionObjArgs(py_import,
12128                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
12129             Py_DECREF(py_level);
12130             #else
12131             module = PyImport_ImportModuleLevelObject(
12132                 name, global_dict, empty_dict, list, level);
12133             #endif
12134         }
12135     }
12136 bad:
12137     #if PY_MAJOR_VERSION < 3
12138     Py_XDECREF(py_import);
12139     #endif
12140     Py_XDECREF(empty_list);
12141     Py_XDECREF(empty_dict);
12142     return module;
12143 }
12144
12145 /* ImportFrom */
12146 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
12147     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
12148     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
12149         PyErr_Format(PyExc_ImportError,
12150         #if PY_MAJOR_VERSION < 3
12151             "cannot import name %.230s", PyString_AS_STRING(name));
12152         #else
12153             "cannot import name %S", name);
12154         #endif
12155     }
12156     return value;
12157 }
12158
12159 /* GetAttr3 */
12160 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
12161     __Pyx_PyThreadState_declare
12162     __Pyx_PyThreadState_assign
12163     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12164         return NULL;
12165     __Pyx_PyErr_Clear();
12166     Py_INCREF(d);
12167     return d;
12168 }
12169 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
12170     PyObject *r = __Pyx_GetAttr(o, n);
12171     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
12172 }
12173
12174 /* py_dict_items */
12175 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
12176     if (PY_MAJOR_VERSION >= 3)
12177         return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
12178     else
12179         return PyDict_Items(d);
12180 }
12181
12182 /* CallUnboundCMethod1 */
12183 #if CYTHON_COMPILING_IN_CPYTHON
12184 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
12185     if (likely(cfunc->func)) {
12186         int flag = cfunc->flag;
12187         if (flag == METH_O) {
12188             return (*(cfunc->func))(self, arg);
12189         } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
12190             if (PY_VERSION_HEX >= 0x030700A0) {
12191                 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
12192             } else {
12193                 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12194             }
12195         } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
12196             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12197         }
12198     }
12199     return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
12200 }
12201 #endif
12202 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
12203     PyObject *args, *result = NULL;
12204     if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12205 #if CYTHON_COMPILING_IN_CPYTHON
12206     if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12207         args = PyTuple_New(1);
12208         if (unlikely(!args)) goto bad;
12209         Py_INCREF(arg);
12210         PyTuple_SET_ITEM(args, 0, arg);
12211         if (cfunc->flag & METH_KEYWORDS)
12212             result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12213         else
12214             result = (*cfunc->func)(self, args);
12215     } else {
12216         args = PyTuple_New(2);
12217         if (unlikely(!args)) goto bad;
12218         Py_INCREF(self);
12219         PyTuple_SET_ITEM(args, 0, self);
12220         Py_INCREF(arg);
12221         PyTuple_SET_ITEM(args, 1, arg);
12222         result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12223     }
12224 #else
12225     args = PyTuple_Pack(2, self, arg);
12226     if (unlikely(!args)) goto bad;
12227     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12228 #endif
12229 bad:
12230     Py_XDECREF(args);
12231     return result;
12232 }
12233
12234 /* CallUnboundCMethod2 */
12235 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
12236 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
12237     if (likely(cfunc->func)) {
12238         PyObject *args[2] = {arg1, arg2};
12239         if (cfunc->flag == METH_FASTCALL) {
12240             #if PY_VERSION_HEX >= 0x030700A0
12241             return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
12242             #else
12243             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12244             #endif
12245         }
12246         #if PY_VERSION_HEX >= 0x030700A0
12247         if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
12248             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12249         #endif
12250     }
12251     return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
12252 }
12253 #endif
12254 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
12255     PyObject *args, *result = NULL;
12256     if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12257 #if CYTHON_COMPILING_IN_CPYTHON
12258     if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12259         args = PyTuple_New(2);
12260         if (unlikely(!args)) goto bad;
12261         Py_INCREF(arg1);
12262         PyTuple_SET_ITEM(args, 0, arg1);
12263         Py_INCREF(arg2);
12264         PyTuple_SET_ITEM(args, 1, arg2);
12265         if (cfunc->flag & METH_KEYWORDS)
12266             result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12267         else
12268             result = (*cfunc->func)(self, args);
12269     } else {
12270         args = PyTuple_New(3);
12271         if (unlikely(!args)) goto bad;
12272         Py_INCREF(self);
12273         PyTuple_SET_ITEM(args, 0, self);
12274         Py_INCREF(arg1);
12275         PyTuple_SET_ITEM(args, 1, arg1);
12276         Py_INCREF(arg2);
12277         PyTuple_SET_ITEM(args, 2, arg2);
12278         result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12279     }
12280 #else
12281     args = PyTuple_Pack(3, self, arg1, arg2);
12282     if (unlikely(!args)) goto bad;
12283     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12284 #endif
12285 bad:
12286     Py_XDECREF(args);
12287     return result;
12288 }
12289
12290 /* dict_getitem_default */
12291 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
12292     PyObject* value;
12293 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
12294     value = PyDict_GetItemWithError(d, key);
12295     if (unlikely(!value)) {
12296         if (unlikely(PyErr_Occurred()))
12297             return NULL;
12298         value = default_value;
12299     }
12300     Py_INCREF(value);
12301     if ((1));
12302 #else
12303     if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
12304         value = PyDict_GetItem(d, key);
12305         if (unlikely(!value)) {
12306             value = default_value;
12307         }
12308         Py_INCREF(value);
12309     }
12310 #endif
12311     else {
12312         if (default_value == Py_None)
12313             value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
12314         else
12315             value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
12316     }
12317     return value;
12318 }
12319
12320 /* RaiseNoneIterError */
12321 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
12322     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
12323 }
12324
12325 /* PyObject_GenericGetAttrNoDict */
12326 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12327 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12328     PyErr_Format(PyExc_AttributeError,
12329 #if PY_MAJOR_VERSION >= 3
12330                  "'%.50s' object has no attribute '%U'",
12331                  tp->tp_name, attr_name);
12332 #else
12333                  "'%.50s' object has no attribute '%.400s'",
12334                  tp->tp_name, PyString_AS_STRING(attr_name));
12335 #endif
12336     return NULL;
12337 }
12338 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12339     PyObject *descr;
12340     PyTypeObject *tp = Py_TYPE(obj);
12341     if (unlikely(!PyString_Check(attr_name))) {
12342         return PyObject_GenericGetAttr(obj, attr_name);
12343     }
12344     assert(!tp->tp_dictoffset);
12345     descr = _PyType_Lookup(tp, attr_name);
12346     if (unlikely(!descr)) {
12347         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12348     }
12349     Py_INCREF(descr);
12350     #if PY_MAJOR_VERSION < 3
12351     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12352     #endif
12353     {
12354         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12355         if (unlikely(f)) {
12356             PyObject *res = f(descr, obj, (PyObject *)tp);
12357             Py_DECREF(descr);
12358             return res;
12359         }
12360     }
12361     return descr;
12362 }
12363 #endif
12364
12365 /* PyObject_GenericGetAttr */
12366 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12367 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12368     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12369         return PyObject_GenericGetAttr(obj, attr_name);
12370     }
12371     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12372 }
12373 #endif
12374
12375 /* SetVTable */
12376 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
12377 #if PY_VERSION_HEX >= 0x02070000
12378     PyObject *ob = PyCapsule_New(vtable, 0, 0);
12379 #else
12380     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
12381 #endif
12382     if (!ob)
12383         goto bad;
12384     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
12385         goto bad;
12386     Py_DECREF(ob);
12387     return 0;
12388 bad:
12389     Py_XDECREF(ob);
12390     return -1;
12391 }
12392
12393 /* PyObjectGetAttrStrNoError */
12394 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
12395     __Pyx_PyThreadState_declare
12396     __Pyx_PyThreadState_assign
12397     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12398         __Pyx_PyErr_Clear();
12399 }
12400 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
12401     PyObject *result;
12402 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
12403     PyTypeObject* tp = Py_TYPE(obj);
12404     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
12405         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
12406     }
12407 #endif
12408     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
12409     if (unlikely(!result)) {
12410         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
12411     }
12412     return result;
12413 }
12414
12415 /* SetupReduce */
12416 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12417   int ret;
12418   PyObject *name_attr;
12419   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
12420   if (likely(name_attr)) {
12421       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12422   } else {
12423       ret = -1;
12424   }
12425   if (unlikely(ret < 0)) {
12426       PyErr_Clear();
12427       ret = 0;
12428   }
12429   Py_XDECREF(name_attr);
12430   return ret;
12431 }
12432 static int __Pyx_setup_reduce(PyObject* type_obj) {
12433     int ret = 0;
12434     PyObject *object_reduce = NULL;
12435     PyObject *object_reduce_ex = NULL;
12436     PyObject *reduce = NULL;
12437     PyObject *reduce_ex = NULL;
12438     PyObject *reduce_cython = NULL;
12439     PyObject *setstate = NULL;
12440     PyObject *setstate_cython = NULL;
12441 #if CYTHON_USE_PYTYPE_LOOKUP
12442     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12443 #else
12444     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12445 #endif
12446 #if CYTHON_USE_PYTYPE_LOOKUP
12447     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12448 #else
12449     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12450 #endif
12451     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
12452     if (reduce_ex == object_reduce_ex) {
12453 #if CYTHON_USE_PYTYPE_LOOKUP
12454         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12455 #else
12456         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12457 #endif
12458         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
12459         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
12460             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
12461             if (likely(reduce_cython)) {
12462                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12463                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12464             } else if (reduce == object_reduce || PyErr_Occurred()) {
12465                 goto __PYX_BAD;
12466             }
12467             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
12468             if (!setstate) PyErr_Clear();
12469             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
12470                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
12471                 if (likely(setstate_cython)) {
12472                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12473                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12474                 } else if (!setstate || PyErr_Occurred()) {
12475                     goto __PYX_BAD;
12476                 }
12477             }
12478             PyType_Modified((PyTypeObject*)type_obj);
12479         }
12480     }
12481     goto __PYX_GOOD;
12482 __PYX_BAD:
12483     if (!PyErr_Occurred())
12484         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
12485     ret = -1;
12486 __PYX_GOOD:
12487 #if !CYTHON_USE_PYTYPE_LOOKUP
12488     Py_XDECREF(object_reduce);
12489     Py_XDECREF(object_reduce_ex);
12490 #endif
12491     Py_XDECREF(reduce);
12492     Py_XDECREF(reduce_ex);
12493     Py_XDECREF(reduce_cython);
12494     Py_XDECREF(setstate);
12495     Py_XDECREF(setstate_cython);
12496     return ret;
12497 }
12498
12499 /* CalculateMetaclass */
12500 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
12501     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
12502     for (i=0; i < nbases; i++) {
12503         PyTypeObject *tmptype;
12504         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
12505         tmptype = Py_TYPE(tmp);
12506 #if PY_MAJOR_VERSION < 3
12507         if (tmptype == &PyClass_Type)
12508             continue;
12509 #endif
12510         if (!metaclass) {
12511             metaclass = tmptype;
12512             continue;
12513         }
12514         if (PyType_IsSubtype(metaclass, tmptype))
12515             continue;
12516         if (PyType_IsSubtype(tmptype, metaclass)) {
12517             metaclass = tmptype;
12518             continue;
12519         }
12520         PyErr_SetString(PyExc_TypeError,
12521                         "metaclass conflict: "
12522                         "the metaclass of a derived class "
12523                         "must be a (non-strict) subclass "
12524                         "of the metaclasses of all its bases");
12525         return NULL;
12526     }
12527     if (!metaclass) {
12528 #if PY_MAJOR_VERSION < 3
12529         metaclass = &PyClass_Type;
12530 #else
12531         metaclass = &PyType_Type;
12532 #endif
12533     }
12534     Py_INCREF((PyObject*) metaclass);
12535     return (PyObject*) metaclass;
12536 }
12537
12538 /* Py3ClassCreate */
12539 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
12540                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
12541     PyObject *ns;
12542     if (metaclass) {
12543         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
12544         if (prep) {
12545             PyObject *pargs = PyTuple_Pack(2, name, bases);
12546             if (unlikely(!pargs)) {
12547                 Py_DECREF(prep);
12548                 return NULL;
12549             }
12550             ns = PyObject_Call(prep, pargs, mkw);
12551             Py_DECREF(prep);
12552             Py_DECREF(pargs);
12553         } else {
12554             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
12555                 return NULL;
12556             PyErr_Clear();
12557             ns = PyDict_New();
12558         }
12559     } else {
12560         ns = PyDict_New();
12561     }
12562     if (unlikely(!ns))
12563         return NULL;
12564     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
12565     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
12566     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
12567     return ns;
12568 bad:
12569     Py_DECREF(ns);
12570     return NULL;
12571 }
12572 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
12573                                       PyObject *dict, PyObject *mkw,
12574                                       int calculate_metaclass, int allow_py2_metaclass) {
12575     PyObject *result, *margs;
12576     PyObject *owned_metaclass = NULL;
12577     if (allow_py2_metaclass) {
12578         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
12579         if (owned_metaclass) {
12580             metaclass = owned_metaclass;
12581         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
12582             PyErr_Clear();
12583         } else {
12584             return NULL;
12585         }
12586     }
12587     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
12588         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
12589         Py_XDECREF(owned_metaclass);
12590         if (unlikely(!metaclass))
12591             return NULL;
12592         owned_metaclass = metaclass;
12593     }
12594     margs = PyTuple_Pack(3, name, bases, dict);
12595     if (unlikely(!margs)) {
12596         result = NULL;
12597     } else {
12598         result = PyObject_Call(metaclass, margs, mkw);
12599         Py_DECREF(margs);
12600     }
12601     Py_XDECREF(owned_metaclass);
12602     return result;
12603 }
12604
12605 /* FetchCommonType */
12606 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
12607     PyObject* fake_module;
12608     PyTypeObject* cached_type = NULL;
12609     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
12610     if (!fake_module) return NULL;
12611     Py_INCREF(fake_module);
12612     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
12613     if (cached_type) {
12614         if (!PyType_Check((PyObject*)cached_type)) {
12615             PyErr_Format(PyExc_TypeError,
12616                 "Shared Cython type %.200s is not a type object",
12617                 type->tp_name);
12618             goto bad;
12619         }
12620         if (cached_type->tp_basicsize != type->tp_basicsize) {
12621             PyErr_Format(PyExc_TypeError,
12622                 "Shared Cython type %.200s has the wrong size, try recompiling",
12623                 type->tp_name);
12624             goto bad;
12625         }
12626     } else {
12627         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12628         PyErr_Clear();
12629         if (PyType_Ready(type) < 0) goto bad;
12630         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
12631             goto bad;
12632         Py_INCREF(type);
12633         cached_type = type;
12634     }
12635 done:
12636     Py_DECREF(fake_module);
12637     return cached_type;
12638 bad:
12639     Py_XDECREF(cached_type);
12640     cached_type = NULL;
12641     goto done;
12642 }
12643
12644 /* CythonFunctionShared */
12645 #include <structmember.h>
12646 static PyObject *
12647 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
12648 {
12649     if (unlikely(op->func_doc == NULL)) {
12650         if (op->func.m_ml->ml_doc) {
12651 #if PY_MAJOR_VERSION >= 3
12652             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
12653 #else
12654             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
12655 #endif
12656             if (unlikely(op->func_doc == NULL))
12657                 return NULL;
12658         } else {
12659             Py_INCREF(Py_None);
12660             return Py_None;
12661         }
12662     }
12663     Py_INCREF(op->func_doc);
12664     return op->func_doc;
12665 }
12666 static int
12667 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12668 {
12669     PyObject *tmp = op->func_doc;
12670     if (value == NULL) {
12671         value = Py_None;
12672     }
12673     Py_INCREF(value);
12674     op->func_doc = value;
12675     Py_XDECREF(tmp);
12676     return 0;
12677 }
12678 static PyObject *
12679 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12680 {
12681     if (unlikely(op->func_name == NULL)) {
12682 #if PY_MAJOR_VERSION >= 3
12683         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
12684 #else
12685         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
12686 #endif
12687         if (unlikely(op->func_name == NULL))
12688             return NULL;
12689     }
12690     Py_INCREF(op->func_name);
12691     return op->func_name;
12692 }
12693 static int
12694 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12695 {
12696     PyObject *tmp;
12697 #if PY_MAJOR_VERSION >= 3
12698     if (unlikely(value == NULL || !PyUnicode_Check(value)))
12699 #else
12700     if (unlikely(value == NULL || !PyString_Check(value)))
12701 #endif
12702     {
12703         PyErr_SetString(PyExc_TypeError,
12704                         "__name__ must be set to a string object");
12705         return -1;
12706     }
12707     tmp = op->func_name;
12708     Py_INCREF(value);
12709     op->func_name = value;
12710     Py_XDECREF(tmp);
12711     return 0;
12712 }
12713 static PyObject *
12714 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12715 {
12716     Py_INCREF(op->func_qualname);
12717     return op->func_qualname;
12718 }
12719 static int
12720 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12721 {
12722     PyObject *tmp;
12723 #if PY_MAJOR_VERSION >= 3
12724     if (unlikely(value == NULL || !PyUnicode_Check(value)))
12725 #else
12726     if (unlikely(value == NULL || !PyString_Check(value)))
12727 #endif
12728     {
12729         PyErr_SetString(PyExc_TypeError,
12730                         "__qualname__ must be set to a string object");
12731         return -1;
12732     }
12733     tmp = op->func_qualname;
12734     Py_INCREF(value);
12735     op->func_qualname = value;
12736     Py_XDECREF(tmp);
12737     return 0;
12738 }
12739 static PyObject *
12740 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
12741 {
12742     PyObject *self;
12743     self = m->func_closure;
12744     if (self == NULL)
12745         self = Py_None;
12746     Py_INCREF(self);
12747     return self;
12748 }
12749 static PyObject *
12750 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12751 {
12752     if (unlikely(op->func_dict == NULL)) {
12753         op->func_dict = PyDict_New();
12754         if (unlikely(op->func_dict == NULL))
12755             return NULL;
12756     }
12757     Py_INCREF(op->func_dict);
12758     return op->func_dict;
12759 }
12760 static int
12761 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12762 {
12763     PyObject *tmp;
12764     if (unlikely(value == NULL)) {
12765         PyErr_SetString(PyExc_TypeError,
12766                "function's dictionary may not be deleted");
12767         return -1;
12768     }
12769     if (unlikely(!PyDict_Check(value))) {
12770         PyErr_SetString(PyExc_TypeError,
12771                "setting function's dictionary to a non-dict");
12772         return -1;
12773     }
12774     tmp = op->func_dict;
12775     Py_INCREF(value);
12776     op->func_dict = value;
12777     Py_XDECREF(tmp);
12778     return 0;
12779 }
12780 static PyObject *
12781 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12782 {
12783     Py_INCREF(op->func_globals);
12784     return op->func_globals;
12785 }
12786 static PyObject *
12787 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12788 {
12789     Py_INCREF(Py_None);
12790     return Py_None;
12791 }
12792 static PyObject *
12793 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12794 {
12795     PyObject* result = (op->func_code) ? op->func_code : Py_None;
12796     Py_INCREF(result);
12797     return result;
12798 }
12799 static int
12800 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
12801     int result = 0;
12802     PyObject *res = op->defaults_getter((PyObject *) op);
12803     if (unlikely(!res))
12804         return -1;
12805     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12806     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
12807     Py_INCREF(op->defaults_tuple);
12808     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
12809     Py_INCREF(op->defaults_kwdict);
12810     #else
12811     op->defaults_tuple = PySequence_ITEM(res, 0);
12812     if (unlikely(!op->defaults_tuple)) result = -1;
12813     else {
12814         op->defaults_kwdict = PySequence_ITEM(res, 1);
12815         if (unlikely(!op->defaults_kwdict)) result = -1;
12816     }
12817     #endif
12818     Py_DECREF(res);
12819     return result;
12820 }
12821 static int
12822 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12823     PyObject* tmp;
12824     if (!value) {
12825         value = Py_None;
12826     } else if (value != Py_None && !PyTuple_Check(value)) {
12827         PyErr_SetString(PyExc_TypeError,
12828                         "__defaults__ must be set to a tuple object");
12829         return -1;
12830     }
12831     Py_INCREF(value);
12832     tmp = op->defaults_tuple;
12833     op->defaults_tuple = value;
12834     Py_XDECREF(tmp);
12835     return 0;
12836 }
12837 static PyObject *
12838 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12839     PyObject* result = op->defaults_tuple;
12840     if (unlikely(!result)) {
12841         if (op->defaults_getter) {
12842             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12843             result = op->defaults_tuple;
12844         } else {
12845             result = Py_None;
12846         }
12847     }
12848     Py_INCREF(result);
12849     return result;
12850 }
12851 static int
12852 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12853     PyObject* tmp;
12854     if (!value) {
12855         value = Py_None;
12856     } else if (value != Py_None && !PyDict_Check(value)) {
12857         PyErr_SetString(PyExc_TypeError,
12858                         "__kwdefaults__ must be set to a dict object");
12859         return -1;
12860     }
12861     Py_INCREF(value);
12862     tmp = op->defaults_kwdict;
12863     op->defaults_kwdict = value;
12864     Py_XDECREF(tmp);
12865     return 0;
12866 }
12867 static PyObject *
12868 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12869     PyObject* result = op->defaults_kwdict;
12870     if (unlikely(!result)) {
12871         if (op->defaults_getter) {
12872             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12873             result = op->defaults_kwdict;
12874         } else {
12875             result = Py_None;
12876         }
12877     }
12878     Py_INCREF(result);
12879     return result;
12880 }
12881 static int
12882 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12883     PyObject* tmp;
12884     if (!value || value == Py_None) {
12885         value = NULL;
12886     } else if (!PyDict_Check(value)) {
12887         PyErr_SetString(PyExc_TypeError,
12888                         "__annotations__ must be set to a dict object");
12889         return -1;
12890     }
12891     Py_XINCREF(value);
12892     tmp = op->func_annotations;
12893     op->func_annotations = value;
12894     Py_XDECREF(tmp);
12895     return 0;
12896 }
12897 static PyObject *
12898 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12899     PyObject* result = op->func_annotations;
12900     if (unlikely(!result)) {
12901         result = PyDict_New();
12902         if (unlikely(!result)) return NULL;
12903         op->func_annotations = result;
12904     }
12905     Py_INCREF(result);
12906     return result;
12907 }
12908 static PyGetSetDef __pyx_CyFunction_getsets[] = {
12909     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12910     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12911     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12912     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12913     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
12914     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
12915     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12916     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12917     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12918     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12919     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12920     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12921     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12922     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12923     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12924     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12925     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
12926     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
12927     {0, 0, 0, 0, 0}
12928 };
12929 static PyMemberDef __pyx_CyFunction_members[] = {
12930     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
12931     {0, 0, 0,  0, 0}
12932 };
12933 static PyObject *
12934 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
12935 {
12936 #if PY_MAJOR_VERSION >= 3
12937     return PyUnicode_FromString(m->func.m_ml->ml_name);
12938 #else
12939     return PyString_FromString(m->func.m_ml->ml_name);
12940 #endif
12941 }
12942 static PyMethodDef __pyx_CyFunction_methods[] = {
12943     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
12944     {0, 0, 0, 0}
12945 };
12946 #if PY_VERSION_HEX < 0x030500A0
12947 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
12948 #else
12949 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
12950 #endif
12951 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
12952                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
12953     if (unlikely(op == NULL))
12954         return NULL;
12955     op->flags = flags;
12956     __Pyx_CyFunction_weakreflist(op) = NULL;
12957     op->func.m_ml = ml;
12958     op->func.m_self = (PyObject *) op;
12959     Py_XINCREF(closure);
12960     op->func_closure = closure;
12961     Py_XINCREF(module);
12962     op->func.m_module = module;
12963     op->func_dict = NULL;
12964     op->func_name = NULL;
12965     Py_INCREF(qualname);
12966     op->func_qualname = qualname;
12967     op->func_doc = NULL;
12968     op->func_classobj = NULL;
12969     op->func_globals = globals;
12970     Py_INCREF(op->func_globals);
12971     Py_XINCREF(code);
12972     op->func_code = code;
12973     op->defaults_pyobjects = 0;
12974     op->defaults_size = 0;
12975     op->defaults = NULL;
12976     op->defaults_tuple = NULL;
12977     op->defaults_kwdict = NULL;
12978     op->defaults_getter = NULL;
12979     op->func_annotations = NULL;
12980     return (PyObject *) op;
12981 }
12982 static int
12983 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
12984 {
12985     Py_CLEAR(m->func_closure);
12986     Py_CLEAR(m->func.m_module);
12987     Py_CLEAR(m->func_dict);
12988     Py_CLEAR(m->func_name);
12989     Py_CLEAR(m->func_qualname);
12990     Py_CLEAR(m->func_doc);
12991     Py_CLEAR(m->func_globals);
12992     Py_CLEAR(m->func_code);
12993     Py_CLEAR(m->func_classobj);
12994     Py_CLEAR(m->defaults_tuple);
12995     Py_CLEAR(m->defaults_kwdict);
12996     Py_CLEAR(m->func_annotations);
12997     if (m->defaults) {
12998         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
12999         int i;
13000         for (i = 0; i < m->defaults_pyobjects; i++)
13001             Py_XDECREF(pydefaults[i]);
13002         PyObject_Free(m->defaults);
13003         m->defaults = NULL;
13004     }
13005     return 0;
13006 }
13007 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
13008 {
13009     if (__Pyx_CyFunction_weakreflist(m) != NULL)
13010         PyObject_ClearWeakRefs((PyObject *) m);
13011     __Pyx_CyFunction_clear(m);
13012     PyObject_GC_Del(m);
13013 }
13014 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13015 {
13016     PyObject_GC_UnTrack(m);
13017     __Pyx__CyFunction_dealloc(m);
13018 }
13019 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13020 {
13021     Py_VISIT(m->func_closure);
13022     Py_VISIT(m->func.m_module);
13023     Py_VISIT(m->func_dict);
13024     Py_VISIT(m->func_name);
13025     Py_VISIT(m->func_qualname);
13026     Py_VISIT(m->func_doc);
13027     Py_VISIT(m->func_globals);
13028     Py_VISIT(m->func_code);
13029     Py_VISIT(m->func_classobj);
13030     Py_VISIT(m->defaults_tuple);
13031     Py_VISIT(m->defaults_kwdict);
13032     if (m->defaults) {
13033         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13034         int i;
13035         for (i = 0; i < m->defaults_pyobjects; i++)
13036             Py_VISIT(pydefaults[i]);
13037     }
13038     return 0;
13039 }
13040 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13041 {
13042 #if PY_MAJOR_VERSION < 3
13043     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13044     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13045         Py_INCREF(func);
13046         return func;
13047     }
13048     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
13049         if (type == NULL)
13050             type = (PyObject *)(Py_TYPE(obj));
13051         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
13052     }
13053     if (obj == Py_None)
13054         obj = NULL;
13055 #endif
13056     return __Pyx_PyMethod_New(func, obj, type);
13057 }
13058 static PyObject*
13059 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13060 {
13061 #if PY_MAJOR_VERSION >= 3
13062     return PyUnicode_FromFormat("<cyfunction %U at %p>",
13063                                 op->func_qualname, (void *)op);
13064 #else
13065     return PyString_FromFormat("<cyfunction %s at %p>",
13066                                PyString_AsString(op->func_qualname), (void *)op);
13067 #endif
13068 }
13069 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
13070     PyCFunctionObject* f = (PyCFunctionObject*)func;
13071     PyCFunction meth = f->m_ml->ml_meth;
13072     Py_ssize_t size;
13073     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13074     case METH_VARARGS:
13075         if (likely(kw == NULL || PyDict_Size(kw) == 0))
13076             return (*meth)(self, arg);
13077         break;
13078     case METH_VARARGS | METH_KEYWORDS:
13079         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
13080     case METH_NOARGS:
13081         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13082             size = PyTuple_GET_SIZE(arg);
13083             if (likely(size == 0))
13084                 return (*meth)(self, NULL);
13085             PyErr_Format(PyExc_TypeError,
13086                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13087                 f->m_ml->ml_name, size);
13088             return NULL;
13089         }
13090         break;
13091     case METH_O:
13092         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13093             size = PyTuple_GET_SIZE(arg);
13094             if (likely(size == 1)) {
13095                 PyObject *result, *arg0;
13096                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13097                 arg0 = PyTuple_GET_ITEM(arg, 0);
13098                 #else
13099                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13100                 #endif
13101                 result = (*meth)(self, arg0);
13102                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13103                 Py_DECREF(arg0);
13104                 #endif
13105                 return result;
13106             }
13107             PyErr_Format(PyExc_TypeError,
13108                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13109                 f->m_ml->ml_name, size);
13110             return NULL;
13111         }
13112         break;
13113     default:
13114         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
13115                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
13116                         "longer supported!");
13117         return NULL;
13118     }
13119     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13120                  f->m_ml->ml_name);
13121     return NULL;
13122 }
13123 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13124     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
13125 }
13126 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13127     PyObject *result;
13128     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13129     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13130         Py_ssize_t argc;
13131         PyObject *new_args;
13132         PyObject *self;
13133         argc = PyTuple_GET_SIZE(args);
13134         new_args = PyTuple_GetSlice(args, 1, argc);
13135         if (unlikely(!new_args))
13136             return NULL;
13137         self = PyTuple_GetItem(args, 0);
13138         if (unlikely(!self)) {
13139             Py_DECREF(new_args);
13140             return NULL;
13141         }
13142         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13143         Py_DECREF(new_args);
13144     } else {
13145         result = __Pyx_CyFunction_Call(func, args, kw);
13146     }
13147     return result;
13148 }
13149 static PyTypeObject __pyx_CyFunctionType_type = {
13150     PyVarObject_HEAD_INIT(0, 0)
13151     "cython_function_or_method",
13152     sizeof(__pyx_CyFunctionObject),
13153     0,
13154     (destructor) __Pyx_CyFunction_dealloc,
13155     0,
13156     0,
13157     0,
13158 #if PY_MAJOR_VERSION < 3
13159     0,
13160 #else
13161     0,
13162 #endif
13163     (reprfunc) __Pyx_CyFunction_repr,
13164     0,
13165     0,
13166     0,
13167     0,
13168     __Pyx_CyFunction_CallAsMethod,
13169     0,
13170     0,
13171     0,
13172     0,
13173     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
13174     0,
13175     (traverseproc) __Pyx_CyFunction_traverse,
13176     (inquiry) __Pyx_CyFunction_clear,
13177     0,
13178 #if PY_VERSION_HEX < 0x030500A0
13179     offsetof(__pyx_CyFunctionObject, func_weakreflist),
13180 #else
13181     offsetof(PyCFunctionObject, m_weakreflist),
13182 #endif
13183     0,
13184     0,
13185     __pyx_CyFunction_methods,
13186     __pyx_CyFunction_members,
13187     __pyx_CyFunction_getsets,
13188     0,
13189     0,
13190     __Pyx_CyFunction_descr_get,
13191     0,
13192     offsetof(__pyx_CyFunctionObject, func_dict),
13193     0,
13194     0,
13195     0,
13196     0,
13197     0,
13198     0,
13199     0,
13200     0,
13201     0,
13202     0,
13203     0,
13204     0,
13205 #if PY_VERSION_HEX >= 0x030400a1
13206     0,
13207 #endif
13208 #if PY_VERSION_HEX >= 0x030800b1
13209     0,
13210 #endif
13211 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
13212     0,
13213 #endif
13214 };
13215 static int __pyx_CyFunction_init(void) {
13216     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
13217     if (unlikely(__pyx_CyFunctionType == NULL)) {
13218         return -1;
13219     }
13220     return 0;
13221 }
13222 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
13223     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13224     m->defaults = PyObject_Malloc(size);
13225     if (unlikely(!m->defaults))
13226         return PyErr_NoMemory();
13227     memset(m->defaults, 0, size);
13228     m->defaults_pyobjects = pyobjects;
13229     m->defaults_size = size;
13230     return m->defaults;
13231 }
13232 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13233     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13234     m->defaults_tuple = tuple;
13235     Py_INCREF(tuple);
13236 }
13237 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
13238     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13239     m->defaults_kwdict = dict;
13240     Py_INCREF(dict);
13241 }
13242 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
13243     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13244     m->func_annotations = dict;
13245     Py_INCREF(dict);
13246 }
13247
13248 /* CythonFunction */
13249 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
13250                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13251     PyObject *op = __Pyx_CyFunction_Init(
13252         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
13253         ml, flags, qualname, closure, module, globals, code
13254     );
13255     if (likely(op)) {
13256         PyObject_GC_Track(op);
13257     }
13258     return op;
13259 }
13260
13261 /* RegisterModuleCleanup */
13262 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
13263 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
13264     __pyx_module_cleanup(module);
13265     Py_INCREF(Py_None); return Py_None;
13266 }
13267 static int __Pyx_RegisterCleanup(void) {
13268     static PyMethodDef cleanup_def = {
13269         "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
13270     PyObject *cleanup_func = 0;
13271     PyObject *atexit = 0;
13272     PyObject *reg = 0;
13273     PyObject *args = 0;
13274     PyObject *res = 0;
13275     int ret = -1;
13276     cleanup_func = PyCFunction_New(&cleanup_def, 0);
13277     if (!cleanup_func)
13278         goto bad;
13279     atexit = PyImport_ImportModule("atexit");
13280     if (!atexit)
13281         goto bad;
13282     reg = PyObject_GetAttrString(atexit, "_exithandlers");
13283     if (reg && PyList_Check(reg)) {
13284         PyObject *a, *kw;
13285         a = PyTuple_New(0);
13286         kw = PyDict_New();
13287         if (!a || !kw) {
13288             Py_XDECREF(a);
13289             Py_XDECREF(kw);
13290             goto bad;
13291         }
13292         args = PyTuple_Pack(3, cleanup_func, a, kw);
13293         Py_DECREF(a);
13294         Py_DECREF(kw);
13295         if (!args)
13296             goto bad;
13297         ret = PyList_Insert(reg, 0, args);
13298     } else {
13299         if (!reg)
13300             PyErr_Clear();
13301         Py_XDECREF(reg);
13302         reg = PyObject_GetAttrString(atexit, "register");
13303         if (!reg)
13304             goto bad;
13305         args = PyTuple_Pack(1, cleanup_func);
13306         if (!args)
13307             goto bad;
13308         res = PyObject_CallObject(reg, args);
13309         if (!res)
13310             goto bad;
13311         ret = 0;
13312     }
13313 bad:
13314     Py_XDECREF(cleanup_func);
13315     Py_XDECREF(atexit);
13316     Py_XDECREF(reg);
13317     Py_XDECREF(args);
13318     Py_XDECREF(res);
13319     return ret;
13320 }
13321 #endif
13322
13323 /* CLineInTraceback */
13324 #ifndef CYTHON_CLINE_IN_TRACEBACK
13325 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
13326     PyObject *use_cline;
13327     PyObject *ptype, *pvalue, *ptraceback;
13328 #if CYTHON_COMPILING_IN_CPYTHON
13329     PyObject **cython_runtime_dict;
13330 #endif
13331     if (unlikely(!__pyx_cython_runtime)) {
13332         return c_line;
13333     }
13334     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13335 #if CYTHON_COMPILING_IN_CPYTHON
13336     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13337     if (likely(cython_runtime_dict)) {
13338         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13339             use_cline, *cython_runtime_dict,
13340             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13341     } else
13342 #endif
13343     {
13344       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13345       if (use_cline_obj) {
13346         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13347         Py_DECREF(use_cline_obj);
13348       } else {
13349         PyErr_Clear();
13350         use_cline = NULL;
13351       }
13352     }
13353     if (!use_cline) {
13354         c_line = 0;
13355         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13356     }
13357     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13358         c_line = 0;
13359     }
13360     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13361     return c_line;
13362 }
13363 #endif
13364
13365 /* CodeObjectCache */
13366 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13367     int start = 0, mid = 0, end = count - 1;
13368     if (end >= 0 && code_line > entries[end].code_line) {
13369         return count;
13370     }
13371     while (start < end) {
13372         mid = start + (end - start) / 2;
13373         if (code_line < entries[mid].code_line) {
13374             end = mid;
13375         } else if (code_line > entries[mid].code_line) {
13376              start = mid + 1;
13377         } else {
13378             return mid;
13379         }
13380     }
13381     if (code_line <= entries[mid].code_line) {
13382         return mid;
13383     } else {
13384         return mid + 1;
13385     }
13386 }
13387 static PyCodeObject *__pyx_find_code_object(int code_line) {
13388     PyCodeObject* code_object;
13389     int pos;
13390     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13391         return NULL;
13392     }
13393     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13394     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13395         return NULL;
13396     }
13397     code_object = __pyx_code_cache.entries[pos].code_object;
13398     Py_INCREF(code_object);
13399     return code_object;
13400 }
13401 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13402     int pos, i;
13403     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13404     if (unlikely(!code_line)) {
13405         return;
13406     }
13407     if (unlikely(!entries)) {
13408         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13409         if (likely(entries)) {
13410             __pyx_code_cache.entries = entries;
13411             __pyx_code_cache.max_count = 64;
13412             __pyx_code_cache.count = 1;
13413             entries[0].code_line = code_line;
13414             entries[0].code_object = code_object;
13415             Py_INCREF(code_object);
13416         }
13417         return;
13418     }
13419     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13420     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13421         PyCodeObject* tmp = entries[pos].code_object;
13422         entries[pos].code_object = code_object;
13423         Py_DECREF(tmp);
13424         return;
13425     }
13426     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13427         int new_max = __pyx_code_cache.max_count + 64;
13428         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13429             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
13430         if (unlikely(!entries)) {
13431             return;
13432         }
13433         __pyx_code_cache.entries = entries;
13434         __pyx_code_cache.max_count = new_max;
13435     }
13436     for (i=__pyx_code_cache.count; i>pos; i--) {
13437         entries[i] = entries[i-1];
13438     }
13439     entries[pos].code_line = code_line;
13440     entries[pos].code_object = code_object;
13441     __pyx_code_cache.count++;
13442     Py_INCREF(code_object);
13443 }
13444
13445 /* AddTraceback */
13446 #include "compile.h"
13447 #include "frameobject.h"
13448 #include "traceback.h"
13449 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13450             const char *funcname, int c_line,
13451             int py_line, const char *filename) {
13452     PyCodeObject *py_code = 0;
13453     PyObject *py_srcfile = 0;
13454     PyObject *py_funcname = 0;
13455     #if PY_MAJOR_VERSION < 3
13456     py_srcfile = PyString_FromString(filename);
13457     #else
13458     py_srcfile = PyUnicode_FromString(filename);
13459     #endif
13460     if (!py_srcfile) goto bad;
13461     if (c_line) {
13462         #if PY_MAJOR_VERSION < 3
13463         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13464         #else
13465         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13466         #endif
13467     }
13468     else {
13469         #if PY_MAJOR_VERSION < 3
13470         py_funcname = PyString_FromString(funcname);
13471         #else
13472         py_funcname = PyUnicode_FromString(funcname);
13473         #endif
13474     }
13475     if (!py_funcname) goto bad;
13476     py_code = __Pyx_PyCode_New(
13477         0,
13478         0,
13479         0,
13480         0,
13481         0,
13482         __pyx_empty_bytes, /*PyObject *code,*/
13483         __pyx_empty_tuple, /*PyObject *consts,*/
13484         __pyx_empty_tuple, /*PyObject *names,*/
13485         __pyx_empty_tuple, /*PyObject *varnames,*/
13486         __pyx_empty_tuple, /*PyObject *freevars,*/
13487         __pyx_empty_tuple, /*PyObject *cellvars,*/
13488         py_srcfile,   /*PyObject *filename,*/
13489         py_funcname,  /*PyObject *name,*/
13490         py_line,
13491         __pyx_empty_bytes  /*PyObject *lnotab*/
13492     );
13493     Py_DECREF(py_srcfile);
13494     Py_DECREF(py_funcname);
13495     return py_code;
13496 bad:
13497     Py_XDECREF(py_srcfile);
13498     Py_XDECREF(py_funcname);
13499     return NULL;
13500 }
13501 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13502                                int py_line, const char *filename) {
13503     PyCodeObject *py_code = 0;
13504     PyFrameObject *py_frame = 0;
13505     PyThreadState *tstate = __Pyx_PyThreadState_Current;
13506     if (c_line) {
13507         c_line = __Pyx_CLineForTraceback(tstate, c_line);
13508     }
13509     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13510     if (!py_code) {
13511         py_code = __Pyx_CreateCodeObjectForTraceback(
13512             funcname, c_line, py_line, filename);
13513         if (!py_code) goto bad;
13514         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13515     }
13516     py_frame = PyFrame_New(
13517         tstate,            /*PyThreadState *tstate,*/
13518         py_code,           /*PyCodeObject *code,*/
13519         __pyx_d,    /*PyObject *globals,*/
13520         0                  /*PyObject *locals*/
13521     );
13522     if (!py_frame) goto bad;
13523     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13524     PyTraceBack_Here(py_frame);
13525 bad:
13526     Py_XDECREF(py_code);
13527     Py_XDECREF(py_frame);
13528 }
13529
13530 /* CIntFromPyVerify */
13531 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
13532     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
13533 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
13534     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
13535 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
13536     {\
13537         func_type value = func_value;\
13538         if (sizeof(target_type) < sizeof(func_type)) {\
13539             if (unlikely(value != (func_type) (target_type) value)) {\
13540                 func_type zero = 0;\
13541                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
13542                     return (target_type) -1;\
13543                 if (is_unsigned && unlikely(value < zero))\
13544                     goto raise_neg_overflow;\
13545                 else\
13546                     goto raise_overflow;\
13547             }\
13548         }\
13549         return (target_type) value;\
13550     }
13551
13552 /* CIntToPy */
13553 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
13554     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13555     const int is_unsigned = neg_one > const_zero;
13556     if (is_unsigned) {
13557         if (sizeof(long) < sizeof(long)) {
13558             return PyInt_FromLong((long) value);
13559         } else if (sizeof(long) <= sizeof(unsigned long)) {
13560             return PyLong_FromUnsignedLong((unsigned long) value);
13561 #ifdef HAVE_LONG_LONG
13562         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13563             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13564 #endif
13565         }
13566     } else {
13567         if (sizeof(long) <= sizeof(long)) {
13568             return PyInt_FromLong((long) value);
13569 #ifdef HAVE_LONG_LONG
13570         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13571             return PyLong_FromLongLong((PY_LONG_LONG) value);
13572 #endif
13573         }
13574     }
13575     {
13576         int one = 1; int little = (int)*(unsigned char *)&one;
13577         unsigned char *bytes = (unsigned char *)&value;
13578         return _PyLong_FromByteArray(bytes, sizeof(long),
13579                                      little, !is_unsigned);
13580     }
13581 }
13582
13583 /* CIntFromPy */
13584 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
13585     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13586     const int is_unsigned = neg_one > const_zero;
13587 #if PY_MAJOR_VERSION < 3
13588     if (likely(PyInt_Check(x))) {
13589         if (sizeof(long) < sizeof(long)) {
13590             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
13591         } else {
13592             long val = PyInt_AS_LONG(x);
13593             if (is_unsigned && unlikely(val < 0)) {
13594                 goto raise_neg_overflow;
13595             }
13596             return (long) val;
13597         }
13598     } else
13599 #endif
13600     if (likely(PyLong_Check(x))) {
13601         if (is_unsigned) {
13602 #if CYTHON_USE_PYLONG_INTERNALS
13603             const digit* digits = ((PyLongObject*)x)->ob_digit;
13604             switch (Py_SIZE(x)) {
13605                 case  0: return (long) 0;
13606                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
13607                 case 2:
13608                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13609                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13610                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13611                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
13612                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13613                         }
13614                     }
13615                     break;
13616                 case 3:
13617                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13618                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13619                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13620                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
13621                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13622                         }
13623                     }
13624                     break;
13625                 case 4:
13626                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13627                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13628                             __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])))
13629                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
13630                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13631                         }
13632                     }
13633                     break;
13634             }
13635 #endif
13636 #if CYTHON_COMPILING_IN_CPYTHON
13637             if (unlikely(Py_SIZE(x) < 0)) {
13638                 goto raise_neg_overflow;
13639             }
13640 #else
13641             {
13642                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13643                 if (unlikely(result < 0))
13644                     return (long) -1;
13645                 if (unlikely(result == 1))
13646                     goto raise_neg_overflow;
13647             }
13648 #endif
13649             if (sizeof(long) <= sizeof(unsigned long)) {
13650                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
13651 #ifdef HAVE_LONG_LONG
13652             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13653                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13654 #endif
13655             }
13656         } else {
13657 #if CYTHON_USE_PYLONG_INTERNALS
13658             const digit* digits = ((PyLongObject*)x)->ob_digit;
13659             switch (Py_SIZE(x)) {
13660                 case  0: return (long) 0;
13661                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
13662                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
13663                 case -2:
13664                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
13665                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13666                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13667                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13668                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13669                         }
13670                     }
13671                     break;
13672                 case 2:
13673                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13674                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13675                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13676                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13677                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13678                         }
13679                     }
13680                     break;
13681                 case -3:
13682                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13683                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13684                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13685                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13686                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13687                         }
13688                     }
13689                     break;
13690                 case 3:
13691                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13692                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13693                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13694                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13695                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13696                         }
13697                     }
13698                     break;
13699                 case -4:
13700                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13701                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13702                             __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])))
13703                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13704                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13705                         }
13706                     }
13707                     break;
13708                 case 4:
13709                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13710                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13711                             __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])))
13712                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13713                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13714                         }
13715                     }
13716                     break;
13717             }
13718 #endif
13719             if (sizeof(long) <= sizeof(long)) {
13720                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
13721 #ifdef HAVE_LONG_LONG
13722             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13723                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
13724 #endif
13725             }
13726         }
13727         {
13728 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13729             PyErr_SetString(PyExc_RuntimeError,
13730                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13731 #else
13732             long val;
13733             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13734  #if PY_MAJOR_VERSION < 3
13735             if (likely(v) && !PyLong_Check(v)) {
13736                 PyObject *tmp = v;
13737                 v = PyNumber_Long(tmp);
13738                 Py_DECREF(tmp);
13739             }
13740  #endif
13741             if (likely(v)) {
13742                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13743                 unsigned char *bytes = (unsigned char *)&val;
13744                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13745                                               bytes, sizeof(val),
13746                                               is_little, !is_unsigned);
13747                 Py_DECREF(v);
13748                 if (likely(!ret))
13749                     return val;
13750             }
13751 #endif
13752             return (long) -1;
13753         }
13754     } else {
13755         long val;
13756         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13757         if (!tmp) return (long) -1;
13758         val = __Pyx_PyInt_As_long(tmp);
13759         Py_DECREF(tmp);
13760         return val;
13761     }
13762 raise_overflow:
13763     PyErr_SetString(PyExc_OverflowError,
13764         "value too large to convert to long");
13765     return (long) -1;
13766 raise_neg_overflow:
13767     PyErr_SetString(PyExc_OverflowError,
13768         "can't convert negative value to long");
13769     return (long) -1;
13770 }
13771
13772 /* CIntFromPy */
13773 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13774     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
13775     const int is_unsigned = neg_one > const_zero;
13776 #if PY_MAJOR_VERSION < 3
13777     if (likely(PyInt_Check(x))) {
13778         if (sizeof(int) < sizeof(long)) {
13779             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
13780         } else {
13781             long val = PyInt_AS_LONG(x);
13782             if (is_unsigned && unlikely(val < 0)) {
13783                 goto raise_neg_overflow;
13784             }
13785             return (int) val;
13786         }
13787     } else
13788 #endif
13789     if (likely(PyLong_Check(x))) {
13790         if (is_unsigned) {
13791 #if CYTHON_USE_PYLONG_INTERNALS
13792             const digit* digits = ((PyLongObject*)x)->ob_digit;
13793             switch (Py_SIZE(x)) {
13794                 case  0: return (int) 0;
13795                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
13796                 case 2:
13797                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13798                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13799                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13800                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
13801                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13802                         }
13803                     }
13804                     break;
13805                 case 3:
13806                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13807                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13808                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13809                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
13810                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13811                         }
13812                     }
13813                     break;
13814                 case 4:
13815                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13816                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13817                             __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])))
13818                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
13819                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13820                         }
13821                     }
13822                     break;
13823             }
13824 #endif
13825 #if CYTHON_COMPILING_IN_CPYTHON
13826             if (unlikely(Py_SIZE(x) < 0)) {
13827                 goto raise_neg_overflow;
13828             }
13829 #else
13830             {
13831                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13832                 if (unlikely(result < 0))
13833                     return (int) -1;
13834                 if (unlikely(result == 1))
13835                     goto raise_neg_overflow;
13836             }
13837 #endif
13838             if (sizeof(int) <= sizeof(unsigned long)) {
13839                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13840 #ifdef HAVE_LONG_LONG
13841             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13842                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13843 #endif
13844             }
13845         } else {
13846 #if CYTHON_USE_PYLONG_INTERNALS
13847             const digit* digits = ((PyLongObject*)x)->ob_digit;
13848             switch (Py_SIZE(x)) {
13849                 case  0: return (int) 0;
13850                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
13851                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
13852                 case -2:
13853                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
13854                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13855                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13856                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13857                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13858                         }
13859                     }
13860                     break;
13861                 case 2:
13862                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13863                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13864                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13865                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13866                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13867                         }
13868                     }
13869                     break;
13870                 case -3:
13871                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13872                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13873                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13874                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13875                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13876                         }
13877                     }
13878                     break;
13879                 case 3:
13880                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13881                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13882                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13883                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13884                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13885                         }
13886                     }
13887                     break;
13888                 case -4:
13889                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13890                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13891                             __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])))
13892                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13893                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13894                         }
13895                     }
13896                     break;
13897                 case 4:
13898                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13899                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13900                             __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])))
13901                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13902                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13903                         }
13904                     }
13905                     break;
13906             }
13907 #endif
13908             if (sizeof(int) <= sizeof(long)) {
13909                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13910 #ifdef HAVE_LONG_LONG
13911             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13912                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13913 #endif
13914             }
13915         }
13916         {
13917 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13918             PyErr_SetString(PyExc_RuntimeError,
13919                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13920 #else
13921             int val;
13922             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13923  #if PY_MAJOR_VERSION < 3
13924             if (likely(v) && !PyLong_Check(v)) {
13925                 PyObject *tmp = v;
13926                 v = PyNumber_Long(tmp);
13927                 Py_DECREF(tmp);
13928             }
13929  #endif
13930             if (likely(v)) {
13931                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13932                 unsigned char *bytes = (unsigned char *)&val;
13933                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13934                                               bytes, sizeof(val),
13935                                               is_little, !is_unsigned);
13936                 Py_DECREF(v);
13937                 if (likely(!ret))
13938                     return val;
13939             }
13940 #endif
13941             return (int) -1;
13942         }
13943     } else {
13944         int val;
13945         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13946         if (!tmp) return (int) -1;
13947         val = __Pyx_PyInt_As_int(tmp);
13948         Py_DECREF(tmp);
13949         return val;
13950     }
13951 raise_overflow:
13952     PyErr_SetString(PyExc_OverflowError,
13953         "value too large to convert to int");
13954     return (int) -1;
13955 raise_neg_overflow:
13956     PyErr_SetString(PyExc_OverflowError,
13957         "can't convert negative value to int");
13958     return (int) -1;
13959 }
13960
13961 /* FastTypeChecks */
13962 #if CYTHON_COMPILING_IN_CPYTHON
13963 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
13964     while (a) {
13965         a = a->tp_base;
13966         if (a == b)
13967             return 1;
13968     }
13969     return b == &PyBaseObject_Type;
13970 }
13971 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
13972     PyObject *mro;
13973     if (a == b) return 1;
13974     mro = a->tp_mro;
13975     if (likely(mro)) {
13976         Py_ssize_t i, n;
13977         n = PyTuple_GET_SIZE(mro);
13978         for (i = 0; i < n; i++) {
13979             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
13980                 return 1;
13981         }
13982         return 0;
13983     }
13984     return __Pyx_InBases(a, b);
13985 }
13986 #if PY_MAJOR_VERSION == 2
13987 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
13988     PyObject *exception, *value, *tb;
13989     int res;
13990     __Pyx_PyThreadState_declare
13991     __Pyx_PyThreadState_assign
13992     __Pyx_ErrFetch(&exception, &value, &tb);
13993     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
13994     if (unlikely(res == -1)) {
13995         PyErr_WriteUnraisable(err);
13996         res = 0;
13997     }
13998     if (!res) {
13999         res = PyObject_IsSubclass(err, exc_type2);
14000         if (unlikely(res == -1)) {
14001             PyErr_WriteUnraisable(err);
14002             res = 0;
14003         }
14004     }
14005     __Pyx_ErrRestore(exception, value, tb);
14006     return res;
14007 }
14008 #else
14009 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
14010     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
14011     if (!res) {
14012         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14013     }
14014     return res;
14015 }
14016 #endif
14017 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14018     Py_ssize_t i, n;
14019     assert(PyExceptionClass_Check(exc_type));
14020     n = PyTuple_GET_SIZE(tuple);
14021 #if PY_MAJOR_VERSION >= 3
14022     for (i=0; i<n; i++) {
14023         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14024     }
14025 #endif
14026     for (i=0; i<n; i++) {
14027         PyObject *t = PyTuple_GET_ITEM(tuple, i);
14028         #if PY_MAJOR_VERSION < 3
14029         if (likely(exc_type == t)) return 1;
14030         #endif
14031         if (likely(PyExceptionClass_Check(t))) {
14032             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14033         } else {
14034         }
14035     }
14036     return 0;
14037 }
14038 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14039     if (likely(err == exc_type)) return 1;
14040     if (likely(PyExceptionClass_Check(err))) {
14041         if (likely(PyExceptionClass_Check(exc_type))) {
14042             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14043         } else if (likely(PyTuple_Check(exc_type))) {
14044             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14045         } else {
14046         }
14047     }
14048     return PyErr_GivenExceptionMatches(err, exc_type);
14049 }
14050 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14051     assert(PyExceptionClass_Check(exc_type1));
14052     assert(PyExceptionClass_Check(exc_type2));
14053     if (likely(err == exc_type1 || err == exc_type2)) return 1;
14054     if (likely(PyExceptionClass_Check(err))) {
14055         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14056     }
14057     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14058 }
14059 #endif
14060
14061 /* CheckBinaryVersion */
14062 static int __Pyx_check_binary_version(void) {
14063     char ctversion[4], rtversion[4];
14064     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
14065     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
14066     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
14067         char message[200];
14068         PyOS_snprintf(message, sizeof(message),
14069                       "compiletime version %s of module '%.100s' "
14070                       "does not match runtime version %s",
14071                       ctversion, __Pyx_MODULE_NAME, rtversion);
14072         return PyErr_WarnEx(NULL, message, 1);
14073     }
14074     return 0;
14075 }
14076
14077 /* FunctionExport */
14078 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
14079     PyObject *d = 0;
14080     PyObject *cobj = 0;
14081     union {
14082         void (*fp)(void);
14083         void *p;
14084     } tmp;
14085     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
14086     if (!d) {
14087         PyErr_Clear();
14088         d = PyDict_New();
14089         if (!d)
14090             goto bad;
14091         Py_INCREF(d);
14092         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
14093             goto bad;
14094     }
14095     tmp.fp = f;
14096 #if PY_VERSION_HEX >= 0x02070000
14097     cobj = PyCapsule_New(tmp.p, sig, 0);
14098 #else
14099     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
14100 #endif
14101     if (!cobj)
14102         goto bad;
14103     if (PyDict_SetItemString(d, name, cobj) < 0)
14104         goto bad;
14105     Py_DECREF(cobj);
14106     Py_DECREF(d);
14107     return 0;
14108 bad:
14109     Py_XDECREF(cobj);
14110     Py_XDECREF(d);
14111     return -1;
14112 }
14113
14114 /* InitStrings */
14115 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
14116     while (t->p) {
14117         #if PY_MAJOR_VERSION < 3
14118         if (t->is_unicode) {
14119             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14120         } else if (t->intern) {
14121             *t->p = PyString_InternFromString(t->s);
14122         } else {
14123             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14124         }
14125         #else
14126         if (t->is_unicode | t->is_str) {
14127             if (t->intern) {
14128                 *t->p = PyUnicode_InternFromString(t->s);
14129             } else if (t->encoding) {
14130                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14131             } else {
14132                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14133             }
14134         } else {
14135             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14136         }
14137         #endif
14138         if (!*t->p)
14139             return -1;
14140         if (PyObject_Hash(*t->p) == -1)
14141             return -1;
14142         ++t;
14143     }
14144     return 0;
14145 }
14146
14147 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
14148     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
14149 }
14150 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14151     Py_ssize_t ignore;
14152     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
14153 }
14154 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14155 #if !CYTHON_PEP393_ENABLED
14156 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14157     char* defenc_c;
14158     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
14159     if (!defenc) return NULL;
14160     defenc_c = PyBytes_AS_STRING(defenc);
14161 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14162     {
14163         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14164         char* c;
14165         for (c = defenc_c; c < end; c++) {
14166             if ((unsigned char) (*c) >= 128) {
14167                 PyUnicode_AsASCIIString(o);
14168                 return NULL;
14169             }
14170         }
14171     }
14172 #endif
14173     *length = PyBytes_GET_SIZE(defenc);
14174     return defenc_c;
14175 }
14176 #else
14177 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14178     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
14179 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14180     if (likely(PyUnicode_IS_ASCII(o))) {
14181         *length = PyUnicode_GET_LENGTH(o);
14182         return PyUnicode_AsUTF8(o);
14183     } else {
14184         PyUnicode_AsASCIIString(o);
14185         return NULL;
14186     }
14187 #else
14188     return PyUnicode_AsUTF8AndSize(o, length);
14189 #endif
14190 }
14191 #endif
14192 #endif
14193 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14194 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14195     if (
14196 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14197             __Pyx_sys_getdefaultencoding_not_ascii &&
14198 #endif
14199             PyUnicode_Check(o)) {
14200         return __Pyx_PyUnicode_AsStringAndSize(o, length);
14201     } else
14202 #endif
14203 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
14204     if (PyByteArray_Check(o)) {
14205         *length = PyByteArray_GET_SIZE(o);
14206         return PyByteArray_AS_STRING(o);
14207     } else
14208 #endif
14209     {
14210         char* result;
14211         int r = PyBytes_AsStringAndSize(o, &result, length);
14212         if (unlikely(r < 0)) {
14213             return NULL;
14214         } else {
14215             return result;
14216         }
14217     }
14218 }
14219 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
14220    int is_true = x == Py_True;
14221    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
14222    else return PyObject_IsTrue(x);
14223 }
14224 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
14225     int retval;
14226     if (unlikely(!x)) return -1;
14227     retval = __Pyx_PyObject_IsTrue(x);
14228     Py_DECREF(x);
14229     return retval;
14230 }
14231 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
14232 #if PY_MAJOR_VERSION >= 3
14233     if (PyLong_Check(result)) {
14234         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
14235                 "__int__ returned non-int (type %.200s).  "
14236                 "The ability to return an instance of a strict subclass of int "
14237                 "is deprecated, and may be removed in a future version of Python.",
14238                 Py_TYPE(result)->tp_name)) {
14239             Py_DECREF(result);
14240             return NULL;
14241         }
14242         return result;
14243     }
14244 #endif
14245     PyErr_Format(PyExc_TypeError,
14246                  "__%.4s__ returned non-%.4s (type %.200s)",
14247                  type_name, type_name, Py_TYPE(result)->tp_name);
14248     Py_DECREF(result);
14249     return NULL;
14250 }
14251 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
14252 #if CYTHON_USE_TYPE_SLOTS
14253   PyNumberMethods *m;
14254 #endif
14255   const char *name = NULL;
14256   PyObject *res = NULL;
14257 #if PY_MAJOR_VERSION < 3
14258   if (likely(PyInt_Check(x) || PyLong_Check(x)))
14259 #else
14260   if (likely(PyLong_Check(x)))
14261 #endif
14262     return __Pyx_NewRef(x);
14263 #if CYTHON_USE_TYPE_SLOTS
14264   m = Py_TYPE(x)->tp_as_number;
14265   #if PY_MAJOR_VERSION < 3
14266   if (m && m->nb_int) {
14267     name = "int";
14268     res = m->nb_int(x);
14269   }
14270   else if (m && m->nb_long) {
14271     name = "long";
14272     res = m->nb_long(x);
14273   }
14274   #else
14275   if (likely(m && m->nb_int)) {
14276     name = "int";
14277     res = m->nb_int(x);
14278   }
14279   #endif
14280 #else
14281   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
14282     res = PyNumber_Int(x);
14283   }
14284 #endif
14285   if (likely(res)) {
14286 #if PY_MAJOR_VERSION < 3
14287     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
14288 #else
14289     if (unlikely(!PyLong_CheckExact(res))) {
14290 #endif
14291         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14292     }
14293   }
14294   else if (!PyErr_Occurred()) {
14295     PyErr_SetString(PyExc_TypeError,
14296                     "an integer is required");
14297   }
14298   return res;
14299 }
14300 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14301   Py_ssize_t ival;
14302   PyObject *x;
14303 #if PY_MAJOR_VERSION < 3
14304   if (likely(PyInt_CheckExact(b))) {
14305     if (sizeof(Py_ssize_t) >= sizeof(long))
14306         return PyInt_AS_LONG(b);
14307     else
14308         return PyInt_AsSsize_t(b);
14309   }
14310 #endif
14311   if (likely(PyLong_CheckExact(b))) {
14312     #if CYTHON_USE_PYLONG_INTERNALS
14313     const digit* digits = ((PyLongObject*)b)->ob_digit;
14314     const Py_ssize_t size = Py_SIZE(b);
14315     if (likely(__Pyx_sst_abs(size) <= 1)) {
14316         ival = likely(size) ? digits[0] : 0;
14317         if (size == -1) ival = -ival;
14318         return ival;
14319     } else {
14320       switch (size) {
14321          case 2:
14322            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14323              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14324            }
14325            break;
14326          case -2:
14327            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14328              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14329            }
14330            break;
14331          case 3:
14332            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14333              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14334            }
14335            break;
14336          case -3:
14337            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14338              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14339            }
14340            break;
14341          case 4:
14342            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14343              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]));
14344            }
14345            break;
14346          case -4:
14347            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14348              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]));
14349            }
14350            break;
14351       }
14352     }
14353     #endif
14354     return PyLong_AsSsize_t(b);
14355   }
14356   x = PyNumber_Index(b);
14357   if (!x) return -1;
14358   ival = PyInt_AsSsize_t(x);
14359   Py_DECREF(x);
14360   return ival;
14361 }
14362 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14363   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14364 }
14365 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14366     return PyInt_FromSize_t(ival);
14367 }
14368
14369
14370 #endif /* Py_PYTHON_H */