1 /* Generated by Cython 0.29.21 */
3 /* BEGIN: Cython Metadata
8 "CYTHON_CLINE_IN_TRACEBACK",
12 "extra_compile_args": [
16 "/usr/include/libxml2",
25 "module_name": "lxml.sax"
27 END: Cython Metadata */
29 #define PY_SSIZE_T_CLEAN
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+.
36 #define CYTHON_ABI "0_29_21"
37 #define CYTHON_HEX_VERSION 0x001D15F0
38 #define CYTHON_FUTURE_DIVISION 0
41 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
55 #define DL_IMPORT(t) t
58 #define DL_EXPORT(t) t
61 #ifndef HAVE_LONG_LONG
62 #if PY_VERSION_HEX >= 0x02070000
63 #define HAVE_LONG_LONG
67 #define PY_LONG_LONG LONG_LONG
70 #define Py_HUGE_VAL HUGE_VAL
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
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
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
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
135 #ifndef CYTHON_ASSUME_SAFE_MACROS
136 #define CYTHON_ASSUME_SAFE_MACROS 1
138 #ifndef CYTHON_UNPACK_METHODS
139 #define CYTHON_UNPACK_METHODS 1
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
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
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
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
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
178 #ifndef CYTHON_USE_PYLIST_INTERNALS
179 #define CYTHON_USE_PYLIST_INTERNALS 1
181 #ifndef CYTHON_USE_UNICODE_INTERNALS
182 #define CYTHON_USE_UNICODE_INTERNALS 1
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
190 #ifndef CYTHON_AVOID_BORROWED_REFS
191 #define CYTHON_AVOID_BORROWED_REFS 0
193 #ifndef CYTHON_ASSUME_SAFE_MACROS
194 #define CYTHON_ASSUME_SAFE_MACROS 1
196 #ifndef CYTHON_UNPACK_METHODS
197 #define CYTHON_UNPACK_METHODS 1
199 #ifndef CYTHON_FAST_THREAD_STATE
200 #define CYTHON_FAST_THREAD_STATE 1
202 #ifndef CYTHON_FAST_PYCALL
203 #define CYTHON_FAST_PYCALL 1
205 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
208 #ifndef CYTHON_USE_TP_FINALIZE
209 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
211 #ifndef CYTHON_USE_DICT_VERSIONS
212 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
214 #ifndef CYTHON_USE_EXC_INFO_STACK
215 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
221 #if CYTHON_USE_PYLONG_INTERNALS
222 #include "longintrepr.h"
227 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
230 #ifndef __has_attribute
231 #define __has_attribute(x) 0
233 #ifndef __has_cpp_attribute
234 #define __has_cpp_attribute(x) 0
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
244 #define CYTHON_RESTRICT
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__))
252 # define CYTHON_UNUSED
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 # define CYTHON_UNUSED __attribute__ ((__unused__))
257 # define CYTHON_UNUSED
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 # if defined(__cplusplus)
262 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
264 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 # define CYTHON_NCP_UNUSED
271 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
276 #ifndef _MSC_STDINT_H_
278 typedef unsigned char uint8_t;
279 typedef unsigned int uint32_t;
281 typedef unsigned __int8 uint8_t;
282 typedef unsigned __int32 uint32_t;
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]]
298 #ifndef CYTHON_FALLTHROUGH
299 #if __has_attribute(fallthrough)
300 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
302 #define CYTHON_FALLTHROUGH
305 #if defined(__clang__ ) && defined(__apple_build_version__)
306 #if __apple_build_version__ < 7000000
307 #undef CYTHON_FALLTHROUGH
308 #define CYTHON_FALLTHROUGH
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
323 #define CYTHON_INLINE
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328 #define Py_OptimizeFlag 0
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
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)
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)
346 #define __Pyx_DefaultClassType PyType_Type
348 #ifndef Py_TPFLAGS_CHECKTYPES
349 #define Py_TPFLAGS_CHECKTYPES 0
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352 #define Py_TPFLAGS_HAVE_INDEX 0
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358 #define Py_TPFLAGS_HAVE_FINALIZE 0
360 #ifndef METH_STACKLESS
361 #define METH_STACKLESS 0
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364 #ifndef METH_FASTCALL
365 #define METH_FASTCALL 0x80
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);
371 #define __Pyx_PyCFunctionFast _PyCFunctionFast
372 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
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)))))
378 #define __Pyx_PyFastCFunction_Check(func) 0
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)
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)
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)
394 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
395 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
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()
404 #define __Pyx_PyThreadState_Current _PyThreadState_Current
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();
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;
419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423 return *key != Py_tss_NEEDS_INIT;
425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426 PyThread_delete_key(*key);
427 *key = Py_tss_NEEDS_INIT;
429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430 return PyThread_set_key_value(*key, value);
432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433 return PyThread_get_key_value(*key);
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
439 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
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)
445 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
446 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
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)
451 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
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)))
467 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
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))
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)
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))
492 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
493 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
495 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
496 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
498 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
499 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
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)
506 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
508 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
509 #define PyObject_ASCII(o) PyObject_Repr(o)
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
521 #if PY_MAJOR_VERSION >= 3
522 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
523 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
525 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
526 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
528 #ifndef PySet_CheckExact
529 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
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)
535 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
536 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
538 #if CYTHON_ASSUME_SAFE_MACROS
539 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
541 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
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
560 #if PY_MAJOR_VERSION >= 3
561 #define PyBoolObject PyLongObject
563 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
564 #ifndef PyUnicode_InternFromString
565 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
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
573 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
574 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
576 #if PY_MAJOR_VERSION >= 3
577 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
579 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
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)
586 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
589 #define __Pyx_PyType_AsAsync(obj) NULL
591 #ifndef __Pyx_PyAsyncMethodsStruct
596 } __Pyx_PyAsyncMethodsStruct;
599 #if defined(WIN32) || defined(MS_WINDOWS)
600 #define _USE_MATH_DEFINES
604 #define __PYX_NAN() ((float) NAN)
606 static CYTHON_INLINE float __PYX_NAN() {
608 memset(&value, 0xFF, sizeof(value));
612 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
613 #define __Pyx_truncl trunc
615 #define __Pyx_truncl truncl
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; }
623 #ifndef __PYX_EXTERN_C
625 #define __PYX_EXTERN_C extern "C"
627 #define __PYX_EXTERN_C extern
631 #define __PYX_HAVE__lxml__sax
632 #define __PYX_HAVE_API__lxml__sax
638 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
639 #define CYTHON_WITHOUT_ASSERTIONS
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;
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;
666 #if defined (__cplusplus) && __cplusplus >= 201103L
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)
680 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
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
693 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
694 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
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;
715 return (size_t)(u_end - u - 1);
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))
733 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
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))
739 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
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) {
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");
752 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
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;
760 char ascii_chars[128];
762 for (c = 0; c < 128; c++) {
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) {
772 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
776 Py_DECREF(ascii_chars_u);
777 Py_DECREF(ascii_chars_b);
779 Py_DECREF(default_encoding);
782 Py_XDECREF(default_encoding);
783 Py_XDECREF(ascii_chars_u);
784 Py_XDECREF(ascii_chars_b);
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)
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) {
796 PyObject* default_encoding = NULL;
797 char* default_encoding_c;
798 sys = PyImport_ImportModule("sys");
800 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
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);
811 Py_XDECREF(default_encoding);
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; }
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;
841 static const char *__pyx_f[] = {
846 /*--- Type declarations ---*/
847 struct __pyx_obj_4lxml_3sax_ElementTreeProducer;
850 * cdef tuple _getNsTag(tag)
852 * cdef class ElementTreeProducer: # <<<<<<<<<<<<<<
854 * cdef _content_handler
856 struct __pyx_obj_4lxml_3sax_ElementTreeProducer {
858 struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtab;
860 PyObject *_content_handler;
861 PyObject *_attr_class;
862 PyObject *_empty_attributes;
870 * class ElementTreeProducer(object): # <<<<<<<<<<<<<<
871 * """Produces SAX events for an element and children.
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);
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);
883 /* --- Runtime support code (head) --- */
885 #ifndef CYTHON_REFNANNY
886 #define CYTHON_REFNANNY 0
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;
901 #define __Pyx_RefNannySetupContext(name, 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);\
907 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
910 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
911 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
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)
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)
936 #define __Pyx_XDECREF_SET(r, v) do {\
937 PyObject *tmp = (PyObject *) r;\
938 r = v; __Pyx_XDECREF(tmp);\
940 #define __Pyx_DECREF_SET(r, v) do {\
941 PyObject *tmp = (PyObject *) r;\
942 r = v; __Pyx_DECREF(tmp);\
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)
947 /* PyObjectGetAttrStr.proto */
948 #if CYTHON_USE_TYPE_SLOTS
949 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
951 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
954 /* GetBuiltinName.proto */
955 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
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);
979 /* IncludeStringH.proto */
982 /* BytesEquals.proto */
983 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
985 /* UnicodeEquals.proto */
986 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
988 /* StrEquals.proto */
989 #if PY_MAJOR_VERSION >= 3
990 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
992 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
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);
1001 /* PyObjectCall.proto */
1002 #if CYTHON_COMPILING_IN_CPYTHON
1003 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1005 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1008 /* RaiseDoubleKeywords.proto */
1009 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
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);
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);
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;\
1033 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1034 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
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);
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);
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);\
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);\
1060 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
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);
1067 /* PyCFunctionFastCall.proto */
1068 #if CYTHON_FAST_PYCCALL
1069 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1071 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
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);
1081 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
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)
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))
1097 /* PyObjectCall2Args.proto */
1098 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1100 /* PyObjectCallMethO.proto */
1101 #if CYTHON_COMPILING_IN_CPYTHON
1102 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1105 /* PyObjectCallOneArg.proto */
1106 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
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);
1113 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1114 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
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))) {
1124 PyList_SET_ITEM(list, len, x);
1125 __Pyx_SET_SIZE(list, len + 1);
1128 return PyList_Append(list, x);
1131 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1134 /* PyObjectGetMethod.proto */
1135 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1137 /* PyObjectCallMethod1.proto */
1138 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1141 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1143 /* ObjectGetItem.proto */
1144 #if CYTHON_USE_TYPE_SLOTS
1145 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1147 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1150 /* GetTopmostException.proto */
1151 #if CYTHON_USE_EXC_INFO_STACK
1152 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
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
1161 #define __Pyx_PyThreadState_declare
1162 #define __Pyx_PyThreadState_assign
1163 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
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);
1173 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1174 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
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);
1182 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
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);
1190 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1193 /* PyObjectCallNoArg.proto */
1194 #if CYTHON_COMPILING_IN_CPYTHON
1195 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1197 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1200 /* PyObjectCallMethod0.proto */
1201 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
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))
1210 #define __Pyx_PyList_Pop(L) __Pyx__PyObject_Pop(L)
1211 #define __Pyx_PyObject_Pop(L) __Pyx__PyObject_Pop(L)
1214 /* UnpackUnboundCMethod.proto */
1217 PyObject **method_name;
1221 } __Pyx_CachedCFunction;
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))
1240 #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
1243 /* RaiseTooManyValuesToUnpack.proto */
1244 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1246 /* RaiseNeedMoreValuesToUnpack.proto */
1247 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1249 /* IterFinish.proto */
1250 static CYTHON_INLINE int __Pyx_IterFinish(void);
1252 /* UnpackItemEndCheck.proto */
1253 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1256 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1259 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
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);
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))
1281 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
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)
1294 /* RaiseException.proto */
1295 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
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)) {
1304 PyList_SET_ITEM(list, len, x);
1305 __Pyx_SET_SIZE(list, len + 1);
1308 return PyList_Append(list, x);
1311 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1315 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1317 /* ImportFrom.proto */
1318 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1320 /* GetAttr3.proto */
1321 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1323 /* py_dict_items.proto */
1324 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1326 /* dict_getitem_default.proto */
1327 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
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);
1334 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
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);
1342 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1345 /* RaiseNoneIterError.proto */
1346 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
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);
1352 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
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);
1359 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1362 /* SetVTable.proto */
1363 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1365 /* PyObjectGetAttrStrNoError.proto */
1366 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1368 /* SetupReduce.proto */
1369 static int __Pyx_setup_reduce(PyObject* type_obj);
1371 /* CalculateMetaclass.proto */
1372 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
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);
1380 /* FetchCommonType.proto */
1381 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
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)
1397 PyCFunctionObject func;
1398 #if PY_VERSION_HEX < 0x030500A0
1399 PyObject *func_weakreflist;
1401 PyObject *func_dict;
1402 PyObject *func_name;
1403 PyObject *func_qualname;
1405 PyObject *func_globals;
1406 PyObject *func_code;
1407 PyObject *func_closure;
1408 PyObject *func_classobj;
1410 int defaults_pyobjects;
1411 size_t defaults_size; // used by FusedFunction for copying defaults
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,
1423 PyObject *module, PyObject *globals,
1425 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1428 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1430 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1432 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1434 static int __pyx_CyFunction_init(void);
1436 /* CythonFunction.proto */
1437 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1438 int flags, PyObject* qualname,
1440 PyObject *module, PyObject *globals,
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))
1451 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
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);
1459 #define __Pyx_RegisterCleanup() (0)
1462 /* CLineInTraceback.proto */
1463 #ifdef CYTHON_CLINE_IN_TRACEBACK
1464 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1466 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1469 /* CodeObjectCache.proto */
1471 PyCodeObject* code_object;
1473 } __Pyx_CodeObjectCacheEntry;
1474 struct __Pyx_CodeObjectCache {
1477 __Pyx_CodeObjectCacheEntry* entries;
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);
1484 /* AddTraceback.proto */
1485 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1486 int py_line, const char *filename);
1488 /* CIntToPy.proto */
1489 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1491 /* CIntFromPy.proto */
1492 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1494 /* CIntFromPy.proto */
1495 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
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);
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))
1508 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1510 /* CheckBinaryVersion.proto */
1511 static int __Pyx_check_binary_version(void);
1513 /* FunctionExport.proto */
1514 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1516 /* InitStrings.proto */
1517 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
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*/
1522 /* Module declarations from 'cython' */
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;
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;
1920 * def _getNsTag(tag): # <<<<<<<<<<<<<<
1922 * return tuple(tag[1:].split('}', 1))
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;
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);
1938 * def _getNsTag(tag):
1939 * if tag[0] == '{': # <<<<<<<<<<<<<<
1940 * return tuple(tag[1:].split('}', 1))
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;
1950 * def _getNsTag(tag):
1952 * return tuple(tag[1:].split('}', 1)) # <<<<<<<<<<<<<<
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);
1974 * def _getNsTag(tag):
1975 * if tag[0] == '{': # <<<<<<<<<<<<<<
1976 * return tuple(tag[1:].split('}', 1))
1982 * return tuple(tag[1:].split('}', 1))
1984 * return None, tag # <<<<<<<<<<<<<<
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);
2006 * def _getNsTag(tag): # <<<<<<<<<<<<<<
2008 * return tuple(tag[1:].split('}', 1))
2011 /* function exit code */
2013 __Pyx_XDECREF(__pyx_t_1);
2014 __Pyx_XDECREF(__pyx_t_3);
2015 __Pyx_AddTraceback("lxml.sax._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
2018 __Pyx_XGIVEREF(__pyx_r);
2019 __Pyx_RefNannyFinishContext();
2024 * """Build an lxml ElementTree from SAX events.
2026 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
2027 * ContentHandler.__init__(self)
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);
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)) {
2049 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2051 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2053 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2056 default: goto __pyx_L5_argtuple_error;
2058 kw_args = PyDict_Size(__pyx_kwds);
2061 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2062 else goto __pyx_L5_argtuple_error;
2066 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_makeelement);
2067 if (value) { values[1] = value; kw_args--; }
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)
2074 switch (PyTuple_GET_SIZE(__pyx_args)) {
2075 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2077 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2079 default: goto __pyx_L5_argtuple_error;
2082 __pyx_v_self = values[0];
2083 __pyx_v_makeelement = values[1];
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)
2089 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2090 __Pyx_RefNannyFinishContext();
2092 __pyx_L4_argument_unpacking_done:;
2093 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_makeelement);
2095 /* function exit code */
2096 __Pyx_RefNannyFinishContext();
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;
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);
2116 * def __init__(self, makeelement=None):
2117 * ContentHandler.__init__(self) # <<<<<<<<<<<<<<
2119 * self._root_siblings = []
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;
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);
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;
2144 * def __init__(self, makeelement=None):
2145 * ContentHandler.__init__(self)
2146 * self._root = None # <<<<<<<<<<<<<<
2147 * self._root_siblings = []
2148 * self._element_stack = []
2150 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, Py_None) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
2153 * ContentHandler.__init__(self)
2155 * self._root_siblings = [] # <<<<<<<<<<<<<<
2156 * self._element_stack = []
2157 * self._default_ns = None
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;
2166 * self._root_siblings = []
2167 * self._element_stack = [] # <<<<<<<<<<<<<<
2168 * self._default_ns = None
2169 * self._ns_mapping = { None : [None] }
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;
2177 * self._root_siblings = []
2178 * self._element_stack = []
2179 * self._default_ns = None # <<<<<<<<<<<<<<
2180 * self._ns_mapping = { None : [None] }
2181 * self._new_mappings = {}
2183 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, Py_None) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
2186 * self._element_stack = []
2187 * self._default_ns = None
2188 * self._ns_mapping = { None : [None] } # <<<<<<<<<<<<<<
2189 * self._new_mappings = {}
2190 * if makeelement is None:
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;
2205 * self._default_ns = None
2206 * self._ns_mapping = { None : [None] }
2207 * self._new_mappings = {} # <<<<<<<<<<<<<<
2208 * if makeelement is None:
2209 * makeelement = etree.Element
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;
2217 * self._ns_mapping = { None : [None] }
2218 * self._new_mappings = {}
2219 * if makeelement is None: # <<<<<<<<<<<<<<
2220 * makeelement = etree.Element
2221 * self._makeelement = makeelement
2223 __pyx_t_4 = (__pyx_v_makeelement == Py_None);
2224 __pyx_t_5 = (__pyx_t_4 != 0);
2228 * self._new_mappings = {}
2229 * if makeelement is None:
2230 * makeelement = etree.Element # <<<<<<<<<<<<<<
2231 * self._makeelement = makeelement
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);
2243 * self._ns_mapping = { None : [None] }
2244 * self._new_mappings = {}
2245 * if makeelement is None: # <<<<<<<<<<<<<<
2246 * makeelement = etree.Element
2247 * self._makeelement = makeelement
2252 * if makeelement is None:
2253 * makeelement = etree.Element
2254 * self._makeelement = makeelement # <<<<<<<<<<<<<<
2256 * def _get_etree(self):
2258 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2, __pyx_v_makeelement) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
2261 * """Build an lxml ElementTree from SAX events.
2263 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
2264 * ContentHandler.__init__(self)
2268 /* function exit code */
2269 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
2278 __Pyx_XDECREF(__pyx_v_makeelement);
2279 __Pyx_XGIVEREF(__pyx_r);
2280 __Pyx_RefNannyFinishContext();
2285 * self._makeelement = makeelement
2287 * def _get_etree(self): # <<<<<<<<<<<<<<
2288 * "Contains the generated ElementTree after parsing is finished."
2289 * return ElementTree(self._root)
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));
2302 /* function exit code */
2303 __Pyx_RefNannyFinishContext();
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);
2320 * def _get_etree(self):
2321 * "Contains the generated ElementTree after parsing is finished."
2322 * return ElementTree(self._root) # <<<<<<<<<<<<<<
2324 * etree = property(_get_etree, doc=_get_etree.__doc__)
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);
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);
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;
2352 * self._makeelement = makeelement
2354 * def _get_etree(self): # <<<<<<<<<<<<<<
2355 * "Contains the generated ElementTree after parsing is finished."
2356 * return ElementTree(self._root)
2359 /* function exit code */
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);
2368 __Pyx_XGIVEREF(__pyx_r);
2369 __Pyx_RefNannyFinishContext();
2374 * etree = property(_get_etree, doc=_get_etree.__doc__)
2376 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
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);
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)) {
2398 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2400 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2402 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2405 default: goto __pyx_L5_argtuple_error;
2407 kw_args = PyDict_Size(__pyx_kwds);
2410 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2411 else goto __pyx_L5_argtuple_error;
2414 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_locator)) != 0)) kw_args--;
2416 __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
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)
2422 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2423 goto __pyx_L5_argtuple_error;
2425 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2426 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2428 __pyx_v_self = values[0];
2429 __pyx_v_locator = values[1];
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)
2435 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.setDocumentLocator", __pyx_clineno, __pyx_lineno, __pyx_filename);
2436 __Pyx_RefNannyFinishContext();
2438 __pyx_L4_argument_unpacking_done:;
2439 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(__pyx_self, __pyx_v_self, __pyx_v_locator);
2441 /* function exit code */
2442 __Pyx_RefNannyFinishContext();
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);
2451 /* function exit code */
2452 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2453 __Pyx_XGIVEREF(__pyx_r);
2454 __Pyx_RefNannyFinishContext();
2461 * def startDocument(self): # <<<<<<<<<<<<<<
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));
2475 /* function exit code */
2476 __Pyx_RefNannyFinishContext();
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);
2485 /* function exit code */
2486 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2487 __Pyx_XGIVEREF(__pyx_r);
2488 __Pyx_RefNannyFinishContext();
2495 * def endDocument(self): # <<<<<<<<<<<<<<
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));
2509 /* function exit code */
2510 __Pyx_RefNannyFinishContext();
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);
2519 /* function exit code */
2520 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2521 __Pyx_XGIVEREF(__pyx_r);
2522 __Pyx_RefNannyFinishContext();
2529 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
2530 * self._new_mappings[prefix] = uri
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);
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)) {
2552 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2554 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2556 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2558 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2561 default: goto __pyx_L5_argtuple_error;
2563 kw_args = PyDict_Size(__pyx_kwds);
2566 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2567 else goto __pyx_L5_argtuple_error;
2570 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2572 __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 1); __PYX_ERR(0, 65, __pyx_L3_error)
2576 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
2578 __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 2); __PYX_ERR(0, 65, __pyx_L3_error)
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)
2584 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2585 goto __pyx_L5_argtuple_error;
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);
2591 __pyx_v_self = values[0];
2592 __pyx_v_prefix = values[1];
2593 __pyx_v_uri = values[2];
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)
2599 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2600 __Pyx_RefNannyFinishContext();
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);
2605 /* function exit code */
2606 __Pyx_RefNannyFinishContext();
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;
2620 PyObject *__pyx_t_8 = NULL;
2621 PyObject *__pyx_t_9 = NULL;
2622 PyObject *__pyx_t_10 = NULL;
2625 int __pyx_lineno = 0;
2626 const char *__pyx_filename = NULL;
2627 int __pyx_clineno = 0;
2628 __Pyx_RefNannySetupContext("startPrefixMapping", 0);
2632 * def startPrefixMapping(self, prefix, uri):
2633 * self._new_mappings[prefix] = uri # <<<<<<<<<<<<<<
2635 * self._ns_mapping[prefix].append(uri)
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;
2643 * def startPrefixMapping(self, prefix, uri):
2644 * self._new_mappings[prefix] = uri
2645 * try: # <<<<<<<<<<<<<<
2646 * self._ns_mapping[prefix].append(uri)
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);
2659 * self._new_mappings[prefix] = uri
2661 * self._ns_mapping[prefix].append(uri) # <<<<<<<<<<<<<<
2663 * self._ns_mapping[prefix] = [uri]
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;
2674 * def startPrefixMapping(self, prefix, uri):
2675 * self._new_mappings[prefix] = uri
2676 * try: # <<<<<<<<<<<<<<
2677 * self._ns_mapping[prefix].append(uri)
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;
2686 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2687 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2691 * self._ns_mapping[prefix].append(uri)
2692 * except KeyError: # <<<<<<<<<<<<<<
2693 * self._ns_mapping[prefix] = [uri]
2694 * if prefix is None:
2696 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
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);
2705 * self._ns_mapping[prefix].append(uri)
2707 * self._ns_mapping[prefix] = [uri] # <<<<<<<<<<<<<<
2708 * if prefix is None:
2709 * self._default_ns = uri
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;
2726 goto __pyx_L5_except_error;
2727 __pyx_L5_except_error:;
2730 * def startPrefixMapping(self, prefix, uri):
2731 * self._new_mappings[prefix] = uri
2732 * try: # <<<<<<<<<<<<<<
2733 * self._ns_mapping[prefix].append(uri)
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);
2751 * self._ns_mapping[prefix] = [uri]
2752 * if prefix is None: # <<<<<<<<<<<<<<
2753 * self._default_ns = uri
2756 __pyx_t_11 = (__pyx_v_prefix == Py_None);
2757 __pyx_t_12 = (__pyx_t_11 != 0);
2761 * self._ns_mapping[prefix] = [uri]
2762 * if prefix is None:
2763 * self._default_ns = uri # <<<<<<<<<<<<<<
2765 * def endPrefixMapping(self, prefix):
2767 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_v_uri) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
2771 * self._ns_mapping[prefix] = [uri]
2772 * if prefix is None: # <<<<<<<<<<<<<<
2773 * self._default_ns = uri
2781 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
2782 * self._new_mappings[prefix] = uri
2786 /* function exit code */
2787 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
2798 __Pyx_XGIVEREF(__pyx_r);
2799 __Pyx_RefNannyFinishContext();
2804 * self._default_ns = uri
2806 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
2807 * ns_uri_list = self._ns_mapping[prefix]
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);
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)) {
2828 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2830 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2832 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2835 default: goto __pyx_L5_argtuple_error;
2837 kw_args = PyDict_Size(__pyx_kwds);
2840 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2841 else goto __pyx_L5_argtuple_error;
2844 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2846 __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, 1); __PYX_ERR(0, 74, __pyx_L3_error)
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)
2852 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2853 goto __pyx_L5_argtuple_error;
2855 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2856 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2858 __pyx_v_self = values[0];
2859 __pyx_v_prefix = values[1];
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)
2865 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2866 __Pyx_RefNannyFinishContext();
2868 __pyx_L4_argument_unpacking_done:;
2869 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix);
2871 /* function exit code */
2872 __Pyx_RefNannyFinishContext();
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;
2884 int __pyx_lineno = 0;
2885 const char *__pyx_filename = NULL;
2886 int __pyx_clineno = 0;
2887 __Pyx_RefNannySetupContext("endPrefixMapping", 0);
2891 * def endPrefixMapping(self, prefix):
2892 * ns_uri_list = self._ns_mapping[prefix] # <<<<<<<<<<<<<<
2894 * if prefix is None:
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;
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]
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;
2916 * ns_uri_list = self._ns_mapping[prefix]
2918 * if prefix is None: # <<<<<<<<<<<<<<
2919 * self._default_ns = ns_uri_list[-1]
2922 __pyx_t_3 = (__pyx_v_prefix == Py_None);
2923 __pyx_t_4 = (__pyx_t_3 != 0);
2928 * if prefix is None:
2929 * self._default_ns = ns_uri_list[-1] # <<<<<<<<<<<<<<
2931 * def _buildTag(self, ns_name_tuple):
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;
2939 * ns_uri_list = self._ns_mapping[prefix]
2941 * if prefix is None: # <<<<<<<<<<<<<<
2942 * self._default_ns = ns_uri_list[-1]
2948 * self._default_ns = uri
2950 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
2951 * ns_uri_list = self._ns_mapping[prefix]
2955 /* function exit code */
2956 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
2964 __Pyx_XDECREF(__pyx_v_ns_uri_list);
2965 __Pyx_XGIVEREF(__pyx_r);
2966 __Pyx_RefNannyFinishContext();
2971 * self._default_ns = ns_uri_list[-1]
2973 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
2974 * ns_uri, local_name = ns_name_tuple
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);
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)) {
2995 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2997 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2999 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3002 default: goto __pyx_L5_argtuple_error;
3004 kw_args = PyDict_Size(__pyx_kwds);
3007 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3008 else goto __pyx_L5_argtuple_error;
3011 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name_tuple)) != 0)) kw_args--;
3013 __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, 1); __PYX_ERR(0, 80, __pyx_L3_error)
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)
3019 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3020 goto __pyx_L5_argtuple_error;
3022 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3023 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3025 __pyx_v_self = values[0];
3026 __pyx_v_ns_name_tuple = values[1];
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)
3032 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3033 __Pyx_RefNannyFinishContext();
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);
3038 /* function exit code */
3039 __Pyx_RefNannyFinishContext();
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 *);
3054 int __pyx_lineno = 0;
3055 const char *__pyx_filename = NULL;
3056 int __pyx_clineno = 0;
3057 __Pyx_RefNannySetupContext("_buildTag", 0);
3061 * def _buildTag(self, ns_name_tuple):
3062 * ns_uri, local_name = ns_name_tuple # <<<<<<<<<<<<<<
3064 * el_tag = "{%s}%s" % ns_name_tuple
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)
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);
3079 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3080 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3082 __Pyx_INCREF(__pyx_t_1);
3083 __Pyx_INCREF(__pyx_t_2);
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);
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)
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;
3106 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3107 __PYX_ERR(0, 81, __pyx_L1_error)
3108 __pyx_L4_unpacking_done:;
3110 __pyx_v_ns_uri = __pyx_t_1;
3112 __pyx_v_local_name = __pyx_t_2;
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:
3122 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
3126 * ns_uri, local_name = ns_name_tuple
3128 * el_tag = "{%s}%s" % ns_name_tuple # <<<<<<<<<<<<<<
3129 * elif self._default_ns:
3130 * el_tag = "{%s}%s" % (self._default_ns, local_name)
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;
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:
3149 * el_tag = "{%s}%s" % ns_name_tuple
3150 * elif self._default_ns: # <<<<<<<<<<<<<<
3151 * el_tag = "{%s}%s" % (self._default_ns, local_name)
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;
3161 * el_tag = "{%s}%s" % ns_name_tuple
3162 * elif self._default_ns:
3163 * el_tag = "{%s}%s" % (self._default_ns, local_name) # <<<<<<<<<<<<<<
3165 * el_tag = local_name
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);
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;
3185 * el_tag = "{%s}%s" % ns_name_tuple
3186 * elif self._default_ns: # <<<<<<<<<<<<<<
3187 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3194 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3196 * el_tag = local_name # <<<<<<<<<<<<<<
3201 __Pyx_INCREF(__pyx_v_local_name);
3202 __pyx_v_el_tag = __pyx_v_local_name;
3208 * el_tag = local_name
3209 * return el_tag # <<<<<<<<<<<<<<
3211 * def startElementNS(self, ns_name, qname, attributes=None):
3213 __Pyx_XDECREF(__pyx_r);
3214 __Pyx_INCREF(__pyx_v_el_tag);
3215 __pyx_r = __pyx_v_el_tag;
3219 * self._default_ns = ns_uri_list[-1]
3221 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
3222 * ns_uri, local_name = ns_name_tuple
3226 /* function exit code */
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);
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();
3245 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
3246 * el_name = self._buildTag(ns_name)
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);
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)) {
3270 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3272 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3274 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3276 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3278 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3281 default: goto __pyx_L5_argtuple_error;
3283 kw_args = PyDict_Size(__pyx_kwds);
3286 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3287 else goto __pyx_L5_argtuple_error;
3290 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
3292 __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 1); __PYX_ERR(0, 90, __pyx_L3_error)
3296 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
3298 __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 2); __PYX_ERR(0, 90, __pyx_L3_error)
3303 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
3304 if (value) { values[3] = value; kw_args--; }
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)
3311 switch (PyTuple_GET_SIZE(__pyx_args)) {
3312 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
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);
3318 default: goto __pyx_L5_argtuple_error;
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];
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)
3330 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3331 __Pyx_RefNannyFinishContext();
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);
3336 /* function exit code */
3337 __Pyx_RefNannyFinishContext();
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;
3357 PyObject *__pyx_t_5 = NULL;
3358 PyObject *__pyx_t_6 = NULL;
3359 PyObject *__pyx_t_7 = NULL;
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 *);
3370 int __pyx_lineno = 0;
3371 const char *__pyx_filename = NULL;
3372 int __pyx_clineno = 0;
3373 __Pyx_RefNannySetupContext("startElementNS", 0);
3377 * def startElementNS(self, ns_name, qname, attributes=None):
3378 * el_name = self._buildTag(ns_name) # <<<<<<<<<<<<<<
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);
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);
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;
3403 * def startElementNS(self, ns_name, qname, attributes=None):
3404 * el_name = self._buildTag(ns_name)
3405 * if attributes: # <<<<<<<<<<<<<<
3409 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 92, __pyx_L1_error)
3413 * el_name = self._buildTag(ns_name)
3415 * attrs = {} # <<<<<<<<<<<<<<
3417 * iter_attributes = attributes.iteritems()
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);
3427 * try: # <<<<<<<<<<<<<<
3428 * iter_attributes = attributes.iteritems()
3429 * except AttributeError:
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);
3443 * iter_attributes = attributes.iteritems() # <<<<<<<<<<<<<<
3444 * except AttributeError:
3445 * iter_attributes = attributes.items()
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);
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);
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;
3470 * try: # <<<<<<<<<<<<<<
3471 * iter_attributes = attributes.iteritems()
3472 * except AttributeError:
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;
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;
3486 * iter_attributes = attributes.iteritems()
3487 * except AttributeError: # <<<<<<<<<<<<<<
3488 * iter_attributes = attributes.items()
3491 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
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);
3500 * iter_attributes = attributes.iteritems()
3501 * except AttributeError:
3502 * iter_attributes = attributes.items() # <<<<<<<<<<<<<<
3504 * for name_tuple, value in iter_attributes:
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);
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);
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);
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;
3530 goto __pyx_L6_except_error;
3531 __pyx_L6_except_error:;
3536 * try: # <<<<<<<<<<<<<<
3537 * iter_attributes = attributes.iteritems()
3538 * except AttributeError:
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);
3554 * iter_attributes = attributes.items()
3556 * for name_tuple, value in iter_attributes: # <<<<<<<<<<<<<<
3558 * attr_name = "{%s}%s" % name_tuple
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;
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)
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)
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);
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)
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);
3588 __pyx_t_2 = __pyx_t_13(__pyx_t_3);
3589 if (unlikely(!__pyx_t_2)) {
3590 PyObject* exc_type = PyErr_Occurred();
3592 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3593 else __PYX_ERR(0, 99, __pyx_L1_error)
3597 __Pyx_GOTREF(__pyx_t_2);
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)
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);
3612 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3613 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
3615 __Pyx_INCREF(__pyx_t_1);
3616 __Pyx_INCREF(__pyx_t_9);
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);
3623 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
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)
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;
3641 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3642 __PYX_ERR(0, 99, __pyx_L1_error)
3643 __pyx_L15_unpacking_done:;
3645 __Pyx_XDECREF_SET(__pyx_v_name_tuple, __pyx_t_1);
3647 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
3650 /* "lxml/sax.py":100
3652 * for name_tuple, value in iter_attributes:
3653 * if name_tuple[0]: # <<<<<<<<<<<<<<
3654 * attr_name = "{%s}%s" % name_tuple
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;
3663 /* "lxml/sax.py":101
3664 * for name_tuple, value in iter_attributes:
3666 * attr_name = "{%s}%s" % name_tuple # <<<<<<<<<<<<<<
3668 * attr_name = name_tuple[1]
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);
3675 /* "lxml/sax.py":100
3677 * for name_tuple, value in iter_attributes:
3678 * if name_tuple[0]: # <<<<<<<<<<<<<<
3679 * attr_name = "{%s}%s" % name_tuple
3685 /* "lxml/sax.py":103
3686 * attr_name = "{%s}%s" % name_tuple
3688 * attr_name = name_tuple[1] # <<<<<<<<<<<<<<
3689 * attrs[attr_name] = value
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);
3700 /* "lxml/sax.py":104
3702 * attr_name = name_tuple[1]
3703 * attrs[attr_name] = value # <<<<<<<<<<<<<<
3707 if (unlikely(PyDict_SetItem(__pyx_v_attrs, __pyx_v_attr_name, __pyx_v_value) < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
3710 * iter_attributes = attributes.items()
3712 * for name_tuple, value in iter_attributes: # <<<<<<<<<<<<<<
3714 * attr_name = "{%s}%s" % name_tuple
3717 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3720 * def startElementNS(self, ns_name, qname, attributes=None):
3721 * el_name = self._buildTag(ns_name)
3722 * if attributes: # <<<<<<<<<<<<<<
3729 /* "lxml/sax.py":106
3730 * attrs[attr_name] = value
3732 * attrs = None # <<<<<<<<<<<<<<
3734 * element_stack = self._element_stack
3737 __Pyx_INCREF(Py_None);
3738 __pyx_v_attrs = ((PyObject*)Py_None);
3742 /* "lxml/sax.py":108
3745 * element_stack = self._element_stack # <<<<<<<<<<<<<<
3746 * if self._root is None:
3747 * element = self._root = \
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;
3754 /* "lxml/sax.py":109
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)
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);
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:
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);
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);
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;
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;
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);
3813 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
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);
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;
3828 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3829 __Pyx_INCREF(__pyx_t_3);
3830 __pyx_v_element = __pyx_t_3;
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'):
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;
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)
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;
3855 __pyx_t_15 = __pyx_t_4;
3856 goto __pyx_L19_bool_binop_done;
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:;
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[:]
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;
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)
3881 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
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)
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);
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)
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);
3902 __pyx_t_3 = __pyx_t_13(__pyx_t_2);
3903 if (unlikely(!__pyx_t_3)) {
3904 PyObject* exc_type = PyErr_Occurred();
3906 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3907 else __PYX_ERR(0, 113, __pyx_L1_error)
3911 __Pyx_GOTREF(__pyx_t_3);
3913 __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
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[:]
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);
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);
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;
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[:]
3950 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
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)
3961 /* "lxml/sax.py":115
3962 * for sibling in self._root_siblings:
3963 * element.addprevious(sibling)
3964 * del self._root_siblings[:] # <<<<<<<<<<<<<<
3966 * element = SubElement(element_stack[-1], el_name,
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;
3973 /* "lxml/sax.py":109
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)
3983 /* "lxml/sax.py":117
3984 * del self._root_siblings[:]
3986 * element = SubElement(element_stack[-1], el_name, # <<<<<<<<<<<<<<
3987 * attrs, self._new_mappings)
3988 * element_stack.append(element)
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);
3996 /* "lxml/sax.py":118
3998 * element = SubElement(element_stack[-1], el_name,
3999 * attrs, self._new_mappings) # <<<<<<<<<<<<<<
4000 * element_stack.append(element)
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);
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);
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;
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;
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);
4041 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
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);
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;
4059 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4060 __pyx_v_element = __pyx_t_2;
4065 /* "lxml/sax.py":119
4066 * element = SubElement(element_stack[-1], el_name,
4067 * attrs, self._new_mappings)
4068 * element_stack.append(element) # <<<<<<<<<<<<<<
4070 * self._new_mappings.clear()
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)
4074 /* "lxml/sax.py":121
4075 * element_stack.append(element)
4077 * self._new_mappings.clear() # <<<<<<<<<<<<<<
4079 * def processingInstruction(self, target, data):
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;
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);
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;
4106 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
4107 * el_name = self._buildTag(ns_name)
4111 /* function exit code */
4112 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
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();
4138 /* "lxml/sax.py":123
4139 * self._new_mappings.clear()
4141 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
4142 * pi = ProcessingInstruction(target, data)
4143 * if self._root is None:
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);
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)) {
4164 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4166 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4168 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4170 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4173 default: goto __pyx_L5_argtuple_error;
4175 kw_args = PyDict_Size(__pyx_kwds);
4178 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4179 else goto __pyx_L5_argtuple_error;
4182 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
4184 __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 1); __PYX_ERR(0, 123, __pyx_L3_error)
4188 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4190 __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 2); __PYX_ERR(0, 123, __pyx_L3_error)
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)
4196 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4197 goto __pyx_L5_argtuple_error;
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);
4203 __pyx_v_self = values[0];
4204 __pyx_v_target = values[1];
4205 __pyx_v_data = values[2];
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)
4211 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4212 __Pyx_RefNannyFinishContext();
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);
4217 /* function exit code */
4218 __Pyx_RefNannyFinishContext();
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;
4230 PyObject *__pyx_t_5 = NULL;
4234 int __pyx_lineno = 0;
4235 const char *__pyx_filename = NULL;
4236 int __pyx_clineno = 0;
4237 __Pyx_RefNannySetupContext("processingInstruction", 0);
4239 /* "lxml/sax.py":124
4241 * def processingInstruction(self, target, data):
4242 * pi = ProcessingInstruction(target, data) # <<<<<<<<<<<<<<
4243 * if self._root is None:
4244 * self._root_siblings.append(pi)
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);
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);
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);
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);
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);
4280 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
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;
4292 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4293 __pyx_v_pi = __pyx_t_1;
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)
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);
4310 /* "lxml/sax.py":126
4311 * pi = ProcessingInstruction(target, data)
4312 * if self._root is None:
4313 * self._root_siblings.append(pi) # <<<<<<<<<<<<<<
4315 * self._element_stack[-1].append(pi)
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;
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)
4332 /* "lxml/sax.py":128
4333 * self._root_siblings.append(pi)
4335 * self._element_stack[-1].append(pi) # <<<<<<<<<<<<<<
4337 * def endElementNS(self, ns_name, qname):
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;
4350 /* "lxml/sax.py":123
4351 * self._new_mappings.clear()
4353 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
4354 * pi = ProcessingInstruction(target, data)
4355 * if self._root is None:
4358 /* function exit code */
4359 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
4369 __Pyx_XDECREF(__pyx_v_pi);
4370 __Pyx_XGIVEREF(__pyx_r);
4371 __Pyx_RefNannyFinishContext();
4375 /* "lxml/sax.py":130
4376 * self._element_stack[-1].append(pi)
4378 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
4379 * element = self._element_stack.pop()
4380 * el_tag = self._buildTag(ns_name)
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);
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)) {
4401 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4403 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4405 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4407 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4410 default: goto __pyx_L5_argtuple_error;
4412 kw_args = PyDict_Size(__pyx_kwds);
4415 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4416 else goto __pyx_L5_argtuple_error;
4419 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
4421 __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 1); __PYX_ERR(0, 130, __pyx_L3_error)
4425 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
4427 __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 2); __PYX_ERR(0, 130, __pyx_L3_error)
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)
4433 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4434 goto __pyx_L5_argtuple_error;
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);
4440 __pyx_v_self = values[0];
4441 __pyx_v_ns_name = values[1];
4442 __pyx_v_qname = values[2];
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)
4448 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4449 __Pyx_RefNannyFinishContext();
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);
4454 /* function exit code */
4455 __Pyx_RefNannyFinishContext();
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;
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);
4474 /* "lxml/sax.py":131
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:
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;
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)
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);
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);
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;
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)
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)) {
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) # <<<<<<<<<<<<<<
4536 * def startElement(self, name, attributes=None):
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);
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);
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)
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)
4571 /* "lxml/sax.py":130
4572 * self._element_stack[-1].append(pi)
4574 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
4575 * element = self._element_stack.pop()
4576 * el_tag = self._buildTag(ns_name)
4579 /* function exit code */
4580 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
4590 __Pyx_XDECREF(__pyx_v_element);
4591 __Pyx_XDECREF(__pyx_v_el_tag);
4592 __Pyx_XGIVEREF(__pyx_r);
4593 __Pyx_RefNannyFinishContext();
4597 /* "lxml/sax.py":136
4598 * raise SaxError("Unexpected element closed: " + el_tag)
4600 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
4602 * attributes = dict(
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);
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)) {
4624 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4626 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4628 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4630 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4633 default: goto __pyx_L5_argtuple_error;
4635 kw_args = PyDict_Size(__pyx_kwds);
4638 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4639 else goto __pyx_L5_argtuple_error;
4642 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
4644 __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4649 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
4650 if (value) { values[2] = value; kw_args--; }
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)
4657 switch (PyTuple_GET_SIZE(__pyx_args)) {
4658 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4660 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4661 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4663 default: goto __pyx_L5_argtuple_error;
4666 __pyx_v_self = values[0];
4667 __pyx_v_name = values[1];
4668 __pyx_v_attributes = values[2];
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)
4674 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4675 __Pyx_RefNannyFinishContext();
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);
4680 /* function exit code */
4681 __Pyx_RefNannyFinishContext();
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
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 *);
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);
4707 /* "lxml/sax.py":137
4709 * def startElement(self, name, attributes=None):
4710 * if attributes: # <<<<<<<<<<<<<<
4711 * attributes = dict(
4712 * [((None, k), v) for k, v in attributes.items()]
4714 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 137, __pyx_L1_error)
4717 /* "lxml/sax.py":139
4719 * attributes = dict(
4720 * [((None, k), v) for k, v in attributes.items()] # <<<<<<<<<<<<<<
4722 * self.startElementNS((None, name), name, attributes)
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);
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);
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;
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)
4751 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
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)
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);
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)
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);
4772 __pyx_t_3 = __pyx_t_7(__pyx_t_4);
4773 if (unlikely(!__pyx_t_3)) {
4774 PyObject* exc_type = PyErr_Occurred();
4776 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4777 else __PYX_ERR(0, 139, __pyx_L1_error)
4781 __Pyx_GOTREF(__pyx_t_3);
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)
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);
4796 __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
4797 __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
4799 __Pyx_INCREF(__pyx_t_5);
4800 __Pyx_INCREF(__pyx_t_8);
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);
4807 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
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)
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;
4825 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4826 __PYX_ERR(0, 139, __pyx_L1_error)
4827 __pyx_L7_unpacking_done:;
4829 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
4831 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
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);
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;
4852 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4854 /* "lxml/sax.py":138
4855 * def startElement(self, name, attributes=None):
4857 * attributes = dict( # <<<<<<<<<<<<<<
4858 * [((None, k), v) for k, v in attributes.items()]
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);
4867 /* "lxml/sax.py":137
4869 * def startElement(self, name, attributes=None):
4870 * if attributes: # <<<<<<<<<<<<<<
4871 * attributes = dict(
4872 * [((None, k), v) for k, v in attributes.items()]
4876 /* "lxml/sax.py":141
4877 * [((None, k), v) for k, v in attributes.items()]
4879 * self.startElementNS((None, name), name, attributes) # <<<<<<<<<<<<<<
4881 * def endElement(self, name):
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);
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);
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;
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;
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);
4927 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
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);
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;
4942 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4943 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4945 /* "lxml/sax.py":136
4946 * raise SaxError("Unexpected element closed: " + el_tag)
4948 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
4950 * attributes = dict(
4953 /* function exit code */
4954 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
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();
4974 /* "lxml/sax.py":143
4975 * self.startElementNS((None, name), name, attributes)
4977 * def endElement(self, name): # <<<<<<<<<<<<<<
4978 * self.endElementNS((None, name), name)
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);
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)) {
4999 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5001 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5003 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5006 default: goto __pyx_L5_argtuple_error;
5008 kw_args = PyDict_Size(__pyx_kwds);
5011 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5012 else goto __pyx_L5_argtuple_error;
5015 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
5017 __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, 1); __PYX_ERR(0, 143, __pyx_L3_error)
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)
5023 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5024 goto __pyx_L5_argtuple_error;
5026 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5027 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5029 __pyx_v_self = values[0];
5030 __pyx_v_name = values[1];
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)
5036 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5037 __Pyx_RefNannyFinishContext();
5039 __pyx_L4_argument_unpacking_done:;
5040 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(__pyx_self, __pyx_v_self, __pyx_v_name);
5042 /* function exit code */
5043 __Pyx_RefNannyFinishContext();
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;
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);
5061 /* "lxml/sax.py":144
5063 * def endElement(self, name):
5064 * self.endElementNS((None, name), name) # <<<<<<<<<<<<<<
5066 * def characters(self, data):
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);
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);
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;
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;
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);
5112 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
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);
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;
5124 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5125 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5127 /* "lxml/sax.py":143
5128 * self.startElementNS((None, name), name, attributes)
5130 * def endElement(self, name): # <<<<<<<<<<<<<<
5131 * self.endElementNS((None, name), name)
5135 /* function exit code */
5136 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
5147 __Pyx_XGIVEREF(__pyx_r);
5148 __Pyx_RefNannyFinishContext();
5152 /* "lxml/sax.py":146
5153 * self.endElementNS((None, name), name)
5155 * def characters(self, data): # <<<<<<<<<<<<<<
5156 * last_element = self._element_stack[-1]
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);
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)) {
5177 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5179 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5181 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5184 default: goto __pyx_L5_argtuple_error;
5186 kw_args = PyDict_Size(__pyx_kwds);
5189 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5190 else goto __pyx_L5_argtuple_error;
5193 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
5195 __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, 1); __PYX_ERR(0, 146, __pyx_L3_error)
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)
5201 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5202 goto __pyx_L5_argtuple_error;
5204 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5205 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5207 __pyx_v_self = values[0];
5208 __pyx_v_data = values[1];
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)
5214 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5215 __Pyx_RefNannyFinishContext();
5217 __pyx_L4_argument_unpacking_done:;
5218 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(__pyx_self, __pyx_v_self, __pyx_v_data);
5220 /* function exit code */
5221 __Pyx_RefNannyFinishContext();
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;
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);
5244 /* "lxml/sax.py":147
5246 * def characters(self, data):
5247 * last_element = self._element_stack[-1] # <<<<<<<<<<<<<<
5249 * # if there already is a child element, we must append to its tail
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;
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]
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);
5275 /* "lxml/sax.py":150
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:
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);
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
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)
5298 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
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;
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;
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]
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;
5327 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5328 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
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
5337 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
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);
5345 /* "lxml/sax.py":154
5346 * except IndexError:
5347 * # otherwise: append to the text
5348 * last_element.text = (last_element.text or '') + data # <<<<<<<<<<<<<<
5350 * ignorableWhitespace = characters
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)
5356 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
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;
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;
5376 goto __pyx_L5_except_error;
5377 __pyx_L5_except_error:;
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]
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);
5399 /* "lxml/sax.py":146
5400 * self.endElementNS((None, name), name)
5402 * def characters(self, data): # <<<<<<<<<<<<<<
5403 * last_element = self._element_stack[-1]
5407 /* function exit code */
5408 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
5419 __Pyx_XDECREF(__pyx_v_last_element);
5420 __Pyx_XGIVEREF(__pyx_r);
5421 __Pyx_RefNannyFinishContext();
5425 /* "lxml/sax.py":162
5426 * """Produces SAX events for an element and children.
5428 * def __init__(self, element_or_tree, content_handler): # <<<<<<<<<<<<<<
5430 * element = element_or_tree.getroot()
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;
5442 __Pyx_RefNannyDeclarations
5443 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
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)) {
5449 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5451 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5453 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5456 default: goto __pyx_L5_argtuple_error;
5458 kw_args = PyDict_Size(__pyx_kwds);
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;
5465 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
5467 __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 162, __pyx_L3_error)
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)
5473 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5474 goto __pyx_L5_argtuple_error;
5476 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5477 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5479 __pyx_v_element_or_tree = values[0];
5480 __pyx_v_content_handler = values[1];
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)
5486 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5487 __Pyx_RefNannyFinishContext();
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);
5492 /* function exit code */
5493 __Pyx_RefNannyFinishContext();
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;
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;
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);
5517 /* "lxml/sax.py":163
5519 * def __init__(self, element_or_tree, content_handler):
5520 * try: # <<<<<<<<<<<<<<
5521 * element = element_or_tree.getroot()
5522 * except AttributeError:
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);
5533 /* "lxml/sax.py":164
5534 * def __init__(self, element_or_tree, content_handler):
5536 * element = element_or_tree.getroot() # <<<<<<<<<<<<<<
5537 * except AttributeError:
5538 * element = element_or_tree
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);
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);
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;
5560 /* "lxml/sax.py":163
5562 * def __init__(self, element_or_tree, content_handler):
5563 * try: # <<<<<<<<<<<<<<
5564 * element = element_or_tree.getroot()
5565 * except AttributeError:
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;
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;
5577 /* "lxml/sax.py":165
5579 * element = element_or_tree.getroot()
5580 * except AttributeError: # <<<<<<<<<<<<<<
5581 * element = element_or_tree
5582 * self._element = element
5584 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
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);
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
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;
5606 goto __pyx_L5_except_error;
5607 __pyx_L5_except_error:;
5609 /* "lxml/sax.py":163
5611 * def __init__(self, element_or_tree, content_handler):
5612 * try: # <<<<<<<<<<<<<<
5613 * element = element_or_tree.getroot()
5614 * except AttributeError:
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);
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
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;
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
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;
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({}, {})
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;
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({}, {})
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;
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({}, {}) # <<<<<<<<<<<<<<
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;
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);
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;
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;
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);
5738 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
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);
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;
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;
5757 /* "lxml/sax.py":162
5758 * """Produces SAX events for an element and children.
5760 * def __init__(self, element_or_tree, content_handler): # <<<<<<<<<<<<<<
5762 * element = element_or_tree.getroot()
5765 /* function exit code */
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);
5778 __Pyx_XDECREF(__pyx_v_element);
5779 __Pyx_XDECREF(__pyx_v_attr_class);
5780 __Pyx_RefNannyFinishContext();
5784 /* "lxml/sax.py":173
5785 * self._empty_attributes = attr_class({}, {})
5787 * def saxify(self): # <<<<<<<<<<<<<<
5788 * self._content_handler.startDocument()
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));
5801 /* function exit code */
5802 __Pyx_RefNannyFinishContext();
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;
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);
5824 /* "lxml/sax.py":174
5827 * self._content_handler.startDocument() # <<<<<<<<<<<<<<
5829 * element = self._element
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);
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);
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;
5850 /* "lxml/sax.py":176
5851 * self._content_handler.startDocument()
5853 * element = self._element # <<<<<<<<<<<<<<
5854 * if hasattr(element, 'getprevious'):
5857 __pyx_t_1 = __pyx_v_self->_element;
5858 __Pyx_INCREF(__pyx_t_1);
5859 __pyx_v_element = __pyx_t_1;
5862 /* "lxml/sax.py":177
5864 * element = self._element
5865 * if hasattr(element, 'getprevious'): # <<<<<<<<<<<<<<
5867 * sibling = element.getprevious()
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);
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:
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);
5885 /* "lxml/sax.py":179
5886 * if hasattr(element, 'getprevious'):
5888 * sibling = element.getprevious() # <<<<<<<<<<<<<<
5889 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
5890 * siblings.append(sibling)
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);
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);
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;
5912 /* "lxml/sax.py":180
5914 * sibling = element.getprevious()
5915 * while getattr(sibling, 'tag', None) is ProcessingInstruction: # <<<<<<<<<<<<<<
5916 * siblings.append(sibling)
5917 * sibling = sibling.getprevious()
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;
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]:
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)
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, {})
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);
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);
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);
5967 /* "lxml/sax.py":183
5968 * siblings.append(sibling)
5969 * sibling = sibling.getprevious()
5970 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
5971 * self._recursive_saxify(sibling, {})
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;
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)
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);
5986 __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5989 /* "lxml/sax.py":184
5990 * sibling = sibling.getprevious()
5991 * for sibling in siblings[::-1]:
5992 * self._recursive_saxify(sibling, {}) # <<<<<<<<<<<<<<
5994 * self._recursive_saxify(element, {})
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;
6003 /* "lxml/sax.py":183
6004 * siblings.append(sibling)
6005 * sibling = sibling.getprevious()
6006 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
6007 * self._recursive_saxify(sibling, {})
6011 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6013 /* "lxml/sax.py":177
6015 * element = self._element
6016 * if hasattr(element, 'getprevious'): # <<<<<<<<<<<<<<
6018 * sibling = element.getprevious()
6022 /* "lxml/sax.py":186
6023 * self._recursive_saxify(sibling, {})
6025 * self._recursive_saxify(element, {}) # <<<<<<<<<<<<<<
6027 * if hasattr(element, 'getnext'):
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;
6036 /* "lxml/sax.py":188
6037 * self._recursive_saxify(element, {})
6039 * if hasattr(element, 'getnext'): # <<<<<<<<<<<<<<
6040 * sibling = element.getnext()
6041 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
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);
6047 /* "lxml/sax.py":189
6049 * if hasattr(element, 'getnext'):
6050 * sibling = element.getnext() # <<<<<<<<<<<<<<
6051 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6052 * self._recursive_saxify(sibling, {})
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);
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);
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);
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()
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;
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()
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;
6106 /* "lxml/sax.py":192
6107 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6108 * self._recursive_saxify(sibling, {})
6109 * sibling = sibling.getnext() # <<<<<<<<<<<<<<
6111 * self._content_handler.endDocument()
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);
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);
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);
6134 /* "lxml/sax.py":188
6135 * self._recursive_saxify(element, {})
6137 * if hasattr(element, 'getnext'): # <<<<<<<<<<<<<<
6138 * sibling = element.getnext()
6139 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6143 /* "lxml/sax.py":194
6144 * sibling = sibling.getnext()
6146 * self._content_handler.endDocument() # <<<<<<<<<<<<<<
6148 * def _recursive_saxify(self, element, parent_nsmap):
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);
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);
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;
6169 /* "lxml/sax.py":173
6170 * self._empty_attributes = attr_class({}, {})
6172 * def saxify(self): # <<<<<<<<<<<<<<
6173 * self._content_handler.startDocument()
6177 /* function exit code */
6178 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
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();
6195 /* "lxml/sax.py":196
6196 * self._content_handler.endDocument()
6198 * def _recursive_saxify(self, element, parent_nsmap): # <<<<<<<<<<<<<<
6199 * content_handler = self._content_handler
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;
6229 PyObject *__pyx_t_5 = NULL;
6230 PyObject *__pyx_t_6 = NULL;
6231 PyObject *__pyx_t_7 = NULL;
6232 PyObject *__pyx_t_8 = NULL;
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 *);
6239 int __pyx_lineno = 0;
6240 const char *__pyx_filename = NULL;
6241 int __pyx_clineno = 0;
6242 __Pyx_RefNannySetupContext("_recursive_saxify", 0);
6244 /* "lxml/sax.py":197
6246 * def _recursive_saxify(self, element, parent_nsmap):
6247 * content_handler = self._content_handler # <<<<<<<<<<<<<<
6249 * if tag is Comment or tag is ProcessingInstruction:
6251 __pyx_t_1 = __pyx_v_self->_content_handler;
6252 __Pyx_INCREF(__pyx_t_1);
6253 __pyx_v_content_handler = __pyx_t_1;
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:
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;
6268 /* "lxml/sax.py":199
6269 * content_handler = self._content_handler
6271 * if tag is Comment or tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6272 * if tag is ProcessingInstruction:
6273 * content_handler.processingInstruction(
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);
6282 __pyx_t_2 = __pyx_t_4;
6283 goto __pyx_L4_bool_binop_done;
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:;
6294 /* "lxml/sax.py":200
6296 * if tag is Comment or tag is ProcessingInstruction:
6297 * if tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6298 * content_handler.processingInstruction(
6299 * element.target, element.text)
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);
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
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);
6318 /* "lxml/sax.py":202
6319 * if tag is ProcessingInstruction:
6320 * content_handler.processingInstruction(
6321 * element.target, element.text) # <<<<<<<<<<<<<<
6322 * tail = element.tail
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);
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);
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;
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;
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);
6365 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
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);
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;
6377 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6378 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6380 /* "lxml/sax.py":200
6382 * if tag is Comment or tag is ProcessingInstruction:
6383 * if tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6384 * content_handler.processingInstruction(
6385 * element.target, element.text)
6389 /* "lxml/sax.py":203
6390 * content_handler.processingInstruction(
6391 * element.target, element.text)
6392 * tail = element.tail # <<<<<<<<<<<<<<
6394 * content_handler.characters(tail)
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;
6401 /* "lxml/sax.py":204
6402 * element.target, element.text)
6403 * tail = element.tail
6404 * if tail: # <<<<<<<<<<<<<<
6405 * content_handler.characters(tail)
6408 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
6411 /* "lxml/sax.py":205
6412 * tail = element.tail
6414 * content_handler.characters(tail) # <<<<<<<<<<<<<<
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);
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);
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;
6437 /* "lxml/sax.py":204
6438 * element.target, element.text)
6439 * tail = element.tail
6440 * if tail: # <<<<<<<<<<<<<<
6441 * content_handler.characters(tail)
6446 /* "lxml/sax.py":206
6448 * content_handler.characters(tail)
6449 * return # <<<<<<<<<<<<<<
6451 * element_nsmap = element.nsmap
6453 __Pyx_XDECREF(__pyx_r);
6454 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6457 /* "lxml/sax.py":199
6458 * content_handler = self._content_handler
6460 * if tag is Comment or tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6461 * if tag is ProcessingInstruction:
6462 * content_handler.processingInstruction(
6466 /* "lxml/sax.py":208
6469 * element_nsmap = element.nsmap # <<<<<<<<<<<<<<
6471 * if element_nsmap != parent_nsmap:
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);
6479 /* "lxml/sax.py":209
6481 * element_nsmap = element.nsmap
6482 * new_prefixes = [] # <<<<<<<<<<<<<<
6483 * if element_nsmap != parent_nsmap:
6484 * # There have been updates to the namespace
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);
6491 /* "lxml/sax.py":210
6492 * element_nsmap = element.nsmap
6494 * if element_nsmap != parent_nsmap: # <<<<<<<<<<<<<<
6495 * # There have been updates to the namespace
6496 * for prefix, ns_uri in element_nsmap.items():
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;
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) )
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)
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;
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)
6524 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
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)
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);
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)
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);
6545 __pyx_t_1 = __pyx_t_12(__pyx_t_5);
6546 if (unlikely(!__pyx_t_1)) {
6547 PyObject* exc_type = PyErr_Occurred();
6549 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6550 else __PYX_ERR(0, 212, __pyx_L1_error)
6554 __Pyx_GOTREF(__pyx_t_1);
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)
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);
6569 __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
6570 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
6572 __Pyx_INCREF(__pyx_t_10);
6573 __Pyx_INCREF(__pyx_t_7);
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);
6580 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
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)
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;
6598 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6599 __PYX_ERR(0, 212, __pyx_L1_error)
6600 __pyx_L12_unpacking_done:;
6602 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
6604 __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_7);
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) )
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)
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;
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) ) # <<<<<<<<<<<<<<
6631 * attribs = element.items()
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;
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) )
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) )
6661 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6663 /* "lxml/sax.py":210
6664 * element_nsmap = element.nsmap
6666 * if element_nsmap != parent_nsmap: # <<<<<<<<<<<<<<
6667 * # There have been updates to the namespace
6668 * for prefix, ns_uri in element_nsmap.items():
6672 /* "lxml/sax.py":216
6673 * new_prefixes.append( (prefix, ns_uri) )
6675 * attribs = element.items() # <<<<<<<<<<<<<<
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);
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);
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;
6699 /* "lxml/sax.py":217
6701 * attribs = element.items()
6702 * if attribs: # <<<<<<<<<<<<<<
6706 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attribs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
6709 /* "lxml/sax.py":218
6710 * attribs = element.items()
6712 * attr_values = {} # <<<<<<<<<<<<<<
6714 * for attr_ns_name, value in attribs:
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);
6721 /* "lxml/sax.py":219
6724 * attr_qnames = {} # <<<<<<<<<<<<<<
6725 * for attr_ns_name, value in attribs:
6726 * attr_ns_tuple = _getNsTag(attr_ns_name)
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);
6733 /* "lxml/sax.py":220
6736 * for attr_ns_name, value in attribs: # <<<<<<<<<<<<<<
6737 * attr_ns_tuple = _getNsTag(attr_ns_name)
6738 * attr_values[attr_ns_tuple] = value
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;
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)
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)
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);
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)
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);
6768 __pyx_t_7 = __pyx_t_12(__pyx_t_5);
6769 if (unlikely(!__pyx_t_7)) {
6770 PyObject* exc_type = PyErr_Occurred();
6772 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6773 else __PYX_ERR(0, 220, __pyx_L1_error)
6777 __Pyx_GOTREF(__pyx_t_7);
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)
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);
6792 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
6793 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
6795 __Pyx_INCREF(__pyx_t_1);
6796 __Pyx_INCREF(__pyx_t_10);
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);
6803 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
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)
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;
6821 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6822 __PYX_ERR(0, 220, __pyx_L1_error)
6823 __pyx_L18_unpacking_done:;
6825 __Pyx_XDECREF_SET(__pyx_v_attr_ns_name, __pyx_t_1);
6827 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
6830 /* "lxml/sax.py":221
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(
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));
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,
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)
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)
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)
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)
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);
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)
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;
6885 /* "lxml/sax.py":220
6888 * for attr_ns_name, value in attribs: # <<<<<<<<<<<<<<
6889 * attr_ns_tuple = _getNsTag(attr_ns_name)
6890 * attr_values[attr_ns_tuple] = value
6893 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
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) # <<<<<<<<<<<<<<
6900 * sax_attributes = self._empty_attributes
6902 __Pyx_INCREF(__pyx_v_self->_attr_class);
6903 __pyx_t_1 = __pyx_v_self->_attr_class; __pyx_t_10 = NULL;
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);
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);
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);
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);
6935 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
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;
6947 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6948 __pyx_v_sax_attributes = __pyx_t_5;
6951 /* "lxml/sax.py":217
6953 * attribs = element.items()
6954 * if attribs: # <<<<<<<<<<<<<<
6961 /* "lxml/sax.py":228
6962 * sax_attributes = self._attr_class(attr_values, attr_qnames)
6964 * sax_attributes = self._empty_attributes # <<<<<<<<<<<<<<
6966 * ns_uri, local_name = _getNsTag(tag)
6969 __pyx_t_5 = __pyx_v_self->_empty_attributes;
6970 __Pyx_INCREF(__pyx_t_5);
6971 __pyx_v_sax_attributes = __pyx_t_5;
6976 /* "lxml/sax.py":230
6977 * sax_attributes = self._empty_attributes
6979 * ns_uri, local_name = _getNsTag(tag) # <<<<<<<<<<<<<<
6980 * qname = self._build_qname(
6981 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
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)
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);
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);
7004 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7006 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 230, __pyx_L1_error)
7008 __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_1);
7010 __pyx_v_local_name = __pyx_t_7;
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) # <<<<<<<<<<<<<<
7018 * for prefix, uri in new_prefixes:
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);
7023 /* "lxml/sax.py":231
7025 * ns_uri, local_name = _getNsTag(tag)
7026 * qname = self._build_qname( # <<<<<<<<<<<<<<
7027 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
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;
7036 /* "lxml/sax.py":234
7037 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7039 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7040 * content_handler.startPrefixMapping(prefix, uri)
7041 * content_handler.startElementNS(
7043 __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
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)
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);
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)
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);
7065 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
7066 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
7068 __Pyx_INCREF(__pyx_t_1);
7069 __Pyx_INCREF(__pyx_t_10);
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);
7076 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
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)
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;
7094 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7095 __PYX_ERR(0, 234, __pyx_L1_error)
7096 __pyx_L22_unpacking_done:;
7098 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_1);
7100 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_10);
7103 /* "lxml/sax.py":235
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)
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);
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);
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);
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);
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);
7144 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
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;
7156 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7157 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7159 /* "lxml/sax.py":234
7160 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7162 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7163 * content_handler.startPrefixMapping(prefix, uri)
7164 * content_handler.startElementNS(
7167 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
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
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);
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
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);
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);
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;
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;
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);
7228 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
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);
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;
7243 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7244 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7246 /* "lxml/sax.py":238
7247 * content_handler.startElementNS(
7248 * (ns_uri, local_name), qname, sax_attributes)
7249 * text = element.text # <<<<<<<<<<<<<<
7251 * content_handler.characters(text)
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;
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:
7265 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
7268 /* "lxml/sax.py":240
7269 * text = element.text
7271 * content_handler.characters(text) # <<<<<<<<<<<<<<
7272 * for child in element:
7273 * self._recursive_saxify(child, element_nsmap)
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);
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);
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;
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:
7303 /* "lxml/sax.py":241
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)
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;
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)
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)
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);
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)
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);
7338 __pyx_t_5 = __pyx_t_12(__pyx_t_7);
7339 if (unlikely(!__pyx_t_5)) {
7340 PyObject* exc_type = PyErr_Occurred();
7342 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7343 else __PYX_ERR(0, 241, __pyx_L1_error)
7347 __Pyx_GOTREF(__pyx_t_5);
7349 __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
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:
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;
7363 /* "lxml/sax.py":241
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)
7371 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
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)
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);
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);
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;
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;
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);
7424 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
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);
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;
7436 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7437 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
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
7446 __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
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)
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);
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)
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);
7468 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
7469 __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
7471 __Pyx_INCREF(__pyx_t_6);
7472 __Pyx_INCREF(__pyx_t_1);
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);
7479 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
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)
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;
7497 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7498 __PYX_ERR(0, 244, __pyx_L1_error)
7499 __pyx_L29_unpacking_done:;
7501 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
7503 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
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
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);
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);
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;
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
7540 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7542 /* "lxml/sax.py":246
7543 * for prefix, uri in new_prefixes:
7544 * content_handler.endPrefixMapping(prefix)
7545 * tail = element.tail # <<<<<<<<<<<<<<
7547 * content_handler.characters(tail)
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;
7554 /* "lxml/sax.py":247
7555 * content_handler.endPrefixMapping(prefix)
7556 * tail = element.tail
7557 * if tail: # <<<<<<<<<<<<<<
7558 * content_handler.characters(tail)
7561 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7564 /* "lxml/sax.py":248
7565 * tail = element.tail
7567 * content_handler.characters(tail) # <<<<<<<<<<<<<<
7569 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
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);
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);
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;
7590 /* "lxml/sax.py":247
7591 * content_handler.endPrefixMapping(prefix)
7592 * tail = element.tail
7593 * if tail: # <<<<<<<<<<<<<<
7594 * content_handler.characters(tail)
7599 /* "lxml/sax.py":196
7600 * self._content_handler.endDocument()
7602 * def _recursive_saxify(self, element, parent_nsmap): # <<<<<<<<<<<<<<
7603 * content_handler = self._content_handler
7607 /* function exit code */
7608 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
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();
7644 /* "lxml/sax.py":250
7645 * content_handler.characters(tail)
7647 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute): # <<<<<<<<<<<<<<
7648 * if ns_uri is None:
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
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 *);
7671 int __pyx_lineno = 0;
7672 const char *__pyx_filename = NULL;
7673 int __pyx_clineno = 0;
7674 __Pyx_RefNannySetupContext("_build_qname", 0);
7676 /* "lxml/sax.py":251
7678 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7679 * if ns_uri is None: # <<<<<<<<<<<<<<
7683 __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
7684 __pyx_t_2 = (__pyx_t_1 != 0);
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 # <<<<<<<<<<<<<<
7692 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7694 __Pyx_XDECREF(__pyx_r);
7695 __Pyx_INCREF(__pyx_v_local_name);
7696 __pyx_r = __pyx_v_local_name;
7699 /* "lxml/sax.py":251
7701 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7702 * if ns_uri is None: # <<<<<<<<<<<<<<
7708 /* "lxml/sax.py":254
7711 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri: # <<<<<<<<<<<<<<
7712 * prefix = preferred_prefix
7715 __pyx_t_1 = ((!(__pyx_v_is_attribute != 0)) != 0);
7718 __pyx_t_2 = __pyx_t_1;
7719 goto __pyx_L5_bool_binop_done;
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)
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:;
7735 /* "lxml/sax.py":255
7737 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7738 * prefix = preferred_prefix # <<<<<<<<<<<<<<
7740 * # Pick the first matching prefix, in alphabetical order.
7742 __Pyx_INCREF(__pyx_v_preferred_prefix);
7743 __pyx_v_prefix = __pyx_v_preferred_prefix;
7745 /* "lxml/sax.py":254
7748 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri: # <<<<<<<<<<<<<<
7749 * prefix = preferred_prefix
7755 /* "lxml/sax.py":258
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
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);
7766 /* "lxml/sax.py":259
7767 * # Pick the first matching prefix, in alphabetical order.
7769 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7770 * if pfx is not None and uri == ns_uri
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)
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;
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)
7787 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
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)
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);
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)
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);
7808 __pyx_t_3 = __pyx_t_7(__pyx_t_5);
7809 if (unlikely(!__pyx_t_3)) {
7810 PyObject* exc_type = PyErr_Occurred();
7812 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7813 else __PYX_ERR(0, 259, __pyx_L1_error)
7817 __Pyx_GOTREF(__pyx_t_3);
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)
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);
7832 __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
7833 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
7835 __Pyx_INCREF(__pyx_t_8);
7836 __Pyx_INCREF(__pyx_t_9);
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);
7843 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
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)
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;
7861 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7862 __PYX_ERR(0, 259, __pyx_L1_error)
7863 __pyx_L10_unpacking_done:;
7865 __Pyx_XDECREF_SET(__pyx_v_pfx, __pyx_t_8);
7867 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_9);
7870 /* "lxml/sax.py":260
7872 * pfx for (pfx, uri) in nsmap.items()
7873 * if pfx is not None and uri == ns_uri # <<<<<<<<<<<<<<
7877 __pyx_t_1 = (__pyx_v_pfx != Py_None);
7878 __pyx_t_12 = (__pyx_t_1 != 0);
7881 __pyx_t_2 = __pyx_t_12;
7882 goto __pyx_L12_bool_binop_done;
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:;
7891 /* "lxml/sax.py":259
7892 * # Pick the first matching prefix, in alphabetical order.
7894 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7895 * if pfx is not None and uri == ns_uri
7898 if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_pfx))) __PYX_ERR(0, 258, __pyx_L1_error)
7900 /* "lxml/sax.py":260
7902 * pfx for (pfx, uri) in nsmap.items()
7903 * if pfx is not None and uri == ns_uri # <<<<<<<<<<<<<<
7909 /* "lxml/sax.py":259
7910 * # Pick the first matching prefix, in alphabetical order.
7912 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7913 * if pfx is not None and uri == ns_uri
7917 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7918 __pyx_v_candidates = ((PyObject*)__pyx_t_4);
7921 /* "lxml/sax.py":263
7924 * candidates[0] if len(candidates) == 1 # <<<<<<<<<<<<<<
7925 * else min(candidates) if candidates
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;
7936 /* "lxml/sax.py":264
7938 * candidates[0] if len(candidates) == 1
7939 * else min(candidates) if candidates # <<<<<<<<<<<<<<
7943 __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
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;
7951 /* "lxml/sax.py":265
7952 * candidates[0] if len(candidates) == 1
7953 * else min(candidates) if candidates
7954 * else None # <<<<<<<<<<<<<<
7958 __Pyx_INCREF(Py_None);
7959 __pyx_t_5 = Py_None;
7961 __pyx_t_4 = __pyx_t_5;
7964 __pyx_v_prefix = __pyx_t_4;
7969 /* "lxml/sax.py":268
7972 * if prefix is None: # <<<<<<<<<<<<<<
7973 * # Default namespace
7976 __pyx_t_2 = (__pyx_v_prefix == Py_None);
7977 __pyx_t_12 = (__pyx_t_2 != 0);
7980 /* "lxml/sax.py":270
7981 * if prefix is None:
7982 * # Default namespace
7983 * return local_name # <<<<<<<<<<<<<<
7984 * return prefix + ':' + local_name
7987 __Pyx_XDECREF(__pyx_r);
7988 __Pyx_INCREF(__pyx_v_local_name);
7989 __pyx_r = __pyx_v_local_name;
7992 /* "lxml/sax.py":268
7995 * if prefix is None: # <<<<<<<<<<<<<<
7996 * # Default namespace
8001 /* "lxml/sax.py":271
8002 * # Default namespace
8004 * return prefix + ':' + local_name # <<<<<<<<<<<<<<
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;
8018 /* "lxml/sax.py":250
8019 * content_handler.characters(tail)
8021 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute): # <<<<<<<<<<<<<<
8022 * if ns_uri is None:
8026 /* function exit code */
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);
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();
8046 /* "(tree fragment)":1
8047 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
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));
8061 /* function exit code */
8062 __Pyx_RefNannyFinishContext();
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;
8075 PyObject *__pyx_t_4 = NULL;
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);
8083 /* "(tree fragment)":5
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:
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);
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:
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;
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: # <<<<<<<<<<<<<<
8124 * use_setstate = True
8126 __pyx_t_2 = (__pyx_v__dict != Py_None);
8127 __pyx_t_3 = (__pyx_t_2 != 0);
8130 /* "(tree fragment)":8
8131 * _dict = getattr(self, '__dict__', None)
8132 * if _dict is not None:
8133 * state += (_dict,) # <<<<<<<<<<<<<<
8134 * use_setstate = True
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));
8148 /* "(tree fragment)":9
8149 * if _dict is not None:
8151 * use_setstate = True # <<<<<<<<<<<<<<
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
8155 __pyx_v_use_setstate = 1;
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: # <<<<<<<<<<<<<<
8162 * use_setstate = True
8167 /* "(tree fragment)":11
8168 * use_setstate = True
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 # <<<<<<<<<<<<<<
8172 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8175 __pyx_t_2 = (__pyx_v_self->_attr_class != Py_None);
8176 __pyx_t_5 = (__pyx_t_2 != 0);
8179 __pyx_t_3 = __pyx_t_5;
8180 goto __pyx_L4_bool_binop_done;
8182 __pyx_t_5 = (__pyx_v_self->_content_handler != Py_None);
8183 __pyx_t_2 = (__pyx_t_5 != 0);
8186 __pyx_t_3 = __pyx_t_2;
8187 goto __pyx_L4_bool_binop_done;
8189 __pyx_t_2 = (__pyx_v_self->_element != Py_None);
8190 __pyx_t_5 = (__pyx_t_2 != 0);
8193 __pyx_t_3 = __pyx_t_5;
8194 goto __pyx_L4_bool_binop_done;
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;
8204 /* "(tree fragment)":12
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
8211 __pyx_t_3 = (__pyx_v_use_setstate != 0);
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
8217 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state # <<<<<<<<<<<<<<
8219 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
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);
8246 __pyx_r = __pyx_t_6;
8250 /* "(tree fragment)":12
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
8259 /* "(tree fragment)":15
8260 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
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)
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);
8289 __pyx_r = __pyx_t_4;
8294 /* "(tree fragment)":1
8295 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8300 /* function exit code */
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);
8308 __Pyx_XDECREF(__pyx_v_state);
8309 __Pyx_XDECREF(__pyx_v__dict);
8310 __Pyx_XGIVEREF(__pyx_r);
8311 __Pyx_RefNannyFinishContext();
8315 /* "(tree fragment)":16
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)
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));
8331 /* function exit code */
8332 __Pyx_RefNannyFinishContext();
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);
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) # <<<<<<<<<<<<<<
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;
8355 /* "(tree fragment)":16
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)
8362 /* function exit code */
8363 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8366 __Pyx_XDECREF(__pyx_t_1);
8367 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8370 __Pyx_XGIVEREF(__pyx_r);
8371 __Pyx_RefNannyFinishContext();
8375 /* "lxml/sax.py":274
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.
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);
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)) {
8401 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8403 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8405 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8408 default: goto __pyx_L5_argtuple_error;
8410 kw_args = PyDict_Size(__pyx_kwds);
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;
8417 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
8419 __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, 1); __PYX_ERR(0, 274, __pyx_L3_error)
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)
8425 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8426 goto __pyx_L5_argtuple_error;
8428 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8429 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8431 __pyx_v_element_or_tree = values[0];
8432 __pyx_v_content_handler = values[1];
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)
8438 __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8439 __Pyx_RefNannyFinishContext();
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);
8444 /* function exit code */
8445 __Pyx_RefNannyFinishContext();
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);
8460 /* "lxml/sax.py":278
8461 * them against a SAX ContentHandler.
8463 * return ElementTreeProducer(element_or_tree, content_handler).saxify() # <<<<<<<<<<<<<<
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;
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);
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;
8499 /* "lxml/sax.py":274
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.
8507 /* function exit code */
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);
8515 __Pyx_XGIVEREF(__pyx_r);
8516 __Pyx_RefNannyFinishContext();
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
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);
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)) {
8544 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8546 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8548 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8550 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8553 default: goto __pyx_L5_argtuple_error;
8555 kw_args = PyDict_Size(__pyx_kwds);
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;
8562 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
8564 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
8568 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8570 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
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)
8576 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8577 goto __pyx_L5_argtuple_error;
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);
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];
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)
8591 __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8592 __Pyx_RefNannyFinishContext();
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);
8597 /* function exit code */
8598 __Pyx_RefNannyFinishContext();
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
8608 PyObject *__pyx_t_2 = NULL;
8609 PyObject *__pyx_t_3 = NULL;
8610 PyObject *__pyx_t_4 = NULL;
8611 PyObject *__pyx_t_5 = NULL;
8613 int __pyx_lineno = 0;
8614 const char *__pyx_filename = NULL;
8615 int __pyx_clineno = 0;
8616 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer", 0);
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)
8625 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x1d4a0fa) != 0);
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)
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;
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:
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);
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)
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)
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)
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);
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);
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;
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
8726 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
8727 __pyx_t_6 = (__pyx_t_1 != 0);
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):
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;
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
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]
8758 __Pyx_XDECREF(__pyx_r);
8759 __Pyx_INCREF(__pyx_v___pyx_result);
8760 __pyx_r = __pyx_v___pyx_result;
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
8769 /* function exit code */
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);
8778 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
8779 __Pyx_XDECREF(__pyx_v___pyx_result);
8780 __Pyx_XGIVEREF(__pyx_r);
8781 __Pyx_RefNannyFinishContext();
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__'):
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;
8798 Py_ssize_t __pyx_t_3;
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);
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])
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)
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;
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)
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;
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)
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;
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)
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;
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])
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)
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);
8875 __pyx_t_2 = __pyx_t_4;
8876 goto __pyx_L4_bool_binop_done;
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:;
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]) # <<<<<<<<<<<<<<
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)
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);
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);
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;
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])
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__'):
8934 /* function exit code */
8935 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
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);
8945 __Pyx_XGIVEREF(__pyx_r);
8946 __Pyx_RefNannyFinishContext();
8949 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer __pyx_vtable_4lxml_3sax_ElementTreeProducer;
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;
8954 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
8955 o = (*t->tp_alloc)(t, 0);
8957 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
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);
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;
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);
8984 static int __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer(PyObject *o, visitproc v, void *a) {
8986 struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8988 e = (*v)(p->_element, a); if (e) return e;
8990 if (p->_content_handler) {
8991 e = (*v)(p->_content_handler, a); if (e) return e;
8993 if (p->_attr_class) {
8994 e = (*v)(p->_attr_class, a); if (e) return e;
8996 if (p->_empty_attributes) {
8997 e = (*v)(p->_empty_attributes, a); if (e) return e;
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);
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},
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*/
9023 __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer, /*tp_dealloc*/
9024 #if PY_VERSION_HEX < 0x030800b4
9027 #if PY_VERSION_HEX >= 0x030800b4
9028 0, /*tp_vectorcall_offset*/
9032 #if PY_MAJOR_VERSION < 3
9035 #if PY_MAJOR_VERSION >= 3
9040 0, /*tp_as_sequence*/
9041 0, /*tp_as_mapping*/
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*/
9056 __pyx_methods_4lxml_3sax_ElementTreeProducer, /*tp_methods*/
9063 0, /*tp_dictoffset*/
9064 __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__, /*tp_init*/
9066 __pyx_tp_new_4lxml_3sax_ElementTreeProducer, /*tp_new*/
9072 0, /*tp_subclasses*/
9075 0, /*tp_version_tag*/
9076 #if PY_VERSION_HEX >= 0x030400a1
9079 #if PY_VERSION_HEX >= 0x030800b1
9080 0, /*tp_vectorcall*/
9082 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9087 static PyMethodDef __pyx_methods[] = {
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},
9102 static struct PyModuleDef __pyx_moduledef = {
9103 PyModuleDef_HEAD_INIT,
9105 __pyx_k_SAX_based_adapter_to_copy_trees, /* m_doc */
9106 #if CYTHON_PEP489_MULTI_PHASE_INIT
9111 __pyx_methods /* m_methods */,
9112 #if CYTHON_PEP489_MULTI_PHASE_INIT
9113 __pyx_moduledef_slots, /* m_slots */
9115 NULL, /* m_reload */
9117 NULL, /* m_traverse */
9119 (freefunc)__pyx_module_cleanup /* m_free */
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))
9128 #define CYTHON_SMALL_CODE
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}
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)
9298 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9299 __Pyx_RefNannyDeclarations
9300 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9303 * def _getNsTag(tag):
9305 * return tuple(tag[1:].split('}', 1)) # <<<<<<<<<<<<<<
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);
9316 /* "lxml/sax.py":115
9317 * for sibling in self._root_siblings:
9318 * element.addprevious(sibling)
9319 * del self._root_siblings[:] # <<<<<<<<<<<<<<
9321 * element = SubElement(element_stack[-1], el_name,
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);
9327 /* "lxml/sax.py":183
9328 * siblings.append(sibling)
9329 * sibling = sibling.getprevious()
9330 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
9331 * self._recursive_saxify(sibling, {})
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);
9339 * """Build an lxml ElementTree from SAX events.
9341 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
9342 * ContentHandler.__init__(self)
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);
9354 * self._makeelement = makeelement
9356 * def _get_etree(self): # <<<<<<<<<<<<<<
9357 * "Contains the generated ElementTree after parsing is finished."
9358 * return ElementTree(self._root)
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)
9366 * etree = property(_get_etree, doc=_get_etree.__doc__)
9368 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
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)
9380 * def startDocument(self): # <<<<<<<<<<<<<<
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)
9392 * def endDocument(self): # <<<<<<<<<<<<<<
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)
9404 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
9405 * self._new_mappings[prefix] = uri
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)
9414 * self._default_ns = uri
9416 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
9417 * ns_uri_list = self._ns_mapping[prefix]
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)
9426 * self._default_ns = ns_uri_list[-1]
9428 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
9429 * ns_uri, local_name = ns_name_tuple
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)
9440 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
9441 * el_name = self._buildTag(ns_name)
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);
9452 /* "lxml/sax.py":123
9453 * self._new_mappings.clear()
9455 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
9456 * pi = ProcessingInstruction(target, data)
9457 * if self._root is None:
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)
9464 /* "lxml/sax.py":130
9465 * self._element_stack[-1].append(pi)
9467 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
9468 * element = self._element_stack.pop()
9469 * el_tag = self._buildTag(ns_name)
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)
9476 /* "lxml/sax.py":136
9477 * raise SaxError("Unexpected element closed: " + el_tag)
9479 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
9481 * attributes = dict(
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);
9491 /* "lxml/sax.py":143
9492 * self.startElementNS((None, name), name, attributes)
9494 * def endElement(self, name): # <<<<<<<<<<<<<<
9495 * self.endElementNS((None, name), name)
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)
9503 /* "lxml/sax.py":146
9504 * self.endElementNS((None, name), name)
9506 * def characters(self, data): # <<<<<<<<<<<<<<
9507 * last_element = self._element_stack[-1]
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)
9515 /* "lxml/sax.py":173
9516 * self._empty_attributes = attr_class({}, {})
9518 * def saxify(self): # <<<<<<<<<<<<<<
9519 * self._content_handler.startDocument()
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)
9527 /* "(tree fragment)":1
9528 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
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)
9537 /* "(tree fragment)":16
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)
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)
9548 /* "lxml/sax.py":274
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.
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)
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
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();
9572 __Pyx_RefNannyFinishContext();
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)
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*/
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();
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();
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();
9624 __Pyx_RefNannyFinishContext();
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;
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;
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();
9652 __Pyx_RefNannyFinishContext();
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();
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();
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();
9681 #ifndef CYTHON_NO_PYINIT_EXPORT
9682 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9683 #elif PY_MAJOR_VERSION < 3
9685 #define __Pyx_PyMODINIT_FUNC extern "C" void
9687 #define __Pyx_PyMODINIT_FUNC void
9691 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9693 #define __Pyx_PyMODINIT_FUNC PyObject *
9698 #if PY_MAJOR_VERSION < 3
9699 __Pyx_PyMODINIT_FUNC initsax(void) CYTHON_SMALL_CODE; /*proto*/
9700 __Pyx_PyMODINIT_FUNC initsax(void)
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
9706 return PyModuleDef_Init(&__pyx_moduledef);
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))
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))
9726 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
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);
9734 if (likely(value)) {
9735 if (allow_none || value != Py_None) {
9736 result = PyDict_SetItemString(moddict, to_name, value);
9739 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
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())
9751 return __Pyx_NewRef(__pyx_m);
9752 modname = PyObject_GetAttrString(spec, "name");
9753 if (unlikely(!modname)) goto bad;
9754 module = PyModule_NewObject(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;
9770 static CYTHON_SMALL_CODE int __pyx_pymod_exec_sax(PyObject *__pyx_pyinit_module)
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
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.");
9791 #elif PY_MAJOR_VERSION >= 3
9792 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
9795 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9796 if (!__Pyx_RefNanny) {
9798 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9799 if (!__Pyx_RefNanny)
9800 Py_FatalError("failed to import 'refnanny' module");
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();
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)
9814 #ifdef __Pyx_FusedFunction_USED
9815 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9817 #ifdef __Pyx_Coroutine_USED
9818 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9820 #ifdef __Pyx_Generator_USED
9821 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9823 #ifdef __Pyx_AsyncGen_USED
9824 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9826 #ifdef __Pyx_StopAsyncIteration_USED
9827 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
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();
9836 /*--- Module creation code ---*/
9837 #if CYTHON_PEP489_MULTI_PHASE_INIT
9838 __pyx_m = __pyx_pyinit_module;
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);
9844 __pyx_m = PyModule_Create(&__pyx_moduledef);
9846 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
9848 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
9850 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
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)
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)
9863 #if PY_MAJOR_VERSION >= 3
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)
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)
9889 * from __future__ import absolute_import
9891 * from xml.sax.handler import ContentHandler # <<<<<<<<<<<<<<
9892 * from lxml import etree
9893 * from lxml.etree import ElementTree, SubElement
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;
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
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;
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
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;
9959 * from lxml import etree
9960 * from lxml.etree import ElementTree, SubElement
9961 * from lxml.etree import Comment, ProcessingInstruction # <<<<<<<<<<<<<<
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;
9989 * class SaxError(etree.LxmlError): # <<<<<<<<<<<<<<
9990 * """General SAX error.
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);
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;
10015 /* "lxml/sax.py":35
10018 * class ElementTreeContentHandler(ContentHandler): # <<<<<<<<<<<<<<
10019 * """Build an lxml ElementTree from SAX events.
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);
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);
10034 /* "lxml/sax.py":38
10035 * """Build an lxml ElementTree from SAX events.
10037 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
10038 * ContentHandler.__init__(self)
10039 * self._root = None
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;
10047 /* "lxml/sax.py":50
10048 * self._makeelement = makeelement
10050 * def _get_etree(self): # <<<<<<<<<<<<<<
10051 * "Contains the generated ElementTree after parsing is finished."
10052 * return ElementTree(self._root)
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;
10059 /* "lxml/sax.py":54
10060 * return ElementTree(self._root)
10062 * etree = property(_get_etree, doc=_get_etree.__doc__) # <<<<<<<<<<<<<<
10064 * def setDocumentLocator(self, locator):
10066 __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10067 if (unlikely(!__pyx_t_4)) {
10069 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_etree);
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);
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)) {
10083 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_etree);
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;
10099 /* "lxml/sax.py":56
10100 * etree = property(_get_etree, doc=_get_etree.__doc__)
10102 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
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;
10111 /* "lxml/sax.py":59
10114 * def startDocument(self): # <<<<<<<<<<<<<<
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;
10123 /* "lxml/sax.py":62
10126 * def endDocument(self): # <<<<<<<<<<<<<<
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;
10135 /* "lxml/sax.py":65
10138 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
10139 * self._new_mappings[prefix] = uri
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;
10147 /* "lxml/sax.py":74
10148 * self._default_ns = uri
10150 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
10151 * ns_uri_list = self._ns_mapping[prefix]
10152 * ns_uri_list.pop()
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;
10159 /* "lxml/sax.py":80
10160 * self._default_ns = ns_uri_list[-1]
10162 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
10163 * ns_uri, local_name = ns_name_tuple
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;
10171 /* "lxml/sax.py":90
10174 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
10175 * el_name = self._buildTag(ns_name)
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;
10184 /* "lxml/sax.py":123
10185 * self._new_mappings.clear()
10187 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
10188 * pi = ProcessingInstruction(target, data)
10189 * if self._root is None:
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;
10196 /* "lxml/sax.py":130
10197 * self._element_stack[-1].append(pi)
10199 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
10200 * element = self._element_stack.pop()
10201 * el_tag = self._buildTag(ns_name)
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;
10208 /* "lxml/sax.py":136
10209 * raise SaxError("Unexpected element closed: " + el_tag)
10211 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
10213 * attributes = dict(
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;
10221 /* "lxml/sax.py":143
10222 * self.startElementNS((None, name), name, attributes)
10224 * def endElement(self, name): # <<<<<<<<<<<<<<
10225 * self.endElementNS((None, name), name)
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;
10233 /* "lxml/sax.py":146
10234 * self.endElementNS((None, name), name)
10236 * def characters(self, data): # <<<<<<<<<<<<<<
10237 * last_element = self._element_stack[-1]
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;
10245 /* "lxml/sax.py":156
10246 * last_element.text = (last_element.text or '') + data
10248 * ignorableWhitespace = characters # <<<<<<<<<<<<<<
10252 __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_characters);
10253 if (unlikely(!__pyx_t_7)) {
10255 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_characters);
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;
10262 /* "lxml/sax.py":35
10265 * class ElementTreeContentHandler(ContentHandler): # <<<<<<<<<<<<<<
10266 * """Build an lxml ElementTree from SAX events.
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;
10277 /* "lxml/sax.py":173
10278 * self._empty_attributes = attr_class({}, {})
10280 * def saxify(self): # <<<<<<<<<<<<<<
10281 * self._content_handler.startDocument()
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);
10290 /* "(tree fragment)":1
10291 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10293 * cdef object _dict
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);
10301 /* "(tree fragment)":16
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)
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);
10313 /* "lxml/sax.py":274
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.
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;
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
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;
10336 * # cython: language_level=2 # <<<<<<<<<<<<<<
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;
10345 /*--- Wrapped vars code ---*/
10347 if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __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);
10359 __Pyx_AddTraceback("init lxml.sax", __pyx_clineno, __pyx_lineno, __pyx_filename);
10362 } else if (!PyErr_Occurred()) {
10363 PyErr_SetString(PyExc_ImportError, "init lxml.sax");
10366 __Pyx_RefNannyFinishContext();
10367 #if CYTHON_PEP489_MULTI_PHASE_INIT
10368 return (__pyx_m != NULL) ? 0 : -1;
10369 #elif PY_MAJOR_VERSION >= 3
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);
10432 PyMem_Free(entries);
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);
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);
10452 Py_CLEAR(__pyx_cython_runtime);
10456 /* --- Runtime support code --- */
10458 #if CYTHON_REFNANNY
10459 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10460 PyObject *m = NULL, *p = NULL;
10462 m = PyImport_ImportModule(modname);
10464 p = PyObject_GetAttrString(m, "RefNannyAPI");
10466 r = PyLong_AsVoidPtr(p);
10470 return (__Pyx_RefNannyAPIStruct *)r;
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));
10484 return PyObject_GetAttr(obj, attr_name);
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);
10496 "name '%.200s' is not defined", PyString_AS_STRING(name));
10503 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
10505 if (!j) return NULL;
10506 r = PyObject_GetItem(o, j);
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);
10518 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
10519 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
10523 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10525 return PySequence_GetItem(o, i);
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);
10536 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
10537 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
10541 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10543 return PySequence_GetItem(o, i);
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);
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);
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)) {
10573 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10578 return m->sq_item(o, i);
10582 if (is_list || PySequence_Check(o)) {
10583 return PySequence_GetItem(o, i);
10586 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
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);
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);
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);
10617 result = memcmp(ps1, ps2, (size_t)length);
10618 return (equals == Py_EQ) ? (result == 0) : (result != 0);
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);
10626 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10629 result = __Pyx_PyObject_IsTrue(py_result);
10630 Py_DECREF(py_result);
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);
10641 #if PY_MAJOR_VERSION < 3
10642 PyObject* owned_ref = NULL;
10644 int s1_is_unicode, s2_is_unicode;
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))
10657 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10658 owned_ref = PyUnicode_FromObject(s1);
10659 if (unlikely(!owned_ref))
10663 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10664 return __Pyx_PyBytes_Equals(s1, s2, equals);
10667 if (s1_is_unicode & s2_is_unicode) {
10670 void *data1, *data2;
10671 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10673 length = __Pyx_PyUnicode_GET_LENGTH(s1);
10674 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10677 #if CYTHON_USE_UNICODE_INTERNALS
10679 Py_hash_t hash1, hash2;
10680 #if CYTHON_PEP393_ENABLED
10681 hash1 = ((PyASCIIObject*)s1)->hash;
10682 hash2 = ((PyASCIIObject*)s2)->hash;
10684 hash1 = ((PyUnicodeObject*)s1)->hash;
10685 hash2 = ((PyUnicodeObject*)s2)->hash;
10687 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10692 kind = __Pyx_PyUnicode_KIND(s1);
10693 if (kind != __Pyx_PyUnicode_KIND(s2)) {
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)) {
10700 } else if (length == 1) {
10703 int result = memcmp(data1, data2, (size_t)(length * kind));
10704 #if PY_MAJOR_VERSION < 3
10705 Py_XDECREF(owned_ref);
10707 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10709 } else if ((s1 == Py_None) & s2_is_unicode) {
10711 } else if ((s2 == Py_None) & s1_is_unicode) {
10715 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10716 #if PY_MAJOR_VERSION < 3
10717 Py_XDECREF(owned_ref);
10721 result = __Pyx_PyObject_IsTrue(py_result);
10722 Py_DECREF(py_result);
10726 #if PY_MAJOR_VERSION < 3
10727 Py_XDECREF(owned_ref);
10729 return (equals == Py_EQ);
10731 #if PY_MAJOR_VERSION < 3
10732 Py_XDECREF(owned_ref);
10734 return (equals == Py_NE);
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)) {
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;
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;
10760 cstop = PY_SSIZE_T_MAX;
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)) {
10767 if (cstop < 0) cstop = 0;
10771 if (cstart < 0) cstart = 0;
10774 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10779 return ms->sq_slice(obj, cstart, cstop);
10782 mp = Py_TYPE(obj)->tp_as_mapping;
10783 if (likely(mp && mp->mp_subscript))
10787 PyObject *py_slice, *py_start, *py_stop;
10789 py_slice = *_py_slice;
10791 PyObject* owned_start = NULL;
10792 PyObject* owned_stop = NULL;
10794 py_start = *_py_start;
10797 owned_start = py_start = PyInt_FromSsize_t(cstart);
10798 if (unlikely(!py_start)) goto bad;
10800 py_start = Py_None;
10803 py_stop = *_py_stop;
10806 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
10807 if (unlikely(!py_stop)) {
10808 Py_XDECREF(owned_start);
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;
10819 #if CYTHON_USE_TYPE_SLOTS
10820 result = mp->mp_subscript(obj, py_slice);
10822 result = PyObject_GetItem(obj, py_slice);
10825 Py_DECREF(py_slice);
10829 PyErr_Format(PyExc_TypeError,
10830 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
10836 #if CYTHON_COMPILING_IN_CPYTHON
10837 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
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")))
10844 result = (*call)(func, arg, kw);
10845 Py_LeaveRecursiveCall();
10846 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10849 "NULL result without error in PyObject_Call");
10855 /* RaiseDoubleKeywords */
10856 static void __Pyx_RaiseDoubleKeywordsError(
10857 const char* func_name,
10860 PyErr_Format(PyExc_TypeError,
10861 #if PY_MAJOR_VERSION >= 3
10862 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
10864 "%s() got multiple values for keyword argument '%s'", func_name,
10865 PyString_AsString(kw_name));
10869 /* ParseKeywords */
10870 static int __Pyx_ParseOptionalKeywords(
10872 PyObject **argnames[],
10874 PyObject *values[],
10875 Py_ssize_t num_pos_args,
10876 const char* function_name)
10878 PyObject *key = 0, *value = 0;
10879 Py_ssize_t pos = 0;
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++;
10886 values[name-argnames] = value;
10889 name = first_kw_arg;
10890 #if PY_MAJOR_VERSION < 3
10891 if (likely(PyString_Check(key))) {
10893 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
10894 && _PyString_Eq(**name, key)) {
10895 values[name-argnames] = value;
10900 if (*name) continue;
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;
10914 if (likely(PyUnicode_Check(key))) {
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 :
10920 PyUnicode_Compare(**name, key);
10921 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10923 values[name-argnames] = value;
10928 if (*name) continue;
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 :
10936 PyUnicode_Compare(**argname, key);
10937 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10938 if (cmp == 0) goto arg_passed_twice;
10943 goto invalid_keyword_type;
10945 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10947 goto invalid_keyword;
10952 __Pyx_RaiseDoubleKeywordsError(function_name, key);
10954 invalid_keyword_type:
10955 PyErr_Format(PyExc_TypeError,
10956 "%.200s() keywords must be strings", function_name);
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));
10964 "%s() got an unexpected keyword argument '%U'",
10965 function_name, key);
10971 /* RaiseArgTupleInvalid */
10972 static void __Pyx_RaiseArgtupleInvalid(
10973 const char* func_name,
10975 Py_ssize_t num_min,
10976 Py_ssize_t num_max,
10977 Py_ssize_t num_found)
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";
10985 num_expected = num_max;
10986 more_or_less = "at most";
10989 more_or_less = "exactly";
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);
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;
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;
11007 #if CYTHON_COMPILING_IN_CPYTHON
11008 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
11010 dictptr = _PyObject_GetDictPtr(obj);
11013 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
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)))
11019 return obj_dict_version == __Pyx_get_object_dict_version(obj);
11023 /* GetModuleGlobalName */
11024 #if CYTHON_USE_DICT_VERSIONS
11025 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11027 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
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())) {
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);
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);
11055 return __Pyx_GetBuiltinName(name);
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);
11076 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
11081 /* PyFunctionFastCall */
11082 #if CYTHON_FAST_PYCALL
11083 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11084 PyObject *globals) {
11086 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11087 PyObject **fastlocals;
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.
11095 assert(tstate != NULL);
11096 f = PyFrame_New(tstate, co, globals, NULL);
11100 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11101 for (i = 0; i < na; i++) {
11103 fastlocals[i] = *args++;
11105 result = PyEval_EvalFrameEx(f,0);
11106 ++tstate->recursion_depth;
11108 --tstate->recursion_depth;
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);
11117 #if PY_MAJOR_VERSION >= 3
11120 PyObject *kwtuple, **k;
11125 assert(kwargs == NULL || PyDict_Check(kwargs));
11126 nk = kwargs ? PyDict_Size(kwargs) : 0;
11127 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
11131 #if PY_MAJOR_VERSION >= 3
11132 co->co_kwonlyargcount == 0 &&
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);
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);
11149 if (kwargs != NULL) {
11151 kwtuple = PyTuple_New(2 * nk);
11152 if (kwtuple == NULL) {
11156 k = &PyTuple_GET_ITEM(kwtuple, 0);
11158 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11169 closure = PyFunction_GET_CLOSURE(func);
11170 #if PY_MAJOR_VERSION >= 3
11171 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11173 if (argdefs != NULL) {
11174 d = &PyTuple_GET_ITEM(argdefs, 0);
11175 nd = Py_SIZE(argdefs);
11181 #if PY_MAJOR_VERSION >= 3
11182 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11185 d, (int)nd, kwdefs, closure);
11187 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11190 d, (int)nd, closure);
11192 Py_XDECREF(kwtuple);
11194 Py_LeaveRecursiveCall();
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);
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);
11215 args = PyTuple_New(2);
11216 if (unlikely(!args)) goto done;
11218 PyTuple_SET_ITEM(args, 0, arg1);
11220 PyTuple_SET_ITEM(args, 1, arg2);
11221 Py_INCREF(function);
11222 result = __Pyx_PyObject_Call(function, args, NULL);
11224 Py_DECREF(function);
11229 /* PyObjectCallMethO */
11230 #if CYTHON_COMPILING_IN_CPYTHON
11231 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11232 PyObject *self, *result;
11234 cfunc = PyCFunction_GET_FUNCTION(func);
11235 self = PyCFunction_GET_SELF(func);
11236 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11238 result = cfunc(self, arg);
11239 Py_LeaveRecursiveCall();
11240 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11243 "NULL result without error in PyObject_Call");
11249 /* PyObjectCallOneArg */
11250 #if CYTHON_COMPILING_IN_CPYTHON
11251 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11253 PyObject *args = PyTuple_New(1);
11254 if (unlikely(!args)) return NULL;
11256 PyTuple_SET_ITEM(args, 0, arg);
11257 result = __Pyx_PyObject_Call(func, args, NULL);
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);
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);
11276 return __Pyx__PyObject_CallOneArg(func, arg);
11279 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11281 PyObject *args = PyTuple_Pack(1, arg);
11282 if (unlikely(!args)) return NULL;
11283 result = __Pyx_PyObject_Call(func, args, NULL);
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);
11299 return PyObject_SetAttr(obj, attr_name, value);
11303 /* PyObjectGetMethod */
11304 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
11306 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
11307 PyTypeObject *tp = Py_TYPE(obj);
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);
11317 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
11320 descr = _PyType_Lookup(tp, name);
11321 if (likely(descr != NULL)) {
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)))
11327 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
11330 #ifdef __Pyx_CyFunction_USED
11331 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
11333 if (likely(PyFunction_Check(descr)))
11339 f = Py_TYPE(descr)->tp_descr_get;
11340 if (f != NULL && PyDescr_IsData(descr)) {
11341 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11347 dictptr = _PyObject_GetDictPtr(obj);
11348 if (dictptr != NULL && (dict = *dictptr) != NULL) {
11350 attr = __Pyx_PyDict_GetItemStr(dict, name);
11351 if (attr != NULL) {
11364 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11368 if (descr != NULL) {
11372 PyErr_Format(PyExc_AttributeError,
11373 #if PY_MAJOR_VERSION >= 3
11374 "'%.50s' object has no attribute '%U'",
11375 tp->tp_name, name);
11377 "'%.50s' object has no attribute '%.400s'",
11378 tp->tp_name, PyString_AS_STRING(name));
11382 attr = __Pyx_PyObject_GetAttrStr(obj, name);
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);
11391 *method = function;
11399 /* PyObjectCallMethod1 */
11400 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
11401 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
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);
11413 if (unlikely(!method)) return NULL;
11414 return __Pyx__PyObject_CallMethod1(method, arg);
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;
11422 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
11423 if (unlikely(!retval))
11430 /* ObjectGetItem */
11431 #if CYTHON_USE_TYPE_SLOTS
11432 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
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);
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);
11444 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
11446 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
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);
11455 return __Pyx_PyObject_GetIndex(obj, key);
11459 /* GetTopmostException */
11460 #if CYTHON_USE_EXC_INFO_STACK
11461 static _PyErr_StackItem *
11462 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
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)
11468 exc_info = exc_info->previous_item;
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;
11483 *type = tstate->exc_type;
11484 *value = tstate->exc_value;
11485 *tb = tstate->exc_traceback;
11488 Py_XINCREF(*value);
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;
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;
11509 Py_XDECREF(tmp_type);
11510 Py_XDECREF(tmp_value);
11511 Py_XDECREF(tmp_tb);
11515 /* PyErrExceptionMatches */
11516 #if CYTHON_FAST_THREAD_STATE
11517 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
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;
11525 for (i=0; i<n; i++) {
11526 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
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);
11541 #if CYTHON_FAST_THREAD_STATE
11542 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
11544 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
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;
11557 PyErr_Fetch(&local_type, &local_value, &local_tb);
11559 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
11560 #if CYTHON_FAST_THREAD_STATE
11561 if (unlikely(tstate->curexc_type))
11563 if (unlikely(PyErr_Occurred()))
11566 #if PY_MAJOR_VERSION >= 3
11568 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
11572 Py_XINCREF(local_tb);
11573 Py_XINCREF(local_type);
11574 Py_XINCREF(local_value);
11575 *type = local_type;
11576 *value = local_value;
11578 #if CYTHON_FAST_THREAD_STATE
11579 #if CYTHON_USE_EXC_INFO_STACK
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;
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;
11597 Py_XDECREF(tmp_type);
11598 Py_XDECREF(tmp_value);
11599 Py_XDECREF(tmp_tb);
11601 PyErr_SetExcInfo(local_type, local_value, local_tb);
11608 Py_XDECREF(local_type);
11609 Py_XDECREF(local_value);
11610 Py_XDECREF(local_tb);
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);
11622 #ifdef __Pyx_CyFunction_USED
11623 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
11625 if (likely(PyCFunction_Check(func)))
11628 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11629 return __Pyx_PyObject_CallMethO(func, NULL);
11632 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
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);
11645 if (unlikely(!method)) goto bad;
11646 result = __Pyx_PyObject_CallNoArg(method);
11652 /* UnpackUnboundCMethod */
11653 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
11655 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
11656 if (unlikely(!method))
11658 target->method = method;
11659 #if CYTHON_COMPILING_IN_CPYTHON
11660 #if PY_MAJOR_VERSION >= 3
11661 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
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);
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;
11680 PyTuple_SET_ITEM(args, 0, self);
11682 args = PyTuple_Pack(1, self);
11683 if (unlikely(!args)) goto bad;
11685 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
11692 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
11693 if (Py_TYPE(L) == &PySet_Type) {
11694 return PySet_Pop(L);
11696 return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
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));
11704 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
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);
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");
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);
11744 if (unlikely(PyErr_Occurred())) {
11745 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
11756 /* UnpackItemEndCheck */
11757 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
11758 if (unlikely(retval)) {
11760 __Pyx_RaiseTooManyValuesError(expected);
11763 return __Pyx_IterFinish();
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)))
11774 if (likely(PyString_Check(n)))
11776 return __Pyx_PyObject_GetAttrStr(o, n);
11778 return PyObject_GetAttr(o, n);
11782 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
11784 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
11785 PyErr_SetString(PyExc_TypeError,
11786 "hasattr(): attribute name must be string");
11789 r = __Pyx_GetAttr(o, n);
11790 if (unlikely(!r)) {
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)) {
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;
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;
11821 cstop = PY_SSIZE_T_MAX;
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)) {
11828 if (cstop < 0) cstop = 0;
11832 if (cstart < 0) cstart = 0;
11835 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11840 return ms->sq_ass_slice(obj, cstart, cstop, value);
11843 mp = Py_TYPE(obj)->tp_as_mapping;
11844 if (likely(mp && mp->mp_ass_subscript))
11848 PyObject *py_slice, *py_start, *py_stop;
11850 py_slice = *_py_slice;
11852 PyObject* owned_start = NULL;
11853 PyObject* owned_stop = NULL;
11855 py_start = *_py_start;
11858 owned_start = py_start = PyInt_FromSsize_t(cstart);
11859 if (unlikely(!py_start)) goto bad;
11861 py_start = Py_None;
11864 py_stop = *_py_stop;
11867 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
11868 if (unlikely(!py_stop)) {
11869 Py_XDECREF(owned_start);
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;
11880 #if CYTHON_USE_TYPE_SLOTS
11881 result = mp->mp_ass_subscript(obj, py_slice, value);
11883 result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
11886 Py_DECREF(py_slice);
11890 PyErr_Format(PyExc_TypeError,
11891 "'%.200s' object does not support slice %.10s",
11892 Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
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);
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;
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
11927 if (!value || value == Py_None)
11931 if (!tb || tb == Py_None)
11935 if (!PyTraceBack_Check(tb)) {
11936 PyErr_SetString(PyExc_TypeError,
11937 "raise: arg 3 must be a traceback or None");
11941 if (PyType_Check(type)) {
11942 #if CYTHON_COMPILING_IN_PYPY
11944 Py_INCREF(Py_None);
11948 PyErr_NormalizeException(&type, &value, &tb);
11951 PyErr_SetString(PyExc_TypeError,
11952 "instance exception may not have a separate value");
11956 type = (PyObject*) Py_TYPE(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");
11964 __Pyx_PyThreadState_assign
11965 __Pyx_ErrRestore(type, value, tb);
11974 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11975 PyObject* owned_instance = NULL;
11976 if (tb == Py_None) {
11978 } else if (tb && !PyTraceBack_Check(tb)) {
11979 PyErr_SetString(PyExc_TypeError,
11980 "raise: arg 3 must be a traceback or None");
11983 if (value == Py_None)
11985 if (PyExceptionInstance_Check(type)) {
11987 PyErr_SetString(PyExc_TypeError,
11988 "instance exception may not have a separate value");
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)) {
12004 type = instance_class;
12008 if (!instance_class) {
12011 args = PyTuple_New(0);
12012 else if (PyTuple_Check(value)) {
12016 args = PyTuple_Pack(1, value);
12019 owned_instance = PyObject_Call(type, args, NULL);
12021 if (!owned_instance)
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));
12033 PyErr_SetString(PyExc_TypeError,
12034 "raise: exception class must be a subclass of BaseException");
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)
12045 } else if (PyExceptionInstance_Check(cause)) {
12046 fixed_cause = cause;
12047 Py_INCREF(fixed_cause);
12049 PyErr_SetString(PyExc_TypeError,
12050 "exception causes must derive from "
12054 PyException_SetCause(value, fixed_cause);
12056 PyErr_SetObject(type, value);
12058 #if CYTHON_COMPILING_IN_PYPY
12059 PyObject *tmp_type, *tmp_value, *tmp_tb;
12060 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12062 PyErr_Restore(tmp_type, tmp_value, tb);
12063 Py_XDECREF(tmp_tb);
12065 PyThreadState *tstate = __Pyx_PyThreadState_Current;
12066 PyObject* tmp_tb = tstate->curexc_traceback;
12067 if (tb != tmp_tb) {
12069 tstate->curexc_traceback = tb;
12070 Py_XDECREF(tmp_tb);
12075 Py_XDECREF(owned_instance);
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;
12087 #if PY_MAJOR_VERSION < 3
12088 PyObject *py_import;
12089 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12096 empty_list = PyList_New(0);
12101 global_dict = PyModule_GetDict(__pyx_m);
12104 empty_dict = PyDict_New();
12108 #if PY_MAJOR_VERSION >= 3
12110 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12111 module = PyImport_ImportModuleLevelObject(
12112 name, global_dict, empty_dict, list, 1);
12114 if (!PyErr_ExceptionMatches(PyExc_ImportError))
12123 #if PY_MAJOR_VERSION < 3
12124 PyObject *py_level = PyInt_FromLong(level);
12127 module = PyObject_CallFunctionObjArgs(py_import,
12128 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
12129 Py_DECREF(py_level);
12131 module = PyImport_ImportModuleLevelObject(
12132 name, global_dict, empty_dict, list, level);
12137 #if PY_MAJOR_VERSION < 3
12138 Py_XDECREF(py_import);
12140 Py_XDECREF(empty_list);
12141 Py_XDECREF(empty_dict);
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));
12153 "cannot import name %S", name);
12160 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
12161 __Pyx_PyThreadState_declare
12162 __Pyx_PyThreadState_assign
12163 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12165 __Pyx_PyErr_Clear();
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);
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);
12179 return PyDict_Items(d);
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);
12193 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12195 } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
12196 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12199 return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
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;
12210 PyTuple_SET_ITEM(args, 0, arg);
12211 if (cfunc->flag & METH_KEYWORDS)
12212 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12214 result = (*cfunc->func)(self, args);
12216 args = PyTuple_New(2);
12217 if (unlikely(!args)) goto bad;
12219 PyTuple_SET_ITEM(args, 0, self);
12221 PyTuple_SET_ITEM(args, 1, arg);
12222 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12225 args = PyTuple_Pack(2, self, arg);
12226 if (unlikely(!args)) goto bad;
12227 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
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);
12243 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
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);
12251 return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
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;
12262 PyTuple_SET_ITEM(args, 0, arg1);
12264 PyTuple_SET_ITEM(args, 1, arg2);
12265 if (cfunc->flag & METH_KEYWORDS)
12266 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12268 result = (*cfunc->func)(self, args);
12270 args = PyTuple_New(3);
12271 if (unlikely(!args)) goto bad;
12273 PyTuple_SET_ITEM(args, 0, self);
12275 PyTuple_SET_ITEM(args, 1, arg1);
12277 PyTuple_SET_ITEM(args, 2, arg2);
12278 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12281 args = PyTuple_Pack(3, self, arg1, arg2);
12282 if (unlikely(!args)) goto bad;
12283 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12290 /* dict_getitem_default */
12291 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_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()))
12298 value = default_value;
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;
12312 if (default_value == Py_None)
12313 value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
12315 value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
12320 /* RaiseNoneIterError */
12321 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
12322 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
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);
12333 "'%.50s' object has no attribute '%.400s'",
12334 tp->tp_name, PyString_AS_STRING(attr_name));
12338 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12340 PyTypeObject *tp = Py_TYPE(obj);
12341 if (unlikely(!PyString_Check(attr_name))) {
12342 return PyObject_GenericGetAttr(obj, attr_name);
12344 assert(!tp->tp_dictoffset);
12345 descr = _PyType_Lookup(tp, attr_name);
12346 if (unlikely(!descr)) {
12347 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12350 #if PY_MAJOR_VERSION < 3
12351 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12354 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12356 PyObject *res = f(descr, obj, (PyObject *)tp);
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);
12371 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12376 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
12377 #if PY_VERSION_HEX >= 0x02070000
12378 PyObject *ob = PyCapsule_New(vtable, 0, 0);
12380 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
12384 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
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();
12400 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
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);
12408 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
12409 if (unlikely(!result)) {
12410 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
12416 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
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);
12425 if (unlikely(ret < 0)) {
12429 Py_XDECREF(name_attr);
12432 static int __Pyx_setup_reduce(PyObject* type_obj) {
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;
12444 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
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;
12449 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
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;
12456 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
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()) {
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()) {
12478 PyType_Modified((PyTypeObject*)type_obj);
12483 if (!PyErr_Occurred())
12484 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
12487 #if !CYTHON_USE_PYTYPE_LOOKUP
12488 Py_XDECREF(object_reduce);
12489 Py_XDECREF(object_reduce_ex);
12491 Py_XDECREF(reduce);
12492 Py_XDECREF(reduce_ex);
12493 Py_XDECREF(reduce_cython);
12494 Py_XDECREF(setstate);
12495 Py_XDECREF(setstate_cython);
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)
12511 metaclass = tmptype;
12514 if (PyType_IsSubtype(metaclass, tmptype))
12516 if (PyType_IsSubtype(tmptype, metaclass)) {
12517 metaclass = tmptype;
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");
12528 #if PY_MAJOR_VERSION < 3
12529 metaclass = &PyClass_Type;
12531 metaclass = &PyType_Type;
12534 Py_INCREF((PyObject*) metaclass);
12535 return (PyObject*) metaclass;
12538 /* Py3ClassCreate */
12539 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
12540 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
12543 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
12545 PyObject *pargs = PyTuple_Pack(2, name, bases);
12546 if (unlikely(!pargs)) {
12550 ns = PyObject_Call(prep, pargs, mkw);
12554 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
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;
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))) {
12587 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
12588 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
12589 Py_XDECREF(owned_metaclass);
12590 if (unlikely(!metaclass))
12592 owned_metaclass = metaclass;
12594 margs = PyTuple_Pack(3, name, bases, dict);
12595 if (unlikely(!margs)) {
12598 result = PyObject_Call(metaclass, margs, mkw);
12601 Py_XDECREF(owned_metaclass);
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);
12614 if (!PyType_Check((PyObject*)cached_type)) {
12615 PyErr_Format(PyExc_TypeError,
12616 "Shared Cython type %.200s is not a type object",
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",
12627 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12629 if (PyType_Ready(type) < 0) goto bad;
12630 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
12633 cached_type = type;
12636 Py_DECREF(fake_module);
12637 return cached_type;
12639 Py_XDECREF(cached_type);
12640 cached_type = NULL;
12644 /* CythonFunctionShared */
12645 #include <structmember.h>
12647 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
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);
12654 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
12656 if (unlikely(op->func_doc == NULL))
12659 Py_INCREF(Py_None);
12663 Py_INCREF(op->func_doc);
12664 return op->func_doc;
12667 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12669 PyObject *tmp = op->func_doc;
12670 if (value == NULL) {
12674 op->func_doc = value;
12679 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
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);
12685 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
12687 if (unlikely(op->func_name == NULL))
12690 Py_INCREF(op->func_name);
12691 return op->func_name;
12694 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12697 #if PY_MAJOR_VERSION >= 3
12698 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12700 if (unlikely(value == NULL || !PyString_Check(value)))
12703 PyErr_SetString(PyExc_TypeError,
12704 "__name__ must be set to a string object");
12707 tmp = op->func_name;
12709 op->func_name = value;
12714 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12716 Py_INCREF(op->func_qualname);
12717 return op->func_qualname;
12720 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12723 #if PY_MAJOR_VERSION >= 3
12724 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12726 if (unlikely(value == NULL || !PyString_Check(value)))
12729 PyErr_SetString(PyExc_TypeError,
12730 "__qualname__ must be set to a string object");
12733 tmp = op->func_qualname;
12735 op->func_qualname = value;
12740 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
12743 self = m->func_closure;
12750 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12752 if (unlikely(op->func_dict == NULL)) {
12753 op->func_dict = PyDict_New();
12754 if (unlikely(op->func_dict == NULL))
12757 Py_INCREF(op->func_dict);
12758 return op->func_dict;
12761 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12764 if (unlikely(value == NULL)) {
12765 PyErr_SetString(PyExc_TypeError,
12766 "function's dictionary may not be deleted");
12769 if (unlikely(!PyDict_Check(value))) {
12770 PyErr_SetString(PyExc_TypeError,
12771 "setting function's dictionary to a non-dict");
12774 tmp = op->func_dict;
12776 op->func_dict = value;
12781 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12783 Py_INCREF(op->func_globals);
12784 return op->func_globals;
12787 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12789 Py_INCREF(Py_None);
12793 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12795 PyObject* result = (op->func_code) ? op->func_code : Py_None;
12800 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
12802 PyObject *res = op->defaults_getter((PyObject *) op);
12803 if (unlikely(!res))
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);
12811 op->defaults_tuple = PySequence_ITEM(res, 0);
12812 if (unlikely(!op->defaults_tuple)) result = -1;
12814 op->defaults_kwdict = PySequence_ITEM(res, 1);
12815 if (unlikely(!op->defaults_kwdict)) result = -1;
12822 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12826 } else if (value != Py_None && !PyTuple_Check(value)) {
12827 PyErr_SetString(PyExc_TypeError,
12828 "__defaults__ must be set to a tuple object");
12832 tmp = op->defaults_tuple;
12833 op->defaults_tuple = value;
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;
12852 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12856 } else if (value != Py_None && !PyDict_Check(value)) {
12857 PyErr_SetString(PyExc_TypeError,
12858 "__kwdefaults__ must be set to a dict object");
12862 tmp = op->defaults_kwdict;
12863 op->defaults_kwdict = value;
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;
12882 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12884 if (!value || value == Py_None) {
12886 } else if (!PyDict_Check(value)) {
12887 PyErr_SetString(PyExc_TypeError,
12888 "__annotations__ must be set to a dict object");
12892 tmp = op->func_annotations;
12893 op->func_annotations = value;
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;
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},
12929 static PyMemberDef __pyx_CyFunction_members[] = {
12930 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
12934 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
12936 #if PY_MAJOR_VERSION >= 3
12937 return PyUnicode_FromString(m->func.m_ml->ml_name);
12939 return PyString_FromString(m->func.m_ml->ml_name);
12942 static PyMethodDef __pyx_CyFunction_methods[] = {
12943 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
12946 #if PY_VERSION_HEX < 0x030500A0
12947 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
12949 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
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))
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);
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;
12983 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
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);
12998 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13000 for (i = 0; i < m->defaults_pyobjects; i++)
13001 Py_XDECREF(pydefaults[i]);
13002 PyObject_Free(m->defaults);
13003 m->defaults = NULL;
13007 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
13009 if (__Pyx_CyFunction_weakreflist(m) != NULL)
13010 PyObject_ClearWeakRefs((PyObject *) m);
13011 __Pyx_CyFunction_clear(m);
13012 PyObject_GC_Del(m);
13014 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13016 PyObject_GC_UnTrack(m);
13017 __Pyx__CyFunction_dealloc(m);
13019 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
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);
13033 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13035 for (i = 0; i < m->defaults_pyobjects; i++)
13036 Py_VISIT(pydefaults[i]);
13040 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13042 #if PY_MAJOR_VERSION < 3
13043 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13044 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13048 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
13050 type = (PyObject *)(Py_TYPE(obj));
13051 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
13053 if (obj == Py_None)
13056 return __Pyx_PyMethod_New(func, obj, type);
13059 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13061 #if PY_MAJOR_VERSION >= 3
13062 return PyUnicode_FromFormat("<cyfunction %U at %p>",
13063 op->func_qualname, (void *)op);
13065 return PyString_FromFormat("<cyfunction %s at %p>",
13066 PyString_AsString(op->func_qualname), (void *)op);
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;
13073 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13075 if (likely(kw == NULL || PyDict_Size(kw) == 0))
13076 return (*meth)(self, arg);
13078 case METH_VARARGS | METH_KEYWORDS:
13079 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
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);
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);
13099 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13101 result = (*meth)(self, arg0);
13102 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13107 PyErr_Format(PyExc_TypeError,
13108 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13109 f->m_ml->ml_name, size);
13114 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
13115 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
13116 "longer supported!");
13119 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
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);
13126 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13128 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13129 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13131 PyObject *new_args;
13133 argc = PyTuple_GET_SIZE(args);
13134 new_args = PyTuple_GetSlice(args, 1, argc);
13135 if (unlikely(!new_args))
13137 self = PyTuple_GetItem(args, 0);
13138 if (unlikely(!self)) {
13139 Py_DECREF(new_args);
13142 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13143 Py_DECREF(new_args);
13145 result = __Pyx_CyFunction_Call(func, args, kw);
13149 static PyTypeObject __pyx_CyFunctionType_type = {
13150 PyVarObject_HEAD_INIT(0, 0)
13151 "cython_function_or_method",
13152 sizeof(__pyx_CyFunctionObject),
13154 (destructor) __Pyx_CyFunction_dealloc,
13158 #if PY_MAJOR_VERSION < 3
13163 (reprfunc) __Pyx_CyFunction_repr,
13168 __Pyx_CyFunction_CallAsMethod,
13173 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
13175 (traverseproc) __Pyx_CyFunction_traverse,
13176 (inquiry) __Pyx_CyFunction_clear,
13178 #if PY_VERSION_HEX < 0x030500A0
13179 offsetof(__pyx_CyFunctionObject, func_weakreflist),
13181 offsetof(PyCFunctionObject, m_weakreflist),
13185 __pyx_CyFunction_methods,
13186 __pyx_CyFunction_members,
13187 __pyx_CyFunction_getsets,
13190 __Pyx_CyFunction_descr_get,
13192 offsetof(__pyx_CyFunctionObject, func_dict),
13205 #if PY_VERSION_HEX >= 0x030400a1
13208 #if PY_VERSION_HEX >= 0x030800b1
13211 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
13215 static int __pyx_CyFunction_init(void) {
13216 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
13217 if (unlikely(__pyx_CyFunctionType == NULL)) {
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;
13232 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13233 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13234 m->defaults_tuple = tuple;
13237 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
13238 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13239 m->defaults_kwdict = dict;
13242 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
13243 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13244 m->func_annotations = dict;
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
13256 PyObject_GC_Track(op);
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;
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;
13273 PyObject *args = 0;
13276 cleanup_func = PyCFunction_New(&cleanup_def, 0);
13279 atexit = PyImport_ImportModule("atexit");
13282 reg = PyObject_GetAttrString(atexit, "_exithandlers");
13283 if (reg && PyList_Check(reg)) {
13285 a = PyTuple_New(0);
13292 args = PyTuple_Pack(3, cleanup_func, a, kw);
13297 ret = PyList_Insert(reg, 0, args);
13302 reg = PyObject_GetAttrString(atexit, "register");
13305 args = PyTuple_Pack(1, cleanup_func);
13308 res = PyObject_CallObject(reg, args);
13314 Py_XDECREF(cleanup_func);
13315 Py_XDECREF(atexit);
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;
13331 if (unlikely(!__pyx_cython_runtime)) {
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))
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);
13355 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13357 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13360 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
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) {
13371 while (start < end) {
13372 mid = start + (end - start) / 2;
13373 if (code_line < entries[mid].code_line) {
13375 } else if (code_line > entries[mid].code_line) {
13381 if (code_line <= entries[mid].code_line) {
13387 static PyCodeObject *__pyx_find_code_object(int code_line) {
13388 PyCodeObject* code_object;
13390 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
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)) {
13397 code_object = __pyx_code_cache.entries[pos].code_object;
13398 Py_INCREF(code_object);
13399 return code_object;
13401 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13403 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13404 if (unlikely(!code_line)) {
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);
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;
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)) {
13433 __pyx_code_cache.entries = entries;
13434 __pyx_code_cache.max_count = new_max;
13436 for (i=__pyx_code_cache.count; i>pos; i--) {
13437 entries[i] = entries[i-1];
13439 entries[pos].code_line = code_line;
13440 entries[pos].code_object = code_object;
13441 __pyx_code_cache.count++;
13442 Py_INCREF(code_object);
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);
13458 py_srcfile = PyUnicode_FromString(filename);
13460 if (!py_srcfile) goto bad;
13462 #if PY_MAJOR_VERSION < 3
13463 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13465 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13469 #if PY_MAJOR_VERSION < 3
13470 py_funcname = PyString_FromString(funcname);
13472 py_funcname = PyUnicode_FromString(funcname);
13475 if (!py_funcname) goto bad;
13476 py_code = __Pyx_PyCode_New(
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,*/
13491 __pyx_empty_bytes /*PyObject *lnotab*/
13493 Py_DECREF(py_srcfile);
13494 Py_DECREF(py_funcname);
13497 Py_XDECREF(py_srcfile);
13498 Py_XDECREF(py_funcname);
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;
13507 c_line = __Pyx_CLineForTraceback(tstate, c_line);
13509 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
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);
13516 py_frame = PyFrame_New(
13517 tstate, /*PyThreadState *tstate,*/
13518 py_code, /*PyCodeObject *code,*/
13519 __pyx_d, /*PyObject *globals,*/
13520 0 /*PyObject *locals*/
13522 if (!py_frame) goto bad;
13523 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13524 PyTraceBack_Here(py_frame);
13526 Py_XDECREF(py_code);
13527 Py_XDECREF(py_frame);
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)\
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;\
13546 goto raise_overflow;\
13549 return (target_type) value;\
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;
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);
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);
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);
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))
13592 long val = PyInt_AS_LONG(x);
13593 if (is_unsigned && unlikely(val < 0)) {
13594 goto raise_neg_overflow;
13600 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
13636 #if CYTHON_COMPILING_IN_CPYTHON
13637 if (unlikely(Py_SIZE(x) < 0)) {
13638 goto raise_neg_overflow;
13642 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13643 if (unlikely(result < 0))
13645 if (unlikely(result == 1))
13646 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
13733 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13734 #if PY_MAJOR_VERSION < 3
13735 if (likely(v) && !PyLong_Check(v)) {
13737 v = PyNumber_Long(tmp);
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);
13756 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13757 if (!tmp) return (long) -1;
13758 val = __Pyx_PyInt_As_long(tmp);
13763 PyErr_SetString(PyExc_OverflowError,
13764 "value too large to convert to long");
13766 raise_neg_overflow:
13767 PyErr_SetString(PyExc_OverflowError,
13768 "can't convert negative value to long");
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))
13781 long val = PyInt_AS_LONG(x);
13782 if (is_unsigned && unlikely(val < 0)) {
13783 goto raise_neg_overflow;
13789 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
13825 #if CYTHON_COMPILING_IN_CPYTHON
13826 if (unlikely(Py_SIZE(x) < 0)) {
13827 goto raise_neg_overflow;
13831 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13832 if (unlikely(result < 0))
13834 if (unlikely(result == 1))
13835 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
13922 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13923 #if PY_MAJOR_VERSION < 3
13924 if (likely(v) && !PyLong_Check(v)) {
13926 v = PyNumber_Long(tmp);
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);
13945 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13946 if (!tmp) return (int) -1;
13947 val = __Pyx_PyInt_As_int(tmp);
13952 PyErr_SetString(PyExc_OverflowError,
13953 "value too large to convert to int");
13955 raise_neg_overflow:
13956 PyErr_SetString(PyExc_OverflowError,
13957 "can't convert negative value to int");
13961 /* FastTypeChecks */
13962 #if CYTHON_COMPILING_IN_CPYTHON
13963 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
13969 return b == &PyBaseObject_Type;
13971 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
13973 if (a == b) return 1;
13977 n = PyTuple_GET_SIZE(mro);
13978 for (i = 0; i < n; i++) {
13979 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
13984 return __Pyx_InBases(a, b);
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;
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);
13999 res = PyObject_IsSubclass(err, exc_type2);
14000 if (unlikely(res == -1)) {
14001 PyErr_WriteUnraisable(err);
14005 __Pyx_ErrRestore(exception, value, tb);
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;
14012 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14017 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
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;
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;
14031 if (likely(PyExceptionClass_Check(t))) {
14032 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
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);
14048 return PyErr_GivenExceptionMatches(err, exc_type);
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);
14057 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
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]) {
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);
14077 /* FunctionExport */
14078 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
14080 PyObject *cobj = 0;
14085 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
14092 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
14096 #if PY_VERSION_HEX >= 0x02070000
14097 cobj = PyCapsule_New(tmp.p, sig, 0);
14099 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
14103 if (PyDict_SetItemString(d, name, cobj) < 0)
14115 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
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);
14123 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14126 if (t->is_unicode | t->is_str) {
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);
14132 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14135 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14140 if (PyObject_Hash(*t->p) == -1)
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));
14150 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14152 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
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) {
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
14163 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14165 for (c = defenc_c; c < end; c++) {
14166 if ((unsigned char) (*c) >= 128) {
14167 PyUnicode_AsASCIIString(o);
14173 *length = PyBytes_GET_SIZE(defenc);
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);
14184 PyUnicode_AsASCIIString(o);
14188 return PyUnicode_AsUTF8AndSize(o, length);
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
14196 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14197 __Pyx_sys_getdefaultencoding_not_ascii &&
14199 PyUnicode_Check(o)) {
14200 return __Pyx_PyUnicode_AsStringAndSize(o, length);
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);
14211 int r = PyBytes_AsStringAndSize(o, &result, length);
14212 if (unlikely(r < 0)) {
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);
14224 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
14226 if (unlikely(!x)) return -1;
14227 retval = __Pyx_PyObject_IsTrue(x);
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)) {
14245 PyErr_Format(PyExc_TypeError,
14246 "__%.4s__ returned non-%.4s (type %.200s)",
14247 type_name, type_name, Py_TYPE(result)->tp_name);
14251 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
14252 #if CYTHON_USE_TYPE_SLOTS
14253 PyNumberMethods *m;
14255 const char *name = NULL;
14256 PyObject *res = NULL;
14257 #if PY_MAJOR_VERSION < 3
14258 if (likely(PyInt_Check(x) || PyLong_Check(x)))
14260 if (likely(PyLong_Check(x)))
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) {
14268 res = m->nb_int(x);
14270 else if (m && m->nb_long) {
14272 res = m->nb_long(x);
14275 if (likely(m && m->nb_int)) {
14277 res = m->nb_int(x);
14281 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
14282 res = PyNumber_Int(x);
14286 #if PY_MAJOR_VERSION < 3
14287 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
14289 if (unlikely(!PyLong_CheckExact(res))) {
14291 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14294 else if (!PyErr_Occurred()) {
14295 PyErr_SetString(PyExc_TypeError,
14296 "an integer is required");
14300 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
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);
14308 return PyInt_AsSsize_t(b);
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;
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]));
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]));
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]));
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]));
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]));
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]));
14354 return PyLong_AsSsize_t(b);
14356 x = PyNumber_Index(b);
14358 ival = PyInt_AsSsize_t(x);
14362 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14363 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14365 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14366 return PyInt_FromSize_t(ival);
14370 #endif /* Py_PYTHON_H */