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._elementpath",
22 "src/lxml/_elementpath.py"
25 "module_name": "lxml._elementpath"
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___elementpath
621 #define __PYX_HAVE_API__lxml___elementpath
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/_elementpath.py",
834 /*--- Type declarations ---*/
835 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer;
836 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child;
837 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select;
838 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select;
839 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant;
840 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select;
841 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select;
842 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate;
843 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select;
844 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select;
845 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select;
846 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select;
847 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select;
848 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select;
849 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator;
850 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr;
852 /* "lxml/_elementpath.py":74
855 * def xpath_tokenizer(pattern, namespaces=None): # <<<<<<<<<<<<<<
856 * # ElementTree uses '', lxml used None originally.
857 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
859 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer {
861 PyObject *__pyx_v_default_namespace;
862 PyObject *__pyx_v_namespaces;
863 PyObject *__pyx_v_parsing_attribute;
864 PyObject *__pyx_v_pattern;
865 PyObject *__pyx_v_prefix;
866 PyObject *__pyx_v_tag;
867 PyObject *__pyx_v_token;
868 PyObject *__pyx_v_ttype;
869 PyObject *__pyx_v_uri;
871 Py_ssize_t __pyx_t_1;
872 PyObject *(*__pyx_t_2)(PyObject *);
879 /* "lxml/_elementpath.py":99
882 * def prepare_child(next, token): # <<<<<<<<<<<<<<
884 * def select(result):
886 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child {
888 PyObject *__pyx_v_tag;
892 /* "lxml/_elementpath.py":101
893 * def prepare_child(next, token):
895 * def select(result): # <<<<<<<<<<<<<<
896 * for elem in result:
897 * for e in elem.iterchildren(tag):
899 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select {
901 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *__pyx_outer_scope;
903 PyObject *__pyx_v_elem;
904 PyObject *__pyx_v_result;
906 Py_ssize_t __pyx_t_1;
907 PyObject *(*__pyx_t_2)(PyObject *);
909 Py_ssize_t __pyx_t_4;
910 PyObject *(*__pyx_t_5)(PyObject *);
914 /* "lxml/_elementpath.py":108
916 * def prepare_star(next, token):
917 * def select(result): # <<<<<<<<<<<<<<
918 * for elem in result:
919 * for e in elem.iterchildren('*'):
921 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select {
924 PyObject *__pyx_v_elem;
925 PyObject *__pyx_v_result;
927 Py_ssize_t __pyx_t_1;
928 PyObject *(*__pyx_t_2)(PyObject *);
930 Py_ssize_t __pyx_t_4;
931 PyObject *(*__pyx_t_5)(PyObject *);
935 /* "lxml/_elementpath.py":119
938 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
940 * if token[0] == "*":
942 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant {
944 PyObject *__pyx_v_tag;
948 /* "lxml/_elementpath.py":127
950 * raise SyntaxError("invalid descendant")
951 * def select(result): # <<<<<<<<<<<<<<
952 * for elem in result:
953 * for e in elem.iterdescendants(tag):
955 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select {
957 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *__pyx_outer_scope;
959 PyObject *__pyx_v_elem;
960 PyObject *__pyx_v_result;
962 Py_ssize_t __pyx_t_1;
963 PyObject *(*__pyx_t_2)(PyObject *);
965 Py_ssize_t __pyx_t_4;
966 PyObject *(*__pyx_t_5)(PyObject *);
970 /* "lxml/_elementpath.py":134
972 * def prepare_parent(next, token):
973 * def select(result): # <<<<<<<<<<<<<<
974 * for elem in result:
975 * parent = elem.getparent()
977 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select {
979 PyObject *__pyx_v_elem;
980 PyObject *__pyx_v_parent;
981 PyObject *__pyx_v_result;
983 Py_ssize_t __pyx_t_1;
984 PyObject *(*__pyx_t_2)(PyObject *);
988 /* "lxml/_elementpath.py":141
991 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
992 * # FIXME: replace with real parser!!! refs:
993 * # http://effbot.org/zone/simple-iterator-parser.htm
995 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate {
997 PyObject *__pyx_v_index;
998 PyObject *__pyx_v_key;
999 PyObject *__pyx_v_tag;
1000 PyObject *__pyx_v_value;
1004 /* "lxml/_elementpath.py":163
1005 * # [@attribute] predicate
1006 * key = predicate[1]
1007 * def select(result): # <<<<<<<<<<<<<<
1008 * for elem in result:
1009 * if elem.get(key) is not None:
1011 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select {
1013 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1014 PyObject *__pyx_v_elem;
1015 PyObject *__pyx_v_result;
1016 PyObject *__pyx_t_0;
1017 Py_ssize_t __pyx_t_1;
1018 PyObject *(*__pyx_t_2)(PyObject *);
1022 /* "lxml/_elementpath.py":172
1023 * key = predicate[1]
1024 * value = predicate[-1]
1025 * def select(result): # <<<<<<<<<<<<<<
1026 * for elem in result:
1027 * if elem.get(key) == value:
1029 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select {
1031 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1032 PyObject *__pyx_v_elem;
1033 PyObject *__pyx_v_result;
1034 PyObject *__pyx_t_0;
1035 Py_ssize_t __pyx_t_1;
1036 PyObject *(*__pyx_t_2)(PyObject *);
1040 /* "lxml/_elementpath.py":180
1042 * tag = predicate[0]
1043 * def select(result): # <<<<<<<<<<<<<<
1044 * for elem in result:
1045 * for _ in elem.iterchildren(tag):
1047 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select {
1049 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1050 PyObject *__pyx_v__;
1051 PyObject *__pyx_v_elem;
1052 PyObject *__pyx_v_result;
1053 PyObject *__pyx_t_0;
1054 Py_ssize_t __pyx_t_1;
1055 PyObject *(*__pyx_t_2)(PyObject *);
1056 PyObject *__pyx_t_3;
1057 Py_ssize_t __pyx_t_4;
1058 PyObject *(*__pyx_t_5)(PyObject *);
1062 /* "lxml/_elementpath.py":191
1063 * value = predicate[-1]
1065 * def select(result): # <<<<<<<<<<<<<<
1066 * for elem in result:
1067 * for e in elem.iterchildren(tag):
1069 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select {
1071 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1072 PyObject *__pyx_v_e;
1073 PyObject *__pyx_v_elem;
1074 PyObject *__pyx_v_result;
1075 PyObject *__pyx_t_0;
1076 Py_ssize_t __pyx_t_1;
1077 PyObject *(*__pyx_t_2)(PyObject *);
1078 PyObject *__pyx_t_3;
1079 Py_ssize_t __pyx_t_4;
1080 PyObject *(*__pyx_t_5)(PyObject *);
1084 /* "lxml/_elementpath.py":198
1087 * def select(result): # <<<<<<<<<<<<<<
1088 * for elem in result:
1089 * if "".join(elem.itertext()) == value:
1091 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select {
1093 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1094 PyObject *__pyx_v_elem;
1095 PyObject *__pyx_v_result;
1096 PyObject *__pyx_t_0;
1097 Py_ssize_t __pyx_t_1;
1098 PyObject *(*__pyx_t_2)(PyObject *);
1102 /* "lxml/_elementpath.py":224
1105 * def select(result): # <<<<<<<<<<<<<<
1106 * for elem in result:
1107 * parent = elem.getparent()
1109 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select {
1111 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_outer_scope;
1112 PyObject *__pyx_v_elem;
1113 PyObject *__pyx_v_elems;
1114 PyObject *__pyx_v_parent;
1115 PyObject *__pyx_v_result;
1116 PyObject *__pyx_t_0;
1117 Py_ssize_t __pyx_t_1;
1118 PyObject *(*__pyx_t_2)(PyObject *);
1119 PyObject *__pyx_t_3;
1120 PyObject *__pyx_t_4;
1121 PyObject *__pyx_t_5;
1125 /* "lxml/_elementpath.py":254
1128 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
1129 * """compile selector pattern"""
1130 * if path[-1:] == "/":
1132 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator {
1134 PyObject *__pyx_v_namespaces;
1138 /* "lxml/_elementpath.py":269
1139 * namespaces[None], namespaces['']))
1140 * cache_key += (namespaces[None],) + tuple(sorted(
1141 * item for item in namespaces.items() if item[0] is not None)) # <<<<<<<<<<<<<<
1143 * cache_key += tuple(sorted(namespaces.items()))
1145 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr {
1147 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *__pyx_outer_scope;
1148 PyObject *__pyx_v_item;
1152 /* --- Runtime support code (head) --- */
1153 /* Refnanny.proto */
1154 #ifndef CYTHON_REFNANNY
1155 #define CYTHON_REFNANNY 0
1159 void (*INCREF)(void*, PyObject*, int);
1160 void (*DECREF)(void*, PyObject*, int);
1161 void (*GOTREF)(void*, PyObject*, int);
1162 void (*GIVEREF)(void*, PyObject*, int);
1163 void* (*SetupContext)(const char*, int, const char*);
1164 void (*FinishContext)(void**);
1165 } __Pyx_RefNannyAPIStruct;
1166 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1167 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1168 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1170 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1172 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1173 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1174 PyGILState_Release(__pyx_gilstate_save);\
1176 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1179 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1180 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1182 #define __Pyx_RefNannyFinishContext()\
1183 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1184 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1185 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1186 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1187 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1188 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1189 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1190 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1191 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1193 #define __Pyx_RefNannyDeclarations
1194 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1195 #define __Pyx_RefNannyFinishContext()
1196 #define __Pyx_INCREF(r) Py_INCREF(r)
1197 #define __Pyx_DECREF(r) Py_DECREF(r)
1198 #define __Pyx_GOTREF(r)
1199 #define __Pyx_GIVEREF(r)
1200 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1201 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1202 #define __Pyx_XGOTREF(r)
1203 #define __Pyx_XGIVEREF(r)
1205 #define __Pyx_XDECREF_SET(r, v) do {\
1206 PyObject *tmp = (PyObject *) r;\
1207 r = v; __Pyx_XDECREF(tmp);\
1209 #define __Pyx_DECREF_SET(r, v) do {\
1210 PyObject *tmp = (PyObject *) r;\
1211 r = v; __Pyx_DECREF(tmp);\
1213 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1214 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1216 /* PyObjectGetAttrStr.proto */
1217 #if CYTHON_USE_TYPE_SLOTS
1218 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1220 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1223 /* GetBuiltinName.proto */
1224 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1226 /* RaiseDoubleKeywords.proto */
1227 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1229 /* ParseKeywords.proto */
1230 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1231 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1232 const char* function_name);
1234 /* RaiseArgTupleInvalid.proto */
1235 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1236 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1238 /* PyCFunctionFastCall.proto */
1239 #if CYTHON_FAST_PYCCALL
1240 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1242 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1245 /* PyFunctionFastCall.proto */
1246 #if CYTHON_FAST_PYCALL
1247 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1248 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1249 #if 1 || PY_VERSION_HEX < 0x030600B1
1250 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1252 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1254 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1255 (sizeof(char [1 - 2*!(cond)]) - 1)
1256 #ifndef Py_MEMBER_SIZE
1257 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1259 static size_t __pyx_pyframe_localsplus_offset = 0;
1260 #include "frameobject.h"
1261 #define __Pxy_PyFrame_Initialize_Offsets()\
1262 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1263 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1264 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1265 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1268 /* PyObjectCall.proto */
1269 #if CYTHON_COMPILING_IN_CPYTHON
1270 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1272 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1275 /* PyObjectCall2Args.proto */
1276 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1278 /* PyObjectCallMethO.proto */
1279 #if CYTHON_COMPILING_IN_CPYTHON
1280 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1283 /* PyObjectCallOneArg.proto */
1284 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1286 /* PyDictVersioning.proto */
1287 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1288 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1289 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1290 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1291 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1292 (cache_var) = (value);
1293 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1294 static PY_UINT64_T __pyx_dict_version = 0;\
1295 static PyObject *__pyx_dict_cached_value = NULL;\
1296 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1297 (VAR) = __pyx_dict_cached_value;\
1299 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1300 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1303 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1304 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1305 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1307 #define __PYX_GET_DICT_VERSION(dict) (0)
1308 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1309 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1312 /* GetModuleGlobalName.proto */
1313 #if CYTHON_USE_DICT_VERSIONS
1314 #define __Pyx_GetModuleGlobalName(var, name) {\
1315 static PY_UINT64_T __pyx_dict_version = 0;\
1316 static PyObject *__pyx_dict_cached_value = NULL;\
1317 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1318 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1319 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1321 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1322 PY_UINT64_T __pyx_dict_version;\
1323 PyObject *__pyx_dict_cached_value;\
1324 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1326 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1328 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1329 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1330 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1333 /* RaiseTooManyValuesToUnpack.proto */
1334 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1336 /* RaiseNeedMoreValuesToUnpack.proto */
1337 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1339 /* IterFinish.proto */
1340 static CYTHON_INLINE int __Pyx_IterFinish(void);
1342 /* UnpackItemEndCheck.proto */
1343 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1345 /* GetItemInt.proto */
1346 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1347 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1348 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1349 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1350 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1351 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1352 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1353 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1354 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1355 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1356 int wraparound, int boundscheck);
1357 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1358 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1359 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1360 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1361 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1362 int wraparound, int boundscheck);
1363 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1364 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1365 int is_list, int wraparound, int boundscheck);
1367 /* IncludeStringH.proto */
1370 /* BytesEquals.proto */
1371 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1373 /* UnicodeEquals.proto */
1374 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1376 /* StrEquals.proto */
1377 #if PY_MAJOR_VERSION >= 3
1378 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1380 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1383 /* PySequenceContains.proto */
1384 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1385 int result = PySequence_Contains(seq, item);
1386 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1389 /* PyThreadStateGet.proto */
1390 #if CYTHON_FAST_THREAD_STATE
1391 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1392 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1393 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1395 #define __Pyx_PyThreadState_declare
1396 #define __Pyx_PyThreadState_assign
1397 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1400 /* PyErrFetchRestore.proto */
1401 #if CYTHON_FAST_THREAD_STATE
1402 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1403 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1404 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1405 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1406 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1407 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1408 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1409 #if CYTHON_COMPILING_IN_CPYTHON
1410 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1412 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1415 #define __Pyx_PyErr_Clear() PyErr_Clear()
1416 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1417 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1418 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1419 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1420 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1421 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1422 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1425 /* RaiseException.proto */
1426 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1428 /* ObjectGetItem.proto */
1429 #if CYTHON_USE_TYPE_SLOTS
1430 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1432 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1435 /* GetTopmostException.proto */
1436 #if CYTHON_USE_EXC_INFO_STACK
1437 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1440 /* SaveResetException.proto */
1441 #if CYTHON_FAST_THREAD_STATE
1442 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1443 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1444 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1445 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1447 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1448 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1451 /* PyErrExceptionMatches.proto */
1452 #if CYTHON_FAST_THREAD_STATE
1453 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1454 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1456 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1459 /* GetException.proto */
1460 #if CYTHON_FAST_THREAD_STATE
1461 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1462 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1464 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1468 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1470 /* FetchCommonType.proto */
1471 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1473 /* CythonFunctionShared.proto */
1474 #define __Pyx_CyFunction_USED 1
1475 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1476 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1477 #define __Pyx_CYFUNCTION_CCLASS 0x04
1478 #define __Pyx_CyFunction_GetClosure(f)\
1479 (((__pyx_CyFunctionObject *) (f))->func_closure)
1480 #define __Pyx_CyFunction_GetClassObj(f)\
1481 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1482 #define __Pyx_CyFunction_Defaults(type, f)\
1483 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1484 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1485 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1487 PyCFunctionObject func;
1488 #if PY_VERSION_HEX < 0x030500A0
1489 PyObject *func_weakreflist;
1491 PyObject *func_dict;
1492 PyObject *func_name;
1493 PyObject *func_qualname;
1495 PyObject *func_globals;
1496 PyObject *func_code;
1497 PyObject *func_closure;
1498 PyObject *func_classobj;
1500 int defaults_pyobjects;
1501 size_t defaults_size; // used by FusedFunction for copying defaults
1503 PyObject *defaults_tuple;
1504 PyObject *defaults_kwdict;
1505 PyObject *(*defaults_getter)(PyObject *);
1506 PyObject *func_annotations;
1507 } __pyx_CyFunctionObject;
1508 static PyTypeObject *__pyx_CyFunctionType = 0;
1509 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1510 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1511 int flags, PyObject* qualname,
1513 PyObject *module, PyObject *globals,
1515 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1518 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1520 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1522 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1524 static int __pyx_CyFunction_init(void);
1526 /* CythonFunction.proto */
1527 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1528 int flags, PyObject* qualname,
1530 PyObject *module, PyObject *globals,
1533 /* PyObjectCallNoArg.proto */
1534 #if CYTHON_COMPILING_IN_CPYTHON
1535 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1537 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1540 /* StringJoin.proto */
1541 #if PY_MAJOR_VERSION < 3
1542 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
1543 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
1545 #define __Pyx_PyString_Join PyUnicode_Join
1546 #define __Pyx_PyBaseString_Join PyUnicode_Join
1548 #if CYTHON_COMPILING_IN_CPYTHON
1549 #if PY_MAJOR_VERSION < 3
1550 #define __Pyx_PyBytes_Join _PyString_Join
1552 #define __Pyx_PyBytes_Join _PyBytes_Join
1555 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
1558 /* SliceObject.proto */
1559 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1560 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1561 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1562 int has_cstart, int has_cstop, int wraparound);
1564 /* ListAppend.proto */
1565 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1566 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1567 PyListObject* L = (PyListObject*) list;
1568 Py_ssize_t len = Py_SIZE(list);
1569 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1571 PyList_SET_ITEM(list, len, x);
1572 Py_SIZE(list) = len+1;
1575 return PyList_Append(list, x);
1578 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1581 /* PyIntBinop.proto */
1582 #if !CYTHON_COMPILING_IN_PYPY
1583 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1585 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
1586 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1589 /* PyIntCompare.proto */
1590 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1592 /* ListCompAppend.proto */
1593 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1594 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1595 PyListObject* L = (PyListObject*) list;
1596 Py_ssize_t len = Py_SIZE(list);
1597 if (likely(L->allocated > len)) {
1599 PyList_SET_ITEM(list, len, x);
1600 Py_SIZE(list) = len+1;
1603 return PyList_Append(list, x);
1606 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1609 /* DictGetItem.proto */
1610 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1611 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1612 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1613 (likely(PyDict_CheckExact(obj)) ?\
1614 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1616 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1617 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1620 /* IterNext.proto */
1621 #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
1622 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
1624 /* PyObject_GenericGetAttrNoDict.proto */
1625 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1626 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1628 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1632 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1634 /* RegisterModuleCleanup.proto */
1635 static void __pyx_module_cleanup(PyObject *self);
1636 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1637 static int __Pyx_RegisterCleanup(void);
1639 #define __Pyx_RegisterCleanup() (0)
1642 /* CLineInTraceback.proto */
1643 #ifdef CYTHON_CLINE_IN_TRACEBACK
1644 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1646 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1649 /* CodeObjectCache.proto */
1651 PyCodeObject* code_object;
1653 } __Pyx_CodeObjectCacheEntry;
1654 struct __Pyx_CodeObjectCache {
1657 __Pyx_CodeObjectCacheEntry* entries;
1659 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1660 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1661 static PyCodeObject *__pyx_find_code_object(int code_line);
1662 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1664 /* AddTraceback.proto */
1665 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1666 int py_line, const char *filename);
1668 /* CIntToPy.proto */
1669 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1671 /* CIntFromPy.proto */
1672 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1674 /* CIntFromPy.proto */
1675 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1677 /* FastTypeChecks.proto */
1678 #if CYTHON_COMPILING_IN_CPYTHON
1679 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1680 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1681 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1682 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1684 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1685 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1686 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1688 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1690 /* SwapException.proto */
1691 #if CYTHON_FAST_THREAD_STATE
1692 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1693 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1695 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1698 /* PyObjectGetMethod.proto */
1699 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1701 /* PyObjectCallMethod1.proto */
1702 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1704 /* CoroutineBase.proto */
1705 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
1706 #if CYTHON_USE_EXC_INFO_STACK
1707 #define __Pyx_ExcInfoStruct _PyErr_StackItem
1711 PyObject *exc_value;
1712 PyObject *exc_traceback;
1713 } __Pyx_ExcInfoStruct;
1717 __pyx_coroutine_body_t body;
1719 __Pyx_ExcInfoStruct gi_exc_state;
1720 PyObject *gi_weakreflist;
1722 PyObject *yieldfrom;
1724 PyObject *gi_qualname;
1725 PyObject *gi_modulename;
1729 } __pyx_CoroutineObject;
1730 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
1731 PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1732 PyObject *name, PyObject *qualname, PyObject *module_name);
1733 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
1734 __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1735 PyObject *name, PyObject *qualname, PyObject *module_name);
1736 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
1737 static int __Pyx_Coroutine_clear(PyObject *self);
1738 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
1739 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
1740 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
1741 #if CYTHON_USE_EXC_INFO_STACK
1742 #define __Pyx_Coroutine_SwapException(self)
1743 #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
1745 #define __Pyx_Coroutine_SwapException(self) {\
1746 __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
1747 __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
1749 #define __Pyx_Coroutine_ResetAndClearException(self) {\
1750 __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
1751 (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
1754 #if CYTHON_FAST_THREAD_STATE
1755 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1756 __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
1758 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1759 __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
1761 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
1762 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
1764 /* PatchModuleWithCoroutine.proto */
1765 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
1767 /* PatchGeneratorABC.proto */
1768 static int __Pyx_patch_abc(void);
1770 /* Generator.proto */
1771 #define __Pyx_Generator_USED
1772 static PyTypeObject *__pyx_GeneratorType = 0;
1773 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
1774 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
1775 __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
1776 static PyObject *__Pyx_Generator_Next(PyObject *self);
1777 static int __pyx_Generator_init(void);
1779 /* CheckBinaryVersion.proto */
1780 static int __Pyx_check_binary_version(void);
1782 /* InitStrings.proto */
1783 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1786 /* Module declarations from 'lxml._elementpath' */
1787 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer = 0;
1788 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child = 0;
1789 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_2_select = 0;
1790 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_3_select = 0;
1791 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant = 0;
1792 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_5_select = 0;
1793 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_6_select = 0;
1794 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate = 0;
1795 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_8_select = 0;
1796 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_9_select = 0;
1797 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_10_select = 0;
1798 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_11_select = 0;
1799 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_12_select = 0;
1800 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_13_select = 0;
1801 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator = 0;
1802 static PyTypeObject *__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_15_genexpr = 0;
1803 #define __Pyx_MODULE_NAME "lxml._elementpath"
1804 extern int __pyx_module_is_main_lxml___elementpath;
1805 int __pyx_module_is_main_lxml___elementpath = 0;
1807 /* Implementation of 'lxml._elementpath' */
1808 static PyObject *__pyx_builtin_KeyError;
1809 static PyObject *__pyx_builtin_SyntaxError;
1810 static PyObject *__pyx_builtin_ValueError;
1811 static PyObject *__pyx_builtin_IndexError;
1812 static PyObject *__pyx_builtin_AttributeError;
1813 static PyObject *__pyx_builtin_StopIteration;
1814 static const char __pyx_k_d[] = "-?\\d+$";
1815 static const char __pyx_k_e[] = "e";
1816 static const char __pyx_k__2[] = "";
1817 static const char __pyx_k__3[] = "{";
1818 static const char __pyx_k__4[] = ":";
1819 static const char __pyx_k__6[] = "@";
1820 static const char __pyx_k__9[] = "*";
1821 static const char __pyx_k_el[] = "el";
1822 static const char __pyx_k_it[] = "it";
1823 static const char __pyx_k_re[] = "re";
1824 static const char __pyx_k__19[] = "]";
1825 static const char __pyx_k__22[] = "'\"";
1826 static const char __pyx_k__23[] = "'";
1827 static const char __pyx_k__25[] = "-";
1828 static const char __pyx_k__26[] = "@-";
1829 static const char __pyx_k__29[] = "@-='";
1830 static const char __pyx_k__32[] = "_";
1831 static const char __pyx_k__35[] = ".='";
1832 static const char __pyx_k__36[] = "-='";
1833 static const char __pyx_k__41[] = "-()";
1834 static const char __pyx_k__42[] = "-()-";
1835 static const char __pyx_k__51[] = "/";
1836 static const char __pyx_k__70[] = ".";
1837 static const char __pyx_k__71[] = "..";
1838 static const char __pyx_k__72[] = "//";
1839 static const char __pyx_k__73[] = "[";
1840 static const char __pyx_k_get[] = "get";
1841 static const char __pyx_k_key[] = "key";
1842 static const char __pyx_k_ops[] = "ops";
1843 static const char __pyx_k_s_s[] = "{%s}%s";
1844 static const char __pyx_k_tag[] = "tag";
1845 static const char __pyx_k_uri[] = "uri";
1846 static const char __pyx_k_args[] = "args";
1847 static const char __pyx_k_elem[] = "elem";
1848 static const char __pyx_k_find[] = "find";
1849 static const char __pyx_k_join[] = "join";
1850 static const char __pyx_k_last[] = "last";
1851 static const char __pyx_k_main[] = "__main__";
1852 static const char __pyx_k_name[] = "__name__";
1853 static const char __pyx_k_next[] = "next";
1854 static const char __pyx_k_path[] = "path";
1855 static const char __pyx_k_send[] = "send";
1856 static const char __pyx_k_test[] = "__test__";
1857 static const char __pyx_k_text[] = "text";
1858 static const char __pyx_k_cache[] = "_cache";
1859 static const char __pyx_k_clear[] = "clear";
1860 static const char __pyx_k_close[] = "close";
1861 static const char __pyx_k_elems[] = "elems";
1862 static const char __pyx_k_index[] = "index";
1863 static const char __pyx_k_items[] = "items";
1864 static const char __pyx_k_match[] = "match";
1865 static const char __pyx_k_s_s_2[] = "('[^']*'|\"[^\"]*\"|::|//?|\\.\\.|\\(\\)|[/.*:\\[\\]\\(\\)@=])|((?:\\{[^}]+\\})?[^/\\[\\]\\(\\)@=\\s]+)|\\s+";
1866 static const char __pyx_k_split[] = "split";
1867 static const char __pyx_k_throw[] = "throw";
1868 static const char __pyx_k_token[] = "token";
1869 static const char __pyx_k_ttype[] = "ttype";
1870 static const char __pyx_k_value[] = "value";
1871 static const char __pyx_k_import[] = "__import__";
1872 static const char __pyx_k_next_2[] = "__next__";
1873 static const char __pyx_k_next_3[] = "_next";
1874 static const char __pyx_k_parent[] = "parent";
1875 static const char __pyx_k_prefix[] = "prefix";
1876 static const char __pyx_k_result[] = "result";
1877 static const char __pyx_k_select[] = "select";
1878 static const char __pyx_k_stream[] = "stream";
1879 static const char __pyx_k_compile[] = "compile";
1880 static const char __pyx_k_default[] = "default";
1881 static const char __pyx_k_findall[] = "findall";
1882 static const char __pyx_k_genexpr[] = "genexpr";
1883 static const char __pyx_k_pattern[] = "pattern";
1884 static const char __pyx_k_KeyError[] = "KeyError";
1885 static const char __pyx_k_findtext[] = "findtext";
1886 static const char __pyx_k_iterfind[] = "iterfind";
1887 static const char __pyx_k_itertext[] = "itertext";
1888 static const char __pyx_k_selector[] = "selector";
1889 static const char __pyx_k_cache_key[] = "cache_key";
1890 static const char __pyx_k_getparent[] = "getparent";
1891 static const char __pyx_k_predicate[] = "predicate";
1892 static const char __pyx_k_signature[] = "signature";
1893 static const char __pyx_k_IndexError[] = "IndexError";
1894 static const char __pyx_k_ValueError[] = "ValueError";
1895 static const char __pyx_k_namespaces[] = "namespaces";
1896 static const char __pyx_k_SyntaxError[] = "SyntaxError";
1897 static const char __pyx_k_invalid_path[] = "invalid path";
1898 static const char __pyx_k_iterchildren[] = "iterchildren";
1899 static const char __pyx_k_prepare_self[] = "prepare_self";
1900 static const char __pyx_k_prepare_star[] = "prepare_star";
1901 static const char __pyx_k_StopIteration[] = "StopIteration";
1902 static const char __pyx_k_prepare_child[] = "prepare_child";
1903 static const char __pyx_k_AttributeError[] = "AttributeError";
1904 static const char __pyx_k_prepare_parent[] = "prepare_parent";
1905 static const char __pyx_k_iterdescendants[] = "iterdescendants";
1906 static const char __pyx_k_xpath_tokenizer[] = "xpath_tokenizer";
1907 static const char __pyx_k_default_namespace[] = "default_namespace";
1908 static const char __pyx_k_invalid_predicate[] = "invalid predicate";
1909 static const char __pyx_k_lxml__elementpath[] = "lxml._elementpath";
1910 static const char __pyx_k_parsing_attribute[] = "parsing_attribute";
1911 static const char __pyx_k_prepare_predicate[] = "prepare_predicate";
1912 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1913 static const char __pyx_k_invalid_descendant[] = "invalid descendant";
1914 static const char __pyx_k_prepare_descendant[] = "prepare_descendant";
1915 static const char __pyx_k_xpath_tokenizer_re[] = "xpath_tokenizer_re";
1916 static const char __pyx_k_build_path_iterator[] = "_build_path_iterator";
1917 static const char __pyx_k_unsupported_function[] = "unsupported function";
1918 static const char __pyx_k_empty_path_expression[] = "empty path expression";
1919 static const char __pyx_k_path_index_1_expected[] = "path index >= 1 expected";
1920 static const char __pyx_k_unsupported_expression[] = "unsupported expression";
1921 static const char __pyx_k_src_lxml__elementpath_py[] = "src/lxml/_elementpath.py";
1922 static const char __pyx_k_prepare_self_locals_select[] = "prepare_self.<locals>.select";
1923 static const char __pyx_k_prepare_star_locals_select[] = "prepare_star.<locals>.select";
1924 static const char __pyx_k_prepare_child_locals_select[] = "prepare_child.<locals>.select";
1925 static const char __pyx_k_prepare_parent_locals_select[] = "prepare_parent.<locals>.select";
1926 static const char __pyx_k_build_path_iterator_locals_gene[] = "_build_path_iterator.<locals>.genexpr";
1927 static const char __pyx_k_prepare_predicate_locals_select[] = "prepare_predicate.<locals>.select";
1928 static const char __pyx_k_Ambiguous_default_namespace_prov[] = "Ambiguous default namespace provided: %r versus %r";
1929 static const char __pyx_k_cannot_use_absolute_path_on_elem[] = "cannot use absolute path on element";
1930 static const char __pyx_k_indices_in_path_predicates_are_1[] = "indices in path predicates are 1-based, not 0-based";
1931 static const char __pyx_k_prefix_r_not_found_in_prefix_map[] = "prefix %r not found in prefix map";
1932 static const char __pyx_k_prepare_descendant_locals_select[] = "prepare_descendant.<locals>.select";
1933 static PyObject *__pyx_kp_s_Ambiguous_default_namespace_prov;
1934 static PyObject *__pyx_n_s_AttributeError;
1935 static PyObject *__pyx_n_s_IndexError;
1936 static PyObject *__pyx_n_s_KeyError;
1937 static PyObject *__pyx_n_s_StopIteration;
1938 static PyObject *__pyx_n_s_SyntaxError;
1939 static PyObject *__pyx_n_s_ValueError;
1940 static PyObject *__pyx_kp_s__19;
1941 static PyObject *__pyx_kp_s__2;
1942 static PyObject *__pyx_kp_s__22;
1943 static PyObject *__pyx_kp_s__23;
1944 static PyObject *__pyx_kp_s__25;
1945 static PyObject *__pyx_kp_s__26;
1946 static PyObject *__pyx_kp_s__29;
1947 static PyObject *__pyx_kp_s__3;
1948 static PyObject *__pyx_n_s__32;
1949 static PyObject *__pyx_kp_s__35;
1950 static PyObject *__pyx_kp_s__36;
1951 static PyObject *__pyx_kp_s__4;
1952 static PyObject *__pyx_kp_s__41;
1953 static PyObject *__pyx_kp_s__42;
1954 static PyObject *__pyx_kp_s__51;
1955 static PyObject *__pyx_kp_s__6;
1956 static PyObject *__pyx_kp_s__70;
1957 static PyObject *__pyx_kp_s__71;
1958 static PyObject *__pyx_kp_s__72;
1959 static PyObject *__pyx_kp_s__73;
1960 static PyObject *__pyx_kp_s__9;
1961 static PyObject *__pyx_n_s_args;
1962 static PyObject *__pyx_n_s_build_path_iterator;
1963 static PyObject *__pyx_n_s_build_path_iterator_locals_gene;
1964 static PyObject *__pyx_n_s_cache;
1965 static PyObject *__pyx_n_s_cache_key;
1966 static PyObject *__pyx_kp_s_cannot_use_absolute_path_on_elem;
1967 static PyObject *__pyx_n_s_clear;
1968 static PyObject *__pyx_n_s_cline_in_traceback;
1969 static PyObject *__pyx_n_s_close;
1970 static PyObject *__pyx_n_s_compile;
1971 static PyObject *__pyx_kp_s_d;
1972 static PyObject *__pyx_n_s_default;
1973 static PyObject *__pyx_n_s_default_namespace;
1974 static PyObject *__pyx_n_s_e;
1975 static PyObject *__pyx_n_s_el;
1976 static PyObject *__pyx_n_s_elem;
1977 static PyObject *__pyx_n_s_elems;
1978 static PyObject *__pyx_kp_s_empty_path_expression;
1979 static PyObject *__pyx_n_s_find;
1980 static PyObject *__pyx_n_s_findall;
1981 static PyObject *__pyx_n_s_findtext;
1982 static PyObject *__pyx_n_s_genexpr;
1983 static PyObject *__pyx_n_s_get;
1984 static PyObject *__pyx_n_s_getparent;
1985 static PyObject *__pyx_n_s_import;
1986 static PyObject *__pyx_n_s_index;
1987 static PyObject *__pyx_kp_s_indices_in_path_predicates_are_1;
1988 static PyObject *__pyx_kp_s_invalid_descendant;
1989 static PyObject *__pyx_kp_s_invalid_path;
1990 static PyObject *__pyx_kp_s_invalid_predicate;
1991 static PyObject *__pyx_n_s_it;
1992 static PyObject *__pyx_n_s_items;
1993 static PyObject *__pyx_n_s_iterchildren;
1994 static PyObject *__pyx_n_s_iterdescendants;
1995 static PyObject *__pyx_n_s_iterfind;
1996 static PyObject *__pyx_n_s_itertext;
1997 static PyObject *__pyx_n_s_join;
1998 static PyObject *__pyx_n_s_key;
1999 static PyObject *__pyx_n_s_last;
2000 static PyObject *__pyx_n_s_lxml__elementpath;
2001 static PyObject *__pyx_n_s_main;
2002 static PyObject *__pyx_n_s_match;
2003 static PyObject *__pyx_n_s_name;
2004 static PyObject *__pyx_n_s_namespaces;
2005 static PyObject *__pyx_n_s_next;
2006 static PyObject *__pyx_n_s_next_2;
2007 static PyObject *__pyx_n_s_next_3;
2008 static PyObject *__pyx_n_s_ops;
2009 static PyObject *__pyx_n_s_parent;
2010 static PyObject *__pyx_n_s_parsing_attribute;
2011 static PyObject *__pyx_n_s_path;
2012 static PyObject *__pyx_kp_s_path_index_1_expected;
2013 static PyObject *__pyx_n_s_pattern;
2014 static PyObject *__pyx_n_s_predicate;
2015 static PyObject *__pyx_n_s_prefix;
2016 static PyObject *__pyx_kp_s_prefix_r_not_found_in_prefix_map;
2017 static PyObject *__pyx_n_s_prepare_child;
2018 static PyObject *__pyx_n_s_prepare_child_locals_select;
2019 static PyObject *__pyx_n_s_prepare_descendant;
2020 static PyObject *__pyx_n_s_prepare_descendant_locals_select;
2021 static PyObject *__pyx_n_s_prepare_parent;
2022 static PyObject *__pyx_n_s_prepare_parent_locals_select;
2023 static PyObject *__pyx_n_s_prepare_predicate;
2024 static PyObject *__pyx_n_s_prepare_predicate_locals_select;
2025 static PyObject *__pyx_n_s_prepare_self;
2026 static PyObject *__pyx_n_s_prepare_self_locals_select;
2027 static PyObject *__pyx_n_s_prepare_star;
2028 static PyObject *__pyx_n_s_prepare_star_locals_select;
2029 static PyObject *__pyx_n_s_re;
2030 static PyObject *__pyx_n_s_result;
2031 static PyObject *__pyx_kp_s_s_s;
2032 static PyObject *__pyx_kp_s_s_s_2;
2033 static PyObject *__pyx_n_s_select;
2034 static PyObject *__pyx_n_s_selector;
2035 static PyObject *__pyx_n_s_send;
2036 static PyObject *__pyx_n_s_signature;
2037 static PyObject *__pyx_n_s_split;
2038 static PyObject *__pyx_kp_s_src_lxml__elementpath_py;
2039 static PyObject *__pyx_n_s_stream;
2040 static PyObject *__pyx_n_s_tag;
2041 static PyObject *__pyx_n_s_test;
2042 static PyObject *__pyx_n_s_text;
2043 static PyObject *__pyx_n_s_throw;
2044 static PyObject *__pyx_n_s_token;
2045 static PyObject *__pyx_n_s_ttype;
2046 static PyObject *__pyx_kp_s_unsupported_expression;
2047 static PyObject *__pyx_kp_s_unsupported_function;
2048 static PyObject *__pyx_n_s_uri;
2049 static PyObject *__pyx_n_s_value;
2050 static PyObject *__pyx_n_s_xpath_tokenizer;
2051 static PyObject *__pyx_n_s_xpath_tokenizer_re;
2052 static PyObject *__pyx_pf_4lxml_12_elementpath_xpath_tokenizer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_namespaces); /* proto */
2053 static PyObject *__pyx_pf_4lxml_12_elementpath_13prepare_child_select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2054 static PyObject *__pyx_pf_4lxml_12_elementpath_3prepare_child(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, PyObject *__pyx_v_token); /* proto */
2055 static PyObject *__pyx_pf_4lxml_12_elementpath_12prepare_star_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2056 static PyObject *__pyx_pf_4lxml_12_elementpath_5prepare_star(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token); /* proto */
2057 static PyObject *__pyx_pf_4lxml_12_elementpath_12prepare_self_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2058 static PyObject *__pyx_pf_4lxml_12_elementpath_7prepare_self(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token); /* proto */
2059 static PyObject *__pyx_pf_4lxml_12_elementpath_18prepare_descendant_select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2060 static PyObject *__pyx_pf_4lxml_12_elementpath_9prepare_descendant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_next, PyObject *__pyx_v_token); /* proto */
2061 static PyObject *__pyx_pf_4lxml_12_elementpath_14prepare_parent_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2062 static PyObject *__pyx_pf_4lxml_12_elementpath_11prepare_parent(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token); /* proto */
2063 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2064 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_3select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2065 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_6select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2066 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_9select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2067 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_12select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2068 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_15select(PyObject *__pyx_self, PyObject *__pyx_v_result); /* proto */
2069 static PyObject *__pyx_pf_4lxml_12_elementpath_13prepare_predicate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_next, PyObject *__pyx_v_token); /* proto */
2070 static PyObject *__pyx_pf_4lxml_12_elementpath_20_build_path_iterator_genexpr(PyObject *__pyx_self); /* proto */
2071 static PyObject *__pyx_pf_4lxml_12_elementpath_15_build_path_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
2072 static PyObject *__pyx_pf_4lxml_12_elementpath_17iterfind(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
2073 static PyObject *__pyx_pf_4lxml_12_elementpath_19find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
2074 static PyObject *__pyx_pf_4lxml_12_elementpath_21findall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces); /* proto */
2075 static PyObject *__pyx_pf_4lxml_12_elementpath_23findtext(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces); /* proto */
2076 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2077 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2078 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2079 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2080 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2081 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2082 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2083 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2084 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2085 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2086 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2087 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2088 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2089 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2090 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2091 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2092 static PyObject *__pyx_int_0;
2093 static PyObject *__pyx_int_1;
2094 static PyObject *__pyx_int_neg_1;
2095 static PyObject *__pyx_codeobj_;
2096 static PyObject *__pyx_tuple__5;
2097 static PyObject *__pyx_tuple__7;
2098 static PyObject *__pyx_slice__21;
2099 static PyObject *__pyx_slice__24;
2100 static PyObject *__pyx_slice__50;
2101 static PyObject *__pyx_tuple__10;
2102 static PyObject *__pyx_tuple__12;
2103 static PyObject *__pyx_tuple__14;
2104 static PyObject *__pyx_tuple__15;
2105 static PyObject *__pyx_tuple__17;
2106 static PyObject *__pyx_tuple__20;
2107 static PyObject *__pyx_tuple__27;
2108 static PyObject *__pyx_tuple__30;
2109 static PyObject *__pyx_tuple__33;
2110 static PyObject *__pyx_tuple__37;
2111 static PyObject *__pyx_tuple__39;
2112 static PyObject *__pyx_tuple__43;
2113 static PyObject *__pyx_tuple__44;
2114 static PyObject *__pyx_tuple__45;
2115 static PyObject *__pyx_tuple__46;
2116 static PyObject *__pyx_tuple__47;
2117 static PyObject *__pyx_tuple__49;
2118 static PyObject *__pyx_tuple__52;
2119 static PyObject *__pyx_tuple__53;
2120 static PyObject *__pyx_tuple__54;
2121 static PyObject *__pyx_tuple__55;
2122 static PyObject *__pyx_tuple__56;
2123 static PyObject *__pyx_tuple__57;
2124 static PyObject *__pyx_tuple__58;
2125 static PyObject *__pyx_tuple__60;
2126 static PyObject *__pyx_tuple__62;
2127 static PyObject *__pyx_tuple__64;
2128 static PyObject *__pyx_tuple__66;
2129 static PyObject *__pyx_tuple__68;
2130 static PyObject *__pyx_tuple__74;
2131 static PyObject *__pyx_tuple__76;
2132 static PyObject *__pyx_tuple__78;
2133 static PyObject *__pyx_tuple__79;
2134 static PyObject *__pyx_tuple__81;
2135 static PyObject *__pyx_tuple__82;
2136 static PyObject *__pyx_tuple__84;
2137 static PyObject *__pyx_tuple__85;
2138 static PyObject *__pyx_tuple__87;
2139 static PyObject *__pyx_codeobj__8;
2140 static PyObject *__pyx_codeobj__11;
2141 static PyObject *__pyx_codeobj__13;
2142 static PyObject *__pyx_codeobj__16;
2143 static PyObject *__pyx_codeobj__18;
2144 static PyObject *__pyx_codeobj__28;
2145 static PyObject *__pyx_codeobj__31;
2146 static PyObject *__pyx_codeobj__34;
2147 static PyObject *__pyx_codeobj__38;
2148 static PyObject *__pyx_codeobj__40;
2149 static PyObject *__pyx_codeobj__48;
2150 static PyObject *__pyx_codeobj__59;
2151 static PyObject *__pyx_codeobj__61;
2152 static PyObject *__pyx_codeobj__63;
2153 static PyObject *__pyx_codeobj__65;
2154 static PyObject *__pyx_codeobj__67;
2155 static PyObject *__pyx_codeobj__69;
2156 static PyObject *__pyx_codeobj__75;
2157 static PyObject *__pyx_codeobj__77;
2158 static PyObject *__pyx_codeobj__80;
2159 static PyObject *__pyx_codeobj__83;
2160 static PyObject *__pyx_codeobj__86;
2162 static PyObject *__pyx_gb_4lxml_12_elementpath_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
2164 /* "lxml/_elementpath.py":74
2167 * def xpath_tokenizer(pattern, namespaces=None): # <<<<<<<<<<<<<<
2168 * # ElementTree uses '', lxml used None originally.
2169 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
2172 /* Python wrapper */
2173 static PyObject *__pyx_pw_4lxml_12_elementpath_1xpath_tokenizer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2174 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_1xpath_tokenizer = {"xpath_tokenizer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_1xpath_tokenizer, METH_VARARGS|METH_KEYWORDS, 0};
2175 static PyObject *__pyx_pw_4lxml_12_elementpath_1xpath_tokenizer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2176 PyObject *__pyx_v_pattern = 0;
2177 PyObject *__pyx_v_namespaces = 0;
2178 int __pyx_lineno = 0;
2179 const char *__pyx_filename = NULL;
2180 int __pyx_clineno = 0;
2181 PyObject *__pyx_r = 0;
2182 __Pyx_RefNannyDeclarations
2183 __Pyx_RefNannySetupContext("xpath_tokenizer (wrapper)", 0);
2185 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pattern,&__pyx_n_s_namespaces,0};
2186 PyObject* values[2] = {0,0};
2187 values[1] = ((PyObject *)((PyObject *)Py_None));
2188 if (unlikely(__pyx_kwds)) {
2190 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2192 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2194 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2197 default: goto __pyx_L5_argtuple_error;
2199 kw_args = PyDict_Size(__pyx_kwds);
2202 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
2203 else goto __pyx_L5_argtuple_error;
2207 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
2208 if (value) { values[1] = value; kw_args--; }
2211 if (unlikely(kw_args > 0)) {
2212 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "xpath_tokenizer") < 0)) __PYX_ERR(0, 74, __pyx_L3_error)
2215 switch (PyTuple_GET_SIZE(__pyx_args)) {
2216 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2218 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2220 default: goto __pyx_L5_argtuple_error;
2223 __pyx_v_pattern = values[0];
2224 __pyx_v_namespaces = values[1];
2226 goto __pyx_L4_argument_unpacking_done;
2227 __pyx_L5_argtuple_error:;
2228 __Pyx_RaiseArgtupleInvalid("xpath_tokenizer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
2230 __Pyx_AddTraceback("lxml._elementpath.xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
2231 __Pyx_RefNannyFinishContext();
2233 __pyx_L4_argument_unpacking_done:;
2234 __pyx_r = __pyx_pf_4lxml_12_elementpath_xpath_tokenizer(__pyx_self, __pyx_v_pattern, __pyx_v_namespaces);
2236 /* function exit code */
2237 __Pyx_RefNannyFinishContext();
2241 static PyObject *__pyx_pf_4lxml_12_elementpath_xpath_tokenizer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pattern, PyObject *__pyx_v_namespaces) {
2242 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *__pyx_cur_scope;
2243 PyObject *__pyx_r = NULL;
2244 __Pyx_RefNannyDeclarations
2245 int __pyx_lineno = 0;
2246 const char *__pyx_filename = NULL;
2247 int __pyx_clineno = 0;
2248 __Pyx_RefNannySetupContext("xpath_tokenizer", 0);
2249 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, __pyx_empty_tuple, NULL);
2250 if (unlikely(!__pyx_cur_scope)) {
2251 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)Py_None);
2252 __Pyx_INCREF(Py_None);
2253 __PYX_ERR(0, 74, __pyx_L1_error)
2255 __Pyx_GOTREF(__pyx_cur_scope);
2257 __pyx_cur_scope->__pyx_v_pattern = __pyx_v_pattern;
2258 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pattern);
2259 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pattern);
2260 __pyx_cur_scope->__pyx_v_namespaces = __pyx_v_namespaces;
2261 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_namespaces);
2262 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_namespaces);
2264 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_xpath_tokenizer, __pyx_n_s_xpath_tokenizer, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 74, __pyx_L1_error)
2265 __Pyx_DECREF(__pyx_cur_scope);
2266 __Pyx_RefNannyFinishContext();
2267 return (PyObject *) gen;
2270 /* function exit code */
2272 __Pyx_AddTraceback("lxml._elementpath.xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
2274 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2275 __Pyx_XGIVEREF(__pyx_r);
2276 __Pyx_RefNannyFinishContext();
2280 static PyObject *__pyx_gb_4lxml_12_elementpath_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
2282 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)__pyx_generator->closure);
2283 PyObject *__pyx_r = NULL;
2284 PyObject *__pyx_t_1 = NULL;
2286 PyObject *__pyx_t_3 = NULL;
2287 PyObject *__pyx_t_4 = NULL;
2288 PyObject *__pyx_t_5 = NULL;
2289 PyObject *__pyx_t_6 = NULL;
2291 Py_ssize_t __pyx_t_8;
2292 PyObject *(*__pyx_t_9)(PyObject *);
2293 PyObject *(*__pyx_t_10)(PyObject *);
2294 PyObject *__pyx_t_11 = NULL;
2295 PyObject *__pyx_t_12 = NULL;
2296 PyObject *__pyx_t_13 = NULL;
2298 PyObject *__pyx_t_15 = NULL;
2300 int __pyx_lineno = 0;
2301 const char *__pyx_filename = NULL;
2302 int __pyx_clineno = 0;
2303 __Pyx_RefNannyDeclarations
2304 __Pyx_RefNannySetupContext("xpath_tokenizer", 0);
2305 switch (__pyx_generator->resume_label) {
2306 case 0: goto __pyx_L3_first_run;
2307 case 1: goto __pyx_L25_resume_from_yield;
2308 case 2: goto __pyx_L30_resume_from_yield;
2309 case 3: goto __pyx_L31_resume_from_yield;
2310 case 4: goto __pyx_L32_resume_from_yield;
2311 default: /* CPython raises the right error here */
2312 __Pyx_RefNannyFinishContext();
2315 __pyx_L3_first_run:;
2316 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 74, __pyx_L1_error)
2318 /* "lxml/_elementpath.py":76
2319 * def xpath_tokenizer(pattern, namespaces=None):
2320 * # ElementTree uses '', lxml used None originally.
2321 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None # <<<<<<<<<<<<<<
2322 * parsing_attribute = False
2323 * for token in xpath_tokenizer_re.findall(pattern):
2325 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_namespaces); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 76, __pyx_L1_error)
2327 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_namespaces, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
2328 __Pyx_GOTREF(__pyx_t_5);
2330 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2331 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
2332 if (likely(__pyx_t_6)) {
2333 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2334 __Pyx_INCREF(__pyx_t_6);
2335 __Pyx_INCREF(function);
2336 __Pyx_DECREF_SET(__pyx_t_5, function);
2339 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, Py_None) : __Pyx_PyObject_CallOneArg(__pyx_t_5, Py_None);
2340 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2341 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
2342 __Pyx_GOTREF(__pyx_t_4);
2343 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2344 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 76, __pyx_L1_error)
2346 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2348 __Pyx_INCREF(__pyx_t_4);
2349 __pyx_t_3 = __pyx_t_4;
2350 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2351 goto __pyx_L4_bool_binop_done;
2353 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_namespaces, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
2354 __Pyx_GOTREF(__pyx_t_5);
2356 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2357 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
2358 if (likely(__pyx_t_6)) {
2359 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2360 __Pyx_INCREF(__pyx_t_6);
2361 __Pyx_INCREF(function);
2362 __Pyx_DECREF_SET(__pyx_t_5, function);
2365 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s__2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__2);
2366 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2367 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
2368 __Pyx_GOTREF(__pyx_t_4);
2369 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2370 __Pyx_INCREF(__pyx_t_4);
2371 __pyx_t_3 = __pyx_t_4;
2372 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2373 __pyx_L4_bool_binop_done:;
2374 __pyx_t_1 = __pyx_t_3;
2377 __Pyx_INCREF(Py_None);
2378 __pyx_t_1 = Py_None;
2380 __Pyx_GIVEREF(__pyx_t_1);
2381 __pyx_cur_scope->__pyx_v_default_namespace = __pyx_t_1;
2384 /* "lxml/_elementpath.py":77
2385 * # ElementTree uses '', lxml used None originally.
2386 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
2387 * parsing_attribute = False # <<<<<<<<<<<<<<
2388 * for token in xpath_tokenizer_re.findall(pattern):
2389 * ttype, tag = token
2391 __Pyx_INCREF(Py_False);
2392 __Pyx_GIVEREF(Py_False);
2393 __pyx_cur_scope->__pyx_v_parsing_attribute = Py_False;
2395 /* "lxml/_elementpath.py":78
2396 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
2397 * parsing_attribute = False
2398 * for token in xpath_tokenizer_re.findall(pattern): # <<<<<<<<<<<<<<
2399 * ttype, tag = token
2400 * if tag and tag[0] != "{":
2402 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_xpath_tokenizer_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
2403 __Pyx_GOTREF(__pyx_t_3);
2404 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_findall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
2405 __Pyx_GOTREF(__pyx_t_4);
2406 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2408 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
2409 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
2410 if (likely(__pyx_t_3)) {
2411 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
2412 __Pyx_INCREF(__pyx_t_3);
2413 __Pyx_INCREF(function);
2414 __Pyx_DECREF_SET(__pyx_t_4, function);
2417 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_pattern) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_pattern);
2418 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2419 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2420 __Pyx_GOTREF(__pyx_t_1);
2421 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2422 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2423 __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
2426 __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
2427 __Pyx_GOTREF(__pyx_t_4);
2428 __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 78, __pyx_L1_error)
2430 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2432 if (likely(!__pyx_t_9)) {
2433 if (likely(PyList_CheckExact(__pyx_t_4))) {
2434 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
2435 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2436 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 78, __pyx_L1_error)
2438 __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2439 __Pyx_GOTREF(__pyx_t_1);
2442 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
2443 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2444 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 78, __pyx_L1_error)
2446 __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2447 __Pyx_GOTREF(__pyx_t_1);
2451 __pyx_t_1 = __pyx_t_9(__pyx_t_4);
2452 if (unlikely(!__pyx_t_1)) {
2453 PyObject* exc_type = PyErr_Occurred();
2455 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2456 else __PYX_ERR(0, 78, __pyx_L1_error)
2460 __Pyx_GOTREF(__pyx_t_1);
2462 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_token);
2463 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_token, __pyx_t_1);
2464 __Pyx_GIVEREF(__pyx_t_1);
2467 /* "lxml/_elementpath.py":79
2468 * parsing_attribute = False
2469 * for token in xpath_tokenizer_re.findall(pattern):
2470 * ttype, tag = token # <<<<<<<<<<<<<<
2471 * if tag and tag[0] != "{":
2474 if ((likely(PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_token))) || (PyList_CheckExact(__pyx_cur_scope->__pyx_v_token))) {
2475 PyObject* sequence = __pyx_cur_scope->__pyx_v_token;
2476 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2477 if (unlikely(size != 2)) {
2478 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2479 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2480 __PYX_ERR(0, 79, __pyx_L1_error)
2482 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2483 if (likely(PyTuple_CheckExact(sequence))) {
2484 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
2485 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
2487 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
2488 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
2490 __Pyx_INCREF(__pyx_t_1);
2491 __Pyx_INCREF(__pyx_t_3);
2493 __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
2494 __Pyx_GOTREF(__pyx_t_1);
2495 __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
2496 __Pyx_GOTREF(__pyx_t_3);
2499 Py_ssize_t index = -1;
2500 __pyx_t_5 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_token); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
2501 __Pyx_GOTREF(__pyx_t_5);
2502 __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext;
2503 index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
2504 __Pyx_GOTREF(__pyx_t_1);
2505 index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
2506 __Pyx_GOTREF(__pyx_t_3);
2507 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_5), 2) < 0) __PYX_ERR(0, 79, __pyx_L1_error)
2509 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2510 goto __pyx_L9_unpacking_done;
2511 __pyx_L8_unpacking_failed:;
2512 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2514 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2515 __PYX_ERR(0, 79, __pyx_L1_error)
2516 __pyx_L9_unpacking_done:;
2518 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ttype);
2519 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ttype, __pyx_t_1);
2520 __Pyx_GIVEREF(__pyx_t_1);
2522 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_tag);
2523 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_tag, __pyx_t_3);
2524 __Pyx_GIVEREF(__pyx_t_3);
2527 /* "lxml/_elementpath.py":80
2528 * for token in xpath_tokenizer_re.findall(pattern):
2529 * ttype, tag = token
2530 * if tag and tag[0] != "{": # <<<<<<<<<<<<<<
2532 * prefix, uri = tag.split(":", 1)
2534 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_tag); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 80, __pyx_L1_error)
2537 __pyx_t_2 = __pyx_t_7;
2538 goto __pyx_L11_bool_binop_done;
2540 __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_tag, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
2541 __Pyx_GOTREF(__pyx_t_3);
2542 __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s__3, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 80, __pyx_L1_error)
2543 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2544 __pyx_t_2 = __pyx_t_7;
2545 __pyx_L11_bool_binop_done:;
2548 /* "lxml/_elementpath.py":81
2549 * ttype, tag = token
2550 * if tag and tag[0] != "{":
2551 * if ":" in tag: # <<<<<<<<<<<<<<
2552 * prefix, uri = tag.split(":", 1)
2555 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__4, __pyx_cur_scope->__pyx_v_tag, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
2556 __pyx_t_7 = (__pyx_t_2 != 0);
2559 /* "lxml/_elementpath.py":82
2560 * if tag and tag[0] != "{":
2562 * prefix, uri = tag.split(":", 1) # <<<<<<<<<<<<<<
2564 * if not namespaces:
2566 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_tag, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
2567 __Pyx_GOTREF(__pyx_t_3);
2568 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
2569 __Pyx_GOTREF(__pyx_t_1);
2570 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2571 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
2572 PyObject* sequence = __pyx_t_1;
2573 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2574 if (unlikely(size != 2)) {
2575 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2576 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2577 __PYX_ERR(0, 82, __pyx_L1_error)
2579 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2580 if (likely(PyTuple_CheckExact(sequence))) {
2581 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
2582 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
2584 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
2585 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
2587 __Pyx_INCREF(__pyx_t_3);
2588 __Pyx_INCREF(__pyx_t_5);
2590 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
2591 __Pyx_GOTREF(__pyx_t_3);
2592 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
2593 __Pyx_GOTREF(__pyx_t_5);
2595 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2597 Py_ssize_t index = -1;
2598 __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
2599 __Pyx_GOTREF(__pyx_t_6);
2600 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2601 __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext;
2602 index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L14_unpacking_failed;
2603 __Pyx_GOTREF(__pyx_t_3);
2604 index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
2605 __Pyx_GOTREF(__pyx_t_5);
2606 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_6), 2) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
2608 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2609 goto __pyx_L15_unpacking_done;
2610 __pyx_L14_unpacking_failed:;
2611 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2613 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2614 __PYX_ERR(0, 82, __pyx_L1_error)
2615 __pyx_L15_unpacking_done:;
2617 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_prefix);
2618 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_prefix, __pyx_t_3);
2619 __Pyx_GIVEREF(__pyx_t_3);
2621 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_uri);
2622 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_uri, __pyx_t_5);
2623 __Pyx_GIVEREF(__pyx_t_5);
2626 /* "lxml/_elementpath.py":83
2628 * prefix, uri = tag.split(":", 1)
2629 * try: # <<<<<<<<<<<<<<
2630 * if not namespaces:
2634 __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
2635 __Pyx_XGOTREF(__pyx_t_11);
2636 __Pyx_XGOTREF(__pyx_t_12);
2637 __Pyx_XGOTREF(__pyx_t_13);
2640 /* "lxml/_elementpath.py":84
2641 * prefix, uri = tag.split(":", 1)
2643 * if not namespaces: # <<<<<<<<<<<<<<
2645 * yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2647 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_namespaces); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 84, __pyx_L16_error)
2648 __pyx_t_2 = ((!__pyx_t_7) != 0);
2649 if (unlikely(__pyx_t_2)) {
2651 /* "lxml/_elementpath.py":85
2653 * if not namespaces:
2654 * raise KeyError # <<<<<<<<<<<<<<
2655 * yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2658 __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
2659 __PYX_ERR(0, 85, __pyx_L16_error)
2661 /* "lxml/_elementpath.py":84
2662 * prefix, uri = tag.split(":", 1)
2664 * if not namespaces: # <<<<<<<<<<<<<<
2666 * yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2670 /* "lxml/_elementpath.py":86
2671 * if not namespaces:
2673 * yield ttype, "{%s}%s" % (namespaces[prefix], uri) # <<<<<<<<<<<<<<
2675 * raise SyntaxError("prefix %r not found in prefix map" % prefix)
2677 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_namespaces, __pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L16_error)
2678 __Pyx_GOTREF(__pyx_t_1);
2679 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L16_error)
2680 __Pyx_GOTREF(__pyx_t_5);
2681 __Pyx_GIVEREF(__pyx_t_1);
2682 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
2683 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_uri);
2684 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_uri);
2685 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_uri);
2687 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L16_error)
2688 __Pyx_GOTREF(__pyx_t_1);
2689 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2690 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L16_error)
2691 __Pyx_GOTREF(__pyx_t_5);
2692 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ttype);
2693 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ttype);
2694 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_ttype);
2695 __Pyx_GIVEREF(__pyx_t_1);
2696 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
2698 __pyx_r = __pyx_t_5;
2700 __Pyx_XGIVEREF(__pyx_t_4);
2701 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
2702 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
2703 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
2704 __Pyx_XGIVEREF(__pyx_t_11);
2705 __pyx_cur_scope->__pyx_t_3 = __pyx_t_11;
2706 __Pyx_XGIVEREF(__pyx_t_12);
2707 __pyx_cur_scope->__pyx_t_4 = __pyx_t_12;
2708 __Pyx_XGIVEREF(__pyx_t_13);
2709 __pyx_cur_scope->__pyx_t_5 = __pyx_t_13;
2710 __Pyx_XGIVEREF(__pyx_r);
2711 __Pyx_RefNannyFinishContext();
2712 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2713 /* return from generator, yielding value */
2714 __pyx_generator->resume_label = 1;
2716 __pyx_L25_resume_from_yield:;
2717 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
2718 __pyx_cur_scope->__pyx_t_0 = 0;
2719 __Pyx_XGOTREF(__pyx_t_4);
2720 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
2721 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
2722 __pyx_t_11 = __pyx_cur_scope->__pyx_t_3;
2723 __pyx_cur_scope->__pyx_t_3 = 0;
2724 __Pyx_XGOTREF(__pyx_t_11);
2725 __pyx_t_12 = __pyx_cur_scope->__pyx_t_4;
2726 __pyx_cur_scope->__pyx_t_4 = 0;
2727 __Pyx_XGOTREF(__pyx_t_12);
2728 __pyx_t_13 = __pyx_cur_scope->__pyx_t_5;
2729 __pyx_cur_scope->__pyx_t_5 = 0;
2730 __Pyx_XGOTREF(__pyx_t_13);
2731 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 86, __pyx_L16_error)
2733 /* "lxml/_elementpath.py":83
2735 * prefix, uri = tag.split(":", 1)
2736 * try: # <<<<<<<<<<<<<<
2737 * if not namespaces:
2741 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
2742 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
2743 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2744 goto __pyx_L23_try_end;
2746 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2747 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2748 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2749 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2751 /* "lxml/_elementpath.py":87
2753 * yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2754 * except KeyError: # <<<<<<<<<<<<<<
2755 * raise SyntaxError("prefix %r not found in prefix map" % prefix)
2756 * elif default_namespace and not parsing_attribute:
2758 __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
2760 __Pyx_AddTraceback("lxml._elementpath.xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
2761 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 87, __pyx_L18_except_error)
2762 __Pyx_GOTREF(__pyx_t_5);
2763 __Pyx_GOTREF(__pyx_t_1);
2764 __Pyx_GOTREF(__pyx_t_3);
2766 /* "lxml/_elementpath.py":88
2767 * yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2769 * raise SyntaxError("prefix %r not found in prefix map" % prefix) # <<<<<<<<<<<<<<
2770 * elif default_namespace and not parsing_attribute:
2771 * yield ttype, "{%s}%s" % (default_namespace, tag)
2773 __pyx_t_6 = __Pyx_PyString_FormatSafe(__pyx_kp_s_prefix_r_not_found_in_prefix_map, __pyx_cur_scope->__pyx_v_prefix); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L18_except_error)
2774 __Pyx_GOTREF(__pyx_t_6);
2775 __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_SyntaxError, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 88, __pyx_L18_except_error)
2776 __Pyx_GOTREF(__pyx_t_15);
2777 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2778 __Pyx_Raise(__pyx_t_15, 0, 0, 0);
2779 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
2780 __PYX_ERR(0, 88, __pyx_L18_except_error)
2782 goto __pyx_L18_except_error;
2783 __pyx_L18_except_error:;
2785 /* "lxml/_elementpath.py":83
2787 * prefix, uri = tag.split(":", 1)
2788 * try: # <<<<<<<<<<<<<<
2789 * if not namespaces:
2792 __Pyx_XGIVEREF(__pyx_t_11);
2793 __Pyx_XGIVEREF(__pyx_t_12);
2794 __Pyx_XGIVEREF(__pyx_t_13);
2795 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
2796 goto __pyx_L1_error;
2800 /* "lxml/_elementpath.py":81
2801 * ttype, tag = token
2802 * if tag and tag[0] != "{":
2803 * if ":" in tag: # <<<<<<<<<<<<<<
2804 * prefix, uri = tag.split(":", 1)
2810 /* "lxml/_elementpath.py":89
2812 * raise SyntaxError("prefix %r not found in prefix map" % prefix)
2813 * elif default_namespace and not parsing_attribute: # <<<<<<<<<<<<<<
2814 * yield ttype, "{%s}%s" % (default_namespace, tag)
2817 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_default_namespace); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
2820 __pyx_t_2 = __pyx_t_7;
2821 goto __pyx_L28_bool_binop_done;
2823 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_parsing_attribute); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
2824 __pyx_t_16 = ((!__pyx_t_7) != 0);
2825 __pyx_t_2 = __pyx_t_16;
2826 __pyx_L28_bool_binop_done:;
2829 /* "lxml/_elementpath.py":90
2830 * raise SyntaxError("prefix %r not found in prefix map" % prefix)
2831 * elif default_namespace and not parsing_attribute:
2832 * yield ttype, "{%s}%s" % (default_namespace, tag) # <<<<<<<<<<<<<<
2836 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
2837 __Pyx_GOTREF(__pyx_t_3);
2838 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_default_namespace);
2839 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_default_namespace);
2840 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_default_namespace);
2841 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tag);
2842 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tag);
2843 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_tag);
2844 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
2845 __Pyx_GOTREF(__pyx_t_1);
2846 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2847 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
2848 __Pyx_GOTREF(__pyx_t_3);
2849 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ttype);
2850 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ttype);
2851 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_ttype);
2852 __Pyx_GIVEREF(__pyx_t_1);
2853 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
2855 __pyx_r = __pyx_t_3;
2857 __Pyx_XGIVEREF(__pyx_t_4);
2858 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
2859 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
2860 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
2861 __Pyx_XGIVEREF(__pyx_r);
2862 __Pyx_RefNannyFinishContext();
2863 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2864 /* return from generator, yielding value */
2865 __pyx_generator->resume_label = 2;
2867 __pyx_L30_resume_from_yield:;
2868 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
2869 __pyx_cur_scope->__pyx_t_0 = 0;
2870 __Pyx_XGOTREF(__pyx_t_4);
2871 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
2872 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
2873 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 90, __pyx_L1_error)
2875 /* "lxml/_elementpath.py":89
2877 * raise SyntaxError("prefix %r not found in prefix map" % prefix)
2878 * elif default_namespace and not parsing_attribute: # <<<<<<<<<<<<<<
2879 * yield ttype, "{%s}%s" % (default_namespace, tag)
2885 /* "lxml/_elementpath.py":92
2886 * yield ttype, "{%s}%s" % (default_namespace, tag)
2888 * yield token # <<<<<<<<<<<<<<
2889 * parsing_attribute = False
2893 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token);
2894 __pyx_r = __pyx_cur_scope->__pyx_v_token;
2895 __Pyx_XGIVEREF(__pyx_t_4);
2896 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
2897 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
2898 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
2899 __Pyx_XGIVEREF(__pyx_r);
2900 __Pyx_RefNannyFinishContext();
2901 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2902 /* return from generator, yielding value */
2903 __pyx_generator->resume_label = 3;
2905 __pyx_L31_resume_from_yield:;
2906 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
2907 __pyx_cur_scope->__pyx_t_0 = 0;
2908 __Pyx_XGOTREF(__pyx_t_4);
2909 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
2910 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
2911 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 92, __pyx_L1_error)
2915 /* "lxml/_elementpath.py":93
2918 * parsing_attribute = False # <<<<<<<<<<<<<<
2922 __Pyx_INCREF(Py_False);
2923 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_parsing_attribute);
2924 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_parsing_attribute, Py_False);
2925 __Pyx_GIVEREF(Py_False);
2927 /* "lxml/_elementpath.py":80
2928 * for token in xpath_tokenizer_re.findall(pattern):
2929 * ttype, tag = token
2930 * if tag and tag[0] != "{": # <<<<<<<<<<<<<<
2932 * prefix, uri = tag.split(":", 1)
2937 /* "lxml/_elementpath.py":95
2938 * parsing_attribute = False
2940 * yield token # <<<<<<<<<<<<<<
2941 * parsing_attribute = ttype == '@'
2945 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_token);
2946 __pyx_r = __pyx_cur_scope->__pyx_v_token;
2947 __Pyx_XGIVEREF(__pyx_t_4);
2948 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
2949 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
2950 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
2951 __Pyx_XGIVEREF(__pyx_r);
2952 __Pyx_RefNannyFinishContext();
2953 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2954 /* return from generator, yielding value */
2955 __pyx_generator->resume_label = 4;
2957 __pyx_L32_resume_from_yield:;
2958 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
2959 __pyx_cur_scope->__pyx_t_0 = 0;
2960 __Pyx_XGOTREF(__pyx_t_4);
2961 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
2962 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
2963 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 95, __pyx_L1_error)
2965 /* "lxml/_elementpath.py":96
2968 * parsing_attribute = ttype == '@' # <<<<<<<<<<<<<<
2972 __pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_ttype, __pyx_kp_s__6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
2973 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_parsing_attribute);
2974 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_parsing_attribute, __pyx_t_3);
2975 __Pyx_GIVEREF(__pyx_t_3);
2980 /* "lxml/_elementpath.py":78
2981 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
2982 * parsing_attribute = False
2983 * for token in xpath_tokenizer_re.findall(pattern): # <<<<<<<<<<<<<<
2984 * ttype, tag = token
2985 * if tag and tag[0] != "{":
2988 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2989 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
2991 /* "lxml/_elementpath.py":74
2994 * def xpath_tokenizer(pattern, namespaces=None): # <<<<<<<<<<<<<<
2995 * # ElementTree uses '', lxml used None originally.
2996 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
2999 /* function exit code */
3000 PyErr_SetNone(PyExc_StopIteration);
3003 __Pyx_XDECREF(__pyx_t_1);
3004 __Pyx_XDECREF(__pyx_t_3);
3005 __Pyx_XDECREF(__pyx_t_4);
3006 __Pyx_XDECREF(__pyx_t_5);
3007 __Pyx_XDECREF(__pyx_t_6);
3008 __Pyx_XDECREF(__pyx_t_15);
3009 __Pyx_AddTraceback("xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
3011 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3012 #if !CYTHON_USE_EXC_INFO_STACK
3013 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3015 __pyx_generator->resume_label = -1;
3016 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3017 __Pyx_RefNannyFinishContext();
3021 /* "lxml/_elementpath.py":99
3024 * def prepare_child(next, token): # <<<<<<<<<<<<<<
3026 * def select(result):
3029 /* Python wrapper */
3030 static PyObject *__pyx_pw_4lxml_12_elementpath_4prepare_child(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3031 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_4prepare_child = {"prepare_child", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_4prepare_child, METH_VARARGS|METH_KEYWORDS, 0};
3032 static PyObject *__pyx_pw_4lxml_12_elementpath_4prepare_child(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3033 CYTHON_UNUSED PyObject *__pyx_v_next = 0;
3034 PyObject *__pyx_v_token = 0;
3035 int __pyx_lineno = 0;
3036 const char *__pyx_filename = NULL;
3037 int __pyx_clineno = 0;
3038 PyObject *__pyx_r = 0;
3039 __Pyx_RefNannyDeclarations
3040 __Pyx_RefNannySetupContext("prepare_child (wrapper)", 0);
3042 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
3043 PyObject* values[2] = {0,0};
3044 if (unlikely(__pyx_kwds)) {
3046 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3048 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3050 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3053 default: goto __pyx_L5_argtuple_error;
3055 kw_args = PyDict_Size(__pyx_kwds);
3058 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3059 else goto __pyx_L5_argtuple_error;
3062 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3064 __Pyx_RaiseArgtupleInvalid("prepare_child", 1, 2, 2, 1); __PYX_ERR(0, 99, __pyx_L3_error)
3067 if (unlikely(kw_args > 0)) {
3068 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_child") < 0)) __PYX_ERR(0, 99, __pyx_L3_error)
3070 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3071 goto __pyx_L5_argtuple_error;
3073 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3074 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3076 __pyx_v_next = values[0];
3077 __pyx_v_token = values[1];
3079 goto __pyx_L4_argument_unpacking_done;
3080 __pyx_L5_argtuple_error:;
3081 __Pyx_RaiseArgtupleInvalid("prepare_child", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 99, __pyx_L3_error)
3083 __Pyx_AddTraceback("lxml._elementpath.prepare_child", __pyx_clineno, __pyx_lineno, __pyx_filename);
3084 __Pyx_RefNannyFinishContext();
3086 __pyx_L4_argument_unpacking_done:;
3087 __pyx_r = __pyx_pf_4lxml_12_elementpath_3prepare_child(__pyx_self, __pyx_v_next, __pyx_v_token);
3089 /* function exit code */
3090 __Pyx_RefNannyFinishContext();
3093 static PyObject *__pyx_gb_4lxml_12_elementpath_13prepare_child_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
3095 /* "lxml/_elementpath.py":101
3096 * def prepare_child(next, token):
3098 * def select(result): # <<<<<<<<<<<<<<
3099 * for elem in result:
3100 * for e in elem.iterchildren(tag):
3103 /* Python wrapper */
3104 static PyObject *__pyx_pw_4lxml_12_elementpath_13prepare_child_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
3105 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_13prepare_child_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_13prepare_child_1select, METH_O, 0};
3106 static PyObject *__pyx_pw_4lxml_12_elementpath_13prepare_child_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
3107 PyObject *__pyx_r = 0;
3108 __Pyx_RefNannyDeclarations
3109 __Pyx_RefNannySetupContext("select (wrapper)", 0);
3110 __pyx_r = __pyx_pf_4lxml_12_elementpath_13prepare_child_select(__pyx_self, ((PyObject *)__pyx_v_result));
3112 /* function exit code */
3113 __Pyx_RefNannyFinishContext();
3117 static PyObject *__pyx_pf_4lxml_12_elementpath_13prepare_child_select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
3118 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *__pyx_cur_scope;
3119 PyObject *__pyx_r = NULL;
3120 __Pyx_RefNannyDeclarations
3121 int __pyx_lineno = 0;
3122 const char *__pyx_filename = NULL;
3123 int __pyx_clineno = 0;
3124 __Pyx_RefNannySetupContext("select", 0);
3125 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_2_select, __pyx_empty_tuple, NULL);
3126 if (unlikely(!__pyx_cur_scope)) {
3127 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)Py_None);
3128 __Pyx_INCREF(Py_None);
3129 __PYX_ERR(0, 101, __pyx_L1_error)
3131 __Pyx_GOTREF(__pyx_cur_scope);
3133 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *) __Pyx_CyFunction_GetClosure(__pyx_self);
3134 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
3135 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
3136 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
3137 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
3138 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
3140 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_13prepare_child_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_child_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 101, __pyx_L1_error)
3141 __Pyx_DECREF(__pyx_cur_scope);
3142 __Pyx_RefNannyFinishContext();
3143 return (PyObject *) gen;
3146 /* function exit code */
3148 __Pyx_AddTraceback("lxml._elementpath.prepare_child.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3150 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3151 __Pyx_XGIVEREF(__pyx_r);
3152 __Pyx_RefNannyFinishContext();
3156 static PyObject *__pyx_gb_4lxml_12_elementpath_13prepare_child_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
3158 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)__pyx_generator->closure);
3159 PyObject *__pyx_r = NULL;
3160 PyObject *__pyx_t_1 = NULL;
3161 Py_ssize_t __pyx_t_2;
3162 PyObject *(*__pyx_t_3)(PyObject *);
3163 PyObject *__pyx_t_4 = NULL;
3164 PyObject *__pyx_t_5 = NULL;
3165 PyObject *__pyx_t_6 = NULL;
3166 Py_ssize_t __pyx_t_7;
3167 PyObject *(*__pyx_t_8)(PyObject *);
3168 int __pyx_lineno = 0;
3169 const char *__pyx_filename = NULL;
3170 int __pyx_clineno = 0;
3171 __Pyx_RefNannyDeclarations
3172 __Pyx_RefNannySetupContext("select", 0);
3173 switch (__pyx_generator->resume_label) {
3174 case 0: goto __pyx_L3_first_run;
3175 case 1: goto __pyx_L8_resume_from_yield;
3176 default: /* CPython raises the right error here */
3177 __Pyx_RefNannyFinishContext();
3180 __pyx_L3_first_run:;
3181 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 101, __pyx_L1_error)
3183 /* "lxml/_elementpath.py":102
3185 * def select(result):
3186 * for elem in result: # <<<<<<<<<<<<<<
3187 * for e in elem.iterchildren(tag):
3190 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
3191 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
3194 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
3195 __Pyx_GOTREF(__pyx_t_1);
3196 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
3199 if (likely(!__pyx_t_3)) {
3200 if (likely(PyList_CheckExact(__pyx_t_1))) {
3201 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
3202 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3203 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 102, __pyx_L1_error)
3205 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
3206 __Pyx_GOTREF(__pyx_t_4);
3209 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3210 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3211 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 102, __pyx_L1_error)
3213 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
3214 __Pyx_GOTREF(__pyx_t_4);
3218 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
3219 if (unlikely(!__pyx_t_4)) {
3220 PyObject* exc_type = PyErr_Occurred();
3222 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3223 else __PYX_ERR(0, 102, __pyx_L1_error)
3227 __Pyx_GOTREF(__pyx_t_4);
3229 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
3230 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
3231 __Pyx_GIVEREF(__pyx_t_4);
3234 /* "lxml/_elementpath.py":103
3235 * def select(result):
3236 * for elem in result:
3237 * for e in elem.iterchildren(tag): # <<<<<<<<<<<<<<
3241 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error)
3242 __Pyx_GOTREF(__pyx_t_5);
3243 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag)) { __Pyx_RaiseClosureNameError("tag"); __PYX_ERR(0, 103, __pyx_L1_error) }
3245 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
3246 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3247 if (likely(__pyx_t_6)) {
3248 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3249 __Pyx_INCREF(__pyx_t_6);
3250 __Pyx_INCREF(function);
3251 __Pyx_DECREF_SET(__pyx_t_5, function);
3254 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag);
3255 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3256 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
3257 __Pyx_GOTREF(__pyx_t_4);
3258 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3259 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
3260 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
3263 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error)
3264 __Pyx_GOTREF(__pyx_t_5);
3265 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L1_error)
3267 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3269 if (likely(!__pyx_t_8)) {
3270 if (likely(PyList_CheckExact(__pyx_t_5))) {
3271 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
3272 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3273 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 103, __pyx_L1_error)
3275 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
3276 __Pyx_GOTREF(__pyx_t_4);
3279 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
3280 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3281 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 103, __pyx_L1_error)
3283 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
3284 __Pyx_GOTREF(__pyx_t_4);
3288 __pyx_t_4 = __pyx_t_8(__pyx_t_5);
3289 if (unlikely(!__pyx_t_4)) {
3290 PyObject* exc_type = PyErr_Occurred();
3292 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3293 else __PYX_ERR(0, 103, __pyx_L1_error)
3297 __Pyx_GOTREF(__pyx_t_4);
3299 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
3300 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4);
3301 __Pyx_GIVEREF(__pyx_t_4);
3304 /* "lxml/_elementpath.py":104
3305 * for elem in result:
3306 * for e in elem.iterchildren(tag):
3307 * yield e # <<<<<<<<<<<<<<
3311 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
3312 __pyx_r = __pyx_cur_scope->__pyx_v_e;
3313 __Pyx_XGIVEREF(__pyx_t_1);
3314 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
3315 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
3316 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
3317 __Pyx_XGIVEREF(__pyx_t_5);
3318 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
3319 __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
3320 __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
3321 __Pyx_XGIVEREF(__pyx_r);
3322 __Pyx_RefNannyFinishContext();
3323 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3324 /* return from generator, yielding value */
3325 __pyx_generator->resume_label = 1;
3327 __pyx_L8_resume_from_yield:;
3328 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
3329 __pyx_cur_scope->__pyx_t_0 = 0;
3330 __Pyx_XGOTREF(__pyx_t_1);
3331 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
3332 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
3333 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
3334 __pyx_cur_scope->__pyx_t_3 = 0;
3335 __Pyx_XGOTREF(__pyx_t_5);
3336 __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
3337 __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
3338 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 104, __pyx_L1_error)
3340 /* "lxml/_elementpath.py":103
3341 * def select(result):
3342 * for elem in result:
3343 * for e in elem.iterchildren(tag): # <<<<<<<<<<<<<<
3348 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3350 /* "lxml/_elementpath.py":102
3352 * def select(result):
3353 * for elem in result: # <<<<<<<<<<<<<<
3354 * for e in elem.iterchildren(tag):
3358 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3359 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
3361 /* "lxml/_elementpath.py":101
3362 * def prepare_child(next, token):
3364 * def select(result): # <<<<<<<<<<<<<<
3365 * for elem in result:
3366 * for e in elem.iterchildren(tag):
3369 /* function exit code */
3370 PyErr_SetNone(PyExc_StopIteration);
3373 __Pyx_XDECREF(__pyx_t_1);
3374 __Pyx_XDECREF(__pyx_t_4);
3375 __Pyx_XDECREF(__pyx_t_5);
3376 __Pyx_XDECREF(__pyx_t_6);
3377 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3379 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3380 #if !CYTHON_USE_EXC_INFO_STACK
3381 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3383 __pyx_generator->resume_label = -1;
3384 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3385 __Pyx_RefNannyFinishContext();
3389 /* "lxml/_elementpath.py":99
3392 * def prepare_child(next, token): # <<<<<<<<<<<<<<
3394 * def select(result):
3397 static PyObject *__pyx_pf_4lxml_12_elementpath_3prepare_child(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, PyObject *__pyx_v_token) {
3398 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *__pyx_cur_scope;
3399 PyObject *__pyx_v_select = 0;
3400 PyObject *__pyx_r = NULL;
3401 __Pyx_RefNannyDeclarations
3402 PyObject *__pyx_t_1 = NULL;
3403 int __pyx_lineno = 0;
3404 const char *__pyx_filename = NULL;
3405 int __pyx_clineno = 0;
3406 __Pyx_RefNannySetupContext("prepare_child", 0);
3407 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, __pyx_empty_tuple, NULL);
3408 if (unlikely(!__pyx_cur_scope)) {
3409 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)Py_None);
3410 __Pyx_INCREF(Py_None);
3411 __PYX_ERR(0, 99, __pyx_L1_error)
3413 __Pyx_GOTREF(__pyx_cur_scope);
3416 /* "lxml/_elementpath.py":100
3418 * def prepare_child(next, token):
3419 * tag = token[1] # <<<<<<<<<<<<<<
3420 * def select(result):
3421 * for elem in result:
3423 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
3424 __Pyx_GOTREF(__pyx_t_1);
3425 __Pyx_GIVEREF(__pyx_t_1);
3426 __pyx_cur_scope->__pyx_v_tag = __pyx_t_1;
3429 /* "lxml/_elementpath.py":101
3430 * def prepare_child(next, token):
3432 * def select(result): # <<<<<<<<<<<<<<
3433 * for elem in result:
3434 * for e in elem.iterchildren(tag):
3436 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_13prepare_child_1select, 0, __pyx_n_s_prepare_child_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
3437 __Pyx_GOTREF(__pyx_t_1);
3438 __pyx_v_select = __pyx_t_1;
3441 /* "lxml/_elementpath.py":105
3442 * for e in elem.iterchildren(tag):
3444 * return select # <<<<<<<<<<<<<<
3446 * def prepare_star(next, token):
3448 __Pyx_XDECREF(__pyx_r);
3449 __Pyx_INCREF(__pyx_v_select);
3450 __pyx_r = __pyx_v_select;
3453 /* "lxml/_elementpath.py":99
3456 * def prepare_child(next, token): # <<<<<<<<<<<<<<
3458 * def select(result):
3461 /* function exit code */
3463 __Pyx_XDECREF(__pyx_t_1);
3464 __Pyx_AddTraceback("lxml._elementpath.prepare_child", __pyx_clineno, __pyx_lineno, __pyx_filename);
3467 __Pyx_XDECREF(__pyx_v_select);
3468 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3469 __Pyx_XGIVEREF(__pyx_r);
3470 __Pyx_RefNannyFinishContext();
3474 /* "lxml/_elementpath.py":107
3477 * def prepare_star(next, token): # <<<<<<<<<<<<<<
3478 * def select(result):
3479 * for elem in result:
3482 /* Python wrapper */
3483 static PyObject *__pyx_pw_4lxml_12_elementpath_6prepare_star(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3484 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_6prepare_star = {"prepare_star", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_6prepare_star, METH_VARARGS|METH_KEYWORDS, 0};
3485 static PyObject *__pyx_pw_4lxml_12_elementpath_6prepare_star(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3486 CYTHON_UNUSED PyObject *__pyx_v_next = 0;
3487 CYTHON_UNUSED PyObject *__pyx_v_token = 0;
3488 int __pyx_lineno = 0;
3489 const char *__pyx_filename = NULL;
3490 int __pyx_clineno = 0;
3491 PyObject *__pyx_r = 0;
3492 __Pyx_RefNannyDeclarations
3493 __Pyx_RefNannySetupContext("prepare_star (wrapper)", 0);
3495 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
3496 PyObject* values[2] = {0,0};
3497 if (unlikely(__pyx_kwds)) {
3499 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3501 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3503 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3506 default: goto __pyx_L5_argtuple_error;
3508 kw_args = PyDict_Size(__pyx_kwds);
3511 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3512 else goto __pyx_L5_argtuple_error;
3515 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3517 __Pyx_RaiseArgtupleInvalid("prepare_star", 1, 2, 2, 1); __PYX_ERR(0, 107, __pyx_L3_error)
3520 if (unlikely(kw_args > 0)) {
3521 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_star") < 0)) __PYX_ERR(0, 107, __pyx_L3_error)
3523 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3524 goto __pyx_L5_argtuple_error;
3526 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3527 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3529 __pyx_v_next = values[0];
3530 __pyx_v_token = values[1];
3532 goto __pyx_L4_argument_unpacking_done;
3533 __pyx_L5_argtuple_error:;
3534 __Pyx_RaiseArgtupleInvalid("prepare_star", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 107, __pyx_L3_error)
3536 __Pyx_AddTraceback("lxml._elementpath.prepare_star", __pyx_clineno, __pyx_lineno, __pyx_filename);
3537 __Pyx_RefNannyFinishContext();
3539 __pyx_L4_argument_unpacking_done:;
3540 __pyx_r = __pyx_pf_4lxml_12_elementpath_5prepare_star(__pyx_self, __pyx_v_next, __pyx_v_token);
3542 /* function exit code */
3543 __Pyx_RefNannyFinishContext();
3546 static PyObject *__pyx_gb_4lxml_12_elementpath_12prepare_star_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
3548 /* "lxml/_elementpath.py":108
3550 * def prepare_star(next, token):
3551 * def select(result): # <<<<<<<<<<<<<<
3552 * for elem in result:
3553 * for e in elem.iterchildren('*'):
3556 /* Python wrapper */
3557 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_star_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
3558 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_12prepare_star_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_12prepare_star_1select, METH_O, 0};
3559 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_star_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
3560 PyObject *__pyx_r = 0;
3561 __Pyx_RefNannyDeclarations
3562 __Pyx_RefNannySetupContext("select (wrapper)", 0);
3563 __pyx_r = __pyx_pf_4lxml_12_elementpath_12prepare_star_select(__pyx_self, ((PyObject *)__pyx_v_result));
3565 /* function exit code */
3566 __Pyx_RefNannyFinishContext();
3570 static PyObject *__pyx_pf_4lxml_12_elementpath_12prepare_star_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result) {
3571 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *__pyx_cur_scope;
3572 PyObject *__pyx_r = NULL;
3573 __Pyx_RefNannyDeclarations
3574 int __pyx_lineno = 0;
3575 const char *__pyx_filename = NULL;
3576 int __pyx_clineno = 0;
3577 __Pyx_RefNannySetupContext("select", 0);
3578 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_3_select, __pyx_empty_tuple, NULL);
3579 if (unlikely(!__pyx_cur_scope)) {
3580 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)Py_None);
3581 __Pyx_INCREF(Py_None);
3582 __PYX_ERR(0, 108, __pyx_L1_error)
3584 __Pyx_GOTREF(__pyx_cur_scope);
3586 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
3587 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
3588 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
3590 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_12prepare_star_2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_star_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 108, __pyx_L1_error)
3591 __Pyx_DECREF(__pyx_cur_scope);
3592 __Pyx_RefNannyFinishContext();
3593 return (PyObject *) gen;
3596 /* function exit code */
3598 __Pyx_AddTraceback("lxml._elementpath.prepare_star.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3600 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3601 __Pyx_XGIVEREF(__pyx_r);
3602 __Pyx_RefNannyFinishContext();
3606 static PyObject *__pyx_gb_4lxml_12_elementpath_12prepare_star_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
3608 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)__pyx_generator->closure);
3609 PyObject *__pyx_r = NULL;
3610 PyObject *__pyx_t_1 = NULL;
3611 Py_ssize_t __pyx_t_2;
3612 PyObject *(*__pyx_t_3)(PyObject *);
3613 PyObject *__pyx_t_4 = NULL;
3614 PyObject *__pyx_t_5 = NULL;
3615 PyObject *__pyx_t_6 = NULL;
3616 Py_ssize_t __pyx_t_7;
3617 PyObject *(*__pyx_t_8)(PyObject *);
3618 int __pyx_lineno = 0;
3619 const char *__pyx_filename = NULL;
3620 int __pyx_clineno = 0;
3621 __Pyx_RefNannyDeclarations
3622 __Pyx_RefNannySetupContext("select", 0);
3623 switch (__pyx_generator->resume_label) {
3624 case 0: goto __pyx_L3_first_run;
3625 case 1: goto __pyx_L8_resume_from_yield;
3626 default: /* CPython raises the right error here */
3627 __Pyx_RefNannyFinishContext();
3630 __pyx_L3_first_run:;
3631 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 108, __pyx_L1_error)
3633 /* "lxml/_elementpath.py":109
3634 * def prepare_star(next, token):
3635 * def select(result):
3636 * for elem in result: # <<<<<<<<<<<<<<
3637 * for e in elem.iterchildren('*'):
3640 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
3641 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
3644 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
3645 __Pyx_GOTREF(__pyx_t_1);
3646 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
3649 if (likely(!__pyx_t_3)) {
3650 if (likely(PyList_CheckExact(__pyx_t_1))) {
3651 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
3652 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3653 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
3655 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
3656 __Pyx_GOTREF(__pyx_t_4);
3659 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3660 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3661 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
3663 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
3664 __Pyx_GOTREF(__pyx_t_4);
3668 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
3669 if (unlikely(!__pyx_t_4)) {
3670 PyObject* exc_type = PyErr_Occurred();
3672 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3673 else __PYX_ERR(0, 109, __pyx_L1_error)
3677 __Pyx_GOTREF(__pyx_t_4);
3679 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
3680 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
3681 __Pyx_GIVEREF(__pyx_t_4);
3684 /* "lxml/_elementpath.py":110
3685 * def select(result):
3686 * for elem in result:
3687 * for e in elem.iterchildren('*'): # <<<<<<<<<<<<<<
3691 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
3692 __Pyx_GOTREF(__pyx_t_5);
3694 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
3695 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3696 if (likely(__pyx_t_6)) {
3697 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3698 __Pyx_INCREF(__pyx_t_6);
3699 __Pyx_INCREF(function);
3700 __Pyx_DECREF_SET(__pyx_t_5, function);
3703 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_s__9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__9);
3704 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3705 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
3706 __Pyx_GOTREF(__pyx_t_4);
3707 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3708 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
3709 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
3712 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
3713 __Pyx_GOTREF(__pyx_t_5);
3714 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error)
3716 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3718 if (likely(!__pyx_t_8)) {
3719 if (likely(PyList_CheckExact(__pyx_t_5))) {
3720 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
3721 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3722 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
3724 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
3725 __Pyx_GOTREF(__pyx_t_4);
3728 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
3729 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3730 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
3732 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
3733 __Pyx_GOTREF(__pyx_t_4);
3737 __pyx_t_4 = __pyx_t_8(__pyx_t_5);
3738 if (unlikely(!__pyx_t_4)) {
3739 PyObject* exc_type = PyErr_Occurred();
3741 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3742 else __PYX_ERR(0, 110, __pyx_L1_error)
3746 __Pyx_GOTREF(__pyx_t_4);
3748 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
3749 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4);
3750 __Pyx_GIVEREF(__pyx_t_4);
3753 /* "lxml/_elementpath.py":111
3754 * for elem in result:
3755 * for e in elem.iterchildren('*'):
3756 * yield e # <<<<<<<<<<<<<<
3760 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
3761 __pyx_r = __pyx_cur_scope->__pyx_v_e;
3762 __Pyx_XGIVEREF(__pyx_t_1);
3763 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
3764 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
3765 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
3766 __Pyx_XGIVEREF(__pyx_t_5);
3767 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
3768 __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
3769 __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
3770 __Pyx_XGIVEREF(__pyx_r);
3771 __Pyx_RefNannyFinishContext();
3772 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3773 /* return from generator, yielding value */
3774 __pyx_generator->resume_label = 1;
3776 __pyx_L8_resume_from_yield:;
3777 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
3778 __pyx_cur_scope->__pyx_t_0 = 0;
3779 __Pyx_XGOTREF(__pyx_t_1);
3780 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
3781 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
3782 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
3783 __pyx_cur_scope->__pyx_t_3 = 0;
3784 __Pyx_XGOTREF(__pyx_t_5);
3785 __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
3786 __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
3787 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 111, __pyx_L1_error)
3789 /* "lxml/_elementpath.py":110
3790 * def select(result):
3791 * for elem in result:
3792 * for e in elem.iterchildren('*'): # <<<<<<<<<<<<<<
3797 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3799 /* "lxml/_elementpath.py":109
3800 * def prepare_star(next, token):
3801 * def select(result):
3802 * for elem in result: # <<<<<<<<<<<<<<
3803 * for e in elem.iterchildren('*'):
3807 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3808 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
3810 /* "lxml/_elementpath.py":108
3812 * def prepare_star(next, token):
3813 * def select(result): # <<<<<<<<<<<<<<
3814 * for elem in result:
3815 * for e in elem.iterchildren('*'):
3818 /* function exit code */
3819 PyErr_SetNone(PyExc_StopIteration);
3822 __Pyx_XDECREF(__pyx_t_1);
3823 __Pyx_XDECREF(__pyx_t_4);
3824 __Pyx_XDECREF(__pyx_t_5);
3825 __Pyx_XDECREF(__pyx_t_6);
3826 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3828 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3829 #if !CYTHON_USE_EXC_INFO_STACK
3830 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3832 __pyx_generator->resume_label = -1;
3833 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3834 __Pyx_RefNannyFinishContext();
3838 /* "lxml/_elementpath.py":107
3841 * def prepare_star(next, token): # <<<<<<<<<<<<<<
3842 * def select(result):
3843 * for elem in result:
3846 static PyObject *__pyx_pf_4lxml_12_elementpath_5prepare_star(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token) {
3847 PyObject *__pyx_v_select = 0;
3848 PyObject *__pyx_r = NULL;
3849 __Pyx_RefNannyDeclarations
3850 PyObject *__pyx_t_1 = NULL;
3851 int __pyx_lineno = 0;
3852 const char *__pyx_filename = NULL;
3853 int __pyx_clineno = 0;
3854 __Pyx_RefNannySetupContext("prepare_star", 0);
3856 /* "lxml/_elementpath.py":108
3858 * def prepare_star(next, token):
3859 * def select(result): # <<<<<<<<<<<<<<
3860 * for elem in result:
3861 * for e in elem.iterchildren('*'):
3863 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_12prepare_star_1select, 0, __pyx_n_s_prepare_star_locals_select, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
3864 __Pyx_GOTREF(__pyx_t_1);
3865 __pyx_v_select = __pyx_t_1;
3868 /* "lxml/_elementpath.py":112
3869 * for e in elem.iterchildren('*'):
3871 * return select # <<<<<<<<<<<<<<
3873 * def prepare_self(next, token):
3875 __Pyx_XDECREF(__pyx_r);
3876 __Pyx_INCREF(__pyx_v_select);
3877 __pyx_r = __pyx_v_select;
3880 /* "lxml/_elementpath.py":107
3883 * def prepare_star(next, token): # <<<<<<<<<<<<<<
3884 * def select(result):
3885 * for elem in result:
3888 /* function exit code */
3890 __Pyx_XDECREF(__pyx_t_1);
3891 __Pyx_AddTraceback("lxml._elementpath.prepare_star", __pyx_clineno, __pyx_lineno, __pyx_filename);
3894 __Pyx_XDECREF(__pyx_v_select);
3895 __Pyx_XGIVEREF(__pyx_r);
3896 __Pyx_RefNannyFinishContext();
3900 /* "lxml/_elementpath.py":114
3903 * def prepare_self(next, token): # <<<<<<<<<<<<<<
3904 * def select(result):
3908 /* Python wrapper */
3909 static PyObject *__pyx_pw_4lxml_12_elementpath_8prepare_self(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3910 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_8prepare_self = {"prepare_self", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_8prepare_self, METH_VARARGS|METH_KEYWORDS, 0};
3911 static PyObject *__pyx_pw_4lxml_12_elementpath_8prepare_self(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3912 CYTHON_UNUSED PyObject *__pyx_v_next = 0;
3913 CYTHON_UNUSED PyObject *__pyx_v_token = 0;
3914 int __pyx_lineno = 0;
3915 const char *__pyx_filename = NULL;
3916 int __pyx_clineno = 0;
3917 PyObject *__pyx_r = 0;
3918 __Pyx_RefNannyDeclarations
3919 __Pyx_RefNannySetupContext("prepare_self (wrapper)", 0);
3921 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
3922 PyObject* values[2] = {0,0};
3923 if (unlikely(__pyx_kwds)) {
3925 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3927 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3929 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3932 default: goto __pyx_L5_argtuple_error;
3934 kw_args = PyDict_Size(__pyx_kwds);
3937 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3938 else goto __pyx_L5_argtuple_error;
3941 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3943 __Pyx_RaiseArgtupleInvalid("prepare_self", 1, 2, 2, 1); __PYX_ERR(0, 114, __pyx_L3_error)
3946 if (unlikely(kw_args > 0)) {
3947 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_self") < 0)) __PYX_ERR(0, 114, __pyx_L3_error)
3949 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3950 goto __pyx_L5_argtuple_error;
3952 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3953 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3955 __pyx_v_next = values[0];
3956 __pyx_v_token = values[1];
3958 goto __pyx_L4_argument_unpacking_done;
3959 __pyx_L5_argtuple_error:;
3960 __Pyx_RaiseArgtupleInvalid("prepare_self", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 114, __pyx_L3_error)
3962 __Pyx_AddTraceback("lxml._elementpath.prepare_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
3963 __Pyx_RefNannyFinishContext();
3965 __pyx_L4_argument_unpacking_done:;
3966 __pyx_r = __pyx_pf_4lxml_12_elementpath_7prepare_self(__pyx_self, __pyx_v_next, __pyx_v_token);
3968 /* function exit code */
3969 __Pyx_RefNannyFinishContext();
3973 /* "lxml/_elementpath.py":115
3975 * def prepare_self(next, token):
3976 * def select(result): # <<<<<<<<<<<<<<
3981 /* Python wrapper */
3982 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_self_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
3983 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_12prepare_self_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_12prepare_self_1select, METH_O, 0};
3984 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_self_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
3985 PyObject *__pyx_r = 0;
3986 __Pyx_RefNannyDeclarations
3987 __Pyx_RefNannySetupContext("select (wrapper)", 0);
3988 __pyx_r = __pyx_pf_4lxml_12_elementpath_12prepare_self_select(__pyx_self, ((PyObject *)__pyx_v_result));
3990 /* function exit code */
3991 __Pyx_RefNannyFinishContext();
3995 static PyObject *__pyx_pf_4lxml_12_elementpath_12prepare_self_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result) {
3996 PyObject *__pyx_r = NULL;
3997 __Pyx_RefNannyDeclarations
3998 __Pyx_RefNannySetupContext("select", 0);
4000 /* "lxml/_elementpath.py":116
4001 * def prepare_self(next, token):
4002 * def select(result):
4003 * return result # <<<<<<<<<<<<<<
4007 __Pyx_XDECREF(__pyx_r);
4008 __Pyx_INCREF(__pyx_v_result);
4009 __pyx_r = __pyx_v_result;
4012 /* "lxml/_elementpath.py":115
4014 * def prepare_self(next, token):
4015 * def select(result): # <<<<<<<<<<<<<<
4020 /* function exit code */
4022 __Pyx_XGIVEREF(__pyx_r);
4023 __Pyx_RefNannyFinishContext();
4027 /* "lxml/_elementpath.py":114
4030 * def prepare_self(next, token): # <<<<<<<<<<<<<<
4031 * def select(result):
4035 static PyObject *__pyx_pf_4lxml_12_elementpath_7prepare_self(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token) {
4036 PyObject *__pyx_v_select = 0;
4037 PyObject *__pyx_r = NULL;
4038 __Pyx_RefNannyDeclarations
4039 PyObject *__pyx_t_1 = NULL;
4040 int __pyx_lineno = 0;
4041 const char *__pyx_filename = NULL;
4042 int __pyx_clineno = 0;
4043 __Pyx_RefNannySetupContext("prepare_self", 0);
4045 /* "lxml/_elementpath.py":115
4047 * def prepare_self(next, token):
4048 * def select(result): # <<<<<<<<<<<<<<
4052 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_12prepare_self_1select, 0, __pyx_n_s_prepare_self_locals_select, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
4053 __Pyx_GOTREF(__pyx_t_1);
4054 __pyx_v_select = __pyx_t_1;
4057 /* "lxml/_elementpath.py":117
4058 * def select(result):
4060 * return select # <<<<<<<<<<<<<<
4062 * def prepare_descendant(next, token):
4064 __Pyx_XDECREF(__pyx_r);
4065 __Pyx_INCREF(__pyx_v_select);
4066 __pyx_r = __pyx_v_select;
4069 /* "lxml/_elementpath.py":114
4072 * def prepare_self(next, token): # <<<<<<<<<<<<<<
4073 * def select(result):
4077 /* function exit code */
4079 __Pyx_XDECREF(__pyx_t_1);
4080 __Pyx_AddTraceback("lxml._elementpath.prepare_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
4083 __Pyx_XDECREF(__pyx_v_select);
4084 __Pyx_XGIVEREF(__pyx_r);
4085 __Pyx_RefNannyFinishContext();
4089 /* "lxml/_elementpath.py":119
4092 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
4094 * if token[0] == "*":
4097 /* Python wrapper */
4098 static PyObject *__pyx_pw_4lxml_12_elementpath_10prepare_descendant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4099 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_10prepare_descendant = {"prepare_descendant", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_10prepare_descendant, METH_VARARGS|METH_KEYWORDS, 0};
4100 static PyObject *__pyx_pw_4lxml_12_elementpath_10prepare_descendant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4101 PyObject *__pyx_v_next = 0;
4102 PyObject *__pyx_v_token = 0;
4103 int __pyx_lineno = 0;
4104 const char *__pyx_filename = NULL;
4105 int __pyx_clineno = 0;
4106 PyObject *__pyx_r = 0;
4107 __Pyx_RefNannyDeclarations
4108 __Pyx_RefNannySetupContext("prepare_descendant (wrapper)", 0);
4110 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
4111 PyObject* values[2] = {0,0};
4112 if (unlikely(__pyx_kwds)) {
4114 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4116 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4118 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4121 default: goto __pyx_L5_argtuple_error;
4123 kw_args = PyDict_Size(__pyx_kwds);
4126 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
4127 else goto __pyx_L5_argtuple_error;
4130 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
4132 __Pyx_RaiseArgtupleInvalid("prepare_descendant", 1, 2, 2, 1); __PYX_ERR(0, 119, __pyx_L3_error)
4135 if (unlikely(kw_args > 0)) {
4136 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_descendant") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
4138 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4139 goto __pyx_L5_argtuple_error;
4141 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4142 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4144 __pyx_v_next = values[0];
4145 __pyx_v_token = values[1];
4147 goto __pyx_L4_argument_unpacking_done;
4148 __pyx_L5_argtuple_error:;
4149 __Pyx_RaiseArgtupleInvalid("prepare_descendant", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error)
4151 __Pyx_AddTraceback("lxml._elementpath.prepare_descendant", __pyx_clineno, __pyx_lineno, __pyx_filename);
4152 __Pyx_RefNannyFinishContext();
4154 __pyx_L4_argument_unpacking_done:;
4155 __pyx_r = __pyx_pf_4lxml_12_elementpath_9prepare_descendant(__pyx_self, __pyx_v_next, __pyx_v_token);
4157 /* function exit code */
4158 __Pyx_RefNannyFinishContext();
4161 static PyObject *__pyx_gb_4lxml_12_elementpath_18prepare_descendant_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
4163 /* "lxml/_elementpath.py":127
4165 * raise SyntaxError("invalid descendant")
4166 * def select(result): # <<<<<<<<<<<<<<
4167 * for elem in result:
4168 * for e in elem.iterdescendants(tag):
4171 /* Python wrapper */
4172 static PyObject *__pyx_pw_4lxml_12_elementpath_18prepare_descendant_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
4173 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_18prepare_descendant_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_18prepare_descendant_1select, METH_O, 0};
4174 static PyObject *__pyx_pw_4lxml_12_elementpath_18prepare_descendant_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
4175 PyObject *__pyx_r = 0;
4176 __Pyx_RefNannyDeclarations
4177 __Pyx_RefNannySetupContext("select (wrapper)", 0);
4178 __pyx_r = __pyx_pf_4lxml_12_elementpath_18prepare_descendant_select(__pyx_self, ((PyObject *)__pyx_v_result));
4180 /* function exit code */
4181 __Pyx_RefNannyFinishContext();
4185 static PyObject *__pyx_pf_4lxml_12_elementpath_18prepare_descendant_select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
4186 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *__pyx_cur_scope;
4187 PyObject *__pyx_r = NULL;
4188 __Pyx_RefNannyDeclarations
4189 int __pyx_lineno = 0;
4190 const char *__pyx_filename = NULL;
4191 int __pyx_clineno = 0;
4192 __Pyx_RefNannySetupContext("select", 0);
4193 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_5_select, __pyx_empty_tuple, NULL);
4194 if (unlikely(!__pyx_cur_scope)) {
4195 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)Py_None);
4196 __Pyx_INCREF(Py_None);
4197 __PYX_ERR(0, 127, __pyx_L1_error)
4199 __Pyx_GOTREF(__pyx_cur_scope);
4201 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *) __Pyx_CyFunction_GetClosure(__pyx_self);
4202 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
4203 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
4204 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
4205 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
4206 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
4208 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_18prepare_descendant_2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_descendant_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 127, __pyx_L1_error)
4209 __Pyx_DECREF(__pyx_cur_scope);
4210 __Pyx_RefNannyFinishContext();
4211 return (PyObject *) gen;
4214 /* function exit code */
4216 __Pyx_AddTraceback("lxml._elementpath.prepare_descendant.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4218 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4219 __Pyx_XGIVEREF(__pyx_r);
4220 __Pyx_RefNannyFinishContext();
4224 static PyObject *__pyx_gb_4lxml_12_elementpath_18prepare_descendant_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
4226 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)__pyx_generator->closure);
4227 PyObject *__pyx_r = NULL;
4228 PyObject *__pyx_t_1 = NULL;
4229 Py_ssize_t __pyx_t_2;
4230 PyObject *(*__pyx_t_3)(PyObject *);
4231 PyObject *__pyx_t_4 = NULL;
4232 PyObject *__pyx_t_5 = NULL;
4233 PyObject *__pyx_t_6 = NULL;
4234 Py_ssize_t __pyx_t_7;
4235 PyObject *(*__pyx_t_8)(PyObject *);
4236 int __pyx_lineno = 0;
4237 const char *__pyx_filename = NULL;
4238 int __pyx_clineno = 0;
4239 __Pyx_RefNannyDeclarations
4240 __Pyx_RefNannySetupContext("select", 0);
4241 switch (__pyx_generator->resume_label) {
4242 case 0: goto __pyx_L3_first_run;
4243 case 1: goto __pyx_L8_resume_from_yield;
4244 default: /* CPython raises the right error here */
4245 __Pyx_RefNannyFinishContext();
4248 __pyx_L3_first_run:;
4249 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 127, __pyx_L1_error)
4251 /* "lxml/_elementpath.py":128
4252 * raise SyntaxError("invalid descendant")
4253 * def select(result):
4254 * for elem in result: # <<<<<<<<<<<<<<
4255 * for e in elem.iterdescendants(tag):
4258 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
4259 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
4262 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
4263 __Pyx_GOTREF(__pyx_t_1);
4264 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error)
4267 if (likely(!__pyx_t_3)) {
4268 if (likely(PyList_CheckExact(__pyx_t_1))) {
4269 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
4270 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4271 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
4273 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error)
4274 __Pyx_GOTREF(__pyx_t_4);
4277 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4278 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4279 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
4281 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error)
4282 __Pyx_GOTREF(__pyx_t_4);
4286 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
4287 if (unlikely(!__pyx_t_4)) {
4288 PyObject* exc_type = PyErr_Occurred();
4290 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4291 else __PYX_ERR(0, 128, __pyx_L1_error)
4295 __Pyx_GOTREF(__pyx_t_4);
4297 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
4298 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
4299 __Pyx_GIVEREF(__pyx_t_4);
4302 /* "lxml/_elementpath.py":129
4303 * def select(result):
4304 * for elem in result:
4305 * for e in elem.iterdescendants(tag): # <<<<<<<<<<<<<<
4309 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_iterdescendants); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error)
4310 __Pyx_GOTREF(__pyx_t_5);
4311 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag)) { __Pyx_RaiseClosureNameError("tag"); __PYX_ERR(0, 129, __pyx_L1_error) }
4313 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
4314 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
4315 if (likely(__pyx_t_6)) {
4316 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4317 __Pyx_INCREF(__pyx_t_6);
4318 __Pyx_INCREF(function);
4319 __Pyx_DECREF_SET(__pyx_t_5, function);
4322 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag);
4323 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4324 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error)
4325 __Pyx_GOTREF(__pyx_t_4);
4326 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4327 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
4328 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
4331 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error)
4332 __Pyx_GOTREF(__pyx_t_5);
4333 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __pyx_L1_error)
4335 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4337 if (likely(!__pyx_t_8)) {
4338 if (likely(PyList_CheckExact(__pyx_t_5))) {
4339 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
4340 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4341 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 129, __pyx_L1_error)
4343 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error)
4344 __Pyx_GOTREF(__pyx_t_4);
4347 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
4348 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4349 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 129, __pyx_L1_error)
4351 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error)
4352 __Pyx_GOTREF(__pyx_t_4);
4356 __pyx_t_4 = __pyx_t_8(__pyx_t_5);
4357 if (unlikely(!__pyx_t_4)) {
4358 PyObject* exc_type = PyErr_Occurred();
4360 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4361 else __PYX_ERR(0, 129, __pyx_L1_error)
4365 __Pyx_GOTREF(__pyx_t_4);
4367 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
4368 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4);
4369 __Pyx_GIVEREF(__pyx_t_4);
4372 /* "lxml/_elementpath.py":130
4373 * for elem in result:
4374 * for e in elem.iterdescendants(tag):
4375 * yield e # <<<<<<<<<<<<<<
4379 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
4380 __pyx_r = __pyx_cur_scope->__pyx_v_e;
4381 __Pyx_XGIVEREF(__pyx_t_1);
4382 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
4383 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
4384 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
4385 __Pyx_XGIVEREF(__pyx_t_5);
4386 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
4387 __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
4388 __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
4389 __Pyx_XGIVEREF(__pyx_r);
4390 __Pyx_RefNannyFinishContext();
4391 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4392 /* return from generator, yielding value */
4393 __pyx_generator->resume_label = 1;
4395 __pyx_L8_resume_from_yield:;
4396 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
4397 __pyx_cur_scope->__pyx_t_0 = 0;
4398 __Pyx_XGOTREF(__pyx_t_1);
4399 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
4400 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
4401 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
4402 __pyx_cur_scope->__pyx_t_3 = 0;
4403 __Pyx_XGOTREF(__pyx_t_5);
4404 __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
4405 __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
4406 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 130, __pyx_L1_error)
4408 /* "lxml/_elementpath.py":129
4409 * def select(result):
4410 * for elem in result:
4411 * for e in elem.iterdescendants(tag): # <<<<<<<<<<<<<<
4416 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4418 /* "lxml/_elementpath.py":128
4419 * raise SyntaxError("invalid descendant")
4420 * def select(result):
4421 * for elem in result: # <<<<<<<<<<<<<<
4422 * for e in elem.iterdescendants(tag):
4426 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4427 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4429 /* "lxml/_elementpath.py":127
4431 * raise SyntaxError("invalid descendant")
4432 * def select(result): # <<<<<<<<<<<<<<
4433 * for elem in result:
4434 * for e in elem.iterdescendants(tag):
4437 /* function exit code */
4438 PyErr_SetNone(PyExc_StopIteration);
4441 __Pyx_XDECREF(__pyx_t_1);
4442 __Pyx_XDECREF(__pyx_t_4);
4443 __Pyx_XDECREF(__pyx_t_5);
4444 __Pyx_XDECREF(__pyx_t_6);
4445 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4447 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4448 #if !CYTHON_USE_EXC_INFO_STACK
4449 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4451 __pyx_generator->resume_label = -1;
4452 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4453 __Pyx_RefNannyFinishContext();
4457 /* "lxml/_elementpath.py":119
4460 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
4462 * if token[0] == "*":
4465 static PyObject *__pyx_pf_4lxml_12_elementpath_9prepare_descendant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_next, PyObject *__pyx_v_token) {
4466 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *__pyx_cur_scope;
4467 PyObject *__pyx_v_select = 0;
4468 PyObject *__pyx_r = NULL;
4469 __Pyx_RefNannyDeclarations
4470 PyObject *__pyx_t_1 = NULL;
4471 PyObject *__pyx_t_2 = NULL;
4472 PyObject *__pyx_t_3 = NULL;
4475 int __pyx_lineno = 0;
4476 const char *__pyx_filename = NULL;
4477 int __pyx_clineno = 0;
4478 __Pyx_RefNannySetupContext("prepare_descendant", 0);
4479 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, __pyx_empty_tuple, NULL);
4480 if (unlikely(!__pyx_cur_scope)) {
4481 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)Py_None);
4482 __Pyx_INCREF(Py_None);
4483 __PYX_ERR(0, 119, __pyx_L1_error)
4485 __Pyx_GOTREF(__pyx_cur_scope);
4487 __Pyx_INCREF(__pyx_v_token);
4489 /* "lxml/_elementpath.py":120
4491 * def prepare_descendant(next, token):
4492 * token = next() # <<<<<<<<<<<<<<
4493 * if token[0] == "*":
4496 __Pyx_INCREF(__pyx_v_next);
4497 __pyx_t_2 = __pyx_v_next; __pyx_t_3 = NULL;
4498 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4499 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4500 if (likely(__pyx_t_3)) {
4501 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4502 __Pyx_INCREF(__pyx_t_3);
4503 __Pyx_INCREF(function);
4504 __Pyx_DECREF_SET(__pyx_t_2, function);
4507 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
4508 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4509 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
4510 __Pyx_GOTREF(__pyx_t_1);
4511 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4512 __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_1);
4515 /* "lxml/_elementpath.py":121
4516 * def prepare_descendant(next, token):
4518 * if token[0] == "*": # <<<<<<<<<<<<<<
4520 * elif not token[0]:
4522 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
4523 __Pyx_GOTREF(__pyx_t_1);
4524 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__9, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 121, __pyx_L1_error)
4525 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4528 /* "lxml/_elementpath.py":122
4530 * if token[0] == "*":
4531 * tag = "*" # <<<<<<<<<<<<<<
4532 * elif not token[0]:
4535 __Pyx_INCREF(__pyx_kp_s__9);
4536 __Pyx_GIVEREF(__pyx_kp_s__9);
4537 __pyx_cur_scope->__pyx_v_tag = __pyx_kp_s__9;
4539 /* "lxml/_elementpath.py":121
4540 * def prepare_descendant(next, token):
4542 * if token[0] == "*": # <<<<<<<<<<<<<<
4544 * elif not token[0]:
4549 /* "lxml/_elementpath.py":123
4550 * if token[0] == "*":
4552 * elif not token[0]: # <<<<<<<<<<<<<<
4556 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
4557 __Pyx_GOTREF(__pyx_t_1);
4558 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 123, __pyx_L1_error)
4559 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4560 __pyx_t_5 = ((!__pyx_t_4) != 0);
4561 if (likely(__pyx_t_5)) {
4563 /* "lxml/_elementpath.py":124
4565 * elif not token[0]:
4566 * tag = token[1] # <<<<<<<<<<<<<<
4568 * raise SyntaxError("invalid descendant")
4570 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4571 __Pyx_GOTREF(__pyx_t_1);
4572 __Pyx_GIVEREF(__pyx_t_1);
4573 __pyx_cur_scope->__pyx_v_tag = __pyx_t_1;
4576 /* "lxml/_elementpath.py":123
4577 * if token[0] == "*":
4579 * elif not token[0]: # <<<<<<<<<<<<<<
4586 /* "lxml/_elementpath.py":126
4589 * raise SyntaxError("invalid descendant") # <<<<<<<<<<<<<<
4590 * def select(result):
4591 * for elem in result:
4594 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4595 __Pyx_GOTREF(__pyx_t_1);
4596 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4597 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4598 __PYX_ERR(0, 126, __pyx_L1_error)
4602 /* "lxml/_elementpath.py":127
4604 * raise SyntaxError("invalid descendant")
4605 * def select(result): # <<<<<<<<<<<<<<
4606 * for elem in result:
4607 * for e in elem.iterdescendants(tag):
4609 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_18prepare_descendant_1select, 0, __pyx_n_s_prepare_descendant_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
4610 __Pyx_GOTREF(__pyx_t_1);
4611 __pyx_v_select = __pyx_t_1;
4614 /* "lxml/_elementpath.py":131
4615 * for e in elem.iterdescendants(tag):
4617 * return select # <<<<<<<<<<<<<<
4619 * def prepare_parent(next, token):
4621 __Pyx_XDECREF(__pyx_r);
4622 __Pyx_INCREF(__pyx_v_select);
4623 __pyx_r = __pyx_v_select;
4626 /* "lxml/_elementpath.py":119
4629 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
4631 * if token[0] == "*":
4634 /* function exit code */
4636 __Pyx_XDECREF(__pyx_t_1);
4637 __Pyx_XDECREF(__pyx_t_2);
4638 __Pyx_XDECREF(__pyx_t_3);
4639 __Pyx_AddTraceback("lxml._elementpath.prepare_descendant", __pyx_clineno, __pyx_lineno, __pyx_filename);
4642 __Pyx_XDECREF(__pyx_v_select);
4643 __Pyx_XDECREF(__pyx_v_token);
4644 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4645 __Pyx_XGIVEREF(__pyx_r);
4646 __Pyx_RefNannyFinishContext();
4650 /* "lxml/_elementpath.py":133
4653 * def prepare_parent(next, token): # <<<<<<<<<<<<<<
4654 * def select(result):
4655 * for elem in result:
4658 /* Python wrapper */
4659 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4660 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_12prepare_parent = {"prepare_parent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_12prepare_parent, METH_VARARGS|METH_KEYWORDS, 0};
4661 static PyObject *__pyx_pw_4lxml_12_elementpath_12prepare_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4662 CYTHON_UNUSED PyObject *__pyx_v_next = 0;
4663 CYTHON_UNUSED PyObject *__pyx_v_token = 0;
4664 int __pyx_lineno = 0;
4665 const char *__pyx_filename = NULL;
4666 int __pyx_clineno = 0;
4667 PyObject *__pyx_r = 0;
4668 __Pyx_RefNannyDeclarations
4669 __Pyx_RefNannySetupContext("prepare_parent (wrapper)", 0);
4671 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
4672 PyObject* values[2] = {0,0};
4673 if (unlikely(__pyx_kwds)) {
4675 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4677 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4679 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4682 default: goto __pyx_L5_argtuple_error;
4684 kw_args = PyDict_Size(__pyx_kwds);
4687 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
4688 else goto __pyx_L5_argtuple_error;
4691 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
4693 __Pyx_RaiseArgtupleInvalid("prepare_parent", 1, 2, 2, 1); __PYX_ERR(0, 133, __pyx_L3_error)
4696 if (unlikely(kw_args > 0)) {
4697 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_parent") < 0)) __PYX_ERR(0, 133, __pyx_L3_error)
4699 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4700 goto __pyx_L5_argtuple_error;
4702 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4703 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4705 __pyx_v_next = values[0];
4706 __pyx_v_token = values[1];
4708 goto __pyx_L4_argument_unpacking_done;
4709 __pyx_L5_argtuple_error:;
4710 __Pyx_RaiseArgtupleInvalid("prepare_parent", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error)
4712 __Pyx_AddTraceback("lxml._elementpath.prepare_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4713 __Pyx_RefNannyFinishContext();
4715 __pyx_L4_argument_unpacking_done:;
4716 __pyx_r = __pyx_pf_4lxml_12_elementpath_11prepare_parent(__pyx_self, __pyx_v_next, __pyx_v_token);
4718 /* function exit code */
4719 __Pyx_RefNannyFinishContext();
4722 static PyObject *__pyx_gb_4lxml_12_elementpath_14prepare_parent_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
4724 /* "lxml/_elementpath.py":134
4726 * def prepare_parent(next, token):
4727 * def select(result): # <<<<<<<<<<<<<<
4728 * for elem in result:
4729 * parent = elem.getparent()
4732 /* Python wrapper */
4733 static PyObject *__pyx_pw_4lxml_12_elementpath_14prepare_parent_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
4734 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_14prepare_parent_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_14prepare_parent_1select, METH_O, 0};
4735 static PyObject *__pyx_pw_4lxml_12_elementpath_14prepare_parent_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
4736 PyObject *__pyx_r = 0;
4737 __Pyx_RefNannyDeclarations
4738 __Pyx_RefNannySetupContext("select (wrapper)", 0);
4739 __pyx_r = __pyx_pf_4lxml_12_elementpath_14prepare_parent_select(__pyx_self, ((PyObject *)__pyx_v_result));
4741 /* function exit code */
4742 __Pyx_RefNannyFinishContext();
4746 static PyObject *__pyx_pf_4lxml_12_elementpath_14prepare_parent_select(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_result) {
4747 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *__pyx_cur_scope;
4748 PyObject *__pyx_r = NULL;
4749 __Pyx_RefNannyDeclarations
4750 int __pyx_lineno = 0;
4751 const char *__pyx_filename = NULL;
4752 int __pyx_clineno = 0;
4753 __Pyx_RefNannySetupContext("select", 0);
4754 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_6_select, __pyx_empty_tuple, NULL);
4755 if (unlikely(!__pyx_cur_scope)) {
4756 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)Py_None);
4757 __Pyx_INCREF(Py_None);
4758 __PYX_ERR(0, 134, __pyx_L1_error)
4760 __Pyx_GOTREF(__pyx_cur_scope);
4762 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
4763 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
4764 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
4766 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_14prepare_parent_2generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_parent_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 134, __pyx_L1_error)
4767 __Pyx_DECREF(__pyx_cur_scope);
4768 __Pyx_RefNannyFinishContext();
4769 return (PyObject *) gen;
4772 /* function exit code */
4774 __Pyx_AddTraceback("lxml._elementpath.prepare_parent.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4776 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4777 __Pyx_XGIVEREF(__pyx_r);
4778 __Pyx_RefNannyFinishContext();
4782 static PyObject *__pyx_gb_4lxml_12_elementpath_14prepare_parent_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
4784 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)__pyx_generator->closure);
4785 PyObject *__pyx_r = NULL;
4786 PyObject *__pyx_t_1 = NULL;
4787 Py_ssize_t __pyx_t_2;
4788 PyObject *(*__pyx_t_3)(PyObject *);
4789 PyObject *__pyx_t_4 = NULL;
4790 PyObject *__pyx_t_5 = NULL;
4791 PyObject *__pyx_t_6 = NULL;
4794 int __pyx_lineno = 0;
4795 const char *__pyx_filename = NULL;
4796 int __pyx_clineno = 0;
4797 __Pyx_RefNannyDeclarations
4798 __Pyx_RefNannySetupContext("select", 0);
4799 switch (__pyx_generator->resume_label) {
4800 case 0: goto __pyx_L3_first_run;
4801 case 1: goto __pyx_L7_resume_from_yield;
4802 default: /* CPython raises the right error here */
4803 __Pyx_RefNannyFinishContext();
4806 __pyx_L3_first_run:;
4807 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 134, __pyx_L1_error)
4809 /* "lxml/_elementpath.py":135
4810 * def prepare_parent(next, token):
4811 * def select(result):
4812 * for elem in result: # <<<<<<<<<<<<<<
4813 * parent = elem.getparent()
4814 * if parent is not None:
4816 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
4817 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
4820 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
4821 __Pyx_GOTREF(__pyx_t_1);
4822 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error)
4825 if (likely(!__pyx_t_3)) {
4826 if (likely(PyList_CheckExact(__pyx_t_1))) {
4827 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
4828 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4829 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 135, __pyx_L1_error)
4831 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
4832 __Pyx_GOTREF(__pyx_t_4);
4835 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4836 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4837 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 135, __pyx_L1_error)
4839 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
4840 __Pyx_GOTREF(__pyx_t_4);
4844 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
4845 if (unlikely(!__pyx_t_4)) {
4846 PyObject* exc_type = PyErr_Occurred();
4848 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4849 else __PYX_ERR(0, 135, __pyx_L1_error)
4853 __Pyx_GOTREF(__pyx_t_4);
4855 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
4856 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
4857 __Pyx_GIVEREF(__pyx_t_4);
4860 /* "lxml/_elementpath.py":136
4861 * def select(result):
4862 * for elem in result:
4863 * parent = elem.getparent() # <<<<<<<<<<<<<<
4864 * if parent is not None:
4867 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_getparent); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error)
4868 __Pyx_GOTREF(__pyx_t_5);
4870 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
4871 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
4872 if (likely(__pyx_t_6)) {
4873 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4874 __Pyx_INCREF(__pyx_t_6);
4875 __Pyx_INCREF(function);
4876 __Pyx_DECREF_SET(__pyx_t_5, function);
4879 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
4880 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4881 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error)
4882 __Pyx_GOTREF(__pyx_t_4);
4883 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4884 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_parent);
4885 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_parent, __pyx_t_4);
4886 __Pyx_GIVEREF(__pyx_t_4);
4889 /* "lxml/_elementpath.py":137
4890 * for elem in result:
4891 * parent = elem.getparent()
4892 * if parent is not None: # <<<<<<<<<<<<<<
4896 __pyx_t_7 = (__pyx_cur_scope->__pyx_v_parent != Py_None);
4897 __pyx_t_8 = (__pyx_t_7 != 0);
4900 /* "lxml/_elementpath.py":138
4901 * parent = elem.getparent()
4902 * if parent is not None:
4903 * yield parent # <<<<<<<<<<<<<<
4907 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_parent);
4908 __pyx_r = __pyx_cur_scope->__pyx_v_parent;
4909 __Pyx_XGIVEREF(__pyx_t_1);
4910 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
4911 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
4912 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
4913 __Pyx_XGIVEREF(__pyx_r);
4914 __Pyx_RefNannyFinishContext();
4915 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4916 /* return from generator, yielding value */
4917 __pyx_generator->resume_label = 1;
4919 __pyx_L7_resume_from_yield:;
4920 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
4921 __pyx_cur_scope->__pyx_t_0 = 0;
4922 __Pyx_XGOTREF(__pyx_t_1);
4923 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
4924 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
4925 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 138, __pyx_L1_error)
4927 /* "lxml/_elementpath.py":137
4928 * for elem in result:
4929 * parent = elem.getparent()
4930 * if parent is not None: # <<<<<<<<<<<<<<
4936 /* "lxml/_elementpath.py":135
4937 * def prepare_parent(next, token):
4938 * def select(result):
4939 * for elem in result: # <<<<<<<<<<<<<<
4940 * parent = elem.getparent()
4941 * if parent is not None:
4944 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4945 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4947 /* "lxml/_elementpath.py":134
4949 * def prepare_parent(next, token):
4950 * def select(result): # <<<<<<<<<<<<<<
4951 * for elem in result:
4952 * parent = elem.getparent()
4955 /* function exit code */
4956 PyErr_SetNone(PyExc_StopIteration);
4959 __Pyx_XDECREF(__pyx_t_1);
4960 __Pyx_XDECREF(__pyx_t_4);
4961 __Pyx_XDECREF(__pyx_t_5);
4962 __Pyx_XDECREF(__pyx_t_6);
4963 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4965 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4966 #if !CYTHON_USE_EXC_INFO_STACK
4967 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4969 __pyx_generator->resume_label = -1;
4970 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4971 __Pyx_RefNannyFinishContext();
4975 /* "lxml/_elementpath.py":133
4978 * def prepare_parent(next, token): # <<<<<<<<<<<<<<
4979 * def select(result):
4980 * for elem in result:
4983 static PyObject *__pyx_pf_4lxml_12_elementpath_11prepare_parent(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_next, CYTHON_UNUSED PyObject *__pyx_v_token) {
4984 PyObject *__pyx_v_select = 0;
4985 PyObject *__pyx_r = NULL;
4986 __Pyx_RefNannyDeclarations
4987 PyObject *__pyx_t_1 = NULL;
4988 int __pyx_lineno = 0;
4989 const char *__pyx_filename = NULL;
4990 int __pyx_clineno = 0;
4991 __Pyx_RefNannySetupContext("prepare_parent", 0);
4993 /* "lxml/_elementpath.py":134
4995 * def prepare_parent(next, token):
4996 * def select(result): # <<<<<<<<<<<<<<
4997 * for elem in result:
4998 * parent = elem.getparent()
5000 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_14prepare_parent_1select, 0, __pyx_n_s_prepare_parent_locals_select, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
5001 __Pyx_GOTREF(__pyx_t_1);
5002 __pyx_v_select = __pyx_t_1;
5005 /* "lxml/_elementpath.py":139
5006 * if parent is not None:
5008 * return select # <<<<<<<<<<<<<<
5010 * def prepare_predicate(next, token):
5012 __Pyx_XDECREF(__pyx_r);
5013 __Pyx_INCREF(__pyx_v_select);
5014 __pyx_r = __pyx_v_select;
5017 /* "lxml/_elementpath.py":133
5020 * def prepare_parent(next, token): # <<<<<<<<<<<<<<
5021 * def select(result):
5022 * for elem in result:
5025 /* function exit code */
5027 __Pyx_XDECREF(__pyx_t_1);
5028 __Pyx_AddTraceback("lxml._elementpath.prepare_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
5031 __Pyx_XDECREF(__pyx_v_select);
5032 __Pyx_XGIVEREF(__pyx_r);
5033 __Pyx_RefNannyFinishContext();
5037 /* "lxml/_elementpath.py":141
5040 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
5041 * # FIXME: replace with real parser!!! refs:
5042 * # http://effbot.org/zone/simple-iterator-parser.htm
5045 /* Python wrapper */
5046 static PyObject *__pyx_pw_4lxml_12_elementpath_14prepare_predicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5047 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_14prepare_predicate = {"prepare_predicate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_14prepare_predicate, METH_VARARGS|METH_KEYWORDS, 0};
5048 static PyObject *__pyx_pw_4lxml_12_elementpath_14prepare_predicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5049 PyObject *__pyx_v_next = 0;
5050 PyObject *__pyx_v_token = 0;
5051 int __pyx_lineno = 0;
5052 const char *__pyx_filename = NULL;
5053 int __pyx_clineno = 0;
5054 PyObject *__pyx_r = 0;
5055 __Pyx_RefNannyDeclarations
5056 __Pyx_RefNannySetupContext("prepare_predicate (wrapper)", 0);
5058 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_next,&__pyx_n_s_token,0};
5059 PyObject* values[2] = {0,0};
5060 if (unlikely(__pyx_kwds)) {
5062 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5064 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5066 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5069 default: goto __pyx_L5_argtuple_error;
5071 kw_args = PyDict_Size(__pyx_kwds);
5074 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
5075 else goto __pyx_L5_argtuple_error;
5078 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
5080 __Pyx_RaiseArgtupleInvalid("prepare_predicate", 1, 2, 2, 1); __PYX_ERR(0, 141, __pyx_L3_error)
5083 if (unlikely(kw_args > 0)) {
5084 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare_predicate") < 0)) __PYX_ERR(0, 141, __pyx_L3_error)
5086 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5087 goto __pyx_L5_argtuple_error;
5089 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5090 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5092 __pyx_v_next = values[0];
5093 __pyx_v_token = values[1];
5095 goto __pyx_L4_argument_unpacking_done;
5096 __pyx_L5_argtuple_error:;
5097 __Pyx_RaiseArgtupleInvalid("prepare_predicate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error)
5099 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
5100 __Pyx_RefNannyFinishContext();
5102 __pyx_L4_argument_unpacking_done:;
5103 __pyx_r = __pyx_pf_4lxml_12_elementpath_13prepare_predicate(__pyx_self, __pyx_v_next, __pyx_v_token);
5105 /* function exit code */
5106 __Pyx_RefNannyFinishContext();
5109 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
5111 /* "lxml/_elementpath.py":163
5112 * # [@attribute] predicate
5113 * key = predicate[1]
5114 * def select(result): # <<<<<<<<<<<<<<
5115 * for elem in result:
5116 * if elem.get(key) is not None:
5119 /* Python wrapper */
5120 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_1select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
5121 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_1select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_1select, METH_O, 0};
5122 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_1select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5123 PyObject *__pyx_r = 0;
5124 __Pyx_RefNannyDeclarations
5125 __Pyx_RefNannySetupContext("select (wrapper)", 0);
5126 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_select(__pyx_self, ((PyObject *)__pyx_v_result));
5128 /* function exit code */
5129 __Pyx_RefNannyFinishContext();
5133 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5134 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *__pyx_cur_scope;
5135 PyObject *__pyx_r = NULL;
5136 __Pyx_RefNannyDeclarations
5137 int __pyx_lineno = 0;
5138 const char *__pyx_filename = NULL;
5139 int __pyx_clineno = 0;
5140 __Pyx_RefNannySetupContext("select", 0);
5141 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_8_select, __pyx_empty_tuple, NULL);
5142 if (unlikely(!__pyx_cur_scope)) {
5143 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)Py_None);
5144 __Pyx_INCREF(Py_None);
5145 __PYX_ERR(0, 163, __pyx_L1_error)
5147 __Pyx_GOTREF(__pyx_cur_scope);
5149 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
5150 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
5151 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
5152 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
5153 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
5154 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
5156 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_2generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 163, __pyx_L1_error)
5157 __Pyx_DECREF(__pyx_cur_scope);
5158 __Pyx_RefNannyFinishContext();
5159 return (PyObject *) gen;
5162 /* function exit code */
5164 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5166 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5167 __Pyx_XGIVEREF(__pyx_r);
5168 __Pyx_RefNannyFinishContext();
5172 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
5174 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)__pyx_generator->closure);
5175 PyObject *__pyx_r = NULL;
5176 PyObject *__pyx_t_1 = NULL;
5177 Py_ssize_t __pyx_t_2;
5178 PyObject *(*__pyx_t_3)(PyObject *);
5179 PyObject *__pyx_t_4 = NULL;
5180 PyObject *__pyx_t_5 = NULL;
5181 PyObject *__pyx_t_6 = NULL;
5184 int __pyx_lineno = 0;
5185 const char *__pyx_filename = NULL;
5186 int __pyx_clineno = 0;
5187 __Pyx_RefNannyDeclarations
5188 __Pyx_RefNannySetupContext("select", 0);
5189 switch (__pyx_generator->resume_label) {
5190 case 0: goto __pyx_L3_first_run;
5191 case 1: goto __pyx_L7_resume_from_yield;
5192 default: /* CPython raises the right error here */
5193 __Pyx_RefNannyFinishContext();
5196 __pyx_L3_first_run:;
5197 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 163, __pyx_L1_error)
5199 /* "lxml/_elementpath.py":164
5200 * key = predicate[1]
5201 * def select(result):
5202 * for elem in result: # <<<<<<<<<<<<<<
5203 * if elem.get(key) is not None:
5206 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
5207 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
5210 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error)
5211 __Pyx_GOTREF(__pyx_t_1);
5212 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
5215 if (likely(!__pyx_t_3)) {
5216 if (likely(PyList_CheckExact(__pyx_t_1))) {
5217 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
5218 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5219 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
5221 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L1_error)
5222 __Pyx_GOTREF(__pyx_t_4);
5225 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
5226 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5227 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
5229 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L1_error)
5230 __Pyx_GOTREF(__pyx_t_4);
5234 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5235 if (unlikely(!__pyx_t_4)) {
5236 PyObject* exc_type = PyErr_Occurred();
5238 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5239 else __PYX_ERR(0, 164, __pyx_L1_error)
5243 __Pyx_GOTREF(__pyx_t_4);
5245 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
5246 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
5247 __Pyx_GIVEREF(__pyx_t_4);
5250 /* "lxml/_elementpath.py":165
5251 * def select(result):
5252 * for elem in result:
5253 * if elem.get(key) is not None: # <<<<<<<<<<<<<<
5257 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
5258 __Pyx_GOTREF(__pyx_t_5);
5259 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_key)) { __Pyx_RaiseClosureNameError("key"); __PYX_ERR(0, 165, __pyx_L1_error) }
5261 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5262 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5263 if (likely(__pyx_t_6)) {
5264 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5265 __Pyx_INCREF(__pyx_t_6);
5266 __Pyx_INCREF(function);
5267 __Pyx_DECREF_SET(__pyx_t_5, function);
5270 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_key);
5271 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5272 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
5273 __Pyx_GOTREF(__pyx_t_4);
5274 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5275 __pyx_t_7 = (__pyx_t_4 != Py_None);
5276 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5277 __pyx_t_8 = (__pyx_t_7 != 0);
5280 /* "lxml/_elementpath.py":166
5281 * for elem in result:
5282 * if elem.get(key) is not None:
5283 * yield elem # <<<<<<<<<<<<<<
5285 * if signature == "@-='":
5287 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
5288 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
5289 __Pyx_XGIVEREF(__pyx_t_1);
5290 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5291 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5292 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5293 __Pyx_XGIVEREF(__pyx_r);
5294 __Pyx_RefNannyFinishContext();
5295 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5296 /* return from generator, yielding value */
5297 __pyx_generator->resume_label = 1;
5299 __pyx_L7_resume_from_yield:;
5300 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5301 __pyx_cur_scope->__pyx_t_0 = 0;
5302 __Pyx_XGOTREF(__pyx_t_1);
5303 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5304 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5305 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 166, __pyx_L1_error)
5307 /* "lxml/_elementpath.py":165
5308 * def select(result):
5309 * for elem in result:
5310 * if elem.get(key) is not None: # <<<<<<<<<<<<<<
5316 /* "lxml/_elementpath.py":164
5317 * key = predicate[1]
5318 * def select(result):
5319 * for elem in result: # <<<<<<<<<<<<<<
5320 * if elem.get(key) is not None:
5324 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5325 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5327 /* "lxml/_elementpath.py":163
5328 * # [@attribute] predicate
5329 * key = predicate[1]
5330 * def select(result): # <<<<<<<<<<<<<<
5331 * for elem in result:
5332 * if elem.get(key) is not None:
5335 /* function exit code */
5336 PyErr_SetNone(PyExc_StopIteration);
5339 __Pyx_XDECREF(__pyx_t_1);
5340 __Pyx_XDECREF(__pyx_t_4);
5341 __Pyx_XDECREF(__pyx_t_5);
5342 __Pyx_XDECREF(__pyx_t_6);
5343 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5345 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5346 #if !CYTHON_USE_EXC_INFO_STACK
5347 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5349 __pyx_generator->resume_label = -1;
5350 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5351 __Pyx_RefNannyFinishContext();
5354 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_5generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
5356 /* "lxml/_elementpath.py":172
5357 * key = predicate[1]
5358 * value = predicate[-1]
5359 * def select(result): # <<<<<<<<<<<<<<
5360 * for elem in result:
5361 * if elem.get(key) == value:
5364 /* Python wrapper */
5365 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_4select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
5366 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_4select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_4select, METH_O, 0};
5367 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_4select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5368 PyObject *__pyx_r = 0;
5369 __Pyx_RefNannyDeclarations
5370 __Pyx_RefNannySetupContext("select (wrapper)", 0);
5371 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_3select(__pyx_self, ((PyObject *)__pyx_v_result));
5373 /* function exit code */
5374 __Pyx_RefNannyFinishContext();
5378 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_3select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5379 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *__pyx_cur_scope;
5380 PyObject *__pyx_r = NULL;
5381 __Pyx_RefNannyDeclarations
5382 int __pyx_lineno = 0;
5383 const char *__pyx_filename = NULL;
5384 int __pyx_clineno = 0;
5385 __Pyx_RefNannySetupContext("select", 0);
5386 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_9_select, __pyx_empty_tuple, NULL);
5387 if (unlikely(!__pyx_cur_scope)) {
5388 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)Py_None);
5389 __Pyx_INCREF(Py_None);
5390 __PYX_ERR(0, 172, __pyx_L1_error)
5392 __Pyx_GOTREF(__pyx_cur_scope);
5394 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
5395 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
5396 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
5397 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
5398 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
5399 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
5401 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_5generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 172, __pyx_L1_error)
5402 __Pyx_DECREF(__pyx_cur_scope);
5403 __Pyx_RefNannyFinishContext();
5404 return (PyObject *) gen;
5407 /* function exit code */
5409 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5411 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5412 __Pyx_XGIVEREF(__pyx_r);
5413 __Pyx_RefNannyFinishContext();
5417 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_5generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
5419 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)__pyx_generator->closure);
5420 PyObject *__pyx_r = NULL;
5421 PyObject *__pyx_t_1 = NULL;
5422 Py_ssize_t __pyx_t_2;
5423 PyObject *(*__pyx_t_3)(PyObject *);
5424 PyObject *__pyx_t_4 = NULL;
5425 PyObject *__pyx_t_5 = NULL;
5426 PyObject *__pyx_t_6 = NULL;
5428 int __pyx_lineno = 0;
5429 const char *__pyx_filename = NULL;
5430 int __pyx_clineno = 0;
5431 __Pyx_RefNannyDeclarations
5432 __Pyx_RefNannySetupContext("select", 0);
5433 switch (__pyx_generator->resume_label) {
5434 case 0: goto __pyx_L3_first_run;
5435 case 1: goto __pyx_L7_resume_from_yield;
5436 default: /* CPython raises the right error here */
5437 __Pyx_RefNannyFinishContext();
5440 __pyx_L3_first_run:;
5441 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 172, __pyx_L1_error)
5443 /* "lxml/_elementpath.py":173
5444 * value = predicate[-1]
5445 * def select(result):
5446 * for elem in result: # <<<<<<<<<<<<<<
5447 * if elem.get(key) == value:
5450 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
5451 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
5454 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
5455 __Pyx_GOTREF(__pyx_t_1);
5456 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
5459 if (likely(!__pyx_t_3)) {
5460 if (likely(PyList_CheckExact(__pyx_t_1))) {
5461 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
5462 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5463 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 173, __pyx_L1_error)
5465 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
5466 __Pyx_GOTREF(__pyx_t_4);
5469 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
5470 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5471 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 173, __pyx_L1_error)
5473 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
5474 __Pyx_GOTREF(__pyx_t_4);
5478 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5479 if (unlikely(!__pyx_t_4)) {
5480 PyObject* exc_type = PyErr_Occurred();
5482 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5483 else __PYX_ERR(0, 173, __pyx_L1_error)
5487 __Pyx_GOTREF(__pyx_t_4);
5489 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
5490 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
5491 __Pyx_GIVEREF(__pyx_t_4);
5494 /* "lxml/_elementpath.py":174
5495 * def select(result):
5496 * for elem in result:
5497 * if elem.get(key) == value: # <<<<<<<<<<<<<<
5501 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
5502 __Pyx_GOTREF(__pyx_t_5);
5503 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_key)) { __Pyx_RaiseClosureNameError("key"); __PYX_ERR(0, 174, __pyx_L1_error) }
5505 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5506 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5507 if (likely(__pyx_t_6)) {
5508 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5509 __Pyx_INCREF(__pyx_t_6);
5510 __Pyx_INCREF(function);
5511 __Pyx_DECREF_SET(__pyx_t_5, function);
5514 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_key);
5515 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5516 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error)
5517 __Pyx_GOTREF(__pyx_t_4);
5518 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5519 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 174, __pyx_L1_error) }
5520 __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
5521 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5522 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 174, __pyx_L1_error)
5523 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5526 /* "lxml/_elementpath.py":175
5527 * for elem in result:
5528 * if elem.get(key) == value:
5529 * yield elem # <<<<<<<<<<<<<<
5531 * if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
5533 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
5534 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
5535 __Pyx_XGIVEREF(__pyx_t_1);
5536 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5537 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5538 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5539 __Pyx_XGIVEREF(__pyx_r);
5540 __Pyx_RefNannyFinishContext();
5541 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5542 /* return from generator, yielding value */
5543 __pyx_generator->resume_label = 1;
5545 __pyx_L7_resume_from_yield:;
5546 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5547 __pyx_cur_scope->__pyx_t_0 = 0;
5548 __Pyx_XGOTREF(__pyx_t_1);
5549 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5550 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5551 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 175, __pyx_L1_error)
5553 /* "lxml/_elementpath.py":174
5554 * def select(result):
5555 * for elem in result:
5556 * if elem.get(key) == value: # <<<<<<<<<<<<<<
5562 /* "lxml/_elementpath.py":173
5563 * value = predicate[-1]
5564 * def select(result):
5565 * for elem in result: # <<<<<<<<<<<<<<
5566 * if elem.get(key) == value:
5570 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5571 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5573 /* "lxml/_elementpath.py":172
5574 * key = predicate[1]
5575 * value = predicate[-1]
5576 * def select(result): # <<<<<<<<<<<<<<
5577 * for elem in result:
5578 * if elem.get(key) == value:
5581 /* function exit code */
5582 PyErr_SetNone(PyExc_StopIteration);
5585 __Pyx_XDECREF(__pyx_t_1);
5586 __Pyx_XDECREF(__pyx_t_4);
5587 __Pyx_XDECREF(__pyx_t_5);
5588 __Pyx_XDECREF(__pyx_t_6);
5589 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5591 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5592 #if !CYTHON_USE_EXC_INFO_STACK
5593 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5595 __pyx_generator->resume_label = -1;
5596 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5597 __Pyx_RefNannyFinishContext();
5600 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_8generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
5602 /* "lxml/_elementpath.py":180
5604 * tag = predicate[0]
5605 * def select(result): # <<<<<<<<<<<<<<
5606 * for elem in result:
5607 * for _ in elem.iterchildren(tag):
5610 /* Python wrapper */
5611 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_7select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
5612 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_7select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_7select, METH_O, 0};
5613 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_7select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5614 PyObject *__pyx_r = 0;
5615 __Pyx_RefNannyDeclarations
5616 __Pyx_RefNannySetupContext("select (wrapper)", 0);
5617 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_6select(__pyx_self, ((PyObject *)__pyx_v_result));
5619 /* function exit code */
5620 __Pyx_RefNannyFinishContext();
5624 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_6select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5625 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *__pyx_cur_scope;
5626 PyObject *__pyx_r = NULL;
5627 __Pyx_RefNannyDeclarations
5628 int __pyx_lineno = 0;
5629 const char *__pyx_filename = NULL;
5630 int __pyx_clineno = 0;
5631 __Pyx_RefNannySetupContext("select", 0);
5632 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_10_select, __pyx_empty_tuple, NULL);
5633 if (unlikely(!__pyx_cur_scope)) {
5634 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)Py_None);
5635 __Pyx_INCREF(Py_None);
5636 __PYX_ERR(0, 180, __pyx_L1_error)
5638 __Pyx_GOTREF(__pyx_cur_scope);
5640 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
5641 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
5642 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
5643 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
5644 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
5645 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
5647 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_8generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 180, __pyx_L1_error)
5648 __Pyx_DECREF(__pyx_cur_scope);
5649 __Pyx_RefNannyFinishContext();
5650 return (PyObject *) gen;
5653 /* function exit code */
5655 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5657 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5658 __Pyx_XGIVEREF(__pyx_r);
5659 __Pyx_RefNannyFinishContext();
5663 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_8generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
5665 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)__pyx_generator->closure);
5666 PyObject *__pyx_r = NULL;
5667 PyObject *__pyx_t_1 = NULL;
5668 Py_ssize_t __pyx_t_2;
5669 PyObject *(*__pyx_t_3)(PyObject *);
5670 PyObject *__pyx_t_4 = NULL;
5671 PyObject *__pyx_t_5 = NULL;
5672 PyObject *__pyx_t_6 = NULL;
5673 Py_ssize_t __pyx_t_7;
5674 PyObject *(*__pyx_t_8)(PyObject *);
5675 int __pyx_lineno = 0;
5676 const char *__pyx_filename = NULL;
5677 int __pyx_clineno = 0;
5678 __Pyx_RefNannyDeclarations
5679 __Pyx_RefNannySetupContext("select", 0);
5680 switch (__pyx_generator->resume_label) {
5681 case 0: goto __pyx_L3_first_run;
5682 case 1: goto __pyx_L8_resume_from_yield;
5683 default: /* CPython raises the right error here */
5684 __Pyx_RefNannyFinishContext();
5687 __pyx_L3_first_run:;
5688 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 180, __pyx_L1_error)
5690 /* "lxml/_elementpath.py":181
5691 * tag = predicate[0]
5692 * def select(result):
5693 * for elem in result: # <<<<<<<<<<<<<<
5694 * for _ in elem.iterchildren(tag):
5697 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
5698 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
5701 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
5702 __Pyx_GOTREF(__pyx_t_1);
5703 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
5706 if (likely(!__pyx_t_3)) {
5707 if (likely(PyList_CheckExact(__pyx_t_1))) {
5708 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
5709 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5710 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
5712 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
5713 __Pyx_GOTREF(__pyx_t_4);
5716 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
5717 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5718 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
5720 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
5721 __Pyx_GOTREF(__pyx_t_4);
5725 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5726 if (unlikely(!__pyx_t_4)) {
5727 PyObject* exc_type = PyErr_Occurred();
5729 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5730 else __PYX_ERR(0, 181, __pyx_L1_error)
5734 __Pyx_GOTREF(__pyx_t_4);
5736 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
5737 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
5738 __Pyx_GIVEREF(__pyx_t_4);
5741 /* "lxml/_elementpath.py":182
5742 * def select(result):
5743 * for elem in result:
5744 * for _ in elem.iterchildren(tag): # <<<<<<<<<<<<<<
5748 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
5749 __Pyx_GOTREF(__pyx_t_5);
5750 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag)) { __Pyx_RaiseClosureNameError("tag"); __PYX_ERR(0, 182, __pyx_L1_error) }
5752 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5753 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5754 if (likely(__pyx_t_6)) {
5755 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5756 __Pyx_INCREF(__pyx_t_6);
5757 __Pyx_INCREF(function);
5758 __Pyx_DECREF_SET(__pyx_t_5, function);
5761 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag);
5762 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5763 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error)
5764 __Pyx_GOTREF(__pyx_t_4);
5765 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5766 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
5767 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
5770 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
5771 __Pyx_GOTREF(__pyx_t_5);
5772 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
5774 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5776 if (likely(!__pyx_t_8)) {
5777 if (likely(PyList_CheckExact(__pyx_t_5))) {
5778 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
5779 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5780 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L1_error)
5782 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error)
5783 __Pyx_GOTREF(__pyx_t_4);
5786 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
5787 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5788 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L1_error)
5790 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error)
5791 __Pyx_GOTREF(__pyx_t_4);
5795 __pyx_t_4 = __pyx_t_8(__pyx_t_5);
5796 if (unlikely(!__pyx_t_4)) {
5797 PyObject* exc_type = PyErr_Occurred();
5799 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5800 else __PYX_ERR(0, 182, __pyx_L1_error)
5804 __Pyx_GOTREF(__pyx_t_4);
5806 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__);
5807 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v__, __pyx_t_4);
5808 __Pyx_GIVEREF(__pyx_t_4);
5811 /* "lxml/_elementpath.py":183
5812 * for elem in result:
5813 * for _ in elem.iterchildren(tag):
5814 * yield elem # <<<<<<<<<<<<<<
5818 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
5819 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
5820 __Pyx_XGIVEREF(__pyx_t_1);
5821 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5822 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5823 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5824 __Pyx_XGIVEREF(__pyx_t_5);
5825 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
5826 __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
5827 __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
5828 __Pyx_XGIVEREF(__pyx_r);
5829 __Pyx_RefNannyFinishContext();
5830 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5831 /* return from generator, yielding value */
5832 __pyx_generator->resume_label = 1;
5834 __pyx_L8_resume_from_yield:;
5835 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5836 __pyx_cur_scope->__pyx_t_0 = 0;
5837 __Pyx_XGOTREF(__pyx_t_1);
5838 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5839 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5840 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
5841 __pyx_cur_scope->__pyx_t_3 = 0;
5842 __Pyx_XGOTREF(__pyx_t_5);
5843 __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
5844 __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
5845 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 183, __pyx_L1_error)
5847 /* "lxml/_elementpath.py":184
5848 * for _ in elem.iterchildren(tag):
5850 * break # <<<<<<<<<<<<<<
5852 * if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):
5854 goto __pyx_L7_break;
5856 /* "lxml/_elementpath.py":182
5857 * def select(result):
5858 * for elem in result:
5859 * for _ in elem.iterchildren(tag): # <<<<<<<<<<<<<<
5865 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5867 /* "lxml/_elementpath.py":181
5868 * tag = predicate[0]
5869 * def select(result):
5870 * for elem in result: # <<<<<<<<<<<<<<
5871 * for _ in elem.iterchildren(tag):
5875 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5876 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5878 /* "lxml/_elementpath.py":180
5880 * tag = predicate[0]
5881 * def select(result): # <<<<<<<<<<<<<<
5882 * for elem in result:
5883 * for _ in elem.iterchildren(tag):
5886 /* function exit code */
5887 PyErr_SetNone(PyExc_StopIteration);
5890 __Pyx_XDECREF(__pyx_t_1);
5891 __Pyx_XDECREF(__pyx_t_4);
5892 __Pyx_XDECREF(__pyx_t_5);
5893 __Pyx_XDECREF(__pyx_t_6);
5894 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5896 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5897 #if !CYTHON_USE_EXC_INFO_STACK
5898 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5900 __pyx_generator->resume_label = -1;
5901 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5902 __Pyx_RefNannyFinishContext();
5905 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_11generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
5907 /* "lxml/_elementpath.py":191
5908 * value = predicate[-1]
5910 * def select(result): # <<<<<<<<<<<<<<
5911 * for elem in result:
5912 * for e in elem.iterchildren(tag):
5915 /* Python wrapper */
5916 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_10select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
5917 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_10select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_10select, METH_O, 0};
5918 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_10select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5919 PyObject *__pyx_r = 0;
5920 __Pyx_RefNannyDeclarations
5921 __Pyx_RefNannySetupContext("select (wrapper)", 0);
5922 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_9select(__pyx_self, ((PyObject *)__pyx_v_result));
5924 /* function exit code */
5925 __Pyx_RefNannyFinishContext();
5929 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_9select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
5930 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *__pyx_cur_scope;
5931 PyObject *__pyx_r = NULL;
5932 __Pyx_RefNannyDeclarations
5933 int __pyx_lineno = 0;
5934 const char *__pyx_filename = NULL;
5935 int __pyx_clineno = 0;
5936 __Pyx_RefNannySetupContext("select", 0);
5937 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_11_select, __pyx_empty_tuple, NULL);
5938 if (unlikely(!__pyx_cur_scope)) {
5939 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)Py_None);
5940 __Pyx_INCREF(Py_None);
5941 __PYX_ERR(0, 191, __pyx_L1_error)
5943 __Pyx_GOTREF(__pyx_cur_scope);
5945 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
5946 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
5947 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
5948 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
5949 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
5950 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
5952 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_11generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 191, __pyx_L1_error)
5953 __Pyx_DECREF(__pyx_cur_scope);
5954 __Pyx_RefNannyFinishContext();
5955 return (PyObject *) gen;
5958 /* function exit code */
5960 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5962 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5963 __Pyx_XGIVEREF(__pyx_r);
5964 __Pyx_RefNannyFinishContext();
5968 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_11generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
5970 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)__pyx_generator->closure);
5971 PyObject *__pyx_r = NULL;
5972 PyObject *__pyx_t_1 = NULL;
5973 Py_ssize_t __pyx_t_2;
5974 PyObject *(*__pyx_t_3)(PyObject *);
5975 PyObject *__pyx_t_4 = NULL;
5976 PyObject *__pyx_t_5 = NULL;
5977 PyObject *__pyx_t_6 = NULL;
5978 Py_ssize_t __pyx_t_7;
5979 PyObject *(*__pyx_t_8)(PyObject *);
5980 PyObject *__pyx_t_9 = NULL;
5982 int __pyx_lineno = 0;
5983 const char *__pyx_filename = NULL;
5984 int __pyx_clineno = 0;
5985 __Pyx_RefNannyDeclarations
5986 __Pyx_RefNannySetupContext("select", 0);
5987 switch (__pyx_generator->resume_label) {
5988 case 0: goto __pyx_L3_first_run;
5989 case 1: goto __pyx_L9_resume_from_yield;
5990 default: /* CPython raises the right error here */
5991 __Pyx_RefNannyFinishContext();
5994 __pyx_L3_first_run:;
5995 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 191, __pyx_L1_error)
5997 /* "lxml/_elementpath.py":192
5999 * def select(result):
6000 * for elem in result: # <<<<<<<<<<<<<<
6001 * for e in elem.iterchildren(tag):
6002 * if "".join(e.itertext()) == value:
6004 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
6005 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6008 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
6009 __Pyx_GOTREF(__pyx_t_1);
6010 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
6013 if (likely(!__pyx_t_3)) {
6014 if (likely(PyList_CheckExact(__pyx_t_1))) {
6015 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
6016 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6017 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
6019 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
6020 __Pyx_GOTREF(__pyx_t_4);
6023 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6024 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6025 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
6027 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
6028 __Pyx_GOTREF(__pyx_t_4);
6032 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6033 if (unlikely(!__pyx_t_4)) {
6034 PyObject* exc_type = PyErr_Occurred();
6036 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6037 else __PYX_ERR(0, 192, __pyx_L1_error)
6041 __Pyx_GOTREF(__pyx_t_4);
6043 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
6044 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
6045 __Pyx_GIVEREF(__pyx_t_4);
6048 /* "lxml/_elementpath.py":193
6049 * def select(result):
6050 * for elem in result:
6051 * for e in elem.iterchildren(tag): # <<<<<<<<<<<<<<
6052 * if "".join(e.itertext()) == value:
6055 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
6056 __Pyx_GOTREF(__pyx_t_5);
6057 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag)) { __Pyx_RaiseClosureNameError("tag"); __PYX_ERR(0, 193, __pyx_L1_error) }
6059 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6060 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6061 if (likely(__pyx_t_6)) {
6062 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6063 __Pyx_INCREF(__pyx_t_6);
6064 __Pyx_INCREF(function);
6065 __Pyx_DECREF_SET(__pyx_t_5, function);
6068 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_tag);
6069 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6070 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
6071 __Pyx_GOTREF(__pyx_t_4);
6072 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6073 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
6074 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0;
6077 __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
6078 __Pyx_GOTREF(__pyx_t_5);
6079 __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 193, __pyx_L1_error)
6081 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6083 if (likely(!__pyx_t_8)) {
6084 if (likely(PyList_CheckExact(__pyx_t_5))) {
6085 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break;
6086 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6087 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
6089 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
6090 __Pyx_GOTREF(__pyx_t_4);
6093 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6094 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6095 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
6097 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
6098 __Pyx_GOTREF(__pyx_t_4);
6102 __pyx_t_4 = __pyx_t_8(__pyx_t_5);
6103 if (unlikely(!__pyx_t_4)) {
6104 PyObject* exc_type = PyErr_Occurred();
6106 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6107 else __PYX_ERR(0, 193, __pyx_L1_error)
6111 __Pyx_GOTREF(__pyx_t_4);
6113 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
6114 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4);
6115 __Pyx_GIVEREF(__pyx_t_4);
6118 /* "lxml/_elementpath.py":194
6119 * for elem in result:
6120 * for e in elem.iterchildren(tag):
6121 * if "".join(e.itertext()) == value: # <<<<<<<<<<<<<<
6125 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_e, __pyx_n_s_itertext); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
6126 __Pyx_GOTREF(__pyx_t_6);
6128 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
6129 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
6130 if (likely(__pyx_t_9)) {
6131 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6132 __Pyx_INCREF(__pyx_t_9);
6133 __Pyx_INCREF(function);
6134 __Pyx_DECREF_SET(__pyx_t_6, function);
6137 __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
6138 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6139 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
6140 __Pyx_GOTREF(__pyx_t_4);
6141 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6142 __pyx_t_6 = __Pyx_PyString_Join(__pyx_kp_s__2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
6143 __Pyx_GOTREF(__pyx_t_6);
6144 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6145 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 194, __pyx_L1_error) }
6146 __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 194, __pyx_L1_error)
6147 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6150 /* "lxml/_elementpath.py":195
6151 * for e in elem.iterchildren(tag):
6152 * if "".join(e.itertext()) == value:
6153 * yield elem # <<<<<<<<<<<<<<
6157 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
6158 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
6159 __Pyx_XGIVEREF(__pyx_t_1);
6160 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6161 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6162 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6163 __Pyx_XGIVEREF(__pyx_t_5);
6164 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
6165 __pyx_cur_scope->__pyx_t_4 = __pyx_t_7;
6166 __pyx_cur_scope->__pyx_t_5 = __pyx_t_8;
6167 __Pyx_XGIVEREF(__pyx_r);
6168 __Pyx_RefNannyFinishContext();
6169 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6170 /* return from generator, yielding value */
6171 __pyx_generator->resume_label = 1;
6173 __pyx_L9_resume_from_yield:;
6174 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6175 __pyx_cur_scope->__pyx_t_0 = 0;
6176 __Pyx_XGOTREF(__pyx_t_1);
6177 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6178 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6179 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
6180 __pyx_cur_scope->__pyx_t_3 = 0;
6181 __Pyx_XGOTREF(__pyx_t_5);
6182 __pyx_t_7 = __pyx_cur_scope->__pyx_t_4;
6183 __pyx_t_8 = __pyx_cur_scope->__pyx_t_5;
6184 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 195, __pyx_L1_error)
6186 /* "lxml/_elementpath.py":196
6187 * if "".join(e.itertext()) == value:
6189 * break # <<<<<<<<<<<<<<
6191 * def select(result):
6193 goto __pyx_L7_break;
6195 /* "lxml/_elementpath.py":194
6196 * for elem in result:
6197 * for e in elem.iterchildren(tag):
6198 * if "".join(e.itertext()) == value: # <<<<<<<<<<<<<<
6204 /* "lxml/_elementpath.py":193
6205 * def select(result):
6206 * for elem in result:
6207 * for e in elem.iterchildren(tag): # <<<<<<<<<<<<<<
6208 * if "".join(e.itertext()) == value:
6213 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6215 /* "lxml/_elementpath.py":192
6217 * def select(result):
6218 * for elem in result: # <<<<<<<<<<<<<<
6219 * for e in elem.iterchildren(tag):
6220 * if "".join(e.itertext()) == value:
6223 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6224 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6226 /* "lxml/_elementpath.py":191
6227 * value = predicate[-1]
6229 * def select(result): # <<<<<<<<<<<<<<
6230 * for elem in result:
6231 * for e in elem.iterchildren(tag):
6234 /* function exit code */
6235 PyErr_SetNone(PyExc_StopIteration);
6238 __Pyx_XDECREF(__pyx_t_1);
6239 __Pyx_XDECREF(__pyx_t_4);
6240 __Pyx_XDECREF(__pyx_t_5);
6241 __Pyx_XDECREF(__pyx_t_6);
6242 __Pyx_XDECREF(__pyx_t_9);
6243 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6245 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6246 #if !CYTHON_USE_EXC_INFO_STACK
6247 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6249 __pyx_generator->resume_label = -1;
6250 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6251 __Pyx_RefNannyFinishContext();
6254 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_14generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
6256 /* "lxml/_elementpath.py":198
6259 * def select(result): # <<<<<<<<<<<<<<
6260 * for elem in result:
6261 * if "".join(elem.itertext()) == value:
6264 /* Python wrapper */
6265 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_13select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
6266 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_13select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_13select, METH_O, 0};
6267 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_13select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
6268 PyObject *__pyx_r = 0;
6269 __Pyx_RefNannyDeclarations
6270 __Pyx_RefNannySetupContext("select (wrapper)", 0);
6271 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_12select(__pyx_self, ((PyObject *)__pyx_v_result));
6273 /* function exit code */
6274 __Pyx_RefNannyFinishContext();
6278 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_12select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
6279 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *__pyx_cur_scope;
6280 PyObject *__pyx_r = NULL;
6281 __Pyx_RefNannyDeclarations
6282 int __pyx_lineno = 0;
6283 const char *__pyx_filename = NULL;
6284 int __pyx_clineno = 0;
6285 __Pyx_RefNannySetupContext("select", 0);
6286 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_12_select, __pyx_empty_tuple, NULL);
6287 if (unlikely(!__pyx_cur_scope)) {
6288 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)Py_None);
6289 __Pyx_INCREF(Py_None);
6290 __PYX_ERR(0, 198, __pyx_L1_error)
6292 __Pyx_GOTREF(__pyx_cur_scope);
6294 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
6295 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
6296 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
6297 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
6298 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
6299 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
6301 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_14generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 198, __pyx_L1_error)
6302 __Pyx_DECREF(__pyx_cur_scope);
6303 __Pyx_RefNannyFinishContext();
6304 return (PyObject *) gen;
6307 /* function exit code */
6309 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6311 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6312 __Pyx_XGIVEREF(__pyx_r);
6313 __Pyx_RefNannyFinishContext();
6317 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_14generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
6319 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)__pyx_generator->closure);
6320 PyObject *__pyx_r = NULL;
6321 PyObject *__pyx_t_1 = NULL;
6322 Py_ssize_t __pyx_t_2;
6323 PyObject *(*__pyx_t_3)(PyObject *);
6324 PyObject *__pyx_t_4 = NULL;
6325 PyObject *__pyx_t_5 = NULL;
6326 PyObject *__pyx_t_6 = NULL;
6328 int __pyx_lineno = 0;
6329 const char *__pyx_filename = NULL;
6330 int __pyx_clineno = 0;
6331 __Pyx_RefNannyDeclarations
6332 __Pyx_RefNannySetupContext("select", 0);
6333 switch (__pyx_generator->resume_label) {
6334 case 0: goto __pyx_L3_first_run;
6335 case 1: goto __pyx_L7_resume_from_yield;
6336 default: /* CPython raises the right error here */
6337 __Pyx_RefNannyFinishContext();
6340 __pyx_L3_first_run:;
6341 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 198, __pyx_L1_error)
6343 /* "lxml/_elementpath.py":199
6345 * def select(result):
6346 * for elem in result: # <<<<<<<<<<<<<<
6347 * if "".join(elem.itertext()) == value:
6350 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
6351 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6354 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6355 __Pyx_GOTREF(__pyx_t_1);
6356 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
6359 if (likely(!__pyx_t_3)) {
6360 if (likely(PyList_CheckExact(__pyx_t_1))) {
6361 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
6362 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6363 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
6365 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
6366 __Pyx_GOTREF(__pyx_t_4);
6369 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6370 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6371 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
6373 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
6374 __Pyx_GOTREF(__pyx_t_4);
6378 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6379 if (unlikely(!__pyx_t_4)) {
6380 PyObject* exc_type = PyErr_Occurred();
6382 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6383 else __PYX_ERR(0, 199, __pyx_L1_error)
6387 __Pyx_GOTREF(__pyx_t_4);
6389 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
6390 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
6391 __Pyx_GIVEREF(__pyx_t_4);
6394 /* "lxml/_elementpath.py":200
6395 * def select(result):
6396 * for elem in result:
6397 * if "".join(elem.itertext()) == value: # <<<<<<<<<<<<<<
6401 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_itertext); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
6402 __Pyx_GOTREF(__pyx_t_5);
6404 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6405 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6406 if (likely(__pyx_t_6)) {
6407 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6408 __Pyx_INCREF(__pyx_t_6);
6409 __Pyx_INCREF(function);
6410 __Pyx_DECREF_SET(__pyx_t_5, function);
6413 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
6414 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6415 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
6416 __Pyx_GOTREF(__pyx_t_4);
6417 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6418 __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
6419 __Pyx_GOTREF(__pyx_t_5);
6420 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6421 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); __PYX_ERR(0, 200, __pyx_L1_error) }
6422 __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
6423 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6426 /* "lxml/_elementpath.py":201
6427 * for elem in result:
6428 * if "".join(elem.itertext()) == value:
6429 * yield elem # <<<<<<<<<<<<<<
6431 * if signature == "-" or signature == "-()" or signature == "-()-":
6433 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
6434 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
6435 __Pyx_XGIVEREF(__pyx_t_1);
6436 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6437 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6438 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6439 __Pyx_XGIVEREF(__pyx_r);
6440 __Pyx_RefNannyFinishContext();
6441 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6442 /* return from generator, yielding value */
6443 __pyx_generator->resume_label = 1;
6445 __pyx_L7_resume_from_yield:;
6446 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6447 __pyx_cur_scope->__pyx_t_0 = 0;
6448 __Pyx_XGOTREF(__pyx_t_1);
6449 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6450 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6451 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 201, __pyx_L1_error)
6453 /* "lxml/_elementpath.py":200
6454 * def select(result):
6455 * for elem in result:
6456 * if "".join(elem.itertext()) == value: # <<<<<<<<<<<<<<
6462 /* "lxml/_elementpath.py":199
6464 * def select(result):
6465 * for elem in result: # <<<<<<<<<<<<<<
6466 * if "".join(elem.itertext()) == value:
6470 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6471 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6473 /* "lxml/_elementpath.py":198
6476 * def select(result): # <<<<<<<<<<<<<<
6477 * for elem in result:
6478 * if "".join(elem.itertext()) == value:
6481 /* function exit code */
6482 PyErr_SetNone(PyExc_StopIteration);
6485 __Pyx_XDECREF(__pyx_t_1);
6486 __Pyx_XDECREF(__pyx_t_4);
6487 __Pyx_XDECREF(__pyx_t_5);
6488 __Pyx_XDECREF(__pyx_t_6);
6489 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6491 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6492 #if !CYTHON_USE_EXC_INFO_STACK
6493 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6495 __pyx_generator->resume_label = -1;
6496 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6497 __Pyx_RefNannyFinishContext();
6500 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_17generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
6502 /* "lxml/_elementpath.py":224
6505 * def select(result): # <<<<<<<<<<<<<<
6506 * for elem in result:
6507 * parent = elem.getparent()
6510 /* Python wrapper */
6511 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_16select(PyObject *__pyx_self, PyObject *__pyx_v_result); /*proto*/
6512 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_17prepare_predicate_16select = {"select", (PyCFunction)__pyx_pw_4lxml_12_elementpath_17prepare_predicate_16select, METH_O, 0};
6513 static PyObject *__pyx_pw_4lxml_12_elementpath_17prepare_predicate_16select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
6514 PyObject *__pyx_r = 0;
6515 __Pyx_RefNannyDeclarations
6516 __Pyx_RefNannySetupContext("select (wrapper)", 0);
6517 __pyx_r = __pyx_pf_4lxml_12_elementpath_17prepare_predicate_15select(__pyx_self, ((PyObject *)__pyx_v_result));
6519 /* function exit code */
6520 __Pyx_RefNannyFinishContext();
6524 static PyObject *__pyx_pf_4lxml_12_elementpath_17prepare_predicate_15select(PyObject *__pyx_self, PyObject *__pyx_v_result) {
6525 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *__pyx_cur_scope;
6526 PyObject *__pyx_r = NULL;
6527 __Pyx_RefNannyDeclarations
6528 int __pyx_lineno = 0;
6529 const char *__pyx_filename = NULL;
6530 int __pyx_clineno = 0;
6531 __Pyx_RefNannySetupContext("select", 0);
6532 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_13_select, __pyx_empty_tuple, NULL);
6533 if (unlikely(!__pyx_cur_scope)) {
6534 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)Py_None);
6535 __Pyx_INCREF(Py_None);
6536 __PYX_ERR(0, 224, __pyx_L1_error)
6538 __Pyx_GOTREF(__pyx_cur_scope);
6540 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *) __Pyx_CyFunction_GetClosure(__pyx_self);
6541 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
6542 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
6543 __pyx_cur_scope->__pyx_v_result = __pyx_v_result;
6544 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_result);
6545 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_result);
6547 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_17prepare_predicate_17generator10, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_select, __pyx_n_s_prepare_predicate_locals_select, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 224, __pyx_L1_error)
6548 __Pyx_DECREF(__pyx_cur_scope);
6549 __Pyx_RefNannyFinishContext();
6550 return (PyObject *) gen;
6553 /* function exit code */
6555 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6557 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6558 __Pyx_XGIVEREF(__pyx_r);
6559 __Pyx_RefNannyFinishContext();
6563 static PyObject *__pyx_gb_4lxml_12_elementpath_17prepare_predicate_17generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
6565 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)__pyx_generator->closure);
6566 PyObject *__pyx_r = NULL;
6567 PyObject *__pyx_t_1 = NULL;
6568 Py_ssize_t __pyx_t_2;
6569 PyObject *(*__pyx_t_3)(PyObject *);
6570 PyObject *__pyx_t_4 = NULL;
6571 PyObject *__pyx_t_5 = NULL;
6572 PyObject *__pyx_t_6 = NULL;
6575 PyObject *__pyx_t_9 = NULL;
6576 PyObject *__pyx_t_10 = NULL;
6577 PyObject *__pyx_t_11 = NULL;
6578 PyObject *__pyx_t_12 = NULL;
6580 int __pyx_lineno = 0;
6581 const char *__pyx_filename = NULL;
6582 int __pyx_clineno = 0;
6583 __Pyx_RefNannyDeclarations
6584 __Pyx_RefNannySetupContext("select", 0);
6585 switch (__pyx_generator->resume_label) {
6586 case 0: goto __pyx_L3_first_run;
6587 case 1: goto __pyx_L16_resume_from_yield;
6588 default: /* CPython raises the right error here */
6589 __Pyx_RefNannyFinishContext();
6592 __pyx_L3_first_run:;
6593 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 224, __pyx_L1_error)
6595 /* "lxml/_elementpath.py":225
6597 * def select(result):
6598 * for elem in result: # <<<<<<<<<<<<<<
6599 * parent = elem.getparent()
6600 * if parent is None:
6602 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_result)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_result)) {
6603 __pyx_t_1 = __pyx_cur_scope->__pyx_v_result; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6606 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
6607 __Pyx_GOTREF(__pyx_t_1);
6608 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
6611 if (likely(!__pyx_t_3)) {
6612 if (likely(PyList_CheckExact(__pyx_t_1))) {
6613 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
6614 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6615 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error)
6617 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
6618 __Pyx_GOTREF(__pyx_t_4);
6621 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6622 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6623 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error)
6625 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
6626 __Pyx_GOTREF(__pyx_t_4);
6630 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6631 if (unlikely(!__pyx_t_4)) {
6632 PyObject* exc_type = PyErr_Occurred();
6634 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6635 else __PYX_ERR(0, 225, __pyx_L1_error)
6639 __Pyx_GOTREF(__pyx_t_4);
6641 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
6642 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_4);
6643 __Pyx_GIVEREF(__pyx_t_4);
6646 /* "lxml/_elementpath.py":226
6647 * def select(result):
6648 * for elem in result:
6649 * parent = elem.getparent() # <<<<<<<<<<<<<<
6650 * if parent is None:
6653 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_getparent); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6654 __Pyx_GOTREF(__pyx_t_5);
6656 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6657 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6658 if (likely(__pyx_t_6)) {
6659 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6660 __Pyx_INCREF(__pyx_t_6);
6661 __Pyx_INCREF(function);
6662 __Pyx_DECREF_SET(__pyx_t_5, function);
6665 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
6666 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6667 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
6668 __Pyx_GOTREF(__pyx_t_4);
6669 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6670 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_parent);
6671 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_parent, __pyx_t_4);
6672 __Pyx_GIVEREF(__pyx_t_4);
6675 /* "lxml/_elementpath.py":227
6676 * for elem in result:
6677 * parent = elem.getparent()
6678 * if parent is None: # <<<<<<<<<<<<<<
6682 __pyx_t_7 = (__pyx_cur_scope->__pyx_v_parent == Py_None);
6683 __pyx_t_8 = (__pyx_t_7 != 0);
6686 /* "lxml/_elementpath.py":228
6687 * parent = elem.getparent()
6688 * if parent is None:
6689 * continue # <<<<<<<<<<<<<<
6691 * # FIXME: what if the selector is "*" ?
6693 goto __pyx_L4_continue;
6695 /* "lxml/_elementpath.py":227
6696 * for elem in result:
6697 * parent = elem.getparent()
6698 * if parent is None: # <<<<<<<<<<<<<<
6704 /* "lxml/_elementpath.py":229
6705 * if parent is None:
6707 * try: # <<<<<<<<<<<<<<
6708 * # FIXME: what if the selector is "*" ?
6709 * elems = list(parent.iterchildren(elem.tag))
6712 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
6713 __Pyx_XGOTREF(__pyx_t_9);
6714 __Pyx_XGOTREF(__pyx_t_10);
6715 __Pyx_XGOTREF(__pyx_t_11);
6718 /* "lxml/_elementpath.py":231
6720 * # FIXME: what if the selector is "*" ?
6721 * elems = list(parent.iterchildren(elem.tag)) # <<<<<<<<<<<<<<
6722 * if elems[index] is elem:
6725 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_parent, __pyx_n_s_iterchildren); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L7_error)
6726 __Pyx_GOTREF(__pyx_t_5);
6727 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_elem, __pyx_n_s_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 231, __pyx_L7_error)
6728 __Pyx_GOTREF(__pyx_t_6);
6730 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6731 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
6732 if (likely(__pyx_t_12)) {
6733 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6734 __Pyx_INCREF(__pyx_t_12);
6735 __Pyx_INCREF(function);
6736 __Pyx_DECREF_SET(__pyx_t_5, function);
6739 __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
6740 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
6741 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6742 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L7_error)
6743 __Pyx_GOTREF(__pyx_t_4);
6744 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6745 __pyx_t_5 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L7_error)
6746 __Pyx_GOTREF(__pyx_t_5);
6747 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6748 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elems);
6749 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elems, ((PyObject*)__pyx_t_5));
6750 __Pyx_GIVEREF(__pyx_t_5);
6753 /* "lxml/_elementpath.py":232
6754 * # FIXME: what if the selector is "*" ?
6755 * elems = list(parent.iterchildren(elem.tag))
6756 * if elems[index] is elem: # <<<<<<<<<<<<<<
6758 * except IndexError:
6760 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_index)) { __Pyx_RaiseClosureNameError("index"); __PYX_ERR(0, 232, __pyx_L7_error) }
6761 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_elems, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L7_error)
6762 __Pyx_GOTREF(__pyx_t_5);
6763 __pyx_t_8 = (__pyx_t_5 == __pyx_cur_scope->__pyx_v_elem);
6764 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6765 __pyx_t_7 = (__pyx_t_8 != 0);
6768 /* "lxml/_elementpath.py":233
6769 * elems = list(parent.iterchildren(elem.tag))
6770 * if elems[index] is elem:
6771 * yield elem # <<<<<<<<<<<<<<
6772 * except IndexError:
6775 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_elem);
6776 __pyx_r = __pyx_cur_scope->__pyx_v_elem;
6777 __Pyx_XGIVEREF(__pyx_t_1);
6778 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6779 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6780 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6781 __Pyx_XGIVEREF(__pyx_t_9);
6782 __pyx_cur_scope->__pyx_t_3 = __pyx_t_9;
6783 __Pyx_XGIVEREF(__pyx_t_10);
6784 __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
6785 __Pyx_XGIVEREF(__pyx_t_11);
6786 __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
6787 __Pyx_XGIVEREF(__pyx_r);
6788 __Pyx_RefNannyFinishContext();
6789 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6790 /* return from generator, yielding value */
6791 __pyx_generator->resume_label = 1;
6793 __pyx_L16_resume_from_yield:;
6794 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6795 __pyx_cur_scope->__pyx_t_0 = 0;
6796 __Pyx_XGOTREF(__pyx_t_1);
6797 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6798 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6799 __pyx_t_9 = __pyx_cur_scope->__pyx_t_3;
6800 __pyx_cur_scope->__pyx_t_3 = 0;
6801 __Pyx_XGOTREF(__pyx_t_9);
6802 __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
6803 __pyx_cur_scope->__pyx_t_4 = 0;
6804 __Pyx_XGOTREF(__pyx_t_10);
6805 __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
6806 __pyx_cur_scope->__pyx_t_5 = 0;
6807 __Pyx_XGOTREF(__pyx_t_11);
6808 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 233, __pyx_L7_error)
6810 /* "lxml/_elementpath.py":232
6811 * # FIXME: what if the selector is "*" ?
6812 * elems = list(parent.iterchildren(elem.tag))
6813 * if elems[index] is elem: # <<<<<<<<<<<<<<
6815 * except IndexError:
6819 /* "lxml/_elementpath.py":229
6820 * if parent is None:
6822 * try: # <<<<<<<<<<<<<<
6823 * # FIXME: what if the selector is "*" ?
6824 * elems = list(parent.iterchildren(elem.tag))
6827 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6828 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6829 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
6830 goto __pyx_L14_try_end;
6832 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
6833 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6834 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6835 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6837 /* "lxml/_elementpath.py":234
6838 * if elems[index] is elem:
6840 * except IndexError: # <<<<<<<<<<<<<<
6844 __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
6846 __Pyx_ErrRestore(0,0,0);
6847 goto __pyx_L8_exception_handled;
6849 goto __pyx_L9_except_error;
6850 __pyx_L9_except_error:;
6852 /* "lxml/_elementpath.py":229
6853 * if parent is None:
6855 * try: # <<<<<<<<<<<<<<
6856 * # FIXME: what if the selector is "*" ?
6857 * elems = list(parent.iterchildren(elem.tag))
6859 __Pyx_XGIVEREF(__pyx_t_9);
6860 __Pyx_XGIVEREF(__pyx_t_10);
6861 __Pyx_XGIVEREF(__pyx_t_11);
6862 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
6863 goto __pyx_L1_error;
6864 __pyx_L8_exception_handled:;
6865 __Pyx_XGIVEREF(__pyx_t_9);
6866 __Pyx_XGIVEREF(__pyx_t_10);
6867 __Pyx_XGIVEREF(__pyx_t_11);
6868 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
6872 /* "lxml/_elementpath.py":225
6874 * def select(result):
6875 * for elem in result: # <<<<<<<<<<<<<<
6876 * parent = elem.getparent()
6877 * if parent is None:
6881 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6882 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6884 /* "lxml/_elementpath.py":224
6887 * def select(result): # <<<<<<<<<<<<<<
6888 * for elem in result:
6889 * parent = elem.getparent()
6892 /* function exit code */
6893 PyErr_SetNone(PyExc_StopIteration);
6896 __Pyx_XDECREF(__pyx_t_1);
6897 __Pyx_XDECREF(__pyx_t_4);
6898 __Pyx_XDECREF(__pyx_t_5);
6899 __Pyx_XDECREF(__pyx_t_6);
6900 __Pyx_XDECREF(__pyx_t_12);
6901 __Pyx_AddTraceback("select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6903 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6904 #if !CYTHON_USE_EXC_INFO_STACK
6905 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6907 __pyx_generator->resume_label = -1;
6908 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6909 __Pyx_RefNannyFinishContext();
6913 /* "lxml/_elementpath.py":141
6916 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
6917 * # FIXME: replace with real parser!!! refs:
6918 * # http://effbot.org/zone/simple-iterator-parser.htm
6921 static PyObject *__pyx_pf_4lxml_12_elementpath_13prepare_predicate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_next, PyObject *__pyx_v_token) {
6922 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_cur_scope;
6923 PyObject *__pyx_v_signature = NULL;
6924 PyObject *__pyx_v_predicate = NULL;
6925 PyObject *__pyx_v_select = 0;
6926 PyObject *__pyx_r = NULL;
6927 __Pyx_RefNannyDeclarations
6928 PyObject *__pyx_t_1 = NULL;
6929 PyObject *__pyx_t_2 = NULL;
6930 PyObject *__pyx_t_3 = NULL;
6935 PyObject *__pyx_t_8 = NULL;
6937 PyObject *__pyx_t_10 = NULL;
6938 PyObject *__pyx_t_11 = NULL;
6939 PyObject *__pyx_t_12 = NULL;
6940 PyObject *__pyx_t_13 = NULL;
6941 int __pyx_lineno = 0;
6942 const char *__pyx_filename = NULL;
6943 int __pyx_clineno = 0;
6944 __Pyx_RefNannySetupContext("prepare_predicate", 0);
6945 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, __pyx_empty_tuple, NULL);
6946 if (unlikely(!__pyx_cur_scope)) {
6947 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)Py_None);
6948 __Pyx_INCREF(Py_None);
6949 __PYX_ERR(0, 141, __pyx_L1_error)
6951 __Pyx_GOTREF(__pyx_cur_scope);
6953 __Pyx_INCREF(__pyx_v_token);
6955 /* "lxml/_elementpath.py":145
6956 * # http://effbot.org/zone/simple-iterator-parser.htm
6957 * # http://javascript.crockford.com/tdop/tdop.html
6958 * signature = '' # <<<<<<<<<<<<<<
6962 __Pyx_INCREF(__pyx_kp_s__2);
6963 __pyx_v_signature = __pyx_kp_s__2;
6965 /* "lxml/_elementpath.py":146
6966 * # http://javascript.crockford.com/tdop/tdop.html
6968 * predicate = [] # <<<<<<<<<<<<<<
6972 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
6973 __Pyx_GOTREF(__pyx_t_1);
6974 __pyx_v_predicate = ((PyObject*)__pyx_t_1);
6977 /* "lxml/_elementpath.py":147
6980 * while 1: # <<<<<<<<<<<<<<
6982 * if token[0] == "]":
6986 /* "lxml/_elementpath.py":148
6989 * token = next() # <<<<<<<<<<<<<<
6990 * if token[0] == "]":
6993 __Pyx_INCREF(__pyx_v_next);
6994 __pyx_t_2 = __pyx_v_next; __pyx_t_3 = NULL;
6995 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6996 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6997 if (likely(__pyx_t_3)) {
6998 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6999 __Pyx_INCREF(__pyx_t_3);
7000 __Pyx_INCREF(function);
7001 __Pyx_DECREF_SET(__pyx_t_2, function);
7004 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7005 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7006 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
7007 __Pyx_GOTREF(__pyx_t_1);
7008 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7009 __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_1);
7012 /* "lxml/_elementpath.py":149
7015 * if token[0] == "]": # <<<<<<<<<<<<<<
7017 * if token == ('', ''):
7019 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
7020 __Pyx_GOTREF(__pyx_t_1);
7021 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__19, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 149, __pyx_L1_error)
7022 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7025 /* "lxml/_elementpath.py":150
7027 * if token[0] == "]":
7028 * break # <<<<<<<<<<<<<<
7029 * if token == ('', ''):
7030 * # ignore whitespace
7032 goto __pyx_L4_break;
7034 /* "lxml/_elementpath.py":149
7037 * if token[0] == "]": # <<<<<<<<<<<<<<
7039 * if token == ('', ''):
7043 /* "lxml/_elementpath.py":151
7044 * if token[0] == "]":
7046 * if token == ('', ''): # <<<<<<<<<<<<<<
7047 * # ignore whitespace
7050 __pyx_t_1 = PyObject_RichCompare(__pyx_v_token, __pyx_tuple__20, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
7051 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 151, __pyx_L1_error)
7052 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7055 /* "lxml/_elementpath.py":153
7056 * if token == ('', ''):
7057 * # ignore whitespace
7058 * continue # <<<<<<<<<<<<<<
7059 * if token[0] and token[0][:1] in "'\"":
7060 * token = "'", token[0][1:-1]
7062 goto __pyx_L3_continue;
7064 /* "lxml/_elementpath.py":151
7065 * if token[0] == "]":
7067 * if token == ('', ''): # <<<<<<<<<<<<<<
7068 * # ignore whitespace
7073 /* "lxml/_elementpath.py":154
7074 * # ignore whitespace
7076 * if token[0] and token[0][:1] in "'\"": # <<<<<<<<<<<<<<
7077 * token = "'", token[0][1:-1]
7078 * signature += token[0] or "-"
7080 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
7081 __Pyx_GOTREF(__pyx_t_1);
7082 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
7083 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7086 __pyx_t_4 = __pyx_t_5;
7087 goto __pyx_L8_bool_binop_done;
7089 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
7090 __Pyx_GOTREF(__pyx_t_1);
7091 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 1, NULL, NULL, &__pyx_slice__21, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
7092 __Pyx_GOTREF(__pyx_t_2);
7093 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7094 __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_kp_s__22, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
7095 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7096 __pyx_t_6 = (__pyx_t_5 != 0);
7097 __pyx_t_4 = __pyx_t_6;
7098 __pyx_L8_bool_binop_done:;
7101 /* "lxml/_elementpath.py":155
7103 * if token[0] and token[0][:1] in "'\"":
7104 * token = "'", token[0][1:-1] # <<<<<<<<<<<<<<
7105 * signature += token[0] or "-"
7106 * predicate.append(token[1])
7108 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
7109 __Pyx_GOTREF(__pyx_t_2);
7110 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 1, -1L, NULL, NULL, &__pyx_slice__24, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
7111 __Pyx_GOTREF(__pyx_t_1);
7112 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7113 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
7114 __Pyx_GOTREF(__pyx_t_2);
7115 __Pyx_INCREF(__pyx_kp_s__23);
7116 __Pyx_GIVEREF(__pyx_kp_s__23);
7117 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__23);
7118 __Pyx_GIVEREF(__pyx_t_1);
7119 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
7121 __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_2);
7124 /* "lxml/_elementpath.py":154
7125 * # ignore whitespace
7127 * if token[0] and token[0][:1] in "'\"": # <<<<<<<<<<<<<<
7128 * token = "'", token[0][1:-1]
7129 * signature += token[0] or "-"
7133 /* "lxml/_elementpath.py":156
7134 * if token[0] and token[0][:1] in "'\"":
7135 * token = "'", token[0][1:-1]
7136 * signature += token[0] or "-" # <<<<<<<<<<<<<<
7137 * predicate.append(token[1])
7140 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
7141 __Pyx_GOTREF(__pyx_t_1);
7142 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
7144 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7146 __Pyx_INCREF(__pyx_t_1);
7147 __pyx_t_2 = __pyx_t_1;
7148 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7149 goto __pyx_L10_bool_binop_done;
7151 __Pyx_INCREF(__pyx_kp_s__25);
7152 __pyx_t_2 = __pyx_kp_s__25;
7153 __pyx_L10_bool_binop_done:;
7154 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_signature, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
7155 __Pyx_GOTREF(__pyx_t_1);
7156 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7157 __Pyx_DECREF_SET(__pyx_v_signature, __pyx_t_1);
7160 /* "lxml/_elementpath.py":157
7161 * token = "'", token[0][1:-1]
7162 * signature += token[0] or "-"
7163 * predicate.append(token[1]) # <<<<<<<<<<<<<<
7165 * # use signature to determine predicate type
7167 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_token, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
7168 __Pyx_GOTREF(__pyx_t_1);
7169 __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_predicate, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 157, __pyx_L1_error)
7170 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7175 /* "lxml/_elementpath.py":160
7177 * # use signature to determine predicate type
7178 * if signature == "@-": # <<<<<<<<<<<<<<
7179 * # [@attribute] predicate
7180 * key = predicate[1]
7182 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__26, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 160, __pyx_L1_error)
7185 /* "lxml/_elementpath.py":162
7186 * if signature == "@-":
7187 * # [@attribute] predicate
7188 * key = predicate[1] # <<<<<<<<<<<<<<
7189 * def select(result):
7190 * for elem in result:
7192 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
7193 __Pyx_GOTREF(__pyx_t_1);
7194 __Pyx_GIVEREF(__pyx_t_1);
7195 __pyx_cur_scope->__pyx_v_key = __pyx_t_1;
7198 /* "lxml/_elementpath.py":163
7199 * # [@attribute] predicate
7200 * key = predicate[1]
7201 * def select(result): # <<<<<<<<<<<<<<
7202 * for elem in result:
7203 * if elem.get(key) is not None:
7205 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_1select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
7206 __Pyx_GOTREF(__pyx_t_1);
7207 __pyx_v_select = __pyx_t_1;
7210 /* "lxml/_elementpath.py":167
7211 * if elem.get(key) is not None:
7213 * return select # <<<<<<<<<<<<<<
7214 * if signature == "@-='":
7215 * # [@attribute='value']
7217 __Pyx_XDECREF(__pyx_r);
7218 __Pyx_INCREF(__pyx_v_select);
7219 __pyx_r = __pyx_v_select;
7222 /* "lxml/_elementpath.py":160
7224 * # use signature to determine predicate type
7225 * if signature == "@-": # <<<<<<<<<<<<<<
7226 * # [@attribute] predicate
7227 * key = predicate[1]
7231 /* "lxml/_elementpath.py":168
7234 * if signature == "@-='": # <<<<<<<<<<<<<<
7235 * # [@attribute='value']
7236 * key = predicate[1]
7238 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__29, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
7241 /* "lxml/_elementpath.py":170
7242 * if signature == "@-='":
7243 * # [@attribute='value']
7244 * key = predicate[1] # <<<<<<<<<<<<<<
7245 * value = predicate[-1]
7246 * def select(result):
7248 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
7249 __Pyx_GOTREF(__pyx_t_1);
7250 __Pyx_GIVEREF(__pyx_t_1);
7251 __pyx_cur_scope->__pyx_v_key = __pyx_t_1;
7254 /* "lxml/_elementpath.py":171
7255 * # [@attribute='value']
7256 * key = predicate[1]
7257 * value = predicate[-1] # <<<<<<<<<<<<<<
7258 * def select(result):
7259 * for elem in result:
7261 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
7262 __Pyx_GOTREF(__pyx_t_1);
7263 __Pyx_GIVEREF(__pyx_t_1);
7264 __pyx_cur_scope->__pyx_v_value = __pyx_t_1;
7267 /* "lxml/_elementpath.py":172
7268 * key = predicate[1]
7269 * value = predicate[-1]
7270 * def select(result): # <<<<<<<<<<<<<<
7271 * for elem in result:
7272 * if elem.get(key) == value:
7274 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_4select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
7275 __Pyx_GOTREF(__pyx_t_1);
7276 __pyx_v_select = __pyx_t_1;
7279 /* "lxml/_elementpath.py":176
7280 * if elem.get(key) == value:
7282 * return select # <<<<<<<<<<<<<<
7283 * if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
7286 __Pyx_XDECREF(__pyx_r);
7287 __Pyx_INCREF(__pyx_v_select);
7288 __pyx_r = __pyx_v_select;
7291 /* "lxml/_elementpath.py":168
7294 * if signature == "@-='": # <<<<<<<<<<<<<<
7295 * # [@attribute='value']
7296 * key = predicate[1]
7300 /* "lxml/_elementpath.py":177
7303 * if signature == "-" and not re.match(r"-?\d+$", predicate[0]): # <<<<<<<<<<<<<<
7305 * tag = predicate[0]
7307 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 177, __pyx_L1_error)
7310 __pyx_t_4 = __pyx_t_6;
7311 goto __pyx_L15_bool_binop_done;
7313 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
7314 __Pyx_GOTREF(__pyx_t_2);
7315 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
7316 __Pyx_GOTREF(__pyx_t_3);
7317 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7318 __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
7319 __Pyx_GOTREF(__pyx_t_2);
7322 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7323 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
7324 if (likely(__pyx_t_8)) {
7325 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7326 __Pyx_INCREF(__pyx_t_8);
7327 __Pyx_INCREF(function);
7328 __Pyx_DECREF_SET(__pyx_t_3, function);
7332 #if CYTHON_FAST_PYCALL
7333 if (PyFunction_Check(__pyx_t_3)) {
7334 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_s_d, __pyx_t_2};
7335 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
7336 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7337 __Pyx_GOTREF(__pyx_t_1);
7338 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7341 #if CYTHON_FAST_PYCCALL
7342 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7343 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_kp_s_d, __pyx_t_2};
7344 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
7345 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7346 __Pyx_GOTREF(__pyx_t_1);
7347 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7351 __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 177, __pyx_L1_error)
7352 __Pyx_GOTREF(__pyx_t_10);
7354 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
7356 __Pyx_INCREF(__pyx_kp_s_d);
7357 __Pyx_GIVEREF(__pyx_kp_s_d);
7358 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_s_d);
7359 __Pyx_GIVEREF(__pyx_t_2);
7360 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_2);
7362 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
7363 __Pyx_GOTREF(__pyx_t_1);
7364 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7366 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7367 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 177, __pyx_L1_error)
7368 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7369 __pyx_t_5 = ((!__pyx_t_6) != 0);
7370 __pyx_t_4 = __pyx_t_5;
7371 __pyx_L15_bool_binop_done:;
7374 /* "lxml/_elementpath.py":179
7375 * if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
7377 * tag = predicate[0] # <<<<<<<<<<<<<<
7378 * def select(result):
7379 * for elem in result:
7381 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
7382 __Pyx_GOTREF(__pyx_t_1);
7383 __Pyx_GIVEREF(__pyx_t_1);
7384 __pyx_cur_scope->__pyx_v_tag = __pyx_t_1;
7387 /* "lxml/_elementpath.py":180
7389 * tag = predicate[0]
7390 * def select(result): # <<<<<<<<<<<<<<
7391 * for elem in result:
7392 * for _ in elem.iterchildren(tag):
7394 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_7select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
7395 __Pyx_GOTREF(__pyx_t_1);
7396 __pyx_v_select = __pyx_t_1;
7399 /* "lxml/_elementpath.py":185
7402 * return select # <<<<<<<<<<<<<<
7403 * if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):
7404 * # [.='value'] or [tag='value']
7406 __Pyx_XDECREF(__pyx_r);
7407 __Pyx_INCREF(__pyx_v_select);
7408 __pyx_r = __pyx_v_select;
7411 /* "lxml/_elementpath.py":177
7414 * if signature == "-" and not re.match(r"-?\d+$", predicate[0]): # <<<<<<<<<<<<<<
7416 * tag = predicate[0]
7420 /* "lxml/_elementpath.py":186
7423 * if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])): # <<<<<<<<<<<<<<
7424 * # [.='value'] or [tag='value']
7425 * tag = predicate[0]
7427 __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__35, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
7430 __pyx_t_4 = __pyx_t_5;
7431 goto __pyx_L18_bool_binop_done;
7433 __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__36, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
7436 __pyx_t_4 = __pyx_t_5;
7437 goto __pyx_L18_bool_binop_done;
7439 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
7440 __Pyx_GOTREF(__pyx_t_3);
7441 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_match); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 186, __pyx_L1_error)
7442 __Pyx_GOTREF(__pyx_t_10);
7443 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7444 __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
7445 __Pyx_GOTREF(__pyx_t_3);
7448 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
7449 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
7450 if (likely(__pyx_t_2)) {
7451 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7452 __Pyx_INCREF(__pyx_t_2);
7453 __Pyx_INCREF(function);
7454 __Pyx_DECREF_SET(__pyx_t_10, function);
7458 #if CYTHON_FAST_PYCALL
7459 if (PyFunction_Check(__pyx_t_10)) {
7460 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_d, __pyx_t_3};
7461 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
7462 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7463 __Pyx_GOTREF(__pyx_t_1);
7464 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7467 #if CYTHON_FAST_PYCCALL
7468 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
7469 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_d, __pyx_t_3};
7470 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
7471 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7472 __Pyx_GOTREF(__pyx_t_1);
7473 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7477 __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
7478 __Pyx_GOTREF(__pyx_t_8);
7480 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
7482 __Pyx_INCREF(__pyx_kp_s_d);
7483 __Pyx_GIVEREF(__pyx_kp_s_d);
7484 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_kp_s_d);
7485 __Pyx_GIVEREF(__pyx_t_3);
7486 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_3);
7488 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
7489 __Pyx_GOTREF(__pyx_t_1);
7490 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7492 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7493 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
7494 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7495 __pyx_t_6 = ((!__pyx_t_5) != 0);
7496 __pyx_t_4 = __pyx_t_6;
7497 __pyx_L18_bool_binop_done:;
7500 /* "lxml/_elementpath.py":188
7501 * if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):
7502 * # [.='value'] or [tag='value']
7503 * tag = predicate[0] # <<<<<<<<<<<<<<
7504 * value = predicate[-1]
7507 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
7508 __Pyx_GOTREF(__pyx_t_1);
7509 __Pyx_GIVEREF(__pyx_t_1);
7510 __pyx_cur_scope->__pyx_v_tag = __pyx_t_1;
7513 /* "lxml/_elementpath.py":189
7514 * # [.='value'] or [tag='value']
7515 * tag = predicate[0]
7516 * value = predicate[-1] # <<<<<<<<<<<<<<
7518 * def select(result):
7520 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
7521 __Pyx_GOTREF(__pyx_t_1);
7522 __Pyx_GIVEREF(__pyx_t_1);
7523 __pyx_cur_scope->__pyx_v_value = __pyx_t_1;
7526 /* "lxml/_elementpath.py":190
7527 * tag = predicate[0]
7528 * value = predicate[-1]
7529 * if tag: # <<<<<<<<<<<<<<
7530 * def select(result):
7531 * for elem in result:
7533 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_tag); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 190, __pyx_L1_error)
7536 /* "lxml/_elementpath.py":191
7537 * value = predicate[-1]
7539 * def select(result): # <<<<<<<<<<<<<<
7540 * for elem in result:
7541 * for e in elem.iterchildren(tag):
7543 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_10select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
7544 __Pyx_GOTREF(__pyx_t_1);
7545 __pyx_v_select = __pyx_t_1;
7548 /* "lxml/_elementpath.py":190
7549 * tag = predicate[0]
7550 * value = predicate[-1]
7551 * if tag: # <<<<<<<<<<<<<<
7552 * def select(result):
7553 * for elem in result:
7558 /* "lxml/_elementpath.py":198
7561 * def select(result): # <<<<<<<<<<<<<<
7562 * for elem in result:
7563 * if "".join(elem.itertext()) == value:
7566 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_13select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
7567 __Pyx_GOTREF(__pyx_t_1);
7568 __pyx_v_select = __pyx_t_1;
7573 /* "lxml/_elementpath.py":202
7574 * if "".join(elem.itertext()) == value:
7576 * return select # <<<<<<<<<<<<<<
7577 * if signature == "-" or signature == "-()" or signature == "-()-":
7578 * # [index] or [last()] or [last()-index]
7580 __Pyx_XDECREF(__pyx_r);
7581 __Pyx_INCREF(__pyx_v_select);
7582 __pyx_r = __pyx_v_select;
7585 /* "lxml/_elementpath.py":186
7588 * if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])): # <<<<<<<<<<<<<<
7589 * # [.='value'] or [tag='value']
7590 * tag = predicate[0]
7594 /* "lxml/_elementpath.py":203
7597 * if signature == "-" or signature == "-()" or signature == "-()-": # <<<<<<<<<<<<<<
7598 * # [index] or [last()] or [last()-index]
7599 * if signature == "-":
7601 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 203, __pyx_L1_error)
7604 __pyx_t_4 = __pyx_t_6;
7605 goto __pyx_L23_bool_binop_done;
7607 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__41, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 203, __pyx_L1_error)
7610 __pyx_t_4 = __pyx_t_6;
7611 goto __pyx_L23_bool_binop_done;
7613 __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__42, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 203, __pyx_L1_error)
7614 __pyx_t_4 = __pyx_t_6;
7615 __pyx_L23_bool_binop_done:;
7618 /* "lxml/_elementpath.py":205
7619 * if signature == "-" or signature == "-()" or signature == "-()-":
7620 * # [index] or [last()] or [last()-index]
7621 * if signature == "-": # <<<<<<<<<<<<<<
7623 * index = int(predicate[0]) - 1
7625 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__25, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
7628 /* "lxml/_elementpath.py":207
7629 * if signature == "-":
7631 * index = int(predicate[0]) - 1 # <<<<<<<<<<<<<<
7635 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
7636 __Pyx_GOTREF(__pyx_t_1);
7637 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 207, __pyx_L1_error)
7638 __Pyx_GOTREF(__pyx_t_10);
7639 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7640 __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
7641 __Pyx_GOTREF(__pyx_t_1);
7642 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7643 __Pyx_GIVEREF(__pyx_t_1);
7644 __pyx_cur_scope->__pyx_v_index = __pyx_t_1;
7647 /* "lxml/_elementpath.py":208
7649 * index = int(predicate[0]) - 1
7650 * if index < 0: # <<<<<<<<<<<<<<
7652 * raise SyntaxError(
7654 __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_index, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
7655 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
7656 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7659 /* "lxml/_elementpath.py":209
7660 * index = int(predicate[0]) - 1
7662 * if index == -1: # <<<<<<<<<<<<<<
7663 * raise SyntaxError(
7664 * "indices in path predicates are 1-based, not 0-based")
7666 __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_cur_scope->__pyx_v_index, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
7667 __Pyx_GOTREF(__pyx_t_1);
7668 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
7669 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7670 if (unlikely(__pyx_t_4)) {
7672 /* "lxml/_elementpath.py":210
7675 * raise SyntaxError( # <<<<<<<<<<<<<<
7676 * "indices in path predicates are 1-based, not 0-based")
7679 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
7680 __Pyx_GOTREF(__pyx_t_1);
7681 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7682 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7683 __PYX_ERR(0, 210, __pyx_L1_error)
7685 /* "lxml/_elementpath.py":209
7686 * index = int(predicate[0]) - 1
7688 * if index == -1: # <<<<<<<<<<<<<<
7689 * raise SyntaxError(
7690 * "indices in path predicates are 1-based, not 0-based")
7694 /* "lxml/_elementpath.py":213
7695 * "indices in path predicates are 1-based, not 0-based")
7697 * raise SyntaxError("path index >= 1 expected") # <<<<<<<<<<<<<<
7699 * if predicate[0] != "last":
7702 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
7703 __Pyx_GOTREF(__pyx_t_1);
7704 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7705 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7706 __PYX_ERR(0, 213, __pyx_L1_error)
7709 /* "lxml/_elementpath.py":208
7711 * index = int(predicate[0]) - 1
7712 * if index < 0: # <<<<<<<<<<<<<<
7714 * raise SyntaxError(
7718 /* "lxml/_elementpath.py":205
7719 * if signature == "-" or signature == "-()" or signature == "-()-":
7720 * # [index] or [last()] or [last()-index]
7721 * if signature == "-": # <<<<<<<<<<<<<<
7723 * index = int(predicate[0]) - 1
7728 /* "lxml/_elementpath.py":215
7729 * raise SyntaxError("path index >= 1 expected")
7731 * if predicate[0] != "last": # <<<<<<<<<<<<<<
7732 * raise SyntaxError("unsupported function")
7733 * if signature == "-()-":
7736 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
7737 __Pyx_GOTREF(__pyx_t_1);
7738 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_last, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 215, __pyx_L1_error)
7739 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7740 if (unlikely(__pyx_t_4)) {
7742 /* "lxml/_elementpath.py":216
7744 * if predicate[0] != "last":
7745 * raise SyntaxError("unsupported function") # <<<<<<<<<<<<<<
7746 * if signature == "-()-":
7749 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
7750 __Pyx_GOTREF(__pyx_t_1);
7751 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7752 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7753 __PYX_ERR(0, 216, __pyx_L1_error)
7755 /* "lxml/_elementpath.py":215
7756 * raise SyntaxError("path index >= 1 expected")
7758 * if predicate[0] != "last": # <<<<<<<<<<<<<<
7759 * raise SyntaxError("unsupported function")
7760 * if signature == "-()-":
7764 /* "lxml/_elementpath.py":217
7765 * if predicate[0] != "last":
7766 * raise SyntaxError("unsupported function")
7767 * if signature == "-()-": # <<<<<<<<<<<<<<
7769 * index = int(predicate[2]) - 1
7771 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_signature, __pyx_kp_s__42, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
7774 /* "lxml/_elementpath.py":218
7775 * raise SyntaxError("unsupported function")
7776 * if signature == "-()-":
7777 * try: # <<<<<<<<<<<<<<
7778 * index = int(predicate[2]) - 1
7779 * except ValueError:
7782 __Pyx_PyThreadState_declare
7783 __Pyx_PyThreadState_assign
7784 __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
7785 __Pyx_XGOTREF(__pyx_t_11);
7786 __Pyx_XGOTREF(__pyx_t_12);
7787 __Pyx_XGOTREF(__pyx_t_13);
7790 /* "lxml/_elementpath.py":219
7791 * if signature == "-()-":
7793 * index = int(predicate[2]) - 1 # <<<<<<<<<<<<<<
7794 * except ValueError:
7795 * raise SyntaxError("unsupported expression")
7797 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_predicate, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L31_error)
7798 __Pyx_GOTREF(__pyx_t_1);
7799 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L31_error)
7800 __Pyx_GOTREF(__pyx_t_10);
7801 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7802 __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L31_error)
7803 __Pyx_GOTREF(__pyx_t_1);
7804 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7805 __Pyx_GIVEREF(__pyx_t_1);
7806 __pyx_cur_scope->__pyx_v_index = __pyx_t_1;
7809 /* "lxml/_elementpath.py":218
7810 * raise SyntaxError("unsupported function")
7811 * if signature == "-()-":
7812 * try: # <<<<<<<<<<<<<<
7813 * index = int(predicate[2]) - 1
7814 * except ValueError:
7817 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7818 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
7819 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7820 goto __pyx_L36_try_end;
7822 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7823 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
7824 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7825 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7826 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7828 /* "lxml/_elementpath.py":220
7830 * index = int(predicate[2]) - 1
7831 * except ValueError: # <<<<<<<<<<<<<<
7832 * raise SyntaxError("unsupported expression")
7835 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
7837 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
7838 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_10, &__pyx_t_8) < 0) __PYX_ERR(0, 220, __pyx_L33_except_error)
7839 __Pyx_GOTREF(__pyx_t_1);
7840 __Pyx_GOTREF(__pyx_t_10);
7841 __Pyx_GOTREF(__pyx_t_8);
7843 /* "lxml/_elementpath.py":221
7844 * index = int(predicate[2]) - 1
7845 * except ValueError:
7846 * raise SyntaxError("unsupported expression") # <<<<<<<<<<<<<<
7850 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L33_except_error)
7851 __Pyx_GOTREF(__pyx_t_3);
7852 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7853 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7854 __PYX_ERR(0, 221, __pyx_L33_except_error)
7856 goto __pyx_L33_except_error;
7857 __pyx_L33_except_error:;
7859 /* "lxml/_elementpath.py":218
7860 * raise SyntaxError("unsupported function")
7861 * if signature == "-()-":
7862 * try: # <<<<<<<<<<<<<<
7863 * index = int(predicate[2]) - 1
7864 * except ValueError:
7866 __Pyx_XGIVEREF(__pyx_t_11);
7867 __Pyx_XGIVEREF(__pyx_t_12);
7868 __Pyx_XGIVEREF(__pyx_t_13);
7869 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
7870 goto __pyx_L1_error;
7874 /* "lxml/_elementpath.py":217
7875 * if predicate[0] != "last":
7876 * raise SyntaxError("unsupported function")
7877 * if signature == "-()-": # <<<<<<<<<<<<<<
7879 * index = int(predicate[2]) - 1
7884 /* "lxml/_elementpath.py":223
7885 * raise SyntaxError("unsupported expression")
7887 * index = -1 # <<<<<<<<<<<<<<
7888 * def select(result):
7889 * for elem in result:
7892 __Pyx_INCREF(__pyx_int_neg_1);
7893 __Pyx_GIVEREF(__pyx_int_neg_1);
7894 __pyx_cur_scope->__pyx_v_index = __pyx_int_neg_1;
7900 /* "lxml/_elementpath.py":224
7903 * def select(result): # <<<<<<<<<<<<<<
7904 * for elem in result:
7905 * parent = elem.getparent()
7907 __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_17prepare_predicate_16select, 0, __pyx_n_s_prepare_predicate_locals_select, ((PyObject*)__pyx_cur_scope), __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error)
7908 __Pyx_GOTREF(__pyx_t_8);
7909 __pyx_v_select = __pyx_t_8;
7912 /* "lxml/_elementpath.py":236
7913 * except IndexError:
7915 * return select # <<<<<<<<<<<<<<
7916 * raise SyntaxError("invalid predicate")
7919 __Pyx_XDECREF(__pyx_r);
7920 __Pyx_INCREF(__pyx_v_select);
7921 __pyx_r = __pyx_v_select;
7924 /* "lxml/_elementpath.py":203
7927 * if signature == "-" or signature == "-()" or signature == "-()-": # <<<<<<<<<<<<<<
7928 * # [index] or [last()] or [last()-index]
7929 * if signature == "-":
7933 /* "lxml/_elementpath.py":237
7936 * raise SyntaxError("invalid predicate") # <<<<<<<<<<<<<<
7940 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 237, __pyx_L1_error)
7941 __Pyx_GOTREF(__pyx_t_8);
7942 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7943 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7944 __PYX_ERR(0, 237, __pyx_L1_error)
7946 /* "lxml/_elementpath.py":141
7949 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
7950 * # FIXME: replace with real parser!!! refs:
7951 * # http://effbot.org/zone/simple-iterator-parser.htm
7954 /* function exit code */
7956 __Pyx_XDECREF(__pyx_t_1);
7957 __Pyx_XDECREF(__pyx_t_2);
7958 __Pyx_XDECREF(__pyx_t_3);
7959 __Pyx_XDECREF(__pyx_t_8);
7960 __Pyx_XDECREF(__pyx_t_10);
7961 __Pyx_AddTraceback("lxml._elementpath.prepare_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
7964 __Pyx_XDECREF(__pyx_v_signature);
7965 __Pyx_XDECREF(__pyx_v_predicate);
7966 __Pyx_XDECREF(__pyx_v_select);
7967 __Pyx_XDECREF(__pyx_v_token);
7968 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
7969 __Pyx_XGIVEREF(__pyx_r);
7970 __Pyx_RefNannyFinishContext();
7974 /* "lxml/_elementpath.py":254
7977 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
7978 * """compile selector pattern"""
7979 * if path[-1:] == "/":
7982 /* Python wrapper */
7983 static PyObject *__pyx_pw_4lxml_12_elementpath_16_build_path_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7984 static char __pyx_doc_4lxml_12_elementpath_15_build_path_iterator[] = "compile selector pattern";
7985 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_16_build_path_iterator = {"_build_path_iterator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_16_build_path_iterator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_12_elementpath_15_build_path_iterator};
7986 static PyObject *__pyx_pw_4lxml_12_elementpath_16_build_path_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7987 PyObject *__pyx_v_path = 0;
7988 PyObject *__pyx_v_namespaces = 0;
7989 int __pyx_lineno = 0;
7990 const char *__pyx_filename = NULL;
7991 int __pyx_clineno = 0;
7992 PyObject *__pyx_r = 0;
7993 __Pyx_RefNannyDeclarations
7994 __Pyx_RefNannySetupContext("_build_path_iterator (wrapper)", 0);
7996 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
7997 PyObject* values[2] = {0,0};
7998 if (unlikely(__pyx_kwds)) {
8000 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8002 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8004 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8007 default: goto __pyx_L5_argtuple_error;
8009 kw_args = PyDict_Size(__pyx_kwds);
8012 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
8013 else goto __pyx_L5_argtuple_error;
8016 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
8018 __Pyx_RaiseArgtupleInvalid("_build_path_iterator", 1, 2, 2, 1); __PYX_ERR(0, 254, __pyx_L3_error)
8021 if (unlikely(kw_args > 0)) {
8022 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_build_path_iterator") < 0)) __PYX_ERR(0, 254, __pyx_L3_error)
8024 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8025 goto __pyx_L5_argtuple_error;
8027 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8028 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8030 __pyx_v_path = values[0];
8031 __pyx_v_namespaces = values[1];
8033 goto __pyx_L4_argument_unpacking_done;
8034 __pyx_L5_argtuple_error:;
8035 __Pyx_RaiseArgtupleInvalid("_build_path_iterator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 254, __pyx_L3_error)
8037 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8038 __Pyx_RefNannyFinishContext();
8040 __pyx_L4_argument_unpacking_done:;
8041 __pyx_r = __pyx_pf_4lxml_12_elementpath_15_build_path_iterator(__pyx_self, __pyx_v_path, __pyx_v_namespaces);
8043 /* function exit code */
8044 __Pyx_RefNannyFinishContext();
8047 static PyObject *__pyx_gb_4lxml_12_elementpath_20_build_path_iterator_2generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
8049 /* "lxml/_elementpath.py":269
8050 * namespaces[None], namespaces['']))
8051 * cache_key += (namespaces[None],) + tuple(sorted(
8052 * item for item in namespaces.items() if item[0] is not None)) # <<<<<<<<<<<<<<
8054 * cache_key += tuple(sorted(namespaces.items()))
8057 static PyObject *__pyx_pf_4lxml_12_elementpath_20_build_path_iterator_genexpr(PyObject *__pyx_self) {
8058 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *__pyx_cur_scope;
8059 PyObject *__pyx_r = NULL;
8060 __Pyx_RefNannyDeclarations
8061 int __pyx_lineno = 0;
8062 const char *__pyx_filename = NULL;
8063 int __pyx_clineno = 0;
8064 __Pyx_RefNannySetupContext("genexpr", 0);
8065 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, __pyx_empty_tuple, NULL);
8066 if (unlikely(!__pyx_cur_scope)) {
8067 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)Py_None);
8068 __Pyx_INCREF(Py_None);
8069 __PYX_ERR(0, 269, __pyx_L1_error)
8071 __Pyx_GOTREF(__pyx_cur_scope);
8073 __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *) __pyx_self;
8074 __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
8075 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
8077 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_12_elementpath_20_build_path_iterator_2generator11, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_build_path_iterator_locals_gene, __pyx_n_s_lxml__elementpath); if (unlikely(!gen)) __PYX_ERR(0, 269, __pyx_L1_error)
8078 __Pyx_DECREF(__pyx_cur_scope);
8079 __Pyx_RefNannyFinishContext();
8080 return (PyObject *) gen;
8083 /* function exit code */
8085 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8087 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8088 __Pyx_XGIVEREF(__pyx_r);
8089 __Pyx_RefNannyFinishContext();
8093 static PyObject *__pyx_gb_4lxml_12_elementpath_20_build_path_iterator_2generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
8095 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)__pyx_generator->closure);
8096 PyObject *__pyx_r = NULL;
8097 PyObject *__pyx_t_1 = NULL;
8098 PyObject *__pyx_t_2 = NULL;
8099 PyObject *__pyx_t_3 = NULL;
8100 Py_ssize_t __pyx_t_4;
8101 PyObject *(*__pyx_t_5)(PyObject *);
8104 int __pyx_lineno = 0;
8105 const char *__pyx_filename = NULL;
8106 int __pyx_clineno = 0;
8107 __Pyx_RefNannyDeclarations
8108 __Pyx_RefNannySetupContext("genexpr", 0);
8109 switch (__pyx_generator->resume_label) {
8110 case 0: goto __pyx_L3_first_run;
8111 default: /* CPython raises the right error here */
8112 __Pyx_RefNannyFinishContext();
8115 __pyx_L3_first_run:;
8116 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 269, __pyx_L1_error)
8117 __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 269, __pyx_L1_error)
8118 __Pyx_GOTREF(__pyx_r);
8119 if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_namespaces)) { __Pyx_RaiseClosureNameError("namespaces"); __PYX_ERR(0, 269, __pyx_L1_error) }
8120 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_namespaces, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
8121 __Pyx_GOTREF(__pyx_t_2);
8123 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8124 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8125 if (likely(__pyx_t_3)) {
8126 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8127 __Pyx_INCREF(__pyx_t_3);
8128 __Pyx_INCREF(function);
8129 __Pyx_DECREF_SET(__pyx_t_2, function);
8132 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
8133 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8134 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
8135 __Pyx_GOTREF(__pyx_t_1);
8136 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8137 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
8138 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
8141 __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
8142 __Pyx_GOTREF(__pyx_t_2);
8143 __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
8145 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8147 if (likely(!__pyx_t_5)) {
8148 if (likely(PyList_CheckExact(__pyx_t_2))) {
8149 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
8150 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8151 __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, 269, __pyx_L1_error)
8153 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
8154 __Pyx_GOTREF(__pyx_t_1);
8157 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
8158 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8159 __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, 269, __pyx_L1_error)
8161 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
8162 __Pyx_GOTREF(__pyx_t_1);
8166 __pyx_t_1 = __pyx_t_5(__pyx_t_2);
8167 if (unlikely(!__pyx_t_1)) {
8168 PyObject* exc_type = PyErr_Occurred();
8170 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8171 else __PYX_ERR(0, 269, __pyx_L1_error)
8175 __Pyx_GOTREF(__pyx_t_1);
8177 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_item);
8178 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_item, __pyx_t_1);
8179 __Pyx_GIVEREF(__pyx_t_1);
8181 __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_item, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
8182 __Pyx_GOTREF(__pyx_t_1);
8183 __pyx_t_6 = (__pyx_t_1 != Py_None);
8184 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8185 __pyx_t_7 = (__pyx_t_6 != 0);
8187 if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_item))) __PYX_ERR(0, 269, __pyx_L1_error)
8190 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8191 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
8193 /* function exit code */
8196 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
8197 __Pyx_XDECREF(__pyx_t_1);
8198 __Pyx_XDECREF(__pyx_t_2);
8199 __Pyx_XDECREF(__pyx_t_3);
8200 __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8202 __Pyx_XGIVEREF(__pyx_r);
8203 #if !CYTHON_USE_EXC_INFO_STACK
8204 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
8206 __pyx_generator->resume_label = -1;
8207 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
8208 __Pyx_RefNannyFinishContext();
8212 /* "lxml/_elementpath.py":254
8215 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
8216 * """compile selector pattern"""
8217 * if path[-1:] == "/":
8220 static PyObject *__pyx_pf_4lxml_12_elementpath_15_build_path_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
8221 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *__pyx_cur_scope;
8222 PyObject *__pyx_v_cache_key = NULL;
8223 PyObject *__pyx_v_stream = NULL;
8224 PyObject *__pyx_v__next = NULL;
8225 PyObject *__pyx_v_token = NULL;
8226 PyObject *__pyx_v_selector = NULL;
8227 PyObject *__pyx_r = NULL;
8228 __Pyx_RefNannyDeclarations
8229 PyObject *__pyx_t_1 = NULL;
8233 PyObject *__pyx_t_5 = NULL;
8234 PyObject *__pyx_t_6 = NULL;
8235 PyObject *__pyx_t_7 = NULL;
8237 PyObject *__pyx_t_9 = NULL;
8238 PyObject *__pyx_t_10 = NULL;
8239 PyObject *__pyx_t_11 = NULL;
8241 Py_ssize_t __pyx_t_13;
8242 int __pyx_lineno = 0;
8243 const char *__pyx_filename = NULL;
8244 int __pyx_clineno = 0;
8245 __Pyx_RefNannySetupContext("_build_path_iterator", 0);
8246 __pyx_cur_scope = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(__pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, __pyx_empty_tuple, NULL);
8247 if (unlikely(!__pyx_cur_scope)) {
8248 __pyx_cur_scope = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)Py_None);
8249 __Pyx_INCREF(Py_None);
8250 __PYX_ERR(0, 254, __pyx_L1_error)
8252 __Pyx_GOTREF(__pyx_cur_scope);
8254 __pyx_cur_scope->__pyx_v_namespaces = __pyx_v_namespaces;
8255 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_namespaces);
8256 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_namespaces);
8257 __Pyx_INCREF(__pyx_v_path);
8259 /* "lxml/_elementpath.py":256
8260 * def _build_path_iterator(path, namespaces):
8261 * """compile selector pattern"""
8262 * if path[-1:] == "/": # <<<<<<<<<<<<<<
8263 * path += "*" # implicit all (FIXME: keep this?)
8266 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_path, -1L, 0, NULL, NULL, &__pyx_slice__50, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
8267 __Pyx_GOTREF(__pyx_t_1);
8268 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__51, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
8269 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8272 /* "lxml/_elementpath.py":257
8273 * """compile selector pattern"""
8274 * if path[-1:] == "/":
8275 * path += "*" # implicit all (FIXME: keep this?) # <<<<<<<<<<<<<<
8277 * cache_key = (path,)
8279 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_kp_s__9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
8280 __Pyx_GOTREF(__pyx_t_1);
8281 __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
8284 /* "lxml/_elementpath.py":256
8285 * def _build_path_iterator(path, namespaces):
8286 * """compile selector pattern"""
8287 * if path[-1:] == "/": # <<<<<<<<<<<<<<
8288 * path += "*" # implicit all (FIXME: keep this?)
8293 /* "lxml/_elementpath.py":259
8294 * path += "*" # implicit all (FIXME: keep this?)
8296 * cache_key = (path,) # <<<<<<<<<<<<<<
8298 * # lxml originally used None for the default namespace but ElementTree uses the
8300 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
8301 __Pyx_GOTREF(__pyx_t_1);
8302 __Pyx_INCREF(__pyx_v_path);
8303 __Pyx_GIVEREF(__pyx_v_path);
8304 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_path);
8305 __pyx_v_cache_key = ((PyObject*)__pyx_t_1);
8308 /* "lxml/_elementpath.py":260
8310 * cache_key = (path,)
8311 * if namespaces: # <<<<<<<<<<<<<<
8312 * # lxml originally used None for the default namespace but ElementTree uses the
8313 * # more convenient (all-strings-dict) empty string, so we support both here,
8315 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_namespaces); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
8318 /* "lxml/_elementpath.py":264
8319 * # more convenient (all-strings-dict) empty string, so we support both here,
8320 * # preferring the more convenient '', as long as they aren't ambiguous.
8321 * if None in namespaces: # <<<<<<<<<<<<<<
8322 * if '' in namespaces and namespaces[None] != namespaces['']:
8323 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8325 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_cur_scope->__pyx_v_namespaces, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 264, __pyx_L1_error)
8326 __pyx_t_3 = (__pyx_t_2 != 0);
8329 /* "lxml/_elementpath.py":265
8330 * # preferring the more convenient '', as long as they aren't ambiguous.
8331 * if None in namespaces:
8332 * if '' in namespaces and namespaces[None] != namespaces['']: # <<<<<<<<<<<<<<
8333 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8334 * namespaces[None], namespaces['']))
8336 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__2, __pyx_cur_scope->__pyx_v_namespaces, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
8337 __pyx_t_4 = (__pyx_t_2 != 0);
8340 __pyx_t_3 = __pyx_t_4;
8341 goto __pyx_L7_bool_binop_done;
8343 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_namespaces, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
8344 __Pyx_GOTREF(__pyx_t_1);
8345 __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_namespaces, __pyx_kp_s__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 265, __pyx_L1_error)
8346 __Pyx_GOTREF(__pyx_t_5);
8347 __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error)
8348 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8349 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8350 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
8351 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8352 __pyx_t_3 = __pyx_t_4;
8353 __pyx_L7_bool_binop_done:;
8354 if (unlikely(__pyx_t_3)) {
8356 /* "lxml/_elementpath.py":267
8357 * if '' in namespaces and namespaces[None] != namespaces['']:
8358 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8359 * namespaces[None], namespaces[''])) # <<<<<<<<<<<<<<
8360 * cache_key += (namespaces[None],) + tuple(sorted(
8361 * item for item in namespaces.items() if item[0] is not None))
8363 __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_namespaces, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error)
8364 __Pyx_GOTREF(__pyx_t_6);
8365 __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_namespaces, __pyx_kp_s__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 267, __pyx_L1_error)
8366 __Pyx_GOTREF(__pyx_t_5);
8367 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
8368 __Pyx_GOTREF(__pyx_t_1);
8369 __Pyx_GIVEREF(__pyx_t_6);
8370 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
8371 __Pyx_GIVEREF(__pyx_t_5);
8372 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
8376 /* "lxml/_elementpath.py":266
8377 * if None in namespaces:
8378 * if '' in namespaces and namespaces[None] != namespaces['']:
8379 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % ( # <<<<<<<<<<<<<<
8380 * namespaces[None], namespaces['']))
8381 * cache_key += (namespaces[None],) + tuple(sorted(
8383 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Ambiguous_default_namespace_prov, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 266, __pyx_L1_error)
8384 __Pyx_GOTREF(__pyx_t_5);
8385 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8386 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
8387 __Pyx_GOTREF(__pyx_t_1);
8388 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8389 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8390 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8391 __PYX_ERR(0, 266, __pyx_L1_error)
8393 /* "lxml/_elementpath.py":265
8394 * # preferring the more convenient '', as long as they aren't ambiguous.
8395 * if None in namespaces:
8396 * if '' in namespaces and namespaces[None] != namespaces['']: # <<<<<<<<<<<<<<
8397 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8398 * namespaces[None], namespaces['']))
8402 /* "lxml/_elementpath.py":268
8403 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8404 * namespaces[None], namespaces['']))
8405 * cache_key += (namespaces[None],) + tuple(sorted( # <<<<<<<<<<<<<<
8406 * item for item in namespaces.items() if item[0] is not None))
8409 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_namespaces, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
8410 __Pyx_GOTREF(__pyx_t_1);
8411 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
8412 __Pyx_GOTREF(__pyx_t_5);
8413 __Pyx_GIVEREF(__pyx_t_1);
8414 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
8417 /* "lxml/_elementpath.py":269
8418 * namespaces[None], namespaces['']))
8419 * cache_key += (namespaces[None],) + tuple(sorted(
8420 * item for item in namespaces.items() if item[0] is not None)) # <<<<<<<<<<<<<<
8422 * cache_key += tuple(sorted(namespaces.items()))
8424 __pyx_t_6 = __pyx_pf_4lxml_12_elementpath_20_build_path_iterator_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 269, __pyx_L1_error)
8425 __Pyx_GOTREF(__pyx_t_6);
8427 /* "lxml/_elementpath.py":268
8428 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8429 * namespaces[None], namespaces['']))
8430 * cache_key += (namespaces[None],) + tuple(sorted( # <<<<<<<<<<<<<<
8431 * item for item in namespaces.items() if item[0] is not None))
8434 __pyx_t_7 = __Pyx_Generator_Next(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
8435 __Pyx_GOTREF(__pyx_t_7);
8436 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8437 __pyx_t_1 = ((PyObject*)__pyx_t_7);
8439 __pyx_t_8 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 268, __pyx_L1_error)
8440 if (unlikely(__pyx_t_1 == Py_None)) {
8441 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8442 __PYX_ERR(0, 268, __pyx_L1_error)
8444 __pyx_t_7 = PyList_AsTuple(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
8445 __Pyx_GOTREF(__pyx_t_7);
8446 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8447 __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
8448 __Pyx_GOTREF(__pyx_t_1);
8449 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8450 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8451 __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_cache_key, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
8452 __Pyx_GOTREF(__pyx_t_7);
8453 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8454 __Pyx_DECREF_SET(__pyx_v_cache_key, ((PyObject*)__pyx_t_7));
8457 /* "lxml/_elementpath.py":264
8458 * # more convenient (all-strings-dict) empty string, so we support both here,
8459 * # preferring the more convenient '', as long as they aren't ambiguous.
8460 * if None in namespaces: # <<<<<<<<<<<<<<
8461 * if '' in namespaces and namespaces[None] != namespaces['']:
8462 * raise ValueError("Ambiguous default namespace provided: %r versus %r" % (
8467 /* "lxml/_elementpath.py":271
8468 * item for item in namespaces.items() if item[0] is not None))
8470 * cache_key += tuple(sorted(namespaces.items())) # <<<<<<<<<<<<<<
8475 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_namespaces, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8476 __Pyx_GOTREF(__pyx_t_5);
8478 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8479 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8480 if (likely(__pyx_t_6)) {
8481 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8482 __Pyx_INCREF(__pyx_t_6);
8483 __Pyx_INCREF(function);
8484 __Pyx_DECREF_SET(__pyx_t_5, function);
8487 __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8488 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8489 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
8490 __Pyx_GOTREF(__pyx_t_1);
8491 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8492 __pyx_t_5 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8493 __Pyx_GOTREF(__pyx_t_5);
8494 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8495 __pyx_t_7 = ((PyObject*)__pyx_t_5);
8497 __pyx_t_8 = PyList_Sort(__pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 271, __pyx_L1_error)
8498 if (unlikely(__pyx_t_7 == Py_None)) {
8499 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8500 __PYX_ERR(0, 271, __pyx_L1_error)
8502 __pyx_t_5 = PyList_AsTuple(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
8503 __Pyx_GOTREF(__pyx_t_5);
8504 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8505 __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_cache_key, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
8506 __Pyx_GOTREF(__pyx_t_7);
8507 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8508 __Pyx_DECREF_SET(__pyx_v_cache_key, ((PyObject*)__pyx_t_7));
8513 /* "lxml/_elementpath.py":260
8515 * cache_key = (path,)
8516 * if namespaces: # <<<<<<<<<<<<<<
8517 * # lxml originally used None for the default namespace but ElementTree uses the
8518 * # more convenient (all-strings-dict) empty string, so we support both here,
8522 /* "lxml/_elementpath.py":273
8523 * cache_key += tuple(sorted(namespaces.items()))
8525 * try: # <<<<<<<<<<<<<<
8526 * return _cache[cache_key]
8530 __Pyx_PyThreadState_declare
8531 __Pyx_PyThreadState_assign
8532 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
8533 __Pyx_XGOTREF(__pyx_t_9);
8534 __Pyx_XGOTREF(__pyx_t_10);
8535 __Pyx_XGOTREF(__pyx_t_11);
8538 /* "lxml/_elementpath.py":274
8541 * return _cache[cache_key] # <<<<<<<<<<<<<<
8545 __Pyx_XDECREF(__pyx_r);
8546 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cache); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 274, __pyx_L9_error)
8547 __Pyx_GOTREF(__pyx_t_7);
8548 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_cache_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L9_error)
8549 __Pyx_GOTREF(__pyx_t_5);
8550 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8551 __pyx_r = __pyx_t_5;
8553 goto __pyx_L13_try_return;
8555 /* "lxml/_elementpath.py":273
8556 * cache_key += tuple(sorted(namespaces.items()))
8558 * try: # <<<<<<<<<<<<<<
8559 * return _cache[cache_key]
8564 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8565 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8566 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8567 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8569 /* "lxml/_elementpath.py":275
8571 * return _cache[cache_key]
8572 * except KeyError: # <<<<<<<<<<<<<<
8574 * if len(_cache) > 100:
8576 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
8578 __Pyx_ErrRestore(0,0,0);
8579 goto __pyx_L10_exception_handled;
8581 goto __pyx_L11_except_error;
8582 __pyx_L11_except_error:;
8584 /* "lxml/_elementpath.py":273
8585 * cache_key += tuple(sorted(namespaces.items()))
8587 * try: # <<<<<<<<<<<<<<
8588 * return _cache[cache_key]
8591 __Pyx_XGIVEREF(__pyx_t_9);
8592 __Pyx_XGIVEREF(__pyx_t_10);
8593 __Pyx_XGIVEREF(__pyx_t_11);
8594 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
8595 goto __pyx_L1_error;
8596 __pyx_L13_try_return:;
8597 __Pyx_XGIVEREF(__pyx_t_9);
8598 __Pyx_XGIVEREF(__pyx_t_10);
8599 __Pyx_XGIVEREF(__pyx_t_11);
8600 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
8602 __pyx_L10_exception_handled:;
8603 __Pyx_XGIVEREF(__pyx_t_9);
8604 __Pyx_XGIVEREF(__pyx_t_10);
8605 __Pyx_XGIVEREF(__pyx_t_11);
8606 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
8609 /* "lxml/_elementpath.py":277
8612 * if len(_cache) > 100: # <<<<<<<<<<<<<<
8616 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error)
8617 __Pyx_GOTREF(__pyx_t_5);
8618 __pyx_t_13 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error)
8619 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8620 __pyx_t_3 = ((__pyx_t_13 > 0x64) != 0);
8623 /* "lxml/_elementpath.py":278
8625 * if len(_cache) > 100:
8626 * _cache.clear() # <<<<<<<<<<<<<<
8628 * if path[:1] == "/":
8630 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cache); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
8631 __Pyx_GOTREF(__pyx_t_7);
8632 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_clear); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
8633 __Pyx_GOTREF(__pyx_t_1);
8634 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8636 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8637 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
8638 if (likely(__pyx_t_7)) {
8639 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8640 __Pyx_INCREF(__pyx_t_7);
8641 __Pyx_INCREF(function);
8642 __Pyx_DECREF_SET(__pyx_t_1, function);
8645 __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
8646 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8647 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
8648 __Pyx_GOTREF(__pyx_t_5);
8649 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8650 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8652 /* "lxml/_elementpath.py":277
8655 * if len(_cache) > 100: # <<<<<<<<<<<<<<
8661 /* "lxml/_elementpath.py":280
8664 * if path[:1] == "/": # <<<<<<<<<<<<<<
8665 * raise SyntaxError("cannot use absolute path on element")
8666 * stream = iter(xpath_tokenizer(path, namespaces))
8668 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_path, 0, 1, NULL, NULL, &__pyx_slice__21, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 280, __pyx_L1_error)
8669 __Pyx_GOTREF(__pyx_t_5);
8670 __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__51, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
8671 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8672 if (unlikely(__pyx_t_3)) {
8674 /* "lxml/_elementpath.py":281
8676 * if path[:1] == "/":
8677 * raise SyntaxError("cannot use absolute path on element") # <<<<<<<<<<<<<<
8678 * stream = iter(xpath_tokenizer(path, namespaces))
8681 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
8682 __Pyx_GOTREF(__pyx_t_5);
8683 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
8684 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8685 __PYX_ERR(0, 281, __pyx_L1_error)
8687 /* "lxml/_elementpath.py":280
8690 * if path[:1] == "/": # <<<<<<<<<<<<<<
8691 * raise SyntaxError("cannot use absolute path on element")
8692 * stream = iter(xpath_tokenizer(path, namespaces))
8696 /* "lxml/_elementpath.py":282
8697 * if path[:1] == "/":
8698 * raise SyntaxError("cannot use absolute path on element")
8699 * stream = iter(xpath_tokenizer(path, namespaces)) # <<<<<<<<<<<<<<
8701 * _next = stream.next
8703 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_xpath_tokenizer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
8704 __Pyx_GOTREF(__pyx_t_1);
8707 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8708 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
8709 if (likely(__pyx_t_7)) {
8710 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8711 __Pyx_INCREF(__pyx_t_7);
8712 __Pyx_INCREF(function);
8713 __Pyx_DECREF_SET(__pyx_t_1, function);
8717 #if CYTHON_FAST_PYCALL
8718 if (PyFunction_Check(__pyx_t_1)) {
8719 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_path, __pyx_cur_scope->__pyx_v_namespaces};
8720 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
8721 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8722 __Pyx_GOTREF(__pyx_t_5);
8725 #if CYTHON_FAST_PYCCALL
8726 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
8727 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_path, __pyx_cur_scope->__pyx_v_namespaces};
8728 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
8729 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8730 __Pyx_GOTREF(__pyx_t_5);
8734 __pyx_t_6 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
8735 __Pyx_GOTREF(__pyx_t_6);
8737 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
8739 __Pyx_INCREF(__pyx_v_path);
8740 __Pyx_GIVEREF(__pyx_v_path);
8741 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_12, __pyx_v_path);
8742 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_namespaces);
8743 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_namespaces);
8744 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_12, __pyx_cur_scope->__pyx_v_namespaces);
8745 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
8746 __Pyx_GOTREF(__pyx_t_5);
8747 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8749 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8750 __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
8751 __Pyx_GOTREF(__pyx_t_1);
8752 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8753 __pyx_v_stream = __pyx_t_1;
8756 /* "lxml/_elementpath.py":283
8757 * raise SyntaxError("cannot use absolute path on element")
8758 * stream = iter(xpath_tokenizer(path, namespaces))
8759 * try: # <<<<<<<<<<<<<<
8760 * _next = stream.next
8761 * except AttributeError:
8764 __Pyx_PyThreadState_declare
8765 __Pyx_PyThreadState_assign
8766 __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
8767 __Pyx_XGOTREF(__pyx_t_11);
8768 __Pyx_XGOTREF(__pyx_t_10);
8769 __Pyx_XGOTREF(__pyx_t_9);
8772 /* "lxml/_elementpath.py":284
8773 * stream = iter(xpath_tokenizer(path, namespaces))
8775 * _next = stream.next # <<<<<<<<<<<<<<
8776 * except AttributeError:
8779 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stream, __pyx_n_s_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L17_error)
8780 __Pyx_GOTREF(__pyx_t_1);
8781 __pyx_v__next = __pyx_t_1;
8784 /* "lxml/_elementpath.py":283
8785 * raise SyntaxError("cannot use absolute path on element")
8786 * stream = iter(xpath_tokenizer(path, namespaces))
8787 * try: # <<<<<<<<<<<<<<
8788 * _next = stream.next
8789 * except AttributeError:
8792 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
8793 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8794 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
8795 goto __pyx_L22_try_end;
8797 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8798 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8799 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8800 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8802 /* "lxml/_elementpath.py":285
8804 * _next = stream.next
8805 * except AttributeError: # <<<<<<<<<<<<<<
8807 * _next = stream.__next__
8809 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
8811 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8812 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 285, __pyx_L19_except_error)
8813 __Pyx_GOTREF(__pyx_t_1);
8814 __Pyx_GOTREF(__pyx_t_5);
8815 __Pyx_GOTREF(__pyx_t_6);
8817 /* "lxml/_elementpath.py":287
8818 * except AttributeError:
8820 * _next = stream.__next__ # <<<<<<<<<<<<<<
8824 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stream, __pyx_n_s_next_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 287, __pyx_L19_except_error)
8825 __Pyx_GOTREF(__pyx_t_7);
8826 __Pyx_XDECREF_SET(__pyx_v__next, __pyx_t_7);
8828 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8829 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8830 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8831 goto __pyx_L18_exception_handled;
8833 goto __pyx_L19_except_error;
8834 __pyx_L19_except_error:;
8836 /* "lxml/_elementpath.py":283
8837 * raise SyntaxError("cannot use absolute path on element")
8838 * stream = iter(xpath_tokenizer(path, namespaces))
8839 * try: # <<<<<<<<<<<<<<
8840 * _next = stream.next
8841 * except AttributeError:
8843 __Pyx_XGIVEREF(__pyx_t_11);
8844 __Pyx_XGIVEREF(__pyx_t_10);
8845 __Pyx_XGIVEREF(__pyx_t_9);
8846 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
8847 goto __pyx_L1_error;
8848 __pyx_L18_exception_handled:;
8849 __Pyx_XGIVEREF(__pyx_t_11);
8850 __Pyx_XGIVEREF(__pyx_t_10);
8851 __Pyx_XGIVEREF(__pyx_t_9);
8852 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
8856 /* "lxml/_elementpath.py":288
8858 * _next = stream.__next__
8859 * try: # <<<<<<<<<<<<<<
8861 * except StopIteration:
8864 __Pyx_PyThreadState_declare
8865 __Pyx_PyThreadState_assign
8866 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
8867 __Pyx_XGOTREF(__pyx_t_9);
8868 __Pyx_XGOTREF(__pyx_t_10);
8869 __Pyx_XGOTREF(__pyx_t_11);
8872 /* "lxml/_elementpath.py":289
8873 * _next = stream.__next__
8875 * token = _next() # <<<<<<<<<<<<<<
8876 * except StopIteration:
8877 * raise SyntaxError("empty path expression")
8879 __Pyx_INCREF(__pyx_v__next);
8880 __pyx_t_5 = __pyx_v__next; __pyx_t_1 = NULL;
8881 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8882 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
8883 if (likely(__pyx_t_1)) {
8884 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8885 __Pyx_INCREF(__pyx_t_1);
8886 __Pyx_INCREF(function);
8887 __Pyx_DECREF_SET(__pyx_t_5, function);
8890 __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
8891 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8892 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L25_error)
8893 __Pyx_GOTREF(__pyx_t_6);
8894 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8895 __pyx_v_token = __pyx_t_6;
8898 /* "lxml/_elementpath.py":288
8900 * _next = stream.__next__
8901 * try: # <<<<<<<<<<<<<<
8903 * except StopIteration:
8906 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
8907 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8908 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
8909 goto __pyx_L30_try_end;
8911 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8912 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8913 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8914 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8916 /* "lxml/_elementpath.py":290
8919 * except StopIteration: # <<<<<<<<<<<<<<
8920 * raise SyntaxError("empty path expression")
8923 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
8925 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8926 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 290, __pyx_L27_except_error)
8927 __Pyx_GOTREF(__pyx_t_6);
8928 __Pyx_GOTREF(__pyx_t_5);
8929 __Pyx_GOTREF(__pyx_t_1);
8931 /* "lxml/_elementpath.py":291
8933 * except StopIteration:
8934 * raise SyntaxError("empty path expression") # <<<<<<<<<<<<<<
8938 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L27_except_error)
8939 __Pyx_GOTREF(__pyx_t_7);
8940 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
8941 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8942 __PYX_ERR(0, 291, __pyx_L27_except_error)
8944 goto __pyx_L27_except_error;
8945 __pyx_L27_except_error:;
8947 /* "lxml/_elementpath.py":288
8949 * _next = stream.__next__
8950 * try: # <<<<<<<<<<<<<<
8952 * except StopIteration:
8954 __Pyx_XGIVEREF(__pyx_t_9);
8955 __Pyx_XGIVEREF(__pyx_t_10);
8956 __Pyx_XGIVEREF(__pyx_t_11);
8957 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
8958 goto __pyx_L1_error;
8962 /* "lxml/_elementpath.py":292
8963 * except StopIteration:
8964 * raise SyntaxError("empty path expression")
8965 * selector = [] # <<<<<<<<<<<<<<
8969 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
8970 __Pyx_GOTREF(__pyx_t_1);
8971 __pyx_v_selector = ((PyObject*)__pyx_t_1);
8974 /* "lxml/_elementpath.py":293
8975 * raise SyntaxError("empty path expression")
8977 * while 1: # <<<<<<<<<<<<<<
8979 * selector.append(ops[token[0]](_next, token))
8983 /* "lxml/_elementpath.py":294
8986 * try: # <<<<<<<<<<<<<<
8987 * selector.append(ops[token[0]](_next, token))
8988 * except StopIteration:
8991 __Pyx_PyThreadState_declare
8992 __Pyx_PyThreadState_assign
8993 __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
8994 __Pyx_XGOTREF(__pyx_t_11);
8995 __Pyx_XGOTREF(__pyx_t_10);
8996 __Pyx_XGOTREF(__pyx_t_9);
8999 /* "lxml/_elementpath.py":295
9002 * selector.append(ops[token[0]](_next, token)) # <<<<<<<<<<<<<<
9003 * except StopIteration:
9004 * raise SyntaxError("invalid path")
9006 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ops); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L35_error)
9007 __Pyx_GOTREF(__pyx_t_5);
9008 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L35_error)
9009 __Pyx_GOTREF(__pyx_t_6);
9010 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L35_error)
9011 __Pyx_GOTREF(__pyx_t_7);
9012 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9013 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9016 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9017 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
9018 if (likely(__pyx_t_6)) {
9019 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9020 __Pyx_INCREF(__pyx_t_6);
9021 __Pyx_INCREF(function);
9022 __Pyx_DECREF_SET(__pyx_t_7, function);
9026 #if CYTHON_FAST_PYCALL
9027 if (PyFunction_Check(__pyx_t_7)) {
9028 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v__next, __pyx_v_token};
9029 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L35_error)
9030 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9031 __Pyx_GOTREF(__pyx_t_1);
9034 #if CYTHON_FAST_PYCCALL
9035 if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9036 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v__next, __pyx_v_token};
9037 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L35_error)
9038 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9039 __Pyx_GOTREF(__pyx_t_1);
9043 __pyx_t_5 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L35_error)
9044 __Pyx_GOTREF(__pyx_t_5);
9046 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
9048 __Pyx_INCREF(__pyx_v__next);
9049 __Pyx_GIVEREF(__pyx_v__next);
9050 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_v__next);
9051 __Pyx_INCREF(__pyx_v_token);
9052 __Pyx_GIVEREF(__pyx_v_token);
9053 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_v_token);
9054 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L35_error)
9055 __Pyx_GOTREF(__pyx_t_1);
9056 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9058 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9059 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_selector, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L35_error)
9060 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9062 /* "lxml/_elementpath.py":294
9065 * try: # <<<<<<<<<<<<<<
9066 * selector.append(ops[token[0]](_next, token))
9067 * except StopIteration:
9070 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
9071 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9072 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9073 goto __pyx_L42_try_end;
9075 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9076 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9077 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9078 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9080 /* "lxml/_elementpath.py":296
9082 * selector.append(ops[token[0]](_next, token))
9083 * except StopIteration: # <<<<<<<<<<<<<<
9084 * raise SyntaxError("invalid path")
9087 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9089 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
9090 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 296, __pyx_L37_except_error)
9091 __Pyx_GOTREF(__pyx_t_1);
9092 __Pyx_GOTREF(__pyx_t_7);
9093 __Pyx_GOTREF(__pyx_t_5);
9095 /* "lxml/_elementpath.py":297
9096 * selector.append(ops[token[0]](_next, token))
9097 * except StopIteration:
9098 * raise SyntaxError("invalid path") # <<<<<<<<<<<<<<
9102 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_SyntaxError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 297, __pyx_L37_except_error)
9103 __Pyx_GOTREF(__pyx_t_6);
9104 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
9105 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9106 __PYX_ERR(0, 297, __pyx_L37_except_error)
9108 goto __pyx_L37_except_error;
9109 __pyx_L37_except_error:;
9111 /* "lxml/_elementpath.py":294
9114 * try: # <<<<<<<<<<<<<<
9115 * selector.append(ops[token[0]](_next, token))
9116 * except StopIteration:
9118 __Pyx_XGIVEREF(__pyx_t_11);
9119 __Pyx_XGIVEREF(__pyx_t_10);
9120 __Pyx_XGIVEREF(__pyx_t_9);
9121 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
9122 goto __pyx_L1_error;
9126 /* "lxml/_elementpath.py":298
9127 * except StopIteration:
9128 * raise SyntaxError("invalid path")
9129 * try: # <<<<<<<<<<<<<<
9131 * if token[0] == "/":
9134 __Pyx_PyThreadState_declare
9135 __Pyx_PyThreadState_assign
9136 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
9137 __Pyx_XGOTREF(__pyx_t_9);
9138 __Pyx_XGOTREF(__pyx_t_10);
9139 __Pyx_XGOTREF(__pyx_t_11);
9142 /* "lxml/_elementpath.py":299
9143 * raise SyntaxError("invalid path")
9145 * token = _next() # <<<<<<<<<<<<<<
9146 * if token[0] == "/":
9149 __Pyx_INCREF(__pyx_v__next);
9150 __pyx_t_7 = __pyx_v__next; __pyx_t_1 = NULL;
9151 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
9152 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
9153 if (likely(__pyx_t_1)) {
9154 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9155 __Pyx_INCREF(__pyx_t_1);
9156 __Pyx_INCREF(function);
9157 __Pyx_DECREF_SET(__pyx_t_7, function);
9160 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
9161 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9162 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L45_error)
9163 __Pyx_GOTREF(__pyx_t_5);
9164 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9165 __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_5);
9168 /* "lxml/_elementpath.py":300
9171 * if token[0] == "/": # <<<<<<<<<<<<<<
9173 * except StopIteration:
9175 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_token, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L45_error)
9176 __Pyx_GOTREF(__pyx_t_5);
9177 __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s__51, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 300, __pyx_L45_error)
9178 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9181 /* "lxml/_elementpath.py":301
9183 * if token[0] == "/":
9184 * token = _next() # <<<<<<<<<<<<<<
9185 * except StopIteration:
9188 __Pyx_INCREF(__pyx_v__next);
9189 __pyx_t_7 = __pyx_v__next; __pyx_t_1 = NULL;
9190 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
9191 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
9192 if (likely(__pyx_t_1)) {
9193 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9194 __Pyx_INCREF(__pyx_t_1);
9195 __Pyx_INCREF(function);
9196 __Pyx_DECREF_SET(__pyx_t_7, function);
9199 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
9200 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9201 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L45_error)
9202 __Pyx_GOTREF(__pyx_t_5);
9203 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9204 __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_5);
9207 /* "lxml/_elementpath.py":300
9210 * if token[0] == "/": # <<<<<<<<<<<<<<
9212 * except StopIteration:
9216 /* "lxml/_elementpath.py":298
9217 * except StopIteration:
9218 * raise SyntaxError("invalid path")
9219 * try: # <<<<<<<<<<<<<<
9221 * if token[0] == "/":
9224 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9225 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9226 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
9227 goto __pyx_L52_try_end;
9229 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9230 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9231 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9232 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9234 /* "lxml/_elementpath.py":302
9235 * if token[0] == "/":
9237 * except StopIteration: # <<<<<<<<<<<<<<
9239 * _cache[cache_key] = selector
9241 __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9243 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
9244 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_1) < 0) __PYX_ERR(0, 302, __pyx_L47_except_error)
9245 __Pyx_GOTREF(__pyx_t_5);
9246 __Pyx_GOTREF(__pyx_t_7);
9247 __Pyx_GOTREF(__pyx_t_1);
9249 /* "lxml/_elementpath.py":303
9251 * except StopIteration:
9252 * break # <<<<<<<<<<<<<<
9253 * _cache[cache_key] = selector
9256 goto __pyx_L54_except_break;
9257 __pyx_L54_except_break:;
9258 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9259 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9260 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9261 goto __pyx_L50_try_break;
9263 goto __pyx_L47_except_error;
9264 __pyx_L47_except_error:;
9266 /* "lxml/_elementpath.py":298
9267 * except StopIteration:
9268 * raise SyntaxError("invalid path")
9269 * try: # <<<<<<<<<<<<<<
9271 * if token[0] == "/":
9273 __Pyx_XGIVEREF(__pyx_t_9);
9274 __Pyx_XGIVEREF(__pyx_t_10);
9275 __Pyx_XGIVEREF(__pyx_t_11);
9276 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
9277 goto __pyx_L1_error;
9278 __pyx_L50_try_break:;
9279 __Pyx_XGIVEREF(__pyx_t_9);
9280 __Pyx_XGIVEREF(__pyx_t_10);
9281 __Pyx_XGIVEREF(__pyx_t_11);
9282 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
9283 goto __pyx_L34_break;
9289 /* "lxml/_elementpath.py":304
9290 * except StopIteration:
9292 * _cache[cache_key] = selector # <<<<<<<<<<<<<<
9296 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
9297 __Pyx_GOTREF(__pyx_t_1);
9298 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_cache_key, __pyx_v_selector) < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
9299 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9301 /* "lxml/_elementpath.py":305
9303 * _cache[cache_key] = selector
9304 * return selector # <<<<<<<<<<<<<<
9308 __Pyx_XDECREF(__pyx_r);
9309 __Pyx_INCREF(__pyx_v_selector);
9310 __pyx_r = __pyx_v_selector;
9313 /* "lxml/_elementpath.py":254
9316 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
9317 * """compile selector pattern"""
9318 * if path[-1:] == "/":
9321 /* function exit code */
9323 __Pyx_XDECREF(__pyx_t_1);
9324 __Pyx_XDECREF(__pyx_t_5);
9325 __Pyx_XDECREF(__pyx_t_6);
9326 __Pyx_XDECREF(__pyx_t_7);
9327 __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
9330 __Pyx_XDECREF(__pyx_v_cache_key);
9331 __Pyx_XDECREF(__pyx_v_stream);
9332 __Pyx_XDECREF(__pyx_v__next);
9333 __Pyx_XDECREF(__pyx_v_token);
9334 __Pyx_XDECREF(__pyx_v_selector);
9335 __Pyx_XDECREF(__pyx_v_path);
9336 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
9337 __Pyx_XGIVEREF(__pyx_r);
9338 __Pyx_RefNannyFinishContext();
9342 /* "lxml/_elementpath.py":311
9343 * # Iterate over the matching nodes
9345 * def iterfind(elem, path, namespaces=None): # <<<<<<<<<<<<<<
9346 * selector = _build_path_iterator(path, namespaces)
9347 * result = iter((elem,))
9350 /* Python wrapper */
9351 static PyObject *__pyx_pw_4lxml_12_elementpath_18iterfind(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9352 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_18iterfind = {"iterfind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_18iterfind, METH_VARARGS|METH_KEYWORDS, 0};
9353 static PyObject *__pyx_pw_4lxml_12_elementpath_18iterfind(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9354 PyObject *__pyx_v_elem = 0;
9355 PyObject *__pyx_v_path = 0;
9356 PyObject *__pyx_v_namespaces = 0;
9357 int __pyx_lineno = 0;
9358 const char *__pyx_filename = NULL;
9359 int __pyx_clineno = 0;
9360 PyObject *__pyx_r = 0;
9361 __Pyx_RefNannyDeclarations
9362 __Pyx_RefNannySetupContext("iterfind (wrapper)", 0);
9364 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
9365 PyObject* values[3] = {0,0,0};
9366 values[2] = ((PyObject *)((PyObject *)Py_None));
9367 if (unlikely(__pyx_kwds)) {
9369 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9371 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9373 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9375 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9378 default: goto __pyx_L5_argtuple_error;
9380 kw_args = PyDict_Size(__pyx_kwds);
9383 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9384 else goto __pyx_L5_argtuple_error;
9387 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9389 __Pyx_RaiseArgtupleInvalid("iterfind", 0, 2, 3, 1); __PYX_ERR(0, 311, __pyx_L3_error)
9394 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9395 if (value) { values[2] = value; kw_args--; }
9398 if (unlikely(kw_args > 0)) {
9399 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterfind") < 0)) __PYX_ERR(0, 311, __pyx_L3_error)
9402 switch (PyTuple_GET_SIZE(__pyx_args)) {
9403 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9405 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9406 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9408 default: goto __pyx_L5_argtuple_error;
9411 __pyx_v_elem = values[0];
9412 __pyx_v_path = values[1];
9413 __pyx_v_namespaces = values[2];
9415 goto __pyx_L4_argument_unpacking_done;
9416 __pyx_L5_argtuple_error:;
9417 __Pyx_RaiseArgtupleInvalid("iterfind", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 311, __pyx_L3_error)
9419 __Pyx_AddTraceback("lxml._elementpath.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
9420 __Pyx_RefNannyFinishContext();
9422 __pyx_L4_argument_unpacking_done:;
9423 __pyx_r = __pyx_pf_4lxml_12_elementpath_17iterfind(__pyx_self, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces);
9425 /* function exit code */
9426 __Pyx_RefNannyFinishContext();
9430 static PyObject *__pyx_pf_4lxml_12_elementpath_17iterfind(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
9431 PyObject *__pyx_v_selector = NULL;
9432 PyObject *__pyx_v_result = NULL;
9433 PyObject *__pyx_v_select = NULL;
9434 PyObject *__pyx_r = NULL;
9435 __Pyx_RefNannyDeclarations
9436 PyObject *__pyx_t_1 = NULL;
9437 PyObject *__pyx_t_2 = NULL;
9438 PyObject *__pyx_t_3 = NULL;
9440 PyObject *__pyx_t_5 = NULL;
9441 Py_ssize_t __pyx_t_6;
9442 PyObject *(*__pyx_t_7)(PyObject *);
9443 int __pyx_lineno = 0;
9444 const char *__pyx_filename = NULL;
9445 int __pyx_clineno = 0;
9446 __Pyx_RefNannySetupContext("iterfind", 0);
9448 /* "lxml/_elementpath.py":312
9450 * def iterfind(elem, path, namespaces=None):
9451 * selector = _build_path_iterator(path, namespaces) # <<<<<<<<<<<<<<
9452 * result = iter((elem,))
9453 * for select in selector:
9455 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_build_path_iterator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
9456 __Pyx_GOTREF(__pyx_t_2);
9459 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
9460 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
9461 if (likely(__pyx_t_3)) {
9462 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9463 __Pyx_INCREF(__pyx_t_3);
9464 __Pyx_INCREF(function);
9465 __Pyx_DECREF_SET(__pyx_t_2, function);
9469 #if CYTHON_FAST_PYCALL
9470 if (PyFunction_Check(__pyx_t_2)) {
9471 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_path, __pyx_v_namespaces};
9472 __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, 312, __pyx_L1_error)
9473 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9474 __Pyx_GOTREF(__pyx_t_1);
9477 #if CYTHON_FAST_PYCCALL
9478 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
9479 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_path, __pyx_v_namespaces};
9480 __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, 312, __pyx_L1_error)
9481 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9482 __Pyx_GOTREF(__pyx_t_1);
9486 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 312, __pyx_L1_error)
9487 __Pyx_GOTREF(__pyx_t_5);
9489 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
9491 __Pyx_INCREF(__pyx_v_path);
9492 __Pyx_GIVEREF(__pyx_v_path);
9493 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_path);
9494 __Pyx_INCREF(__pyx_v_namespaces);
9495 __Pyx_GIVEREF(__pyx_v_namespaces);
9496 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_namespaces);
9497 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
9498 __Pyx_GOTREF(__pyx_t_1);
9499 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9501 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9502 __pyx_v_selector = __pyx_t_1;
9505 /* "lxml/_elementpath.py":313
9506 * def iterfind(elem, path, namespaces=None):
9507 * selector = _build_path_iterator(path, namespaces)
9508 * result = iter((elem,)) # <<<<<<<<<<<<<<
9509 * for select in selector:
9510 * result = select(result)
9512 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
9513 __Pyx_GOTREF(__pyx_t_1);
9514 __Pyx_INCREF(__pyx_v_elem);
9515 __Pyx_GIVEREF(__pyx_v_elem);
9516 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_elem);
9517 __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
9518 __Pyx_GOTREF(__pyx_t_2);
9519 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9520 __pyx_v_result = __pyx_t_2;
9523 /* "lxml/_elementpath.py":314
9524 * selector = _build_path_iterator(path, namespaces)
9525 * result = iter((elem,))
9526 * for select in selector: # <<<<<<<<<<<<<<
9527 * result = select(result)
9530 if (likely(PyList_CheckExact(__pyx_v_selector)) || PyTuple_CheckExact(__pyx_v_selector)) {
9531 __pyx_t_2 = __pyx_v_selector; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
9534 __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_selector); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
9535 __Pyx_GOTREF(__pyx_t_2);
9536 __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 314, __pyx_L1_error)
9539 if (likely(!__pyx_t_7)) {
9540 if (likely(PyList_CheckExact(__pyx_t_2))) {
9541 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
9542 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9543 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 314, __pyx_L1_error)
9545 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
9546 __Pyx_GOTREF(__pyx_t_1);
9549 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
9550 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9551 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 314, __pyx_L1_error)
9553 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
9554 __Pyx_GOTREF(__pyx_t_1);
9558 __pyx_t_1 = __pyx_t_7(__pyx_t_2);
9559 if (unlikely(!__pyx_t_1)) {
9560 PyObject* exc_type = PyErr_Occurred();
9562 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9563 else __PYX_ERR(0, 314, __pyx_L1_error)
9567 __Pyx_GOTREF(__pyx_t_1);
9569 __Pyx_XDECREF_SET(__pyx_v_select, __pyx_t_1);
9572 /* "lxml/_elementpath.py":315
9573 * result = iter((elem,))
9574 * for select in selector:
9575 * result = select(result) # <<<<<<<<<<<<<<
9579 __Pyx_INCREF(__pyx_v_select);
9580 __pyx_t_5 = __pyx_v_select; __pyx_t_3 = NULL;
9581 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9582 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
9583 if (likely(__pyx_t_3)) {
9584 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9585 __Pyx_INCREF(__pyx_t_3);
9586 __Pyx_INCREF(function);
9587 __Pyx_DECREF_SET(__pyx_t_5, function);
9590 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_result) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_result);
9591 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9592 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
9593 __Pyx_GOTREF(__pyx_t_1);
9594 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9595 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
9598 /* "lxml/_elementpath.py":314
9599 * selector = _build_path_iterator(path, namespaces)
9600 * result = iter((elem,))
9601 * for select in selector: # <<<<<<<<<<<<<<
9602 * result = select(result)
9606 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9608 /* "lxml/_elementpath.py":316
9609 * for select in selector:
9610 * result = select(result)
9611 * return result # <<<<<<<<<<<<<<
9615 __Pyx_XDECREF(__pyx_r);
9616 __Pyx_INCREF(__pyx_v_result);
9617 __pyx_r = __pyx_v_result;
9620 /* "lxml/_elementpath.py":311
9621 * # Iterate over the matching nodes
9623 * def iterfind(elem, path, namespaces=None): # <<<<<<<<<<<<<<
9624 * selector = _build_path_iterator(path, namespaces)
9625 * result = iter((elem,))
9628 /* function exit code */
9630 __Pyx_XDECREF(__pyx_t_1);
9631 __Pyx_XDECREF(__pyx_t_2);
9632 __Pyx_XDECREF(__pyx_t_3);
9633 __Pyx_XDECREF(__pyx_t_5);
9634 __Pyx_AddTraceback("lxml._elementpath.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
9637 __Pyx_XDECREF(__pyx_v_selector);
9638 __Pyx_XDECREF(__pyx_v_result);
9639 __Pyx_XDECREF(__pyx_v_select);
9640 __Pyx_XGIVEREF(__pyx_r);
9641 __Pyx_RefNannyFinishContext();
9645 /* "lxml/_elementpath.py":322
9646 * # Find first matching object.
9648 * def find(elem, path, namespaces=None): # <<<<<<<<<<<<<<
9649 * it = iterfind(elem, path, namespaces)
9653 /* Python wrapper */
9654 static PyObject *__pyx_pw_4lxml_12_elementpath_20find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9655 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_20find = {"find", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_20find, METH_VARARGS|METH_KEYWORDS, 0};
9656 static PyObject *__pyx_pw_4lxml_12_elementpath_20find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9657 PyObject *__pyx_v_elem = 0;
9658 PyObject *__pyx_v_path = 0;
9659 PyObject *__pyx_v_namespaces = 0;
9660 int __pyx_lineno = 0;
9661 const char *__pyx_filename = NULL;
9662 int __pyx_clineno = 0;
9663 PyObject *__pyx_r = 0;
9664 __Pyx_RefNannyDeclarations
9665 __Pyx_RefNannySetupContext("find (wrapper)", 0);
9667 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
9668 PyObject* values[3] = {0,0,0};
9669 values[2] = ((PyObject *)((PyObject *)Py_None));
9670 if (unlikely(__pyx_kwds)) {
9672 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9674 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9676 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9678 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9681 default: goto __pyx_L5_argtuple_error;
9683 kw_args = PyDict_Size(__pyx_kwds);
9686 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9687 else goto __pyx_L5_argtuple_error;
9690 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9692 __Pyx_RaiseArgtupleInvalid("find", 0, 2, 3, 1); __PYX_ERR(0, 322, __pyx_L3_error)
9697 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9698 if (value) { values[2] = value; kw_args--; }
9701 if (unlikely(kw_args > 0)) {
9702 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find") < 0)) __PYX_ERR(0, 322, __pyx_L3_error)
9705 switch (PyTuple_GET_SIZE(__pyx_args)) {
9706 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9708 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9709 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9711 default: goto __pyx_L5_argtuple_error;
9714 __pyx_v_elem = values[0];
9715 __pyx_v_path = values[1];
9716 __pyx_v_namespaces = values[2];
9718 goto __pyx_L4_argument_unpacking_done;
9719 __pyx_L5_argtuple_error:;
9720 __Pyx_RaiseArgtupleInvalid("find", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 322, __pyx_L3_error)
9722 __Pyx_AddTraceback("lxml._elementpath.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
9723 __Pyx_RefNannyFinishContext();
9725 __pyx_L4_argument_unpacking_done:;
9726 __pyx_r = __pyx_pf_4lxml_12_elementpath_19find(__pyx_self, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces);
9728 /* function exit code */
9729 __Pyx_RefNannyFinishContext();
9733 static PyObject *__pyx_pf_4lxml_12_elementpath_19find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
9734 PyObject *__pyx_v_it = NULL;
9735 PyObject *__pyx_r = NULL;
9736 __Pyx_RefNannyDeclarations
9737 PyObject *__pyx_t_1 = NULL;
9738 PyObject *__pyx_t_2 = NULL;
9739 PyObject *__pyx_t_3 = NULL;
9741 PyObject *__pyx_t_5 = NULL;
9742 PyObject *__pyx_t_6 = NULL;
9743 PyObject *__pyx_t_7 = NULL;
9744 PyObject *__pyx_t_8 = NULL;
9745 int __pyx_lineno = 0;
9746 const char *__pyx_filename = NULL;
9747 int __pyx_clineno = 0;
9748 __Pyx_RefNannySetupContext("find", 0);
9750 /* "lxml/_elementpath.py":323
9752 * def find(elem, path, namespaces=None):
9753 * it = iterfind(elem, path, namespaces) # <<<<<<<<<<<<<<
9757 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
9758 __Pyx_GOTREF(__pyx_t_2);
9761 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
9762 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
9763 if (likely(__pyx_t_3)) {
9764 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
9765 __Pyx_INCREF(__pyx_t_3);
9766 __Pyx_INCREF(function);
9767 __Pyx_DECREF_SET(__pyx_t_2, function);
9771 #if CYTHON_FAST_PYCALL
9772 if (PyFunction_Check(__pyx_t_2)) {
9773 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
9774 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
9775 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9776 __Pyx_GOTREF(__pyx_t_1);
9779 #if CYTHON_FAST_PYCCALL
9780 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
9781 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
9782 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
9783 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9784 __Pyx_GOTREF(__pyx_t_1);
9788 __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
9789 __Pyx_GOTREF(__pyx_t_5);
9791 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
9793 __Pyx_INCREF(__pyx_v_elem);
9794 __Pyx_GIVEREF(__pyx_v_elem);
9795 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_elem);
9796 __Pyx_INCREF(__pyx_v_path);
9797 __Pyx_GIVEREF(__pyx_v_path);
9798 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_path);
9799 __Pyx_INCREF(__pyx_v_namespaces);
9800 __Pyx_GIVEREF(__pyx_v_namespaces);
9801 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_namespaces);
9802 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
9803 __Pyx_GOTREF(__pyx_t_1);
9804 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9806 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9807 __pyx_v_it = __pyx_t_1;
9810 /* "lxml/_elementpath.py":324
9811 * def find(elem, path, namespaces=None):
9812 * it = iterfind(elem, path, namespaces)
9813 * try: # <<<<<<<<<<<<<<
9815 * except StopIteration:
9818 __Pyx_PyThreadState_declare
9819 __Pyx_PyThreadState_assign
9820 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
9821 __Pyx_XGOTREF(__pyx_t_6);
9822 __Pyx_XGOTREF(__pyx_t_7);
9823 __Pyx_XGOTREF(__pyx_t_8);
9826 /* "lxml/_elementpath.py":325
9827 * it = iterfind(elem, path, namespaces)
9829 * return next(it) # <<<<<<<<<<<<<<
9830 * except StopIteration:
9833 __Pyx_XDECREF(__pyx_r);
9834 __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_it); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L3_error)
9835 __Pyx_GOTREF(__pyx_t_1);
9836 __pyx_r = __pyx_t_1;
9838 goto __pyx_L7_try_return;
9840 /* "lxml/_elementpath.py":324
9841 * def find(elem, path, namespaces=None):
9842 * it = iterfind(elem, path, namespaces)
9843 * try: # <<<<<<<<<<<<<<
9845 * except StopIteration:
9849 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9850 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9851 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9852 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9854 /* "lxml/_elementpath.py":326
9857 * except StopIteration: # <<<<<<<<<<<<<<
9861 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9863 __Pyx_AddTraceback("lxml._elementpath.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
9864 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 326, __pyx_L5_except_error)
9865 __Pyx_GOTREF(__pyx_t_1);
9866 __Pyx_GOTREF(__pyx_t_2);
9867 __Pyx_GOTREF(__pyx_t_5);
9869 /* "lxml/_elementpath.py":327
9871 * except StopIteration:
9872 * return None # <<<<<<<<<<<<<<
9876 __Pyx_XDECREF(__pyx_r);
9877 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9878 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9879 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9880 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9881 goto __pyx_L6_except_return;
9883 goto __pyx_L5_except_error;
9884 __pyx_L5_except_error:;
9886 /* "lxml/_elementpath.py":324
9887 * def find(elem, path, namespaces=None):
9888 * it = iterfind(elem, path, namespaces)
9889 * try: # <<<<<<<<<<<<<<
9891 * except StopIteration:
9893 __Pyx_XGIVEREF(__pyx_t_6);
9894 __Pyx_XGIVEREF(__pyx_t_7);
9895 __Pyx_XGIVEREF(__pyx_t_8);
9896 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9897 goto __pyx_L1_error;
9898 __pyx_L7_try_return:;
9899 __Pyx_XGIVEREF(__pyx_t_6);
9900 __Pyx_XGIVEREF(__pyx_t_7);
9901 __Pyx_XGIVEREF(__pyx_t_8);
9902 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9904 __pyx_L6_except_return:;
9905 __Pyx_XGIVEREF(__pyx_t_6);
9906 __Pyx_XGIVEREF(__pyx_t_7);
9907 __Pyx_XGIVEREF(__pyx_t_8);
9908 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
9912 /* "lxml/_elementpath.py":322
9913 * # Find first matching object.
9915 * def find(elem, path, namespaces=None): # <<<<<<<<<<<<<<
9916 * it = iterfind(elem, path, namespaces)
9920 /* function exit code */
9922 __Pyx_XDECREF(__pyx_t_1);
9923 __Pyx_XDECREF(__pyx_t_2);
9924 __Pyx_XDECREF(__pyx_t_3);
9925 __Pyx_XDECREF(__pyx_t_5);
9926 __Pyx_AddTraceback("lxml._elementpath.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
9929 __Pyx_XDECREF(__pyx_v_it);
9930 __Pyx_XGIVEREF(__pyx_r);
9931 __Pyx_RefNannyFinishContext();
9935 /* "lxml/_elementpath.py":333
9936 * # Find all matching objects.
9938 * def findall(elem, path, namespaces=None): # <<<<<<<<<<<<<<
9939 * return list(iterfind(elem, path, namespaces))
9943 /* Python wrapper */
9944 static PyObject *__pyx_pw_4lxml_12_elementpath_22findall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9945 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_22findall = {"findall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_22findall, METH_VARARGS|METH_KEYWORDS, 0};
9946 static PyObject *__pyx_pw_4lxml_12_elementpath_22findall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9947 PyObject *__pyx_v_elem = 0;
9948 PyObject *__pyx_v_path = 0;
9949 PyObject *__pyx_v_namespaces = 0;
9950 int __pyx_lineno = 0;
9951 const char *__pyx_filename = NULL;
9952 int __pyx_clineno = 0;
9953 PyObject *__pyx_r = 0;
9954 __Pyx_RefNannyDeclarations
9955 __Pyx_RefNannySetupContext("findall (wrapper)", 0);
9957 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_path,&__pyx_n_s_namespaces,0};
9958 PyObject* values[3] = {0,0,0};
9959 values[2] = ((PyObject *)((PyObject *)Py_None));
9960 if (unlikely(__pyx_kwds)) {
9962 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9964 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9966 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9968 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9971 default: goto __pyx_L5_argtuple_error;
9973 kw_args = PyDict_Size(__pyx_kwds);
9976 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9977 else goto __pyx_L5_argtuple_error;
9980 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9982 __Pyx_RaiseArgtupleInvalid("findall", 0, 2, 3, 1); __PYX_ERR(0, 333, __pyx_L3_error)
9987 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9988 if (value) { values[2] = value; kw_args--; }
9991 if (unlikely(kw_args > 0)) {
9992 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findall") < 0)) __PYX_ERR(0, 333, __pyx_L3_error)
9995 switch (PyTuple_GET_SIZE(__pyx_args)) {
9996 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9998 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9999 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10001 default: goto __pyx_L5_argtuple_error;
10004 __pyx_v_elem = values[0];
10005 __pyx_v_path = values[1];
10006 __pyx_v_namespaces = values[2];
10008 goto __pyx_L4_argument_unpacking_done;
10009 __pyx_L5_argtuple_error:;
10010 __Pyx_RaiseArgtupleInvalid("findall", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 333, __pyx_L3_error)
10012 __Pyx_AddTraceback("lxml._elementpath.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
10013 __Pyx_RefNannyFinishContext();
10015 __pyx_L4_argument_unpacking_done:;
10016 __pyx_r = __pyx_pf_4lxml_12_elementpath_21findall(__pyx_self, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces);
10018 /* function exit code */
10019 __Pyx_RefNannyFinishContext();
10023 static PyObject *__pyx_pf_4lxml_12_elementpath_21findall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_namespaces) {
10024 PyObject *__pyx_r = NULL;
10025 __Pyx_RefNannyDeclarations
10026 PyObject *__pyx_t_1 = NULL;
10027 PyObject *__pyx_t_2 = NULL;
10028 PyObject *__pyx_t_3 = NULL;
10030 PyObject *__pyx_t_5 = NULL;
10031 int __pyx_lineno = 0;
10032 const char *__pyx_filename = NULL;
10033 int __pyx_clineno = 0;
10034 __Pyx_RefNannySetupContext("findall", 0);
10036 /* "lxml/_elementpath.py":334
10038 * def findall(elem, path, namespaces=None):
10039 * return list(iterfind(elem, path, namespaces)) # <<<<<<<<<<<<<<
10043 __Pyx_XDECREF(__pyx_r);
10044 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_iterfind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
10045 __Pyx_GOTREF(__pyx_t_2);
10048 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10049 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10050 if (likely(__pyx_t_3)) {
10051 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10052 __Pyx_INCREF(__pyx_t_3);
10053 __Pyx_INCREF(function);
10054 __Pyx_DECREF_SET(__pyx_t_2, function);
10058 #if CYTHON_FAST_PYCALL
10059 if (PyFunction_Check(__pyx_t_2)) {
10060 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
10061 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
10062 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10063 __Pyx_GOTREF(__pyx_t_1);
10066 #if CYTHON_FAST_PYCCALL
10067 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
10068 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
10069 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
10070 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10071 __Pyx_GOTREF(__pyx_t_1);
10075 __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
10076 __Pyx_GOTREF(__pyx_t_5);
10078 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
10080 __Pyx_INCREF(__pyx_v_elem);
10081 __Pyx_GIVEREF(__pyx_v_elem);
10082 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_elem);
10083 __Pyx_INCREF(__pyx_v_path);
10084 __Pyx_GIVEREF(__pyx_v_path);
10085 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_path);
10086 __Pyx_INCREF(__pyx_v_namespaces);
10087 __Pyx_GIVEREF(__pyx_v_namespaces);
10088 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_namespaces);
10089 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
10090 __Pyx_GOTREF(__pyx_t_1);
10091 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10093 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10094 __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
10095 __Pyx_GOTREF(__pyx_t_2);
10096 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10097 __pyx_r = __pyx_t_2;
10101 /* "lxml/_elementpath.py":333
10102 * # Find all matching objects.
10104 * def findall(elem, path, namespaces=None): # <<<<<<<<<<<<<<
10105 * return list(iterfind(elem, path, namespaces))
10109 /* function exit code */
10111 __Pyx_XDECREF(__pyx_t_1);
10112 __Pyx_XDECREF(__pyx_t_2);
10113 __Pyx_XDECREF(__pyx_t_3);
10114 __Pyx_XDECREF(__pyx_t_5);
10115 __Pyx_AddTraceback("lxml._elementpath.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
10118 __Pyx_XGIVEREF(__pyx_r);
10119 __Pyx_RefNannyFinishContext();
10123 /* "lxml/_elementpath.py":340
10124 * # Find text for first matching object.
10126 * def findtext(elem, path, default=None, namespaces=None): # <<<<<<<<<<<<<<
10127 * el = find(elem, path, namespaces)
10131 /* Python wrapper */
10132 static PyObject *__pyx_pw_4lxml_12_elementpath_24findtext(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10133 static PyMethodDef __pyx_mdef_4lxml_12_elementpath_24findtext = {"findtext", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_12_elementpath_24findtext, METH_VARARGS|METH_KEYWORDS, 0};
10134 static PyObject *__pyx_pw_4lxml_12_elementpath_24findtext(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10135 PyObject *__pyx_v_elem = 0;
10136 PyObject *__pyx_v_path = 0;
10137 PyObject *__pyx_v_default = 0;
10138 PyObject *__pyx_v_namespaces = 0;
10139 int __pyx_lineno = 0;
10140 const char *__pyx_filename = NULL;
10141 int __pyx_clineno = 0;
10142 PyObject *__pyx_r = 0;
10143 __Pyx_RefNannyDeclarations
10144 __Pyx_RefNannySetupContext("findtext (wrapper)", 0);
10146 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_path,&__pyx_n_s_default,&__pyx_n_s_namespaces,0};
10147 PyObject* values[4] = {0,0,0,0};
10148 values[2] = ((PyObject *)((PyObject *)Py_None));
10149 values[3] = ((PyObject *)((PyObject *)Py_None));
10150 if (unlikely(__pyx_kwds)) {
10151 Py_ssize_t kw_args;
10152 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10153 switch (pos_args) {
10154 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10155 CYTHON_FALLTHROUGH;
10156 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10157 CYTHON_FALLTHROUGH;
10158 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10159 CYTHON_FALLTHROUGH;
10160 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10161 CYTHON_FALLTHROUGH;
10163 default: goto __pyx_L5_argtuple_error;
10165 kw_args = PyDict_Size(__pyx_kwds);
10166 switch (pos_args) {
10168 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
10169 else goto __pyx_L5_argtuple_error;
10170 CYTHON_FALLTHROUGH;
10172 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
10174 __Pyx_RaiseArgtupleInvalid("findtext", 0, 2, 4, 1); __PYX_ERR(0, 340, __pyx_L3_error)
10176 CYTHON_FALLTHROUGH;
10179 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
10180 if (value) { values[2] = value; kw_args--; }
10182 CYTHON_FALLTHROUGH;
10185 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
10186 if (value) { values[3] = value; kw_args--; }
10189 if (unlikely(kw_args > 0)) {
10190 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findtext") < 0)) __PYX_ERR(0, 340, __pyx_L3_error)
10193 switch (PyTuple_GET_SIZE(__pyx_args)) {
10194 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10195 CYTHON_FALLTHROUGH;
10196 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10197 CYTHON_FALLTHROUGH;
10198 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10199 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10201 default: goto __pyx_L5_argtuple_error;
10204 __pyx_v_elem = values[0];
10205 __pyx_v_path = values[1];
10206 __pyx_v_default = values[2];
10207 __pyx_v_namespaces = values[3];
10209 goto __pyx_L4_argument_unpacking_done;
10210 __pyx_L5_argtuple_error:;
10211 __Pyx_RaiseArgtupleInvalid("findtext", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 340, __pyx_L3_error)
10213 __Pyx_AddTraceback("lxml._elementpath.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
10214 __Pyx_RefNannyFinishContext();
10216 __pyx_L4_argument_unpacking_done:;
10217 __pyx_r = __pyx_pf_4lxml_12_elementpath_23findtext(__pyx_self, __pyx_v_elem, __pyx_v_path, __pyx_v_default, __pyx_v_namespaces);
10219 /* function exit code */
10220 __Pyx_RefNannyFinishContext();
10224 static PyObject *__pyx_pf_4lxml_12_elementpath_23findtext(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_elem, PyObject *__pyx_v_path, PyObject *__pyx_v_default, PyObject *__pyx_v_namespaces) {
10225 PyObject *__pyx_v_el = NULL;
10226 PyObject *__pyx_r = NULL;
10227 __Pyx_RefNannyDeclarations
10228 PyObject *__pyx_t_1 = NULL;
10229 PyObject *__pyx_t_2 = NULL;
10230 PyObject *__pyx_t_3 = NULL;
10232 PyObject *__pyx_t_5 = NULL;
10235 int __pyx_lineno = 0;
10236 const char *__pyx_filename = NULL;
10237 int __pyx_clineno = 0;
10238 __Pyx_RefNannySetupContext("findtext", 0);
10240 /* "lxml/_elementpath.py":341
10242 * def findtext(elem, path, default=None, namespaces=None):
10243 * el = find(elem, path, namespaces) # <<<<<<<<<<<<<<
10247 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_find); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
10248 __Pyx_GOTREF(__pyx_t_2);
10251 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10252 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10253 if (likely(__pyx_t_3)) {
10254 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10255 __Pyx_INCREF(__pyx_t_3);
10256 __Pyx_INCREF(function);
10257 __Pyx_DECREF_SET(__pyx_t_2, function);
10261 #if CYTHON_FAST_PYCALL
10262 if (PyFunction_Check(__pyx_t_2)) {
10263 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
10264 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
10265 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10266 __Pyx_GOTREF(__pyx_t_1);
10269 #if CYTHON_FAST_PYCCALL
10270 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
10271 PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_elem, __pyx_v_path, __pyx_v_namespaces};
10272 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
10273 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10274 __Pyx_GOTREF(__pyx_t_1);
10278 __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error)
10279 __Pyx_GOTREF(__pyx_t_5);
10281 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
10283 __Pyx_INCREF(__pyx_v_elem);
10284 __Pyx_GIVEREF(__pyx_v_elem);
10285 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_elem);
10286 __Pyx_INCREF(__pyx_v_path);
10287 __Pyx_GIVEREF(__pyx_v_path);
10288 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_path);
10289 __Pyx_INCREF(__pyx_v_namespaces);
10290 __Pyx_GIVEREF(__pyx_v_namespaces);
10291 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_namespaces);
10292 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
10293 __Pyx_GOTREF(__pyx_t_1);
10294 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10296 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10297 __pyx_v_el = __pyx_t_1;
10300 /* "lxml/_elementpath.py":342
10301 * def findtext(elem, path, default=None, namespaces=None):
10302 * el = find(elem, path, namespaces)
10303 * if el is None: # <<<<<<<<<<<<<<
10307 __pyx_t_6 = (__pyx_v_el == Py_None);
10308 __pyx_t_7 = (__pyx_t_6 != 0);
10311 /* "lxml/_elementpath.py":343
10312 * el = find(elem, path, namespaces)
10314 * return default # <<<<<<<<<<<<<<
10316 * return el.text or ''
10318 __Pyx_XDECREF(__pyx_r);
10319 __Pyx_INCREF(__pyx_v_default);
10320 __pyx_r = __pyx_v_default;
10323 /* "lxml/_elementpath.py":342
10324 * def findtext(elem, path, default=None, namespaces=None):
10325 * el = find(elem, path, namespaces)
10326 * if el is None: # <<<<<<<<<<<<<<
10332 /* "lxml/_elementpath.py":345
10335 * return el.text or '' # <<<<<<<<<<<<<<
10338 __Pyx_XDECREF(__pyx_r);
10339 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error)
10340 __Pyx_GOTREF(__pyx_t_2);
10341 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
10343 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10345 __Pyx_INCREF(__pyx_t_2);
10346 __pyx_t_1 = __pyx_t_2;
10347 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10348 goto __pyx_L4_bool_binop_done;
10350 __Pyx_INCREF(__pyx_kp_s__2);
10351 __pyx_t_1 = __pyx_kp_s__2;
10352 __pyx_L4_bool_binop_done:;
10353 __pyx_r = __pyx_t_1;
10358 /* "lxml/_elementpath.py":340
10359 * # Find text for first matching object.
10361 * def findtext(elem, path, default=None, namespaces=None): # <<<<<<<<<<<<<<
10362 * el = find(elem, path, namespaces)
10366 /* function exit code */
10368 __Pyx_XDECREF(__pyx_t_1);
10369 __Pyx_XDECREF(__pyx_t_2);
10370 __Pyx_XDECREF(__pyx_t_3);
10371 __Pyx_XDECREF(__pyx_t_5);
10372 __Pyx_AddTraceback("lxml._elementpath.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
10375 __Pyx_XDECREF(__pyx_v_el);
10376 __Pyx_XGIVEREF(__pyx_r);
10377 __Pyx_RefNannyFinishContext();
10381 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer[8];
10382 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer = 0;
10384 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10386 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer)))) {
10387 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer];
10388 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer));
10389 (void) PyObject_INIT(o, t);
10390 PyObject_GC_Track(o);
10392 o = (*t->tp_alloc)(t, 0);
10393 if (unlikely(!o)) return 0;
10398 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyObject *o) {
10399 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)o;
10400 PyObject_GC_UnTrack(o);
10401 Py_CLEAR(p->__pyx_v_default_namespace);
10402 Py_CLEAR(p->__pyx_v_namespaces);
10403 Py_CLEAR(p->__pyx_v_parsing_attribute);
10404 Py_CLEAR(p->__pyx_v_pattern);
10405 Py_CLEAR(p->__pyx_v_prefix);
10406 Py_CLEAR(p->__pyx_v_tag);
10407 Py_CLEAR(p->__pyx_v_token);
10408 Py_CLEAR(p->__pyx_v_ttype);
10409 Py_CLEAR(p->__pyx_v_uri);
10410 Py_CLEAR(p->__pyx_t_0);
10411 Py_CLEAR(p->__pyx_t_3);
10412 Py_CLEAR(p->__pyx_t_4);
10413 Py_CLEAR(p->__pyx_t_5);
10414 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer)))) {
10415 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)o);
10417 (*Py_TYPE(o)->tp_free)(o);
10421 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyObject *o, visitproc v, void *a) {
10423 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer *)o;
10424 if (p->__pyx_v_default_namespace) {
10425 e = (*v)(p->__pyx_v_default_namespace, a); if (e) return e;
10427 if (p->__pyx_v_namespaces) {
10428 e = (*v)(p->__pyx_v_namespaces, a); if (e) return e;
10430 if (p->__pyx_v_parsing_attribute) {
10431 e = (*v)(p->__pyx_v_parsing_attribute, a); if (e) return e;
10433 if (p->__pyx_v_pattern) {
10434 e = (*v)(p->__pyx_v_pattern, a); if (e) return e;
10436 if (p->__pyx_v_prefix) {
10437 e = (*v)(p->__pyx_v_prefix, a); if (e) return e;
10439 if (p->__pyx_v_tag) {
10440 e = (*v)(p->__pyx_v_tag, a); if (e) return e;
10442 if (p->__pyx_v_token) {
10443 e = (*v)(p->__pyx_v_token, a); if (e) return e;
10445 if (p->__pyx_v_ttype) {
10446 e = (*v)(p->__pyx_v_ttype, a); if (e) return e;
10448 if (p->__pyx_v_uri) {
10449 e = (*v)(p->__pyx_v_uri, a); if (e) return e;
10451 if (p->__pyx_t_0) {
10452 e = (*v)(p->__pyx_t_0, a); if (e) return e;
10454 if (p->__pyx_t_3) {
10455 e = (*v)(p->__pyx_t_3, a); if (e) return e;
10457 if (p->__pyx_t_4) {
10458 e = (*v)(p->__pyx_t_4, a); if (e) return e;
10460 if (p->__pyx_t_5) {
10461 e = (*v)(p->__pyx_t_5, a); if (e) return e;
10466 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer = {
10467 PyVarObject_HEAD_INIT(0, 0)
10468 "lxml._elementpath.__pyx_scope_struct__xpath_tokenizer", /*tp_name*/
10469 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer), /*tp_basicsize*/
10471 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_dealloc*/
10472 #if PY_VERSION_HEX < 0x030800b4
10475 #if PY_VERSION_HEX >= 0x030800b4
10476 0, /*tp_vectorcall_offset*/
10480 #if PY_MAJOR_VERSION < 3
10483 #if PY_MAJOR_VERSION >= 3
10487 0, /*tp_as_number*/
10488 0, /*tp_as_sequence*/
10489 0, /*tp_as_mapping*/
10495 0, /*tp_as_buffer*/
10496 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10498 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_traverse*/
10500 0, /*tp_richcompare*/
10501 0, /*tp_weaklistoffset*/
10509 0, /*tp_descr_get*/
10510 0, /*tp_descr_set*/
10511 0, /*tp_dictoffset*/
10514 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_new*/
10520 0, /*tp_subclasses*/
10523 0, /*tp_version_tag*/
10524 #if PY_VERSION_HEX >= 0x030400a1
10527 #if PY_VERSION_HEX >= 0x030800b1
10528 0, /*tp_vectorcall*/
10530 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10535 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child[8];
10536 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child = 0;
10538 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10540 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child)))) {
10541 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child];
10542 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child));
10543 (void) PyObject_INIT(o, t);
10544 PyObject_GC_Track(o);
10546 o = (*t->tp_alloc)(t, 0);
10547 if (unlikely(!o)) return 0;
10552 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyObject *o) {
10553 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)o;
10554 PyObject_GC_UnTrack(o);
10555 Py_CLEAR(p->__pyx_v_tag);
10556 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child)))) {
10557 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)o);
10559 (*Py_TYPE(o)->tp_free)(o);
10563 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyObject *o, visitproc v, void *a) {
10565 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)o;
10566 if (p->__pyx_v_tag) {
10567 e = (*v)(p->__pyx_v_tag, a); if (e) return e;
10572 static int __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyObject *o) {
10573 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *)o;
10574 Py_CLEAR(p->__pyx_v_tag);
10578 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child = {
10579 PyVarObject_HEAD_INIT(0, 0)
10580 "lxml._elementpath.__pyx_scope_struct_1_prepare_child", /*tp_name*/
10581 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child), /*tp_basicsize*/
10583 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_dealloc*/
10584 #if PY_VERSION_HEX < 0x030800b4
10587 #if PY_VERSION_HEX >= 0x030800b4
10588 0, /*tp_vectorcall_offset*/
10592 #if PY_MAJOR_VERSION < 3
10595 #if PY_MAJOR_VERSION >= 3
10599 0, /*tp_as_number*/
10600 0, /*tp_as_sequence*/
10601 0, /*tp_as_mapping*/
10607 0, /*tp_as_buffer*/
10608 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10610 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_traverse*/
10611 __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_clear*/
10612 0, /*tp_richcompare*/
10613 0, /*tp_weaklistoffset*/
10621 0, /*tp_descr_get*/
10622 0, /*tp_descr_set*/
10623 0, /*tp_dictoffset*/
10626 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_new*/
10632 0, /*tp_subclasses*/
10635 0, /*tp_version_tag*/
10636 #if PY_VERSION_HEX >= 0x030400a1
10639 #if PY_VERSION_HEX >= 0x030800b1
10640 0, /*tp_vectorcall*/
10642 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10647 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_2_select[8];
10648 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select = 0;
10650 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10652 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select)))) {
10653 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_2_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select];
10654 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select));
10655 (void) PyObject_INIT(o, t);
10656 PyObject_GC_Track(o);
10658 o = (*t->tp_alloc)(t, 0);
10659 if (unlikely(!o)) return 0;
10664 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_2_select(PyObject *o) {
10665 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)o;
10666 PyObject_GC_UnTrack(o);
10667 Py_CLEAR(p->__pyx_outer_scope);
10668 Py_CLEAR(p->__pyx_v_e);
10669 Py_CLEAR(p->__pyx_v_elem);
10670 Py_CLEAR(p->__pyx_v_result);
10671 Py_CLEAR(p->__pyx_t_0);
10672 Py_CLEAR(p->__pyx_t_3);
10673 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select)))) {
10674 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_2_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)o);
10676 (*Py_TYPE(o)->tp_free)(o);
10680 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_2_select(PyObject *o, visitproc v, void *a) {
10682 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select *)o;
10683 if (p->__pyx_outer_scope) {
10684 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
10686 if (p->__pyx_v_e) {
10687 e = (*v)(p->__pyx_v_e, a); if (e) return e;
10689 if (p->__pyx_v_elem) {
10690 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
10692 if (p->__pyx_v_result) {
10693 e = (*v)(p->__pyx_v_result, a); if (e) return e;
10695 if (p->__pyx_t_0) {
10696 e = (*v)(p->__pyx_t_0, a); if (e) return e;
10698 if (p->__pyx_t_3) {
10699 e = (*v)(p->__pyx_t_3, a); if (e) return e;
10704 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select = {
10705 PyVarObject_HEAD_INIT(0, 0)
10706 "lxml._elementpath.__pyx_scope_struct_2_select", /*tp_name*/
10707 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select), /*tp_basicsize*/
10709 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_dealloc*/
10710 #if PY_VERSION_HEX < 0x030800b4
10713 #if PY_VERSION_HEX >= 0x030800b4
10714 0, /*tp_vectorcall_offset*/
10718 #if PY_MAJOR_VERSION < 3
10721 #if PY_MAJOR_VERSION >= 3
10725 0, /*tp_as_number*/
10726 0, /*tp_as_sequence*/
10727 0, /*tp_as_mapping*/
10733 0, /*tp_as_buffer*/
10734 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10736 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_traverse*/
10738 0, /*tp_richcompare*/
10739 0, /*tp_weaklistoffset*/
10747 0, /*tp_descr_get*/
10748 0, /*tp_descr_set*/
10749 0, /*tp_dictoffset*/
10752 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_new*/
10758 0, /*tp_subclasses*/
10761 0, /*tp_version_tag*/
10762 #if PY_VERSION_HEX >= 0x030400a1
10765 #if PY_VERSION_HEX >= 0x030800b1
10766 0, /*tp_vectorcall*/
10768 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10773 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_3_select[8];
10774 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select = 0;
10776 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10778 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select)))) {
10779 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_3_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select];
10780 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select));
10781 (void) PyObject_INIT(o, t);
10782 PyObject_GC_Track(o);
10784 o = (*t->tp_alloc)(t, 0);
10785 if (unlikely(!o)) return 0;
10790 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_3_select(PyObject *o) {
10791 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)o;
10792 PyObject_GC_UnTrack(o);
10793 Py_CLEAR(p->__pyx_v_e);
10794 Py_CLEAR(p->__pyx_v_elem);
10795 Py_CLEAR(p->__pyx_v_result);
10796 Py_CLEAR(p->__pyx_t_0);
10797 Py_CLEAR(p->__pyx_t_3);
10798 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select)))) {
10799 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_3_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)o);
10801 (*Py_TYPE(o)->tp_free)(o);
10805 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_3_select(PyObject *o, visitproc v, void *a) {
10807 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select *)o;
10808 if (p->__pyx_v_e) {
10809 e = (*v)(p->__pyx_v_e, a); if (e) return e;
10811 if (p->__pyx_v_elem) {
10812 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
10814 if (p->__pyx_v_result) {
10815 e = (*v)(p->__pyx_v_result, a); if (e) return e;
10817 if (p->__pyx_t_0) {
10818 e = (*v)(p->__pyx_t_0, a); if (e) return e;
10820 if (p->__pyx_t_3) {
10821 e = (*v)(p->__pyx_t_3, a); if (e) return e;
10826 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select = {
10827 PyVarObject_HEAD_INIT(0, 0)
10828 "lxml._elementpath.__pyx_scope_struct_3_select", /*tp_name*/
10829 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select), /*tp_basicsize*/
10831 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_dealloc*/
10832 #if PY_VERSION_HEX < 0x030800b4
10835 #if PY_VERSION_HEX >= 0x030800b4
10836 0, /*tp_vectorcall_offset*/
10840 #if PY_MAJOR_VERSION < 3
10843 #if PY_MAJOR_VERSION >= 3
10847 0, /*tp_as_number*/
10848 0, /*tp_as_sequence*/
10849 0, /*tp_as_mapping*/
10855 0, /*tp_as_buffer*/
10856 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10858 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_traverse*/
10860 0, /*tp_richcompare*/
10861 0, /*tp_weaklistoffset*/
10869 0, /*tp_descr_get*/
10870 0, /*tp_descr_set*/
10871 0, /*tp_dictoffset*/
10874 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_new*/
10880 0, /*tp_subclasses*/
10883 0, /*tp_version_tag*/
10884 #if PY_VERSION_HEX >= 0x030400a1
10887 #if PY_VERSION_HEX >= 0x030800b1
10888 0, /*tp_vectorcall*/
10890 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10895 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant[8];
10896 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant = 0;
10898 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10900 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant)))) {
10901 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant];
10902 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant));
10903 (void) PyObject_INIT(o, t);
10904 PyObject_GC_Track(o);
10906 o = (*t->tp_alloc)(t, 0);
10907 if (unlikely(!o)) return 0;
10912 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyObject *o) {
10913 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)o;
10914 PyObject_GC_UnTrack(o);
10915 Py_CLEAR(p->__pyx_v_tag);
10916 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant)))) {
10917 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)o);
10919 (*Py_TYPE(o)->tp_free)(o);
10923 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyObject *o, visitproc v, void *a) {
10925 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)o;
10926 if (p->__pyx_v_tag) {
10927 e = (*v)(p->__pyx_v_tag, a); if (e) return e;
10932 static int __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyObject *o) {
10933 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *)o;
10934 Py_CLEAR(p->__pyx_v_tag);
10938 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant = {
10939 PyVarObject_HEAD_INIT(0, 0)
10940 "lxml._elementpath.__pyx_scope_struct_4_prepare_descendant", /*tp_name*/
10941 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant), /*tp_basicsize*/
10943 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_dealloc*/
10944 #if PY_VERSION_HEX < 0x030800b4
10947 #if PY_VERSION_HEX >= 0x030800b4
10948 0, /*tp_vectorcall_offset*/
10952 #if PY_MAJOR_VERSION < 3
10955 #if PY_MAJOR_VERSION >= 3
10959 0, /*tp_as_number*/
10960 0, /*tp_as_sequence*/
10961 0, /*tp_as_mapping*/
10967 0, /*tp_as_buffer*/
10968 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10970 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_traverse*/
10971 __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_clear*/
10972 0, /*tp_richcompare*/
10973 0, /*tp_weaklistoffset*/
10981 0, /*tp_descr_get*/
10982 0, /*tp_descr_set*/
10983 0, /*tp_dictoffset*/
10986 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_new*/
10992 0, /*tp_subclasses*/
10995 0, /*tp_version_tag*/
10996 #if PY_VERSION_HEX >= 0x030400a1
10999 #if PY_VERSION_HEX >= 0x030800b1
11000 0, /*tp_vectorcall*/
11002 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11007 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_5_select[8];
11008 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select = 0;
11010 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11012 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select)))) {
11013 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_5_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select];
11014 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select));
11015 (void) PyObject_INIT(o, t);
11016 PyObject_GC_Track(o);
11018 o = (*t->tp_alloc)(t, 0);
11019 if (unlikely(!o)) return 0;
11024 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_5_select(PyObject *o) {
11025 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)o;
11026 PyObject_GC_UnTrack(o);
11027 Py_CLEAR(p->__pyx_outer_scope);
11028 Py_CLEAR(p->__pyx_v_e);
11029 Py_CLEAR(p->__pyx_v_elem);
11030 Py_CLEAR(p->__pyx_v_result);
11031 Py_CLEAR(p->__pyx_t_0);
11032 Py_CLEAR(p->__pyx_t_3);
11033 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select)))) {
11034 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_5_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)o);
11036 (*Py_TYPE(o)->tp_free)(o);
11040 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_5_select(PyObject *o, visitproc v, void *a) {
11042 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select *)o;
11043 if (p->__pyx_outer_scope) {
11044 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11046 if (p->__pyx_v_e) {
11047 e = (*v)(p->__pyx_v_e, a); if (e) return e;
11049 if (p->__pyx_v_elem) {
11050 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11052 if (p->__pyx_v_result) {
11053 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11055 if (p->__pyx_t_0) {
11056 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11058 if (p->__pyx_t_3) {
11059 e = (*v)(p->__pyx_t_3, a); if (e) return e;
11064 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select = {
11065 PyVarObject_HEAD_INIT(0, 0)
11066 "lxml._elementpath.__pyx_scope_struct_5_select", /*tp_name*/
11067 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select), /*tp_basicsize*/
11069 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_dealloc*/
11070 #if PY_VERSION_HEX < 0x030800b4
11073 #if PY_VERSION_HEX >= 0x030800b4
11074 0, /*tp_vectorcall_offset*/
11078 #if PY_MAJOR_VERSION < 3
11081 #if PY_MAJOR_VERSION >= 3
11085 0, /*tp_as_number*/
11086 0, /*tp_as_sequence*/
11087 0, /*tp_as_mapping*/
11093 0, /*tp_as_buffer*/
11094 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11096 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_traverse*/
11098 0, /*tp_richcompare*/
11099 0, /*tp_weaklistoffset*/
11107 0, /*tp_descr_get*/
11108 0, /*tp_descr_set*/
11109 0, /*tp_dictoffset*/
11112 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_new*/
11118 0, /*tp_subclasses*/
11121 0, /*tp_version_tag*/
11122 #if PY_VERSION_HEX >= 0x030400a1
11125 #if PY_VERSION_HEX >= 0x030800b1
11126 0, /*tp_vectorcall*/
11128 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11133 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_6_select[8];
11134 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select = 0;
11136 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11138 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select)))) {
11139 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_6_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select];
11140 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select));
11141 (void) PyObject_INIT(o, t);
11142 PyObject_GC_Track(o);
11144 o = (*t->tp_alloc)(t, 0);
11145 if (unlikely(!o)) return 0;
11150 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_6_select(PyObject *o) {
11151 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)o;
11152 PyObject_GC_UnTrack(o);
11153 Py_CLEAR(p->__pyx_v_elem);
11154 Py_CLEAR(p->__pyx_v_parent);
11155 Py_CLEAR(p->__pyx_v_result);
11156 Py_CLEAR(p->__pyx_t_0);
11157 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select)))) {
11158 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_6_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)o);
11160 (*Py_TYPE(o)->tp_free)(o);
11164 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_6_select(PyObject *o, visitproc v, void *a) {
11166 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select *)o;
11167 if (p->__pyx_v_elem) {
11168 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11170 if (p->__pyx_v_parent) {
11171 e = (*v)(p->__pyx_v_parent, a); if (e) return e;
11173 if (p->__pyx_v_result) {
11174 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11176 if (p->__pyx_t_0) {
11177 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11182 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select = {
11183 PyVarObject_HEAD_INIT(0, 0)
11184 "lxml._elementpath.__pyx_scope_struct_6_select", /*tp_name*/
11185 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select), /*tp_basicsize*/
11187 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_dealloc*/
11188 #if PY_VERSION_HEX < 0x030800b4
11191 #if PY_VERSION_HEX >= 0x030800b4
11192 0, /*tp_vectorcall_offset*/
11196 #if PY_MAJOR_VERSION < 3
11199 #if PY_MAJOR_VERSION >= 3
11203 0, /*tp_as_number*/
11204 0, /*tp_as_sequence*/
11205 0, /*tp_as_mapping*/
11211 0, /*tp_as_buffer*/
11212 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11214 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_traverse*/
11216 0, /*tp_richcompare*/
11217 0, /*tp_weaklistoffset*/
11225 0, /*tp_descr_get*/
11226 0, /*tp_descr_set*/
11227 0, /*tp_dictoffset*/
11230 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_new*/
11236 0, /*tp_subclasses*/
11239 0, /*tp_version_tag*/
11240 #if PY_VERSION_HEX >= 0x030400a1
11243 #if PY_VERSION_HEX >= 0x030800b1
11244 0, /*tp_vectorcall*/
11246 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11251 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate[8];
11252 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate = 0;
11254 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11256 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate)))) {
11257 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate];
11258 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate));
11259 (void) PyObject_INIT(o, t);
11260 PyObject_GC_Track(o);
11262 o = (*t->tp_alloc)(t, 0);
11263 if (unlikely(!o)) return 0;
11268 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyObject *o) {
11269 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)o;
11270 PyObject_GC_UnTrack(o);
11271 Py_CLEAR(p->__pyx_v_index);
11272 Py_CLEAR(p->__pyx_v_key);
11273 Py_CLEAR(p->__pyx_v_tag);
11274 Py_CLEAR(p->__pyx_v_value);
11275 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate)))) {
11276 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)o);
11278 (*Py_TYPE(o)->tp_free)(o);
11282 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyObject *o, visitproc v, void *a) {
11284 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)o;
11285 if (p->__pyx_v_index) {
11286 e = (*v)(p->__pyx_v_index, a); if (e) return e;
11288 if (p->__pyx_v_key) {
11289 e = (*v)(p->__pyx_v_key, a); if (e) return e;
11291 if (p->__pyx_v_tag) {
11292 e = (*v)(p->__pyx_v_tag, a); if (e) return e;
11294 if (p->__pyx_v_value) {
11295 e = (*v)(p->__pyx_v_value, a); if (e) return e;
11300 static int __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyObject *o) {
11301 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate *)o;
11302 Py_CLEAR(p->__pyx_v_index);
11303 Py_CLEAR(p->__pyx_v_key);
11304 Py_CLEAR(p->__pyx_v_tag);
11305 Py_CLEAR(p->__pyx_v_value);
11309 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate = {
11310 PyVarObject_HEAD_INIT(0, 0)
11311 "lxml._elementpath.__pyx_scope_struct_7_prepare_predicate", /*tp_name*/
11312 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate), /*tp_basicsize*/
11314 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_dealloc*/
11315 #if PY_VERSION_HEX < 0x030800b4
11318 #if PY_VERSION_HEX >= 0x030800b4
11319 0, /*tp_vectorcall_offset*/
11323 #if PY_MAJOR_VERSION < 3
11326 #if PY_MAJOR_VERSION >= 3
11330 0, /*tp_as_number*/
11331 0, /*tp_as_sequence*/
11332 0, /*tp_as_mapping*/
11338 0, /*tp_as_buffer*/
11339 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11341 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_traverse*/
11342 __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_clear*/
11343 0, /*tp_richcompare*/
11344 0, /*tp_weaklistoffset*/
11352 0, /*tp_descr_get*/
11353 0, /*tp_descr_set*/
11354 0, /*tp_dictoffset*/
11357 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_new*/
11363 0, /*tp_subclasses*/
11366 0, /*tp_version_tag*/
11367 #if PY_VERSION_HEX >= 0x030400a1
11370 #if PY_VERSION_HEX >= 0x030800b1
11371 0, /*tp_vectorcall*/
11373 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11378 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_8_select[8];
11379 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select = 0;
11381 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11383 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select)))) {
11384 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_8_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select];
11385 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select));
11386 (void) PyObject_INIT(o, t);
11387 PyObject_GC_Track(o);
11389 o = (*t->tp_alloc)(t, 0);
11390 if (unlikely(!o)) return 0;
11395 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_8_select(PyObject *o) {
11396 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)o;
11397 PyObject_GC_UnTrack(o);
11398 Py_CLEAR(p->__pyx_outer_scope);
11399 Py_CLEAR(p->__pyx_v_elem);
11400 Py_CLEAR(p->__pyx_v_result);
11401 Py_CLEAR(p->__pyx_t_0);
11402 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select)))) {
11403 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_8_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)o);
11405 (*Py_TYPE(o)->tp_free)(o);
11409 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_8_select(PyObject *o, visitproc v, void *a) {
11411 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select *)o;
11412 if (p->__pyx_outer_scope) {
11413 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11415 if (p->__pyx_v_elem) {
11416 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11418 if (p->__pyx_v_result) {
11419 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11421 if (p->__pyx_t_0) {
11422 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11427 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select = {
11428 PyVarObject_HEAD_INIT(0, 0)
11429 "lxml._elementpath.__pyx_scope_struct_8_select", /*tp_name*/
11430 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select), /*tp_basicsize*/
11432 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_dealloc*/
11433 #if PY_VERSION_HEX < 0x030800b4
11436 #if PY_VERSION_HEX >= 0x030800b4
11437 0, /*tp_vectorcall_offset*/
11441 #if PY_MAJOR_VERSION < 3
11444 #if PY_MAJOR_VERSION >= 3
11448 0, /*tp_as_number*/
11449 0, /*tp_as_sequence*/
11450 0, /*tp_as_mapping*/
11456 0, /*tp_as_buffer*/
11457 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11459 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_traverse*/
11461 0, /*tp_richcompare*/
11462 0, /*tp_weaklistoffset*/
11470 0, /*tp_descr_get*/
11471 0, /*tp_descr_set*/
11472 0, /*tp_dictoffset*/
11475 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_new*/
11481 0, /*tp_subclasses*/
11484 0, /*tp_version_tag*/
11485 #if PY_VERSION_HEX >= 0x030400a1
11488 #if PY_VERSION_HEX >= 0x030800b1
11489 0, /*tp_vectorcall*/
11491 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11496 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_9_select[8];
11497 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select = 0;
11499 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11501 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select)))) {
11502 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_9_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select];
11503 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select));
11504 (void) PyObject_INIT(o, t);
11505 PyObject_GC_Track(o);
11507 o = (*t->tp_alloc)(t, 0);
11508 if (unlikely(!o)) return 0;
11513 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_9_select(PyObject *o) {
11514 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)o;
11515 PyObject_GC_UnTrack(o);
11516 Py_CLEAR(p->__pyx_outer_scope);
11517 Py_CLEAR(p->__pyx_v_elem);
11518 Py_CLEAR(p->__pyx_v_result);
11519 Py_CLEAR(p->__pyx_t_0);
11520 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select)))) {
11521 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_9_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)o);
11523 (*Py_TYPE(o)->tp_free)(o);
11527 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_9_select(PyObject *o, visitproc v, void *a) {
11529 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select *)o;
11530 if (p->__pyx_outer_scope) {
11531 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11533 if (p->__pyx_v_elem) {
11534 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11536 if (p->__pyx_v_result) {
11537 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11539 if (p->__pyx_t_0) {
11540 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11545 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select = {
11546 PyVarObject_HEAD_INIT(0, 0)
11547 "lxml._elementpath.__pyx_scope_struct_9_select", /*tp_name*/
11548 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select), /*tp_basicsize*/
11550 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_dealloc*/
11551 #if PY_VERSION_HEX < 0x030800b4
11554 #if PY_VERSION_HEX >= 0x030800b4
11555 0, /*tp_vectorcall_offset*/
11559 #if PY_MAJOR_VERSION < 3
11562 #if PY_MAJOR_VERSION >= 3
11566 0, /*tp_as_number*/
11567 0, /*tp_as_sequence*/
11568 0, /*tp_as_mapping*/
11574 0, /*tp_as_buffer*/
11575 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11577 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_traverse*/
11579 0, /*tp_richcompare*/
11580 0, /*tp_weaklistoffset*/
11588 0, /*tp_descr_get*/
11589 0, /*tp_descr_set*/
11590 0, /*tp_dictoffset*/
11593 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_new*/
11599 0, /*tp_subclasses*/
11602 0, /*tp_version_tag*/
11603 #if PY_VERSION_HEX >= 0x030400a1
11606 #if PY_VERSION_HEX >= 0x030800b1
11607 0, /*tp_vectorcall*/
11609 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11614 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_10_select[8];
11615 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select = 0;
11617 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11619 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select)))) {
11620 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_10_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select];
11621 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select));
11622 (void) PyObject_INIT(o, t);
11623 PyObject_GC_Track(o);
11625 o = (*t->tp_alloc)(t, 0);
11626 if (unlikely(!o)) return 0;
11631 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_10_select(PyObject *o) {
11632 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)o;
11633 PyObject_GC_UnTrack(o);
11634 Py_CLEAR(p->__pyx_outer_scope);
11635 Py_CLEAR(p->__pyx_v__);
11636 Py_CLEAR(p->__pyx_v_elem);
11637 Py_CLEAR(p->__pyx_v_result);
11638 Py_CLEAR(p->__pyx_t_0);
11639 Py_CLEAR(p->__pyx_t_3);
11640 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select)))) {
11641 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_10_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)o);
11643 (*Py_TYPE(o)->tp_free)(o);
11647 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_10_select(PyObject *o, visitproc v, void *a) {
11649 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select *)o;
11650 if (p->__pyx_outer_scope) {
11651 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11653 if (p->__pyx_v__) {
11654 e = (*v)(p->__pyx_v__, a); if (e) return e;
11656 if (p->__pyx_v_elem) {
11657 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11659 if (p->__pyx_v_result) {
11660 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11662 if (p->__pyx_t_0) {
11663 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11665 if (p->__pyx_t_3) {
11666 e = (*v)(p->__pyx_t_3, a); if (e) return e;
11671 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select = {
11672 PyVarObject_HEAD_INIT(0, 0)
11673 "lxml._elementpath.__pyx_scope_struct_10_select", /*tp_name*/
11674 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select), /*tp_basicsize*/
11676 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_dealloc*/
11677 #if PY_VERSION_HEX < 0x030800b4
11680 #if PY_VERSION_HEX >= 0x030800b4
11681 0, /*tp_vectorcall_offset*/
11685 #if PY_MAJOR_VERSION < 3
11688 #if PY_MAJOR_VERSION >= 3
11692 0, /*tp_as_number*/
11693 0, /*tp_as_sequence*/
11694 0, /*tp_as_mapping*/
11700 0, /*tp_as_buffer*/
11701 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11703 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_traverse*/
11705 0, /*tp_richcompare*/
11706 0, /*tp_weaklistoffset*/
11714 0, /*tp_descr_get*/
11715 0, /*tp_descr_set*/
11716 0, /*tp_dictoffset*/
11719 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_new*/
11725 0, /*tp_subclasses*/
11728 0, /*tp_version_tag*/
11729 #if PY_VERSION_HEX >= 0x030400a1
11732 #if PY_VERSION_HEX >= 0x030800b1
11733 0, /*tp_vectorcall*/
11735 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11740 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_11_select[8];
11741 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select = 0;
11743 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11745 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select)))) {
11746 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_11_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select];
11747 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select));
11748 (void) PyObject_INIT(o, t);
11749 PyObject_GC_Track(o);
11751 o = (*t->tp_alloc)(t, 0);
11752 if (unlikely(!o)) return 0;
11757 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_11_select(PyObject *o) {
11758 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)o;
11759 PyObject_GC_UnTrack(o);
11760 Py_CLEAR(p->__pyx_outer_scope);
11761 Py_CLEAR(p->__pyx_v_e);
11762 Py_CLEAR(p->__pyx_v_elem);
11763 Py_CLEAR(p->__pyx_v_result);
11764 Py_CLEAR(p->__pyx_t_0);
11765 Py_CLEAR(p->__pyx_t_3);
11766 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select)))) {
11767 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_11_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)o);
11769 (*Py_TYPE(o)->tp_free)(o);
11773 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_11_select(PyObject *o, visitproc v, void *a) {
11775 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select *)o;
11776 if (p->__pyx_outer_scope) {
11777 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11779 if (p->__pyx_v_e) {
11780 e = (*v)(p->__pyx_v_e, a); if (e) return e;
11782 if (p->__pyx_v_elem) {
11783 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11785 if (p->__pyx_v_result) {
11786 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11788 if (p->__pyx_t_0) {
11789 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11791 if (p->__pyx_t_3) {
11792 e = (*v)(p->__pyx_t_3, a); if (e) return e;
11797 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select = {
11798 PyVarObject_HEAD_INIT(0, 0)
11799 "lxml._elementpath.__pyx_scope_struct_11_select", /*tp_name*/
11800 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select), /*tp_basicsize*/
11802 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_dealloc*/
11803 #if PY_VERSION_HEX < 0x030800b4
11806 #if PY_VERSION_HEX >= 0x030800b4
11807 0, /*tp_vectorcall_offset*/
11811 #if PY_MAJOR_VERSION < 3
11814 #if PY_MAJOR_VERSION >= 3
11818 0, /*tp_as_number*/
11819 0, /*tp_as_sequence*/
11820 0, /*tp_as_mapping*/
11826 0, /*tp_as_buffer*/
11827 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11829 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_traverse*/
11831 0, /*tp_richcompare*/
11832 0, /*tp_weaklistoffset*/
11840 0, /*tp_descr_get*/
11841 0, /*tp_descr_set*/
11842 0, /*tp_dictoffset*/
11845 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_new*/
11851 0, /*tp_subclasses*/
11854 0, /*tp_version_tag*/
11855 #if PY_VERSION_HEX >= 0x030400a1
11858 #if PY_VERSION_HEX >= 0x030800b1
11859 0, /*tp_vectorcall*/
11861 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11866 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_12_select[8];
11867 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select = 0;
11869 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11871 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select)))) {
11872 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_12_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select];
11873 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select));
11874 (void) PyObject_INIT(o, t);
11875 PyObject_GC_Track(o);
11877 o = (*t->tp_alloc)(t, 0);
11878 if (unlikely(!o)) return 0;
11883 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_12_select(PyObject *o) {
11884 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)o;
11885 PyObject_GC_UnTrack(o);
11886 Py_CLEAR(p->__pyx_outer_scope);
11887 Py_CLEAR(p->__pyx_v_elem);
11888 Py_CLEAR(p->__pyx_v_result);
11889 Py_CLEAR(p->__pyx_t_0);
11890 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select)))) {
11891 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_12_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)o);
11893 (*Py_TYPE(o)->tp_free)(o);
11897 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_12_select(PyObject *o, visitproc v, void *a) {
11899 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select *)o;
11900 if (p->__pyx_outer_scope) {
11901 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
11903 if (p->__pyx_v_elem) {
11904 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11906 if (p->__pyx_v_result) {
11907 e = (*v)(p->__pyx_v_result, a); if (e) return e;
11909 if (p->__pyx_t_0) {
11910 e = (*v)(p->__pyx_t_0, a); if (e) return e;
11915 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select = {
11916 PyVarObject_HEAD_INIT(0, 0)
11917 "lxml._elementpath.__pyx_scope_struct_12_select", /*tp_name*/
11918 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select), /*tp_basicsize*/
11920 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_dealloc*/
11921 #if PY_VERSION_HEX < 0x030800b4
11924 #if PY_VERSION_HEX >= 0x030800b4
11925 0, /*tp_vectorcall_offset*/
11929 #if PY_MAJOR_VERSION < 3
11932 #if PY_MAJOR_VERSION >= 3
11936 0, /*tp_as_number*/
11937 0, /*tp_as_sequence*/
11938 0, /*tp_as_mapping*/
11944 0, /*tp_as_buffer*/
11945 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
11947 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_traverse*/
11949 0, /*tp_richcompare*/
11950 0, /*tp_weaklistoffset*/
11958 0, /*tp_descr_get*/
11959 0, /*tp_descr_set*/
11960 0, /*tp_dictoffset*/
11963 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_new*/
11969 0, /*tp_subclasses*/
11972 0, /*tp_version_tag*/
11973 #if PY_VERSION_HEX >= 0x030400a1
11976 #if PY_VERSION_HEX >= 0x030800b1
11977 0, /*tp_vectorcall*/
11979 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11984 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_13_select[8];
11985 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select = 0;
11987 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11989 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select)))) {
11990 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_13_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select];
11991 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select));
11992 (void) PyObject_INIT(o, t);
11993 PyObject_GC_Track(o);
11995 o = (*t->tp_alloc)(t, 0);
11996 if (unlikely(!o)) return 0;
12001 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_13_select(PyObject *o) {
12002 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)o;
12003 PyObject_GC_UnTrack(o);
12004 Py_CLEAR(p->__pyx_outer_scope);
12005 Py_CLEAR(p->__pyx_v_elem);
12006 Py_CLEAR(p->__pyx_v_elems);
12007 Py_CLEAR(p->__pyx_v_parent);
12008 Py_CLEAR(p->__pyx_v_result);
12009 Py_CLEAR(p->__pyx_t_0);
12010 Py_CLEAR(p->__pyx_t_3);
12011 Py_CLEAR(p->__pyx_t_4);
12012 Py_CLEAR(p->__pyx_t_5);
12013 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select)))) {
12014 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_13_select[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)o);
12016 (*Py_TYPE(o)->tp_free)(o);
12020 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_13_select(PyObject *o, visitproc v, void *a) {
12022 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select *)o;
12023 if (p->__pyx_outer_scope) {
12024 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
12026 if (p->__pyx_v_elem) {
12027 e = (*v)(p->__pyx_v_elem, a); if (e) return e;
12029 if (p->__pyx_v_elems) {
12030 e = (*v)(p->__pyx_v_elems, a); if (e) return e;
12032 if (p->__pyx_v_parent) {
12033 e = (*v)(p->__pyx_v_parent, a); if (e) return e;
12035 if (p->__pyx_v_result) {
12036 e = (*v)(p->__pyx_v_result, a); if (e) return e;
12038 if (p->__pyx_t_0) {
12039 e = (*v)(p->__pyx_t_0, a); if (e) return e;
12041 if (p->__pyx_t_3) {
12042 e = (*v)(p->__pyx_t_3, a); if (e) return e;
12044 if (p->__pyx_t_4) {
12045 e = (*v)(p->__pyx_t_4, a); if (e) return e;
12047 if (p->__pyx_t_5) {
12048 e = (*v)(p->__pyx_t_5, a); if (e) return e;
12053 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select = {
12054 PyVarObject_HEAD_INIT(0, 0)
12055 "lxml._elementpath.__pyx_scope_struct_13_select", /*tp_name*/
12056 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select), /*tp_basicsize*/
12058 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_dealloc*/
12059 #if PY_VERSION_HEX < 0x030800b4
12062 #if PY_VERSION_HEX >= 0x030800b4
12063 0, /*tp_vectorcall_offset*/
12067 #if PY_MAJOR_VERSION < 3
12070 #if PY_MAJOR_VERSION >= 3
12074 0, /*tp_as_number*/
12075 0, /*tp_as_sequence*/
12076 0, /*tp_as_mapping*/
12082 0, /*tp_as_buffer*/
12083 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
12085 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_traverse*/
12087 0, /*tp_richcompare*/
12088 0, /*tp_weaklistoffset*/
12096 0, /*tp_descr_get*/
12097 0, /*tp_descr_set*/
12098 0, /*tp_dictoffset*/
12101 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_new*/
12107 0, /*tp_subclasses*/
12110 0, /*tp_version_tag*/
12111 #if PY_VERSION_HEX >= 0x030400a1
12114 #if PY_VERSION_HEX >= 0x030800b1
12115 0, /*tp_vectorcall*/
12117 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12122 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator[8];
12123 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator = 0;
12125 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
12127 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator)))) {
12128 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator];
12129 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator));
12130 (void) PyObject_INIT(o, t);
12131 PyObject_GC_Track(o);
12133 o = (*t->tp_alloc)(t, 0);
12134 if (unlikely(!o)) return 0;
12139 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyObject *o) {
12140 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)o;
12141 PyObject_GC_UnTrack(o);
12142 Py_CLEAR(p->__pyx_v_namespaces);
12143 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator)))) {
12144 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)o);
12146 (*Py_TYPE(o)->tp_free)(o);
12150 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyObject *o, visitproc v, void *a) {
12152 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)o;
12153 if (p->__pyx_v_namespaces) {
12154 e = (*v)(p->__pyx_v_namespaces, a); if (e) return e;
12159 static int __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyObject *o) {
12160 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *)o;
12161 Py_CLEAR(p->__pyx_v_namespaces);
12165 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator = {
12166 PyVarObject_HEAD_INIT(0, 0)
12167 "lxml._elementpath.__pyx_scope_struct_14__build_path_iterator", /*tp_name*/
12168 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator), /*tp_basicsize*/
12170 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_dealloc*/
12171 #if PY_VERSION_HEX < 0x030800b4
12174 #if PY_VERSION_HEX >= 0x030800b4
12175 0, /*tp_vectorcall_offset*/
12179 #if PY_MAJOR_VERSION < 3
12182 #if PY_MAJOR_VERSION >= 3
12186 0, /*tp_as_number*/
12187 0, /*tp_as_sequence*/
12188 0, /*tp_as_mapping*/
12194 0, /*tp_as_buffer*/
12195 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
12197 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_traverse*/
12198 __pyx_tp_clear_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_clear*/
12199 0, /*tp_richcompare*/
12200 0, /*tp_weaklistoffset*/
12208 0, /*tp_descr_get*/
12209 0, /*tp_descr_set*/
12210 0, /*tp_dictoffset*/
12213 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_new*/
12219 0, /*tp_subclasses*/
12222 0, /*tp_version_tag*/
12223 #if PY_VERSION_HEX >= 0x030400a1
12226 #if PY_VERSION_HEX >= 0x030800b1
12227 0, /*tp_vectorcall*/
12229 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12234 static struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_15_genexpr[8];
12235 static int __pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr = 0;
12237 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
12239 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr)))) {
12240 o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_15_genexpr[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr];
12241 memset(o, 0, sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr));
12242 (void) PyObject_INIT(o, t);
12243 PyObject_GC_Track(o);
12245 o = (*t->tp_alloc)(t, 0);
12246 if (unlikely(!o)) return 0;
12251 static void __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyObject *o) {
12252 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)o;
12253 PyObject_GC_UnTrack(o);
12254 Py_CLEAR(p->__pyx_outer_scope);
12255 Py_CLEAR(p->__pyx_v_item);
12256 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr)))) {
12257 __pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_15_genexpr[__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr++] = ((struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)o);
12259 (*Py_TYPE(o)->tp_free)(o);
12263 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyObject *o, visitproc v, void *a) {
12265 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr *)o;
12266 if (p->__pyx_outer_scope) {
12267 e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
12269 if (p->__pyx_v_item) {
12270 e = (*v)(p->__pyx_v_item, a); if (e) return e;
12275 static PyTypeObject __pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr = {
12276 PyVarObject_HEAD_INIT(0, 0)
12277 "lxml._elementpath.__pyx_scope_struct_15_genexpr", /*tp_name*/
12278 sizeof(struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr), /*tp_basicsize*/
12280 __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_dealloc*/
12281 #if PY_VERSION_HEX < 0x030800b4
12284 #if PY_VERSION_HEX >= 0x030800b4
12285 0, /*tp_vectorcall_offset*/
12289 #if PY_MAJOR_VERSION < 3
12292 #if PY_MAJOR_VERSION >= 3
12296 0, /*tp_as_number*/
12297 0, /*tp_as_sequence*/
12298 0, /*tp_as_mapping*/
12304 0, /*tp_as_buffer*/
12305 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
12307 __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_traverse*/
12309 0, /*tp_richcompare*/
12310 0, /*tp_weaklistoffset*/
12318 0, /*tp_descr_get*/
12319 0, /*tp_descr_set*/
12320 0, /*tp_dictoffset*/
12323 __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_new*/
12329 0, /*tp_subclasses*/
12332 0, /*tp_version_tag*/
12333 #if PY_VERSION_HEX >= 0x030400a1
12336 #if PY_VERSION_HEX >= 0x030800b1
12337 0, /*tp_vectorcall*/
12339 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12344 static PyMethodDef __pyx_methods[] = {
12348 #if PY_MAJOR_VERSION >= 3
12349 #if CYTHON_PEP489_MULTI_PHASE_INIT
12350 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
12351 static int __pyx_pymod_exec__elementpath(PyObject* module); /*proto*/
12352 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
12353 {Py_mod_create, (void*)__pyx_pymod_create},
12354 {Py_mod_exec, (void*)__pyx_pymod_exec__elementpath},
12359 static struct PyModuleDef __pyx_moduledef = {
12360 PyModuleDef_HEAD_INIT,
12363 #if CYTHON_PEP489_MULTI_PHASE_INIT
12368 __pyx_methods /* m_methods */,
12369 #if CYTHON_PEP489_MULTI_PHASE_INIT
12370 __pyx_moduledef_slots, /* m_slots */
12372 NULL, /* m_reload */
12374 NULL, /* m_traverse */
12375 NULL, /* m_clear */
12376 (freefunc)__pyx_module_cleanup /* m_free */
12379 #ifndef CYTHON_SMALL_CODE
12380 #if defined(__clang__)
12381 #define CYTHON_SMALL_CODE
12382 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
12383 #define CYTHON_SMALL_CODE __attribute__((cold))
12385 #define CYTHON_SMALL_CODE
12389 static __Pyx_StringTabEntry __pyx_string_tab[] = {
12390 {&__pyx_kp_s_Ambiguous_default_namespace_prov, __pyx_k_Ambiguous_default_namespace_prov, sizeof(__pyx_k_Ambiguous_default_namespace_prov), 0, 0, 1, 0},
12391 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
12392 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
12393 {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
12394 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
12395 {&__pyx_n_s_SyntaxError, __pyx_k_SyntaxError, sizeof(__pyx_k_SyntaxError), 0, 0, 1, 1},
12396 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
12397 {&__pyx_kp_s__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 1, 0},
12398 {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
12399 {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0},
12400 {&__pyx_kp_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 0},
12401 {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0},
12402 {&__pyx_kp_s__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 1, 0},
12403 {&__pyx_kp_s__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 0},
12404 {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
12405 {&__pyx_n_s__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 1, 1},
12406 {&__pyx_kp_s__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 0, 1, 0},
12407 {&__pyx_kp_s__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 0, 1, 0},
12408 {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
12409 {&__pyx_kp_s__41, __pyx_k__41, sizeof(__pyx_k__41), 0, 0, 1, 0},
12410 {&__pyx_kp_s__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 0, 1, 0},
12411 {&__pyx_kp_s__51, __pyx_k__51, sizeof(__pyx_k__51), 0, 0, 1, 0},
12412 {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
12413 {&__pyx_kp_s__70, __pyx_k__70, sizeof(__pyx_k__70), 0, 0, 1, 0},
12414 {&__pyx_kp_s__71, __pyx_k__71, sizeof(__pyx_k__71), 0, 0, 1, 0},
12415 {&__pyx_kp_s__72, __pyx_k__72, sizeof(__pyx_k__72), 0, 0, 1, 0},
12416 {&__pyx_kp_s__73, __pyx_k__73, sizeof(__pyx_k__73), 0, 0, 1, 0},
12417 {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
12418 {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
12419 {&__pyx_n_s_build_path_iterator, __pyx_k_build_path_iterator, sizeof(__pyx_k_build_path_iterator), 0, 0, 1, 1},
12420 {&__pyx_n_s_build_path_iterator_locals_gene, __pyx_k_build_path_iterator_locals_gene, sizeof(__pyx_k_build_path_iterator_locals_gene), 0, 0, 1, 1},
12421 {&__pyx_n_s_cache, __pyx_k_cache, sizeof(__pyx_k_cache), 0, 0, 1, 1},
12422 {&__pyx_n_s_cache_key, __pyx_k_cache_key, sizeof(__pyx_k_cache_key), 0, 0, 1, 1},
12423 {&__pyx_kp_s_cannot_use_absolute_path_on_elem, __pyx_k_cannot_use_absolute_path_on_elem, sizeof(__pyx_k_cannot_use_absolute_path_on_elem), 0, 0, 1, 0},
12424 {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
12425 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
12426 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
12427 {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
12428 {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
12429 {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
12430 {&__pyx_n_s_default_namespace, __pyx_k_default_namespace, sizeof(__pyx_k_default_namespace), 0, 0, 1, 1},
12431 {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
12432 {&__pyx_n_s_el, __pyx_k_el, sizeof(__pyx_k_el), 0, 0, 1, 1},
12433 {&__pyx_n_s_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 0, 0, 1, 1},
12434 {&__pyx_n_s_elems, __pyx_k_elems, sizeof(__pyx_k_elems), 0, 0, 1, 1},
12435 {&__pyx_kp_s_empty_path_expression, __pyx_k_empty_path_expression, sizeof(__pyx_k_empty_path_expression), 0, 0, 1, 0},
12436 {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
12437 {&__pyx_n_s_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 0, 0, 1, 1},
12438 {&__pyx_n_s_findtext, __pyx_k_findtext, sizeof(__pyx_k_findtext), 0, 0, 1, 1},
12439 {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
12440 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
12441 {&__pyx_n_s_getparent, __pyx_k_getparent, sizeof(__pyx_k_getparent), 0, 0, 1, 1},
12442 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
12443 {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
12444 {&__pyx_kp_s_indices_in_path_predicates_are_1, __pyx_k_indices_in_path_predicates_are_1, sizeof(__pyx_k_indices_in_path_predicates_are_1), 0, 0, 1, 0},
12445 {&__pyx_kp_s_invalid_descendant, __pyx_k_invalid_descendant, sizeof(__pyx_k_invalid_descendant), 0, 0, 1, 0},
12446 {&__pyx_kp_s_invalid_path, __pyx_k_invalid_path, sizeof(__pyx_k_invalid_path), 0, 0, 1, 0},
12447 {&__pyx_kp_s_invalid_predicate, __pyx_k_invalid_predicate, sizeof(__pyx_k_invalid_predicate), 0, 0, 1, 0},
12448 {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1},
12449 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
12450 {&__pyx_n_s_iterchildren, __pyx_k_iterchildren, sizeof(__pyx_k_iterchildren), 0, 0, 1, 1},
12451 {&__pyx_n_s_iterdescendants, __pyx_k_iterdescendants, sizeof(__pyx_k_iterdescendants), 0, 0, 1, 1},
12452 {&__pyx_n_s_iterfind, __pyx_k_iterfind, sizeof(__pyx_k_iterfind), 0, 0, 1, 1},
12453 {&__pyx_n_s_itertext, __pyx_k_itertext, sizeof(__pyx_k_itertext), 0, 0, 1, 1},
12454 {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
12455 {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
12456 {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
12457 {&__pyx_n_s_lxml__elementpath, __pyx_k_lxml__elementpath, sizeof(__pyx_k_lxml__elementpath), 0, 0, 1, 1},
12458 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
12459 {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
12460 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
12461 {&__pyx_n_s_namespaces, __pyx_k_namespaces, sizeof(__pyx_k_namespaces), 0, 0, 1, 1},
12462 {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
12463 {&__pyx_n_s_next_2, __pyx_k_next_2, sizeof(__pyx_k_next_2), 0, 0, 1, 1},
12464 {&__pyx_n_s_next_3, __pyx_k_next_3, sizeof(__pyx_k_next_3), 0, 0, 1, 1},
12465 {&__pyx_n_s_ops, __pyx_k_ops, sizeof(__pyx_k_ops), 0, 0, 1, 1},
12466 {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
12467 {&__pyx_n_s_parsing_attribute, __pyx_k_parsing_attribute, sizeof(__pyx_k_parsing_attribute), 0, 0, 1, 1},
12468 {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
12469 {&__pyx_kp_s_path_index_1_expected, __pyx_k_path_index_1_expected, sizeof(__pyx_k_path_index_1_expected), 0, 0, 1, 0},
12470 {&__pyx_n_s_pattern, __pyx_k_pattern, sizeof(__pyx_k_pattern), 0, 0, 1, 1},
12471 {&__pyx_n_s_predicate, __pyx_k_predicate, sizeof(__pyx_k_predicate), 0, 0, 1, 1},
12472 {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
12473 {&__pyx_kp_s_prefix_r_not_found_in_prefix_map, __pyx_k_prefix_r_not_found_in_prefix_map, sizeof(__pyx_k_prefix_r_not_found_in_prefix_map), 0, 0, 1, 0},
12474 {&__pyx_n_s_prepare_child, __pyx_k_prepare_child, sizeof(__pyx_k_prepare_child), 0, 0, 1, 1},
12475 {&__pyx_n_s_prepare_child_locals_select, __pyx_k_prepare_child_locals_select, sizeof(__pyx_k_prepare_child_locals_select), 0, 0, 1, 1},
12476 {&__pyx_n_s_prepare_descendant, __pyx_k_prepare_descendant, sizeof(__pyx_k_prepare_descendant), 0, 0, 1, 1},
12477 {&__pyx_n_s_prepare_descendant_locals_select, __pyx_k_prepare_descendant_locals_select, sizeof(__pyx_k_prepare_descendant_locals_select), 0, 0, 1, 1},
12478 {&__pyx_n_s_prepare_parent, __pyx_k_prepare_parent, sizeof(__pyx_k_prepare_parent), 0, 0, 1, 1},
12479 {&__pyx_n_s_prepare_parent_locals_select, __pyx_k_prepare_parent_locals_select, sizeof(__pyx_k_prepare_parent_locals_select), 0, 0, 1, 1},
12480 {&__pyx_n_s_prepare_predicate, __pyx_k_prepare_predicate, sizeof(__pyx_k_prepare_predicate), 0, 0, 1, 1},
12481 {&__pyx_n_s_prepare_predicate_locals_select, __pyx_k_prepare_predicate_locals_select, sizeof(__pyx_k_prepare_predicate_locals_select), 0, 0, 1, 1},
12482 {&__pyx_n_s_prepare_self, __pyx_k_prepare_self, sizeof(__pyx_k_prepare_self), 0, 0, 1, 1},
12483 {&__pyx_n_s_prepare_self_locals_select, __pyx_k_prepare_self_locals_select, sizeof(__pyx_k_prepare_self_locals_select), 0, 0, 1, 1},
12484 {&__pyx_n_s_prepare_star, __pyx_k_prepare_star, sizeof(__pyx_k_prepare_star), 0, 0, 1, 1},
12485 {&__pyx_n_s_prepare_star_locals_select, __pyx_k_prepare_star_locals_select, sizeof(__pyx_k_prepare_star_locals_select), 0, 0, 1, 1},
12486 {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
12487 {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
12488 {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
12489 {&__pyx_kp_s_s_s_2, __pyx_k_s_s_2, sizeof(__pyx_k_s_s_2), 0, 0, 1, 0},
12490 {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1},
12491 {&__pyx_n_s_selector, __pyx_k_selector, sizeof(__pyx_k_selector), 0, 0, 1, 1},
12492 {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
12493 {&__pyx_n_s_signature, __pyx_k_signature, sizeof(__pyx_k_signature), 0, 0, 1, 1},
12494 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
12495 {&__pyx_kp_s_src_lxml__elementpath_py, __pyx_k_src_lxml__elementpath_py, sizeof(__pyx_k_src_lxml__elementpath_py), 0, 0, 1, 0},
12496 {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1},
12497 {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
12498 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
12499 {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
12500 {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
12501 {&__pyx_n_s_token, __pyx_k_token, sizeof(__pyx_k_token), 0, 0, 1, 1},
12502 {&__pyx_n_s_ttype, __pyx_k_ttype, sizeof(__pyx_k_ttype), 0, 0, 1, 1},
12503 {&__pyx_kp_s_unsupported_expression, __pyx_k_unsupported_expression, sizeof(__pyx_k_unsupported_expression), 0, 0, 1, 0},
12504 {&__pyx_kp_s_unsupported_function, __pyx_k_unsupported_function, sizeof(__pyx_k_unsupported_function), 0, 0, 1, 0},
12505 {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
12506 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
12507 {&__pyx_n_s_xpath_tokenizer, __pyx_k_xpath_tokenizer, sizeof(__pyx_k_xpath_tokenizer), 0, 0, 1, 1},
12508 {&__pyx_n_s_xpath_tokenizer_re, __pyx_k_xpath_tokenizer_re, sizeof(__pyx_k_xpath_tokenizer_re), 0, 0, 1, 1},
12509 {0, 0, 0, 0, 0, 0, 0}
12511 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
12512 __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 85, __pyx_L1_error)
12513 __pyx_builtin_SyntaxError = __Pyx_GetBuiltinName(__pyx_n_s_SyntaxError); if (!__pyx_builtin_SyntaxError) __PYX_ERR(0, 88, __pyx_L1_error)
12514 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 220, __pyx_L1_error)
12515 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 234, __pyx_L1_error)
12516 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 285, __pyx_L1_error)
12517 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 290, __pyx_L1_error)
12523 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
12524 __Pyx_RefNannyDeclarations
12525 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
12527 /* "lxml/_elementpath.py":82
12528 * if tag and tag[0] != "{":
12530 * prefix, uri = tag.split(":", 1) # <<<<<<<<<<<<<<
12532 * if not namespaces:
12534 __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 82, __pyx_L1_error)
12535 __Pyx_GOTREF(__pyx_tuple__5);
12536 __Pyx_GIVEREF(__pyx_tuple__5);
12538 /* "lxml/_elementpath.py":101
12539 * def prepare_child(next, token):
12541 * def select(result): # <<<<<<<<<<<<<<
12542 * for elem in result:
12543 * for e in elem.iterchildren(tag):
12545 __pyx_tuple__7 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_e); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 101, __pyx_L1_error)
12546 __Pyx_GOTREF(__pyx_tuple__7);
12547 __Pyx_GIVEREF(__pyx_tuple__7);
12548 __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 101, __pyx_L1_error)
12550 /* "lxml/_elementpath.py":108
12552 * def prepare_star(next, token):
12553 * def select(result): # <<<<<<<<<<<<<<
12554 * for elem in result:
12555 * for e in elem.iterchildren('*'):
12557 __pyx_tuple__10 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_e); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 108, __pyx_L1_error)
12558 __Pyx_GOTREF(__pyx_tuple__10);
12559 __Pyx_GIVEREF(__pyx_tuple__10);
12560 __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 108, __pyx_L1_error)
12562 /* "lxml/_elementpath.py":115
12564 * def prepare_self(next, token):
12565 * def select(result): # <<<<<<<<<<<<<<
12569 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_result); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 115, __pyx_L1_error)
12570 __Pyx_GOTREF(__pyx_tuple__12);
12571 __Pyx_GIVEREF(__pyx_tuple__12);
12572 __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 115, __pyx_L1_error)
12574 /* "lxml/_elementpath.py":126
12577 * raise SyntaxError("invalid descendant") # <<<<<<<<<<<<<<
12578 * def select(result):
12579 * for elem in result:
12581 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_invalid_descendant); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 126, __pyx_L1_error)
12582 __Pyx_GOTREF(__pyx_tuple__14);
12583 __Pyx_GIVEREF(__pyx_tuple__14);
12585 /* "lxml/_elementpath.py":127
12587 * raise SyntaxError("invalid descendant")
12588 * def select(result): # <<<<<<<<<<<<<<
12589 * for elem in result:
12590 * for e in elem.iterdescendants(tag):
12592 __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_e); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 127, __pyx_L1_error)
12593 __Pyx_GOTREF(__pyx_tuple__15);
12594 __Pyx_GIVEREF(__pyx_tuple__15);
12595 __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 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_src_lxml__elementpath_py, __pyx_n_s_select, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 127, __pyx_L1_error)
12597 /* "lxml/_elementpath.py":134
12599 * def prepare_parent(next, token):
12600 * def select(result): # <<<<<<<<<<<<<<
12601 * for elem in result:
12602 * parent = elem.getparent()
12604 __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_parent); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 134, __pyx_L1_error)
12605 __Pyx_GOTREF(__pyx_tuple__17);
12606 __Pyx_GIVEREF(__pyx_tuple__17);
12607 __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 134, __pyx_L1_error)
12609 /* "lxml/_elementpath.py":151
12610 * if token[0] == "]":
12612 * if token == ('', ''): # <<<<<<<<<<<<<<
12613 * # ignore whitespace
12616 __pyx_tuple__20 = PyTuple_Pack(2, __pyx_kp_s__2, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 151, __pyx_L1_error)
12617 __Pyx_GOTREF(__pyx_tuple__20);
12618 __Pyx_GIVEREF(__pyx_tuple__20);
12620 /* "lxml/_elementpath.py":154
12621 * # ignore whitespace
12623 * if token[0] and token[0][:1] in "'\"": # <<<<<<<<<<<<<<
12624 * token = "'", token[0][1:-1]
12625 * signature += token[0] or "-"
12627 __pyx_slice__21 = PySlice_New(Py_None, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__21)) __PYX_ERR(0, 154, __pyx_L1_error)
12628 __Pyx_GOTREF(__pyx_slice__21);
12629 __Pyx_GIVEREF(__pyx_slice__21);
12631 /* "lxml/_elementpath.py":155
12633 * if token[0] and token[0][:1] in "'\"":
12634 * token = "'", token[0][1:-1] # <<<<<<<<<<<<<<
12635 * signature += token[0] or "-"
12636 * predicate.append(token[1])
12638 __pyx_slice__24 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(0, 155, __pyx_L1_error)
12639 __Pyx_GOTREF(__pyx_slice__24);
12640 __Pyx_GIVEREF(__pyx_slice__24);
12642 /* "lxml/_elementpath.py":163
12643 * # [@attribute] predicate
12644 * key = predicate[1]
12645 * def select(result): # <<<<<<<<<<<<<<
12646 * for elem in result:
12647 * if elem.get(key) is not None:
12649 __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_result, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 163, __pyx_L1_error)
12650 __Pyx_GOTREF(__pyx_tuple__27);
12651 __Pyx_GIVEREF(__pyx_tuple__27);
12652 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 163, __pyx_L1_error)
12654 /* "lxml/_elementpath.py":172
12655 * key = predicate[1]
12656 * value = predicate[-1]
12657 * def select(result): # <<<<<<<<<<<<<<
12658 * for elem in result:
12659 * if elem.get(key) == value:
12661 __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_result, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 172, __pyx_L1_error)
12662 __Pyx_GOTREF(__pyx_tuple__30);
12663 __Pyx_GIVEREF(__pyx_tuple__30);
12664 __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 172, __pyx_L1_error)
12666 /* "lxml/_elementpath.py":180
12668 * tag = predicate[0]
12669 * def select(result): # <<<<<<<<<<<<<<
12670 * for elem in result:
12671 * for _ in elem.iterchildren(tag):
12673 __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s__32); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 180, __pyx_L1_error)
12674 __Pyx_GOTREF(__pyx_tuple__33);
12675 __Pyx_GIVEREF(__pyx_tuple__33);
12676 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 180, __pyx_L1_error)
12678 /* "lxml/_elementpath.py":191
12679 * value = predicate[-1]
12681 * def select(result): # <<<<<<<<<<<<<<
12682 * for elem in result:
12683 * for e in elem.iterchildren(tag):
12685 __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_e); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 191, __pyx_L1_error)
12686 __Pyx_GOTREF(__pyx_tuple__37);
12687 __Pyx_GIVEREF(__pyx_tuple__37);
12688 __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 191, __pyx_L1_error)
12690 /* "lxml/_elementpath.py":198
12693 * def select(result): # <<<<<<<<<<<<<<
12694 * for elem in result:
12695 * if "".join(elem.itertext()) == value:
12697 __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_result, __pyx_n_s_elem); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 198, __pyx_L1_error)
12698 __Pyx_GOTREF(__pyx_tuple__39);
12699 __Pyx_GIVEREF(__pyx_tuple__39);
12700 __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 198, __pyx_L1_error)
12702 /* "lxml/_elementpath.py":210
12705 * raise SyntaxError( # <<<<<<<<<<<<<<
12706 * "indices in path predicates are 1-based, not 0-based")
12709 __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_indices_in_path_predicates_are_1); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 210, __pyx_L1_error)
12710 __Pyx_GOTREF(__pyx_tuple__43);
12711 __Pyx_GIVEREF(__pyx_tuple__43);
12713 /* "lxml/_elementpath.py":213
12714 * "indices in path predicates are 1-based, not 0-based")
12716 * raise SyntaxError("path index >= 1 expected") # <<<<<<<<<<<<<<
12718 * if predicate[0] != "last":
12720 __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_path_index_1_expected); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 213, __pyx_L1_error)
12721 __Pyx_GOTREF(__pyx_tuple__44);
12722 __Pyx_GIVEREF(__pyx_tuple__44);
12724 /* "lxml/_elementpath.py":216
12726 * if predicate[0] != "last":
12727 * raise SyntaxError("unsupported function") # <<<<<<<<<<<<<<
12728 * if signature == "-()-":
12731 __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_unsupported_function); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 216, __pyx_L1_error)
12732 __Pyx_GOTREF(__pyx_tuple__45);
12733 __Pyx_GIVEREF(__pyx_tuple__45);
12735 /* "lxml/_elementpath.py":221
12736 * index = int(predicate[2]) - 1
12737 * except ValueError:
12738 * raise SyntaxError("unsupported expression") # <<<<<<<<<<<<<<
12742 __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_unsupported_expression); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 221, __pyx_L1_error)
12743 __Pyx_GOTREF(__pyx_tuple__46);
12744 __Pyx_GIVEREF(__pyx_tuple__46);
12746 /* "lxml/_elementpath.py":224
12749 * def select(result): # <<<<<<<<<<<<<<
12750 * for elem in result:
12751 * parent = elem.getparent()
12753 __pyx_tuple__47 = PyTuple_Pack(4, __pyx_n_s_result, __pyx_n_s_elem, __pyx_n_s_parent, __pyx_n_s_elems); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 224, __pyx_L1_error)
12754 __Pyx_GOTREF(__pyx_tuple__47);
12755 __Pyx_GIVEREF(__pyx_tuple__47);
12756 __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_select, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 224, __pyx_L1_error)
12758 /* "lxml/_elementpath.py":237
12761 * raise SyntaxError("invalid predicate") # <<<<<<<<<<<<<<
12765 __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_invalid_predicate); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 237, __pyx_L1_error)
12766 __Pyx_GOTREF(__pyx_tuple__49);
12767 __Pyx_GIVEREF(__pyx_tuple__49);
12769 /* "lxml/_elementpath.py":256
12770 * def _build_path_iterator(path, namespaces):
12771 * """compile selector pattern"""
12772 * if path[-1:] == "/": # <<<<<<<<<<<<<<
12773 * path += "*" # implicit all (FIXME: keep this?)
12776 __pyx_slice__50 = PySlice_New(__pyx_int_neg_1, Py_None, Py_None); if (unlikely(!__pyx_slice__50)) __PYX_ERR(0, 256, __pyx_L1_error)
12777 __Pyx_GOTREF(__pyx_slice__50);
12778 __Pyx_GIVEREF(__pyx_slice__50);
12780 /* "lxml/_elementpath.py":281
12782 * if path[:1] == "/":
12783 * raise SyntaxError("cannot use absolute path on element") # <<<<<<<<<<<<<<
12784 * stream = iter(xpath_tokenizer(path, namespaces))
12787 __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_cannot_use_absolute_path_on_elem); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 281, __pyx_L1_error)
12788 __Pyx_GOTREF(__pyx_tuple__52);
12789 __Pyx_GIVEREF(__pyx_tuple__52);
12791 /* "lxml/_elementpath.py":291
12793 * except StopIteration:
12794 * raise SyntaxError("empty path expression") # <<<<<<<<<<<<<<
12798 __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_empty_path_expression); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 291, __pyx_L1_error)
12799 __Pyx_GOTREF(__pyx_tuple__53);
12800 __Pyx_GIVEREF(__pyx_tuple__53);
12802 /* "lxml/_elementpath.py":297
12803 * selector.append(ops[token[0]](_next, token))
12804 * except StopIteration:
12805 * raise SyntaxError("invalid path") # <<<<<<<<<<<<<<
12809 __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_invalid_path); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 297, __pyx_L1_error)
12810 __Pyx_GOTREF(__pyx_tuple__54);
12811 __Pyx_GIVEREF(__pyx_tuple__54);
12813 /* "lxml/_elementpath.py":62
12816 * xpath_tokenizer_re = re.compile( # <<<<<<<<<<<<<<
12818 * "'[^']*'|\"[^\"]*\"|"
12820 __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_s_s_2); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 62, __pyx_L1_error)
12821 __Pyx_GOTREF(__pyx_tuple__55);
12822 __Pyx_GIVEREF(__pyx_tuple__55);
12824 /* "lxml/_elementpath.py":74
12827 * def xpath_tokenizer(pattern, namespaces=None): # <<<<<<<<<<<<<<
12828 * # ElementTree uses '', lxml used None originally.
12829 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
12831 __pyx_tuple__56 = PyTuple_Pack(9, __pyx_n_s_pattern, __pyx_n_s_namespaces, __pyx_n_s_default_namespace, __pyx_n_s_parsing_attribute, __pyx_n_s_token, __pyx_n_s_ttype, __pyx_n_s_tag, __pyx_n_s_prefix, __pyx_n_s_uri); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 74, __pyx_L1_error)
12832 __Pyx_GOTREF(__pyx_tuple__56);
12833 __Pyx_GIVEREF(__pyx_tuple__56);
12834 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_xpath_tokenizer, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 74, __pyx_L1_error)
12835 __pyx_tuple__57 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 74, __pyx_L1_error)
12836 __Pyx_GOTREF(__pyx_tuple__57);
12837 __Pyx_GIVEREF(__pyx_tuple__57);
12839 /* "lxml/_elementpath.py":99
12842 * def prepare_child(next, token): # <<<<<<<<<<<<<<
12844 * def select(result):
12846 __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_tag, __pyx_n_s_select, __pyx_n_s_select); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 99, __pyx_L1_error)
12847 __Pyx_GOTREF(__pyx_tuple__58);
12848 __Pyx_GIVEREF(__pyx_tuple__58);
12849 __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_child, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 99, __pyx_L1_error)
12851 /* "lxml/_elementpath.py":107
12854 * def prepare_star(next, token): # <<<<<<<<<<<<<<
12855 * def select(result):
12856 * for elem in result:
12858 __pyx_tuple__60 = PyTuple_Pack(4, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_select, __pyx_n_s_select); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 107, __pyx_L1_error)
12859 __Pyx_GOTREF(__pyx_tuple__60);
12860 __Pyx_GIVEREF(__pyx_tuple__60);
12861 __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_star, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 107, __pyx_L1_error)
12863 /* "lxml/_elementpath.py":114
12866 * def prepare_self(next, token): # <<<<<<<<<<<<<<
12867 * def select(result):
12870 __pyx_tuple__62 = PyTuple_Pack(4, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_select, __pyx_n_s_select); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 114, __pyx_L1_error)
12871 __Pyx_GOTREF(__pyx_tuple__62);
12872 __Pyx_GIVEREF(__pyx_tuple__62);
12873 __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_self, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 114, __pyx_L1_error)
12875 /* "lxml/_elementpath.py":119
12878 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
12880 * if token[0] == "*":
12882 __pyx_tuple__64 = PyTuple_Pack(5, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_tag, __pyx_n_s_select, __pyx_n_s_select); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 119, __pyx_L1_error)
12883 __Pyx_GOTREF(__pyx_tuple__64);
12884 __Pyx_GIVEREF(__pyx_tuple__64);
12885 __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_descendant, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 119, __pyx_L1_error)
12887 /* "lxml/_elementpath.py":133
12890 * def prepare_parent(next, token): # <<<<<<<<<<<<<<
12891 * def select(result):
12892 * for elem in result:
12894 __pyx_tuple__66 = PyTuple_Pack(4, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_select, __pyx_n_s_select); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 133, __pyx_L1_error)
12895 __Pyx_GOTREF(__pyx_tuple__66);
12896 __Pyx_GIVEREF(__pyx_tuple__66);
12897 __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_parent, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 133, __pyx_L1_error)
12899 /* "lxml/_elementpath.py":141
12902 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
12903 * # FIXME: replace with real parser!!! refs:
12904 * # http://effbot.org/zone/simple-iterator-parser.htm
12906 __pyx_tuple__68 = PyTuple_Pack(15, __pyx_n_s_next, __pyx_n_s_token, __pyx_n_s_signature, __pyx_n_s_predicate, __pyx_n_s_key, __pyx_n_s_select, __pyx_n_s_select, __pyx_n_s_value, __pyx_n_s_select, __pyx_n_s_tag, __pyx_n_s_select, __pyx_n_s_select, __pyx_n_s_select, __pyx_n_s_index, __pyx_n_s_select); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 141, __pyx_L1_error)
12907 __Pyx_GOTREF(__pyx_tuple__68);
12908 __Pyx_GIVEREF(__pyx_tuple__68);
12909 __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_prepare_predicate, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 141, __pyx_L1_error)
12911 /* "lxml/_elementpath.py":254
12914 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
12915 * """compile selector pattern"""
12916 * if path[-1:] == "/":
12918 __pyx_tuple__74 = PyTuple_Pack(9, __pyx_n_s_path, __pyx_n_s_namespaces, __pyx_n_s_cache_key, __pyx_n_s_stream, __pyx_n_s_next_3, __pyx_n_s_token, __pyx_n_s_selector, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 254, __pyx_L1_error)
12919 __Pyx_GOTREF(__pyx_tuple__74);
12920 __Pyx_GIVEREF(__pyx_tuple__74);
12921 __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_build_path_iterator, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 254, __pyx_L1_error)
12923 /* "lxml/_elementpath.py":311
12924 * # Iterate over the matching nodes
12926 * def iterfind(elem, path, namespaces=None): # <<<<<<<<<<<<<<
12927 * selector = _build_path_iterator(path, namespaces)
12928 * result = iter((elem,))
12930 __pyx_tuple__76 = PyTuple_Pack(6, __pyx_n_s_elem, __pyx_n_s_path, __pyx_n_s_namespaces, __pyx_n_s_selector, __pyx_n_s_result, __pyx_n_s_select); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 311, __pyx_L1_error)
12931 __Pyx_GOTREF(__pyx_tuple__76);
12932 __Pyx_GIVEREF(__pyx_tuple__76);
12933 __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_iterfind, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 311, __pyx_L1_error)
12934 __pyx_tuple__78 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 311, __pyx_L1_error)
12935 __Pyx_GOTREF(__pyx_tuple__78);
12936 __Pyx_GIVEREF(__pyx_tuple__78);
12938 /* "lxml/_elementpath.py":322
12939 * # Find first matching object.
12941 * def find(elem, path, namespaces=None): # <<<<<<<<<<<<<<
12942 * it = iterfind(elem, path, namespaces)
12945 __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_elem, __pyx_n_s_path, __pyx_n_s_namespaces, __pyx_n_s_it); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 322, __pyx_L1_error)
12946 __Pyx_GOTREF(__pyx_tuple__79);
12947 __Pyx_GIVEREF(__pyx_tuple__79);
12948 __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_find, 322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 322, __pyx_L1_error)
12949 __pyx_tuple__81 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 322, __pyx_L1_error)
12950 __Pyx_GOTREF(__pyx_tuple__81);
12951 __Pyx_GIVEREF(__pyx_tuple__81);
12953 /* "lxml/_elementpath.py":333
12954 * # Find all matching objects.
12956 * def findall(elem, path, namespaces=None): # <<<<<<<<<<<<<<
12957 * return list(iterfind(elem, path, namespaces))
12960 __pyx_tuple__82 = PyTuple_Pack(3, __pyx_n_s_elem, __pyx_n_s_path, __pyx_n_s_namespaces); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 333, __pyx_L1_error)
12961 __Pyx_GOTREF(__pyx_tuple__82);
12962 __Pyx_GIVEREF(__pyx_tuple__82);
12963 __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_findall, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 333, __pyx_L1_error)
12964 __pyx_tuple__84 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 333, __pyx_L1_error)
12965 __Pyx_GOTREF(__pyx_tuple__84);
12966 __Pyx_GIVEREF(__pyx_tuple__84);
12968 /* "lxml/_elementpath.py":340
12969 * # Find text for first matching object.
12971 * def findtext(elem, path, default=None, namespaces=None): # <<<<<<<<<<<<<<
12972 * el = find(elem, path, namespaces)
12975 __pyx_tuple__85 = PyTuple_Pack(5, __pyx_n_s_elem, __pyx_n_s_path, __pyx_n_s_default, __pyx_n_s_namespaces, __pyx_n_s_el); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 340, __pyx_L1_error)
12976 __Pyx_GOTREF(__pyx_tuple__85);
12977 __Pyx_GIVEREF(__pyx_tuple__85);
12978 __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml__elementpath_py, __pyx_n_s_findtext, 340, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 340, __pyx_L1_error)
12979 __pyx_tuple__87 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 340, __pyx_L1_error)
12980 __Pyx_GOTREF(__pyx_tuple__87);
12981 __Pyx_GIVEREF(__pyx_tuple__87);
12982 __Pyx_RefNannyFinishContext();
12985 __Pyx_RefNannyFinishContext();
12989 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
12990 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
12991 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
12992 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12993 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
12999 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
13000 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
13001 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
13002 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
13003 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
13004 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
13005 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
13007 static int __Pyx_modinit_global_init_code(void) {
13008 __Pyx_RefNannyDeclarations
13009 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
13010 /*--- Global init code ---*/
13011 __Pyx_RefNannyFinishContext();
13015 static int __Pyx_modinit_variable_export_code(void) {
13016 __Pyx_RefNannyDeclarations
13017 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
13018 /*--- Variable export code ---*/
13019 __Pyx_RefNannyFinishContext();
13023 static int __Pyx_modinit_function_export_code(void) {
13024 __Pyx_RefNannyDeclarations
13025 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
13026 /*--- Function export code ---*/
13027 __Pyx_RefNannyFinishContext();
13031 static int __Pyx_modinit_type_init_code(void) {
13032 __Pyx_RefNannyDeclarations
13033 int __pyx_lineno = 0;
13034 const char *__pyx_filename = NULL;
13035 int __pyx_clineno = 0;
13036 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
13037 /*--- Type init code ---*/
13038 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
13039 #if PY_VERSION_HEX < 0x030800B1
13040 __pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer.tp_print = 0;
13042 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer.tp_getattro == PyObject_GenericGetAttr)) {
13043 __pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13045 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer;
13046 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
13047 #if PY_VERSION_HEX < 0x030800B1
13048 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child.tp_print = 0;
13050 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child.tp_getattro == PyObject_GenericGetAttr)) {
13051 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13053 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child;
13054 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
13055 #if PY_VERSION_HEX < 0x030800B1
13056 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select.tp_print = 0;
13058 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select.tp_getattro == PyObject_GenericGetAttr)) {
13059 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13061 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_2_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_2_select;
13062 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
13063 #if PY_VERSION_HEX < 0x030800B1
13064 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select.tp_print = 0;
13066 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select.tp_getattro == PyObject_GenericGetAttr)) {
13067 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13069 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_3_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_3_select;
13070 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
13071 #if PY_VERSION_HEX < 0x030800B1
13072 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant.tp_print = 0;
13074 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant.tp_getattro == PyObject_GenericGetAttr)) {
13075 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13077 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant;
13078 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
13079 #if PY_VERSION_HEX < 0x030800B1
13080 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select.tp_print = 0;
13082 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select.tp_getattro == PyObject_GenericGetAttr)) {
13083 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13085 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_5_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_5_select;
13086 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
13087 #if PY_VERSION_HEX < 0x030800B1
13088 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select.tp_print = 0;
13090 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select.tp_getattro == PyObject_GenericGetAttr)) {
13091 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13093 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_6_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_6_select;
13094 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
13095 #if PY_VERSION_HEX < 0x030800B1
13096 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate.tp_print = 0;
13098 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate.tp_getattro == PyObject_GenericGetAttr)) {
13099 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13101 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate;
13102 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
13103 #if PY_VERSION_HEX < 0x030800B1
13104 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select.tp_print = 0;
13106 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select.tp_getattro == PyObject_GenericGetAttr)) {
13107 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13109 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_8_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_8_select;
13110 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
13111 #if PY_VERSION_HEX < 0x030800B1
13112 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select.tp_print = 0;
13114 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select.tp_getattro == PyObject_GenericGetAttr)) {
13115 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13117 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_9_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_9_select;
13118 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
13119 #if PY_VERSION_HEX < 0x030800B1
13120 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select.tp_print = 0;
13122 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select.tp_getattro == PyObject_GenericGetAttr)) {
13123 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13125 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_10_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_10_select;
13126 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select) < 0) __PYX_ERR(0, 191, __pyx_L1_error)
13127 #if PY_VERSION_HEX < 0x030800B1
13128 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select.tp_print = 0;
13130 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select.tp_getattro == PyObject_GenericGetAttr)) {
13131 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13133 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_11_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_11_select;
13134 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
13135 #if PY_VERSION_HEX < 0x030800B1
13136 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select.tp_print = 0;
13138 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select.tp_getattro == PyObject_GenericGetAttr)) {
13139 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13141 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_12_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_12_select;
13142 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
13143 #if PY_VERSION_HEX < 0x030800B1
13144 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select.tp_print = 0;
13146 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select.tp_getattro == PyObject_GenericGetAttr)) {
13147 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13149 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_13_select = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_13_select;
13150 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
13151 #if PY_VERSION_HEX < 0x030800B1
13152 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator.tp_print = 0;
13154 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator.tp_getattro == PyObject_GenericGetAttr)) {
13155 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13157 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator;
13158 if (PyType_Ready(&__pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
13159 #if PY_VERSION_HEX < 0x030800B1
13160 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr.tp_print = 0;
13162 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr.tp_dictoffset && __pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
13163 __pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
13165 __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_15_genexpr = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr;
13166 __Pyx_RefNannyFinishContext();
13169 __Pyx_RefNannyFinishContext();
13173 static int __Pyx_modinit_type_import_code(void) {
13174 __Pyx_RefNannyDeclarations
13175 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
13176 /*--- Type import code ---*/
13177 __Pyx_RefNannyFinishContext();
13181 static int __Pyx_modinit_variable_import_code(void) {
13182 __Pyx_RefNannyDeclarations
13183 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
13184 /*--- Variable import code ---*/
13185 __Pyx_RefNannyFinishContext();
13189 static int __Pyx_modinit_function_import_code(void) {
13190 __Pyx_RefNannyDeclarations
13191 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
13192 /*--- Function import code ---*/
13193 __Pyx_RefNannyFinishContext();
13198 #ifndef CYTHON_NO_PYINIT_EXPORT
13199 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
13200 #elif PY_MAJOR_VERSION < 3
13202 #define __Pyx_PyMODINIT_FUNC extern "C" void
13204 #define __Pyx_PyMODINIT_FUNC void
13208 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
13210 #define __Pyx_PyMODINIT_FUNC PyObject *
13215 #if PY_MAJOR_VERSION < 3
13216 __Pyx_PyMODINIT_FUNC init_elementpath(void) CYTHON_SMALL_CODE; /*proto*/
13217 __Pyx_PyMODINIT_FUNC init_elementpath(void)
13219 __Pyx_PyMODINIT_FUNC PyInit__elementpath(void) CYTHON_SMALL_CODE; /*proto*/
13220 __Pyx_PyMODINIT_FUNC PyInit__elementpath(void)
13221 #if CYTHON_PEP489_MULTI_PHASE_INIT
13223 return PyModuleDef_Init(&__pyx_moduledef);
13225 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
13226 #if PY_VERSION_HEX >= 0x030700A1
13227 static PY_INT64_T main_interpreter_id = -1;
13228 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
13229 if (main_interpreter_id == -1) {
13230 main_interpreter_id = current_id;
13231 return (unlikely(current_id == -1)) ? -1 : 0;
13232 } else if (unlikely(main_interpreter_id != current_id))
13234 static PyInterpreterState *main_interpreter = NULL;
13235 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
13236 if (!main_interpreter) {
13237 main_interpreter = current_interpreter;
13238 } else if (unlikely(main_interpreter != current_interpreter))
13243 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
13248 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) {
13249 PyObject *value = PyObject_GetAttrString(spec, from_name);
13251 if (likely(value)) {
13252 if (allow_none || value != Py_None) {
13253 result = PyDict_SetItemString(moddict, to_name, value);
13256 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
13263 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
13264 PyObject *module = NULL, *moddict, *modname;
13265 if (__Pyx_check_single_interpreter())
13268 return __Pyx_NewRef(__pyx_m);
13269 modname = PyObject_GetAttrString(spec, "name");
13270 if (unlikely(!modname)) goto bad;
13271 module = PyModule_NewObject(modname);
13272 Py_DECREF(modname);
13273 if (unlikely(!module)) goto bad;
13274 moddict = PyModule_GetDict(module);
13275 if (unlikely(!moddict)) goto bad;
13276 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
13277 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
13278 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
13279 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
13282 Py_XDECREF(module);
13287 static CYTHON_SMALL_CODE int __pyx_pymod_exec__elementpath(PyObject *__pyx_pyinit_module)
13291 PyObject *__pyx_t_1 = NULL;
13292 PyObject *__pyx_t_2 = NULL;
13293 int __pyx_lineno = 0;
13294 const char *__pyx_filename = NULL;
13295 int __pyx_clineno = 0;
13296 __Pyx_RefNannyDeclarations
13297 #if CYTHON_PEP489_MULTI_PHASE_INIT
13299 if (__pyx_m == __pyx_pyinit_module) return 0;
13300 PyErr_SetString(PyExc_RuntimeError, "Module '_elementpath' has already been imported. Re-initialisation is not supported.");
13303 #elif PY_MAJOR_VERSION >= 3
13304 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
13306 #if CYTHON_REFNANNY
13307 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
13308 if (!__Pyx_RefNanny) {
13310 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
13311 if (!__Pyx_RefNanny)
13312 Py_FatalError("failed to import 'refnanny' module");
13315 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__elementpath(void)", 0);
13316 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13317 #ifdef __Pxy_PyFrame_Initialize_Offsets
13318 __Pxy_PyFrame_Initialize_Offsets();
13320 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
13321 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
13322 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
13323 #ifdef __Pyx_CyFunction_USED
13324 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13326 #ifdef __Pyx_FusedFunction_USED
13327 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13329 #ifdef __Pyx_Coroutine_USED
13330 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13332 #ifdef __Pyx_Generator_USED
13333 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13335 #ifdef __Pyx_AsyncGen_USED
13336 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13338 #ifdef __Pyx_StopAsyncIteration_USED
13339 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13341 /*--- Library function declarations ---*/
13342 /*--- Threads initialization code ---*/
13343 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
13344 #ifdef WITH_THREAD /* Python build with threading support? */
13345 PyEval_InitThreads();
13348 /*--- Module creation code ---*/
13349 #if CYTHON_PEP489_MULTI_PHASE_INIT
13350 __pyx_m = __pyx_pyinit_module;
13351 Py_INCREF(__pyx_m);
13353 #if PY_MAJOR_VERSION < 3
13354 __pyx_m = Py_InitModule4("_elementpath", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
13356 __pyx_m = PyModule_Create(&__pyx_moduledef);
13358 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
13360 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
13361 Py_INCREF(__pyx_d);
13362 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
13363 Py_INCREF(__pyx_b);
13364 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
13365 Py_INCREF(__pyx_cython_runtime);
13366 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
13367 /*--- Initialize various global constants etc. ---*/
13368 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13369 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
13370 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13372 if (__pyx_module_is_main_lxml___elementpath) {
13373 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13375 #if PY_MAJOR_VERSION >= 3
13377 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
13378 if (!PyDict_GetItemString(modules, "lxml._elementpath")) {
13379 if (unlikely(PyDict_SetItemString(modules, "lxml._elementpath", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
13383 /*--- Builtin init code ---*/
13384 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13385 /*--- Constants init code ---*/
13386 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13387 /*--- Global type/function init code ---*/
13388 (void)__Pyx_modinit_global_init_code();
13389 (void)__Pyx_modinit_variable_export_code();
13390 (void)__Pyx_modinit_function_export_code();
13391 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
13392 (void)__Pyx_modinit_type_import_code();
13393 (void)__Pyx_modinit_variable_import_code();
13394 (void)__Pyx_modinit_function_import_code();
13395 /*--- Execution code ---*/
13396 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
13397 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13400 /* "lxml/_elementpath.py":60
13401 * from __future__ import absolute_import
13403 * import re # <<<<<<<<<<<<<<
13405 * xpath_tokenizer_re = re.compile(
13407 __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
13408 __Pyx_GOTREF(__pyx_t_1);
13409 if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 60, __pyx_L1_error)
13410 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13412 /* "lxml/_elementpath.py":62
13415 * xpath_tokenizer_re = re.compile( # <<<<<<<<<<<<<<
13417 * "'[^']*'|\"[^\"]*\"|"
13419 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
13420 __Pyx_GOTREF(__pyx_t_1);
13421 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
13422 __Pyx_GOTREF(__pyx_t_2);
13423 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13424 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
13425 __Pyx_GOTREF(__pyx_t_1);
13426 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13427 if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpath_tokenizer_re, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
13428 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13430 /* "lxml/_elementpath.py":74
13433 * def xpath_tokenizer(pattern, namespaces=None): # <<<<<<<<<<<<<<
13434 * # ElementTree uses '', lxml used None originally.
13435 * default_namespace = (namespaces.get(None) or namespaces.get('')) if namespaces else None
13437 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_1xpath_tokenizer, 0, __pyx_n_s_xpath_tokenizer, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
13438 __Pyx_GOTREF(__pyx_t_1);
13439 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__57);
13440 if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpath_tokenizer, __pyx_t_1) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
13441 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13443 /* "lxml/_elementpath.py":99
13446 * def prepare_child(next, token): # <<<<<<<<<<<<<<
13448 * def select(result):
13450 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_4prepare_child, 0, __pyx_n_s_prepare_child, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
13451 __Pyx_GOTREF(__pyx_t_1);
13452 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_child, __pyx_t_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
13453 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13455 /* "lxml/_elementpath.py":107
13458 * def prepare_star(next, token): # <<<<<<<<<<<<<<
13459 * def select(result):
13460 * for elem in result:
13462 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_6prepare_star, 0, __pyx_n_s_prepare_star, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
13463 __Pyx_GOTREF(__pyx_t_1);
13464 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_star, __pyx_t_1) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
13465 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13467 /* "lxml/_elementpath.py":114
13470 * def prepare_self(next, token): # <<<<<<<<<<<<<<
13471 * def select(result):
13474 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_8prepare_self, 0, __pyx_n_s_prepare_self, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
13475 __Pyx_GOTREF(__pyx_t_1);
13476 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_self, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
13477 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13479 /* "lxml/_elementpath.py":119
13482 * def prepare_descendant(next, token): # <<<<<<<<<<<<<<
13484 * if token[0] == "*":
13486 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_10prepare_descendant, 0, __pyx_n_s_prepare_descendant, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
13487 __Pyx_GOTREF(__pyx_t_1);
13488 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_descendant, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
13489 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13491 /* "lxml/_elementpath.py":133
13494 * def prepare_parent(next, token): # <<<<<<<<<<<<<<
13495 * def select(result):
13496 * for elem in result:
13498 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_12prepare_parent, 0, __pyx_n_s_prepare_parent, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
13499 __Pyx_GOTREF(__pyx_t_1);
13500 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_parent, __pyx_t_1) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
13501 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13503 /* "lxml/_elementpath.py":141
13506 * def prepare_predicate(next, token): # <<<<<<<<<<<<<<
13507 * # FIXME: replace with real parser!!! refs:
13508 * # http://effbot.org/zone/simple-iterator-parser.htm
13510 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_14prepare_predicate, 0, __pyx_n_s_prepare_predicate, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
13511 __Pyx_GOTREF(__pyx_t_1);
13512 if (PyDict_SetItem(__pyx_d, __pyx_n_s_prepare_predicate, __pyx_t_1) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
13513 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13515 /* "lxml/_elementpath.py":240
13518 * "": prepare_child, # <<<<<<<<<<<<<<
13519 * "*": prepare_star,
13520 * ".": prepare_self,
13522 __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
13523 __Pyx_GOTREF(__pyx_t_1);
13524 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_child); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
13525 __Pyx_GOTREF(__pyx_t_2);
13526 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__2, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13527 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13529 /* "lxml/_elementpath.py":241
13531 * "": prepare_child,
13532 * "*": prepare_star, # <<<<<<<<<<<<<<
13533 * ".": prepare_self,
13534 * "..": prepare_parent,
13536 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_star); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
13537 __Pyx_GOTREF(__pyx_t_2);
13538 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__9, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13539 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13541 /* "lxml/_elementpath.py":242
13542 * "": prepare_child,
13543 * "*": prepare_star,
13544 * ".": prepare_self, # <<<<<<<<<<<<<<
13545 * "..": prepare_parent,
13546 * "//": prepare_descendant,
13548 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
13549 __Pyx_GOTREF(__pyx_t_2);
13550 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__70, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13551 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13553 /* "lxml/_elementpath.py":243
13554 * "*": prepare_star,
13555 * ".": prepare_self,
13556 * "..": prepare_parent, # <<<<<<<<<<<<<<
13557 * "//": prepare_descendant,
13558 * "[": prepare_predicate,
13560 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_parent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
13561 __Pyx_GOTREF(__pyx_t_2);
13562 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__71, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13563 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13565 /* "lxml/_elementpath.py":244
13566 * ".": prepare_self,
13567 * "..": prepare_parent,
13568 * "//": prepare_descendant, # <<<<<<<<<<<<<<
13569 * "[": prepare_predicate,
13572 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_descendant); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
13573 __Pyx_GOTREF(__pyx_t_2);
13574 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__72, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13575 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13577 /* "lxml/_elementpath.py":245
13578 * "..": prepare_parent,
13579 * "//": prepare_descendant,
13580 * "[": prepare_predicate, # <<<<<<<<<<<<<<
13584 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prepare_predicate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
13585 __Pyx_GOTREF(__pyx_t_2);
13586 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s__73, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
13587 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13588 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ops, __pyx_t_1) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
13589 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13591 /* "lxml/_elementpath.py":251
13592 * # --------------------------------------------------------------------
13594 * _cache = {} # <<<<<<<<<<<<<<
13598 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
13599 __Pyx_GOTREF(__pyx_t_1);
13600 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cache, __pyx_t_1) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
13601 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13603 /* "lxml/_elementpath.py":254
13606 * def _build_path_iterator(path, namespaces): # <<<<<<<<<<<<<<
13607 * """compile selector pattern"""
13608 * if path[-1:] == "/":
13610 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_16_build_path_iterator, 0, __pyx_n_s_build_path_iterator, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
13611 __Pyx_GOTREF(__pyx_t_1);
13612 if (PyDict_SetItem(__pyx_d, __pyx_n_s_build_path_iterator, __pyx_t_1) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
13613 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13615 /* "lxml/_elementpath.py":311
13616 * # Iterate over the matching nodes
13618 * def iterfind(elem, path, namespaces=None): # <<<<<<<<<<<<<<
13619 * selector = _build_path_iterator(path, namespaces)
13620 * result = iter((elem,))
13622 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_18iterfind, 0, __pyx_n_s_iterfind, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
13623 __Pyx_GOTREF(__pyx_t_1);
13624 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__78);
13625 if (PyDict_SetItem(__pyx_d, __pyx_n_s_iterfind, __pyx_t_1) < 0) __PYX_ERR(0, 311, __pyx_L1_error)
13626 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13628 /* "lxml/_elementpath.py":322
13629 * # Find first matching object.
13631 * def find(elem, path, namespaces=None): # <<<<<<<<<<<<<<
13632 * it = iterfind(elem, path, namespaces)
13635 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_20find, 0, __pyx_n_s_find, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
13636 __Pyx_GOTREF(__pyx_t_1);
13637 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__81);
13638 if (PyDict_SetItem(__pyx_d, __pyx_n_s_find, __pyx_t_1) < 0) __PYX_ERR(0, 322, __pyx_L1_error)
13639 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13641 /* "lxml/_elementpath.py":333
13642 * # Find all matching objects.
13644 * def findall(elem, path, namespaces=None): # <<<<<<<<<<<<<<
13645 * return list(iterfind(elem, path, namespaces))
13648 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_22findall, 0, __pyx_n_s_findall, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
13649 __Pyx_GOTREF(__pyx_t_1);
13650 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__84);
13651 if (PyDict_SetItem(__pyx_d, __pyx_n_s_findall, __pyx_t_1) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
13652 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13654 /* "lxml/_elementpath.py":340
13655 * # Find text for first matching object.
13657 * def findtext(elem, path, default=None, namespaces=None): # <<<<<<<<<<<<<<
13658 * el = find(elem, path, namespaces)
13661 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_12_elementpath_24findtext, 0, __pyx_n_s_findtext, NULL, __pyx_n_s_lxml__elementpath, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
13662 __Pyx_GOTREF(__pyx_t_1);
13663 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__87);
13664 if (PyDict_SetItem(__pyx_d, __pyx_n_s_findtext, __pyx_t_1) < 0) __PYX_ERR(0, 340, __pyx_L1_error)
13665 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13667 /* "lxml/_elementpath.py":1
13668 * # cython: language_level=2 # <<<<<<<<<<<<<<
13672 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
13673 __Pyx_GOTREF(__pyx_t_1);
13674 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13675 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13677 /*--- Wrapped vars code ---*/
13679 if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
13682 __Pyx_XDECREF(__pyx_t_1);
13683 __Pyx_XDECREF(__pyx_t_2);
13686 __Pyx_AddTraceback("init lxml._elementpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
13689 } else if (!PyErr_Occurred()) {
13690 PyErr_SetString(PyExc_ImportError, "init lxml._elementpath");
13693 __Pyx_RefNannyFinishContext();
13694 #if CYTHON_PEP489_MULTI_PHASE_INIT
13695 return (__pyx_m != NULL) ? 0 : -1;
13696 #elif PY_MAJOR_VERSION >= 3
13703 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
13704 Py_CLEAR(__pyx_codeobj_);
13705 Py_CLEAR(__pyx_tuple__5);
13706 Py_CLEAR(__pyx_tuple__7);
13707 Py_CLEAR(__pyx_codeobj__8);
13708 Py_CLEAR(__pyx_tuple__10);
13709 Py_CLEAR(__pyx_codeobj__11);
13710 Py_CLEAR(__pyx_tuple__12);
13711 Py_CLEAR(__pyx_codeobj__13);
13712 Py_CLEAR(__pyx_tuple__14);
13713 Py_CLEAR(__pyx_tuple__15);
13714 Py_CLEAR(__pyx_codeobj__16);
13715 Py_CLEAR(__pyx_tuple__17);
13716 Py_CLEAR(__pyx_codeobj__18);
13717 Py_CLEAR(__pyx_tuple__20);
13718 Py_CLEAR(__pyx_slice__21);
13719 Py_CLEAR(__pyx_slice__24);
13720 Py_CLEAR(__pyx_tuple__27);
13721 Py_CLEAR(__pyx_codeobj__28);
13722 Py_CLEAR(__pyx_tuple__30);
13723 Py_CLEAR(__pyx_codeobj__31);
13724 Py_CLEAR(__pyx_tuple__33);
13725 Py_CLEAR(__pyx_codeobj__34);
13726 Py_CLEAR(__pyx_tuple__37);
13727 Py_CLEAR(__pyx_codeobj__38);
13728 Py_CLEAR(__pyx_tuple__39);
13729 Py_CLEAR(__pyx_codeobj__40);
13730 Py_CLEAR(__pyx_tuple__43);
13731 Py_CLEAR(__pyx_tuple__44);
13732 Py_CLEAR(__pyx_tuple__45);
13733 Py_CLEAR(__pyx_tuple__46);
13734 Py_CLEAR(__pyx_tuple__47);
13735 Py_CLEAR(__pyx_codeobj__48);
13736 Py_CLEAR(__pyx_tuple__49);
13737 Py_CLEAR(__pyx_slice__50);
13738 Py_CLEAR(__pyx_tuple__52);
13739 Py_CLEAR(__pyx_tuple__53);
13740 Py_CLEAR(__pyx_tuple__54);
13741 Py_CLEAR(__pyx_tuple__55);
13742 Py_CLEAR(__pyx_tuple__56);
13743 Py_CLEAR(__pyx_tuple__57);
13744 Py_CLEAR(__pyx_tuple__58);
13745 Py_CLEAR(__pyx_codeobj__59);
13746 Py_CLEAR(__pyx_tuple__60);
13747 Py_CLEAR(__pyx_codeobj__61);
13748 Py_CLEAR(__pyx_tuple__62);
13749 Py_CLEAR(__pyx_codeobj__63);
13750 Py_CLEAR(__pyx_tuple__64);
13751 Py_CLEAR(__pyx_codeobj__65);
13752 Py_CLEAR(__pyx_tuple__66);
13753 Py_CLEAR(__pyx_codeobj__67);
13754 Py_CLEAR(__pyx_tuple__68);
13755 Py_CLEAR(__pyx_codeobj__69);
13756 Py_CLEAR(__pyx_tuple__74);
13757 Py_CLEAR(__pyx_codeobj__75);
13758 Py_CLEAR(__pyx_tuple__76);
13759 Py_CLEAR(__pyx_codeobj__77);
13760 Py_CLEAR(__pyx_tuple__78);
13761 Py_CLEAR(__pyx_tuple__79);
13762 Py_CLEAR(__pyx_codeobj__80);
13763 Py_CLEAR(__pyx_tuple__81);
13764 Py_CLEAR(__pyx_tuple__82);
13765 Py_CLEAR(__pyx_codeobj__83);
13766 Py_CLEAR(__pyx_tuple__84);
13767 Py_CLEAR(__pyx_tuple__85);
13768 Py_CLEAR(__pyx_codeobj__86);
13769 Py_CLEAR(__pyx_tuple__87);
13770 /* CodeObjectCache.cleanup */
13771 if (__pyx_code_cache.entries) {
13772 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13773 int i, count = __pyx_code_cache.count;
13774 __pyx_code_cache.count = 0;
13775 __pyx_code_cache.max_count = 0;
13776 __pyx_code_cache.entries = NULL;
13777 for (i=0; i<count; i++) {
13778 Py_DECREF(entries[i].code_object);
13780 PyMem_Free(entries);
13784 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
13785 /*--- Global cleanup code ---*/
13786 __Pyx_CleanupGlobals();
13787 /*--- Type import cleanup code ---*/
13788 /*--- Builtin cleanup code ---*/
13789 Py_CLEAR(__pyx_builtin_KeyError);
13790 Py_CLEAR(__pyx_builtin_SyntaxError);
13791 Py_CLEAR(__pyx_builtin_ValueError);
13792 Py_CLEAR(__pyx_builtin_IndexError);
13793 Py_CLEAR(__pyx_builtin_AttributeError);
13794 Py_CLEAR(__pyx_builtin_StopIteration);
13795 /*--- Intern cleanup code ---*/
13796 Py_CLEAR(__pyx_empty_tuple);
13797 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer > 0) {
13798 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer];
13799 (*Py_TYPE(o)->tp_free)(o);
13801 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child > 0) {
13802 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child];
13803 (*Py_TYPE(o)->tp_free)(o);
13805 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select > 0) {
13806 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_2_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_2_select];
13807 (*Py_TYPE(o)->tp_free)(o);
13809 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select > 0) {
13810 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_3_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_3_select];
13811 (*Py_TYPE(o)->tp_free)(o);
13813 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant > 0) {
13814 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant];
13815 (*Py_TYPE(o)->tp_free)(o);
13817 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select > 0) {
13818 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_5_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_5_select];
13819 (*Py_TYPE(o)->tp_free)(o);
13821 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select > 0) {
13822 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_6_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_6_select];
13823 (*Py_TYPE(o)->tp_free)(o);
13825 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate > 0) {
13826 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate];
13827 (*Py_TYPE(o)->tp_free)(o);
13829 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select > 0) {
13830 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_8_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_8_select];
13831 (*Py_TYPE(o)->tp_free)(o);
13833 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select > 0) {
13834 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_9_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_9_select];
13835 (*Py_TYPE(o)->tp_free)(o);
13837 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select > 0) {
13838 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_10_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_10_select];
13839 (*Py_TYPE(o)->tp_free)(o);
13841 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select > 0) {
13842 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_11_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_11_select];
13843 (*Py_TYPE(o)->tp_free)(o);
13845 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select > 0) {
13846 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_12_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_12_select];
13847 (*Py_TYPE(o)->tp_free)(o);
13849 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select > 0) {
13850 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_13_select[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_13_select];
13851 (*Py_TYPE(o)->tp_free)(o);
13853 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator > 0) {
13854 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator];
13855 (*Py_TYPE(o)->tp_free)(o);
13857 while (__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr > 0) {
13858 PyObject* o = (PyObject*)__pyx_freelist_4lxml_12_elementpath___pyx_scope_struct_15_genexpr[--__pyx_freecount_4lxml_12_elementpath___pyx_scope_struct_15_genexpr];
13859 (*Py_TYPE(o)->tp_free)(o);
13862 Py_CLEAR(__pyx_cython_runtime);
13866 /* --- Runtime support code --- */
13868 #if CYTHON_REFNANNY
13869 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
13870 PyObject *m = NULL, *p = NULL;
13872 m = PyImport_ImportModule(modname);
13874 p = PyObject_GetAttrString(m, "RefNannyAPI");
13876 r = PyLong_AsVoidPtr(p);
13880 return (__Pyx_RefNannyAPIStruct *)r;
13884 /* PyObjectGetAttrStr */
13885 #if CYTHON_USE_TYPE_SLOTS
13886 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
13887 PyTypeObject* tp = Py_TYPE(obj);
13888 if (likely(tp->tp_getattro))
13889 return tp->tp_getattro(obj, attr_name);
13890 #if PY_MAJOR_VERSION < 3
13891 if (likely(tp->tp_getattr))
13892 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
13894 return PyObject_GetAttr(obj, attr_name);
13898 /* GetBuiltinName */
13899 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
13900 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
13901 if (unlikely(!result)) {
13902 PyErr_Format(PyExc_NameError,
13903 #if PY_MAJOR_VERSION >= 3
13904 "name '%U' is not defined", name);
13906 "name '%.200s' is not defined", PyString_AS_STRING(name));
13912 /* RaiseDoubleKeywords */
13913 static void __Pyx_RaiseDoubleKeywordsError(
13914 const char* func_name,
13917 PyErr_Format(PyExc_TypeError,
13918 #if PY_MAJOR_VERSION >= 3
13919 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
13921 "%s() got multiple values for keyword argument '%s'", func_name,
13922 PyString_AsString(kw_name));
13926 /* ParseKeywords */
13927 static int __Pyx_ParseOptionalKeywords(
13929 PyObject **argnames[],
13931 PyObject *values[],
13932 Py_ssize_t num_pos_args,
13933 const char* function_name)
13935 PyObject *key = 0, *value = 0;
13936 Py_ssize_t pos = 0;
13938 PyObject*** first_kw_arg = argnames + num_pos_args;
13939 while (PyDict_Next(kwds, &pos, &key, &value)) {
13940 name = first_kw_arg;
13941 while (*name && (**name != key)) name++;
13943 values[name-argnames] = value;
13946 name = first_kw_arg;
13947 #if PY_MAJOR_VERSION < 3
13948 if (likely(PyString_Check(key))) {
13950 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
13951 && _PyString_Eq(**name, key)) {
13952 values[name-argnames] = value;
13957 if (*name) continue;
13959 PyObject*** argname = argnames;
13960 while (argname != first_kw_arg) {
13961 if ((**argname == key) || (
13962 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
13963 && _PyString_Eq(**argname, key))) {
13964 goto arg_passed_twice;
13971 if (likely(PyUnicode_Check(key))) {
13973 int cmp = (**name == key) ? 0 :
13974 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13975 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13977 PyUnicode_Compare(**name, key);
13978 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13980 values[name-argnames] = value;
13985 if (*name) continue;
13987 PyObject*** argname = argnames;
13988 while (argname != first_kw_arg) {
13989 int cmp = (**argname == key) ? 0 :
13990 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
13991 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
13993 PyUnicode_Compare(**argname, key);
13994 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13995 if (cmp == 0) goto arg_passed_twice;
14000 goto invalid_keyword_type;
14002 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
14004 goto invalid_keyword;
14009 __Pyx_RaiseDoubleKeywordsError(function_name, key);
14011 invalid_keyword_type:
14012 PyErr_Format(PyExc_TypeError,
14013 "%.200s() keywords must be strings", function_name);
14016 PyErr_Format(PyExc_TypeError,
14017 #if PY_MAJOR_VERSION < 3
14018 "%.200s() got an unexpected keyword argument '%.200s'",
14019 function_name, PyString_AsString(key));
14021 "%s() got an unexpected keyword argument '%U'",
14022 function_name, key);
14028 /* RaiseArgTupleInvalid */
14029 static void __Pyx_RaiseArgtupleInvalid(
14030 const char* func_name,
14032 Py_ssize_t num_min,
14033 Py_ssize_t num_max,
14034 Py_ssize_t num_found)
14036 Py_ssize_t num_expected;
14037 const char *more_or_less;
14038 if (num_found < num_min) {
14039 num_expected = num_min;
14040 more_or_less = "at least";
14042 num_expected = num_max;
14043 more_or_less = "at most";
14046 more_or_less = "exactly";
14048 PyErr_Format(PyExc_TypeError,
14049 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
14050 func_name, more_or_less, num_expected,
14051 (num_expected == 1) ? "" : "s", num_found);
14054 /* PyCFunctionFastCall */
14055 #if CYTHON_FAST_PYCCALL
14056 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
14057 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
14058 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
14059 PyObject *self = PyCFunction_GET_SELF(func);
14060 int flags = PyCFunction_GET_FLAGS(func);
14061 assert(PyCFunction_Check(func));
14062 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
14063 assert(nargs >= 0);
14064 assert(nargs == 0 || args != NULL);
14065 /* _PyCFunction_FastCallDict() must not be called with an exception set,
14066 because it may clear it (directly or indirectly) and so the
14067 caller loses its exception */
14068 assert(!PyErr_Occurred());
14069 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
14070 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
14072 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
14077 /* PyFunctionFastCall */
14078 #if CYTHON_FAST_PYCALL
14079 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
14080 PyObject *globals) {
14082 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14083 PyObject **fastlocals;
14086 assert(globals != NULL);
14087 /* XXX Perhaps we should create a specialized
14088 PyFrame_New() that doesn't take locals, but does
14089 take builtins without sanity checking them.
14091 assert(tstate != NULL);
14092 f = PyFrame_New(tstate, co, globals, NULL);
14096 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
14097 for (i = 0; i < na; i++) {
14099 fastlocals[i] = *args++;
14101 result = PyEval_EvalFrameEx(f,0);
14102 ++tstate->recursion_depth;
14104 --tstate->recursion_depth;
14107 #if 1 || PY_VERSION_HEX < 0x030600B1
14108 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
14109 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
14110 PyObject *globals = PyFunction_GET_GLOBALS(func);
14111 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
14113 #if PY_MAJOR_VERSION >= 3
14116 PyObject *kwtuple, **k;
14121 assert(kwargs == NULL || PyDict_Check(kwargs));
14122 nk = kwargs ? PyDict_Size(kwargs) : 0;
14123 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
14127 #if PY_MAJOR_VERSION >= 3
14128 co->co_kwonlyargcount == 0 &&
14130 likely(kwargs == NULL || nk == 0) &&
14131 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
14132 if (argdefs == NULL && co->co_argcount == nargs) {
14133 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
14136 else if (nargs == 0 && argdefs != NULL
14137 && co->co_argcount == Py_SIZE(argdefs)) {
14138 /* function called with no arguments, but all parameters have
14139 a default value: use default values as arguments .*/
14140 args = &PyTuple_GET_ITEM(argdefs, 0);
14141 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
14145 if (kwargs != NULL) {
14147 kwtuple = PyTuple_New(2 * nk);
14148 if (kwtuple == NULL) {
14152 k = &PyTuple_GET_ITEM(kwtuple, 0);
14154 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
14165 closure = PyFunction_GET_CLOSURE(func);
14166 #if PY_MAJOR_VERSION >= 3
14167 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
14169 if (argdefs != NULL) {
14170 d = &PyTuple_GET_ITEM(argdefs, 0);
14171 nd = Py_SIZE(argdefs);
14177 #if PY_MAJOR_VERSION >= 3
14178 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
14181 d, (int)nd, kwdefs, closure);
14183 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
14186 d, (int)nd, closure);
14188 Py_XDECREF(kwtuple);
14190 Py_LeaveRecursiveCall();
14197 #if CYTHON_COMPILING_IN_CPYTHON
14198 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
14200 ternaryfunc call = func->ob_type->tp_call;
14201 if (unlikely(!call))
14202 return PyObject_Call(func, arg, kw);
14203 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14205 result = (*call)(func, arg, kw);
14206 Py_LeaveRecursiveCall();
14207 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14210 "NULL result without error in PyObject_Call");
14216 /* PyObjectCall2Args */
14217 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
14218 PyObject *args, *result = NULL;
14219 #if CYTHON_FAST_PYCALL
14220 if (PyFunction_Check(function)) {
14221 PyObject *args[2] = {arg1, arg2};
14222 return __Pyx_PyFunction_FastCall(function, args, 2);
14225 #if CYTHON_FAST_PYCCALL
14226 if (__Pyx_PyFastCFunction_Check(function)) {
14227 PyObject *args[2] = {arg1, arg2};
14228 return __Pyx_PyCFunction_FastCall(function, args, 2);
14231 args = PyTuple_New(2);
14232 if (unlikely(!args)) goto done;
14234 PyTuple_SET_ITEM(args, 0, arg1);
14236 PyTuple_SET_ITEM(args, 1, arg2);
14237 Py_INCREF(function);
14238 result = __Pyx_PyObject_Call(function, args, NULL);
14240 Py_DECREF(function);
14245 /* PyObjectCallMethO */
14246 #if CYTHON_COMPILING_IN_CPYTHON
14247 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
14248 PyObject *self, *result;
14250 cfunc = PyCFunction_GET_FUNCTION(func);
14251 self = PyCFunction_GET_SELF(func);
14252 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14254 result = cfunc(self, arg);
14255 Py_LeaveRecursiveCall();
14256 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14259 "NULL result without error in PyObject_Call");
14265 /* PyObjectCallOneArg */
14266 #if CYTHON_COMPILING_IN_CPYTHON
14267 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14269 PyObject *args = PyTuple_New(1);
14270 if (unlikely(!args)) return NULL;
14272 PyTuple_SET_ITEM(args, 0, arg);
14273 result = __Pyx_PyObject_Call(func, args, NULL);
14277 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14278 #if CYTHON_FAST_PYCALL
14279 if (PyFunction_Check(func)) {
14280 return __Pyx_PyFunction_FastCall(func, &arg, 1);
14283 if (likely(PyCFunction_Check(func))) {
14284 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
14285 return __Pyx_PyObject_CallMethO(func, arg);
14286 #if CYTHON_FAST_PYCCALL
14287 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
14288 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
14292 return __Pyx__PyObject_CallOneArg(func, arg);
14295 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14297 PyObject *args = PyTuple_Pack(1, arg);
14298 if (unlikely(!args)) return NULL;
14299 result = __Pyx_PyObject_Call(func, args, NULL);
14305 /* PyDictVersioning */
14306 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
14307 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
14308 PyObject *dict = Py_TYPE(obj)->tp_dict;
14309 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
14311 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
14312 PyObject **dictptr = NULL;
14313 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
14315 #if CYTHON_COMPILING_IN_CPYTHON
14316 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
14318 dictptr = _PyObject_GetDictPtr(obj);
14321 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
14323 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
14324 PyObject *dict = Py_TYPE(obj)->tp_dict;
14325 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
14327 return obj_dict_version == __Pyx_get_object_dict_version(obj);
14331 /* GetModuleGlobalName */
14332 #if CYTHON_USE_DICT_VERSIONS
14333 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
14335 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
14339 #if !CYTHON_AVOID_BORROWED_REFS
14340 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
14341 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
14342 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14343 if (likely(result)) {
14344 return __Pyx_NewRef(result);
14345 } else if (unlikely(PyErr_Occurred())) {
14349 result = PyDict_GetItem(__pyx_d, name);
14350 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14351 if (likely(result)) {
14352 return __Pyx_NewRef(result);
14356 result = PyObject_GetItem(__pyx_d, name);
14357 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
14358 if (likely(result)) {
14359 return __Pyx_NewRef(result);
14363 return __Pyx_GetBuiltinName(name);
14366 /* RaiseTooManyValuesToUnpack */
14367 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
14368 PyErr_Format(PyExc_ValueError,
14369 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
14372 /* RaiseNeedMoreValuesToUnpack */
14373 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
14374 PyErr_Format(PyExc_ValueError,
14375 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
14376 index, (index == 1) ? "" : "s");
14380 static CYTHON_INLINE int __Pyx_IterFinish(void) {
14381 #if CYTHON_FAST_THREAD_STATE
14382 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14383 PyObject* exc_type = tstate->curexc_type;
14384 if (unlikely(exc_type)) {
14385 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
14386 PyObject *exc_value, *exc_tb;
14387 exc_value = tstate->curexc_value;
14388 exc_tb = tstate->curexc_traceback;
14389 tstate->curexc_type = 0;
14390 tstate->curexc_value = 0;
14391 tstate->curexc_traceback = 0;
14392 Py_DECREF(exc_type);
14393 Py_XDECREF(exc_value);
14394 Py_XDECREF(exc_tb);
14402 if (unlikely(PyErr_Occurred())) {
14403 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
14414 /* UnpackItemEndCheck */
14415 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
14416 if (unlikely(retval)) {
14418 __Pyx_RaiseTooManyValuesError(expected);
14421 return __Pyx_IterFinish();
14427 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
14429 if (!j) return NULL;
14430 r = PyObject_GetItem(o, j);
14434 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
14435 CYTHON_NCP_UNUSED int wraparound,
14436 CYTHON_NCP_UNUSED int boundscheck) {
14437 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14438 Py_ssize_t wrapped_i = i;
14439 if (wraparound & unlikely(i < 0)) {
14440 wrapped_i += PyList_GET_SIZE(o);
14442 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
14443 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
14447 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14449 return PySequence_GetItem(o, i);
14452 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
14453 CYTHON_NCP_UNUSED int wraparound,
14454 CYTHON_NCP_UNUSED int boundscheck) {
14455 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14456 Py_ssize_t wrapped_i = i;
14457 if (wraparound & unlikely(i < 0)) {
14458 wrapped_i += PyTuple_GET_SIZE(o);
14460 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
14461 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
14465 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14467 return PySequence_GetItem(o, i);
14470 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
14471 CYTHON_NCP_UNUSED int wraparound,
14472 CYTHON_NCP_UNUSED int boundscheck) {
14473 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
14474 if (is_list || PyList_CheckExact(o)) {
14475 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
14476 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
14477 PyObject *r = PyList_GET_ITEM(o, n);
14482 else if (PyTuple_CheckExact(o)) {
14483 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
14484 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
14485 PyObject *r = PyTuple_GET_ITEM(o, n);
14490 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
14491 if (likely(m && m->sq_item)) {
14492 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
14493 Py_ssize_t l = m->sq_length(o);
14494 if (likely(l >= 0)) {
14497 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
14502 return m->sq_item(o, i);
14506 if (is_list || PySequence_Check(o)) {
14507 return PySequence_GetItem(o, i);
14510 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14514 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
14515 #if CYTHON_COMPILING_IN_PYPY
14516 return PyObject_RichCompareBool(s1, s2, equals);
14519 return (equals == Py_EQ);
14520 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
14521 const char *ps1, *ps2;
14522 Py_ssize_t length = PyBytes_GET_SIZE(s1);
14523 if (length != PyBytes_GET_SIZE(s2))
14524 return (equals == Py_NE);
14525 ps1 = PyBytes_AS_STRING(s1);
14526 ps2 = PyBytes_AS_STRING(s2);
14527 if (ps1[0] != ps2[0]) {
14528 return (equals == Py_NE);
14529 } else if (length == 1) {
14530 return (equals == Py_EQ);
14533 #if CYTHON_USE_UNICODE_INTERNALS
14534 Py_hash_t hash1, hash2;
14535 hash1 = ((PyBytesObject*)s1)->ob_shash;
14536 hash2 = ((PyBytesObject*)s2)->ob_shash;
14537 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
14538 return (equals == Py_NE);
14541 result = memcmp(ps1, ps2, (size_t)length);
14542 return (equals == Py_EQ) ? (result == 0) : (result != 0);
14544 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
14545 return (equals == Py_NE);
14546 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
14547 return (equals == Py_NE);
14550 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14553 result = __Pyx_PyObject_IsTrue(py_result);
14554 Py_DECREF(py_result);
14560 /* UnicodeEquals */
14561 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
14562 #if CYTHON_COMPILING_IN_PYPY
14563 return PyObject_RichCompareBool(s1, s2, equals);
14565 #if PY_MAJOR_VERSION < 3
14566 PyObject* owned_ref = NULL;
14568 int s1_is_unicode, s2_is_unicode;
14572 s1_is_unicode = PyUnicode_CheckExact(s1);
14573 s2_is_unicode = PyUnicode_CheckExact(s2);
14574 #if PY_MAJOR_VERSION < 3
14575 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
14576 owned_ref = PyUnicode_FromObject(s2);
14577 if (unlikely(!owned_ref))
14581 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
14582 owned_ref = PyUnicode_FromObject(s1);
14583 if (unlikely(!owned_ref))
14587 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
14588 return __Pyx_PyBytes_Equals(s1, s2, equals);
14591 if (s1_is_unicode & s2_is_unicode) {
14594 void *data1, *data2;
14595 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
14597 length = __Pyx_PyUnicode_GET_LENGTH(s1);
14598 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
14601 #if CYTHON_USE_UNICODE_INTERNALS
14603 Py_hash_t hash1, hash2;
14604 #if CYTHON_PEP393_ENABLED
14605 hash1 = ((PyASCIIObject*)s1)->hash;
14606 hash2 = ((PyASCIIObject*)s2)->hash;
14608 hash1 = ((PyUnicodeObject*)s1)->hash;
14609 hash2 = ((PyUnicodeObject*)s2)->hash;
14611 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
14616 kind = __Pyx_PyUnicode_KIND(s1);
14617 if (kind != __Pyx_PyUnicode_KIND(s2)) {
14620 data1 = __Pyx_PyUnicode_DATA(s1);
14621 data2 = __Pyx_PyUnicode_DATA(s2);
14622 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
14624 } else if (length == 1) {
14627 int result = memcmp(data1, data2, (size_t)(length * kind));
14628 #if PY_MAJOR_VERSION < 3
14629 Py_XDECREF(owned_ref);
14631 return (equals == Py_EQ) ? (result == 0) : (result != 0);
14633 } else if ((s1 == Py_None) & s2_is_unicode) {
14635 } else if ((s2 == Py_None) & s1_is_unicode) {
14639 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14640 #if PY_MAJOR_VERSION < 3
14641 Py_XDECREF(owned_ref);
14645 result = __Pyx_PyObject_IsTrue(py_result);
14646 Py_DECREF(py_result);
14650 #if PY_MAJOR_VERSION < 3
14651 Py_XDECREF(owned_ref);
14653 return (equals == Py_EQ);
14655 #if PY_MAJOR_VERSION < 3
14656 Py_XDECREF(owned_ref);
14658 return (equals == Py_NE);
14662 /* PyErrFetchRestore */
14663 #if CYTHON_FAST_THREAD_STATE
14664 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14665 PyObject *tmp_type, *tmp_value, *tmp_tb;
14666 tmp_type = tstate->curexc_type;
14667 tmp_value = tstate->curexc_value;
14668 tmp_tb = tstate->curexc_traceback;
14669 tstate->curexc_type = type;
14670 tstate->curexc_value = value;
14671 tstate->curexc_traceback = tb;
14672 Py_XDECREF(tmp_type);
14673 Py_XDECREF(tmp_value);
14674 Py_XDECREF(tmp_tb);
14676 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14677 *type = tstate->curexc_type;
14678 *value = tstate->curexc_value;
14679 *tb = tstate->curexc_traceback;
14680 tstate->curexc_type = 0;
14681 tstate->curexc_value = 0;
14682 tstate->curexc_traceback = 0;
14686 /* RaiseException */
14687 #if PY_MAJOR_VERSION < 3
14688 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
14689 CYTHON_UNUSED PyObject *cause) {
14690 __Pyx_PyThreadState_declare
14692 if (!value || value == Py_None)
14696 if (!tb || tb == Py_None)
14700 if (!PyTraceBack_Check(tb)) {
14701 PyErr_SetString(PyExc_TypeError,
14702 "raise: arg 3 must be a traceback or None");
14706 if (PyType_Check(type)) {
14707 #if CYTHON_COMPILING_IN_PYPY
14709 Py_INCREF(Py_None);
14713 PyErr_NormalizeException(&type, &value, &tb);
14716 PyErr_SetString(PyExc_TypeError,
14717 "instance exception may not have a separate value");
14721 type = (PyObject*) Py_TYPE(type);
14723 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
14724 PyErr_SetString(PyExc_TypeError,
14725 "raise: exception class must be a subclass of BaseException");
14729 __Pyx_PyThreadState_assign
14730 __Pyx_ErrRestore(type, value, tb);
14739 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
14740 PyObject* owned_instance = NULL;
14741 if (tb == Py_None) {
14743 } else if (tb && !PyTraceBack_Check(tb)) {
14744 PyErr_SetString(PyExc_TypeError,
14745 "raise: arg 3 must be a traceback or None");
14748 if (value == Py_None)
14750 if (PyExceptionInstance_Check(type)) {
14752 PyErr_SetString(PyExc_TypeError,
14753 "instance exception may not have a separate value");
14757 type = (PyObject*) Py_TYPE(value);
14758 } else if (PyExceptionClass_Check(type)) {
14759 PyObject *instance_class = NULL;
14760 if (value && PyExceptionInstance_Check(value)) {
14761 instance_class = (PyObject*) Py_TYPE(value);
14762 if (instance_class != type) {
14763 int is_subclass = PyObject_IsSubclass(instance_class, type);
14764 if (!is_subclass) {
14765 instance_class = NULL;
14766 } else if (unlikely(is_subclass == -1)) {
14769 type = instance_class;
14773 if (!instance_class) {
14776 args = PyTuple_New(0);
14777 else if (PyTuple_Check(value)) {
14781 args = PyTuple_Pack(1, value);
14784 owned_instance = PyObject_Call(type, args, NULL);
14786 if (!owned_instance)
14788 value = owned_instance;
14789 if (!PyExceptionInstance_Check(value)) {
14790 PyErr_Format(PyExc_TypeError,
14791 "calling %R should have returned an instance of "
14792 "BaseException, not %R",
14793 type, Py_TYPE(value));
14798 PyErr_SetString(PyExc_TypeError,
14799 "raise: exception class must be a subclass of BaseException");
14803 PyObject *fixed_cause;
14804 if (cause == Py_None) {
14805 fixed_cause = NULL;
14806 } else if (PyExceptionClass_Check(cause)) {
14807 fixed_cause = PyObject_CallObject(cause, NULL);
14808 if (fixed_cause == NULL)
14810 } else if (PyExceptionInstance_Check(cause)) {
14811 fixed_cause = cause;
14812 Py_INCREF(fixed_cause);
14814 PyErr_SetString(PyExc_TypeError,
14815 "exception causes must derive from "
14819 PyException_SetCause(value, fixed_cause);
14821 PyErr_SetObject(type, value);
14823 #if CYTHON_COMPILING_IN_PYPY
14824 PyObject *tmp_type, *tmp_value, *tmp_tb;
14825 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
14827 PyErr_Restore(tmp_type, tmp_value, tb);
14828 Py_XDECREF(tmp_tb);
14830 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14831 PyObject* tmp_tb = tstate->curexc_traceback;
14832 if (tb != tmp_tb) {
14834 tstate->curexc_traceback = tb;
14835 Py_XDECREF(tmp_tb);
14840 Py_XDECREF(owned_instance);
14845 /* ObjectGetItem */
14846 #if CYTHON_USE_TYPE_SLOTS
14847 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
14849 Py_ssize_t key_value;
14850 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
14851 if (unlikely(!(m && m->sq_item))) {
14852 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
14855 key_value = __Pyx_PyIndex_AsSsize_t(index);
14856 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
14857 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
14859 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
14861 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
14865 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
14866 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
14867 if (likely(m && m->mp_subscript)) {
14868 return m->mp_subscript(obj, key);
14870 return __Pyx_PyObject_GetIndex(obj, key);
14874 /* GetTopmostException */
14875 #if CYTHON_USE_EXC_INFO_STACK
14876 static _PyErr_StackItem *
14877 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
14879 _PyErr_StackItem *exc_info = tstate->exc_info;
14880 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
14881 exc_info->previous_item != NULL)
14883 exc_info = exc_info->previous_item;
14889 /* SaveResetException */
14890 #if CYTHON_FAST_THREAD_STATE
14891 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14892 #if CYTHON_USE_EXC_INFO_STACK
14893 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
14894 *type = exc_info->exc_type;
14895 *value = exc_info->exc_value;
14896 *tb = exc_info->exc_traceback;
14898 *type = tstate->exc_type;
14899 *value = tstate->exc_value;
14900 *tb = tstate->exc_traceback;
14903 Py_XINCREF(*value);
14906 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14907 PyObject *tmp_type, *tmp_value, *tmp_tb;
14908 #if CYTHON_USE_EXC_INFO_STACK
14909 _PyErr_StackItem *exc_info = tstate->exc_info;
14910 tmp_type = exc_info->exc_type;
14911 tmp_value = exc_info->exc_value;
14912 tmp_tb = exc_info->exc_traceback;
14913 exc_info->exc_type = type;
14914 exc_info->exc_value = value;
14915 exc_info->exc_traceback = tb;
14917 tmp_type = tstate->exc_type;
14918 tmp_value = tstate->exc_value;
14919 tmp_tb = tstate->exc_traceback;
14920 tstate->exc_type = type;
14921 tstate->exc_value = value;
14922 tstate->exc_traceback = tb;
14924 Py_XDECREF(tmp_type);
14925 Py_XDECREF(tmp_value);
14926 Py_XDECREF(tmp_tb);
14930 /* PyErrExceptionMatches */
14931 #if CYTHON_FAST_THREAD_STATE
14932 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14934 n = PyTuple_GET_SIZE(tuple);
14935 #if PY_MAJOR_VERSION >= 3
14936 for (i=0; i<n; i++) {
14937 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14940 for (i=0; i<n; i++) {
14941 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
14945 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
14946 PyObject *exc_type = tstate->curexc_type;
14947 if (exc_type == err) return 1;
14948 if (unlikely(!exc_type)) return 0;
14949 if (unlikely(PyTuple_Check(err)))
14950 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
14951 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
14956 #if CYTHON_FAST_THREAD_STATE
14957 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
14959 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
14962 PyObject *local_type, *local_value, *local_tb;
14963 #if CYTHON_FAST_THREAD_STATE
14964 PyObject *tmp_type, *tmp_value, *tmp_tb;
14965 local_type = tstate->curexc_type;
14966 local_value = tstate->curexc_value;
14967 local_tb = tstate->curexc_traceback;
14968 tstate->curexc_type = 0;
14969 tstate->curexc_value = 0;
14970 tstate->curexc_traceback = 0;
14972 PyErr_Fetch(&local_type, &local_value, &local_tb);
14974 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14975 #if CYTHON_FAST_THREAD_STATE
14976 if (unlikely(tstate->curexc_type))
14978 if (unlikely(PyErr_Occurred()))
14981 #if PY_MAJOR_VERSION >= 3
14983 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14987 Py_XINCREF(local_tb);
14988 Py_XINCREF(local_type);
14989 Py_XINCREF(local_value);
14990 *type = local_type;
14991 *value = local_value;
14993 #if CYTHON_FAST_THREAD_STATE
14994 #if CYTHON_USE_EXC_INFO_STACK
14996 _PyErr_StackItem *exc_info = tstate->exc_info;
14997 tmp_type = exc_info->exc_type;
14998 tmp_value = exc_info->exc_value;
14999 tmp_tb = exc_info->exc_traceback;
15000 exc_info->exc_type = local_type;
15001 exc_info->exc_value = local_value;
15002 exc_info->exc_traceback = local_tb;
15005 tmp_type = tstate->exc_type;
15006 tmp_value = tstate->exc_value;
15007 tmp_tb = tstate->exc_traceback;
15008 tstate->exc_type = local_type;
15009 tstate->exc_value = local_value;
15010 tstate->exc_traceback = local_tb;
15012 Py_XDECREF(tmp_type);
15013 Py_XDECREF(tmp_value);
15014 Py_XDECREF(tmp_tb);
15016 PyErr_SetExcInfo(local_type, local_value, local_tb);
15023 Py_XDECREF(local_type);
15024 Py_XDECREF(local_value);
15025 Py_XDECREF(local_tb);
15030 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
15031 PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
15034 /* FetchCommonType */
15035 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
15036 PyObject* fake_module;
15037 PyTypeObject* cached_type = NULL;
15038 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
15039 if (!fake_module) return NULL;
15040 Py_INCREF(fake_module);
15041 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
15043 if (!PyType_Check((PyObject*)cached_type)) {
15044 PyErr_Format(PyExc_TypeError,
15045 "Shared Cython type %.200s is not a type object",
15049 if (cached_type->tp_basicsize != type->tp_basicsize) {
15050 PyErr_Format(PyExc_TypeError,
15051 "Shared Cython type %.200s has the wrong size, try recompiling",
15056 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
15058 if (PyType_Ready(type) < 0) goto bad;
15059 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
15062 cached_type = type;
15065 Py_DECREF(fake_module);
15066 return cached_type;
15068 Py_XDECREF(cached_type);
15069 cached_type = NULL;
15073 /* CythonFunctionShared */
15074 #include <structmember.h>
15076 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
15078 if (unlikely(op->func_doc == NULL)) {
15079 if (op->func.m_ml->ml_doc) {
15080 #if PY_MAJOR_VERSION >= 3
15081 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
15083 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
15085 if (unlikely(op->func_doc == NULL))
15088 Py_INCREF(Py_None);
15092 Py_INCREF(op->func_doc);
15093 return op->func_doc;
15096 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15098 PyObject *tmp = op->func_doc;
15099 if (value == NULL) {
15103 op->func_doc = value;
15108 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15110 if (unlikely(op->func_name == NULL)) {
15111 #if PY_MAJOR_VERSION >= 3
15112 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
15114 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
15116 if (unlikely(op->func_name == NULL))
15119 Py_INCREF(op->func_name);
15120 return op->func_name;
15123 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15126 #if PY_MAJOR_VERSION >= 3
15127 if (unlikely(value == NULL || !PyUnicode_Check(value)))
15129 if (unlikely(value == NULL || !PyString_Check(value)))
15132 PyErr_SetString(PyExc_TypeError,
15133 "__name__ must be set to a string object");
15136 tmp = op->func_name;
15138 op->func_name = value;
15143 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15145 Py_INCREF(op->func_qualname);
15146 return op->func_qualname;
15149 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15152 #if PY_MAJOR_VERSION >= 3
15153 if (unlikely(value == NULL || !PyUnicode_Check(value)))
15155 if (unlikely(value == NULL || !PyString_Check(value)))
15158 PyErr_SetString(PyExc_TypeError,
15159 "__qualname__ must be set to a string object");
15162 tmp = op->func_qualname;
15164 op->func_qualname = value;
15169 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
15172 self = m->func_closure;
15179 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15181 if (unlikely(op->func_dict == NULL)) {
15182 op->func_dict = PyDict_New();
15183 if (unlikely(op->func_dict == NULL))
15186 Py_INCREF(op->func_dict);
15187 return op->func_dict;
15190 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15193 if (unlikely(value == NULL)) {
15194 PyErr_SetString(PyExc_TypeError,
15195 "function's dictionary may not be deleted");
15198 if (unlikely(!PyDict_Check(value))) {
15199 PyErr_SetString(PyExc_TypeError,
15200 "setting function's dictionary to a non-dict");
15203 tmp = op->func_dict;
15205 op->func_dict = value;
15210 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15212 Py_INCREF(op->func_globals);
15213 return op->func_globals;
15216 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15218 Py_INCREF(Py_None);
15222 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15224 PyObject* result = (op->func_code) ? op->func_code : Py_None;
15229 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
15231 PyObject *res = op->defaults_getter((PyObject *) op);
15232 if (unlikely(!res))
15234 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15235 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
15236 Py_INCREF(op->defaults_tuple);
15237 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
15238 Py_INCREF(op->defaults_kwdict);
15240 op->defaults_tuple = PySequence_ITEM(res, 0);
15241 if (unlikely(!op->defaults_tuple)) result = -1;
15243 op->defaults_kwdict = PySequence_ITEM(res, 1);
15244 if (unlikely(!op->defaults_kwdict)) result = -1;
15251 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15255 } else if (value != Py_None && !PyTuple_Check(value)) {
15256 PyErr_SetString(PyExc_TypeError,
15257 "__defaults__ must be set to a tuple object");
15261 tmp = op->defaults_tuple;
15262 op->defaults_tuple = value;
15267 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15268 PyObject* result = op->defaults_tuple;
15269 if (unlikely(!result)) {
15270 if (op->defaults_getter) {
15271 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
15272 result = op->defaults_tuple;
15281 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15285 } else if (value != Py_None && !PyDict_Check(value)) {
15286 PyErr_SetString(PyExc_TypeError,
15287 "__kwdefaults__ must be set to a dict object");
15291 tmp = op->defaults_kwdict;
15292 op->defaults_kwdict = value;
15297 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15298 PyObject* result = op->defaults_kwdict;
15299 if (unlikely(!result)) {
15300 if (op->defaults_getter) {
15301 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
15302 result = op->defaults_kwdict;
15311 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15313 if (!value || value == Py_None) {
15315 } else if (!PyDict_Check(value)) {
15316 PyErr_SetString(PyExc_TypeError,
15317 "__annotations__ must be set to a dict object");
15321 tmp = op->func_annotations;
15322 op->func_annotations = value;
15327 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
15328 PyObject* result = op->func_annotations;
15329 if (unlikely(!result)) {
15330 result = PyDict_New();
15331 if (unlikely(!result)) return NULL;
15332 op->func_annotations = result;
15337 static PyGetSetDef __pyx_CyFunction_getsets[] = {
15338 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15339 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
15340 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15341 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
15342 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
15343 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
15344 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15345 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
15346 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15347 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
15348 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15349 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
15350 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15351 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
15352 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15353 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
15354 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
15355 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
15358 static PyMemberDef __pyx_CyFunction_members[] = {
15359 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
15363 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
15365 #if PY_MAJOR_VERSION >= 3
15366 return PyUnicode_FromString(m->func.m_ml->ml_name);
15368 return PyString_FromString(m->func.m_ml->ml_name);
15371 static PyMethodDef __pyx_CyFunction_methods[] = {
15372 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
15375 #if PY_VERSION_HEX < 0x030500A0
15376 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
15378 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
15380 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
15381 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
15382 if (unlikely(op == NULL))
15385 __Pyx_CyFunction_weakreflist(op) = NULL;
15386 op->func.m_ml = ml;
15387 op->func.m_self = (PyObject *) op;
15388 Py_XINCREF(closure);
15389 op->func_closure = closure;
15390 Py_XINCREF(module);
15391 op->func.m_module = module;
15392 op->func_dict = NULL;
15393 op->func_name = NULL;
15394 Py_INCREF(qualname);
15395 op->func_qualname = qualname;
15396 op->func_doc = NULL;
15397 op->func_classobj = NULL;
15398 op->func_globals = globals;
15399 Py_INCREF(op->func_globals);
15401 op->func_code = code;
15402 op->defaults_pyobjects = 0;
15403 op->defaults_size = 0;
15404 op->defaults = NULL;
15405 op->defaults_tuple = NULL;
15406 op->defaults_kwdict = NULL;
15407 op->defaults_getter = NULL;
15408 op->func_annotations = NULL;
15409 return (PyObject *) op;
15412 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
15414 Py_CLEAR(m->func_closure);
15415 Py_CLEAR(m->func.m_module);
15416 Py_CLEAR(m->func_dict);
15417 Py_CLEAR(m->func_name);
15418 Py_CLEAR(m->func_qualname);
15419 Py_CLEAR(m->func_doc);
15420 Py_CLEAR(m->func_globals);
15421 Py_CLEAR(m->func_code);
15422 Py_CLEAR(m->func_classobj);
15423 Py_CLEAR(m->defaults_tuple);
15424 Py_CLEAR(m->defaults_kwdict);
15425 Py_CLEAR(m->func_annotations);
15427 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15429 for (i = 0; i < m->defaults_pyobjects; i++)
15430 Py_XDECREF(pydefaults[i]);
15431 PyObject_Free(m->defaults);
15432 m->defaults = NULL;
15436 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
15438 if (__Pyx_CyFunction_weakreflist(m) != NULL)
15439 PyObject_ClearWeakRefs((PyObject *) m);
15440 __Pyx_CyFunction_clear(m);
15441 PyObject_GC_Del(m);
15443 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
15445 PyObject_GC_UnTrack(m);
15446 __Pyx__CyFunction_dealloc(m);
15448 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
15450 Py_VISIT(m->func_closure);
15451 Py_VISIT(m->func.m_module);
15452 Py_VISIT(m->func_dict);
15453 Py_VISIT(m->func_name);
15454 Py_VISIT(m->func_qualname);
15455 Py_VISIT(m->func_doc);
15456 Py_VISIT(m->func_globals);
15457 Py_VISIT(m->func_code);
15458 Py_VISIT(m->func_classobj);
15459 Py_VISIT(m->defaults_tuple);
15460 Py_VISIT(m->defaults_kwdict);
15462 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15464 for (i = 0; i < m->defaults_pyobjects; i++)
15465 Py_VISIT(pydefaults[i]);
15469 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
15471 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15472 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
15476 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
15478 type = (PyObject *)(Py_TYPE(obj));
15479 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
15481 if (obj == Py_None)
15483 return __Pyx_PyMethod_New(func, obj, type);
15486 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
15488 #if PY_MAJOR_VERSION >= 3
15489 return PyUnicode_FromFormat("<cyfunction %U at %p>",
15490 op->func_qualname, (void *)op);
15492 return PyString_FromFormat("<cyfunction %s at %p>",
15493 PyString_AsString(op->func_qualname), (void *)op);
15496 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
15497 PyCFunctionObject* f = (PyCFunctionObject*)func;
15498 PyCFunction meth = f->m_ml->ml_meth;
15500 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
15502 if (likely(kw == NULL || PyDict_Size(kw) == 0))
15503 return (*meth)(self, arg);
15505 case METH_VARARGS | METH_KEYWORDS:
15506 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
15508 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15509 size = PyTuple_GET_SIZE(arg);
15510 if (likely(size == 0))
15511 return (*meth)(self, NULL);
15512 PyErr_Format(PyExc_TypeError,
15513 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
15514 f->m_ml->ml_name, size);
15519 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
15520 size = PyTuple_GET_SIZE(arg);
15521 if (likely(size == 1)) {
15522 PyObject *result, *arg0;
15523 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15524 arg0 = PyTuple_GET_ITEM(arg, 0);
15526 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
15528 result = (*meth)(self, arg0);
15529 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
15534 PyErr_Format(PyExc_TypeError,
15535 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
15536 f->m_ml->ml_name, size);
15541 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
15542 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
15543 "longer supported!");
15546 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
15550 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
15551 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
15553 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
15555 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
15556 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
15558 PyObject *new_args;
15560 argc = PyTuple_GET_SIZE(args);
15561 new_args = PyTuple_GetSlice(args, 1, argc);
15562 if (unlikely(!new_args))
15564 self = PyTuple_GetItem(args, 0);
15565 if (unlikely(!self)) {
15566 Py_DECREF(new_args);
15569 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
15570 Py_DECREF(new_args);
15572 result = __Pyx_CyFunction_Call(func, args, kw);
15576 static PyTypeObject __pyx_CyFunctionType_type = {
15577 PyVarObject_HEAD_INIT(0, 0)
15578 "cython_function_or_method",
15579 sizeof(__pyx_CyFunctionObject),
15581 (destructor) __Pyx_CyFunction_dealloc,
15585 #if PY_MAJOR_VERSION < 3
15590 (reprfunc) __Pyx_CyFunction_repr,
15595 __Pyx_CyFunction_CallAsMethod,
15600 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
15602 (traverseproc) __Pyx_CyFunction_traverse,
15603 (inquiry) __Pyx_CyFunction_clear,
15605 #if PY_VERSION_HEX < 0x030500A0
15606 offsetof(__pyx_CyFunctionObject, func_weakreflist),
15608 offsetof(PyCFunctionObject, m_weakreflist),
15612 __pyx_CyFunction_methods,
15613 __pyx_CyFunction_members,
15614 __pyx_CyFunction_getsets,
15617 __Pyx_CyFunction_descr_get,
15619 offsetof(__pyx_CyFunctionObject, func_dict),
15632 #if PY_VERSION_HEX >= 0x030400a1
15635 #if PY_VERSION_HEX >= 0x030800b1
15638 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15642 static int __pyx_CyFunction_init(void) {
15643 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
15644 if (unlikely(__pyx_CyFunctionType == NULL)) {
15649 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
15650 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15651 m->defaults = PyObject_Malloc(size);
15652 if (unlikely(!m->defaults))
15653 return PyErr_NoMemory();
15654 memset(m->defaults, 0, size);
15655 m->defaults_pyobjects = pyobjects;
15656 m->defaults_size = size;
15657 return m->defaults;
15659 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
15660 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15661 m->defaults_tuple = tuple;
15664 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
15665 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15666 m->defaults_kwdict = dict;
15669 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
15670 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15671 m->func_annotations = dict;
15675 /* CythonFunction */
15676 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
15677 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
15678 PyObject *op = __Pyx_CyFunction_Init(
15679 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
15680 ml, flags, qualname, closure, module, globals, code
15683 PyObject_GC_Track(op);
15688 /* PyObjectCallNoArg */
15689 #if CYTHON_COMPILING_IN_CPYTHON
15690 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
15691 #if CYTHON_FAST_PYCALL
15692 if (PyFunction_Check(func)) {
15693 return __Pyx_PyFunction_FastCall(func, NULL, 0);
15696 #ifdef __Pyx_CyFunction_USED
15697 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
15699 if (likely(PyCFunction_Check(func)))
15702 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
15703 return __Pyx_PyObject_CallMethO(func, NULL);
15706 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
15711 #if !CYTHON_COMPILING_IN_CPYTHON
15712 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
15713 return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
15718 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
15719 Py_ssize_t cstart, Py_ssize_t cstop,
15720 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
15721 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
15722 #if CYTHON_USE_TYPE_SLOTS
15723 PyMappingMethods* mp;
15724 #if PY_MAJOR_VERSION < 3
15725 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
15726 if (likely(ms && ms->sq_slice)) {
15728 if (_py_start && (*_py_start != Py_None)) {
15729 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
15730 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
15735 if (_py_stop && (*_py_stop != Py_None)) {
15736 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
15737 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
15739 cstop = PY_SSIZE_T_MAX;
15741 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
15742 Py_ssize_t l = ms->sq_length(obj);
15743 if (likely(l >= 0)) {
15746 if (cstop < 0) cstop = 0;
15750 if (cstart < 0) cstart = 0;
15753 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
15758 return ms->sq_slice(obj, cstart, cstop);
15761 mp = Py_TYPE(obj)->tp_as_mapping;
15762 if (likely(mp && mp->mp_subscript))
15766 PyObject *py_slice, *py_start, *py_stop;
15768 py_slice = *_py_slice;
15770 PyObject* owned_start = NULL;
15771 PyObject* owned_stop = NULL;
15773 py_start = *_py_start;
15776 owned_start = py_start = PyInt_FromSsize_t(cstart);
15777 if (unlikely(!py_start)) goto bad;
15779 py_start = Py_None;
15782 py_stop = *_py_stop;
15785 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
15786 if (unlikely(!py_stop)) {
15787 Py_XDECREF(owned_start);
15793 py_slice = PySlice_New(py_start, py_stop, Py_None);
15794 Py_XDECREF(owned_start);
15795 Py_XDECREF(owned_stop);
15796 if (unlikely(!py_slice)) goto bad;
15798 #if CYTHON_USE_TYPE_SLOTS
15799 result = mp->mp_subscript(obj, py_slice);
15801 result = PyObject_GetItem(obj, py_slice);
15804 Py_DECREF(py_slice);
15808 PyErr_Format(PyExc_TypeError,
15809 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
15815 #if !CYTHON_COMPILING_IN_PYPY
15816 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
15818 (void)zerodivision_check;
15819 #if PY_MAJOR_VERSION < 3
15820 if (likely(PyInt_CheckExact(op1))) {
15821 const long b = intval;
15823 long a = PyInt_AS_LONG(op1);
15824 x = (long)((unsigned long)a - b);
15825 if (likely((x^a) >= 0 || (x^~b) >= 0))
15826 return PyInt_FromLong(x);
15827 return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
15830 #if CYTHON_USE_PYLONG_INTERNALS
15831 if (likely(PyLong_CheckExact(op1))) {
15832 const long b = intval;
15834 #ifdef HAVE_LONG_LONG
15835 const PY_LONG_LONG llb = intval;
15836 PY_LONG_LONG lla, llx;
15838 const digit* digits = ((PyLongObject*)op1)->ob_digit;
15839 const Py_ssize_t size = Py_SIZE(op1);
15840 if (likely(__Pyx_sst_abs(size) <= 1)) {
15841 a = likely(size) ? digits[0] : 0;
15842 if (size == -1) a = -a;
15846 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15847 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15849 #ifdef HAVE_LONG_LONG
15850 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15851 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15855 CYTHON_FALLTHROUGH;
15857 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15858 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15860 #ifdef HAVE_LONG_LONG
15861 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15862 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15866 CYTHON_FALLTHROUGH;
15868 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15869 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15871 #ifdef HAVE_LONG_LONG
15872 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15873 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15877 CYTHON_FALLTHROUGH;
15879 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15880 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15882 #ifdef HAVE_LONG_LONG
15883 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15884 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15888 CYTHON_FALLTHROUGH;
15890 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15891 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15893 #ifdef HAVE_LONG_LONG
15894 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15895 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15899 CYTHON_FALLTHROUGH;
15901 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15902 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15904 #ifdef HAVE_LONG_LONG
15905 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15906 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15910 CYTHON_FALLTHROUGH;
15911 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
15915 return PyLong_FromLong(x);
15916 #ifdef HAVE_LONG_LONG
15919 return PyLong_FromLongLong(llx);
15925 if (PyFloat_CheckExact(op1)) {
15926 const long b = intval;
15927 double a = PyFloat_AS_DOUBLE(op1);
15929 PyFPE_START_PROTECT("subtract", return NULL)
15930 result = ((double)a) - (double)b;
15931 PyFPE_END_PROTECT(result)
15932 return PyFloat_FromDouble(result);
15934 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
15939 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
15943 #if PY_MAJOR_VERSION < 3
15944 if (likely(PyInt_CheckExact(op1))) {
15945 const long b = intval;
15946 long a = PyInt_AS_LONG(op1);
15947 if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
15950 #if CYTHON_USE_PYLONG_INTERNALS
15951 if (likely(PyLong_CheckExact(op1))) {
15953 unsigned long uintval;
15954 Py_ssize_t size = Py_SIZE(op1);
15955 const digit* digits = ((PyLongObject*)op1)->ob_digit;
15957 if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
15958 } else if (intval < 0) {
15967 uintval = (unsigned long) intval;
15968 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
15969 if (uintval >> (PyLong_SHIFT * 4)) {
15970 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
15971 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
15974 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
15975 if (uintval >> (PyLong_SHIFT * 3)) {
15976 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
15977 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
15980 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
15981 if (uintval >> (PyLong_SHIFT * 2)) {
15982 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
15983 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
15986 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
15987 if (uintval >> (PyLong_SHIFT * 1)) {
15988 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
15989 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
15992 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
15993 if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
15996 if (PyFloat_CheckExact(op1)) {
15997 const long b = intval;
15998 double a = PyFloat_AS_DOUBLE(op1);
15999 if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
16002 PyObject_RichCompare(op1, op2, Py_EQ));
16006 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
16007 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
16009 value = PyDict_GetItemWithError(d, key);
16010 if (unlikely(!value)) {
16011 if (!PyErr_Occurred()) {
16012 if (unlikely(PyTuple_Check(key))) {
16013 PyObject* args = PyTuple_Pack(1, key);
16014 if (likely(args)) {
16015 PyErr_SetObject(PyExc_KeyError, args);
16019 PyErr_SetObject(PyExc_KeyError, key);
16030 static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
16031 PyObject* exc_type;
16032 __Pyx_PyThreadState_declare
16033 __Pyx_PyThreadState_assign
16034 exc_type = __Pyx_PyErr_Occurred();
16035 if (unlikely(exc_type)) {
16036 if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
16038 __Pyx_PyErr_Clear();
16046 __Pyx_PyErr_SetNone(PyExc_StopIteration);
16049 static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
16050 PyErr_Format(PyExc_TypeError,
16051 "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
16053 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
16055 iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
16056 if (likely(iternext)) {
16057 #if CYTHON_USE_TYPE_SLOTS
16058 next = iternext(iterator);
16061 #if PY_VERSION_HEX >= 0x02070000
16062 if (unlikely(iternext == &_PyObject_NextNotImplemented))
16066 next = PyIter_Next(iterator);
16070 } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
16071 __Pyx_PyIter_Next_ErrorNoIterator(iterator);
16074 #if !CYTHON_USE_TYPE_SLOTS
16076 next = PyIter_Next(iterator);
16081 return __Pyx_PyIter_Next2Default(defval);
16084 /* PyObject_GenericGetAttrNoDict */
16085 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
16086 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
16087 PyErr_Format(PyExc_AttributeError,
16088 #if PY_MAJOR_VERSION >= 3
16089 "'%.50s' object has no attribute '%U'",
16090 tp->tp_name, attr_name);
16092 "'%.50s' object has no attribute '%.400s'",
16093 tp->tp_name, PyString_AS_STRING(attr_name));
16097 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
16099 PyTypeObject *tp = Py_TYPE(obj);
16100 if (unlikely(!PyString_Check(attr_name))) {
16101 return PyObject_GenericGetAttr(obj, attr_name);
16103 assert(!tp->tp_dictoffset);
16104 descr = _PyType_Lookup(tp, attr_name);
16105 if (unlikely(!descr)) {
16106 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
16109 #if PY_MAJOR_VERSION < 3
16110 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
16113 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
16115 PyObject *res = f(descr, obj, (PyObject *)tp);
16125 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
16126 PyObject *empty_list = 0;
16127 PyObject *module = 0;
16128 PyObject *global_dict = 0;
16129 PyObject *empty_dict = 0;
16131 #if PY_MAJOR_VERSION < 3
16132 PyObject *py_import;
16133 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
16140 empty_list = PyList_New(0);
16145 global_dict = PyModule_GetDict(__pyx_m);
16148 empty_dict = PyDict_New();
16152 #if PY_MAJOR_VERSION >= 3
16154 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
16155 module = PyImport_ImportModuleLevelObject(
16156 name, global_dict, empty_dict, list, 1);
16158 if (!PyErr_ExceptionMatches(PyExc_ImportError))
16167 #if PY_MAJOR_VERSION < 3
16168 PyObject *py_level = PyInt_FromLong(level);
16171 module = PyObject_CallFunctionObjArgs(py_import,
16172 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
16173 Py_DECREF(py_level);
16175 module = PyImport_ImportModuleLevelObject(
16176 name, global_dict, empty_dict, list, level);
16181 #if PY_MAJOR_VERSION < 3
16182 Py_XDECREF(py_import);
16184 Py_XDECREF(empty_list);
16185 Py_XDECREF(empty_dict);
16189 /* RegisterModuleCleanup */
16190 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
16191 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
16192 __pyx_module_cleanup(module);
16193 Py_INCREF(Py_None); return Py_None;
16195 static int __Pyx_RegisterCleanup(void) {
16196 static PyMethodDef cleanup_def = {
16197 "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
16198 PyObject *cleanup_func = 0;
16199 PyObject *atexit = 0;
16201 PyObject *args = 0;
16204 cleanup_func = PyCFunction_New(&cleanup_def, 0);
16207 atexit = PyImport_ImportModule("atexit");
16210 reg = PyObject_GetAttrString(atexit, "_exithandlers");
16211 if (reg && PyList_Check(reg)) {
16213 a = PyTuple_New(0);
16220 args = PyTuple_Pack(3, cleanup_func, a, kw);
16225 ret = PyList_Insert(reg, 0, args);
16230 reg = PyObject_GetAttrString(atexit, "register");
16233 args = PyTuple_Pack(1, cleanup_func);
16236 res = PyObject_CallObject(reg, args);
16242 Py_XDECREF(cleanup_func);
16243 Py_XDECREF(atexit);
16251 /* CLineInTraceback */
16252 #ifndef CYTHON_CLINE_IN_TRACEBACK
16253 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
16254 PyObject *use_cline;
16255 PyObject *ptype, *pvalue, *ptraceback;
16256 #if CYTHON_COMPILING_IN_CPYTHON
16257 PyObject **cython_runtime_dict;
16259 if (unlikely(!__pyx_cython_runtime)) {
16262 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
16263 #if CYTHON_COMPILING_IN_CPYTHON
16264 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
16265 if (likely(cython_runtime_dict)) {
16266 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
16267 use_cline, *cython_runtime_dict,
16268 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
16272 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
16273 if (use_cline_obj) {
16274 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
16275 Py_DECREF(use_cline_obj);
16283 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
16285 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
16288 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
16293 /* CodeObjectCache */
16294 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
16295 int start = 0, mid = 0, end = count - 1;
16296 if (end >= 0 && code_line > entries[end].code_line) {
16299 while (start < end) {
16300 mid = start + (end - start) / 2;
16301 if (code_line < entries[mid].code_line) {
16303 } else if (code_line > entries[mid].code_line) {
16309 if (code_line <= entries[mid].code_line) {
16315 static PyCodeObject *__pyx_find_code_object(int code_line) {
16316 PyCodeObject* code_object;
16318 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
16321 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16322 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
16325 code_object = __pyx_code_cache.entries[pos].code_object;
16326 Py_INCREF(code_object);
16327 return code_object;
16329 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
16331 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
16332 if (unlikely(!code_line)) {
16335 if (unlikely(!entries)) {
16336 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
16337 if (likely(entries)) {
16338 __pyx_code_cache.entries = entries;
16339 __pyx_code_cache.max_count = 64;
16340 __pyx_code_cache.count = 1;
16341 entries[0].code_line = code_line;
16342 entries[0].code_object = code_object;
16343 Py_INCREF(code_object);
16347 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16348 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
16349 PyCodeObject* tmp = entries[pos].code_object;
16350 entries[pos].code_object = code_object;
16354 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
16355 int new_max = __pyx_code_cache.max_count + 64;
16356 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
16357 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
16358 if (unlikely(!entries)) {
16361 __pyx_code_cache.entries = entries;
16362 __pyx_code_cache.max_count = new_max;
16364 for (i=__pyx_code_cache.count; i>pos; i--) {
16365 entries[i] = entries[i-1];
16367 entries[pos].code_line = code_line;
16368 entries[pos].code_object = code_object;
16369 __pyx_code_cache.count++;
16370 Py_INCREF(code_object);
16374 #include "compile.h"
16375 #include "frameobject.h"
16376 #include "traceback.h"
16377 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
16378 const char *funcname, int c_line,
16379 int py_line, const char *filename) {
16380 PyCodeObject *py_code = 0;
16381 PyObject *py_srcfile = 0;
16382 PyObject *py_funcname = 0;
16383 #if PY_MAJOR_VERSION < 3
16384 py_srcfile = PyString_FromString(filename);
16386 py_srcfile = PyUnicode_FromString(filename);
16388 if (!py_srcfile) goto bad;
16390 #if PY_MAJOR_VERSION < 3
16391 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16393 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16397 #if PY_MAJOR_VERSION < 3
16398 py_funcname = PyString_FromString(funcname);
16400 py_funcname = PyUnicode_FromString(funcname);
16403 if (!py_funcname) goto bad;
16404 py_code = __Pyx_PyCode_New(
16410 __pyx_empty_bytes, /*PyObject *code,*/
16411 __pyx_empty_tuple, /*PyObject *consts,*/
16412 __pyx_empty_tuple, /*PyObject *names,*/
16413 __pyx_empty_tuple, /*PyObject *varnames,*/
16414 __pyx_empty_tuple, /*PyObject *freevars,*/
16415 __pyx_empty_tuple, /*PyObject *cellvars,*/
16416 py_srcfile, /*PyObject *filename,*/
16417 py_funcname, /*PyObject *name,*/
16419 __pyx_empty_bytes /*PyObject *lnotab*/
16421 Py_DECREF(py_srcfile);
16422 Py_DECREF(py_funcname);
16425 Py_XDECREF(py_srcfile);
16426 Py_XDECREF(py_funcname);
16429 static void __Pyx_AddTraceback(const char *funcname, int c_line,
16430 int py_line, const char *filename) {
16431 PyCodeObject *py_code = 0;
16432 PyFrameObject *py_frame = 0;
16433 PyThreadState *tstate = __Pyx_PyThreadState_Current;
16435 c_line = __Pyx_CLineForTraceback(tstate, c_line);
16437 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
16439 py_code = __Pyx_CreateCodeObjectForTraceback(
16440 funcname, c_line, py_line, filename);
16441 if (!py_code) goto bad;
16442 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
16444 py_frame = PyFrame_New(
16445 tstate, /*PyThreadState *tstate,*/
16446 py_code, /*PyCodeObject *code,*/
16447 __pyx_d, /*PyObject *globals,*/
16448 0 /*PyObject *locals*/
16450 if (!py_frame) goto bad;
16451 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
16452 PyTraceBack_Here(py_frame);
16454 Py_XDECREF(py_code);
16455 Py_XDECREF(py_frame);
16459 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
16460 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
16461 const int is_unsigned = neg_one > const_zero;
16463 if (sizeof(long) < sizeof(long)) {
16464 return PyInt_FromLong((long) value);
16465 } else if (sizeof(long) <= sizeof(unsigned long)) {
16466 return PyLong_FromUnsignedLong((unsigned long) value);
16467 #ifdef HAVE_LONG_LONG
16468 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16469 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16473 if (sizeof(long) <= sizeof(long)) {
16474 return PyInt_FromLong((long) value);
16475 #ifdef HAVE_LONG_LONG
16476 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16477 return PyLong_FromLongLong((PY_LONG_LONG) value);
16482 int one = 1; int little = (int)*(unsigned char *)&one;
16483 unsigned char *bytes = (unsigned char *)&value;
16484 return _PyLong_FromByteArray(bytes, sizeof(long),
16485 little, !is_unsigned);
16489 /* CIntFromPyVerify */
16490 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
16491 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
16492 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
16493 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
16494 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
16496 func_type value = func_value;\
16497 if (sizeof(target_type) < sizeof(func_type)) {\
16498 if (unlikely(value != (func_type) (target_type) value)) {\
16499 func_type zero = 0;\
16500 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
16501 return (target_type) -1;\
16502 if (is_unsigned && unlikely(value < zero))\
16503 goto raise_neg_overflow;\
16505 goto raise_overflow;\
16508 return (target_type) value;\
16512 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
16513 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
16514 const int is_unsigned = neg_one > const_zero;
16515 #if PY_MAJOR_VERSION < 3
16516 if (likely(PyInt_Check(x))) {
16517 if (sizeof(long) < sizeof(long)) {
16518 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
16520 long val = PyInt_AS_LONG(x);
16521 if (is_unsigned && unlikely(val < 0)) {
16522 goto raise_neg_overflow;
16528 if (likely(PyLong_Check(x))) {
16530 #if CYTHON_USE_PYLONG_INTERNALS
16531 const digit* digits = ((PyLongObject*)x)->ob_digit;
16532 switch (Py_SIZE(x)) {
16533 case 0: return (long) 0;
16534 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
16536 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
16537 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16538 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16539 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
16540 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16545 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
16546 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16547 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16548 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
16549 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16554 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
16555 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16556 __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])))
16557 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
16558 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16564 #if CYTHON_COMPILING_IN_CPYTHON
16565 if (unlikely(Py_SIZE(x) < 0)) {
16566 goto raise_neg_overflow;
16570 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16571 if (unlikely(result < 0))
16573 if (unlikely(result == 1))
16574 goto raise_neg_overflow;
16577 if (sizeof(long) <= sizeof(unsigned long)) {
16578 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
16579 #ifdef HAVE_LONG_LONG
16580 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16581 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16585 #if CYTHON_USE_PYLONG_INTERNALS
16586 const digit* digits = ((PyLongObject*)x)->ob_digit;
16587 switch (Py_SIZE(x)) {
16588 case 0: return (long) 0;
16589 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
16590 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
16592 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
16593 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16594 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16595 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16596 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16601 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
16602 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16603 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16604 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16605 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16610 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16611 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16612 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16613 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16614 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16619 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
16620 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16621 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16622 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16623 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16628 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
16629 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16630 __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])))
16631 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
16632 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16637 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
16638 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16639 __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])))
16640 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
16641 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
16647 if (sizeof(long) <= sizeof(long)) {
16648 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
16649 #ifdef HAVE_LONG_LONG
16650 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16651 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
16656 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16657 PyErr_SetString(PyExc_RuntimeError,
16658 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16661 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16662 #if PY_MAJOR_VERSION < 3
16663 if (likely(v) && !PyLong_Check(v)) {
16665 v = PyNumber_Long(tmp);
16670 int one = 1; int is_little = (int)*(unsigned char *)&one;
16671 unsigned char *bytes = (unsigned char *)&val;
16672 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16673 bytes, sizeof(val),
16674 is_little, !is_unsigned);
16684 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16685 if (!tmp) return (long) -1;
16686 val = __Pyx_PyInt_As_long(tmp);
16691 PyErr_SetString(PyExc_OverflowError,
16692 "value too large to convert to long");
16694 raise_neg_overflow:
16695 PyErr_SetString(PyExc_OverflowError,
16696 "can't convert negative value to long");
16701 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
16702 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
16703 const int is_unsigned = neg_one > const_zero;
16704 #if PY_MAJOR_VERSION < 3
16705 if (likely(PyInt_Check(x))) {
16706 if (sizeof(int) < sizeof(long)) {
16707 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
16709 long val = PyInt_AS_LONG(x);
16710 if (is_unsigned && unlikely(val < 0)) {
16711 goto raise_neg_overflow;
16717 if (likely(PyLong_Check(x))) {
16719 #if CYTHON_USE_PYLONG_INTERNALS
16720 const digit* digits = ((PyLongObject*)x)->ob_digit;
16721 switch (Py_SIZE(x)) {
16722 case 0: return (int) 0;
16723 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
16725 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
16726 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16727 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16728 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
16729 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16734 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
16735 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16736 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16737 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
16738 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16743 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
16744 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16745 __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])))
16746 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
16747 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
16753 #if CYTHON_COMPILING_IN_CPYTHON
16754 if (unlikely(Py_SIZE(x) < 0)) {
16755 goto raise_neg_overflow;
16759 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16760 if (unlikely(result < 0))
16762 if (unlikely(result == 1))
16763 goto raise_neg_overflow;
16766 if (sizeof(int) <= sizeof(unsigned long)) {
16767 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
16768 #ifdef HAVE_LONG_LONG
16769 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
16770 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16774 #if CYTHON_USE_PYLONG_INTERNALS
16775 const digit* digits = ((PyLongObject*)x)->ob_digit;
16776 switch (Py_SIZE(x)) {
16777 case 0: return (int) 0;
16778 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
16779 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
16781 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
16782 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16783 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16784 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16785 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16790 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
16791 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16792 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16793 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16794 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16799 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
16800 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16801 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16802 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16803 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16808 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
16809 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16810 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16811 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16812 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16817 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
16818 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16819 __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])))
16820 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
16821 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16826 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
16827 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16828 __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])))
16829 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
16830 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
16836 if (sizeof(int) <= sizeof(long)) {
16837 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
16838 #ifdef HAVE_LONG_LONG
16839 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
16840 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
16845 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16846 PyErr_SetString(PyExc_RuntimeError,
16847 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16850 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16851 #if PY_MAJOR_VERSION < 3
16852 if (likely(v) && !PyLong_Check(v)) {
16854 v = PyNumber_Long(tmp);
16859 int one = 1; int is_little = (int)*(unsigned char *)&one;
16860 unsigned char *bytes = (unsigned char *)&val;
16861 int ret = _PyLong_AsByteArray((PyLongObject *)v,
16862 bytes, sizeof(val),
16863 is_little, !is_unsigned);
16873 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16874 if (!tmp) return (int) -1;
16875 val = __Pyx_PyInt_As_int(tmp);
16880 PyErr_SetString(PyExc_OverflowError,
16881 "value too large to convert to int");
16883 raise_neg_overflow:
16884 PyErr_SetString(PyExc_OverflowError,
16885 "can't convert negative value to int");
16889 /* FastTypeChecks */
16890 #if CYTHON_COMPILING_IN_CPYTHON
16891 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
16897 return b == &PyBaseObject_Type;
16899 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
16901 if (a == b) return 1;
16905 n = PyTuple_GET_SIZE(mro);
16906 for (i = 0; i < n; i++) {
16907 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
16912 return __Pyx_InBases(a, b);
16914 #if PY_MAJOR_VERSION == 2
16915 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
16916 PyObject *exception, *value, *tb;
16918 __Pyx_PyThreadState_declare
16919 __Pyx_PyThreadState_assign
16920 __Pyx_ErrFetch(&exception, &value, &tb);
16921 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
16922 if (unlikely(res == -1)) {
16923 PyErr_WriteUnraisable(err);
16927 res = PyObject_IsSubclass(err, exc_type2);
16928 if (unlikely(res == -1)) {
16929 PyErr_WriteUnraisable(err);
16933 __Pyx_ErrRestore(exception, value, tb);
16937 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
16938 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
16940 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
16945 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
16947 assert(PyExceptionClass_Check(exc_type));
16948 n = PyTuple_GET_SIZE(tuple);
16949 #if PY_MAJOR_VERSION >= 3
16950 for (i=0; i<n; i++) {
16951 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
16954 for (i=0; i<n; i++) {
16955 PyObject *t = PyTuple_GET_ITEM(tuple, i);
16956 #if PY_MAJOR_VERSION < 3
16957 if (likely(exc_type == t)) return 1;
16959 if (likely(PyExceptionClass_Check(t))) {
16960 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
16966 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
16967 if (likely(err == exc_type)) return 1;
16968 if (likely(PyExceptionClass_Check(err))) {
16969 if (likely(PyExceptionClass_Check(exc_type))) {
16970 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
16971 } else if (likely(PyTuple_Check(exc_type))) {
16972 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
16976 return PyErr_GivenExceptionMatches(err, exc_type);
16978 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
16979 assert(PyExceptionClass_Check(exc_type1));
16980 assert(PyExceptionClass_Check(exc_type2));
16981 if (likely(err == exc_type1 || err == exc_type2)) return 1;
16982 if (likely(PyExceptionClass_Check(err))) {
16983 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
16985 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
16989 /* SwapException */
16990 #if CYTHON_FAST_THREAD_STATE
16991 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
16992 PyObject *tmp_type, *tmp_value, *tmp_tb;
16993 #if CYTHON_USE_EXC_INFO_STACK
16994 _PyErr_StackItem *exc_info = tstate->exc_info;
16995 tmp_type = exc_info->exc_type;
16996 tmp_value = exc_info->exc_value;
16997 tmp_tb = exc_info->exc_traceback;
16998 exc_info->exc_type = *type;
16999 exc_info->exc_value = *value;
17000 exc_info->exc_traceback = *tb;
17002 tmp_type = tstate->exc_type;
17003 tmp_value = tstate->exc_value;
17004 tmp_tb = tstate->exc_traceback;
17005 tstate->exc_type = *type;
17006 tstate->exc_value = *value;
17007 tstate->exc_traceback = *tb;
17010 *value = tmp_value;
17014 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
17015 PyObject *tmp_type, *tmp_value, *tmp_tb;
17016 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
17017 PyErr_SetExcInfo(*type, *value, *tb);
17019 *value = tmp_value;
17024 /* PyObjectGetMethod */
17025 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
17027 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
17028 PyTypeObject *tp = Py_TYPE(obj);
17030 descrgetfunc f = NULL;
17031 PyObject **dictptr, *dict;
17032 int meth_found = 0;
17033 assert (*method == NULL);
17034 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
17035 attr = __Pyx_PyObject_GetAttrStr(obj, name);
17038 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
17041 descr = _PyType_Lookup(tp, name);
17042 if (likely(descr != NULL)) {
17044 #if PY_MAJOR_VERSION >= 3
17045 #ifdef __Pyx_CyFunction_USED
17046 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
17048 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
17051 #ifdef __Pyx_CyFunction_USED
17052 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
17054 if (likely(PyFunction_Check(descr)))
17060 f = Py_TYPE(descr)->tp_descr_get;
17061 if (f != NULL && PyDescr_IsData(descr)) {
17062 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
17068 dictptr = _PyObject_GetDictPtr(obj);
17069 if (dictptr != NULL && (dict = *dictptr) != NULL) {
17071 attr = __Pyx_PyDict_GetItemStr(dict, name);
17072 if (attr != NULL) {
17085 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
17089 if (descr != NULL) {
17093 PyErr_Format(PyExc_AttributeError,
17094 #if PY_MAJOR_VERSION >= 3
17095 "'%.50s' object has no attribute '%U'",
17096 tp->tp_name, name);
17098 "'%.50s' object has no attribute '%.400s'",
17099 tp->tp_name, PyString_AS_STRING(name));
17103 attr = __Pyx_PyObject_GetAttrStr(obj, name);
17107 #if CYTHON_UNPACK_METHODS
17108 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
17109 PyObject *function = PyMethod_GET_FUNCTION(attr);
17110 Py_INCREF(function);
17112 *method = function;
17120 /* PyObjectCallMethod1 */
17121 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
17122 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
17126 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
17127 PyObject *method = NULL, *result;
17128 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
17129 if (likely(is_method)) {
17130 result = __Pyx_PyObject_Call2Args(method, obj, arg);
17134 if (unlikely(!method)) return NULL;
17135 return __Pyx__PyObject_CallMethod1(method, arg);
17138 /* CoroutineBase */
17139 #include <structmember.h>
17140 #include <frameobject.h>
17141 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
17142 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
17143 PyObject *et, *ev, *tb;
17144 PyObject *value = NULL;
17145 __Pyx_ErrFetch(&et, &ev, &tb);
17149 Py_INCREF(Py_None);
17153 if (likely(et == PyExc_StopIteration)) {
17155 Py_INCREF(Py_None);
17158 #if PY_VERSION_HEX >= 0x030300A0
17159 else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
17160 value = ((PyStopIterationObject *)ev)->value;
17165 else if (unlikely(PyTuple_Check(ev))) {
17166 if (PyTuple_GET_SIZE(ev) >= 1) {
17167 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17168 value = PyTuple_GET_ITEM(ev, 0);
17171 value = PySequence_ITEM(ev, 0);
17174 Py_INCREF(Py_None);
17179 else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
17182 if (likely(value)) {
17188 } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
17189 __Pyx_ErrRestore(et, ev, tb);
17192 PyErr_NormalizeException(&et, &ev, &tb);
17193 if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
17194 __Pyx_ErrRestore(et, ev, tb);
17199 #if PY_VERSION_HEX >= 0x030300A0
17200 value = ((PyStopIterationObject *)ev)->value;
17205 PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
17207 if (likely(args)) {
17208 value = PySequence_GetItem(args, 0);
17211 if (unlikely(!value)) {
17212 __Pyx_ErrRestore(NULL, NULL, NULL);
17213 Py_INCREF(Py_None);
17221 static CYTHON_INLINE
17222 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
17223 PyObject *t, *v, *tb;
17224 t = exc_state->exc_type;
17225 v = exc_state->exc_value;
17226 tb = exc_state->exc_traceback;
17227 exc_state->exc_type = NULL;
17228 exc_state->exc_value = NULL;
17229 exc_state->exc_traceback = NULL;
17234 #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
17235 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
17238 #ifdef __Pyx_Coroutine_USED
17239 } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
17240 msg = "coroutine already executing";
17242 #ifdef __Pyx_AsyncGen_USED
17243 } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
17244 msg = "async generator already executing";
17247 msg = "generator already executing";
17249 PyErr_SetString(PyExc_ValueError, msg);
17251 #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
17252 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
17255 #ifdef __Pyx_Coroutine_USED
17256 } else if (__Pyx_Coroutine_Check(gen)) {
17257 msg = "can't send non-None value to a just-started coroutine";
17259 #ifdef __Pyx_AsyncGen_USED
17260 } else if (__Pyx_AsyncGen_CheckExact(gen)) {
17261 msg = "can't send non-None value to a just-started async generator";
17264 msg = "can't send non-None value to a just-started generator";
17266 PyErr_SetString(PyExc_TypeError, msg);
17268 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
17269 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
17270 #ifdef __Pyx_Coroutine_USED
17271 if (!closing && __Pyx_Coroutine_Check(gen)) {
17272 PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
17276 #ifdef __Pyx_AsyncGen_USED
17277 if (__Pyx_AsyncGen_CheckExact(gen))
17278 PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
17281 PyErr_SetNone(PyExc_StopIteration);
17285 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
17286 __Pyx_PyThreadState_declare
17287 PyThreadState *tstate;
17288 __Pyx_ExcInfoStruct *exc_state;
17290 assert(!self->is_running);
17291 if (unlikely(self->resume_label == 0)) {
17292 if (unlikely(value && value != Py_None)) {
17293 return __Pyx_Coroutine_NotStartedError((PyObject*)self);
17296 if (unlikely(self->resume_label == -1)) {
17297 return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
17299 #if CYTHON_FAST_THREAD_STATE
17300 __Pyx_PyThreadState_assign
17301 tstate = __pyx_tstate;
17303 tstate = __Pyx_PyThreadState_Current;
17305 exc_state = &self->gi_exc_state;
17306 if (exc_state->exc_type) {
17307 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
17309 if (exc_state->exc_traceback) {
17310 PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
17311 PyFrameObject *f = tb->tb_frame;
17312 Py_XINCREF(tstate->frame);
17313 assert(f->f_back == NULL);
17314 f->f_back = tstate->frame;
17318 #if CYTHON_USE_EXC_INFO_STACK
17319 exc_state->previous_item = tstate->exc_info;
17320 tstate->exc_info = exc_state;
17322 if (exc_state->exc_type) {
17323 __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
17325 __Pyx_Coroutine_ExceptionClear(exc_state);
17326 __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
17329 self->is_running = 1;
17330 retval = self->body((PyObject *) self, tstate, value);
17331 self->is_running = 0;
17332 #if CYTHON_USE_EXC_INFO_STACK
17333 exc_state = &self->gi_exc_state;
17334 tstate->exc_info = exc_state->previous_item;
17335 exc_state->previous_item = NULL;
17336 __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
17340 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
17341 PyObject *exc_tb = exc_state->exc_traceback;
17342 if (likely(exc_tb)) {
17343 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
17345 PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
17346 PyFrameObject *f = tb->tb_frame;
17347 Py_CLEAR(f->f_back);
17351 static CYTHON_INLINE
17352 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
17353 if (unlikely(!retval)) {
17354 __Pyx_PyThreadState_declare
17355 __Pyx_PyThreadState_assign
17356 if (!__Pyx_PyErr_Occurred()) {
17357 PyObject *exc = PyExc_StopIteration;
17358 #ifdef __Pyx_AsyncGen_USED
17359 if (__Pyx_AsyncGen_CheckExact(gen))
17360 exc = __Pyx_PyExc_StopAsyncIteration;
17362 __Pyx_PyErr_SetNone(exc);
17367 static CYTHON_INLINE
17368 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
17370 PyObject *val = NULL;
17371 __Pyx_Coroutine_Undelegate(gen);
17372 __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
17373 ret = __Pyx_Coroutine_SendEx(gen, val, 0);
17377 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
17379 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
17380 PyObject *yf = gen->yieldfrom;
17381 if (unlikely(gen->is_running))
17382 return __Pyx_Coroutine_AlreadyRunningError(gen);
17385 gen->is_running = 1;
17386 #ifdef __Pyx_Generator_USED
17387 if (__Pyx_Generator_CheckExact(yf)) {
17388 ret = __Pyx_Coroutine_Send(yf, value);
17391 #ifdef __Pyx_Coroutine_USED
17392 if (__Pyx_Coroutine_Check(yf)) {
17393 ret = __Pyx_Coroutine_Send(yf, value);
17396 #ifdef __Pyx_AsyncGen_USED
17397 if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
17398 ret = __Pyx_async_gen_asend_send(yf, value);
17401 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
17402 if (PyGen_CheckExact(yf)) {
17403 ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
17406 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
17407 if (PyCoro_CheckExact(yf)) {
17408 ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
17412 if (value == Py_None)
17413 ret = Py_TYPE(yf)->tp_iternext(yf);
17415 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
17417 gen->is_running = 0;
17421 retval = __Pyx_Coroutine_FinishDelegation(gen);
17423 retval = __Pyx_Coroutine_SendEx(gen, value, 0);
17425 return __Pyx_Coroutine_MethodReturn(self, retval);
17427 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
17428 PyObject *retval = NULL;
17430 #ifdef __Pyx_Generator_USED
17431 if (__Pyx_Generator_CheckExact(yf)) {
17432 retval = __Pyx_Coroutine_Close(yf);
17437 #ifdef __Pyx_Coroutine_USED
17438 if (__Pyx_Coroutine_Check(yf)) {
17439 retval = __Pyx_Coroutine_Close(yf);
17443 if (__Pyx_CoroutineAwait_CheckExact(yf)) {
17444 retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
17449 #ifdef __Pyx_AsyncGen_USED
17450 if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
17451 retval = __Pyx_async_gen_asend_close(yf, NULL);
17453 if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
17454 retval = __Pyx_async_gen_athrow_close(yf, NULL);
17459 gen->is_running = 1;
17460 meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
17461 if (unlikely(!meth)) {
17462 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
17463 PyErr_WriteUnraisable(yf);
17467 retval = PyObject_CallFunction(meth, NULL);
17472 gen->is_running = 0;
17474 Py_XDECREF(retval);
17477 static PyObject *__Pyx_Generator_Next(PyObject *self) {
17478 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
17479 PyObject *yf = gen->yieldfrom;
17480 if (unlikely(gen->is_running))
17481 return __Pyx_Coroutine_AlreadyRunningError(gen);
17484 gen->is_running = 1;
17485 #ifdef __Pyx_Generator_USED
17486 if (__Pyx_Generator_CheckExact(yf)) {
17487 ret = __Pyx_Generator_Next(yf);
17490 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
17491 if (PyGen_CheckExact(yf)) {
17492 ret = _PyGen_Send((PyGenObject*)yf, NULL);
17495 #ifdef __Pyx_Coroutine_USED
17496 if (__Pyx_Coroutine_Check(yf)) {
17497 ret = __Pyx_Coroutine_Send(yf, Py_None);
17500 ret = Py_TYPE(yf)->tp_iternext(yf);
17501 gen->is_running = 0;
17505 return __Pyx_Coroutine_FinishDelegation(gen);
17507 return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
17509 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
17510 return __Pyx_Coroutine_Close(self);
17512 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
17513 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
17514 PyObject *retval, *raised_exception;
17515 PyObject *yf = gen->yieldfrom;
17517 if (unlikely(gen->is_running))
17518 return __Pyx_Coroutine_AlreadyRunningError(gen);
17521 err = __Pyx_Coroutine_CloseIter(gen, yf);
17522 __Pyx_Coroutine_Undelegate(gen);
17526 PyErr_SetNone(PyExc_GeneratorExit);
17527 retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
17528 if (unlikely(retval)) {
17532 #ifdef __Pyx_Coroutine_USED
17533 } else if (__Pyx_Coroutine_Check(self)) {
17534 msg = "coroutine ignored GeneratorExit";
17536 #ifdef __Pyx_AsyncGen_USED
17537 } else if (__Pyx_AsyncGen_CheckExact(self)) {
17538 #if PY_VERSION_HEX < 0x03060000
17539 msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
17541 msg = "async generator ignored GeneratorExit";
17545 msg = "generator ignored GeneratorExit";
17547 PyErr_SetString(PyExc_RuntimeError, msg);
17550 raised_exception = PyErr_Occurred();
17551 if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
17552 if (raised_exception) PyErr_Clear();
17553 Py_INCREF(Py_None);
17558 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
17559 PyObject *args, int close_on_genexit) {
17560 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
17561 PyObject *yf = gen->yieldfrom;
17562 if (unlikely(gen->is_running))
17563 return __Pyx_Coroutine_AlreadyRunningError(gen);
17567 if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
17568 int err = __Pyx_Coroutine_CloseIter(gen, yf);
17570 __Pyx_Coroutine_Undelegate(gen);
17572 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
17575 gen->is_running = 1;
17577 #ifdef __Pyx_Generator_USED
17578 || __Pyx_Generator_CheckExact(yf)
17580 #ifdef __Pyx_Coroutine_USED
17581 || __Pyx_Coroutine_Check(yf)
17584 ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
17585 #ifdef __Pyx_Coroutine_USED
17586 } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
17587 ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
17590 PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
17591 if (unlikely(!meth)) {
17593 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
17594 gen->is_running = 0;
17598 __Pyx_Coroutine_Undelegate(gen);
17599 gen->is_running = 0;
17602 if (likely(args)) {
17603 ret = PyObject_CallObject(meth, args);
17605 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
17609 gen->is_running = 0;
17612 ret = __Pyx_Coroutine_FinishDelegation(gen);
17614 return __Pyx_Coroutine_MethodReturn(self, ret);
17617 __Pyx_Raise(typ, val, tb, NULL);
17618 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
17620 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
17622 PyObject *val = NULL;
17623 PyObject *tb = NULL;
17624 if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
17626 return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
17628 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
17629 Py_VISIT(exc_state->exc_type);
17630 Py_VISIT(exc_state->exc_value);
17631 Py_VISIT(exc_state->exc_traceback);
17634 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
17635 Py_VISIT(gen->closure);
17636 Py_VISIT(gen->classobj);
17637 Py_VISIT(gen->yieldfrom);
17638 return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
17640 static int __Pyx_Coroutine_clear(PyObject *self) {
17641 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
17642 Py_CLEAR(gen->closure);
17643 Py_CLEAR(gen->classobj);
17644 Py_CLEAR(gen->yieldfrom);
17645 __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
17646 #ifdef __Pyx_AsyncGen_USED
17647 if (__Pyx_AsyncGen_CheckExact(self)) {
17648 Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
17651 Py_CLEAR(gen->gi_code);
17652 Py_CLEAR(gen->gi_name);
17653 Py_CLEAR(gen->gi_qualname);
17654 Py_CLEAR(gen->gi_modulename);
17657 static void __Pyx_Coroutine_dealloc(PyObject *self) {
17658 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
17659 PyObject_GC_UnTrack(gen);
17660 if (gen->gi_weakreflist != NULL)
17661 PyObject_ClearWeakRefs(self);
17662 if (gen->resume_label >= 0) {
17663 PyObject_GC_Track(self);
17664 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
17665 if (PyObject_CallFinalizerFromDealloc(self))
17667 Py_TYPE(gen)->tp_del(self);
17668 if (self->ob_refcnt > 0)
17673 PyObject_GC_UnTrack(self);
17675 #ifdef __Pyx_AsyncGen_USED
17676 if (__Pyx_AsyncGen_CheckExact(self)) {
17677 /* We have to handle this case for asynchronous generators
17678 right here, because this code has to be between UNTRACK
17680 Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
17683 __Pyx_Coroutine_clear(self);
17684 PyObject_GC_Del(gen);
17686 static void __Pyx_Coroutine_del(PyObject *self) {
17687 PyObject *error_type, *error_value, *error_traceback;
17688 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
17689 __Pyx_PyThreadState_declare
17690 if (gen->resume_label < 0) {
17693 #if !CYTHON_USE_TP_FINALIZE
17694 assert(self->ob_refcnt == 0);
17695 self->ob_refcnt = 1;
17697 __Pyx_PyThreadState_assign
17698 __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
17699 #ifdef __Pyx_AsyncGen_USED
17700 if (__Pyx_AsyncGen_CheckExact(self)) {
17701 __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
17702 PyObject *finalizer = agen->ag_finalizer;
17703 if (finalizer && !agen->ag_closed) {
17704 PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
17705 if (unlikely(!res)) {
17706 PyErr_WriteUnraisable(self);
17710 __Pyx_ErrRestore(error_type, error_value, error_traceback);
17715 if (unlikely(gen->resume_label == 0 && !error_value)) {
17716 #ifdef __Pyx_Coroutine_USED
17717 #ifdef __Pyx_Generator_USED
17718 if (!__Pyx_Generator_CheckExact(self))
17721 PyObject_GC_UnTrack(self);
17722 #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
17723 if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
17724 PyErr_WriteUnraisable(self);
17728 #if CYTHON_COMPILING_IN_PYPY
17730 cmsg = (char*) "coroutine was never awaited";
17733 PyObject *qualname;
17734 qualname = gen->gi_qualname;
17735 cname = PyString_AS_STRING(qualname);
17736 msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
17737 if (unlikely(!msg)) {
17739 cmsg = (char*) "coroutine was never awaited";
17741 cmsg = PyString_AS_STRING(msg);
17744 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
17745 PyErr_WriteUnraisable(self);
17748 PyObject_GC_Track(self);
17752 PyObject *res = __Pyx_Coroutine_Close(self);
17753 if (unlikely(!res)) {
17754 if (PyErr_Occurred())
17755 PyErr_WriteUnraisable(self);
17760 __Pyx_ErrRestore(error_type, error_value, error_traceback);
17761 #if !CYTHON_USE_TP_FINALIZE
17762 assert(self->ob_refcnt > 0);
17763 if (--self->ob_refcnt == 0) {
17767 Py_ssize_t refcnt = self->ob_refcnt;
17768 _Py_NewReference(self);
17769 self->ob_refcnt = refcnt;
17771 #if CYTHON_COMPILING_IN_CPYTHON
17772 assert(PyType_IS_GC(self->ob_type) &&
17773 _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
17776 #ifdef COUNT_ALLOCS
17777 --Py_TYPE(self)->tp_frees;
17778 --Py_TYPE(self)->tp_allocs;
17783 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
17785 PyObject *name = self->gi_name;
17786 if (unlikely(!name)) name = Py_None;
17791 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
17794 #if PY_MAJOR_VERSION >= 3
17795 if (unlikely(value == NULL || !PyUnicode_Check(value)))
17797 if (unlikely(value == NULL || !PyString_Check(value)))
17800 PyErr_SetString(PyExc_TypeError,
17801 "__name__ must be set to a string object");
17804 tmp = self->gi_name;
17806 self->gi_name = value;
17811 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
17813 PyObject *name = self->gi_qualname;
17814 if (unlikely(!name)) name = Py_None;
17819 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
17822 #if PY_MAJOR_VERSION >= 3
17823 if (unlikely(value == NULL || !PyUnicode_Check(value)))
17825 if (unlikely(value == NULL || !PyString_Check(value)))
17828 PyErr_SetString(PyExc_TypeError,
17829 "__qualname__ must be set to a string object");
17832 tmp = self->gi_qualname;
17834 self->gi_qualname = value;
17838 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
17839 PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
17840 PyObject *name, PyObject *qualname, PyObject *module_name) {
17841 __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
17842 if (unlikely(!gen))
17844 return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
17846 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
17847 __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
17848 PyObject *name, PyObject *qualname, PyObject *module_name) {
17850 gen->closure = closure;
17851 Py_XINCREF(closure);
17852 gen->is_running = 0;
17853 gen->resume_label = 0;
17854 gen->classobj = NULL;
17855 gen->yieldfrom = NULL;
17856 gen->gi_exc_state.exc_type = NULL;
17857 gen->gi_exc_state.exc_value = NULL;
17858 gen->gi_exc_state.exc_traceback = NULL;
17859 #if CYTHON_USE_EXC_INFO_STACK
17860 gen->gi_exc_state.previous_item = NULL;
17862 gen->gi_weakreflist = NULL;
17863 Py_XINCREF(qualname);
17864 gen->gi_qualname = qualname;
17866 gen->gi_name = name;
17867 Py_XINCREF(module_name);
17868 gen->gi_modulename = module_name;
17870 gen->gi_code = code;
17871 PyObject_GC_Track(gen);
17875 /* PatchModuleWithCoroutine */
17876 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
17877 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
17879 PyObject *globals, *result_obj;
17880 globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
17881 result = PyDict_SetItemString(globals, "_cython_coroutine_type",
17882 #ifdef __Pyx_Coroutine_USED
17883 (PyObject*)__pyx_CoroutineType);
17887 if (unlikely(result < 0)) goto ignore;
17888 result = PyDict_SetItemString(globals, "_cython_generator_type",
17889 #ifdef __Pyx_Generator_USED
17890 (PyObject*)__pyx_GeneratorType);
17894 if (unlikely(result < 0)) goto ignore;
17895 if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
17896 if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
17897 result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
17898 if (unlikely(!result_obj)) goto ignore;
17899 Py_DECREF(result_obj);
17900 Py_DECREF(globals);
17903 Py_XDECREF(globals);
17904 PyErr_WriteUnraisable(module);
17905 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
17915 /* PatchGeneratorABC */
17916 #ifndef CYTHON_REGISTER_ABCS
17917 #define CYTHON_REGISTER_ABCS 1
17919 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
17920 static PyObject* __Pyx_patch_abc_module(PyObject *module);
17921 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
17922 module = __Pyx_Coroutine_patch_module(
17924 "if _cython_generator_type is not None:\n"
17925 " try: Generator = _module.Generator\n"
17926 " except AttributeError: pass\n"
17927 " else: Generator.register(_cython_generator_type)\n"
17928 "if _cython_coroutine_type is not None:\n"
17929 " try: Coroutine = _module.Coroutine\n"
17930 " except AttributeError: pass\n"
17931 " else: Coroutine.register(_cython_coroutine_type)\n"
17936 static int __Pyx_patch_abc(void) {
17937 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
17938 static int abc_patched = 0;
17939 if (CYTHON_REGISTER_ABCS && !abc_patched) {
17941 module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
17943 PyErr_WriteUnraisable(NULL);
17944 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
17945 ((PY_MAJOR_VERSION >= 3) ?
17946 "Cython module failed to register with collections.abc module" :
17947 "Cython module failed to register with collections module"), 1) < 0)) {
17951 module = __Pyx_patch_abc_module(module);
17953 if (unlikely(!module))
17957 module = PyImport_ImportModule("backports_abc");
17959 module = __Pyx_patch_abc_module(module);
17960 Py_XDECREF(module);
17967 if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
17973 static PyMethodDef __pyx_Generator_methods[] = {
17974 {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
17975 (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
17976 {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
17977 (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
17978 {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
17979 (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
17982 static PyMemberDef __pyx_Generator_memberlist[] = {
17983 {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
17984 {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
17985 (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
17986 {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
17989 static PyGetSetDef __pyx_Generator_getsets[] = {
17990 {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
17991 (char*) PyDoc_STR("name of the generator"), 0},
17992 {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
17993 (char*) PyDoc_STR("qualified name of the generator"), 0},
17996 static PyTypeObject __pyx_GeneratorType_type = {
17997 PyVarObject_HEAD_INIT(0, 0)
17999 sizeof(__pyx_CoroutineObject),
18001 (destructor) __Pyx_Coroutine_dealloc,
18016 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
18018 (traverseproc) __Pyx_Coroutine_traverse,
18021 offsetof(__pyx_CoroutineObject, gi_weakreflist),
18023 (iternextfunc) __Pyx_Generator_Next,
18024 __pyx_Generator_methods,
18025 __pyx_Generator_memberlist,
18026 __pyx_Generator_getsets,
18042 #if CYTHON_USE_TP_FINALIZE
18045 __Pyx_Coroutine_del,
18048 #if CYTHON_USE_TP_FINALIZE
18049 __Pyx_Coroutine_del,
18050 #elif PY_VERSION_HEX >= 0x030400a1
18053 #if PY_VERSION_HEX >= 0x030800b1
18056 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18060 static int __pyx_Generator_init(void) {
18061 __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
18062 __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
18063 __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
18064 if (unlikely(!__pyx_GeneratorType)) {
18070 /* CheckBinaryVersion */
18071 static int __Pyx_check_binary_version(void) {
18072 char ctversion[4], rtversion[4];
18073 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
18074 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
18075 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
18077 PyOS_snprintf(message, sizeof(message),
18078 "compiletime version %s of module '%.100s' "
18079 "does not match runtime version %s",
18080 ctversion, __Pyx_MODULE_NAME, rtversion);
18081 return PyErr_WarnEx(NULL, message, 1);
18087 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
18089 #if PY_MAJOR_VERSION < 3
18090 if (t->is_unicode) {
18091 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
18092 } else if (t->intern) {
18093 *t->p = PyString_InternFromString(t->s);
18095 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
18098 if (t->is_unicode | t->is_str) {
18100 *t->p = PyUnicode_InternFromString(t->s);
18101 } else if (t->encoding) {
18102 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
18104 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
18107 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
18112 if (PyObject_Hash(*t->p) == -1)
18119 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
18120 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
18122 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
18124 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
18126 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
18127 #if !CYTHON_PEP393_ENABLED
18128 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
18130 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
18131 if (!defenc) return NULL;
18132 defenc_c = PyBytes_AS_STRING(defenc);
18133 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
18135 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
18137 for (c = defenc_c; c < end; c++) {
18138 if ((unsigned char) (*c) >= 128) {
18139 PyUnicode_AsASCIIString(o);
18145 *length = PyBytes_GET_SIZE(defenc);
18149 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
18150 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
18151 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
18152 if (likely(PyUnicode_IS_ASCII(o))) {
18153 *length = PyUnicode_GET_LENGTH(o);
18154 return PyUnicode_AsUTF8(o);
18156 PyUnicode_AsASCIIString(o);
18160 return PyUnicode_AsUTF8AndSize(o, length);
18165 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
18166 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
18168 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
18169 __Pyx_sys_getdefaultencoding_not_ascii &&
18171 PyUnicode_Check(o)) {
18172 return __Pyx_PyUnicode_AsStringAndSize(o, length);
18175 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
18176 if (PyByteArray_Check(o)) {
18177 *length = PyByteArray_GET_SIZE(o);
18178 return PyByteArray_AS_STRING(o);
18183 int r = PyBytes_AsStringAndSize(o, &result, length);
18184 if (unlikely(r < 0)) {
18191 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
18192 int is_true = x == Py_True;
18193 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
18194 else return PyObject_IsTrue(x);
18196 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
18198 if (unlikely(!x)) return -1;
18199 retval = __Pyx_PyObject_IsTrue(x);
18203 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
18204 #if PY_MAJOR_VERSION >= 3
18205 if (PyLong_Check(result)) {
18206 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
18207 "__int__ returned non-int (type %.200s). "
18208 "The ability to return an instance of a strict subclass of int "
18209 "is deprecated, and may be removed in a future version of Python.",
18210 Py_TYPE(result)->tp_name)) {
18217 PyErr_Format(PyExc_TypeError,
18218 "__%.4s__ returned non-%.4s (type %.200s)",
18219 type_name, type_name, Py_TYPE(result)->tp_name);
18223 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
18224 #if CYTHON_USE_TYPE_SLOTS
18225 PyNumberMethods *m;
18227 const char *name = NULL;
18228 PyObject *res = NULL;
18229 #if PY_MAJOR_VERSION < 3
18230 if (likely(PyInt_Check(x) || PyLong_Check(x)))
18232 if (likely(PyLong_Check(x)))
18234 return __Pyx_NewRef(x);
18235 #if CYTHON_USE_TYPE_SLOTS
18236 m = Py_TYPE(x)->tp_as_number;
18237 #if PY_MAJOR_VERSION < 3
18238 if (m && m->nb_int) {
18240 res = m->nb_int(x);
18242 else if (m && m->nb_long) {
18244 res = m->nb_long(x);
18247 if (likely(m && m->nb_int)) {
18249 res = m->nb_int(x);
18253 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
18254 res = PyNumber_Int(x);
18258 #if PY_MAJOR_VERSION < 3
18259 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
18261 if (unlikely(!PyLong_CheckExact(res))) {
18263 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
18266 else if (!PyErr_Occurred()) {
18267 PyErr_SetString(PyExc_TypeError,
18268 "an integer is required");
18272 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
18275 #if PY_MAJOR_VERSION < 3
18276 if (likely(PyInt_CheckExact(b))) {
18277 if (sizeof(Py_ssize_t) >= sizeof(long))
18278 return PyInt_AS_LONG(b);
18280 return PyInt_AsSsize_t(b);
18283 if (likely(PyLong_CheckExact(b))) {
18284 #if CYTHON_USE_PYLONG_INTERNALS
18285 const digit* digits = ((PyLongObject*)b)->ob_digit;
18286 const Py_ssize_t size = Py_SIZE(b);
18287 if (likely(__Pyx_sst_abs(size) <= 1)) {
18288 ival = likely(size) ? digits[0] : 0;
18289 if (size == -1) ival = -ival;
18294 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
18295 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
18299 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
18300 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
18304 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
18305 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
18309 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
18310 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
18314 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
18315 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]));
18319 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
18320 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]));
18326 return PyLong_AsSsize_t(b);
18328 x = PyNumber_Index(b);
18330 ival = PyInt_AsSsize_t(x);
18334 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
18335 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
18337 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
18338 return PyInt_FromSize_t(ival);
18342 #endif /* Py_PYTHON_H */