1 /* Generated by Cython 0.29.18 */
3 /* BEGIN: Cython Metadata
8 "CYTHON_CLINE_IN_TRACEBACK",
12 "extra_compile_args": [
16 "/usr/include/libxml2",
20 "name": "lxml.builder",
25 "module_name": "lxml.builder"
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__builder
621 #define __PYX_HAVE_API__lxml__builder
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[] = {
831 "src/lxml/builder.py",
835 /*--- Type declarations ---*/
836 struct __pyx_obj_4lxml_7builder_ElementMaker;
837 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__;
839 /* "lxml/builder.pxd":6
840 * cdef object partial
842 * cdef class ElementMaker: # <<<<<<<<<<<<<<
843 * cdef readonly dict _nsmap
844 * cdef readonly dict _typemap
846 struct __pyx_obj_4lxml_7builder_ElementMaker {
850 PyObject *_namespace;
851 PyObject *_makeelement;
855 /* "lxml/builder.py":148
858 * def __init__(self, typemap=None, # <<<<<<<<<<<<<<
859 * namespace=None, nsmap=None, makeelement=None):
860 * if namespace is not None:
862 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ {
864 PyObject *__pyx_v_typemap;
868 /* --- Runtime support code (head) --- */
870 #ifndef CYTHON_REFNANNY
871 #define CYTHON_REFNANNY 0
875 void (*INCREF)(void*, PyObject*, int);
876 void (*DECREF)(void*, PyObject*, int);
877 void (*GOTREF)(void*, PyObject*, int);
878 void (*GIVEREF)(void*, PyObject*, int);
879 void* (*SetupContext)(const char*, int, const char*);
880 void (*FinishContext)(void**);
881 } __Pyx_RefNannyAPIStruct;
882 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
883 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
884 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
886 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
888 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
889 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
890 PyGILState_Release(__pyx_gilstate_save);\
892 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
895 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
896 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
898 #define __Pyx_RefNannyFinishContext()\
899 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
900 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
901 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
902 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
903 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
904 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
905 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
906 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
907 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
909 #define __Pyx_RefNannyDeclarations
910 #define __Pyx_RefNannySetupContext(name, acquire_gil)
911 #define __Pyx_RefNannyFinishContext()
912 #define __Pyx_INCREF(r) Py_INCREF(r)
913 #define __Pyx_DECREF(r) Py_DECREF(r)
914 #define __Pyx_GOTREF(r)
915 #define __Pyx_GIVEREF(r)
916 #define __Pyx_XINCREF(r) Py_XINCREF(r)
917 #define __Pyx_XDECREF(r) Py_XDECREF(r)
918 #define __Pyx_XGOTREF(r)
919 #define __Pyx_XGIVEREF(r)
921 #define __Pyx_XDECREF_SET(r, v) do {\
922 PyObject *tmp = (PyObject *) r;\
923 r = v; __Pyx_XDECREF(tmp);\
925 #define __Pyx_DECREF_SET(r, v) do {\
926 PyObject *tmp = (PyObject *) r;\
927 r = v; __Pyx_DECREF(tmp);\
929 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
930 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
932 /* PyObjectGetAttrStr.proto */
933 #if CYTHON_USE_TYPE_SLOTS
934 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
936 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
939 /* GetBuiltinName.proto */
940 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
942 /* RaiseDoubleKeywords.proto */
943 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
945 /* ParseKeywords.proto */
946 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
947 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
948 const char* function_name);
950 /* RaiseArgTupleInvalid.proto */
951 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
952 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
954 /* GetItemInt.proto */
955 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
956 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
957 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
958 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
959 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
960 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
961 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
962 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
963 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
964 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
965 int wraparound, int boundscheck);
966 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
967 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
968 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
969 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
970 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
971 int wraparound, int boundscheck);
972 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
973 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
974 int is_list, int wraparound, int boundscheck);
976 /* PyObjectSetAttrStr.proto */
977 #if CYTHON_USE_TYPE_SLOTS
978 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
979 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
981 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
982 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
985 /* GetTopmostException.proto */
986 #if CYTHON_USE_EXC_INFO_STACK
987 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
990 /* PyThreadStateGet.proto */
991 #if CYTHON_FAST_THREAD_STATE
992 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
993 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
994 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
996 #define __Pyx_PyThreadState_declare
997 #define __Pyx_PyThreadState_assign
998 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1001 /* SaveResetException.proto */
1002 #if CYTHON_FAST_THREAD_STATE
1003 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1004 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1005 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1006 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1008 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1009 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1012 /* PyErrExceptionMatches.proto */
1013 #if CYTHON_FAST_THREAD_STATE
1014 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1015 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1017 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1020 /* GetException.proto */
1021 #if CYTHON_FAST_THREAD_STATE
1022 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1023 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1025 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1028 /* PyCFunctionFastCall.proto */
1029 #if CYTHON_FAST_PYCCALL
1030 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1032 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1035 /* PyFunctionFastCall.proto */
1036 #if CYTHON_FAST_PYCALL
1037 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1038 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1039 #if 1 || PY_VERSION_HEX < 0x030600B1
1040 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1042 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1044 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1045 (sizeof(char [1 - 2*!(cond)]) - 1)
1046 #ifndef Py_MEMBER_SIZE
1047 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1049 static size_t __pyx_pyframe_localsplus_offset = 0;
1050 #include "frameobject.h"
1051 #define __Pxy_PyFrame_Initialize_Offsets()\
1052 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1053 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1054 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1055 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1058 /* PyObjectCall.proto */
1059 #if CYTHON_COMPILING_IN_CPYTHON
1060 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1062 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1065 /* PyObjectCallMethO.proto */
1066 #if CYTHON_COMPILING_IN_CPYTHON
1067 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1070 /* PyObjectCallOneArg.proto */
1071 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1073 /* PyErrFetchRestore.proto */
1074 #if CYTHON_FAST_THREAD_STATE
1075 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1076 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1077 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1078 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1079 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1080 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1081 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1082 #if CYTHON_COMPILING_IN_CPYTHON
1083 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1085 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1088 #define __Pyx_PyErr_Clear() PyErr_Clear()
1089 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1090 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1091 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1092 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1093 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1094 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1095 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1098 /* RaiseException.proto */
1099 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1101 /* PyObjectCallNoArg.proto */
1102 #if CYTHON_COMPILING_IN_CPYTHON
1103 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1105 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1108 /* RaiseTooManyValuesToUnpack.proto */
1109 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1111 /* RaiseNeedMoreValuesToUnpack.proto */
1112 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1114 /* IterFinish.proto */
1115 static CYTHON_INLINE int __Pyx_IterFinish(void);
1117 /* UnpackItemEndCheck.proto */
1118 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1120 /* PyDictVersioning.proto */
1121 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1122 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1123 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1124 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1125 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1126 (cache_var) = (value);
1127 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1128 static PY_UINT64_T __pyx_dict_version = 0;\
1129 static PyObject *__pyx_dict_cached_value = NULL;\
1130 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1131 (VAR) = __pyx_dict_cached_value;\
1133 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1134 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1137 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1138 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1139 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1141 #define __PYX_GET_DICT_VERSION(dict) (0)
1142 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1143 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1146 /* GetModuleGlobalName.proto */
1147 #if CYTHON_USE_DICT_VERSIONS
1148 #define __Pyx_GetModuleGlobalName(var, name) {\
1149 static PY_UINT64_T __pyx_dict_version = 0;\
1150 static PyObject *__pyx_dict_cached_value = NULL;\
1151 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1152 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1153 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1155 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1156 PY_UINT64_T __pyx_dict_version;\
1157 PyObject *__pyx_dict_cached_value;\
1158 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1160 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1162 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1163 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1164 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1168 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1170 /* ObjectGetItem.proto */
1171 #if CYTHON_USE_TYPE_SLOTS
1172 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1174 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1177 /* CallableCheck.proto */
1178 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
1179 #define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL)
1181 #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj)
1184 /* FetchCommonType.proto */
1185 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1187 /* CythonFunctionShared.proto */
1188 #define __Pyx_CyFunction_USED 1
1189 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1190 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1191 #define __Pyx_CYFUNCTION_CCLASS 0x04
1192 #define __Pyx_CyFunction_GetClosure(f)\
1193 (((__pyx_CyFunctionObject *) (f))->func_closure)
1194 #define __Pyx_CyFunction_GetClassObj(f)\
1195 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1196 #define __Pyx_CyFunction_Defaults(type, f)\
1197 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1198 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1199 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1201 PyCFunctionObject func;
1202 #if PY_VERSION_HEX < 0x030500A0
1203 PyObject *func_weakreflist;
1205 PyObject *func_dict;
1206 PyObject *func_name;
1207 PyObject *func_qualname;
1209 PyObject *func_globals;
1210 PyObject *func_code;
1211 PyObject *func_closure;
1212 PyObject *func_classobj;
1214 int defaults_pyobjects;
1215 size_t defaults_size; // used by FusedFunction for copying defaults
1217 PyObject *defaults_tuple;
1218 PyObject *defaults_kwdict;
1219 PyObject *(*defaults_getter)(PyObject *);
1220 PyObject *func_annotations;
1221 } __pyx_CyFunctionObject;
1222 static PyTypeObject *__pyx_CyFunctionType = 0;
1223 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1224 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1225 int flags, PyObject* qualname,
1227 PyObject *module, PyObject *globals,
1229 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1232 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1234 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1236 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1238 static int __pyx_CyFunction_init(void);
1240 /* CythonFunction.proto */
1241 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1242 int flags, PyObject* qualname,
1244 PyObject *module, PyObject *globals,
1247 /* PySequenceContains.proto */
1248 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1249 int result = PySequence_Contains(seq, item);
1250 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1253 /* IncludeStringH.proto */
1256 /* BytesEquals.proto */
1257 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1259 /* UnicodeEquals.proto */
1260 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1262 /* StrEquals.proto */
1263 #if PY_MAJOR_VERSION >= 3
1264 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1266 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1269 /* DictGetItem.proto */
1270 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1271 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1272 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1273 (likely(PyDict_CheckExact(obj)) ?\
1274 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1276 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1277 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1280 /* dict_getitem_default.proto */
1281 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1283 /* UnpackUnboundCMethod.proto */
1286 PyObject **method_name;
1290 } __Pyx_CachedCFunction;
1292 /* CallUnboundCMethod1.proto */
1293 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1294 #if CYTHON_COMPILING_IN_CPYTHON
1295 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1297 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1300 /* CallUnboundCMethod2.proto */
1301 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1302 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1303 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1305 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1308 /* PyObjectCall2Args.proto */
1309 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1311 /* ListAppend.proto */
1312 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1313 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1314 PyListObject* L = (PyListObject*) list;
1315 Py_ssize_t len = Py_SIZE(list);
1316 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1318 PyList_SET_ITEM(list, len, x);
1319 Py_SIZE(list) = len+1;
1322 return PyList_Append(list, x);
1325 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1328 /* PyObjectGetMethod.proto */
1329 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1331 /* PyObjectCallMethod1.proto */
1332 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1335 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1338 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1340 /* GetAttr3.proto */
1341 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1344 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1346 /* ImportFrom.proto */
1347 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1350 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1352 /* PyObject_GenericGetAttrNoDict.proto */
1353 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1354 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1356 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1359 /* PyObject_GenericGetAttr.proto */
1360 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1361 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1363 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1366 /* PyObjectGetAttrStrNoError.proto */
1367 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1369 /* SetupReduce.proto */
1370 static int __Pyx_setup_reduce(PyObject* type_obj);
1372 /* RegisterModuleCleanup.proto */
1373 static void __pyx_module_cleanup(PyObject *self);
1374 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1375 static int __Pyx_RegisterCleanup(void);
1377 #define __Pyx_RegisterCleanup() (0)
1380 /* CLineInTraceback.proto */
1381 #ifdef CYTHON_CLINE_IN_TRACEBACK
1382 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1384 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1387 /* CodeObjectCache.proto */
1389 PyCodeObject* code_object;
1391 } __Pyx_CodeObjectCacheEntry;
1392 struct __Pyx_CodeObjectCache {
1395 __Pyx_CodeObjectCacheEntry* entries;
1397 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1398 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1399 static PyCodeObject *__pyx_find_code_object(int code_line);
1400 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1402 /* AddTraceback.proto */
1403 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1404 int py_line, const char *filename);
1406 /* CIntToPy.proto */
1407 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1409 /* CIntFromPy.proto */
1410 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1412 /* CIntFromPy.proto */
1413 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1415 /* FastTypeChecks.proto */
1416 #if CYTHON_COMPILING_IN_CPYTHON
1417 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1418 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1419 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1420 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1422 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1423 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1424 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1426 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1428 /* CheckBinaryVersion.proto */
1429 static int __Pyx_check_binary_version(void);
1431 /* VoidPtrExport.proto */
1432 static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig);
1434 /* InitStrings.proto */
1435 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1438 /* Module declarations from 'lxml.builder' */
1439 static PyTypeObject *__pyx_ptype_4lxml_7builder_ElementMaker = 0;
1440 static PyTypeObject *__pyx_ptype_4lxml_7builder___pyx_scope_struct____init__ = 0;
1441 static PyObject *__pyx_v_4lxml_7builder_ET = 0;
1442 static PyObject *__pyx_v_4lxml_7builder_partial = 0;
1443 static PyObject *__pyx_f_4lxml_7builder___pyx_unpickle_ElementMaker__set_state(struct __pyx_obj_4lxml_7builder_ElementMaker *, PyObject *); /*proto*/
1444 #define __Pyx_MODULE_NAME "lxml.builder"
1445 extern int __pyx_module_is_main_lxml__builder;
1446 int __pyx_module_is_main_lxml__builder = 0;
1448 /* Implementation of 'lxml.builder' */
1449 static PyObject *__pyx_builtin_NameError;
1450 static PyObject *__pyx_builtin_IndexError;
1451 static PyObject *__pyx_builtin_ValueError;
1452 static PyObject *__pyx_builtin_TypeError;
1453 static const char __pyx_k_[] = "";
1454 static const char __pyx_k_E[] = "E";
1455 static const char __pyx_k_k[] = "k";
1456 static const char __pyx_k_v[] = "v";
1457 static const char __pyx_k_ET[] = "ET";
1458 static const char __pyx_k__2[] = "{";
1459 static const char __pyx_k__3[] = "}";
1460 static const char __pyx_k__10[] = "*";
1461 static const char __pyx_k_get[] = "get";
1462 static const char __pyx_k_mro[] = "__mro__";
1463 static const char __pyx_k_new[] = "__new__";
1464 static const char __pyx_k_tag[] = "tag";
1465 static const char __pyx_k_dict[] = "__dict__";
1466 static const char __pyx_k_elem[] = "elem";
1467 static const char __pyx_k_item[] = "item";
1468 static const char __pyx_k_main[] = "__main__";
1469 static const char __pyx_k_name[] = "__name__";
1470 static const char __pyx_k_self[] = "self";
1471 static const char __pyx_k_tail[] = "tail";
1472 static const char __pyx_k_test[] = "__test__";
1473 static const char __pyx_k_text[] = "text";
1474 static const char __pyx_k_CDATA[] = "CDATA";
1475 static const char __pyx_k_cdata[] = "cdata";
1476 static const char __pyx_k_items[] = "items";
1477 static const char __pyx_k_nsmap[] = "nsmap";
1478 static const char __pyx_k_state[] = "state";
1479 static const char __pyx_k_append[] = "append";
1480 static const char __pyx_k_attrib[] = "attrib";
1481 static const char __pyx_k_dict_2[] = "_dict";
1482 static const char __pyx_k_import[] = "__import__";
1483 static const char __pyx_k_pickle[] = "pickle";
1484 static const char __pyx_k_reduce[] = "__reduce__";
1485 static const char __pyx_k_update[] = "update";
1486 static const char __pyx_k_Element[] = "Element";
1487 static const char __pyx_k_partial[] = "partial";
1488 static const char __pyx_k_typemap[] = "typemap";
1489 static const char __pyx_k_unicode[] = "unicode";
1490 static const char __pyx_k_add_dict[] = "add_dict";
1491 static const char __pyx_k_add_text[] = "add_text";
1492 static const char __pyx_k_getstate[] = "__getstate__";
1493 static const char __pyx_k_pyx_capi[] = "__pyx_capi__";
1494 static const char __pyx_k_pyx_type[] = "__pyx_type";
1495 static const char __pyx_k_setstate[] = "__setstate__";
1496 static const char __pyx_k_NameError[] = "NameError";
1497 static const char __pyx_k_TypeError[] = "TypeError";
1498 static const char __pyx_k_add_cdata[] = "add_cdata";
1499 static const char __pyx_k_functools[] = "functools";
1500 static const char __pyx_k_iselement[] = "iselement";
1501 static const char __pyx_k_namespace[] = "namespace";
1502 static const char __pyx_k_pyx_state[] = "__pyx_state";
1503 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1504 static const char __pyx_k_IndexError[] = "IndexError";
1505 static const char __pyx_k_ValueError[] = "ValueError";
1506 static const char __pyx_k_basestring[] = "basestring";
1507 static const char __pyx_k_lxml_etree[] = "lxml.etree";
1508 static const char __pyx_k_pyx_result[] = "__pyx_result";
1509 static const char __pyx_k_PickleError[] = "PickleError";
1510 static const char __pyx_k_makeelement[] = "makeelement";
1511 static const char __pyx_k_ElementMaker[] = "ElementMaker";
1512 static const char __pyx_k_lxml_builder[] = "lxml.builder";
1513 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1514 static const char __pyx_k_stringsource[] = "stringsource";
1515 static const char __pyx_k_use_setstate[] = "use_setstate";
1516 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1517 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1518 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1519 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1520 static const char __pyx_k_src_lxml_builder_py[] = "src/lxml/builder.py";
1521 static const char __pyx_k_bad_argument_type_s_r[] = "bad argument type: %s(%r)";
1522 static const char __pyx_k_init___locals_add_dict[] = "__init__.<locals>.add_dict";
1523 static const char __pyx_k_init___locals_add_text[] = "__init__.<locals>.add_text";
1524 static const char __pyx_k_init___locals_add_cdata[] = "__init__.<locals>.add_cdata";
1525 static const char __pyx_k_pyx_unpickle_ElementMaker[] = "__pyx_unpickle_ElementMaker";
1526 static const char __pyx_k_ElementMaker___reduce_cython[] = "ElementMaker.__reduce_cython__";
1527 static const char __pyx_k_ElementMaker___setstate_cython[] = "ElementMaker.__setstate_cython__";
1528 static const char __pyx_k_The_E_Element_factory_for_gener[] = "\nThe ``E`` Element factory for generating XML documents.\n";
1529 static const char __pyx_k_Can_t_add_a_CDATA_section_Elemen[] = "Can't add a CDATA section. Element already has some text: %r";
1530 static const char __pyx_k_Incompatible_checksums_s_vs_0x9f[] = "Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))";
1531 static PyObject *__pyx_kp_s_;
1532 static PyObject *__pyx_n_s_CDATA;
1533 static PyObject *__pyx_kp_s_Can_t_add_a_CDATA_section_Elemen;
1534 static PyObject *__pyx_n_s_E;
1535 static PyObject *__pyx_n_s_ET;
1536 static PyObject *__pyx_n_s_Element;
1537 static PyObject *__pyx_n_s_ElementMaker;
1538 static PyObject *__pyx_n_s_ElementMaker___reduce_cython;
1539 static PyObject *__pyx_n_s_ElementMaker___setstate_cython;
1540 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x9f;
1541 static PyObject *__pyx_n_s_IndexError;
1542 static PyObject *__pyx_n_s_NameError;
1543 static PyObject *__pyx_n_s_PickleError;
1544 static PyObject *__pyx_n_s_TypeError;
1545 static PyObject *__pyx_n_s_ValueError;
1546 static PyObject *__pyx_n_s__10;
1547 static PyObject *__pyx_kp_s__2;
1548 static PyObject *__pyx_kp_s__3;
1549 static PyObject *__pyx_n_s_add_cdata;
1550 static PyObject *__pyx_n_s_add_dict;
1551 static PyObject *__pyx_n_s_add_text;
1552 static PyObject *__pyx_n_s_append;
1553 static PyObject *__pyx_n_s_attrib;
1554 static PyObject *__pyx_kp_s_bad_argument_type_s_r;
1555 static PyObject *__pyx_n_s_basestring;
1556 static PyObject *__pyx_n_s_cdata;
1557 static PyObject *__pyx_n_s_cline_in_traceback;
1558 static PyObject *__pyx_n_s_dict;
1559 static PyObject *__pyx_n_s_dict_2;
1560 static PyObject *__pyx_n_s_elem;
1561 static PyObject *__pyx_n_s_functools;
1562 static PyObject *__pyx_n_s_get;
1563 static PyObject *__pyx_n_s_getstate;
1564 static PyObject *__pyx_n_s_import;
1565 static PyObject *__pyx_n_s_init___locals_add_cdata;
1566 static PyObject *__pyx_n_s_init___locals_add_dict;
1567 static PyObject *__pyx_n_s_init___locals_add_text;
1568 static PyObject *__pyx_n_s_iselement;
1569 static PyObject *__pyx_n_s_item;
1570 static PyObject *__pyx_n_s_items;
1571 static PyObject *__pyx_n_s_k;
1572 static PyObject *__pyx_n_s_lxml_builder;
1573 static PyObject *__pyx_n_s_lxml_etree;
1574 static PyObject *__pyx_n_s_main;
1575 static PyObject *__pyx_n_s_makeelement;
1576 static PyObject *__pyx_n_s_mro;
1577 static PyObject *__pyx_n_s_name;
1578 static PyObject *__pyx_n_s_namespace;
1579 static PyObject *__pyx_n_s_new;
1580 static PyObject *__pyx_n_s_nsmap;
1581 static PyObject *__pyx_n_s_partial;
1582 static PyObject *__pyx_n_s_pickle;
1583 static PyObject *__pyx_n_s_pyx_PickleError;
1584 static PyObject *__pyx_n_s_pyx_capi;
1585 static PyObject *__pyx_n_s_pyx_checksum;
1586 static PyObject *__pyx_n_s_pyx_result;
1587 static PyObject *__pyx_n_s_pyx_state;
1588 static PyObject *__pyx_n_s_pyx_type;
1589 static PyObject *__pyx_n_s_pyx_unpickle_ElementMaker;
1590 static PyObject *__pyx_n_s_reduce;
1591 static PyObject *__pyx_n_s_reduce_cython;
1592 static PyObject *__pyx_n_s_reduce_ex;
1593 static PyObject *__pyx_n_s_self;
1594 static PyObject *__pyx_n_s_setstate;
1595 static PyObject *__pyx_n_s_setstate_cython;
1596 static PyObject *__pyx_kp_s_src_lxml_builder_py;
1597 static PyObject *__pyx_n_s_state;
1598 static PyObject *__pyx_kp_s_stringsource;
1599 static PyObject *__pyx_n_s_tag;
1600 static PyObject *__pyx_n_s_tail;
1601 static PyObject *__pyx_n_s_test;
1602 static PyObject *__pyx_n_s_text;
1603 static PyObject *__pyx_n_s_typemap;
1604 static PyObject *__pyx_n_s_unicode;
1605 static PyObject *__pyx_n_s_update;
1606 static PyObject *__pyx_n_s_use_setstate;
1607 static PyObject *__pyx_n_s_v;
1608 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___add_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_item); /* proto */
1609 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___2add_cdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_cdata); /* proto */
1610 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___4add_dict(PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_item); /* proto */
1611 static int __pyx_pf_4lxml_7builder_12ElementMaker___init__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_typemap, PyObject *__pyx_v_namespace, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_makeelement); /* proto */
1612 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_2__call__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_children, PyObject *__pyx_v_attrib); /* proto */
1613 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_4__getattr__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
1614 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_6_nsmap___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self); /* proto */
1615 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8_typemap___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self); /* proto */
1616 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_10_namespace___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self); /* proto */
1617 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_12_makeelement___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self); /* proto */
1618 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_6__reduce_cython__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self); /* proto */
1619 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__setstate_cython__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1620 static PyObject *__pyx_pf_4lxml_7builder___pyx_unpickle_ElementMaker(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1621 static PyObject *__pyx_tp_new_4lxml_7builder_ElementMaker(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1622 static PyObject *__pyx_tp_new_4lxml_7builder___pyx_scope_struct____init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1623 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
1624 static PyObject *__pyx_int_167522209;
1625 static PyObject *__pyx_tuple__4;
1626 static PyObject *__pyx_tuple__6;
1627 static PyObject *__pyx_tuple__8;
1628 static PyObject *__pyx_tuple__11;
1629 static PyObject *__pyx_tuple__13;
1630 static PyObject *__pyx_tuple__15;
1631 static PyObject *__pyx_codeobj__5;
1632 static PyObject *__pyx_codeobj__7;
1633 static PyObject *__pyx_codeobj__9;
1634 static PyObject *__pyx_codeobj__12;
1635 static PyObject *__pyx_codeobj__14;
1636 static PyObject *__pyx_codeobj__16;
1639 /* "lxml/builder.py":148
1642 * def __init__(self, typemap=None, # <<<<<<<<<<<<<<
1643 * namespace=None, nsmap=None, makeelement=None):
1644 * if namespace is not None:
1647 /* Python wrapper */
1648 static int __pyx_pw_4lxml_7builder_12ElementMaker_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1649 static int __pyx_pw_4lxml_7builder_12ElementMaker_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1650 PyObject *__pyx_v_typemap = 0;
1651 PyObject *__pyx_v_namespace = 0;
1652 PyObject *__pyx_v_nsmap = 0;
1653 PyObject *__pyx_v_makeelement = 0;
1654 int __pyx_lineno = 0;
1655 const char *__pyx_filename = NULL;
1656 int __pyx_clineno = 0;
1658 __Pyx_RefNannyDeclarations
1659 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1661 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typemap,&__pyx_n_s_namespace,&__pyx_n_s_nsmap,&__pyx_n_s_makeelement,0};
1662 PyObject* values[4] = {0,0,0,0};
1663 values[0] = ((PyObject *)Py_None);
1665 /* "lxml/builder.py":149
1667 * def __init__(self, typemap=None,
1668 * namespace=None, nsmap=None, makeelement=None): # <<<<<<<<<<<<<<
1669 * if namespace is not None:
1670 * self._namespace = '{' + namespace + '}'
1672 values[1] = ((PyObject *)Py_None);
1673 values[2] = ((PyObject *)Py_None);
1674 values[3] = ((PyObject *)Py_None);
1675 if (unlikely(__pyx_kwds)) {
1677 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1679 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1681 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1683 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1685 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1688 default: goto __pyx_L5_argtuple_error;
1690 kw_args = PyDict_Size(__pyx_kwds);
1694 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typemap);
1695 if (value) { values[0] = value; kw_args--; }
1700 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespace);
1701 if (value) { values[1] = value; kw_args--; }
1706 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsmap);
1707 if (value) { values[2] = value; kw_args--; }
1712 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_makeelement);
1713 if (value) { values[3] = value; kw_args--; }
1716 if (unlikely(kw_args > 0)) {
1717 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 148, __pyx_L3_error)
1720 switch (PyTuple_GET_SIZE(__pyx_args)) {
1721 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1723 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1725 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1727 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1730 default: goto __pyx_L5_argtuple_error;
1733 __pyx_v_typemap = values[0];
1734 __pyx_v_namespace = values[1];
1735 __pyx_v_nsmap = values[2];
1736 __pyx_v_makeelement = values[3];
1738 goto __pyx_L4_argument_unpacking_done;
1739 __pyx_L5_argtuple_error:;
1740 __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 148, __pyx_L3_error)
1742 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1743 __Pyx_RefNannyFinishContext();
1745 __pyx_L4_argument_unpacking_done:;
1746 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker___init__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self), __pyx_v_typemap, __pyx_v_namespace, __pyx_v_nsmap, __pyx_v_makeelement);
1748 /* "lxml/builder.py":148
1751 * def __init__(self, typemap=None, # <<<<<<<<<<<<<<
1752 * namespace=None, nsmap=None, makeelement=None):
1753 * if namespace is not None:
1756 /* function exit code */
1757 __Pyx_RefNannyFinishContext();
1761 /* "lxml/builder.py":173
1764 * def add_text(elem, item): # <<<<<<<<<<<<<<
1766 * elem[-1].tail = (elem[-1].tail or "") + item
1769 /* Python wrapper */
1770 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___1add_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1771 static PyMethodDef __pyx_mdef_4lxml_7builder_12ElementMaker_8__init___1add_text = {"add_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_7builder_12ElementMaker_8__init___1add_text, METH_VARARGS|METH_KEYWORDS, 0};
1772 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___1add_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1773 PyObject *__pyx_v_elem = 0;
1774 PyObject *__pyx_v_item = 0;
1775 int __pyx_lineno = 0;
1776 const char *__pyx_filename = NULL;
1777 int __pyx_clineno = 0;
1778 PyObject *__pyx_r = 0;
1779 __Pyx_RefNannyDeclarations
1780 __Pyx_RefNannySetupContext("add_text (wrapper)", 0);
1782 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_item,0};
1783 PyObject* values[2] = {0,0};
1784 if (unlikely(__pyx_kwds)) {
1786 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1788 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1790 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1793 default: goto __pyx_L5_argtuple_error;
1795 kw_args = PyDict_Size(__pyx_kwds);
1798 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
1799 else goto __pyx_L5_argtuple_error;
1802 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--;
1804 __Pyx_RaiseArgtupleInvalid("add_text", 1, 2, 2, 1); __PYX_ERR(0, 173, __pyx_L3_error)
1807 if (unlikely(kw_args > 0)) {
1808 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_text") < 0)) __PYX_ERR(0, 173, __pyx_L3_error)
1810 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1811 goto __pyx_L5_argtuple_error;
1813 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1814 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1816 __pyx_v_elem = values[0];
1817 __pyx_v_item = values[1];
1819 goto __pyx_L4_argument_unpacking_done;
1820 __pyx_L5_argtuple_error:;
1821 __Pyx_RaiseArgtupleInvalid("add_text", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 173, __pyx_L3_error)
1823 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
1824 __Pyx_RefNannyFinishContext();
1826 __pyx_L4_argument_unpacking_done:;
1827 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_8__init___add_text(__pyx_self, __pyx_v_elem, __pyx_v_item);
1829 /* function exit code */
1830 __Pyx_RefNannyFinishContext();
1834 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___add_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_item) {
1835 PyObject *__pyx_r = NULL;
1836 __Pyx_RefNannyDeclarations
1837 PyObject *__pyx_t_1 = NULL;
1838 PyObject *__pyx_t_2 = NULL;
1839 PyObject *__pyx_t_3 = NULL;
1840 PyObject *__pyx_t_4 = NULL;
1841 PyObject *__pyx_t_5 = NULL;
1842 PyObject *__pyx_t_6 = NULL;
1845 PyObject *__pyx_t_9 = NULL;
1846 PyObject *__pyx_t_10 = NULL;
1847 int __pyx_lineno = 0;
1848 const char *__pyx_filename = NULL;
1849 int __pyx_clineno = 0;
1850 __Pyx_RefNannySetupContext("add_text", 0);
1852 /* "lxml/builder.py":174
1854 * def add_text(elem, item):
1855 * try: # <<<<<<<<<<<<<<
1856 * elem[-1].tail = (elem[-1].tail or "") + item
1857 * except IndexError:
1860 __Pyx_PyThreadState_declare
1861 __Pyx_PyThreadState_assign
1862 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
1863 __Pyx_XGOTREF(__pyx_t_1);
1864 __Pyx_XGOTREF(__pyx_t_2);
1865 __Pyx_XGOTREF(__pyx_t_3);
1868 /* "lxml/builder.py":175
1869 * def add_text(elem, item):
1871 * elem[-1].tail = (elem[-1].tail or "") + item # <<<<<<<<<<<<<<
1872 * except IndexError:
1873 * elem.text = (elem.text or "") + item
1875 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elem, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L3_error)
1876 __Pyx_GOTREF(__pyx_t_5);
1877 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tail); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L3_error)
1878 __Pyx_GOTREF(__pyx_t_6);
1879 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1880 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 175, __pyx_L3_error)
1882 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1884 __Pyx_INCREF(__pyx_t_6);
1885 __pyx_t_4 = __pyx_t_6;
1886 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1887 goto __pyx_L9_bool_binop_done;
1889 __Pyx_INCREF(__pyx_kp_s_);
1890 __pyx_t_4 = __pyx_kp_s_;
1891 __pyx_L9_bool_binop_done:;
1892 __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_v_item); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L3_error)
1893 __Pyx_GOTREF(__pyx_t_6);
1894 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1895 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elem, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L3_error)
1896 __Pyx_GOTREF(__pyx_t_4);
1897 if (__Pyx_PyObject_SetAttrStr(__pyx_t_4, __pyx_n_s_tail, __pyx_t_6) < 0) __PYX_ERR(0, 175, __pyx_L3_error)
1898 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1899 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1901 /* "lxml/builder.py":174
1903 * def add_text(elem, item):
1904 * try: # <<<<<<<<<<<<<<
1905 * elem[-1].tail = (elem[-1].tail or "") + item
1906 * except IndexError:
1909 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
1910 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1911 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1912 goto __pyx_L8_try_end;
1914 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
1915 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1916 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1918 /* "lxml/builder.py":176
1920 * elem[-1].tail = (elem[-1].tail or "") + item
1921 * except IndexError: # <<<<<<<<<<<<<<
1922 * elem.text = (elem.text or "") + item
1925 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
1927 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
1928 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 176, __pyx_L5_except_error)
1929 __Pyx_GOTREF(__pyx_t_4);
1930 __Pyx_GOTREF(__pyx_t_6);
1931 __Pyx_GOTREF(__pyx_t_5);
1933 /* "lxml/builder.py":177
1934 * elem[-1].tail = (elem[-1].tail or "") + item
1935 * except IndexError:
1936 * elem.text = (elem.text or "") + item # <<<<<<<<<<<<<<
1938 * def add_cdata(elem, cdata):
1940 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 177, __pyx_L5_except_error)
1941 __Pyx_GOTREF(__pyx_t_10);
1942 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 177, __pyx_L5_except_error)
1944 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
1946 __Pyx_INCREF(__pyx_t_10);
1947 __pyx_t_9 = __pyx_t_10;
1948 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
1949 goto __pyx_L13_bool_binop_done;
1951 __Pyx_INCREF(__pyx_kp_s_);
1952 __pyx_t_9 = __pyx_kp_s_;
1953 __pyx_L13_bool_binop_done:;
1954 __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_v_item); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 177, __pyx_L5_except_error)
1955 __Pyx_GOTREF(__pyx_t_10);
1956 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
1957 if (__Pyx_PyObject_SetAttrStr(__pyx_v_elem, __pyx_n_s_text, __pyx_t_10) < 0) __PYX_ERR(0, 177, __pyx_L5_except_error)
1958 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
1959 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
1960 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1961 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1962 goto __pyx_L4_exception_handled;
1964 goto __pyx_L5_except_error;
1965 __pyx_L5_except_error:;
1967 /* "lxml/builder.py":174
1969 * def add_text(elem, item):
1970 * try: # <<<<<<<<<<<<<<
1971 * elem[-1].tail = (elem[-1].tail or "") + item
1972 * except IndexError:
1974 __Pyx_XGIVEREF(__pyx_t_1);
1975 __Pyx_XGIVEREF(__pyx_t_2);
1976 __Pyx_XGIVEREF(__pyx_t_3);
1977 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
1978 goto __pyx_L1_error;
1979 __pyx_L4_exception_handled:;
1980 __Pyx_XGIVEREF(__pyx_t_1);
1981 __Pyx_XGIVEREF(__pyx_t_2);
1982 __Pyx_XGIVEREF(__pyx_t_3);
1983 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
1987 /* "lxml/builder.py":173
1990 * def add_text(elem, item): # <<<<<<<<<<<<<<
1992 * elem[-1].tail = (elem[-1].tail or "") + item
1995 /* function exit code */
1996 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1999 __Pyx_XDECREF(__pyx_t_4);
2000 __Pyx_XDECREF(__pyx_t_5);
2001 __Pyx_XDECREF(__pyx_t_6);
2002 __Pyx_XDECREF(__pyx_t_9);
2003 __Pyx_XDECREF(__pyx_t_10);
2004 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
2007 __Pyx_XGIVEREF(__pyx_r);
2008 __Pyx_RefNannyFinishContext();
2012 /* "lxml/builder.py":179
2013 * elem.text = (elem.text or "") + item
2015 * def add_cdata(elem, cdata): # <<<<<<<<<<<<<<
2017 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2020 /* Python wrapper */
2021 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___3add_cdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2022 static PyMethodDef __pyx_mdef_4lxml_7builder_12ElementMaker_8__init___3add_cdata = {"add_cdata", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_7builder_12ElementMaker_8__init___3add_cdata, METH_VARARGS|METH_KEYWORDS, 0};
2023 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___3add_cdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2024 PyObject *__pyx_v_elem = 0;
2025 PyObject *__pyx_v_cdata = 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("add_cdata (wrapper)", 0);
2033 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_cdata,0};
2034 PyObject* values[2] = {0,0};
2035 if (unlikely(__pyx_kwds)) {
2037 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2039 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2041 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2044 default: goto __pyx_L5_argtuple_error;
2046 kw_args = PyDict_Size(__pyx_kwds);
2049 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
2050 else goto __pyx_L5_argtuple_error;
2053 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cdata)) != 0)) kw_args--;
2055 __Pyx_RaiseArgtupleInvalid("add_cdata", 1, 2, 2, 1); __PYX_ERR(0, 179, __pyx_L3_error)
2058 if (unlikely(kw_args > 0)) {
2059 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_cdata") < 0)) __PYX_ERR(0, 179, __pyx_L3_error)
2061 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2062 goto __pyx_L5_argtuple_error;
2064 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2065 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2067 __pyx_v_elem = values[0];
2068 __pyx_v_cdata = values[1];
2070 goto __pyx_L4_argument_unpacking_done;
2071 __pyx_L5_argtuple_error:;
2072 __Pyx_RaiseArgtupleInvalid("add_cdata", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error)
2074 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_cdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
2075 __Pyx_RefNannyFinishContext();
2077 __pyx_L4_argument_unpacking_done:;
2078 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_8__init___2add_cdata(__pyx_self, __pyx_v_elem, __pyx_v_cdata);
2080 /* function exit code */
2081 __Pyx_RefNannyFinishContext();
2085 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___2add_cdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_cdata) {
2086 PyObject *__pyx_r = NULL;
2087 __Pyx_RefNannyDeclarations
2088 PyObject *__pyx_t_1 = NULL;
2090 PyObject *__pyx_t_3 = NULL;
2091 int __pyx_lineno = 0;
2092 const char *__pyx_filename = NULL;
2093 int __pyx_clineno = 0;
2094 __Pyx_RefNannySetupContext("add_cdata", 0);
2096 /* "lxml/builder.py":180
2098 * def add_cdata(elem, cdata):
2099 * if elem.text: # <<<<<<<<<<<<<<
2100 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2103 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
2104 __Pyx_GOTREF(__pyx_t_1);
2105 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
2106 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2107 if (unlikely(__pyx_t_2)) {
2109 /* "lxml/builder.py":181
2110 * def add_cdata(elem, cdata):
2112 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text) # <<<<<<<<<<<<<<
2116 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
2117 __Pyx_GOTREF(__pyx_t_1);
2118 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Can_t_add_a_CDATA_section_Elemen, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
2119 __Pyx_GOTREF(__pyx_t_3);
2120 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2121 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
2122 __Pyx_GOTREF(__pyx_t_1);
2123 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2124 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2125 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2126 __PYX_ERR(0, 181, __pyx_L1_error)
2128 /* "lxml/builder.py":180
2130 * def add_cdata(elem, cdata):
2131 * if elem.text: # <<<<<<<<<<<<<<
2132 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2137 /* "lxml/builder.py":182
2139 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2140 * elem.text = cdata # <<<<<<<<<<<<<<
2142 * if str not in typemap:
2144 if (__Pyx_PyObject_SetAttrStr(__pyx_v_elem, __pyx_n_s_text, __pyx_v_cdata) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
2146 /* "lxml/builder.py":179
2147 * elem.text = (elem.text or "") + item
2149 * def add_cdata(elem, cdata): # <<<<<<<<<<<<<<
2151 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2154 /* function exit code */
2155 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2158 __Pyx_XDECREF(__pyx_t_1);
2159 __Pyx_XDECREF(__pyx_t_3);
2160 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_cdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
2163 __Pyx_XGIVEREF(__pyx_r);
2164 __Pyx_RefNannyFinishContext();
2168 /* "lxml/builder.py":191
2169 * typemap[ET.CDATA] = add_cdata
2171 * def add_dict(elem, item): # <<<<<<<<<<<<<<
2172 * attrib = elem.attrib
2173 * for k, v in item.items():
2176 /* Python wrapper */
2177 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___5add_dict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2178 static PyMethodDef __pyx_mdef_4lxml_7builder_12ElementMaker_8__init___5add_dict = {"add_dict", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_7builder_12ElementMaker_8__init___5add_dict, METH_VARARGS|METH_KEYWORDS, 0};
2179 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8__init___5add_dict(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2180 PyObject *__pyx_v_elem = 0;
2181 PyObject *__pyx_v_item = 0;
2182 int __pyx_lineno = 0;
2183 const char *__pyx_filename = NULL;
2184 int __pyx_clineno = 0;
2185 PyObject *__pyx_r = 0;
2186 __Pyx_RefNannyDeclarations
2187 __Pyx_RefNannySetupContext("add_dict (wrapper)", 0);
2189 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_item,0};
2190 PyObject* values[2] = {0,0};
2191 if (unlikely(__pyx_kwds)) {
2193 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2195 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2197 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2200 default: goto __pyx_L5_argtuple_error;
2202 kw_args = PyDict_Size(__pyx_kwds);
2205 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
2206 else goto __pyx_L5_argtuple_error;
2209 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--;
2211 __Pyx_RaiseArgtupleInvalid("add_dict", 1, 2, 2, 1); __PYX_ERR(0, 191, __pyx_L3_error)
2214 if (unlikely(kw_args > 0)) {
2215 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_dict") < 0)) __PYX_ERR(0, 191, __pyx_L3_error)
2217 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2218 goto __pyx_L5_argtuple_error;
2220 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2221 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2223 __pyx_v_elem = values[0];
2224 __pyx_v_item = values[1];
2226 goto __pyx_L4_argument_unpacking_done;
2227 __pyx_L5_argtuple_error:;
2228 __Pyx_RaiseArgtupleInvalid("add_dict", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 191, __pyx_L3_error)
2230 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
2231 __Pyx_RefNannyFinishContext();
2233 __pyx_L4_argument_unpacking_done:;
2234 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_8__init___4add_dict(__pyx_self, __pyx_v_elem, __pyx_v_item);
2236 /* function exit code */
2237 __Pyx_RefNannyFinishContext();
2241 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__init___4add_dict(PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_item) {
2242 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *__pyx_cur_scope;
2243 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *__pyx_outer_scope;
2244 PyObject *__pyx_v_attrib = NULL;
2245 PyObject *__pyx_v_k = NULL;
2246 PyObject *__pyx_v_v = NULL;
2247 PyObject *__pyx_r = NULL;
2248 __Pyx_RefNannyDeclarations
2249 PyObject *__pyx_t_1 = NULL;
2250 PyObject *__pyx_t_2 = NULL;
2251 PyObject *__pyx_t_3 = NULL;
2252 Py_ssize_t __pyx_t_4;
2253 PyObject *(*__pyx_t_5)(PyObject *);
2254 PyObject *__pyx_t_6 = NULL;
2255 PyObject *__pyx_t_7 = NULL;
2256 PyObject *(*__pyx_t_8)(PyObject *);
2260 int __pyx_lineno = 0;
2261 const char *__pyx_filename = NULL;
2262 int __pyx_clineno = 0;
2263 __Pyx_RefNannySetupContext("add_dict", 0);
2264 __pyx_outer_scope = (struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
2265 __pyx_cur_scope = __pyx_outer_scope;
2267 /* "lxml/builder.py":192
2269 * def add_dict(elem, item):
2270 * attrib = elem.attrib # <<<<<<<<<<<<<<
2271 * for k, v in item.items():
2272 * if isinstance(v, basestring):
2274 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_attrib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
2275 __Pyx_GOTREF(__pyx_t_1);
2276 __pyx_v_attrib = __pyx_t_1;
2279 /* "lxml/builder.py":193
2280 * def add_dict(elem, item):
2281 * attrib = elem.attrib
2282 * for k, v in item.items(): # <<<<<<<<<<<<<<
2283 * if isinstance(v, basestring):
2286 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
2287 __Pyx_GOTREF(__pyx_t_2);
2289 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2290 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2291 if (likely(__pyx_t_3)) {
2292 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2293 __Pyx_INCREF(__pyx_t_3);
2294 __Pyx_INCREF(function);
2295 __Pyx_DECREF_SET(__pyx_t_2, function);
2298 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
2299 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2300 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
2301 __Pyx_GOTREF(__pyx_t_1);
2302 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2303 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2304 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
2307 __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
2308 __Pyx_GOTREF(__pyx_t_2);
2309 __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
2311 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2313 if (likely(!__pyx_t_5)) {
2314 if (likely(PyList_CheckExact(__pyx_t_2))) {
2315 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
2316 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2317 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
2319 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
2320 __Pyx_GOTREF(__pyx_t_1);
2323 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
2324 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2325 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
2327 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
2328 __Pyx_GOTREF(__pyx_t_1);
2332 __pyx_t_1 = __pyx_t_5(__pyx_t_2);
2333 if (unlikely(!__pyx_t_1)) {
2334 PyObject* exc_type = PyErr_Occurred();
2336 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2337 else __PYX_ERR(0, 193, __pyx_L1_error)
2341 __Pyx_GOTREF(__pyx_t_1);
2343 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
2344 PyObject* sequence = __pyx_t_1;
2345 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2346 if (unlikely(size != 2)) {
2347 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2348 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2349 __PYX_ERR(0, 193, __pyx_L1_error)
2351 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2352 if (likely(PyTuple_CheckExact(sequence))) {
2353 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
2354 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
2356 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
2357 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
2359 __Pyx_INCREF(__pyx_t_3);
2360 __Pyx_INCREF(__pyx_t_6);
2362 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
2363 __Pyx_GOTREF(__pyx_t_3);
2364 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
2365 __Pyx_GOTREF(__pyx_t_6);
2367 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2369 Py_ssize_t index = -1;
2370 __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error)
2371 __Pyx_GOTREF(__pyx_t_7);
2372 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2373 __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
2374 index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
2375 __Pyx_GOTREF(__pyx_t_3);
2376 index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
2377 __Pyx_GOTREF(__pyx_t_6);
2378 if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
2380 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2381 goto __pyx_L6_unpacking_done;
2382 __pyx_L5_unpacking_failed:;
2383 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2385 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2386 __PYX_ERR(0, 193, __pyx_L1_error)
2387 __pyx_L6_unpacking_done:;
2389 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
2391 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
2394 /* "lxml/builder.py":194
2395 * attrib = elem.attrib
2396 * for k, v in item.items():
2397 * if isinstance(v, basestring): # <<<<<<<<<<<<<<
2401 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
2402 __Pyx_GOTREF(__pyx_t_1);
2403 __pyx_t_9 = PyObject_IsInstance(__pyx_v_v, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 194, __pyx_L1_error)
2404 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2405 __pyx_t_10 = (__pyx_t_9 != 0);
2408 /* "lxml/builder.py":195
2409 * for k, v in item.items():
2410 * if isinstance(v, basestring):
2411 * attrib[k] = v # <<<<<<<<<<<<<<
2413 * attrib[k] = typemap[type(v)](None, v)
2415 if (unlikely(PyObject_SetItem(__pyx_v_attrib, __pyx_v_k, __pyx_v_v) < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
2417 /* "lxml/builder.py":194
2418 * attrib = elem.attrib
2419 * for k, v in item.items():
2420 * if isinstance(v, basestring): # <<<<<<<<<<<<<<
2427 /* "lxml/builder.py":197
2430 * attrib[k] = typemap[type(v)](None, v) # <<<<<<<<<<<<<<
2431 * if dict not in typemap:
2432 * typemap[dict] = add_dict
2435 if (unlikely(!__pyx_cur_scope->__pyx_v_typemap)) { __Pyx_RaiseClosureNameError("typemap"); __PYX_ERR(0, 197, __pyx_L1_error) }
2436 __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_typemap, ((PyObject *)Py_TYPE(__pyx_v_v))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error)
2437 __Pyx_GOTREF(__pyx_t_6);
2440 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
2441 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
2442 if (likely(__pyx_t_3)) {
2443 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2444 __Pyx_INCREF(__pyx_t_3);
2445 __Pyx_INCREF(function);
2446 __Pyx_DECREF_SET(__pyx_t_6, function);
2450 #if CYTHON_FAST_PYCALL
2451 if (PyFunction_Check(__pyx_t_6)) {
2452 PyObject *__pyx_temp[3] = {__pyx_t_3, Py_None, __pyx_v_v};
2453 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
2454 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2455 __Pyx_GOTREF(__pyx_t_1);
2458 #if CYTHON_FAST_PYCCALL
2459 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
2460 PyObject *__pyx_temp[3] = {__pyx_t_3, Py_None, __pyx_v_v};
2461 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
2462 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2463 __Pyx_GOTREF(__pyx_t_1);
2467 __pyx_t_7 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error)
2468 __Pyx_GOTREF(__pyx_t_7);
2470 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
2472 __Pyx_INCREF(Py_None);
2473 __Pyx_GIVEREF(Py_None);
2474 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, Py_None);
2475 __Pyx_INCREF(__pyx_v_v);
2476 __Pyx_GIVEREF(__pyx_v_v);
2477 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_v_v);
2478 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
2479 __Pyx_GOTREF(__pyx_t_1);
2480 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2482 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2483 if (unlikely(PyObject_SetItem(__pyx_v_attrib, __pyx_v_k, __pyx_t_1) < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
2484 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2488 /* "lxml/builder.py":193
2489 * def add_dict(elem, item):
2490 * attrib = elem.attrib
2491 * for k, v in item.items(): # <<<<<<<<<<<<<<
2492 * if isinstance(v, basestring):
2496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2498 /* "lxml/builder.py":191
2499 * typemap[ET.CDATA] = add_cdata
2501 * def add_dict(elem, item): # <<<<<<<<<<<<<<
2502 * attrib = elem.attrib
2503 * for k, v in item.items():
2506 /* function exit code */
2507 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2510 __Pyx_XDECREF(__pyx_t_1);
2511 __Pyx_XDECREF(__pyx_t_2);
2512 __Pyx_XDECREF(__pyx_t_3);
2513 __Pyx_XDECREF(__pyx_t_6);
2514 __Pyx_XDECREF(__pyx_t_7);
2515 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__.add_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
2518 __Pyx_XDECREF(__pyx_v_attrib);
2519 __Pyx_XDECREF(__pyx_v_k);
2520 __Pyx_XDECREF(__pyx_v_v);
2521 __Pyx_XGIVEREF(__pyx_r);
2522 __Pyx_RefNannyFinishContext();
2526 /* "lxml/builder.py":148
2529 * def __init__(self, typemap=None, # <<<<<<<<<<<<<<
2530 * namespace=None, nsmap=None, makeelement=None):
2531 * if namespace is not None:
2534 static int __pyx_pf_4lxml_7builder_12ElementMaker___init__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_typemap, PyObject *__pyx_v_namespace, PyObject *__pyx_v_nsmap, PyObject *__pyx_v_makeelement) {
2535 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *__pyx_cur_scope;
2536 PyObject *__pyx_v_add_text = 0;
2537 PyObject *__pyx_v_add_cdata = 0;
2538 PyObject *__pyx_v_add_dict = 0;
2540 __Pyx_RefNannyDeclarations
2543 PyObject *__pyx_t_3 = NULL;
2544 PyObject *__pyx_t_4 = NULL;
2545 int __pyx_lineno = 0;
2546 const char *__pyx_filename = NULL;
2547 int __pyx_clineno = 0;
2548 __Pyx_RefNannySetupContext("__init__", 0);
2549 __pyx_cur_scope = (struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)__pyx_tp_new_4lxml_7builder___pyx_scope_struct____init__(__pyx_ptype_4lxml_7builder___pyx_scope_struct____init__, __pyx_empty_tuple, NULL);
2550 if (unlikely(!__pyx_cur_scope)) {
2551 __pyx_cur_scope = ((struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)Py_None);
2552 __Pyx_INCREF(Py_None);
2553 __PYX_ERR(0, 148, __pyx_L1_error)
2555 __Pyx_GOTREF(__pyx_cur_scope);
2557 __pyx_cur_scope->__pyx_v_typemap = __pyx_v_typemap;
2558 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_typemap);
2559 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_typemap);
2561 /* "lxml/builder.py":150
2562 * def __init__(self, typemap=None,
2563 * namespace=None, nsmap=None, makeelement=None):
2564 * if namespace is not None: # <<<<<<<<<<<<<<
2565 * self._namespace = '{' + namespace + '}'
2568 __pyx_t_1 = (__pyx_v_namespace != Py_None);
2569 __pyx_t_2 = (__pyx_t_1 != 0);
2572 /* "lxml/builder.py":151
2573 * namespace=None, nsmap=None, makeelement=None):
2574 * if namespace is not None:
2575 * self._namespace = '{' + namespace + '}' # <<<<<<<<<<<<<<
2577 * self._namespace = None
2579 __pyx_t_3 = PyNumber_Add(__pyx_kp_s__2, __pyx_v_namespace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
2580 __Pyx_GOTREF(__pyx_t_3);
2581 __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error)
2582 __Pyx_GOTREF(__pyx_t_4);
2583 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2584 __Pyx_GIVEREF(__pyx_t_4);
2585 __Pyx_GOTREF(__pyx_v_self->_namespace);
2586 __Pyx_DECREF(__pyx_v_self->_namespace);
2587 __pyx_v_self->_namespace = __pyx_t_4;
2590 /* "lxml/builder.py":150
2591 * def __init__(self, typemap=None,
2592 * namespace=None, nsmap=None, makeelement=None):
2593 * if namespace is not None: # <<<<<<<<<<<<<<
2594 * self._namespace = '{' + namespace + '}'
2600 /* "lxml/builder.py":153
2601 * self._namespace = '{' + namespace + '}'
2603 * self._namespace = None # <<<<<<<<<<<<<<
2608 __Pyx_INCREF(Py_None);
2609 __Pyx_GIVEREF(Py_None);
2610 __Pyx_GOTREF(__pyx_v_self->_namespace);
2611 __Pyx_DECREF(__pyx_v_self->_namespace);
2612 __pyx_v_self->_namespace = Py_None;
2616 /* "lxml/builder.py":155
2617 * self._namespace = None
2619 * if nsmap: # <<<<<<<<<<<<<<
2620 * self._nsmap = dict(nsmap)
2623 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_nsmap); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 155, __pyx_L1_error)
2626 /* "lxml/builder.py":156
2629 * self._nsmap = dict(nsmap) # <<<<<<<<<<<<<<
2631 * self._nsmap = None
2633 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_nsmap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error)
2634 __Pyx_GOTREF(__pyx_t_4);
2635 __Pyx_GIVEREF(__pyx_t_4);
2636 __Pyx_GOTREF(__pyx_v_self->_nsmap);
2637 __Pyx_DECREF(__pyx_v_self->_nsmap);
2638 __pyx_v_self->_nsmap = ((PyObject*)__pyx_t_4);
2641 /* "lxml/builder.py":155
2642 * self._namespace = None
2644 * if nsmap: # <<<<<<<<<<<<<<
2645 * self._nsmap = dict(nsmap)
2651 /* "lxml/builder.py":158
2652 * self._nsmap = dict(nsmap)
2654 * self._nsmap = None # <<<<<<<<<<<<<<
2656 * if makeelement is not None:
2659 __Pyx_INCREF(Py_None);
2660 __Pyx_GIVEREF(Py_None);
2661 __Pyx_GOTREF(__pyx_v_self->_nsmap);
2662 __Pyx_DECREF(__pyx_v_self->_nsmap);
2663 __pyx_v_self->_nsmap = ((PyObject*)Py_None);
2667 /* "lxml/builder.py":160
2668 * self._nsmap = None
2670 * if makeelement is not None: # <<<<<<<<<<<<<<
2671 * assert callable(makeelement)
2672 * self._makeelement = makeelement
2674 __pyx_t_2 = (__pyx_v_makeelement != Py_None);
2675 __pyx_t_1 = (__pyx_t_2 != 0);
2678 /* "lxml/builder.py":161
2680 * if makeelement is not None:
2681 * assert callable(makeelement) # <<<<<<<<<<<<<<
2682 * self._makeelement = makeelement
2685 #ifndef CYTHON_WITHOUT_ASSERTIONS
2686 if (unlikely(!Py_OptimizeFlag)) {
2687 __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_makeelement); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 161, __pyx_L1_error)
2688 if (unlikely(!(__pyx_t_1 != 0))) {
2689 PyErr_SetNone(PyExc_AssertionError);
2690 __PYX_ERR(0, 161, __pyx_L1_error)
2695 /* "lxml/builder.py":162
2696 * if makeelement is not None:
2697 * assert callable(makeelement)
2698 * self._makeelement = makeelement # <<<<<<<<<<<<<<
2700 * self._makeelement = ET.Element
2702 __Pyx_INCREF(__pyx_v_makeelement);
2703 __Pyx_GIVEREF(__pyx_v_makeelement);
2704 __Pyx_GOTREF(__pyx_v_self->_makeelement);
2705 __Pyx_DECREF(__pyx_v_self->_makeelement);
2706 __pyx_v_self->_makeelement = __pyx_v_makeelement;
2708 /* "lxml/builder.py":160
2709 * self._nsmap = None
2711 * if makeelement is not None: # <<<<<<<<<<<<<<
2712 * assert callable(makeelement)
2713 * self._makeelement = makeelement
2718 /* "lxml/builder.py":164
2719 * self._makeelement = makeelement
2721 * self._makeelement = ET.Element # <<<<<<<<<<<<<<
2723 * # initialize type map for this element factory
2726 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_7builder_ET, __pyx_n_s_Element); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L1_error)
2727 __Pyx_GOTREF(__pyx_t_4);
2728 __Pyx_GIVEREF(__pyx_t_4);
2729 __Pyx_GOTREF(__pyx_v_self->_makeelement);
2730 __Pyx_DECREF(__pyx_v_self->_makeelement);
2731 __pyx_v_self->_makeelement = __pyx_t_4;
2736 /* "lxml/builder.py":168
2737 * # initialize type map for this element factory
2739 * if typemap: # <<<<<<<<<<<<<<
2740 * typemap = dict(typemap)
2743 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_typemap); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
2746 /* "lxml/builder.py":169
2749 * typemap = dict(typemap) # <<<<<<<<<<<<<<
2753 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_cur_scope->__pyx_v_typemap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error)
2754 __Pyx_GOTREF(__pyx_t_4);
2755 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_typemap);
2756 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_typemap, __pyx_t_4);
2757 __Pyx_GIVEREF(__pyx_t_4);
2760 /* "lxml/builder.py":168
2761 * # initialize type map for this element factory
2763 * if typemap: # <<<<<<<<<<<<<<
2764 * typemap = dict(typemap)
2770 /* "lxml/builder.py":171
2771 * typemap = dict(typemap)
2773 * typemap = {} # <<<<<<<<<<<<<<
2775 * def add_text(elem, item):
2778 __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
2779 __Pyx_GOTREF(__pyx_t_4);
2780 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_typemap);
2781 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_typemap, __pyx_t_4);
2782 __Pyx_GIVEREF(__pyx_t_4);
2787 /* "lxml/builder.py":173
2790 * def add_text(elem, item): # <<<<<<<<<<<<<<
2792 * elem[-1].tail = (elem[-1].tail or "") + item
2794 __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_12ElementMaker_8__init___1add_text, 0, __pyx_n_s_init___locals_add_text, NULL, __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
2795 __Pyx_GOTREF(__pyx_t_4);
2796 __pyx_v_add_text = __pyx_t_4;
2799 /* "lxml/builder.py":179
2800 * elem.text = (elem.text or "") + item
2802 * def add_cdata(elem, cdata): # <<<<<<<<<<<<<<
2804 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
2806 __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_12ElementMaker_8__init___3add_cdata, 0, __pyx_n_s_init___locals_add_cdata, NULL, __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)
2807 __Pyx_GOTREF(__pyx_t_4);
2808 __pyx_v_add_cdata = __pyx_t_4;
2811 /* "lxml/builder.py":184
2814 * if str not in typemap: # <<<<<<<<<<<<<<
2815 * typemap[str] = add_text
2816 * if unicode not in typemap:
2818 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(((PyObject *)(&PyString_Type)), __pyx_cur_scope->__pyx_v_typemap, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 184, __pyx_L1_error)
2819 __pyx_t_2 = (__pyx_t_1 != 0);
2822 /* "lxml/builder.py":185
2824 * if str not in typemap:
2825 * typemap[str] = add_text # <<<<<<<<<<<<<<
2826 * if unicode not in typemap:
2827 * typemap[unicode] = add_text
2829 if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_typemap, ((PyObject *)(&PyString_Type)), __pyx_v_add_text) < 0)) __PYX_ERR(0, 185, __pyx_L1_error)
2831 /* "lxml/builder.py":184
2834 * if str not in typemap: # <<<<<<<<<<<<<<
2835 * typemap[str] = add_text
2836 * if unicode not in typemap:
2840 /* "lxml/builder.py":186
2841 * if str not in typemap:
2842 * typemap[str] = add_text
2843 * if unicode not in typemap: # <<<<<<<<<<<<<<
2844 * typemap[unicode] = add_text
2845 * if ET.CDATA not in typemap:
2847 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
2848 __Pyx_GOTREF(__pyx_t_4);
2849 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_4, __pyx_cur_scope->__pyx_v_typemap, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
2850 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2851 __pyx_t_1 = (__pyx_t_2 != 0);
2854 /* "lxml/builder.py":187
2855 * typemap[str] = add_text
2856 * if unicode not in typemap:
2857 * typemap[unicode] = add_text # <<<<<<<<<<<<<<
2858 * if ET.CDATA not in typemap:
2859 * typemap[ET.CDATA] = add_cdata
2861 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error)
2862 __Pyx_GOTREF(__pyx_t_4);
2863 if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_typemap, __pyx_t_4, __pyx_v_add_text) < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
2864 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2866 /* "lxml/builder.py":186
2867 * if str not in typemap:
2868 * typemap[str] = add_text
2869 * if unicode not in typemap: # <<<<<<<<<<<<<<
2870 * typemap[unicode] = add_text
2871 * if ET.CDATA not in typemap:
2875 /* "lxml/builder.py":188
2876 * if unicode not in typemap:
2877 * typemap[unicode] = add_text
2878 * if ET.CDATA not in typemap: # <<<<<<<<<<<<<<
2879 * typemap[ET.CDATA] = add_cdata
2882 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_7builder_ET, __pyx_n_s_CDATA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error)
2883 __Pyx_GOTREF(__pyx_t_4);
2884 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_4, __pyx_cur_scope->__pyx_v_typemap, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 188, __pyx_L1_error)
2885 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2886 __pyx_t_2 = (__pyx_t_1 != 0);
2889 /* "lxml/builder.py":189
2890 * typemap[unicode] = add_text
2891 * if ET.CDATA not in typemap:
2892 * typemap[ET.CDATA] = add_cdata # <<<<<<<<<<<<<<
2894 * def add_dict(elem, item):
2896 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_7builder_ET, __pyx_n_s_CDATA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
2897 __Pyx_GOTREF(__pyx_t_4);
2898 if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_typemap, __pyx_t_4, __pyx_v_add_cdata) < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
2899 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2901 /* "lxml/builder.py":188
2902 * if unicode not in typemap:
2903 * typemap[unicode] = add_text
2904 * if ET.CDATA not in typemap: # <<<<<<<<<<<<<<
2905 * typemap[ET.CDATA] = add_cdata
2910 /* "lxml/builder.py":191
2911 * typemap[ET.CDATA] = add_cdata
2913 * def add_dict(elem, item): # <<<<<<<<<<<<<<
2914 * attrib = elem.attrib
2915 * for k, v in item.items():
2917 __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_12ElementMaker_8__init___5add_dict, 0, __pyx_n_s_init___locals_add_dict, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
2918 __Pyx_GOTREF(__pyx_t_4);
2919 __pyx_v_add_dict = __pyx_t_4;
2922 /* "lxml/builder.py":198
2924 * attrib[k] = typemap[type(v)](None, v)
2925 * if dict not in typemap: # <<<<<<<<<<<<<<
2926 * typemap[dict] = add_dict
2929 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(((PyObject *)(&PyDict_Type)), __pyx_cur_scope->__pyx_v_typemap, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
2930 __pyx_t_1 = (__pyx_t_2 != 0);
2933 /* "lxml/builder.py":199
2934 * attrib[k] = typemap[type(v)](None, v)
2935 * if dict not in typemap:
2936 * typemap[dict] = add_dict # <<<<<<<<<<<<<<
2938 * self._typemap = typemap
2940 if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_typemap, ((PyObject *)(&PyDict_Type)), __pyx_v_add_dict) < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
2942 /* "lxml/builder.py":198
2944 * attrib[k] = typemap[type(v)](None, v)
2945 * if dict not in typemap: # <<<<<<<<<<<<<<
2946 * typemap[dict] = add_dict
2951 /* "lxml/builder.py":201
2952 * typemap[dict] = add_dict
2954 * self._typemap = typemap # <<<<<<<<<<<<<<
2956 * def __call__(self, tag, *children, **attrib):
2958 if (!(likely(PyDict_CheckExact(__pyx_cur_scope->__pyx_v_typemap))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_cur_scope->__pyx_v_typemap)->tp_name), 0))) __PYX_ERR(0, 201, __pyx_L1_error)
2959 __pyx_t_4 = __pyx_cur_scope->__pyx_v_typemap;
2960 __Pyx_INCREF(__pyx_t_4);
2961 __Pyx_GIVEREF(__pyx_t_4);
2962 __Pyx_GOTREF(__pyx_v_self->_typemap);
2963 __Pyx_DECREF(__pyx_v_self->_typemap);
2964 __pyx_v_self->_typemap = ((PyObject*)__pyx_t_4);
2967 /* "lxml/builder.py":148
2970 * def __init__(self, typemap=None, # <<<<<<<<<<<<<<
2971 * namespace=None, nsmap=None, makeelement=None):
2972 * if namespace is not None:
2975 /* function exit code */
2979 __Pyx_XDECREF(__pyx_t_3);
2980 __Pyx_XDECREF(__pyx_t_4);
2981 __Pyx_AddTraceback("lxml.builder.ElementMaker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2984 __Pyx_XDECREF(__pyx_v_add_text);
2985 __Pyx_XDECREF(__pyx_v_add_cdata);
2986 __Pyx_XDECREF(__pyx_v_add_dict);
2987 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2988 __Pyx_RefNannyFinishContext();
2992 /* "lxml/builder.py":203
2993 * self._typemap = typemap
2995 * def __call__(self, tag, *children, **attrib): # <<<<<<<<<<<<<<
2996 * typemap = self._typemap
3000 /* Python wrapper */
3001 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3002 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3003 PyObject *__pyx_v_tag = 0;
3004 PyObject *__pyx_v_children = 0;
3005 PyObject *__pyx_v_attrib = 0;
3006 int __pyx_lineno = 0;
3007 const char *__pyx_filename = NULL;
3008 int __pyx_clineno = 0;
3009 PyObject *__pyx_r = 0;
3010 __Pyx_RefNannyDeclarations
3011 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
3012 __pyx_v_attrib = PyDict_New(); if (unlikely(!__pyx_v_attrib)) return NULL;
3013 __Pyx_GOTREF(__pyx_v_attrib);
3014 if (PyTuple_GET_SIZE(__pyx_args) > 1) {
3015 __pyx_v_children = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
3016 if (unlikely(!__pyx_v_children)) {
3017 __Pyx_DECREF(__pyx_v_attrib); __pyx_v_attrib = 0;
3018 __Pyx_RefNannyFinishContext();
3021 __Pyx_GOTREF(__pyx_v_children);
3023 __pyx_v_children = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
3026 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tag,0};
3027 PyObject* values[1] = {0};
3028 if (unlikely(__pyx_kwds)) {
3030 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3033 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3037 kw_args = PyDict_Size(__pyx_kwds);
3040 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tag)) != 0)) kw_args--;
3041 else goto __pyx_L5_argtuple_error;
3043 if (unlikely(kw_args > 0)) {
3044 const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
3045 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_attrib, values, used_pos_args, "__call__") < 0)) __PYX_ERR(0, 203, __pyx_L3_error)
3047 } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
3048 goto __pyx_L5_argtuple_error;
3050 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3052 __pyx_v_tag = values[0];
3054 goto __pyx_L4_argument_unpacking_done;
3055 __pyx_L5_argtuple_error:;
3056 __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error)
3058 __Pyx_DECREF(__pyx_v_children); __pyx_v_children = 0;
3059 __Pyx_DECREF(__pyx_v_attrib); __pyx_v_attrib = 0;
3060 __Pyx_AddTraceback("lxml.builder.ElementMaker.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3061 __Pyx_RefNannyFinishContext();
3063 __pyx_L4_argument_unpacking_done:;
3064 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_2__call__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self), __pyx_v_tag, __pyx_v_children, __pyx_v_attrib);
3066 /* function exit code */
3067 __Pyx_XDECREF(__pyx_v_children);
3068 __Pyx_XDECREF(__pyx_v_attrib);
3069 __Pyx_RefNannyFinishContext();
3073 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_2__call__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_tag, PyObject *__pyx_v_children, PyObject *__pyx_v_attrib) {
3074 PyObject *__pyx_v_typemap = NULL;
3075 PyObject *__pyx_v_elem = NULL;
3076 PyObject *__pyx_v_item = NULL;
3077 PyObject *__pyx_v_t = NULL;
3078 PyObject *__pyx_v_basetype = NULL;
3079 PyObject *__pyx_v_v = NULL;
3080 PyObject *__pyx_r = NULL;
3081 __Pyx_RefNannyDeclarations
3082 PyObject *__pyx_t_1 = NULL;
3086 PyObject *__pyx_t_5 = NULL;
3087 PyObject *__pyx_t_6 = NULL;
3089 PyObject *__pyx_t_8 = NULL;
3090 Py_ssize_t __pyx_t_9;
3092 Py_ssize_t __pyx_t_11;
3093 PyObject *(*__pyx_t_12)(PyObject *);
3094 PyObject *__pyx_t_13 = NULL;
3095 int __pyx_lineno = 0;
3096 const char *__pyx_filename = NULL;
3097 int __pyx_clineno = 0;
3098 __Pyx_RefNannySetupContext("__call__", 0);
3099 __Pyx_INCREF(__pyx_v_tag);
3101 /* "lxml/builder.py":204
3103 * def __call__(self, tag, *children, **attrib):
3104 * typemap = self._typemap # <<<<<<<<<<<<<<
3106 * if self._namespace is not None and tag[0] != '{':
3108 __pyx_t_1 = __pyx_v_self->_typemap;
3109 __Pyx_INCREF(__pyx_t_1);
3110 __pyx_v_typemap = ((PyObject*)__pyx_t_1);
3113 /* "lxml/builder.py":206
3114 * typemap = self._typemap
3116 * if self._namespace is not None and tag[0] != '{': # <<<<<<<<<<<<<<
3117 * tag = self._namespace + tag
3118 * elem = self._makeelement(tag, nsmap=self._nsmap)
3120 __pyx_t_3 = (__pyx_v_self->_namespace != Py_None);
3121 __pyx_t_4 = (__pyx_t_3 != 0);
3124 __pyx_t_2 = __pyx_t_4;
3125 goto __pyx_L4_bool_binop_done;
3127 __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, 206, __pyx_L1_error)
3128 __Pyx_GOTREF(__pyx_t_1);
3129 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__2, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 206, __pyx_L1_error)
3130 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3131 __pyx_t_2 = __pyx_t_4;
3132 __pyx_L4_bool_binop_done:;
3135 /* "lxml/builder.py":207
3137 * if self._namespace is not None and tag[0] != '{':
3138 * tag = self._namespace + tag # <<<<<<<<<<<<<<
3139 * elem = self._makeelement(tag, nsmap=self._nsmap)
3142 __pyx_t_1 = PyNumber_Add(__pyx_v_self->_namespace, __pyx_v_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
3143 __Pyx_GOTREF(__pyx_t_1);
3144 __Pyx_DECREF_SET(__pyx_v_tag, __pyx_t_1);
3147 /* "lxml/builder.py":206
3148 * typemap = self._typemap
3150 * if self._namespace is not None and tag[0] != '{': # <<<<<<<<<<<<<<
3151 * tag = self._namespace + tag
3152 * elem = self._makeelement(tag, nsmap=self._nsmap)
3156 /* "lxml/builder.py":208
3157 * if self._namespace is not None and tag[0] != '{':
3158 * tag = self._namespace + tag
3159 * elem = self._makeelement(tag, nsmap=self._nsmap) # <<<<<<<<<<<<<<
3161 * typemap[dict](elem, attrib)
3163 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
3164 __Pyx_GOTREF(__pyx_t_1);
3165 __Pyx_INCREF(__pyx_v_tag);
3166 __Pyx_GIVEREF(__pyx_v_tag);
3167 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tag);
3168 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error)
3169 __Pyx_GOTREF(__pyx_t_5);
3170 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_nsmap, __pyx_v_self->_nsmap) < 0) __PYX_ERR(0, 208, __pyx_L1_error)
3171 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_self->_makeelement, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error)
3172 __Pyx_GOTREF(__pyx_t_6);
3173 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3174 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3175 __pyx_v_elem = __pyx_t_6;
3178 /* "lxml/builder.py":209
3179 * tag = self._namespace + tag
3180 * elem = self._makeelement(tag, nsmap=self._nsmap)
3181 * if attrib: # <<<<<<<<<<<<<<
3182 * typemap[dict](elem, attrib)
3185 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_attrib); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
3188 /* "lxml/builder.py":210
3189 * elem = self._makeelement(tag, nsmap=self._nsmap)
3191 * typemap[dict](elem, attrib) # <<<<<<<<<<<<<<
3193 * for item in children:
3195 if (unlikely(__pyx_v_typemap == Py_None)) {
3196 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3197 __PYX_ERR(0, 210, __pyx_L1_error)
3199 __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_typemap, ((PyObject *)(&PyDict_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
3200 __Pyx_GOTREF(__pyx_t_5);
3203 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3204 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
3205 if (likely(__pyx_t_1)) {
3206 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3207 __Pyx_INCREF(__pyx_t_1);
3208 __Pyx_INCREF(function);
3209 __Pyx_DECREF_SET(__pyx_t_5, function);
3213 #if CYTHON_FAST_PYCALL
3214 if (PyFunction_Check(__pyx_t_5)) {
3215 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_elem, __pyx_v_attrib};
3216 __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
3217 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3218 __Pyx_GOTREF(__pyx_t_6);
3221 #if CYTHON_FAST_PYCCALL
3222 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
3223 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_elem, __pyx_v_attrib};
3224 __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
3225 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3226 __Pyx_GOTREF(__pyx_t_6);
3230 __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 210, __pyx_L1_error)
3231 __Pyx_GOTREF(__pyx_t_8);
3233 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
3235 __Pyx_INCREF(__pyx_v_elem);
3236 __Pyx_GIVEREF(__pyx_v_elem);
3237 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_elem);
3238 __Pyx_INCREF(__pyx_v_attrib);
3239 __Pyx_GIVEREF(__pyx_v_attrib);
3240 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_attrib);
3241 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
3242 __Pyx_GOTREF(__pyx_t_6);
3243 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3245 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3246 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3248 /* "lxml/builder.py":209
3249 * tag = self._namespace + tag
3250 * elem = self._makeelement(tag, nsmap=self._nsmap)
3251 * if attrib: # <<<<<<<<<<<<<<
3252 * typemap[dict](elem, attrib)
3257 /* "lxml/builder.py":212
3258 * typemap[dict](elem, attrib)
3260 * for item in children: # <<<<<<<<<<<<<<
3261 * if callable(item):
3264 __pyx_t_6 = __pyx_v_children; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
3266 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
3267 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3268 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
3270 __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
3271 __Pyx_GOTREF(__pyx_t_5);
3273 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5);
3276 /* "lxml/builder.py":213
3278 * for item in children:
3279 * if callable(item): # <<<<<<<<<<<<<<
3281 * t = typemap.get(type(item))
3283 __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_item); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 213, __pyx_L1_error)
3284 __pyx_t_4 = (__pyx_t_2 != 0);
3287 /* "lxml/builder.py":214
3288 * for item in children:
3289 * if callable(item):
3290 * item = item() # <<<<<<<<<<<<<<
3291 * t = typemap.get(type(item))
3294 __Pyx_INCREF(__pyx_v_item);
3295 __pyx_t_8 = __pyx_v_item; __pyx_t_1 = NULL;
3296 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
3297 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
3298 if (likely(__pyx_t_1)) {
3299 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3300 __Pyx_INCREF(__pyx_t_1);
3301 __Pyx_INCREF(function);
3302 __Pyx_DECREF_SET(__pyx_t_8, function);
3305 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
3306 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3307 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error)
3308 __Pyx_GOTREF(__pyx_t_5);
3309 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3310 __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_5);
3313 /* "lxml/builder.py":213
3315 * for item in children:
3316 * if callable(item): # <<<<<<<<<<<<<<
3318 * t = typemap.get(type(item))
3322 /* "lxml/builder.py":215
3323 * if callable(item):
3325 * t = typemap.get(type(item)) # <<<<<<<<<<<<<<
3327 * if ET.iselement(item):
3329 if (unlikely(__pyx_v_typemap == Py_None)) {
3330 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
3331 __PYX_ERR(0, 215, __pyx_L1_error)
3333 __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_typemap, ((PyObject *)Py_TYPE(__pyx_v_item)), Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error)
3334 __Pyx_GOTREF(__pyx_t_5);
3335 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_5);
3338 /* "lxml/builder.py":216
3340 * t = typemap.get(type(item))
3341 * if t is None: # <<<<<<<<<<<<<<
3342 * if ET.iselement(item):
3345 __pyx_t_4 = (__pyx_v_t == Py_None);
3346 __pyx_t_2 = (__pyx_t_4 != 0);
3349 /* "lxml/builder.py":217
3350 * t = typemap.get(type(item))
3352 * if ET.iselement(item): # <<<<<<<<<<<<<<
3356 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_4lxml_7builder_ET, __pyx_n_s_iselement); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error)
3357 __Pyx_GOTREF(__pyx_t_8);
3359 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
3360 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
3361 if (likely(__pyx_t_1)) {
3362 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3363 __Pyx_INCREF(__pyx_t_1);
3364 __Pyx_INCREF(function);
3365 __Pyx_DECREF_SET(__pyx_t_8, function);
3368 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_item);
3369 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3370 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error)
3371 __Pyx_GOTREF(__pyx_t_5);
3372 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3373 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
3374 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3377 /* "lxml/builder.py":218
3379 * if ET.iselement(item):
3380 * elem.append(item) # <<<<<<<<<<<<<<
3382 * for basetype in type(item).__mro__:
3384 __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_elem, __pyx_v_item); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L1_error)
3386 /* "lxml/builder.py":219
3387 * if ET.iselement(item):
3389 * continue # <<<<<<<<<<<<<<
3390 * for basetype in type(item).__mro__:
3391 * # See if the typemap knows of any of this type's bases.
3393 goto __pyx_L7_continue;
3395 /* "lxml/builder.py":217
3396 * t = typemap.get(type(item))
3398 * if ET.iselement(item): # <<<<<<<<<<<<<<
3404 /* "lxml/builder.py":220
3407 * for basetype in type(item).__mro__: # <<<<<<<<<<<<<<
3408 * # See if the typemap knows of any of this type's bases.
3409 * t = typemap.get(basetype)
3411 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_n_s_mro); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
3412 __Pyx_GOTREF(__pyx_t_5);
3413 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
3414 __pyx_t_8 = __pyx_t_5; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0;
3417 __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error)
3418 __Pyx_GOTREF(__pyx_t_8);
3419 __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 220, __pyx_L1_error)
3421 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3423 if (likely(!__pyx_t_12)) {
3424 if (likely(PyList_CheckExact(__pyx_t_8))) {
3425 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break;
3426 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3427 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
3429 __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
3430 __Pyx_GOTREF(__pyx_t_5);
3433 if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
3434 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3435 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
3437 __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
3438 __Pyx_GOTREF(__pyx_t_5);
3442 __pyx_t_5 = __pyx_t_12(__pyx_t_8);
3443 if (unlikely(!__pyx_t_5)) {
3444 PyObject* exc_type = PyErr_Occurred();
3446 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3447 else __PYX_ERR(0, 220, __pyx_L1_error)
3451 __Pyx_GOTREF(__pyx_t_5);
3453 __Pyx_XDECREF_SET(__pyx_v_basetype, __pyx_t_5);
3456 /* "lxml/builder.py":222
3457 * for basetype in type(item).__mro__:
3458 * # See if the typemap knows of any of this type's bases.
3459 * t = typemap.get(basetype) # <<<<<<<<<<<<<<
3463 if (unlikely(__pyx_v_typemap == Py_None)) {
3464 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
3465 __PYX_ERR(0, 222, __pyx_L1_error)
3467 __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_typemap, __pyx_v_basetype, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error)
3468 __Pyx_GOTREF(__pyx_t_5);
3469 __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_5);
3472 /* "lxml/builder.py":223
3473 * # See if the typemap knows of any of this type's bases.
3474 * t = typemap.get(basetype)
3475 * if t is not None: # <<<<<<<<<<<<<<
3479 __pyx_t_2 = (__pyx_v_t != Py_None);
3480 __pyx_t_4 = (__pyx_t_2 != 0);
3483 /* "lxml/builder.py":224
3484 * t = typemap.get(basetype)
3486 * break # <<<<<<<<<<<<<<
3488 * raise TypeError("bad argument type: %s(%r)" %
3490 goto __pyx_L13_break;
3492 /* "lxml/builder.py":223
3493 * # See if the typemap knows of any of this type's bases.
3494 * t = typemap.get(basetype)
3495 * if t is not None: # <<<<<<<<<<<<<<
3501 /* "lxml/builder.py":220
3504 * for basetype in type(item).__mro__: # <<<<<<<<<<<<<<
3505 * # See if the typemap knows of any of this type's bases.
3506 * t = typemap.get(basetype)
3511 /* "lxml/builder.py":227
3513 * raise TypeError("bad argument type: %s(%r)" %
3514 * (type(item).__name__, item)) # <<<<<<<<<<<<<<
3518 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
3519 __Pyx_GOTREF(__pyx_t_5);
3520 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
3521 __Pyx_GOTREF(__pyx_t_1);
3522 __Pyx_GIVEREF(__pyx_t_5);
3523 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
3524 __Pyx_INCREF(__pyx_v_item);
3525 __Pyx_GIVEREF(__pyx_v_item);
3526 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_item);
3529 /* "lxml/builder.py":226
3532 * raise TypeError("bad argument type: %s(%r)" % # <<<<<<<<<<<<<<
3533 * (type(item).__name__, item))
3536 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_bad_argument_type_s_r, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
3537 __Pyx_GOTREF(__pyx_t_5);
3538 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3539 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error)
3540 __Pyx_GOTREF(__pyx_t_1);
3541 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3542 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3543 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3544 __PYX_ERR(0, 226, __pyx_L1_error)
3547 /* "lxml/builder.py":220
3550 * for basetype in type(item).__mro__: # <<<<<<<<<<<<<<
3551 * # See if the typemap knows of any of this type's bases.
3552 * t = typemap.get(basetype)
3555 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3557 /* "lxml/builder.py":216
3559 * t = typemap.get(type(item))
3560 * if t is None: # <<<<<<<<<<<<<<
3561 * if ET.iselement(item):
3566 /* "lxml/builder.py":228
3567 * raise TypeError("bad argument type: %s(%r)" %
3568 * (type(item).__name__, item))
3569 * v = t(elem, item) # <<<<<<<<<<<<<<
3571 * typemap.get(type(v))(elem, v)
3573 __Pyx_INCREF(__pyx_v_t);
3574 __pyx_t_1 = __pyx_v_t; __pyx_t_5 = NULL;
3576 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3577 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
3578 if (likely(__pyx_t_5)) {
3579 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3580 __Pyx_INCREF(__pyx_t_5);
3581 __Pyx_INCREF(function);
3582 __Pyx_DECREF_SET(__pyx_t_1, function);
3586 #if CYTHON_FAST_PYCALL
3587 if (PyFunction_Check(__pyx_t_1)) {
3588 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_elem, __pyx_v_item};
3589 __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
3590 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3591 __Pyx_GOTREF(__pyx_t_8);
3594 #if CYTHON_FAST_PYCCALL
3595 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3596 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_elem, __pyx_v_item};
3597 __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
3598 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3599 __Pyx_GOTREF(__pyx_t_8);
3603 __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error)
3604 __Pyx_GOTREF(__pyx_t_13);
3606 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL;
3608 __Pyx_INCREF(__pyx_v_elem);
3609 __Pyx_GIVEREF(__pyx_v_elem);
3610 PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_v_elem);
3611 __Pyx_INCREF(__pyx_v_item);
3612 __Pyx_GIVEREF(__pyx_v_item);
3613 PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_v_item);
3614 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 228, __pyx_L1_error)
3615 __Pyx_GOTREF(__pyx_t_8);
3616 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3618 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3619 __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
3622 /* "lxml/builder.py":229
3623 * (type(item).__name__, item))
3625 * if v: # <<<<<<<<<<<<<<
3626 * typemap.get(type(v))(elem, v)
3629 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
3632 /* "lxml/builder.py":230
3635 * typemap.get(type(v))(elem, v) # <<<<<<<<<<<<<<
3639 if (unlikely(__pyx_v_typemap == Py_None)) {
3640 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
3641 __PYX_ERR(0, 230, __pyx_L1_error)
3643 __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_typemap, ((PyObject *)Py_TYPE(__pyx_v_v)), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
3644 __Pyx_GOTREF(__pyx_t_1);
3647 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3648 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
3649 if (likely(__pyx_t_13)) {
3650 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3651 __Pyx_INCREF(__pyx_t_13);
3652 __Pyx_INCREF(function);
3653 __Pyx_DECREF_SET(__pyx_t_1, function);
3657 #if CYTHON_FAST_PYCALL
3658 if (PyFunction_Check(__pyx_t_1)) {
3659 PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_elem, __pyx_v_v};
3660 __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
3661 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
3662 __Pyx_GOTREF(__pyx_t_8);
3665 #if CYTHON_FAST_PYCCALL
3666 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3667 PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_elem, __pyx_v_v};
3668 __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
3669 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
3670 __Pyx_GOTREF(__pyx_t_8);
3674 __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
3675 __Pyx_GOTREF(__pyx_t_5);
3677 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_13); __pyx_t_13 = NULL;
3679 __Pyx_INCREF(__pyx_v_elem);
3680 __Pyx_GIVEREF(__pyx_v_elem);
3681 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_elem);
3682 __Pyx_INCREF(__pyx_v_v);
3683 __Pyx_GIVEREF(__pyx_v_v);
3684 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_v);
3685 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
3686 __Pyx_GOTREF(__pyx_t_8);
3687 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3689 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3690 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3692 /* "lxml/builder.py":229
3693 * (type(item).__name__, item))
3695 * if v: # <<<<<<<<<<<<<<
3696 * typemap.get(type(v))(elem, v)
3701 /* "lxml/builder.py":212
3702 * typemap[dict](elem, attrib)
3704 * for item in children: # <<<<<<<<<<<<<<
3705 * if callable(item):
3710 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3712 /* "lxml/builder.py":232
3713 * typemap.get(type(v))(elem, v)
3715 * return elem # <<<<<<<<<<<<<<
3717 * def __getattr__(self, tag):
3719 __Pyx_XDECREF(__pyx_r);
3720 __Pyx_INCREF(__pyx_v_elem);
3721 __pyx_r = __pyx_v_elem;
3724 /* "lxml/builder.py":203
3725 * self._typemap = typemap
3727 * def __call__(self, tag, *children, **attrib): # <<<<<<<<<<<<<<
3728 * typemap = self._typemap
3732 /* function exit code */
3734 __Pyx_XDECREF(__pyx_t_1);
3735 __Pyx_XDECREF(__pyx_t_5);
3736 __Pyx_XDECREF(__pyx_t_6);
3737 __Pyx_XDECREF(__pyx_t_8);
3738 __Pyx_XDECREF(__pyx_t_13);
3739 __Pyx_AddTraceback("lxml.builder.ElementMaker.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3742 __Pyx_XDECREF(__pyx_v_typemap);
3743 __Pyx_XDECREF(__pyx_v_elem);
3744 __Pyx_XDECREF(__pyx_v_item);
3745 __Pyx_XDECREF(__pyx_v_t);
3746 __Pyx_XDECREF(__pyx_v_basetype);
3747 __Pyx_XDECREF(__pyx_v_v);
3748 __Pyx_XDECREF(__pyx_v_tag);
3749 __Pyx_XGIVEREF(__pyx_r);
3750 __Pyx_RefNannyFinishContext();
3754 /* "lxml/builder.py":234
3757 * def __getattr__(self, tag): # <<<<<<<<<<<<<<
3758 * return partial(self, tag)
3762 /* Python wrapper */
3763 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
3764 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
3765 PyObject *__pyx_r = 0;
3766 __Pyx_RefNannyDeclarations
3767 __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
3768 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_4__getattr__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self), ((PyObject *)__pyx_v_tag));
3770 /* function exit code */
3771 __Pyx_RefNannyFinishContext();
3775 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_4__getattr__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v_tag) {
3776 PyObject *__pyx_r = NULL;
3777 __Pyx_RefNannyDeclarations
3778 PyObject *__pyx_t_1 = NULL;
3779 PyObject *__pyx_t_2 = NULL;
3780 PyObject *__pyx_t_3 = NULL;
3782 PyObject *__pyx_t_5 = NULL;
3783 int __pyx_lineno = 0;
3784 const char *__pyx_filename = NULL;
3785 int __pyx_clineno = 0;
3786 __Pyx_RefNannySetupContext("__getattr__", 0);
3788 /* "lxml/builder.py":235
3790 * def __getattr__(self, tag):
3791 * return partial(self, tag) # <<<<<<<<<<<<<<
3795 __Pyx_XDECREF(__pyx_r);
3796 __Pyx_INCREF(__pyx_v_4lxml_7builder_partial);
3797 __pyx_t_2 = __pyx_v_4lxml_7builder_partial; __pyx_t_3 = NULL;
3799 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3800 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3801 if (likely(__pyx_t_3)) {
3802 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3803 __Pyx_INCREF(__pyx_t_3);
3804 __Pyx_INCREF(function);
3805 __Pyx_DECREF_SET(__pyx_t_2, function);
3809 #if CYTHON_FAST_PYCALL
3810 if (PyFunction_Check(__pyx_t_2)) {
3811 PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tag};
3812 __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, 235, __pyx_L1_error)
3813 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3814 __Pyx_GOTREF(__pyx_t_1);
3817 #if CYTHON_FAST_PYCCALL
3818 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3819 PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_tag};
3820 __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, 235, __pyx_L1_error)
3821 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3822 __Pyx_GOTREF(__pyx_t_1);
3826 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
3827 __Pyx_GOTREF(__pyx_t_5);
3829 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
3831 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3832 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3833 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_self));
3834 __Pyx_INCREF(__pyx_v_tag);
3835 __Pyx_GIVEREF(__pyx_v_tag);
3836 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_tag);
3837 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
3838 __Pyx_GOTREF(__pyx_t_1);
3839 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3841 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3842 __pyx_r = __pyx_t_1;
3846 /* "lxml/builder.py":234
3849 * def __getattr__(self, tag): # <<<<<<<<<<<<<<
3850 * return partial(self, tag)
3854 /* function exit code */
3856 __Pyx_XDECREF(__pyx_t_1);
3857 __Pyx_XDECREF(__pyx_t_2);
3858 __Pyx_XDECREF(__pyx_t_3);
3859 __Pyx_XDECREF(__pyx_t_5);
3860 __Pyx_AddTraceback("lxml.builder.ElementMaker.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3863 __Pyx_XGIVEREF(__pyx_r);
3864 __Pyx_RefNannyFinishContext();
3868 /* "lxml/builder.pxd":7
3870 * cdef class ElementMaker:
3871 * cdef readonly dict _nsmap # <<<<<<<<<<<<<<
3872 * cdef readonly dict _typemap
3873 * cdef readonly object _namespace
3876 /* Python wrapper */
3877 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_6_nsmap_1__get__(PyObject *__pyx_v_self); /*proto*/
3878 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_6_nsmap_1__get__(PyObject *__pyx_v_self) {
3879 PyObject *__pyx_r = 0;
3880 __Pyx_RefNannyDeclarations
3881 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3882 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_6_nsmap___get__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self));
3884 /* function exit code */
3885 __Pyx_RefNannyFinishContext();
3889 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_6_nsmap___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self) {
3890 PyObject *__pyx_r = NULL;
3891 __Pyx_RefNannyDeclarations
3892 __Pyx_RefNannySetupContext("__get__", 0);
3893 __Pyx_XDECREF(__pyx_r);
3894 __Pyx_INCREF(__pyx_v_self->_nsmap);
3895 __pyx_r = __pyx_v_self->_nsmap;
3898 /* function exit code */
3900 __Pyx_XGIVEREF(__pyx_r);
3901 __Pyx_RefNannyFinishContext();
3905 /* "lxml/builder.pxd":8
3906 * cdef class ElementMaker:
3907 * cdef readonly dict _nsmap
3908 * cdef readonly dict _typemap # <<<<<<<<<<<<<<
3909 * cdef readonly object _namespace
3910 * cdef readonly object _makeelement
3913 /* Python wrapper */
3914 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8_typemap_1__get__(PyObject *__pyx_v_self); /*proto*/
3915 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_8_typemap_1__get__(PyObject *__pyx_v_self) {
3916 PyObject *__pyx_r = 0;
3917 __Pyx_RefNannyDeclarations
3918 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3919 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_8_typemap___get__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self));
3921 /* function exit code */
3922 __Pyx_RefNannyFinishContext();
3926 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8_typemap___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self) {
3927 PyObject *__pyx_r = NULL;
3928 __Pyx_RefNannyDeclarations
3929 __Pyx_RefNannySetupContext("__get__", 0);
3930 __Pyx_XDECREF(__pyx_r);
3931 __Pyx_INCREF(__pyx_v_self->_typemap);
3932 __pyx_r = __pyx_v_self->_typemap;
3935 /* function exit code */
3937 __Pyx_XGIVEREF(__pyx_r);
3938 __Pyx_RefNannyFinishContext();
3942 /* "lxml/builder.pxd":9
3943 * cdef readonly dict _nsmap
3944 * cdef readonly dict _typemap
3945 * cdef readonly object _namespace # <<<<<<<<<<<<<<
3946 * cdef readonly object _makeelement
3949 /* Python wrapper */
3950 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_10_namespace_1__get__(PyObject *__pyx_v_self); /*proto*/
3951 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_10_namespace_1__get__(PyObject *__pyx_v_self) {
3952 PyObject *__pyx_r = 0;
3953 __Pyx_RefNannyDeclarations
3954 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3955 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_10_namespace___get__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self));
3957 /* function exit code */
3958 __Pyx_RefNannyFinishContext();
3962 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_10_namespace___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self) {
3963 PyObject *__pyx_r = NULL;
3964 __Pyx_RefNannyDeclarations
3965 __Pyx_RefNannySetupContext("__get__", 0);
3966 __Pyx_XDECREF(__pyx_r);
3967 __Pyx_INCREF(__pyx_v_self->_namespace);
3968 __pyx_r = __pyx_v_self->_namespace;
3971 /* function exit code */
3973 __Pyx_XGIVEREF(__pyx_r);
3974 __Pyx_RefNannyFinishContext();
3978 /* "lxml/builder.pxd":10
3979 * cdef readonly dict _typemap
3980 * cdef readonly object _namespace
3981 * cdef readonly object _makeelement # <<<<<<<<<<<<<<
3984 /* Python wrapper */
3985 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_12_makeelement_1__get__(PyObject *__pyx_v_self); /*proto*/
3986 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_12_makeelement_1__get__(PyObject *__pyx_v_self) {
3987 PyObject *__pyx_r = 0;
3988 __Pyx_RefNannyDeclarations
3989 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3990 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_12_makeelement___get__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self));
3992 /* function exit code */
3993 __Pyx_RefNannyFinishContext();
3997 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_12_makeelement___get__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self) {
3998 PyObject *__pyx_r = NULL;
3999 __Pyx_RefNannyDeclarations
4000 __Pyx_RefNannySetupContext("__get__", 0);
4001 __Pyx_XDECREF(__pyx_r);
4002 __Pyx_INCREF(__pyx_v_self->_makeelement);
4003 __pyx_r = __pyx_v_self->_makeelement;
4006 /* function exit code */
4008 __Pyx_XGIVEREF(__pyx_r);
4009 __Pyx_RefNannyFinishContext();
4013 /* "(tree fragment)":1
4014 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4019 /* Python wrapper */
4020 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4021 static PyMethodDef __pyx_mdef_4lxml_7builder_12ElementMaker_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_7builder_12ElementMaker_7__reduce_cython__, METH_NOARGS, 0};
4022 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4023 PyObject *__pyx_r = 0;
4024 __Pyx_RefNannyDeclarations
4025 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4026 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_6__reduce_cython__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self));
4028 /* function exit code */
4029 __Pyx_RefNannyFinishContext();
4033 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_6__reduce_cython__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self) {
4034 PyObject *__pyx_v_state = 0;
4035 PyObject *__pyx_v__dict = 0;
4036 int __pyx_v_use_setstate;
4037 PyObject *__pyx_r = NULL;
4038 __Pyx_RefNannyDeclarations
4039 PyObject *__pyx_t_1 = NULL;
4042 PyObject *__pyx_t_4 = NULL;
4044 PyObject *__pyx_t_6 = NULL;
4045 int __pyx_lineno = 0;
4046 const char *__pyx_filename = NULL;
4047 int __pyx_clineno = 0;
4048 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4050 /* "(tree fragment)":5
4052 * cdef bint use_setstate
4053 * state = (self._makeelement, self._namespace, self._nsmap, self._typemap) # <<<<<<<<<<<<<<
4054 * _dict = getattr(self, '__dict__', None)
4055 * if _dict is not None:
4057 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
4058 __Pyx_GOTREF(__pyx_t_1);
4059 __Pyx_INCREF(__pyx_v_self->_makeelement);
4060 __Pyx_GIVEREF(__pyx_v_self->_makeelement);
4061 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->_makeelement);
4062 __Pyx_INCREF(__pyx_v_self->_namespace);
4063 __Pyx_GIVEREF(__pyx_v_self->_namespace);
4064 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->_namespace);
4065 __Pyx_INCREF(__pyx_v_self->_nsmap);
4066 __Pyx_GIVEREF(__pyx_v_self->_nsmap);
4067 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->_nsmap);
4068 __Pyx_INCREF(__pyx_v_self->_typemap);
4069 __Pyx_GIVEREF(__pyx_v_self->_typemap);
4070 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->_typemap);
4071 __pyx_v_state = ((PyObject*)__pyx_t_1);
4074 /* "(tree fragment)":6
4075 * cdef bint use_setstate
4076 * state = (self._makeelement, self._namespace, self._nsmap, self._typemap)
4077 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
4078 * if _dict is not None:
4081 __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)
4082 __Pyx_GOTREF(__pyx_t_1);
4083 __pyx_v__dict = __pyx_t_1;
4086 /* "(tree fragment)":7
4087 * state = (self._makeelement, self._namespace, self._nsmap, self._typemap)
4088 * _dict = getattr(self, '__dict__', None)
4089 * if _dict is not None: # <<<<<<<<<<<<<<
4091 * use_setstate = True
4093 __pyx_t_2 = (__pyx_v__dict != Py_None);
4094 __pyx_t_3 = (__pyx_t_2 != 0);
4097 /* "(tree fragment)":8
4098 * _dict = getattr(self, '__dict__', None)
4099 * if _dict is not None:
4100 * state += (_dict,) # <<<<<<<<<<<<<<
4101 * use_setstate = True
4104 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
4105 __Pyx_GOTREF(__pyx_t_1);
4106 __Pyx_INCREF(__pyx_v__dict);
4107 __Pyx_GIVEREF(__pyx_v__dict);
4108 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
4109 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
4110 __Pyx_GOTREF(__pyx_t_4);
4111 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4112 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
4115 /* "(tree fragment)":9
4116 * if _dict is not None:
4118 * use_setstate = True # <<<<<<<<<<<<<<
4120 * use_setstate = self._makeelement is not None or self._namespace is not None or self._nsmap is not None or self._typemap is not None
4122 __pyx_v_use_setstate = 1;
4124 /* "(tree fragment)":7
4125 * state = (self._makeelement, self._namespace, self._nsmap, self._typemap)
4126 * _dict = getattr(self, '__dict__', None)
4127 * if _dict is not None: # <<<<<<<<<<<<<<
4129 * use_setstate = True
4134 /* "(tree fragment)":11
4135 * use_setstate = True
4137 * use_setstate = self._makeelement is not None or self._namespace is not None or self._nsmap is not None or self._typemap is not None # <<<<<<<<<<<<<<
4139 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, None), state
4142 __pyx_t_2 = (__pyx_v_self->_makeelement != Py_None);
4143 __pyx_t_5 = (__pyx_t_2 != 0);
4146 __pyx_t_3 = __pyx_t_5;
4147 goto __pyx_L4_bool_binop_done;
4149 __pyx_t_5 = (__pyx_v_self->_namespace != Py_None);
4150 __pyx_t_2 = (__pyx_t_5 != 0);
4153 __pyx_t_3 = __pyx_t_2;
4154 goto __pyx_L4_bool_binop_done;
4156 __pyx_t_2 = (__pyx_v_self->_nsmap != ((PyObject*)Py_None));
4157 __pyx_t_5 = (__pyx_t_2 != 0);
4160 __pyx_t_3 = __pyx_t_5;
4161 goto __pyx_L4_bool_binop_done;
4163 __pyx_t_5 = (__pyx_v_self->_typemap != ((PyObject*)Py_None));
4164 __pyx_t_2 = (__pyx_t_5 != 0);
4165 __pyx_t_3 = __pyx_t_2;
4166 __pyx_L4_bool_binop_done:;
4167 __pyx_v_use_setstate = __pyx_t_3;
4171 /* "(tree fragment)":12
4173 * use_setstate = self._makeelement is not None or self._namespace is not None or self._nsmap is not None or self._typemap is not None
4174 * if use_setstate: # <<<<<<<<<<<<<<
4175 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, None), state
4178 __pyx_t_3 = (__pyx_v_use_setstate != 0);
4181 /* "(tree fragment)":13
4182 * use_setstate = self._makeelement is not None or self._namespace is not None or self._nsmap is not None or self._typemap is not None
4184 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, None), state # <<<<<<<<<<<<<<
4186 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
4188 __Pyx_XDECREF(__pyx_r);
4189 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_ElementMaker); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
4190 __Pyx_GOTREF(__pyx_t_4);
4191 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
4192 __Pyx_GOTREF(__pyx_t_1);
4193 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4194 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4195 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4196 __Pyx_INCREF(__pyx_int_167522209);
4197 __Pyx_GIVEREF(__pyx_int_167522209);
4198 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_167522209);
4199 __Pyx_INCREF(Py_None);
4200 __Pyx_GIVEREF(Py_None);
4201 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
4202 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
4203 __Pyx_GOTREF(__pyx_t_6);
4204 __Pyx_GIVEREF(__pyx_t_4);
4205 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
4206 __Pyx_GIVEREF(__pyx_t_1);
4207 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
4208 __Pyx_INCREF(__pyx_v_state);
4209 __Pyx_GIVEREF(__pyx_v_state);
4210 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
4213 __pyx_r = __pyx_t_6;
4217 /* "(tree fragment)":12
4219 * use_setstate = self._makeelement is not None or self._namespace is not None or self._nsmap is not None or self._typemap is not None
4220 * if use_setstate: # <<<<<<<<<<<<<<
4221 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, None), state
4226 /* "(tree fragment)":15
4227 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, None), state
4229 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state) # <<<<<<<<<<<<<<
4230 * def __setstate_cython__(self, __pyx_state):
4231 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state)
4234 __Pyx_XDECREF(__pyx_r);
4235 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_ElementMaker); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
4236 __Pyx_GOTREF(__pyx_t_6);
4237 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
4238 __Pyx_GOTREF(__pyx_t_1);
4239 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4240 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4241 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4242 __Pyx_INCREF(__pyx_int_167522209);
4243 __Pyx_GIVEREF(__pyx_int_167522209);
4244 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_167522209);
4245 __Pyx_INCREF(__pyx_v_state);
4246 __Pyx_GIVEREF(__pyx_v_state);
4247 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
4248 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
4249 __Pyx_GOTREF(__pyx_t_4);
4250 __Pyx_GIVEREF(__pyx_t_6);
4251 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
4252 __Pyx_GIVEREF(__pyx_t_1);
4253 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
4256 __pyx_r = __pyx_t_4;
4261 /* "(tree fragment)":1
4262 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4267 /* function exit code */
4269 __Pyx_XDECREF(__pyx_t_1);
4270 __Pyx_XDECREF(__pyx_t_4);
4271 __Pyx_XDECREF(__pyx_t_6);
4272 __Pyx_AddTraceback("lxml.builder.ElementMaker.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4275 __Pyx_XDECREF(__pyx_v_state);
4276 __Pyx_XDECREF(__pyx_v__dict);
4277 __Pyx_XGIVEREF(__pyx_r);
4278 __Pyx_RefNannyFinishContext();
4282 /* "(tree fragment)":16
4284 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
4285 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4286 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state)
4289 /* Python wrapper */
4290 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
4291 static PyMethodDef __pyx_mdef_4lxml_7builder_12ElementMaker_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_7builder_12ElementMaker_9__setstate_cython__, METH_O, 0};
4292 static PyObject *__pyx_pw_4lxml_7builder_12ElementMaker_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4293 PyObject *__pyx_r = 0;
4294 __Pyx_RefNannyDeclarations
4295 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4296 __pyx_r = __pyx_pf_4lxml_7builder_12ElementMaker_8__setstate_cython__(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4298 /* function exit code */
4299 __Pyx_RefNannyFinishContext();
4303 static PyObject *__pyx_pf_4lxml_7builder_12ElementMaker_8__setstate_cython__(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4304 PyObject *__pyx_r = NULL;
4305 __Pyx_RefNannyDeclarations
4306 PyObject *__pyx_t_1 = NULL;
4307 int __pyx_lineno = 0;
4308 const char *__pyx_filename = NULL;
4309 int __pyx_clineno = 0;
4310 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4312 /* "(tree fragment)":17
4313 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
4314 * def __setstate_cython__(self, __pyx_state):
4315 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
4317 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)
4318 __pyx_t_1 = __pyx_f_4lxml_7builder___pyx_unpickle_ElementMaker__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
4319 __Pyx_GOTREF(__pyx_t_1);
4320 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4322 /* "(tree fragment)":16
4324 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
4325 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4326 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state)
4329 /* function exit code */
4330 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4333 __Pyx_XDECREF(__pyx_t_1);
4334 __Pyx_AddTraceback("lxml.builder.ElementMaker.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4337 __Pyx_XGIVEREF(__pyx_r);
4338 __Pyx_RefNannyFinishContext();
4342 /* "(tree fragment)":1
4343 * def __pyx_unpickle_ElementMaker(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
4344 * cdef object __pyx_PickleError
4345 * cdef object __pyx_result
4348 /* Python wrapper */
4349 static PyObject *__pyx_pw_4lxml_7builder_1__pyx_unpickle_ElementMaker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4350 static PyMethodDef __pyx_mdef_4lxml_7builder_1__pyx_unpickle_ElementMaker = {"__pyx_unpickle_ElementMaker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_7builder_1__pyx_unpickle_ElementMaker, METH_VARARGS|METH_KEYWORDS, 0};
4351 static PyObject *__pyx_pw_4lxml_7builder_1__pyx_unpickle_ElementMaker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4352 PyObject *__pyx_v___pyx_type = 0;
4353 long __pyx_v___pyx_checksum;
4354 PyObject *__pyx_v___pyx_state = 0;
4355 int __pyx_lineno = 0;
4356 const char *__pyx_filename = NULL;
4357 int __pyx_clineno = 0;
4358 PyObject *__pyx_r = 0;
4359 __Pyx_RefNannyDeclarations
4360 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementMaker (wrapper)", 0);
4362 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
4363 PyObject* values[3] = {0,0,0};
4364 if (unlikely(__pyx_kwds)) {
4366 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4368 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4370 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4372 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4375 default: goto __pyx_L5_argtuple_error;
4377 kw_args = PyDict_Size(__pyx_kwds);
4380 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
4381 else goto __pyx_L5_argtuple_error;
4384 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
4386 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementMaker", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
4390 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
4392 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementMaker", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
4395 if (unlikely(kw_args > 0)) {
4396 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ElementMaker") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
4398 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4399 goto __pyx_L5_argtuple_error;
4401 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4402 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4403 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4405 __pyx_v___pyx_type = values[0];
4406 __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)
4407 __pyx_v___pyx_state = values[2];
4409 goto __pyx_L4_argument_unpacking_done;
4410 __pyx_L5_argtuple_error:;
4411 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ElementMaker", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
4413 __Pyx_AddTraceback("lxml.builder.__pyx_unpickle_ElementMaker", __pyx_clineno, __pyx_lineno, __pyx_filename);
4414 __Pyx_RefNannyFinishContext();
4416 __pyx_L4_argument_unpacking_done:;
4417 __pyx_r = __pyx_pf_4lxml_7builder___pyx_unpickle_ElementMaker(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
4419 /* function exit code */
4420 __Pyx_RefNannyFinishContext();
4424 static PyObject *__pyx_pf_4lxml_7builder___pyx_unpickle_ElementMaker(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
4425 PyObject *__pyx_v___pyx_PickleError = 0;
4426 PyObject *__pyx_v___pyx_result = 0;
4427 PyObject *__pyx_r = NULL;
4428 __Pyx_RefNannyDeclarations
4430 PyObject *__pyx_t_2 = NULL;
4431 PyObject *__pyx_t_3 = NULL;
4432 PyObject *__pyx_t_4 = NULL;
4433 PyObject *__pyx_t_5 = NULL;
4435 int __pyx_lineno = 0;
4436 const char *__pyx_filename = NULL;
4437 int __pyx_clineno = 0;
4438 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementMaker", 0);
4440 /* "(tree fragment)":4
4441 * cdef object __pyx_PickleError
4442 * cdef object __pyx_result
4443 * if __pyx_checksum != 0x9fc2fa1: # <<<<<<<<<<<<<<
4444 * from pickle import PickleError as __pyx_PickleError
4445 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4447 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x9fc2fa1) != 0);
4450 /* "(tree fragment)":5
4451 * cdef object __pyx_result
4452 * if __pyx_checksum != 0x9fc2fa1:
4453 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
4454 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4455 * __pyx_result = ElementMaker.__new__(__pyx_type)
4457 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
4458 __Pyx_GOTREF(__pyx_t_2);
4459 __Pyx_INCREF(__pyx_n_s_PickleError);
4460 __Pyx_GIVEREF(__pyx_n_s_PickleError);
4461 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
4462 __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)
4463 __Pyx_GOTREF(__pyx_t_3);
4464 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4465 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
4466 __Pyx_GOTREF(__pyx_t_2);
4467 __Pyx_INCREF(__pyx_t_2);
4468 __pyx_v___pyx_PickleError = __pyx_t_2;
4469 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4470 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4472 /* "(tree fragment)":6
4473 * if __pyx_checksum != 0x9fc2fa1:
4474 * from pickle import PickleError as __pyx_PickleError
4475 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum) # <<<<<<<<<<<<<<
4476 * __pyx_result = ElementMaker.__new__(__pyx_type)
4477 * if __pyx_state is not None:
4479 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
4480 __Pyx_GOTREF(__pyx_t_2);
4481 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x9f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
4482 __Pyx_GOTREF(__pyx_t_4);
4483 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4484 __Pyx_INCREF(__pyx_v___pyx_PickleError);
4485 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
4486 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4487 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
4488 if (likely(__pyx_t_5)) {
4489 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4490 __Pyx_INCREF(__pyx_t_5);
4491 __Pyx_INCREF(function);
4492 __Pyx_DECREF_SET(__pyx_t_2, function);
4495 __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);
4496 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4497 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4498 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
4499 __Pyx_GOTREF(__pyx_t_3);
4500 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4501 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4502 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4503 __PYX_ERR(1, 6, __pyx_L1_error)
4505 /* "(tree fragment)":4
4506 * cdef object __pyx_PickleError
4507 * cdef object __pyx_result
4508 * if __pyx_checksum != 0x9fc2fa1: # <<<<<<<<<<<<<<
4509 * from pickle import PickleError as __pyx_PickleError
4510 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4514 /* "(tree fragment)":7
4515 * from pickle import PickleError as __pyx_PickleError
4516 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4517 * __pyx_result = ElementMaker.__new__(__pyx_type) # <<<<<<<<<<<<<<
4518 * if __pyx_state is not None:
4519 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4521 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4lxml_7builder_ElementMaker), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
4522 __Pyx_GOTREF(__pyx_t_2);
4524 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4525 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
4526 if (likely(__pyx_t_4)) {
4527 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4528 __Pyx_INCREF(__pyx_t_4);
4529 __Pyx_INCREF(function);
4530 __Pyx_DECREF_SET(__pyx_t_2, function);
4533 __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);
4534 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4535 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
4536 __Pyx_GOTREF(__pyx_t_3);
4537 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4538 __pyx_v___pyx_result = __pyx_t_3;
4541 /* "(tree fragment)":8
4542 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4543 * __pyx_result = ElementMaker.__new__(__pyx_type)
4544 * if __pyx_state is not None: # <<<<<<<<<<<<<<
4545 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4546 * return __pyx_result
4548 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
4549 __pyx_t_6 = (__pyx_t_1 != 0);
4552 /* "(tree fragment)":9
4553 * __pyx_result = ElementMaker.__new__(__pyx_type)
4554 * if __pyx_state is not None:
4555 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
4556 * return __pyx_result
4557 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state):
4559 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)
4560 __pyx_t_3 = __pyx_f_4lxml_7builder___pyx_unpickle_ElementMaker__set_state(((struct __pyx_obj_4lxml_7builder_ElementMaker *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
4561 __Pyx_GOTREF(__pyx_t_3);
4562 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4564 /* "(tree fragment)":8
4565 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x9fc2fa1 = (_makeelement, _namespace, _nsmap, _typemap))" % __pyx_checksum)
4566 * __pyx_result = ElementMaker.__new__(__pyx_type)
4567 * if __pyx_state is not None: # <<<<<<<<<<<<<<
4568 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4569 * return __pyx_result
4573 /* "(tree fragment)":10
4574 * if __pyx_state is not None:
4575 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4576 * return __pyx_result # <<<<<<<<<<<<<<
4577 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state):
4578 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4580 __Pyx_XDECREF(__pyx_r);
4581 __Pyx_INCREF(__pyx_v___pyx_result);
4582 __pyx_r = __pyx_v___pyx_result;
4585 /* "(tree fragment)":1
4586 * def __pyx_unpickle_ElementMaker(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
4587 * cdef object __pyx_PickleError
4588 * cdef object __pyx_result
4591 /* function exit code */
4593 __Pyx_XDECREF(__pyx_t_2);
4594 __Pyx_XDECREF(__pyx_t_3);
4595 __Pyx_XDECREF(__pyx_t_4);
4596 __Pyx_XDECREF(__pyx_t_5);
4597 __Pyx_AddTraceback("lxml.builder.__pyx_unpickle_ElementMaker", __pyx_clineno, __pyx_lineno, __pyx_filename);
4600 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
4601 __Pyx_XDECREF(__pyx_v___pyx_result);
4602 __Pyx_XGIVEREF(__pyx_r);
4603 __Pyx_RefNannyFinishContext();
4607 /* "(tree fragment)":11
4608 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4609 * return __pyx_result
4610 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
4611 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4612 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
4615 static PyObject *__pyx_f_4lxml_7builder___pyx_unpickle_ElementMaker__set_state(struct __pyx_obj_4lxml_7builder_ElementMaker *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
4616 PyObject *__pyx_r = NULL;
4617 __Pyx_RefNannyDeclarations
4618 PyObject *__pyx_t_1 = NULL;
4620 Py_ssize_t __pyx_t_3;
4623 PyObject *__pyx_t_6 = NULL;
4624 PyObject *__pyx_t_7 = NULL;
4625 PyObject *__pyx_t_8 = NULL;
4626 int __pyx_lineno = 0;
4627 const char *__pyx_filename = NULL;
4628 int __pyx_clineno = 0;
4629 __Pyx_RefNannySetupContext("__pyx_unpickle_ElementMaker__set_state", 0);
4631 /* "(tree fragment)":12
4632 * return __pyx_result
4633 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state):
4634 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3] # <<<<<<<<<<<<<<
4635 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
4636 * __pyx_result.__dict__.update(__pyx_state[4])
4638 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4639 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4640 __PYX_ERR(1, 12, __pyx_L1_error)
4642 __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)
4643 __Pyx_GOTREF(__pyx_t_1);
4644 __Pyx_GIVEREF(__pyx_t_1);
4645 __Pyx_GOTREF(__pyx_v___pyx_result->_makeelement);
4646 __Pyx_DECREF(__pyx_v___pyx_result->_makeelement);
4647 __pyx_v___pyx_result->_makeelement = __pyx_t_1;
4649 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4650 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4651 __PYX_ERR(1, 12, __pyx_L1_error)
4653 __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)
4654 __Pyx_GOTREF(__pyx_t_1);
4655 __Pyx_GIVEREF(__pyx_t_1);
4656 __Pyx_GOTREF(__pyx_v___pyx_result->_namespace);
4657 __Pyx_DECREF(__pyx_v___pyx_result->_namespace);
4658 __pyx_v___pyx_result->_namespace = __pyx_t_1;
4660 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4661 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4662 __PYX_ERR(1, 12, __pyx_L1_error)
4664 __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)
4665 __Pyx_GOTREF(__pyx_t_1);
4666 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(1, 12, __pyx_L1_error)
4667 __Pyx_GIVEREF(__pyx_t_1);
4668 __Pyx_GOTREF(__pyx_v___pyx_result->_nsmap);
4669 __Pyx_DECREF(__pyx_v___pyx_result->_nsmap);
4670 __pyx_v___pyx_result->_nsmap = ((PyObject*)__pyx_t_1);
4672 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4673 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4674 __PYX_ERR(1, 12, __pyx_L1_error)
4676 __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)
4677 __Pyx_GOTREF(__pyx_t_1);
4678 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(1, 12, __pyx_L1_error)
4679 __Pyx_GIVEREF(__pyx_t_1);
4680 __Pyx_GOTREF(__pyx_v___pyx_result->_typemap);
4681 __Pyx_DECREF(__pyx_v___pyx_result->_typemap);
4682 __pyx_v___pyx_result->_typemap = ((PyObject*)__pyx_t_1);
4685 /* "(tree fragment)":13
4686 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state):
4687 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4688 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
4689 * __pyx_result.__dict__.update(__pyx_state[4])
4691 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4692 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
4693 __PYX_ERR(1, 13, __pyx_L1_error)
4695 __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)
4696 __pyx_t_4 = ((__pyx_t_3 > 4) != 0);
4699 __pyx_t_2 = __pyx_t_4;
4700 goto __pyx_L4_bool_binop_done;
4702 __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)
4703 __pyx_t_5 = (__pyx_t_4 != 0);
4704 __pyx_t_2 = __pyx_t_5;
4705 __pyx_L4_bool_binop_done:;
4708 /* "(tree fragment)":14
4709 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4710 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
4711 * __pyx_result.__dict__.update(__pyx_state[4]) # <<<<<<<<<<<<<<
4713 __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)
4714 __Pyx_GOTREF(__pyx_t_6);
4715 __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)
4716 __Pyx_GOTREF(__pyx_t_7);
4717 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4718 if (unlikely(__pyx_v___pyx_state == Py_None)) {
4719 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4720 __PYX_ERR(1, 14, __pyx_L1_error)
4722 __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)
4723 __Pyx_GOTREF(__pyx_t_6);
4725 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
4726 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
4727 if (likely(__pyx_t_8)) {
4728 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
4729 __Pyx_INCREF(__pyx_t_8);
4730 __Pyx_INCREF(function);
4731 __Pyx_DECREF_SET(__pyx_t_7, function);
4734 __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);
4735 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
4736 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4737 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
4738 __Pyx_GOTREF(__pyx_t_1);
4739 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4740 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4742 /* "(tree fragment)":13
4743 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state):
4744 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4745 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
4746 * __pyx_result.__dict__.update(__pyx_state[4])
4750 /* "(tree fragment)":11
4751 * __pyx_unpickle_ElementMaker__set_state(<ElementMaker> __pyx_result, __pyx_state)
4752 * return __pyx_result
4753 * cdef __pyx_unpickle_ElementMaker__set_state(ElementMaker __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
4754 * __pyx_result._makeelement = __pyx_state[0]; __pyx_result._namespace = __pyx_state[1]; __pyx_result._nsmap = __pyx_state[2]; __pyx_result._typemap = __pyx_state[3]
4755 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
4758 /* function exit code */
4759 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4762 __Pyx_XDECREF(__pyx_t_1);
4763 __Pyx_XDECREF(__pyx_t_6);
4764 __Pyx_XDECREF(__pyx_t_7);
4765 __Pyx_XDECREF(__pyx_t_8);
4766 __Pyx_AddTraceback("lxml.builder.__pyx_unpickle_ElementMaker__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
4769 __Pyx_XGIVEREF(__pyx_r);
4770 __Pyx_RefNannyFinishContext();
4774 static PyObject *__pyx_tp_new_4lxml_7builder_ElementMaker(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4775 struct __pyx_obj_4lxml_7builder_ElementMaker *p;
4777 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4778 o = (*t->tp_alloc)(t, 0);
4780 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4782 if (unlikely(!o)) return 0;
4783 p = ((struct __pyx_obj_4lxml_7builder_ElementMaker *)o);
4784 p->_nsmap = ((PyObject*)Py_None); Py_INCREF(Py_None);
4785 p->_typemap = ((PyObject*)Py_None); Py_INCREF(Py_None);
4786 p->_namespace = Py_None; Py_INCREF(Py_None);
4787 p->_makeelement = Py_None; Py_INCREF(Py_None);
4791 static void __pyx_tp_dealloc_4lxml_7builder_ElementMaker(PyObject *o) {
4792 struct __pyx_obj_4lxml_7builder_ElementMaker *p = (struct __pyx_obj_4lxml_7builder_ElementMaker *)o;
4793 #if CYTHON_USE_TP_FINALIZE
4794 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
4795 if (PyObject_CallFinalizerFromDealloc(o)) return;
4798 PyObject_GC_UnTrack(o);
4799 Py_CLEAR(p->_nsmap);
4800 Py_CLEAR(p->_typemap);
4801 Py_CLEAR(p->_namespace);
4802 Py_CLEAR(p->_makeelement);
4803 (*Py_TYPE(o)->tp_free)(o);
4806 static int __pyx_tp_traverse_4lxml_7builder_ElementMaker(PyObject *o, visitproc v, void *a) {
4808 struct __pyx_obj_4lxml_7builder_ElementMaker *p = (struct __pyx_obj_4lxml_7builder_ElementMaker *)o;
4810 e = (*v)(p->_nsmap, a); if (e) return e;
4813 e = (*v)(p->_typemap, a); if (e) return e;
4815 if (p->_namespace) {
4816 e = (*v)(p->_namespace, a); if (e) return e;
4818 if (p->_makeelement) {
4819 e = (*v)(p->_makeelement, a); if (e) return e;
4824 static int __pyx_tp_clear_4lxml_7builder_ElementMaker(PyObject *o) {
4825 struct __pyx_obj_4lxml_7builder_ElementMaker *p = (struct __pyx_obj_4lxml_7builder_ElementMaker *)o;
4826 Py_CLEAR(p->_nsmap);
4827 Py_CLEAR(p->_typemap);
4828 Py_CLEAR(p->_namespace);
4829 Py_CLEAR(p->_makeelement);
4833 static PyObject *__pyx_tp_getattro_4lxml_7builder_ElementMaker(PyObject *o, PyObject *n) {
4834 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
4835 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
4837 v = __pyx_pw_4lxml_7builder_12ElementMaker_5__getattr__(o, n);
4842 static PyObject *__pyx_getprop_4lxml_7builder_12ElementMaker__nsmap(PyObject *o, CYTHON_UNUSED void *x) {
4843 return __pyx_pw_4lxml_7builder_12ElementMaker_6_nsmap_1__get__(o);
4846 static PyObject *__pyx_getprop_4lxml_7builder_12ElementMaker__typemap(PyObject *o, CYTHON_UNUSED void *x) {
4847 return __pyx_pw_4lxml_7builder_12ElementMaker_8_typemap_1__get__(o);
4850 static PyObject *__pyx_getprop_4lxml_7builder_12ElementMaker__namespace(PyObject *o, CYTHON_UNUSED void *x) {
4851 return __pyx_pw_4lxml_7builder_12ElementMaker_10_namespace_1__get__(o);
4854 static PyObject *__pyx_getprop_4lxml_7builder_12ElementMaker__makeelement(PyObject *o, CYTHON_UNUSED void *x) {
4855 return __pyx_pw_4lxml_7builder_12ElementMaker_12_makeelement_1__get__(o);
4858 static PyMethodDef __pyx_methods_4lxml_7builder_ElementMaker[] = {
4859 {"__getattr__", (PyCFunction)__pyx_pw_4lxml_7builder_12ElementMaker_5__getattr__, METH_O|METH_COEXIST, 0},
4860 {"__reduce_cython__", (PyCFunction)__pyx_pw_4lxml_7builder_12ElementMaker_7__reduce_cython__, METH_NOARGS, 0},
4861 {"__setstate_cython__", (PyCFunction)__pyx_pw_4lxml_7builder_12ElementMaker_9__setstate_cython__, METH_O, 0},
4865 static struct PyGetSetDef __pyx_getsets_4lxml_7builder_ElementMaker[] = {
4866 {(char *)"_nsmap", __pyx_getprop_4lxml_7builder_12ElementMaker__nsmap, 0, (char *)0, 0},
4867 {(char *)"_typemap", __pyx_getprop_4lxml_7builder_12ElementMaker__typemap, 0, (char *)0, 0},
4868 {(char *)"_namespace", __pyx_getprop_4lxml_7builder_12ElementMaker__namespace, 0, (char *)0, 0},
4869 {(char *)"_makeelement", __pyx_getprop_4lxml_7builder_12ElementMaker__makeelement, 0, (char *)0, 0},
4873 static PyTypeObject __pyx_type_4lxml_7builder_ElementMaker = {
4874 PyVarObject_HEAD_INIT(0, 0)
4875 "lxml.builder.ElementMaker", /*tp_name*/
4876 sizeof(struct __pyx_obj_4lxml_7builder_ElementMaker), /*tp_basicsize*/
4878 __pyx_tp_dealloc_4lxml_7builder_ElementMaker, /*tp_dealloc*/
4879 #if PY_VERSION_HEX < 0x030800b4
4882 #if PY_VERSION_HEX >= 0x030800b4
4883 0, /*tp_vectorcall_offset*/
4887 #if PY_MAJOR_VERSION < 3
4890 #if PY_MAJOR_VERSION >= 3
4895 0, /*tp_as_sequence*/
4896 0, /*tp_as_mapping*/
4898 __pyx_pw_4lxml_7builder_12ElementMaker_3__call__, /*tp_call*/
4900 __pyx_tp_getattro_4lxml_7builder_ElementMaker, /*tp_getattro*/
4903 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
4904 "Element generator factory.\n\n Unlike the ordinary Element factory, the E factory allows you to pass in\n more than just a tag and some optional attributes; you can also pass in\n text and other elements. The text is added as either text or tail\n attributes, and elements are inserted at the right spot. Some small\n examples::\n\n >>> from lxml import etree as ET\n >>> from lxml.builder import E\n\n >>> ET.tostring(E(\"tag\"))\n '<tag/>'\n >>> ET.tostring(E(\"tag\", \"text\"))\n '<tag>text</tag>'\n >>> ET.tostring(E(\"tag\", \"text\", key=\"value\"))\n '<tag key=\"value\">text</tag>'\n >>> ET.tostring(E(\"tag\", E(\"subtag\", \"text\"), \"tail\"))\n '<tag><subtag>text</subtag>tail</tag>'\n\n For simple tags, the factory also allows you to write ``E.tag(...)`` instead\n of ``E('tag', ...)``::\n\n >>> ET.tostring(E.tag())\n '<tag/>'\n >>> ET.tostring(E.tag(\"text\"))\n '<tag>text</tag>'\n >>> ET.tostring(E.tag(E.subtag(\"text\"), \"tail\"))\n '<tag><subtag>text</subtag>tail</tag>'\n\n Here's a somewhat larger example; this shows how to generate HTML\n documents, using a mix of prepared factory functions for inline elements,\n nested ``E.tag`` calls, and embedded XHTML fragments::\n\n # some common inline elements\n A = E.a\n I = E.i\n B = E.b\n\n def CLASS(v):\n # helper function, 'class' is a reserved word\n return {'class': v}\n\n page = (\n E.html(\n E.head(\n E.title(\"This is a sample document\")\n ),\n E.body(\n E.h1(\"Hello!\", CLASS(\"title\")),\n E.p(\"This is a paragraph with \", B(\"bold\"), \" text in it!\"),\n E.p(\"This is another paragraph, with a \",\n A(\"link\", href=\"http://www.python.org""\"), \".\"),\n E.p(\"Here are some reserved characters: <spam&egg>.\"),\n ET.XML(\"<p>And finally, here is an embedded XHTML fragment.</p>\"),\n )\n )\n )\n\n print ET.tostring(page)\n\n Here's a prettyprinted version of the output from the above script::\n\n <html>\n <head>\n <title>This is a sample document</title>\n </head>\n <body>\n <h1 class=\"title\">Hello!</h1>\n <p>This is a paragraph with <b>bold</b> text in it!</p>\n <p>This is another paragraph, with <a href=\"http://www.python.org\">link</a>.</p>\n <p>Here are some reserved characters: <spam&egg>.</p>\n <p>And finally, here is an embedded XHTML fragment.</p>\n </body>\n </html>\n\n For namespace support, you can pass a namespace map (``nsmap``)\n and/or a specific target ``namespace`` to the ElementMaker class::\n\n >>> E = ElementMaker(namespace=\"http://my.ns/\")\n >>> print(ET.tostring( E.test ))\n <test xmlns=\"http://my.ns/\"/>\n\n >>> E = ElementMaker(namespace=\"http://my.ns/\", nsmap={'p':'http://my.ns/'})\n >>> print(ET.tostring( E.test ))\n <p:test xmlns:p=\"http://my.ns/\"/>\n ", /*tp_doc*/
4905 __pyx_tp_traverse_4lxml_7builder_ElementMaker, /*tp_traverse*/
4906 __pyx_tp_clear_4lxml_7builder_ElementMaker, /*tp_clear*/
4907 0, /*tp_richcompare*/
4908 0, /*tp_weaklistoffset*/
4911 __pyx_methods_4lxml_7builder_ElementMaker, /*tp_methods*/
4913 __pyx_getsets_4lxml_7builder_ElementMaker, /*tp_getset*/
4918 0, /*tp_dictoffset*/
4919 __pyx_pw_4lxml_7builder_12ElementMaker_1__init__, /*tp_init*/
4921 __pyx_tp_new_4lxml_7builder_ElementMaker, /*tp_new*/
4927 0, /*tp_subclasses*/
4930 0, /*tp_version_tag*/
4931 #if PY_VERSION_HEX >= 0x030400a1
4934 #if PY_VERSION_HEX >= 0x030800b1
4935 0, /*tp_vectorcall*/
4937 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
4942 static struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *__pyx_freelist_4lxml_7builder___pyx_scope_struct____init__[8];
4943 static int __pyx_freecount_4lxml_7builder___pyx_scope_struct____init__ = 0;
4945 static PyObject *__pyx_tp_new_4lxml_7builder___pyx_scope_struct____init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4947 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__)))) {
4948 o = (PyObject*)__pyx_freelist_4lxml_7builder___pyx_scope_struct____init__[--__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__];
4949 memset(o, 0, sizeof(struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__));
4950 (void) PyObject_INIT(o, t);
4951 PyObject_GC_Track(o);
4953 o = (*t->tp_alloc)(t, 0);
4954 if (unlikely(!o)) return 0;
4959 static void __pyx_tp_dealloc_4lxml_7builder___pyx_scope_struct____init__(PyObject *o) {
4960 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *p = (struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)o;
4961 PyObject_GC_UnTrack(o);
4962 Py_CLEAR(p->__pyx_v_typemap);
4963 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__)))) {
4964 __pyx_freelist_4lxml_7builder___pyx_scope_struct____init__[__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__++] = ((struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)o);
4966 (*Py_TYPE(o)->tp_free)(o);
4970 static int __pyx_tp_traverse_4lxml_7builder___pyx_scope_struct____init__(PyObject *o, visitproc v, void *a) {
4972 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *p = (struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)o;
4973 if (p->__pyx_v_typemap) {
4974 e = (*v)(p->__pyx_v_typemap, a); if (e) return e;
4979 static int __pyx_tp_clear_4lxml_7builder___pyx_scope_struct____init__(PyObject *o) {
4980 struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *p = (struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__ *)o;
4981 Py_CLEAR(p->__pyx_v_typemap);
4985 static PyTypeObject __pyx_type_4lxml_7builder___pyx_scope_struct____init__ = {
4986 PyVarObject_HEAD_INIT(0, 0)
4987 "lxml.builder.__pyx_scope_struct____init__", /*tp_name*/
4988 sizeof(struct __pyx_obj_4lxml_7builder___pyx_scope_struct____init__), /*tp_basicsize*/
4990 __pyx_tp_dealloc_4lxml_7builder___pyx_scope_struct____init__, /*tp_dealloc*/
4991 #if PY_VERSION_HEX < 0x030800b4
4994 #if PY_VERSION_HEX >= 0x030800b4
4995 0, /*tp_vectorcall_offset*/
4999 #if PY_MAJOR_VERSION < 3
5002 #if PY_MAJOR_VERSION >= 3
5007 0, /*tp_as_sequence*/
5008 0, /*tp_as_mapping*/
5015 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
5017 __pyx_tp_traverse_4lxml_7builder___pyx_scope_struct____init__, /*tp_traverse*/
5018 __pyx_tp_clear_4lxml_7builder___pyx_scope_struct____init__, /*tp_clear*/
5019 0, /*tp_richcompare*/
5020 0, /*tp_weaklistoffset*/
5030 0, /*tp_dictoffset*/
5033 __pyx_tp_new_4lxml_7builder___pyx_scope_struct____init__, /*tp_new*/
5039 0, /*tp_subclasses*/
5042 0, /*tp_version_tag*/
5043 #if PY_VERSION_HEX >= 0x030400a1
5046 #if PY_VERSION_HEX >= 0x030800b1
5047 0, /*tp_vectorcall*/
5049 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
5054 static PyMethodDef __pyx_methods[] = {
5058 #if PY_MAJOR_VERSION >= 3
5059 #if CYTHON_PEP489_MULTI_PHASE_INIT
5060 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
5061 static int __pyx_pymod_exec_builder(PyObject* module); /*proto*/
5062 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
5063 {Py_mod_create, (void*)__pyx_pymod_create},
5064 {Py_mod_exec, (void*)__pyx_pymod_exec_builder},
5069 static struct PyModuleDef __pyx_moduledef = {
5070 PyModuleDef_HEAD_INIT,
5072 __pyx_k_The_E_Element_factory_for_gener, /* m_doc */
5073 #if CYTHON_PEP489_MULTI_PHASE_INIT
5078 __pyx_methods /* m_methods */,
5079 #if CYTHON_PEP489_MULTI_PHASE_INIT
5080 __pyx_moduledef_slots, /* m_slots */
5082 NULL, /* m_reload */
5084 NULL, /* m_traverse */
5086 (freefunc)__pyx_module_cleanup /* m_free */
5089 #ifndef CYTHON_SMALL_CODE
5090 #if defined(__clang__)
5091 #define CYTHON_SMALL_CODE
5092 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
5093 #define CYTHON_SMALL_CODE __attribute__((cold))
5095 #define CYTHON_SMALL_CODE
5099 static __Pyx_StringTabEntry __pyx_string_tab[] = {
5100 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
5101 {&__pyx_n_s_CDATA, __pyx_k_CDATA, sizeof(__pyx_k_CDATA), 0, 0, 1, 1},
5102 {&__pyx_kp_s_Can_t_add_a_CDATA_section_Elemen, __pyx_k_Can_t_add_a_CDATA_section_Elemen, sizeof(__pyx_k_Can_t_add_a_CDATA_section_Elemen), 0, 0, 1, 0},
5103 {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
5104 {&__pyx_n_s_ET, __pyx_k_ET, sizeof(__pyx_k_ET), 0, 0, 1, 1},
5105 {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
5106 {&__pyx_n_s_ElementMaker, __pyx_k_ElementMaker, sizeof(__pyx_k_ElementMaker), 0, 0, 1, 1},
5107 {&__pyx_n_s_ElementMaker___reduce_cython, __pyx_k_ElementMaker___reduce_cython, sizeof(__pyx_k_ElementMaker___reduce_cython), 0, 0, 1, 1},
5108 {&__pyx_n_s_ElementMaker___setstate_cython, __pyx_k_ElementMaker___setstate_cython, sizeof(__pyx_k_ElementMaker___setstate_cython), 0, 0, 1, 1},
5109 {&__pyx_kp_s_Incompatible_checksums_s_vs_0x9f, __pyx_k_Incompatible_checksums_s_vs_0x9f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x9f), 0, 0, 1, 0},
5110 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
5111 {&__pyx_n_s_NameError, __pyx_k_NameError, sizeof(__pyx_k_NameError), 0, 0, 1, 1},
5112 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
5113 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
5114 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
5115 {&__pyx_n_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1},
5116 {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
5117 {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
5118 {&__pyx_n_s_add_cdata, __pyx_k_add_cdata, sizeof(__pyx_k_add_cdata), 0, 0, 1, 1},
5119 {&__pyx_n_s_add_dict, __pyx_k_add_dict, sizeof(__pyx_k_add_dict), 0, 0, 1, 1},
5120 {&__pyx_n_s_add_text, __pyx_k_add_text, sizeof(__pyx_k_add_text), 0, 0, 1, 1},
5121 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
5122 {&__pyx_n_s_attrib, __pyx_k_attrib, sizeof(__pyx_k_attrib), 0, 0, 1, 1},
5123 {&__pyx_kp_s_bad_argument_type_s_r, __pyx_k_bad_argument_type_s_r, sizeof(__pyx_k_bad_argument_type_s_r), 0, 0, 1, 0},
5124 {&__pyx_n_s_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 0, 1, 1},
5125 {&__pyx_n_s_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 0, 1, 1},
5126 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
5127 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
5128 {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1},
5129 {&__pyx_n_s_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 0, 0, 1, 1},
5130 {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
5131 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
5132 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
5133 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
5134 {&__pyx_n_s_init___locals_add_cdata, __pyx_k_init___locals_add_cdata, sizeof(__pyx_k_init___locals_add_cdata), 0, 0, 1, 1},
5135 {&__pyx_n_s_init___locals_add_dict, __pyx_k_init___locals_add_dict, sizeof(__pyx_k_init___locals_add_dict), 0, 0, 1, 1},
5136 {&__pyx_n_s_init___locals_add_text, __pyx_k_init___locals_add_text, sizeof(__pyx_k_init___locals_add_text), 0, 0, 1, 1},
5137 {&__pyx_n_s_iselement, __pyx_k_iselement, sizeof(__pyx_k_iselement), 0, 0, 1, 1},
5138 {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1},
5139 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
5140 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
5141 {&__pyx_n_s_lxml_builder, __pyx_k_lxml_builder, sizeof(__pyx_k_lxml_builder), 0, 0, 1, 1},
5142 {&__pyx_n_s_lxml_etree, __pyx_k_lxml_etree, sizeof(__pyx_k_lxml_etree), 0, 0, 1, 1},
5143 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
5144 {&__pyx_n_s_makeelement, __pyx_k_makeelement, sizeof(__pyx_k_makeelement), 0, 0, 1, 1},
5145 {&__pyx_n_s_mro, __pyx_k_mro, sizeof(__pyx_k_mro), 0, 0, 1, 1},
5146 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
5147 {&__pyx_n_s_namespace, __pyx_k_namespace, sizeof(__pyx_k_namespace), 0, 0, 1, 1},
5148 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
5149 {&__pyx_n_s_nsmap, __pyx_k_nsmap, sizeof(__pyx_k_nsmap), 0, 0, 1, 1},
5150 {&__pyx_n_s_partial, __pyx_k_partial, sizeof(__pyx_k_partial), 0, 0, 1, 1},
5151 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
5152 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
5153 {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1},
5154 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
5155 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
5156 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
5157 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
5158 {&__pyx_n_s_pyx_unpickle_ElementMaker, __pyx_k_pyx_unpickle_ElementMaker, sizeof(__pyx_k_pyx_unpickle_ElementMaker), 0, 0, 1, 1},
5159 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
5160 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
5161 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
5162 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
5163 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
5164 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
5165 {&__pyx_kp_s_src_lxml_builder_py, __pyx_k_src_lxml_builder_py, sizeof(__pyx_k_src_lxml_builder_py), 0, 0, 1, 0},
5166 {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
5167 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
5168 {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
5169 {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
5170 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
5171 {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
5172 {&__pyx_n_s_typemap, __pyx_k_typemap, sizeof(__pyx_k_typemap), 0, 0, 1, 1},
5173 {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
5174 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
5175 {&__pyx_n_s_use_setstate, __pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 0, 1, 1},
5176 {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
5177 {0, 0, 0, 0, 0, 0, 0}
5179 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
5180 __pyx_builtin_NameError = __Pyx_GetBuiltinName(__pyx_n_s_NameError); if (!__pyx_builtin_NameError) __PYX_ERR(0, 50, __pyx_L1_error)
5181 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 176, __pyx_L1_error)
5182 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 181, __pyx_L1_error)
5183 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 226, __pyx_L1_error)
5189 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
5190 __Pyx_RefNannyDeclarations
5191 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
5193 /* "lxml/builder.py":173
5196 * def add_text(elem, item): # <<<<<<<<<<<<<<
5198 * elem[-1].tail = (elem[-1].tail or "") + item
5200 __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_elem, __pyx_n_s_item); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 173, __pyx_L1_error)
5201 __Pyx_GOTREF(__pyx_tuple__4);
5202 __Pyx_GIVEREF(__pyx_tuple__4);
5203 __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_builder_py, __pyx_n_s_add_text, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 173, __pyx_L1_error)
5205 /* "lxml/builder.py":179
5206 * elem.text = (elem.text or "") + item
5208 * def add_cdata(elem, cdata): # <<<<<<<<<<<<<<
5210 * raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
5212 __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_elem, __pyx_n_s_cdata); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 179, __pyx_L1_error)
5213 __Pyx_GOTREF(__pyx_tuple__6);
5214 __Pyx_GIVEREF(__pyx_tuple__6);
5215 __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_builder_py, __pyx_n_s_add_cdata, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 179, __pyx_L1_error)
5217 /* "lxml/builder.py":191
5218 * typemap[ET.CDATA] = add_cdata
5220 * def add_dict(elem, item): # <<<<<<<<<<<<<<
5221 * attrib = elem.attrib
5222 * for k, v in item.items():
5224 __pyx_tuple__8 = PyTuple_Pack(5, __pyx_n_s_elem, __pyx_n_s_item, __pyx_n_s_attrib, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 191, __pyx_L1_error)
5225 __Pyx_GOTREF(__pyx_tuple__8);
5226 __Pyx_GIVEREF(__pyx_tuple__8);
5227 __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_builder_py, __pyx_n_s_add_dict, 191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 191, __pyx_L1_error)
5229 /* "(tree fragment)":1
5230 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5234 __pyx_tuple__11 = 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__11)) __PYX_ERR(1, 1, __pyx_L1_error)
5235 __Pyx_GOTREF(__pyx_tuple__11);
5236 __Pyx_GIVEREF(__pyx_tuple__11);
5237 __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(1, 1, __pyx_L1_error)
5239 /* "(tree fragment)":16
5241 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
5242 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5243 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state)
5245 __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 16, __pyx_L1_error)
5246 __Pyx_GOTREF(__pyx_tuple__13);
5247 __Pyx_GIVEREF(__pyx_tuple__13);
5248 __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(1, 16, __pyx_L1_error)
5250 /* "(tree fragment)":1
5251 * def __pyx_unpickle_ElementMaker(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
5252 * cdef object __pyx_PickleError
5253 * cdef object __pyx_result
5255 __pyx_tuple__15 = 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__15)) __PYX_ERR(1, 1, __pyx_L1_error)
5256 __Pyx_GOTREF(__pyx_tuple__15);
5257 __Pyx_GIVEREF(__pyx_tuple__15);
5258 __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ElementMaker, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(1, 1, __pyx_L1_error)
5259 __Pyx_RefNannyFinishContext();
5262 __Pyx_RefNannyFinishContext();
5266 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
5267 __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
5268 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5269 __pyx_int_167522209 = PyInt_FromLong(167522209L); if (unlikely(!__pyx_int_167522209)) __PYX_ERR(0, 1, __pyx_L1_error)
5275 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
5276 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
5277 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
5278 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
5279 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
5280 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
5281 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
5283 static int __Pyx_modinit_global_init_code(void) {
5284 __Pyx_RefNannyDeclarations
5285 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
5286 /*--- Global init code ---*/
5287 __pyx_v_4lxml_7builder_ET = Py_None; Py_INCREF(Py_None);
5288 __pyx_v_4lxml_7builder_partial = Py_None; Py_INCREF(Py_None);
5289 __Pyx_RefNannyFinishContext();
5293 static int __Pyx_modinit_variable_export_code(void) {
5294 __Pyx_RefNannyDeclarations
5295 int __pyx_lineno = 0;
5296 const char *__pyx_filename = NULL;
5297 int __pyx_clineno = 0;
5298 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
5299 /*--- Variable export code ---*/
5300 if (__Pyx_ExportVoidPtr(__pyx_n_s_ET, (void *)&__pyx_v_4lxml_7builder_ET, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5301 if (__Pyx_ExportVoidPtr(__pyx_n_s_partial, (void *)&__pyx_v_4lxml_7builder_partial, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5302 __Pyx_RefNannyFinishContext();
5305 __Pyx_RefNannyFinishContext();
5309 static int __Pyx_modinit_function_export_code(void) {
5310 __Pyx_RefNannyDeclarations
5311 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
5312 /*--- Function export code ---*/
5313 __Pyx_RefNannyFinishContext();
5317 static int __Pyx_modinit_type_init_code(void) {
5318 __Pyx_RefNannyDeclarations
5319 int __pyx_lineno = 0;
5320 const char *__pyx_filename = NULL;
5321 int __pyx_clineno = 0;
5322 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
5323 /*--- Type init code ---*/
5324 if (PyType_Ready(&__pyx_type_4lxml_7builder_ElementMaker) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
5325 #if PY_VERSION_HEX < 0x030800B1
5326 __pyx_type_4lxml_7builder_ElementMaker.tp_print = 0;
5328 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ElementMaker, (PyObject *)&__pyx_type_4lxml_7builder_ElementMaker) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
5329 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4lxml_7builder_ElementMaker) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
5330 __pyx_ptype_4lxml_7builder_ElementMaker = &__pyx_type_4lxml_7builder_ElementMaker;
5331 if (PyType_Ready(&__pyx_type_4lxml_7builder___pyx_scope_struct____init__) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
5332 #if PY_VERSION_HEX < 0x030800B1
5333 __pyx_type_4lxml_7builder___pyx_scope_struct____init__.tp_print = 0;
5335 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_7builder___pyx_scope_struct____init__.tp_dictoffset && __pyx_type_4lxml_7builder___pyx_scope_struct____init__.tp_getattro == PyObject_GenericGetAttr)) {
5336 __pyx_type_4lxml_7builder___pyx_scope_struct____init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
5338 __pyx_ptype_4lxml_7builder___pyx_scope_struct____init__ = &__pyx_type_4lxml_7builder___pyx_scope_struct____init__;
5339 __Pyx_RefNannyFinishContext();
5342 __Pyx_RefNannyFinishContext();
5346 static int __Pyx_modinit_type_import_code(void) {
5347 __Pyx_RefNannyDeclarations
5348 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
5349 /*--- Type import code ---*/
5350 __Pyx_RefNannyFinishContext();
5354 static int __Pyx_modinit_variable_import_code(void) {
5355 __Pyx_RefNannyDeclarations
5356 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
5357 /*--- Variable import code ---*/
5358 __Pyx_RefNannyFinishContext();
5362 static int __Pyx_modinit_function_import_code(void) {
5363 __Pyx_RefNannyDeclarations
5364 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
5365 /*--- Function import code ---*/
5366 __Pyx_RefNannyFinishContext();
5371 #ifndef CYTHON_NO_PYINIT_EXPORT
5372 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
5373 #elif PY_MAJOR_VERSION < 3
5375 #define __Pyx_PyMODINIT_FUNC extern "C" void
5377 #define __Pyx_PyMODINIT_FUNC void
5381 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
5383 #define __Pyx_PyMODINIT_FUNC PyObject *
5388 #if PY_MAJOR_VERSION < 3
5389 __Pyx_PyMODINIT_FUNC initbuilder(void) CYTHON_SMALL_CODE; /*proto*/
5390 __Pyx_PyMODINIT_FUNC initbuilder(void)
5392 __Pyx_PyMODINIT_FUNC PyInit_builder(void) CYTHON_SMALL_CODE; /*proto*/
5393 __Pyx_PyMODINIT_FUNC PyInit_builder(void)
5394 #if CYTHON_PEP489_MULTI_PHASE_INIT
5396 return PyModuleDef_Init(&__pyx_moduledef);
5398 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
5399 #if PY_VERSION_HEX >= 0x030700A1
5400 static PY_INT64_T main_interpreter_id = -1;
5401 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
5402 if (main_interpreter_id == -1) {
5403 main_interpreter_id = current_id;
5404 return (unlikely(current_id == -1)) ? -1 : 0;
5405 } else if (unlikely(main_interpreter_id != current_id))
5407 static PyInterpreterState *main_interpreter = NULL;
5408 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
5409 if (!main_interpreter) {
5410 main_interpreter = current_interpreter;
5411 } else if (unlikely(main_interpreter != current_interpreter))
5416 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
5421 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) {
5422 PyObject *value = PyObject_GetAttrString(spec, from_name);
5424 if (likely(value)) {
5425 if (allow_none || value != Py_None) {
5426 result = PyDict_SetItemString(moddict, to_name, value);
5429 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
5436 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
5437 PyObject *module = NULL, *moddict, *modname;
5438 if (__Pyx_check_single_interpreter())
5441 return __Pyx_NewRef(__pyx_m);
5442 modname = PyObject_GetAttrString(spec, "name");
5443 if (unlikely(!modname)) goto bad;
5444 module = PyModule_NewObject(modname);
5446 if (unlikely(!module)) goto bad;
5447 moddict = PyModule_GetDict(module);
5448 if (unlikely(!moddict)) goto bad;
5449 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
5450 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
5451 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
5452 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
5460 static CYTHON_SMALL_CODE int __pyx_pymod_exec_builder(PyObject *__pyx_pyinit_module)
5464 PyObject *__pyx_t_1 = NULL;
5465 PyObject *__pyx_t_2 = NULL;
5466 PyObject *__pyx_t_3 = NULL;
5467 PyObject *__pyx_t_4 = NULL;
5468 PyObject *__pyx_t_5 = NULL;
5470 PyObject *__pyx_t_7 = NULL;
5471 int __pyx_lineno = 0;
5472 const char *__pyx_filename = NULL;
5473 int __pyx_clineno = 0;
5474 __Pyx_RefNannyDeclarations
5475 #if CYTHON_PEP489_MULTI_PHASE_INIT
5477 if (__pyx_m == __pyx_pyinit_module) return 0;
5478 PyErr_SetString(PyExc_RuntimeError, "Module 'builder' has already been imported. Re-initialisation is not supported.");
5481 #elif PY_MAJOR_VERSION >= 3
5482 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
5485 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
5486 if (!__Pyx_RefNanny) {
5488 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
5489 if (!__Pyx_RefNanny)
5490 Py_FatalError("failed to import 'refnanny' module");
5493 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_builder(void)", 0);
5494 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5495 #ifdef __Pxy_PyFrame_Initialize_Offsets
5496 __Pxy_PyFrame_Initialize_Offsets();
5498 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
5499 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
5500 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
5501 #ifdef __Pyx_CyFunction_USED
5502 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5504 #ifdef __Pyx_FusedFunction_USED
5505 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5507 #ifdef __Pyx_Coroutine_USED
5508 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5510 #ifdef __Pyx_Generator_USED
5511 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5513 #ifdef __Pyx_AsyncGen_USED
5514 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5516 #ifdef __Pyx_StopAsyncIteration_USED
5517 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5519 /*--- Library function declarations ---*/
5520 /*--- Threads initialization code ---*/
5521 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
5522 #ifdef WITH_THREAD /* Python build with threading support? */
5523 PyEval_InitThreads();
5526 /*--- Module creation code ---*/
5527 #if CYTHON_PEP489_MULTI_PHASE_INIT
5528 __pyx_m = __pyx_pyinit_module;
5531 #if PY_MAJOR_VERSION < 3
5532 __pyx_m = Py_InitModule4("builder", __pyx_methods, __pyx_k_The_E_Element_factory_for_gener, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
5534 __pyx_m = PyModule_Create(&__pyx_moduledef);
5536 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
5538 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
5540 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
5542 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
5543 Py_INCREF(__pyx_cython_runtime);
5544 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5545 /*--- Initialize various global constants etc. ---*/
5546 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5547 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
5548 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5550 if (__pyx_module_is_main_lxml__builder) {
5551 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5553 #if PY_MAJOR_VERSION >= 3
5555 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
5556 if (!PyDict_GetItemString(modules, "lxml.builder")) {
5557 if (unlikely(PyDict_SetItemString(modules, "lxml.builder", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5561 /*--- Builtin init code ---*/
5562 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5563 /*--- Constants init code ---*/
5564 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5565 /*--- Global type/function init code ---*/
5566 (void)__Pyx_modinit_global_init_code();
5567 if (unlikely(__Pyx_modinit_variable_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5568 (void)__Pyx_modinit_function_export_code();
5569 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5570 (void)__Pyx_modinit_type_import_code();
5571 (void)__Pyx_modinit_variable_import_code();
5572 (void)__Pyx_modinit_function_import_code();
5573 /*--- Execution code ---*/
5574 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
5575 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5578 /* "lxml/builder.py":44
5579 * from __future__ import absolute_import
5581 * import lxml.etree as ET # <<<<<<<<<<<<<<
5583 * from functools import partial
5585 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
5586 __Pyx_GOTREF(__pyx_t_1);
5587 __Pyx_INCREF(__pyx_n_s__10);
5588 __Pyx_GIVEREF(__pyx_n_s__10);
5589 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__10);
5590 __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml_etree, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
5591 __Pyx_GOTREF(__pyx_t_2);
5592 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5593 __Pyx_XGOTREF(__pyx_v_4lxml_7builder_ET);
5594 __Pyx_DECREF_SET(__pyx_v_4lxml_7builder_ET, __pyx_t_2);
5595 __Pyx_GIVEREF(__pyx_t_2);
5598 /* "lxml/builder.py":46
5599 * import lxml.etree as ET
5601 * from functools import partial # <<<<<<<<<<<<<<
5605 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
5606 __Pyx_GOTREF(__pyx_t_2);
5607 __Pyx_INCREF(__pyx_n_s_partial);
5608 __Pyx_GIVEREF(__pyx_n_s_partial);
5609 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_partial);
5610 __pyx_t_1 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
5611 __Pyx_GOTREF(__pyx_t_1);
5612 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5613 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_partial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
5614 __Pyx_GOTREF(__pyx_t_2);
5615 __Pyx_INCREF(__pyx_t_2);
5616 __Pyx_XGOTREF(__pyx_v_4lxml_7builder_partial);
5617 __Pyx_DECREF_SET(__pyx_v_4lxml_7builder_partial, __pyx_t_2);
5618 __Pyx_GIVEREF(__pyx_t_2);
5619 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5620 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5622 /* "lxml/builder.py":48
5623 * from functools import partial
5625 * try: # <<<<<<<<<<<<<<
5630 __Pyx_PyThreadState_declare
5631 __Pyx_PyThreadState_assign
5632 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
5633 __Pyx_XGOTREF(__pyx_t_3);
5634 __Pyx_XGOTREF(__pyx_t_4);
5635 __Pyx_XGOTREF(__pyx_t_5);
5638 /* "lxml/builder.py":49
5641 * basestring # <<<<<<<<<<<<<<
5645 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L2_error)
5646 __Pyx_GOTREF(__pyx_t_1);
5647 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5649 /* "lxml/builder.py":48
5650 * from functools import partial
5652 * try: # <<<<<<<<<<<<<<
5657 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5658 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5659 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5660 goto __pyx_L7_try_end;
5662 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5663 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5665 /* "lxml/builder.py":50
5668 * except NameError: # <<<<<<<<<<<<<<
5672 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NameError);
5674 __Pyx_AddTraceback("lxml.builder", __pyx_clineno, __pyx_lineno, __pyx_filename);
5675 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(0, 50, __pyx_L4_except_error)
5676 __Pyx_GOTREF(__pyx_t_1);
5677 __Pyx_GOTREF(__pyx_t_2);
5678 __Pyx_GOTREF(__pyx_t_7);
5680 /* "lxml/builder.py":51
5683 * basestring = str # <<<<<<<<<<<<<<
5687 if (PyDict_SetItem(__pyx_d, __pyx_n_s_basestring, ((PyObject *)(&PyString_Type))) < 0) __PYX_ERR(0, 51, __pyx_L4_except_error)
5688 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5689 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5690 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5691 goto __pyx_L3_exception_handled;
5693 goto __pyx_L4_except_error;
5694 __pyx_L4_except_error:;
5696 /* "lxml/builder.py":48
5697 * from functools import partial
5699 * try: # <<<<<<<<<<<<<<
5703 __Pyx_XGIVEREF(__pyx_t_3);
5704 __Pyx_XGIVEREF(__pyx_t_4);
5705 __Pyx_XGIVEREF(__pyx_t_5);
5706 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5707 goto __pyx_L1_error;
5708 __pyx_L3_exception_handled:;
5709 __Pyx_XGIVEREF(__pyx_t_3);
5710 __Pyx_XGIVEREF(__pyx_t_4);
5711 __Pyx_XGIVEREF(__pyx_t_5);
5712 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
5716 /* "lxml/builder.py":53
5719 * try: # <<<<<<<<<<<<<<
5724 __Pyx_PyThreadState_declare
5725 __Pyx_PyThreadState_assign
5726 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
5727 __Pyx_XGOTREF(__pyx_t_5);
5728 __Pyx_XGOTREF(__pyx_t_4);
5729 __Pyx_XGOTREF(__pyx_t_3);
5732 /* "lxml/builder.py":54
5735 * unicode # <<<<<<<<<<<<<<
5739 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L10_error)
5740 __Pyx_GOTREF(__pyx_t_7);
5741 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5743 /* "lxml/builder.py":53
5746 * try: # <<<<<<<<<<<<<<
5751 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5752 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5753 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5754 goto __pyx_L15_try_end;
5756 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5757 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5758 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5760 /* "lxml/builder.py":55
5763 * except NameError: # <<<<<<<<<<<<<<
5767 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NameError);
5769 __Pyx_AddTraceback("lxml.builder", __pyx_clineno, __pyx_lineno, __pyx_filename);
5770 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L12_except_error)
5771 __Pyx_GOTREF(__pyx_t_7);
5772 __Pyx_GOTREF(__pyx_t_2);
5773 __Pyx_GOTREF(__pyx_t_1);
5775 /* "lxml/builder.py":56
5778 * unicode = str # <<<<<<<<<<<<<<
5782 if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, ((PyObject *)(&PyString_Type))) < 0) __PYX_ERR(0, 56, __pyx_L12_except_error)
5783 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5784 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5785 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5786 goto __pyx_L11_exception_handled;
5788 goto __pyx_L12_except_error;
5789 __pyx_L12_except_error:;
5791 /* "lxml/builder.py":53
5794 * try: # <<<<<<<<<<<<<<
5798 __Pyx_XGIVEREF(__pyx_t_5);
5799 __Pyx_XGIVEREF(__pyx_t_4);
5800 __Pyx_XGIVEREF(__pyx_t_3);
5801 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
5802 goto __pyx_L1_error;
5803 __pyx_L11_exception_handled:;
5804 __Pyx_XGIVEREF(__pyx_t_5);
5805 __Pyx_XGIVEREF(__pyx_t_4);
5806 __Pyx_XGIVEREF(__pyx_t_3);
5807 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
5811 /* "(tree fragment)":1
5812 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5816 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_12ElementMaker_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementMaker___reduce_cython, NULL, __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
5817 __Pyx_GOTREF(__pyx_t_1);
5818 if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_7builder_ElementMaker->tp_dict, __pyx_n_s_reduce_cython, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
5819 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5820 PyType_Modified(__pyx_ptype_4lxml_7builder_ElementMaker);
5822 /* "(tree fragment)":16
5824 * return __pyx_unpickle_ElementMaker, (type(self), 0x9fc2fa1, state)
5825 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5826 * __pyx_unpickle_ElementMaker__set_state(self, __pyx_state)
5828 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_12ElementMaker_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ElementMaker___setstate_cython, NULL, __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error)
5829 __Pyx_GOTREF(__pyx_t_1);
5830 if (PyDict_SetItem((PyObject *)__pyx_ptype_4lxml_7builder_ElementMaker->tp_dict, __pyx_n_s_setstate_cython, __pyx_t_1) < 0) __PYX_ERR(1, 16, __pyx_L1_error)
5831 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5832 PyType_Modified(__pyx_ptype_4lxml_7builder_ElementMaker);
5834 /* "lxml/builder.py":239
5836 * # create factory object
5837 * E = ElementMaker() # <<<<<<<<<<<<<<
5839 __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4lxml_7builder_ElementMaker)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
5840 __Pyx_GOTREF(__pyx_t_1);
5841 if (PyDict_SetItem(__pyx_d, __pyx_n_s_E, __pyx_t_1) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
5842 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5844 /* "(tree fragment)":1
5845 * def __pyx_unpickle_ElementMaker(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
5846 * cdef object __pyx_PickleError
5847 * cdef object __pyx_result
5849 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_7builder_1__pyx_unpickle_ElementMaker, 0, __pyx_n_s_pyx_unpickle_ElementMaker, NULL, __pyx_n_s_lxml_builder, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
5850 __Pyx_GOTREF(__pyx_t_1);
5851 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ElementMaker, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
5852 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5854 /* "lxml/builder.py":1
5855 * # cython: language_level=2 # <<<<<<<<<<<<<<
5859 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5860 __Pyx_GOTREF(__pyx_t_1);
5861 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5864 /*--- Wrapped vars code ---*/
5866 if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
5869 __Pyx_XDECREF(__pyx_t_1);
5870 __Pyx_XDECREF(__pyx_t_2);
5871 __Pyx_XDECREF(__pyx_t_7);
5874 __Pyx_AddTraceback("init lxml.builder", __pyx_clineno, __pyx_lineno, __pyx_filename);
5877 } else if (!PyErr_Occurred()) {
5878 PyErr_SetString(PyExc_ImportError, "init lxml.builder");
5881 __Pyx_RefNannyFinishContext();
5882 #if CYTHON_PEP489_MULTI_PHASE_INIT
5883 return (__pyx_m != NULL) ? 0 : -1;
5884 #elif PY_MAJOR_VERSION >= 3
5891 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
5892 Py_CLEAR(__pyx_tuple__4);
5893 Py_CLEAR(__pyx_codeobj__5);
5894 Py_CLEAR(__pyx_tuple__6);
5895 Py_CLEAR(__pyx_codeobj__7);
5896 Py_CLEAR(__pyx_tuple__8);
5897 Py_CLEAR(__pyx_codeobj__9);
5898 Py_CLEAR(__pyx_tuple__11);
5899 Py_CLEAR(__pyx_codeobj__12);
5900 Py_CLEAR(__pyx_tuple__13);
5901 Py_CLEAR(__pyx_codeobj__14);
5902 Py_CLEAR(__pyx_tuple__15);
5903 Py_CLEAR(__pyx_codeobj__16);
5904 /* CodeObjectCache.cleanup */
5905 if (__pyx_code_cache.entries) {
5906 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5907 int i, count = __pyx_code_cache.count;
5908 __pyx_code_cache.count = 0;
5909 __pyx_code_cache.max_count = 0;
5910 __pyx_code_cache.entries = NULL;
5911 for (i=0; i<count; i++) {
5912 Py_DECREF(entries[i].code_object);
5914 PyMem_Free(entries);
5917 Py_CLEAR(__pyx_umethod_PyDict_Type_get.method);
5919 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
5920 /*--- Global cleanup code ---*/
5921 Py_CLEAR(__pyx_v_4lxml_7builder_partial);
5922 Py_CLEAR(__pyx_v_4lxml_7builder_ET);
5923 __Pyx_CleanupGlobals();
5924 /*--- Type import cleanup code ---*/
5925 /*--- Builtin cleanup code ---*/
5926 Py_CLEAR(__pyx_builtin_NameError);
5927 Py_CLEAR(__pyx_builtin_IndexError);
5928 Py_CLEAR(__pyx_builtin_ValueError);
5929 Py_CLEAR(__pyx_builtin_TypeError);
5930 /*--- Intern cleanup code ---*/
5931 Py_CLEAR(__pyx_empty_tuple);
5932 while (__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__ > 0) {
5933 PyObject* o = (PyObject*)__pyx_freelist_4lxml_7builder___pyx_scope_struct____init__[--__pyx_freecount_4lxml_7builder___pyx_scope_struct____init__];
5934 (*Py_TYPE(o)->tp_free)(o);
5937 Py_CLEAR(__pyx_cython_runtime);
5941 /* --- Runtime support code --- */
5944 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5945 PyObject *m = NULL, *p = NULL;
5947 m = PyImport_ImportModule(modname);
5949 p = PyObject_GetAttrString(m, "RefNannyAPI");
5951 r = PyLong_AsVoidPtr(p);
5955 return (__Pyx_RefNannyAPIStruct *)r;
5959 /* PyObjectGetAttrStr */
5960 #if CYTHON_USE_TYPE_SLOTS
5961 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
5962 PyTypeObject* tp = Py_TYPE(obj);
5963 if (likely(tp->tp_getattro))
5964 return tp->tp_getattro(obj, attr_name);
5965 #if PY_MAJOR_VERSION < 3
5966 if (likely(tp->tp_getattr))
5967 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
5969 return PyObject_GetAttr(obj, attr_name);
5973 /* GetBuiltinName */
5974 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5975 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5976 if (unlikely(!result)) {
5977 PyErr_Format(PyExc_NameError,
5978 #if PY_MAJOR_VERSION >= 3
5979 "name '%U' is not defined", name);
5981 "name '%.200s' is not defined", PyString_AS_STRING(name));
5987 /* RaiseDoubleKeywords */
5988 static void __Pyx_RaiseDoubleKeywordsError(
5989 const char* func_name,
5992 PyErr_Format(PyExc_TypeError,
5993 #if PY_MAJOR_VERSION >= 3
5994 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5996 "%s() got multiple values for keyword argument '%s'", func_name,
5997 PyString_AsString(kw_name));
6002 static int __Pyx_ParseOptionalKeywords(
6004 PyObject **argnames[],
6007 Py_ssize_t num_pos_args,
6008 const char* function_name)
6010 PyObject *key = 0, *value = 0;
6013 PyObject*** first_kw_arg = argnames + num_pos_args;
6014 while (PyDict_Next(kwds, &pos, &key, &value)) {
6015 name = first_kw_arg;
6016 while (*name && (**name != key)) name++;
6018 values[name-argnames] = value;
6021 name = first_kw_arg;
6022 #if PY_MAJOR_VERSION < 3
6023 if (likely(PyString_Check(key))) {
6025 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
6026 && _PyString_Eq(**name, key)) {
6027 values[name-argnames] = value;
6032 if (*name) continue;
6034 PyObject*** argname = argnames;
6035 while (argname != first_kw_arg) {
6036 if ((**argname == key) || (
6037 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
6038 && _PyString_Eq(**argname, key))) {
6039 goto arg_passed_twice;
6046 if (likely(PyUnicode_Check(key))) {
6048 int cmp = (**name == key) ? 0 :
6049 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6050 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6052 PyUnicode_Compare(**name, key);
6053 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6055 values[name-argnames] = value;
6060 if (*name) continue;
6062 PyObject*** argname = argnames;
6063 while (argname != first_kw_arg) {
6064 int cmp = (**argname == key) ? 0 :
6065 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6066 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6068 PyUnicode_Compare(**argname, key);
6069 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6070 if (cmp == 0) goto arg_passed_twice;
6075 goto invalid_keyword_type;
6077 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
6079 goto invalid_keyword;
6084 __Pyx_RaiseDoubleKeywordsError(function_name, key);
6086 invalid_keyword_type:
6087 PyErr_Format(PyExc_TypeError,
6088 "%.200s() keywords must be strings", function_name);
6091 PyErr_Format(PyExc_TypeError,
6092 #if PY_MAJOR_VERSION < 3
6093 "%.200s() got an unexpected keyword argument '%.200s'",
6094 function_name, PyString_AsString(key));
6096 "%s() got an unexpected keyword argument '%U'",
6097 function_name, key);
6103 /* RaiseArgTupleInvalid */
6104 static void __Pyx_RaiseArgtupleInvalid(
6105 const char* func_name,
6109 Py_ssize_t num_found)
6111 Py_ssize_t num_expected;
6112 const char *more_or_less;
6113 if (num_found < num_min) {
6114 num_expected = num_min;
6115 more_or_less = "at least";
6117 num_expected = num_max;
6118 more_or_less = "at most";
6121 more_or_less = "exactly";
6123 PyErr_Format(PyExc_TypeError,
6124 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6125 func_name, more_or_less, num_expected,
6126 (num_expected == 1) ? "" : "s", num_found);
6130 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
6132 if (!j) return NULL;
6133 r = PyObject_GetItem(o, j);
6137 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
6138 CYTHON_NCP_UNUSED int wraparound,
6139 CYTHON_NCP_UNUSED int boundscheck) {
6140 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6141 Py_ssize_t wrapped_i = i;
6142 if (wraparound & unlikely(i < 0)) {
6143 wrapped_i += PyList_GET_SIZE(o);
6145 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
6146 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
6150 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6152 return PySequence_GetItem(o, i);
6155 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
6156 CYTHON_NCP_UNUSED int wraparound,
6157 CYTHON_NCP_UNUSED int boundscheck) {
6158 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6159 Py_ssize_t wrapped_i = i;
6160 if (wraparound & unlikely(i < 0)) {
6161 wrapped_i += PyTuple_GET_SIZE(o);
6163 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
6164 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
6168 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6170 return PySequence_GetItem(o, i);
6173 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
6174 CYTHON_NCP_UNUSED int wraparound,
6175 CYTHON_NCP_UNUSED int boundscheck) {
6176 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
6177 if (is_list || PyList_CheckExact(o)) {
6178 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
6179 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
6180 PyObject *r = PyList_GET_ITEM(o, n);
6185 else if (PyTuple_CheckExact(o)) {
6186 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
6187 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
6188 PyObject *r = PyTuple_GET_ITEM(o, n);
6193 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
6194 if (likely(m && m->sq_item)) {
6195 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
6196 Py_ssize_t l = m->sq_length(o);
6197 if (likely(l >= 0)) {
6200 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
6205 return m->sq_item(o, i);
6209 if (is_list || PySequence_Check(o)) {
6210 return PySequence_GetItem(o, i);
6213 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
6216 /* PyObjectSetAttrStr */
6217 #if CYTHON_USE_TYPE_SLOTS
6218 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
6219 PyTypeObject* tp = Py_TYPE(obj);
6220 if (likely(tp->tp_setattro))
6221 return tp->tp_setattro(obj, attr_name, value);
6222 #if PY_MAJOR_VERSION < 3
6223 if (likely(tp->tp_setattr))
6224 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
6226 return PyObject_SetAttr(obj, attr_name, value);
6230 /* GetTopmostException */
6231 #if CYTHON_USE_EXC_INFO_STACK
6232 static _PyErr_StackItem *
6233 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
6235 _PyErr_StackItem *exc_info = tstate->exc_info;
6236 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
6237 exc_info->previous_item != NULL)
6239 exc_info = exc_info->previous_item;
6245 /* SaveResetException */
6246 #if CYTHON_FAST_THREAD_STATE
6247 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6248 #if CYTHON_USE_EXC_INFO_STACK
6249 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
6250 *type = exc_info->exc_type;
6251 *value = exc_info->exc_value;
6252 *tb = exc_info->exc_traceback;
6254 *type = tstate->exc_type;
6255 *value = tstate->exc_value;
6256 *tb = tstate->exc_traceback;
6262 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6263 PyObject *tmp_type, *tmp_value, *tmp_tb;
6264 #if CYTHON_USE_EXC_INFO_STACK
6265 _PyErr_StackItem *exc_info = tstate->exc_info;
6266 tmp_type = exc_info->exc_type;
6267 tmp_value = exc_info->exc_value;
6268 tmp_tb = exc_info->exc_traceback;
6269 exc_info->exc_type = type;
6270 exc_info->exc_value = value;
6271 exc_info->exc_traceback = tb;
6273 tmp_type = tstate->exc_type;
6274 tmp_value = tstate->exc_value;
6275 tmp_tb = tstate->exc_traceback;
6276 tstate->exc_type = type;
6277 tstate->exc_value = value;
6278 tstate->exc_traceback = tb;
6280 Py_XDECREF(tmp_type);
6281 Py_XDECREF(tmp_value);
6286 /* PyErrExceptionMatches */
6287 #if CYTHON_FAST_THREAD_STATE
6288 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6290 n = PyTuple_GET_SIZE(tuple);
6291 #if PY_MAJOR_VERSION >= 3
6292 for (i=0; i<n; i++) {
6293 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6296 for (i=0; i<n; i++) {
6297 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
6301 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
6302 PyObject *exc_type = tstate->curexc_type;
6303 if (exc_type == err) return 1;
6304 if (unlikely(!exc_type)) return 0;
6305 if (unlikely(PyTuple_Check(err)))
6306 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
6307 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
6312 #if CYTHON_FAST_THREAD_STATE
6313 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
6315 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
6318 PyObject *local_type, *local_value, *local_tb;
6319 #if CYTHON_FAST_THREAD_STATE
6320 PyObject *tmp_type, *tmp_value, *tmp_tb;
6321 local_type = tstate->curexc_type;
6322 local_value = tstate->curexc_value;
6323 local_tb = tstate->curexc_traceback;
6324 tstate->curexc_type = 0;
6325 tstate->curexc_value = 0;
6326 tstate->curexc_traceback = 0;
6328 PyErr_Fetch(&local_type, &local_value, &local_tb);
6330 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
6331 #if CYTHON_FAST_THREAD_STATE
6332 if (unlikely(tstate->curexc_type))
6334 if (unlikely(PyErr_Occurred()))
6337 #if PY_MAJOR_VERSION >= 3
6339 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
6343 Py_XINCREF(local_tb);
6344 Py_XINCREF(local_type);
6345 Py_XINCREF(local_value);
6347 *value = local_value;
6349 #if CYTHON_FAST_THREAD_STATE
6350 #if CYTHON_USE_EXC_INFO_STACK
6352 _PyErr_StackItem *exc_info = tstate->exc_info;
6353 tmp_type = exc_info->exc_type;
6354 tmp_value = exc_info->exc_value;
6355 tmp_tb = exc_info->exc_traceback;
6356 exc_info->exc_type = local_type;
6357 exc_info->exc_value = local_value;
6358 exc_info->exc_traceback = local_tb;
6361 tmp_type = tstate->exc_type;
6362 tmp_value = tstate->exc_value;
6363 tmp_tb = tstate->exc_traceback;
6364 tstate->exc_type = local_type;
6365 tstate->exc_value = local_value;
6366 tstate->exc_traceback = local_tb;
6368 Py_XDECREF(tmp_type);
6369 Py_XDECREF(tmp_value);
6372 PyErr_SetExcInfo(local_type, local_value, local_tb);
6379 Py_XDECREF(local_type);
6380 Py_XDECREF(local_value);
6381 Py_XDECREF(local_tb);
6385 /* PyCFunctionFastCall */
6386 #if CYTHON_FAST_PYCCALL
6387 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6388 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6389 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6390 PyObject *self = PyCFunction_GET_SELF(func);
6391 int flags = PyCFunction_GET_FLAGS(func);
6392 assert(PyCFunction_Check(func));
6393 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
6395 assert(nargs == 0 || args != NULL);
6396 /* _PyCFunction_FastCallDict() must not be called with an exception set,
6397 because it may clear it (directly or indirectly) and so the
6398 caller loses its exception */
6399 assert(!PyErr_Occurred());
6400 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
6401 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
6403 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
6408 /* PyFunctionFastCall */
6409 #if CYTHON_FAST_PYCALL
6410 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6411 PyObject *globals) {
6413 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6414 PyObject **fastlocals;
6417 assert(globals != NULL);
6418 /* XXX Perhaps we should create a specialized
6419 PyFrame_New() that doesn't take locals, but does
6420 take builtins without sanity checking them.
6422 assert(tstate != NULL);
6423 f = PyFrame_New(tstate, co, globals, NULL);
6427 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
6428 for (i = 0; i < na; i++) {
6430 fastlocals[i] = *args++;
6432 result = PyEval_EvalFrameEx(f,0);
6433 ++tstate->recursion_depth;
6435 --tstate->recursion_depth;
6438 #if 1 || PY_VERSION_HEX < 0x030600B1
6439 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
6440 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6441 PyObject *globals = PyFunction_GET_GLOBALS(func);
6442 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6444 #if PY_MAJOR_VERSION >= 3
6447 PyObject *kwtuple, **k;
6452 assert(kwargs == NULL || PyDict_Check(kwargs));
6453 nk = kwargs ? PyDict_Size(kwargs) : 0;
6454 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6458 #if PY_MAJOR_VERSION >= 3
6459 co->co_kwonlyargcount == 0 &&
6461 likely(kwargs == NULL || nk == 0) &&
6462 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6463 if (argdefs == NULL && co->co_argcount == nargs) {
6464 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6467 else if (nargs == 0 && argdefs != NULL
6468 && co->co_argcount == Py_SIZE(argdefs)) {
6469 /* function called with no arguments, but all parameters have
6470 a default value: use default values as arguments .*/
6471 args = &PyTuple_GET_ITEM(argdefs, 0);
6472 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6476 if (kwargs != NULL) {
6478 kwtuple = PyTuple_New(2 * nk);
6479 if (kwtuple == NULL) {
6483 k = &PyTuple_GET_ITEM(kwtuple, 0);
6485 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6496 closure = PyFunction_GET_CLOSURE(func);
6497 #if PY_MAJOR_VERSION >= 3
6498 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6500 if (argdefs != NULL) {
6501 d = &PyTuple_GET_ITEM(argdefs, 0);
6502 nd = Py_SIZE(argdefs);
6508 #if PY_MAJOR_VERSION >= 3
6509 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6512 d, (int)nd, kwdefs, closure);
6514 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6517 d, (int)nd, closure);
6519 Py_XDECREF(kwtuple);
6521 Py_LeaveRecursiveCall();
6528 #if CYTHON_COMPILING_IN_CPYTHON
6529 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6531 ternaryfunc call = func->ob_type->tp_call;
6532 if (unlikely(!call))
6533 return PyObject_Call(func, arg, kw);
6534 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6536 result = (*call)(func, arg, kw);
6537 Py_LeaveRecursiveCall();
6538 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6541 "NULL result without error in PyObject_Call");
6547 /* PyObjectCallMethO */
6548 #if CYTHON_COMPILING_IN_CPYTHON
6549 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6550 PyObject *self, *result;
6552 cfunc = PyCFunction_GET_FUNCTION(func);
6553 self = PyCFunction_GET_SELF(func);
6554 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6556 result = cfunc(self, arg);
6557 Py_LeaveRecursiveCall();
6558 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6561 "NULL result without error in PyObject_Call");
6567 /* PyObjectCallOneArg */
6568 #if CYTHON_COMPILING_IN_CPYTHON
6569 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6571 PyObject *args = PyTuple_New(1);
6572 if (unlikely(!args)) return NULL;
6574 PyTuple_SET_ITEM(args, 0, arg);
6575 result = __Pyx_PyObject_Call(func, args, NULL);
6579 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6580 #if CYTHON_FAST_PYCALL
6581 if (PyFunction_Check(func)) {
6582 return __Pyx_PyFunction_FastCall(func, &arg, 1);
6585 if (likely(PyCFunction_Check(func))) {
6586 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6587 return __Pyx_PyObject_CallMethO(func, arg);
6588 #if CYTHON_FAST_PYCCALL
6589 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
6590 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6594 return __Pyx__PyObject_CallOneArg(func, arg);
6597 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6599 PyObject *args = PyTuple_Pack(1, arg);
6600 if (unlikely(!args)) return NULL;
6601 result = __Pyx_PyObject_Call(func, args, NULL);
6607 /* PyErrFetchRestore */
6608 #if CYTHON_FAST_THREAD_STATE
6609 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6610 PyObject *tmp_type, *tmp_value, *tmp_tb;
6611 tmp_type = tstate->curexc_type;
6612 tmp_value = tstate->curexc_value;
6613 tmp_tb = tstate->curexc_traceback;
6614 tstate->curexc_type = type;
6615 tstate->curexc_value = value;
6616 tstate->curexc_traceback = tb;
6617 Py_XDECREF(tmp_type);
6618 Py_XDECREF(tmp_value);
6621 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6622 *type = tstate->curexc_type;
6623 *value = tstate->curexc_value;
6624 *tb = tstate->curexc_traceback;
6625 tstate->curexc_type = 0;
6626 tstate->curexc_value = 0;
6627 tstate->curexc_traceback = 0;
6631 /* RaiseException */
6632 #if PY_MAJOR_VERSION < 3
6633 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6634 CYTHON_UNUSED PyObject *cause) {
6635 __Pyx_PyThreadState_declare
6637 if (!value || value == Py_None)
6641 if (!tb || tb == Py_None)
6645 if (!PyTraceBack_Check(tb)) {
6646 PyErr_SetString(PyExc_TypeError,
6647 "raise: arg 3 must be a traceback or None");
6651 if (PyType_Check(type)) {
6652 #if CYTHON_COMPILING_IN_PYPY
6658 PyErr_NormalizeException(&type, &value, &tb);
6661 PyErr_SetString(PyExc_TypeError,
6662 "instance exception may not have a separate value");
6666 type = (PyObject*) Py_TYPE(type);
6668 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6669 PyErr_SetString(PyExc_TypeError,
6670 "raise: exception class must be a subclass of BaseException");
6674 __Pyx_PyThreadState_assign
6675 __Pyx_ErrRestore(type, value, tb);
6684 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6685 PyObject* owned_instance = NULL;
6686 if (tb == Py_None) {
6688 } else if (tb && !PyTraceBack_Check(tb)) {
6689 PyErr_SetString(PyExc_TypeError,
6690 "raise: arg 3 must be a traceback or None");
6693 if (value == Py_None)
6695 if (PyExceptionInstance_Check(type)) {
6697 PyErr_SetString(PyExc_TypeError,
6698 "instance exception may not have a separate value");
6702 type = (PyObject*) Py_TYPE(value);
6703 } else if (PyExceptionClass_Check(type)) {
6704 PyObject *instance_class = NULL;
6705 if (value && PyExceptionInstance_Check(value)) {
6706 instance_class = (PyObject*) Py_TYPE(value);
6707 if (instance_class != type) {
6708 int is_subclass = PyObject_IsSubclass(instance_class, type);
6710 instance_class = NULL;
6711 } else if (unlikely(is_subclass == -1)) {
6714 type = instance_class;
6718 if (!instance_class) {
6721 args = PyTuple_New(0);
6722 else if (PyTuple_Check(value)) {
6726 args = PyTuple_Pack(1, value);
6729 owned_instance = PyObject_Call(type, args, NULL);
6731 if (!owned_instance)
6733 value = owned_instance;
6734 if (!PyExceptionInstance_Check(value)) {
6735 PyErr_Format(PyExc_TypeError,
6736 "calling %R should have returned an instance of "
6737 "BaseException, not %R",
6738 type, Py_TYPE(value));
6743 PyErr_SetString(PyExc_TypeError,
6744 "raise: exception class must be a subclass of BaseException");
6748 PyObject *fixed_cause;
6749 if (cause == Py_None) {
6751 } else if (PyExceptionClass_Check(cause)) {
6752 fixed_cause = PyObject_CallObject(cause, NULL);
6753 if (fixed_cause == NULL)
6755 } else if (PyExceptionInstance_Check(cause)) {
6756 fixed_cause = cause;
6757 Py_INCREF(fixed_cause);
6759 PyErr_SetString(PyExc_TypeError,
6760 "exception causes must derive from "
6764 PyException_SetCause(value, fixed_cause);
6766 PyErr_SetObject(type, value);
6768 #if CYTHON_COMPILING_IN_PYPY
6769 PyObject *tmp_type, *tmp_value, *tmp_tb;
6770 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6772 PyErr_Restore(tmp_type, tmp_value, tb);
6775 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6776 PyObject* tmp_tb = tstate->curexc_traceback;
6779 tstate->curexc_traceback = tb;
6785 Py_XDECREF(owned_instance);
6790 /* PyObjectCallNoArg */
6791 #if CYTHON_COMPILING_IN_CPYTHON
6792 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
6793 #if CYTHON_FAST_PYCALL
6794 if (PyFunction_Check(func)) {
6795 return __Pyx_PyFunction_FastCall(func, NULL, 0);
6798 #ifdef __Pyx_CyFunction_USED
6799 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
6801 if (likely(PyCFunction_Check(func)))
6804 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
6805 return __Pyx_PyObject_CallMethO(func, NULL);
6808 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
6812 /* RaiseTooManyValuesToUnpack */
6813 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
6814 PyErr_Format(PyExc_ValueError,
6815 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
6818 /* RaiseNeedMoreValuesToUnpack */
6819 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
6820 PyErr_Format(PyExc_ValueError,
6821 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
6822 index, (index == 1) ? "" : "s");
6826 static CYTHON_INLINE int __Pyx_IterFinish(void) {
6827 #if CYTHON_FAST_THREAD_STATE
6828 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6829 PyObject* exc_type = tstate->curexc_type;
6830 if (unlikely(exc_type)) {
6831 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
6832 PyObject *exc_value, *exc_tb;
6833 exc_value = tstate->curexc_value;
6834 exc_tb = tstate->curexc_traceback;
6835 tstate->curexc_type = 0;
6836 tstate->curexc_value = 0;
6837 tstate->curexc_traceback = 0;
6838 Py_DECREF(exc_type);
6839 Py_XDECREF(exc_value);
6848 if (unlikely(PyErr_Occurred())) {
6849 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
6860 /* UnpackItemEndCheck */
6861 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
6862 if (unlikely(retval)) {
6864 __Pyx_RaiseTooManyValuesError(expected);
6867 return __Pyx_IterFinish();
6872 /* PyDictVersioning */
6873 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
6874 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
6875 PyObject *dict = Py_TYPE(obj)->tp_dict;
6876 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
6878 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
6879 PyObject **dictptr = NULL;
6880 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
6882 #if CYTHON_COMPILING_IN_CPYTHON
6883 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
6885 dictptr = _PyObject_GetDictPtr(obj);
6888 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
6890 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
6891 PyObject *dict = Py_TYPE(obj)->tp_dict;
6892 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
6894 return obj_dict_version == __Pyx_get_object_dict_version(obj);
6898 /* GetModuleGlobalName */
6899 #if CYTHON_USE_DICT_VERSIONS
6900 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
6902 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
6906 #if !CYTHON_AVOID_BORROWED_REFS
6907 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
6908 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
6909 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6910 if (likely(result)) {
6911 return __Pyx_NewRef(result);
6912 } else if (unlikely(PyErr_Occurred())) {
6916 result = PyDict_GetItem(__pyx_d, name);
6917 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6918 if (likely(result)) {
6919 return __Pyx_NewRef(result);
6923 result = PyObject_GetItem(__pyx_d, name);
6924 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
6925 if (likely(result)) {
6926 return __Pyx_NewRef(result);
6930 return __Pyx_GetBuiltinName(name);
6934 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
6935 PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
6939 #if CYTHON_USE_TYPE_SLOTS
6940 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
6942 Py_ssize_t key_value;
6943 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
6944 if (unlikely(!(m && m->sq_item))) {
6945 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
6948 key_value = __Pyx_PyIndex_AsSsize_t(index);
6949 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
6950 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
6952 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
6954 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
6958 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
6959 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
6960 if (likely(m && m->mp_subscript)) {
6961 return m->mp_subscript(obj, key);
6963 return __Pyx_PyObject_GetIndex(obj, key);
6967 /* FetchCommonType */
6968 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
6969 PyObject* fake_module;
6970 PyTypeObject* cached_type = NULL;
6971 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
6972 if (!fake_module) return NULL;
6973 Py_INCREF(fake_module);
6974 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
6976 if (!PyType_Check((PyObject*)cached_type)) {
6977 PyErr_Format(PyExc_TypeError,
6978 "Shared Cython type %.200s is not a type object",
6982 if (cached_type->tp_basicsize != type->tp_basicsize) {
6983 PyErr_Format(PyExc_TypeError,
6984 "Shared Cython type %.200s has the wrong size, try recompiling",
6989 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
6991 if (PyType_Ready(type) < 0) goto bad;
6992 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
6998 Py_DECREF(fake_module);
7001 Py_XDECREF(cached_type);
7006 /* CythonFunctionShared */
7007 #include <structmember.h>
7009 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
7011 if (unlikely(op->func_doc == NULL)) {
7012 if (op->func.m_ml->ml_doc) {
7013 #if PY_MAJOR_VERSION >= 3
7014 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
7016 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
7018 if (unlikely(op->func_doc == NULL))
7025 Py_INCREF(op->func_doc);
7026 return op->func_doc;
7029 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
7031 PyObject *tmp = op->func_doc;
7032 if (value == NULL) {
7036 op->func_doc = value;
7041 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7043 if (unlikely(op->func_name == NULL)) {
7044 #if PY_MAJOR_VERSION >= 3
7045 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
7047 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
7049 if (unlikely(op->func_name == NULL))
7052 Py_INCREF(op->func_name);
7053 return op->func_name;
7056 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
7059 #if PY_MAJOR_VERSION >= 3
7060 if (unlikely(value == NULL || !PyUnicode_Check(value)))
7062 if (unlikely(value == NULL || !PyString_Check(value)))
7065 PyErr_SetString(PyExc_TypeError,
7066 "__name__ must be set to a string object");
7069 tmp = op->func_name;
7071 op->func_name = value;
7076 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7078 Py_INCREF(op->func_qualname);
7079 return op->func_qualname;
7082 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
7085 #if PY_MAJOR_VERSION >= 3
7086 if (unlikely(value == NULL || !PyUnicode_Check(value)))
7088 if (unlikely(value == NULL || !PyString_Check(value)))
7091 PyErr_SetString(PyExc_TypeError,
7092 "__qualname__ must be set to a string object");
7095 tmp = op->func_qualname;
7097 op->func_qualname = value;
7102 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
7105 self = m->func_closure;
7112 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7114 if (unlikely(op->func_dict == NULL)) {
7115 op->func_dict = PyDict_New();
7116 if (unlikely(op->func_dict == NULL))
7119 Py_INCREF(op->func_dict);
7120 return op->func_dict;
7123 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
7126 if (unlikely(value == NULL)) {
7127 PyErr_SetString(PyExc_TypeError,
7128 "function's dictionary may not be deleted");
7131 if (unlikely(!PyDict_Check(value))) {
7132 PyErr_SetString(PyExc_TypeError,
7133 "setting function's dictionary to a non-dict");
7136 tmp = op->func_dict;
7138 op->func_dict = value;
7143 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7145 Py_INCREF(op->func_globals);
7146 return op->func_globals;
7149 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7155 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
7157 PyObject* result = (op->func_code) ? op->func_code : Py_None;
7162 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
7164 PyObject *res = op->defaults_getter((PyObject *) op);
7167 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7168 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
7169 Py_INCREF(op->defaults_tuple);
7170 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
7171 Py_INCREF(op->defaults_kwdict);
7173 op->defaults_tuple = PySequence_ITEM(res, 0);
7174 if (unlikely(!op->defaults_tuple)) result = -1;
7176 op->defaults_kwdict = PySequence_ITEM(res, 1);
7177 if (unlikely(!op->defaults_kwdict)) result = -1;
7184 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
7188 } else if (value != Py_None && !PyTuple_Check(value)) {
7189 PyErr_SetString(PyExc_TypeError,
7190 "__defaults__ must be set to a tuple object");
7194 tmp = op->defaults_tuple;
7195 op->defaults_tuple = value;
7200 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
7201 PyObject* result = op->defaults_tuple;
7202 if (unlikely(!result)) {
7203 if (op->defaults_getter) {
7204 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
7205 result = op->defaults_tuple;
7214 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
7218 } else if (value != Py_None && !PyDict_Check(value)) {
7219 PyErr_SetString(PyExc_TypeError,
7220 "__kwdefaults__ must be set to a dict object");
7224 tmp = op->defaults_kwdict;
7225 op->defaults_kwdict = value;
7230 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
7231 PyObject* result = op->defaults_kwdict;
7232 if (unlikely(!result)) {
7233 if (op->defaults_getter) {
7234 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
7235 result = op->defaults_kwdict;
7244 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
7246 if (!value || value == Py_None) {
7248 } else if (!PyDict_Check(value)) {
7249 PyErr_SetString(PyExc_TypeError,
7250 "__annotations__ must be set to a dict object");
7254 tmp = op->func_annotations;
7255 op->func_annotations = value;
7260 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
7261 PyObject* result = op->func_annotations;
7262 if (unlikely(!result)) {
7263 result = PyDict_New();
7264 if (unlikely(!result)) return NULL;
7265 op->func_annotations = result;
7270 static PyGetSetDef __pyx_CyFunction_getsets[] = {
7271 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
7272 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
7273 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
7274 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
7275 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
7276 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
7277 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
7278 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
7279 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
7280 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
7281 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
7282 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
7283 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
7284 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
7285 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
7286 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
7287 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
7288 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
7291 static PyMemberDef __pyx_CyFunction_members[] = {
7292 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
7296 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
7298 #if PY_MAJOR_VERSION >= 3
7299 return PyUnicode_FromString(m->func.m_ml->ml_name);
7301 return PyString_FromString(m->func.m_ml->ml_name);
7304 static PyMethodDef __pyx_CyFunction_methods[] = {
7305 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
7308 #if PY_VERSION_HEX < 0x030500A0
7309 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
7311 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
7313 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
7314 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
7315 if (unlikely(op == NULL))
7318 __Pyx_CyFunction_weakreflist(op) = NULL;
7320 op->func.m_self = (PyObject *) op;
7321 Py_XINCREF(closure);
7322 op->func_closure = closure;
7324 op->func.m_module = module;
7325 op->func_dict = NULL;
7326 op->func_name = NULL;
7327 Py_INCREF(qualname);
7328 op->func_qualname = qualname;
7329 op->func_doc = NULL;
7330 op->func_classobj = NULL;
7331 op->func_globals = globals;
7332 Py_INCREF(op->func_globals);
7334 op->func_code = code;
7335 op->defaults_pyobjects = 0;
7336 op->defaults_size = 0;
7337 op->defaults = NULL;
7338 op->defaults_tuple = NULL;
7339 op->defaults_kwdict = NULL;
7340 op->defaults_getter = NULL;
7341 op->func_annotations = NULL;
7342 return (PyObject *) op;
7345 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
7347 Py_CLEAR(m->func_closure);
7348 Py_CLEAR(m->func.m_module);
7349 Py_CLEAR(m->func_dict);
7350 Py_CLEAR(m->func_name);
7351 Py_CLEAR(m->func_qualname);
7352 Py_CLEAR(m->func_doc);
7353 Py_CLEAR(m->func_globals);
7354 Py_CLEAR(m->func_code);
7355 Py_CLEAR(m->func_classobj);
7356 Py_CLEAR(m->defaults_tuple);
7357 Py_CLEAR(m->defaults_kwdict);
7358 Py_CLEAR(m->func_annotations);
7360 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
7362 for (i = 0; i < m->defaults_pyobjects; i++)
7363 Py_XDECREF(pydefaults[i]);
7364 PyObject_Free(m->defaults);
7369 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
7371 if (__Pyx_CyFunction_weakreflist(m) != NULL)
7372 PyObject_ClearWeakRefs((PyObject *) m);
7373 __Pyx_CyFunction_clear(m);
7376 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
7378 PyObject_GC_UnTrack(m);
7379 __Pyx__CyFunction_dealloc(m);
7381 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
7383 Py_VISIT(m->func_closure);
7384 Py_VISIT(m->func.m_module);
7385 Py_VISIT(m->func_dict);
7386 Py_VISIT(m->func_name);
7387 Py_VISIT(m->func_qualname);
7388 Py_VISIT(m->func_doc);
7389 Py_VISIT(m->func_globals);
7390 Py_VISIT(m->func_code);
7391 Py_VISIT(m->func_classobj);
7392 Py_VISIT(m->defaults_tuple);
7393 Py_VISIT(m->defaults_kwdict);
7395 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
7397 for (i = 0; i < m->defaults_pyobjects; i++)
7398 Py_VISIT(pydefaults[i]);
7402 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
7404 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7405 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
7409 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
7411 type = (PyObject *)(Py_TYPE(obj));
7412 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
7416 return __Pyx_PyMethod_New(func, obj, type);
7419 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
7421 #if PY_MAJOR_VERSION >= 3
7422 return PyUnicode_FromFormat("<cyfunction %U at %p>",
7423 op->func_qualname, (void *)op);
7425 return PyString_FromFormat("<cyfunction %s at %p>",
7426 PyString_AsString(op->func_qualname), (void *)op);
7429 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
7430 PyCFunctionObject* f = (PyCFunctionObject*)func;
7431 PyCFunction meth = f->m_ml->ml_meth;
7433 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
7435 if (likely(kw == NULL || PyDict_Size(kw) == 0))
7436 return (*meth)(self, arg);
7438 case METH_VARARGS | METH_KEYWORDS:
7439 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
7441 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
7442 size = PyTuple_GET_SIZE(arg);
7443 if (likely(size == 0))
7444 return (*meth)(self, NULL);
7445 PyErr_Format(PyExc_TypeError,
7446 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
7447 f->m_ml->ml_name, size);
7452 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
7453 size = PyTuple_GET_SIZE(arg);
7454 if (likely(size == 1)) {
7455 PyObject *result, *arg0;
7456 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7457 arg0 = PyTuple_GET_ITEM(arg, 0);
7459 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
7461 result = (*meth)(self, arg0);
7462 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
7467 PyErr_Format(PyExc_TypeError,
7468 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
7469 f->m_ml->ml_name, size);
7474 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
7475 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
7476 "longer supported!");
7479 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
7483 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
7484 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
7486 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
7488 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
7489 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
7493 argc = PyTuple_GET_SIZE(args);
7494 new_args = PyTuple_GetSlice(args, 1, argc);
7495 if (unlikely(!new_args))
7497 self = PyTuple_GetItem(args, 0);
7498 if (unlikely(!self)) {
7499 Py_DECREF(new_args);
7502 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
7503 Py_DECREF(new_args);
7505 result = __Pyx_CyFunction_Call(func, args, kw);
7509 static PyTypeObject __pyx_CyFunctionType_type = {
7510 PyVarObject_HEAD_INIT(0, 0)
7511 "cython_function_or_method",
7512 sizeof(__pyx_CyFunctionObject),
7514 (destructor) __Pyx_CyFunction_dealloc,
7518 #if PY_MAJOR_VERSION < 3
7523 (reprfunc) __Pyx_CyFunction_repr,
7528 __Pyx_CyFunction_CallAsMethod,
7533 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
7535 (traverseproc) __Pyx_CyFunction_traverse,
7536 (inquiry) __Pyx_CyFunction_clear,
7538 #if PY_VERSION_HEX < 0x030500A0
7539 offsetof(__pyx_CyFunctionObject, func_weakreflist),
7541 offsetof(PyCFunctionObject, m_weakreflist),
7545 __pyx_CyFunction_methods,
7546 __pyx_CyFunction_members,
7547 __pyx_CyFunction_getsets,
7550 __Pyx_CyFunction_descr_get,
7552 offsetof(__pyx_CyFunctionObject, func_dict),
7565 #if PY_VERSION_HEX >= 0x030400a1
7568 #if PY_VERSION_HEX >= 0x030800b1
7571 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
7575 static int __pyx_CyFunction_init(void) {
7576 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
7577 if (unlikely(__pyx_CyFunctionType == NULL)) {
7582 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
7583 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7584 m->defaults = PyObject_Malloc(size);
7585 if (unlikely(!m->defaults))
7586 return PyErr_NoMemory();
7587 memset(m->defaults, 0, size);
7588 m->defaults_pyobjects = pyobjects;
7589 m->defaults_size = size;
7592 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
7593 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7594 m->defaults_tuple = tuple;
7597 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
7598 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7599 m->defaults_kwdict = dict;
7602 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
7603 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7604 m->func_annotations = dict;
7608 /* CythonFunction */
7609 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
7610 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
7611 PyObject *op = __Pyx_CyFunction_Init(
7612 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
7613 ml, flags, qualname, closure, module, globals, code
7616 PyObject_GC_Track(op);
7622 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
7623 #if CYTHON_COMPILING_IN_PYPY
7624 return PyObject_RichCompareBool(s1, s2, equals);
7627 return (equals == Py_EQ);
7628 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
7629 const char *ps1, *ps2;
7630 Py_ssize_t length = PyBytes_GET_SIZE(s1);
7631 if (length != PyBytes_GET_SIZE(s2))
7632 return (equals == Py_NE);
7633 ps1 = PyBytes_AS_STRING(s1);
7634 ps2 = PyBytes_AS_STRING(s2);
7635 if (ps1[0] != ps2[0]) {
7636 return (equals == Py_NE);
7637 } else if (length == 1) {
7638 return (equals == Py_EQ);
7641 #if CYTHON_USE_UNICODE_INTERNALS
7642 Py_hash_t hash1, hash2;
7643 hash1 = ((PyBytesObject*)s1)->ob_shash;
7644 hash2 = ((PyBytesObject*)s2)->ob_shash;
7645 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
7646 return (equals == Py_NE);
7649 result = memcmp(ps1, ps2, (size_t)length);
7650 return (equals == Py_EQ) ? (result == 0) : (result != 0);
7652 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
7653 return (equals == Py_NE);
7654 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
7655 return (equals == Py_NE);
7658 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
7661 result = __Pyx_PyObject_IsTrue(py_result);
7662 Py_DECREF(py_result);
7669 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
7670 #if CYTHON_COMPILING_IN_PYPY
7671 return PyObject_RichCompareBool(s1, s2, equals);
7673 #if PY_MAJOR_VERSION < 3
7674 PyObject* owned_ref = NULL;
7676 int s1_is_unicode, s2_is_unicode;
7680 s1_is_unicode = PyUnicode_CheckExact(s1);
7681 s2_is_unicode = PyUnicode_CheckExact(s2);
7682 #if PY_MAJOR_VERSION < 3
7683 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
7684 owned_ref = PyUnicode_FromObject(s2);
7685 if (unlikely(!owned_ref))
7689 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
7690 owned_ref = PyUnicode_FromObject(s1);
7691 if (unlikely(!owned_ref))
7695 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
7696 return __Pyx_PyBytes_Equals(s1, s2, equals);
7699 if (s1_is_unicode & s2_is_unicode) {
7702 void *data1, *data2;
7703 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
7705 length = __Pyx_PyUnicode_GET_LENGTH(s1);
7706 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
7709 #if CYTHON_USE_UNICODE_INTERNALS
7711 Py_hash_t hash1, hash2;
7712 #if CYTHON_PEP393_ENABLED
7713 hash1 = ((PyASCIIObject*)s1)->hash;
7714 hash2 = ((PyASCIIObject*)s2)->hash;
7716 hash1 = ((PyUnicodeObject*)s1)->hash;
7717 hash2 = ((PyUnicodeObject*)s2)->hash;
7719 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
7724 kind = __Pyx_PyUnicode_KIND(s1);
7725 if (kind != __Pyx_PyUnicode_KIND(s2)) {
7728 data1 = __Pyx_PyUnicode_DATA(s1);
7729 data2 = __Pyx_PyUnicode_DATA(s2);
7730 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
7732 } else if (length == 1) {
7735 int result = memcmp(data1, data2, (size_t)(length * kind));
7736 #if PY_MAJOR_VERSION < 3
7737 Py_XDECREF(owned_ref);
7739 return (equals == Py_EQ) ? (result == 0) : (result != 0);
7741 } else if ((s1 == Py_None) & s2_is_unicode) {
7743 } else if ((s2 == Py_None) & s1_is_unicode) {
7747 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
7748 #if PY_MAJOR_VERSION < 3
7749 Py_XDECREF(owned_ref);
7753 result = __Pyx_PyObject_IsTrue(py_result);
7754 Py_DECREF(py_result);
7758 #if PY_MAJOR_VERSION < 3
7759 Py_XDECREF(owned_ref);
7761 return (equals == Py_EQ);
7763 #if PY_MAJOR_VERSION < 3
7764 Py_XDECREF(owned_ref);
7766 return (equals == Py_NE);
7771 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
7772 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
7774 value = PyDict_GetItemWithError(d, key);
7775 if (unlikely(!value)) {
7776 if (!PyErr_Occurred()) {
7777 if (unlikely(PyTuple_Check(key))) {
7778 PyObject* args = PyTuple_Pack(1, key);
7780 PyErr_SetObject(PyExc_KeyError, args);
7784 PyErr_SetObject(PyExc_KeyError, key);
7794 /* UnpackUnboundCMethod */
7795 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
7797 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
7798 if (unlikely(!method))
7800 target->method = method;
7801 #if CYTHON_COMPILING_IN_CPYTHON
7802 #if PY_MAJOR_VERSION >= 3
7803 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
7806 PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
7807 target->func = descr->d_method->ml_meth;
7808 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
7814 /* CallUnboundCMethod1 */
7815 #if CYTHON_COMPILING_IN_CPYTHON
7816 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
7817 if (likely(cfunc->func)) {
7818 int flag = cfunc->flag;
7819 if (flag == METH_O) {
7820 return (*(cfunc->func))(self, arg);
7821 } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
7822 if (PY_VERSION_HEX >= 0x030700A0) {
7823 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
7825 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
7827 } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
7828 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
7831 return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
7834 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
7835 PyObject *args, *result = NULL;
7836 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
7837 #if CYTHON_COMPILING_IN_CPYTHON
7838 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
7839 args = PyTuple_New(1);
7840 if (unlikely(!args)) goto bad;
7842 PyTuple_SET_ITEM(args, 0, arg);
7843 if (cfunc->flag & METH_KEYWORDS)
7844 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
7846 result = (*cfunc->func)(self, args);
7848 args = PyTuple_New(2);
7849 if (unlikely(!args)) goto bad;
7851 PyTuple_SET_ITEM(args, 0, self);
7853 PyTuple_SET_ITEM(args, 1, arg);
7854 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7857 args = PyTuple_Pack(2, self, arg);
7858 if (unlikely(!args)) goto bad;
7859 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7866 /* CallUnboundCMethod2 */
7867 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
7868 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
7869 if (likely(cfunc->func)) {
7870 PyObject *args[2] = {arg1, arg2};
7871 if (cfunc->flag == METH_FASTCALL) {
7872 #if PY_VERSION_HEX >= 0x030700A0
7873 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
7875 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
7878 #if PY_VERSION_HEX >= 0x030700A0
7879 if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
7880 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
7883 return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
7886 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
7887 PyObject *args, *result = NULL;
7888 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
7889 #if CYTHON_COMPILING_IN_CPYTHON
7890 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
7891 args = PyTuple_New(2);
7892 if (unlikely(!args)) goto bad;
7894 PyTuple_SET_ITEM(args, 0, arg1);
7896 PyTuple_SET_ITEM(args, 1, arg2);
7897 if (cfunc->flag & METH_KEYWORDS)
7898 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
7900 result = (*cfunc->func)(self, args);
7902 args = PyTuple_New(3);
7903 if (unlikely(!args)) goto bad;
7905 PyTuple_SET_ITEM(args, 0, self);
7907 PyTuple_SET_ITEM(args, 1, arg1);
7909 PyTuple_SET_ITEM(args, 2, arg2);
7910 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7913 args = PyTuple_Pack(3, self, arg1, arg2);
7914 if (unlikely(!args)) goto bad;
7915 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7922 /* dict_getitem_default */
7923 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
7925 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
7926 value = PyDict_GetItemWithError(d, key);
7927 if (unlikely(!value)) {
7928 if (unlikely(PyErr_Occurred()))
7930 value = default_value;
7935 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
7936 value = PyDict_GetItem(d, key);
7937 if (unlikely(!value)) {
7938 value = default_value;
7944 if (default_value == Py_None)
7945 value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
7947 value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
7952 /* PyObjectCall2Args */
7953 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
7954 PyObject *args, *result = NULL;
7955 #if CYTHON_FAST_PYCALL
7956 if (PyFunction_Check(function)) {
7957 PyObject *args[2] = {arg1, arg2};
7958 return __Pyx_PyFunction_FastCall(function, args, 2);
7961 #if CYTHON_FAST_PYCCALL
7962 if (__Pyx_PyFastCFunction_Check(function)) {
7963 PyObject *args[2] = {arg1, arg2};
7964 return __Pyx_PyCFunction_FastCall(function, args, 2);
7967 args = PyTuple_New(2);
7968 if (unlikely(!args)) goto done;
7970 PyTuple_SET_ITEM(args, 0, arg1);
7972 PyTuple_SET_ITEM(args, 1, arg2);
7973 Py_INCREF(function);
7974 result = __Pyx_PyObject_Call(function, args, NULL);
7976 Py_DECREF(function);
7981 /* PyObjectGetMethod */
7982 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
7984 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
7985 PyTypeObject *tp = Py_TYPE(obj);
7987 descrgetfunc f = NULL;
7988 PyObject **dictptr, *dict;
7990 assert (*method == NULL);
7991 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
7992 attr = __Pyx_PyObject_GetAttrStr(obj, name);
7995 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
7998 descr = _PyType_Lookup(tp, name);
7999 if (likely(descr != NULL)) {
8001 #if PY_MAJOR_VERSION >= 3
8002 #ifdef __Pyx_CyFunction_USED
8003 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
8005 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
8008 #ifdef __Pyx_CyFunction_USED
8009 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
8011 if (likely(PyFunction_Check(descr)))
8017 f = Py_TYPE(descr)->tp_descr_get;
8018 if (f != NULL && PyDescr_IsData(descr)) {
8019 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
8025 dictptr = _PyObject_GetDictPtr(obj);
8026 if (dictptr != NULL && (dict = *dictptr) != NULL) {
8028 attr = __Pyx_PyDict_GetItemStr(dict, name);
8042 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
8046 if (descr != NULL) {
8050 PyErr_Format(PyExc_AttributeError,
8051 #if PY_MAJOR_VERSION >= 3
8052 "'%.50s' object has no attribute '%U'",
8055 "'%.50s' object has no attribute '%.400s'",
8056 tp->tp_name, PyString_AS_STRING(name));
8060 attr = __Pyx_PyObject_GetAttrStr(obj, name);
8064 #if CYTHON_UNPACK_METHODS
8065 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
8066 PyObject *function = PyMethod_GET_FUNCTION(attr);
8067 Py_INCREF(function);
8077 /* PyObjectCallMethod1 */
8078 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
8079 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
8083 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
8084 PyObject *method = NULL, *result;
8085 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
8086 if (likely(is_method)) {
8087 result = __Pyx_PyObject_Call2Args(method, obj, arg);
8091 if (unlikely(!method)) return NULL;
8092 return __Pyx__PyObject_CallMethod1(method, arg);
8096 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
8097 if (likely(PyList_CheckExact(L))) {
8098 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
8100 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
8101 if (unlikely(!retval))
8109 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
8110 #if CYTHON_USE_TYPE_SLOTS
8111 #if PY_MAJOR_VERSION >= 3
8112 if (likely(PyUnicode_Check(n)))
8114 if (likely(PyString_Check(n)))
8116 return __Pyx_PyObject_GetAttrStr(o, n);
8118 return PyObject_GetAttr(o, n);
8122 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
8123 __Pyx_PyThreadState_declare
8124 __Pyx_PyThreadState_assign
8125 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
8127 __Pyx_PyErr_Clear();
8131 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
8132 PyObject *r = __Pyx_GetAttr(o, n);
8133 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
8137 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
8138 PyObject *empty_list = 0;
8139 PyObject *module = 0;
8140 PyObject *global_dict = 0;
8141 PyObject *empty_dict = 0;
8143 #if PY_MAJOR_VERSION < 3
8144 PyObject *py_import;
8145 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
8152 empty_list = PyList_New(0);
8157 global_dict = PyModule_GetDict(__pyx_m);
8160 empty_dict = PyDict_New();
8164 #if PY_MAJOR_VERSION >= 3
8166 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
8167 module = PyImport_ImportModuleLevelObject(
8168 name, global_dict, empty_dict, list, 1);
8170 if (!PyErr_ExceptionMatches(PyExc_ImportError))
8179 #if PY_MAJOR_VERSION < 3
8180 PyObject *py_level = PyInt_FromLong(level);
8183 module = PyObject_CallFunctionObjArgs(py_import,
8184 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
8185 Py_DECREF(py_level);
8187 module = PyImport_ImportModuleLevelObject(
8188 name, global_dict, empty_dict, list, level);
8193 #if PY_MAJOR_VERSION < 3
8194 Py_XDECREF(py_import);
8196 Py_XDECREF(empty_list);
8197 Py_XDECREF(empty_dict);
8202 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
8203 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
8204 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
8205 PyErr_Format(PyExc_ImportError,
8206 #if PY_MAJOR_VERSION < 3
8207 "cannot import name %.230s", PyString_AS_STRING(name));
8209 "cannot import name %S", name);
8216 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
8218 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
8219 PyErr_SetString(PyExc_TypeError,
8220 "hasattr(): attribute name must be string");
8223 r = __Pyx_GetAttr(o, n);
8233 /* PyObject_GenericGetAttrNoDict */
8234 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
8235 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
8236 PyErr_Format(PyExc_AttributeError,
8237 #if PY_MAJOR_VERSION >= 3
8238 "'%.50s' object has no attribute '%U'",
8239 tp->tp_name, attr_name);
8241 "'%.50s' object has no attribute '%.400s'",
8242 tp->tp_name, PyString_AS_STRING(attr_name));
8246 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
8248 PyTypeObject *tp = Py_TYPE(obj);
8249 if (unlikely(!PyString_Check(attr_name))) {
8250 return PyObject_GenericGetAttr(obj, attr_name);
8252 assert(!tp->tp_dictoffset);
8253 descr = _PyType_Lookup(tp, attr_name);
8254 if (unlikely(!descr)) {
8255 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
8258 #if PY_MAJOR_VERSION < 3
8259 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
8262 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
8264 PyObject *res = f(descr, obj, (PyObject *)tp);
8273 /* PyObject_GenericGetAttr */
8274 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
8275 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
8276 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
8277 return PyObject_GenericGetAttr(obj, attr_name);
8279 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
8283 /* PyObjectGetAttrStrNoError */
8284 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
8285 __Pyx_PyThreadState_declare
8286 __Pyx_PyThreadState_assign
8287 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
8288 __Pyx_PyErr_Clear();
8290 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
8292 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
8293 PyTypeObject* tp = Py_TYPE(obj);
8294 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
8295 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
8298 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
8299 if (unlikely(!result)) {
8300 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
8306 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
8308 PyObject *name_attr;
8309 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
8310 if (likely(name_attr)) {
8311 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
8315 if (unlikely(ret < 0)) {
8319 Py_XDECREF(name_attr);
8322 static int __Pyx_setup_reduce(PyObject* type_obj) {
8324 PyObject *object_reduce = NULL;
8325 PyObject *object_reduce_ex = NULL;
8326 PyObject *reduce = NULL;
8327 PyObject *reduce_ex = NULL;
8328 PyObject *reduce_cython = NULL;
8329 PyObject *setstate = NULL;
8330 PyObject *setstate_cython = NULL;
8331 #if CYTHON_USE_PYTYPE_LOOKUP
8332 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8334 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8336 #if CYTHON_USE_PYTYPE_LOOKUP
8337 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8339 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8341 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
8342 if (reduce_ex == object_reduce_ex) {
8343 #if CYTHON_USE_PYTYPE_LOOKUP
8344 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8346 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8348 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
8349 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
8350 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
8351 if (likely(reduce_cython)) {
8352 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8353 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8354 } else if (reduce == object_reduce || PyErr_Occurred()) {
8357 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
8358 if (!setstate) PyErr_Clear();
8359 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
8360 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
8361 if (likely(setstate_cython)) {
8362 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8363 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8364 } else if (!setstate || PyErr_Occurred()) {
8368 PyType_Modified((PyTypeObject*)type_obj);
8373 if (!PyErr_Occurred())
8374 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
8377 #if !CYTHON_USE_PYTYPE_LOOKUP
8378 Py_XDECREF(object_reduce);
8379 Py_XDECREF(object_reduce_ex);
8382 Py_XDECREF(reduce_ex);
8383 Py_XDECREF(reduce_cython);
8384 Py_XDECREF(setstate);
8385 Py_XDECREF(setstate_cython);
8389 /* RegisterModuleCleanup */
8390 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
8391 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
8392 __pyx_module_cleanup(module);
8393 Py_INCREF(Py_None); return Py_None;
8395 static int __Pyx_RegisterCleanup(void) {
8396 static PyMethodDef cleanup_def = {
8397 "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
8398 PyObject *cleanup_func = 0;
8399 PyObject *atexit = 0;
8404 cleanup_func = PyCFunction_New(&cleanup_def, 0);
8407 atexit = PyImport_ImportModule("atexit");
8410 reg = PyObject_GetAttrString(atexit, "_exithandlers");
8411 if (reg && PyList_Check(reg)) {
8420 args = PyTuple_Pack(3, cleanup_func, a, kw);
8425 ret = PyList_Insert(reg, 0, args);
8430 reg = PyObject_GetAttrString(atexit, "register");
8433 args = PyTuple_Pack(1, cleanup_func);
8436 res = PyObject_CallObject(reg, args);
8442 Py_XDECREF(cleanup_func);
8451 /* CLineInTraceback */
8452 #ifndef CYTHON_CLINE_IN_TRACEBACK
8453 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
8454 PyObject *use_cline;
8455 PyObject *ptype, *pvalue, *ptraceback;
8456 #if CYTHON_COMPILING_IN_CPYTHON
8457 PyObject **cython_runtime_dict;
8459 if (unlikely(!__pyx_cython_runtime)) {
8462 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8463 #if CYTHON_COMPILING_IN_CPYTHON
8464 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8465 if (likely(cython_runtime_dict)) {
8466 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8467 use_cline, *cython_runtime_dict,
8468 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8472 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8473 if (use_cline_obj) {
8474 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8475 Py_DECREF(use_cline_obj);
8483 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8485 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8488 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8493 /* CodeObjectCache */
8494 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8495 int start = 0, mid = 0, end = count - 1;
8496 if (end >= 0 && code_line > entries[end].code_line) {
8499 while (start < end) {
8500 mid = start + (end - start) / 2;
8501 if (code_line < entries[mid].code_line) {
8503 } else if (code_line > entries[mid].code_line) {
8509 if (code_line <= entries[mid].code_line) {
8515 static PyCodeObject *__pyx_find_code_object(int code_line) {
8516 PyCodeObject* code_object;
8518 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8521 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8522 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8525 code_object = __pyx_code_cache.entries[pos].code_object;
8526 Py_INCREF(code_object);
8529 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8531 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8532 if (unlikely(!code_line)) {
8535 if (unlikely(!entries)) {
8536 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8537 if (likely(entries)) {
8538 __pyx_code_cache.entries = entries;
8539 __pyx_code_cache.max_count = 64;
8540 __pyx_code_cache.count = 1;
8541 entries[0].code_line = code_line;
8542 entries[0].code_object = code_object;
8543 Py_INCREF(code_object);
8547 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8548 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8549 PyCodeObject* tmp = entries[pos].code_object;
8550 entries[pos].code_object = code_object;
8554 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8555 int new_max = __pyx_code_cache.max_count + 64;
8556 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8557 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
8558 if (unlikely(!entries)) {
8561 __pyx_code_cache.entries = entries;
8562 __pyx_code_cache.max_count = new_max;
8564 for (i=__pyx_code_cache.count; i>pos; i--) {
8565 entries[i] = entries[i-1];
8567 entries[pos].code_line = code_line;
8568 entries[pos].code_object = code_object;
8569 __pyx_code_cache.count++;
8570 Py_INCREF(code_object);
8574 #include "compile.h"
8575 #include "frameobject.h"
8576 #include "traceback.h"
8577 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8578 const char *funcname, int c_line,
8579 int py_line, const char *filename) {
8580 PyCodeObject *py_code = 0;
8581 PyObject *py_srcfile = 0;
8582 PyObject *py_funcname = 0;
8583 #if PY_MAJOR_VERSION < 3
8584 py_srcfile = PyString_FromString(filename);
8586 py_srcfile = PyUnicode_FromString(filename);
8588 if (!py_srcfile) goto bad;
8590 #if PY_MAJOR_VERSION < 3
8591 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8593 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8597 #if PY_MAJOR_VERSION < 3
8598 py_funcname = PyString_FromString(funcname);
8600 py_funcname = PyUnicode_FromString(funcname);
8603 if (!py_funcname) goto bad;
8604 py_code = __Pyx_PyCode_New(
8610 __pyx_empty_bytes, /*PyObject *code,*/
8611 __pyx_empty_tuple, /*PyObject *consts,*/
8612 __pyx_empty_tuple, /*PyObject *names,*/
8613 __pyx_empty_tuple, /*PyObject *varnames,*/
8614 __pyx_empty_tuple, /*PyObject *freevars,*/
8615 __pyx_empty_tuple, /*PyObject *cellvars,*/
8616 py_srcfile, /*PyObject *filename,*/
8617 py_funcname, /*PyObject *name,*/
8619 __pyx_empty_bytes /*PyObject *lnotab*/
8621 Py_DECREF(py_srcfile);
8622 Py_DECREF(py_funcname);
8625 Py_XDECREF(py_srcfile);
8626 Py_XDECREF(py_funcname);
8629 static void __Pyx_AddTraceback(const char *funcname, int c_line,
8630 int py_line, const char *filename) {
8631 PyCodeObject *py_code = 0;
8632 PyFrameObject *py_frame = 0;
8633 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8635 c_line = __Pyx_CLineForTraceback(tstate, c_line);
8637 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
8639 py_code = __Pyx_CreateCodeObjectForTraceback(
8640 funcname, c_line, py_line, filename);
8641 if (!py_code) goto bad;
8642 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
8644 py_frame = PyFrame_New(
8645 tstate, /*PyThreadState *tstate,*/
8646 py_code, /*PyCodeObject *code,*/
8647 __pyx_d, /*PyObject *globals,*/
8648 0 /*PyObject *locals*/
8650 if (!py_frame) goto bad;
8651 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
8652 PyTraceBack_Here(py_frame);
8654 Py_XDECREF(py_code);
8655 Py_XDECREF(py_frame);
8658 /* CIntFromPyVerify */
8659 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
8660 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
8661 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
8662 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
8663 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
8665 func_type value = func_value;\
8666 if (sizeof(target_type) < sizeof(func_type)) {\
8667 if (unlikely(value != (func_type) (target_type) value)) {\
8668 func_type zero = 0;\
8669 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
8670 return (target_type) -1;\
8671 if (is_unsigned && unlikely(value < zero))\
8672 goto raise_neg_overflow;\
8674 goto raise_overflow;\
8677 return (target_type) value;\
8681 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
8682 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8683 const int is_unsigned = neg_one > const_zero;
8685 if (sizeof(long) < sizeof(long)) {
8686 return PyInt_FromLong((long) value);
8687 } else if (sizeof(long) <= sizeof(unsigned long)) {
8688 return PyLong_FromUnsignedLong((unsigned long) value);
8689 #ifdef HAVE_LONG_LONG
8690 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8691 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8695 if (sizeof(long) <= sizeof(long)) {
8696 return PyInt_FromLong((long) value);
8697 #ifdef HAVE_LONG_LONG
8698 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8699 return PyLong_FromLongLong((PY_LONG_LONG) value);
8704 int one = 1; int little = (int)*(unsigned char *)&one;
8705 unsigned char *bytes = (unsigned char *)&value;
8706 return _PyLong_FromByteArray(bytes, sizeof(long),
8707 little, !is_unsigned);
8712 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
8713 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8714 const int is_unsigned = neg_one > const_zero;
8715 #if PY_MAJOR_VERSION < 3
8716 if (likely(PyInt_Check(x))) {
8717 if (sizeof(long) < sizeof(long)) {
8718 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
8720 long val = PyInt_AS_LONG(x);
8721 if (is_unsigned && unlikely(val < 0)) {
8722 goto raise_neg_overflow;
8728 if (likely(PyLong_Check(x))) {
8730 #if CYTHON_USE_PYLONG_INTERNALS
8731 const digit* digits = ((PyLongObject*)x)->ob_digit;
8732 switch (Py_SIZE(x)) {
8733 case 0: return (long) 0;
8734 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
8736 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8737 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8738 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8739 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
8740 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8745 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8746 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8747 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8748 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
8749 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8754 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8755 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8756 __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])))
8757 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
8758 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8764 #if CYTHON_COMPILING_IN_CPYTHON
8765 if (unlikely(Py_SIZE(x) < 0)) {
8766 goto raise_neg_overflow;
8770 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8771 if (unlikely(result < 0))
8773 if (unlikely(result == 1))
8774 goto raise_neg_overflow;
8777 if (sizeof(long) <= sizeof(unsigned long)) {
8778 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
8779 #ifdef HAVE_LONG_LONG
8780 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8781 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8785 #if CYTHON_USE_PYLONG_INTERNALS
8786 const digit* digits = ((PyLongObject*)x)->ob_digit;
8787 switch (Py_SIZE(x)) {
8788 case 0: return (long) 0;
8789 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
8790 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
8792 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
8793 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8794 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8795 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8796 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8801 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8802 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8803 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8804 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8805 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8810 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8811 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8812 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8813 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8814 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8819 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8820 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8821 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8822 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8823 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8828 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8829 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8830 __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])))
8831 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8832 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8837 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8838 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8839 __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])))
8840 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8841 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8847 if (sizeof(long) <= sizeof(long)) {
8848 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
8849 #ifdef HAVE_LONG_LONG
8850 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8851 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
8856 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8857 PyErr_SetString(PyExc_RuntimeError,
8858 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8861 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8862 #if PY_MAJOR_VERSION < 3
8863 if (likely(v) && !PyLong_Check(v)) {
8865 v = PyNumber_Long(tmp);
8870 int one = 1; int is_little = (int)*(unsigned char *)&one;
8871 unsigned char *bytes = (unsigned char *)&val;
8872 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8874 is_little, !is_unsigned);
8884 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8885 if (!tmp) return (long) -1;
8886 val = __Pyx_PyInt_As_long(tmp);
8891 PyErr_SetString(PyExc_OverflowError,
8892 "value too large to convert to long");
8895 PyErr_SetString(PyExc_OverflowError,
8896 "can't convert negative value to long");
8901 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
8902 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
8903 const int is_unsigned = neg_one > const_zero;
8904 #if PY_MAJOR_VERSION < 3
8905 if (likely(PyInt_Check(x))) {
8906 if (sizeof(int) < sizeof(long)) {
8907 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
8909 long val = PyInt_AS_LONG(x);
8910 if (is_unsigned && unlikely(val < 0)) {
8911 goto raise_neg_overflow;
8917 if (likely(PyLong_Check(x))) {
8919 #if CYTHON_USE_PYLONG_INTERNALS
8920 const digit* digits = ((PyLongObject*)x)->ob_digit;
8921 switch (Py_SIZE(x)) {
8922 case 0: return (int) 0;
8923 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
8925 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8926 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8927 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8928 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
8929 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8934 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8935 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8936 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8937 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
8938 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8943 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8944 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8945 __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])))
8946 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
8947 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8953 #if CYTHON_COMPILING_IN_CPYTHON
8954 if (unlikely(Py_SIZE(x) < 0)) {
8955 goto raise_neg_overflow;
8959 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8960 if (unlikely(result < 0))
8962 if (unlikely(result == 1))
8963 goto raise_neg_overflow;
8966 if (sizeof(int) <= sizeof(unsigned long)) {
8967 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
8968 #ifdef HAVE_LONG_LONG
8969 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8970 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8974 #if CYTHON_USE_PYLONG_INTERNALS
8975 const digit* digits = ((PyLongObject*)x)->ob_digit;
8976 switch (Py_SIZE(x)) {
8977 case 0: return (int) 0;
8978 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
8979 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
8981 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
8982 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8983 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8984 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8985 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8990 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8991 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8992 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8993 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8994 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8999 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9000 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9001 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9002 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9003 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9008 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9009 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9010 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9011 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9012 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9017 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9018 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9019 __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])))
9020 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9021 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9026 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9027 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9028 __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])))
9029 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9030 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9036 if (sizeof(int) <= sizeof(long)) {
9037 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
9038 #ifdef HAVE_LONG_LONG
9039 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9040 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
9045 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9046 PyErr_SetString(PyExc_RuntimeError,
9047 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9050 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9051 #if PY_MAJOR_VERSION < 3
9052 if (likely(v) && !PyLong_Check(v)) {
9054 v = PyNumber_Long(tmp);
9059 int one = 1; int is_little = (int)*(unsigned char *)&one;
9060 unsigned char *bytes = (unsigned char *)&val;
9061 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9063 is_little, !is_unsigned);
9073 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9074 if (!tmp) return (int) -1;
9075 val = __Pyx_PyInt_As_int(tmp);
9080 PyErr_SetString(PyExc_OverflowError,
9081 "value too large to convert to int");
9084 PyErr_SetString(PyExc_OverflowError,
9085 "can't convert negative value to int");
9089 /* FastTypeChecks */
9090 #if CYTHON_COMPILING_IN_CPYTHON
9091 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
9097 return b == &PyBaseObject_Type;
9099 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
9101 if (a == b) return 1;
9105 n = PyTuple_GET_SIZE(mro);
9106 for (i = 0; i < n; i++) {
9107 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
9112 return __Pyx_InBases(a, b);
9114 #if PY_MAJOR_VERSION == 2
9115 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
9116 PyObject *exception, *value, *tb;
9118 __Pyx_PyThreadState_declare
9119 __Pyx_PyThreadState_assign
9120 __Pyx_ErrFetch(&exception, &value, &tb);
9121 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
9122 if (unlikely(res == -1)) {
9123 PyErr_WriteUnraisable(err);
9127 res = PyObject_IsSubclass(err, exc_type2);
9128 if (unlikely(res == -1)) {
9129 PyErr_WriteUnraisable(err);
9133 __Pyx_ErrRestore(exception, value, tb);
9137 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
9138 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
9140 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
9145 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9147 assert(PyExceptionClass_Check(exc_type));
9148 n = PyTuple_GET_SIZE(tuple);
9149 #if PY_MAJOR_VERSION >= 3
9150 for (i=0; i<n; i++) {
9151 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9154 for (i=0; i<n; i++) {
9155 PyObject *t = PyTuple_GET_ITEM(tuple, i);
9156 #if PY_MAJOR_VERSION < 3
9157 if (likely(exc_type == t)) return 1;
9159 if (likely(PyExceptionClass_Check(t))) {
9160 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
9166 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
9167 if (likely(err == exc_type)) return 1;
9168 if (likely(PyExceptionClass_Check(err))) {
9169 if (likely(PyExceptionClass_Check(exc_type))) {
9170 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
9171 } else if (likely(PyTuple_Check(exc_type))) {
9172 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
9176 return PyErr_GivenExceptionMatches(err, exc_type);
9178 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
9179 assert(PyExceptionClass_Check(exc_type1));
9180 assert(PyExceptionClass_Check(exc_type2));
9181 if (likely(err == exc_type1 || err == exc_type2)) return 1;
9182 if (likely(PyExceptionClass_Check(err))) {
9183 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
9185 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
9189 /* CheckBinaryVersion */
9190 static int __Pyx_check_binary_version(void) {
9191 char ctversion[4], rtversion[4];
9192 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
9193 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
9194 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
9196 PyOS_snprintf(message, sizeof(message),
9197 "compiletime version %s of module '%.100s' "
9198 "does not match runtime version %s",
9199 ctversion, __Pyx_MODULE_NAME, rtversion);
9200 return PyErr_WarnEx(NULL, message, 1);
9206 static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) {
9209 d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi);
9215 if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0)
9218 #if PY_VERSION_HEX >= 0x02070000
9219 cobj = PyCapsule_New(p, sig, 0);
9221 cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0);
9225 if (PyDict_SetItem(d, name, cobj) < 0)
9237 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9239 #if PY_MAJOR_VERSION < 3
9240 if (t->is_unicode) {
9241 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9242 } else if (t->intern) {
9243 *t->p = PyString_InternFromString(t->s);
9245 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9248 if (t->is_unicode | t->is_str) {
9250 *t->p = PyUnicode_InternFromString(t->s);
9251 } else if (t->encoding) {
9252 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9254 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9257 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9262 if (PyObject_Hash(*t->p) == -1)
9269 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9270 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9272 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
9274 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9276 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9277 #if !CYTHON_PEP393_ENABLED
9278 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9280 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9281 if (!defenc) return NULL;
9282 defenc_c = PyBytes_AS_STRING(defenc);
9283 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9285 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
9287 for (c = defenc_c; c < end; c++) {
9288 if ((unsigned char) (*c) >= 128) {
9289 PyUnicode_AsASCIIString(o);
9295 *length = PyBytes_GET_SIZE(defenc);
9299 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9300 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
9301 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9302 if (likely(PyUnicode_IS_ASCII(o))) {
9303 *length = PyUnicode_GET_LENGTH(o);
9304 return PyUnicode_AsUTF8(o);
9306 PyUnicode_AsASCIIString(o);
9310 return PyUnicode_AsUTF8AndSize(o, length);
9315 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9316 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9318 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9319 __Pyx_sys_getdefaultencoding_not_ascii &&
9321 PyUnicode_Check(o)) {
9322 return __Pyx_PyUnicode_AsStringAndSize(o, length);
9325 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
9326 if (PyByteArray_Check(o)) {
9327 *length = PyByteArray_GET_SIZE(o);
9328 return PyByteArray_AS_STRING(o);
9333 int r = PyBytes_AsStringAndSize(o, &result, length);
9334 if (unlikely(r < 0)) {
9341 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9342 int is_true = x == Py_True;
9343 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9344 else return PyObject_IsTrue(x);
9346 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
9348 if (unlikely(!x)) return -1;
9349 retval = __Pyx_PyObject_IsTrue(x);
9353 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
9354 #if PY_MAJOR_VERSION >= 3
9355 if (PyLong_Check(result)) {
9356 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
9357 "__int__ returned non-int (type %.200s). "
9358 "The ability to return an instance of a strict subclass of int "
9359 "is deprecated, and may be removed in a future version of Python.",
9360 Py_TYPE(result)->tp_name)) {
9367 PyErr_Format(PyExc_TypeError,
9368 "__%.4s__ returned non-%.4s (type %.200s)",
9369 type_name, type_name, Py_TYPE(result)->tp_name);
9373 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
9374 #if CYTHON_USE_TYPE_SLOTS
9377 const char *name = NULL;
9378 PyObject *res = NULL;
9379 #if PY_MAJOR_VERSION < 3
9380 if (likely(PyInt_Check(x) || PyLong_Check(x)))
9382 if (likely(PyLong_Check(x)))
9384 return __Pyx_NewRef(x);
9385 #if CYTHON_USE_TYPE_SLOTS
9386 m = Py_TYPE(x)->tp_as_number;
9387 #if PY_MAJOR_VERSION < 3
9388 if (m && m->nb_int) {
9392 else if (m && m->nb_long) {
9394 res = m->nb_long(x);
9397 if (likely(m && m->nb_int)) {
9403 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
9404 res = PyNumber_Int(x);
9408 #if PY_MAJOR_VERSION < 3
9409 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
9411 if (unlikely(!PyLong_CheckExact(res))) {
9413 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
9416 else if (!PyErr_Occurred()) {
9417 PyErr_SetString(PyExc_TypeError,
9418 "an integer is required");
9422 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9425 #if PY_MAJOR_VERSION < 3
9426 if (likely(PyInt_CheckExact(b))) {
9427 if (sizeof(Py_ssize_t) >= sizeof(long))
9428 return PyInt_AS_LONG(b);
9430 return PyInt_AsSsize_t(b);
9433 if (likely(PyLong_CheckExact(b))) {
9434 #if CYTHON_USE_PYLONG_INTERNALS
9435 const digit* digits = ((PyLongObject*)b)->ob_digit;
9436 const Py_ssize_t size = Py_SIZE(b);
9437 if (likely(__Pyx_sst_abs(size) <= 1)) {
9438 ival = likely(size) ? digits[0] : 0;
9439 if (size == -1) ival = -ival;
9444 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9445 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9449 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9450 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9454 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9455 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9459 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9460 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9464 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9465 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]));
9469 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9470 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]));
9476 return PyLong_AsSsize_t(b);
9478 x = PyNumber_Index(b);
9480 ival = PyInt_AsSsize_t(x);
9484 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
9485 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
9487 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9488 return PyInt_FromSize_t(ival);
9492 #endif /* Py_PYTHON_H */