1 /* Generated by Cython 0.29.18 */
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_18"
37 #define CYTHON_HEX_VERSION 0x001D12F0
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 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
466 #define CYTHON_PEP393_ENABLED 0
467 #define PyUnicode_1BYTE_KIND 1
468 #define PyUnicode_2BYTE_KIND 2
469 #define PyUnicode_4BYTE_KIND 4
470 #define __Pyx_PyUnicode_READY(op) (0)
471 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
472 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
473 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
474 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
475 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
476 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
477 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
478 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
480 #if CYTHON_COMPILING_IN_PYPY
481 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
482 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
484 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
485 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
486 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
489 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
491 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
492 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
494 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
495 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
497 #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))
498 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
499 #if PY_MAJOR_VERSION >= 3
500 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
502 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
504 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
505 #define PyObject_ASCII(o) PyObject_Repr(o)
507 #if PY_MAJOR_VERSION >= 3
508 #define PyBaseString_Type PyUnicode_Type
509 #define PyStringObject PyUnicodeObject
510 #define PyString_Type PyUnicode_Type
511 #define PyString_Check PyUnicode_Check
512 #define PyString_CheckExact PyUnicode_CheckExact
513 #ifndef PyObject_Unicode
514 #define PyObject_Unicode PyObject_Str
517 #if PY_MAJOR_VERSION >= 3
518 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
519 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
521 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
522 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
524 #ifndef PySet_CheckExact
525 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
527 #if CYTHON_ASSUME_SAFE_MACROS
528 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
530 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
532 #if PY_MAJOR_VERSION >= 3
533 #define PyIntObject PyLongObject
534 #define PyInt_Type PyLong_Type
535 #define PyInt_Check(op) PyLong_Check(op)
536 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
537 #define PyInt_FromString PyLong_FromString
538 #define PyInt_FromUnicode PyLong_FromUnicode
539 #define PyInt_FromLong PyLong_FromLong
540 #define PyInt_FromSize_t PyLong_FromSize_t
541 #define PyInt_FromSsize_t PyLong_FromSsize_t
542 #define PyInt_AsLong PyLong_AsLong
543 #define PyInt_AS_LONG PyLong_AS_LONG
544 #define PyInt_AsSsize_t PyLong_AsSsize_t
545 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
546 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
547 #define PyNumber_Int PyNumber_Long
549 #if PY_MAJOR_VERSION >= 3
550 #define PyBoolObject PyLongObject
552 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
553 #ifndef PyUnicode_InternFromString
554 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
557 #if PY_VERSION_HEX < 0x030200A4
558 typedef long Py_hash_t;
559 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
560 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
562 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
563 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
565 #if PY_MAJOR_VERSION >= 3
566 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
568 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
570 #if CYTHON_USE_ASYNC_SLOTS
571 #if PY_VERSION_HEX >= 0x030500B1
572 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
573 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
575 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
578 #define __Pyx_PyType_AsAsync(obj) NULL
580 #ifndef __Pyx_PyAsyncMethodsStruct
585 } __Pyx_PyAsyncMethodsStruct;
588 #if defined(WIN32) || defined(MS_WINDOWS)
589 #define _USE_MATH_DEFINESg
593 #define __PYX_NAN() ((float) NAN)
595 static CYTHON_INLINE float __PYX_NAN() {
597 memset(&value, 0xFF, sizeof(value));
601 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
602 #define __Pyx_truncl trunc
604 #define __Pyx_truncl truncl
607 #define __PYX_MARK_ERR_POS(f_index, lineno) \
608 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
609 #define __PYX_ERR(f_index, lineno, Ln_error) \
610 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
612 #ifndef __PYX_EXTERN_C
614 #define __PYX_EXTERN_C extern "C"
616 #define __PYX_EXTERN_C extern
620 #define __PYX_HAVE__lxml__sax
621 #define __PYX_HAVE_API__lxml__sax
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
643 (sizeof(type) < sizeof(Py_ssize_t)) ||\
644 (sizeof(type) > sizeof(Py_ssize_t) &&\
645 likely(v < (type)PY_SSIZE_T_MAX ||\
646 v == (type)PY_SSIZE_T_MAX) &&\
647 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648 v == (type)PY_SSIZE_T_MIN))) ||\
649 (sizeof(type) == sizeof(Py_ssize_t) &&\
650 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651 v == (type)PY_SSIZE_T_MAX))) )
652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653 return (size_t) i < (size_t) limit;
655 #if defined (__cplusplus) && __cplusplus >= 201103L
657 #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659 #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661 #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665 #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667 #define __Pyx_sst_abs(value) __builtin_llabs(value)
669 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
680 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
682 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
683 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
685 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702 const Py_UNICODE *u_end = u;
704 return (size_t)(u_end - u - 1);
706 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
735 PyObject* default_encoding = NULL;
736 PyObject* ascii_chars_u = NULL;
737 PyObject* ascii_chars_b = NULL;
738 const char* default_encoding_c;
739 sys = PyImport_ImportModule("sys");
741 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
743 if (!default_encoding) goto bad;
744 default_encoding_c = PyBytes_AsString(default_encoding);
745 if (!default_encoding_c) goto bad;
746 if (strcmp(default_encoding_c, "ascii") == 0) {
747 __Pyx_sys_getdefaultencoding_not_ascii = 0;
749 char ascii_chars[128];
751 for (c = 0; c < 128; c++) {
754 __Pyx_sys_getdefaultencoding_not_ascii = 1;
755 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756 if (!ascii_chars_u) goto bad;
757 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
761 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
765 Py_DECREF(ascii_chars_u);
766 Py_DECREF(ascii_chars_b);
768 Py_DECREF(default_encoding);
771 Py_XDECREF(default_encoding);
772 Py_XDECREF(ascii_chars_u);
773 Py_XDECREF(ascii_chars_b);
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
785 PyObject* default_encoding = NULL;
786 char* default_encoding_c;
787 sys = PyImport_ImportModule("sys");
789 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
791 if (!default_encoding) goto bad;
792 default_encoding_c = PyBytes_AsString(default_encoding);
793 if (!default_encoding_c) goto bad;
794 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797 Py_DECREF(default_encoding);
800 Py_XDECREF(default_encoding);
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809 #define likely(x) __builtin_expect(!!(x), 1)
810 #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812 #define likely(x) (x)
813 #define unlikely(x) (x)
814 #endif /* __GNUC__ */
815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
830 static const char *__pyx_f[] = {
835 /*--- Type declarations ---*/
836 struct __pyx_obj_4lxml_3sax_ElementTreeProducer;
839 * cdef tuple _getNsTag(tag)
841 * cdef class ElementTreeProducer: # <<<<<<<<<<<<<<
843 * cdef _content_handler
845 struct __pyx_obj_4lxml_3sax_ElementTreeProducer {
847 struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtab;
849 PyObject *_content_handler;
850 PyObject *_attr_class;
851 PyObject *_empty_attributes;
859 * class ElementTreeProducer(object): # <<<<<<<<<<<<<<
860 * """Produces SAX events for an element and children.
864 struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer {
865 PyObject *(*_recursive_saxify)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
866 PyObject *(*_build_qname)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
868 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer *__pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
869 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *);
870 static CYTHON_INLINE PyObject *__pyx_f_4lxml_3sax_19ElementTreeProducer__build_qname(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *, PyObject *, PyObject *, int);
872 /* --- Runtime support code (head) --- */
874 #ifndef CYTHON_REFNANNY
875 #define CYTHON_REFNANNY 0
879 void (*INCREF)(void*, PyObject*, int);
880 void (*DECREF)(void*, PyObject*, int);
881 void (*GOTREF)(void*, PyObject*, int);
882 void (*GIVEREF)(void*, PyObject*, int);
883 void* (*SetupContext)(const char*, int, const char*);
884 void (*FinishContext)(void**);
885 } __Pyx_RefNannyAPIStruct;
886 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
887 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
888 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
890 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
892 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
893 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
894 PyGILState_Release(__pyx_gilstate_save);\
896 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
899 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
900 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
902 #define __Pyx_RefNannyFinishContext()\
903 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
904 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
905 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
906 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
907 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
908 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
909 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
910 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
911 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
913 #define __Pyx_RefNannyDeclarations
914 #define __Pyx_RefNannySetupContext(name, acquire_gil)
915 #define __Pyx_RefNannyFinishContext()
916 #define __Pyx_INCREF(r) Py_INCREF(r)
917 #define __Pyx_DECREF(r) Py_DECREF(r)
918 #define __Pyx_GOTREF(r)
919 #define __Pyx_GIVEREF(r)
920 #define __Pyx_XINCREF(r) Py_XINCREF(r)
921 #define __Pyx_XDECREF(r) Py_XDECREF(r)
922 #define __Pyx_XGOTREF(r)
923 #define __Pyx_XGIVEREF(r)
925 #define __Pyx_XDECREF_SET(r, v) do {\
926 PyObject *tmp = (PyObject *) r;\
927 r = v; __Pyx_XDECREF(tmp);\
929 #define __Pyx_DECREF_SET(r, v) do {\
930 PyObject *tmp = (PyObject *) r;\
931 r = v; __Pyx_DECREF(tmp);\
933 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
934 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
936 /* PyObjectGetAttrStr.proto */
937 #if CYTHON_USE_TYPE_SLOTS
938 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
940 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
943 /* GetBuiltinName.proto */
944 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
946 /* GetItemInt.proto */
947 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
948 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
949 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
950 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
951 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
952 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
953 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
954 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
955 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
956 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
957 int wraparound, int boundscheck);
958 #define __Pyx_GetItemInt_Tuple(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_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
961 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
962 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
963 int wraparound, int boundscheck);
964 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
965 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
966 int is_list, int wraparound, int boundscheck);
968 /* IncludeStringH.proto */
971 /* BytesEquals.proto */
972 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
974 /* UnicodeEquals.proto */
975 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
977 /* StrEquals.proto */
978 #if PY_MAJOR_VERSION >= 3
979 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
981 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
984 /* SliceObject.proto */
985 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
986 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
987 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
988 int has_cstart, int has_cstop, int wraparound);
990 /* PyObjectCall.proto */
991 #if CYTHON_COMPILING_IN_CPYTHON
992 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
994 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
997 /* RaiseDoubleKeywords.proto */
998 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1000 /* ParseKeywords.proto */
1001 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1002 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1003 const char* function_name);
1005 /* RaiseArgTupleInvalid.proto */
1006 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1007 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1009 /* PyDictVersioning.proto */
1010 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1011 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1012 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1013 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1014 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1015 (cache_var) = (value);
1016 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1017 static PY_UINT64_T __pyx_dict_version = 0;\
1018 static PyObject *__pyx_dict_cached_value = NULL;\
1019 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1020 (VAR) = __pyx_dict_cached_value;\
1022 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1023 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1026 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1027 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1028 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1030 #define __PYX_GET_DICT_VERSION(dict) (0)
1031 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1032 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1035 /* GetModuleGlobalName.proto */
1036 #if CYTHON_USE_DICT_VERSIONS
1037 #define __Pyx_GetModuleGlobalName(var, name) {\
1038 static PY_UINT64_T __pyx_dict_version = 0;\
1039 static PyObject *__pyx_dict_cached_value = NULL;\
1040 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1041 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1042 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1044 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1045 PY_UINT64_T __pyx_dict_version;\
1046 PyObject *__pyx_dict_cached_value;\
1047 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1049 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1051 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1052 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1053 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1056 /* PyCFunctionFastCall.proto */
1057 #if CYTHON_FAST_PYCCALL
1058 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1060 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1063 /* PyFunctionFastCall.proto */
1064 #if CYTHON_FAST_PYCALL
1065 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1066 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1067 #if 1 || PY_VERSION_HEX < 0x030600B1
1068 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1070 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1072 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1073 (sizeof(char [1 - 2*!(cond)]) - 1)
1074 #ifndef Py_MEMBER_SIZE
1075 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1077 static size_t __pyx_pyframe_localsplus_offset = 0;
1078 #include "frameobject.h"
1079 #define __Pxy_PyFrame_Initialize_Offsets()\
1080 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1081 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1082 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1083 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1086 /* PyObjectCall2Args.proto */
1087 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1089 /* PyObjectCallMethO.proto */
1090 #if CYTHON_COMPILING_IN_CPYTHON
1091 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1094 /* PyObjectCallOneArg.proto */
1095 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1097 /* PyObjectSetAttrStr.proto */
1098 #if CYTHON_USE_TYPE_SLOTS
1099 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1100 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1102 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1103 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1106 /* ListAppend.proto */
1107 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1108 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1109 PyListObject* L = (PyListObject*) list;
1110 Py_ssize_t len = Py_SIZE(list);
1111 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1113 PyList_SET_ITEM(list, len, x);
1114 Py_SIZE(list) = len+1;
1117 return PyList_Append(list, x);
1120 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1123 /* PyObjectGetMethod.proto */
1124 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1126 /* PyObjectCallMethod1.proto */
1127 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1130 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1132 /* ObjectGetItem.proto */
1133 #if CYTHON_USE_TYPE_SLOTS
1134 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1136 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1139 /* GetTopmostException.proto */
1140 #if CYTHON_USE_EXC_INFO_STACK
1141 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1144 /* PyThreadStateGet.proto */
1145 #if CYTHON_FAST_THREAD_STATE
1146 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1147 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1148 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1150 #define __Pyx_PyThreadState_declare
1151 #define __Pyx_PyThreadState_assign
1152 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1155 /* SaveResetException.proto */
1156 #if CYTHON_FAST_THREAD_STATE
1157 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1158 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1159 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1160 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1162 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1163 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1166 /* PyErrExceptionMatches.proto */
1167 #if CYTHON_FAST_THREAD_STATE
1168 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1169 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1171 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1174 /* GetException.proto */
1175 #if CYTHON_FAST_THREAD_STATE
1176 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1177 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1179 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1182 /* PyObjectCallNoArg.proto */
1183 #if CYTHON_COMPILING_IN_CPYTHON
1184 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1186 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1189 /* PyObjectCallMethod0.proto */
1190 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1193 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1194 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1195 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1196 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1197 __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1199 #define __Pyx_PyList_Pop(L) __Pyx__PyObject_Pop(L)
1200 #define __Pyx_PyObject_Pop(L) __Pyx__PyObject_Pop(L)
1203 /* UnpackUnboundCMethod.proto */
1206 PyObject **method_name;
1210 } __Pyx_CachedCFunction;
1212 /* CallUnboundCMethod0.proto */
1213 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1214 #if CYTHON_COMPILING_IN_CPYTHON
1215 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1216 (likely((cfunc)->func) ?\
1217 (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
1218 (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1219 (PY_VERSION_HEX >= 0x030700A0 ?\
1220 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1221 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1222 (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1223 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1224 (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1225 ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1226 __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1227 __Pyx__CallUnboundCMethod0(cfunc, self))
1229 #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
1232 /* RaiseTooManyValuesToUnpack.proto */
1233 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1235 /* RaiseNeedMoreValuesToUnpack.proto */
1236 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1238 /* IterFinish.proto */
1239 static CYTHON_INLINE int __Pyx_IterFinish(void);
1241 /* UnpackItemEndCheck.proto */
1242 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1245 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1248 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1250 /* SliceObject.proto */
1251 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1252 __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1253 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1254 PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1255 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1256 int has_cstart, int has_cstop, int wraparound);
1258 /* PyErrFetchRestore.proto */
1259 #if CYTHON_FAST_THREAD_STATE
1260 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1261 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1262 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1263 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1264 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1265 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1266 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1267 #if CYTHON_COMPILING_IN_CPYTHON
1268 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1270 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1273 #define __Pyx_PyErr_Clear() PyErr_Clear()
1274 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1275 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1276 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1277 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1278 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1279 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1280 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1283 /* RaiseException.proto */
1284 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1286 /* ListCompAppend.proto */
1287 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1288 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1289 PyListObject* L = (PyListObject*) list;
1290 Py_ssize_t len = Py_SIZE(list);
1291 if (likely(L->allocated > len)) {
1293 PyList_SET_ITEM(list, len, x);
1294 Py_SIZE(list) = len+1;
1297 return PyList_Append(list, x);
1300 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1304 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1306 /* ImportFrom.proto */
1307 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1309 /* GetAttr3.proto */
1310 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1312 /* py_dict_items.proto */
1313 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1315 /* dict_getitem_default.proto */
1316 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1318 /* CallUnboundCMethod1.proto */
1319 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1320 #if CYTHON_COMPILING_IN_CPYTHON
1321 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1323 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1326 /* CallUnboundCMethod2.proto */
1327 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1328 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1329 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1331 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1334 /* RaiseNoneIterError.proto */
1335 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1337 /* PyObject_GenericGetAttrNoDict.proto */
1338 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1339 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1341 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1344 /* PyObject_GenericGetAttr.proto */
1345 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1346 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1348 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1351 /* SetVTable.proto */
1352 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1354 /* PyObjectGetAttrStrNoError.proto */
1355 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1357 /* SetupReduce.proto */
1358 static int __Pyx_setup_reduce(PyObject* type_obj);
1360 /* CalculateMetaclass.proto */
1361 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1363 /* Py3ClassCreate.proto */
1364 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1365 PyObject *mkw, PyObject *modname, PyObject *doc);
1366 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1367 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1369 /* FetchCommonType.proto */
1370 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1372 /* CythonFunctionShared.proto */
1373 #define __Pyx_CyFunction_USED 1
1374 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1375 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1376 #define __Pyx_CYFUNCTION_CCLASS 0x04
1377 #define __Pyx_CyFunction_GetClosure(f)\
1378 (((__pyx_CyFunctionObject *) (f))->func_closure)
1379 #define __Pyx_CyFunction_GetClassObj(f)\
1380 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1381 #define __Pyx_CyFunction_Defaults(type, f)\
1382 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1383 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1384 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1386 PyCFunctionObject func;
1387 #if PY_VERSION_HEX < 0x030500A0
1388 PyObject *func_weakreflist;
1390 PyObject *func_dict;
1391 PyObject *func_name;
1392 PyObject *func_qualname;
1394 PyObject *func_globals;
1395 PyObject *func_code;
1396 PyObject *func_closure;
1397 PyObject *func_classobj;
1399 int defaults_pyobjects;
1400 size_t defaults_size; // used by FusedFunction for copying defaults
1402 PyObject *defaults_tuple;
1403 PyObject *defaults_kwdict;
1404 PyObject *(*defaults_getter)(PyObject *);
1405 PyObject *func_annotations;
1406 } __pyx_CyFunctionObject;
1407 static PyTypeObject *__pyx_CyFunctionType = 0;
1408 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1409 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1410 int flags, PyObject* qualname,
1412 PyObject *module, PyObject *globals,
1414 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1417 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1419 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1421 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1423 static int __pyx_CyFunction_init(void);
1425 /* CythonFunction.proto */
1426 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1427 int flags, PyObject* qualname,
1429 PyObject *module, PyObject *globals,
1432 /* SetNameInClass.proto */
1433 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1434 #define __Pyx_SetNameInClass(ns, name, value)\
1435 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1436 #elif CYTHON_COMPILING_IN_CPYTHON
1437 #define __Pyx_SetNameInClass(ns, name, value)\
1438 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1440 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1443 /* RegisterModuleCleanup.proto */
1444 static void __pyx_module_cleanup(PyObject *self);
1445 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1446 static int __Pyx_RegisterCleanup(void);
1448 #define __Pyx_RegisterCleanup() (0)
1451 /* CLineInTraceback.proto */
1452 #ifdef CYTHON_CLINE_IN_TRACEBACK
1453 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1455 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1458 /* CodeObjectCache.proto */
1460 PyCodeObject* code_object;
1462 } __Pyx_CodeObjectCacheEntry;
1463 struct __Pyx_CodeObjectCache {
1466 __Pyx_CodeObjectCacheEntry* entries;
1468 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1469 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1470 static PyCodeObject *__pyx_find_code_object(int code_line);
1471 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1473 /* AddTraceback.proto */
1474 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1475 int py_line, const char *filename);
1477 /* CIntToPy.proto */
1478 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1480 /* CIntFromPy.proto */
1481 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1483 /* CIntFromPy.proto */
1484 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1486 /* FastTypeChecks.proto */
1487 #if CYTHON_COMPILING_IN_CPYTHON
1488 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1489 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1490 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1491 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1493 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1494 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1495 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1497 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1499 /* CheckBinaryVersion.proto */
1500 static int __Pyx_check_binary_version(void);
1502 /* FunctionExport.proto */
1503 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1505 /* InitStrings.proto */
1506 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1508 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*/
1509 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*/
1511 /* Module declarations from 'cython' */
1513 /* Module declarations from 'lxml.sax' */
1514 static PyTypeObject *__pyx_ptype_4lxml_3sax_ElementTreeProducer = 0;
1515 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *); /*proto*/
1516 static PyObject *__pyx_f_4lxml_3sax___pyx_unpickle_ElementTreeProducer__set_state(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *); /*proto*/
1517 #define __Pyx_MODULE_NAME "lxml.sax"
1518 extern int __pyx_module_is_main_lxml__sax;
1519 int __pyx_module_is_main_lxml__sax = 0;
1521 /* Implementation of 'lxml.sax' */
1522 static PyObject *__pyx_builtin_property;
1523 static PyObject *__pyx_builtin_KeyError;
1524 static PyObject *__pyx_builtin_AttributeError;
1525 static PyObject *__pyx_builtin_IndexError;
1526 static PyObject *__pyx_builtin_min;
1527 static const char __pyx_k_[] = "{";
1528 static const char __pyx_k_k[] = "k";
1529 static const char __pyx_k_v[] = "v";
1530 static const char __pyx_k__3[] = "}";
1531 static const char __pyx_k__6[] = "";
1532 static const char __pyx_k__8[] = ":";
1533 static const char __pyx_k_pi[] = "pi";
1534 static const char __pyx_k_doc[] = "__doc__";
1535 static const char __pyx_k_get[] = "get";
1536 static const char __pyx_k_min[] = "min";
1537 static const char __pyx_k_new[] = "__new__";
1538 static const char __pyx_k_pop[] = "pop";
1539 static const char __pyx_k_s_s[] = "{%s}%s";
1540 static const char __pyx_k_tag[] = "tag";
1541 static const char __pyx_k_uri[] = "uri";
1542 static const char __pyx_k_data[] = "data";
1543 static const char __pyx_k_dict[] = "__dict__";
1544 static const char __pyx_k_init[] = "__init__";
1545 static const char __pyx_k_lxml[] = "lxml";
1546 static const char __pyx_k_main[] = "__main__";
1547 static const char __pyx_k_name[] = "name";
1548 static const char __pyx_k_root[] = "_root";
1549 static const char __pyx_k_self[] = "self";
1550 static const char __pyx_k_tail[] = "tail";
1551 static const char __pyx_k_test[] = "__test__";
1552 static const char __pyx_k_text[] = "text";
1553 static const char __pyx_k_attrs[] = "attrs";
1554 static const char __pyx_k_clear[] = "clear";
1555 static const char __pyx_k_doc_2[] = "doc";
1556 static const char __pyx_k_etree[] = "etree";
1557 static const char __pyx_k_items[] = "items";
1558 static const char __pyx_k_nsmap[] = "nsmap";
1559 static const char __pyx_k_qname[] = "qname";
1560 static const char __pyx_k_split[] = "split";
1561 static const char __pyx_k_state[] = "state";
1562 static const char __pyx_k_value[] = "value";
1563 static const char __pyx_k_append[] = "append";
1564 static const char __pyx_k_dict_2[] = "_dict";
1565 static const char __pyx_k_el_tag[] = "el_tag";
1566 static const char __pyx_k_import[] = "__import__";
1567 static const char __pyx_k_module[] = "__module__";
1568 static const char __pyx_k_name_2[] = "__name__";
1569 static const char __pyx_k_ns_uri[] = "ns_uri";
1570 static const char __pyx_k_pickle[] = "pickle";
1571 static const char __pyx_k_prefix[] = "prefix";
1572 static const char __pyx_k_reduce[] = "__reduce__";
1573 static const char __pyx_k_saxify[] = "saxify";
1574 static const char __pyx_k_target[] = "target";
1575 static const char __pyx_k_update[] = "update";
1576 static const char __pyx_k_Comment[] = "Comment";
1577 static const char __pyx_k_Element[] = "Element";
1578 static const char __pyx_k_el_name[] = "el_name";
1579 static const char __pyx_k_element[] = "element";
1580 static const char __pyx_k_getnext[] = "getnext";
1581 static const char __pyx_k_getroot[] = "getroot";
1582 static const char __pyx_k_locator[] = "locator";
1583 static const char __pyx_k_ns_name[] = "ns_name";
1584 static const char __pyx_k_prepare[] = "__prepare__";
1585 static const char __pyx_k_sibling[] = "sibling";
1586 static const char __pyx_k_KeyError[] = "KeyError";
1587 static const char __pyx_k_SaxError[] = "SaxError";
1588 static const char __pyx_k_buildTag[] = "_buildTag";
1589 static const char __pyx_k_getstate[] = "__getstate__";
1590 static const char __pyx_k_lxml_sax[] = "lxml.sax";
1591 static const char __pyx_k_property[] = "property";
1592 static const char __pyx_k_pyx_type[] = "__pyx_type";
1593 static const char __pyx_k_qualname[] = "__qualname__";
1594 static const char __pyx_k_setstate[] = "__setstate__";
1595 static const char __pyx_k_siblings[] = "siblings";
1596 static const char __pyx_k_LxmlError[] = "LxmlError";
1597 static const char __pyx_k_attr_name[] = "attr_name";
1598 static const char __pyx_k_get_etree[] = "_get_etree";
1599 static const char __pyx_k_iteritems[] = "iteritems";
1600 static const char __pyx_k_metaclass[] = "__metaclass__";
1601 static const char __pyx_k_pyx_state[] = "__pyx_state";
1602 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1603 static const char __pyx_k_IndexError[] = "IndexError";
1604 static const char __pyx_k_SubElement[] = "SubElement";
1605 static const char __pyx_k_attributes[] = "attributes";
1606 static const char __pyx_k_characters[] = "characters";
1607 static const char __pyx_k_default_ns[] = "_default_ns";
1608 static const char __pyx_k_endElement[] = "endElement";
1609 static const char __pyx_k_local_name[] = "local_name";
1610 static const char __pyx_k_lxml_etree[] = "lxml.etree";
1611 static const char __pyx_k_name_tuple[] = "name_tuple";
1612 static const char __pyx_k_ns_mapping[] = "_ns_mapping";
1613 static const char __pyx_k_pyx_result[] = "__pyx_result";
1614 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1615 static const char __pyx_k_ElementTree[] = "ElementTree";
1616 static const char __pyx_k_PickleError[] = "PickleError";
1617 static const char __pyx_k_addprevious[] = "addprevious";
1618 static const char __pyx_k_endDocument[] = "endDocument";
1619 static const char __pyx_k_getprevious[] = "getprevious";
1620 static const char __pyx_k_makeelement[] = "makeelement";
1621 static const char __pyx_k_ns_uri_list[] = "ns_uri_list";
1622 static const char __pyx_k_endElementNS[] = "endElementNS";
1623 static const char __pyx_k_last_element[] = "last_element";
1624 static const char __pyx_k_new_mappings[] = "_new_mappings";
1625 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1626 static const char __pyx_k_startElement[] = "startElement";
1627 static const char __pyx_k_stringsource[] = "stringsource";
1628 static const char __pyx_k_use_setstate[] = "use_setstate";
1629 static const char __pyx_k_element_stack[] = "_element_stack";
1630 static const char __pyx_k_makeelement_2[] = "_makeelement";
1631 static const char __pyx_k_ns_name_tuple[] = "ns_name_tuple";
1632 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1633 static const char __pyx_k_root_siblings[] = "_root_siblings";
1634 static const char __pyx_k_startDocument[] = "startDocument";
1635 static const char __pyx_k_AttributeError[] = "AttributeError";
1636 static const char __pyx_k_ContentHandler[] = "ContentHandler";
1637 static const char __pyx_k_startElementNS[] = "startElementNS";
1638 static const char __pyx_k_content_handler[] = "content_handler";
1639 static const char __pyx_k_element_or_tree[] = "element_or_tree";
1640 static const char __pyx_k_element_stack_2[] = "element_stack";
1641 static const char __pyx_k_iter_attributes[] = "iter_attributes";
1642 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1643 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1644 static const char __pyx_k_src_lxml_sax_py[] = "src/lxml/sax.py";
1645 static const char __pyx_k_xml_sax_handler[] = "xml.sax.handler";
1646 static const char __pyx_k_AttributesNSImpl[] = "AttributesNSImpl";
1647 static const char __pyx_k_endPrefixMapping[] = "endPrefixMapping";
1648 static const char __pyx_k_General_SAX_error[] = "General SAX error.\n ";
1649 static const char __pyx_k_xml_sax_xmlreader[] = "xml.sax.xmlreader";
1650 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1651 static const char __pyx_k_setDocumentLocator[] = "setDocumentLocator";
1652 static const char __pyx_k_startPrefixMapping[] = "startPrefixMapping";
1653 static const char __pyx_k_ElementTreeProducer[] = "ElementTreeProducer";
1654 static const char __pyx_k_ignorableWhitespace[] = "ignorableWhitespace";
1655 static const char __pyx_k_ProcessingInstruction[] = "ProcessingInstruction";
1656 static const char __pyx_k_processingInstruction[] = "processingInstruction";
1657 static const char __pyx_k_ElementTreeContentHandler[] = "ElementTreeContentHandler";
1658 static const char __pyx_k_Unexpected_element_closed[] = "Unexpected element closed: ";
1659 static const char __pyx_k_ElementTreeProducer_saxify[] = "ElementTreeProducer.saxify";
1660 static const char __pyx_k_pyx_unpickle_ElementTreeProduc[] = "__pyx_unpickle_ElementTreeProducer";
1661 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";
1662 static const char __pyx_k_Build_an_lxml_ElementTree_from_S[] = "Build an lxml ElementTree from SAX events.\n ";
1663 static const char __pyx_k_ElementTreeContentHandler___init[] = "ElementTreeContentHandler.__init__";
1664 static const char __pyx_k_ElementTreeContentHandler__build[] = "ElementTreeContentHandler._buildTag";
1665 static const char __pyx_k_ElementTreeContentHandler__get_e[] = "ElementTreeContentHandler._get_etree";
1666 static const char __pyx_k_ElementTreeContentHandler_charac[] = "ElementTreeContentHandler.characters";
1667 static const char __pyx_k_ElementTreeContentHandler_endDoc[] = "ElementTreeContentHandler.endDocument";
1668 static const char __pyx_k_ElementTreeContentHandler_endEle[] = "ElementTreeContentHandler.endElementNS";
1669 static const char __pyx_k_ElementTreeContentHandler_endPre[] = "ElementTreeContentHandler.endPrefixMapping";
1670 static const char __pyx_k_ElementTreeContentHandler_proces[] = "ElementTreeContentHandler.processingInstruction";
1671 static const char __pyx_k_ElementTreeContentHandler_setDoc[] = "ElementTreeContentHandler.setDocumentLocator";
1672 static const char __pyx_k_ElementTreeContentHandler_startD[] = "ElementTreeContentHandler.startDocument";
1673 static const char __pyx_k_ElementTreeContentHandler_startE[] = "ElementTreeContentHandler.startElementNS";
1674 static const char __pyx_k_ElementTreeContentHandler_startP[] = "ElementTreeContentHandler.startPrefixMapping";
1675 static const char __pyx_k_ElementTreeProducer___reduce_cyt[] = "ElementTreeProducer.__reduce_cython__";
1676 static const char __pyx_k_ElementTreeProducer___setstate_c[] = "ElementTreeProducer.__setstate_cython__";
1677 static const char __pyx_k_Incompatible_checksums_s_vs_0x1d[] = "Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))";
1678 static const char __pyx_k_ElementTreeContentHandler_endEle_2[] = "ElementTreeContentHandler.endElement";
1679 static const char __pyx_k_ElementTreeContentHandler_startE_2[] = "ElementTreeContentHandler.startElement";
1680 static PyObject *__pyx_kp_s_;
1681 static PyObject *__pyx_n_s_AttributeError;
1682 static PyObject *__pyx_n_s_AttributesNSImpl;
1683 static PyObject *__pyx_kp_s_Build_an_lxml_ElementTree_from_S;
1684 static PyObject *__pyx_n_s_Comment;
1685 static PyObject *__pyx_n_s_ContentHandler;
1686 static PyObject *__pyx_n_s_Element;
1687 static PyObject *__pyx_n_s_ElementTree;
1688 static PyObject *__pyx_n_s_ElementTreeContentHandler;
1689 static PyObject *__pyx_n_s_ElementTreeContentHandler___init;
1690 static PyObject *__pyx_n_s_ElementTreeContentHandler__build;
1691 static PyObject *__pyx_n_s_ElementTreeContentHandler__get_e;
1692 static PyObject *__pyx_n_s_ElementTreeContentHandler_charac;
1693 static PyObject *__pyx_n_s_ElementTreeContentHandler_endDoc;
1694 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle;
1695 static PyObject *__pyx_n_s_ElementTreeContentHandler_endEle_2;
1696 static PyObject *__pyx_n_s_ElementTreeContentHandler_endPre;
1697 static PyObject *__pyx_n_s_ElementTreeContentHandler_proces;
1698 static PyObject *__pyx_n_s_ElementTreeContentHandler_setDoc;
1699 static PyObject *__pyx_n_s_ElementTreeContentHandler_startD;
1700 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE;
1701 static PyObject *__pyx_n_s_ElementTreeContentHandler_startE_2;
1702 static PyObject *__pyx_n_s_ElementTreeContentHandler_startP;
1703 static PyObject *__pyx_n_s_ElementTreeProducer;
1704 static PyObject *__pyx_n_s_ElementTreeProducer___reduce_cyt;
1705 static PyObject *__pyx_n_s_ElementTreeProducer___setstate_c;
1706 static PyObject *__pyx_n_s_ElementTreeProducer_saxify;
1707 static PyObject *__pyx_kp_s_General_SAX_error;
1708 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x1d;
1709 static PyObject *__pyx_n_s_IndexError;
1710 static PyObject *__pyx_n_s_KeyError;
1711 static PyObject *__pyx_n_s_LxmlError;
1712 static PyObject *__pyx_n_s_PickleError;
1713 static PyObject *__pyx_n_s_ProcessingInstruction;
1714 static PyObject *__pyx_n_s_SaxError;
1715 static PyObject *__pyx_n_s_SubElement;
1716 static PyObject *__pyx_kp_s_Unexpected_element_closed;
1717 static PyObject *__pyx_kp_s__3;
1718 static PyObject *__pyx_kp_s__6;
1719 static PyObject *__pyx_kp_s__8;
1720 static PyObject *__pyx_n_s_addprevious;
1721 static PyObject *__pyx_n_s_append;
1722 static PyObject *__pyx_n_s_attr_name;
1723 static PyObject *__pyx_n_s_attributes;
1724 static PyObject *__pyx_n_s_attrs;
1725 static PyObject *__pyx_n_s_buildTag;
1726 static PyObject *__pyx_n_s_characters;
1727 static PyObject *__pyx_n_s_clear;
1728 static PyObject *__pyx_n_s_cline_in_traceback;
1729 static PyObject *__pyx_n_s_content_handler;
1730 static PyObject *__pyx_n_s_data;
1731 static PyObject *__pyx_n_s_default_ns;
1732 static PyObject *__pyx_n_s_dict;
1733 static PyObject *__pyx_n_s_dict_2;
1734 static PyObject *__pyx_n_s_doc;
1735 static PyObject *__pyx_n_s_doc_2;
1736 static PyObject *__pyx_n_s_el_name;
1737 static PyObject *__pyx_n_s_el_tag;
1738 static PyObject *__pyx_n_s_element;
1739 static PyObject *__pyx_n_s_element_or_tree;
1740 static PyObject *__pyx_n_s_element_stack;
1741 static PyObject *__pyx_n_s_element_stack_2;
1742 static PyObject *__pyx_n_s_endDocument;
1743 static PyObject *__pyx_n_s_endElement;
1744 static PyObject *__pyx_n_s_endElementNS;
1745 static PyObject *__pyx_n_s_endPrefixMapping;
1746 static PyObject *__pyx_n_s_etree;
1747 static PyObject *__pyx_n_s_get;
1748 static PyObject *__pyx_n_s_get_etree;
1749 static PyObject *__pyx_n_s_getnext;
1750 static PyObject *__pyx_n_s_getprevious;
1751 static PyObject *__pyx_n_s_getroot;
1752 static PyObject *__pyx_n_s_getstate;
1753 static PyObject *__pyx_n_s_ignorableWhitespace;
1754 static PyObject *__pyx_n_s_import;
1755 static PyObject *__pyx_n_s_init;
1756 static PyObject *__pyx_n_s_items;
1757 static PyObject *__pyx_n_s_iter_attributes;
1758 static PyObject *__pyx_n_s_iteritems;
1759 static PyObject *__pyx_n_s_k;
1760 static PyObject *__pyx_n_s_last_element;
1761 static PyObject *__pyx_n_s_local_name;
1762 static PyObject *__pyx_n_s_locator;
1763 static PyObject *__pyx_n_s_lxml;
1764 static PyObject *__pyx_n_s_lxml_etree;
1765 static PyObject *__pyx_n_s_lxml_sax;
1766 static PyObject *__pyx_n_s_main;
1767 static PyObject *__pyx_n_s_makeelement;
1768 static PyObject *__pyx_n_s_makeelement_2;
1769 static PyObject *__pyx_n_s_metaclass;
1770 static PyObject *__pyx_n_s_min;
1771 static PyObject *__pyx_n_s_module;
1772 static PyObject *__pyx_n_s_name;
1773 static PyObject *__pyx_n_s_name_2;
1774 static PyObject *__pyx_n_s_name_tuple;
1775 static PyObject *__pyx_n_s_new;
1776 static PyObject *__pyx_n_s_new_mappings;
1777 static PyObject *__pyx_n_s_ns_mapping;
1778 static PyObject *__pyx_n_s_ns_name;
1779 static PyObject *__pyx_n_s_ns_name_tuple;
1780 static PyObject *__pyx_n_s_ns_uri;
1781 static PyObject *__pyx_n_s_ns_uri_list;
1782 static PyObject *__pyx_n_s_nsmap;
1783 static PyObject *__pyx_n_s_pi;
1784 static PyObject *__pyx_n_s_pickle;
1785 static PyObject *__pyx_n_s_pop;
1786 static PyObject *__pyx_n_s_prefix;
1787 static PyObject *__pyx_n_s_prepare;
1788 static PyObject *__pyx_n_s_processingInstruction;
1789 static PyObject *__pyx_n_s_property;
1790 static PyObject *__pyx_n_s_pyx_PickleError;
1791 static PyObject *__pyx_n_s_pyx_checksum;
1792 static PyObject *__pyx_n_s_pyx_result;
1793 static PyObject *__pyx_n_s_pyx_state;
1794 static PyObject *__pyx_n_s_pyx_type;
1795 static PyObject *__pyx_n_s_pyx_unpickle_ElementTreeProduc;
1796 static PyObject *__pyx_n_s_pyx_vtable;
1797 static PyObject *__pyx_n_s_qname;
1798 static PyObject *__pyx_n_s_qualname;
1799 static PyObject *__pyx_n_s_reduce;
1800 static PyObject *__pyx_n_s_reduce_cython;
1801 static PyObject *__pyx_n_s_reduce_ex;
1802 static PyObject *__pyx_n_s_root;
1803 static PyObject *__pyx_n_s_root_siblings;
1804 static PyObject *__pyx_kp_s_s_s;
1805 static PyObject *__pyx_n_s_saxify;
1806 static PyObject *__pyx_n_s_self;
1807 static PyObject *__pyx_n_s_setDocumentLocator;
1808 static PyObject *__pyx_n_s_setstate;
1809 static PyObject *__pyx_n_s_setstate_cython;
1810 static PyObject *__pyx_n_s_sibling;
1811 static PyObject *__pyx_n_s_siblings;
1812 static PyObject *__pyx_n_s_split;
1813 static PyObject *__pyx_kp_s_src_lxml_sax_py;
1814 static PyObject *__pyx_n_s_startDocument;
1815 static PyObject *__pyx_n_s_startElement;
1816 static PyObject *__pyx_n_s_startElementNS;
1817 static PyObject *__pyx_n_s_startPrefixMapping;
1818 static PyObject *__pyx_n_s_state;
1819 static PyObject *__pyx_kp_s_stringsource;
1820 static PyObject *__pyx_n_s_tag;
1821 static PyObject *__pyx_n_s_tail;
1822 static PyObject *__pyx_n_s_target;
1823 static PyObject *__pyx_n_s_test;
1824 static PyObject *__pyx_n_s_text;
1825 static PyObject *__pyx_n_s_update;
1826 static PyObject *__pyx_n_s_uri;
1827 static PyObject *__pyx_n_s_use_setstate;
1828 static PyObject *__pyx_n_s_v;
1829 static PyObject *__pyx_n_s_value;
1830 static PyObject *__pyx_n_s_xml_sax_handler;
1831 static PyObject *__pyx_n_s_xml_sax_xmlreader;
1832 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement); /* proto */
1833 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1834 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 */
1835 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1836 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1837 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 */
1838 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix); /* proto */
1839 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 */
1840 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 */
1841 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 */
1842 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 */
1843 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 */
1844 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
1845 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
1846 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 */
1847 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1848 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self); /* proto */
1849 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 */
1850 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler); /* proto */
1851 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 */
1852 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1853 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
1854 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
1855 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
1856 static PyObject *__pyx_int_1;
1857 static PyObject *__pyx_int_30712058;
1858 static PyObject *__pyx_int_neg_1;
1859 static PyObject *__pyx_slice__2;
1860 static PyObject *__pyx_slice__5;
1861 static PyObject *__pyx_slice__7;
1862 static PyObject *__pyx_tuple__4;
1863 static PyObject *__pyx_tuple__9;
1864 static PyObject *__pyx_tuple__11;
1865 static PyObject *__pyx_tuple__12;
1866 static PyObject *__pyx_tuple__14;
1867 static PyObject *__pyx_tuple__16;
1868 static PyObject *__pyx_tuple__18;
1869 static PyObject *__pyx_tuple__20;
1870 static PyObject *__pyx_tuple__22;
1871 static PyObject *__pyx_tuple__24;
1872 static PyObject *__pyx_tuple__26;
1873 static PyObject *__pyx_tuple__28;
1874 static PyObject *__pyx_tuple__29;
1875 static PyObject *__pyx_tuple__31;
1876 static PyObject *__pyx_tuple__33;
1877 static PyObject *__pyx_tuple__35;
1878 static PyObject *__pyx_tuple__36;
1879 static PyObject *__pyx_tuple__38;
1880 static PyObject *__pyx_tuple__40;
1881 static PyObject *__pyx_tuple__42;
1882 static PyObject *__pyx_tuple__44;
1883 static PyObject *__pyx_tuple__46;
1884 static PyObject *__pyx_tuple__48;
1885 static PyObject *__pyx_codeobj__10;
1886 static PyObject *__pyx_codeobj__13;
1887 static PyObject *__pyx_codeobj__15;
1888 static PyObject *__pyx_codeobj__17;
1889 static PyObject *__pyx_codeobj__19;
1890 static PyObject *__pyx_codeobj__21;
1891 static PyObject *__pyx_codeobj__23;
1892 static PyObject *__pyx_codeobj__25;
1893 static PyObject *__pyx_codeobj__27;
1894 static PyObject *__pyx_codeobj__30;
1895 static PyObject *__pyx_codeobj__32;
1896 static PyObject *__pyx_codeobj__34;
1897 static PyObject *__pyx_codeobj__37;
1898 static PyObject *__pyx_codeobj__39;
1899 static PyObject *__pyx_codeobj__41;
1900 static PyObject *__pyx_codeobj__43;
1901 static PyObject *__pyx_codeobj__45;
1902 static PyObject *__pyx_codeobj__47;
1903 static PyObject *__pyx_codeobj__49;
1909 * def _getNsTag(tag): # <<<<<<<<<<<<<<
1911 * return tuple(tag[1:].split('}', 1))
1914 static PyObject *__pyx_f_4lxml_3sax__getNsTag(PyObject *__pyx_v_tag) {
1915 PyObject *__pyx_r = NULL;
1916 __Pyx_RefNannyDeclarations
1917 PyObject *__pyx_t_1 = NULL;
1919 PyObject *__pyx_t_3 = NULL;
1920 int __pyx_lineno = 0;
1921 const char *__pyx_filename = NULL;
1922 int __pyx_clineno = 0;
1923 __Pyx_RefNannySetupContext("_getNsTag", 0);
1927 * def _getNsTag(tag):
1928 * if tag[0] == '{': # <<<<<<<<<<<<<<
1929 * return tuple(tag[1:].split('}', 1))
1932 __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)
1933 __Pyx_GOTREF(__pyx_t_1);
1934 __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)
1935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1939 * def _getNsTag(tag):
1941 * return tuple(tag[1:].split('}', 1)) # <<<<<<<<<<<<<<
1945 __Pyx_XDECREF(__pyx_r);
1946 __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)
1947 __Pyx_GOTREF(__pyx_t_1);
1948 __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)
1949 __Pyx_GOTREF(__pyx_t_3);
1950 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1951 __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)
1952 __Pyx_GOTREF(__pyx_t_1);
1953 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1954 __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
1955 __Pyx_GOTREF(__pyx_t_3);
1956 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1957 __pyx_r = ((PyObject*)__pyx_t_3);
1963 * def _getNsTag(tag):
1964 * if tag[0] == '{': # <<<<<<<<<<<<<<
1965 * return tuple(tag[1:].split('}', 1))
1971 * return tuple(tag[1:].split('}', 1))
1973 * return None, tag # <<<<<<<<<<<<<<
1978 __Pyx_XDECREF(__pyx_r);
1979 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
1980 __Pyx_GOTREF(__pyx_t_3);
1981 __Pyx_INCREF(Py_None);
1982 __Pyx_GIVEREF(Py_None);
1983 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
1984 __Pyx_INCREF(__pyx_v_tag);
1985 __Pyx_GIVEREF(__pyx_v_tag);
1986 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tag);
1987 __pyx_r = ((PyObject*)__pyx_t_3);
1995 * def _getNsTag(tag): # <<<<<<<<<<<<<<
1997 * return tuple(tag[1:].split('}', 1))
2000 /* function exit code */
2002 __Pyx_XDECREF(__pyx_t_1);
2003 __Pyx_XDECREF(__pyx_t_3);
2004 __Pyx_AddTraceback("lxml.sax._getNsTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
2007 __Pyx_XGIVEREF(__pyx_r);
2008 __Pyx_RefNannyFinishContext();
2013 * """Build an lxml ElementTree from SAX events.
2015 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
2016 * ContentHandler.__init__(self)
2020 /* Python wrapper */
2021 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2022 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};
2023 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2024 PyObject *__pyx_v_self = 0;
2025 PyObject *__pyx_v_makeelement = 0;
2026 int __pyx_lineno = 0;
2027 const char *__pyx_filename = NULL;
2028 int __pyx_clineno = 0;
2029 PyObject *__pyx_r = 0;
2030 __Pyx_RefNannyDeclarations
2031 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2033 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_makeelement,0};
2034 PyObject* values[2] = {0,0};
2035 values[1] = ((PyObject *)((PyObject *)Py_None));
2036 if (unlikely(__pyx_kwds)) {
2038 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2040 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2042 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2045 default: goto __pyx_L5_argtuple_error;
2047 kw_args = PyDict_Size(__pyx_kwds);
2050 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2051 else goto __pyx_L5_argtuple_error;
2055 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_makeelement);
2056 if (value) { values[1] = value; kw_args--; }
2059 if (unlikely(kw_args > 0)) {
2060 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 38, __pyx_L3_error)
2063 switch (PyTuple_GET_SIZE(__pyx_args)) {
2064 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2066 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2068 default: goto __pyx_L5_argtuple_error;
2071 __pyx_v_self = values[0];
2072 __pyx_v_makeelement = values[1];
2074 goto __pyx_L4_argument_unpacking_done;
2075 __pyx_L5_argtuple_error:;
2076 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error)
2078 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079 __Pyx_RefNannyFinishContext();
2081 __pyx_L4_argument_unpacking_done:;
2082 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_makeelement);
2084 /* function exit code */
2085 __Pyx_RefNannyFinishContext();
2089 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_makeelement) {
2090 PyObject *__pyx_r = NULL;
2091 __Pyx_RefNannyDeclarations
2092 PyObject *__pyx_t_1 = NULL;
2093 PyObject *__pyx_t_2 = NULL;
2094 PyObject *__pyx_t_3 = NULL;
2097 int __pyx_lineno = 0;
2098 const char *__pyx_filename = NULL;
2099 int __pyx_clineno = 0;
2100 __Pyx_RefNannySetupContext("__init__", 0);
2101 __Pyx_INCREF(__pyx_v_makeelement);
2105 * def __init__(self, makeelement=None):
2106 * ContentHandler.__init__(self) # <<<<<<<<<<<<<<
2108 * self._root_siblings = []
2110 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
2111 __Pyx_GOTREF(__pyx_t_2);
2112 __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)
2113 __Pyx_GOTREF(__pyx_t_3);
2114 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2116 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2117 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2118 if (likely(__pyx_t_2)) {
2119 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2120 __Pyx_INCREF(__pyx_t_2);
2121 __Pyx_INCREF(function);
2122 __Pyx_DECREF_SET(__pyx_t_3, function);
2125 __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);
2126 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2127 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2128 __Pyx_GOTREF(__pyx_t_1);
2129 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2130 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2133 * def __init__(self, makeelement=None):
2134 * ContentHandler.__init__(self)
2135 * self._root = None # <<<<<<<<<<<<<<
2136 * self._root_siblings = []
2137 * self._element_stack = []
2139 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, Py_None) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
2142 * ContentHandler.__init__(self)
2144 * self._root_siblings = [] # <<<<<<<<<<<<<<
2145 * self._element_stack = []
2146 * self._default_ns = None
2148 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
2149 __Pyx_GOTREF(__pyx_t_1);
2150 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root_siblings, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
2151 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2155 * self._root_siblings = []
2156 * self._element_stack = [] # <<<<<<<<<<<<<<
2157 * self._default_ns = None
2158 * self._ns_mapping = { None : [None] }
2160 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2161 __Pyx_GOTREF(__pyx_t_1);
2162 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_element_stack, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
2163 __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] }
2170 * self._new_mappings = {}
2172 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, Py_None) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
2175 * self._element_stack = []
2176 * self._default_ns = None
2177 * self._ns_mapping = { None : [None] } # <<<<<<<<<<<<<<
2178 * self._new_mappings = {}
2179 * if makeelement is None:
2181 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
2182 __Pyx_GOTREF(__pyx_t_1);
2183 __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
2184 __Pyx_GOTREF(__pyx_t_3);
2185 __Pyx_INCREF(Py_None);
2186 __Pyx_GIVEREF(Py_None);
2187 PyList_SET_ITEM(__pyx_t_3, 0, Py_None);
2188 if (PyDict_SetItem(__pyx_t_1, Py_None, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2189 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2190 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ns_mapping, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2191 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2194 * self._default_ns = None
2195 * self._ns_mapping = { None : [None] }
2196 * self._new_mappings = {} # <<<<<<<<<<<<<<
2197 * if makeelement is None:
2198 * makeelement = etree.Element
2200 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2201 __Pyx_GOTREF(__pyx_t_1);
2202 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_new_mappings, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
2203 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2206 * self._ns_mapping = { None : [None] }
2207 * self._new_mappings = {}
2208 * if makeelement is None: # <<<<<<<<<<<<<<
2209 * makeelement = etree.Element
2210 * self._makeelement = makeelement
2212 __pyx_t_4 = (__pyx_v_makeelement == Py_None);
2213 __pyx_t_5 = (__pyx_t_4 != 0);
2217 * self._new_mappings = {}
2218 * if makeelement is None:
2219 * makeelement = etree.Element # <<<<<<<<<<<<<<
2220 * self._makeelement = makeelement
2223 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
2224 __Pyx_GOTREF(__pyx_t_1);
2225 __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)
2226 __Pyx_GOTREF(__pyx_t_3);
2227 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2228 __Pyx_DECREF_SET(__pyx_v_makeelement, __pyx_t_3);
2232 * self._ns_mapping = { None : [None] }
2233 * self._new_mappings = {}
2234 * if makeelement is None: # <<<<<<<<<<<<<<
2235 * makeelement = etree.Element
2236 * self._makeelement = makeelement
2241 * if makeelement is None:
2242 * makeelement = etree.Element
2243 * self._makeelement = makeelement # <<<<<<<<<<<<<<
2245 * def _get_etree(self):
2247 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_makeelement_2, __pyx_v_makeelement) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
2250 * """Build an lxml ElementTree from SAX events.
2252 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
2253 * ContentHandler.__init__(self)
2257 /* function exit code */
2258 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2261 __Pyx_XDECREF(__pyx_t_1);
2262 __Pyx_XDECREF(__pyx_t_2);
2263 __Pyx_XDECREF(__pyx_t_3);
2264 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2267 __Pyx_XDECREF(__pyx_v_makeelement);
2268 __Pyx_XGIVEREF(__pyx_r);
2269 __Pyx_RefNannyFinishContext();
2274 * self._makeelement = makeelement
2276 * def _get_etree(self): # <<<<<<<<<<<<<<
2277 * "Contains the generated ElementTree after parsing is finished."
2278 * return ElementTree(self._root)
2281 /* Python wrapper */
2282 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2283 static char __pyx_doc_4lxml_3sax_25ElementTreeContentHandler_2_get_etree[] = "Contains the generated ElementTree after parsing is finished.";
2284 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};
2285 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_3_get_etree(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2286 PyObject *__pyx_r = 0;
2287 __Pyx_RefNannyDeclarations
2288 __Pyx_RefNannySetupContext("_get_etree (wrapper)", 0);
2289 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(__pyx_self, ((PyObject *)__pyx_v_self));
2291 /* function exit code */
2292 __Pyx_RefNannyFinishContext();
2296 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_2_get_etree(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2297 PyObject *__pyx_r = NULL;
2298 __Pyx_RefNannyDeclarations
2299 PyObject *__pyx_t_1 = NULL;
2300 PyObject *__pyx_t_2 = NULL;
2301 PyObject *__pyx_t_3 = NULL;
2302 PyObject *__pyx_t_4 = NULL;
2303 int __pyx_lineno = 0;
2304 const char *__pyx_filename = NULL;
2305 int __pyx_clineno = 0;
2306 __Pyx_RefNannySetupContext("_get_etree", 0);
2309 * def _get_etree(self):
2310 * "Contains the generated ElementTree after parsing is finished."
2311 * return ElementTree(self._root) # <<<<<<<<<<<<<<
2313 * etree = property(_get_etree, doc=_get_etree.__doc__)
2315 __Pyx_XDECREF(__pyx_r);
2316 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
2317 __Pyx_GOTREF(__pyx_t_2);
2318 __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)
2319 __Pyx_GOTREF(__pyx_t_3);
2321 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2322 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
2323 if (likely(__pyx_t_4)) {
2324 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2325 __Pyx_INCREF(__pyx_t_4);
2326 __Pyx_INCREF(function);
2327 __Pyx_DECREF_SET(__pyx_t_2, function);
2330 __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);
2331 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2332 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2333 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
2334 __Pyx_GOTREF(__pyx_t_1);
2335 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2336 __pyx_r = __pyx_t_1;
2341 * self._makeelement = makeelement
2343 * def _get_etree(self): # <<<<<<<<<<<<<<
2344 * "Contains the generated ElementTree after parsing is finished."
2345 * return ElementTree(self._root)
2348 /* function exit code */
2350 __Pyx_XDECREF(__pyx_t_1);
2351 __Pyx_XDECREF(__pyx_t_2);
2352 __Pyx_XDECREF(__pyx_t_3);
2353 __Pyx_XDECREF(__pyx_t_4);
2354 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._get_etree", __pyx_clineno, __pyx_lineno, __pyx_filename);
2357 __Pyx_XGIVEREF(__pyx_r);
2358 __Pyx_RefNannyFinishContext();
2363 * etree = property(_get_etree, doc=_get_etree.__doc__)
2365 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
2370 /* Python wrapper */
2371 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2372 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator = {"setDocumentLocator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator, METH_VARARGS|METH_KEYWORDS, 0};
2373 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_5setDocumentLocator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2374 CYTHON_UNUSED PyObject *__pyx_v_self = 0;
2375 CYTHON_UNUSED PyObject *__pyx_v_locator = 0;
2376 int __pyx_lineno = 0;
2377 const char *__pyx_filename = NULL;
2378 int __pyx_clineno = 0;
2379 PyObject *__pyx_r = 0;
2380 __Pyx_RefNannyDeclarations
2381 __Pyx_RefNannySetupContext("setDocumentLocator (wrapper)", 0);
2383 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_locator,0};
2384 PyObject* values[2] = {0,0};
2385 if (unlikely(__pyx_kwds)) {
2387 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2389 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2391 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2394 default: goto __pyx_L5_argtuple_error;
2396 kw_args = PyDict_Size(__pyx_kwds);
2399 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2400 else goto __pyx_L5_argtuple_error;
2403 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_locator)) != 0)) kw_args--;
2405 __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
2408 if (unlikely(kw_args > 0)) {
2409 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setDocumentLocator") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
2411 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2412 goto __pyx_L5_argtuple_error;
2414 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2415 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2417 __pyx_v_self = values[0];
2418 __pyx_v_locator = values[1];
2420 goto __pyx_L4_argument_unpacking_done;
2421 __pyx_L5_argtuple_error:;
2422 __Pyx_RaiseArgtupleInvalid("setDocumentLocator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
2424 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.setDocumentLocator", __pyx_clineno, __pyx_lineno, __pyx_filename);
2425 __Pyx_RefNannyFinishContext();
2427 __pyx_L4_argument_unpacking_done:;
2428 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_4setDocumentLocator(__pyx_self, __pyx_v_self, __pyx_v_locator);
2430 /* function exit code */
2431 __Pyx_RefNannyFinishContext();
2435 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) {
2436 PyObject *__pyx_r = NULL;
2437 __Pyx_RefNannyDeclarations
2438 __Pyx_RefNannySetupContext("setDocumentLocator", 0);
2440 /* function exit code */
2441 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2442 __Pyx_XGIVEREF(__pyx_r);
2443 __Pyx_RefNannyFinishContext();
2450 * def startDocument(self): # <<<<<<<<<<<<<<
2455 /* Python wrapper */
2456 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2457 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_7startDocument = {"startDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument, METH_O, 0};
2458 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_7startDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2459 PyObject *__pyx_r = 0;
2460 __Pyx_RefNannyDeclarations
2461 __Pyx_RefNannySetupContext("startDocument (wrapper)", 0);
2462 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2464 /* function exit code */
2465 __Pyx_RefNannyFinishContext();
2469 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_6startDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2470 PyObject *__pyx_r = NULL;
2471 __Pyx_RefNannyDeclarations
2472 __Pyx_RefNannySetupContext("startDocument", 0);
2474 /* function exit code */
2475 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2476 __Pyx_XGIVEREF(__pyx_r);
2477 __Pyx_RefNannyFinishContext();
2484 * def endDocument(self): # <<<<<<<<<<<<<<
2489 /* Python wrapper */
2490 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2491 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_9endDocument = {"endDocument", (PyCFunction)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument, METH_O, 0};
2492 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_9endDocument(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2493 PyObject *__pyx_r = 0;
2494 __Pyx_RefNannyDeclarations
2495 __Pyx_RefNannySetupContext("endDocument (wrapper)", 0);
2496 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(__pyx_self, ((PyObject *)__pyx_v_self));
2498 /* function exit code */
2499 __Pyx_RefNannyFinishContext();
2503 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_8endDocument(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
2504 PyObject *__pyx_r = NULL;
2505 __Pyx_RefNannyDeclarations
2506 __Pyx_RefNannySetupContext("endDocument", 0);
2508 /* function exit code */
2509 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2510 __Pyx_XGIVEREF(__pyx_r);
2511 __Pyx_RefNannyFinishContext();
2518 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
2519 * self._new_mappings[prefix] = uri
2523 /* Python wrapper */
2524 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2525 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping = {"startPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2526 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_11startPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2527 PyObject *__pyx_v_self = 0;
2528 PyObject *__pyx_v_prefix = 0;
2529 PyObject *__pyx_v_uri = 0;
2530 int __pyx_lineno = 0;
2531 const char *__pyx_filename = NULL;
2532 int __pyx_clineno = 0;
2533 PyObject *__pyx_r = 0;
2534 __Pyx_RefNannyDeclarations
2535 __Pyx_RefNannySetupContext("startPrefixMapping (wrapper)", 0);
2537 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,&__pyx_n_s_uri,0};
2538 PyObject* values[3] = {0,0,0};
2539 if (unlikely(__pyx_kwds)) {
2541 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2543 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2545 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2547 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2550 default: goto __pyx_L5_argtuple_error;
2552 kw_args = PyDict_Size(__pyx_kwds);
2555 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2556 else goto __pyx_L5_argtuple_error;
2559 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2561 __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 1); __PYX_ERR(0, 65, __pyx_L3_error)
2565 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
2567 __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, 2); __PYX_ERR(0, 65, __pyx_L3_error)
2570 if (unlikely(kw_args > 0)) {
2571 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startPrefixMapping") < 0)) __PYX_ERR(0, 65, __pyx_L3_error)
2573 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2574 goto __pyx_L5_argtuple_error;
2576 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2577 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2578 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2580 __pyx_v_self = values[0];
2581 __pyx_v_prefix = values[1];
2582 __pyx_v_uri = values[2];
2584 goto __pyx_L4_argument_unpacking_done;
2585 __pyx_L5_argtuple_error:;
2586 __Pyx_RaiseArgtupleInvalid("startPrefixMapping", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 65, __pyx_L3_error)
2588 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2589 __Pyx_RefNannyFinishContext();
2591 __pyx_L4_argument_unpacking_done:;
2592 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_10startPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix, __pyx_v_uri);
2594 /* function exit code */
2595 __Pyx_RefNannyFinishContext();
2599 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) {
2600 PyObject *__pyx_r = NULL;
2601 __Pyx_RefNannyDeclarations
2602 PyObject *__pyx_t_1 = NULL;
2603 PyObject *__pyx_t_2 = NULL;
2604 PyObject *__pyx_t_3 = NULL;
2605 PyObject *__pyx_t_4 = NULL;
2606 PyObject *__pyx_t_5 = NULL;
2609 PyObject *__pyx_t_8 = NULL;
2610 PyObject *__pyx_t_9 = NULL;
2611 PyObject *__pyx_t_10 = NULL;
2614 int __pyx_lineno = 0;
2615 const char *__pyx_filename = NULL;
2616 int __pyx_clineno = 0;
2617 __Pyx_RefNannySetupContext("startPrefixMapping", 0);
2621 * def startPrefixMapping(self, prefix, uri):
2622 * self._new_mappings[prefix] = uri # <<<<<<<<<<<<<<
2624 * self._ns_mapping[prefix].append(uri)
2626 __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)
2627 __Pyx_GOTREF(__pyx_t_1);
2628 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_prefix, __pyx_v_uri) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
2629 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2632 * def startPrefixMapping(self, prefix, uri):
2633 * self._new_mappings[prefix] = uri
2634 * try: # <<<<<<<<<<<<<<
2635 * self._ns_mapping[prefix].append(uri)
2639 __Pyx_PyThreadState_declare
2640 __Pyx_PyThreadState_assign
2641 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
2642 __Pyx_XGOTREF(__pyx_t_2);
2643 __Pyx_XGOTREF(__pyx_t_3);
2644 __Pyx_XGOTREF(__pyx_t_4);
2648 * self._new_mappings[prefix] = uri
2650 * self._ns_mapping[prefix].append(uri) # <<<<<<<<<<<<<<
2652 * self._ns_mapping[prefix] = [uri]
2654 __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)
2655 __Pyx_GOTREF(__pyx_t_1);
2656 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L3_error)
2657 __Pyx_GOTREF(__pyx_t_5);
2658 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2659 __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)
2660 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2663 * def startPrefixMapping(self, prefix, uri):
2664 * self._new_mappings[prefix] = uri
2665 * try: # <<<<<<<<<<<<<<
2666 * self._ns_mapping[prefix].append(uri)
2670 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2671 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2672 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2673 goto __pyx_L8_try_end;
2675 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2676 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2680 * self._ns_mapping[prefix].append(uri)
2681 * except KeyError: # <<<<<<<<<<<<<<
2682 * self._ns_mapping[prefix] = [uri]
2683 * if prefix is None:
2685 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
2687 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2688 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 69, __pyx_L5_except_error)
2689 __Pyx_GOTREF(__pyx_t_5);
2690 __Pyx_GOTREF(__pyx_t_1);
2691 __Pyx_GOTREF(__pyx_t_8);
2694 * self._ns_mapping[prefix].append(uri)
2696 * self._ns_mapping[prefix] = [uri] # <<<<<<<<<<<<<<
2697 * if prefix is None:
2698 * self._default_ns = uri
2700 __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2701 __Pyx_GOTREF(__pyx_t_9);
2702 __Pyx_INCREF(__pyx_v_uri);
2703 __Pyx_GIVEREF(__pyx_v_uri);
2704 PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_uri);
2705 __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)
2706 __Pyx_GOTREF(__pyx_t_10);
2707 if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_prefix, __pyx_t_9) < 0)) __PYX_ERR(0, 70, __pyx_L5_except_error)
2708 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2709 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2710 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2711 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2712 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2713 goto __pyx_L4_exception_handled;
2715 goto __pyx_L5_except_error;
2716 __pyx_L5_except_error:;
2719 * def startPrefixMapping(self, prefix, uri):
2720 * self._new_mappings[prefix] = uri
2721 * try: # <<<<<<<<<<<<<<
2722 * self._ns_mapping[prefix].append(uri)
2725 __Pyx_XGIVEREF(__pyx_t_2);
2726 __Pyx_XGIVEREF(__pyx_t_3);
2727 __Pyx_XGIVEREF(__pyx_t_4);
2728 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2729 goto __pyx_L1_error;
2730 __pyx_L4_exception_handled:;
2731 __Pyx_XGIVEREF(__pyx_t_2);
2732 __Pyx_XGIVEREF(__pyx_t_3);
2733 __Pyx_XGIVEREF(__pyx_t_4);
2734 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2740 * self._ns_mapping[prefix] = [uri]
2741 * if prefix is None: # <<<<<<<<<<<<<<
2742 * self._default_ns = uri
2745 __pyx_t_11 = (__pyx_v_prefix == Py_None);
2746 __pyx_t_12 = (__pyx_t_11 != 0);
2750 * self._ns_mapping[prefix] = [uri]
2751 * if prefix is None:
2752 * self._default_ns = uri # <<<<<<<<<<<<<<
2754 * def endPrefixMapping(self, prefix):
2756 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_v_uri) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
2760 * self._ns_mapping[prefix] = [uri]
2761 * if prefix is None: # <<<<<<<<<<<<<<
2762 * self._default_ns = uri
2770 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
2771 * self._new_mappings[prefix] = uri
2775 /* function exit code */
2776 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2779 __Pyx_XDECREF(__pyx_t_1);
2780 __Pyx_XDECREF(__pyx_t_5);
2781 __Pyx_XDECREF(__pyx_t_8);
2782 __Pyx_XDECREF(__pyx_t_9);
2783 __Pyx_XDECREF(__pyx_t_10);
2784 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2787 __Pyx_XGIVEREF(__pyx_r);
2788 __Pyx_RefNannyFinishContext();
2793 * self._default_ns = uri
2795 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
2796 * ns_uri_list = self._ns_mapping[prefix]
2800 /* Python wrapper */
2801 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2802 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping = {"endPrefixMapping", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping, METH_VARARGS|METH_KEYWORDS, 0};
2803 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_13endPrefixMapping(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2804 PyObject *__pyx_v_self = 0;
2805 PyObject *__pyx_v_prefix = 0;
2806 int __pyx_lineno = 0;
2807 const char *__pyx_filename = NULL;
2808 int __pyx_clineno = 0;
2809 PyObject *__pyx_r = 0;
2810 __Pyx_RefNannyDeclarations
2811 __Pyx_RefNannySetupContext("endPrefixMapping (wrapper)", 0);
2813 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_prefix,0};
2814 PyObject* values[2] = {0,0};
2815 if (unlikely(__pyx_kwds)) {
2817 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2819 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2821 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2824 default: goto __pyx_L5_argtuple_error;
2826 kw_args = PyDict_Size(__pyx_kwds);
2829 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2830 else goto __pyx_L5_argtuple_error;
2833 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prefix)) != 0)) kw_args--;
2835 __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, 1); __PYX_ERR(0, 74, __pyx_L3_error)
2838 if (unlikely(kw_args > 0)) {
2839 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endPrefixMapping") < 0)) __PYX_ERR(0, 74, __pyx_L3_error)
2841 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2842 goto __pyx_L5_argtuple_error;
2844 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2845 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2847 __pyx_v_self = values[0];
2848 __pyx_v_prefix = values[1];
2850 goto __pyx_L4_argument_unpacking_done;
2851 __pyx_L5_argtuple_error:;
2852 __Pyx_RaiseArgtupleInvalid("endPrefixMapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
2854 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2855 __Pyx_RefNannyFinishContext();
2857 __pyx_L4_argument_unpacking_done:;
2858 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(__pyx_self, __pyx_v_self, __pyx_v_prefix);
2860 /* function exit code */
2861 __Pyx_RefNannyFinishContext();
2865 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_12endPrefixMapping(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_prefix) {
2866 PyObject *__pyx_v_ns_uri_list = NULL;
2867 PyObject *__pyx_r = NULL;
2868 __Pyx_RefNannyDeclarations
2869 PyObject *__pyx_t_1 = NULL;
2870 PyObject *__pyx_t_2 = NULL;
2873 int __pyx_lineno = 0;
2874 const char *__pyx_filename = NULL;
2875 int __pyx_clineno = 0;
2876 __Pyx_RefNannySetupContext("endPrefixMapping", 0);
2880 * def endPrefixMapping(self, prefix):
2881 * ns_uri_list = self._ns_mapping[prefix] # <<<<<<<<<<<<<<
2883 * if prefix is None:
2885 __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)
2886 __Pyx_GOTREF(__pyx_t_1);
2887 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
2888 __Pyx_GOTREF(__pyx_t_2);
2889 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2890 __pyx_v_ns_uri_list = __pyx_t_2;
2894 * def endPrefixMapping(self, prefix):
2895 * ns_uri_list = self._ns_mapping[prefix]
2896 * ns_uri_list.pop() # <<<<<<<<<<<<<<
2897 * if prefix is None:
2898 * self._default_ns = ns_uri_list[-1]
2900 __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_ns_uri_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
2901 __Pyx_GOTREF(__pyx_t_2);
2902 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2905 * ns_uri_list = self._ns_mapping[prefix]
2907 * if prefix is None: # <<<<<<<<<<<<<<
2908 * self._default_ns = ns_uri_list[-1]
2911 __pyx_t_3 = (__pyx_v_prefix == Py_None);
2912 __pyx_t_4 = (__pyx_t_3 != 0);
2917 * if prefix is None:
2918 * self._default_ns = ns_uri_list[-1] # <<<<<<<<<<<<<<
2920 * def _buildTag(self, ns_name_tuple):
2922 __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)
2923 __Pyx_GOTREF(__pyx_t_2);
2924 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_default_ns, __pyx_t_2) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
2925 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2928 * ns_uri_list = self._ns_mapping[prefix]
2930 * if prefix is None: # <<<<<<<<<<<<<<
2931 * self._default_ns = ns_uri_list[-1]
2937 * self._default_ns = uri
2939 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
2940 * ns_uri_list = self._ns_mapping[prefix]
2944 /* function exit code */
2945 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2948 __Pyx_XDECREF(__pyx_t_1);
2949 __Pyx_XDECREF(__pyx_t_2);
2950 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endPrefixMapping", __pyx_clineno, __pyx_lineno, __pyx_filename);
2953 __Pyx_XDECREF(__pyx_v_ns_uri_list);
2954 __Pyx_XGIVEREF(__pyx_r);
2955 __Pyx_RefNannyFinishContext();
2960 * self._default_ns = ns_uri_list[-1]
2962 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
2963 * ns_uri, local_name = ns_name_tuple
2967 /* Python wrapper */
2968 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2969 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};
2970 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_15_buildTag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2971 PyObject *__pyx_v_self = 0;
2972 PyObject *__pyx_v_ns_name_tuple = 0;
2973 int __pyx_lineno = 0;
2974 const char *__pyx_filename = NULL;
2975 int __pyx_clineno = 0;
2976 PyObject *__pyx_r = 0;
2977 __Pyx_RefNannyDeclarations
2978 __Pyx_RefNannySetupContext("_buildTag (wrapper)", 0);
2980 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name_tuple,0};
2981 PyObject* values[2] = {0,0};
2982 if (unlikely(__pyx_kwds)) {
2984 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2986 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2988 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2991 default: goto __pyx_L5_argtuple_error;
2993 kw_args = PyDict_Size(__pyx_kwds);
2996 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2997 else goto __pyx_L5_argtuple_error;
3000 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name_tuple)) != 0)) kw_args--;
3002 __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, 1); __PYX_ERR(0, 80, __pyx_L3_error)
3005 if (unlikely(kw_args > 0)) {
3006 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_buildTag") < 0)) __PYX_ERR(0, 80, __pyx_L3_error)
3008 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3009 goto __pyx_L5_argtuple_error;
3011 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3012 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3014 __pyx_v_self = values[0];
3015 __pyx_v_ns_name_tuple = values[1];
3017 goto __pyx_L4_argument_unpacking_done;
3018 __pyx_L5_argtuple_error:;
3019 __Pyx_RaiseArgtupleInvalid("_buildTag", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 80, __pyx_L3_error)
3021 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3022 __Pyx_RefNannyFinishContext();
3024 __pyx_L4_argument_unpacking_done:;
3025 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(__pyx_self, __pyx_v_self, __pyx_v_ns_name_tuple);
3027 /* function exit code */
3028 __Pyx_RefNannyFinishContext();
3032 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_14_buildTag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ns_name_tuple) {
3033 PyObject *__pyx_v_ns_uri = NULL;
3034 PyObject *__pyx_v_local_name = NULL;
3035 PyObject *__pyx_v_el_tag = NULL;
3036 PyObject *__pyx_r = NULL;
3037 __Pyx_RefNannyDeclarations
3038 PyObject *__pyx_t_1 = NULL;
3039 PyObject *__pyx_t_2 = NULL;
3040 PyObject *__pyx_t_3 = NULL;
3041 PyObject *(*__pyx_t_4)(PyObject *);
3043 int __pyx_lineno = 0;
3044 const char *__pyx_filename = NULL;
3045 int __pyx_clineno = 0;
3046 __Pyx_RefNannySetupContext("_buildTag", 0);
3050 * def _buildTag(self, ns_name_tuple):
3051 * ns_uri, local_name = ns_name_tuple # <<<<<<<<<<<<<<
3053 * el_tag = "{%s}%s" % ns_name_tuple
3055 if ((likely(PyTuple_CheckExact(__pyx_v_ns_name_tuple))) || (PyList_CheckExact(__pyx_v_ns_name_tuple))) {
3056 PyObject* sequence = __pyx_v_ns_name_tuple;
3057 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3058 if (unlikely(size != 2)) {
3059 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3060 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3061 __PYX_ERR(0, 81, __pyx_L1_error)
3063 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3064 if (likely(PyTuple_CheckExact(sequence))) {
3065 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
3066 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
3068 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3069 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3071 __Pyx_INCREF(__pyx_t_1);
3072 __Pyx_INCREF(__pyx_t_2);
3074 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
3075 __Pyx_GOTREF(__pyx_t_1);
3076 __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
3077 __Pyx_GOTREF(__pyx_t_2);
3080 Py_ssize_t index = -1;
3081 __pyx_t_3 = PyObject_GetIter(__pyx_v_ns_name_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
3082 __Pyx_GOTREF(__pyx_t_3);
3083 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
3084 index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
3085 __Pyx_GOTREF(__pyx_t_1);
3086 index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
3087 __Pyx_GOTREF(__pyx_t_2);
3088 if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
3090 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3091 goto __pyx_L4_unpacking_done;
3092 __pyx_L3_unpacking_failed:;
3093 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3095 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3096 __PYX_ERR(0, 81, __pyx_L1_error)
3097 __pyx_L4_unpacking_done:;
3099 __pyx_v_ns_uri = __pyx_t_1;
3101 __pyx_v_local_name = __pyx_t_2;
3105 * def _buildTag(self, ns_name_tuple):
3106 * ns_uri, local_name = ns_name_tuple
3107 * if ns_uri: # <<<<<<<<<<<<<<
3108 * el_tag = "{%s}%s" % ns_name_tuple
3109 * elif self._default_ns:
3111 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ns_uri); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
3115 * ns_uri, local_name = ns_name_tuple
3117 * el_tag = "{%s}%s" % ns_name_tuple # <<<<<<<<<<<<<<
3118 * elif self._default_ns:
3119 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3121 __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)
3122 __Pyx_GOTREF(__pyx_t_2);
3123 __pyx_v_el_tag = __pyx_t_2;
3127 * def _buildTag(self, ns_name_tuple):
3128 * ns_uri, local_name = ns_name_tuple
3129 * if ns_uri: # <<<<<<<<<<<<<<
3130 * el_tag = "{%s}%s" % ns_name_tuple
3131 * elif self._default_ns:
3138 * el_tag = "{%s}%s" % ns_name_tuple
3139 * elif self._default_ns: # <<<<<<<<<<<<<<
3140 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3143 __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)
3144 __Pyx_GOTREF(__pyx_t_2);
3145 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
3146 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3150 * el_tag = "{%s}%s" % ns_name_tuple
3151 * elif self._default_ns:
3152 * el_tag = "{%s}%s" % (self._default_ns, local_name) # <<<<<<<<<<<<<<
3154 * el_tag = local_name
3156 __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)
3157 __Pyx_GOTREF(__pyx_t_2);
3158 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
3159 __Pyx_GOTREF(__pyx_t_1);
3160 __Pyx_GIVEREF(__pyx_t_2);
3161 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3162 __Pyx_INCREF(__pyx_v_local_name);
3163 __Pyx_GIVEREF(__pyx_v_local_name);
3164 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
3166 __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)
3167 __Pyx_GOTREF(__pyx_t_2);
3168 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3169 __pyx_v_el_tag = __pyx_t_2;
3174 * el_tag = "{%s}%s" % ns_name_tuple
3175 * elif self._default_ns: # <<<<<<<<<<<<<<
3176 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3183 * el_tag = "{%s}%s" % (self._default_ns, local_name)
3185 * el_tag = local_name # <<<<<<<<<<<<<<
3190 __Pyx_INCREF(__pyx_v_local_name);
3191 __pyx_v_el_tag = __pyx_v_local_name;
3197 * el_tag = local_name
3198 * return el_tag # <<<<<<<<<<<<<<
3200 * def startElementNS(self, ns_name, qname, attributes=None):
3202 __Pyx_XDECREF(__pyx_r);
3203 __Pyx_INCREF(__pyx_v_el_tag);
3204 __pyx_r = __pyx_v_el_tag;
3208 * self._default_ns = ns_uri_list[-1]
3210 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
3211 * ns_uri, local_name = ns_name_tuple
3215 /* function exit code */
3217 __Pyx_XDECREF(__pyx_t_1);
3218 __Pyx_XDECREF(__pyx_t_2);
3219 __Pyx_XDECREF(__pyx_t_3);
3220 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler._buildTag", __pyx_clineno, __pyx_lineno, __pyx_filename);
3223 __Pyx_XDECREF(__pyx_v_ns_uri);
3224 __Pyx_XDECREF(__pyx_v_local_name);
3225 __Pyx_XDECREF(__pyx_v_el_tag);
3226 __Pyx_XGIVEREF(__pyx_r);
3227 __Pyx_RefNannyFinishContext();
3234 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
3235 * el_name = self._buildTag(ns_name)
3239 /* Python wrapper */
3240 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3241 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_17startElementNS = {"startElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS, METH_VARARGS|METH_KEYWORDS, 0};
3242 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_17startElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3243 PyObject *__pyx_v_self = 0;
3244 PyObject *__pyx_v_ns_name = 0;
3245 CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
3246 PyObject *__pyx_v_attributes = 0;
3247 int __pyx_lineno = 0;
3248 const char *__pyx_filename = NULL;
3249 int __pyx_clineno = 0;
3250 PyObject *__pyx_r = 0;
3251 __Pyx_RefNannyDeclarations
3252 __Pyx_RefNannySetupContext("startElementNS (wrapper)", 0);
3254 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,&__pyx_n_s_attributes,0};
3255 PyObject* values[4] = {0,0,0,0};
3256 values[3] = ((PyObject *)((PyObject *)Py_None));
3257 if (unlikely(__pyx_kwds)) {
3259 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3261 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3263 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3265 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3267 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3270 default: goto __pyx_L5_argtuple_error;
3272 kw_args = PyDict_Size(__pyx_kwds);
3275 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3276 else goto __pyx_L5_argtuple_error;
3279 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
3281 __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 1); __PYX_ERR(0, 90, __pyx_L3_error)
3285 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
3287 __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, 2); __PYX_ERR(0, 90, __pyx_L3_error)
3292 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
3293 if (value) { values[3] = value; kw_args--; }
3296 if (unlikely(kw_args > 0)) {
3297 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElementNS") < 0)) __PYX_ERR(0, 90, __pyx_L3_error)
3300 switch (PyTuple_GET_SIZE(__pyx_args)) {
3301 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3303 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3304 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3305 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3307 default: goto __pyx_L5_argtuple_error;
3310 __pyx_v_self = values[0];
3311 __pyx_v_ns_name = values[1];
3312 __pyx_v_qname = values[2];
3313 __pyx_v_attributes = values[3];
3315 goto __pyx_L4_argument_unpacking_done;
3316 __pyx_L5_argtuple_error:;
3317 __Pyx_RaiseArgtupleInvalid("startElementNS", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error)
3319 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3320 __Pyx_RefNannyFinishContext();
3322 __pyx_L4_argument_unpacking_done:;
3323 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_16startElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname, __pyx_v_attributes);
3325 /* function exit code */
3326 __Pyx_RefNannyFinishContext();
3330 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) {
3331 PyObject *__pyx_v_el_name = NULL;
3332 PyObject *__pyx_v_attrs = NULL;
3333 PyObject *__pyx_v_iter_attributes = NULL;
3334 PyObject *__pyx_v_name_tuple = NULL;
3335 PyObject *__pyx_v_value = NULL;
3336 PyObject *__pyx_v_attr_name = NULL;
3337 PyObject *__pyx_v_element_stack = NULL;
3338 PyObject *__pyx_v_element = NULL;
3339 PyObject *__pyx_v_sibling = NULL;
3340 PyObject *__pyx_r = NULL;
3341 __Pyx_RefNannyDeclarations
3342 PyObject *__pyx_t_1 = NULL;
3343 PyObject *__pyx_t_2 = NULL;
3344 PyObject *__pyx_t_3 = NULL;
3346 PyObject *__pyx_t_5 = NULL;
3347 PyObject *__pyx_t_6 = NULL;
3348 PyObject *__pyx_t_7 = NULL;
3350 PyObject *__pyx_t_9 = NULL;
3351 PyObject *__pyx_t_10 = NULL;
3352 PyObject *__pyx_t_11 = NULL;
3353 Py_ssize_t __pyx_t_12;
3354 PyObject *(*__pyx_t_13)(PyObject *);
3355 PyObject *(*__pyx_t_14)(PyObject *);
3359 int __pyx_lineno = 0;
3360 const char *__pyx_filename = NULL;
3361 int __pyx_clineno = 0;
3362 __Pyx_RefNannySetupContext("startElementNS", 0);
3366 * def startElementNS(self, ns_name, qname, attributes=None):
3367 * el_name = self._buildTag(ns_name) # <<<<<<<<<<<<<<
3371 __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)
3372 __Pyx_GOTREF(__pyx_t_2);
3374 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3375 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3376 if (likely(__pyx_t_3)) {
3377 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3378 __Pyx_INCREF(__pyx_t_3);
3379 __Pyx_INCREF(function);
3380 __Pyx_DECREF_SET(__pyx_t_2, function);
3383 __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);
3384 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3385 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
3386 __Pyx_GOTREF(__pyx_t_1);
3387 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3388 __pyx_v_el_name = __pyx_t_1;
3392 * def startElementNS(self, ns_name, qname, attributes=None):
3393 * el_name = self._buildTag(ns_name)
3394 * if attributes: # <<<<<<<<<<<<<<
3398 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 92, __pyx_L1_error)
3402 * el_name = self._buildTag(ns_name)
3404 * attrs = {} # <<<<<<<<<<<<<<
3406 * iter_attributes = attributes.iteritems()
3408 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
3409 __Pyx_GOTREF(__pyx_t_1);
3410 __pyx_v_attrs = ((PyObject*)__pyx_t_1);
3416 * try: # <<<<<<<<<<<<<<
3417 * iter_attributes = attributes.iteritems()
3418 * except AttributeError:
3421 __Pyx_PyThreadState_declare
3422 __Pyx_PyThreadState_assign
3423 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
3424 __Pyx_XGOTREF(__pyx_t_5);
3425 __Pyx_XGOTREF(__pyx_t_6);
3426 __Pyx_XGOTREF(__pyx_t_7);
3432 * iter_attributes = attributes.iteritems() # <<<<<<<<<<<<<<
3433 * except AttributeError:
3434 * iter_attributes = attributes.items()
3436 __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)
3437 __Pyx_GOTREF(__pyx_t_2);
3439 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3440 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3441 if (likely(__pyx_t_3)) {
3442 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3443 __Pyx_INCREF(__pyx_t_3);
3444 __Pyx_INCREF(function);
3445 __Pyx_DECREF_SET(__pyx_t_2, function);
3448 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3449 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3450 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L4_error)
3451 __Pyx_GOTREF(__pyx_t_1);
3452 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3453 __pyx_v_iter_attributes = __pyx_t_1;
3459 * try: # <<<<<<<<<<<<<<
3460 * iter_attributes = attributes.iteritems()
3461 * except AttributeError:
3464 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3465 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3466 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3467 goto __pyx_L9_try_end;
3469 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3470 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3471 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3475 * iter_attributes = attributes.iteritems()
3476 * except AttributeError: # <<<<<<<<<<<<<<
3477 * iter_attributes = attributes.items()
3480 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
3482 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
3483 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 96, __pyx_L6_except_error)
3484 __Pyx_GOTREF(__pyx_t_1);
3485 __Pyx_GOTREF(__pyx_t_2);
3486 __Pyx_GOTREF(__pyx_t_3);
3489 * iter_attributes = attributes.iteritems()
3490 * except AttributeError:
3491 * iter_attributes = attributes.items() # <<<<<<<<<<<<<<
3493 * for name_tuple, value in iter_attributes:
3495 __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)
3496 __Pyx_GOTREF(__pyx_t_10);
3498 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3499 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
3500 if (likely(__pyx_t_11)) {
3501 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3502 __Pyx_INCREF(__pyx_t_11);
3503 __Pyx_INCREF(function);
3504 __Pyx_DECREF_SET(__pyx_t_10, function);
3507 __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
3508 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3509 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L6_except_error)
3510 __Pyx_GOTREF(__pyx_t_9);
3511 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3512 __Pyx_XDECREF_SET(__pyx_v_iter_attributes, __pyx_t_9);
3514 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3515 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3516 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3517 goto __pyx_L5_exception_handled;
3519 goto __pyx_L6_except_error;
3520 __pyx_L6_except_error:;
3525 * try: # <<<<<<<<<<<<<<
3526 * iter_attributes = attributes.iteritems()
3527 * except AttributeError:
3529 __Pyx_XGIVEREF(__pyx_t_5);
3530 __Pyx_XGIVEREF(__pyx_t_6);
3531 __Pyx_XGIVEREF(__pyx_t_7);
3532 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3533 goto __pyx_L1_error;
3534 __pyx_L5_exception_handled:;
3535 __Pyx_XGIVEREF(__pyx_t_5);
3536 __Pyx_XGIVEREF(__pyx_t_6);
3537 __Pyx_XGIVEREF(__pyx_t_7);
3538 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
3543 * iter_attributes = attributes.items()
3545 * for name_tuple, value in iter_attributes: # <<<<<<<<<<<<<<
3547 * attr_name = "{%s}%s" % name_tuple
3549 if (likely(PyList_CheckExact(__pyx_v_iter_attributes)) || PyTuple_CheckExact(__pyx_v_iter_attributes)) {
3550 __pyx_t_3 = __pyx_v_iter_attributes; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
3553 __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)
3554 __Pyx_GOTREF(__pyx_t_3);
3555 __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 99, __pyx_L1_error)
3558 if (likely(!__pyx_t_13)) {
3559 if (likely(PyList_CheckExact(__pyx_t_3))) {
3560 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
3561 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3562 __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)
3564 __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)
3565 __Pyx_GOTREF(__pyx_t_2);
3568 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3569 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3570 __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)
3572 __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)
3573 __Pyx_GOTREF(__pyx_t_2);
3577 __pyx_t_2 = __pyx_t_13(__pyx_t_3);
3578 if (unlikely(!__pyx_t_2)) {
3579 PyObject* exc_type = PyErr_Occurred();
3581 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3582 else __PYX_ERR(0, 99, __pyx_L1_error)
3586 __Pyx_GOTREF(__pyx_t_2);
3588 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3589 PyObject* sequence = __pyx_t_2;
3590 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3591 if (unlikely(size != 2)) {
3592 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3593 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3594 __PYX_ERR(0, 99, __pyx_L1_error)
3596 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3597 if (likely(PyTuple_CheckExact(sequence))) {
3598 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
3599 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
3601 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3602 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
3604 __Pyx_INCREF(__pyx_t_1);
3605 __Pyx_INCREF(__pyx_t_9);
3607 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
3608 __Pyx_GOTREF(__pyx_t_1);
3609 __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error)
3610 __Pyx_GOTREF(__pyx_t_9);
3612 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3614 Py_ssize_t index = -1;
3615 __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 99, __pyx_L1_error)
3616 __Pyx_GOTREF(__pyx_t_10);
3617 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3618 __pyx_t_14 = Py_TYPE(__pyx_t_10)->tp_iternext;
3619 index = 0; __pyx_t_1 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L14_unpacking_failed;
3620 __Pyx_GOTREF(__pyx_t_1);
3621 index = 1; __pyx_t_9 = __pyx_t_14(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
3622 __Pyx_GOTREF(__pyx_t_9);
3623 if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_10), 2) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
3625 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3626 goto __pyx_L15_unpacking_done;
3627 __pyx_L14_unpacking_failed:;
3628 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3630 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3631 __PYX_ERR(0, 99, __pyx_L1_error)
3632 __pyx_L15_unpacking_done:;
3634 __Pyx_XDECREF_SET(__pyx_v_name_tuple, __pyx_t_1);
3636 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9);
3639 /* "lxml/sax.py":100
3641 * for name_tuple, value in iter_attributes:
3642 * if name_tuple[0]: # <<<<<<<<<<<<<<
3643 * attr_name = "{%s}%s" % name_tuple
3646 __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)
3647 __Pyx_GOTREF(__pyx_t_2);
3648 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
3649 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3652 /* "lxml/sax.py":101
3653 * for name_tuple, value in iter_attributes:
3655 * attr_name = "{%s}%s" % name_tuple # <<<<<<<<<<<<<<
3657 * attr_name = name_tuple[1]
3659 __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)
3660 __Pyx_GOTREF(__pyx_t_2);
3661 __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3664 /* "lxml/sax.py":100
3666 * for name_tuple, value in iter_attributes:
3667 * if name_tuple[0]: # <<<<<<<<<<<<<<
3668 * attr_name = "{%s}%s" % name_tuple
3674 /* "lxml/sax.py":103
3675 * attr_name = "{%s}%s" % name_tuple
3677 * attr_name = name_tuple[1] # <<<<<<<<<<<<<<
3678 * attrs[attr_name] = value
3682 __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)
3683 __Pyx_GOTREF(__pyx_t_2);
3684 __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
3689 /* "lxml/sax.py":104
3691 * attr_name = name_tuple[1]
3692 * attrs[attr_name] = value # <<<<<<<<<<<<<<
3696 if (unlikely(PyDict_SetItem(__pyx_v_attrs, __pyx_v_attr_name, __pyx_v_value) < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
3699 * iter_attributes = attributes.items()
3701 * for name_tuple, value in iter_attributes: # <<<<<<<<<<<<<<
3703 * attr_name = "{%s}%s" % name_tuple
3706 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3709 * def startElementNS(self, ns_name, qname, attributes=None):
3710 * el_name = self._buildTag(ns_name)
3711 * if attributes: # <<<<<<<<<<<<<<
3718 /* "lxml/sax.py":106
3719 * attrs[attr_name] = value
3721 * attrs = None # <<<<<<<<<<<<<<
3723 * element_stack = self._element_stack
3726 __Pyx_INCREF(Py_None);
3727 __pyx_v_attrs = ((PyObject*)Py_None);
3731 /* "lxml/sax.py":108
3734 * element_stack = self._element_stack # <<<<<<<<<<<<<<
3735 * if self._root is None:
3736 * element = self._root = \
3738 __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)
3739 __Pyx_GOTREF(__pyx_t_3);
3740 __pyx_v_element_stack = __pyx_t_3;
3743 /* "lxml/sax.py":109
3745 * element_stack = self._element_stack
3746 * if self._root is None: # <<<<<<<<<<<<<<
3747 * element = self._root = \
3748 * self._makeelement(el_name, attrs, self._new_mappings)
3750 __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)
3751 __Pyx_GOTREF(__pyx_t_3);
3752 __pyx_t_4 = (__pyx_t_3 == Py_None);
3753 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3754 __pyx_t_15 = (__pyx_t_4 != 0);
3757 /* "lxml/sax.py":111
3758 * if self._root is None:
3759 * element = self._root = \
3760 * self._makeelement(el_name, attrs, self._new_mappings) # <<<<<<<<<<<<<<
3761 * if self._root_siblings and hasattr(element, 'addprevious'):
3762 * for sibling in self._root_siblings:
3764 __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)
3765 __Pyx_GOTREF(__pyx_t_2);
3766 __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)
3767 __Pyx_GOTREF(__pyx_t_9);
3770 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3771 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3772 if (likely(__pyx_t_1)) {
3773 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3774 __Pyx_INCREF(__pyx_t_1);
3775 __Pyx_INCREF(function);
3776 __Pyx_DECREF_SET(__pyx_t_2, function);
3780 #if CYTHON_FAST_PYCALL
3781 if (PyFunction_Check(__pyx_t_2)) {
3782 PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3783 __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)
3784 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3785 __Pyx_GOTREF(__pyx_t_3);
3786 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3789 #if CYTHON_FAST_PYCCALL
3790 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3791 PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
3792 __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)
3793 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3794 __Pyx_GOTREF(__pyx_t_3);
3795 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3799 __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 111, __pyx_L1_error)
3800 __Pyx_GOTREF(__pyx_t_10);
3802 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __pyx_t_1 = NULL;
3804 __Pyx_INCREF(__pyx_v_el_name);
3805 __Pyx_GIVEREF(__pyx_v_el_name);
3806 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_el_name);
3807 __Pyx_INCREF(__pyx_v_attrs);
3808 __Pyx_GIVEREF(__pyx_v_attrs);
3809 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_attrs);
3810 __Pyx_GIVEREF(__pyx_t_9);
3811 PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_9);
3813 __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)
3814 __Pyx_GOTREF(__pyx_t_3);
3815 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3817 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3818 __Pyx_INCREF(__pyx_t_3);
3819 __pyx_v_element = __pyx_t_3;
3821 /* "lxml/sax.py":110
3822 * element_stack = self._element_stack
3823 * if self._root is None:
3824 * element = self._root = \ # <<<<<<<<<<<<<<
3825 * self._makeelement(el_name, attrs, self._new_mappings)
3826 * if self._root_siblings and hasattr(element, 'addprevious'):
3828 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_root, __pyx_t_3) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
3829 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3831 /* "lxml/sax.py":112
3832 * element = self._root = \
3833 * self._makeelement(el_name, attrs, self._new_mappings)
3834 * if self._root_siblings and hasattr(element, 'addprevious'): # <<<<<<<<<<<<<<
3835 * for sibling in self._root_siblings:
3836 * element.addprevious(sibling)
3838 __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)
3839 __Pyx_GOTREF(__pyx_t_3);
3840 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
3841 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3844 __pyx_t_15 = __pyx_t_4;
3845 goto __pyx_L19_bool_binop_done;
3847 __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)
3848 __pyx_t_16 = (__pyx_t_4 != 0);
3849 __pyx_t_15 = __pyx_t_16;
3850 __pyx_L19_bool_binop_done:;
3853 /* "lxml/sax.py":113
3854 * self._makeelement(el_name, attrs, self._new_mappings)
3855 * if self._root_siblings and hasattr(element, 'addprevious'):
3856 * for sibling in self._root_siblings: # <<<<<<<<<<<<<<
3857 * element.addprevious(sibling)
3858 * del self._root_siblings[:]
3860 __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)
3861 __Pyx_GOTREF(__pyx_t_3);
3862 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
3863 __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
3866 __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
3867 __Pyx_GOTREF(__pyx_t_2);
3868 __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 113, __pyx_L1_error)
3870 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3872 if (likely(!__pyx_t_13)) {
3873 if (likely(PyList_CheckExact(__pyx_t_2))) {
3874 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
3875 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3876 __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)
3878 __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)
3879 __Pyx_GOTREF(__pyx_t_3);
3882 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3883 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3884 __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)
3886 __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)
3887 __Pyx_GOTREF(__pyx_t_3);
3891 __pyx_t_3 = __pyx_t_13(__pyx_t_2);
3892 if (unlikely(!__pyx_t_3)) {
3893 PyObject* exc_type = PyErr_Occurred();
3895 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3896 else __PYX_ERR(0, 113, __pyx_L1_error)
3900 __Pyx_GOTREF(__pyx_t_3);
3902 __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
3905 /* "lxml/sax.py":114
3906 * if self._root_siblings and hasattr(element, 'addprevious'):
3907 * for sibling in self._root_siblings:
3908 * element.addprevious(sibling) # <<<<<<<<<<<<<<
3909 * del self._root_siblings[:]
3912 __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)
3913 __Pyx_GOTREF(__pyx_t_10);
3915 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
3916 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
3917 if (likely(__pyx_t_9)) {
3918 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3919 __Pyx_INCREF(__pyx_t_9);
3920 __Pyx_INCREF(function);
3921 __Pyx_DECREF_SET(__pyx_t_10, function);
3924 __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);
3925 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3926 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
3927 __Pyx_GOTREF(__pyx_t_3);
3928 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3929 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3931 /* "lxml/sax.py":113
3932 * self._makeelement(el_name, attrs, self._new_mappings)
3933 * if self._root_siblings and hasattr(element, 'addprevious'):
3934 * for sibling in self._root_siblings: # <<<<<<<<<<<<<<
3935 * element.addprevious(sibling)
3936 * del self._root_siblings[:]
3939 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3941 /* "lxml/sax.py":112
3942 * element = self._root = \
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)
3950 /* "lxml/sax.py":115
3951 * for sibling in self._root_siblings:
3952 * element.addprevious(sibling)
3953 * del self._root_siblings[:] # <<<<<<<<<<<<<<
3955 * element = SubElement(element_stack[-1], el_name,
3957 __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)
3958 __Pyx_GOTREF(__pyx_t_2);
3959 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)
3960 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3962 /* "lxml/sax.py":109
3964 * element_stack = self._element_stack
3965 * if self._root is None: # <<<<<<<<<<<<<<
3966 * element = self._root = \
3967 * self._makeelement(el_name, attrs, self._new_mappings)
3972 /* "lxml/sax.py":117
3973 * del self._root_siblings[:]
3975 * element = SubElement(element_stack[-1], el_name, # <<<<<<<<<<<<<<
3976 * attrs, self._new_mappings)
3977 * element_stack.append(element)
3980 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
3981 __Pyx_GOTREF(__pyx_t_3);
3982 __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)
3983 __Pyx_GOTREF(__pyx_t_10);
3985 /* "lxml/sax.py":118
3987 * element = SubElement(element_stack[-1], el_name,
3988 * attrs, self._new_mappings) # <<<<<<<<<<<<<<
3989 * element_stack.append(element)
3992 __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)
3993 __Pyx_GOTREF(__pyx_t_9);
3996 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3997 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
3998 if (likely(__pyx_t_1)) {
3999 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4000 __Pyx_INCREF(__pyx_t_1);
4001 __Pyx_INCREF(function);
4002 __Pyx_DECREF_SET(__pyx_t_3, function);
4006 #if CYTHON_FAST_PYCALL
4007 if (PyFunction_Check(__pyx_t_3)) {
4008 PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4009 __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)
4010 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4011 __Pyx_GOTREF(__pyx_t_2);
4012 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4013 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4016 #if CYTHON_FAST_PYCCALL
4017 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
4018 PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_t_10, __pyx_v_el_name, __pyx_v_attrs, __pyx_t_9};
4019 __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)
4020 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4021 __Pyx_GOTREF(__pyx_t_2);
4022 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4023 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4027 __pyx_t_11 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L1_error)
4028 __Pyx_GOTREF(__pyx_t_11);
4030 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
4032 __Pyx_GIVEREF(__pyx_t_10);
4033 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_t_10);
4034 __Pyx_INCREF(__pyx_v_el_name);
4035 __Pyx_GIVEREF(__pyx_v_el_name);
4036 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_v_el_name);
4037 __Pyx_INCREF(__pyx_v_attrs);
4038 __Pyx_GIVEREF(__pyx_v_attrs);
4039 PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_v_attrs);
4040 __Pyx_GIVEREF(__pyx_t_9);
4041 PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_8, __pyx_t_9);
4044 __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)
4045 __Pyx_GOTREF(__pyx_t_2);
4046 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4048 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4049 __pyx_v_element = __pyx_t_2;
4054 /* "lxml/sax.py":119
4055 * element = SubElement(element_stack[-1], el_name,
4056 * attrs, self._new_mappings)
4057 * element_stack.append(element) # <<<<<<<<<<<<<<
4059 * self._new_mappings.clear()
4061 __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)
4063 /* "lxml/sax.py":121
4064 * element_stack.append(element)
4066 * self._new_mappings.clear() # <<<<<<<<<<<<<<
4068 * def processingInstruction(self, target, data):
4070 __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)
4071 __Pyx_GOTREF(__pyx_t_3);
4072 __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)
4073 __Pyx_GOTREF(__pyx_t_11);
4074 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4076 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
4077 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
4078 if (likely(__pyx_t_3)) {
4079 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
4080 __Pyx_INCREF(__pyx_t_3);
4081 __Pyx_INCREF(function);
4082 __Pyx_DECREF_SET(__pyx_t_11, function);
4085 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
4086 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4087 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
4088 __Pyx_GOTREF(__pyx_t_2);
4089 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4090 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4095 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
4096 * el_name = self._buildTag(ns_name)
4100 /* function exit code */
4101 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4104 __Pyx_XDECREF(__pyx_t_1);
4105 __Pyx_XDECREF(__pyx_t_2);
4106 __Pyx_XDECREF(__pyx_t_3);
4107 __Pyx_XDECREF(__pyx_t_9);
4108 __Pyx_XDECREF(__pyx_t_10);
4109 __Pyx_XDECREF(__pyx_t_11);
4110 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4113 __Pyx_XDECREF(__pyx_v_el_name);
4114 __Pyx_XDECREF(__pyx_v_attrs);
4115 __Pyx_XDECREF(__pyx_v_iter_attributes);
4116 __Pyx_XDECREF(__pyx_v_name_tuple);
4117 __Pyx_XDECREF(__pyx_v_value);
4118 __Pyx_XDECREF(__pyx_v_attr_name);
4119 __Pyx_XDECREF(__pyx_v_element_stack);
4120 __Pyx_XDECREF(__pyx_v_element);
4121 __Pyx_XDECREF(__pyx_v_sibling);
4122 __Pyx_XGIVEREF(__pyx_r);
4123 __Pyx_RefNannyFinishContext();
4127 /* "lxml/sax.py":123
4128 * self._new_mappings.clear()
4130 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
4131 * pi = ProcessingInstruction(target, data)
4132 * if self._root is None:
4135 /* Python wrapper */
4136 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4137 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction = {"processingInstruction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction, METH_VARARGS|METH_KEYWORDS, 0};
4138 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_19processingInstruction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4139 PyObject *__pyx_v_self = 0;
4140 PyObject *__pyx_v_target = 0;
4141 PyObject *__pyx_v_data = 0;
4142 int __pyx_lineno = 0;
4143 const char *__pyx_filename = NULL;
4144 int __pyx_clineno = 0;
4145 PyObject *__pyx_r = 0;
4146 __Pyx_RefNannyDeclarations
4147 __Pyx_RefNannySetupContext("processingInstruction (wrapper)", 0);
4149 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_target,&__pyx_n_s_data,0};
4150 PyObject* values[3] = {0,0,0};
4151 if (unlikely(__pyx_kwds)) {
4153 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4155 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4157 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4159 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4162 default: goto __pyx_L5_argtuple_error;
4164 kw_args = PyDict_Size(__pyx_kwds);
4167 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4168 else goto __pyx_L5_argtuple_error;
4171 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
4173 __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 1); __PYX_ERR(0, 123, __pyx_L3_error)
4177 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4179 __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, 2); __PYX_ERR(0, 123, __pyx_L3_error)
4182 if (unlikely(kw_args > 0)) {
4183 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "processingInstruction") < 0)) __PYX_ERR(0, 123, __pyx_L3_error)
4185 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4186 goto __pyx_L5_argtuple_error;
4188 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4189 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4190 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4192 __pyx_v_self = values[0];
4193 __pyx_v_target = values[1];
4194 __pyx_v_data = values[2];
4196 goto __pyx_L4_argument_unpacking_done;
4197 __pyx_L5_argtuple_error:;
4198 __Pyx_RaiseArgtupleInvalid("processingInstruction", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 123, __pyx_L3_error)
4200 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4201 __Pyx_RefNannyFinishContext();
4203 __pyx_L4_argument_unpacking_done:;
4204 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_18processingInstruction(__pyx_self, __pyx_v_self, __pyx_v_target, __pyx_v_data);
4206 /* function exit code */
4207 __Pyx_RefNannyFinishContext();
4211 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) {
4212 PyObject *__pyx_v_pi = NULL;
4213 PyObject *__pyx_r = NULL;
4214 __Pyx_RefNannyDeclarations
4215 PyObject *__pyx_t_1 = NULL;
4216 PyObject *__pyx_t_2 = NULL;
4217 PyObject *__pyx_t_3 = NULL;
4219 PyObject *__pyx_t_5 = NULL;
4223 int __pyx_lineno = 0;
4224 const char *__pyx_filename = NULL;
4225 int __pyx_clineno = 0;
4226 __Pyx_RefNannySetupContext("processingInstruction", 0);
4228 /* "lxml/sax.py":124
4230 * def processingInstruction(self, target, data):
4231 * pi = ProcessingInstruction(target, data) # <<<<<<<<<<<<<<
4232 * if self._root is None:
4233 * self._root_siblings.append(pi)
4235 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
4236 __Pyx_GOTREF(__pyx_t_2);
4239 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4240 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4241 if (likely(__pyx_t_3)) {
4242 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4243 __Pyx_INCREF(__pyx_t_3);
4244 __Pyx_INCREF(function);
4245 __Pyx_DECREF_SET(__pyx_t_2, function);
4249 #if CYTHON_FAST_PYCALL
4250 if (PyFunction_Check(__pyx_t_2)) {
4251 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4252 __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)
4253 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4254 __Pyx_GOTREF(__pyx_t_1);
4257 #if CYTHON_FAST_PYCCALL
4258 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4259 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_target, __pyx_v_data};
4260 __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)
4261 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4262 __Pyx_GOTREF(__pyx_t_1);
4266 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
4267 __Pyx_GOTREF(__pyx_t_5);
4269 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4271 __Pyx_INCREF(__pyx_v_target);
4272 __Pyx_GIVEREF(__pyx_v_target);
4273 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_target);
4274 __Pyx_INCREF(__pyx_v_data);
4275 __Pyx_GIVEREF(__pyx_v_data);
4276 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_data);
4277 __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)
4278 __Pyx_GOTREF(__pyx_t_1);
4279 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4281 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4282 __pyx_v_pi = __pyx_t_1;
4285 /* "lxml/sax.py":125
4286 * def processingInstruction(self, target, data):
4287 * pi = ProcessingInstruction(target, data)
4288 * if self._root is None: # <<<<<<<<<<<<<<
4289 * self._root_siblings.append(pi)
4292 __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)
4293 __Pyx_GOTREF(__pyx_t_1);
4294 __pyx_t_6 = (__pyx_t_1 == Py_None);
4295 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4296 __pyx_t_7 = (__pyx_t_6 != 0);
4299 /* "lxml/sax.py":126
4300 * pi = ProcessingInstruction(target, data)
4301 * if self._root is None:
4302 * self._root_siblings.append(pi) # <<<<<<<<<<<<<<
4304 * self._element_stack[-1].append(pi)
4306 __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)
4307 __Pyx_GOTREF(__pyx_t_1);
4308 __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)
4309 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4311 /* "lxml/sax.py":125
4312 * def processingInstruction(self, target, data):
4313 * pi = ProcessingInstruction(target, data)
4314 * if self._root is None: # <<<<<<<<<<<<<<
4315 * self._root_siblings.append(pi)
4321 /* "lxml/sax.py":128
4322 * self._root_siblings.append(pi)
4324 * self._element_stack[-1].append(pi) # <<<<<<<<<<<<<<
4326 * def endElementNS(self, ns_name, qname):
4329 __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)
4330 __Pyx_GOTREF(__pyx_t_1);
4331 __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)
4332 __Pyx_GOTREF(__pyx_t_2);
4333 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4334 __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)
4335 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4339 /* "lxml/sax.py":123
4340 * self._new_mappings.clear()
4342 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
4343 * pi = ProcessingInstruction(target, data)
4344 * if self._root is None:
4347 /* function exit code */
4348 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4351 __Pyx_XDECREF(__pyx_t_1);
4352 __Pyx_XDECREF(__pyx_t_2);
4353 __Pyx_XDECREF(__pyx_t_3);
4354 __Pyx_XDECREF(__pyx_t_5);
4355 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.processingInstruction", __pyx_clineno, __pyx_lineno, __pyx_filename);
4358 __Pyx_XDECREF(__pyx_v_pi);
4359 __Pyx_XGIVEREF(__pyx_r);
4360 __Pyx_RefNannyFinishContext();
4364 /* "lxml/sax.py":130
4365 * self._element_stack[-1].append(pi)
4367 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
4368 * element = self._element_stack.pop()
4369 * el_tag = self._buildTag(ns_name)
4372 /* Python wrapper */
4373 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4374 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_21endElementNS = {"endElementNS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS, METH_VARARGS|METH_KEYWORDS, 0};
4375 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_21endElementNS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4376 PyObject *__pyx_v_self = 0;
4377 PyObject *__pyx_v_ns_name = 0;
4378 CYTHON_UNUSED PyObject *__pyx_v_qname = 0;
4379 int __pyx_lineno = 0;
4380 const char *__pyx_filename = NULL;
4381 int __pyx_clineno = 0;
4382 PyObject *__pyx_r = 0;
4383 __Pyx_RefNannyDeclarations
4384 __Pyx_RefNannySetupContext("endElementNS (wrapper)", 0);
4386 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_ns_name,&__pyx_n_s_qname,0};
4387 PyObject* values[3] = {0,0,0};
4388 if (unlikely(__pyx_kwds)) {
4390 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4392 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4394 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4396 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4399 default: goto __pyx_L5_argtuple_error;
4401 kw_args = PyDict_Size(__pyx_kwds);
4404 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4405 else goto __pyx_L5_argtuple_error;
4408 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_name)) != 0)) kw_args--;
4410 __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 1); __PYX_ERR(0, 130, __pyx_L3_error)
4414 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qname)) != 0)) kw_args--;
4416 __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, 2); __PYX_ERR(0, 130, __pyx_L3_error)
4419 if (unlikely(kw_args > 0)) {
4420 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElementNS") < 0)) __PYX_ERR(0, 130, __pyx_L3_error)
4422 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4423 goto __pyx_L5_argtuple_error;
4425 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4426 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4427 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4429 __pyx_v_self = values[0];
4430 __pyx_v_ns_name = values[1];
4431 __pyx_v_qname = values[2];
4433 goto __pyx_L4_argument_unpacking_done;
4434 __pyx_L5_argtuple_error:;
4435 __Pyx_RaiseArgtupleInvalid("endElementNS", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 130, __pyx_L3_error)
4437 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4438 __Pyx_RefNannyFinishContext();
4440 __pyx_L4_argument_unpacking_done:;
4441 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_20endElementNS(__pyx_self, __pyx_v_self, __pyx_v_ns_name, __pyx_v_qname);
4443 /* function exit code */
4444 __Pyx_RefNannyFinishContext();
4448 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) {
4449 PyObject *__pyx_v_element = NULL;
4450 PyObject *__pyx_v_el_tag = NULL;
4451 PyObject *__pyx_r = NULL;
4452 __Pyx_RefNannyDeclarations
4453 PyObject *__pyx_t_1 = NULL;
4454 PyObject *__pyx_t_2 = NULL;
4455 PyObject *__pyx_t_3 = NULL;
4457 PyObject *__pyx_t_5 = NULL;
4458 int __pyx_lineno = 0;
4459 const char *__pyx_filename = NULL;
4460 int __pyx_clineno = 0;
4461 __Pyx_RefNannySetupContext("endElementNS", 0);
4463 /* "lxml/sax.py":131
4465 * def endElementNS(self, ns_name, qname):
4466 * element = self._element_stack.pop() # <<<<<<<<<<<<<<
4467 * el_tag = self._buildTag(ns_name)
4468 * if el_tag != element.tag:
4470 __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)
4471 __Pyx_GOTREF(__pyx_t_1);
4472 __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
4473 __Pyx_GOTREF(__pyx_t_2);
4474 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4475 __pyx_v_element = __pyx_t_2;
4478 /* "lxml/sax.py":132
4479 * def endElementNS(self, ns_name, qname):
4480 * element = self._element_stack.pop()
4481 * el_tag = self._buildTag(ns_name) # <<<<<<<<<<<<<<
4482 * if el_tag != element.tag:
4483 * raise SaxError("Unexpected element closed: " + el_tag)
4485 __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)
4486 __Pyx_GOTREF(__pyx_t_1);
4488 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4489 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
4490 if (likely(__pyx_t_3)) {
4491 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4492 __Pyx_INCREF(__pyx_t_3);
4493 __Pyx_INCREF(function);
4494 __Pyx_DECREF_SET(__pyx_t_1, function);
4497 __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);
4498 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4499 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
4500 __Pyx_GOTREF(__pyx_t_2);
4501 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4502 __pyx_v_el_tag = __pyx_t_2;
4505 /* "lxml/sax.py":133
4506 * element = self._element_stack.pop()
4507 * el_tag = self._buildTag(ns_name)
4508 * if el_tag != element.tag: # <<<<<<<<<<<<<<
4509 * raise SaxError("Unexpected element closed: " + el_tag)
4512 __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)
4513 __Pyx_GOTREF(__pyx_t_2);
4514 __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)
4515 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4516 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 133, __pyx_L1_error)
4517 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4518 if (unlikely(__pyx_t_4)) {
4520 /* "lxml/sax.py":134
4521 * el_tag = self._buildTag(ns_name)
4522 * if el_tag != element.tag:
4523 * raise SaxError("Unexpected element closed: " + el_tag) # <<<<<<<<<<<<<<
4525 * def startElement(self, name, attributes=None):
4527 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SaxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
4528 __Pyx_GOTREF(__pyx_t_2);
4529 __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)
4530 __Pyx_GOTREF(__pyx_t_3);
4532 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4533 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
4534 if (likely(__pyx_t_5)) {
4535 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4536 __Pyx_INCREF(__pyx_t_5);
4537 __Pyx_INCREF(function);
4538 __Pyx_DECREF_SET(__pyx_t_2, function);
4541 __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);
4542 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4543 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4544 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
4545 __Pyx_GOTREF(__pyx_t_1);
4546 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4547 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4548 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4549 __PYX_ERR(0, 134, __pyx_L1_error)
4551 /* "lxml/sax.py":133
4552 * element = self._element_stack.pop()
4553 * el_tag = self._buildTag(ns_name)
4554 * if el_tag != element.tag: # <<<<<<<<<<<<<<
4555 * raise SaxError("Unexpected element closed: " + el_tag)
4560 /* "lxml/sax.py":130
4561 * self._element_stack[-1].append(pi)
4563 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
4564 * element = self._element_stack.pop()
4565 * el_tag = self._buildTag(ns_name)
4568 /* function exit code */
4569 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4572 __Pyx_XDECREF(__pyx_t_1);
4573 __Pyx_XDECREF(__pyx_t_2);
4574 __Pyx_XDECREF(__pyx_t_3);
4575 __Pyx_XDECREF(__pyx_t_5);
4576 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElementNS", __pyx_clineno, __pyx_lineno, __pyx_filename);
4579 __Pyx_XDECREF(__pyx_v_element);
4580 __Pyx_XDECREF(__pyx_v_el_tag);
4581 __Pyx_XGIVEREF(__pyx_r);
4582 __Pyx_RefNannyFinishContext();
4586 /* "lxml/sax.py":136
4587 * raise SaxError("Unexpected element closed: " + el_tag)
4589 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
4591 * attributes = dict(
4594 /* Python wrapper */
4595 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4596 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_23startElement = {"startElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement, METH_VARARGS|METH_KEYWORDS, 0};
4597 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_23startElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4598 PyObject *__pyx_v_self = 0;
4599 PyObject *__pyx_v_name = 0;
4600 PyObject *__pyx_v_attributes = 0;
4601 int __pyx_lineno = 0;
4602 const char *__pyx_filename = NULL;
4603 int __pyx_clineno = 0;
4604 PyObject *__pyx_r = 0;
4605 __Pyx_RefNannyDeclarations
4606 __Pyx_RefNannySetupContext("startElement (wrapper)", 0);
4608 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_attributes,0};
4609 PyObject* values[3] = {0,0,0};
4610 values[2] = ((PyObject *)((PyObject *)Py_None));
4611 if (unlikely(__pyx_kwds)) {
4613 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4615 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4617 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4619 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4622 default: goto __pyx_L5_argtuple_error;
4624 kw_args = PyDict_Size(__pyx_kwds);
4627 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4628 else goto __pyx_L5_argtuple_error;
4631 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
4633 __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4638 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes);
4639 if (value) { values[2] = value; kw_args--; }
4642 if (unlikely(kw_args > 0)) {
4643 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "startElement") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
4646 switch (PyTuple_GET_SIZE(__pyx_args)) {
4647 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4649 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4650 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4652 default: goto __pyx_L5_argtuple_error;
4655 __pyx_v_self = values[0];
4656 __pyx_v_name = values[1];
4657 __pyx_v_attributes = values[2];
4659 goto __pyx_L4_argument_unpacking_done;
4660 __pyx_L5_argtuple_error:;
4661 __Pyx_RaiseArgtupleInvalid("startElement", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
4663 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4664 __Pyx_RefNannyFinishContext();
4666 __pyx_L4_argument_unpacking_done:;
4667 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_22startElement(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_attributes);
4669 /* function exit code */
4670 __Pyx_RefNannyFinishContext();
4674 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) {
4675 PyObject *__pyx_v_k = NULL;
4676 PyObject *__pyx_v_v = NULL;
4677 PyObject *__pyx_r = NULL;
4678 __Pyx_RefNannyDeclarations
4680 PyObject *__pyx_t_2 = NULL;
4681 PyObject *__pyx_t_3 = NULL;
4682 PyObject *__pyx_t_4 = NULL;
4683 PyObject *__pyx_t_5 = NULL;
4684 Py_ssize_t __pyx_t_6;
4685 PyObject *(*__pyx_t_7)(PyObject *);
4686 PyObject *__pyx_t_8 = NULL;
4687 PyObject *__pyx_t_9 = NULL;
4688 PyObject *(*__pyx_t_10)(PyObject *);
4690 int __pyx_lineno = 0;
4691 const char *__pyx_filename = NULL;
4692 int __pyx_clineno = 0;
4693 __Pyx_RefNannySetupContext("startElement", 0);
4694 __Pyx_INCREF(__pyx_v_attributes);
4696 /* "lxml/sax.py":137
4698 * def startElement(self, name, attributes=None):
4699 * if attributes: # <<<<<<<<<<<<<<
4700 * attributes = dict(
4701 * [((None, k), v) for k, v in attributes.items()]
4703 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_attributes); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 137, __pyx_L1_error)
4706 /* "lxml/sax.py":139
4708 * attributes = dict(
4709 * [((None, k), v) for k, v in attributes.items()] # <<<<<<<<<<<<<<
4711 * self.startElementNS((None, name), name, attributes)
4713 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4714 __Pyx_GOTREF(__pyx_t_2);
4715 __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)
4716 __Pyx_GOTREF(__pyx_t_4);
4718 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4719 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4720 if (likely(__pyx_t_5)) {
4721 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4722 __Pyx_INCREF(__pyx_t_5);
4723 __Pyx_INCREF(function);
4724 __Pyx_DECREF_SET(__pyx_t_4, function);
4727 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
4728 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4729 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4730 __Pyx_GOTREF(__pyx_t_3);
4731 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4732 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
4733 __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
4736 __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4737 __Pyx_GOTREF(__pyx_t_4);
4738 __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L1_error)
4740 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4742 if (likely(!__pyx_t_7)) {
4743 if (likely(PyList_CheckExact(__pyx_t_4))) {
4744 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
4745 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4746 __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)
4748 __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)
4749 __Pyx_GOTREF(__pyx_t_3);
4752 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
4753 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4754 __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)
4756 __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)
4757 __Pyx_GOTREF(__pyx_t_3);
4761 __pyx_t_3 = __pyx_t_7(__pyx_t_4);
4762 if (unlikely(!__pyx_t_3)) {
4763 PyObject* exc_type = PyErr_Occurred();
4765 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4766 else __PYX_ERR(0, 139, __pyx_L1_error)
4770 __Pyx_GOTREF(__pyx_t_3);
4772 if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
4773 PyObject* sequence = __pyx_t_3;
4774 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4775 if (unlikely(size != 2)) {
4776 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4777 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4778 __PYX_ERR(0, 139, __pyx_L1_error)
4780 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4781 if (likely(PyTuple_CheckExact(sequence))) {
4782 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
4783 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
4785 __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
4786 __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
4788 __Pyx_INCREF(__pyx_t_5);
4789 __Pyx_INCREF(__pyx_t_8);
4791 __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
4792 __Pyx_GOTREF(__pyx_t_5);
4793 __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4794 __Pyx_GOTREF(__pyx_t_8);
4796 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4798 Py_ssize_t index = -1;
4799 __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 139, __pyx_L1_error)
4800 __Pyx_GOTREF(__pyx_t_9);
4801 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4802 __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
4803 index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
4804 __Pyx_GOTREF(__pyx_t_5);
4805 index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
4806 __Pyx_GOTREF(__pyx_t_8);
4807 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
4809 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4810 goto __pyx_L7_unpacking_done;
4811 __pyx_L6_unpacking_failed:;
4812 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4814 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4815 __PYX_ERR(0, 139, __pyx_L1_error)
4816 __pyx_L7_unpacking_done:;
4818 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
4820 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
4822 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4823 __Pyx_GOTREF(__pyx_t_3);
4824 __Pyx_INCREF(Py_None);
4825 __Pyx_GIVEREF(Py_None);
4826 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
4827 __Pyx_INCREF(__pyx_v_k);
4828 __Pyx_GIVEREF(__pyx_v_k);
4829 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_k);
4830 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 139, __pyx_L1_error)
4831 __Pyx_GOTREF(__pyx_t_8);
4832 __Pyx_GIVEREF(__pyx_t_3);
4833 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
4834 __Pyx_INCREF(__pyx_v_v);
4835 __Pyx_GIVEREF(__pyx_v_v);
4836 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v);
4838 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 139, __pyx_L1_error)
4839 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4841 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4843 /* "lxml/sax.py":138
4844 * def startElement(self, name, attributes=None):
4846 * attributes = dict( # <<<<<<<<<<<<<<
4847 * [((None, k), v) for k, v in attributes.items()]
4850 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
4851 __Pyx_GOTREF(__pyx_t_4);
4852 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4853 __Pyx_DECREF_SET(__pyx_v_attributes, __pyx_t_4);
4856 /* "lxml/sax.py":137
4858 * def startElement(self, name, attributes=None):
4859 * if attributes: # <<<<<<<<<<<<<<
4860 * attributes = dict(
4861 * [((None, k), v) for k, v in attributes.items()]
4865 /* "lxml/sax.py":141
4866 * [((None, k), v) for k, v in attributes.items()]
4868 * self.startElementNS((None, name), name, attributes) # <<<<<<<<<<<<<<
4870 * def endElement(self, name):
4872 __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)
4873 __Pyx_GOTREF(__pyx_t_2);
4874 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
4875 __Pyx_GOTREF(__pyx_t_8);
4876 __Pyx_INCREF(Py_None);
4877 __Pyx_GIVEREF(Py_None);
4878 PyTuple_SET_ITEM(__pyx_t_8, 0, Py_None);
4879 __Pyx_INCREF(__pyx_v_name);
4880 __Pyx_GIVEREF(__pyx_v_name);
4881 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name);
4884 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4885 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4886 if (likely(__pyx_t_3)) {
4887 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4888 __Pyx_INCREF(__pyx_t_3);
4889 __Pyx_INCREF(function);
4890 __Pyx_DECREF_SET(__pyx_t_2, function);
4894 #if CYTHON_FAST_PYCALL
4895 if (PyFunction_Check(__pyx_t_2)) {
4896 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4897 __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)
4898 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4899 __Pyx_GOTREF(__pyx_t_4);
4900 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4903 #if CYTHON_FAST_PYCCALL
4904 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4905 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_v_name, __pyx_v_attributes};
4906 __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)
4907 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4908 __Pyx_GOTREF(__pyx_t_4);
4909 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4913 __pyx_t_5 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
4914 __Pyx_GOTREF(__pyx_t_5);
4916 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4918 __Pyx_GIVEREF(__pyx_t_8);
4919 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_11, __pyx_t_8);
4920 __Pyx_INCREF(__pyx_v_name);
4921 __Pyx_GIVEREF(__pyx_v_name);
4922 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_11, __pyx_v_name);
4923 __Pyx_INCREF(__pyx_v_attributes);
4924 __Pyx_GIVEREF(__pyx_v_attributes);
4925 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_11, __pyx_v_attributes);
4927 __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)
4928 __Pyx_GOTREF(__pyx_t_4);
4929 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4931 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4932 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4934 /* "lxml/sax.py":136
4935 * raise SaxError("Unexpected element closed: " + el_tag)
4937 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
4939 * attributes = dict(
4942 /* function exit code */
4943 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4946 __Pyx_XDECREF(__pyx_t_2);
4947 __Pyx_XDECREF(__pyx_t_3);
4948 __Pyx_XDECREF(__pyx_t_4);
4949 __Pyx_XDECREF(__pyx_t_5);
4950 __Pyx_XDECREF(__pyx_t_8);
4951 __Pyx_XDECREF(__pyx_t_9);
4952 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.startElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
4955 __Pyx_XDECREF(__pyx_v_k);
4956 __Pyx_XDECREF(__pyx_v_v);
4957 __Pyx_XDECREF(__pyx_v_attributes);
4958 __Pyx_XGIVEREF(__pyx_r);
4959 __Pyx_RefNannyFinishContext();
4963 /* "lxml/sax.py":143
4964 * self.startElementNS((None, name), name, attributes)
4966 * def endElement(self, name): # <<<<<<<<<<<<<<
4967 * self.endElementNS((None, name), name)
4971 /* Python wrapper */
4972 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4973 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_25endElement = {"endElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement, METH_VARARGS|METH_KEYWORDS, 0};
4974 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_25endElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4975 PyObject *__pyx_v_self = 0;
4976 PyObject *__pyx_v_name = 0;
4977 int __pyx_lineno = 0;
4978 const char *__pyx_filename = NULL;
4979 int __pyx_clineno = 0;
4980 PyObject *__pyx_r = 0;
4981 __Pyx_RefNannyDeclarations
4982 __Pyx_RefNannySetupContext("endElement (wrapper)", 0);
4984 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,0};
4985 PyObject* values[2] = {0,0};
4986 if (unlikely(__pyx_kwds)) {
4988 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4990 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4992 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4995 default: goto __pyx_L5_argtuple_error;
4997 kw_args = PyDict_Size(__pyx_kwds);
5000 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5001 else goto __pyx_L5_argtuple_error;
5004 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
5006 __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, 1); __PYX_ERR(0, 143, __pyx_L3_error)
5009 if (unlikely(kw_args > 0)) {
5010 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "endElement") < 0)) __PYX_ERR(0, 143, __pyx_L3_error)
5012 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5013 goto __pyx_L5_argtuple_error;
5015 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5016 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5018 __pyx_v_self = values[0];
5019 __pyx_v_name = values[1];
5021 goto __pyx_L4_argument_unpacking_done;
5022 __pyx_L5_argtuple_error:;
5023 __Pyx_RaiseArgtupleInvalid("endElement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error)
5025 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5026 __Pyx_RefNannyFinishContext();
5028 __pyx_L4_argument_unpacking_done:;
5029 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(__pyx_self, __pyx_v_self, __pyx_v_name);
5031 /* function exit code */
5032 __Pyx_RefNannyFinishContext();
5036 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_24endElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
5037 PyObject *__pyx_r = NULL;
5038 __Pyx_RefNannyDeclarations
5039 PyObject *__pyx_t_1 = NULL;
5040 PyObject *__pyx_t_2 = NULL;
5041 PyObject *__pyx_t_3 = NULL;
5042 PyObject *__pyx_t_4 = NULL;
5044 PyObject *__pyx_t_6 = NULL;
5045 int __pyx_lineno = 0;
5046 const char *__pyx_filename = NULL;
5047 int __pyx_clineno = 0;
5048 __Pyx_RefNannySetupContext("endElement", 0);
5050 /* "lxml/sax.py":144
5052 * def endElement(self, name):
5053 * self.endElementNS((None, name), name) # <<<<<<<<<<<<<<
5055 * def characters(self, data):
5057 __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)
5058 __Pyx_GOTREF(__pyx_t_2);
5059 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
5060 __Pyx_GOTREF(__pyx_t_3);
5061 __Pyx_INCREF(Py_None);
5062 __Pyx_GIVEREF(Py_None);
5063 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
5064 __Pyx_INCREF(__pyx_v_name);
5065 __Pyx_GIVEREF(__pyx_v_name);
5066 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name);
5069 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5070 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
5071 if (likely(__pyx_t_4)) {
5072 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5073 __Pyx_INCREF(__pyx_t_4);
5074 __Pyx_INCREF(function);
5075 __Pyx_DECREF_SET(__pyx_t_2, function);
5079 #if CYTHON_FAST_PYCALL
5080 if (PyFunction_Check(__pyx_t_2)) {
5081 PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5082 __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)
5083 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5084 __Pyx_GOTREF(__pyx_t_1);
5085 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5088 #if CYTHON_FAST_PYCCALL
5089 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
5090 PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_name};
5091 __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)
5092 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5093 __Pyx_GOTREF(__pyx_t_1);
5094 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5098 __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
5099 __Pyx_GOTREF(__pyx_t_6);
5101 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
5103 __Pyx_GIVEREF(__pyx_t_3);
5104 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
5105 __Pyx_INCREF(__pyx_v_name);
5106 __Pyx_GIVEREF(__pyx_v_name);
5107 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_name);
5109 __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)
5110 __Pyx_GOTREF(__pyx_t_1);
5111 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5113 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5114 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5116 /* "lxml/sax.py":143
5117 * self.startElementNS((None, name), name, attributes)
5119 * def endElement(self, name): # <<<<<<<<<<<<<<
5120 * self.endElementNS((None, name), name)
5124 /* function exit code */
5125 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5128 __Pyx_XDECREF(__pyx_t_1);
5129 __Pyx_XDECREF(__pyx_t_2);
5130 __Pyx_XDECREF(__pyx_t_3);
5131 __Pyx_XDECREF(__pyx_t_4);
5132 __Pyx_XDECREF(__pyx_t_6);
5133 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.endElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5136 __Pyx_XGIVEREF(__pyx_r);
5137 __Pyx_RefNannyFinishContext();
5141 /* "lxml/sax.py":146
5142 * self.endElementNS((None, name), name)
5144 * def characters(self, data): # <<<<<<<<<<<<<<
5145 * last_element = self._element_stack[-1]
5149 /* Python wrapper */
5150 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5151 static PyMethodDef __pyx_mdef_4lxml_3sax_25ElementTreeContentHandler_27characters = {"characters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters, METH_VARARGS|METH_KEYWORDS, 0};
5152 static PyObject *__pyx_pw_4lxml_3sax_25ElementTreeContentHandler_27characters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5153 PyObject *__pyx_v_self = 0;
5154 PyObject *__pyx_v_data = 0;
5155 int __pyx_lineno = 0;
5156 const char *__pyx_filename = NULL;
5157 int __pyx_clineno = 0;
5158 PyObject *__pyx_r = 0;
5159 __Pyx_RefNannyDeclarations
5160 __Pyx_RefNannySetupContext("characters (wrapper)", 0);
5162 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
5163 PyObject* values[2] = {0,0};
5164 if (unlikely(__pyx_kwds)) {
5166 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5168 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5170 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5173 default: goto __pyx_L5_argtuple_error;
5175 kw_args = PyDict_Size(__pyx_kwds);
5178 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5179 else goto __pyx_L5_argtuple_error;
5182 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
5184 __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, 1); __PYX_ERR(0, 146, __pyx_L3_error)
5187 if (unlikely(kw_args > 0)) {
5188 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "characters") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
5190 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5191 goto __pyx_L5_argtuple_error;
5193 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5194 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5196 __pyx_v_self = values[0];
5197 __pyx_v_data = values[1];
5199 goto __pyx_L4_argument_unpacking_done;
5200 __pyx_L5_argtuple_error:;
5201 __Pyx_RaiseArgtupleInvalid("characters", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
5203 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5204 __Pyx_RefNannyFinishContext();
5206 __pyx_L4_argument_unpacking_done:;
5207 __pyx_r = __pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(__pyx_self, __pyx_v_self, __pyx_v_data);
5209 /* function exit code */
5210 __Pyx_RefNannyFinishContext();
5214 static PyObject *__pyx_pf_4lxml_3sax_25ElementTreeContentHandler_26characters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
5215 PyObject *__pyx_v_last_element = NULL;
5216 PyObject *__pyx_r = NULL;
5217 __Pyx_RefNannyDeclarations
5218 PyObject *__pyx_t_1 = NULL;
5219 PyObject *__pyx_t_2 = NULL;
5220 PyObject *__pyx_t_3 = NULL;
5221 PyObject *__pyx_t_4 = NULL;
5222 PyObject *__pyx_t_5 = NULL;
5225 PyObject *__pyx_t_8 = NULL;
5226 PyObject *__pyx_t_9 = NULL;
5227 PyObject *__pyx_t_10 = NULL;
5228 int __pyx_lineno = 0;
5229 const char *__pyx_filename = NULL;
5230 int __pyx_clineno = 0;
5231 __Pyx_RefNannySetupContext("characters", 0);
5233 /* "lxml/sax.py":147
5235 * def characters(self, data):
5236 * last_element = self._element_stack[-1] # <<<<<<<<<<<<<<
5238 * # if there already is a child element, we must append to its tail
5240 __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)
5241 __Pyx_GOTREF(__pyx_t_1);
5242 __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)
5243 __Pyx_GOTREF(__pyx_t_2);
5244 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5245 __pyx_v_last_element = __pyx_t_2;
5248 /* "lxml/sax.py":148
5249 * def characters(self, data):
5250 * last_element = self._element_stack[-1]
5251 * try: # <<<<<<<<<<<<<<
5252 * # if there already is a child element, we must append to its tail
5253 * last_element = last_element[-1]
5256 __Pyx_PyThreadState_declare
5257 __Pyx_PyThreadState_assign
5258 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
5259 __Pyx_XGOTREF(__pyx_t_3);
5260 __Pyx_XGOTREF(__pyx_t_4);
5261 __Pyx_XGOTREF(__pyx_t_5);
5264 /* "lxml/sax.py":150
5266 * # if there already is a child element, we must append to its tail
5267 * last_element = last_element[-1] # <<<<<<<<<<<<<<
5268 * last_element.tail = (last_element.tail or '') + data
5269 * except IndexError:
5271 __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)
5272 __Pyx_GOTREF(__pyx_t_2);
5273 __Pyx_DECREF_SET(__pyx_v_last_element, __pyx_t_2);
5276 /* "lxml/sax.py":151
5277 * # if there already is a child element, we must append to its tail
5278 * last_element = last_element[-1]
5279 * last_element.tail = (last_element.tail or '') + data # <<<<<<<<<<<<<<
5280 * except IndexError:
5281 * # otherwise: append to the text
5283 __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)
5284 __Pyx_GOTREF(__pyx_t_1);
5285 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 151, __pyx_L3_error)
5287 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5289 __Pyx_INCREF(__pyx_t_1);
5290 __pyx_t_2 = __pyx_t_1;
5291 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5292 goto __pyx_L9_bool_binop_done;
5294 __Pyx_INCREF(__pyx_kp_s__6);
5295 __pyx_t_2 = __pyx_kp_s__6;
5296 __pyx_L9_bool_binop_done:;
5297 __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L3_error)
5298 __Pyx_GOTREF(__pyx_t_1);
5299 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5300 if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_tail, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
5301 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5303 /* "lxml/sax.py":148
5304 * def characters(self, data):
5305 * last_element = self._element_stack[-1]
5306 * try: # <<<<<<<<<<<<<<
5307 * # if there already is a child element, we must append to its tail
5308 * last_element = last_element[-1]
5311 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5312 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5313 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5314 goto __pyx_L8_try_end;
5316 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5317 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5319 /* "lxml/sax.py":152
5320 * last_element = last_element[-1]
5321 * last_element.tail = (last_element.tail or '') + data
5322 * except IndexError: # <<<<<<<<<<<<<<
5323 * # otherwise: append to the text
5324 * last_element.text = (last_element.text or '') + data
5326 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
5328 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5329 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_8) < 0) __PYX_ERR(0, 152, __pyx_L5_except_error)
5330 __Pyx_GOTREF(__pyx_t_1);
5331 __Pyx_GOTREF(__pyx_t_2);
5332 __Pyx_GOTREF(__pyx_t_8);
5334 /* "lxml/sax.py":154
5335 * except IndexError:
5336 * # otherwise: append to the text
5337 * last_element.text = (last_element.text or '') + data # <<<<<<<<<<<<<<
5339 * ignorableWhitespace = characters
5341 __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)
5342 __Pyx_GOTREF(__pyx_t_10);
5343 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5345 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5347 __Pyx_INCREF(__pyx_t_10);
5348 __pyx_t_9 = __pyx_t_10;
5349 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5350 goto __pyx_L13_bool_binop_done;
5352 __Pyx_INCREF(__pyx_kp_s__6);
5353 __pyx_t_9 = __pyx_kp_s__6;
5354 __pyx_L13_bool_binop_done:;
5355 __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_v_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L5_except_error)
5356 __Pyx_GOTREF(__pyx_t_10);
5357 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5358 if (__Pyx_PyObject_SetAttrStr(__pyx_v_last_element, __pyx_n_s_text, __pyx_t_10) < 0) __PYX_ERR(0, 154, __pyx_L5_except_error)
5359 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5360 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5361 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5362 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5363 goto __pyx_L4_exception_handled;
5365 goto __pyx_L5_except_error;
5366 __pyx_L5_except_error:;
5368 /* "lxml/sax.py":148
5369 * def characters(self, data):
5370 * last_element = self._element_stack[-1]
5371 * try: # <<<<<<<<<<<<<<
5372 * # if there already is a child element, we must append to its tail
5373 * last_element = last_element[-1]
5375 __Pyx_XGIVEREF(__pyx_t_3);
5376 __Pyx_XGIVEREF(__pyx_t_4);
5377 __Pyx_XGIVEREF(__pyx_t_5);
5378 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5379 goto __pyx_L1_error;
5380 __pyx_L4_exception_handled:;
5381 __Pyx_XGIVEREF(__pyx_t_3);
5382 __Pyx_XGIVEREF(__pyx_t_4);
5383 __Pyx_XGIVEREF(__pyx_t_5);
5384 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5388 /* "lxml/sax.py":146
5389 * self.endElementNS((None, name), name)
5391 * def characters(self, data): # <<<<<<<<<<<<<<
5392 * last_element = self._element_stack[-1]
5396 /* function exit code */
5397 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5400 __Pyx_XDECREF(__pyx_t_1);
5401 __Pyx_XDECREF(__pyx_t_2);
5402 __Pyx_XDECREF(__pyx_t_8);
5403 __Pyx_XDECREF(__pyx_t_9);
5404 __Pyx_XDECREF(__pyx_t_10);
5405 __Pyx_AddTraceback("lxml.sax.ElementTreeContentHandler.characters", __pyx_clineno, __pyx_lineno, __pyx_filename);
5408 __Pyx_XDECREF(__pyx_v_last_element);
5409 __Pyx_XGIVEREF(__pyx_r);
5410 __Pyx_RefNannyFinishContext();
5414 /* "lxml/sax.py":162
5415 * """Produces SAX events for an element and children.
5417 * def __init__(self, element_or_tree, content_handler): # <<<<<<<<<<<<<<
5419 * element = element_or_tree.getroot()
5422 /* Python wrapper */
5423 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5424 static int __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5425 PyObject *__pyx_v_element_or_tree = 0;
5426 PyObject *__pyx_v_content_handler = 0;
5427 int __pyx_lineno = 0;
5428 const char *__pyx_filename = NULL;
5429 int __pyx_clineno = 0;
5431 __Pyx_RefNannyDeclarations
5432 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
5434 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
5435 PyObject* values[2] = {0,0};
5436 if (unlikely(__pyx_kwds)) {
5438 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5440 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5442 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5445 default: goto __pyx_L5_argtuple_error;
5447 kw_args = PyDict_Size(__pyx_kwds);
5450 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
5451 else goto __pyx_L5_argtuple_error;
5454 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
5456 __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 162, __pyx_L3_error)
5459 if (unlikely(kw_args > 0)) {
5460 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 162, __pyx_L3_error)
5462 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5463 goto __pyx_L5_argtuple_error;
5465 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5466 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5468 __pyx_v_element_or_tree = values[0];
5469 __pyx_v_content_handler = values[1];
5471 goto __pyx_L4_argument_unpacking_done;
5472 __pyx_L5_argtuple_error:;
5473 __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error)
5475 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5476 __Pyx_RefNannyFinishContext();
5478 __pyx_L4_argument_unpacking_done:;
5479 __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);
5481 /* function exit code */
5482 __Pyx_RefNannyFinishContext();
5486 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) {
5487 PyObject *__pyx_v_element = NULL;
5488 PyObject *__pyx_v_attr_class = NULL;
5490 __Pyx_RefNannyDeclarations
5491 PyObject *__pyx_t_1 = NULL;
5492 PyObject *__pyx_t_2 = NULL;
5493 PyObject *__pyx_t_3 = NULL;
5494 PyObject *__pyx_t_4 = NULL;
5495 PyObject *__pyx_t_5 = NULL;
5496 PyObject *__pyx_t_6 = NULL;
5498 PyObject *__pyx_t_8 = NULL;
5499 PyObject *__pyx_t_9 = NULL;
5500 PyObject *__pyx_t_10 = NULL;
5501 int __pyx_lineno = 0;
5502 const char *__pyx_filename = NULL;
5503 int __pyx_clineno = 0;
5504 __Pyx_RefNannySetupContext("__init__", 0);
5506 /* "lxml/sax.py":163
5508 * def __init__(self, element_or_tree, content_handler):
5509 * try: # <<<<<<<<<<<<<<
5510 * element = element_or_tree.getroot()
5511 * except AttributeError:
5514 __Pyx_PyThreadState_declare
5515 __Pyx_PyThreadState_assign
5516 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5517 __Pyx_XGOTREF(__pyx_t_1);
5518 __Pyx_XGOTREF(__pyx_t_2);
5519 __Pyx_XGOTREF(__pyx_t_3);
5522 /* "lxml/sax.py":164
5523 * def __init__(self, element_or_tree, content_handler):
5525 * element = element_or_tree.getroot() # <<<<<<<<<<<<<<
5526 * except AttributeError:
5527 * element = element_or_tree
5529 __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)
5530 __Pyx_GOTREF(__pyx_t_5);
5532 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5533 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5534 if (likely(__pyx_t_6)) {
5535 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5536 __Pyx_INCREF(__pyx_t_6);
5537 __Pyx_INCREF(function);
5538 __Pyx_DECREF_SET(__pyx_t_5, function);
5541 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5542 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5543 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L3_error)
5544 __Pyx_GOTREF(__pyx_t_4);
5545 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5546 __pyx_v_element = __pyx_t_4;
5549 /* "lxml/sax.py":163
5551 * def __init__(self, element_or_tree, content_handler):
5552 * try: # <<<<<<<<<<<<<<
5553 * element = element_or_tree.getroot()
5554 * except AttributeError:
5557 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5558 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5559 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5560 goto __pyx_L8_try_end;
5562 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5563 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5564 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5566 /* "lxml/sax.py":165
5568 * element = element_or_tree.getroot()
5569 * except AttributeError: # <<<<<<<<<<<<<<
5570 * element = element_or_tree
5571 * self._element = element
5573 __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
5575 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5576 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 165, __pyx_L5_except_error)
5577 __Pyx_GOTREF(__pyx_t_4);
5578 __Pyx_GOTREF(__pyx_t_5);
5579 __Pyx_GOTREF(__pyx_t_6);
5581 /* "lxml/sax.py":166
5582 * element = element_or_tree.getroot()
5583 * except AttributeError:
5584 * element = element_or_tree # <<<<<<<<<<<<<<
5585 * self._element = element
5586 * self._content_handler = content_handler
5588 __Pyx_INCREF(__pyx_v_element_or_tree);
5589 __Pyx_XDECREF_SET(__pyx_v_element, __pyx_v_element_or_tree);
5590 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5591 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5592 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5593 goto __pyx_L4_exception_handled;
5595 goto __pyx_L5_except_error;
5596 __pyx_L5_except_error:;
5598 /* "lxml/sax.py":163
5600 * def __init__(self, element_or_tree, content_handler):
5601 * try: # <<<<<<<<<<<<<<
5602 * element = element_or_tree.getroot()
5603 * except AttributeError:
5605 __Pyx_XGIVEREF(__pyx_t_1);
5606 __Pyx_XGIVEREF(__pyx_t_2);
5607 __Pyx_XGIVEREF(__pyx_t_3);
5608 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5609 goto __pyx_L1_error;
5610 __pyx_L4_exception_handled:;
5611 __Pyx_XGIVEREF(__pyx_t_1);
5612 __Pyx_XGIVEREF(__pyx_t_2);
5613 __Pyx_XGIVEREF(__pyx_t_3);
5614 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5618 /* "lxml/sax.py":167
5619 * except AttributeError:
5620 * element = element_or_tree
5621 * self._element = element # <<<<<<<<<<<<<<
5622 * self._content_handler = content_handler
5623 * from xml.sax.xmlreader import AttributesNSImpl as attr_class
5625 __Pyx_INCREF(__pyx_v_element);
5626 __Pyx_GIVEREF(__pyx_v_element);
5627 __Pyx_GOTREF(__pyx_v_self->_element);
5628 __Pyx_DECREF(__pyx_v_self->_element);
5629 __pyx_v_self->_element = __pyx_v_element;
5631 /* "lxml/sax.py":168
5632 * element = element_or_tree
5633 * self._element = element
5634 * self._content_handler = content_handler # <<<<<<<<<<<<<<
5635 * from xml.sax.xmlreader import AttributesNSImpl as attr_class
5636 * self._attr_class = attr_class
5638 __Pyx_INCREF(__pyx_v_content_handler);
5639 __Pyx_GIVEREF(__pyx_v_content_handler);
5640 __Pyx_GOTREF(__pyx_v_self->_content_handler);
5641 __Pyx_DECREF(__pyx_v_self->_content_handler);
5642 __pyx_v_self->_content_handler = __pyx_v_content_handler;
5644 /* "lxml/sax.py":169
5645 * self._element = element
5646 * self._content_handler = content_handler
5647 * from xml.sax.xmlreader import AttributesNSImpl as attr_class # <<<<<<<<<<<<<<
5648 * self._attr_class = attr_class
5649 * self._empty_attributes = attr_class({}, {})
5651 __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5652 __Pyx_GOTREF(__pyx_t_6);
5653 __Pyx_INCREF(__pyx_n_s_AttributesNSImpl);
5654 __Pyx_GIVEREF(__pyx_n_s_AttributesNSImpl);
5655 PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_AttributesNSImpl);
5656 __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)
5657 __Pyx_GOTREF(__pyx_t_5);
5658 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5659 __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_AttributesNSImpl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
5660 __Pyx_GOTREF(__pyx_t_6);
5661 __Pyx_INCREF(__pyx_t_6);
5662 __pyx_v_attr_class = __pyx_t_6;
5663 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5664 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5666 /* "lxml/sax.py":170
5667 * self._content_handler = content_handler
5668 * from xml.sax.xmlreader import AttributesNSImpl as attr_class
5669 * self._attr_class = attr_class # <<<<<<<<<<<<<<
5670 * self._empty_attributes = attr_class({}, {})
5673 __Pyx_INCREF(__pyx_v_attr_class);
5674 __Pyx_GIVEREF(__pyx_v_attr_class);
5675 __Pyx_GOTREF(__pyx_v_self->_attr_class);
5676 __Pyx_DECREF(__pyx_v_self->_attr_class);
5677 __pyx_v_self->_attr_class = __pyx_v_attr_class;
5679 /* "lxml/sax.py":171
5680 * from xml.sax.xmlreader import AttributesNSImpl as attr_class
5681 * self._attr_class = attr_class
5682 * self._empty_attributes = attr_class({}, {}) # <<<<<<<<<<<<<<
5686 __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error)
5687 __Pyx_GOTREF(__pyx_t_6);
5688 __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
5689 __Pyx_GOTREF(__pyx_t_4);
5690 __Pyx_INCREF(__pyx_v_attr_class);
5691 __pyx_t_8 = __pyx_v_attr_class; __pyx_t_9 = NULL;
5693 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5694 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
5695 if (likely(__pyx_t_9)) {
5696 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5697 __Pyx_INCREF(__pyx_t_9);
5698 __Pyx_INCREF(function);
5699 __Pyx_DECREF_SET(__pyx_t_8, function);
5703 #if CYTHON_FAST_PYCALL
5704 if (PyFunction_Check(__pyx_t_8)) {
5705 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5706 __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)
5707 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5708 __Pyx_GOTREF(__pyx_t_5);
5709 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5710 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5713 #if CYTHON_FAST_PYCCALL
5714 if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5715 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_6, __pyx_t_4};
5716 __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)
5717 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5718 __Pyx_GOTREF(__pyx_t_5);
5719 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5720 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5724 __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error)
5725 __Pyx_GOTREF(__pyx_t_10);
5727 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
5729 __Pyx_GIVEREF(__pyx_t_6);
5730 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_6);
5731 __Pyx_GIVEREF(__pyx_t_4);
5732 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_4);
5735 __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)
5736 __Pyx_GOTREF(__pyx_t_5);
5737 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5739 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5740 __Pyx_GIVEREF(__pyx_t_5);
5741 __Pyx_GOTREF(__pyx_v_self->_empty_attributes);
5742 __Pyx_DECREF(__pyx_v_self->_empty_attributes);
5743 __pyx_v_self->_empty_attributes = __pyx_t_5;
5746 /* "lxml/sax.py":162
5747 * """Produces SAX events for an element and children.
5749 * def __init__(self, element_or_tree, content_handler): # <<<<<<<<<<<<<<
5751 * element = element_or_tree.getroot()
5754 /* function exit code */
5758 __Pyx_XDECREF(__pyx_t_4);
5759 __Pyx_XDECREF(__pyx_t_5);
5760 __Pyx_XDECREF(__pyx_t_6);
5761 __Pyx_XDECREF(__pyx_t_8);
5762 __Pyx_XDECREF(__pyx_t_9);
5763 __Pyx_XDECREF(__pyx_t_10);
5764 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5767 __Pyx_XDECREF(__pyx_v_element);
5768 __Pyx_XDECREF(__pyx_v_attr_class);
5769 __Pyx_RefNannyFinishContext();
5773 /* "lxml/sax.py":173
5774 * self._empty_attributes = attr_class({}, {})
5776 * def saxify(self): # <<<<<<<<<<<<<<
5777 * self._content_handler.startDocument()
5781 /* Python wrapper */
5782 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5783 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_3saxify = {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0};
5784 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5785 PyObject *__pyx_r = 0;
5786 __Pyx_RefNannyDeclarations
5787 __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
5788 __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
5790 /* function exit code */
5791 __Pyx_RefNannyFinishContext();
5795 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_2saxify(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
5796 PyObject *__pyx_v_element = NULL;
5797 PyObject *__pyx_v_siblings = NULL;
5798 PyObject *__pyx_v_sibling = NULL;
5799 PyObject *__pyx_r = NULL;
5800 __Pyx_RefNannyDeclarations
5801 PyObject *__pyx_t_1 = NULL;
5802 PyObject *__pyx_t_2 = NULL;
5803 PyObject *__pyx_t_3 = NULL;
5807 Py_ssize_t __pyx_t_7;
5808 int __pyx_lineno = 0;
5809 const char *__pyx_filename = NULL;
5810 int __pyx_clineno = 0;
5811 __Pyx_RefNannySetupContext("saxify", 0);
5813 /* "lxml/sax.py":174
5816 * self._content_handler.startDocument() # <<<<<<<<<<<<<<
5818 * element = self._element
5820 __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)
5821 __Pyx_GOTREF(__pyx_t_2);
5823 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5824 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5825 if (likely(__pyx_t_3)) {
5826 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5827 __Pyx_INCREF(__pyx_t_3);
5828 __Pyx_INCREF(function);
5829 __Pyx_DECREF_SET(__pyx_t_2, function);
5832 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5833 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5834 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
5835 __Pyx_GOTREF(__pyx_t_1);
5836 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5837 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5839 /* "lxml/sax.py":176
5840 * self._content_handler.startDocument()
5842 * element = self._element # <<<<<<<<<<<<<<
5843 * if hasattr(element, 'getprevious'):
5846 __pyx_t_1 = __pyx_v_self->_element;
5847 __Pyx_INCREF(__pyx_t_1);
5848 __pyx_v_element = __pyx_t_1;
5851 /* "lxml/sax.py":177
5853 * element = self._element
5854 * if hasattr(element, 'getprevious'): # <<<<<<<<<<<<<<
5856 * sibling = element.getprevious()
5858 __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)
5859 __pyx_t_5 = (__pyx_t_4 != 0);
5862 /* "lxml/sax.py":178
5863 * element = self._element
5864 * if hasattr(element, 'getprevious'):
5865 * siblings = [] # <<<<<<<<<<<<<<
5866 * sibling = element.getprevious()
5867 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
5869 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5870 __Pyx_GOTREF(__pyx_t_1);
5871 __pyx_v_siblings = ((PyObject*)__pyx_t_1);
5874 /* "lxml/sax.py":179
5875 * if hasattr(element, 'getprevious'):
5877 * sibling = element.getprevious() # <<<<<<<<<<<<<<
5878 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
5879 * siblings.append(sibling)
5881 __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)
5882 __Pyx_GOTREF(__pyx_t_2);
5884 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5885 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5886 if (likely(__pyx_t_3)) {
5887 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5888 __Pyx_INCREF(__pyx_t_3);
5889 __Pyx_INCREF(function);
5890 __Pyx_DECREF_SET(__pyx_t_2, function);
5893 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5894 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5895 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
5896 __Pyx_GOTREF(__pyx_t_1);
5897 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5898 __pyx_v_sibling = __pyx_t_1;
5901 /* "lxml/sax.py":180
5903 * sibling = element.getprevious()
5904 * while getattr(sibling, 'tag', None) is ProcessingInstruction: # <<<<<<<<<<<<<<
5905 * siblings.append(sibling)
5906 * sibling = sibling.getprevious()
5909 __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)
5910 __Pyx_GOTREF(__pyx_t_1);
5911 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
5912 __Pyx_GOTREF(__pyx_t_2);
5913 __pyx_t_5 = (__pyx_t_1 == __pyx_t_2);
5914 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5915 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5916 __pyx_t_4 = (__pyx_t_5 != 0);
5917 if (!__pyx_t_4) break;
5919 /* "lxml/sax.py":181
5920 * sibling = element.getprevious()
5921 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
5922 * siblings.append(sibling) # <<<<<<<<<<<<<<
5923 * sibling = sibling.getprevious()
5924 * for sibling in siblings[::-1]:
5926 __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)
5928 /* "lxml/sax.py":182
5929 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
5930 * siblings.append(sibling)
5931 * sibling = sibling.getprevious() # <<<<<<<<<<<<<<
5932 * for sibling in siblings[::-1]:
5933 * self._recursive_saxify(sibling, {})
5935 __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)
5936 __Pyx_GOTREF(__pyx_t_1);
5938 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
5939 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
5940 if (likely(__pyx_t_3)) {
5941 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
5942 __Pyx_INCREF(__pyx_t_3);
5943 __Pyx_INCREF(function);
5944 __Pyx_DECREF_SET(__pyx_t_1, function);
5947 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
5948 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5949 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
5950 __Pyx_GOTREF(__pyx_t_2);
5951 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5952 __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5956 /* "lxml/sax.py":183
5957 * siblings.append(sibling)
5958 * sibling = sibling.getprevious()
5959 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
5960 * self._recursive_saxify(sibling, {})
5963 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_siblings, __pyx_slice__7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
5964 __Pyx_GOTREF(__pyx_t_2);
5965 __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
5966 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5968 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
5969 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5970 __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)
5972 __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)
5973 __Pyx_GOTREF(__pyx_t_2);
5975 __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_2);
5978 /* "lxml/sax.py":184
5979 * sibling = sibling.getprevious()
5980 * for sibling in siblings[::-1]:
5981 * self._recursive_saxify(sibling, {}) # <<<<<<<<<<<<<<
5983 * self._recursive_saxify(element, {})
5985 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5986 __Pyx_GOTREF(__pyx_t_2);
5987 __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)
5988 __Pyx_GOTREF(__pyx_t_3);
5989 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5990 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5992 /* "lxml/sax.py":183
5993 * siblings.append(sibling)
5994 * sibling = sibling.getprevious()
5995 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
5996 * self._recursive_saxify(sibling, {})
6000 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6002 /* "lxml/sax.py":177
6004 * element = self._element
6005 * if hasattr(element, 'getprevious'): # <<<<<<<<<<<<<<
6007 * sibling = element.getprevious()
6011 /* "lxml/sax.py":186
6012 * self._recursive_saxify(sibling, {})
6014 * self._recursive_saxify(element, {}) # <<<<<<<<<<<<<<
6016 * if hasattr(element, 'getnext'):
6018 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
6019 __Pyx_GOTREF(__pyx_t_1);
6020 __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)
6021 __Pyx_GOTREF(__pyx_t_3);
6022 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6023 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6025 /* "lxml/sax.py":188
6026 * self._recursive_saxify(element, {})
6028 * if hasattr(element, 'getnext'): # <<<<<<<<<<<<<<
6029 * sibling = element.getnext()
6030 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6032 __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)
6033 __pyx_t_5 = (__pyx_t_4 != 0);
6036 /* "lxml/sax.py":189
6038 * if hasattr(element, 'getnext'):
6039 * sibling = element.getnext() # <<<<<<<<<<<<<<
6040 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6041 * self._recursive_saxify(sibling, {})
6043 __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)
6044 __Pyx_GOTREF(__pyx_t_1);
6046 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6047 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6048 if (likely(__pyx_t_2)) {
6049 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6050 __Pyx_INCREF(__pyx_t_2);
6051 __Pyx_INCREF(function);
6052 __Pyx_DECREF_SET(__pyx_t_1, function);
6055 __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6056 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6057 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
6058 __Pyx_GOTREF(__pyx_t_3);
6059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6060 __Pyx_XDECREF_SET(__pyx_v_sibling, __pyx_t_3);
6063 /* "lxml/sax.py":190
6064 * if hasattr(element, 'getnext'):
6065 * sibling = element.getnext()
6066 * while getattr(sibling, 'tag', None) is ProcessingInstruction: # <<<<<<<<<<<<<<
6067 * self._recursive_saxify(sibling, {})
6068 * sibling = sibling.getnext()
6071 __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)
6072 __Pyx_GOTREF(__pyx_t_3);
6073 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
6074 __Pyx_GOTREF(__pyx_t_1);
6075 __pyx_t_5 = (__pyx_t_3 == __pyx_t_1);
6076 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6077 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6078 __pyx_t_4 = (__pyx_t_5 != 0);
6079 if (!__pyx_t_4) break;
6081 /* "lxml/sax.py":191
6082 * sibling = element.getnext()
6083 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6084 * self._recursive_saxify(sibling, {}) # <<<<<<<<<<<<<<
6085 * sibling = sibling.getnext()
6088 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
6089 __Pyx_GOTREF(__pyx_t_1);
6090 __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)
6091 __Pyx_GOTREF(__pyx_t_3);
6092 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6093 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6095 /* "lxml/sax.py":192
6096 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6097 * self._recursive_saxify(sibling, {})
6098 * sibling = sibling.getnext() # <<<<<<<<<<<<<<
6100 * self._content_handler.endDocument()
6102 __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)
6103 __Pyx_GOTREF(__pyx_t_1);
6105 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6106 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6107 if (likely(__pyx_t_2)) {
6108 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6109 __Pyx_INCREF(__pyx_t_2);
6110 __Pyx_INCREF(function);
6111 __Pyx_DECREF_SET(__pyx_t_1, function);
6114 __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6115 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6116 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
6117 __Pyx_GOTREF(__pyx_t_3);
6118 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6119 __Pyx_DECREF_SET(__pyx_v_sibling, __pyx_t_3);
6123 /* "lxml/sax.py":188
6124 * self._recursive_saxify(element, {})
6126 * if hasattr(element, 'getnext'): # <<<<<<<<<<<<<<
6127 * sibling = element.getnext()
6128 * while getattr(sibling, 'tag', None) is ProcessingInstruction:
6132 /* "lxml/sax.py":194
6133 * sibling = sibling.getnext()
6135 * self._content_handler.endDocument() # <<<<<<<<<<<<<<
6137 * def _recursive_saxify(self, element, parent_nsmap):
6139 __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)
6140 __Pyx_GOTREF(__pyx_t_1);
6142 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6143 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6144 if (likely(__pyx_t_2)) {
6145 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6146 __Pyx_INCREF(__pyx_t_2);
6147 __Pyx_INCREF(function);
6148 __Pyx_DECREF_SET(__pyx_t_1, function);
6151 __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6152 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6153 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error)
6154 __Pyx_GOTREF(__pyx_t_3);
6155 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6156 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6158 /* "lxml/sax.py":173
6159 * self._empty_attributes = attr_class({}, {})
6161 * def saxify(self): # <<<<<<<<<<<<<<
6162 * self._content_handler.startDocument()
6166 /* function exit code */
6167 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6170 __Pyx_XDECREF(__pyx_t_1);
6171 __Pyx_XDECREF(__pyx_t_2);
6172 __Pyx_XDECREF(__pyx_t_3);
6173 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
6176 __Pyx_XDECREF(__pyx_v_element);
6177 __Pyx_XDECREF(__pyx_v_siblings);
6178 __Pyx_XDECREF(__pyx_v_sibling);
6179 __Pyx_XGIVEREF(__pyx_r);
6180 __Pyx_RefNannyFinishContext();
6184 /* "lxml/sax.py":196
6185 * self._content_handler.endDocument()
6187 * def _recursive_saxify(self, element, parent_nsmap): # <<<<<<<<<<<<<<
6188 * content_handler = self._content_handler
6192 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) {
6193 PyObject *__pyx_v_element_nsmap = 0;
6194 PyObject *__pyx_v_content_handler = NULL;
6195 PyObject *__pyx_v_tag = NULL;
6196 PyObject *__pyx_v_tail = NULL;
6197 PyObject *__pyx_v_new_prefixes = NULL;
6198 PyObject *__pyx_v_prefix = NULL;
6199 PyObject *__pyx_v_ns_uri = NULL;
6200 PyObject *__pyx_v_attribs = NULL;
6201 PyObject *__pyx_v_attr_values = NULL;
6202 PyObject *__pyx_v_attr_qnames = NULL;
6203 PyObject *__pyx_v_attr_ns_name = NULL;
6204 PyObject *__pyx_v_value = NULL;
6205 PyObject *__pyx_v_attr_ns_tuple = NULL;
6206 PyObject *__pyx_v_sax_attributes = NULL;
6207 PyObject *__pyx_v_local_name = NULL;
6208 PyObject *__pyx_v_qname = NULL;
6209 PyObject *__pyx_v_uri = NULL;
6210 PyObject *__pyx_v_text = NULL;
6211 PyObject *__pyx_v_child = NULL;
6212 PyObject *__pyx_r = NULL;
6213 __Pyx_RefNannyDeclarations
6214 PyObject *__pyx_t_1 = NULL;
6218 PyObject *__pyx_t_5 = NULL;
6219 PyObject *__pyx_t_6 = NULL;
6220 PyObject *__pyx_t_7 = NULL;
6221 PyObject *__pyx_t_8 = NULL;
6223 PyObject *__pyx_t_10 = NULL;
6224 Py_ssize_t __pyx_t_11;
6225 PyObject *(*__pyx_t_12)(PyObject *);
6226 PyObject *(*__pyx_t_13)(PyObject *);
6228 int __pyx_lineno = 0;
6229 const char *__pyx_filename = NULL;
6230 int __pyx_clineno = 0;
6231 __Pyx_RefNannySetupContext("_recursive_saxify", 0);
6233 /* "lxml/sax.py":197
6235 * def _recursive_saxify(self, element, parent_nsmap):
6236 * content_handler = self._content_handler # <<<<<<<<<<<<<<
6238 * if tag is Comment or tag is ProcessingInstruction:
6240 __pyx_t_1 = __pyx_v_self->_content_handler;
6241 __Pyx_INCREF(__pyx_t_1);
6242 __pyx_v_content_handler = __pyx_t_1;
6245 /* "lxml/sax.py":198
6246 * def _recursive_saxify(self, element, parent_nsmap):
6247 * content_handler = self._content_handler
6248 * tag = element.tag # <<<<<<<<<<<<<<
6249 * if tag is Comment or tag is ProcessingInstruction:
6250 * if tag is ProcessingInstruction:
6252 __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)
6253 __Pyx_GOTREF(__pyx_t_1);
6254 __pyx_v_tag = __pyx_t_1;
6257 /* "lxml/sax.py":199
6258 * content_handler = self._content_handler
6260 * if tag is Comment or tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6261 * if tag is ProcessingInstruction:
6262 * content_handler.processingInstruction(
6264 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6265 __Pyx_GOTREF(__pyx_t_1);
6266 __pyx_t_3 = (__pyx_v_tag == __pyx_t_1);
6267 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6268 __pyx_t_4 = (__pyx_t_3 != 0);
6271 __pyx_t_2 = __pyx_t_4;
6272 goto __pyx_L4_bool_binop_done;
6274 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6275 __Pyx_GOTREF(__pyx_t_1);
6276 __pyx_t_4 = (__pyx_v_tag == __pyx_t_1);
6277 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6278 __pyx_t_3 = (__pyx_t_4 != 0);
6279 __pyx_t_2 = __pyx_t_3;
6280 __pyx_L4_bool_binop_done:;
6283 /* "lxml/sax.py":200
6285 * if tag is Comment or tag is ProcessingInstruction:
6286 * if tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6287 * content_handler.processingInstruction(
6288 * element.target, element.text)
6290 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
6291 __Pyx_GOTREF(__pyx_t_1);
6292 __pyx_t_2 = (__pyx_v_tag == __pyx_t_1);
6293 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6294 __pyx_t_3 = (__pyx_t_2 != 0);
6297 /* "lxml/sax.py":201
6298 * if tag is Comment or tag is ProcessingInstruction:
6299 * if tag is ProcessingInstruction:
6300 * content_handler.processingInstruction( # <<<<<<<<<<<<<<
6301 * element.target, element.text)
6302 * tail = element.tail
6304 __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)
6305 __Pyx_GOTREF(__pyx_t_5);
6307 /* "lxml/sax.py":202
6308 * if tag is ProcessingInstruction:
6309 * content_handler.processingInstruction(
6310 * element.target, element.text) # <<<<<<<<<<<<<<
6311 * tail = element.tail
6314 __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)
6315 __Pyx_GOTREF(__pyx_t_6);
6316 __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)
6317 __Pyx_GOTREF(__pyx_t_7);
6320 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6321 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
6322 if (likely(__pyx_t_8)) {
6323 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6324 __Pyx_INCREF(__pyx_t_8);
6325 __Pyx_INCREF(function);
6326 __Pyx_DECREF_SET(__pyx_t_5, function);
6330 #if CYTHON_FAST_PYCALL
6331 if (PyFunction_Check(__pyx_t_5)) {
6332 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6333 __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)
6334 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6335 __Pyx_GOTREF(__pyx_t_1);
6336 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6337 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6340 #if CYTHON_FAST_PYCCALL
6341 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6342 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_7};
6343 __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)
6344 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6345 __Pyx_GOTREF(__pyx_t_1);
6346 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6347 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6351 __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error)
6352 __Pyx_GOTREF(__pyx_t_10);
6354 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
6356 __Pyx_GIVEREF(__pyx_t_6);
6357 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_6);
6358 __Pyx_GIVEREF(__pyx_t_7);
6359 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
6362 __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)
6363 __Pyx_GOTREF(__pyx_t_1);
6364 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6366 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6367 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6369 /* "lxml/sax.py":200
6371 * if tag is Comment or tag is ProcessingInstruction:
6372 * if tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6373 * content_handler.processingInstruction(
6374 * element.target, element.text)
6378 /* "lxml/sax.py":203
6379 * content_handler.processingInstruction(
6380 * element.target, element.text)
6381 * tail = element.tail # <<<<<<<<<<<<<<
6383 * content_handler.characters(tail)
6385 __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)
6386 __Pyx_GOTREF(__pyx_t_1);
6387 __pyx_v_tail = __pyx_t_1;
6390 /* "lxml/sax.py":204
6391 * element.target, element.text)
6392 * tail = element.tail
6393 * if tail: # <<<<<<<<<<<<<<
6394 * content_handler.characters(tail)
6397 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
6400 /* "lxml/sax.py":205
6401 * tail = element.tail
6403 * content_handler.characters(tail) # <<<<<<<<<<<<<<
6407 __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)
6408 __Pyx_GOTREF(__pyx_t_5);
6410 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6411 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
6412 if (likely(__pyx_t_10)) {
6413 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6414 __Pyx_INCREF(__pyx_t_10);
6415 __Pyx_INCREF(function);
6416 __Pyx_DECREF_SET(__pyx_t_5, function);
6419 __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);
6420 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6421 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
6422 __Pyx_GOTREF(__pyx_t_1);
6423 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6424 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6426 /* "lxml/sax.py":204
6427 * element.target, element.text)
6428 * tail = element.tail
6429 * if tail: # <<<<<<<<<<<<<<
6430 * content_handler.characters(tail)
6435 /* "lxml/sax.py":206
6437 * content_handler.characters(tail)
6438 * return # <<<<<<<<<<<<<<
6440 * element_nsmap = element.nsmap
6442 __Pyx_XDECREF(__pyx_r);
6443 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6446 /* "lxml/sax.py":199
6447 * content_handler = self._content_handler
6449 * if tag is Comment or tag is ProcessingInstruction: # <<<<<<<<<<<<<<
6450 * if tag is ProcessingInstruction:
6451 * content_handler.processingInstruction(
6455 /* "lxml/sax.py":208
6458 * element_nsmap = element.nsmap # <<<<<<<<<<<<<<
6460 * if element_nsmap != parent_nsmap:
6462 __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)
6463 __Pyx_GOTREF(__pyx_t_1);
6464 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)
6465 __pyx_v_element_nsmap = ((PyObject*)__pyx_t_1);
6468 /* "lxml/sax.py":209
6470 * element_nsmap = element.nsmap
6471 * new_prefixes = [] # <<<<<<<<<<<<<<
6472 * if element_nsmap != parent_nsmap:
6473 * # There have been updates to the namespace
6475 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
6476 __Pyx_GOTREF(__pyx_t_1);
6477 __pyx_v_new_prefixes = ((PyObject*)__pyx_t_1);
6480 /* "lxml/sax.py":210
6481 * element_nsmap = element.nsmap
6483 * if element_nsmap != parent_nsmap: # <<<<<<<<<<<<<<
6484 * # There have been updates to the namespace
6485 * for prefix, ns_uri in element_nsmap.items():
6487 __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)
6488 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
6489 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6492 /* "lxml/sax.py":212
6493 * if element_nsmap != parent_nsmap:
6494 * # There have been updates to the namespace
6495 * for prefix, ns_uri in element_nsmap.items(): # <<<<<<<<<<<<<<
6496 * if parent_nsmap.get(prefix) != ns_uri:
6497 * new_prefixes.append( (prefix, ns_uri) )
6499 if (unlikely(__pyx_v_element_nsmap == Py_None)) {
6500 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
6501 __PYX_ERR(0, 212, __pyx_L1_error)
6503 __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_element_nsmap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
6504 __Pyx_GOTREF(__pyx_t_1);
6505 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
6506 __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6509 __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
6510 __Pyx_GOTREF(__pyx_t_5);
6511 __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 212, __pyx_L1_error)
6513 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6515 if (likely(!__pyx_t_12)) {
6516 if (likely(PyList_CheckExact(__pyx_t_5))) {
6517 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6518 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6519 __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)
6521 __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)
6522 __Pyx_GOTREF(__pyx_t_1);
6525 if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6526 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6527 __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)
6529 __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)
6530 __Pyx_GOTREF(__pyx_t_1);
6534 __pyx_t_1 = __pyx_t_12(__pyx_t_5);
6535 if (unlikely(!__pyx_t_1)) {
6536 PyObject* exc_type = PyErr_Occurred();
6538 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6539 else __PYX_ERR(0, 212, __pyx_L1_error)
6543 __Pyx_GOTREF(__pyx_t_1);
6545 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
6546 PyObject* sequence = __pyx_t_1;
6547 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6548 if (unlikely(size != 2)) {
6549 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6550 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6551 __PYX_ERR(0, 212, __pyx_L1_error)
6553 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6554 if (likely(PyTuple_CheckExact(sequence))) {
6555 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
6556 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
6558 __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
6559 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
6561 __Pyx_INCREF(__pyx_t_10);
6562 __Pyx_INCREF(__pyx_t_7);
6564 __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 212, __pyx_L1_error)
6565 __Pyx_GOTREF(__pyx_t_10);
6566 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __pyx_L1_error)
6567 __Pyx_GOTREF(__pyx_t_7);
6569 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6571 Py_ssize_t index = -1;
6572 __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error)
6573 __Pyx_GOTREF(__pyx_t_6);
6574 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6575 __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6576 index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
6577 __Pyx_GOTREF(__pyx_t_10);
6578 index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
6579 __Pyx_GOTREF(__pyx_t_7);
6580 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
6582 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6583 goto __pyx_L12_unpacking_done;
6584 __pyx_L11_unpacking_failed:;
6585 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6587 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6588 __PYX_ERR(0, 212, __pyx_L1_error)
6589 __pyx_L12_unpacking_done:;
6591 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_10);
6593 __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_7);
6596 /* "lxml/sax.py":213
6597 * # There have been updates to the namespace
6598 * for prefix, ns_uri in element_nsmap.items():
6599 * if parent_nsmap.get(prefix) != ns_uri: # <<<<<<<<<<<<<<
6600 * new_prefixes.append( (prefix, ns_uri) )
6603 if (unlikely(__pyx_v_parent_nsmap == Py_None)) {
6604 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
6605 __PYX_ERR(0, 213, __pyx_L1_error)
6607 __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)
6608 __Pyx_GOTREF(__pyx_t_1);
6609 __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)
6610 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6611 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
6612 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6615 /* "lxml/sax.py":214
6616 * for prefix, ns_uri in element_nsmap.items():
6617 * if parent_nsmap.get(prefix) != ns_uri:
6618 * new_prefixes.append( (prefix, ns_uri) ) # <<<<<<<<<<<<<<
6620 * attribs = element.items()
6622 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error)
6623 __Pyx_GOTREF(__pyx_t_7);
6624 __Pyx_INCREF(__pyx_v_prefix);
6625 __Pyx_GIVEREF(__pyx_v_prefix);
6626 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_prefix);
6627 __Pyx_INCREF(__pyx_v_ns_uri);
6628 __Pyx_GIVEREF(__pyx_v_ns_uri);
6629 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ns_uri);
6630 __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)
6631 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6633 /* "lxml/sax.py":213
6634 * # There have been updates to the namespace
6635 * for prefix, ns_uri in element_nsmap.items():
6636 * if parent_nsmap.get(prefix) != ns_uri: # <<<<<<<<<<<<<<
6637 * new_prefixes.append( (prefix, ns_uri) )
6642 /* "lxml/sax.py":212
6643 * if element_nsmap != parent_nsmap:
6644 * # There have been updates to the namespace
6645 * for prefix, ns_uri in element_nsmap.items(): # <<<<<<<<<<<<<<
6646 * if parent_nsmap.get(prefix) != ns_uri:
6647 * new_prefixes.append( (prefix, ns_uri) )
6650 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6652 /* "lxml/sax.py":210
6653 * element_nsmap = element.nsmap
6655 * if element_nsmap != parent_nsmap: # <<<<<<<<<<<<<<
6656 * # There have been updates to the namespace
6657 * for prefix, ns_uri in element_nsmap.items():
6661 /* "lxml/sax.py":216
6662 * new_prefixes.append( (prefix, ns_uri) )
6664 * attribs = element.items() # <<<<<<<<<<<<<<
6668 __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)
6669 __Pyx_GOTREF(__pyx_t_7);
6671 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
6672 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
6673 if (likely(__pyx_t_1)) {
6674 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6675 __Pyx_INCREF(__pyx_t_1);
6676 __Pyx_INCREF(function);
6677 __Pyx_DECREF_SET(__pyx_t_7, function);
6680 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
6681 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6682 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
6683 __Pyx_GOTREF(__pyx_t_5);
6684 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6685 __pyx_v_attribs = __pyx_t_5;
6688 /* "lxml/sax.py":217
6690 * attribs = element.items()
6691 * if attribs: # <<<<<<<<<<<<<<
6695 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_attribs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
6698 /* "lxml/sax.py":218
6699 * attribs = element.items()
6701 * attr_values = {} # <<<<<<<<<<<<<<
6703 * for attr_ns_name, value in attribs:
6705 __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error)
6706 __Pyx_GOTREF(__pyx_t_5);
6707 __pyx_v_attr_values = ((PyObject*)__pyx_t_5);
6710 /* "lxml/sax.py":219
6713 * attr_qnames = {} # <<<<<<<<<<<<<<
6714 * for attr_ns_name, value in attribs:
6715 * attr_ns_tuple = _getNsTag(attr_ns_name)
6717 __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
6718 __Pyx_GOTREF(__pyx_t_5);
6719 __pyx_v_attr_qnames = ((PyObject*)__pyx_t_5);
6722 /* "lxml/sax.py":220
6725 * for attr_ns_name, value in attribs: # <<<<<<<<<<<<<<
6726 * attr_ns_tuple = _getNsTag(attr_ns_name)
6727 * attr_values[attr_ns_tuple] = value
6729 if (likely(PyList_CheckExact(__pyx_v_attribs)) || PyTuple_CheckExact(__pyx_v_attribs)) {
6730 __pyx_t_5 = __pyx_v_attribs; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0;
6733 __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_attribs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
6734 __Pyx_GOTREF(__pyx_t_5);
6735 __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 220, __pyx_L1_error)
6738 if (likely(!__pyx_t_12)) {
6739 if (likely(PyList_CheckExact(__pyx_t_5))) {
6740 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break;
6741 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6742 __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)
6744 __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)
6745 __Pyx_GOTREF(__pyx_t_7);
6748 if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6749 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6750 __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)
6752 __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)
6753 __Pyx_GOTREF(__pyx_t_7);
6757 __pyx_t_7 = __pyx_t_12(__pyx_t_5);
6758 if (unlikely(!__pyx_t_7)) {
6759 PyObject* exc_type = PyErr_Occurred();
6761 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6762 else __PYX_ERR(0, 220, __pyx_L1_error)
6766 __Pyx_GOTREF(__pyx_t_7);
6768 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
6769 PyObject* sequence = __pyx_t_7;
6770 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6771 if (unlikely(size != 2)) {
6772 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6773 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6774 __PYX_ERR(0, 220, __pyx_L1_error)
6776 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6777 if (likely(PyTuple_CheckExact(sequence))) {
6778 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
6779 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
6781 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
6782 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
6784 __Pyx_INCREF(__pyx_t_1);
6785 __Pyx_INCREF(__pyx_t_10);
6787 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
6788 __Pyx_GOTREF(__pyx_t_1);
6789 __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error)
6790 __Pyx_GOTREF(__pyx_t_10);
6792 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6794 Py_ssize_t index = -1;
6795 __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
6796 __Pyx_GOTREF(__pyx_t_6);
6797 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6798 __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
6799 index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
6800 __Pyx_GOTREF(__pyx_t_1);
6801 index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
6802 __Pyx_GOTREF(__pyx_t_10);
6803 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
6805 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6806 goto __pyx_L18_unpacking_done;
6807 __pyx_L17_unpacking_failed:;
6808 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6810 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6811 __PYX_ERR(0, 220, __pyx_L1_error)
6812 __pyx_L18_unpacking_done:;
6814 __Pyx_XDECREF_SET(__pyx_v_attr_ns_name, __pyx_t_1);
6816 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
6819 /* "lxml/sax.py":221
6821 * for attr_ns_name, value in attribs:
6822 * attr_ns_tuple = _getNsTag(attr_ns_name) # <<<<<<<<<<<<<<
6823 * attr_values[attr_ns_tuple] = value
6824 * attr_qnames[attr_ns_tuple] = self._build_qname(
6826 __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)
6827 __Pyx_GOTREF(__pyx_t_7);
6828 __Pyx_XDECREF_SET(__pyx_v_attr_ns_tuple, ((PyObject*)__pyx_t_7));
6831 /* "lxml/sax.py":222
6832 * for attr_ns_name, value in attribs:
6833 * attr_ns_tuple = _getNsTag(attr_ns_name)
6834 * attr_values[attr_ns_tuple] = value # <<<<<<<<<<<<<<
6835 * attr_qnames[attr_ns_tuple] = self._build_qname(
6836 * attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6838 if (unlikely(PyDict_SetItem(__pyx_v_attr_values, __pyx_v_attr_ns_tuple, __pyx_v_value) < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
6840 /* "lxml/sax.py":224
6841 * attr_values[attr_ns_tuple] = value
6842 * attr_qnames[attr_ns_tuple] = self._build_qname(
6843 * attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap, # <<<<<<<<<<<<<<
6844 * preferred_prefix=None, is_attribute=True)
6845 * sax_attributes = self._attr_class(attr_values, attr_qnames)
6847 if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6848 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6849 __PYX_ERR(0, 224, __pyx_L1_error)
6851 __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)
6852 __Pyx_GOTREF(__pyx_t_7);
6853 if (unlikely(__pyx_v_attr_ns_tuple == Py_None)) {
6854 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6855 __PYX_ERR(0, 224, __pyx_L1_error)
6857 __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)
6858 __Pyx_GOTREF(__pyx_t_10);
6860 /* "lxml/sax.py":223
6861 * attr_ns_tuple = _getNsTag(attr_ns_name)
6862 * attr_values[attr_ns_tuple] = value
6863 * attr_qnames[attr_ns_tuple] = self._build_qname( # <<<<<<<<<<<<<<
6864 * attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6865 * preferred_prefix=None, is_attribute=True)
6867 __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)
6868 __Pyx_GOTREF(__pyx_t_1);
6869 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6870 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6871 if (unlikely(PyDict_SetItem(__pyx_v_attr_qnames, __pyx_v_attr_ns_tuple, __pyx_t_1) < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
6872 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6874 /* "lxml/sax.py":220
6877 * for attr_ns_name, value in attribs: # <<<<<<<<<<<<<<
6878 * attr_ns_tuple = _getNsTag(attr_ns_name)
6879 * attr_values[attr_ns_tuple] = value
6882 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6884 /* "lxml/sax.py":226
6885 * attr_ns_tuple[0], attr_ns_tuple[1], element_nsmap,
6886 * preferred_prefix=None, is_attribute=True)
6887 * sax_attributes = self._attr_class(attr_values, attr_qnames) # <<<<<<<<<<<<<<
6889 * sax_attributes = self._empty_attributes
6891 __Pyx_INCREF(__pyx_v_self->_attr_class);
6892 __pyx_t_1 = __pyx_v_self->_attr_class; __pyx_t_10 = NULL;
6894 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6895 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
6896 if (likely(__pyx_t_10)) {
6897 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6898 __Pyx_INCREF(__pyx_t_10);
6899 __Pyx_INCREF(function);
6900 __Pyx_DECREF_SET(__pyx_t_1, function);
6904 #if CYTHON_FAST_PYCALL
6905 if (PyFunction_Check(__pyx_t_1)) {
6906 PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6907 __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)
6908 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6909 __Pyx_GOTREF(__pyx_t_5);
6912 #if CYTHON_FAST_PYCCALL
6913 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6914 PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_attr_values, __pyx_v_attr_qnames};
6915 __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)
6916 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6917 __Pyx_GOTREF(__pyx_t_5);
6921 __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error)
6922 __Pyx_GOTREF(__pyx_t_7);
6924 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10); __pyx_t_10 = NULL;
6926 __Pyx_INCREF(__pyx_v_attr_values);
6927 __Pyx_GIVEREF(__pyx_v_attr_values);
6928 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_attr_values);
6929 __Pyx_INCREF(__pyx_v_attr_qnames);
6930 __Pyx_GIVEREF(__pyx_v_attr_qnames);
6931 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_attr_qnames);
6932 __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)
6933 __Pyx_GOTREF(__pyx_t_5);
6934 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6936 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6937 __pyx_v_sax_attributes = __pyx_t_5;
6940 /* "lxml/sax.py":217
6942 * attribs = element.items()
6943 * if attribs: # <<<<<<<<<<<<<<
6950 /* "lxml/sax.py":228
6951 * sax_attributes = self._attr_class(attr_values, attr_qnames)
6953 * sax_attributes = self._empty_attributes # <<<<<<<<<<<<<<
6955 * ns_uri, local_name = _getNsTag(tag)
6958 __pyx_t_5 = __pyx_v_self->_empty_attributes;
6959 __Pyx_INCREF(__pyx_t_5);
6960 __pyx_v_sax_attributes = __pyx_t_5;
6965 /* "lxml/sax.py":230
6966 * sax_attributes = self._empty_attributes
6968 * ns_uri, local_name = _getNsTag(tag) # <<<<<<<<<<<<<<
6969 * qname = self._build_qname(
6970 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
6972 __pyx_t_5 = __pyx_f_4lxml_3sax__getNsTag(__pyx_v_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
6973 __Pyx_GOTREF(__pyx_t_5);
6974 if (likely(__pyx_t_5 != Py_None)) {
6975 PyObject* sequence = __pyx_t_5;
6976 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6977 if (unlikely(size != 2)) {
6978 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6979 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6980 __PYX_ERR(0, 230, __pyx_L1_error)
6982 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6983 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
6984 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
6985 __Pyx_INCREF(__pyx_t_1);
6986 __Pyx_INCREF(__pyx_t_7);
6988 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
6989 __Pyx_GOTREF(__pyx_t_1);
6990 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
6991 __Pyx_GOTREF(__pyx_t_7);
6993 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6995 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 230, __pyx_L1_error)
6997 __Pyx_XDECREF_SET(__pyx_v_ns_uri, __pyx_t_1);
6999 __pyx_v_local_name = __pyx_t_7;
7002 /* "lxml/sax.py":232
7003 * ns_uri, local_name = _getNsTag(tag)
7004 * qname = self._build_qname(
7005 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False) # <<<<<<<<<<<<<<
7007 * for prefix, uri in new_prefixes:
7009 __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)
7010 __Pyx_GOTREF(__pyx_t_5);
7012 /* "lxml/sax.py":231
7014 * ns_uri, local_name = _getNsTag(tag)
7015 * qname = self._build_qname( # <<<<<<<<<<<<<<
7016 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7019 __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)
7020 __Pyx_GOTREF(__pyx_t_7);
7021 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7022 __pyx_v_qname = __pyx_t_7;
7025 /* "lxml/sax.py":234
7026 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7028 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7029 * content_handler.startPrefixMapping(prefix, uri)
7030 * content_handler.startElementNS(
7032 __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7034 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7035 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7036 __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)
7038 __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)
7039 __Pyx_GOTREF(__pyx_t_5);
7041 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7042 PyObject* sequence = __pyx_t_5;
7043 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7044 if (unlikely(size != 2)) {
7045 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7046 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7047 __PYX_ERR(0, 234, __pyx_L1_error)
7049 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7050 if (likely(PyTuple_CheckExact(sequence))) {
7051 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
7052 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
7054 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
7055 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
7057 __Pyx_INCREF(__pyx_t_1);
7058 __Pyx_INCREF(__pyx_t_10);
7060 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
7061 __Pyx_GOTREF(__pyx_t_1);
7062 __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 234, __pyx_L1_error)
7063 __Pyx_GOTREF(__pyx_t_10);
7065 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7067 Py_ssize_t index = -1;
7068 __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
7069 __Pyx_GOTREF(__pyx_t_6);
7070 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7071 __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext;
7072 index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed;
7073 __Pyx_GOTREF(__pyx_t_1);
7074 index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed;
7075 __Pyx_GOTREF(__pyx_t_10);
7076 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
7078 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7079 goto __pyx_L22_unpacking_done;
7080 __pyx_L21_unpacking_failed:;
7081 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7083 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7084 __PYX_ERR(0, 234, __pyx_L1_error)
7085 __pyx_L22_unpacking_done:;
7087 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_1);
7089 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_10);
7092 /* "lxml/sax.py":235
7094 * for prefix, uri in new_prefixes:
7095 * content_handler.startPrefixMapping(prefix, uri) # <<<<<<<<<<<<<<
7096 * content_handler.startElementNS(
7097 * (ns_uri, local_name), qname, sax_attributes)
7099 __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)
7100 __Pyx_GOTREF(__pyx_t_10);
7103 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
7104 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
7105 if (likely(__pyx_t_1)) {
7106 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7107 __Pyx_INCREF(__pyx_t_1);
7108 __Pyx_INCREF(function);
7109 __Pyx_DECREF_SET(__pyx_t_10, function);
7113 #if CYTHON_FAST_PYCALL
7114 if (PyFunction_Check(__pyx_t_10)) {
7115 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7116 __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)
7117 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7118 __Pyx_GOTREF(__pyx_t_5);
7121 #if CYTHON_FAST_PYCCALL
7122 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
7123 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_prefix, __pyx_v_uri};
7124 __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)
7125 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7126 __Pyx_GOTREF(__pyx_t_5);
7130 __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
7131 __Pyx_GOTREF(__pyx_t_6);
7133 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
7135 __Pyx_INCREF(__pyx_v_prefix);
7136 __Pyx_GIVEREF(__pyx_v_prefix);
7137 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_v_prefix);
7138 __Pyx_INCREF(__pyx_v_uri);
7139 __Pyx_GIVEREF(__pyx_v_uri);
7140 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_uri);
7141 __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)
7142 __Pyx_GOTREF(__pyx_t_5);
7143 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7145 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7146 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7148 /* "lxml/sax.py":234
7149 * ns_uri, local_name, element_nsmap, element.prefix, is_attribute=False)
7151 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7152 * content_handler.startPrefixMapping(prefix, uri)
7153 * content_handler.startElementNS(
7156 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7158 /* "lxml/sax.py":236
7159 * for prefix, uri in new_prefixes:
7160 * content_handler.startPrefixMapping(prefix, uri)
7161 * content_handler.startElementNS( # <<<<<<<<<<<<<<
7162 * (ns_uri, local_name), qname, sax_attributes)
7163 * text = element.text
7165 __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)
7166 __Pyx_GOTREF(__pyx_t_5);
7168 /* "lxml/sax.py":237
7169 * content_handler.startPrefixMapping(prefix, uri)
7170 * content_handler.startElementNS(
7171 * (ns_uri, local_name), qname, sax_attributes) # <<<<<<<<<<<<<<
7172 * text = element.text
7175 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error)
7176 __Pyx_GOTREF(__pyx_t_10);
7177 __Pyx_INCREF(__pyx_v_ns_uri);
7178 __Pyx_GIVEREF(__pyx_v_ns_uri);
7179 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ns_uri);
7180 __Pyx_INCREF(__pyx_v_local_name);
7181 __Pyx_GIVEREF(__pyx_v_local_name);
7182 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_local_name);
7185 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7186 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7187 if (likely(__pyx_t_6)) {
7188 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7189 __Pyx_INCREF(__pyx_t_6);
7190 __Pyx_INCREF(function);
7191 __Pyx_DECREF_SET(__pyx_t_5, function);
7195 #if CYTHON_FAST_PYCALL
7196 if (PyFunction_Check(__pyx_t_5)) {
7197 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7198 __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)
7199 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7200 __Pyx_GOTREF(__pyx_t_7);
7201 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7204 #if CYTHON_FAST_PYCCALL
7205 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7206 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_10, __pyx_v_qname, __pyx_v_sax_attributes};
7207 __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)
7208 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7209 __Pyx_GOTREF(__pyx_t_7);
7210 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7214 __pyx_t_1 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
7215 __Pyx_GOTREF(__pyx_t_1);
7217 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
7219 __Pyx_GIVEREF(__pyx_t_10);
7220 PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_t_10);
7221 __Pyx_INCREF(__pyx_v_qname);
7222 __Pyx_GIVEREF(__pyx_v_qname);
7223 PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_v_qname);
7224 __Pyx_INCREF(__pyx_v_sax_attributes);
7225 __Pyx_GIVEREF(__pyx_v_sax_attributes);
7226 PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_9, __pyx_v_sax_attributes);
7228 __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)
7229 __Pyx_GOTREF(__pyx_t_7);
7230 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7232 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7233 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7235 /* "lxml/sax.py":238
7236 * content_handler.startElementNS(
7237 * (ns_uri, local_name), qname, sax_attributes)
7238 * text = element.text # <<<<<<<<<<<<<<
7240 * content_handler.characters(text)
7242 __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)
7243 __Pyx_GOTREF(__pyx_t_7);
7244 __pyx_v_text = __pyx_t_7;
7247 /* "lxml/sax.py":239
7248 * (ns_uri, local_name), qname, sax_attributes)
7249 * text = element.text
7250 * if text: # <<<<<<<<<<<<<<
7251 * content_handler.characters(text)
7252 * for child in element:
7254 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
7257 /* "lxml/sax.py":240
7258 * text = element.text
7260 * content_handler.characters(text) # <<<<<<<<<<<<<<
7261 * for child in element:
7262 * self._recursive_saxify(child, element_nsmap)
7264 __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)
7265 __Pyx_GOTREF(__pyx_t_5);
7267 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7268 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7269 if (likely(__pyx_t_1)) {
7270 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7271 __Pyx_INCREF(__pyx_t_1);
7272 __Pyx_INCREF(function);
7273 __Pyx_DECREF_SET(__pyx_t_5, function);
7276 __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);
7277 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7278 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
7279 __Pyx_GOTREF(__pyx_t_7);
7280 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7281 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7283 /* "lxml/sax.py":239
7284 * (ns_uri, local_name), qname, sax_attributes)
7285 * text = element.text
7286 * if text: # <<<<<<<<<<<<<<
7287 * content_handler.characters(text)
7288 * for child in element:
7292 /* "lxml/sax.py":241
7294 * content_handler.characters(text)
7295 * for child in element: # <<<<<<<<<<<<<<
7296 * self._recursive_saxify(child, element_nsmap)
7297 * content_handler.endElementNS((ns_uri, local_name), qname)
7299 if (likely(PyList_CheckExact(__pyx_v_element)) || PyTuple_CheckExact(__pyx_v_element)) {
7300 __pyx_t_7 = __pyx_v_element; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7303 __pyx_t_11 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_element); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
7304 __Pyx_GOTREF(__pyx_t_7);
7305 __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 241, __pyx_L1_error)
7308 if (likely(!__pyx_t_12)) {
7309 if (likely(PyList_CheckExact(__pyx_t_7))) {
7310 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7311 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7312 __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)
7314 __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)
7315 __Pyx_GOTREF(__pyx_t_5);
7318 if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
7319 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7320 __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)
7322 __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)
7323 __Pyx_GOTREF(__pyx_t_5);
7327 __pyx_t_5 = __pyx_t_12(__pyx_t_7);
7328 if (unlikely(!__pyx_t_5)) {
7329 PyObject* exc_type = PyErr_Occurred();
7331 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7332 else __PYX_ERR(0, 241, __pyx_L1_error)
7336 __Pyx_GOTREF(__pyx_t_5);
7338 __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
7341 /* "lxml/sax.py":242
7342 * content_handler.characters(text)
7343 * for child in element:
7344 * self._recursive_saxify(child, element_nsmap) # <<<<<<<<<<<<<<
7345 * content_handler.endElementNS((ns_uri, local_name), qname)
7346 * for prefix, uri in new_prefixes:
7348 __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)
7349 __Pyx_GOTREF(__pyx_t_5);
7350 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7352 /* "lxml/sax.py":241
7354 * content_handler.characters(text)
7355 * for child in element: # <<<<<<<<<<<<<<
7356 * self._recursive_saxify(child, element_nsmap)
7357 * content_handler.endElementNS((ns_uri, local_name), qname)
7360 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7362 /* "lxml/sax.py":243
7363 * for child in element:
7364 * self._recursive_saxify(child, element_nsmap)
7365 * content_handler.endElementNS((ns_uri, local_name), qname) # <<<<<<<<<<<<<<
7366 * for prefix, uri in new_prefixes:
7367 * content_handler.endPrefixMapping(prefix)
7369 __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)
7370 __Pyx_GOTREF(__pyx_t_5);
7371 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
7372 __Pyx_GOTREF(__pyx_t_1);
7373 __Pyx_INCREF(__pyx_v_ns_uri);
7374 __Pyx_GIVEREF(__pyx_v_ns_uri);
7375 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ns_uri);
7376 __Pyx_INCREF(__pyx_v_local_name);
7377 __Pyx_GIVEREF(__pyx_v_local_name);
7378 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_local_name);
7381 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7382 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
7383 if (likely(__pyx_t_10)) {
7384 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7385 __Pyx_INCREF(__pyx_t_10);
7386 __Pyx_INCREF(function);
7387 __Pyx_DECREF_SET(__pyx_t_5, function);
7391 #if CYTHON_FAST_PYCALL
7392 if (PyFunction_Check(__pyx_t_5)) {
7393 PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7394 __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)
7395 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7396 __Pyx_GOTREF(__pyx_t_7);
7397 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7400 #if CYTHON_FAST_PYCCALL
7401 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7402 PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_qname};
7403 __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)
7404 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7405 __Pyx_GOTREF(__pyx_t_7);
7406 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7410 __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error)
7411 __Pyx_GOTREF(__pyx_t_6);
7413 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
7415 __Pyx_GIVEREF(__pyx_t_1);
7416 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_1);
7417 __Pyx_INCREF(__pyx_v_qname);
7418 __Pyx_GIVEREF(__pyx_v_qname);
7419 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_qname);
7421 __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)
7422 __Pyx_GOTREF(__pyx_t_7);
7423 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7425 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7426 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7428 /* "lxml/sax.py":244
7429 * self._recursive_saxify(child, element_nsmap)
7430 * content_handler.endElementNS((ns_uri, local_name), qname)
7431 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7432 * content_handler.endPrefixMapping(prefix)
7433 * tail = element.tail
7435 __pyx_t_7 = __pyx_v_new_prefixes; __Pyx_INCREF(__pyx_t_7); __pyx_t_11 = 0;
7437 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_7)) break;
7438 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7439 __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)
7441 __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)
7442 __Pyx_GOTREF(__pyx_t_5);
7444 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
7445 PyObject* sequence = __pyx_t_5;
7446 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7447 if (unlikely(size != 2)) {
7448 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7449 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7450 __PYX_ERR(0, 244, __pyx_L1_error)
7452 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7453 if (likely(PyTuple_CheckExact(sequence))) {
7454 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
7455 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
7457 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
7458 __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
7460 __Pyx_INCREF(__pyx_t_6);
7461 __Pyx_INCREF(__pyx_t_1);
7463 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error)
7464 __Pyx_GOTREF(__pyx_t_6);
7465 __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
7466 __Pyx_GOTREF(__pyx_t_1);
7468 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7470 Py_ssize_t index = -1;
7471 __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 244, __pyx_L1_error)
7472 __Pyx_GOTREF(__pyx_t_10);
7473 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7474 __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext;
7475 index = 0; __pyx_t_6 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L28_unpacking_failed;
7476 __Pyx_GOTREF(__pyx_t_6);
7477 index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L28_unpacking_failed;
7478 __Pyx_GOTREF(__pyx_t_1);
7479 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_10), 2) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
7481 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7482 goto __pyx_L29_unpacking_done;
7483 __pyx_L28_unpacking_failed:;
7484 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7486 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7487 __PYX_ERR(0, 244, __pyx_L1_error)
7488 __pyx_L29_unpacking_done:;
7490 __Pyx_XDECREF_SET(__pyx_v_prefix, __pyx_t_6);
7492 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_1);
7495 /* "lxml/sax.py":245
7496 * content_handler.endElementNS((ns_uri, local_name), qname)
7497 * for prefix, uri in new_prefixes:
7498 * content_handler.endPrefixMapping(prefix) # <<<<<<<<<<<<<<
7499 * tail = element.tail
7502 __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)
7503 __Pyx_GOTREF(__pyx_t_1);
7505 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
7506 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
7507 if (likely(__pyx_t_6)) {
7508 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
7509 __Pyx_INCREF(__pyx_t_6);
7510 __Pyx_INCREF(function);
7511 __Pyx_DECREF_SET(__pyx_t_1, function);
7514 __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);
7515 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7516 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 245, __pyx_L1_error)
7517 __Pyx_GOTREF(__pyx_t_5);
7518 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7519 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7521 /* "lxml/sax.py":244
7522 * self._recursive_saxify(child, element_nsmap)
7523 * content_handler.endElementNS((ns_uri, local_name), qname)
7524 * for prefix, uri in new_prefixes: # <<<<<<<<<<<<<<
7525 * content_handler.endPrefixMapping(prefix)
7526 * tail = element.tail
7529 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7531 /* "lxml/sax.py":246
7532 * for prefix, uri in new_prefixes:
7533 * content_handler.endPrefixMapping(prefix)
7534 * tail = element.tail # <<<<<<<<<<<<<<
7536 * content_handler.characters(tail)
7538 __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)
7539 __Pyx_GOTREF(__pyx_t_7);
7540 __pyx_v_tail = __pyx_t_7;
7543 /* "lxml/sax.py":247
7544 * content_handler.endPrefixMapping(prefix)
7545 * tail = element.tail
7546 * if tail: # <<<<<<<<<<<<<<
7547 * content_handler.characters(tail)
7550 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_tail); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7553 /* "lxml/sax.py":248
7554 * tail = element.tail
7556 * content_handler.characters(tail) # <<<<<<<<<<<<<<
7558 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7560 __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)
7561 __Pyx_GOTREF(__pyx_t_5);
7563 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7564 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
7565 if (likely(__pyx_t_1)) {
7566 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7567 __Pyx_INCREF(__pyx_t_1);
7568 __Pyx_INCREF(function);
7569 __Pyx_DECREF_SET(__pyx_t_5, function);
7572 __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);
7573 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7574 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
7575 __Pyx_GOTREF(__pyx_t_7);
7576 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7577 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7579 /* "lxml/sax.py":247
7580 * content_handler.endPrefixMapping(prefix)
7581 * tail = element.tail
7582 * if tail: # <<<<<<<<<<<<<<
7583 * content_handler.characters(tail)
7588 /* "lxml/sax.py":196
7589 * self._content_handler.endDocument()
7591 * def _recursive_saxify(self, element, parent_nsmap): # <<<<<<<<<<<<<<
7592 * content_handler = self._content_handler
7596 /* function exit code */
7597 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7600 __Pyx_XDECREF(__pyx_t_1);
7601 __Pyx_XDECREF(__pyx_t_5);
7602 __Pyx_XDECREF(__pyx_t_6);
7603 __Pyx_XDECREF(__pyx_t_7);
7604 __Pyx_XDECREF(__pyx_t_8);
7605 __Pyx_XDECREF(__pyx_t_10);
7606 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._recursive_saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
7609 __Pyx_XDECREF(__pyx_v_element_nsmap);
7610 __Pyx_XDECREF(__pyx_v_content_handler);
7611 __Pyx_XDECREF(__pyx_v_tag);
7612 __Pyx_XDECREF(__pyx_v_tail);
7613 __Pyx_XDECREF(__pyx_v_new_prefixes);
7614 __Pyx_XDECREF(__pyx_v_prefix);
7615 __Pyx_XDECREF(__pyx_v_ns_uri);
7616 __Pyx_XDECREF(__pyx_v_attribs);
7617 __Pyx_XDECREF(__pyx_v_attr_values);
7618 __Pyx_XDECREF(__pyx_v_attr_qnames);
7619 __Pyx_XDECREF(__pyx_v_attr_ns_name);
7620 __Pyx_XDECREF(__pyx_v_value);
7621 __Pyx_XDECREF(__pyx_v_attr_ns_tuple);
7622 __Pyx_XDECREF(__pyx_v_sax_attributes);
7623 __Pyx_XDECREF(__pyx_v_local_name);
7624 __Pyx_XDECREF(__pyx_v_qname);
7625 __Pyx_XDECREF(__pyx_v_uri);
7626 __Pyx_XDECREF(__pyx_v_text);
7627 __Pyx_XDECREF(__pyx_v_child);
7628 __Pyx_XGIVEREF(__pyx_r);
7629 __Pyx_RefNannyFinishContext();
7633 /* "lxml/sax.py":250
7634 * content_handler.characters(tail)
7636 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute): # <<<<<<<<<<<<<<
7637 * if ns_uri is None:
7641 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) {
7642 PyObject *__pyx_v_prefix = NULL;
7643 PyObject *__pyx_v_candidates = NULL;
7644 PyObject *__pyx_v_pfx = NULL;
7645 PyObject *__pyx_v_uri = NULL;
7646 PyObject *__pyx_r = NULL;
7647 __Pyx_RefNannyDeclarations
7650 PyObject *__pyx_t_3 = NULL;
7651 PyObject *__pyx_t_4 = NULL;
7652 PyObject *__pyx_t_5 = NULL;
7653 Py_ssize_t __pyx_t_6;
7654 PyObject *(*__pyx_t_7)(PyObject *);
7655 PyObject *__pyx_t_8 = NULL;
7656 PyObject *__pyx_t_9 = NULL;
7657 PyObject *__pyx_t_10 = NULL;
7658 PyObject *(*__pyx_t_11)(PyObject *);
7660 int __pyx_lineno = 0;
7661 const char *__pyx_filename = NULL;
7662 int __pyx_clineno = 0;
7663 __Pyx_RefNannySetupContext("_build_qname", 0);
7665 /* "lxml/sax.py":251
7667 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7668 * if ns_uri is None: # <<<<<<<<<<<<<<
7672 __pyx_t_1 = (__pyx_v_ns_uri == Py_None);
7673 __pyx_t_2 = (__pyx_t_1 != 0);
7676 /* "lxml/sax.py":252
7677 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7678 * if ns_uri is None:
7679 * return local_name # <<<<<<<<<<<<<<
7681 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7683 __Pyx_XDECREF(__pyx_r);
7684 __Pyx_INCREF(__pyx_v_local_name);
7685 __pyx_r = __pyx_v_local_name;
7688 /* "lxml/sax.py":251
7690 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute):
7691 * if ns_uri is None: # <<<<<<<<<<<<<<
7697 /* "lxml/sax.py":254
7700 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri: # <<<<<<<<<<<<<<
7701 * prefix = preferred_prefix
7704 __pyx_t_1 = ((!(__pyx_v_is_attribute != 0)) != 0);
7707 __pyx_t_2 = __pyx_t_1;
7708 goto __pyx_L5_bool_binop_done;
7710 if (unlikely(__pyx_v_nsmap == Py_None)) {
7711 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
7712 __PYX_ERR(0, 254, __pyx_L1_error)
7714 __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)
7715 __Pyx_GOTREF(__pyx_t_3);
7716 __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)
7717 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7718 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
7719 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7720 __pyx_t_2 = __pyx_t_1;
7721 __pyx_L5_bool_binop_done:;
7724 /* "lxml/sax.py":255
7726 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri:
7727 * prefix = preferred_prefix # <<<<<<<<<<<<<<
7729 * # Pick the first matching prefix, in alphabetical order.
7731 __Pyx_INCREF(__pyx_v_preferred_prefix);
7732 __pyx_v_prefix = __pyx_v_preferred_prefix;
7734 /* "lxml/sax.py":254
7737 * if not is_attribute and nsmap.get(preferred_prefix) == ns_uri: # <<<<<<<<<<<<<<
7738 * prefix = preferred_prefix
7744 /* "lxml/sax.py":258
7746 * # Pick the first matching prefix, in alphabetical order.
7747 * candidates = [ # <<<<<<<<<<<<<<
7748 * pfx for (pfx, uri) in nsmap.items()
7749 * if pfx is not None and uri == ns_uri
7752 __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
7753 __Pyx_GOTREF(__pyx_t_4);
7755 /* "lxml/sax.py":259
7756 * # Pick the first matching prefix, in alphabetical order.
7758 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7759 * if pfx is not None and uri == ns_uri
7762 if (unlikely(__pyx_v_nsmap == Py_None)) {
7763 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
7764 __PYX_ERR(0, 259, __pyx_L1_error)
7766 __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_nsmap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7767 __Pyx_GOTREF(__pyx_t_3);
7768 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
7769 __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
7772 __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __pyx_L1_error)
7773 __Pyx_GOTREF(__pyx_t_5);
7774 __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
7776 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7778 if (likely(!__pyx_t_7)) {
7779 if (likely(PyList_CheckExact(__pyx_t_5))) {
7780 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
7781 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7782 __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)
7784 __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)
7785 __Pyx_GOTREF(__pyx_t_3);
7788 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7789 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7790 __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)
7792 __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)
7793 __Pyx_GOTREF(__pyx_t_3);
7797 __pyx_t_3 = __pyx_t_7(__pyx_t_5);
7798 if (unlikely(!__pyx_t_3)) {
7799 PyObject* exc_type = PyErr_Occurred();
7801 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7802 else __PYX_ERR(0, 259, __pyx_L1_error)
7806 __Pyx_GOTREF(__pyx_t_3);
7808 if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
7809 PyObject* sequence = __pyx_t_3;
7810 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7811 if (unlikely(size != 2)) {
7812 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7813 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7814 __PYX_ERR(0, 259, __pyx_L1_error)
7816 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7817 if (likely(PyTuple_CheckExact(sequence))) {
7818 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
7819 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
7821 __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
7822 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
7824 __Pyx_INCREF(__pyx_t_8);
7825 __Pyx_INCREF(__pyx_t_9);
7827 __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error)
7828 __Pyx_GOTREF(__pyx_t_8);
7829 __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error)
7830 __Pyx_GOTREF(__pyx_t_9);
7832 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7834 Py_ssize_t index = -1;
7835 __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
7836 __Pyx_GOTREF(__pyx_t_10);
7837 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7838 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
7839 index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
7840 __Pyx_GOTREF(__pyx_t_8);
7841 index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
7842 __Pyx_GOTREF(__pyx_t_9);
7843 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
7845 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7846 goto __pyx_L10_unpacking_done;
7847 __pyx_L9_unpacking_failed:;
7848 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7850 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7851 __PYX_ERR(0, 259, __pyx_L1_error)
7852 __pyx_L10_unpacking_done:;
7854 __Pyx_XDECREF_SET(__pyx_v_pfx, __pyx_t_8);
7856 __Pyx_XDECREF_SET(__pyx_v_uri, __pyx_t_9);
7859 /* "lxml/sax.py":260
7861 * pfx for (pfx, uri) in nsmap.items()
7862 * if pfx is not None and uri == ns_uri # <<<<<<<<<<<<<<
7866 __pyx_t_1 = (__pyx_v_pfx != Py_None);
7867 __pyx_t_12 = (__pyx_t_1 != 0);
7870 __pyx_t_2 = __pyx_t_12;
7871 goto __pyx_L12_bool_binop_done;
7873 __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)
7874 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
7875 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7876 __pyx_t_2 = __pyx_t_12;
7877 __pyx_L12_bool_binop_done:;
7880 /* "lxml/sax.py":259
7881 * # Pick the first matching prefix, in alphabetical order.
7883 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7884 * if pfx is not None and uri == ns_uri
7887 if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_pfx))) __PYX_ERR(0, 258, __pyx_L1_error)
7889 /* "lxml/sax.py":260
7891 * pfx for (pfx, uri) in nsmap.items()
7892 * if pfx is not None and uri == ns_uri # <<<<<<<<<<<<<<
7898 /* "lxml/sax.py":259
7899 * # Pick the first matching prefix, in alphabetical order.
7901 * pfx for (pfx, uri) in nsmap.items() # <<<<<<<<<<<<<<
7902 * if pfx is not None and uri == ns_uri
7906 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7907 __pyx_v_candidates = ((PyObject*)__pyx_t_4);
7910 /* "lxml/sax.py":263
7913 * candidates[0] if len(candidates) == 1 # <<<<<<<<<<<<<<
7914 * else min(candidates) if candidates
7917 __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)
7918 if (((__pyx_t_6 == 1) != 0)) {
7919 __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)
7920 __Pyx_GOTREF(__pyx_t_5);
7921 __pyx_t_4 = __pyx_t_5;
7925 /* "lxml/sax.py":264
7927 * candidates[0] if len(candidates) == 1
7928 * else min(candidates) if candidates # <<<<<<<<<<<<<<
7932 __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
7934 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_v_candidates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7935 __Pyx_GOTREF(__pyx_t_3);
7936 __pyx_t_5 = __pyx_t_3;
7940 /* "lxml/sax.py":265
7941 * candidates[0] if len(candidates) == 1
7942 * else min(candidates) if candidates
7943 * else None # <<<<<<<<<<<<<<
7947 __Pyx_INCREF(Py_None);
7948 __pyx_t_5 = Py_None;
7950 __pyx_t_4 = __pyx_t_5;
7953 __pyx_v_prefix = __pyx_t_4;
7958 /* "lxml/sax.py":268
7961 * if prefix is None: # <<<<<<<<<<<<<<
7962 * # Default namespace
7965 __pyx_t_2 = (__pyx_v_prefix == Py_None);
7966 __pyx_t_12 = (__pyx_t_2 != 0);
7969 /* "lxml/sax.py":270
7970 * if prefix is None:
7971 * # Default namespace
7972 * return local_name # <<<<<<<<<<<<<<
7973 * return prefix + ':' + local_name
7976 __Pyx_XDECREF(__pyx_r);
7977 __Pyx_INCREF(__pyx_v_local_name);
7978 __pyx_r = __pyx_v_local_name;
7981 /* "lxml/sax.py":268
7984 * if prefix is None: # <<<<<<<<<<<<<<
7985 * # Default namespace
7990 /* "lxml/sax.py":271
7991 * # Default namespace
7993 * return prefix + ':' + local_name # <<<<<<<<<<<<<<
7997 __Pyx_XDECREF(__pyx_r);
7998 __pyx_t_4 = PyNumber_Add(__pyx_v_prefix, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
7999 __Pyx_GOTREF(__pyx_t_4);
8000 __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_v_local_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8001 __Pyx_GOTREF(__pyx_t_5);
8002 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8003 __pyx_r = __pyx_t_5;
8007 /* "lxml/sax.py":250
8008 * content_handler.characters(tail)
8010 * def _build_qname(self, ns_uri, local_name, nsmap, preferred_prefix, is_attribute): # <<<<<<<<<<<<<<
8011 * if ns_uri is None:
8015 /* function exit code */
8017 __Pyx_XDECREF(__pyx_t_3);
8018 __Pyx_XDECREF(__pyx_t_4);
8019 __Pyx_XDECREF(__pyx_t_5);
8020 __Pyx_XDECREF(__pyx_t_8);
8021 __Pyx_XDECREF(__pyx_t_9);
8022 __Pyx_XDECREF(__pyx_t_10);
8023 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer._build_qname", __pyx_clineno, __pyx_lineno, __pyx_filename);
8026 __Pyx_XDECREF(__pyx_v_prefix);
8027 __Pyx_XDECREF(__pyx_v_candidates);
8028 __Pyx_XDECREF(__pyx_v_pfx);
8029 __Pyx_XDECREF(__pyx_v_uri);
8030 __Pyx_XGIVEREF(__pyx_r);
8031 __Pyx_RefNannyFinishContext();
8035 /* "(tree fragment)":1
8036 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8041 /* Python wrapper */
8042 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8043 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0};
8044 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8045 PyObject *__pyx_r = 0;
8046 __Pyx_RefNannyDeclarations
8047 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8048 __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self));
8050 /* function exit code */
8051 __Pyx_RefNannyFinishContext();
8055 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_4__reduce_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self) {
8056 PyObject *__pyx_v_state = 0;
8057 PyObject *__pyx_v__dict = 0;
8058 int __pyx_v_use_setstate;
8059 PyObject *__pyx_r = NULL;
8060 __Pyx_RefNannyDeclarations
8061 PyObject *__pyx_t_1 = NULL;
8064 PyObject *__pyx_t_4 = NULL;
8066 PyObject *__pyx_t_6 = NULL;
8067 int __pyx_lineno = 0;
8068 const char *__pyx_filename = NULL;
8069 int __pyx_clineno = 0;
8070 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8072 /* "(tree fragment)":5
8074 * cdef bint use_setstate
8075 * state = (self._attr_class, self._content_handler, self._element, self._empty_attributes) # <<<<<<<<<<<<<<
8076 * _dict = getattr(self, '__dict__', None)
8077 * if _dict is not None:
8079 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
8080 __Pyx_GOTREF(__pyx_t_1);
8081 __Pyx_INCREF(__pyx_v_self->_attr_class);
8082 __Pyx_GIVEREF(__pyx_v_self->_attr_class);
8083 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_attr_class);
8084 __Pyx_INCREF(__pyx_v_self->_content_handler);
8085 __Pyx_GIVEREF(__pyx_v_self->_content_handler);
8086 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_content_handler);
8087 __Pyx_INCREF(__pyx_v_self->_element);
8088 __Pyx_GIVEREF(__pyx_v_self->_element);
8089 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->_element);
8090 __Pyx_INCREF(__pyx_v_self->_empty_attributes);
8091 __Pyx_GIVEREF(__pyx_v_self->_empty_attributes);
8092 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->_empty_attributes);
8093 __pyx_v_state = ((PyObject*)__pyx_t_1);
8096 /* "(tree fragment)":6
8097 * cdef bint use_setstate
8098 * state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8099 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
8100 * if _dict is not None:
8103 __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)
8104 __Pyx_GOTREF(__pyx_t_1);
8105 __pyx_v__dict = __pyx_t_1;
8108 /* "(tree fragment)":7
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: # <<<<<<<<<<<<<<
8113 * use_setstate = True
8115 __pyx_t_2 = (__pyx_v__dict != Py_None);
8116 __pyx_t_3 = (__pyx_t_2 != 0);
8119 /* "(tree fragment)":8
8120 * _dict = getattr(self, '__dict__', None)
8121 * if _dict is not None:
8122 * state += (_dict,) # <<<<<<<<<<<<<<
8123 * use_setstate = True
8126 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
8127 __Pyx_GOTREF(__pyx_t_1);
8128 __Pyx_INCREF(__pyx_v__dict);
8129 __Pyx_GIVEREF(__pyx_v__dict);
8130 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8131 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
8132 __Pyx_GOTREF(__pyx_t_4);
8133 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8134 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8137 /* "(tree fragment)":9
8138 * if _dict is not None:
8140 * use_setstate = True # <<<<<<<<<<<<<<
8142 * 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
8144 __pyx_v_use_setstate = 1;
8146 /* "(tree fragment)":7
8147 * state = (self._attr_class, self._content_handler, self._element, self._empty_attributes)
8148 * _dict = getattr(self, '__dict__', None)
8149 * if _dict is not None: # <<<<<<<<<<<<<<
8151 * use_setstate = True
8156 /* "(tree fragment)":11
8157 * use_setstate = True
8159 * 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 # <<<<<<<<<<<<<<
8161 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8164 __pyx_t_2 = (__pyx_v_self->_attr_class != Py_None);
8165 __pyx_t_5 = (__pyx_t_2 != 0);
8168 __pyx_t_3 = __pyx_t_5;
8169 goto __pyx_L4_bool_binop_done;
8171 __pyx_t_5 = (__pyx_v_self->_content_handler != Py_None);
8172 __pyx_t_2 = (__pyx_t_5 != 0);
8175 __pyx_t_3 = __pyx_t_2;
8176 goto __pyx_L4_bool_binop_done;
8178 __pyx_t_2 = (__pyx_v_self->_element != Py_None);
8179 __pyx_t_5 = (__pyx_t_2 != 0);
8182 __pyx_t_3 = __pyx_t_5;
8183 goto __pyx_L4_bool_binop_done;
8185 __pyx_t_5 = (__pyx_v_self->_empty_attributes != Py_None);
8186 __pyx_t_2 = (__pyx_t_5 != 0);
8187 __pyx_t_3 = __pyx_t_2;
8188 __pyx_L4_bool_binop_done:;
8189 __pyx_v_use_setstate = __pyx_t_3;
8193 /* "(tree fragment)":12
8195 * 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
8196 * if use_setstate: # <<<<<<<<<<<<<<
8197 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8200 __pyx_t_3 = (__pyx_v_use_setstate != 0);
8203 /* "(tree fragment)":13
8204 * 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
8206 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state # <<<<<<<<<<<<<<
8208 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8210 __Pyx_XDECREF(__pyx_r);
8211 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
8212 __Pyx_GOTREF(__pyx_t_4);
8213 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
8214 __Pyx_GOTREF(__pyx_t_1);
8215 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8216 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8217 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8218 __Pyx_INCREF(__pyx_int_30712058);
8219 __Pyx_GIVEREF(__pyx_int_30712058);
8220 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8221 __Pyx_INCREF(Py_None);
8222 __Pyx_GIVEREF(Py_None);
8223 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8224 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
8225 __Pyx_GOTREF(__pyx_t_6);
8226 __Pyx_GIVEREF(__pyx_t_4);
8227 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
8228 __Pyx_GIVEREF(__pyx_t_1);
8229 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
8230 __Pyx_INCREF(__pyx_v_state);
8231 __Pyx_GIVEREF(__pyx_v_state);
8232 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
8235 __pyx_r = __pyx_t_6;
8239 /* "(tree fragment)":12
8241 * 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
8242 * if use_setstate: # <<<<<<<<<<<<<<
8243 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8248 /* "(tree fragment)":15
8249 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, None), state
8251 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state) # <<<<<<<<<<<<<<
8252 * def __setstate_cython__(self, __pyx_state):
8253 * __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8256 __Pyx_XDECREF(__pyx_r);
8257 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_ElementTreeProduc); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
8258 __Pyx_GOTREF(__pyx_t_6);
8259 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
8260 __Pyx_GOTREF(__pyx_t_1);
8261 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8262 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8263 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8264 __Pyx_INCREF(__pyx_int_30712058);
8265 __Pyx_GIVEREF(__pyx_int_30712058);
8266 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_30712058);
8267 __Pyx_INCREF(__pyx_v_state);
8268 __Pyx_GIVEREF(__pyx_v_state);
8269 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8270 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
8271 __Pyx_GOTREF(__pyx_t_4);
8272 __Pyx_GIVEREF(__pyx_t_6);
8273 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
8274 __Pyx_GIVEREF(__pyx_t_1);
8275 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8278 __pyx_r = __pyx_t_4;
8283 /* "(tree fragment)":1
8284 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8289 /* function exit code */
8291 __Pyx_XDECREF(__pyx_t_1);
8292 __Pyx_XDECREF(__pyx_t_4);
8293 __Pyx_XDECREF(__pyx_t_6);
8294 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8297 __Pyx_XDECREF(__pyx_v_state);
8298 __Pyx_XDECREF(__pyx_v__dict);
8299 __Pyx_XGIVEREF(__pyx_r);
8300 __Pyx_RefNannyFinishContext();
8304 /* "(tree fragment)":16
8306 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8307 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8308 * __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
8311 /* Python wrapper */
8312 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
8313 static PyMethodDef __pyx_mdef_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0};
8314 static PyObject *__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8315 PyObject *__pyx_r = 0;
8316 __Pyx_RefNannyDeclarations
8317 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8318 __pyx_r = __pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8320 /* function exit code */
8321 __Pyx_RefNannyFinishContext();
8325 static PyObject *__pyx_pf_4lxml_3sax_19ElementTreeProducer_6__setstate_cython__(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8326 PyObject *__pyx_r = NULL;
8327 __Pyx_RefNannyDeclarations
8328 PyObject *__pyx_t_1 = NULL;
8329 int __pyx_lineno = 0;
8330 const char *__pyx_filename = NULL;
8331 int __pyx_clineno = 0;
8332 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8334 /* "(tree fragment)":17
8335 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
8336 * def __setstate_cython__(self, __pyx_state):
8337 * __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
8339 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)
8340 __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)
8341 __Pyx_GOTREF(__pyx_t_1);
8342 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8344 /* "(tree fragment)":16
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)
8351 /* function exit code */
8352 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8355 __Pyx_XDECREF(__pyx_t_1);
8356 __Pyx_AddTraceback("lxml.sax.ElementTreeProducer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8359 __Pyx_XGIVEREF(__pyx_r);
8360 __Pyx_RefNannyFinishContext();
8364 /* "lxml/sax.py":274
8367 * def saxify(element_or_tree, content_handler): # <<<<<<<<<<<<<<
8368 * """One-shot helper to generate SAX events from an XML tree and fire
8369 * them against a SAX ContentHandler.
8372 /* Python wrapper */
8373 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8374 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 ";
8375 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};
8376 static PyObject *__pyx_pw_4lxml_3sax_1saxify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8377 PyObject *__pyx_v_element_or_tree = 0;
8378 PyObject *__pyx_v_content_handler = 0;
8379 int __pyx_lineno = 0;
8380 const char *__pyx_filename = NULL;
8381 int __pyx_clineno = 0;
8382 PyObject *__pyx_r = 0;
8383 __Pyx_RefNannyDeclarations
8384 __Pyx_RefNannySetupContext("saxify (wrapper)", 0);
8386 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_element_or_tree,&__pyx_n_s_content_handler,0};
8387 PyObject* values[2] = {0,0};
8388 if (unlikely(__pyx_kwds)) {
8390 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8392 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8394 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8397 default: goto __pyx_L5_argtuple_error;
8399 kw_args = PyDict_Size(__pyx_kwds);
8402 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_element_or_tree)) != 0)) kw_args--;
8403 else goto __pyx_L5_argtuple_error;
8406 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content_handler)) != 0)) kw_args--;
8408 __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, 1); __PYX_ERR(0, 274, __pyx_L3_error)
8411 if (unlikely(kw_args > 0)) {
8412 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "saxify") < 0)) __PYX_ERR(0, 274, __pyx_L3_error)
8414 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8415 goto __pyx_L5_argtuple_error;
8417 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8418 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8420 __pyx_v_element_or_tree = values[0];
8421 __pyx_v_content_handler = values[1];
8423 goto __pyx_L4_argument_unpacking_done;
8424 __pyx_L5_argtuple_error:;
8425 __Pyx_RaiseArgtupleInvalid("saxify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 274, __pyx_L3_error)
8427 __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8428 __Pyx_RefNannyFinishContext();
8430 __pyx_L4_argument_unpacking_done:;
8431 __pyx_r = __pyx_pf_4lxml_3sax_saxify(__pyx_self, __pyx_v_element_or_tree, __pyx_v_content_handler);
8433 /* function exit code */
8434 __Pyx_RefNannyFinishContext();
8438 static PyObject *__pyx_pf_4lxml_3sax_saxify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_element_or_tree, PyObject *__pyx_v_content_handler) {
8439 PyObject *__pyx_r = NULL;
8440 __Pyx_RefNannyDeclarations
8441 PyObject *__pyx_t_1 = NULL;
8442 PyObject *__pyx_t_2 = NULL;
8443 PyObject *__pyx_t_3 = NULL;
8444 int __pyx_lineno = 0;
8445 const char *__pyx_filename = NULL;
8446 int __pyx_clineno = 0;
8447 __Pyx_RefNannySetupContext("saxify", 0);
8449 /* "lxml/sax.py":278
8450 * them against a SAX ContentHandler.
8452 * return ElementTreeProducer(element_or_tree, content_handler).saxify() # <<<<<<<<<<<<<<
8454 __Pyx_XDECREF(__pyx_r);
8455 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
8456 __Pyx_GOTREF(__pyx_t_2);
8457 __Pyx_INCREF(__pyx_v_element_or_tree);
8458 __Pyx_GIVEREF(__pyx_v_element_or_tree);
8459 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_element_or_tree);
8460 __Pyx_INCREF(__pyx_v_content_handler);
8461 __Pyx_GIVEREF(__pyx_v_content_handler);
8462 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_content_handler);
8463 __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)
8464 __Pyx_GOTREF(__pyx_t_3);
8465 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8466 __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)
8467 __Pyx_GOTREF(__pyx_t_2);
8468 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8470 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8471 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8472 if (likely(__pyx_t_3)) {
8473 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8474 __Pyx_INCREF(__pyx_t_3);
8475 __Pyx_INCREF(function);
8476 __Pyx_DECREF_SET(__pyx_t_2, function);
8479 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8480 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8481 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
8482 __Pyx_GOTREF(__pyx_t_1);
8483 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8484 __pyx_r = __pyx_t_1;
8488 /* "lxml/sax.py":274
8491 * def saxify(element_or_tree, content_handler): # <<<<<<<<<<<<<<
8492 * """One-shot helper to generate SAX events from an XML tree and fire
8493 * them against a SAX ContentHandler.
8496 /* function exit code */
8498 __Pyx_XDECREF(__pyx_t_1);
8499 __Pyx_XDECREF(__pyx_t_2);
8500 __Pyx_XDECREF(__pyx_t_3);
8501 __Pyx_AddTraceback("lxml.sax.saxify", __pyx_clineno, __pyx_lineno, __pyx_filename);
8504 __Pyx_XGIVEREF(__pyx_r);
8505 __Pyx_RefNannyFinishContext();
8509 /* "(tree fragment)":1
8510 * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
8511 * cdef object __pyx_PickleError
8512 * cdef object __pyx_result
8515 /* Python wrapper */
8516 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8517 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};
8518 static PyObject *__pyx_pw_4lxml_3sax_3__pyx_unpickle_ElementTreeProducer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8519 PyObject *__pyx_v___pyx_type = 0;
8520 long __pyx_v___pyx_checksum;
8521 PyObject *__pyx_v___pyx_state = 0;
8522 int __pyx_lineno = 0;
8523 const char *__pyx_filename = NULL;
8524 int __pyx_clineno = 0;
8525 PyObject *__pyx_r = 0;
8526 __Pyx_RefNannyDeclarations
8527 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer (wrapper)", 0);
8529 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
8530 PyObject* values[3] = {0,0,0};
8531 if (unlikely(__pyx_kwds)) {
8533 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8535 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8537 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8539 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8542 default: goto __pyx_L5_argtuple_error;
8544 kw_args = PyDict_Size(__pyx_kwds);
8547 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
8548 else goto __pyx_L5_argtuple_error;
8551 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
8553 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
8557 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
8559 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
8562 if (unlikely(kw_args > 0)) {
8563 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ElementTreeProducer") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
8565 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8566 goto __pyx_L5_argtuple_error;
8568 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8569 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8570 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8572 __pyx_v___pyx_type = values[0];
8573 __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)
8574 __pyx_v___pyx_state = values[2];
8576 goto __pyx_L4_argument_unpacking_done;
8577 __pyx_L5_argtuple_error:;
8578 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementTreeProducer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
8580 __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8581 __Pyx_RefNannyFinishContext();
8583 __pyx_L4_argument_unpacking_done:;
8584 __pyx_r = __pyx_pf_4lxml_3sax_2__pyx_unpickle_ElementTreeProducer(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
8586 /* function exit code */
8587 __Pyx_RefNannyFinishContext();
8591 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) {
8592 PyObject *__pyx_v___pyx_PickleError = 0;
8593 PyObject *__pyx_v___pyx_result = 0;
8594 PyObject *__pyx_r = NULL;
8595 __Pyx_RefNannyDeclarations
8597 PyObject *__pyx_t_2 = NULL;
8598 PyObject *__pyx_t_3 = NULL;
8599 PyObject *__pyx_t_4 = NULL;
8600 PyObject *__pyx_t_5 = NULL;
8602 int __pyx_lineno = 0;
8603 const char *__pyx_filename = NULL;
8604 int __pyx_clineno = 0;
8605 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer", 0);
8607 /* "(tree fragment)":4
8608 * cdef object __pyx_PickleError
8609 * cdef object __pyx_result
8610 * if __pyx_checksum != 0x1d4a0fa: # <<<<<<<<<<<<<<
8611 * from pickle import PickleError as __pyx_PickleError
8612 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8614 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x1d4a0fa) != 0);
8617 /* "(tree fragment)":5
8618 * cdef object __pyx_result
8619 * if __pyx_checksum != 0x1d4a0fa:
8620 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
8621 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8622 * __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8624 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8625 __Pyx_GOTREF(__pyx_t_2);
8626 __Pyx_INCREF(__pyx_n_s_PickleError);
8627 __Pyx_GIVEREF(__pyx_n_s_PickleError);
8628 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
8629 __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)
8630 __Pyx_GOTREF(__pyx_t_3);
8631 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8632 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
8633 __Pyx_GOTREF(__pyx_t_2);
8634 __Pyx_INCREF(__pyx_t_2);
8635 __pyx_v___pyx_PickleError = __pyx_t_2;
8636 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8637 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8639 /* "(tree fragment)":6
8640 * if __pyx_checksum != 0x1d4a0fa:
8641 * from pickle import PickleError as __pyx_PickleError
8642 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum) # <<<<<<<<<<<<<<
8643 * __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8644 * if __pyx_state is not None:
8646 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
8647 __Pyx_GOTREF(__pyx_t_2);
8648 __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)
8649 __Pyx_GOTREF(__pyx_t_4);
8650 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8651 __Pyx_INCREF(__pyx_v___pyx_PickleError);
8652 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
8653 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
8654 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
8655 if (likely(__pyx_t_5)) {
8656 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8657 __Pyx_INCREF(__pyx_t_5);
8658 __Pyx_INCREF(function);
8659 __Pyx_DECREF_SET(__pyx_t_2, function);
8662 __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);
8663 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8664 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8665 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
8666 __Pyx_GOTREF(__pyx_t_3);
8667 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8668 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8669 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8670 __PYX_ERR(1, 6, __pyx_L1_error)
8672 /* "(tree fragment)":4
8673 * cdef object __pyx_PickleError
8674 * cdef object __pyx_result
8675 * if __pyx_checksum != 0x1d4a0fa: # <<<<<<<<<<<<<<
8676 * from pickle import PickleError as __pyx_PickleError
8677 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8681 /* "(tree fragment)":7
8682 * from pickle import PickleError as __pyx_PickleError
8683 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8684 * __pyx_result = ElementTreeProducer.__new__(__pyx_type) # <<<<<<<<<<<<<<
8685 * if __pyx_state is not None:
8686 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8688 __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)
8689 __Pyx_GOTREF(__pyx_t_2);
8691 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8692 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
8693 if (likely(__pyx_t_4)) {
8694 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8695 __Pyx_INCREF(__pyx_t_4);
8696 __Pyx_INCREF(function);
8697 __Pyx_DECREF_SET(__pyx_t_2, function);
8700 __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);
8701 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8702 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
8703 __Pyx_GOTREF(__pyx_t_3);
8704 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8705 __pyx_v___pyx_result = __pyx_t_3;
8708 /* "(tree fragment)":8
8709 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8710 * __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8711 * if __pyx_state is not None: # <<<<<<<<<<<<<<
8712 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8713 * return __pyx_result
8715 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
8716 __pyx_t_6 = (__pyx_t_1 != 0);
8719 /* "(tree fragment)":9
8720 * __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8721 * if __pyx_state is not None:
8722 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
8723 * return __pyx_result
8724 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8726 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)
8727 __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)
8728 __Pyx_GOTREF(__pyx_t_3);
8729 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8731 /* "(tree fragment)":8
8732 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x1d4a0fa = (_attr_class, _content_handler, _element, _empty_attributes))" % __pyx_checksum)
8733 * __pyx_result = ElementTreeProducer.__new__(__pyx_type)
8734 * if __pyx_state is not None: # <<<<<<<<<<<<<<
8735 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8736 * return __pyx_result
8740 /* "(tree fragment)":10
8741 * if __pyx_state is not None:
8742 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8743 * return __pyx_result # <<<<<<<<<<<<<<
8744 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8745 * __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]
8747 __Pyx_XDECREF(__pyx_r);
8748 __Pyx_INCREF(__pyx_v___pyx_result);
8749 __pyx_r = __pyx_v___pyx_result;
8752 /* "(tree fragment)":1
8753 * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
8754 * cdef object __pyx_PickleError
8755 * cdef object __pyx_result
8758 /* function exit code */
8760 __Pyx_XDECREF(__pyx_t_2);
8761 __Pyx_XDECREF(__pyx_t_3);
8762 __Pyx_XDECREF(__pyx_t_4);
8763 __Pyx_XDECREF(__pyx_t_5);
8764 __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8767 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
8768 __Pyx_XDECREF(__pyx_v___pyx_result);
8769 __Pyx_XGIVEREF(__pyx_r);
8770 __Pyx_RefNannyFinishContext();
8774 /* "(tree fragment)":11
8775 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8776 * return __pyx_result
8777 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
8778 * __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]
8779 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8782 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) {
8783 PyObject *__pyx_r = NULL;
8784 __Pyx_RefNannyDeclarations
8785 PyObject *__pyx_t_1 = NULL;
8787 Py_ssize_t __pyx_t_3;
8790 PyObject *__pyx_t_6 = NULL;
8791 PyObject *__pyx_t_7 = NULL;
8792 PyObject *__pyx_t_8 = NULL;
8793 int __pyx_lineno = 0;
8794 const char *__pyx_filename = NULL;
8795 int __pyx_clineno = 0;
8796 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementTreeProducer__set_state", 0);
8798 /* "(tree fragment)":12
8799 * return __pyx_result
8800 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8801 * __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] # <<<<<<<<<<<<<<
8802 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8803 * __pyx_result.__dict__.update(__pyx_state[4])
8805 if (unlikely(__pyx_v___pyx_state == Py_None)) {
8806 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8807 __PYX_ERR(1, 12, __pyx_L1_error)
8809 __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)
8810 __Pyx_GOTREF(__pyx_t_1);
8811 __Pyx_GIVEREF(__pyx_t_1);
8812 __Pyx_GOTREF(__pyx_v___pyx_result->_attr_class);
8813 __Pyx_DECREF(__pyx_v___pyx_result->_attr_class);
8814 __pyx_v___pyx_result->_attr_class = __pyx_t_1;
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, 1, 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->_content_handler);
8824 __Pyx_DECREF(__pyx_v___pyx_result->_content_handler);
8825 __pyx_v___pyx_result->_content_handler = __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, 2, 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->_element);
8835 __Pyx_DECREF(__pyx_v___pyx_result->_element);
8836 __pyx_v___pyx_result->_element = __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, 3, 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->_empty_attributes);
8846 __Pyx_DECREF(__pyx_v___pyx_result->_empty_attributes);
8847 __pyx_v___pyx_result->_empty_attributes = __pyx_t_1;
8850 /* "(tree fragment)":13
8851 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8852 * __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]
8853 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
8854 * __pyx_result.__dict__.update(__pyx_state[4])
8856 if (unlikely(__pyx_v___pyx_state == Py_None)) {
8857 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8858 __PYX_ERR(1, 13, __pyx_L1_error)
8860 __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)
8861 __pyx_t_4 = ((__pyx_t_3 > 4) != 0);
8864 __pyx_t_2 = __pyx_t_4;
8865 goto __pyx_L4_bool_binop_done;
8867 __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)
8868 __pyx_t_5 = (__pyx_t_4 != 0);
8869 __pyx_t_2 = __pyx_t_5;
8870 __pyx_L4_bool_binop_done:;
8873 /* "(tree fragment)":14
8874 * __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]
8875 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8876 * __pyx_result.__dict__.update(__pyx_state[4]) # <<<<<<<<<<<<<<
8878 __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)
8879 __Pyx_GOTREF(__pyx_t_6);
8880 __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)
8881 __Pyx_GOTREF(__pyx_t_7);
8882 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8883 if (unlikely(__pyx_v___pyx_state == Py_None)) {
8884 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8885 __PYX_ERR(1, 14, __pyx_L1_error)
8887 __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)
8888 __Pyx_GOTREF(__pyx_t_6);
8890 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
8891 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
8892 if (likely(__pyx_t_8)) {
8893 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8894 __Pyx_INCREF(__pyx_t_8);
8895 __Pyx_INCREF(function);
8896 __Pyx_DECREF_SET(__pyx_t_7, function);
8899 __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);
8900 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8901 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8902 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
8903 __Pyx_GOTREF(__pyx_t_1);
8904 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8905 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8907 /* "(tree fragment)":13
8908 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state):
8909 * __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]
8910 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
8911 * __pyx_result.__dict__.update(__pyx_state[4])
8915 /* "(tree fragment)":11
8916 * __pyx_unpickle_ElementTreeProducer__set_state(<ElementTreeProducer> __pyx_result, __pyx_state)
8917 * return __pyx_result
8918 * cdef __pyx_unpickle_ElementTreeProducer__set_state(ElementTreeProducer __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
8919 * __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]
8920 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8923 /* function exit code */
8924 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8927 __Pyx_XDECREF(__pyx_t_1);
8928 __Pyx_XDECREF(__pyx_t_6);
8929 __Pyx_XDECREF(__pyx_t_7);
8930 __Pyx_XDECREF(__pyx_t_8);
8931 __Pyx_AddTraceback("lxml.sax.__pyx_unpickle_ElementTreeProducer__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
8934 __Pyx_XGIVEREF(__pyx_r);
8935 __Pyx_RefNannyFinishContext();
8938 static struct __pyx_vtabstruct_4lxml_3sax_ElementTreeProducer __pyx_vtable_4lxml_3sax_ElementTreeProducer;
8940 static PyObject *__pyx_tp_new_4lxml_3sax_ElementTreeProducer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8941 struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p;
8943 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
8944 o = (*t->tp_alloc)(t, 0);
8946 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
8948 if (unlikely(!o)) return 0;
8949 p = ((struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o);
8950 p->__pyx_vtab = __pyx_vtabptr_4lxml_3sax_ElementTreeProducer;
8951 p->_element = Py_None; Py_INCREF(Py_None);
8952 p->_content_handler = Py_None; Py_INCREF(Py_None);
8953 p->_attr_class = Py_None; Py_INCREF(Py_None);
8954 p->_empty_attributes = Py_None; Py_INCREF(Py_None);
8958 static void __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer(PyObject *o) {
8959 struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8960 #if CYTHON_USE_TP_FINALIZE
8961 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
8962 if (PyObject_CallFinalizerFromDealloc(o)) return;
8965 PyObject_GC_UnTrack(o);
8966 Py_CLEAR(p->_element);
8967 Py_CLEAR(p->_content_handler);
8968 Py_CLEAR(p->_attr_class);
8969 Py_CLEAR(p->_empty_attributes);
8970 (*Py_TYPE(o)->tp_free)(o);
8973 static int __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer(PyObject *o, visitproc v, void *a) {
8975 struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8977 e = (*v)(p->_element, a); if (e) return e;
8979 if (p->_content_handler) {
8980 e = (*v)(p->_content_handler, a); if (e) return e;
8982 if (p->_attr_class) {
8983 e = (*v)(p->_attr_class, a); if (e) return e;
8985 if (p->_empty_attributes) {
8986 e = (*v)(p->_empty_attributes, a); if (e) return e;
8991 static int __pyx_tp_clear_4lxml_3sax_ElementTreeProducer(PyObject *o) {
8992 struct __pyx_obj_4lxml_3sax_ElementTreeProducer *p = (struct __pyx_obj_4lxml_3sax_ElementTreeProducer *)o;
8993 Py_CLEAR(p->_element);
8994 Py_CLEAR(p->_content_handler);
8995 Py_CLEAR(p->_attr_class);
8996 Py_CLEAR(p->_empty_attributes);
9000 static PyMethodDef __pyx_methods_4lxml_3sax_ElementTreeProducer[] = {
9001 {"saxify", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_3saxify, METH_NOARGS, 0},
9002 {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_5__reduce_cython__, METH_NOARGS, 0},
9003 {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_3sax_19ElementTreeProducer_7__setstate_cython__, METH_O, 0},
9007 static PyTypeObject __pyx_type_4lxml_3sax_ElementTreeProducer = {
9008 PyVarObject_HEAD_INIT(0, 0)
9009 "lxml.sax.ElementTreeProducer", /*tp_name*/
9010 sizeof(struct __pyx_obj_4lxml_3sax_ElementTreeProducer), /*tp_basicsize*/
9012 __pyx_tp_dealloc_4lxml_3sax_ElementTreeProducer, /*tp_dealloc*/
9013 #if PY_VERSION_HEX < 0x030800b4
9016 #if PY_VERSION_HEX >= 0x030800b4
9017 0, /*tp_vectorcall_offset*/
9021 #if PY_MAJOR_VERSION < 3
9024 #if PY_MAJOR_VERSION >= 3
9029 0, /*tp_as_sequence*/
9030 0, /*tp_as_mapping*/
9037 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9038 "Produces SAX events for an element and children.\n ", /*tp_doc*/
9039 __pyx_tp_traverse_4lxml_3sax_ElementTreeProducer, /*tp_traverse*/
9040 __pyx_tp_clear_4lxml_3sax_ElementTreeProducer, /*tp_clear*/
9041 0, /*tp_richcompare*/
9042 0, /*tp_weaklistoffset*/
9045 __pyx_methods_4lxml_3sax_ElementTreeProducer, /*tp_methods*/
9052 0, /*tp_dictoffset*/
9053 __pyx_pw_4lxml_3sax_19ElementTreeProducer_1__init__, /*tp_init*/
9055 __pyx_tp_new_4lxml_3sax_ElementTreeProducer, /*tp_new*/
9061 0, /*tp_subclasses*/
9064 0, /*tp_version_tag*/
9065 #if PY_VERSION_HEX >= 0x030400a1
9068 #if PY_VERSION_HEX >= 0x030800b1
9069 0, /*tp_vectorcall*/
9071 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9076 static PyMethodDef __pyx_methods[] = {
9080 #if PY_MAJOR_VERSION >= 3
9081 #if CYTHON_PEP489_MULTI_PHASE_INIT
9082 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9083 static int __pyx_pymod_exec_sax(PyObject* module); /*proto*/
9084 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9085 {Py_mod_create, (void*)__pyx_pymod_create},
9086 {Py_mod_exec, (void*)__pyx_pymod_exec_sax},
9091 static struct PyModuleDef __pyx_moduledef = {
9092 PyModuleDef_HEAD_INIT,
9094 __pyx_k_SAX_based_adapter_to_copy_trees, /* m_doc */
9095 #if CYTHON_PEP489_MULTI_PHASE_INIT
9100 __pyx_methods /* m_methods */,
9101 #if CYTHON_PEP489_MULTI_PHASE_INIT
9102 __pyx_moduledef_slots, /* m_slots */
9104 NULL, /* m_reload */
9106 NULL, /* m_traverse */
9108 (freefunc)__pyx_module_cleanup /* m_free */
9111 #ifndef CYTHON_SMALL_CODE
9112 #if defined(__clang__)
9113 #define CYTHON_SMALL_CODE
9114 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9115 #define CYTHON_SMALL_CODE __attribute__((cold))
9117 #define CYTHON_SMALL_CODE
9121 static __Pyx_StringTabEntry __pyx_string_tab[] = {
9122 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
9123 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
9124 {&__pyx_n_s_AttributesNSImpl, __pyx_k_AttributesNSImpl, sizeof(__pyx_k_AttributesNSImpl), 0, 0, 1, 1},
9125 {&__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},
9126 {&__pyx_n_s_Comment, __pyx_k_Comment, sizeof(__pyx_k_Comment), 0, 0, 1, 1},
9127 {&__pyx_n_s_ContentHandler, __pyx_k_ContentHandler, sizeof(__pyx_k_ContentHandler), 0, 0, 1, 1},
9128 {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
9129 {&__pyx_n_s_ElementTree, __pyx_k_ElementTree, sizeof(__pyx_k_ElementTree), 0, 0, 1, 1},
9130 {&__pyx_n_s_ElementTreeContentHandler, __pyx_k_ElementTreeContentHandler, sizeof(__pyx_k_ElementTreeContentHandler), 0, 0, 1, 1},
9131 {&__pyx_n_s_ElementTreeContentHandler___init, __pyx_k_ElementTreeContentHandler___init, sizeof(__pyx_k_ElementTreeContentHandler___init), 0, 0, 1, 1},
9132 {&__pyx_n_s_ElementTreeContentHandler__build, __pyx_k_ElementTreeContentHandler__build, sizeof(__pyx_k_ElementTreeContentHandler__build), 0, 0, 1, 1},
9133 {&__pyx_n_s_ElementTreeContentHandler__get_e, __pyx_k_ElementTreeContentHandler__get_e, sizeof(__pyx_k_ElementTreeContentHandler__get_e), 0, 0, 1, 1},
9134 {&__pyx_n_s_ElementTreeContentHandler_charac, __pyx_k_ElementTreeContentHandler_charac, sizeof(__pyx_k_ElementTreeContentHandler_charac), 0, 0, 1, 1},
9135 {&__pyx_n_s_ElementTreeContentHandler_endDoc, __pyx_k_ElementTreeContentHandler_endDoc, sizeof(__pyx_k_ElementTreeContentHandler_endDoc), 0, 0, 1, 1},
9136 {&__pyx_n_s_ElementTreeContentHandler_endEle, __pyx_k_ElementTreeContentHandler_endEle, sizeof(__pyx_k_ElementTreeContentHandler_endEle), 0, 0, 1, 1},
9137 {&__pyx_n_s_ElementTreeContentHandler_endEle_2, __pyx_k_ElementTreeContentHandler_endEle_2, sizeof(__pyx_k_ElementTreeContentHandler_endEle_2), 0, 0, 1, 1},
9138 {&__pyx_n_s_ElementTreeContentHandler_endPre, __pyx_k_ElementTreeContentHandler_endPre, sizeof(__pyx_k_ElementTreeContentHandler_endPre), 0, 0, 1, 1},
9139 {&__pyx_n_s_ElementTreeContentHandler_proces, __pyx_k_ElementTreeContentHandler_proces, sizeof(__pyx_k_ElementTreeContentHandler_proces), 0, 0, 1, 1},
9140 {&__pyx_n_s_ElementTreeContentHandler_setDoc, __pyx_k_ElementTreeContentHandler_setDoc, sizeof(__pyx_k_ElementTreeContentHandler_setDoc), 0, 0, 1, 1},
9141 {&__pyx_n_s_ElementTreeContentHandler_startD, __pyx_k_ElementTreeContentHandler_startD, sizeof(__pyx_k_ElementTreeContentHandler_startD), 0, 0, 1, 1},
9142 {&__pyx_n_s_ElementTreeContentHandler_startE, __pyx_k_ElementTreeContentHandler_startE, sizeof(__pyx_k_ElementTreeContentHandler_startE), 0, 0, 1, 1},
9143 {&__pyx_n_s_ElementTreeContentHandler_startE_2, __pyx_k_ElementTreeContentHandler_startE_2, sizeof(__pyx_k_ElementTreeContentHandler_startE_2), 0, 0, 1, 1},
9144 {&__pyx_n_s_ElementTreeContentHandler_startP, __pyx_k_ElementTreeContentHandler_startP, sizeof(__pyx_k_ElementTreeContentHandler_startP), 0, 0, 1, 1},
9145 {&__pyx_n_s_ElementTreeProducer, __pyx_k_ElementTreeProducer, sizeof(__pyx_k_ElementTreeProducer), 0, 0, 1, 1},
9146 {&__pyx_n_s_ElementTreeProducer___reduce_cyt, __pyx_k_ElementTreeProducer___reduce_cyt, sizeof(__pyx_k_ElementTreeProducer___reduce_cyt), 0, 0, 1, 1},
9147 {&__pyx_n_s_ElementTreeProducer___setstate_c, __pyx_k_ElementTreeProducer___setstate_c, sizeof(__pyx_k_ElementTreeProducer___setstate_c), 0, 0, 1, 1},
9148 {&__pyx_n_s_ElementTreeProducer_saxify, __pyx_k_ElementTreeProducer_saxify, sizeof(__pyx_k_ElementTreeProducer_saxify), 0, 0, 1, 1},
9149 {&__pyx_kp_s_General_SAX_error, __pyx_k_General_SAX_error, sizeof(__pyx_k_General_SAX_error), 0, 0, 1, 0},
9150 {&__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},
9151 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
9152 {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
9153 {&__pyx_n_s_LxmlError, __pyx_k_LxmlError, sizeof(__pyx_k_LxmlError), 0, 0, 1, 1},
9154 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9155 {&__pyx_n_s_ProcessingInstruction, __pyx_k_ProcessingInstruction, sizeof(__pyx_k_ProcessingInstruction), 0, 0, 1, 1},
9156 {&__pyx_n_s_SaxError, __pyx_k_SaxError, sizeof(__pyx_k_SaxError), 0, 0, 1, 1},
9157 {&__pyx_n_s_SubElement, __pyx_k_SubElement, sizeof(__pyx_k_SubElement), 0, 0, 1, 1},
9158 {&__pyx_kp_s_Unexpected_element_closed, __pyx_k_Unexpected_element_closed, sizeof(__pyx_k_Unexpected_element_closed), 0, 0, 1, 0},
9159 {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
9160 {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
9161 {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
9162 {&__pyx_n_s_addprevious, __pyx_k_addprevious, sizeof(__pyx_k_addprevious), 0, 0, 1, 1},
9163 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
9164 {&__pyx_n_s_attr_name, __pyx_k_attr_name, sizeof(__pyx_k_attr_name), 0, 0, 1, 1},
9165 {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
9166 {&__pyx_n_s_attrs, __pyx_k_attrs, sizeof(__pyx_k_attrs), 0, 0, 1, 1},
9167 {&__pyx_n_s_buildTag, __pyx_k_buildTag, sizeof(__pyx_k_buildTag), 0, 0, 1, 1},
9168 {&__pyx_n_s_characters, __pyx_k_characters, sizeof(__pyx_k_characters), 0, 0, 1, 1},
9169 {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
9170 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9171 {&__pyx_n_s_content_handler, __pyx_k_content_handler, sizeof(__pyx_k_content_handler), 0, 0, 1, 1},
9172 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
9173 {&__pyx_n_s_default_ns, __pyx_k_default_ns, sizeof(__pyx_k_default_ns), 0, 0, 1, 1},
9174 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9175 {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
9176 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9177 {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1},
9178 {&__pyx_n_s_el_name, __pyx_k_el_name, sizeof(__pyx_k_el_name), 0, 0, 1, 1},
9179 {&__pyx_n_s_el_tag, __pyx_k_el_tag, sizeof(__pyx_k_el_tag), 0, 0, 1, 1},
9180 {&__pyx_n_s_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 0, 1, 1},
9181 {&__pyx_n_s_element_or_tree, __pyx_k_element_or_tree, sizeof(__pyx_k_element_or_tree), 0, 0, 1, 1},
9182 {&__pyx_n_s_element_stack, __pyx_k_element_stack, sizeof(__pyx_k_element_stack), 0, 0, 1, 1},
9183 {&__pyx_n_s_element_stack_2, __pyx_k_element_stack_2, sizeof(__pyx_k_element_stack_2), 0, 0, 1, 1},
9184 {&__pyx_n_s_endDocument, __pyx_k_endDocument, sizeof(__pyx_k_endDocument), 0, 0, 1, 1},
9185 {&__pyx_n_s_endElement, __pyx_k_endElement, sizeof(__pyx_k_endElement), 0, 0, 1, 1},
9186 {&__pyx_n_s_endElementNS, __pyx_k_endElementNS, sizeof(__pyx_k_endElementNS), 0, 0, 1, 1},
9187 {&__pyx_n_s_endPrefixMapping, __pyx_k_endPrefixMapping, sizeof(__pyx_k_endPrefixMapping), 0, 0, 1, 1},
9188 {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
9189 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
9190 {&__pyx_n_s_get_etree, __pyx_k_get_etree, sizeof(__pyx_k_get_etree), 0, 0, 1, 1},
9191 {&__pyx_n_s_getnext, __pyx_k_getnext, sizeof(__pyx_k_getnext), 0, 0, 1, 1},
9192 {&__pyx_n_s_getprevious, __pyx_k_getprevious, sizeof(__pyx_k_getprevious), 0, 0, 1, 1},
9193 {&__pyx_n_s_getroot, __pyx_k_getroot, sizeof(__pyx_k_getroot), 0, 0, 1, 1},
9194 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9195 {&__pyx_n_s_ignorableWhitespace, __pyx_k_ignorableWhitespace, sizeof(__pyx_k_ignorableWhitespace), 0, 0, 1, 1},
9196 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9197 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
9198 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
9199 {&__pyx_n_s_iter_attributes, __pyx_k_iter_attributes, sizeof(__pyx_k_iter_attributes), 0, 0, 1, 1},
9200 {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
9201 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
9202 {&__pyx_n_s_last_element, __pyx_k_last_element, sizeof(__pyx_k_last_element), 0, 0, 1, 1},
9203 {&__pyx_n_s_local_name, __pyx_k_local_name, sizeof(__pyx_k_local_name), 0, 0, 1, 1},
9204 {&__pyx_n_s_locator, __pyx_k_locator, sizeof(__pyx_k_locator), 0, 0, 1, 1},
9205 {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
9206 {&__pyx_n_s_lxml_etree, __pyx_k_lxml_etree, sizeof(__pyx_k_lxml_etree), 0, 0, 1, 1},
9207 {&__pyx_n_s_lxml_sax, __pyx_k_lxml_sax, sizeof(__pyx_k_lxml_sax), 0, 0, 1, 1},
9208 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9209 {&__pyx_n_s_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 0, 0, 1, 1},
9210 {&__pyx_n_s_makeelement_2, __pyx_k_makeelement_2, sizeof(__pyx_k_makeelement_2), 0, 0, 1, 1},
9211 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9212 {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
9213 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9214 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9215 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
9216 {&__pyx_n_s_name_tuple, __pyx_k_name_tuple, sizeof(__pyx_k_name_tuple), 0, 0, 1, 1},
9217 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9218 {&__pyx_n_s_new_mappings, __pyx_k_new_mappings, sizeof(__pyx_k_new_mappings), 0, 0, 1, 1},
9219 {&__pyx_n_s_ns_mapping, __pyx_k_ns_mapping, sizeof(__pyx_k_ns_mapping), 0, 0, 1, 1},
9220 {&__pyx_n_s_ns_name, __pyx_k_ns_name, sizeof(__pyx_k_ns_name), 0, 0, 1, 1},
9221 {&__pyx_n_s_ns_name_tuple, __pyx_k_ns_name_tuple, sizeof(__pyx_k_ns_name_tuple), 0, 0, 1, 1},
9222 {&__pyx_n_s_ns_uri, __pyx_k_ns_uri, sizeof(__pyx_k_ns_uri), 0, 0, 1, 1},
9223 {&__pyx_n_s_ns_uri_list, __pyx_k_ns_uri_list, sizeof(__pyx_k_ns_uri_list), 0, 0, 1, 1},
9224 {&__pyx_n_s_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 0, 0, 1, 1},
9225 {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
9226 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9227 {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
9228 {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
9229 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9230 {&__pyx_n_s_processingInstruction, __pyx_k_processingInstruction, sizeof(__pyx_k_processingInstruction), 0, 0, 1, 1},
9231 {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
9232 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9233 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9234 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9235 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9236 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9237 {&__pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_k_pyx_unpickle_ElementTreeProduc, sizeof(__pyx_k_pyx_unpickle_ElementTreeProduc), 0, 0, 1, 1},
9238 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
9239 {&__pyx_n_s_qname, __pyx_k_qname, sizeof(__pyx_k_qname), 0, 0, 1, 1},
9240 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9241 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9242 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9243 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9244 {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
9245 {&__pyx_n_s_root_siblings, __pyx_k_root_siblings, sizeof(__pyx_k_root_siblings), 0, 0, 1, 1},
9246 {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
9247 {&__pyx_n_s_saxify, __pyx_k_saxify, sizeof(__pyx_k_saxify), 0, 0, 1, 1},
9248 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9249 {&__pyx_n_s_setDocumentLocator, __pyx_k_setDocumentLocator, sizeof(__pyx_k_setDocumentLocator), 0, 0, 1, 1},
9250 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9251 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9252 {&__pyx_n_s_sibling, __pyx_k_sibling, sizeof(__pyx_k_sibling), 0, 0, 1, 1},
9253 {&__pyx_n_s_siblings, __pyx_k_siblings, sizeof(__pyx_k_siblings), 0, 0, 1, 1},
9254 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
9255 {&__pyx_kp_s_src_lxml_sax_py, __pyx_k_src_lxml_sax_py, sizeof(__pyx_k_src_lxml_sax_py), 0, 0, 1, 0},
9256 {&__pyx_n_s_startDocument, __pyx_k_startDocument, sizeof(__pyx_k_startDocument), 0, 0, 1, 1},
9257 {&__pyx_n_s_startElement, __pyx_k_startElement, sizeof(__pyx_k_startElement), 0, 0, 1, 1},
9258 {&__pyx_n_s_startElementNS, __pyx_k_startElementNS, sizeof(__pyx_k_startElementNS), 0, 0, 1, 1},
9259 {&__pyx_n_s_startPrefixMapping, __pyx_k_startPrefixMapping, sizeof(__pyx_k_startPrefixMapping), 0, 0, 1, 1},
9260 {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9261 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9262 {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
9263 {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
9264 {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
9265 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9266 {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
9267 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9268 {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
9269 {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
9270 {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
9271 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9272 {&__pyx_n_s_xml_sax_handler, __pyx_k_xml_sax_handler, sizeof(__pyx_k_xml_sax_handler), 0, 0, 1, 1},
9273 {&__pyx_n_s_xml_sax_xmlreader, __pyx_k_xml_sax_xmlreader, sizeof(__pyx_k_xml_sax_xmlreader), 0, 0, 1, 1},
9274 {0, 0, 0, 0, 0, 0, 0}
9276 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9277 __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 54, __pyx_L1_error)
9278 __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 69, __pyx_L1_error)
9279 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 96, __pyx_L1_error)
9280 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 152, __pyx_L1_error)
9281 __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 264, __pyx_L1_error)
9287 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9288 __Pyx_RefNannyDeclarations
9289 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9292 * def _getNsTag(tag):
9294 * return tuple(tag[1:].split('}', 1)) # <<<<<<<<<<<<<<
9298 __pyx_slice__2 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 30, __pyx_L1_error)
9299 __Pyx_GOTREF(__pyx_slice__2);
9300 __Pyx_GIVEREF(__pyx_slice__2);
9301 __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)
9302 __Pyx_GOTREF(__pyx_tuple__4);
9303 __Pyx_GIVEREF(__pyx_tuple__4);
9305 /* "lxml/sax.py":115
9306 * for sibling in self._root_siblings:
9307 * element.addprevious(sibling)
9308 * del self._root_siblings[:] # <<<<<<<<<<<<<<
9310 * element = SubElement(element_stack[-1], el_name,
9312 __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 115, __pyx_L1_error)
9313 __Pyx_GOTREF(__pyx_slice__5);
9314 __Pyx_GIVEREF(__pyx_slice__5);
9316 /* "lxml/sax.py":183
9317 * siblings.append(sibling)
9318 * sibling = sibling.getprevious()
9319 * for sibling in siblings[::-1]: # <<<<<<<<<<<<<<
9320 * self._recursive_saxify(sibling, {})
9323 __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)
9324 __Pyx_GOTREF(__pyx_slice__7);
9325 __Pyx_GIVEREF(__pyx_slice__7);
9328 * """Build an lxml ElementTree from SAX events.
9330 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
9331 * ContentHandler.__init__(self)
9334 __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)
9335 __Pyx_GOTREF(__pyx_tuple__9);
9336 __Pyx_GIVEREF(__pyx_tuple__9);
9337 __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)
9338 __pyx_tuple__11 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 38, __pyx_L1_error)
9339 __Pyx_GOTREF(__pyx_tuple__11);
9340 __Pyx_GIVEREF(__pyx_tuple__11);
9343 * self._makeelement = makeelement
9345 * def _get_etree(self): # <<<<<<<<<<<<<<
9346 * "Contains the generated ElementTree after parsing is finished."
9347 * return ElementTree(self._root)
9349 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 50, __pyx_L1_error)
9350 __Pyx_GOTREF(__pyx_tuple__12);
9351 __Pyx_GIVEREF(__pyx_tuple__12);
9352 __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)
9355 * etree = property(_get_etree, doc=_get_etree.__doc__)
9357 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
9361 __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)
9362 __Pyx_GOTREF(__pyx_tuple__14);
9363 __Pyx_GIVEREF(__pyx_tuple__14);
9364 __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)
9369 * def startDocument(self): # <<<<<<<<<<<<<<
9373 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 59, __pyx_L1_error)
9374 __Pyx_GOTREF(__pyx_tuple__16);
9375 __Pyx_GIVEREF(__pyx_tuple__16);
9376 __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)
9381 * def endDocument(self): # <<<<<<<<<<<<<<
9385 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 62, __pyx_L1_error)
9386 __Pyx_GOTREF(__pyx_tuple__18);
9387 __Pyx_GIVEREF(__pyx_tuple__18);
9388 __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)
9393 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
9394 * self._new_mappings[prefix] = uri
9397 __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)
9398 __Pyx_GOTREF(__pyx_tuple__20);
9399 __Pyx_GIVEREF(__pyx_tuple__20);
9400 __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)
9403 * self._default_ns = uri
9405 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
9406 * ns_uri_list = self._ns_mapping[prefix]
9409 __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)
9410 __Pyx_GOTREF(__pyx_tuple__22);
9411 __Pyx_GIVEREF(__pyx_tuple__22);
9412 __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)
9415 * self._default_ns = ns_uri_list[-1]
9417 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
9418 * ns_uri, local_name = ns_name_tuple
9421 __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)
9422 __Pyx_GOTREF(__pyx_tuple__24);
9423 __Pyx_GIVEREF(__pyx_tuple__24);
9424 __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)
9429 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
9430 * el_name = self._buildTag(ns_name)
9433 __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)
9434 __Pyx_GOTREF(__pyx_tuple__26);
9435 __Pyx_GIVEREF(__pyx_tuple__26);
9436 __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)
9437 __pyx_tuple__28 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 90, __pyx_L1_error)
9438 __Pyx_GOTREF(__pyx_tuple__28);
9439 __Pyx_GIVEREF(__pyx_tuple__28);
9441 /* "lxml/sax.py":123
9442 * self._new_mappings.clear()
9444 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
9445 * pi = ProcessingInstruction(target, data)
9446 * if self._root is None:
9448 __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)
9449 __Pyx_GOTREF(__pyx_tuple__29);
9450 __Pyx_GIVEREF(__pyx_tuple__29);
9451 __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)
9453 /* "lxml/sax.py":130
9454 * self._element_stack[-1].append(pi)
9456 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
9457 * element = self._element_stack.pop()
9458 * el_tag = self._buildTag(ns_name)
9460 __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)
9461 __Pyx_GOTREF(__pyx_tuple__31);
9462 __Pyx_GIVEREF(__pyx_tuple__31);
9463 __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)
9465 /* "lxml/sax.py":136
9466 * raise SaxError("Unexpected element closed: " + el_tag)
9468 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
9470 * attributes = dict(
9472 __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)
9473 __Pyx_GOTREF(__pyx_tuple__33);
9474 __Pyx_GIVEREF(__pyx_tuple__33);
9475 __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)
9476 __pyx_tuple__35 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error)
9477 __Pyx_GOTREF(__pyx_tuple__35);
9478 __Pyx_GIVEREF(__pyx_tuple__35);
9480 /* "lxml/sax.py":143
9481 * self.startElementNS((None, name), name, attributes)
9483 * def endElement(self, name): # <<<<<<<<<<<<<<
9484 * self.endElementNS((None, name), name)
9487 __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)
9488 __Pyx_GOTREF(__pyx_tuple__36);
9489 __Pyx_GIVEREF(__pyx_tuple__36);
9490 __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)
9492 /* "lxml/sax.py":146
9493 * self.endElementNS((None, name), name)
9495 * def characters(self, data): # <<<<<<<<<<<<<<
9496 * last_element = self._element_stack[-1]
9499 __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)
9500 __Pyx_GOTREF(__pyx_tuple__38);
9501 __Pyx_GIVEREF(__pyx_tuple__38);
9502 __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)
9504 /* "lxml/sax.py":173
9505 * self._empty_attributes = attr_class({}, {})
9507 * def saxify(self): # <<<<<<<<<<<<<<
9508 * self._content_handler.startDocument()
9511 __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)
9512 __Pyx_GOTREF(__pyx_tuple__40);
9513 __Pyx_GIVEREF(__pyx_tuple__40);
9514 __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)
9516 /* "(tree fragment)":1
9517 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9521 __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)
9522 __Pyx_GOTREF(__pyx_tuple__42);
9523 __Pyx_GIVEREF(__pyx_tuple__42);
9524 __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)
9526 /* "(tree fragment)":16
9528 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
9529 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9530 * __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
9532 __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)
9533 __Pyx_GOTREF(__pyx_tuple__44);
9534 __Pyx_GIVEREF(__pyx_tuple__44);
9535 __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)
9537 /* "lxml/sax.py":274
9540 * def saxify(element_or_tree, content_handler): # <<<<<<<<<<<<<<
9541 * """One-shot helper to generate SAX events from an XML tree and fire
9542 * them against a SAX ContentHandler.
9544 __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)
9545 __Pyx_GOTREF(__pyx_tuple__46);
9546 __Pyx_GIVEREF(__pyx_tuple__46);
9547 __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)
9549 /* "(tree fragment)":1
9550 * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
9551 * cdef object __pyx_PickleError
9552 * cdef object __pyx_result
9554 __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)
9555 __Pyx_GOTREF(__pyx_tuple__48);
9556 __Pyx_GIVEREF(__pyx_tuple__48);
9557 __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)
9558 __Pyx_RefNannyFinishContext();
9561 __Pyx_RefNannyFinishContext();
9565 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9566 __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
9567 __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
9568 __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
9569 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9570 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9571 __pyx_int_30712058 = PyInt_FromLong(30712058L); if (unlikely(!__pyx_int_30712058)) __PYX_ERR(0, 1, __pyx_L1_error)
9572 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9578 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9579 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9580 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9581 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9582 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9583 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9584 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9586 static int __Pyx_modinit_global_init_code(void) {
9587 __Pyx_RefNannyDeclarations
9588 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9589 /*--- Global init code ---*/
9590 __Pyx_RefNannyFinishContext();
9594 static int __Pyx_modinit_variable_export_code(void) {
9595 __Pyx_RefNannyDeclarations
9596 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9597 /*--- Variable export code ---*/
9598 __Pyx_RefNannyFinishContext();
9602 static int __Pyx_modinit_function_export_code(void) {
9603 __Pyx_RefNannyDeclarations
9604 int __pyx_lineno = 0;
9605 const char *__pyx_filename = NULL;
9606 int __pyx_clineno = 0;
9607 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9608 /*--- Function export code ---*/
9609 if (__Pyx_ExportFunction("_getNsTag", (void (*)(void))__pyx_f_4lxml_3sax__getNsTag, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9610 __Pyx_RefNannyFinishContext();
9613 __Pyx_RefNannyFinishContext();
9617 static int __Pyx_modinit_type_init_code(void) {
9618 __Pyx_RefNannyDeclarations
9619 int __pyx_lineno = 0;
9620 const char *__pyx_filename = NULL;
9621 int __pyx_clineno = 0;
9622 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9623 /*--- Type init code ---*/
9624 __pyx_vtabptr_4lxml_3sax_ElementTreeProducer = &__pyx_vtable_4lxml_3sax_ElementTreeProducer;
9625 __pyx_vtable_4lxml_3sax_ElementTreeProducer._recursive_saxify = (PyObject *(*)(struct __pyx_obj_4lxml_3sax_ElementTreeProducer *, PyObject *, PyObject *))__pyx_f_4lxml_3sax_19ElementTreeProducer__recursive_saxify;
9626 __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;
9627 if (PyType_Ready(&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9628 #if PY_VERSION_HEX < 0x030800B1
9629 __pyx_type_4lxml_3sax_ElementTreeProducer.tp_print = 0;
9631 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)) {
9632 __pyx_type_4lxml_3sax_ElementTreeProducer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9634 if (__Pyx_SetVtable(__pyx_type_4lxml_3sax_ElementTreeProducer.tp_dict, __pyx_vtabptr_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9635 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementTreeProducer, (PyObject *)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9636 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lxml_3sax_ElementTreeProducer) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
9637 __pyx_ptype_4lxml_3sax_ElementTreeProducer = &__pyx_type_4lxml_3sax_ElementTreeProducer;
9638 __Pyx_RefNannyFinishContext();
9641 __Pyx_RefNannyFinishContext();
9645 static int __Pyx_modinit_type_import_code(void) {
9646 __Pyx_RefNannyDeclarations
9647 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9648 /*--- Type import code ---*/
9649 __Pyx_RefNannyFinishContext();
9653 static int __Pyx_modinit_variable_import_code(void) {
9654 __Pyx_RefNannyDeclarations
9655 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9656 /*--- Variable import code ---*/
9657 __Pyx_RefNannyFinishContext();
9661 static int __Pyx_modinit_function_import_code(void) {
9662 __Pyx_RefNannyDeclarations
9663 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9664 /*--- Function import code ---*/
9665 __Pyx_RefNannyFinishContext();
9670 #ifndef CYTHON_NO_PYINIT_EXPORT
9671 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9672 #elif PY_MAJOR_VERSION < 3
9674 #define __Pyx_PyMODINIT_FUNC extern "C" void
9676 #define __Pyx_PyMODINIT_FUNC void
9680 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9682 #define __Pyx_PyMODINIT_FUNC PyObject *
9687 #if PY_MAJOR_VERSION < 3
9688 __Pyx_PyMODINIT_FUNC initsax(void) CYTHON_SMALL_CODE; /*proto*/
9689 __Pyx_PyMODINIT_FUNC initsax(void)
9691 __Pyx_PyMODINIT_FUNC PyInit_sax(void) CYTHON_SMALL_CODE; /*proto*/
9692 __Pyx_PyMODINIT_FUNC PyInit_sax(void)
9693 #if CYTHON_PEP489_MULTI_PHASE_INIT
9695 return PyModuleDef_Init(&__pyx_moduledef);
9697 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
9698 #if PY_VERSION_HEX >= 0x030700A1
9699 static PY_INT64_T main_interpreter_id = -1;
9700 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
9701 if (main_interpreter_id == -1) {
9702 main_interpreter_id = current_id;
9703 return (unlikely(current_id == -1)) ? -1 : 0;
9704 } else if (unlikely(main_interpreter_id != current_id))
9706 static PyInterpreterState *main_interpreter = NULL;
9707 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
9708 if (!main_interpreter) {
9709 main_interpreter = current_interpreter;
9710 } else if (unlikely(main_interpreter != current_interpreter))
9715 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
9720 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) {
9721 PyObject *value = PyObject_GetAttrString(spec, from_name);
9723 if (likely(value)) {
9724 if (allow_none || value != Py_None) {
9725 result = PyDict_SetItemString(moddict, to_name, value);
9728 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
9735 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
9736 PyObject *module = NULL, *moddict, *modname;
9737 if (__Pyx_check_single_interpreter())
9740 return __Pyx_NewRef(__pyx_m);
9741 modname = PyObject_GetAttrString(spec, "name");
9742 if (unlikely(!modname)) goto bad;
9743 module = PyModule_NewObject(modname);
9745 if (unlikely(!module)) goto bad;
9746 moddict = PyModule_GetDict(module);
9747 if (unlikely(!moddict)) goto bad;
9748 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
9749 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
9750 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
9751 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
9759 static CYTHON_SMALL_CODE int __pyx_pymod_exec_sax(PyObject *__pyx_pyinit_module)
9763 PyObject *__pyx_t_1 = NULL;
9764 PyObject *__pyx_t_2 = NULL;
9765 PyObject *__pyx_t_3 = NULL;
9766 PyObject *__pyx_t_4 = NULL;
9767 PyObject *__pyx_t_5 = NULL;
9768 PyObject *__pyx_t_6 = NULL;
9769 PyObject *__pyx_t_7 = NULL;
9770 int __pyx_lineno = 0;
9771 const char *__pyx_filename = NULL;
9772 int __pyx_clineno = 0;
9773 __Pyx_RefNannyDeclarations
9774 #if CYTHON_PEP489_MULTI_PHASE_INIT
9776 if (__pyx_m == __pyx_pyinit_module) return 0;
9777 PyErr_SetString(PyExc_RuntimeError, "Module 'sax' has already been imported. Re-initialisation is not supported.");
9780 #elif PY_MAJOR_VERSION >= 3
9781 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
9784 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9785 if (!__Pyx_RefNanny) {
9787 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9788 if (!__Pyx_RefNanny)
9789 Py_FatalError("failed to import 'refnanny' module");
9792 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_sax(void)", 0);
9793 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9794 #ifdef __Pxy_PyFrame_Initialize_Offsets
9795 __Pxy_PyFrame_Initialize_Offsets();
9797 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
9798 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
9799 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
9800 #ifdef __Pyx_CyFunction_USED
9801 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9803 #ifdef __Pyx_FusedFunction_USED
9804 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9806 #ifdef __Pyx_Coroutine_USED
9807 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9809 #ifdef __Pyx_Generator_USED
9810 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9812 #ifdef __Pyx_AsyncGen_USED
9813 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9815 #ifdef __Pyx_StopAsyncIteration_USED
9816 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9818 /*--- Library function declarations ---*/
9819 /*--- Threads initialization code ---*/
9820 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
9821 #ifdef WITH_THREAD /* Python build with threading support? */
9822 PyEval_InitThreads();
9825 /*--- Module creation code ---*/
9826 #if CYTHON_PEP489_MULTI_PHASE_INIT
9827 __pyx_m = __pyx_pyinit_module;
9830 #if PY_MAJOR_VERSION < 3
9831 __pyx_m = Py_InitModule4("sax", __pyx_methods, __pyx_k_SAX_based_adapter_to_copy_trees, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
9833 __pyx_m = PyModule_Create(&__pyx_moduledef);
9835 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
9837 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
9839 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
9841 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
9842 Py_INCREF(__pyx_cython_runtime);
9843 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9844 /*--- Initialize various global constants etc. ---*/
9845 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9846 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
9847 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9849 if (__pyx_module_is_main_lxml__sax) {
9850 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9852 #if PY_MAJOR_VERSION >= 3
9854 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
9855 if (!PyDict_GetItemString(modules, "lxml.sax")) {
9856 if (unlikely(PyDict_SetItemString(modules, "lxml.sax", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9860 /*--- Builtin init code ---*/
9861 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9862 /*--- Constants init code ---*/
9863 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9864 /*--- Global type/function init code ---*/
9865 (void)__Pyx_modinit_global_init_code();
9866 (void)__Pyx_modinit_variable_export_code();
9867 if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9868 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9869 (void)__Pyx_modinit_type_import_code();
9870 (void)__Pyx_modinit_variable_import_code();
9871 (void)__Pyx_modinit_function_import_code();
9872 /*--- Execution code ---*/
9873 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
9874 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9878 * from __future__ import absolute_import
9880 * from xml.sax.handler import ContentHandler # <<<<<<<<<<<<<<
9881 * from lxml import etree
9882 * from lxml.etree import ElementTree, SubElement
9884 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9885 __Pyx_GOTREF(__pyx_t_1);
9886 __Pyx_INCREF(__pyx_n_s_ContentHandler);
9887 __Pyx_GIVEREF(__pyx_n_s_ContentHandler);
9888 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ContentHandler);
9889 __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)
9890 __Pyx_GOTREF(__pyx_t_2);
9891 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9892 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
9893 __Pyx_GOTREF(__pyx_t_1);
9894 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ContentHandler, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
9895 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9896 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9900 * from xml.sax.handler import ContentHandler
9901 * from lxml import etree # <<<<<<<<<<<<<<
9902 * from lxml.etree import ElementTree, SubElement
9903 * from lxml.etree import Comment, ProcessingInstruction
9905 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9906 __Pyx_GOTREF(__pyx_t_2);
9907 __Pyx_INCREF(__pyx_n_s_etree);
9908 __Pyx_GIVEREF(__pyx_n_s_etree);
9909 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_etree);
9910 __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)
9911 __Pyx_GOTREF(__pyx_t_1);
9912 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9913 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
9914 __Pyx_GOTREF(__pyx_t_2);
9915 if (PyDict_SetItem(__pyx_d, __pyx_n_s_etree, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
9916 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9917 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9920 * from xml.sax.handler import ContentHandler
9921 * from lxml import etree
9922 * from lxml.etree import ElementTree, SubElement # <<<<<<<<<<<<<<
9923 * from lxml.etree import Comment, ProcessingInstruction
9926 __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9927 __Pyx_GOTREF(__pyx_t_1);
9928 __Pyx_INCREF(__pyx_n_s_ElementTree);
9929 __Pyx_GIVEREF(__pyx_n_s_ElementTree);
9930 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ElementTree);
9931 __Pyx_INCREF(__pyx_n_s_SubElement);
9932 __Pyx_GIVEREF(__pyx_n_s_SubElement);
9933 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_SubElement);
9934 __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)
9935 __Pyx_GOTREF(__pyx_t_2);
9936 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9937 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ElementTree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9938 __Pyx_GOTREF(__pyx_t_1);
9939 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTree, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9940 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9941 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SubElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
9942 __Pyx_GOTREF(__pyx_t_1);
9943 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SubElement, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
9944 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9945 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9948 * from lxml import etree
9949 * from lxml.etree import ElementTree, SubElement
9950 * from lxml.etree import Comment, ProcessingInstruction # <<<<<<<<<<<<<<
9954 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9955 __Pyx_GOTREF(__pyx_t_2);
9956 __Pyx_INCREF(__pyx_n_s_Comment);
9957 __Pyx_GIVEREF(__pyx_n_s_Comment);
9958 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Comment);
9959 __Pyx_INCREF(__pyx_n_s_ProcessingInstruction);
9960 __Pyx_GIVEREF(__pyx_n_s_ProcessingInstruction);
9961 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ProcessingInstruction);
9962 __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)
9963 __Pyx_GOTREF(__pyx_t_1);
9964 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9965 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Comment); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9966 __Pyx_GOTREF(__pyx_t_2);
9967 if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comment, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9968 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9969 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ProcessingInstruction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
9970 __Pyx_GOTREF(__pyx_t_2);
9971 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProcessingInstruction, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
9972 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9973 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9978 * class SaxError(etree.LxmlError): # <<<<<<<<<<<<<<
9979 * """General SAX error.
9982 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9983 __Pyx_GOTREF(__pyx_t_1);
9984 __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)
9985 __Pyx_GOTREF(__pyx_t_2);
9986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9987 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
9988 __Pyx_GOTREF(__pyx_t_1);
9989 __Pyx_GIVEREF(__pyx_t_2);
9990 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
9992 __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
9993 __Pyx_GOTREF(__pyx_t_2);
9994 __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)
9995 __Pyx_GOTREF(__pyx_t_3);
9996 __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)
9997 __Pyx_GOTREF(__pyx_t_4);
9998 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SaxError, __pyx_t_4) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
9999 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10000 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10001 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10002 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10004 /* "lxml/sax.py":35
10007 * class ElementTreeContentHandler(ContentHandler): # <<<<<<<<<<<<<<
10008 * """Build an lxml ElementTree from SAX events.
10011 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ContentHandler); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10012 __Pyx_GOTREF(__pyx_t_1);
10013 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
10014 __Pyx_GOTREF(__pyx_t_2);
10015 __Pyx_GIVEREF(__pyx_t_1);
10016 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
10018 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
10019 __Pyx_GOTREF(__pyx_t_1);
10020 __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)
10021 __Pyx_GOTREF(__pyx_t_3);
10023 /* "lxml/sax.py":38
10024 * """Build an lxml ElementTree from SAX events.
10026 * def __init__(self, makeelement=None): # <<<<<<<<<<<<<<
10027 * ContentHandler.__init__(self)
10028 * self._root = None
10030 __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)
10031 __Pyx_GOTREF(__pyx_t_4);
10032 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__11);
10033 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
10034 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10036 /* "lxml/sax.py":50
10037 * self._makeelement = makeelement
10039 * def _get_etree(self): # <<<<<<<<<<<<<<
10040 * "Contains the generated ElementTree after parsing is finished."
10041 * return ElementTree(self._root)
10043 __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)
10044 __Pyx_GOTREF(__pyx_t_4);
10045 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_etree, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
10046 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10048 /* "lxml/sax.py":54
10049 * return ElementTree(self._root)
10051 * etree = property(_get_etree, doc=_get_etree.__doc__) # <<<<<<<<<<<<<<
10053 * def setDocumentLocator(self, locator):
10055 __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10056 if (unlikely(!__pyx_t_4)) {
10058 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_etree);
10060 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10061 __Pyx_GOTREF(__pyx_t_4);
10062 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
10063 __Pyx_GOTREF(__pyx_t_5);
10064 __Pyx_GIVEREF(__pyx_t_4);
10065 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10067 __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
10068 __Pyx_GOTREF(__pyx_t_4);
10069 __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_get_etree);
10070 if (unlikely(!__pyx_t_6)) {
10072 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_etree);
10074 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
10075 __Pyx_GOTREF(__pyx_t_6);
10076 __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)
10077 __Pyx_GOTREF(__pyx_t_7);
10078 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10079 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_doc_2, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10080 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10081 __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)
10082 __Pyx_GOTREF(__pyx_t_7);
10083 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10084 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10085 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_etree, __pyx_t_7) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
10086 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10088 /* "lxml/sax.py":56
10089 * etree = property(_get_etree, doc=_get_etree.__doc__)
10091 * def setDocumentLocator(self, locator): # <<<<<<<<<<<<<<
10095 __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)
10096 __Pyx_GOTREF(__pyx_t_7);
10097 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_setDocumentLocator, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
10098 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10100 /* "lxml/sax.py":59
10103 * def startDocument(self): # <<<<<<<<<<<<<<
10107 __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)
10108 __Pyx_GOTREF(__pyx_t_7);
10109 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startDocument, __pyx_t_7) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
10110 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10112 /* "lxml/sax.py":62
10115 * def endDocument(self): # <<<<<<<<<<<<<<
10119 __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)
10120 __Pyx_GOTREF(__pyx_t_7);
10121 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endDocument, __pyx_t_7) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
10122 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10124 /* "lxml/sax.py":65
10127 * def startPrefixMapping(self, prefix, uri): # <<<<<<<<<<<<<<
10128 * self._new_mappings[prefix] = uri
10131 __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)
10132 __Pyx_GOTREF(__pyx_t_7);
10133 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
10134 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10136 /* "lxml/sax.py":74
10137 * self._default_ns = uri
10139 * def endPrefixMapping(self, prefix): # <<<<<<<<<<<<<<
10140 * ns_uri_list = self._ns_mapping[prefix]
10141 * ns_uri_list.pop()
10143 __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)
10144 __Pyx_GOTREF(__pyx_t_7);
10145 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endPrefixMapping, __pyx_t_7) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
10146 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10148 /* "lxml/sax.py":80
10149 * self._default_ns = ns_uri_list[-1]
10151 * def _buildTag(self, ns_name_tuple): # <<<<<<<<<<<<<<
10152 * ns_uri, local_name = ns_name_tuple
10155 __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)
10156 __Pyx_GOTREF(__pyx_t_7);
10157 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_buildTag, __pyx_t_7) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
10158 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10160 /* "lxml/sax.py":90
10163 * def startElementNS(self, ns_name, qname, attributes=None): # <<<<<<<<<<<<<<
10164 * el_name = self._buildTag(ns_name)
10167 __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)
10168 __Pyx_GOTREF(__pyx_t_7);
10169 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__28);
10170 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
10171 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10173 /* "lxml/sax.py":123
10174 * self._new_mappings.clear()
10176 * def processingInstruction(self, target, data): # <<<<<<<<<<<<<<
10177 * pi = ProcessingInstruction(target, data)
10178 * if self._root is None:
10180 __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)
10181 __Pyx_GOTREF(__pyx_t_7);
10182 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_processingInstruction, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
10183 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10185 /* "lxml/sax.py":130
10186 * self._element_stack[-1].append(pi)
10188 * def endElementNS(self, ns_name, qname): # <<<<<<<<<<<<<<
10189 * element = self._element_stack.pop()
10190 * el_tag = self._buildTag(ns_name)
10192 __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)
10193 __Pyx_GOTREF(__pyx_t_7);
10194 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElementNS, __pyx_t_7) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
10195 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10197 /* "lxml/sax.py":136
10198 * raise SaxError("Unexpected element closed: " + el_tag)
10200 * def startElement(self, name, attributes=None): # <<<<<<<<<<<<<<
10202 * attributes = dict(
10204 __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)
10205 __Pyx_GOTREF(__pyx_t_7);
10206 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__35);
10207 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_startElement, __pyx_t_7) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
10208 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10210 /* "lxml/sax.py":143
10211 * self.startElementNS((None, name), name, attributes)
10213 * def endElement(self, name): # <<<<<<<<<<<<<<
10214 * self.endElementNS((None, name), name)
10217 __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)
10218 __Pyx_GOTREF(__pyx_t_7);
10219 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_endElement, __pyx_t_7) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
10220 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10222 /* "lxml/sax.py":146
10223 * self.endElementNS((None, name), name)
10225 * def characters(self, data): # <<<<<<<<<<<<<<
10226 * last_element = self._element_stack[-1]
10229 __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)
10230 __Pyx_GOTREF(__pyx_t_7);
10231 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_characters, __pyx_t_7) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
10232 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10234 /* "lxml/sax.py":156
10235 * last_element.text = (last_element.text or '') + data
10237 * ignorableWhitespace = characters # <<<<<<<<<<<<<<
10241 __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_characters);
10242 if (unlikely(!__pyx_t_7)) {
10244 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_characters);
10246 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error)
10247 __Pyx_GOTREF(__pyx_t_7);
10248 if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_ignorableWhitespace, __pyx_t_7) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
10249 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10251 /* "lxml/sax.py":35
10254 * class ElementTreeContentHandler(ContentHandler): # <<<<<<<<<<<<<<
10255 * """Build an lxml ElementTree from SAX events.
10258 __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)
10259 __Pyx_GOTREF(__pyx_t_7);
10260 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ElementTreeContentHandler, __pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
10261 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10262 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10263 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10264 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10266 /* "lxml/sax.py":173
10267 * self._empty_attributes = attr_class({}, {})
10269 * def saxify(self): # <<<<<<<<<<<<<<
10270 * self._content_handler.startDocument()
10273 __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)
10274 __Pyx_GOTREF(__pyx_t_2);
10275 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)
10276 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10277 PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10279 /* "(tree fragment)":1
10280 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10282 * cdef object _dict
10284 __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)
10285 __Pyx_GOTREF(__pyx_t_2);
10286 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)
10287 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10288 PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10290 /* "(tree fragment)":16
10292 * return __pyx_unpickle_ElementTreeProducer, (type(self), 0x1d4a0fa, state)
10293 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10294 * __pyx_unpickle_ElementTreeProducer__set_state(self, __pyx_state)
10296 __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)
10297 __Pyx_GOTREF(__pyx_t_2);
10298 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)
10299 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10300 PyType_Modified(__pyx_ptype_4lxml_3sax_ElementTreeProducer);
10302 /* "lxml/sax.py":274
10305 * def saxify(element_or_tree, content_handler): # <<<<<<<<<<<<<<
10306 * """One-shot helper to generate SAX events from an XML tree and fire
10307 * them against a SAX ContentHandler.
10309 __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)
10310 __Pyx_GOTREF(__pyx_t_2);
10311 if (PyDict_SetItem(__pyx_d, __pyx_n_s_saxify, __pyx_t_2) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
10312 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10314 /* "(tree fragment)":1
10315 * def __pyx_unpickle_ElementTreeProducer(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
10316 * cdef object __pyx_PickleError
10317 * cdef object __pyx_result
10319 __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)
10320 __Pyx_GOTREF(__pyx_t_2);
10321 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ElementTreeProduc, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10322 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10325 * # cython: language_level=2 # <<<<<<<<<<<<<<
10329 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
10330 __Pyx_GOTREF(__pyx_t_2);
10331 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10332 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10334 /*--- Wrapped vars code ---*/
10336 if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
10339 __Pyx_XDECREF(__pyx_t_1);
10340 __Pyx_XDECREF(__pyx_t_2);
10341 __Pyx_XDECREF(__pyx_t_3);
10342 __Pyx_XDECREF(__pyx_t_4);
10343 __Pyx_XDECREF(__pyx_t_5);
10344 __Pyx_XDECREF(__pyx_t_6);
10345 __Pyx_XDECREF(__pyx_t_7);
10348 __Pyx_AddTraceback("init lxml.sax", __pyx_clineno, __pyx_lineno, __pyx_filename);
10351 } else if (!PyErr_Occurred()) {
10352 PyErr_SetString(PyExc_ImportError, "init lxml.sax");
10355 __Pyx_RefNannyFinishContext();
10356 #if CYTHON_PEP489_MULTI_PHASE_INIT
10357 return (__pyx_m != NULL) ? 0 : -1;
10358 #elif PY_MAJOR_VERSION >= 3
10365 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
10366 Py_CLEAR(__pyx_slice__2);
10367 Py_CLEAR(__pyx_tuple__4);
10368 Py_CLEAR(__pyx_slice__5);
10369 Py_CLEAR(__pyx_slice__7);
10370 Py_CLEAR(__pyx_tuple__9);
10371 Py_CLEAR(__pyx_codeobj__10);
10372 Py_CLEAR(__pyx_tuple__11);
10373 Py_CLEAR(__pyx_tuple__12);
10374 Py_CLEAR(__pyx_codeobj__13);
10375 Py_CLEAR(__pyx_tuple__14);
10376 Py_CLEAR(__pyx_codeobj__15);
10377 Py_CLEAR(__pyx_tuple__16);
10378 Py_CLEAR(__pyx_codeobj__17);
10379 Py_CLEAR(__pyx_tuple__18);
10380 Py_CLEAR(__pyx_codeobj__19);
10381 Py_CLEAR(__pyx_tuple__20);
10382 Py_CLEAR(__pyx_codeobj__21);
10383 Py_CLEAR(__pyx_tuple__22);
10384 Py_CLEAR(__pyx_codeobj__23);
10385 Py_CLEAR(__pyx_tuple__24);
10386 Py_CLEAR(__pyx_codeobj__25);
10387 Py_CLEAR(__pyx_tuple__26);
10388 Py_CLEAR(__pyx_codeobj__27);
10389 Py_CLEAR(__pyx_tuple__28);
10390 Py_CLEAR(__pyx_tuple__29);
10391 Py_CLEAR(__pyx_codeobj__30);
10392 Py_CLEAR(__pyx_tuple__31);
10393 Py_CLEAR(__pyx_codeobj__32);
10394 Py_CLEAR(__pyx_tuple__33);
10395 Py_CLEAR(__pyx_codeobj__34);
10396 Py_CLEAR(__pyx_tuple__35);
10397 Py_CLEAR(__pyx_tuple__36);
10398 Py_CLEAR(__pyx_codeobj__37);
10399 Py_CLEAR(__pyx_tuple__38);
10400 Py_CLEAR(__pyx_codeobj__39);
10401 Py_CLEAR(__pyx_tuple__40);
10402 Py_CLEAR(__pyx_codeobj__41);
10403 Py_CLEAR(__pyx_tuple__42);
10404 Py_CLEAR(__pyx_codeobj__43);
10405 Py_CLEAR(__pyx_tuple__44);
10406 Py_CLEAR(__pyx_codeobj__45);
10407 Py_CLEAR(__pyx_tuple__46);
10408 Py_CLEAR(__pyx_codeobj__47);
10409 Py_CLEAR(__pyx_tuple__48);
10410 Py_CLEAR(__pyx_codeobj__49);
10411 /* CodeObjectCache.cleanup */
10412 if (__pyx_code_cache.entries) {
10413 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10414 int i, count = __pyx_code_cache.count;
10415 __pyx_code_cache.count = 0;
10416 __pyx_code_cache.max_count = 0;
10417 __pyx_code_cache.entries = NULL;
10418 for (i=0; i<count; i++) {
10419 Py_DECREF(entries[i].code_object);
10421 PyMem_Free(entries);
10424 Py_CLEAR(__pyx_umethod_PyDict_Type_get.method);
10425 Py_CLEAR(__pyx_umethod_PyDict_Type_items.method);
10426 Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
10428 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
10429 /*--- Global cleanup code ---*/
10430 __Pyx_CleanupGlobals();
10431 /*--- Type import cleanup code ---*/
10432 /*--- Builtin cleanup code ---*/
10433 Py_CLEAR(__pyx_builtin_property);
10434 Py_CLEAR(__pyx_builtin_KeyError);
10435 Py_CLEAR(__pyx_builtin_AttributeError);
10436 Py_CLEAR(__pyx_builtin_IndexError);
10437 Py_CLEAR(__pyx_builtin_min);
10438 /*--- Intern cleanup code ---*/
10439 Py_CLEAR(__pyx_empty_tuple);
10441 Py_CLEAR(__pyx_cython_runtime);
10445 /* --- Runtime support code --- */
10447 #if CYTHON_REFNANNY
10448 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10449 PyObject *m = NULL, *p = NULL;
10451 m = PyImport_ImportModule(modname);
10453 p = PyObject_GetAttrString(m, "RefNannyAPI");
10455 r = PyLong_AsVoidPtr(p);
10459 return (__Pyx_RefNannyAPIStruct *)r;
10463 /* PyObjectGetAttrStr */
10464 #if CYTHON_USE_TYPE_SLOTS
10465 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
10466 PyTypeObject* tp = Py_TYPE(obj);
10467 if (likely(tp->tp_getattro))
10468 return tp->tp_getattro(obj, attr_name);
10469 #if PY_MAJOR_VERSION < 3
10470 if (likely(tp->tp_getattr))
10471 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
10473 return PyObject_GetAttr(obj, attr_name);
10477 /* GetBuiltinName */
10478 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
10479 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
10480 if (unlikely(!result)) {
10481 PyErr_Format(PyExc_NameError,
10482 #if PY_MAJOR_VERSION >= 3
10483 "name '%U' is not defined", name);
10485 "name '%.200s' is not defined", PyString_AS_STRING(name));
10492 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
10494 if (!j) return NULL;
10495 r = PyObject_GetItem(o, j);
10499 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
10500 CYTHON_NCP_UNUSED int wraparound,
10501 CYTHON_NCP_UNUSED int boundscheck) {
10502 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10503 Py_ssize_t wrapped_i = i;
10504 if (wraparound & unlikely(i < 0)) {
10505 wrapped_i += PyList_GET_SIZE(o);
10507 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
10508 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
10512 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10514 return PySequence_GetItem(o, i);
10517 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
10518 CYTHON_NCP_UNUSED int wraparound,
10519 CYTHON_NCP_UNUSED int boundscheck) {
10520 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10521 Py_ssize_t wrapped_i = i;
10522 if (wraparound & unlikely(i < 0)) {
10523 wrapped_i += PyTuple_GET_SIZE(o);
10525 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
10526 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
10530 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10532 return PySequence_GetItem(o, i);
10535 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
10536 CYTHON_NCP_UNUSED int wraparound,
10537 CYTHON_NCP_UNUSED int boundscheck) {
10538 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
10539 if (is_list || PyList_CheckExact(o)) {
10540 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
10541 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
10542 PyObject *r = PyList_GET_ITEM(o, n);
10547 else if (PyTuple_CheckExact(o)) {
10548 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
10549 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
10550 PyObject *r = PyTuple_GET_ITEM(o, n);
10555 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
10556 if (likely(m && m->sq_item)) {
10557 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
10558 Py_ssize_t l = m->sq_length(o);
10559 if (likely(l >= 0)) {
10562 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10567 return m->sq_item(o, i);
10571 if (is_list || PySequence_Check(o)) {
10572 return PySequence_GetItem(o, i);
10575 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10579 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10580 #if CYTHON_COMPILING_IN_PYPY
10581 return PyObject_RichCompareBool(s1, s2, equals);
10584 return (equals == Py_EQ);
10585 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10586 const char *ps1, *ps2;
10587 Py_ssize_t length = PyBytes_GET_SIZE(s1);
10588 if (length != PyBytes_GET_SIZE(s2))
10589 return (equals == Py_NE);
10590 ps1 = PyBytes_AS_STRING(s1);
10591 ps2 = PyBytes_AS_STRING(s2);
10592 if (ps1[0] != ps2[0]) {
10593 return (equals == Py_NE);
10594 } else if (length == 1) {
10595 return (equals == Py_EQ);
10598 #if CYTHON_USE_UNICODE_INTERNALS
10599 Py_hash_t hash1, hash2;
10600 hash1 = ((PyBytesObject*)s1)->ob_shash;
10601 hash2 = ((PyBytesObject*)s2)->ob_shash;
10602 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10603 return (equals == Py_NE);
10606 result = memcmp(ps1, ps2, (size_t)length);
10607 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10609 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10610 return (equals == Py_NE);
10611 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10612 return (equals == Py_NE);
10615 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10618 result = __Pyx_PyObject_IsTrue(py_result);
10619 Py_DECREF(py_result);
10625 /* UnicodeEquals */
10626 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10627 #if CYTHON_COMPILING_IN_PYPY
10628 return PyObject_RichCompareBool(s1, s2, equals);
10630 #if PY_MAJOR_VERSION < 3
10631 PyObject* owned_ref = NULL;
10633 int s1_is_unicode, s2_is_unicode;
10637 s1_is_unicode = PyUnicode_CheckExact(s1);
10638 s2_is_unicode = PyUnicode_CheckExact(s2);
10639 #if PY_MAJOR_VERSION < 3
10640 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10641 owned_ref = PyUnicode_FromObject(s2);
10642 if (unlikely(!owned_ref))
10646 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10647 owned_ref = PyUnicode_FromObject(s1);
10648 if (unlikely(!owned_ref))
10652 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10653 return __Pyx_PyBytes_Equals(s1, s2, equals);
10656 if (s1_is_unicode & s2_is_unicode) {
10659 void *data1, *data2;
10660 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10662 length = __Pyx_PyUnicode_GET_LENGTH(s1);
10663 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10666 #if CYTHON_USE_UNICODE_INTERNALS
10668 Py_hash_t hash1, hash2;
10669 #if CYTHON_PEP393_ENABLED
10670 hash1 = ((PyASCIIObject*)s1)->hash;
10671 hash2 = ((PyASCIIObject*)s2)->hash;
10673 hash1 = ((PyUnicodeObject*)s1)->hash;
10674 hash2 = ((PyUnicodeObject*)s2)->hash;
10676 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10681 kind = __Pyx_PyUnicode_KIND(s1);
10682 if (kind != __Pyx_PyUnicode_KIND(s2)) {
10685 data1 = __Pyx_PyUnicode_DATA(s1);
10686 data2 = __Pyx_PyUnicode_DATA(s2);
10687 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
10689 } else if (length == 1) {
10692 int result = memcmp(data1, data2, (size_t)(length * kind));
10693 #if PY_MAJOR_VERSION < 3
10694 Py_XDECREF(owned_ref);
10696 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10698 } else if ((s1 == Py_None) & s2_is_unicode) {
10700 } else if ((s2 == Py_None) & s1_is_unicode) {
10704 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10705 #if PY_MAJOR_VERSION < 3
10706 Py_XDECREF(owned_ref);
10710 result = __Pyx_PyObject_IsTrue(py_result);
10711 Py_DECREF(py_result);
10715 #if PY_MAJOR_VERSION < 3
10716 Py_XDECREF(owned_ref);
10718 return (equals == Py_EQ);
10720 #if PY_MAJOR_VERSION < 3
10721 Py_XDECREF(owned_ref);
10723 return (equals == Py_NE);
10728 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
10729 Py_ssize_t cstart, Py_ssize_t cstop,
10730 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
10731 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
10732 #if CYTHON_USE_TYPE_SLOTS
10733 PyMappingMethods* mp;
10734 #if PY_MAJOR_VERSION < 3
10735 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
10736 if (likely(ms && ms->sq_slice)) {
10738 if (_py_start && (*_py_start != Py_None)) {
10739 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
10740 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10745 if (_py_stop && (*_py_stop != Py_None)) {
10746 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
10747 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
10749 cstop = PY_SSIZE_T_MAX;
10751 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
10752 Py_ssize_t l = ms->sq_length(obj);
10753 if (likely(l >= 0)) {
10756 if (cstop < 0) cstop = 0;
10760 if (cstart < 0) cstart = 0;
10763 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10768 return ms->sq_slice(obj, cstart, cstop);
10771 mp = Py_TYPE(obj)->tp_as_mapping;
10772 if (likely(mp && mp->mp_subscript))
10776 PyObject *py_slice, *py_start, *py_stop;
10778 py_slice = *_py_slice;
10780 PyObject* owned_start = NULL;
10781 PyObject* owned_stop = NULL;
10783 py_start = *_py_start;
10786 owned_start = py_start = PyInt_FromSsize_t(cstart);
10787 if (unlikely(!py_start)) goto bad;
10789 py_start = Py_None;
10792 py_stop = *_py_stop;
10795 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
10796 if (unlikely(!py_stop)) {
10797 Py_XDECREF(owned_start);
10803 py_slice = PySlice_New(py_start, py_stop, Py_None);
10804 Py_XDECREF(owned_start);
10805 Py_XDECREF(owned_stop);
10806 if (unlikely(!py_slice)) goto bad;
10808 #if CYTHON_USE_TYPE_SLOTS
10809 result = mp->mp_subscript(obj, py_slice);
10811 result = PyObject_GetItem(obj, py_slice);
10814 Py_DECREF(py_slice);
10818 PyErr_Format(PyExc_TypeError,
10819 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
10825 #if CYTHON_COMPILING_IN_CPYTHON
10826 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
10828 ternaryfunc call = func->ob_type->tp_call;
10829 if (unlikely(!call))
10830 return PyObject_Call(func, arg, kw);
10831 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
10833 result = (*call)(func, arg, kw);
10834 Py_LeaveRecursiveCall();
10835 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10838 "NULL result without error in PyObject_Call");
10844 /* RaiseDoubleKeywords */
10845 static void __Pyx_RaiseDoubleKeywordsError(
10846 const char* func_name,
10849 PyErr_Format(PyExc_TypeError,
10850 #if PY_MAJOR_VERSION >= 3
10851 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
10853 "%s() got multiple values for keyword argument '%s'", func_name,
10854 PyString_AsString(kw_name));
10858 /* ParseKeywords */
10859 static int __Pyx_ParseOptionalKeywords(
10861 PyObject **argnames[],
10863 PyObject *values[],
10864 Py_ssize_t num_pos_args,
10865 const char* function_name)
10867 PyObject *key = 0, *value = 0;
10868 Py_ssize_t pos = 0;
10870 PyObject*** first_kw_arg = argnames + num_pos_args;
10871 while (PyDict_Next(kwds, &pos, &key, &value)) {
10872 name = first_kw_arg;
10873 while (*name && (**name != key)) name++;
10875 values[name-argnames] = value;
10878 name = first_kw_arg;
10879 #if PY_MAJOR_VERSION < 3
10880 if (likely(PyString_Check(key))) {
10882 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
10883 && _PyString_Eq(**name, key)) {
10884 values[name-argnames] = value;
10889 if (*name) continue;
10891 PyObject*** argname = argnames;
10892 while (argname != first_kw_arg) {
10893 if ((**argname == key) || (
10894 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
10895 && _PyString_Eq(**argname, key))) {
10896 goto arg_passed_twice;
10903 if (likely(PyUnicode_Check(key))) {
10905 int cmp = (**name == key) ? 0 :
10906 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10907 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10909 PyUnicode_Compare(**name, key);
10910 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10912 values[name-argnames] = value;
10917 if (*name) continue;
10919 PyObject*** argname = argnames;
10920 while (argname != first_kw_arg) {
10921 int cmp = (**argname == key) ? 0 :
10922 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10923 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10925 PyUnicode_Compare(**argname, key);
10926 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10927 if (cmp == 0) goto arg_passed_twice;
10932 goto invalid_keyword_type;
10934 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10936 goto invalid_keyword;
10941 __Pyx_RaiseDoubleKeywordsError(function_name, key);
10943 invalid_keyword_type:
10944 PyErr_Format(PyExc_TypeError,
10945 "%.200s() keywords must be strings", function_name);
10948 PyErr_Format(PyExc_TypeError,
10949 #if PY_MAJOR_VERSION < 3
10950 "%.200s() got an unexpected keyword argument '%.200s'",
10951 function_name, PyString_AsString(key));
10953 "%s() got an unexpected keyword argument '%U'",
10954 function_name, key);
10960 /* RaiseArgTupleInvalid */
10961 static void __Pyx_RaiseArgtupleInvalid(
10962 const char* func_name,
10964 Py_ssize_t num_min,
10965 Py_ssize_t num_max,
10966 Py_ssize_t num_found)
10968 Py_ssize_t num_expected;
10969 const char *more_or_less;
10970 if (num_found < num_min) {
10971 num_expected = num_min;
10972 more_or_less = "at least";
10974 num_expected = num_max;
10975 more_or_less = "at most";
10978 more_or_less = "exactly";
10980 PyErr_Format(PyExc_TypeError,
10981 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
10982 func_name, more_or_less, num_expected,
10983 (num_expected == 1) ? "" : "s", num_found);
10986 /* PyDictVersioning */
10987 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
10988 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
10989 PyObject *dict = Py_TYPE(obj)->tp_dict;
10990 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
10992 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
10993 PyObject **dictptr = NULL;
10994 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
10996 #if CYTHON_COMPILING_IN_CPYTHON
10997 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
10999 dictptr = _PyObject_GetDictPtr(obj);
11002 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
11004 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
11005 PyObject *dict = Py_TYPE(obj)->tp_dict;
11006 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
11008 return obj_dict_version == __Pyx_get_object_dict_version(obj);
11012 /* GetModuleGlobalName */
11013 #if CYTHON_USE_DICT_VERSIONS
11014 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11016 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
11020 #if !CYTHON_AVOID_BORROWED_REFS
11021 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
11022 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
11023 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11024 if (likely(result)) {
11025 return __Pyx_NewRef(result);
11026 } else if (unlikely(PyErr_Occurred())) {
11030 result = PyDict_GetItem(__pyx_d, name);
11031 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11032 if (likely(result)) {
11033 return __Pyx_NewRef(result);
11037 result = PyObject_GetItem(__pyx_d, name);
11038 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11039 if (likely(result)) {
11040 return __Pyx_NewRef(result);
11044 return __Pyx_GetBuiltinName(name);
11047 /* PyCFunctionFastCall */
11048 #if CYTHON_FAST_PYCCALL
11049 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
11050 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
11051 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
11052 PyObject *self = PyCFunction_GET_SELF(func);
11053 int flags = PyCFunction_GET_FLAGS(func);
11054 assert(PyCFunction_Check(func));
11055 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
11056 assert(nargs >= 0);
11057 assert(nargs == 0 || args != NULL);
11058 /* _PyCFunction_FastCallDict() must not be called with an exception set,
11059 because it may clear it (directly or indirectly) and so the
11060 caller loses its exception */
11061 assert(!PyErr_Occurred());
11062 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
11063 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
11065 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
11070 /* PyFunctionFastCall */
11071 #if CYTHON_FAST_PYCALL
11072 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11073 PyObject *globals) {
11075 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11076 PyObject **fastlocals;
11079 assert(globals != NULL);
11080 /* XXX Perhaps we should create a specialized
11081 PyFrame_New() that doesn't take locals, but does
11082 take builtins without sanity checking them.
11084 assert(tstate != NULL);
11085 f = PyFrame_New(tstate, co, globals, NULL);
11089 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11090 for (i = 0; i < na; i++) {
11092 fastlocals[i] = *args++;
11094 result = PyEval_EvalFrameEx(f,0);
11095 ++tstate->recursion_depth;
11097 --tstate->recursion_depth;
11100 #if 1 || PY_VERSION_HEX < 0x030600B1
11101 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11102 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11103 PyObject *globals = PyFunction_GET_GLOBALS(func);
11104 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11106 #if PY_MAJOR_VERSION >= 3
11109 PyObject *kwtuple, **k;
11114 assert(kwargs == NULL || PyDict_Check(kwargs));
11115 nk = kwargs ? PyDict_Size(kwargs) : 0;
11116 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
11120 #if PY_MAJOR_VERSION >= 3
11121 co->co_kwonlyargcount == 0 &&
11123 likely(kwargs == NULL || nk == 0) &&
11124 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11125 if (argdefs == NULL && co->co_argcount == nargs) {
11126 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11129 else if (nargs == 0 && argdefs != NULL
11130 && co->co_argcount == Py_SIZE(argdefs)) {
11131 /* function called with no arguments, but all parameters have
11132 a default value: use default values as arguments .*/
11133 args = &PyTuple_GET_ITEM(argdefs, 0);
11134 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11138 if (kwargs != NULL) {
11140 kwtuple = PyTuple_New(2 * nk);
11141 if (kwtuple == NULL) {
11145 k = &PyTuple_GET_ITEM(kwtuple, 0);
11147 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11158 closure = PyFunction_GET_CLOSURE(func);
11159 #if PY_MAJOR_VERSION >= 3
11160 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11162 if (argdefs != NULL) {
11163 d = &PyTuple_GET_ITEM(argdefs, 0);
11164 nd = Py_SIZE(argdefs);
11170 #if PY_MAJOR_VERSION >= 3
11171 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11174 d, (int)nd, kwdefs, closure);
11176 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11179 d, (int)nd, closure);
11181 Py_XDECREF(kwtuple);
11183 Py_LeaveRecursiveCall();
11189 /* PyObjectCall2Args */
11190 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
11191 PyObject *args, *result = NULL;
11192 #if CYTHON_FAST_PYCALL
11193 if (PyFunction_Check(function)) {
11194 PyObject *args[2] = {arg1, arg2};
11195 return __Pyx_PyFunction_FastCall(function, args, 2);
11198 #if CYTHON_FAST_PYCCALL
11199 if (__Pyx_PyFastCFunction_Check(function)) {
11200 PyObject *args[2] = {arg1, arg2};
11201 return __Pyx_PyCFunction_FastCall(function, args, 2);
11204 args = PyTuple_New(2);
11205 if (unlikely(!args)) goto done;
11207 PyTuple_SET_ITEM(args, 0, arg1);
11209 PyTuple_SET_ITEM(args, 1, arg2);
11210 Py_INCREF(function);
11211 result = __Pyx_PyObject_Call(function, args, NULL);
11213 Py_DECREF(function);
11218 /* PyObjectCallMethO */
11219 #if CYTHON_COMPILING_IN_CPYTHON
11220 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11221 PyObject *self, *result;
11223 cfunc = PyCFunction_GET_FUNCTION(func);
11224 self = PyCFunction_GET_SELF(func);
11225 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11227 result = cfunc(self, arg);
11228 Py_LeaveRecursiveCall();
11229 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11232 "NULL result without error in PyObject_Call");
11238 /* PyObjectCallOneArg */
11239 #if CYTHON_COMPILING_IN_CPYTHON
11240 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11242 PyObject *args = PyTuple_New(1);
11243 if (unlikely(!args)) return NULL;
11245 PyTuple_SET_ITEM(args, 0, arg);
11246 result = __Pyx_PyObject_Call(func, args, NULL);
11250 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11251 #if CYTHON_FAST_PYCALL
11252 if (PyFunction_Check(func)) {
11253 return __Pyx_PyFunction_FastCall(func, &arg, 1);
11256 if (likely(PyCFunction_Check(func))) {
11257 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
11258 return __Pyx_PyObject_CallMethO(func, arg);
11259 #if CYTHON_FAST_PYCCALL
11260 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
11261 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
11265 return __Pyx__PyObject_CallOneArg(func, arg);
11268 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11270 PyObject *args = PyTuple_Pack(1, arg);
11271 if (unlikely(!args)) return NULL;
11272 result = __Pyx_PyObject_Call(func, args, NULL);
11278 /* PyObjectSetAttrStr */
11279 #if CYTHON_USE_TYPE_SLOTS
11280 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
11281 PyTypeObject* tp = Py_TYPE(obj);
11282 if (likely(tp->tp_setattro))
11283 return tp->tp_setattro(obj, attr_name, value);
11284 #if PY_MAJOR_VERSION < 3
11285 if (likely(tp->tp_setattr))
11286 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
11288 return PyObject_SetAttr(obj, attr_name, value);
11292 /* PyObjectGetMethod */
11293 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
11295 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
11296 PyTypeObject *tp = Py_TYPE(obj);
11298 descrgetfunc f = NULL;
11299 PyObject **dictptr, *dict;
11300 int meth_found = 0;
11301 assert (*method == NULL);
11302 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
11303 attr = __Pyx_PyObject_GetAttrStr(obj, name);
11306 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
11309 descr = _PyType_Lookup(tp, name);
11310 if (likely(descr != NULL)) {
11312 #if PY_MAJOR_VERSION >= 3
11313 #ifdef __Pyx_CyFunction_USED
11314 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
11316 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
11319 #ifdef __Pyx_CyFunction_USED
11320 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
11322 if (likely(PyFunction_Check(descr)))
11328 f = Py_TYPE(descr)->tp_descr_get;
11329 if (f != NULL && PyDescr_IsData(descr)) {
11330 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11336 dictptr = _PyObject_GetDictPtr(obj);
11337 if (dictptr != NULL && (dict = *dictptr) != NULL) {
11339 attr = __Pyx_PyDict_GetItemStr(dict, name);
11340 if (attr != NULL) {
11353 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11357 if (descr != NULL) {
11361 PyErr_Format(PyExc_AttributeError,
11362 #if PY_MAJOR_VERSION >= 3
11363 "'%.50s' object has no attribute '%U'",
11364 tp->tp_name, name);
11366 "'%.50s' object has no attribute '%.400s'",
11367 tp->tp_name, PyString_AS_STRING(name));
11371 attr = __Pyx_PyObject_GetAttrStr(obj, name);
11375 #if CYTHON_UNPACK_METHODS
11376 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
11377 PyObject *function = PyMethod_GET_FUNCTION(attr);
11378 Py_INCREF(function);
11380 *method = function;
11388 /* PyObjectCallMethod1 */
11389 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
11390 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
11394 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
11395 PyObject *method = NULL, *result;
11396 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11397 if (likely(is_method)) {
11398 result = __Pyx_PyObject_Call2Args(method, obj, arg);
11402 if (unlikely(!method)) return NULL;
11403 return __Pyx__PyObject_CallMethod1(method, arg);
11407 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
11408 if (likely(PyList_CheckExact(L))) {
11409 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
11411 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
11412 if (unlikely(!retval))
11419 /* ObjectGetItem */
11420 #if CYTHON_USE_TYPE_SLOTS
11421 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
11423 Py_ssize_t key_value;
11424 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
11425 if (unlikely(!(m && m->sq_item))) {
11426 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
11429 key_value = __Pyx_PyIndex_AsSsize_t(index);
11430 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
11431 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
11433 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
11435 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
11439 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
11440 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
11441 if (likely(m && m->mp_subscript)) {
11442 return m->mp_subscript(obj, key);
11444 return __Pyx_PyObject_GetIndex(obj, key);
11448 /* GetTopmostException */
11449 #if CYTHON_USE_EXC_INFO_STACK
11450 static _PyErr_StackItem *
11451 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
11453 _PyErr_StackItem *exc_info = tstate->exc_info;
11454 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
11455 exc_info->previous_item != NULL)
11457 exc_info = exc_info->previous_item;
11463 /* SaveResetException */
11464 #if CYTHON_FAST_THREAD_STATE
11465 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11466 #if CYTHON_USE_EXC_INFO_STACK
11467 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
11468 *type = exc_info->exc_type;
11469 *value = exc_info->exc_value;
11470 *tb = exc_info->exc_traceback;
11472 *type = tstate->exc_type;
11473 *value = tstate->exc_value;
11474 *tb = tstate->exc_traceback;
11477 Py_XINCREF(*value);
11480 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11481 PyObject *tmp_type, *tmp_value, *tmp_tb;
11482 #if CYTHON_USE_EXC_INFO_STACK
11483 _PyErr_StackItem *exc_info = tstate->exc_info;
11484 tmp_type = exc_info->exc_type;
11485 tmp_value = exc_info->exc_value;
11486 tmp_tb = exc_info->exc_traceback;
11487 exc_info->exc_type = type;
11488 exc_info->exc_value = value;
11489 exc_info->exc_traceback = tb;
11491 tmp_type = tstate->exc_type;
11492 tmp_value = tstate->exc_value;
11493 tmp_tb = tstate->exc_traceback;
11494 tstate->exc_type = type;
11495 tstate->exc_value = value;
11496 tstate->exc_traceback = tb;
11498 Py_XDECREF(tmp_type);
11499 Py_XDECREF(tmp_value);
11500 Py_XDECREF(tmp_tb);
11504 /* PyErrExceptionMatches */
11505 #if CYTHON_FAST_THREAD_STATE
11506 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
11508 n = PyTuple_GET_SIZE(tuple);
11509 #if PY_MAJOR_VERSION >= 3
11510 for (i=0; i<n; i++) {
11511 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
11514 for (i=0; i<n; i++) {
11515 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
11519 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
11520 PyObject *exc_type = tstate->curexc_type;
11521 if (exc_type == err) return 1;
11522 if (unlikely(!exc_type)) return 0;
11523 if (unlikely(PyTuple_Check(err)))
11524 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
11525 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
11530 #if CYTHON_FAST_THREAD_STATE
11531 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
11533 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
11536 PyObject *local_type, *local_value, *local_tb;
11537 #if CYTHON_FAST_THREAD_STATE
11538 PyObject *tmp_type, *tmp_value, *tmp_tb;
11539 local_type = tstate->curexc_type;
11540 local_value = tstate->curexc_value;
11541 local_tb = tstate->curexc_traceback;
11542 tstate->curexc_type = 0;
11543 tstate->curexc_value = 0;
11544 tstate->curexc_traceback = 0;
11546 PyErr_Fetch(&local_type, &local_value, &local_tb);
11548 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
11549 #if CYTHON_FAST_THREAD_STATE
11550 if (unlikely(tstate->curexc_type))
11552 if (unlikely(PyErr_Occurred()))
11555 #if PY_MAJOR_VERSION >= 3
11557 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
11561 Py_XINCREF(local_tb);
11562 Py_XINCREF(local_type);
11563 Py_XINCREF(local_value);
11564 *type = local_type;
11565 *value = local_value;
11567 #if CYTHON_FAST_THREAD_STATE
11568 #if CYTHON_USE_EXC_INFO_STACK
11570 _PyErr_StackItem *exc_info = tstate->exc_info;
11571 tmp_type = exc_info->exc_type;
11572 tmp_value = exc_info->exc_value;
11573 tmp_tb = exc_info->exc_traceback;
11574 exc_info->exc_type = local_type;
11575 exc_info->exc_value = local_value;
11576 exc_info->exc_traceback = local_tb;
11579 tmp_type = tstate->exc_type;
11580 tmp_value = tstate->exc_value;
11581 tmp_tb = tstate->exc_traceback;
11582 tstate->exc_type = local_type;
11583 tstate->exc_value = local_value;
11584 tstate->exc_traceback = local_tb;
11586 Py_XDECREF(tmp_type);
11587 Py_XDECREF(tmp_value);
11588 Py_XDECREF(tmp_tb);
11590 PyErr_SetExcInfo(local_type, local_value, local_tb);
11597 Py_XDECREF(local_type);
11598 Py_XDECREF(local_value);
11599 Py_XDECREF(local_tb);
11603 /* PyObjectCallNoArg */
11604 #if CYTHON_COMPILING_IN_CPYTHON
11605 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
11606 #if CYTHON_FAST_PYCALL
11607 if (PyFunction_Check(func)) {
11608 return __Pyx_PyFunction_FastCall(func, NULL, 0);
11611 #ifdef __Pyx_CyFunction_USED
11612 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
11614 if (likely(PyCFunction_Check(func)))
11617 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
11618 return __Pyx_PyObject_CallMethO(func, NULL);
11621 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
11625 /* PyObjectCallMethod0 */
11626 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
11627 PyObject *method = NULL, *result = NULL;
11628 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11629 if (likely(is_method)) {
11630 result = __Pyx_PyObject_CallOneArg(method, obj);
11634 if (unlikely(!method)) goto bad;
11635 result = __Pyx_PyObject_CallNoArg(method);
11641 /* UnpackUnboundCMethod */
11642 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
11644 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
11645 if (unlikely(!method))
11647 target->method = method;
11648 #if CYTHON_COMPILING_IN_CPYTHON
11649 #if PY_MAJOR_VERSION >= 3
11650 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
11653 PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
11654 target->func = descr->d_method->ml_meth;
11655 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
11661 /* CallUnboundCMethod0 */
11662 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
11663 PyObject *args, *result = NULL;
11664 if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
11665 #if CYTHON_ASSUME_SAFE_MACROS
11666 args = PyTuple_New(1);
11667 if (unlikely(!args)) goto bad;
11669 PyTuple_SET_ITEM(args, 0, self);
11671 args = PyTuple_Pack(1, self);
11672 if (unlikely(!args)) goto bad;
11674 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
11681 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
11682 if (Py_TYPE(L) == &PySet_Type) {
11683 return PySet_Pop(L);
11685 return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
11687 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
11688 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
11689 if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
11691 return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
11693 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
11697 /* RaiseTooManyValuesToUnpack */
11698 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
11699 PyErr_Format(PyExc_ValueError,
11700 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
11703 /* RaiseNeedMoreValuesToUnpack */
11704 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
11705 PyErr_Format(PyExc_ValueError,
11706 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
11707 index, (index == 1) ? "" : "s");
11711 static CYTHON_INLINE int __Pyx_IterFinish(void) {
11712 #if CYTHON_FAST_THREAD_STATE
11713 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11714 PyObject* exc_type = tstate->curexc_type;
11715 if (unlikely(exc_type)) {
11716 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
11717 PyObject *exc_value, *exc_tb;
11718 exc_value = tstate->curexc_value;
11719 exc_tb = tstate->curexc_traceback;
11720 tstate->curexc_type = 0;
11721 tstate->curexc_value = 0;
11722 tstate->curexc_traceback = 0;
11723 Py_DECREF(exc_type);
11724 Py_XDECREF(exc_value);
11725 Py_XDECREF(exc_tb);
11733 if (unlikely(PyErr_Occurred())) {
11734 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
11745 /* UnpackItemEndCheck */
11746 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
11747 if (unlikely(retval)) {
11749 __Pyx_RaiseTooManyValuesError(expected);
11752 return __Pyx_IterFinish();
11758 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
11759 #if CYTHON_USE_TYPE_SLOTS
11760 #if PY_MAJOR_VERSION >= 3
11761 if (likely(PyUnicode_Check(n)))
11763 if (likely(PyString_Check(n)))
11765 return __Pyx_PyObject_GetAttrStr(o, n);
11767 return PyObject_GetAttr(o, n);
11771 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
11773 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
11774 PyErr_SetString(PyExc_TypeError,
11775 "hasattr(): attribute name must be string");
11778 r = __Pyx_GetAttr(o, n);
11779 if (unlikely(!r)) {
11789 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
11790 Py_ssize_t cstart, Py_ssize_t cstop,
11791 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
11792 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
11793 #if CYTHON_USE_TYPE_SLOTS
11794 PyMappingMethods* mp;
11795 #if PY_MAJOR_VERSION < 3
11796 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
11797 if (likely(ms && ms->sq_ass_slice)) {
11799 if (_py_start && (*_py_start != Py_None)) {
11800 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
11801 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11806 if (_py_stop && (*_py_stop != Py_None)) {
11807 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
11808 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
11810 cstop = PY_SSIZE_T_MAX;
11812 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
11813 Py_ssize_t l = ms->sq_length(obj);
11814 if (likely(l >= 0)) {
11817 if (cstop < 0) cstop = 0;
11821 if (cstart < 0) cstart = 0;
11824 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11829 return ms->sq_ass_slice(obj, cstart, cstop, value);
11832 mp = Py_TYPE(obj)->tp_as_mapping;
11833 if (likely(mp && mp->mp_ass_subscript))
11837 PyObject *py_slice, *py_start, *py_stop;
11839 py_slice = *_py_slice;
11841 PyObject* owned_start = NULL;
11842 PyObject* owned_stop = NULL;
11844 py_start = *_py_start;
11847 owned_start = py_start = PyInt_FromSsize_t(cstart);
11848 if (unlikely(!py_start)) goto bad;
11850 py_start = Py_None;
11853 py_stop = *_py_stop;
11856 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
11857 if (unlikely(!py_stop)) {
11858 Py_XDECREF(owned_start);
11864 py_slice = PySlice_New(py_start, py_stop, Py_None);
11865 Py_XDECREF(owned_start);
11866 Py_XDECREF(owned_stop);
11867 if (unlikely(!py_slice)) goto bad;
11869 #if CYTHON_USE_TYPE_SLOTS
11870 result = mp->mp_ass_subscript(obj, py_slice, value);
11872 result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
11875 Py_DECREF(py_slice);
11879 PyErr_Format(PyExc_TypeError,
11880 "'%.200s' object does not support slice %.10s",
11881 Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
11886 /* PyErrFetchRestore */
11887 #if CYTHON_FAST_THREAD_STATE
11888 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11889 PyObject *tmp_type, *tmp_value, *tmp_tb;
11890 tmp_type = tstate->curexc_type;
11891 tmp_value = tstate->curexc_value;
11892 tmp_tb = tstate->curexc_traceback;
11893 tstate->curexc_type = type;
11894 tstate->curexc_value = value;
11895 tstate->curexc_traceback = tb;
11896 Py_XDECREF(tmp_type);
11897 Py_XDECREF(tmp_value);
11898 Py_XDECREF(tmp_tb);
11900 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11901 *type = tstate->curexc_type;
11902 *value = tstate->curexc_value;
11903 *tb = tstate->curexc_traceback;
11904 tstate->curexc_type = 0;
11905 tstate->curexc_value = 0;
11906 tstate->curexc_traceback = 0;
11910 /* RaiseException */
11911 #if PY_MAJOR_VERSION < 3
11912 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
11913 CYTHON_UNUSED PyObject *cause) {
11914 __Pyx_PyThreadState_declare
11916 if (!value || value == Py_None)
11920 if (!tb || tb == Py_None)
11924 if (!PyTraceBack_Check(tb)) {
11925 PyErr_SetString(PyExc_TypeError,
11926 "raise: arg 3 must be a traceback or None");
11930 if (PyType_Check(type)) {
11931 #if CYTHON_COMPILING_IN_PYPY
11933 Py_INCREF(Py_None);
11937 PyErr_NormalizeException(&type, &value, &tb);
11940 PyErr_SetString(PyExc_TypeError,
11941 "instance exception may not have a separate value");
11945 type = (PyObject*) Py_TYPE(type);
11947 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
11948 PyErr_SetString(PyExc_TypeError,
11949 "raise: exception class must be a subclass of BaseException");
11953 __Pyx_PyThreadState_assign
11954 __Pyx_ErrRestore(type, value, tb);
11963 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11964 PyObject* owned_instance = NULL;
11965 if (tb == Py_None) {
11967 } else if (tb && !PyTraceBack_Check(tb)) {
11968 PyErr_SetString(PyExc_TypeError,
11969 "raise: arg 3 must be a traceback or None");
11972 if (value == Py_None)
11974 if (PyExceptionInstance_Check(type)) {
11976 PyErr_SetString(PyExc_TypeError,
11977 "instance exception may not have a separate value");
11981 type = (PyObject*) Py_TYPE(value);
11982 } else if (PyExceptionClass_Check(type)) {
11983 PyObject *instance_class = NULL;
11984 if (value && PyExceptionInstance_Check(value)) {
11985 instance_class = (PyObject*) Py_TYPE(value);
11986 if (instance_class != type) {
11987 int is_subclass = PyObject_IsSubclass(instance_class, type);
11988 if (!is_subclass) {
11989 instance_class = NULL;
11990 } else if (unlikely(is_subclass == -1)) {
11993 type = instance_class;
11997 if (!instance_class) {
12000 args = PyTuple_New(0);
12001 else if (PyTuple_Check(value)) {
12005 args = PyTuple_Pack(1, value);
12008 owned_instance = PyObject_Call(type, args, NULL);
12010 if (!owned_instance)
12012 value = owned_instance;
12013 if (!PyExceptionInstance_Check(value)) {
12014 PyErr_Format(PyExc_TypeError,
12015 "calling %R should have returned an instance of "
12016 "BaseException, not %R",
12017 type, Py_TYPE(value));
12022 PyErr_SetString(PyExc_TypeError,
12023 "raise: exception class must be a subclass of BaseException");
12027 PyObject *fixed_cause;
12028 if (cause == Py_None) {
12029 fixed_cause = NULL;
12030 } else if (PyExceptionClass_Check(cause)) {
12031 fixed_cause = PyObject_CallObject(cause, NULL);
12032 if (fixed_cause == NULL)
12034 } else if (PyExceptionInstance_Check(cause)) {
12035 fixed_cause = cause;
12036 Py_INCREF(fixed_cause);
12038 PyErr_SetString(PyExc_TypeError,
12039 "exception causes must derive from "
12043 PyException_SetCause(value, fixed_cause);
12045 PyErr_SetObject(type, value);
12047 #if CYTHON_COMPILING_IN_PYPY
12048 PyObject *tmp_type, *tmp_value, *tmp_tb;
12049 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12051 PyErr_Restore(tmp_type, tmp_value, tb);
12052 Py_XDECREF(tmp_tb);
12054 PyThreadState *tstate = __Pyx_PyThreadState_Current;
12055 PyObject* tmp_tb = tstate->curexc_traceback;
12056 if (tb != tmp_tb) {
12058 tstate->curexc_traceback = tb;
12059 Py_XDECREF(tmp_tb);
12064 Py_XDECREF(owned_instance);
12070 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
12071 PyObject *empty_list = 0;
12072 PyObject *module = 0;
12073 PyObject *global_dict = 0;
12074 PyObject *empty_dict = 0;
12076 #if PY_MAJOR_VERSION < 3
12077 PyObject *py_import;
12078 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
12085 empty_list = PyList_New(0);
12090 global_dict = PyModule_GetDict(__pyx_m);
12093 empty_dict = PyDict_New();
12097 #if PY_MAJOR_VERSION >= 3
12099 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
12100 module = PyImport_ImportModuleLevelObject(
12101 name, global_dict, empty_dict, list, 1);
12103 if (!PyErr_ExceptionMatches(PyExc_ImportError))
12112 #if PY_MAJOR_VERSION < 3
12113 PyObject *py_level = PyInt_FromLong(level);
12116 module = PyObject_CallFunctionObjArgs(py_import,
12117 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
12118 Py_DECREF(py_level);
12120 module = PyImport_ImportModuleLevelObject(
12121 name, global_dict, empty_dict, list, level);
12126 #if PY_MAJOR_VERSION < 3
12127 Py_XDECREF(py_import);
12129 Py_XDECREF(empty_list);
12130 Py_XDECREF(empty_dict);
12135 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
12136 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
12137 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
12138 PyErr_Format(PyExc_ImportError,
12139 #if PY_MAJOR_VERSION < 3
12140 "cannot import name %.230s", PyString_AS_STRING(name));
12142 "cannot import name %S", name);
12149 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
12150 __Pyx_PyThreadState_declare
12151 __Pyx_PyThreadState_assign
12152 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12154 __Pyx_PyErr_Clear();
12158 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
12159 PyObject *r = __Pyx_GetAttr(o, n);
12160 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
12163 /* py_dict_items */
12164 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
12165 if (PY_MAJOR_VERSION >= 3)
12166 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
12168 return PyDict_Items(d);
12171 /* CallUnboundCMethod1 */
12172 #if CYTHON_COMPILING_IN_CPYTHON
12173 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
12174 if (likely(cfunc->func)) {
12175 int flag = cfunc->flag;
12176 if (flag == METH_O) {
12177 return (*(cfunc->func))(self, arg);
12178 } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
12179 if (PY_VERSION_HEX >= 0x030700A0) {
12180 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
12182 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12184 } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
12185 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
12188 return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
12191 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
12192 PyObject *args, *result = NULL;
12193 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12194 #if CYTHON_COMPILING_IN_CPYTHON
12195 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12196 args = PyTuple_New(1);
12197 if (unlikely(!args)) goto bad;
12199 PyTuple_SET_ITEM(args, 0, arg);
12200 if (cfunc->flag & METH_KEYWORDS)
12201 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12203 result = (*cfunc->func)(self, args);
12205 args = PyTuple_New(2);
12206 if (unlikely(!args)) goto bad;
12208 PyTuple_SET_ITEM(args, 0, self);
12210 PyTuple_SET_ITEM(args, 1, arg);
12211 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12214 args = PyTuple_Pack(2, self, arg);
12215 if (unlikely(!args)) goto bad;
12216 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12223 /* CallUnboundCMethod2 */
12224 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
12225 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
12226 if (likely(cfunc->func)) {
12227 PyObject *args[2] = {arg1, arg2};
12228 if (cfunc->flag == METH_FASTCALL) {
12229 #if PY_VERSION_HEX >= 0x030700A0
12230 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
12232 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12235 #if PY_VERSION_HEX >= 0x030700A0
12236 if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
12237 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
12240 return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
12243 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
12244 PyObject *args, *result = NULL;
12245 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
12246 #if CYTHON_COMPILING_IN_CPYTHON
12247 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
12248 args = PyTuple_New(2);
12249 if (unlikely(!args)) goto bad;
12251 PyTuple_SET_ITEM(args, 0, arg1);
12253 PyTuple_SET_ITEM(args, 1, arg2);
12254 if (cfunc->flag & METH_KEYWORDS)
12255 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
12257 result = (*cfunc->func)(self, args);
12259 args = PyTuple_New(3);
12260 if (unlikely(!args)) goto bad;
12262 PyTuple_SET_ITEM(args, 0, self);
12264 PyTuple_SET_ITEM(args, 1, arg1);
12266 PyTuple_SET_ITEM(args, 2, arg2);
12267 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12270 args = PyTuple_Pack(3, self, arg1, arg2);
12271 if (unlikely(!args)) goto bad;
12272 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
12279 /* dict_getitem_default */
12280 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
12282 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
12283 value = PyDict_GetItemWithError(d, key);
12284 if (unlikely(!value)) {
12285 if (unlikely(PyErr_Occurred()))
12287 value = default_value;
12292 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
12293 value = PyDict_GetItem(d, key);
12294 if (unlikely(!value)) {
12295 value = default_value;
12301 if (default_value == Py_None)
12302 value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
12304 value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
12309 /* RaiseNoneIterError */
12310 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
12311 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
12314 /* PyObject_GenericGetAttrNoDict */
12315 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12316 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12317 PyErr_Format(PyExc_AttributeError,
12318 #if PY_MAJOR_VERSION >= 3
12319 "'%.50s' object has no attribute '%U'",
12320 tp->tp_name, attr_name);
12322 "'%.50s' object has no attribute '%.400s'",
12323 tp->tp_name, PyString_AS_STRING(attr_name));
12327 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12329 PyTypeObject *tp = Py_TYPE(obj);
12330 if (unlikely(!PyString_Check(attr_name))) {
12331 return PyObject_GenericGetAttr(obj, attr_name);
12333 assert(!tp->tp_dictoffset);
12334 descr = _PyType_Lookup(tp, attr_name);
12335 if (unlikely(!descr)) {
12336 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12339 #if PY_MAJOR_VERSION < 3
12340 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12343 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12345 PyObject *res = f(descr, obj, (PyObject *)tp);
12354 /* PyObject_GenericGetAttr */
12355 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12356 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12357 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12358 return PyObject_GenericGetAttr(obj, attr_name);
12360 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12365 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
12366 #if PY_VERSION_HEX >= 0x02070000
12367 PyObject *ob = PyCapsule_New(vtable, 0, 0);
12369 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
12373 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
12382 /* PyObjectGetAttrStrNoError */
12383 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
12384 __Pyx_PyThreadState_declare
12385 __Pyx_PyThreadState_assign
12386 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
12387 __Pyx_PyErr_Clear();
12389 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
12391 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
12392 PyTypeObject* tp = Py_TYPE(obj);
12393 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
12394 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
12397 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
12398 if (unlikely(!result)) {
12399 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
12405 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12407 PyObject *name_attr;
12408 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
12409 if (likely(name_attr)) {
12410 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12414 if (unlikely(ret < 0)) {
12418 Py_XDECREF(name_attr);
12421 static int __Pyx_setup_reduce(PyObject* type_obj) {
12423 PyObject *object_reduce = NULL;
12424 PyObject *object_reduce_ex = NULL;
12425 PyObject *reduce = NULL;
12426 PyObject *reduce_ex = NULL;
12427 PyObject *reduce_cython = NULL;
12428 PyObject *setstate = NULL;
12429 PyObject *setstate_cython = NULL;
12430 #if CYTHON_USE_PYTYPE_LOOKUP
12431 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12433 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
12435 #if CYTHON_USE_PYTYPE_LOOKUP
12436 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12438 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12440 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
12441 if (reduce_ex == object_reduce_ex) {
12442 #if CYTHON_USE_PYTYPE_LOOKUP
12443 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12445 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12447 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
12448 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
12449 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
12450 if (likely(reduce_cython)) {
12451 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12452 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12453 } else if (reduce == object_reduce || PyErr_Occurred()) {
12456 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
12457 if (!setstate) PyErr_Clear();
12458 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
12459 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
12460 if (likely(setstate_cython)) {
12461 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12462 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12463 } else if (!setstate || PyErr_Occurred()) {
12467 PyType_Modified((PyTypeObject*)type_obj);
12472 if (!PyErr_Occurred())
12473 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
12476 #if !CYTHON_USE_PYTYPE_LOOKUP
12477 Py_XDECREF(object_reduce);
12478 Py_XDECREF(object_reduce_ex);
12480 Py_XDECREF(reduce);
12481 Py_XDECREF(reduce_ex);
12482 Py_XDECREF(reduce_cython);
12483 Py_XDECREF(setstate);
12484 Py_XDECREF(setstate_cython);
12488 /* CalculateMetaclass */
12489 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
12490 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
12491 for (i=0; i < nbases; i++) {
12492 PyTypeObject *tmptype;
12493 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
12494 tmptype = Py_TYPE(tmp);
12495 #if PY_MAJOR_VERSION < 3
12496 if (tmptype == &PyClass_Type)
12500 metaclass = tmptype;
12503 if (PyType_IsSubtype(metaclass, tmptype))
12505 if (PyType_IsSubtype(tmptype, metaclass)) {
12506 metaclass = tmptype;
12509 PyErr_SetString(PyExc_TypeError,
12510 "metaclass conflict: "
12511 "the metaclass of a derived class "
12512 "must be a (non-strict) subclass "
12513 "of the metaclasses of all its bases");
12517 #if PY_MAJOR_VERSION < 3
12518 metaclass = &PyClass_Type;
12520 metaclass = &PyType_Type;
12523 Py_INCREF((PyObject*) metaclass);
12524 return (PyObject*) metaclass;
12527 /* Py3ClassCreate */
12528 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
12529 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
12532 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
12534 PyObject *pargs = PyTuple_Pack(2, name, bases);
12535 if (unlikely(!pargs)) {
12539 ns = PyObject_Call(prep, pargs, mkw);
12543 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
12553 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
12554 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
12555 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
12561 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
12562 PyObject *dict, PyObject *mkw,
12563 int calculate_metaclass, int allow_py2_metaclass) {
12564 PyObject *result, *margs;
12565 PyObject *owned_metaclass = NULL;
12566 if (allow_py2_metaclass) {
12567 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
12568 if (owned_metaclass) {
12569 metaclass = owned_metaclass;
12570 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
12576 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
12577 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
12578 Py_XDECREF(owned_metaclass);
12579 if (unlikely(!metaclass))
12581 owned_metaclass = metaclass;
12583 margs = PyTuple_Pack(3, name, bases, dict);
12584 if (unlikely(!margs)) {
12587 result = PyObject_Call(metaclass, margs, mkw);
12590 Py_XDECREF(owned_metaclass);
12594 /* FetchCommonType */
12595 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
12596 PyObject* fake_module;
12597 PyTypeObject* cached_type = NULL;
12598 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
12599 if (!fake_module) return NULL;
12600 Py_INCREF(fake_module);
12601 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
12603 if (!PyType_Check((PyObject*)cached_type)) {
12604 PyErr_Format(PyExc_TypeError,
12605 "Shared Cython type %.200s is not a type object",
12609 if (cached_type->tp_basicsize != type->tp_basicsize) {
12610 PyErr_Format(PyExc_TypeError,
12611 "Shared Cython type %.200s has the wrong size, try recompiling",
12616 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12618 if (PyType_Ready(type) < 0) goto bad;
12619 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
12622 cached_type = type;
12625 Py_DECREF(fake_module);
12626 return cached_type;
12628 Py_XDECREF(cached_type);
12629 cached_type = NULL;
12633 /* CythonFunctionShared */
12634 #include <structmember.h>
12636 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
12638 if (unlikely(op->func_doc == NULL)) {
12639 if (op->func.m_ml->ml_doc) {
12640 #if PY_MAJOR_VERSION >= 3
12641 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
12643 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
12645 if (unlikely(op->func_doc == NULL))
12648 Py_INCREF(Py_None);
12652 Py_INCREF(op->func_doc);
12653 return op->func_doc;
12656 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12658 PyObject *tmp = op->func_doc;
12659 if (value == NULL) {
12663 op->func_doc = value;
12668 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12670 if (unlikely(op->func_name == NULL)) {
12671 #if PY_MAJOR_VERSION >= 3
12672 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
12674 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
12676 if (unlikely(op->func_name == NULL))
12679 Py_INCREF(op->func_name);
12680 return op->func_name;
12683 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12686 #if PY_MAJOR_VERSION >= 3
12687 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12689 if (unlikely(value == NULL || !PyString_Check(value)))
12692 PyErr_SetString(PyExc_TypeError,
12693 "__name__ must be set to a string object");
12696 tmp = op->func_name;
12698 op->func_name = value;
12703 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12705 Py_INCREF(op->func_qualname);
12706 return op->func_qualname;
12709 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12712 #if PY_MAJOR_VERSION >= 3
12713 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12715 if (unlikely(value == NULL || !PyString_Check(value)))
12718 PyErr_SetString(PyExc_TypeError,
12719 "__qualname__ must be set to a string object");
12722 tmp = op->func_qualname;
12724 op->func_qualname = value;
12729 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
12732 self = m->func_closure;
12739 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12741 if (unlikely(op->func_dict == NULL)) {
12742 op->func_dict = PyDict_New();
12743 if (unlikely(op->func_dict == NULL))
12746 Py_INCREF(op->func_dict);
12747 return op->func_dict;
12750 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
12753 if (unlikely(value == NULL)) {
12754 PyErr_SetString(PyExc_TypeError,
12755 "function's dictionary may not be deleted");
12758 if (unlikely(!PyDict_Check(value))) {
12759 PyErr_SetString(PyExc_TypeError,
12760 "setting function's dictionary to a non-dict");
12763 tmp = op->func_dict;
12765 op->func_dict = value;
12770 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12772 Py_INCREF(op->func_globals);
12773 return op->func_globals;
12776 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12778 Py_INCREF(Py_None);
12782 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
12784 PyObject* result = (op->func_code) ? op->func_code : Py_None;
12789 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
12791 PyObject *res = op->defaults_getter((PyObject *) op);
12792 if (unlikely(!res))
12794 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12795 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
12796 Py_INCREF(op->defaults_tuple);
12797 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
12798 Py_INCREF(op->defaults_kwdict);
12800 op->defaults_tuple = PySequence_ITEM(res, 0);
12801 if (unlikely(!op->defaults_tuple)) result = -1;
12803 op->defaults_kwdict = PySequence_ITEM(res, 1);
12804 if (unlikely(!op->defaults_kwdict)) result = -1;
12811 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12815 } else if (value != Py_None && !PyTuple_Check(value)) {
12816 PyErr_SetString(PyExc_TypeError,
12817 "__defaults__ must be set to a tuple object");
12821 tmp = op->defaults_tuple;
12822 op->defaults_tuple = value;
12827 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12828 PyObject* result = op->defaults_tuple;
12829 if (unlikely(!result)) {
12830 if (op->defaults_getter) {
12831 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12832 result = op->defaults_tuple;
12841 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12845 } else if (value != Py_None && !PyDict_Check(value)) {
12846 PyErr_SetString(PyExc_TypeError,
12847 "__kwdefaults__ must be set to a dict object");
12851 tmp = op->defaults_kwdict;
12852 op->defaults_kwdict = value;
12857 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12858 PyObject* result = op->defaults_kwdict;
12859 if (unlikely(!result)) {
12860 if (op->defaults_getter) {
12861 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12862 result = op->defaults_kwdict;
12871 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12873 if (!value || value == Py_None) {
12875 } else if (!PyDict_Check(value)) {
12876 PyErr_SetString(PyExc_TypeError,
12877 "__annotations__ must be set to a dict object");
12881 tmp = op->func_annotations;
12882 op->func_annotations = value;
12887 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12888 PyObject* result = op->func_annotations;
12889 if (unlikely(!result)) {
12890 result = PyDict_New();
12891 if (unlikely(!result)) return NULL;
12892 op->func_annotations = result;
12897 static PyGetSetDef __pyx_CyFunction_getsets[] = {
12898 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12899 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12900 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12901 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12902 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
12903 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
12904 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12905 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12906 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12907 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12908 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12909 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12910 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12911 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12912 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12913 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12914 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
12915 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
12918 static PyMemberDef __pyx_CyFunction_members[] = {
12919 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
12923 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
12925 #if PY_MAJOR_VERSION >= 3
12926 return PyUnicode_FromString(m->func.m_ml->ml_name);
12928 return PyString_FromString(m->func.m_ml->ml_name);
12931 static PyMethodDef __pyx_CyFunction_methods[] = {
12932 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
12935 #if PY_VERSION_HEX < 0x030500A0
12936 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
12938 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
12940 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
12941 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
12942 if (unlikely(op == NULL))
12945 __Pyx_CyFunction_weakreflist(op) = NULL;
12946 op->func.m_ml = ml;
12947 op->func.m_self = (PyObject *) op;
12948 Py_XINCREF(closure);
12949 op->func_closure = closure;
12950 Py_XINCREF(module);
12951 op->func.m_module = module;
12952 op->func_dict = NULL;
12953 op->func_name = NULL;
12954 Py_INCREF(qualname);
12955 op->func_qualname = qualname;
12956 op->func_doc = NULL;
12957 op->func_classobj = NULL;
12958 op->func_globals = globals;
12959 Py_INCREF(op->func_globals);
12961 op->func_code = code;
12962 op->defaults_pyobjects = 0;
12963 op->defaults_size = 0;
12964 op->defaults = NULL;
12965 op->defaults_tuple = NULL;
12966 op->defaults_kwdict = NULL;
12967 op->defaults_getter = NULL;
12968 op->func_annotations = NULL;
12969 return (PyObject *) op;
12972 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
12974 Py_CLEAR(m->func_closure);
12975 Py_CLEAR(m->func.m_module);
12976 Py_CLEAR(m->func_dict);
12977 Py_CLEAR(m->func_name);
12978 Py_CLEAR(m->func_qualname);
12979 Py_CLEAR(m->func_doc);
12980 Py_CLEAR(m->func_globals);
12981 Py_CLEAR(m->func_code);
12982 Py_CLEAR(m->func_classobj);
12983 Py_CLEAR(m->defaults_tuple);
12984 Py_CLEAR(m->defaults_kwdict);
12985 Py_CLEAR(m->func_annotations);
12987 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
12989 for (i = 0; i < m->defaults_pyobjects; i++)
12990 Py_XDECREF(pydefaults[i]);
12991 PyObject_Free(m->defaults);
12992 m->defaults = NULL;
12996 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
12998 if (__Pyx_CyFunction_weakreflist(m) != NULL)
12999 PyObject_ClearWeakRefs((PyObject *) m);
13000 __Pyx_CyFunction_clear(m);
13001 PyObject_GC_Del(m);
13003 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13005 PyObject_GC_UnTrack(m);
13006 __Pyx__CyFunction_dealloc(m);
13008 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13010 Py_VISIT(m->func_closure);
13011 Py_VISIT(m->func.m_module);
13012 Py_VISIT(m->func_dict);
13013 Py_VISIT(m->func_name);
13014 Py_VISIT(m->func_qualname);
13015 Py_VISIT(m->func_doc);
13016 Py_VISIT(m->func_globals);
13017 Py_VISIT(m->func_code);
13018 Py_VISIT(m->func_classobj);
13019 Py_VISIT(m->defaults_tuple);
13020 Py_VISIT(m->defaults_kwdict);
13022 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13024 for (i = 0; i < m->defaults_pyobjects; i++)
13025 Py_VISIT(pydefaults[i]);
13029 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13031 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13032 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13036 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
13038 type = (PyObject *)(Py_TYPE(obj));
13039 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
13041 if (obj == Py_None)
13043 return __Pyx_PyMethod_New(func, obj, type);
13046 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13048 #if PY_MAJOR_VERSION >= 3
13049 return PyUnicode_FromFormat("<cyfunction %U at %p>",
13050 op->func_qualname, (void *)op);
13052 return PyString_FromFormat("<cyfunction %s at %p>",
13053 PyString_AsString(op->func_qualname), (void *)op);
13056 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
13057 PyCFunctionObject* f = (PyCFunctionObject*)func;
13058 PyCFunction meth = f->m_ml->ml_meth;
13060 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13062 if (likely(kw == NULL || PyDict_Size(kw) == 0))
13063 return (*meth)(self, arg);
13065 case METH_VARARGS | METH_KEYWORDS:
13066 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
13068 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13069 size = PyTuple_GET_SIZE(arg);
13070 if (likely(size == 0))
13071 return (*meth)(self, NULL);
13072 PyErr_Format(PyExc_TypeError,
13073 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13074 f->m_ml->ml_name, size);
13079 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13080 size = PyTuple_GET_SIZE(arg);
13081 if (likely(size == 1)) {
13082 PyObject *result, *arg0;
13083 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13084 arg0 = PyTuple_GET_ITEM(arg, 0);
13086 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13088 result = (*meth)(self, arg0);
13089 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13094 PyErr_Format(PyExc_TypeError,
13095 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13096 f->m_ml->ml_name, size);
13101 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
13102 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
13103 "longer supported!");
13106 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13110 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13111 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
13113 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13115 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13116 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13118 PyObject *new_args;
13120 argc = PyTuple_GET_SIZE(args);
13121 new_args = PyTuple_GetSlice(args, 1, argc);
13122 if (unlikely(!new_args))
13124 self = PyTuple_GetItem(args, 0);
13125 if (unlikely(!self)) {
13126 Py_DECREF(new_args);
13129 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13130 Py_DECREF(new_args);
13132 result = __Pyx_CyFunction_Call(func, args, kw);
13136 static PyTypeObject __pyx_CyFunctionType_type = {
13137 PyVarObject_HEAD_INIT(0, 0)
13138 "cython_function_or_method",
13139 sizeof(__pyx_CyFunctionObject),
13141 (destructor) __Pyx_CyFunction_dealloc,
13145 #if PY_MAJOR_VERSION < 3
13150 (reprfunc) __Pyx_CyFunction_repr,
13155 __Pyx_CyFunction_CallAsMethod,
13160 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
13162 (traverseproc) __Pyx_CyFunction_traverse,
13163 (inquiry) __Pyx_CyFunction_clear,
13165 #if PY_VERSION_HEX < 0x030500A0
13166 offsetof(__pyx_CyFunctionObject, func_weakreflist),
13168 offsetof(PyCFunctionObject, m_weakreflist),
13172 __pyx_CyFunction_methods,
13173 __pyx_CyFunction_members,
13174 __pyx_CyFunction_getsets,
13177 __Pyx_CyFunction_descr_get,
13179 offsetof(__pyx_CyFunctionObject, func_dict),
13192 #if PY_VERSION_HEX >= 0x030400a1
13195 #if PY_VERSION_HEX >= 0x030800b1
13198 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
13202 static int __pyx_CyFunction_init(void) {
13203 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
13204 if (unlikely(__pyx_CyFunctionType == NULL)) {
13209 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
13210 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13211 m->defaults = PyObject_Malloc(size);
13212 if (unlikely(!m->defaults))
13213 return PyErr_NoMemory();
13214 memset(m->defaults, 0, size);
13215 m->defaults_pyobjects = pyobjects;
13216 m->defaults_size = size;
13217 return m->defaults;
13219 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13220 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13221 m->defaults_tuple = tuple;
13224 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
13225 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13226 m->defaults_kwdict = dict;
13229 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
13230 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13231 m->func_annotations = dict;
13235 /* CythonFunction */
13236 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
13237 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13238 PyObject *op = __Pyx_CyFunction_Init(
13239 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
13240 ml, flags, qualname, closure, module, globals, code
13243 PyObject_GC_Track(op);
13248 /* RegisterModuleCleanup */
13249 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
13250 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
13251 __pyx_module_cleanup(module);
13252 Py_INCREF(Py_None); return Py_None;
13254 static int __Pyx_RegisterCleanup(void) {
13255 static PyMethodDef cleanup_def = {
13256 "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
13257 PyObject *cleanup_func = 0;
13258 PyObject *atexit = 0;
13260 PyObject *args = 0;
13263 cleanup_func = PyCFunction_New(&cleanup_def, 0);
13266 atexit = PyImport_ImportModule("atexit");
13269 reg = PyObject_GetAttrString(atexit, "_exithandlers");
13270 if (reg && PyList_Check(reg)) {
13272 a = PyTuple_New(0);
13279 args = PyTuple_Pack(3, cleanup_func, a, kw);
13284 ret = PyList_Insert(reg, 0, args);
13289 reg = PyObject_GetAttrString(atexit, "register");
13292 args = PyTuple_Pack(1, cleanup_func);
13295 res = PyObject_CallObject(reg, args);
13301 Py_XDECREF(cleanup_func);
13302 Py_XDECREF(atexit);
13310 /* CLineInTraceback */
13311 #ifndef CYTHON_CLINE_IN_TRACEBACK
13312 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
13313 PyObject *use_cline;
13314 PyObject *ptype, *pvalue, *ptraceback;
13315 #if CYTHON_COMPILING_IN_CPYTHON
13316 PyObject **cython_runtime_dict;
13318 if (unlikely(!__pyx_cython_runtime)) {
13321 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13322 #if CYTHON_COMPILING_IN_CPYTHON
13323 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13324 if (likely(cython_runtime_dict)) {
13325 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13326 use_cline, *cython_runtime_dict,
13327 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13331 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13332 if (use_cline_obj) {
13333 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13334 Py_DECREF(use_cline_obj);
13342 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13344 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13347 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13352 /* CodeObjectCache */
13353 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13354 int start = 0, mid = 0, end = count - 1;
13355 if (end >= 0 && code_line > entries[end].code_line) {
13358 while (start < end) {
13359 mid = start + (end - start) / 2;
13360 if (code_line < entries[mid].code_line) {
13362 } else if (code_line > entries[mid].code_line) {
13368 if (code_line <= entries[mid].code_line) {
13374 static PyCodeObject *__pyx_find_code_object(int code_line) {
13375 PyCodeObject* code_object;
13377 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13380 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13381 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13384 code_object = __pyx_code_cache.entries[pos].code_object;
13385 Py_INCREF(code_object);
13386 return code_object;
13388 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13390 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13391 if (unlikely(!code_line)) {
13394 if (unlikely(!entries)) {
13395 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13396 if (likely(entries)) {
13397 __pyx_code_cache.entries = entries;
13398 __pyx_code_cache.max_count = 64;
13399 __pyx_code_cache.count = 1;
13400 entries[0].code_line = code_line;
13401 entries[0].code_object = code_object;
13402 Py_INCREF(code_object);
13406 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13407 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13408 PyCodeObject* tmp = entries[pos].code_object;
13409 entries[pos].code_object = code_object;
13413 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13414 int new_max = __pyx_code_cache.max_count + 64;
13415 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13416 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
13417 if (unlikely(!entries)) {
13420 __pyx_code_cache.entries = entries;
13421 __pyx_code_cache.max_count = new_max;
13423 for (i=__pyx_code_cache.count; i>pos; i--) {
13424 entries[i] = entries[i-1];
13426 entries[pos].code_line = code_line;
13427 entries[pos].code_object = code_object;
13428 __pyx_code_cache.count++;
13429 Py_INCREF(code_object);
13433 #include "compile.h"
13434 #include "frameobject.h"
13435 #include "traceback.h"
13436 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13437 const char *funcname, int c_line,
13438 int py_line, const char *filename) {
13439 PyCodeObject *py_code = 0;
13440 PyObject *py_srcfile = 0;
13441 PyObject *py_funcname = 0;
13442 #if PY_MAJOR_VERSION < 3
13443 py_srcfile = PyString_FromString(filename);
13445 py_srcfile = PyUnicode_FromString(filename);
13447 if (!py_srcfile) goto bad;
13449 #if PY_MAJOR_VERSION < 3
13450 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13452 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13456 #if PY_MAJOR_VERSION < 3
13457 py_funcname = PyString_FromString(funcname);
13459 py_funcname = PyUnicode_FromString(funcname);
13462 if (!py_funcname) goto bad;
13463 py_code = __Pyx_PyCode_New(
13469 __pyx_empty_bytes, /*PyObject *code,*/
13470 __pyx_empty_tuple, /*PyObject *consts,*/
13471 __pyx_empty_tuple, /*PyObject *names,*/
13472 __pyx_empty_tuple, /*PyObject *varnames,*/
13473 __pyx_empty_tuple, /*PyObject *freevars,*/
13474 __pyx_empty_tuple, /*PyObject *cellvars,*/
13475 py_srcfile, /*PyObject *filename,*/
13476 py_funcname, /*PyObject *name,*/
13478 __pyx_empty_bytes /*PyObject *lnotab*/
13480 Py_DECREF(py_srcfile);
13481 Py_DECREF(py_funcname);
13484 Py_XDECREF(py_srcfile);
13485 Py_XDECREF(py_funcname);
13488 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13489 int py_line, const char *filename) {
13490 PyCodeObject *py_code = 0;
13491 PyFrameObject *py_frame = 0;
13492 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13494 c_line = __Pyx_CLineForTraceback(tstate, c_line);
13496 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13498 py_code = __Pyx_CreateCodeObjectForTraceback(
13499 funcname, c_line, py_line, filename);
13500 if (!py_code) goto bad;
13501 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13503 py_frame = PyFrame_New(
13504 tstate, /*PyThreadState *tstate,*/
13505 py_code, /*PyCodeObject *code,*/
13506 __pyx_d, /*PyObject *globals,*/
13507 0 /*PyObject *locals*/
13509 if (!py_frame) goto bad;
13510 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13511 PyTraceBack_Here(py_frame);
13513 Py_XDECREF(py_code);
13514 Py_XDECREF(py_frame);
13517 /* CIntFromPyVerify */
13518 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
13519 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
13520 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
13521 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
13522 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
13524 func_type value = func_value;\
13525 if (sizeof(target_type) < sizeof(func_type)) {\
13526 if (unlikely(value != (func_type) (target_type) value)) {\
13527 func_type zero = 0;\
13528 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
13529 return (target_type) -1;\
13530 if (is_unsigned && unlikely(value < zero))\
13531 goto raise_neg_overflow;\
13533 goto raise_overflow;\
13536 return (target_type) value;\
13540 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
13541 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13542 const int is_unsigned = neg_one > const_zero;
13544 if (sizeof(long) < sizeof(long)) {
13545 return PyInt_FromLong((long) value);
13546 } else if (sizeof(long) <= sizeof(unsigned long)) {
13547 return PyLong_FromUnsignedLong((unsigned long) value);
13548 #ifdef HAVE_LONG_LONG
13549 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13550 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13554 if (sizeof(long) <= sizeof(long)) {
13555 return PyInt_FromLong((long) value);
13556 #ifdef HAVE_LONG_LONG
13557 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13558 return PyLong_FromLongLong((PY_LONG_LONG) value);
13563 int one = 1; int little = (int)*(unsigned char *)&one;
13564 unsigned char *bytes = (unsigned char *)&value;
13565 return _PyLong_FromByteArray(bytes, sizeof(long),
13566 little, !is_unsigned);
13571 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
13572 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
13573 const int is_unsigned = neg_one > const_zero;
13574 #if PY_MAJOR_VERSION < 3
13575 if (likely(PyInt_Check(x))) {
13576 if (sizeof(long) < sizeof(long)) {
13577 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
13579 long val = PyInt_AS_LONG(x);
13580 if (is_unsigned && unlikely(val < 0)) {
13581 goto raise_neg_overflow;
13587 if (likely(PyLong_Check(x))) {
13589 #if CYTHON_USE_PYLONG_INTERNALS
13590 const digit* digits = ((PyLongObject*)x)->ob_digit;
13591 switch (Py_SIZE(x)) {
13592 case 0: return (long) 0;
13593 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
13595 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13596 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13597 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13598 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
13599 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13604 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13605 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13606 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13607 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
13608 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13613 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13614 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13615 __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])))
13616 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
13617 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
13623 #if CYTHON_COMPILING_IN_CPYTHON
13624 if (unlikely(Py_SIZE(x) < 0)) {
13625 goto raise_neg_overflow;
13629 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13630 if (unlikely(result < 0))
13632 if (unlikely(result == 1))
13633 goto raise_neg_overflow;
13636 if (sizeof(long) <= sizeof(unsigned long)) {
13637 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
13638 #ifdef HAVE_LONG_LONG
13639 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13640 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13644 #if CYTHON_USE_PYLONG_INTERNALS
13645 const digit* digits = ((PyLongObject*)x)->ob_digit;
13646 switch (Py_SIZE(x)) {
13647 case 0: return (long) 0;
13648 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
13649 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
13651 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
13652 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13653 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13654 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13655 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13660 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
13661 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13662 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13663 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13664 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13669 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
13670 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13671 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13672 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13673 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13678 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
13679 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13680 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13681 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13682 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13687 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
13688 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13689 __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])))
13690 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13691 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13696 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
13697 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13698 __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])))
13699 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
13700 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
13706 if (sizeof(long) <= sizeof(long)) {
13707 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
13708 #ifdef HAVE_LONG_LONG
13709 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13710 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
13715 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13716 PyErr_SetString(PyExc_RuntimeError,
13717 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13720 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13721 #if PY_MAJOR_VERSION < 3
13722 if (likely(v) && !PyLong_Check(v)) {
13724 v = PyNumber_Long(tmp);
13729 int one = 1; int is_little = (int)*(unsigned char *)&one;
13730 unsigned char *bytes = (unsigned char *)&val;
13731 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13732 bytes, sizeof(val),
13733 is_little, !is_unsigned);
13743 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13744 if (!tmp) return (long) -1;
13745 val = __Pyx_PyInt_As_long(tmp);
13750 PyErr_SetString(PyExc_OverflowError,
13751 "value too large to convert to long");
13753 raise_neg_overflow:
13754 PyErr_SetString(PyExc_OverflowError,
13755 "can't convert negative value to long");
13760 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13761 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
13762 const int is_unsigned = neg_one > const_zero;
13763 #if PY_MAJOR_VERSION < 3
13764 if (likely(PyInt_Check(x))) {
13765 if (sizeof(int) < sizeof(long)) {
13766 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
13768 long val = PyInt_AS_LONG(x);
13769 if (is_unsigned && unlikely(val < 0)) {
13770 goto raise_neg_overflow;
13776 if (likely(PyLong_Check(x))) {
13778 #if CYTHON_USE_PYLONG_INTERNALS
13779 const digit* digits = ((PyLongObject*)x)->ob_digit;
13780 switch (Py_SIZE(x)) {
13781 case 0: return (int) 0;
13782 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
13784 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13785 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13786 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13787 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
13788 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13793 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13794 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13795 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13796 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
13797 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13802 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13803 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13804 __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])))
13805 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
13806 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13812 #if CYTHON_COMPILING_IN_CPYTHON
13813 if (unlikely(Py_SIZE(x) < 0)) {
13814 goto raise_neg_overflow;
13818 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13819 if (unlikely(result < 0))
13821 if (unlikely(result == 1))
13822 goto raise_neg_overflow;
13825 if (sizeof(int) <= sizeof(unsigned long)) {
13826 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13827 #ifdef HAVE_LONG_LONG
13828 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13829 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13833 #if CYTHON_USE_PYLONG_INTERNALS
13834 const digit* digits = ((PyLongObject*)x)->ob_digit;
13835 switch (Py_SIZE(x)) {
13836 case 0: return (int) 0;
13837 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
13838 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
13840 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
13841 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13842 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13843 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13844 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13849 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13850 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13851 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13852 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13853 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13858 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13859 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13860 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13861 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13862 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13867 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13868 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13869 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13870 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13871 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13876 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13877 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13878 __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])))
13879 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13880 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13885 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13886 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13887 __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])))
13888 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13889 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13895 if (sizeof(int) <= sizeof(long)) {
13896 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13897 #ifdef HAVE_LONG_LONG
13898 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13899 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13904 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13905 PyErr_SetString(PyExc_RuntimeError,
13906 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13909 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13910 #if PY_MAJOR_VERSION < 3
13911 if (likely(v) && !PyLong_Check(v)) {
13913 v = PyNumber_Long(tmp);
13918 int one = 1; int is_little = (int)*(unsigned char *)&one;
13919 unsigned char *bytes = (unsigned char *)&val;
13920 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13921 bytes, sizeof(val),
13922 is_little, !is_unsigned);
13932 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13933 if (!tmp) return (int) -1;
13934 val = __Pyx_PyInt_As_int(tmp);
13939 PyErr_SetString(PyExc_OverflowError,
13940 "value too large to convert to int");
13942 raise_neg_overflow:
13943 PyErr_SetString(PyExc_OverflowError,
13944 "can't convert negative value to int");
13948 /* FastTypeChecks */
13949 #if CYTHON_COMPILING_IN_CPYTHON
13950 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
13956 return b == &PyBaseObject_Type;
13958 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
13960 if (a == b) return 1;
13964 n = PyTuple_GET_SIZE(mro);
13965 for (i = 0; i < n; i++) {
13966 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
13971 return __Pyx_InBases(a, b);
13973 #if PY_MAJOR_VERSION == 2
13974 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
13975 PyObject *exception, *value, *tb;
13977 __Pyx_PyThreadState_declare
13978 __Pyx_PyThreadState_assign
13979 __Pyx_ErrFetch(&exception, &value, &tb);
13980 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
13981 if (unlikely(res == -1)) {
13982 PyErr_WriteUnraisable(err);
13986 res = PyObject_IsSubclass(err, exc_type2);
13987 if (unlikely(res == -1)) {
13988 PyErr_WriteUnraisable(err);
13992 __Pyx_ErrRestore(exception, value, tb);
13996 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
13997 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
13999 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14004 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14006 assert(PyExceptionClass_Check(exc_type));
14007 n = PyTuple_GET_SIZE(tuple);
14008 #if PY_MAJOR_VERSION >= 3
14009 for (i=0; i<n; i++) {
14010 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14013 for (i=0; i<n; i++) {
14014 PyObject *t = PyTuple_GET_ITEM(tuple, i);
14015 #if PY_MAJOR_VERSION < 3
14016 if (likely(exc_type == t)) return 1;
14018 if (likely(PyExceptionClass_Check(t))) {
14019 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14025 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14026 if (likely(err == exc_type)) return 1;
14027 if (likely(PyExceptionClass_Check(err))) {
14028 if (likely(PyExceptionClass_Check(exc_type))) {
14029 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14030 } else if (likely(PyTuple_Check(exc_type))) {
14031 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14035 return PyErr_GivenExceptionMatches(err, exc_type);
14037 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14038 assert(PyExceptionClass_Check(exc_type1));
14039 assert(PyExceptionClass_Check(exc_type2));
14040 if (likely(err == exc_type1 || err == exc_type2)) return 1;
14041 if (likely(PyExceptionClass_Check(err))) {
14042 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14044 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14048 /* CheckBinaryVersion */
14049 static int __Pyx_check_binary_version(void) {
14050 char ctversion[4], rtversion[4];
14051 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
14052 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
14053 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
14055 PyOS_snprintf(message, sizeof(message),
14056 "compiletime version %s of module '%.100s' "
14057 "does not match runtime version %s",
14058 ctversion, __Pyx_MODULE_NAME, rtversion);
14059 return PyErr_WarnEx(NULL, message, 1);
14064 /* FunctionExport */
14065 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
14067 PyObject *cobj = 0;
14072 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
14079 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
14083 #if PY_VERSION_HEX >= 0x02070000
14084 cobj = PyCapsule_New(tmp.p, sig, 0);
14086 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
14090 if (PyDict_SetItemString(d, name, cobj) < 0)
14102 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
14104 #if PY_MAJOR_VERSION < 3
14105 if (t->is_unicode) {
14106 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14107 } else if (t->intern) {
14108 *t->p = PyString_InternFromString(t->s);
14110 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14113 if (t->is_unicode | t->is_str) {
14115 *t->p = PyUnicode_InternFromString(t->s);
14116 } else if (t->encoding) {
14117 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14119 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14122 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14127 if (PyObject_Hash(*t->p) == -1)
14134 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
14135 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
14137 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14139 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
14141 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14142 #if !CYTHON_PEP393_ENABLED
14143 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14145 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
14146 if (!defenc) return NULL;
14147 defenc_c = PyBytes_AS_STRING(defenc);
14148 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14150 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14152 for (c = defenc_c; c < end; c++) {
14153 if ((unsigned char) (*c) >= 128) {
14154 PyUnicode_AsASCIIString(o);
14160 *length = PyBytes_GET_SIZE(defenc);
14164 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14165 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
14166 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14167 if (likely(PyUnicode_IS_ASCII(o))) {
14168 *length = PyUnicode_GET_LENGTH(o);
14169 return PyUnicode_AsUTF8(o);
14171 PyUnicode_AsASCIIString(o);
14175 return PyUnicode_AsUTF8AndSize(o, length);
14180 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14181 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14183 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14184 __Pyx_sys_getdefaultencoding_not_ascii &&
14186 PyUnicode_Check(o)) {
14187 return __Pyx_PyUnicode_AsStringAndSize(o, length);
14190 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
14191 if (PyByteArray_Check(o)) {
14192 *length = PyByteArray_GET_SIZE(o);
14193 return PyByteArray_AS_STRING(o);
14198 int r = PyBytes_AsStringAndSize(o, &result, length);
14199 if (unlikely(r < 0)) {
14206 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
14207 int is_true = x == Py_True;
14208 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
14209 else return PyObject_IsTrue(x);
14211 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
14213 if (unlikely(!x)) return -1;
14214 retval = __Pyx_PyObject_IsTrue(x);
14218 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
14219 #if PY_MAJOR_VERSION >= 3
14220 if (PyLong_Check(result)) {
14221 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
14222 "__int__ returned non-int (type %.200s). "
14223 "The ability to return an instance of a strict subclass of int "
14224 "is deprecated, and may be removed in a future version of Python.",
14225 Py_TYPE(result)->tp_name)) {
14232 PyErr_Format(PyExc_TypeError,
14233 "__%.4s__ returned non-%.4s (type %.200s)",
14234 type_name, type_name, Py_TYPE(result)->tp_name);
14238 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
14239 #if CYTHON_USE_TYPE_SLOTS
14240 PyNumberMethods *m;
14242 const char *name = NULL;
14243 PyObject *res = NULL;
14244 #if PY_MAJOR_VERSION < 3
14245 if (likely(PyInt_Check(x) || PyLong_Check(x)))
14247 if (likely(PyLong_Check(x)))
14249 return __Pyx_NewRef(x);
14250 #if CYTHON_USE_TYPE_SLOTS
14251 m = Py_TYPE(x)->tp_as_number;
14252 #if PY_MAJOR_VERSION < 3
14253 if (m && m->nb_int) {
14255 res = m->nb_int(x);
14257 else if (m && m->nb_long) {
14259 res = m->nb_long(x);
14262 if (likely(m && m->nb_int)) {
14264 res = m->nb_int(x);
14268 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
14269 res = PyNumber_Int(x);
14273 #if PY_MAJOR_VERSION < 3
14274 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
14276 if (unlikely(!PyLong_CheckExact(res))) {
14278 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14281 else if (!PyErr_Occurred()) {
14282 PyErr_SetString(PyExc_TypeError,
14283 "an integer is required");
14287 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14290 #if PY_MAJOR_VERSION < 3
14291 if (likely(PyInt_CheckExact(b))) {
14292 if (sizeof(Py_ssize_t) >= sizeof(long))
14293 return PyInt_AS_LONG(b);
14295 return PyInt_AsSsize_t(b);
14298 if (likely(PyLong_CheckExact(b))) {
14299 #if CYTHON_USE_PYLONG_INTERNALS
14300 const digit* digits = ((PyLongObject*)b)->ob_digit;
14301 const Py_ssize_t size = Py_SIZE(b);
14302 if (likely(__Pyx_sst_abs(size) <= 1)) {
14303 ival = likely(size) ? digits[0] : 0;
14304 if (size == -1) ival = -ival;
14309 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14310 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14314 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14315 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14319 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14320 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14324 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14325 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14329 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14330 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]));
14334 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14335 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]));
14341 return PyLong_AsSsize_t(b);
14343 x = PyNumber_Index(b);
14345 ival = PyInt_AsSsize_t(x);
14349 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14350 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14352 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14353 return PyInt_FromSize_t(ival);
14357 #endif /* Py_PYTHON_H */