f1611bf8ee626b49f42f6ce252ac10b9fb2c283f
[platform/upstream/python-lxml.git] / src / lxml / _elementpath.c
1 /* Generated by Cython 0.29.18 */
2
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "CYTHON_CLINE_IN_TRACEBACK",
9                 "0"
10             ]
11         ],
12         "extra_compile_args": [
13             "-w"
14         ],
15         "include_dirs": [
16             "/usr/include/libxml2",
17             "src",
18             "src/lxml/includes"
19         ],
20         "name": "lxml._elementpath",
21         "sources": [
22             "src/lxml/_elementpath.py"
23         ]
24     },
25     "module_name": "lxml._elementpath"
26 }
27 END: Cython Metadata */
28
29 #define PY_SSIZE_T_CLEAN
30 #include "Python.h"
31 #ifndef Py_PYTHON_H
32     #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34     #error Cython requires Python 2.6+ or Python 3.3+.
35 #else
36 #define CYTHON_ABI "0_29_18"
37 #define CYTHON_HEX_VERSION 0x001D12F0
38 #define CYTHON_FUTURE_DIVISION 0
39 #include <stddef.h>
40 #ifndef offsetof
41   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
42 #endif
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
44   #ifndef __stdcall
45     #define __stdcall
46   #endif
47   #ifndef __cdecl
48     #define __cdecl
49   #endif
50   #ifndef __fastcall
51     #define __fastcall
52   #endif
53 #endif
54 #ifndef DL_IMPORT
55   #define DL_IMPORT(t) t
56 #endif
57 #ifndef DL_EXPORT
58   #define DL_EXPORT(t) t
59 #endif
60 #define __PYX_COMMA ,
61 #ifndef HAVE_LONG_LONG
62   #if PY_VERSION_HEX >= 0x02070000
63     #define HAVE_LONG_LONG
64   #endif
65 #endif
66 #ifndef PY_LONG_LONG
67   #define PY_LONG_LONG LONG_LONG
68 #endif
69 #ifndef Py_HUGE_VAL
70   #define Py_HUGE_VAL HUGE_VAL
71 #endif
72 #ifdef PYPY_VERSION
73   #define CYTHON_COMPILING_IN_PYPY 1
74   #define CYTHON_COMPILING_IN_PYSTON 0
75   #define CYTHON_COMPILING_IN_CPYTHON 0
76   #undef CYTHON_USE_TYPE_SLOTS
77   #define CYTHON_USE_TYPE_SLOTS 0
78   #undef CYTHON_USE_PYTYPE_LOOKUP
79   #define CYTHON_USE_PYTYPE_LOOKUP 0
80   #if PY_VERSION_HEX < 0x03050000
81     #undef CYTHON_USE_ASYNC_SLOTS
82     #define CYTHON_USE_ASYNC_SLOTS 0
83   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84     #define CYTHON_USE_ASYNC_SLOTS 1
85   #endif
86   #undef CYTHON_USE_PYLIST_INTERNALS
87   #define CYTHON_USE_PYLIST_INTERNALS 0
88   #undef CYTHON_USE_UNICODE_INTERNALS
89   #define CYTHON_USE_UNICODE_INTERNALS 0
90   #undef CYTHON_USE_UNICODE_WRITER
91   #define CYTHON_USE_UNICODE_WRITER 0
92   #undef CYTHON_USE_PYLONG_INTERNALS
93   #define CYTHON_USE_PYLONG_INTERNALS 0
94   #undef CYTHON_AVOID_BORROWED_REFS
95   #define CYTHON_AVOID_BORROWED_REFS 1
96   #undef CYTHON_ASSUME_SAFE_MACROS
97   #define CYTHON_ASSUME_SAFE_MACROS 0
98   #undef CYTHON_UNPACK_METHODS
99   #define CYTHON_UNPACK_METHODS 0
100   #undef CYTHON_FAST_THREAD_STATE
101   #define CYTHON_FAST_THREAD_STATE 0
102   #undef CYTHON_FAST_PYCALL
103   #define CYTHON_FAST_PYCALL 0
104   #undef CYTHON_PEP489_MULTI_PHASE_INIT
105   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106   #undef CYTHON_USE_TP_FINALIZE
107   #define CYTHON_USE_TP_FINALIZE 0
108   #undef CYTHON_USE_DICT_VERSIONS
109   #define CYTHON_USE_DICT_VERSIONS 0
110   #undef CYTHON_USE_EXC_INFO_STACK
111   #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113   #define CYTHON_COMPILING_IN_PYPY 0
114   #define CYTHON_COMPILING_IN_PYSTON 1
115   #define CYTHON_COMPILING_IN_CPYTHON 0
116   #ifndef CYTHON_USE_TYPE_SLOTS
117     #define CYTHON_USE_TYPE_SLOTS 1
118   #endif
119   #undef CYTHON_USE_PYTYPE_LOOKUP
120   #define CYTHON_USE_PYTYPE_LOOKUP 0
121   #undef CYTHON_USE_ASYNC_SLOTS
122   #define CYTHON_USE_ASYNC_SLOTS 0
123   #undef CYTHON_USE_PYLIST_INTERNALS
124   #define CYTHON_USE_PYLIST_INTERNALS 0
125   #ifndef CYTHON_USE_UNICODE_INTERNALS
126     #define CYTHON_USE_UNICODE_INTERNALS 1
127   #endif
128   #undef CYTHON_USE_UNICODE_WRITER
129   #define CYTHON_USE_UNICODE_WRITER 0
130   #undef CYTHON_USE_PYLONG_INTERNALS
131   #define CYTHON_USE_PYLONG_INTERNALS 0
132   #ifndef CYTHON_AVOID_BORROWED_REFS
133     #define CYTHON_AVOID_BORROWED_REFS 0
134   #endif
135   #ifndef CYTHON_ASSUME_SAFE_MACROS
136     #define CYTHON_ASSUME_SAFE_MACROS 1
137   #endif
138   #ifndef CYTHON_UNPACK_METHODS
139     #define CYTHON_UNPACK_METHODS 1
140   #endif
141   #undef CYTHON_FAST_THREAD_STATE
142   #define CYTHON_FAST_THREAD_STATE 0
143   #undef CYTHON_FAST_PYCALL
144   #define CYTHON_FAST_PYCALL 0
145   #undef CYTHON_PEP489_MULTI_PHASE_INIT
146   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147   #undef CYTHON_USE_TP_FINALIZE
148   #define CYTHON_USE_TP_FINALIZE 0
149   #undef CYTHON_USE_DICT_VERSIONS
150   #define CYTHON_USE_DICT_VERSIONS 0
151   #undef CYTHON_USE_EXC_INFO_STACK
152   #define CYTHON_USE_EXC_INFO_STACK 0
153 #else
154   #define CYTHON_COMPILING_IN_PYPY 0
155   #define CYTHON_COMPILING_IN_PYSTON 0
156   #define CYTHON_COMPILING_IN_CPYTHON 1
157   #ifndef CYTHON_USE_TYPE_SLOTS
158     #define CYTHON_USE_TYPE_SLOTS 1
159   #endif
160   #if PY_VERSION_HEX < 0x02070000
161     #undef CYTHON_USE_PYTYPE_LOOKUP
162     #define CYTHON_USE_PYTYPE_LOOKUP 0
163   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164     #define CYTHON_USE_PYTYPE_LOOKUP 1
165   #endif
166   #if PY_MAJOR_VERSION < 3
167     #undef CYTHON_USE_ASYNC_SLOTS
168     #define CYTHON_USE_ASYNC_SLOTS 0
169   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170     #define CYTHON_USE_ASYNC_SLOTS 1
171   #endif
172   #if PY_VERSION_HEX < 0x02070000
173     #undef CYTHON_USE_PYLONG_INTERNALS
174     #define CYTHON_USE_PYLONG_INTERNALS 0
175   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176     #define CYTHON_USE_PYLONG_INTERNALS 1
177   #endif
178   #ifndef CYTHON_USE_PYLIST_INTERNALS
179     #define CYTHON_USE_PYLIST_INTERNALS 1
180   #endif
181   #ifndef CYTHON_USE_UNICODE_INTERNALS
182     #define CYTHON_USE_UNICODE_INTERNALS 1
183   #endif
184   #if PY_VERSION_HEX < 0x030300F0
185     #undef CYTHON_USE_UNICODE_WRITER
186     #define CYTHON_USE_UNICODE_WRITER 0
187   #elif !defined(CYTHON_USE_UNICODE_WRITER)
188     #define CYTHON_USE_UNICODE_WRITER 1
189   #endif
190   #ifndef CYTHON_AVOID_BORROWED_REFS
191     #define CYTHON_AVOID_BORROWED_REFS 0
192   #endif
193   #ifndef CYTHON_ASSUME_SAFE_MACROS
194     #define CYTHON_ASSUME_SAFE_MACROS 1
195   #endif
196   #ifndef CYTHON_UNPACK_METHODS
197     #define CYTHON_UNPACK_METHODS 1
198   #endif
199   #ifndef CYTHON_FAST_THREAD_STATE
200     #define CYTHON_FAST_THREAD_STATE 1
201   #endif
202   #ifndef CYTHON_FAST_PYCALL
203     #define CYTHON_FAST_PYCALL 1
204   #endif
205   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
207   #endif
208   #ifndef CYTHON_USE_TP_FINALIZE
209     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
210   #endif
211   #ifndef CYTHON_USE_DICT_VERSIONS
212     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
213   #endif
214   #ifndef CYTHON_USE_EXC_INFO_STACK
215     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
216   #endif
217 #endif
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
220 #endif
221 #if CYTHON_USE_PYLONG_INTERNALS
222   #include "longintrepr.h"
223   #undef SHIFT
224   #undef BASE
225   #undef MASK
226   #ifdef SIZEOF_VOID_P
227     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
228   #endif
229 #endif
230 #ifndef __has_attribute
231   #define __has_attribute(x) 0
232 #endif
233 #ifndef __has_cpp_attribute
234   #define __has_cpp_attribute(x) 0
235 #endif
236 #ifndef CYTHON_RESTRICT
237   #if defined(__GNUC__)
238     #define CYTHON_RESTRICT __restrict__
239   #elif defined(_MSC_VER) && _MSC_VER >= 1400
240     #define CYTHON_RESTRICT __restrict
241   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242     #define CYTHON_RESTRICT restrict
243   #else
244     #define CYTHON_RESTRICT
245   #endif
246 #endif
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 #     define CYTHON_UNUSED __attribute__ ((__unused__))
251 #   else
252 #     define CYTHON_UNUSED
253 #   endif
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 #   define CYTHON_UNUSED __attribute__ ((__unused__))
256 # else
257 #   define CYTHON_UNUSED
258 # endif
259 #endif
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 #  if defined(__cplusplus)
262      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
263 #  else
264 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
265 #  endif
266 #endif
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 #  define CYTHON_NCP_UNUSED
270 # else
271 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
272 # endif
273 #endif
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
275 #ifdef _MSC_VER
276     #ifndef _MSC_STDINT_H_
277         #if _MSC_VER < 1300
278            typedef unsigned char     uint8_t;
279            typedef unsigned int      uint32_t;
280         #else
281            typedef unsigned __int8   uint8_t;
282            typedef unsigned __int32  uint32_t;
283         #endif
284     #endif
285 #else
286    #include <stdint.h>
287 #endif
288 #ifndef CYTHON_FALLTHROUGH
289   #if defined(__cplusplus) && __cplusplus >= 201103L
290     #if __has_cpp_attribute(fallthrough)
291       #define CYTHON_FALLTHROUGH [[fallthrough]]
292     #elif __has_cpp_attribute(clang::fallthrough)
293       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294     #elif __has_cpp_attribute(gnu::fallthrough)
295       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
296     #endif
297   #endif
298   #ifndef CYTHON_FALLTHROUGH
299     #if __has_attribute(fallthrough)
300       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
301     #else
302       #define CYTHON_FALLTHROUGH
303     #endif
304   #endif
305   #if defined(__clang__ ) && defined(__apple_build_version__)
306     #if __apple_build_version__ < 7000000
307       #undef  CYTHON_FALLTHROUGH
308       #define CYTHON_FALLTHROUGH
309     #endif
310   #endif
311 #endif
312
313 #ifndef CYTHON_INLINE
314   #if defined(__clang__)
315     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
316   #elif defined(__GNUC__)
317     #define CYTHON_INLINE __inline__
318   #elif defined(_MSC_VER)
319     #define CYTHON_INLINE __inline
320   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
321     #define CYTHON_INLINE inline
322   #else
323     #define CYTHON_INLINE
324   #endif
325 #endif
326
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328   #define Py_OptimizeFlag 0
329 #endif
330 #define __PYX_BUILD_PY_SSIZE_T "n"
331 #define CYTHON_FORMAT_SSIZE_T "z"
332 #if PY_MAJOR_VERSION < 3
333   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
334   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
335           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
336   #define __Pyx_DefaultClassType PyClass_Type
337 #else
338   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
339 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
340   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
342 #else
343   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
345 #endif
346   #define __Pyx_DefaultClassType PyType_Type
347 #endif
348 #ifndef Py_TPFLAGS_CHECKTYPES
349   #define Py_TPFLAGS_CHECKTYPES 0
350 #endif
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352   #define Py_TPFLAGS_HAVE_INDEX 0
353 #endif
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
356 #endif
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358   #define Py_TPFLAGS_HAVE_FINALIZE 0
359 #endif
360 #ifndef METH_STACKLESS
361   #define METH_STACKLESS 0
362 #endif
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364   #ifndef METH_FASTCALL
365      #define METH_FASTCALL 0x80
366   #endif
367   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
368   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
369                                                           Py_ssize_t nargs, PyObject *kwnames);
370 #else
371   #define __Pyx_PyCFunctionFast _PyCFunctionFast
372   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
373 #endif
374 #if CYTHON_FAST_PYCCALL
375 #define __Pyx_PyFastCFunction_Check(func)\
376     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
377 #else
378 #define __Pyx_PyFastCFunction_Check(func) 0
379 #endif
380 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
381   #define PyObject_Malloc(s)   PyMem_Malloc(s)
382   #define PyObject_Free(p)     PyMem_Free(p)
383   #define PyObject_Realloc(p)  PyMem_Realloc(p)
384 #endif
385 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
386   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
387   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
388   #define PyMem_RawFree(p)             PyMem_Free(p)
389 #endif
390 #if CYTHON_COMPILING_IN_PYSTON
391   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
392   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
393 #else
394   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
395   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
396 #endif
397 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
398   #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #elif PY_VERSION_HEX >= 0x03060000
400   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
401 #elif PY_VERSION_HEX >= 0x03000000
402   #define __Pyx_PyThreadState_Current PyThreadState_GET()
403 #else
404   #define __Pyx_PyThreadState_Current _PyThreadState_Current
405 #endif
406 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
407 #include "pythread.h"
408 #define Py_tss_NEEDS_INIT 0
409 typedef int Py_tss_t;
410 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
411   *key = PyThread_create_key();
412   return 0;
413 }
414 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
415   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
416   *key = Py_tss_NEEDS_INIT;
417   return key;
418 }
419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
420   PyObject_Free(key);
421 }
422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423   return *key != Py_tss_NEEDS_INIT;
424 }
425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426   PyThread_delete_key(*key);
427   *key = Py_tss_NEEDS_INIT;
428 }
429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430   return PyThread_set_key_value(*key, value);
431 }
432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433   return PyThread_get_key_value(*key);
434 }
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
438 #else
439 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
440 #endif
441 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
442   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
443   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
444 #else
445   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
446   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
447 #endif
448 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
449 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
450 #else
451 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
452 #endif
453 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
454   #define CYTHON_PEP393_ENABLED 1
455   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
456                                               0 : _PyUnicode_Ready((PyObject *)(op)))
457   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
458   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
459   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
460   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
461   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
462   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
463   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
464   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
465 #else
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))
479 #endif
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)
483 #else
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))
487 #endif
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
489   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
490 #endif
491 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
492   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
493 #endif
494 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
495   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
496 #endif
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)
501 #else
502   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
503 #endif
504 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
505   #define PyObject_ASCII(o)            PyObject_Repr(o)
506 #endif
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
515 #endif
516 #endif
517 #if PY_MAJOR_VERSION >= 3
518   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
519   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
520 #else
521   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
522   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
523 #endif
524 #ifndef PySet_CheckExact
525   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
526 #endif
527 #if CYTHON_ASSUME_SAFE_MACROS
528   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
529 #else
530   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
531 #endif
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
548 #endif
549 #if PY_MAJOR_VERSION >= 3
550   #define PyBoolObject                 PyLongObject
551 #endif
552 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
553   #ifndef PyUnicode_InternFromString
554     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
555   #endif
556 #endif
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
561 #else
562   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
563   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
564 #endif
565 #if PY_MAJOR_VERSION >= 3
566   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
567 #else
568   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
569 #endif
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)
574   #else
575     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
576   #endif
577 #else
578   #define __Pyx_PyType_AsAsync(obj) NULL
579 #endif
580 #ifndef __Pyx_PyAsyncMethodsStruct
581     typedef struct {
582         unaryfunc am_await;
583         unaryfunc am_aiter;
584         unaryfunc am_anext;
585     } __Pyx_PyAsyncMethodsStruct;
586 #endif
587
588 #if defined(WIN32) || defined(MS_WINDOWS)
589   #define _USE_MATH_DEFINESg
590 #endif
591 #include <math.h>
592 #ifdef NAN
593 #define __PYX_NAN() ((float) NAN)
594 #else
595 static CYTHON_INLINE float __PYX_NAN() {
596   float value;
597   memset(&value, 0xFF, sizeof(value));
598   return value;
599 }
600 #endif
601 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
602 #define __Pyx_truncl trunc
603 #else
604 #define __Pyx_truncl truncl
605 #endif
606
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; }
611
612 #ifndef __PYX_EXTERN_C
613   #ifdef __cplusplus
614     #define __PYX_EXTERN_C extern "C"
615   #else
616     #define __PYX_EXTERN_C extern
617   #endif
618 #endif
619
620 #define __PYX_HAVE__lxml___elementpath
621 #define __PYX_HAVE_API__lxml___elementpath
622 /* Early includes */
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630
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;
633
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;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656     #include <cstdlib>
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)
668 #else
669     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
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
681 #else
682     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
683     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
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;
703     while (*u_end++) ;
704     return (size_t)(u_end - u - 1);
705 }
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))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
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))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
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) {
734     PyObject* sys;
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");
740     if (!sys) goto bad;
741     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742     Py_DECREF(sys);
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;
748     } else {
749         char ascii_chars[128];
750         int c;
751         for (c = 0; c < 128; c++) {
752             ascii_chars[c] = c;
753         }
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) {
759             PyErr_Format(
760                 PyExc_ValueError,
761                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762                 default_encoding_c);
763             goto bad;
764         }
765         Py_DECREF(ascii_chars_u);
766         Py_DECREF(ascii_chars_b);
767     }
768     Py_DECREF(default_encoding);
769     return 0;
770 bad:
771     Py_XDECREF(default_encoding);
772     Py_XDECREF(ascii_chars_u);
773     Py_XDECREF(ascii_chars_b);
774     return -1;
775 }
776 #endif
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)
779 #else
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) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
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);
798     return 0;
799 bad:
800     Py_XDECREF(default_encoding);
801     return -1;
802 }
803 #endif
804 #endif
805
806
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; }
816
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;
828
829
830 static const char *__pyx_f[] = {
831   "src/lxml/_elementpath.py",
832 };
833
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;
851
852 /* "lxml/_elementpath.py":74
853  *     )
854  * 
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
858  */
859 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer {
860   PyObject_HEAD
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;
870   PyObject *__pyx_t_0;
871   Py_ssize_t __pyx_t_1;
872   PyObject *(*__pyx_t_2)(PyObject *);
873   PyObject *__pyx_t_3;
874   PyObject *__pyx_t_4;
875   PyObject *__pyx_t_5;
876 };
877
878
879 /* "lxml/_elementpath.py":99
880  * 
881  * 
882  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
883  *     tag = token[1]
884  *     def select(result):
885  */
886 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child {
887   PyObject_HEAD
888   PyObject *__pyx_v_tag;
889 };
890
891
892 /* "lxml/_elementpath.py":101
893  * def prepare_child(next, token):
894  *     tag = token[1]
895  *     def select(result):             # <<<<<<<<<<<<<<
896  *         for elem in result:
897  *             for e in elem.iterchildren(tag):
898  */
899 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_2_select {
900   PyObject_HEAD
901   struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child *__pyx_outer_scope;
902   PyObject *__pyx_v_e;
903   PyObject *__pyx_v_elem;
904   PyObject *__pyx_v_result;
905   PyObject *__pyx_t_0;
906   Py_ssize_t __pyx_t_1;
907   PyObject *(*__pyx_t_2)(PyObject *);
908   PyObject *__pyx_t_3;
909   Py_ssize_t __pyx_t_4;
910   PyObject *(*__pyx_t_5)(PyObject *);
911 };
912
913
914 /* "lxml/_elementpath.py":108
915  * 
916  * def prepare_star(next, token):
917  *     def select(result):             # <<<<<<<<<<<<<<
918  *         for elem in result:
919  *             for e in elem.iterchildren('*'):
920  */
921 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_3_select {
922   PyObject_HEAD
923   PyObject *__pyx_v_e;
924   PyObject *__pyx_v_elem;
925   PyObject *__pyx_v_result;
926   PyObject *__pyx_t_0;
927   Py_ssize_t __pyx_t_1;
928   PyObject *(*__pyx_t_2)(PyObject *);
929   PyObject *__pyx_t_3;
930   Py_ssize_t __pyx_t_4;
931   PyObject *(*__pyx_t_5)(PyObject *);
932 };
933
934
935 /* "lxml/_elementpath.py":119
936  *     return select
937  * 
938  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
939  *     token = next()
940  *     if token[0] == "*":
941  */
942 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant {
943   PyObject_HEAD
944   PyObject *__pyx_v_tag;
945 };
946
947
948 /* "lxml/_elementpath.py":127
949  *     else:
950  *         raise SyntaxError("invalid descendant")
951  *     def select(result):             # <<<<<<<<<<<<<<
952  *         for elem in result:
953  *             for e in elem.iterdescendants(tag):
954  */
955 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_5_select {
956   PyObject_HEAD
957   struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant *__pyx_outer_scope;
958   PyObject *__pyx_v_e;
959   PyObject *__pyx_v_elem;
960   PyObject *__pyx_v_result;
961   PyObject *__pyx_t_0;
962   Py_ssize_t __pyx_t_1;
963   PyObject *(*__pyx_t_2)(PyObject *);
964   PyObject *__pyx_t_3;
965   Py_ssize_t __pyx_t_4;
966   PyObject *(*__pyx_t_5)(PyObject *);
967 };
968
969
970 /* "lxml/_elementpath.py":134
971  * 
972  * def prepare_parent(next, token):
973  *     def select(result):             # <<<<<<<<<<<<<<
974  *         for elem in result:
975  *             parent = elem.getparent()
976  */
977 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_6_select {
978   PyObject_HEAD
979   PyObject *__pyx_v_elem;
980   PyObject *__pyx_v_parent;
981   PyObject *__pyx_v_result;
982   PyObject *__pyx_t_0;
983   Py_ssize_t __pyx_t_1;
984   PyObject *(*__pyx_t_2)(PyObject *);
985 };
986
987
988 /* "lxml/_elementpath.py":141
989  *     return select
990  * 
991  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
992  *     # FIXME: replace with real parser!!! refs:
993  *     # http://effbot.org/zone/simple-iterator-parser.htm
994  */
995 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate {
996   PyObject_HEAD
997   PyObject *__pyx_v_index;
998   PyObject *__pyx_v_key;
999   PyObject *__pyx_v_tag;
1000   PyObject *__pyx_v_value;
1001 };
1002
1003
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:
1010  */
1011 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_8_select {
1012   PyObject_HEAD
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 *);
1019 };
1020
1021
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:
1028  */
1029 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_9_select {
1030   PyObject_HEAD
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 *);
1037 };
1038
1039
1040 /* "lxml/_elementpath.py":180
1041  *         # [tag]
1042  *         tag = predicate[0]
1043  *         def select(result):             # <<<<<<<<<<<<<<
1044  *             for elem in result:
1045  *                 for _ in elem.iterchildren(tag):
1046  */
1047 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_10_select {
1048   PyObject_HEAD
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 *);
1059 };
1060
1061
1062 /* "lxml/_elementpath.py":191
1063  *         value = predicate[-1]
1064  *         if tag:
1065  *             def select(result):             # <<<<<<<<<<<<<<
1066  *                 for elem in result:
1067  *                     for e in elem.iterchildren(tag):
1068  */
1069 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_11_select {
1070   PyObject_HEAD
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 *);
1081 };
1082
1083
1084 /* "lxml/_elementpath.py":198
1085  *                             break
1086  *         else:
1087  *             def select(result):             # <<<<<<<<<<<<<<
1088  *                 for elem in result:
1089  *                     if "".join(elem.itertext()) == value:
1090  */
1091 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_12_select {
1092   PyObject_HEAD
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 *);
1099 };
1100
1101
1102 /* "lxml/_elementpath.py":224
1103  *             else:
1104  *                 index = -1
1105  *         def select(result):             # <<<<<<<<<<<<<<
1106  *             for elem in result:
1107  *                 parent = elem.getparent()
1108  */
1109 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_13_select {
1110   PyObject_HEAD
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;
1122 };
1123
1124
1125 /* "lxml/_elementpath.py":254
1126  * 
1127  * 
1128  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
1129  *     """compile selector pattern"""
1130  *     if path[-1:] == "/":
1131  */
1132 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator {
1133   PyObject_HEAD
1134   PyObject *__pyx_v_namespaces;
1135 };
1136
1137
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))             # <<<<<<<<<<<<<<
1142  *         else:
1143  *             cache_key += tuple(sorted(namespaces.items()))
1144  */
1145 struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_15_genexpr {
1146   PyObject_HEAD
1147   struct __pyx_obj_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator *__pyx_outer_scope;
1148   PyObject *__pyx_v_item;
1149 };
1150
1151
1152 /* --- Runtime support code (head) --- */
1153 /* Refnanny.proto */
1154 #ifndef CYTHON_REFNANNY
1155   #define CYTHON_REFNANNY 0
1156 #endif
1157 #if CYTHON_REFNANNY
1158   typedef struct {
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;
1169 #ifdef WITH_THREAD
1170   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1171           if (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);\
1175           } else {\
1176               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1177           }
1178 #else
1179   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1180           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1181 #endif
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)
1192 #else
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)
1204 #endif
1205 #define __Pyx_XDECREF_SET(r, v) do {\
1206         PyObject *tmp = (PyObject *) r;\
1207         r = v; __Pyx_XDECREF(tmp);\
1208     } while (0)
1209 #define __Pyx_DECREF_SET(r, v) do {\
1210         PyObject *tmp = (PyObject *) r;\
1211         r = v; __Pyx_DECREF(tmp);\
1212     } while (0)
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)
1215
1216 /* PyObjectGetAttrStr.proto */
1217 #if CYTHON_USE_TYPE_SLOTS
1218 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1219 #else
1220 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1221 #endif
1222
1223 /* GetBuiltinName.proto */
1224 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1225
1226 /* RaiseDoubleKeywords.proto */
1227 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1228
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);
1233
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);
1237
1238 /* PyCFunctionFastCall.proto */
1239 #if CYTHON_FAST_PYCCALL
1240 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1241 #else
1242 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1243 #endif
1244
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);
1251 #else
1252 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1253 #endif
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)
1258 #endif
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))
1266 #endif
1267
1268 /* PyObjectCall.proto */
1269 #if CYTHON_COMPILING_IN_CPYTHON
1270 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1271 #else
1272 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1273 #endif
1274
1275 /* PyObjectCall2Args.proto */
1276 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1277
1278 /* PyObjectCallMethO.proto */
1279 #if CYTHON_COMPILING_IN_CPYTHON
1280 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1281 #endif
1282
1283 /* PyObjectCallOneArg.proto */
1284 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1285
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;\
1298     } else {\
1299         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1300         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1301     }\
1302 }
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);
1306 #else
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);
1310 #endif
1311
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);\
1320 }
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);\
1325 }
1326 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1327 #else
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);
1331 #endif
1332
1333 /* RaiseTooManyValuesToUnpack.proto */
1334 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1335
1336 /* RaiseNeedMoreValuesToUnpack.proto */
1337 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1338
1339 /* IterFinish.proto */
1340 static CYTHON_INLINE int __Pyx_IterFinish(void);
1341
1342 /* UnpackItemEndCheck.proto */
1343 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1344
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);
1366
1367 /* IncludeStringH.proto */
1368 #include <string.h>
1369
1370 /* BytesEquals.proto */
1371 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1372
1373 /* UnicodeEquals.proto */
1374 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1375
1376 /* StrEquals.proto */
1377 #if PY_MAJOR_VERSION >= 3
1378 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1379 #else
1380 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1381 #endif
1382
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));
1387 }
1388
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
1394 #else
1395 #define __Pyx_PyThreadState_declare
1396 #define __Pyx_PyThreadState_assign
1397 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1398 #endif
1399
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))
1411 #else
1412 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1413 #endif
1414 #else
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)
1423 #endif
1424
1425 /* RaiseException.proto */
1426 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1427
1428 /* ObjectGetItem.proto */
1429 #if CYTHON_USE_TYPE_SLOTS
1430 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1431 #else
1432 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1433 #endif
1434
1435 /* GetTopmostException.proto */
1436 #if CYTHON_USE_EXC_INFO_STACK
1437 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1438 #endif
1439
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);
1446 #else
1447 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1448 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1449 #endif
1450
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);
1455 #else
1456 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1457 #endif
1458
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);
1463 #else
1464 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1465 #endif
1466
1467 /* None.proto */
1468 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1469
1470 /* FetchCommonType.proto */
1471 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1472
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)
1486 typedef struct {
1487     PyCFunctionObject func;
1488 #if PY_VERSION_HEX < 0x030500A0
1489     PyObject *func_weakreflist;
1490 #endif
1491     PyObject *func_dict;
1492     PyObject *func_name;
1493     PyObject *func_qualname;
1494     PyObject *func_doc;
1495     PyObject *func_globals;
1496     PyObject *func_code;
1497     PyObject *func_closure;
1498     PyObject *func_classobj;
1499     void *defaults;
1500     int defaults_pyobjects;
1501     size_t defaults_size;  // used by FusedFunction for copying defaults
1502     int flags;
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,
1512                                       PyObject *self,
1513                                       PyObject *module, PyObject *globals,
1514                                       PyObject* code);
1515 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1516                                                          size_t size,
1517                                                          int pyobjects);
1518 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1519                                                             PyObject *tuple);
1520 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1521                                                              PyObject *dict);
1522 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1523                                                               PyObject *dict);
1524 static int __pyx_CyFunction_init(void);
1525
1526 /* CythonFunction.proto */
1527 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1528                                       int flags, PyObject* qualname,
1529                                       PyObject *closure,
1530                                       PyObject *module, PyObject *globals,
1531                                       PyObject* code);
1532
1533 /* PyObjectCallNoArg.proto */
1534 #if CYTHON_COMPILING_IN_CPYTHON
1535 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1536 #else
1537 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1538 #endif
1539
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))
1544 #else
1545 #define __Pyx_PyString_Join PyUnicode_Join
1546 #define __Pyx_PyBaseString_Join PyUnicode_Join
1547 #endif
1548 #if CYTHON_COMPILING_IN_CPYTHON
1549     #if PY_MAJOR_VERSION < 3
1550     #define __Pyx_PyBytes_Join _PyString_Join
1551     #else
1552     #define __Pyx_PyBytes_Join _PyBytes_Join
1553     #endif
1554 #else
1555 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
1556 #endif
1557
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);
1563
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))) {
1570         Py_INCREF(x);
1571         PyList_SET_ITEM(list, len, x);
1572         Py_SIZE(list) = len+1;
1573         return 0;
1574     }
1575     return PyList_Append(list, x);
1576 }
1577 #else
1578 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1579 #endif
1580
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);
1584 #else
1585 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
1586     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1587 #endif
1588
1589 /* PyIntCompare.proto */
1590 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1591
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)) {
1598         Py_INCREF(x);
1599         PyList_SET_ITEM(list, len, x);
1600         Py_SIZE(list) = len+1;
1601         return 0;
1602     }
1603     return PyList_Append(list, x);
1604 }
1605 #else
1606 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1607 #endif
1608
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))
1615 #else
1616 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1617 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1618 #endif
1619
1620 /* IterNext.proto */
1621 #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
1622 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
1623
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);
1627 #else
1628 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1629 #endif
1630
1631 /* Import.proto */
1632 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1633
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);
1638 #else
1639 #define __Pyx_RegisterCleanup() (0)
1640 #endif
1641
1642 /* CLineInTraceback.proto */
1643 #ifdef CYTHON_CLINE_IN_TRACEBACK
1644 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1645 #else
1646 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1647 #endif
1648
1649 /* CodeObjectCache.proto */
1650 typedef struct {
1651     PyCodeObject* code_object;
1652     int code_line;
1653 } __Pyx_CodeObjectCacheEntry;
1654 struct __Pyx_CodeObjectCache {
1655     int count;
1656     int max_count;
1657     __Pyx_CodeObjectCacheEntry* entries;
1658 };
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);
1663
1664 /* AddTraceback.proto */
1665 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1666                                int py_line, const char *filename);
1667
1668 /* CIntToPy.proto */
1669 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1670
1671 /* CIntFromPy.proto */
1672 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1673
1674 /* CIntFromPy.proto */
1675 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1676
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);
1683 #else
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))
1687 #endif
1688 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1689
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);
1694 #else
1695 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1696 #endif
1697
1698 /* PyObjectGetMethod.proto */
1699 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1700
1701 /* PyObjectCallMethod1.proto */
1702 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1703
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
1708 #else
1709 typedef struct {
1710     PyObject *exc_type;
1711     PyObject *exc_value;
1712     PyObject *exc_traceback;
1713 } __Pyx_ExcInfoStruct;
1714 #endif
1715 typedef struct {
1716     PyObject_HEAD
1717     __pyx_coroutine_body_t body;
1718     PyObject *closure;
1719     __Pyx_ExcInfoStruct gi_exc_state;
1720     PyObject *gi_weakreflist;
1721     PyObject *classobj;
1722     PyObject *yieldfrom;
1723     PyObject *gi_name;
1724     PyObject *gi_qualname;
1725     PyObject *gi_modulename;
1726     PyObject *gi_code;
1727     int resume_label;
1728     char is_running;
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)
1744 #else
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);\
1748     }
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;\
1752     }
1753 #endif
1754 #if CYTHON_FAST_THREAD_STATE
1755 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1756     __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
1757 #else
1758 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1759     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
1760 #endif
1761 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
1762 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
1763
1764 /* PatchModuleWithCoroutine.proto */
1765 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
1766
1767 /* PatchGeneratorABC.proto */
1768 static int __Pyx_patch_abc(void);
1769
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);
1778
1779 /* CheckBinaryVersion.proto */
1780 static int __Pyx_check_binary_version(void);
1781
1782 /* InitStrings.proto */
1783 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1784
1785
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;
1806
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;
2161 /* Late includes */
2162 static PyObject *__pyx_gb_4lxml_12_elementpath_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
2163
2164 /* "lxml/_elementpath.py":74
2165  *     )
2166  * 
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
2170  */
2171
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);
2184   {
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)) {
2189       Py_ssize_t kw_args;
2190       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2191       switch (pos_args) {
2192         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2193         CYTHON_FALLTHROUGH;
2194         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2195         CYTHON_FALLTHROUGH;
2196         case  0: break;
2197         default: goto __pyx_L5_argtuple_error;
2198       }
2199       kw_args = PyDict_Size(__pyx_kwds);
2200       switch (pos_args) {
2201         case  0:
2202         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern)) != 0)) kw_args--;
2203         else goto __pyx_L5_argtuple_error;
2204         CYTHON_FALLTHROUGH;
2205         case  1:
2206         if (kw_args > 0) {
2207           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
2208           if (value) { values[1] = value; kw_args--; }
2209         }
2210       }
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)
2213       }
2214     } else {
2215       switch (PyTuple_GET_SIZE(__pyx_args)) {
2216         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2217         CYTHON_FALLTHROUGH;
2218         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2219         break;
2220         default: goto __pyx_L5_argtuple_error;
2221       }
2222     }
2223     __pyx_v_pattern = values[0];
2224     __pyx_v_namespaces = values[1];
2225   }
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)
2229   __pyx_L3_error:;
2230   __Pyx_AddTraceback("lxml._elementpath.xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
2231   __Pyx_RefNannyFinishContext();
2232   return NULL;
2233   __pyx_L4_argument_unpacking_done:;
2234   __pyx_r = __pyx_pf_4lxml_12_elementpath_xpath_tokenizer(__pyx_self, __pyx_v_pattern, __pyx_v_namespaces);
2235
2236   /* function exit code */
2237   __Pyx_RefNannyFinishContext();
2238   return __pyx_r;
2239 }
2240
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)
2254   } else {
2255     __Pyx_GOTREF(__pyx_cur_scope);
2256   }
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);
2263   {
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;
2268   }
2269
2270   /* function exit code */
2271   __pyx_L1_error:;
2272   __Pyx_AddTraceback("lxml._elementpath.xpath_tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename);
2273   __pyx_r = NULL;
2274   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2275   __Pyx_XGIVEREF(__pyx_r);
2276   __Pyx_RefNannyFinishContext();
2277   return __pyx_r;
2278 }
2279
2280 static PyObject *__pyx_gb_4lxml_12_elementpath_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
2281 {
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;
2285   int __pyx_t_2;
2286   PyObject *__pyx_t_3 = NULL;
2287   PyObject *__pyx_t_4 = NULL;
2288   PyObject *__pyx_t_5 = NULL;
2289   PyObject *__pyx_t_6 = NULL;
2290   int __pyx_t_7;
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;
2297   int __pyx_t_14;
2298   PyObject *__pyx_t_15 = NULL;
2299   int __pyx_t_16;
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();
2313     return NULL;
2314   }
2315   __pyx_L3_first_run:;
2316   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 74, __pyx_L1_error)
2317
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):
2324  */
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)
2326   if (__pyx_t_2) {
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);
2329     __pyx_t_6 = NULL;
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);
2337       }
2338     }
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)
2345     if (!__pyx_t_7) {
2346       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2347     } else {
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;
2352     }
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);
2355     __pyx_t_6 = NULL;
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);
2363       }
2364     }
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;
2375     __pyx_t_3 = 0;
2376   } else {
2377     __Pyx_INCREF(Py_None);
2378     __pyx_t_1 = Py_None;
2379   }
2380   __Pyx_GIVEREF(__pyx_t_1);
2381   __pyx_cur_scope->__pyx_v_default_namespace = __pyx_t_1;
2382   __pyx_t_1 = 0;
2383
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
2390  */
2391   __Pyx_INCREF(Py_False);
2392   __Pyx_GIVEREF(Py_False);
2393   __pyx_cur_scope->__pyx_v_parsing_attribute = Py_False;
2394
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] != "{":
2401  */
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;
2407   __pyx_t_3 = NULL;
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);
2415     }
2416   }
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;
2424     __pyx_t_9 = NULL;
2425   } else {
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)
2429   }
2430   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2431   for (;;) {
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)
2437         #else
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);
2440         #endif
2441       } else {
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)
2445         #else
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);
2448         #endif
2449       }
2450     } else {
2451       __pyx_t_1 = __pyx_t_9(__pyx_t_4);
2452       if (unlikely(!__pyx_t_1)) {
2453         PyObject* exc_type = PyErr_Occurred();
2454         if (exc_type) {
2455           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2456           else __PYX_ERR(0, 78, __pyx_L1_error)
2457         }
2458         break;
2459       }
2460       __Pyx_GOTREF(__pyx_t_1);
2461     }
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);
2465     __pyx_t_1 = 0;
2466
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] != "{":
2472  *             if ":" in tag:
2473  */
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)
2481       }
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); 
2486       } else {
2487         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
2488         __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
2489       }
2490       __Pyx_INCREF(__pyx_t_1);
2491       __Pyx_INCREF(__pyx_t_3);
2492       #else
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);
2497       #endif
2498     } else {
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)
2508       __pyx_t_10 = NULL;
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;
2513       __pyx_t_10 = NULL;
2514       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2515       __PYX_ERR(0, 79, __pyx_L1_error)
2516       __pyx_L9_unpacking_done:;
2517     }
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);
2521     __pyx_t_1 = 0;
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);
2525     __pyx_t_3 = 0;
2526
2527     /* "lxml/_elementpath.py":80
2528  *     for token in xpath_tokenizer_re.findall(pattern):
2529  *         ttype, tag = token
2530  *         if tag and tag[0] != "{":             # <<<<<<<<<<<<<<
2531  *             if ":" in tag:
2532  *                 prefix, uri = tag.split(":", 1)
2533  */
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)
2535     if (__pyx_t_7) {
2536     } else {
2537       __pyx_t_2 = __pyx_t_7;
2538       goto __pyx_L11_bool_binop_done;
2539     }
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:;
2546     if (__pyx_t_2) {
2547
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)
2553  *                 try:
2554  */
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);
2557       if (__pyx_t_7) {
2558
2559         /* "lxml/_elementpath.py":82
2560  *         if tag and tag[0] != "{":
2561  *             if ":" in tag:
2562  *                 prefix, uri = tag.split(":", 1)             # <<<<<<<<<<<<<<
2563  *                 try:
2564  *                     if not namespaces:
2565  */
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)
2578           }
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); 
2583           } else {
2584             __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
2585             __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
2586           }
2587           __Pyx_INCREF(__pyx_t_3);
2588           __Pyx_INCREF(__pyx_t_5);
2589           #else
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);
2594           #endif
2595           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2596         } else {
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)
2607           __pyx_t_10 = NULL;
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;
2612           __pyx_t_10 = NULL;
2613           if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2614           __PYX_ERR(0, 82, __pyx_L1_error)
2615           __pyx_L15_unpacking_done:;
2616         }
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);
2620         __pyx_t_3 = 0;
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);
2624         __pyx_t_5 = 0;
2625
2626         /* "lxml/_elementpath.py":83
2627  *             if ":" in tag:
2628  *                 prefix, uri = tag.split(":", 1)
2629  *                 try:             # <<<<<<<<<<<<<<
2630  *                     if not namespaces:
2631  *                         raise KeyError
2632  */
2633         {
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);
2638           /*try:*/ {
2639
2640             /* "lxml/_elementpath.py":84
2641  *                 prefix, uri = tag.split(":", 1)
2642  *                 try:
2643  *                     if not namespaces:             # <<<<<<<<<<<<<<
2644  *                         raise KeyError
2645  *                     yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2646  */
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)) {
2650
2651               /* "lxml/_elementpath.py":85
2652  *                 try:
2653  *                     if not namespaces:
2654  *                         raise KeyError             # <<<<<<<<<<<<<<
2655  *                     yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2656  *                 except KeyError:
2657  */
2658               __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0);
2659               __PYX_ERR(0, 85, __pyx_L16_error)
2660
2661               /* "lxml/_elementpath.py":84
2662  *                 prefix, uri = tag.split(":", 1)
2663  *                 try:
2664  *                     if not namespaces:             # <<<<<<<<<<<<<<
2665  *                         raise KeyError
2666  *                     yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2667  */
2668             }
2669
2670             /* "lxml/_elementpath.py":86
2671  *                     if not namespaces:
2672  *                         raise KeyError
2673  *                     yield ttype, "{%s}%s" % (namespaces[prefix], uri)             # <<<<<<<<<<<<<<
2674  *                 except KeyError:
2675  *                     raise SyntaxError("prefix %r not found in prefix map" % prefix)
2676  */
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);
2686             __pyx_t_1 = 0;
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);
2697             __pyx_t_1 = 0;
2698             __pyx_r = __pyx_t_5;
2699             __pyx_t_5 = 0;
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;
2715             return __pyx_r;
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)
2732
2733             /* "lxml/_elementpath.py":83
2734  *             if ":" in tag:
2735  *                 prefix, uri = tag.split(":", 1)
2736  *                 try:             # <<<<<<<<<<<<<<
2737  *                     if not namespaces:
2738  *                         raise KeyError
2739  */
2740           }
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;
2745           __pyx_L16_error:;
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;
2750
2751           /* "lxml/_elementpath.py":87
2752  *                         raise KeyError
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:
2757  */
2758           __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
2759           if (__pyx_t_14) {
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);
2765
2766             /* "lxml/_elementpath.py":88
2767  *                     yield ttype, "{%s}%s" % (namespaces[prefix], uri)
2768  *                 except KeyError:
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)
2772  */
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)
2781           }
2782           goto __pyx_L18_except_error;
2783           __pyx_L18_except_error:;
2784
2785           /* "lxml/_elementpath.py":83
2786  *             if ":" in tag:
2787  *                 prefix, uri = tag.split(":", 1)
2788  *                 try:             # <<<<<<<<<<<<<<
2789  *                     if not namespaces:
2790  *                         raise KeyError
2791  */
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;
2797           __pyx_L23_try_end:;
2798         }
2799
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)
2805  *                 try:
2806  */
2807         goto __pyx_L13;
2808       }
2809
2810       /* "lxml/_elementpath.py":89
2811  *                 except KeyError:
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)
2815  *             else:
2816  */
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)
2818       if (__pyx_t_7) {
2819       } else {
2820         __pyx_t_2 = __pyx_t_7;
2821         goto __pyx_L28_bool_binop_done;
2822       }
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:;
2827       if (__pyx_t_2) {
2828
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)             # <<<<<<<<<<<<<<
2833  *             else:
2834  *                 yield token
2835  */
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);
2854         __pyx_t_1 = 0;
2855         __pyx_r = __pyx_t_3;
2856         __pyx_t_3 = 0;
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;
2866         return __pyx_r;
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)
2874
2875         /* "lxml/_elementpath.py":89
2876  *                 except KeyError:
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)
2880  *             else:
2881  */
2882         goto __pyx_L13;
2883       }
2884
2885       /* "lxml/_elementpath.py":92
2886  *                 yield ttype, "{%s}%s" % (default_namespace, tag)
2887  *             else:
2888  *                 yield token             # <<<<<<<<<<<<<<
2889  *             parsing_attribute = False
2890  *         else:
2891  */
2892       /*else*/ {
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;
2904         return __pyx_r;
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)
2912       }
2913       __pyx_L13:;
2914
2915       /* "lxml/_elementpath.py":93
2916  *             else:
2917  *                 yield token
2918  *             parsing_attribute = False             # <<<<<<<<<<<<<<
2919  *         else:
2920  *             yield token
2921  */
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);
2926
2927       /* "lxml/_elementpath.py":80
2928  *     for token in xpath_tokenizer_re.findall(pattern):
2929  *         ttype, tag = token
2930  *         if tag and tag[0] != "{":             # <<<<<<<<<<<<<<
2931  *             if ":" in tag:
2932  *                 prefix, uri = tag.split(":", 1)
2933  */
2934       goto __pyx_L10;
2935     }
2936
2937     /* "lxml/_elementpath.py":95
2938  *             parsing_attribute = False
2939  *         else:
2940  *             yield token             # <<<<<<<<<<<<<<
2941  *             parsing_attribute = ttype == '@'
2942  * 
2943  */
2944     /*else*/ {
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;
2956       return __pyx_r;
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)
2964
2965       /* "lxml/_elementpath.py":96
2966  *         else:
2967  *             yield token
2968  *             parsing_attribute = ttype == '@'             # <<<<<<<<<<<<<<
2969  * 
2970  * 
2971  */
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);
2976       __pyx_t_3 = 0;
2977     }
2978     __pyx_L10:;
2979
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] != "{":
2986  */
2987   }
2988   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2989   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
2990
2991   /* "lxml/_elementpath.py":74
2992  *     )
2993  * 
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
2997  */
2998
2999   /* function exit code */
3000   PyErr_SetNone(PyExc_StopIteration);
3001   goto __pyx_L0;
3002   __pyx_L1_error:;
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);
3010   __pyx_L0:;
3011   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3012   #if !CYTHON_USE_EXC_INFO_STACK
3013   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3014   #endif
3015   __pyx_generator->resume_label = -1;
3016   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3017   __Pyx_RefNannyFinishContext();
3018   return __pyx_r;
3019 }
3020
3021 /* "lxml/_elementpath.py":99
3022  * 
3023  * 
3024  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
3025  *     tag = token[1]
3026  *     def select(result):
3027  */
3028
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);
3041   {
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)) {
3045       Py_ssize_t kw_args;
3046       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3047       switch (pos_args) {
3048         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3049         CYTHON_FALLTHROUGH;
3050         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3051         CYTHON_FALLTHROUGH;
3052         case  0: break;
3053         default: goto __pyx_L5_argtuple_error;
3054       }
3055       kw_args = PyDict_Size(__pyx_kwds);
3056       switch (pos_args) {
3057         case  0:
3058         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3059         else goto __pyx_L5_argtuple_error;
3060         CYTHON_FALLTHROUGH;
3061         case  1:
3062         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3063         else {
3064           __Pyx_RaiseArgtupleInvalid("prepare_child", 1, 2, 2, 1); __PYX_ERR(0, 99, __pyx_L3_error)
3065         }
3066       }
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)
3069       }
3070     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3071       goto __pyx_L5_argtuple_error;
3072     } else {
3073       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3074       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3075     }
3076     __pyx_v_next = values[0];
3077     __pyx_v_token = values[1];
3078   }
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)
3082   __pyx_L3_error:;
3083   __Pyx_AddTraceback("lxml._elementpath.prepare_child", __pyx_clineno, __pyx_lineno, __pyx_filename);
3084   __Pyx_RefNannyFinishContext();
3085   return NULL;
3086   __pyx_L4_argument_unpacking_done:;
3087   __pyx_r = __pyx_pf_4lxml_12_elementpath_3prepare_child(__pyx_self, __pyx_v_next, __pyx_v_token);
3088
3089   /* function exit code */
3090   __Pyx_RefNannyFinishContext();
3091   return __pyx_r;
3092 }
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 */
3094
3095 /* "lxml/_elementpath.py":101
3096  * def prepare_child(next, token):
3097  *     tag = token[1]
3098  *     def select(result):             # <<<<<<<<<<<<<<
3099  *         for elem in result:
3100  *             for e in elem.iterchildren(tag):
3101  */
3102
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));
3111
3112   /* function exit code */
3113   __Pyx_RefNannyFinishContext();
3114   return __pyx_r;
3115 }
3116
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)
3130   } else {
3131     __Pyx_GOTREF(__pyx_cur_scope);
3132   }
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);
3139   {
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;
3144   }
3145
3146   /* function exit code */
3147   __pyx_L1_error:;
3148   __Pyx_AddTraceback("lxml._elementpath.prepare_child.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3149   __pyx_r = NULL;
3150   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3151   __Pyx_XGIVEREF(__pyx_r);
3152   __Pyx_RefNannyFinishContext();
3153   return __pyx_r;
3154 }
3155
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 */
3157 {
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();
3178     return NULL;
3179   }
3180   __pyx_L3_first_run:;
3181   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 101, __pyx_L1_error)
3182
3183   /* "lxml/_elementpath.py":102
3184  *     tag = token[1]
3185  *     def select(result):
3186  *         for elem in result:             # <<<<<<<<<<<<<<
3187  *             for e in elem.iterchildren(tag):
3188  *                 yield e
3189  */
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;
3192     __pyx_t_3 = NULL;
3193   } else {
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)
3197   }
3198   for (;;) {
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)
3204         #else
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);
3207         #endif
3208       } else {
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)
3212         #else
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);
3215         #endif
3216       }
3217     } else {
3218       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
3219       if (unlikely(!__pyx_t_4)) {
3220         PyObject* exc_type = PyErr_Occurred();
3221         if (exc_type) {
3222           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3223           else __PYX_ERR(0, 102, __pyx_L1_error)
3224         }
3225         break;
3226       }
3227       __Pyx_GOTREF(__pyx_t_4);
3228     }
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);
3232     __pyx_t_4 = 0;
3233
3234     /* "lxml/_elementpath.py":103
3235  *     def select(result):
3236  *         for elem in result:
3237  *             for e in elem.iterchildren(tag):             # <<<<<<<<<<<<<<
3238  *                 yield e
3239  *     return select
3240  */
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) }
3244     __pyx_t_6 = NULL;
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);
3252       }
3253     }
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;
3261       __pyx_t_8 = NULL;
3262     } else {
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)
3266     }
3267     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3268     for (;;) {
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)
3274           #else
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);
3277           #endif
3278         } else {
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)
3282           #else
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);
3285           #endif
3286         }
3287       } else {
3288         __pyx_t_4 = __pyx_t_8(__pyx_t_5);
3289         if (unlikely(!__pyx_t_4)) {
3290           PyObject* exc_type = PyErr_Occurred();
3291           if (exc_type) {
3292             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3293             else __PYX_ERR(0, 103, __pyx_L1_error)
3294           }
3295           break;
3296         }
3297         __Pyx_GOTREF(__pyx_t_4);
3298       }
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);
3302       __pyx_t_4 = 0;
3303
3304       /* "lxml/_elementpath.py":104
3305  *         for elem in result:
3306  *             for e in elem.iterchildren(tag):
3307  *                 yield e             # <<<<<<<<<<<<<<
3308  *     return select
3309  * 
3310  */
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;
3326       return __pyx_r;
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)
3339
3340       /* "lxml/_elementpath.py":103
3341  *     def select(result):
3342  *         for elem in result:
3343  *             for e in elem.iterchildren(tag):             # <<<<<<<<<<<<<<
3344  *                 yield e
3345  *     return select
3346  */
3347     }
3348     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3349
3350     /* "lxml/_elementpath.py":102
3351  *     tag = token[1]
3352  *     def select(result):
3353  *         for elem in result:             # <<<<<<<<<<<<<<
3354  *             for e in elem.iterchildren(tag):
3355  *                 yield e
3356  */
3357   }
3358   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3359   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
3360
3361   /* "lxml/_elementpath.py":101
3362  * def prepare_child(next, token):
3363  *     tag = token[1]
3364  *     def select(result):             # <<<<<<<<<<<<<<
3365  *         for elem in result:
3366  *             for e in elem.iterchildren(tag):
3367  */
3368
3369   /* function exit code */
3370   PyErr_SetNone(PyExc_StopIteration);
3371   goto __pyx_L0;
3372   __pyx_L1_error:;
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);
3378   __pyx_L0:;
3379   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3380   #if !CYTHON_USE_EXC_INFO_STACK
3381   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3382   #endif
3383   __pyx_generator->resume_label = -1;
3384   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3385   __Pyx_RefNannyFinishContext();
3386   return __pyx_r;
3387 }
3388
3389 /* "lxml/_elementpath.py":99
3390  * 
3391  * 
3392  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
3393  *     tag = token[1]
3394  *     def select(result):
3395  */
3396
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)
3412   } else {
3413     __Pyx_GOTREF(__pyx_cur_scope);
3414   }
3415
3416   /* "lxml/_elementpath.py":100
3417  * 
3418  * def prepare_child(next, token):
3419  *     tag = token[1]             # <<<<<<<<<<<<<<
3420  *     def select(result):
3421  *         for elem in result:
3422  */
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;
3427   __pyx_t_1 = 0;
3428
3429   /* "lxml/_elementpath.py":101
3430  * def prepare_child(next, token):
3431  *     tag = token[1]
3432  *     def select(result):             # <<<<<<<<<<<<<<
3433  *         for elem in result:
3434  *             for e in elem.iterchildren(tag):
3435  */
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;
3439   __pyx_t_1 = 0;
3440
3441   /* "lxml/_elementpath.py":105
3442  *             for e in elem.iterchildren(tag):
3443  *                 yield e
3444  *     return select             # <<<<<<<<<<<<<<
3445  * 
3446  * def prepare_star(next, token):
3447  */
3448   __Pyx_XDECREF(__pyx_r);
3449   __Pyx_INCREF(__pyx_v_select);
3450   __pyx_r = __pyx_v_select;
3451   goto __pyx_L0;
3452
3453   /* "lxml/_elementpath.py":99
3454  * 
3455  * 
3456  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
3457  *     tag = token[1]
3458  *     def select(result):
3459  */
3460
3461   /* function exit code */
3462   __pyx_L1_error:;
3463   __Pyx_XDECREF(__pyx_t_1);
3464   __Pyx_AddTraceback("lxml._elementpath.prepare_child", __pyx_clineno, __pyx_lineno, __pyx_filename);
3465   __pyx_r = NULL;
3466   __pyx_L0:;
3467   __Pyx_XDECREF(__pyx_v_select);
3468   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3469   __Pyx_XGIVEREF(__pyx_r);
3470   __Pyx_RefNannyFinishContext();
3471   return __pyx_r;
3472 }
3473
3474 /* "lxml/_elementpath.py":107
3475  *     return select
3476  * 
3477  * def prepare_star(next, token):             # <<<<<<<<<<<<<<
3478  *     def select(result):
3479  *         for elem in result:
3480  */
3481
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);
3494   {
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)) {
3498       Py_ssize_t kw_args;
3499       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3500       switch (pos_args) {
3501         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3502         CYTHON_FALLTHROUGH;
3503         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3504         CYTHON_FALLTHROUGH;
3505         case  0: break;
3506         default: goto __pyx_L5_argtuple_error;
3507       }
3508       kw_args = PyDict_Size(__pyx_kwds);
3509       switch (pos_args) {
3510         case  0:
3511         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3512         else goto __pyx_L5_argtuple_error;
3513         CYTHON_FALLTHROUGH;
3514         case  1:
3515         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3516         else {
3517           __Pyx_RaiseArgtupleInvalid("prepare_star", 1, 2, 2, 1); __PYX_ERR(0, 107, __pyx_L3_error)
3518         }
3519       }
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)
3522       }
3523     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3524       goto __pyx_L5_argtuple_error;
3525     } else {
3526       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3527       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3528     }
3529     __pyx_v_next = values[0];
3530     __pyx_v_token = values[1];
3531   }
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)
3535   __pyx_L3_error:;
3536   __Pyx_AddTraceback("lxml._elementpath.prepare_star", __pyx_clineno, __pyx_lineno, __pyx_filename);
3537   __Pyx_RefNannyFinishContext();
3538   return NULL;
3539   __pyx_L4_argument_unpacking_done:;
3540   __pyx_r = __pyx_pf_4lxml_12_elementpath_5prepare_star(__pyx_self, __pyx_v_next, __pyx_v_token);
3541
3542   /* function exit code */
3543   __Pyx_RefNannyFinishContext();
3544   return __pyx_r;
3545 }
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 */
3547
3548 /* "lxml/_elementpath.py":108
3549  * 
3550  * def prepare_star(next, token):
3551  *     def select(result):             # <<<<<<<<<<<<<<
3552  *         for elem in result:
3553  *             for e in elem.iterchildren('*'):
3554  */
3555
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));
3564
3565   /* function exit code */
3566   __Pyx_RefNannyFinishContext();
3567   return __pyx_r;
3568 }
3569
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)
3583   } else {
3584     __Pyx_GOTREF(__pyx_cur_scope);
3585   }
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);
3589   {
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;
3594   }
3595
3596   /* function exit code */
3597   __pyx_L1_error:;
3598   __Pyx_AddTraceback("lxml._elementpath.prepare_star.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
3599   __pyx_r = NULL;
3600   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
3601   __Pyx_XGIVEREF(__pyx_r);
3602   __Pyx_RefNannyFinishContext();
3603   return __pyx_r;
3604 }
3605
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 */
3607 {
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();
3628     return NULL;
3629   }
3630   __pyx_L3_first_run:;
3631   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 108, __pyx_L1_error)
3632
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('*'):
3638  *                 yield e
3639  */
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;
3642     __pyx_t_3 = NULL;
3643   } else {
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)
3647   }
3648   for (;;) {
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)
3654         #else
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);
3657         #endif
3658       } else {
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)
3662         #else
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);
3665         #endif
3666       }
3667     } else {
3668       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
3669       if (unlikely(!__pyx_t_4)) {
3670         PyObject* exc_type = PyErr_Occurred();
3671         if (exc_type) {
3672           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3673           else __PYX_ERR(0, 109, __pyx_L1_error)
3674         }
3675         break;
3676       }
3677       __Pyx_GOTREF(__pyx_t_4);
3678     }
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);
3682     __pyx_t_4 = 0;
3683
3684     /* "lxml/_elementpath.py":110
3685  *     def select(result):
3686  *         for elem in result:
3687  *             for e in elem.iterchildren('*'):             # <<<<<<<<<<<<<<
3688  *                 yield e
3689  *     return select
3690  */
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);
3693     __pyx_t_6 = NULL;
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);
3701       }
3702     }
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;
3710       __pyx_t_8 = NULL;
3711     } else {
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)
3715     }
3716     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3717     for (;;) {
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)
3723           #else
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);
3726           #endif
3727         } else {
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)
3731           #else
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);
3734           #endif
3735         }
3736       } else {
3737         __pyx_t_4 = __pyx_t_8(__pyx_t_5);
3738         if (unlikely(!__pyx_t_4)) {
3739           PyObject* exc_type = PyErr_Occurred();
3740           if (exc_type) {
3741             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3742             else __PYX_ERR(0, 110, __pyx_L1_error)
3743           }
3744           break;
3745         }
3746         __Pyx_GOTREF(__pyx_t_4);
3747       }
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);
3751       __pyx_t_4 = 0;
3752
3753       /* "lxml/_elementpath.py":111
3754  *         for elem in result:
3755  *             for e in elem.iterchildren('*'):
3756  *                 yield e             # <<<<<<<<<<<<<<
3757  *     return select
3758  * 
3759  */
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;
3775       return __pyx_r;
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)
3788
3789       /* "lxml/_elementpath.py":110
3790  *     def select(result):
3791  *         for elem in result:
3792  *             for e in elem.iterchildren('*'):             # <<<<<<<<<<<<<<
3793  *                 yield e
3794  *     return select
3795  */
3796     }
3797     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3798
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('*'):
3804  *                 yield e
3805  */
3806   }
3807   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3808   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
3809
3810   /* "lxml/_elementpath.py":108
3811  * 
3812  * def prepare_star(next, token):
3813  *     def select(result):             # <<<<<<<<<<<<<<
3814  *         for elem in result:
3815  *             for e in elem.iterchildren('*'):
3816  */
3817
3818   /* function exit code */
3819   PyErr_SetNone(PyExc_StopIteration);
3820   goto __pyx_L0;
3821   __pyx_L1_error:;
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);
3827   __pyx_L0:;
3828   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
3829   #if !CYTHON_USE_EXC_INFO_STACK
3830   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
3831   #endif
3832   __pyx_generator->resume_label = -1;
3833   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
3834   __Pyx_RefNannyFinishContext();
3835   return __pyx_r;
3836 }
3837
3838 /* "lxml/_elementpath.py":107
3839  *     return select
3840  * 
3841  * def prepare_star(next, token):             # <<<<<<<<<<<<<<
3842  *     def select(result):
3843  *         for elem in result:
3844  */
3845
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);
3855
3856   /* "lxml/_elementpath.py":108
3857  * 
3858  * def prepare_star(next, token):
3859  *     def select(result):             # <<<<<<<<<<<<<<
3860  *         for elem in result:
3861  *             for e in elem.iterchildren('*'):
3862  */
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;
3866   __pyx_t_1 = 0;
3867
3868   /* "lxml/_elementpath.py":112
3869  *             for e in elem.iterchildren('*'):
3870  *                 yield e
3871  *     return select             # <<<<<<<<<<<<<<
3872  * 
3873  * def prepare_self(next, token):
3874  */
3875   __Pyx_XDECREF(__pyx_r);
3876   __Pyx_INCREF(__pyx_v_select);
3877   __pyx_r = __pyx_v_select;
3878   goto __pyx_L0;
3879
3880   /* "lxml/_elementpath.py":107
3881  *     return select
3882  * 
3883  * def prepare_star(next, token):             # <<<<<<<<<<<<<<
3884  *     def select(result):
3885  *         for elem in result:
3886  */
3887
3888   /* function exit code */
3889   __pyx_L1_error:;
3890   __Pyx_XDECREF(__pyx_t_1);
3891   __Pyx_AddTraceback("lxml._elementpath.prepare_star", __pyx_clineno, __pyx_lineno, __pyx_filename);
3892   __pyx_r = NULL;
3893   __pyx_L0:;
3894   __Pyx_XDECREF(__pyx_v_select);
3895   __Pyx_XGIVEREF(__pyx_r);
3896   __Pyx_RefNannyFinishContext();
3897   return __pyx_r;
3898 }
3899
3900 /* "lxml/_elementpath.py":114
3901  *     return select
3902  * 
3903  * def prepare_self(next, token):             # <<<<<<<<<<<<<<
3904  *     def select(result):
3905  *         return result
3906  */
3907
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);
3920   {
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)) {
3924       Py_ssize_t kw_args;
3925       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3926       switch (pos_args) {
3927         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3928         CYTHON_FALLTHROUGH;
3929         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3930         CYTHON_FALLTHROUGH;
3931         case  0: break;
3932         default: goto __pyx_L5_argtuple_error;
3933       }
3934       kw_args = PyDict_Size(__pyx_kwds);
3935       switch (pos_args) {
3936         case  0:
3937         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
3938         else goto __pyx_L5_argtuple_error;
3939         CYTHON_FALLTHROUGH;
3940         case  1:
3941         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
3942         else {
3943           __Pyx_RaiseArgtupleInvalid("prepare_self", 1, 2, 2, 1); __PYX_ERR(0, 114, __pyx_L3_error)
3944         }
3945       }
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)
3948       }
3949     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3950       goto __pyx_L5_argtuple_error;
3951     } else {
3952       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3953       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3954     }
3955     __pyx_v_next = values[0];
3956     __pyx_v_token = values[1];
3957   }
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)
3961   __pyx_L3_error:;
3962   __Pyx_AddTraceback("lxml._elementpath.prepare_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
3963   __Pyx_RefNannyFinishContext();
3964   return NULL;
3965   __pyx_L4_argument_unpacking_done:;
3966   __pyx_r = __pyx_pf_4lxml_12_elementpath_7prepare_self(__pyx_self, __pyx_v_next, __pyx_v_token);
3967
3968   /* function exit code */
3969   __Pyx_RefNannyFinishContext();
3970   return __pyx_r;
3971 }
3972
3973 /* "lxml/_elementpath.py":115
3974  * 
3975  * def prepare_self(next, token):
3976  *     def select(result):             # <<<<<<<<<<<<<<
3977  *         return result
3978  *     return select
3979  */
3980
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));
3989
3990   /* function exit code */
3991   __Pyx_RefNannyFinishContext();
3992   return __pyx_r;
3993 }
3994
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);
3999
4000   /* "lxml/_elementpath.py":116
4001  * def prepare_self(next, token):
4002  *     def select(result):
4003  *         return result             # <<<<<<<<<<<<<<
4004  *     return select
4005  * 
4006  */
4007   __Pyx_XDECREF(__pyx_r);
4008   __Pyx_INCREF(__pyx_v_result);
4009   __pyx_r = __pyx_v_result;
4010   goto __pyx_L0;
4011
4012   /* "lxml/_elementpath.py":115
4013  * 
4014  * def prepare_self(next, token):
4015  *     def select(result):             # <<<<<<<<<<<<<<
4016  *         return result
4017  *     return select
4018  */
4019
4020   /* function exit code */
4021   __pyx_L0:;
4022   __Pyx_XGIVEREF(__pyx_r);
4023   __Pyx_RefNannyFinishContext();
4024   return __pyx_r;
4025 }
4026
4027 /* "lxml/_elementpath.py":114
4028  *     return select
4029  * 
4030  * def prepare_self(next, token):             # <<<<<<<<<<<<<<
4031  *     def select(result):
4032  *         return result
4033  */
4034
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);
4044
4045   /* "lxml/_elementpath.py":115
4046  * 
4047  * def prepare_self(next, token):
4048  *     def select(result):             # <<<<<<<<<<<<<<
4049  *         return result
4050  *     return select
4051  */
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;
4055   __pyx_t_1 = 0;
4056
4057   /* "lxml/_elementpath.py":117
4058  *     def select(result):
4059  *         return result
4060  *     return select             # <<<<<<<<<<<<<<
4061  * 
4062  * def prepare_descendant(next, token):
4063  */
4064   __Pyx_XDECREF(__pyx_r);
4065   __Pyx_INCREF(__pyx_v_select);
4066   __pyx_r = __pyx_v_select;
4067   goto __pyx_L0;
4068
4069   /* "lxml/_elementpath.py":114
4070  *     return select
4071  * 
4072  * def prepare_self(next, token):             # <<<<<<<<<<<<<<
4073  *     def select(result):
4074  *         return result
4075  */
4076
4077   /* function exit code */
4078   __pyx_L1_error:;
4079   __Pyx_XDECREF(__pyx_t_1);
4080   __Pyx_AddTraceback("lxml._elementpath.prepare_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
4081   __pyx_r = NULL;
4082   __pyx_L0:;
4083   __Pyx_XDECREF(__pyx_v_select);
4084   __Pyx_XGIVEREF(__pyx_r);
4085   __Pyx_RefNannyFinishContext();
4086   return __pyx_r;
4087 }
4088
4089 /* "lxml/_elementpath.py":119
4090  *     return select
4091  * 
4092  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
4093  *     token = next()
4094  *     if token[0] == "*":
4095  */
4096
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);
4109   {
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)) {
4113       Py_ssize_t kw_args;
4114       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4115       switch (pos_args) {
4116         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4117         CYTHON_FALLTHROUGH;
4118         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4119         CYTHON_FALLTHROUGH;
4120         case  0: break;
4121         default: goto __pyx_L5_argtuple_error;
4122       }
4123       kw_args = PyDict_Size(__pyx_kwds);
4124       switch (pos_args) {
4125         case  0:
4126         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
4127         else goto __pyx_L5_argtuple_error;
4128         CYTHON_FALLTHROUGH;
4129         case  1:
4130         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
4131         else {
4132           __Pyx_RaiseArgtupleInvalid("prepare_descendant", 1, 2, 2, 1); __PYX_ERR(0, 119, __pyx_L3_error)
4133         }
4134       }
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)
4137       }
4138     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4139       goto __pyx_L5_argtuple_error;
4140     } else {
4141       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4142       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4143     }
4144     __pyx_v_next = values[0];
4145     __pyx_v_token = values[1];
4146   }
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)
4150   __pyx_L3_error:;
4151   __Pyx_AddTraceback("lxml._elementpath.prepare_descendant", __pyx_clineno, __pyx_lineno, __pyx_filename);
4152   __Pyx_RefNannyFinishContext();
4153   return NULL;
4154   __pyx_L4_argument_unpacking_done:;
4155   __pyx_r = __pyx_pf_4lxml_12_elementpath_9prepare_descendant(__pyx_self, __pyx_v_next, __pyx_v_token);
4156
4157   /* function exit code */
4158   __Pyx_RefNannyFinishContext();
4159   return __pyx_r;
4160 }
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 */
4162
4163 /* "lxml/_elementpath.py":127
4164  *     else:
4165  *         raise SyntaxError("invalid descendant")
4166  *     def select(result):             # <<<<<<<<<<<<<<
4167  *         for elem in result:
4168  *             for e in elem.iterdescendants(tag):
4169  */
4170
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));
4179
4180   /* function exit code */
4181   __Pyx_RefNannyFinishContext();
4182   return __pyx_r;
4183 }
4184
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)
4198   } else {
4199     __Pyx_GOTREF(__pyx_cur_scope);
4200   }
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);
4207   {
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;
4212   }
4213
4214   /* function exit code */
4215   __pyx_L1_error:;
4216   __Pyx_AddTraceback("lxml._elementpath.prepare_descendant.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4217   __pyx_r = NULL;
4218   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4219   __Pyx_XGIVEREF(__pyx_r);
4220   __Pyx_RefNannyFinishContext();
4221   return __pyx_r;
4222 }
4223
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 */
4225 {
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();
4246     return NULL;
4247   }
4248   __pyx_L3_first_run:;
4249   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 127, __pyx_L1_error)
4250
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):
4256  *                 yield e
4257  */
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;
4260     __pyx_t_3 = NULL;
4261   } else {
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)
4265   }
4266   for (;;) {
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)
4272         #else
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);
4275         #endif
4276       } else {
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)
4280         #else
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);
4283         #endif
4284       }
4285     } else {
4286       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
4287       if (unlikely(!__pyx_t_4)) {
4288         PyObject* exc_type = PyErr_Occurred();
4289         if (exc_type) {
4290           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4291           else __PYX_ERR(0, 128, __pyx_L1_error)
4292         }
4293         break;
4294       }
4295       __Pyx_GOTREF(__pyx_t_4);
4296     }
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);
4300     __pyx_t_4 = 0;
4301
4302     /* "lxml/_elementpath.py":129
4303  *     def select(result):
4304  *         for elem in result:
4305  *             for e in elem.iterdescendants(tag):             # <<<<<<<<<<<<<<
4306  *                 yield e
4307  *     return select
4308  */
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) }
4312     __pyx_t_6 = NULL;
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);
4320       }
4321     }
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;
4329       __pyx_t_8 = NULL;
4330     } else {
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)
4334     }
4335     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4336     for (;;) {
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)
4342           #else
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);
4345           #endif
4346         } else {
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)
4350           #else
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);
4353           #endif
4354         }
4355       } else {
4356         __pyx_t_4 = __pyx_t_8(__pyx_t_5);
4357         if (unlikely(!__pyx_t_4)) {
4358           PyObject* exc_type = PyErr_Occurred();
4359           if (exc_type) {
4360             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4361             else __PYX_ERR(0, 129, __pyx_L1_error)
4362           }
4363           break;
4364         }
4365         __Pyx_GOTREF(__pyx_t_4);
4366       }
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);
4370       __pyx_t_4 = 0;
4371
4372       /* "lxml/_elementpath.py":130
4373  *         for elem in result:
4374  *             for e in elem.iterdescendants(tag):
4375  *                 yield e             # <<<<<<<<<<<<<<
4376  *     return select
4377  * 
4378  */
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;
4394       return __pyx_r;
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)
4407
4408       /* "lxml/_elementpath.py":129
4409  *     def select(result):
4410  *         for elem in result:
4411  *             for e in elem.iterdescendants(tag):             # <<<<<<<<<<<<<<
4412  *                 yield e
4413  *     return select
4414  */
4415     }
4416     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4417
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):
4423  *                 yield e
4424  */
4425   }
4426   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4427   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4428
4429   /* "lxml/_elementpath.py":127
4430  *     else:
4431  *         raise SyntaxError("invalid descendant")
4432  *     def select(result):             # <<<<<<<<<<<<<<
4433  *         for elem in result:
4434  *             for e in elem.iterdescendants(tag):
4435  */
4436
4437   /* function exit code */
4438   PyErr_SetNone(PyExc_StopIteration);
4439   goto __pyx_L0;
4440   __pyx_L1_error:;
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);
4446   __pyx_L0:;
4447   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4448   #if !CYTHON_USE_EXC_INFO_STACK
4449   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4450   #endif
4451   __pyx_generator->resume_label = -1;
4452   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4453   __Pyx_RefNannyFinishContext();
4454   return __pyx_r;
4455 }
4456
4457 /* "lxml/_elementpath.py":119
4458  *     return select
4459  * 
4460  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
4461  *     token = next()
4462  *     if token[0] == "*":
4463  */
4464
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;
4473   int __pyx_t_4;
4474   int __pyx_t_5;
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)
4484   } else {
4485     __Pyx_GOTREF(__pyx_cur_scope);
4486   }
4487   __Pyx_INCREF(__pyx_v_token);
4488
4489   /* "lxml/_elementpath.py":120
4490  * 
4491  * def prepare_descendant(next, token):
4492  *     token = next()             # <<<<<<<<<<<<<<
4493  *     if token[0] == "*":
4494  *         tag = "*"
4495  */
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);
4505     }
4506   }
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);
4513   __pyx_t_1 = 0;
4514
4515   /* "lxml/_elementpath.py":121
4516  * def prepare_descendant(next, token):
4517  *     token = next()
4518  *     if token[0] == "*":             # <<<<<<<<<<<<<<
4519  *         tag = "*"
4520  *     elif not token[0]:
4521  */
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;
4526   if (__pyx_t_4) {
4527
4528     /* "lxml/_elementpath.py":122
4529  *     token = next()
4530  *     if token[0] == "*":
4531  *         tag = "*"             # <<<<<<<<<<<<<<
4532  *     elif not token[0]:
4533  *         tag = token[1]
4534  */
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;
4538
4539     /* "lxml/_elementpath.py":121
4540  * def prepare_descendant(next, token):
4541  *     token = next()
4542  *     if token[0] == "*":             # <<<<<<<<<<<<<<
4543  *         tag = "*"
4544  *     elif not token[0]:
4545  */
4546     goto __pyx_L3;
4547   }
4548
4549   /* "lxml/_elementpath.py":123
4550  *     if token[0] == "*":
4551  *         tag = "*"
4552  *     elif not token[0]:             # <<<<<<<<<<<<<<
4553  *         tag = token[1]
4554  *     else:
4555  */
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)) {
4562
4563     /* "lxml/_elementpath.py":124
4564  *         tag = "*"
4565  *     elif not token[0]:
4566  *         tag = token[1]             # <<<<<<<<<<<<<<
4567  *     else:
4568  *         raise SyntaxError("invalid descendant")
4569  */
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;
4574     __pyx_t_1 = 0;
4575
4576     /* "lxml/_elementpath.py":123
4577  *     if token[0] == "*":
4578  *         tag = "*"
4579  *     elif not token[0]:             # <<<<<<<<<<<<<<
4580  *         tag = token[1]
4581  *     else:
4582  */
4583     goto __pyx_L3;
4584   }
4585
4586   /* "lxml/_elementpath.py":126
4587  *         tag = token[1]
4588  *     else:
4589  *         raise SyntaxError("invalid descendant")             # <<<<<<<<<<<<<<
4590  *     def select(result):
4591  *         for elem in result:
4592  */
4593   /*else*/ {
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)
4599   }
4600   __pyx_L3:;
4601
4602   /* "lxml/_elementpath.py":127
4603  *     else:
4604  *         raise SyntaxError("invalid descendant")
4605  *     def select(result):             # <<<<<<<<<<<<<<
4606  *         for elem in result:
4607  *             for e in elem.iterdescendants(tag):
4608  */
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;
4612   __pyx_t_1 = 0;
4613
4614   /* "lxml/_elementpath.py":131
4615  *             for e in elem.iterdescendants(tag):
4616  *                 yield e
4617  *     return select             # <<<<<<<<<<<<<<
4618  * 
4619  * def prepare_parent(next, token):
4620  */
4621   __Pyx_XDECREF(__pyx_r);
4622   __Pyx_INCREF(__pyx_v_select);
4623   __pyx_r = __pyx_v_select;
4624   goto __pyx_L0;
4625
4626   /* "lxml/_elementpath.py":119
4627  *     return select
4628  * 
4629  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
4630  *     token = next()
4631  *     if token[0] == "*":
4632  */
4633
4634   /* function exit code */
4635   __pyx_L1_error:;
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);
4640   __pyx_r = NULL;
4641   __pyx_L0:;
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();
4647   return __pyx_r;
4648 }
4649
4650 /* "lxml/_elementpath.py":133
4651  *     return select
4652  * 
4653  * def prepare_parent(next, token):             # <<<<<<<<<<<<<<
4654  *     def select(result):
4655  *         for elem in result:
4656  */
4657
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);
4670   {
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)) {
4674       Py_ssize_t kw_args;
4675       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4676       switch (pos_args) {
4677         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4678         CYTHON_FALLTHROUGH;
4679         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4680         CYTHON_FALLTHROUGH;
4681         case  0: break;
4682         default: goto __pyx_L5_argtuple_error;
4683       }
4684       kw_args = PyDict_Size(__pyx_kwds);
4685       switch (pos_args) {
4686         case  0:
4687         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
4688         else goto __pyx_L5_argtuple_error;
4689         CYTHON_FALLTHROUGH;
4690         case  1:
4691         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
4692         else {
4693           __Pyx_RaiseArgtupleInvalid("prepare_parent", 1, 2, 2, 1); __PYX_ERR(0, 133, __pyx_L3_error)
4694         }
4695       }
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)
4698       }
4699     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4700       goto __pyx_L5_argtuple_error;
4701     } else {
4702       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4703       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4704     }
4705     __pyx_v_next = values[0];
4706     __pyx_v_token = values[1];
4707   }
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)
4711   __pyx_L3_error:;
4712   __Pyx_AddTraceback("lxml._elementpath.prepare_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4713   __Pyx_RefNannyFinishContext();
4714   return NULL;
4715   __pyx_L4_argument_unpacking_done:;
4716   __pyx_r = __pyx_pf_4lxml_12_elementpath_11prepare_parent(__pyx_self, __pyx_v_next, __pyx_v_token);
4717
4718   /* function exit code */
4719   __Pyx_RefNannyFinishContext();
4720   return __pyx_r;
4721 }
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 */
4723
4724 /* "lxml/_elementpath.py":134
4725  * 
4726  * def prepare_parent(next, token):
4727  *     def select(result):             # <<<<<<<<<<<<<<
4728  *         for elem in result:
4729  *             parent = elem.getparent()
4730  */
4731
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));
4740
4741   /* function exit code */
4742   __Pyx_RefNannyFinishContext();
4743   return __pyx_r;
4744 }
4745
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)
4759   } else {
4760     __Pyx_GOTREF(__pyx_cur_scope);
4761   }
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);
4765   {
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;
4770   }
4771
4772   /* function exit code */
4773   __pyx_L1_error:;
4774   __Pyx_AddTraceback("lxml._elementpath.prepare_parent.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
4775   __pyx_r = NULL;
4776   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4777   __Pyx_XGIVEREF(__pyx_r);
4778   __Pyx_RefNannyFinishContext();
4779   return __pyx_r;
4780 }
4781
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 */
4783 {
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;
4792   int __pyx_t_7;
4793   int __pyx_t_8;
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();
4804     return NULL;
4805   }
4806   __pyx_L3_first_run:;
4807   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 134, __pyx_L1_error)
4808
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:
4815  */
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;
4818     __pyx_t_3 = NULL;
4819   } else {
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)
4823   }
4824   for (;;) {
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)
4830         #else
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);
4833         #endif
4834       } else {
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)
4838         #else
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);
4841         #endif
4842       }
4843     } else {
4844       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
4845       if (unlikely(!__pyx_t_4)) {
4846         PyObject* exc_type = PyErr_Occurred();
4847         if (exc_type) {
4848           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4849           else __PYX_ERR(0, 135, __pyx_L1_error)
4850         }
4851         break;
4852       }
4853       __Pyx_GOTREF(__pyx_t_4);
4854     }
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);
4858     __pyx_t_4 = 0;
4859
4860     /* "lxml/_elementpath.py":136
4861  *     def select(result):
4862  *         for elem in result:
4863  *             parent = elem.getparent()             # <<<<<<<<<<<<<<
4864  *             if parent is not None:
4865  *                 yield parent
4866  */
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);
4869     __pyx_t_6 = NULL;
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);
4877       }
4878     }
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);
4887     __pyx_t_4 = 0;
4888
4889     /* "lxml/_elementpath.py":137
4890  *         for elem in result:
4891  *             parent = elem.getparent()
4892  *             if parent is not None:             # <<<<<<<<<<<<<<
4893  *                 yield parent
4894  *     return select
4895  */
4896     __pyx_t_7 = (__pyx_cur_scope->__pyx_v_parent != Py_None);
4897     __pyx_t_8 = (__pyx_t_7 != 0);
4898     if (__pyx_t_8) {
4899
4900       /* "lxml/_elementpath.py":138
4901  *             parent = elem.getparent()
4902  *             if parent is not None:
4903  *                 yield parent             # <<<<<<<<<<<<<<
4904  *     return select
4905  * 
4906  */
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;
4918       return __pyx_r;
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)
4926
4927       /* "lxml/_elementpath.py":137
4928  *         for elem in result:
4929  *             parent = elem.getparent()
4930  *             if parent is not None:             # <<<<<<<<<<<<<<
4931  *                 yield parent
4932  *     return select
4933  */
4934     }
4935
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:
4942  */
4943   }
4944   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4945   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4946
4947   /* "lxml/_elementpath.py":134
4948  * 
4949  * def prepare_parent(next, token):
4950  *     def select(result):             # <<<<<<<<<<<<<<
4951  *         for elem in result:
4952  *             parent = elem.getparent()
4953  */
4954
4955   /* function exit code */
4956   PyErr_SetNone(PyExc_StopIteration);
4957   goto __pyx_L0;
4958   __pyx_L1_error:;
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);
4964   __pyx_L0:;
4965   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4966   #if !CYTHON_USE_EXC_INFO_STACK
4967   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4968   #endif
4969   __pyx_generator->resume_label = -1;
4970   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4971   __Pyx_RefNannyFinishContext();
4972   return __pyx_r;
4973 }
4974
4975 /* "lxml/_elementpath.py":133
4976  *     return select
4977  * 
4978  * def prepare_parent(next, token):             # <<<<<<<<<<<<<<
4979  *     def select(result):
4980  *         for elem in result:
4981  */
4982
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);
4992
4993   /* "lxml/_elementpath.py":134
4994  * 
4995  * def prepare_parent(next, token):
4996  *     def select(result):             # <<<<<<<<<<<<<<
4997  *         for elem in result:
4998  *             parent = elem.getparent()
4999  */
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;
5003   __pyx_t_1 = 0;
5004
5005   /* "lxml/_elementpath.py":139
5006  *             if parent is not None:
5007  *                 yield parent
5008  *     return select             # <<<<<<<<<<<<<<
5009  * 
5010  * def prepare_predicate(next, token):
5011  */
5012   __Pyx_XDECREF(__pyx_r);
5013   __Pyx_INCREF(__pyx_v_select);
5014   __pyx_r = __pyx_v_select;
5015   goto __pyx_L0;
5016
5017   /* "lxml/_elementpath.py":133
5018  *     return select
5019  * 
5020  * def prepare_parent(next, token):             # <<<<<<<<<<<<<<
5021  *     def select(result):
5022  *         for elem in result:
5023  */
5024
5025   /* function exit code */
5026   __pyx_L1_error:;
5027   __Pyx_XDECREF(__pyx_t_1);
5028   __Pyx_AddTraceback("lxml._elementpath.prepare_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
5029   __pyx_r = NULL;
5030   __pyx_L0:;
5031   __Pyx_XDECREF(__pyx_v_select);
5032   __Pyx_XGIVEREF(__pyx_r);
5033   __Pyx_RefNannyFinishContext();
5034   return __pyx_r;
5035 }
5036
5037 /* "lxml/_elementpath.py":141
5038  *     return select
5039  * 
5040  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
5041  *     # FIXME: replace with real parser!!! refs:
5042  *     # http://effbot.org/zone/simple-iterator-parser.htm
5043  */
5044
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);
5057   {
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)) {
5061       Py_ssize_t kw_args;
5062       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5063       switch (pos_args) {
5064         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5065         CYTHON_FALLTHROUGH;
5066         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5067         CYTHON_FALLTHROUGH;
5068         case  0: break;
5069         default: goto __pyx_L5_argtuple_error;
5070       }
5071       kw_args = PyDict_Size(__pyx_kwds);
5072       switch (pos_args) {
5073         case  0:
5074         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next)) != 0)) kw_args--;
5075         else goto __pyx_L5_argtuple_error;
5076         CYTHON_FALLTHROUGH;
5077         case  1:
5078         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_token)) != 0)) kw_args--;
5079         else {
5080           __Pyx_RaiseArgtupleInvalid("prepare_predicate", 1, 2, 2, 1); __PYX_ERR(0, 141, __pyx_L3_error)
5081         }
5082       }
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)
5085       }
5086     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5087       goto __pyx_L5_argtuple_error;
5088     } else {
5089       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5090       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5091     }
5092     __pyx_v_next = values[0];
5093     __pyx_v_token = values[1];
5094   }
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)
5098   __pyx_L3_error:;
5099   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
5100   __Pyx_RefNannyFinishContext();
5101   return NULL;
5102   __pyx_L4_argument_unpacking_done:;
5103   __pyx_r = __pyx_pf_4lxml_12_elementpath_13prepare_predicate(__pyx_self, __pyx_v_next, __pyx_v_token);
5104
5105   /* function exit code */
5106   __Pyx_RefNannyFinishContext();
5107   return __pyx_r;
5108 }
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 */
5110
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:
5117  */
5118
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));
5127
5128   /* function exit code */
5129   __Pyx_RefNannyFinishContext();
5130   return __pyx_r;
5131 }
5132
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)
5146   } else {
5147     __Pyx_GOTREF(__pyx_cur_scope);
5148   }
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);
5155   {
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;
5160   }
5161
5162   /* function exit code */
5163   __pyx_L1_error:;
5164   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5165   __pyx_r = NULL;
5166   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5167   __Pyx_XGIVEREF(__pyx_r);
5168   __Pyx_RefNannyFinishContext();
5169   return __pyx_r;
5170 }
5171
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 */
5173 {
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;
5182   int __pyx_t_7;
5183   int __pyx_t_8;
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();
5194     return NULL;
5195   }
5196   __pyx_L3_first_run:;
5197   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 163, __pyx_L1_error)
5198
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:
5204  *                     yield elem
5205  */
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;
5208     __pyx_t_3 = NULL;
5209   } else {
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)
5213   }
5214   for (;;) {
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)
5220         #else
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);
5223         #endif
5224       } else {
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)
5228         #else
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);
5231         #endif
5232       }
5233     } else {
5234       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5235       if (unlikely(!__pyx_t_4)) {
5236         PyObject* exc_type = PyErr_Occurred();
5237         if (exc_type) {
5238           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5239           else __PYX_ERR(0, 164, __pyx_L1_error)
5240         }
5241         break;
5242       }
5243       __Pyx_GOTREF(__pyx_t_4);
5244     }
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);
5248     __pyx_t_4 = 0;
5249
5250     /* "lxml/_elementpath.py":165
5251  *         def select(result):
5252  *             for elem in result:
5253  *                 if elem.get(key) is not None:             # <<<<<<<<<<<<<<
5254  *                     yield elem
5255  *         return select
5256  */
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) }
5260     __pyx_t_6 = NULL;
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);
5268       }
5269     }
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);
5278     if (__pyx_t_8) {
5279
5280       /* "lxml/_elementpath.py":166
5281  *             for elem in result:
5282  *                 if elem.get(key) is not None:
5283  *                     yield elem             # <<<<<<<<<<<<<<
5284  *         return select
5285  *     if signature == "@-='":
5286  */
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;
5298       return __pyx_r;
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)
5306
5307       /* "lxml/_elementpath.py":165
5308  *         def select(result):
5309  *             for elem in result:
5310  *                 if elem.get(key) is not None:             # <<<<<<<<<<<<<<
5311  *                     yield elem
5312  *         return select
5313  */
5314     }
5315
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:
5321  *                     yield elem
5322  */
5323   }
5324   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5325   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5326
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:
5333  */
5334
5335   /* function exit code */
5336   PyErr_SetNone(PyExc_StopIteration);
5337   goto __pyx_L0;
5338   __pyx_L1_error:;
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);
5344   __pyx_L0:;
5345   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5346   #if !CYTHON_USE_EXC_INFO_STACK
5347   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5348   #endif
5349   __pyx_generator->resume_label = -1;
5350   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5351   __Pyx_RefNannyFinishContext();
5352   return __pyx_r;
5353 }
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 */
5355
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:
5362  */
5363
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));
5372
5373   /* function exit code */
5374   __Pyx_RefNannyFinishContext();
5375   return __pyx_r;
5376 }
5377
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)
5391   } else {
5392     __Pyx_GOTREF(__pyx_cur_scope);
5393   }
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);
5400   {
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;
5405   }
5406
5407   /* function exit code */
5408   __pyx_L1_error:;
5409   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5410   __pyx_r = NULL;
5411   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5412   __Pyx_XGIVEREF(__pyx_r);
5413   __Pyx_RefNannyFinishContext();
5414   return __pyx_r;
5415 }
5416
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 */
5418 {
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;
5427   int __pyx_t_7;
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();
5438     return NULL;
5439   }
5440   __pyx_L3_first_run:;
5441   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 172, __pyx_L1_error)
5442
5443   /* "lxml/_elementpath.py":173
5444  *         value = predicate[-1]
5445  *         def select(result):
5446  *             for elem in result:             # <<<<<<<<<<<<<<
5447  *                 if elem.get(key) == value:
5448  *                     yield elem
5449  */
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;
5452     __pyx_t_3 = NULL;
5453   } else {
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)
5457   }
5458   for (;;) {
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)
5464         #else
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);
5467         #endif
5468       } else {
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)
5472         #else
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);
5475         #endif
5476       }
5477     } else {
5478       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5479       if (unlikely(!__pyx_t_4)) {
5480         PyObject* exc_type = PyErr_Occurred();
5481         if (exc_type) {
5482           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5483           else __PYX_ERR(0, 173, __pyx_L1_error)
5484         }
5485         break;
5486       }
5487       __Pyx_GOTREF(__pyx_t_4);
5488     }
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);
5492     __pyx_t_4 = 0;
5493
5494     /* "lxml/_elementpath.py":174
5495  *         def select(result):
5496  *             for elem in result:
5497  *                 if elem.get(key) == value:             # <<<<<<<<<<<<<<
5498  *                     yield elem
5499  *         return select
5500  */
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) }
5504     __pyx_t_6 = NULL;
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);
5512       }
5513     }
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;
5524     if (__pyx_t_7) {
5525
5526       /* "lxml/_elementpath.py":175
5527  *             for elem in result:
5528  *                 if elem.get(key) == value:
5529  *                     yield elem             # <<<<<<<<<<<<<<
5530  *         return select
5531  *     if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
5532  */
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;
5544       return __pyx_r;
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)
5552
5553       /* "lxml/_elementpath.py":174
5554  *         def select(result):
5555  *             for elem in result:
5556  *                 if elem.get(key) == value:             # <<<<<<<<<<<<<<
5557  *                     yield elem
5558  *         return select
5559  */
5560     }
5561
5562     /* "lxml/_elementpath.py":173
5563  *         value = predicate[-1]
5564  *         def select(result):
5565  *             for elem in result:             # <<<<<<<<<<<<<<
5566  *                 if elem.get(key) == value:
5567  *                     yield elem
5568  */
5569   }
5570   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5571   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5572
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:
5579  */
5580
5581   /* function exit code */
5582   PyErr_SetNone(PyExc_StopIteration);
5583   goto __pyx_L0;
5584   __pyx_L1_error:;
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);
5590   __pyx_L0:;
5591   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5592   #if !CYTHON_USE_EXC_INFO_STACK
5593   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5594   #endif
5595   __pyx_generator->resume_label = -1;
5596   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5597   __Pyx_RefNannyFinishContext();
5598   return __pyx_r;
5599 }
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 */
5601
5602 /* "lxml/_elementpath.py":180
5603  *         # [tag]
5604  *         tag = predicate[0]
5605  *         def select(result):             # <<<<<<<<<<<<<<
5606  *             for elem in result:
5607  *                 for _ in elem.iterchildren(tag):
5608  */
5609
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));
5618
5619   /* function exit code */
5620   __Pyx_RefNannyFinishContext();
5621   return __pyx_r;
5622 }
5623
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)
5637   } else {
5638     __Pyx_GOTREF(__pyx_cur_scope);
5639   }
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);
5646   {
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;
5651   }
5652
5653   /* function exit code */
5654   __pyx_L1_error:;
5655   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5656   __pyx_r = NULL;
5657   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5658   __Pyx_XGIVEREF(__pyx_r);
5659   __Pyx_RefNannyFinishContext();
5660   return __pyx_r;
5661 }
5662
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 */
5664 {
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();
5685     return NULL;
5686   }
5687   __pyx_L3_first_run:;
5688   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 180, __pyx_L1_error)
5689
5690   /* "lxml/_elementpath.py":181
5691  *         tag = predicate[0]
5692  *         def select(result):
5693  *             for elem in result:             # <<<<<<<<<<<<<<
5694  *                 for _ in elem.iterchildren(tag):
5695  *                     yield elem
5696  */
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;
5699     __pyx_t_3 = NULL;
5700   } else {
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)
5704   }
5705   for (;;) {
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)
5711         #else
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);
5714         #endif
5715       } else {
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)
5719         #else
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);
5722         #endif
5723       }
5724     } else {
5725       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5726       if (unlikely(!__pyx_t_4)) {
5727         PyObject* exc_type = PyErr_Occurred();
5728         if (exc_type) {
5729           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5730           else __PYX_ERR(0, 181, __pyx_L1_error)
5731         }
5732         break;
5733       }
5734       __Pyx_GOTREF(__pyx_t_4);
5735     }
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);
5739     __pyx_t_4 = 0;
5740
5741     /* "lxml/_elementpath.py":182
5742  *         def select(result):
5743  *             for elem in result:
5744  *                 for _ in elem.iterchildren(tag):             # <<<<<<<<<<<<<<
5745  *                     yield elem
5746  *                     break
5747  */
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) }
5751     __pyx_t_6 = NULL;
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);
5759       }
5760     }
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;
5768       __pyx_t_8 = NULL;
5769     } else {
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)
5773     }
5774     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5775     for (;;) {
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)
5781           #else
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);
5784           #endif
5785         } else {
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)
5789           #else
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);
5792           #endif
5793         }
5794       } else {
5795         __pyx_t_4 = __pyx_t_8(__pyx_t_5);
5796         if (unlikely(!__pyx_t_4)) {
5797           PyObject* exc_type = PyErr_Occurred();
5798           if (exc_type) {
5799             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5800             else __PYX_ERR(0, 182, __pyx_L1_error)
5801           }
5802           break;
5803         }
5804         __Pyx_GOTREF(__pyx_t_4);
5805       }
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);
5809       __pyx_t_4 = 0;
5810
5811       /* "lxml/_elementpath.py":183
5812  *             for elem in result:
5813  *                 for _ in elem.iterchildren(tag):
5814  *                     yield elem             # <<<<<<<<<<<<<<
5815  *                     break
5816  *         return select
5817  */
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;
5833       return __pyx_r;
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)
5846
5847       /* "lxml/_elementpath.py":184
5848  *                 for _ in elem.iterchildren(tag):
5849  *                     yield elem
5850  *                     break             # <<<<<<<<<<<<<<
5851  *         return select
5852  *     if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):
5853  */
5854       goto __pyx_L7_break;
5855
5856       /* "lxml/_elementpath.py":182
5857  *         def select(result):
5858  *             for elem in result:
5859  *                 for _ in elem.iterchildren(tag):             # <<<<<<<<<<<<<<
5860  *                     yield elem
5861  *                     break
5862  */
5863     }
5864     __pyx_L7_break:;
5865     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5866
5867     /* "lxml/_elementpath.py":181
5868  *         tag = predicate[0]
5869  *         def select(result):
5870  *             for elem in result:             # <<<<<<<<<<<<<<
5871  *                 for _ in elem.iterchildren(tag):
5872  *                     yield elem
5873  */
5874   }
5875   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5876   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5877
5878   /* "lxml/_elementpath.py":180
5879  *         # [tag]
5880  *         tag = predicate[0]
5881  *         def select(result):             # <<<<<<<<<<<<<<
5882  *             for elem in result:
5883  *                 for _ in elem.iterchildren(tag):
5884  */
5885
5886   /* function exit code */
5887   PyErr_SetNone(PyExc_StopIteration);
5888   goto __pyx_L0;
5889   __pyx_L1_error:;
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);
5895   __pyx_L0:;
5896   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5897   #if !CYTHON_USE_EXC_INFO_STACK
5898   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5899   #endif
5900   __pyx_generator->resume_label = -1;
5901   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5902   __Pyx_RefNannyFinishContext();
5903   return __pyx_r;
5904 }
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 */
5906
5907 /* "lxml/_elementpath.py":191
5908  *         value = predicate[-1]
5909  *         if tag:
5910  *             def select(result):             # <<<<<<<<<<<<<<
5911  *                 for elem in result:
5912  *                     for e in elem.iterchildren(tag):
5913  */
5914
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));
5923
5924   /* function exit code */
5925   __Pyx_RefNannyFinishContext();
5926   return __pyx_r;
5927 }
5928
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)
5942   } else {
5943     __Pyx_GOTREF(__pyx_cur_scope);
5944   }
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);
5951   {
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;
5956   }
5957
5958   /* function exit code */
5959   __pyx_L1_error:;
5960   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5961   __pyx_r = NULL;
5962   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5963   __Pyx_XGIVEREF(__pyx_r);
5964   __Pyx_RefNannyFinishContext();
5965   return __pyx_r;
5966 }
5967
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 */
5969 {
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;
5981   int __pyx_t_10;
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();
5992     return NULL;
5993   }
5994   __pyx_L3_first_run:;
5995   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 191, __pyx_L1_error)
5996
5997   /* "lxml/_elementpath.py":192
5998  *         if tag:
5999  *             def select(result):
6000  *                 for elem in result:             # <<<<<<<<<<<<<<
6001  *                     for e in elem.iterchildren(tag):
6002  *                         if "".join(e.itertext()) == value:
6003  */
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;
6006     __pyx_t_3 = NULL;
6007   } else {
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)
6011   }
6012   for (;;) {
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)
6018         #else
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);
6021         #endif
6022       } else {
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)
6026         #else
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);
6029         #endif
6030       }
6031     } else {
6032       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6033       if (unlikely(!__pyx_t_4)) {
6034         PyObject* exc_type = PyErr_Occurred();
6035         if (exc_type) {
6036           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6037           else __PYX_ERR(0, 192, __pyx_L1_error)
6038         }
6039         break;
6040       }
6041       __Pyx_GOTREF(__pyx_t_4);
6042     }
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);
6046     __pyx_t_4 = 0;
6047
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:
6053  *                             yield elem
6054  */
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) }
6058     __pyx_t_6 = NULL;
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);
6066       }
6067     }
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;
6075       __pyx_t_8 = NULL;
6076     } else {
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)
6080     }
6081     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6082     for (;;) {
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)
6088           #else
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);
6091           #endif
6092         } else {
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)
6096           #else
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);
6099           #endif
6100         }
6101       } else {
6102         __pyx_t_4 = __pyx_t_8(__pyx_t_5);
6103         if (unlikely(!__pyx_t_4)) {
6104           PyObject* exc_type = PyErr_Occurred();
6105           if (exc_type) {
6106             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6107             else __PYX_ERR(0, 193, __pyx_L1_error)
6108           }
6109           break;
6110         }
6111         __Pyx_GOTREF(__pyx_t_4);
6112       }
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);
6116       __pyx_t_4 = 0;
6117
6118       /* "lxml/_elementpath.py":194
6119  *                 for elem in result:
6120  *                     for e in elem.iterchildren(tag):
6121  *                         if "".join(e.itertext()) == value:             # <<<<<<<<<<<<<<
6122  *                             yield elem
6123  *                             break
6124  */
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);
6127       __pyx_t_9 = NULL;
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);
6135         }
6136       }
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;
6148       if (__pyx_t_10) {
6149
6150         /* "lxml/_elementpath.py":195
6151  *                     for e in elem.iterchildren(tag):
6152  *                         if "".join(e.itertext()) == value:
6153  *                             yield elem             # <<<<<<<<<<<<<<
6154  *                             break
6155  *         else:
6156  */
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;
6172         return __pyx_r;
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)
6185
6186         /* "lxml/_elementpath.py":196
6187  *                         if "".join(e.itertext()) == value:
6188  *                             yield elem
6189  *                             break             # <<<<<<<<<<<<<<
6190  *         else:
6191  *             def select(result):
6192  */
6193         goto __pyx_L7_break;
6194
6195         /* "lxml/_elementpath.py":194
6196  *                 for elem in result:
6197  *                     for e in elem.iterchildren(tag):
6198  *                         if "".join(e.itertext()) == value:             # <<<<<<<<<<<<<<
6199  *                             yield elem
6200  *                             break
6201  */
6202       }
6203
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:
6209  *                             yield elem
6210  */
6211     }
6212     __pyx_L7_break:;
6213     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6214
6215     /* "lxml/_elementpath.py":192
6216  *         if tag:
6217  *             def select(result):
6218  *                 for elem in result:             # <<<<<<<<<<<<<<
6219  *                     for e in elem.iterchildren(tag):
6220  *                         if "".join(e.itertext()) == value:
6221  */
6222   }
6223   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6224   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6225
6226   /* "lxml/_elementpath.py":191
6227  *         value = predicate[-1]
6228  *         if tag:
6229  *             def select(result):             # <<<<<<<<<<<<<<
6230  *                 for elem in result:
6231  *                     for e in elem.iterchildren(tag):
6232  */
6233
6234   /* function exit code */
6235   PyErr_SetNone(PyExc_StopIteration);
6236   goto __pyx_L0;
6237   __pyx_L1_error:;
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);
6244   __pyx_L0:;
6245   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6246   #if !CYTHON_USE_EXC_INFO_STACK
6247   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6248   #endif
6249   __pyx_generator->resume_label = -1;
6250   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6251   __Pyx_RefNannyFinishContext();
6252   return __pyx_r;
6253 }
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 */
6255
6256 /* "lxml/_elementpath.py":198
6257  *                             break
6258  *         else:
6259  *             def select(result):             # <<<<<<<<<<<<<<
6260  *                 for elem in result:
6261  *                     if "".join(elem.itertext()) == value:
6262  */
6263
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));
6272
6273   /* function exit code */
6274   __Pyx_RefNannyFinishContext();
6275   return __pyx_r;
6276 }
6277
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)
6291   } else {
6292     __Pyx_GOTREF(__pyx_cur_scope);
6293   }
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);
6300   {
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;
6305   }
6306
6307   /* function exit code */
6308   __pyx_L1_error:;
6309   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6310   __pyx_r = NULL;
6311   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6312   __Pyx_XGIVEREF(__pyx_r);
6313   __Pyx_RefNannyFinishContext();
6314   return __pyx_r;
6315 }
6316
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 */
6318 {
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;
6327   int __pyx_t_7;
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();
6338     return NULL;
6339   }
6340   __pyx_L3_first_run:;
6341   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 198, __pyx_L1_error)
6342
6343   /* "lxml/_elementpath.py":199
6344  *         else:
6345  *             def select(result):
6346  *                 for elem in result:             # <<<<<<<<<<<<<<
6347  *                     if "".join(elem.itertext()) == value:
6348  *                         yield elem
6349  */
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;
6352     __pyx_t_3 = NULL;
6353   } else {
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)
6357   }
6358   for (;;) {
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)
6364         #else
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);
6367         #endif
6368       } else {
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)
6372         #else
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);
6375         #endif
6376       }
6377     } else {
6378       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6379       if (unlikely(!__pyx_t_4)) {
6380         PyObject* exc_type = PyErr_Occurred();
6381         if (exc_type) {
6382           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6383           else __PYX_ERR(0, 199, __pyx_L1_error)
6384         }
6385         break;
6386       }
6387       __Pyx_GOTREF(__pyx_t_4);
6388     }
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);
6392     __pyx_t_4 = 0;
6393
6394     /* "lxml/_elementpath.py":200
6395  *             def select(result):
6396  *                 for elem in result:
6397  *                     if "".join(elem.itertext()) == value:             # <<<<<<<<<<<<<<
6398  *                         yield elem
6399  *         return select
6400  */
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);
6403     __pyx_t_6 = NULL;
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);
6411       }
6412     }
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;
6424     if (__pyx_t_7) {
6425
6426       /* "lxml/_elementpath.py":201
6427  *                 for elem in result:
6428  *                     if "".join(elem.itertext()) == value:
6429  *                         yield elem             # <<<<<<<<<<<<<<
6430  *         return select
6431  *     if signature == "-" or signature == "-()" or signature == "-()-":
6432  */
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;
6444       return __pyx_r;
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)
6452
6453       /* "lxml/_elementpath.py":200
6454  *             def select(result):
6455  *                 for elem in result:
6456  *                     if "".join(elem.itertext()) == value:             # <<<<<<<<<<<<<<
6457  *                         yield elem
6458  *         return select
6459  */
6460     }
6461
6462     /* "lxml/_elementpath.py":199
6463  *         else:
6464  *             def select(result):
6465  *                 for elem in result:             # <<<<<<<<<<<<<<
6466  *                     if "".join(elem.itertext()) == value:
6467  *                         yield elem
6468  */
6469   }
6470   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6471   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6472
6473   /* "lxml/_elementpath.py":198
6474  *                             break
6475  *         else:
6476  *             def select(result):             # <<<<<<<<<<<<<<
6477  *                 for elem in result:
6478  *                     if "".join(elem.itertext()) == value:
6479  */
6480
6481   /* function exit code */
6482   PyErr_SetNone(PyExc_StopIteration);
6483   goto __pyx_L0;
6484   __pyx_L1_error:;
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);
6490   __pyx_L0:;
6491   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6492   #if !CYTHON_USE_EXC_INFO_STACK
6493   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6494   #endif
6495   __pyx_generator->resume_label = -1;
6496   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6497   __Pyx_RefNannyFinishContext();
6498   return __pyx_r;
6499 }
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 */
6501
6502 /* "lxml/_elementpath.py":224
6503  *             else:
6504  *                 index = -1
6505  *         def select(result):             # <<<<<<<<<<<<<<
6506  *             for elem in result:
6507  *                 parent = elem.getparent()
6508  */
6509
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));
6518
6519   /* function exit code */
6520   __Pyx_RefNannyFinishContext();
6521   return __pyx_r;
6522 }
6523
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)
6537   } else {
6538     __Pyx_GOTREF(__pyx_cur_scope);
6539   }
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);
6546   {
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;
6551   }
6552
6553   /* function exit code */
6554   __pyx_L1_error:;
6555   __Pyx_AddTraceback("lxml._elementpath.prepare_predicate.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6556   __pyx_r = NULL;
6557   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6558   __Pyx_XGIVEREF(__pyx_r);
6559   __Pyx_RefNannyFinishContext();
6560   return __pyx_r;
6561 }
6562
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 */
6564 {
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;
6573   int __pyx_t_7;
6574   int __pyx_t_8;
6575   PyObject *__pyx_t_9 = NULL;
6576   PyObject *__pyx_t_10 = NULL;
6577   PyObject *__pyx_t_11 = NULL;
6578   PyObject *__pyx_t_12 = NULL;
6579   int __pyx_t_13;
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();
6590     return NULL;
6591   }
6592   __pyx_L3_first_run:;
6593   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 224, __pyx_L1_error)
6594
6595   /* "lxml/_elementpath.py":225
6596  *                 index = -1
6597  *         def select(result):
6598  *             for elem in result:             # <<<<<<<<<<<<<<
6599  *                 parent = elem.getparent()
6600  *                 if parent is None:
6601  */
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;
6604     __pyx_t_3 = NULL;
6605   } else {
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)
6609   }
6610   for (;;) {
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)
6616         #else
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);
6619         #endif
6620       } else {
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)
6624         #else
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);
6627         #endif
6628       }
6629     } else {
6630       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6631       if (unlikely(!__pyx_t_4)) {
6632         PyObject* exc_type = PyErr_Occurred();
6633         if (exc_type) {
6634           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6635           else __PYX_ERR(0, 225, __pyx_L1_error)
6636         }
6637         break;
6638       }
6639       __Pyx_GOTREF(__pyx_t_4);
6640     }
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);
6644     __pyx_t_4 = 0;
6645
6646     /* "lxml/_elementpath.py":226
6647  *         def select(result):
6648  *             for elem in result:
6649  *                 parent = elem.getparent()             # <<<<<<<<<<<<<<
6650  *                 if parent is None:
6651  *                     continue
6652  */
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);
6655     __pyx_t_6 = NULL;
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);
6663       }
6664     }
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);
6673     __pyx_t_4 = 0;
6674
6675     /* "lxml/_elementpath.py":227
6676  *             for elem in result:
6677  *                 parent = elem.getparent()
6678  *                 if parent is None:             # <<<<<<<<<<<<<<
6679  *                     continue
6680  *                 try:
6681  */
6682     __pyx_t_7 = (__pyx_cur_scope->__pyx_v_parent == Py_None);
6683     __pyx_t_8 = (__pyx_t_7 != 0);
6684     if (__pyx_t_8) {
6685
6686       /* "lxml/_elementpath.py":228
6687  *                 parent = elem.getparent()
6688  *                 if parent is None:
6689  *                     continue             # <<<<<<<<<<<<<<
6690  *                 try:
6691  *                     # FIXME: what if the selector is "*" ?
6692  */
6693       goto __pyx_L4_continue;
6694
6695       /* "lxml/_elementpath.py":227
6696  *             for elem in result:
6697  *                 parent = elem.getparent()
6698  *                 if parent is None:             # <<<<<<<<<<<<<<
6699  *                     continue
6700  *                 try:
6701  */
6702     }
6703
6704     /* "lxml/_elementpath.py":229
6705  *                 if parent is None:
6706  *                     continue
6707  *                 try:             # <<<<<<<<<<<<<<
6708  *                     # FIXME: what if the selector is "*" ?
6709  *                     elems = list(parent.iterchildren(elem.tag))
6710  */
6711     {
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);
6716       /*try:*/ {
6717
6718         /* "lxml/_elementpath.py":231
6719  *                 try:
6720  *                     # FIXME: what if the selector is "*" ?
6721  *                     elems = list(parent.iterchildren(elem.tag))             # <<<<<<<<<<<<<<
6722  *                     if elems[index] is elem:
6723  *                         yield elem
6724  */
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);
6729         __pyx_t_12 = NULL;
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);
6737           }
6738         }
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);
6751         __pyx_t_5 = 0;
6752
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:             # <<<<<<<<<<<<<<
6757  *                         yield elem
6758  *                 except IndexError:
6759  */
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);
6766         if (__pyx_t_7) {
6767
6768           /* "lxml/_elementpath.py":233
6769  *                     elems = list(parent.iterchildren(elem.tag))
6770  *                     if elems[index] is elem:
6771  *                         yield elem             # <<<<<<<<<<<<<<
6772  *                 except IndexError:
6773  *                     pass
6774  */
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;
6792           return __pyx_r;
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)
6809
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:             # <<<<<<<<<<<<<<
6814  *                         yield elem
6815  *                 except IndexError:
6816  */
6817         }
6818
6819         /* "lxml/_elementpath.py":229
6820  *                 if parent is None:
6821  *                     continue
6822  *                 try:             # <<<<<<<<<<<<<<
6823  *                     # FIXME: what if the selector is "*" ?
6824  *                     elems = list(parent.iterchildren(elem.tag))
6825  */
6826       }
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;
6831       __pyx_L7_error:;
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;
6836
6837       /* "lxml/_elementpath.py":234
6838  *                     if elems[index] is elem:
6839  *                         yield elem
6840  *                 except IndexError:             # <<<<<<<<<<<<<<
6841  *                     pass
6842  *         return select
6843  */
6844       __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
6845       if (__pyx_t_13) {
6846         __Pyx_ErrRestore(0,0,0);
6847         goto __pyx_L8_exception_handled;
6848       }
6849       goto __pyx_L9_except_error;
6850       __pyx_L9_except_error:;
6851
6852       /* "lxml/_elementpath.py":229
6853  *                 if parent is None:
6854  *                     continue
6855  *                 try:             # <<<<<<<<<<<<<<
6856  *                     # FIXME: what if the selector is "*" ?
6857  *                     elems = list(parent.iterchildren(elem.tag))
6858  */
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);
6869       __pyx_L14_try_end:;
6870     }
6871
6872     /* "lxml/_elementpath.py":225
6873  *                 index = -1
6874  *         def select(result):
6875  *             for elem in result:             # <<<<<<<<<<<<<<
6876  *                 parent = elem.getparent()
6877  *                 if parent is None:
6878  */
6879     __pyx_L4_continue:;
6880   }
6881   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6882   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
6883
6884   /* "lxml/_elementpath.py":224
6885  *             else:
6886  *                 index = -1
6887  *         def select(result):             # <<<<<<<<<<<<<<
6888  *             for elem in result:
6889  *                 parent = elem.getparent()
6890  */
6891
6892   /* function exit code */
6893   PyErr_SetNone(PyExc_StopIteration);
6894   goto __pyx_L0;
6895   __pyx_L1_error:;
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);
6902   __pyx_L0:;
6903   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
6904   #if !CYTHON_USE_EXC_INFO_STACK
6905   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6906   #endif
6907   __pyx_generator->resume_label = -1;
6908   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
6909   __Pyx_RefNannyFinishContext();
6910   return __pyx_r;
6911 }
6912
6913 /* "lxml/_elementpath.py":141
6914  *     return select
6915  * 
6916  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
6917  *     # FIXME: replace with real parser!!! refs:
6918  *     # http://effbot.org/zone/simple-iterator-parser.htm
6919  */
6920
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;
6931   int __pyx_t_4;
6932   int __pyx_t_5;
6933   int __pyx_t_6;
6934   int __pyx_t_7;
6935   PyObject *__pyx_t_8 = NULL;
6936   int __pyx_t_9;
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)
6950   } else {
6951     __Pyx_GOTREF(__pyx_cur_scope);
6952   }
6953   __Pyx_INCREF(__pyx_v_token);
6954
6955   /* "lxml/_elementpath.py":145
6956  *     # http://effbot.org/zone/simple-iterator-parser.htm
6957  *     # http://javascript.crockford.com/tdop/tdop.html
6958  *     signature = ''             # <<<<<<<<<<<<<<
6959  *     predicate = []
6960  *     while 1:
6961  */
6962   __Pyx_INCREF(__pyx_kp_s__2);
6963   __pyx_v_signature = __pyx_kp_s__2;
6964
6965   /* "lxml/_elementpath.py":146
6966  *     # http://javascript.crockford.com/tdop/tdop.html
6967  *     signature = ''
6968  *     predicate = []             # <<<<<<<<<<<<<<
6969  *     while 1:
6970  *         token = next()
6971  */
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);
6975   __pyx_t_1 = 0;
6976
6977   /* "lxml/_elementpath.py":147
6978  *     signature = ''
6979  *     predicate = []
6980  *     while 1:             # <<<<<<<<<<<<<<
6981  *         token = next()
6982  *         if token[0] == "]":
6983  */
6984   while (1) {
6985
6986     /* "lxml/_elementpath.py":148
6987  *     predicate = []
6988  *     while 1:
6989  *         token = next()             # <<<<<<<<<<<<<<
6990  *         if token[0] == "]":
6991  *             break
6992  */
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);
7002       }
7003     }
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);
7010     __pyx_t_1 = 0;
7011
7012     /* "lxml/_elementpath.py":149
7013  *     while 1:
7014  *         token = next()
7015  *         if token[0] == "]":             # <<<<<<<<<<<<<<
7016  *             break
7017  *         if token == ('', ''):
7018  */
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;
7023     if (__pyx_t_4) {
7024
7025       /* "lxml/_elementpath.py":150
7026  *         token = next()
7027  *         if token[0] == "]":
7028  *             break             # <<<<<<<<<<<<<<
7029  *         if token == ('', ''):
7030  *             # ignore whitespace
7031  */
7032       goto __pyx_L4_break;
7033
7034       /* "lxml/_elementpath.py":149
7035  *     while 1:
7036  *         token = next()
7037  *         if token[0] == "]":             # <<<<<<<<<<<<<<
7038  *             break
7039  *         if token == ('', ''):
7040  */
7041     }
7042
7043     /* "lxml/_elementpath.py":151
7044  *         if token[0] == "]":
7045  *             break
7046  *         if token == ('', ''):             # <<<<<<<<<<<<<<
7047  *             # ignore whitespace
7048  *             continue
7049  */
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;
7053     if (__pyx_t_4) {
7054
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]
7061  */
7062       goto __pyx_L3_continue;
7063
7064       /* "lxml/_elementpath.py":151
7065  *         if token[0] == "]":
7066  *             break
7067  *         if token == ('', ''):             # <<<<<<<<<<<<<<
7068  *             # ignore whitespace
7069  *             continue
7070  */
7071     }
7072
7073     /* "lxml/_elementpath.py":154
7074  *             # ignore whitespace
7075  *             continue
7076  *         if token[0] and token[0][:1] in "'\"":             # <<<<<<<<<<<<<<
7077  *             token = "'", token[0][1:-1]
7078  *         signature += token[0] or "-"
7079  */
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;
7084     if (__pyx_t_5) {
7085     } else {
7086       __pyx_t_4 = __pyx_t_5;
7087       goto __pyx_L8_bool_binop_done;
7088     }
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:;
7099     if (__pyx_t_4) {
7100
7101       /* "lxml/_elementpath.py":155
7102  *             continue
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])
7107  */
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);
7120       __pyx_t_1 = 0;
7121       __Pyx_DECREF_SET(__pyx_v_token, __pyx_t_2);
7122       __pyx_t_2 = 0;
7123
7124       /* "lxml/_elementpath.py":154
7125  *             # ignore whitespace
7126  *             continue
7127  *         if token[0] and token[0][:1] in "'\"":             # <<<<<<<<<<<<<<
7128  *             token = "'", token[0][1:-1]
7129  *         signature += token[0] or "-"
7130  */
7131     }
7132
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])
7138  * 
7139  */
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)
7143     if (!__pyx_t_4) {
7144       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7145     } else {
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;
7150     }
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);
7158     __pyx_t_1 = 0;
7159
7160     /* "lxml/_elementpath.py":157
7161  *             token = "'", token[0][1:-1]
7162  *         signature += token[0] or "-"
7163  *         predicate.append(token[1])             # <<<<<<<<<<<<<<
7164  * 
7165  *     # use signature to determine predicate type
7166  */
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;
7171     __pyx_L3_continue:;
7172   }
7173   __pyx_L4_break:;
7174
7175   /* "lxml/_elementpath.py":160
7176  * 
7177  *     # use signature to determine predicate type
7178  *     if signature == "@-":             # <<<<<<<<<<<<<<
7179  *         # [@attribute] predicate
7180  *         key = predicate[1]
7181  */
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)
7183   if (__pyx_t_4) {
7184
7185     /* "lxml/_elementpath.py":162
7186  *     if signature == "@-":
7187  *         # [@attribute] predicate
7188  *         key = predicate[1]             # <<<<<<<<<<<<<<
7189  *         def select(result):
7190  *             for elem in result:
7191  */
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;
7196     __pyx_t_1 = 0;
7197
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:
7204  */
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;
7208     __pyx_t_1 = 0;
7209
7210     /* "lxml/_elementpath.py":167
7211  *                 if elem.get(key) is not None:
7212  *                     yield elem
7213  *         return select             # <<<<<<<<<<<<<<
7214  *     if signature == "@-='":
7215  *         # [@attribute='value']
7216  */
7217     __Pyx_XDECREF(__pyx_r);
7218     __Pyx_INCREF(__pyx_v_select);
7219     __pyx_r = __pyx_v_select;
7220     goto __pyx_L0;
7221
7222     /* "lxml/_elementpath.py":160
7223  * 
7224  *     # use signature to determine predicate type
7225  *     if signature == "@-":             # <<<<<<<<<<<<<<
7226  *         # [@attribute] predicate
7227  *         key = predicate[1]
7228  */
7229   }
7230
7231   /* "lxml/_elementpath.py":168
7232  *                     yield elem
7233  *         return select
7234  *     if signature == "@-='":             # <<<<<<<<<<<<<<
7235  *         # [@attribute='value']
7236  *         key = predicate[1]
7237  */
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)
7239   if (__pyx_t_4) {
7240
7241     /* "lxml/_elementpath.py":170
7242  *     if signature == "@-='":
7243  *         # [@attribute='value']
7244  *         key = predicate[1]             # <<<<<<<<<<<<<<
7245  *         value = predicate[-1]
7246  *         def select(result):
7247  */
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;
7252     __pyx_t_1 = 0;
7253
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:
7260  */
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;
7265     __pyx_t_1 = 0;
7266
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:
7273  */
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;
7277     __pyx_t_1 = 0;
7278
7279     /* "lxml/_elementpath.py":176
7280  *                 if elem.get(key) == value:
7281  *                     yield elem
7282  *         return select             # <<<<<<<<<<<<<<
7283  *     if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
7284  *         # [tag]
7285  */
7286     __Pyx_XDECREF(__pyx_r);
7287     __Pyx_INCREF(__pyx_v_select);
7288     __pyx_r = __pyx_v_select;
7289     goto __pyx_L0;
7290
7291     /* "lxml/_elementpath.py":168
7292  *                     yield elem
7293  *         return select
7294  *     if signature == "@-='":             # <<<<<<<<<<<<<<
7295  *         # [@attribute='value']
7296  *         key = predicate[1]
7297  */
7298   }
7299
7300   /* "lxml/_elementpath.py":177
7301  *                     yield elem
7302  *         return select
7303  *     if signature == "-" and not re.match(r"-?\d+$", predicate[0]):             # <<<<<<<<<<<<<<
7304  *         # [tag]
7305  *         tag = predicate[0]
7306  */
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)
7308   if (__pyx_t_6) {
7309   } else {
7310     __pyx_t_4 = __pyx_t_6;
7311     goto __pyx_L15_bool_binop_done;
7312   }
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);
7320   __pyx_t_8 = NULL;
7321   __pyx_t_9 = 0;
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);
7329       __pyx_t_9 = 1;
7330     }
7331   }
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;
7339   } else
7340   #endif
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;
7348   } else
7349   #endif
7350   {
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);
7353     if (__pyx_t_8) {
7354       __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
7355     }
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);
7361     __pyx_t_2 = 0;
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;
7365   }
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:;
7372   if (__pyx_t_4) {
7373
7374     /* "lxml/_elementpath.py":179
7375  *     if signature == "-" and not re.match(r"-?\d+$", predicate[0]):
7376  *         # [tag]
7377  *         tag = predicate[0]             # <<<<<<<<<<<<<<
7378  *         def select(result):
7379  *             for elem in result:
7380  */
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;
7385     __pyx_t_1 = 0;
7386
7387     /* "lxml/_elementpath.py":180
7388  *         # [tag]
7389  *         tag = predicate[0]
7390  *         def select(result):             # <<<<<<<<<<<<<<
7391  *             for elem in result:
7392  *                 for _ in elem.iterchildren(tag):
7393  */
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;
7397     __pyx_t_1 = 0;
7398
7399     /* "lxml/_elementpath.py":185
7400  *                     yield elem
7401  *                     break
7402  *         return select             # <<<<<<<<<<<<<<
7403  *     if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):
7404  *         # [.='value'] or [tag='value']
7405  */
7406     __Pyx_XDECREF(__pyx_r);
7407     __Pyx_INCREF(__pyx_v_select);
7408     __pyx_r = __pyx_v_select;
7409     goto __pyx_L0;
7410
7411     /* "lxml/_elementpath.py":177
7412  *                     yield elem
7413  *         return select
7414  *     if signature == "-" and not re.match(r"-?\d+$", predicate[0]):             # <<<<<<<<<<<<<<
7415  *         # [tag]
7416  *         tag = predicate[0]
7417  */
7418   }
7419
7420   /* "lxml/_elementpath.py":186
7421  *                     break
7422  *         return select
7423  *     if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):             # <<<<<<<<<<<<<<
7424  *         # [.='value'] or [tag='value']
7425  *         tag = predicate[0]
7426  */
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)
7428   if (!__pyx_t_5) {
7429   } else {
7430     __pyx_t_4 = __pyx_t_5;
7431     goto __pyx_L18_bool_binop_done;
7432   }
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)
7434   if (__pyx_t_5) {
7435   } else {
7436     __pyx_t_4 = __pyx_t_5;
7437     goto __pyx_L18_bool_binop_done;
7438   }
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);
7446   __pyx_t_2 = NULL;
7447   __pyx_t_9 = 0;
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);
7455       __pyx_t_9 = 1;
7456     }
7457   }
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;
7465   } else
7466   #endif
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;
7474   } else
7475   #endif
7476   {
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);
7479     if (__pyx_t_2) {
7480       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
7481     }
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);
7487     __pyx_t_3 = 0;
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;
7491   }
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:;
7498   if (__pyx_t_4) {
7499
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]
7505  *         if tag:
7506  */
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;
7511     __pyx_t_1 = 0;
7512
7513     /* "lxml/_elementpath.py":189
7514  *         # [.='value'] or [tag='value']
7515  *         tag = predicate[0]
7516  *         value = predicate[-1]             # <<<<<<<<<<<<<<
7517  *         if tag:
7518  *             def select(result):
7519  */
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;
7524     __pyx_t_1 = 0;
7525
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:
7532  */
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)
7534     if (__pyx_t_4) {
7535
7536       /* "lxml/_elementpath.py":191
7537  *         value = predicate[-1]
7538  *         if tag:
7539  *             def select(result):             # <<<<<<<<<<<<<<
7540  *                 for elem in result:
7541  *                     for e in elem.iterchildren(tag):
7542  */
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;
7546       __pyx_t_1 = 0;
7547
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:
7554  */
7555       goto __pyx_L21;
7556     }
7557
7558     /* "lxml/_elementpath.py":198
7559  *                             break
7560  *         else:
7561  *             def select(result):             # <<<<<<<<<<<<<<
7562  *                 for elem in result:
7563  *                     if "".join(elem.itertext()) == value:
7564  */
7565     /*else*/ {
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;
7569       __pyx_t_1 = 0;
7570     }
7571     __pyx_L21:;
7572
7573     /* "lxml/_elementpath.py":202
7574  *                     if "".join(elem.itertext()) == value:
7575  *                         yield elem
7576  *         return select             # <<<<<<<<<<<<<<
7577  *     if signature == "-" or signature == "-()" or signature == "-()-":
7578  *         # [index] or [last()] or [last()-index]
7579  */
7580     __Pyx_XDECREF(__pyx_r);
7581     __Pyx_INCREF(__pyx_v_select);
7582     __pyx_r = __pyx_v_select;
7583     goto __pyx_L0;
7584
7585     /* "lxml/_elementpath.py":186
7586  *                     break
7587  *         return select
7588  *     if signature == ".='" or (signature == "-='" and not re.match(r"-?\d+$", predicate[0])):             # <<<<<<<<<<<<<<
7589  *         # [.='value'] or [tag='value']
7590  *         tag = predicate[0]
7591  */
7592   }
7593
7594   /* "lxml/_elementpath.py":203
7595  *                         yield elem
7596  *         return select
7597  *     if signature == "-" or signature == "-()" or signature == "-()-":             # <<<<<<<<<<<<<<
7598  *         # [index] or [last()] or [last()-index]
7599  *         if signature == "-":
7600  */
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)
7602   if (!__pyx_t_6) {
7603   } else {
7604     __pyx_t_4 = __pyx_t_6;
7605     goto __pyx_L23_bool_binop_done;
7606   }
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)
7608   if (!__pyx_t_6) {
7609   } else {
7610     __pyx_t_4 = __pyx_t_6;
7611     goto __pyx_L23_bool_binop_done;
7612   }
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:;
7616   if (__pyx_t_4) {
7617
7618     /* "lxml/_elementpath.py":205
7619  *     if signature == "-" or signature == "-()" or signature == "-()-":
7620  *         # [index] or [last()] or [last()-index]
7621  *         if signature == "-":             # <<<<<<<<<<<<<<
7622  *             # [index]
7623  *             index = int(predicate[0]) - 1
7624  */
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)
7626     if (__pyx_t_4) {
7627
7628       /* "lxml/_elementpath.py":207
7629  *         if signature == "-":
7630  *             # [index]
7631  *             index = int(predicate[0]) - 1             # <<<<<<<<<<<<<<
7632  *             if index < 0:
7633  *                 if index == -1:
7634  */
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;
7645       __pyx_t_1 = 0;
7646
7647       /* "lxml/_elementpath.py":208
7648  *             # [index]
7649  *             index = int(predicate[0]) - 1
7650  *             if index < 0:             # <<<<<<<<<<<<<<
7651  *                 if index == -1:
7652  *                     raise SyntaxError(
7653  */
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;
7657       if (__pyx_t_4) {
7658
7659         /* "lxml/_elementpath.py":209
7660  *             index = int(predicate[0]) - 1
7661  *             if index < 0:
7662  *                 if index == -1:             # <<<<<<<<<<<<<<
7663  *                     raise SyntaxError(
7664  *                         "indices in path predicates are 1-based, not 0-based")
7665  */
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)) {
7671
7672           /* "lxml/_elementpath.py":210
7673  *             if index < 0:
7674  *                 if index == -1:
7675  *                     raise SyntaxError(             # <<<<<<<<<<<<<<
7676  *                         "indices in path predicates are 1-based, not 0-based")
7677  *                 else:
7678  */
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)
7684
7685           /* "lxml/_elementpath.py":209
7686  *             index = int(predicate[0]) - 1
7687  *             if index < 0:
7688  *                 if index == -1:             # <<<<<<<<<<<<<<
7689  *                     raise SyntaxError(
7690  *                         "indices in path predicates are 1-based, not 0-based")
7691  */
7692         }
7693
7694         /* "lxml/_elementpath.py":213
7695  *                         "indices in path predicates are 1-based, not 0-based")
7696  *                 else:
7697  *                     raise SyntaxError("path index >= 1 expected")             # <<<<<<<<<<<<<<
7698  *         else:
7699  *             if predicate[0] != "last":
7700  */
7701         /*else*/ {
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)
7707         }
7708
7709         /* "lxml/_elementpath.py":208
7710  *             # [index]
7711  *             index = int(predicate[0]) - 1
7712  *             if index < 0:             # <<<<<<<<<<<<<<
7713  *                 if index == -1:
7714  *                     raise SyntaxError(
7715  */
7716       }
7717
7718       /* "lxml/_elementpath.py":205
7719  *     if signature == "-" or signature == "-()" or signature == "-()-":
7720  *         # [index] or [last()] or [last()-index]
7721  *         if signature == "-":             # <<<<<<<<<<<<<<
7722  *             # [index]
7723  *             index = int(predicate[0]) - 1
7724  */
7725       goto __pyx_L26;
7726     }
7727
7728     /* "lxml/_elementpath.py":215
7729  *                     raise SyntaxError("path index >= 1 expected")
7730  *         else:
7731  *             if predicate[0] != "last":             # <<<<<<<<<<<<<<
7732  *                 raise SyntaxError("unsupported function")
7733  *             if signature == "-()-":
7734  */
7735     /*else*/ {
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)) {
7741
7742         /* "lxml/_elementpath.py":216
7743  *         else:
7744  *             if predicate[0] != "last":
7745  *                 raise SyntaxError("unsupported function")             # <<<<<<<<<<<<<<
7746  *             if signature == "-()-":
7747  *                 try:
7748  */
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)
7754
7755         /* "lxml/_elementpath.py":215
7756  *                     raise SyntaxError("path index >= 1 expected")
7757  *         else:
7758  *             if predicate[0] != "last":             # <<<<<<<<<<<<<<
7759  *                 raise SyntaxError("unsupported function")
7760  *             if signature == "-()-":
7761  */
7762       }
7763
7764       /* "lxml/_elementpath.py":217
7765  *             if predicate[0] != "last":
7766  *                 raise SyntaxError("unsupported function")
7767  *             if signature == "-()-":             # <<<<<<<<<<<<<<
7768  *                 try:
7769  *                     index = int(predicate[2]) - 1
7770  */
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)
7772       if (__pyx_t_4) {
7773
7774         /* "lxml/_elementpath.py":218
7775  *                 raise SyntaxError("unsupported function")
7776  *             if signature == "-()-":
7777  *                 try:             # <<<<<<<<<<<<<<
7778  *                     index = int(predicate[2]) - 1
7779  *                 except ValueError:
7780  */
7781         {
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);
7788           /*try:*/ {
7789
7790             /* "lxml/_elementpath.py":219
7791  *             if signature == "-()-":
7792  *                 try:
7793  *                     index = int(predicate[2]) - 1             # <<<<<<<<<<<<<<
7794  *                 except ValueError:
7795  *                     raise SyntaxError("unsupported expression")
7796  */
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;
7807             __pyx_t_1 = 0;
7808
7809             /* "lxml/_elementpath.py":218
7810  *                 raise SyntaxError("unsupported function")
7811  *             if signature == "-()-":
7812  *                 try:             # <<<<<<<<<<<<<<
7813  *                     index = int(predicate[2]) - 1
7814  *                 except ValueError:
7815  */
7816           }
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;
7821           __pyx_L31_error:;
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;
7827
7828           /* "lxml/_elementpath.py":220
7829  *                 try:
7830  *                     index = int(predicate[2]) - 1
7831  *                 except ValueError:             # <<<<<<<<<<<<<<
7832  *                     raise SyntaxError("unsupported expression")
7833  *             else:
7834  */
7835           __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
7836           if (__pyx_t_9) {
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);
7842
7843             /* "lxml/_elementpath.py":221
7844  *                     index = int(predicate[2]) - 1
7845  *                 except ValueError:
7846  *                     raise SyntaxError("unsupported expression")             # <<<<<<<<<<<<<<
7847  *             else:
7848  *                 index = -1
7849  */
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)
7855           }
7856           goto __pyx_L33_except_error;
7857           __pyx_L33_except_error:;
7858
7859           /* "lxml/_elementpath.py":218
7860  *                 raise SyntaxError("unsupported function")
7861  *             if signature == "-()-":
7862  *                 try:             # <<<<<<<<<<<<<<
7863  *                     index = int(predicate[2]) - 1
7864  *                 except ValueError:
7865  */
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;
7871           __pyx_L36_try_end:;
7872         }
7873
7874         /* "lxml/_elementpath.py":217
7875  *             if predicate[0] != "last":
7876  *                 raise SyntaxError("unsupported function")
7877  *             if signature == "-()-":             # <<<<<<<<<<<<<<
7878  *                 try:
7879  *                     index = int(predicate[2]) - 1
7880  */
7881         goto __pyx_L30;
7882       }
7883
7884       /* "lxml/_elementpath.py":223
7885  *                     raise SyntaxError("unsupported expression")
7886  *             else:
7887  *                 index = -1             # <<<<<<<<<<<<<<
7888  *         def select(result):
7889  *             for elem in result:
7890  */
7891       /*else*/ {
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;
7895       }
7896       __pyx_L30:;
7897     }
7898     __pyx_L26:;
7899
7900     /* "lxml/_elementpath.py":224
7901  *             else:
7902  *                 index = -1
7903  *         def select(result):             # <<<<<<<<<<<<<<
7904  *             for elem in result:
7905  *                 parent = elem.getparent()
7906  */
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;
7910     __pyx_t_8 = 0;
7911
7912     /* "lxml/_elementpath.py":236
7913  *                 except IndexError:
7914  *                     pass
7915  *         return select             # <<<<<<<<<<<<<<
7916  *     raise SyntaxError("invalid predicate")
7917  * 
7918  */
7919     __Pyx_XDECREF(__pyx_r);
7920     __Pyx_INCREF(__pyx_v_select);
7921     __pyx_r = __pyx_v_select;
7922     goto __pyx_L0;
7923
7924     /* "lxml/_elementpath.py":203
7925  *                         yield elem
7926  *         return select
7927  *     if signature == "-" or signature == "-()" or signature == "-()-":             # <<<<<<<<<<<<<<
7928  *         # [index] or [last()] or [last()-index]
7929  *         if signature == "-":
7930  */
7931   }
7932
7933   /* "lxml/_elementpath.py":237
7934  *                     pass
7935  *         return select
7936  *     raise SyntaxError("invalid predicate")             # <<<<<<<<<<<<<<
7937  * 
7938  * ops = {
7939  */
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)
7945
7946   /* "lxml/_elementpath.py":141
7947  *     return select
7948  * 
7949  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
7950  *     # FIXME: replace with real parser!!! refs:
7951  *     # http://effbot.org/zone/simple-iterator-parser.htm
7952  */
7953
7954   /* function exit code */
7955   __pyx_L1_error:;
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);
7962   __pyx_r = NULL;
7963   __pyx_L0:;
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();
7971   return __pyx_r;
7972 }
7973
7974 /* "lxml/_elementpath.py":254
7975  * 
7976  * 
7977  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
7978  *     """compile selector pattern"""
7979  *     if path[-1:] == "/":
7980  */
7981
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);
7995   {
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)) {
7999       Py_ssize_t kw_args;
8000       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8001       switch (pos_args) {
8002         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8003         CYTHON_FALLTHROUGH;
8004         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8005         CYTHON_FALLTHROUGH;
8006         case  0: break;
8007         default: goto __pyx_L5_argtuple_error;
8008       }
8009       kw_args = PyDict_Size(__pyx_kwds);
8010       switch (pos_args) {
8011         case  0:
8012         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
8013         else goto __pyx_L5_argtuple_error;
8014         CYTHON_FALLTHROUGH;
8015         case  1:
8016         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces)) != 0)) kw_args--;
8017         else {
8018           __Pyx_RaiseArgtupleInvalid("_build_path_iterator", 1, 2, 2, 1); __PYX_ERR(0, 254, __pyx_L3_error)
8019         }
8020       }
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)
8023       }
8024     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8025       goto __pyx_L5_argtuple_error;
8026     } else {
8027       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8028       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8029     }
8030     __pyx_v_path = values[0];
8031     __pyx_v_namespaces = values[1];
8032   }
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)
8036   __pyx_L3_error:;
8037   __Pyx_AddTraceback("lxml._elementpath._build_path_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8038   __Pyx_RefNannyFinishContext();
8039   return NULL;
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);
8042
8043   /* function exit code */
8044   __Pyx_RefNannyFinishContext();
8045   return __pyx_r;
8046 }
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 */
8048
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))             # <<<<<<<<<<<<<<
8053  *         else:
8054  *             cache_key += tuple(sorted(namespaces.items()))
8055  */
8056
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)
8070   } else {
8071     __Pyx_GOTREF(__pyx_cur_scope);
8072   }
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);
8076   {
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;
8081   }
8082
8083   /* function exit code */
8084   __pyx_L1_error:;
8085   __Pyx_AddTraceback("lxml._elementpath._build_path_iterator.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8086   __pyx_r = NULL;
8087   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8088   __Pyx_XGIVEREF(__pyx_r);
8089   __Pyx_RefNannyFinishContext();
8090   return __pyx_r;
8091 }
8092
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 */
8094 {
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 *);
8102   int __pyx_t_6;
8103   int __pyx_t_7;
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();
8113     return NULL;
8114   }
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);
8122   __pyx_t_3 = NULL;
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);
8130     }
8131   }
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;
8139     __pyx_t_5 = NULL;
8140   } else {
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)
8144   }
8145   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8146   for (;;) {
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)
8152         #else
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);
8155         #endif
8156       } else {
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)
8160         #else
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);
8163         #endif
8164       }
8165     } else {
8166       __pyx_t_1 = __pyx_t_5(__pyx_t_2);
8167       if (unlikely(!__pyx_t_1)) {
8168         PyObject* exc_type = PyErr_Occurred();
8169         if (exc_type) {
8170           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8171           else __PYX_ERR(0, 269, __pyx_L1_error)
8172         }
8173         break;
8174       }
8175       __Pyx_GOTREF(__pyx_t_1);
8176     }
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);
8180     __pyx_t_1 = 0;
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);
8186     if (__pyx_t_7) {
8187       if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_item))) __PYX_ERR(0, 269, __pyx_L1_error)
8188     }
8189   }
8190   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8191   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
8192
8193   /* function exit code */
8194   goto __pyx_L0;
8195   __pyx_L1_error:;
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);
8201   __pyx_L0:;
8202   __Pyx_XGIVEREF(__pyx_r);
8203   #if !CYTHON_USE_EXC_INFO_STACK
8204   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
8205   #endif
8206   __pyx_generator->resume_label = -1;
8207   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
8208   __Pyx_RefNannyFinishContext();
8209   return __pyx_r;
8210 }
8211
8212 /* "lxml/_elementpath.py":254
8213  * 
8214  * 
8215  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
8216  *     """compile selector pattern"""
8217  *     if path[-1:] == "/":
8218  */
8219
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;
8230   int __pyx_t_2;
8231   int __pyx_t_3;
8232   int __pyx_t_4;
8233   PyObject *__pyx_t_5 = NULL;
8234   PyObject *__pyx_t_6 = NULL;
8235   PyObject *__pyx_t_7 = NULL;
8236   int __pyx_t_8;
8237   PyObject *__pyx_t_9 = NULL;
8238   PyObject *__pyx_t_10 = NULL;
8239   PyObject *__pyx_t_11 = NULL;
8240   int __pyx_t_12;
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)
8251   } else {
8252     __Pyx_GOTREF(__pyx_cur_scope);
8253   }
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);
8258
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?)
8264  * 
8265  */
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;
8270   if (__pyx_t_2) {
8271
8272     /* "lxml/_elementpath.py":257
8273  *     """compile selector pattern"""
8274  *     if path[-1:] == "/":
8275  *         path += "*"  # implicit all (FIXME: keep this?)             # <<<<<<<<<<<<<<
8276  * 
8277  *     cache_key = (path,)
8278  */
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);
8282     __pyx_t_1 = 0;
8283
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?)
8289  * 
8290  */
8291   }
8292
8293   /* "lxml/_elementpath.py":259
8294  *         path += "*"  # implicit all (FIXME: keep this?)
8295  * 
8296  *     cache_key = (path,)             # <<<<<<<<<<<<<<
8297  *     if namespaces:
8298  *         # lxml originally used None for the default namespace but ElementTree uses the
8299  */
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);
8306   __pyx_t_1 = 0;
8307
8308   /* "lxml/_elementpath.py":260
8309  * 
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,
8314  */
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)
8316   if (__pyx_t_2) {
8317
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" % (
8324  */
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);
8327     if (__pyx_t_3) {
8328
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['']))
8335  */
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);
8338       if (__pyx_t_4) {
8339       } else {
8340         __pyx_t_3 = __pyx_t_4;
8341         goto __pyx_L7_bool_binop_done;
8342       }
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)) {
8355
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))
8362  */
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);
8373         __pyx_t_6 = 0;
8374         __pyx_t_5 = 0;
8375
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(
8382  */
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)
8392
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['']))
8399  */
8400       }
8401
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))
8407  *         else:
8408  */
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);
8415       __pyx_t_1 = 0;
8416
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))             # <<<<<<<<<<<<<<
8421  *         else:
8422  *             cache_key += tuple(sorted(namespaces.items()))
8423  */
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);
8426
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))
8432  *         else:
8433  */
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);
8438       __pyx_t_7 = 0;
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)
8443       }
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));
8455       __pyx_t_7 = 0;
8456
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" % (
8463  */
8464       goto __pyx_L5;
8465     }
8466
8467     /* "lxml/_elementpath.py":271
8468  *                 item for item in namespaces.items() if item[0] is not None))
8469  *         else:
8470  *             cache_key += tuple(sorted(namespaces.items()))             # <<<<<<<<<<<<<<
8471  * 
8472  *     try:
8473  */
8474     /*else*/ {
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);
8477       __pyx_t_6 = NULL;
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);
8485         }
8486       }
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);
8496       __pyx_t_5 = 0;
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)
8501       }
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));
8509       __pyx_t_7 = 0;
8510     }
8511     __pyx_L5:;
8512
8513     /* "lxml/_elementpath.py":260
8514  * 
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,
8519  */
8520   }
8521
8522   /* "lxml/_elementpath.py":273
8523  *             cache_key += tuple(sorted(namespaces.items()))
8524  * 
8525  *     try:             # <<<<<<<<<<<<<<
8526  *         return _cache[cache_key]
8527  *     except KeyError:
8528  */
8529   {
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);
8536     /*try:*/ {
8537
8538       /* "lxml/_elementpath.py":274
8539  * 
8540  *     try:
8541  *         return _cache[cache_key]             # <<<<<<<<<<<<<<
8542  *     except KeyError:
8543  *         pass
8544  */
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;
8552       __pyx_t_5 = 0;
8553       goto __pyx_L13_try_return;
8554
8555       /* "lxml/_elementpath.py":273
8556  *             cache_key += tuple(sorted(namespaces.items()))
8557  * 
8558  *     try:             # <<<<<<<<<<<<<<
8559  *         return _cache[cache_key]
8560  *     except KeyError:
8561  */
8562     }
8563     __pyx_L9_error:;
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;
8568
8569     /* "lxml/_elementpath.py":275
8570  *     try:
8571  *         return _cache[cache_key]
8572  *     except KeyError:             # <<<<<<<<<<<<<<
8573  *         pass
8574  *     if len(_cache) > 100:
8575  */
8576     __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
8577     if (__pyx_t_12) {
8578       __Pyx_ErrRestore(0,0,0);
8579       goto __pyx_L10_exception_handled;
8580     }
8581     goto __pyx_L11_except_error;
8582     __pyx_L11_except_error:;
8583
8584     /* "lxml/_elementpath.py":273
8585  *             cache_key += tuple(sorted(namespaces.items()))
8586  * 
8587  *     try:             # <<<<<<<<<<<<<<
8588  *         return _cache[cache_key]
8589  *     except KeyError:
8590  */
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);
8601     goto __pyx_L0;
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);
8607   }
8608
8609   /* "lxml/_elementpath.py":277
8610  *     except KeyError:
8611  *         pass
8612  *     if len(_cache) > 100:             # <<<<<<<<<<<<<<
8613  *         _cache.clear()
8614  * 
8615  */
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);
8621   if (__pyx_t_3) {
8622
8623     /* "lxml/_elementpath.py":278
8624  *         pass
8625  *     if len(_cache) > 100:
8626  *         _cache.clear()             # <<<<<<<<<<<<<<
8627  * 
8628  *     if path[:1] == "/":
8629  */
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;
8635     __pyx_t_7 = NULL;
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);
8643       }
8644     }
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;
8651
8652     /* "lxml/_elementpath.py":277
8653  *     except KeyError:
8654  *         pass
8655  *     if len(_cache) > 100:             # <<<<<<<<<<<<<<
8656  *         _cache.clear()
8657  * 
8658  */
8659   }
8660
8661   /* "lxml/_elementpath.py":280
8662  *         _cache.clear()
8663  * 
8664  *     if path[:1] == "/":             # <<<<<<<<<<<<<<
8665  *         raise SyntaxError("cannot use absolute path on element")
8666  *     stream = iter(xpath_tokenizer(path, namespaces))
8667  */
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)) {
8673
8674     /* "lxml/_elementpath.py":281
8675  * 
8676  *     if path[:1] == "/":
8677  *         raise SyntaxError("cannot use absolute path on element")             # <<<<<<<<<<<<<<
8678  *     stream = iter(xpath_tokenizer(path, namespaces))
8679  *     try:
8680  */
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)
8686
8687     /* "lxml/_elementpath.py":280
8688  *         _cache.clear()
8689  * 
8690  *     if path[:1] == "/":             # <<<<<<<<<<<<<<
8691  *         raise SyntaxError("cannot use absolute path on element")
8692  *     stream = iter(xpath_tokenizer(path, namespaces))
8693  */
8694   }
8695
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))             # <<<<<<<<<<<<<<
8700  *     try:
8701  *         _next = stream.next
8702  */
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);
8705   __pyx_t_7 = NULL;
8706   __pyx_t_12 = 0;
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);
8714       __pyx_t_12 = 1;
8715     }
8716   }
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);
8723   } else
8724   #endif
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);
8731   } else
8732   #endif
8733   {
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);
8736     if (__pyx_t_7) {
8737       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
8738     }
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;
8748   }
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;
8754   __pyx_t_1 = 0;
8755
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:
8762  */
8763   {
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);
8770     /*try:*/ {
8771
8772       /* "lxml/_elementpath.py":284
8773  *     stream = iter(xpath_tokenizer(path, namespaces))
8774  *     try:
8775  *         _next = stream.next             # <<<<<<<<<<<<<<
8776  *     except AttributeError:
8777  *         # Python 3
8778  */
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;
8782       __pyx_t_1 = 0;
8783
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:
8790  */
8791     }
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;
8796     __pyx_L17_error:;
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;
8801
8802     /* "lxml/_elementpath.py":285
8803  *     try:
8804  *         _next = stream.next
8805  *     except AttributeError:             # <<<<<<<<<<<<<<
8806  *         # Python 3
8807  *         _next = stream.__next__
8808  */
8809     __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
8810     if (__pyx_t_12) {
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);
8816
8817       /* "lxml/_elementpath.py":287
8818  *     except AttributeError:
8819  *         # Python 3
8820  *         _next = stream.__next__             # <<<<<<<<<<<<<<
8821  *     try:
8822  *         token = _next()
8823  */
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);
8827       __pyx_t_7 = 0;
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;
8832     }
8833     goto __pyx_L19_except_error;
8834     __pyx_L19_except_error:;
8835
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:
8842  */
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);
8853     __pyx_L22_try_end:;
8854   }
8855
8856   /* "lxml/_elementpath.py":288
8857  *         # Python 3
8858  *         _next = stream.__next__
8859  *     try:             # <<<<<<<<<<<<<<
8860  *         token = _next()
8861  *     except StopIteration:
8862  */
8863   {
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);
8870     /*try:*/ {
8871
8872       /* "lxml/_elementpath.py":289
8873  *         _next = stream.__next__
8874  *     try:
8875  *         token = _next()             # <<<<<<<<<<<<<<
8876  *     except StopIteration:
8877  *         raise SyntaxError("empty path expression")
8878  */
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);
8888         }
8889       }
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;
8896       __pyx_t_6 = 0;
8897
8898       /* "lxml/_elementpath.py":288
8899  *         # Python 3
8900  *         _next = stream.__next__
8901  *     try:             # <<<<<<<<<<<<<<
8902  *         token = _next()
8903  *     except StopIteration:
8904  */
8905     }
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;
8910     __pyx_L25_error:;
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;
8915
8916     /* "lxml/_elementpath.py":290
8917  *     try:
8918  *         token = _next()
8919  *     except StopIteration:             # <<<<<<<<<<<<<<
8920  *         raise SyntaxError("empty path expression")
8921  *     selector = []
8922  */
8923     __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
8924     if (__pyx_t_12) {
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);
8930
8931       /* "lxml/_elementpath.py":291
8932  *         token = _next()
8933  *     except StopIteration:
8934  *         raise SyntaxError("empty path expression")             # <<<<<<<<<<<<<<
8935  *     selector = []
8936  *     while 1:
8937  */
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)
8943     }
8944     goto __pyx_L27_except_error;
8945     __pyx_L27_except_error:;
8946
8947     /* "lxml/_elementpath.py":288
8948  *         # Python 3
8949  *         _next = stream.__next__
8950  *     try:             # <<<<<<<<<<<<<<
8951  *         token = _next()
8952  *     except StopIteration:
8953  */
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;
8959     __pyx_L30_try_end:;
8960   }
8961
8962   /* "lxml/_elementpath.py":292
8963  *     except StopIteration:
8964  *         raise SyntaxError("empty path expression")
8965  *     selector = []             # <<<<<<<<<<<<<<
8966  *     while 1:
8967  *         try:
8968  */
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);
8972   __pyx_t_1 = 0;
8973
8974   /* "lxml/_elementpath.py":293
8975  *         raise SyntaxError("empty path expression")
8976  *     selector = []
8977  *     while 1:             # <<<<<<<<<<<<<<
8978  *         try:
8979  *             selector.append(ops[token[0]](_next, token))
8980  */
8981   while (1) {
8982
8983     /* "lxml/_elementpath.py":294
8984  *     selector = []
8985  *     while 1:
8986  *         try:             # <<<<<<<<<<<<<<
8987  *             selector.append(ops[token[0]](_next, token))
8988  *         except StopIteration:
8989  */
8990     {
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);
8997       /*try:*/ {
8998
8999         /* "lxml/_elementpath.py":295
9000  *     while 1:
9001  *         try:
9002  *             selector.append(ops[token[0]](_next, token))             # <<<<<<<<<<<<<<
9003  *         except StopIteration:
9004  *             raise SyntaxError("invalid path")
9005  */
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;
9014         __pyx_t_6 = NULL;
9015         __pyx_t_12 = 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);
9023             __pyx_t_12 = 1;
9024           }
9025         }
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);
9032         } else
9033         #endif
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);
9040         } else
9041         #endif
9042         {
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);
9045           if (__pyx_t_6) {
9046             __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
9047           }
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;
9057         }
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;
9061
9062         /* "lxml/_elementpath.py":294
9063  *     selector = []
9064  *     while 1:
9065  *         try:             # <<<<<<<<<<<<<<
9066  *             selector.append(ops[token[0]](_next, token))
9067  *         except StopIteration:
9068  */
9069       }
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;
9074       __pyx_L35_error:;
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;
9079
9080       /* "lxml/_elementpath.py":296
9081  *         try:
9082  *             selector.append(ops[token[0]](_next, token))
9083  *         except StopIteration:             # <<<<<<<<<<<<<<
9084  *             raise SyntaxError("invalid path")
9085  *         try:
9086  */
9087       __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9088       if (__pyx_t_12) {
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);
9094
9095         /* "lxml/_elementpath.py":297
9096  *             selector.append(ops[token[0]](_next, token))
9097  *         except StopIteration:
9098  *             raise SyntaxError("invalid path")             # <<<<<<<<<<<<<<
9099  *         try:
9100  *             token = _next()
9101  */
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)
9107       }
9108       goto __pyx_L37_except_error;
9109       __pyx_L37_except_error:;
9110
9111       /* "lxml/_elementpath.py":294
9112  *     selector = []
9113  *     while 1:
9114  *         try:             # <<<<<<<<<<<<<<
9115  *             selector.append(ops[token[0]](_next, token))
9116  *         except StopIteration:
9117  */
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;
9123       __pyx_L42_try_end:;
9124     }
9125
9126     /* "lxml/_elementpath.py":298
9127  *         except StopIteration:
9128  *             raise SyntaxError("invalid path")
9129  *         try:             # <<<<<<<<<<<<<<
9130  *             token = _next()
9131  *             if token[0] == "/":
9132  */
9133     {
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);
9140       /*try:*/ {
9141
9142         /* "lxml/_elementpath.py":299
9143  *             raise SyntaxError("invalid path")
9144  *         try:
9145  *             token = _next()             # <<<<<<<<<<<<<<
9146  *             if token[0] == "/":
9147  *                 token = _next()
9148  */
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);
9158           }
9159         }
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);
9166         __pyx_t_5 = 0;
9167
9168         /* "lxml/_elementpath.py":300
9169  *         try:
9170  *             token = _next()
9171  *             if token[0] == "/":             # <<<<<<<<<<<<<<
9172  *                 token = _next()
9173  *         except StopIteration:
9174  */
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;
9179         if (__pyx_t_3) {
9180
9181           /* "lxml/_elementpath.py":301
9182  *             token = _next()
9183  *             if token[0] == "/":
9184  *                 token = _next()             # <<<<<<<<<<<<<<
9185  *         except StopIteration:
9186  *             break
9187  */
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);
9197             }
9198           }
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);
9205           __pyx_t_5 = 0;
9206
9207           /* "lxml/_elementpath.py":300
9208  *         try:
9209  *             token = _next()
9210  *             if token[0] == "/":             # <<<<<<<<<<<<<<
9211  *                 token = _next()
9212  *         except StopIteration:
9213  */
9214         }
9215
9216         /* "lxml/_elementpath.py":298
9217  *         except StopIteration:
9218  *             raise SyntaxError("invalid path")
9219  *         try:             # <<<<<<<<<<<<<<
9220  *             token = _next()
9221  *             if token[0] == "/":
9222  */
9223       }
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;
9228       __pyx_L45_error:;
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;
9233
9234       /* "lxml/_elementpath.py":302
9235  *             if token[0] == "/":
9236  *                 token = _next()
9237  *         except StopIteration:             # <<<<<<<<<<<<<<
9238  *             break
9239  *     _cache[cache_key] = selector
9240  */
9241       __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9242       if (__pyx_t_12) {
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);
9248
9249         /* "lxml/_elementpath.py":303
9250  *                 token = _next()
9251  *         except StopIteration:
9252  *             break             # <<<<<<<<<<<<<<
9253  *     _cache[cache_key] = selector
9254  *     return selector
9255  */
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;
9262       }
9263       goto __pyx_L47_except_error;
9264       __pyx_L47_except_error:;
9265
9266       /* "lxml/_elementpath.py":298
9267  *         except StopIteration:
9268  *             raise SyntaxError("invalid path")
9269  *         try:             # <<<<<<<<<<<<<<
9270  *             token = _next()
9271  *             if token[0] == "/":
9272  */
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;
9284       __pyx_L52_try_end:;
9285     }
9286   }
9287   __pyx_L34_break:;
9288
9289   /* "lxml/_elementpath.py":304
9290  *         except StopIteration:
9291  *             break
9292  *     _cache[cache_key] = selector             # <<<<<<<<<<<<<<
9293  *     return selector
9294  * 
9295  */
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;
9300
9301   /* "lxml/_elementpath.py":305
9302  *             break
9303  *     _cache[cache_key] = selector
9304  *     return selector             # <<<<<<<<<<<<<<
9305  * 
9306  * 
9307  */
9308   __Pyx_XDECREF(__pyx_r);
9309   __Pyx_INCREF(__pyx_v_selector);
9310   __pyx_r = __pyx_v_selector;
9311   goto __pyx_L0;
9312
9313   /* "lxml/_elementpath.py":254
9314  * 
9315  * 
9316  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
9317  *     """compile selector pattern"""
9318  *     if path[-1:] == "/":
9319  */
9320
9321   /* function exit code */
9322   __pyx_L1_error:;
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);
9328   __pyx_r = NULL;
9329   __pyx_L0:;
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();
9339   return __pyx_r;
9340 }
9341
9342 /* "lxml/_elementpath.py":311
9343  * # Iterate over the matching nodes
9344  * 
9345  * def iterfind(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
9346  *     selector = _build_path_iterator(path, namespaces)
9347  *     result = iter((elem,))
9348  */
9349
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);
9363   {
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)) {
9368       Py_ssize_t kw_args;
9369       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9370       switch (pos_args) {
9371         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9372         CYTHON_FALLTHROUGH;
9373         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9374         CYTHON_FALLTHROUGH;
9375         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9376         CYTHON_FALLTHROUGH;
9377         case  0: break;
9378         default: goto __pyx_L5_argtuple_error;
9379       }
9380       kw_args = PyDict_Size(__pyx_kwds);
9381       switch (pos_args) {
9382         case  0:
9383         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9384         else goto __pyx_L5_argtuple_error;
9385         CYTHON_FALLTHROUGH;
9386         case  1:
9387         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9388         else {
9389           __Pyx_RaiseArgtupleInvalid("iterfind", 0, 2, 3, 1); __PYX_ERR(0, 311, __pyx_L3_error)
9390         }
9391         CYTHON_FALLTHROUGH;
9392         case  2:
9393         if (kw_args > 0) {
9394           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9395           if (value) { values[2] = value; kw_args--; }
9396         }
9397       }
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)
9400       }
9401     } else {
9402       switch (PyTuple_GET_SIZE(__pyx_args)) {
9403         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9404         CYTHON_FALLTHROUGH;
9405         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9406         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9407         break;
9408         default: goto __pyx_L5_argtuple_error;
9409       }
9410     }
9411     __pyx_v_elem = values[0];
9412     __pyx_v_path = values[1];
9413     __pyx_v_namespaces = values[2];
9414   }
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)
9418   __pyx_L3_error:;
9419   __Pyx_AddTraceback("lxml._elementpath.iterfind", __pyx_clineno, __pyx_lineno, __pyx_filename);
9420   __Pyx_RefNannyFinishContext();
9421   return NULL;
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);
9424
9425   /* function exit code */
9426   __Pyx_RefNannyFinishContext();
9427   return __pyx_r;
9428 }
9429
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;
9439   int __pyx_t_4;
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);
9447
9448   /* "lxml/_elementpath.py":312
9449  * 
9450  * def iterfind(elem, path, namespaces=None):
9451  *     selector = _build_path_iterator(path, namespaces)             # <<<<<<<<<<<<<<
9452  *     result = iter((elem,))
9453  *     for select in selector:
9454  */
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);
9457   __pyx_t_3 = NULL;
9458   __pyx_t_4 = 0;
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);
9466       __pyx_t_4 = 1;
9467     }
9468   }
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);
9475   } else
9476   #endif
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);
9483   } else
9484   #endif
9485   {
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);
9488     if (__pyx_t_3) {
9489       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
9490     }
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;
9500   }
9501   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9502   __pyx_v_selector = __pyx_t_1;
9503   __pyx_t_1 = 0;
9504
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)
9511  */
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;
9521   __pyx_t_2 = 0;
9522
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)
9528  *     return result
9529  */
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;
9532     __pyx_t_7 = NULL;
9533   } else {
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)
9537   }
9538   for (;;) {
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)
9544         #else
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);
9547         #endif
9548       } else {
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)
9552         #else
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);
9555         #endif
9556       }
9557     } else {
9558       __pyx_t_1 = __pyx_t_7(__pyx_t_2);
9559       if (unlikely(!__pyx_t_1)) {
9560         PyObject* exc_type = PyErr_Occurred();
9561         if (exc_type) {
9562           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9563           else __PYX_ERR(0, 314, __pyx_L1_error)
9564         }
9565         break;
9566       }
9567       __Pyx_GOTREF(__pyx_t_1);
9568     }
9569     __Pyx_XDECREF_SET(__pyx_v_select, __pyx_t_1);
9570     __pyx_t_1 = 0;
9571
9572     /* "lxml/_elementpath.py":315
9573  *     result = iter((elem,))
9574  *     for select in selector:
9575  *         result = select(result)             # <<<<<<<<<<<<<<
9576  *     return result
9577  * 
9578  */
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);
9588       }
9589     }
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);
9596     __pyx_t_1 = 0;
9597
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)
9603  *     return result
9604  */
9605   }
9606   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9607
9608   /* "lxml/_elementpath.py":316
9609  *     for select in selector:
9610  *         result = select(result)
9611  *     return result             # <<<<<<<<<<<<<<
9612  * 
9613  * 
9614  */
9615   __Pyx_XDECREF(__pyx_r);
9616   __Pyx_INCREF(__pyx_v_result);
9617   __pyx_r = __pyx_v_result;
9618   goto __pyx_L0;
9619
9620   /* "lxml/_elementpath.py":311
9621  * # Iterate over the matching nodes
9622  * 
9623  * def iterfind(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
9624  *     selector = _build_path_iterator(path, namespaces)
9625  *     result = iter((elem,))
9626  */
9627
9628   /* function exit code */
9629   __pyx_L1_error:;
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);
9635   __pyx_r = NULL;
9636   __pyx_L0:;
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();
9642   return __pyx_r;
9643 }
9644
9645 /* "lxml/_elementpath.py":322
9646  * # Find first matching object.
9647  * 
9648  * def find(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
9649  *     it = iterfind(elem, path, namespaces)
9650  *     try:
9651  */
9652
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);
9666   {
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)) {
9671       Py_ssize_t kw_args;
9672       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9673       switch (pos_args) {
9674         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9675         CYTHON_FALLTHROUGH;
9676         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9677         CYTHON_FALLTHROUGH;
9678         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9679         CYTHON_FALLTHROUGH;
9680         case  0: break;
9681         default: goto __pyx_L5_argtuple_error;
9682       }
9683       kw_args = PyDict_Size(__pyx_kwds);
9684       switch (pos_args) {
9685         case  0:
9686         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9687         else goto __pyx_L5_argtuple_error;
9688         CYTHON_FALLTHROUGH;
9689         case  1:
9690         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9691         else {
9692           __Pyx_RaiseArgtupleInvalid("find", 0, 2, 3, 1); __PYX_ERR(0, 322, __pyx_L3_error)
9693         }
9694         CYTHON_FALLTHROUGH;
9695         case  2:
9696         if (kw_args > 0) {
9697           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9698           if (value) { values[2] = value; kw_args--; }
9699         }
9700       }
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)
9703       }
9704     } else {
9705       switch (PyTuple_GET_SIZE(__pyx_args)) {
9706         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9707         CYTHON_FALLTHROUGH;
9708         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9709         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9710         break;
9711         default: goto __pyx_L5_argtuple_error;
9712       }
9713     }
9714     __pyx_v_elem = values[0];
9715     __pyx_v_path = values[1];
9716     __pyx_v_namespaces = values[2];
9717   }
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)
9721   __pyx_L3_error:;
9722   __Pyx_AddTraceback("lxml._elementpath.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
9723   __Pyx_RefNannyFinishContext();
9724   return NULL;
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);
9727
9728   /* function exit code */
9729   __Pyx_RefNannyFinishContext();
9730   return __pyx_r;
9731 }
9732
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;
9740   int __pyx_t_4;
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);
9749
9750   /* "lxml/_elementpath.py":323
9751  * 
9752  * def find(elem, path, namespaces=None):
9753  *     it = iterfind(elem, path, namespaces)             # <<<<<<<<<<<<<<
9754  *     try:
9755  *         return next(it)
9756  */
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);
9759   __pyx_t_3 = NULL;
9760   __pyx_t_4 = 0;
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);
9768       __pyx_t_4 = 1;
9769     }
9770   }
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);
9777   } else
9778   #endif
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);
9785   } else
9786   #endif
9787   {
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);
9790     if (__pyx_t_3) {
9791       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
9792     }
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;
9805   }
9806   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9807   __pyx_v_it = __pyx_t_1;
9808   __pyx_t_1 = 0;
9809
9810   /* "lxml/_elementpath.py":324
9811  * def find(elem, path, namespaces=None):
9812  *     it = iterfind(elem, path, namespaces)
9813  *     try:             # <<<<<<<<<<<<<<
9814  *         return next(it)
9815  *     except StopIteration:
9816  */
9817   {
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);
9824     /*try:*/ {
9825
9826       /* "lxml/_elementpath.py":325
9827  *     it = iterfind(elem, path, namespaces)
9828  *     try:
9829  *         return next(it)             # <<<<<<<<<<<<<<
9830  *     except StopIteration:
9831  *         return None
9832  */
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;
9837       __pyx_t_1 = 0;
9838       goto __pyx_L7_try_return;
9839
9840       /* "lxml/_elementpath.py":324
9841  * def find(elem, path, namespaces=None):
9842  *     it = iterfind(elem, path, namespaces)
9843  *     try:             # <<<<<<<<<<<<<<
9844  *         return next(it)
9845  *     except StopIteration:
9846  */
9847     }
9848     __pyx_L3_error:;
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;
9853
9854     /* "lxml/_elementpath.py":326
9855  *     try:
9856  *         return next(it)
9857  *     except StopIteration:             # <<<<<<<<<<<<<<
9858  *         return None
9859  * 
9860  */
9861     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
9862     if (__pyx_t_4) {
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);
9868
9869       /* "lxml/_elementpath.py":327
9870  *         return next(it)
9871  *     except StopIteration:
9872  *         return None             # <<<<<<<<<<<<<<
9873  * 
9874  * 
9875  */
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;
9882     }
9883     goto __pyx_L5_except_error;
9884     __pyx_L5_except_error:;
9885
9886     /* "lxml/_elementpath.py":324
9887  * def find(elem, path, namespaces=None):
9888  *     it = iterfind(elem, path, namespaces)
9889  *     try:             # <<<<<<<<<<<<<<
9890  *         return next(it)
9891  *     except StopIteration:
9892  */
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);
9903     goto __pyx_L0;
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);
9909     goto __pyx_L0;
9910   }
9911
9912   /* "lxml/_elementpath.py":322
9913  * # Find first matching object.
9914  * 
9915  * def find(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
9916  *     it = iterfind(elem, path, namespaces)
9917  *     try:
9918  */
9919
9920   /* function exit code */
9921   __pyx_L1_error:;
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);
9927   __pyx_r = NULL;
9928   __pyx_L0:;
9929   __Pyx_XDECREF(__pyx_v_it);
9930   __Pyx_XGIVEREF(__pyx_r);
9931   __Pyx_RefNannyFinishContext();
9932   return __pyx_r;
9933 }
9934
9935 /* "lxml/_elementpath.py":333
9936  * # Find all matching objects.
9937  * 
9938  * def findall(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
9939  *     return list(iterfind(elem, path, namespaces))
9940  * 
9941  */
9942
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);
9956   {
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)) {
9961       Py_ssize_t kw_args;
9962       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9963       switch (pos_args) {
9964         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9965         CYTHON_FALLTHROUGH;
9966         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9967         CYTHON_FALLTHROUGH;
9968         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9969         CYTHON_FALLTHROUGH;
9970         case  0: break;
9971         default: goto __pyx_L5_argtuple_error;
9972       }
9973       kw_args = PyDict_Size(__pyx_kwds);
9974       switch (pos_args) {
9975         case  0:
9976         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
9977         else goto __pyx_L5_argtuple_error;
9978         CYTHON_FALLTHROUGH;
9979         case  1:
9980         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
9981         else {
9982           __Pyx_RaiseArgtupleInvalid("findall", 0, 2, 3, 1); __PYX_ERR(0, 333, __pyx_L3_error)
9983         }
9984         CYTHON_FALLTHROUGH;
9985         case  2:
9986         if (kw_args > 0) {
9987           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
9988           if (value) { values[2] = value; kw_args--; }
9989         }
9990       }
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)
9993       }
9994     } else {
9995       switch (PyTuple_GET_SIZE(__pyx_args)) {
9996         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9997         CYTHON_FALLTHROUGH;
9998         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9999         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10000         break;
10001         default: goto __pyx_L5_argtuple_error;
10002       }
10003     }
10004     __pyx_v_elem = values[0];
10005     __pyx_v_path = values[1];
10006     __pyx_v_namespaces = values[2];
10007   }
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)
10011   __pyx_L3_error:;
10012   __Pyx_AddTraceback("lxml._elementpath.findall", __pyx_clineno, __pyx_lineno, __pyx_filename);
10013   __Pyx_RefNannyFinishContext();
10014   return NULL;
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);
10017
10018   /* function exit code */
10019   __Pyx_RefNannyFinishContext();
10020   return __pyx_r;
10021 }
10022
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;
10029   int __pyx_t_4;
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);
10035
10036   /* "lxml/_elementpath.py":334
10037  * 
10038  * def findall(elem, path, namespaces=None):
10039  *     return list(iterfind(elem, path, namespaces))             # <<<<<<<<<<<<<<
10040  * 
10041  * 
10042  */
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);
10046   __pyx_t_3 = NULL;
10047   __pyx_t_4 = 0;
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);
10055       __pyx_t_4 = 1;
10056     }
10057   }
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);
10064   } else
10065   #endif
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);
10072   } else
10073   #endif
10074   {
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);
10077     if (__pyx_t_3) {
10078       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
10079     }
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;
10092   }
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;
10098   __pyx_t_2 = 0;
10099   goto __pyx_L0;
10100
10101   /* "lxml/_elementpath.py":333
10102  * # Find all matching objects.
10103  * 
10104  * def findall(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
10105  *     return list(iterfind(elem, path, namespaces))
10106  * 
10107  */
10108
10109   /* function exit code */
10110   __pyx_L1_error:;
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);
10116   __pyx_r = NULL;
10117   __pyx_L0:;
10118   __Pyx_XGIVEREF(__pyx_r);
10119   __Pyx_RefNannyFinishContext();
10120   return __pyx_r;
10121 }
10122
10123 /* "lxml/_elementpath.py":340
10124  * # Find text for first matching object.
10125  * 
10126  * def findtext(elem, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
10127  *     el = find(elem, path, namespaces)
10128  *     if el is None:
10129  */
10130
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);
10145   {
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;
10162         case  0: break;
10163         default: goto __pyx_L5_argtuple_error;
10164       }
10165       kw_args = PyDict_Size(__pyx_kwds);
10166       switch (pos_args) {
10167         case  0:
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;
10171         case  1:
10172         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
10173         else {
10174           __Pyx_RaiseArgtupleInvalid("findtext", 0, 2, 4, 1); __PYX_ERR(0, 340, __pyx_L3_error)
10175         }
10176         CYTHON_FALLTHROUGH;
10177         case  2:
10178         if (kw_args > 0) {
10179           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
10180           if (value) { values[2] = value; kw_args--; }
10181         }
10182         CYTHON_FALLTHROUGH;
10183         case  3:
10184         if (kw_args > 0) {
10185           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_namespaces);
10186           if (value) { values[3] = value; kw_args--; }
10187         }
10188       }
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)
10191       }
10192     } else {
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);
10200         break;
10201         default: goto __pyx_L5_argtuple_error;
10202       }
10203     }
10204     __pyx_v_elem = values[0];
10205     __pyx_v_path = values[1];
10206     __pyx_v_default = values[2];
10207     __pyx_v_namespaces = values[3];
10208   }
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)
10212   __pyx_L3_error:;
10213   __Pyx_AddTraceback("lxml._elementpath.findtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
10214   __Pyx_RefNannyFinishContext();
10215   return NULL;
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);
10218
10219   /* function exit code */
10220   __Pyx_RefNannyFinishContext();
10221   return __pyx_r;
10222 }
10223
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;
10231   int __pyx_t_4;
10232   PyObject *__pyx_t_5 = NULL;
10233   int __pyx_t_6;
10234   int __pyx_t_7;
10235   int __pyx_lineno = 0;
10236   const char *__pyx_filename = NULL;
10237   int __pyx_clineno = 0;
10238   __Pyx_RefNannySetupContext("findtext", 0);
10239
10240   /* "lxml/_elementpath.py":341
10241  * 
10242  * def findtext(elem, path, default=None, namespaces=None):
10243  *     el = find(elem, path, namespaces)             # <<<<<<<<<<<<<<
10244  *     if el is None:
10245  *         return default
10246  */
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);
10249   __pyx_t_3 = NULL;
10250   __pyx_t_4 = 0;
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);
10258       __pyx_t_4 = 1;
10259     }
10260   }
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);
10267   } else
10268   #endif
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);
10275   } else
10276   #endif
10277   {
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);
10280     if (__pyx_t_3) {
10281       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
10282     }
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;
10295   }
10296   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10297   __pyx_v_el = __pyx_t_1;
10298   __pyx_t_1 = 0;
10299
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:             # <<<<<<<<<<<<<<
10304  *         return default
10305  *     else:
10306  */
10307   __pyx_t_6 = (__pyx_v_el == Py_None);
10308   __pyx_t_7 = (__pyx_t_6 != 0);
10309   if (__pyx_t_7) {
10310
10311     /* "lxml/_elementpath.py":343
10312  *     el = find(elem, path, namespaces)
10313  *     if el is None:
10314  *         return default             # <<<<<<<<<<<<<<
10315  *     else:
10316  *         return el.text or ''
10317  */
10318     __Pyx_XDECREF(__pyx_r);
10319     __Pyx_INCREF(__pyx_v_default);
10320     __pyx_r = __pyx_v_default;
10321     goto __pyx_L0;
10322
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:             # <<<<<<<<<<<<<<
10327  *         return default
10328  *     else:
10329  */
10330   }
10331
10332   /* "lxml/_elementpath.py":345
10333  *         return default
10334  *     else:
10335  *         return el.text or ''             # <<<<<<<<<<<<<<
10336  */
10337   /*else*/ {
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)
10342     if (!__pyx_t_7) {
10343       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10344     } else {
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;
10349     }
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;
10354     __pyx_t_1 = 0;
10355     goto __pyx_L0;
10356   }
10357
10358   /* "lxml/_elementpath.py":340
10359  * # Find text for first matching object.
10360  * 
10361  * def findtext(elem, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
10362  *     el = find(elem, path, namespaces)
10363  *     if el is None:
10364  */
10365
10366   /* function exit code */
10367   __pyx_L1_error:;
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);
10373   __pyx_r = NULL;
10374   __pyx_L0:;
10375   __Pyx_XDECREF(__pyx_v_el);
10376   __Pyx_XGIVEREF(__pyx_r);
10377   __Pyx_RefNannyFinishContext();
10378   return __pyx_r;
10379 }
10380
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;
10383
10384 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10385   PyObject *o;
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);
10391   } else {
10392     o = (*t->tp_alloc)(t, 0);
10393     if (unlikely(!o)) return 0;
10394   }
10395   return o;
10396 }
10397
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);
10416   } else {
10417     (*Py_TYPE(o)->tp_free)(o);
10418   }
10419 }
10420
10421 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer(PyObject *o, visitproc v, void *a) {
10422   int e;
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;
10426   }
10427   if (p->__pyx_v_namespaces) {
10428     e = (*v)(p->__pyx_v_namespaces, a); if (e) return e;
10429   }
10430   if (p->__pyx_v_parsing_attribute) {
10431     e = (*v)(p->__pyx_v_parsing_attribute, a); if (e) return e;
10432   }
10433   if (p->__pyx_v_pattern) {
10434     e = (*v)(p->__pyx_v_pattern, a); if (e) return e;
10435   }
10436   if (p->__pyx_v_prefix) {
10437     e = (*v)(p->__pyx_v_prefix, a); if (e) return e;
10438   }
10439   if (p->__pyx_v_tag) {
10440     e = (*v)(p->__pyx_v_tag, a); if (e) return e;
10441   }
10442   if (p->__pyx_v_token) {
10443     e = (*v)(p->__pyx_v_token, a); if (e) return e;
10444   }
10445   if (p->__pyx_v_ttype) {
10446     e = (*v)(p->__pyx_v_ttype, a); if (e) return e;
10447   }
10448   if (p->__pyx_v_uri) {
10449     e = (*v)(p->__pyx_v_uri, a); if (e) return e;
10450   }
10451   if (p->__pyx_t_0) {
10452     e = (*v)(p->__pyx_t_0, a); if (e) return e;
10453   }
10454   if (p->__pyx_t_3) {
10455     e = (*v)(p->__pyx_t_3, a); if (e) return e;
10456   }
10457   if (p->__pyx_t_4) {
10458     e = (*v)(p->__pyx_t_4, a); if (e) return e;
10459   }
10460   if (p->__pyx_t_5) {
10461     e = (*v)(p->__pyx_t_5, a); if (e) return e;
10462   }
10463   return 0;
10464 }
10465
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*/
10470   0, /*tp_itemsize*/
10471   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_dealloc*/
10472   #if PY_VERSION_HEX < 0x030800b4
10473   0, /*tp_print*/
10474   #endif
10475   #if PY_VERSION_HEX >= 0x030800b4
10476   0, /*tp_vectorcall_offset*/
10477   #endif
10478   0, /*tp_getattr*/
10479   0, /*tp_setattr*/
10480   #if PY_MAJOR_VERSION < 3
10481   0, /*tp_compare*/
10482   #endif
10483   #if PY_MAJOR_VERSION >= 3
10484   0, /*tp_as_async*/
10485   #endif
10486   0, /*tp_repr*/
10487   0, /*tp_as_number*/
10488   0, /*tp_as_sequence*/
10489   0, /*tp_as_mapping*/
10490   0, /*tp_hash*/
10491   0, /*tp_call*/
10492   0, /*tp_str*/
10493   0, /*tp_getattro*/
10494   0, /*tp_setattro*/
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*/
10497   0, /*tp_doc*/
10498   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_traverse*/
10499   0, /*tp_clear*/
10500   0, /*tp_richcompare*/
10501   0, /*tp_weaklistoffset*/
10502   0, /*tp_iter*/
10503   0, /*tp_iternext*/
10504   0, /*tp_methods*/
10505   0, /*tp_members*/
10506   0, /*tp_getset*/
10507   0, /*tp_base*/
10508   0, /*tp_dict*/
10509   0, /*tp_descr_get*/
10510   0, /*tp_descr_set*/
10511   0, /*tp_dictoffset*/
10512   0, /*tp_init*/
10513   0, /*tp_alloc*/
10514   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct__xpath_tokenizer, /*tp_new*/
10515   0, /*tp_free*/
10516   0, /*tp_is_gc*/
10517   0, /*tp_bases*/
10518   0, /*tp_mro*/
10519   0, /*tp_cache*/
10520   0, /*tp_subclasses*/
10521   0, /*tp_weaklist*/
10522   0, /*tp_del*/
10523   0, /*tp_version_tag*/
10524   #if PY_VERSION_HEX >= 0x030400a1
10525   0, /*tp_finalize*/
10526   #endif
10527   #if PY_VERSION_HEX >= 0x030800b1
10528   0, /*tp_vectorcall*/
10529   #endif
10530   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10531   0, /*tp_print*/
10532   #endif
10533 };
10534
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;
10537
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) {
10539   PyObject *o;
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);
10545   } else {
10546     o = (*t->tp_alloc)(t, 0);
10547     if (unlikely(!o)) return 0;
10548   }
10549   return o;
10550 }
10551
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);
10558   } else {
10559     (*Py_TYPE(o)->tp_free)(o);
10560   }
10561 }
10562
10563 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child(PyObject *o, visitproc v, void *a) {
10564   int e;
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;
10568   }
10569   return 0;
10570 }
10571
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);
10575   return 0;
10576 }
10577
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*/
10582   0, /*tp_itemsize*/
10583   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_dealloc*/
10584   #if PY_VERSION_HEX < 0x030800b4
10585   0, /*tp_print*/
10586   #endif
10587   #if PY_VERSION_HEX >= 0x030800b4
10588   0, /*tp_vectorcall_offset*/
10589   #endif
10590   0, /*tp_getattr*/
10591   0, /*tp_setattr*/
10592   #if PY_MAJOR_VERSION < 3
10593   0, /*tp_compare*/
10594   #endif
10595   #if PY_MAJOR_VERSION >= 3
10596   0, /*tp_as_async*/
10597   #endif
10598   0, /*tp_repr*/
10599   0, /*tp_as_number*/
10600   0, /*tp_as_sequence*/
10601   0, /*tp_as_mapping*/
10602   0, /*tp_hash*/
10603   0, /*tp_call*/
10604   0, /*tp_str*/
10605   0, /*tp_getattro*/
10606   0, /*tp_setattro*/
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*/
10609   0, /*tp_doc*/
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*/
10614   0, /*tp_iter*/
10615   0, /*tp_iternext*/
10616   0, /*tp_methods*/
10617   0, /*tp_members*/
10618   0, /*tp_getset*/
10619   0, /*tp_base*/
10620   0, /*tp_dict*/
10621   0, /*tp_descr_get*/
10622   0, /*tp_descr_set*/
10623   0, /*tp_dictoffset*/
10624   0, /*tp_init*/
10625   0, /*tp_alloc*/
10626   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_1_prepare_child, /*tp_new*/
10627   0, /*tp_free*/
10628   0, /*tp_is_gc*/
10629   0, /*tp_bases*/
10630   0, /*tp_mro*/
10631   0, /*tp_cache*/
10632   0, /*tp_subclasses*/
10633   0, /*tp_weaklist*/
10634   0, /*tp_del*/
10635   0, /*tp_version_tag*/
10636   #if PY_VERSION_HEX >= 0x030400a1
10637   0, /*tp_finalize*/
10638   #endif
10639   #if PY_VERSION_HEX >= 0x030800b1
10640   0, /*tp_vectorcall*/
10641   #endif
10642   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10643   0, /*tp_print*/
10644   #endif
10645 };
10646
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;
10649
10650 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10651   PyObject *o;
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);
10657   } else {
10658     o = (*t->tp_alloc)(t, 0);
10659     if (unlikely(!o)) return 0;
10660   }
10661   return o;
10662 }
10663
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);
10675   } else {
10676     (*Py_TYPE(o)->tp_free)(o);
10677   }
10678 }
10679
10680 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_2_select(PyObject *o, visitproc v, void *a) {
10681   int e;
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;
10685   }
10686   if (p->__pyx_v_e) {
10687     e = (*v)(p->__pyx_v_e, a); if (e) return e;
10688   }
10689   if (p->__pyx_v_elem) {
10690     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
10691   }
10692   if (p->__pyx_v_result) {
10693     e = (*v)(p->__pyx_v_result, a); if (e) return e;
10694   }
10695   if (p->__pyx_t_0) {
10696     e = (*v)(p->__pyx_t_0, a); if (e) return e;
10697   }
10698   if (p->__pyx_t_3) {
10699     e = (*v)(p->__pyx_t_3, a); if (e) return e;
10700   }
10701   return 0;
10702 }
10703
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*/
10708   0, /*tp_itemsize*/
10709   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_dealloc*/
10710   #if PY_VERSION_HEX < 0x030800b4
10711   0, /*tp_print*/
10712   #endif
10713   #if PY_VERSION_HEX >= 0x030800b4
10714   0, /*tp_vectorcall_offset*/
10715   #endif
10716   0, /*tp_getattr*/
10717   0, /*tp_setattr*/
10718   #if PY_MAJOR_VERSION < 3
10719   0, /*tp_compare*/
10720   #endif
10721   #if PY_MAJOR_VERSION >= 3
10722   0, /*tp_as_async*/
10723   #endif
10724   0, /*tp_repr*/
10725   0, /*tp_as_number*/
10726   0, /*tp_as_sequence*/
10727   0, /*tp_as_mapping*/
10728   0, /*tp_hash*/
10729   0, /*tp_call*/
10730   0, /*tp_str*/
10731   0, /*tp_getattro*/
10732   0, /*tp_setattro*/
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*/
10735   0, /*tp_doc*/
10736   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_traverse*/
10737   0, /*tp_clear*/
10738   0, /*tp_richcompare*/
10739   0, /*tp_weaklistoffset*/
10740   0, /*tp_iter*/
10741   0, /*tp_iternext*/
10742   0, /*tp_methods*/
10743   0, /*tp_members*/
10744   0, /*tp_getset*/
10745   0, /*tp_base*/
10746   0, /*tp_dict*/
10747   0, /*tp_descr_get*/
10748   0, /*tp_descr_set*/
10749   0, /*tp_dictoffset*/
10750   0, /*tp_init*/
10751   0, /*tp_alloc*/
10752   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_2_select, /*tp_new*/
10753   0, /*tp_free*/
10754   0, /*tp_is_gc*/
10755   0, /*tp_bases*/
10756   0, /*tp_mro*/
10757   0, /*tp_cache*/
10758   0, /*tp_subclasses*/
10759   0, /*tp_weaklist*/
10760   0, /*tp_del*/
10761   0, /*tp_version_tag*/
10762   #if PY_VERSION_HEX >= 0x030400a1
10763   0, /*tp_finalize*/
10764   #endif
10765   #if PY_VERSION_HEX >= 0x030800b1
10766   0, /*tp_vectorcall*/
10767   #endif
10768   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10769   0, /*tp_print*/
10770   #endif
10771 };
10772
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;
10775
10776 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
10777   PyObject *o;
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);
10783   } else {
10784     o = (*t->tp_alloc)(t, 0);
10785     if (unlikely(!o)) return 0;
10786   }
10787   return o;
10788 }
10789
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);
10800   } else {
10801     (*Py_TYPE(o)->tp_free)(o);
10802   }
10803 }
10804
10805 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_3_select(PyObject *o, visitproc v, void *a) {
10806   int e;
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;
10810   }
10811   if (p->__pyx_v_elem) {
10812     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
10813   }
10814   if (p->__pyx_v_result) {
10815     e = (*v)(p->__pyx_v_result, a); if (e) return e;
10816   }
10817   if (p->__pyx_t_0) {
10818     e = (*v)(p->__pyx_t_0, a); if (e) return e;
10819   }
10820   if (p->__pyx_t_3) {
10821     e = (*v)(p->__pyx_t_3, a); if (e) return e;
10822   }
10823   return 0;
10824 }
10825
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*/
10830   0, /*tp_itemsize*/
10831   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_dealloc*/
10832   #if PY_VERSION_HEX < 0x030800b4
10833   0, /*tp_print*/
10834   #endif
10835   #if PY_VERSION_HEX >= 0x030800b4
10836   0, /*tp_vectorcall_offset*/
10837   #endif
10838   0, /*tp_getattr*/
10839   0, /*tp_setattr*/
10840   #if PY_MAJOR_VERSION < 3
10841   0, /*tp_compare*/
10842   #endif
10843   #if PY_MAJOR_VERSION >= 3
10844   0, /*tp_as_async*/
10845   #endif
10846   0, /*tp_repr*/
10847   0, /*tp_as_number*/
10848   0, /*tp_as_sequence*/
10849   0, /*tp_as_mapping*/
10850   0, /*tp_hash*/
10851   0, /*tp_call*/
10852   0, /*tp_str*/
10853   0, /*tp_getattro*/
10854   0, /*tp_setattro*/
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*/
10857   0, /*tp_doc*/
10858   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_traverse*/
10859   0, /*tp_clear*/
10860   0, /*tp_richcompare*/
10861   0, /*tp_weaklistoffset*/
10862   0, /*tp_iter*/
10863   0, /*tp_iternext*/
10864   0, /*tp_methods*/
10865   0, /*tp_members*/
10866   0, /*tp_getset*/
10867   0, /*tp_base*/
10868   0, /*tp_dict*/
10869   0, /*tp_descr_get*/
10870   0, /*tp_descr_set*/
10871   0, /*tp_dictoffset*/
10872   0, /*tp_init*/
10873   0, /*tp_alloc*/
10874   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_3_select, /*tp_new*/
10875   0, /*tp_free*/
10876   0, /*tp_is_gc*/
10877   0, /*tp_bases*/
10878   0, /*tp_mro*/
10879   0, /*tp_cache*/
10880   0, /*tp_subclasses*/
10881   0, /*tp_weaklist*/
10882   0, /*tp_del*/
10883   0, /*tp_version_tag*/
10884   #if PY_VERSION_HEX >= 0x030400a1
10885   0, /*tp_finalize*/
10886   #endif
10887   #if PY_VERSION_HEX >= 0x030800b1
10888   0, /*tp_vectorcall*/
10889   #endif
10890   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
10891   0, /*tp_print*/
10892   #endif
10893 };
10894
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;
10897
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) {
10899   PyObject *o;
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);
10905   } else {
10906     o = (*t->tp_alloc)(t, 0);
10907     if (unlikely(!o)) return 0;
10908   }
10909   return o;
10910 }
10911
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);
10918   } else {
10919     (*Py_TYPE(o)->tp_free)(o);
10920   }
10921 }
10922
10923 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant(PyObject *o, visitproc v, void *a) {
10924   int e;
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;
10928   }
10929   return 0;
10930 }
10931
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);
10935   return 0;
10936 }
10937
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*/
10942   0, /*tp_itemsize*/
10943   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_dealloc*/
10944   #if PY_VERSION_HEX < 0x030800b4
10945   0, /*tp_print*/
10946   #endif
10947   #if PY_VERSION_HEX >= 0x030800b4
10948   0, /*tp_vectorcall_offset*/
10949   #endif
10950   0, /*tp_getattr*/
10951   0, /*tp_setattr*/
10952   #if PY_MAJOR_VERSION < 3
10953   0, /*tp_compare*/
10954   #endif
10955   #if PY_MAJOR_VERSION >= 3
10956   0, /*tp_as_async*/
10957   #endif
10958   0, /*tp_repr*/
10959   0, /*tp_as_number*/
10960   0, /*tp_as_sequence*/
10961   0, /*tp_as_mapping*/
10962   0, /*tp_hash*/
10963   0, /*tp_call*/
10964   0, /*tp_str*/
10965   0, /*tp_getattro*/
10966   0, /*tp_setattro*/
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*/
10969   0, /*tp_doc*/
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*/
10974   0, /*tp_iter*/
10975   0, /*tp_iternext*/
10976   0, /*tp_methods*/
10977   0, /*tp_members*/
10978   0, /*tp_getset*/
10979   0, /*tp_base*/
10980   0, /*tp_dict*/
10981   0, /*tp_descr_get*/
10982   0, /*tp_descr_set*/
10983   0, /*tp_dictoffset*/
10984   0, /*tp_init*/
10985   0, /*tp_alloc*/
10986   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_4_prepare_descendant, /*tp_new*/
10987   0, /*tp_free*/
10988   0, /*tp_is_gc*/
10989   0, /*tp_bases*/
10990   0, /*tp_mro*/
10991   0, /*tp_cache*/
10992   0, /*tp_subclasses*/
10993   0, /*tp_weaklist*/
10994   0, /*tp_del*/
10995   0, /*tp_version_tag*/
10996   #if PY_VERSION_HEX >= 0x030400a1
10997   0, /*tp_finalize*/
10998   #endif
10999   #if PY_VERSION_HEX >= 0x030800b1
11000   0, /*tp_vectorcall*/
11001   #endif
11002   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11003   0, /*tp_print*/
11004   #endif
11005 };
11006
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;
11009
11010 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11011   PyObject *o;
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);
11017   } else {
11018     o = (*t->tp_alloc)(t, 0);
11019     if (unlikely(!o)) return 0;
11020   }
11021   return o;
11022 }
11023
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);
11035   } else {
11036     (*Py_TYPE(o)->tp_free)(o);
11037   }
11038 }
11039
11040 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_5_select(PyObject *o, visitproc v, void *a) {
11041   int e;
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;
11045   }
11046   if (p->__pyx_v_e) {
11047     e = (*v)(p->__pyx_v_e, a); if (e) return e;
11048   }
11049   if (p->__pyx_v_elem) {
11050     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11051   }
11052   if (p->__pyx_v_result) {
11053     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11054   }
11055   if (p->__pyx_t_0) {
11056     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11057   }
11058   if (p->__pyx_t_3) {
11059     e = (*v)(p->__pyx_t_3, a); if (e) return e;
11060   }
11061   return 0;
11062 }
11063
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*/
11068   0, /*tp_itemsize*/
11069   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_dealloc*/
11070   #if PY_VERSION_HEX < 0x030800b4
11071   0, /*tp_print*/
11072   #endif
11073   #if PY_VERSION_HEX >= 0x030800b4
11074   0, /*tp_vectorcall_offset*/
11075   #endif
11076   0, /*tp_getattr*/
11077   0, /*tp_setattr*/
11078   #if PY_MAJOR_VERSION < 3
11079   0, /*tp_compare*/
11080   #endif
11081   #if PY_MAJOR_VERSION >= 3
11082   0, /*tp_as_async*/
11083   #endif
11084   0, /*tp_repr*/
11085   0, /*tp_as_number*/
11086   0, /*tp_as_sequence*/
11087   0, /*tp_as_mapping*/
11088   0, /*tp_hash*/
11089   0, /*tp_call*/
11090   0, /*tp_str*/
11091   0, /*tp_getattro*/
11092   0, /*tp_setattro*/
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*/
11095   0, /*tp_doc*/
11096   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_traverse*/
11097   0, /*tp_clear*/
11098   0, /*tp_richcompare*/
11099   0, /*tp_weaklistoffset*/
11100   0, /*tp_iter*/
11101   0, /*tp_iternext*/
11102   0, /*tp_methods*/
11103   0, /*tp_members*/
11104   0, /*tp_getset*/
11105   0, /*tp_base*/
11106   0, /*tp_dict*/
11107   0, /*tp_descr_get*/
11108   0, /*tp_descr_set*/
11109   0, /*tp_dictoffset*/
11110   0, /*tp_init*/
11111   0, /*tp_alloc*/
11112   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_5_select, /*tp_new*/
11113   0, /*tp_free*/
11114   0, /*tp_is_gc*/
11115   0, /*tp_bases*/
11116   0, /*tp_mro*/
11117   0, /*tp_cache*/
11118   0, /*tp_subclasses*/
11119   0, /*tp_weaklist*/
11120   0, /*tp_del*/
11121   0, /*tp_version_tag*/
11122   #if PY_VERSION_HEX >= 0x030400a1
11123   0, /*tp_finalize*/
11124   #endif
11125   #if PY_VERSION_HEX >= 0x030800b1
11126   0, /*tp_vectorcall*/
11127   #endif
11128   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11129   0, /*tp_print*/
11130   #endif
11131 };
11132
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;
11135
11136 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11137   PyObject *o;
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);
11143   } else {
11144     o = (*t->tp_alloc)(t, 0);
11145     if (unlikely(!o)) return 0;
11146   }
11147   return o;
11148 }
11149
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);
11159   } else {
11160     (*Py_TYPE(o)->tp_free)(o);
11161   }
11162 }
11163
11164 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_6_select(PyObject *o, visitproc v, void *a) {
11165   int e;
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;
11169   }
11170   if (p->__pyx_v_parent) {
11171     e = (*v)(p->__pyx_v_parent, a); if (e) return e;
11172   }
11173   if (p->__pyx_v_result) {
11174     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11175   }
11176   if (p->__pyx_t_0) {
11177     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11178   }
11179   return 0;
11180 }
11181
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*/
11186   0, /*tp_itemsize*/
11187   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_dealloc*/
11188   #if PY_VERSION_HEX < 0x030800b4
11189   0, /*tp_print*/
11190   #endif
11191   #if PY_VERSION_HEX >= 0x030800b4
11192   0, /*tp_vectorcall_offset*/
11193   #endif
11194   0, /*tp_getattr*/
11195   0, /*tp_setattr*/
11196   #if PY_MAJOR_VERSION < 3
11197   0, /*tp_compare*/
11198   #endif
11199   #if PY_MAJOR_VERSION >= 3
11200   0, /*tp_as_async*/
11201   #endif
11202   0, /*tp_repr*/
11203   0, /*tp_as_number*/
11204   0, /*tp_as_sequence*/
11205   0, /*tp_as_mapping*/
11206   0, /*tp_hash*/
11207   0, /*tp_call*/
11208   0, /*tp_str*/
11209   0, /*tp_getattro*/
11210   0, /*tp_setattro*/
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*/
11213   0, /*tp_doc*/
11214   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_traverse*/
11215   0, /*tp_clear*/
11216   0, /*tp_richcompare*/
11217   0, /*tp_weaklistoffset*/
11218   0, /*tp_iter*/
11219   0, /*tp_iternext*/
11220   0, /*tp_methods*/
11221   0, /*tp_members*/
11222   0, /*tp_getset*/
11223   0, /*tp_base*/
11224   0, /*tp_dict*/
11225   0, /*tp_descr_get*/
11226   0, /*tp_descr_set*/
11227   0, /*tp_dictoffset*/
11228   0, /*tp_init*/
11229   0, /*tp_alloc*/
11230   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_6_select, /*tp_new*/
11231   0, /*tp_free*/
11232   0, /*tp_is_gc*/
11233   0, /*tp_bases*/
11234   0, /*tp_mro*/
11235   0, /*tp_cache*/
11236   0, /*tp_subclasses*/
11237   0, /*tp_weaklist*/
11238   0, /*tp_del*/
11239   0, /*tp_version_tag*/
11240   #if PY_VERSION_HEX >= 0x030400a1
11241   0, /*tp_finalize*/
11242   #endif
11243   #if PY_VERSION_HEX >= 0x030800b1
11244   0, /*tp_vectorcall*/
11245   #endif
11246   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11247   0, /*tp_print*/
11248   #endif
11249 };
11250
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;
11253
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) {
11255   PyObject *o;
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);
11261   } else {
11262     o = (*t->tp_alloc)(t, 0);
11263     if (unlikely(!o)) return 0;
11264   }
11265   return o;
11266 }
11267
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);
11277   } else {
11278     (*Py_TYPE(o)->tp_free)(o);
11279   }
11280 }
11281
11282 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate(PyObject *o, visitproc v, void *a) {
11283   int e;
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;
11287   }
11288   if (p->__pyx_v_key) {
11289     e = (*v)(p->__pyx_v_key, a); if (e) return e;
11290   }
11291   if (p->__pyx_v_tag) {
11292     e = (*v)(p->__pyx_v_tag, a); if (e) return e;
11293   }
11294   if (p->__pyx_v_value) {
11295     e = (*v)(p->__pyx_v_value, a); if (e) return e;
11296   }
11297   return 0;
11298 }
11299
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);
11306   return 0;
11307 }
11308
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*/
11313   0, /*tp_itemsize*/
11314   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_dealloc*/
11315   #if PY_VERSION_HEX < 0x030800b4
11316   0, /*tp_print*/
11317   #endif
11318   #if PY_VERSION_HEX >= 0x030800b4
11319   0, /*tp_vectorcall_offset*/
11320   #endif
11321   0, /*tp_getattr*/
11322   0, /*tp_setattr*/
11323   #if PY_MAJOR_VERSION < 3
11324   0, /*tp_compare*/
11325   #endif
11326   #if PY_MAJOR_VERSION >= 3
11327   0, /*tp_as_async*/
11328   #endif
11329   0, /*tp_repr*/
11330   0, /*tp_as_number*/
11331   0, /*tp_as_sequence*/
11332   0, /*tp_as_mapping*/
11333   0, /*tp_hash*/
11334   0, /*tp_call*/
11335   0, /*tp_str*/
11336   0, /*tp_getattro*/
11337   0, /*tp_setattro*/
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*/
11340   0, /*tp_doc*/
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*/
11345   0, /*tp_iter*/
11346   0, /*tp_iternext*/
11347   0, /*tp_methods*/
11348   0, /*tp_members*/
11349   0, /*tp_getset*/
11350   0, /*tp_base*/
11351   0, /*tp_dict*/
11352   0, /*tp_descr_get*/
11353   0, /*tp_descr_set*/
11354   0, /*tp_dictoffset*/
11355   0, /*tp_init*/
11356   0, /*tp_alloc*/
11357   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_7_prepare_predicate, /*tp_new*/
11358   0, /*tp_free*/
11359   0, /*tp_is_gc*/
11360   0, /*tp_bases*/
11361   0, /*tp_mro*/
11362   0, /*tp_cache*/
11363   0, /*tp_subclasses*/
11364   0, /*tp_weaklist*/
11365   0, /*tp_del*/
11366   0, /*tp_version_tag*/
11367   #if PY_VERSION_HEX >= 0x030400a1
11368   0, /*tp_finalize*/
11369   #endif
11370   #if PY_VERSION_HEX >= 0x030800b1
11371   0, /*tp_vectorcall*/
11372   #endif
11373   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11374   0, /*tp_print*/
11375   #endif
11376 };
11377
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;
11380
11381 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11382   PyObject *o;
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);
11388   } else {
11389     o = (*t->tp_alloc)(t, 0);
11390     if (unlikely(!o)) return 0;
11391   }
11392   return o;
11393 }
11394
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);
11404   } else {
11405     (*Py_TYPE(o)->tp_free)(o);
11406   }
11407 }
11408
11409 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_8_select(PyObject *o, visitproc v, void *a) {
11410   int e;
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;
11414   }
11415   if (p->__pyx_v_elem) {
11416     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11417   }
11418   if (p->__pyx_v_result) {
11419     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11420   }
11421   if (p->__pyx_t_0) {
11422     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11423   }
11424   return 0;
11425 }
11426
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*/
11431   0, /*tp_itemsize*/
11432   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_dealloc*/
11433   #if PY_VERSION_HEX < 0x030800b4
11434   0, /*tp_print*/
11435   #endif
11436   #if PY_VERSION_HEX >= 0x030800b4
11437   0, /*tp_vectorcall_offset*/
11438   #endif
11439   0, /*tp_getattr*/
11440   0, /*tp_setattr*/
11441   #if PY_MAJOR_VERSION < 3
11442   0, /*tp_compare*/
11443   #endif
11444   #if PY_MAJOR_VERSION >= 3
11445   0, /*tp_as_async*/
11446   #endif
11447   0, /*tp_repr*/
11448   0, /*tp_as_number*/
11449   0, /*tp_as_sequence*/
11450   0, /*tp_as_mapping*/
11451   0, /*tp_hash*/
11452   0, /*tp_call*/
11453   0, /*tp_str*/
11454   0, /*tp_getattro*/
11455   0, /*tp_setattro*/
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*/
11458   0, /*tp_doc*/
11459   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_traverse*/
11460   0, /*tp_clear*/
11461   0, /*tp_richcompare*/
11462   0, /*tp_weaklistoffset*/
11463   0, /*tp_iter*/
11464   0, /*tp_iternext*/
11465   0, /*tp_methods*/
11466   0, /*tp_members*/
11467   0, /*tp_getset*/
11468   0, /*tp_base*/
11469   0, /*tp_dict*/
11470   0, /*tp_descr_get*/
11471   0, /*tp_descr_set*/
11472   0, /*tp_dictoffset*/
11473   0, /*tp_init*/
11474   0, /*tp_alloc*/
11475   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_8_select, /*tp_new*/
11476   0, /*tp_free*/
11477   0, /*tp_is_gc*/
11478   0, /*tp_bases*/
11479   0, /*tp_mro*/
11480   0, /*tp_cache*/
11481   0, /*tp_subclasses*/
11482   0, /*tp_weaklist*/
11483   0, /*tp_del*/
11484   0, /*tp_version_tag*/
11485   #if PY_VERSION_HEX >= 0x030400a1
11486   0, /*tp_finalize*/
11487   #endif
11488   #if PY_VERSION_HEX >= 0x030800b1
11489   0, /*tp_vectorcall*/
11490   #endif
11491   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11492   0, /*tp_print*/
11493   #endif
11494 };
11495
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;
11498
11499 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11500   PyObject *o;
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);
11506   } else {
11507     o = (*t->tp_alloc)(t, 0);
11508     if (unlikely(!o)) return 0;
11509   }
11510   return o;
11511 }
11512
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);
11522   } else {
11523     (*Py_TYPE(o)->tp_free)(o);
11524   }
11525 }
11526
11527 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_9_select(PyObject *o, visitproc v, void *a) {
11528   int e;
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;
11532   }
11533   if (p->__pyx_v_elem) {
11534     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11535   }
11536   if (p->__pyx_v_result) {
11537     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11538   }
11539   if (p->__pyx_t_0) {
11540     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11541   }
11542   return 0;
11543 }
11544
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*/
11549   0, /*tp_itemsize*/
11550   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_dealloc*/
11551   #if PY_VERSION_HEX < 0x030800b4
11552   0, /*tp_print*/
11553   #endif
11554   #if PY_VERSION_HEX >= 0x030800b4
11555   0, /*tp_vectorcall_offset*/
11556   #endif
11557   0, /*tp_getattr*/
11558   0, /*tp_setattr*/
11559   #if PY_MAJOR_VERSION < 3
11560   0, /*tp_compare*/
11561   #endif
11562   #if PY_MAJOR_VERSION >= 3
11563   0, /*tp_as_async*/
11564   #endif
11565   0, /*tp_repr*/
11566   0, /*tp_as_number*/
11567   0, /*tp_as_sequence*/
11568   0, /*tp_as_mapping*/
11569   0, /*tp_hash*/
11570   0, /*tp_call*/
11571   0, /*tp_str*/
11572   0, /*tp_getattro*/
11573   0, /*tp_setattro*/
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*/
11576   0, /*tp_doc*/
11577   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_traverse*/
11578   0, /*tp_clear*/
11579   0, /*tp_richcompare*/
11580   0, /*tp_weaklistoffset*/
11581   0, /*tp_iter*/
11582   0, /*tp_iternext*/
11583   0, /*tp_methods*/
11584   0, /*tp_members*/
11585   0, /*tp_getset*/
11586   0, /*tp_base*/
11587   0, /*tp_dict*/
11588   0, /*tp_descr_get*/
11589   0, /*tp_descr_set*/
11590   0, /*tp_dictoffset*/
11591   0, /*tp_init*/
11592   0, /*tp_alloc*/
11593   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_9_select, /*tp_new*/
11594   0, /*tp_free*/
11595   0, /*tp_is_gc*/
11596   0, /*tp_bases*/
11597   0, /*tp_mro*/
11598   0, /*tp_cache*/
11599   0, /*tp_subclasses*/
11600   0, /*tp_weaklist*/
11601   0, /*tp_del*/
11602   0, /*tp_version_tag*/
11603   #if PY_VERSION_HEX >= 0x030400a1
11604   0, /*tp_finalize*/
11605   #endif
11606   #if PY_VERSION_HEX >= 0x030800b1
11607   0, /*tp_vectorcall*/
11608   #endif
11609   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11610   0, /*tp_print*/
11611   #endif
11612 };
11613
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;
11616
11617 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11618   PyObject *o;
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);
11624   } else {
11625     o = (*t->tp_alloc)(t, 0);
11626     if (unlikely(!o)) return 0;
11627   }
11628   return o;
11629 }
11630
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);
11642   } else {
11643     (*Py_TYPE(o)->tp_free)(o);
11644   }
11645 }
11646
11647 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_10_select(PyObject *o, visitproc v, void *a) {
11648   int e;
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;
11652   }
11653   if (p->__pyx_v__) {
11654     e = (*v)(p->__pyx_v__, a); if (e) return e;
11655   }
11656   if (p->__pyx_v_elem) {
11657     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11658   }
11659   if (p->__pyx_v_result) {
11660     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11661   }
11662   if (p->__pyx_t_0) {
11663     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11664   }
11665   if (p->__pyx_t_3) {
11666     e = (*v)(p->__pyx_t_3, a); if (e) return e;
11667   }
11668   return 0;
11669 }
11670
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*/
11675   0, /*tp_itemsize*/
11676   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_dealloc*/
11677   #if PY_VERSION_HEX < 0x030800b4
11678   0, /*tp_print*/
11679   #endif
11680   #if PY_VERSION_HEX >= 0x030800b4
11681   0, /*tp_vectorcall_offset*/
11682   #endif
11683   0, /*tp_getattr*/
11684   0, /*tp_setattr*/
11685   #if PY_MAJOR_VERSION < 3
11686   0, /*tp_compare*/
11687   #endif
11688   #if PY_MAJOR_VERSION >= 3
11689   0, /*tp_as_async*/
11690   #endif
11691   0, /*tp_repr*/
11692   0, /*tp_as_number*/
11693   0, /*tp_as_sequence*/
11694   0, /*tp_as_mapping*/
11695   0, /*tp_hash*/
11696   0, /*tp_call*/
11697   0, /*tp_str*/
11698   0, /*tp_getattro*/
11699   0, /*tp_setattro*/
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*/
11702   0, /*tp_doc*/
11703   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_traverse*/
11704   0, /*tp_clear*/
11705   0, /*tp_richcompare*/
11706   0, /*tp_weaklistoffset*/
11707   0, /*tp_iter*/
11708   0, /*tp_iternext*/
11709   0, /*tp_methods*/
11710   0, /*tp_members*/
11711   0, /*tp_getset*/
11712   0, /*tp_base*/
11713   0, /*tp_dict*/
11714   0, /*tp_descr_get*/
11715   0, /*tp_descr_set*/
11716   0, /*tp_dictoffset*/
11717   0, /*tp_init*/
11718   0, /*tp_alloc*/
11719   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_10_select, /*tp_new*/
11720   0, /*tp_free*/
11721   0, /*tp_is_gc*/
11722   0, /*tp_bases*/
11723   0, /*tp_mro*/
11724   0, /*tp_cache*/
11725   0, /*tp_subclasses*/
11726   0, /*tp_weaklist*/
11727   0, /*tp_del*/
11728   0, /*tp_version_tag*/
11729   #if PY_VERSION_HEX >= 0x030400a1
11730   0, /*tp_finalize*/
11731   #endif
11732   #if PY_VERSION_HEX >= 0x030800b1
11733   0, /*tp_vectorcall*/
11734   #endif
11735   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11736   0, /*tp_print*/
11737   #endif
11738 };
11739
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;
11742
11743 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11744   PyObject *o;
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);
11750   } else {
11751     o = (*t->tp_alloc)(t, 0);
11752     if (unlikely(!o)) return 0;
11753   }
11754   return o;
11755 }
11756
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);
11768   } else {
11769     (*Py_TYPE(o)->tp_free)(o);
11770   }
11771 }
11772
11773 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_11_select(PyObject *o, visitproc v, void *a) {
11774   int e;
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;
11778   }
11779   if (p->__pyx_v_e) {
11780     e = (*v)(p->__pyx_v_e, a); if (e) return e;
11781   }
11782   if (p->__pyx_v_elem) {
11783     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11784   }
11785   if (p->__pyx_v_result) {
11786     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11787   }
11788   if (p->__pyx_t_0) {
11789     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11790   }
11791   if (p->__pyx_t_3) {
11792     e = (*v)(p->__pyx_t_3, a); if (e) return e;
11793   }
11794   return 0;
11795 }
11796
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*/
11801   0, /*tp_itemsize*/
11802   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_dealloc*/
11803   #if PY_VERSION_HEX < 0x030800b4
11804   0, /*tp_print*/
11805   #endif
11806   #if PY_VERSION_HEX >= 0x030800b4
11807   0, /*tp_vectorcall_offset*/
11808   #endif
11809   0, /*tp_getattr*/
11810   0, /*tp_setattr*/
11811   #if PY_MAJOR_VERSION < 3
11812   0, /*tp_compare*/
11813   #endif
11814   #if PY_MAJOR_VERSION >= 3
11815   0, /*tp_as_async*/
11816   #endif
11817   0, /*tp_repr*/
11818   0, /*tp_as_number*/
11819   0, /*tp_as_sequence*/
11820   0, /*tp_as_mapping*/
11821   0, /*tp_hash*/
11822   0, /*tp_call*/
11823   0, /*tp_str*/
11824   0, /*tp_getattro*/
11825   0, /*tp_setattro*/
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*/
11828   0, /*tp_doc*/
11829   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_traverse*/
11830   0, /*tp_clear*/
11831   0, /*tp_richcompare*/
11832   0, /*tp_weaklistoffset*/
11833   0, /*tp_iter*/
11834   0, /*tp_iternext*/
11835   0, /*tp_methods*/
11836   0, /*tp_members*/
11837   0, /*tp_getset*/
11838   0, /*tp_base*/
11839   0, /*tp_dict*/
11840   0, /*tp_descr_get*/
11841   0, /*tp_descr_set*/
11842   0, /*tp_dictoffset*/
11843   0, /*tp_init*/
11844   0, /*tp_alloc*/
11845   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_11_select, /*tp_new*/
11846   0, /*tp_free*/
11847   0, /*tp_is_gc*/
11848   0, /*tp_bases*/
11849   0, /*tp_mro*/
11850   0, /*tp_cache*/
11851   0, /*tp_subclasses*/
11852   0, /*tp_weaklist*/
11853   0, /*tp_del*/
11854   0, /*tp_version_tag*/
11855   #if PY_VERSION_HEX >= 0x030400a1
11856   0, /*tp_finalize*/
11857   #endif
11858   #if PY_VERSION_HEX >= 0x030800b1
11859   0, /*tp_vectorcall*/
11860   #endif
11861   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11862   0, /*tp_print*/
11863   #endif
11864 };
11865
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;
11868
11869 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11870   PyObject *o;
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);
11876   } else {
11877     o = (*t->tp_alloc)(t, 0);
11878     if (unlikely(!o)) return 0;
11879   }
11880   return o;
11881 }
11882
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);
11892   } else {
11893     (*Py_TYPE(o)->tp_free)(o);
11894   }
11895 }
11896
11897 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_12_select(PyObject *o, visitproc v, void *a) {
11898   int e;
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;
11902   }
11903   if (p->__pyx_v_elem) {
11904     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
11905   }
11906   if (p->__pyx_v_result) {
11907     e = (*v)(p->__pyx_v_result, a); if (e) return e;
11908   }
11909   if (p->__pyx_t_0) {
11910     e = (*v)(p->__pyx_t_0, a); if (e) return e;
11911   }
11912   return 0;
11913 }
11914
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*/
11919   0, /*tp_itemsize*/
11920   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_dealloc*/
11921   #if PY_VERSION_HEX < 0x030800b4
11922   0, /*tp_print*/
11923   #endif
11924   #if PY_VERSION_HEX >= 0x030800b4
11925   0, /*tp_vectorcall_offset*/
11926   #endif
11927   0, /*tp_getattr*/
11928   0, /*tp_setattr*/
11929   #if PY_MAJOR_VERSION < 3
11930   0, /*tp_compare*/
11931   #endif
11932   #if PY_MAJOR_VERSION >= 3
11933   0, /*tp_as_async*/
11934   #endif
11935   0, /*tp_repr*/
11936   0, /*tp_as_number*/
11937   0, /*tp_as_sequence*/
11938   0, /*tp_as_mapping*/
11939   0, /*tp_hash*/
11940   0, /*tp_call*/
11941   0, /*tp_str*/
11942   0, /*tp_getattro*/
11943   0, /*tp_setattro*/
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*/
11946   0, /*tp_doc*/
11947   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_traverse*/
11948   0, /*tp_clear*/
11949   0, /*tp_richcompare*/
11950   0, /*tp_weaklistoffset*/
11951   0, /*tp_iter*/
11952   0, /*tp_iternext*/
11953   0, /*tp_methods*/
11954   0, /*tp_members*/
11955   0, /*tp_getset*/
11956   0, /*tp_base*/
11957   0, /*tp_dict*/
11958   0, /*tp_descr_get*/
11959   0, /*tp_descr_set*/
11960   0, /*tp_dictoffset*/
11961   0, /*tp_init*/
11962   0, /*tp_alloc*/
11963   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_12_select, /*tp_new*/
11964   0, /*tp_free*/
11965   0, /*tp_is_gc*/
11966   0, /*tp_bases*/
11967   0, /*tp_mro*/
11968   0, /*tp_cache*/
11969   0, /*tp_subclasses*/
11970   0, /*tp_weaklist*/
11971   0, /*tp_del*/
11972   0, /*tp_version_tag*/
11973   #if PY_VERSION_HEX >= 0x030400a1
11974   0, /*tp_finalize*/
11975   #endif
11976   #if PY_VERSION_HEX >= 0x030800b1
11977   0, /*tp_vectorcall*/
11978   #endif
11979   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
11980   0, /*tp_print*/
11981   #endif
11982 };
11983
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;
11986
11987 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
11988   PyObject *o;
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);
11994   } else {
11995     o = (*t->tp_alloc)(t, 0);
11996     if (unlikely(!o)) return 0;
11997   }
11998   return o;
11999 }
12000
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);
12015   } else {
12016     (*Py_TYPE(o)->tp_free)(o);
12017   }
12018 }
12019
12020 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_13_select(PyObject *o, visitproc v, void *a) {
12021   int e;
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;
12025   }
12026   if (p->__pyx_v_elem) {
12027     e = (*v)(p->__pyx_v_elem, a); if (e) return e;
12028   }
12029   if (p->__pyx_v_elems) {
12030     e = (*v)(p->__pyx_v_elems, a); if (e) return e;
12031   }
12032   if (p->__pyx_v_parent) {
12033     e = (*v)(p->__pyx_v_parent, a); if (e) return e;
12034   }
12035   if (p->__pyx_v_result) {
12036     e = (*v)(p->__pyx_v_result, a); if (e) return e;
12037   }
12038   if (p->__pyx_t_0) {
12039     e = (*v)(p->__pyx_t_0, a); if (e) return e;
12040   }
12041   if (p->__pyx_t_3) {
12042     e = (*v)(p->__pyx_t_3, a); if (e) return e;
12043   }
12044   if (p->__pyx_t_4) {
12045     e = (*v)(p->__pyx_t_4, a); if (e) return e;
12046   }
12047   if (p->__pyx_t_5) {
12048     e = (*v)(p->__pyx_t_5, a); if (e) return e;
12049   }
12050   return 0;
12051 }
12052
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*/
12057   0, /*tp_itemsize*/
12058   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_dealloc*/
12059   #if PY_VERSION_HEX < 0x030800b4
12060   0, /*tp_print*/
12061   #endif
12062   #if PY_VERSION_HEX >= 0x030800b4
12063   0, /*tp_vectorcall_offset*/
12064   #endif
12065   0, /*tp_getattr*/
12066   0, /*tp_setattr*/
12067   #if PY_MAJOR_VERSION < 3
12068   0, /*tp_compare*/
12069   #endif
12070   #if PY_MAJOR_VERSION >= 3
12071   0, /*tp_as_async*/
12072   #endif
12073   0, /*tp_repr*/
12074   0, /*tp_as_number*/
12075   0, /*tp_as_sequence*/
12076   0, /*tp_as_mapping*/
12077   0, /*tp_hash*/
12078   0, /*tp_call*/
12079   0, /*tp_str*/
12080   0, /*tp_getattro*/
12081   0, /*tp_setattro*/
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*/
12084   0, /*tp_doc*/
12085   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_traverse*/
12086   0, /*tp_clear*/
12087   0, /*tp_richcompare*/
12088   0, /*tp_weaklistoffset*/
12089   0, /*tp_iter*/
12090   0, /*tp_iternext*/
12091   0, /*tp_methods*/
12092   0, /*tp_members*/
12093   0, /*tp_getset*/
12094   0, /*tp_base*/
12095   0, /*tp_dict*/
12096   0, /*tp_descr_get*/
12097   0, /*tp_descr_set*/
12098   0, /*tp_dictoffset*/
12099   0, /*tp_init*/
12100   0, /*tp_alloc*/
12101   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_13_select, /*tp_new*/
12102   0, /*tp_free*/
12103   0, /*tp_is_gc*/
12104   0, /*tp_bases*/
12105   0, /*tp_mro*/
12106   0, /*tp_cache*/
12107   0, /*tp_subclasses*/
12108   0, /*tp_weaklist*/
12109   0, /*tp_del*/
12110   0, /*tp_version_tag*/
12111   #if PY_VERSION_HEX >= 0x030400a1
12112   0, /*tp_finalize*/
12113   #endif
12114   #if PY_VERSION_HEX >= 0x030800b1
12115   0, /*tp_vectorcall*/
12116   #endif
12117   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12118   0, /*tp_print*/
12119   #endif
12120 };
12121
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;
12124
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) {
12126   PyObject *o;
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);
12132   } else {
12133     o = (*t->tp_alloc)(t, 0);
12134     if (unlikely(!o)) return 0;
12135   }
12136   return o;
12137 }
12138
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);
12145   } else {
12146     (*Py_TYPE(o)->tp_free)(o);
12147   }
12148 }
12149
12150 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator(PyObject *o, visitproc v, void *a) {
12151   int e;
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;
12155   }
12156   return 0;
12157 }
12158
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);
12162   return 0;
12163 }
12164
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*/
12169   0, /*tp_itemsize*/
12170   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_dealloc*/
12171   #if PY_VERSION_HEX < 0x030800b4
12172   0, /*tp_print*/
12173   #endif
12174   #if PY_VERSION_HEX >= 0x030800b4
12175   0, /*tp_vectorcall_offset*/
12176   #endif
12177   0, /*tp_getattr*/
12178   0, /*tp_setattr*/
12179   #if PY_MAJOR_VERSION < 3
12180   0, /*tp_compare*/
12181   #endif
12182   #if PY_MAJOR_VERSION >= 3
12183   0, /*tp_as_async*/
12184   #endif
12185   0, /*tp_repr*/
12186   0, /*tp_as_number*/
12187   0, /*tp_as_sequence*/
12188   0, /*tp_as_mapping*/
12189   0, /*tp_hash*/
12190   0, /*tp_call*/
12191   0, /*tp_str*/
12192   0, /*tp_getattro*/
12193   0, /*tp_setattro*/
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*/
12196   0, /*tp_doc*/
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*/
12201   0, /*tp_iter*/
12202   0, /*tp_iternext*/
12203   0, /*tp_methods*/
12204   0, /*tp_members*/
12205   0, /*tp_getset*/
12206   0, /*tp_base*/
12207   0, /*tp_dict*/
12208   0, /*tp_descr_get*/
12209   0, /*tp_descr_set*/
12210   0, /*tp_dictoffset*/
12211   0, /*tp_init*/
12212   0, /*tp_alloc*/
12213   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_14__build_path_iterator, /*tp_new*/
12214   0, /*tp_free*/
12215   0, /*tp_is_gc*/
12216   0, /*tp_bases*/
12217   0, /*tp_mro*/
12218   0, /*tp_cache*/
12219   0, /*tp_subclasses*/
12220   0, /*tp_weaklist*/
12221   0, /*tp_del*/
12222   0, /*tp_version_tag*/
12223   #if PY_VERSION_HEX >= 0x030400a1
12224   0, /*tp_finalize*/
12225   #endif
12226   #if PY_VERSION_HEX >= 0x030800b1
12227   0, /*tp_vectorcall*/
12228   #endif
12229   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12230   0, /*tp_print*/
12231   #endif
12232 };
12233
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;
12236
12237 static PyObject *__pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
12238   PyObject *o;
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);
12244   } else {
12245     o = (*t->tp_alloc)(t, 0);
12246     if (unlikely(!o)) return 0;
12247   }
12248   return o;
12249 }
12250
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);
12258   } else {
12259     (*Py_TYPE(o)->tp_free)(o);
12260   }
12261 }
12262
12263 static int __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_15_genexpr(PyObject *o, visitproc v, void *a) {
12264   int e;
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;
12268   }
12269   if (p->__pyx_v_item) {
12270     e = (*v)(p->__pyx_v_item, a); if (e) return e;
12271   }
12272   return 0;
12273 }
12274
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*/
12279   0, /*tp_itemsize*/
12280   __pyx_tp_dealloc_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_dealloc*/
12281   #if PY_VERSION_HEX < 0x030800b4
12282   0, /*tp_print*/
12283   #endif
12284   #if PY_VERSION_HEX >= 0x030800b4
12285   0, /*tp_vectorcall_offset*/
12286   #endif
12287   0, /*tp_getattr*/
12288   0, /*tp_setattr*/
12289   #if PY_MAJOR_VERSION < 3
12290   0, /*tp_compare*/
12291   #endif
12292   #if PY_MAJOR_VERSION >= 3
12293   0, /*tp_as_async*/
12294   #endif
12295   0, /*tp_repr*/
12296   0, /*tp_as_number*/
12297   0, /*tp_as_sequence*/
12298   0, /*tp_as_mapping*/
12299   0, /*tp_hash*/
12300   0, /*tp_call*/
12301   0, /*tp_str*/
12302   0, /*tp_getattro*/
12303   0, /*tp_setattro*/
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*/
12306   0, /*tp_doc*/
12307   __pyx_tp_traverse_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_traverse*/
12308   0, /*tp_clear*/
12309   0, /*tp_richcompare*/
12310   0, /*tp_weaklistoffset*/
12311   0, /*tp_iter*/
12312   0, /*tp_iternext*/
12313   0, /*tp_methods*/
12314   0, /*tp_members*/
12315   0, /*tp_getset*/
12316   0, /*tp_base*/
12317   0, /*tp_dict*/
12318   0, /*tp_descr_get*/
12319   0, /*tp_descr_set*/
12320   0, /*tp_dictoffset*/
12321   0, /*tp_init*/
12322   0, /*tp_alloc*/
12323   __pyx_tp_new_4lxml_12_elementpath___pyx_scope_struct_15_genexpr, /*tp_new*/
12324   0, /*tp_free*/
12325   0, /*tp_is_gc*/
12326   0, /*tp_bases*/
12327   0, /*tp_mro*/
12328   0, /*tp_cache*/
12329   0, /*tp_subclasses*/
12330   0, /*tp_weaklist*/
12331   0, /*tp_del*/
12332   0, /*tp_version_tag*/
12333   #if PY_VERSION_HEX >= 0x030400a1
12334   0, /*tp_finalize*/
12335   #endif
12336   #if PY_VERSION_HEX >= 0x030800b1
12337   0, /*tp_vectorcall*/
12338   #endif
12339   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12340   0, /*tp_print*/
12341   #endif
12342 };
12343
12344 static PyMethodDef __pyx_methods[] = {
12345   {0, 0, 0, 0}
12346 };
12347
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},
12355   {0, NULL}
12356 };
12357 #endif
12358
12359 static struct PyModuleDef __pyx_moduledef = {
12360     PyModuleDef_HEAD_INIT,
12361     "_elementpath",
12362     0, /* m_doc */
12363   #if CYTHON_PEP489_MULTI_PHASE_INIT
12364     0, /* m_size */
12365   #else
12366     -1, /* m_size */
12367   #endif
12368     __pyx_methods /* m_methods */,
12369   #if CYTHON_PEP489_MULTI_PHASE_INIT
12370     __pyx_moduledef_slots, /* m_slots */
12371   #else
12372     NULL, /* m_reload */
12373   #endif
12374     NULL, /* m_traverse */
12375     NULL, /* m_clear */
12376     (freefunc)__pyx_module_cleanup /* m_free */
12377 };
12378 #endif
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))
12384 #else
12385     #define CYTHON_SMALL_CODE
12386 #endif
12387 #endif
12388
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}
12510 };
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)
12518   return 0;
12519   __pyx_L1_error:;
12520   return -1;
12521 }
12522
12523 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
12524   __Pyx_RefNannyDeclarations
12525   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
12526
12527   /* "lxml/_elementpath.py":82
12528  *         if tag and tag[0] != "{":
12529  *             if ":" in tag:
12530  *                 prefix, uri = tag.split(":", 1)             # <<<<<<<<<<<<<<
12531  *                 try:
12532  *                     if not namespaces:
12533  */
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);
12537
12538   /* "lxml/_elementpath.py":101
12539  * def prepare_child(next, token):
12540  *     tag = token[1]
12541  *     def select(result):             # <<<<<<<<<<<<<<
12542  *         for elem in result:
12543  *             for e in elem.iterchildren(tag):
12544  */
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)
12549
12550   /* "lxml/_elementpath.py":108
12551  * 
12552  * def prepare_star(next, token):
12553  *     def select(result):             # <<<<<<<<<<<<<<
12554  *         for elem in result:
12555  *             for e in elem.iterchildren('*'):
12556  */
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)
12561
12562   /* "lxml/_elementpath.py":115
12563  * 
12564  * def prepare_self(next, token):
12565  *     def select(result):             # <<<<<<<<<<<<<<
12566  *         return result
12567  *     return select
12568  */
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)
12573
12574   /* "lxml/_elementpath.py":126
12575  *         tag = token[1]
12576  *     else:
12577  *         raise SyntaxError("invalid descendant")             # <<<<<<<<<<<<<<
12578  *     def select(result):
12579  *         for elem in result:
12580  */
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);
12584
12585   /* "lxml/_elementpath.py":127
12586  *     else:
12587  *         raise SyntaxError("invalid descendant")
12588  *     def select(result):             # <<<<<<<<<<<<<<
12589  *         for elem in result:
12590  *             for e in elem.iterdescendants(tag):
12591  */
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)
12596
12597   /* "lxml/_elementpath.py":134
12598  * 
12599  * def prepare_parent(next, token):
12600  *     def select(result):             # <<<<<<<<<<<<<<
12601  *         for elem in result:
12602  *             parent = elem.getparent()
12603  */
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)
12608
12609   /* "lxml/_elementpath.py":151
12610  *         if token[0] == "]":
12611  *             break
12612  *         if token == ('', ''):             # <<<<<<<<<<<<<<
12613  *             # ignore whitespace
12614  *             continue
12615  */
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);
12619
12620   /* "lxml/_elementpath.py":154
12621  *             # ignore whitespace
12622  *             continue
12623  *         if token[0] and token[0][:1] in "'\"":             # <<<<<<<<<<<<<<
12624  *             token = "'", token[0][1:-1]
12625  *         signature += token[0] or "-"
12626  */
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);
12630
12631   /* "lxml/_elementpath.py":155
12632  *             continue
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])
12637  */
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);
12641
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:
12648  */
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)
12653
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:
12660  */
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)
12665
12666   /* "lxml/_elementpath.py":180
12667  *         # [tag]
12668  *         tag = predicate[0]
12669  *         def select(result):             # <<<<<<<<<<<<<<
12670  *             for elem in result:
12671  *                 for _ in elem.iterchildren(tag):
12672  */
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)
12677
12678   /* "lxml/_elementpath.py":191
12679  *         value = predicate[-1]
12680  *         if tag:
12681  *             def select(result):             # <<<<<<<<<<<<<<
12682  *                 for elem in result:
12683  *                     for e in elem.iterchildren(tag):
12684  */
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)
12689
12690   /* "lxml/_elementpath.py":198
12691  *                             break
12692  *         else:
12693  *             def select(result):             # <<<<<<<<<<<<<<
12694  *                 for elem in result:
12695  *                     if "".join(elem.itertext()) == value:
12696  */
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)
12701
12702   /* "lxml/_elementpath.py":210
12703  *             if index < 0:
12704  *                 if index == -1:
12705  *                     raise SyntaxError(             # <<<<<<<<<<<<<<
12706  *                         "indices in path predicates are 1-based, not 0-based")
12707  *                 else:
12708  */
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);
12712
12713   /* "lxml/_elementpath.py":213
12714  *                         "indices in path predicates are 1-based, not 0-based")
12715  *                 else:
12716  *                     raise SyntaxError("path index >= 1 expected")             # <<<<<<<<<<<<<<
12717  *         else:
12718  *             if predicate[0] != "last":
12719  */
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);
12723
12724   /* "lxml/_elementpath.py":216
12725  *         else:
12726  *             if predicate[0] != "last":
12727  *                 raise SyntaxError("unsupported function")             # <<<<<<<<<<<<<<
12728  *             if signature == "-()-":
12729  *                 try:
12730  */
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);
12734
12735   /* "lxml/_elementpath.py":221
12736  *                     index = int(predicate[2]) - 1
12737  *                 except ValueError:
12738  *                     raise SyntaxError("unsupported expression")             # <<<<<<<<<<<<<<
12739  *             else:
12740  *                 index = -1
12741  */
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);
12745
12746   /* "lxml/_elementpath.py":224
12747  *             else:
12748  *                 index = -1
12749  *         def select(result):             # <<<<<<<<<<<<<<
12750  *             for elem in result:
12751  *                 parent = elem.getparent()
12752  */
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)
12757
12758   /* "lxml/_elementpath.py":237
12759  *                     pass
12760  *         return select
12761  *     raise SyntaxError("invalid predicate")             # <<<<<<<<<<<<<<
12762  * 
12763  * ops = {
12764  */
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);
12768
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?)
12774  * 
12775  */
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);
12779
12780   /* "lxml/_elementpath.py":281
12781  * 
12782  *     if path[:1] == "/":
12783  *         raise SyntaxError("cannot use absolute path on element")             # <<<<<<<<<<<<<<
12784  *     stream = iter(xpath_tokenizer(path, namespaces))
12785  *     try:
12786  */
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);
12790
12791   /* "lxml/_elementpath.py":291
12792  *         token = _next()
12793  *     except StopIteration:
12794  *         raise SyntaxError("empty path expression")             # <<<<<<<<<<<<<<
12795  *     selector = []
12796  *     while 1:
12797  */
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);
12801
12802   /* "lxml/_elementpath.py":297
12803  *             selector.append(ops[token[0]](_next, token))
12804  *         except StopIteration:
12805  *             raise SyntaxError("invalid path")             # <<<<<<<<<<<<<<
12806  *         try:
12807  *             token = _next()
12808  */
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);
12812
12813   /* "lxml/_elementpath.py":62
12814  * import re
12815  * 
12816  * xpath_tokenizer_re = re.compile(             # <<<<<<<<<<<<<<
12817  *     "("
12818  *     "'[^']*'|\"[^\"]*\"|"
12819  */
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);
12823
12824   /* "lxml/_elementpath.py":74
12825  *     )
12826  * 
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
12830  */
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);
12838
12839   /* "lxml/_elementpath.py":99
12840  * 
12841  * 
12842  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
12843  *     tag = token[1]
12844  *     def select(result):
12845  */
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)
12850
12851   /* "lxml/_elementpath.py":107
12852  *     return select
12853  * 
12854  * def prepare_star(next, token):             # <<<<<<<<<<<<<<
12855  *     def select(result):
12856  *         for elem in result:
12857  */
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)
12862
12863   /* "lxml/_elementpath.py":114
12864  *     return select
12865  * 
12866  * def prepare_self(next, token):             # <<<<<<<<<<<<<<
12867  *     def select(result):
12868  *         return result
12869  */
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)
12874
12875   /* "lxml/_elementpath.py":119
12876  *     return select
12877  * 
12878  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
12879  *     token = next()
12880  *     if token[0] == "*":
12881  */
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)
12886
12887   /* "lxml/_elementpath.py":133
12888  *     return select
12889  * 
12890  * def prepare_parent(next, token):             # <<<<<<<<<<<<<<
12891  *     def select(result):
12892  *         for elem in result:
12893  */
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)
12898
12899   /* "lxml/_elementpath.py":141
12900  *     return select
12901  * 
12902  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
12903  *     # FIXME: replace with real parser!!! refs:
12904  *     # http://effbot.org/zone/simple-iterator-parser.htm
12905  */
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)
12910
12911   /* "lxml/_elementpath.py":254
12912  * 
12913  * 
12914  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
12915  *     """compile selector pattern"""
12916  *     if path[-1:] == "/":
12917  */
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)
12922
12923   /* "lxml/_elementpath.py":311
12924  * # Iterate over the matching nodes
12925  * 
12926  * def iterfind(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
12927  *     selector = _build_path_iterator(path, namespaces)
12928  *     result = iter((elem,))
12929  */
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);
12937
12938   /* "lxml/_elementpath.py":322
12939  * # Find first matching object.
12940  * 
12941  * def find(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
12942  *     it = iterfind(elem, path, namespaces)
12943  *     try:
12944  */
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);
12952
12953   /* "lxml/_elementpath.py":333
12954  * # Find all matching objects.
12955  * 
12956  * def findall(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
12957  *     return list(iterfind(elem, path, namespaces))
12958  * 
12959  */
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);
12967
12968   /* "lxml/_elementpath.py":340
12969  * # Find text for first matching object.
12970  * 
12971  * def findtext(elem, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
12972  *     el = find(elem, path, namespaces)
12973  *     if el is None:
12974  */
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();
12983   return 0;
12984   __pyx_L1_error:;
12985   __Pyx_RefNannyFinishContext();
12986   return -1;
12987 }
12988
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)
12994   return 0;
12995   __pyx_L1_error:;
12996   return -1;
12997 }
12998
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*/
13006
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();
13012   return 0;
13013 }
13014
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();
13020   return 0;
13021 }
13022
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();
13028   return 0;
13029 }
13030
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;
13041   #endif
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;
13044   }
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;
13049   #endif
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;
13052   }
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;
13057   #endif
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;
13060   }
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;
13065   #endif
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;
13068   }
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;
13073   #endif
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;
13076   }
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;
13081   #endif
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;
13084   }
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;
13089   #endif
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;
13092   }
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;
13097   #endif
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;
13100   }
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;
13105   #endif
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;
13108   }
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;
13113   #endif
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;
13116   }
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;
13121   #endif
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;
13124   }
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;
13129   #endif
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;
13132   }
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;
13137   #endif
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;
13140   }
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;
13145   #endif
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;
13148   }
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;
13153   #endif
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;
13156   }
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;
13161   #endif
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;
13164   }
13165   __pyx_ptype_4lxml_12_elementpath___pyx_scope_struct_15_genexpr = &__pyx_type_4lxml_12_elementpath___pyx_scope_struct_15_genexpr;
13166   __Pyx_RefNannyFinishContext();
13167   return 0;
13168   __pyx_L1_error:;
13169   __Pyx_RefNannyFinishContext();
13170   return -1;
13171 }
13172
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();
13178   return 0;
13179 }
13180
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();
13186   return 0;
13187 }
13188
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();
13194   return 0;
13195 }
13196
13197
13198 #ifndef CYTHON_NO_PYINIT_EXPORT
13199 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
13200 #elif PY_MAJOR_VERSION < 3
13201 #ifdef __cplusplus
13202 #define __Pyx_PyMODINIT_FUNC extern "C" void
13203 #else
13204 #define __Pyx_PyMODINIT_FUNC void
13205 #endif
13206 #else
13207 #ifdef __cplusplus
13208 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
13209 #else
13210 #define __Pyx_PyMODINIT_FUNC PyObject *
13211 #endif
13212 #endif
13213
13214
13215 #if PY_MAJOR_VERSION < 3
13216 __Pyx_PyMODINIT_FUNC init_elementpath(void) CYTHON_SMALL_CODE; /*proto*/
13217 __Pyx_PyMODINIT_FUNC init_elementpath(void)
13218 #else
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
13222 {
13223   return PyModuleDef_Init(&__pyx_moduledef);
13224 }
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))
13233     #else
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))
13239     #endif
13240     {
13241         PyErr_SetString(
13242             PyExc_ImportError,
13243             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
13244         return -1;
13245     }
13246     return 0;
13247 }
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);
13250     int result = 0;
13251     if (likely(value)) {
13252         if (allow_none || value != Py_None) {
13253             result = PyDict_SetItemString(moddict, to_name, value);
13254         }
13255         Py_DECREF(value);
13256     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
13257         PyErr_Clear();
13258     } else {
13259         result = -1;
13260     }
13261     return result;
13262 }
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())
13266         return NULL;
13267     if (__pyx_m)
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;
13280     return module;
13281 bad:
13282     Py_XDECREF(module);
13283     return NULL;
13284 }
13285
13286
13287 static CYTHON_SMALL_CODE int __pyx_pymod_exec__elementpath(PyObject *__pyx_pyinit_module)
13288 #endif
13289 #endif
13290 {
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
13298   if (__pyx_m) {
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.");
13301     return -1;
13302   }
13303   #elif PY_MAJOR_VERSION >= 3
13304   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
13305   #endif
13306   #if CYTHON_REFNANNY
13307 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
13308 if (!__Pyx_RefNanny) {
13309   PyErr_Clear();
13310   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
13311   if (!__Pyx_RefNanny)
13312       Py_FatalError("failed to import 'refnanny' module");
13313 }
13314 #endif
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();
13319   #endif
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)
13325   #endif
13326   #ifdef __Pyx_FusedFunction_USED
13327   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13328   #endif
13329   #ifdef __Pyx_Coroutine_USED
13330   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13331   #endif
13332   #ifdef __Pyx_Generator_USED
13333   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13334   #endif
13335   #ifdef __Pyx_AsyncGen_USED
13336   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13337   #endif
13338   #ifdef __Pyx_StopAsyncIteration_USED
13339   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13340   #endif
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();
13346   #endif
13347   #endif
13348   /*--- Module creation code ---*/
13349   #if CYTHON_PEP489_MULTI_PHASE_INIT
13350   __pyx_m = __pyx_pyinit_module;
13351   Py_INCREF(__pyx_m);
13352   #else
13353   #if PY_MAJOR_VERSION < 3
13354   __pyx_m = Py_InitModule4("_elementpath", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
13355   #else
13356   __pyx_m = PyModule_Create(&__pyx_moduledef);
13357   #endif
13358   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
13359   #endif
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)
13371   #endif
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)
13374   }
13375   #if PY_MAJOR_VERSION >= 3
13376   {
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)
13380     }
13381   }
13382   #endif
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)
13398   #endif
13399
13400   /* "lxml/_elementpath.py":60
13401  * from __future__ import absolute_import
13402  * 
13403  * import re             # <<<<<<<<<<<<<<
13404  * 
13405  * xpath_tokenizer_re = re.compile(
13406  */
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;
13411
13412   /* "lxml/_elementpath.py":62
13413  * import re
13414  * 
13415  * xpath_tokenizer_re = re.compile(             # <<<<<<<<<<<<<<
13416  *     "("
13417  *     "'[^']*'|\"[^\"]*\"|"
13418  */
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;
13429
13430   /* "lxml/_elementpath.py":74
13431  *     )
13432  * 
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
13436  */
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;
13442
13443   /* "lxml/_elementpath.py":99
13444  * 
13445  * 
13446  * def prepare_child(next, token):             # <<<<<<<<<<<<<<
13447  *     tag = token[1]
13448  *     def select(result):
13449  */
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;
13454
13455   /* "lxml/_elementpath.py":107
13456  *     return select
13457  * 
13458  * def prepare_star(next, token):             # <<<<<<<<<<<<<<
13459  *     def select(result):
13460  *         for elem in result:
13461  */
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;
13466
13467   /* "lxml/_elementpath.py":114
13468  *     return select
13469  * 
13470  * def prepare_self(next, token):             # <<<<<<<<<<<<<<
13471  *     def select(result):
13472  *         return result
13473  */
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;
13478
13479   /* "lxml/_elementpath.py":119
13480  *     return select
13481  * 
13482  * def prepare_descendant(next, token):             # <<<<<<<<<<<<<<
13483  *     token = next()
13484  *     if token[0] == "*":
13485  */
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;
13490
13491   /* "lxml/_elementpath.py":133
13492  *     return select
13493  * 
13494  * def prepare_parent(next, token):             # <<<<<<<<<<<<<<
13495  *     def select(result):
13496  *         for elem in result:
13497  */
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;
13502
13503   /* "lxml/_elementpath.py":141
13504  *     return select
13505  * 
13506  * def prepare_predicate(next, token):             # <<<<<<<<<<<<<<
13507  *     # FIXME: replace with real parser!!! refs:
13508  *     # http://effbot.org/zone/simple-iterator-parser.htm
13509  */
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;
13514
13515   /* "lxml/_elementpath.py":240
13516  * 
13517  * ops = {
13518  *     "": prepare_child,             # <<<<<<<<<<<<<<
13519  *     "*": prepare_star,
13520  *     ".": prepare_self,
13521  */
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;
13528
13529   /* "lxml/_elementpath.py":241
13530  * ops = {
13531  *     "": prepare_child,
13532  *     "*": prepare_star,             # <<<<<<<<<<<<<<
13533  *     ".": prepare_self,
13534  *     "..": prepare_parent,
13535  */
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;
13540
13541   /* "lxml/_elementpath.py":242
13542  *     "": prepare_child,
13543  *     "*": prepare_star,
13544  *     ".": prepare_self,             # <<<<<<<<<<<<<<
13545  *     "..": prepare_parent,
13546  *     "//": prepare_descendant,
13547  */
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;
13552
13553   /* "lxml/_elementpath.py":243
13554  *     "*": prepare_star,
13555  *     ".": prepare_self,
13556  *     "..": prepare_parent,             # <<<<<<<<<<<<<<
13557  *     "//": prepare_descendant,
13558  *     "[": prepare_predicate,
13559  */
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;
13564
13565   /* "lxml/_elementpath.py":244
13566  *     ".": prepare_self,
13567  *     "..": prepare_parent,
13568  *     "//": prepare_descendant,             # <<<<<<<<<<<<<<
13569  *     "[": prepare_predicate,
13570  * }
13571  */
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;
13576
13577   /* "lxml/_elementpath.py":245
13578  *     "..": prepare_parent,
13579  *     "//": prepare_descendant,
13580  *     "[": prepare_predicate,             # <<<<<<<<<<<<<<
13581  * }
13582  * 
13583  */
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;
13590
13591   /* "lxml/_elementpath.py":251
13592  * # --------------------------------------------------------------------
13593  * 
13594  * _cache = {}             # <<<<<<<<<<<<<<
13595  * 
13596  * 
13597  */
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;
13602
13603   /* "lxml/_elementpath.py":254
13604  * 
13605  * 
13606  * def _build_path_iterator(path, namespaces):             # <<<<<<<<<<<<<<
13607  *     """compile selector pattern"""
13608  *     if path[-1:] == "/":
13609  */
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;
13614
13615   /* "lxml/_elementpath.py":311
13616  * # Iterate over the matching nodes
13617  * 
13618  * def iterfind(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
13619  *     selector = _build_path_iterator(path, namespaces)
13620  *     result = iter((elem,))
13621  */
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;
13627
13628   /* "lxml/_elementpath.py":322
13629  * # Find first matching object.
13630  * 
13631  * def find(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
13632  *     it = iterfind(elem, path, namespaces)
13633  *     try:
13634  */
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;
13640
13641   /* "lxml/_elementpath.py":333
13642  * # Find all matching objects.
13643  * 
13644  * def findall(elem, path, namespaces=None):             # <<<<<<<<<<<<<<
13645  *     return list(iterfind(elem, path, namespaces))
13646  * 
13647  */
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;
13653
13654   /* "lxml/_elementpath.py":340
13655  * # Find text for first matching object.
13656  * 
13657  * def findtext(elem, path, default=None, namespaces=None):             # <<<<<<<<<<<<<<
13658  *     el = find(elem, path, namespaces)
13659  *     if el is None:
13660  */
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;
13666
13667   /* "lxml/_elementpath.py":1
13668  * # cython: language_level=2             # <<<<<<<<<<<<<<
13669  * 
13670  * #
13671  */
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;
13676
13677   /*--- Wrapped vars code ---*/
13678
13679   if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
13680   goto __pyx_L0;
13681   __pyx_L1_error:;
13682   __Pyx_XDECREF(__pyx_t_1);
13683   __Pyx_XDECREF(__pyx_t_2);
13684   if (__pyx_m) {
13685     if (__pyx_d) {
13686       __Pyx_AddTraceback("init lxml._elementpath", __pyx_clineno, __pyx_lineno, __pyx_filename);
13687     }
13688     Py_CLEAR(__pyx_m);
13689   } else if (!PyErr_Occurred()) {
13690     PyErr_SetString(PyExc_ImportError, "init lxml._elementpath");
13691   }
13692   __pyx_L0:;
13693   __Pyx_RefNannyFinishContext();
13694   #if CYTHON_PEP489_MULTI_PHASE_INIT
13695   return (__pyx_m != NULL) ? 0 : -1;
13696   #elif PY_MAJOR_VERSION >= 3
13697   return __pyx_m;
13698   #else
13699   return;
13700   #endif
13701 }
13702
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);
13779       }
13780       PyMem_Free(entries);
13781   }
13782
13783 }
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);
13800   }
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);
13804   }
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);
13808   }
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);
13812   }
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);
13816   }
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);
13820   }
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);
13824   }
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);
13828   }
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);
13832   }
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);
13836   }
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);
13840   }
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);
13844   }
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);
13848   }
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);
13852   }
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);
13856   }
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);
13860   }
13861   Py_CLEAR(__pyx_d);
13862   Py_CLEAR(__pyx_cython_runtime);
13863   Py_CLEAR(__pyx_b);
13864 }
13865
13866 /* --- Runtime support code --- */
13867 /* Refnanny */
13868 #if CYTHON_REFNANNY
13869 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
13870     PyObject *m = NULL, *p = NULL;
13871     void *r = NULL;
13872     m = PyImport_ImportModule(modname);
13873     if (!m) goto end;
13874     p = PyObject_GetAttrString(m, "RefNannyAPI");
13875     if (!p) goto end;
13876     r = PyLong_AsVoidPtr(p);
13877 end:
13878     Py_XDECREF(p);
13879     Py_XDECREF(m);
13880     return (__Pyx_RefNannyAPIStruct *)r;
13881 }
13882 #endif
13883
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));
13893 #endif
13894     return PyObject_GetAttr(obj, attr_name);
13895 }
13896 #endif
13897
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);
13905 #else
13906             "name '%.200s' is not defined", PyString_AS_STRING(name));
13907 #endif
13908     }
13909     return result;
13910 }
13911
13912 /* RaiseDoubleKeywords */
13913 static void __Pyx_RaiseDoubleKeywordsError(
13914     const char* func_name,
13915     PyObject* kw_name)
13916 {
13917     PyErr_Format(PyExc_TypeError,
13918         #if PY_MAJOR_VERSION >= 3
13919         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
13920         #else
13921         "%s() got multiple values for keyword argument '%s'", func_name,
13922         PyString_AsString(kw_name));
13923         #endif
13924 }
13925
13926 /* ParseKeywords */
13927 static int __Pyx_ParseOptionalKeywords(
13928     PyObject *kwds,
13929     PyObject **argnames[],
13930     PyObject *kwds2,
13931     PyObject *values[],
13932     Py_ssize_t num_pos_args,
13933     const char* function_name)
13934 {
13935     PyObject *key = 0, *value = 0;
13936     Py_ssize_t pos = 0;
13937     PyObject*** name;
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++;
13942         if (*name) {
13943             values[name-argnames] = value;
13944             continue;
13945         }
13946         name = first_kw_arg;
13947         #if PY_MAJOR_VERSION < 3
13948         if (likely(PyString_Check(key))) {
13949             while (*name) {
13950                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
13951                         && _PyString_Eq(**name, key)) {
13952                     values[name-argnames] = value;
13953                     break;
13954                 }
13955                 name++;
13956             }
13957             if (*name) continue;
13958             else {
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;
13965                     }
13966                     argname++;
13967                 }
13968             }
13969         } else
13970         #endif
13971         if (likely(PyUnicode_Check(key))) {
13972             while (*name) {
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 :
13976                 #endif
13977                     PyUnicode_Compare(**name, key);
13978                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13979                 if (cmp == 0) {
13980                     values[name-argnames] = value;
13981                     break;
13982                 }
13983                 name++;
13984             }
13985             if (*name) continue;
13986             else {
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 :
13992                     #endif
13993                         PyUnicode_Compare(**argname, key);
13994                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
13995                     if (cmp == 0) goto arg_passed_twice;
13996                     argname++;
13997                 }
13998             }
13999         } else
14000             goto invalid_keyword_type;
14001         if (kwds2) {
14002             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
14003         } else {
14004             goto invalid_keyword;
14005         }
14006     }
14007     return 0;
14008 arg_passed_twice:
14009     __Pyx_RaiseDoubleKeywordsError(function_name, key);
14010     goto bad;
14011 invalid_keyword_type:
14012     PyErr_Format(PyExc_TypeError,
14013         "%.200s() keywords must be strings", function_name);
14014     goto bad;
14015 invalid_keyword:
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));
14020     #else
14021         "%s() got an unexpected keyword argument '%U'",
14022         function_name, key);
14023     #endif
14024 bad:
14025     return -1;
14026 }
14027
14028 /* RaiseArgTupleInvalid */
14029 static void __Pyx_RaiseArgtupleInvalid(
14030     const char* func_name,
14031     int exact,
14032     Py_ssize_t num_min,
14033     Py_ssize_t num_max,
14034     Py_ssize_t num_found)
14035 {
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";
14041     } else {
14042         num_expected = num_max;
14043         more_or_less = "at most";
14044     }
14045     if (exact) {
14046         more_or_less = "exactly";
14047     }
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);
14052 }
14053
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);
14071     } else {
14072         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
14073     }
14074 }
14075 #endif
14076
14077 /* PyFunctionFastCall */
14078 #if CYTHON_FAST_PYCALL
14079 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
14080                                                PyObject *globals) {
14081     PyFrameObject *f;
14082     PyThreadState *tstate = __Pyx_PyThreadState_Current;
14083     PyObject **fastlocals;
14084     Py_ssize_t i;
14085     PyObject *result;
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.
14090        */
14091     assert(tstate != NULL);
14092     f = PyFrame_New(tstate, co, globals, NULL);
14093     if (f == NULL) {
14094         return NULL;
14095     }
14096     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
14097     for (i = 0; i < na; i++) {
14098         Py_INCREF(*args);
14099         fastlocals[i] = *args++;
14100     }
14101     result = PyEval_EvalFrameEx(f,0);
14102     ++tstate->recursion_depth;
14103     Py_DECREF(f);
14104     --tstate->recursion_depth;
14105     return result;
14106 }
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);
14112     PyObject *closure;
14113 #if PY_MAJOR_VERSION >= 3
14114     PyObject *kwdefs;
14115 #endif
14116     PyObject *kwtuple, **k;
14117     PyObject **d;
14118     Py_ssize_t nd;
14119     Py_ssize_t nk;
14120     PyObject *result;
14121     assert(kwargs == NULL || PyDict_Check(kwargs));
14122     nk = kwargs ? PyDict_Size(kwargs) : 0;
14123     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
14124         return NULL;
14125     }
14126     if (
14127 #if PY_MAJOR_VERSION >= 3
14128             co->co_kwonlyargcount == 0 &&
14129 #endif
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);
14134             goto done;
14135         }
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);
14142             goto done;
14143         }
14144     }
14145     if (kwargs != NULL) {
14146         Py_ssize_t pos, i;
14147         kwtuple = PyTuple_New(2 * nk);
14148         if (kwtuple == NULL) {
14149             result = NULL;
14150             goto done;
14151         }
14152         k = &PyTuple_GET_ITEM(kwtuple, 0);
14153         pos = i = 0;
14154         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
14155             Py_INCREF(k[i]);
14156             Py_INCREF(k[i+1]);
14157             i += 2;
14158         }
14159         nk = i / 2;
14160     }
14161     else {
14162         kwtuple = NULL;
14163         k = NULL;
14164     }
14165     closure = PyFunction_GET_CLOSURE(func);
14166 #if PY_MAJOR_VERSION >= 3
14167     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
14168 #endif
14169     if (argdefs != NULL) {
14170         d = &PyTuple_GET_ITEM(argdefs, 0);
14171         nd = Py_SIZE(argdefs);
14172     }
14173     else {
14174         d = NULL;
14175         nd = 0;
14176     }
14177 #if PY_MAJOR_VERSION >= 3
14178     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
14179                                args, (int)nargs,
14180                                k, (int)nk,
14181                                d, (int)nd, kwdefs, closure);
14182 #else
14183     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
14184                                args, (int)nargs,
14185                                k, (int)nk,
14186                                d, (int)nd, closure);
14187 #endif
14188     Py_XDECREF(kwtuple);
14189 done:
14190     Py_LeaveRecursiveCall();
14191     return result;
14192 }
14193 #endif
14194 #endif
14195
14196 /* PyObjectCall */
14197 #if CYTHON_COMPILING_IN_CPYTHON
14198 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
14199     PyObject *result;
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")))
14204         return NULL;
14205     result = (*call)(func, arg, kw);
14206     Py_LeaveRecursiveCall();
14207     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14208         PyErr_SetString(
14209             PyExc_SystemError,
14210             "NULL result without error in PyObject_Call");
14211     }
14212     return result;
14213 }
14214 #endif
14215
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);
14223     }
14224     #endif
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);
14229     }
14230     #endif
14231     args = PyTuple_New(2);
14232     if (unlikely(!args)) goto done;
14233     Py_INCREF(arg1);
14234     PyTuple_SET_ITEM(args, 0, arg1);
14235     Py_INCREF(arg2);
14236     PyTuple_SET_ITEM(args, 1, arg2);
14237     Py_INCREF(function);
14238     result = __Pyx_PyObject_Call(function, args, NULL);
14239     Py_DECREF(args);
14240     Py_DECREF(function);
14241 done:
14242     return result;
14243 }
14244
14245 /* PyObjectCallMethO */
14246 #if CYTHON_COMPILING_IN_CPYTHON
14247 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
14248     PyObject *self, *result;
14249     PyCFunction cfunc;
14250     cfunc = PyCFunction_GET_FUNCTION(func);
14251     self = PyCFunction_GET_SELF(func);
14252     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14253         return NULL;
14254     result = cfunc(self, arg);
14255     Py_LeaveRecursiveCall();
14256     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14257         PyErr_SetString(
14258             PyExc_SystemError,
14259             "NULL result without error in PyObject_Call");
14260     }
14261     return result;
14262 }
14263 #endif
14264
14265 /* PyObjectCallOneArg */
14266 #if CYTHON_COMPILING_IN_CPYTHON
14267 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14268     PyObject *result;
14269     PyObject *args = PyTuple_New(1);
14270     if (unlikely(!args)) return NULL;
14271     Py_INCREF(arg);
14272     PyTuple_SET_ITEM(args, 0, arg);
14273     result = __Pyx_PyObject_Call(func, args, NULL);
14274     Py_DECREF(args);
14275     return result;
14276 }
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);
14281     }
14282 #endif
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);
14289 #endif
14290         }
14291     }
14292     return __Pyx__PyObject_CallOneArg(func, arg);
14293 }
14294 #else
14295 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14296     PyObject *result;
14297     PyObject *args = PyTuple_Pack(1, arg);
14298     if (unlikely(!args)) return NULL;
14299     result = __Pyx_PyObject_Call(func, args, NULL);
14300     Py_DECREF(args);
14301     return result;
14302 }
14303 #endif
14304
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;
14310 }
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;
14314     if (offset) {
14315 #if CYTHON_COMPILING_IN_CPYTHON
14316         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
14317 #else
14318         dictptr = _PyObject_GetDictPtr(obj);
14319 #endif
14320     }
14321     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
14322 }
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)))
14326         return 0;
14327     return obj_dict_version == __Pyx_get_object_dict_version(obj);
14328 }
14329 #endif
14330
14331 /* GetModuleGlobalName */
14332 #if CYTHON_USE_DICT_VERSIONS
14333 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
14334 #else
14335 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
14336 #endif
14337 {
14338     PyObject *result;
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())) {
14346         return NULL;
14347     }
14348 #else
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);
14353     }
14354 #endif
14355 #else
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);
14360     }
14361     PyErr_Clear();
14362 #endif
14363     return __Pyx_GetBuiltinName(name);
14364 }
14365
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);
14370 }
14371
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");
14377 }
14378
14379 /* IterFinish */
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);
14395             return 0;
14396         } else {
14397             return -1;
14398         }
14399     }
14400     return 0;
14401 #else
14402     if (unlikely(PyErr_Occurred())) {
14403         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
14404             PyErr_Clear();
14405             return 0;
14406         } else {
14407             return -1;
14408         }
14409     }
14410     return 0;
14411 #endif
14412 }
14413
14414 /* UnpackItemEndCheck */
14415 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
14416     if (unlikely(retval)) {
14417         Py_DECREF(retval);
14418         __Pyx_RaiseTooManyValuesError(expected);
14419         return -1;
14420     } else {
14421         return __Pyx_IterFinish();
14422     }
14423     return 0;
14424 }
14425
14426 /* GetItemInt */
14427 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
14428     PyObject *r;
14429     if (!j) return NULL;
14430     r = PyObject_GetItem(o, j);
14431     Py_DECREF(j);
14432     return r;
14433 }
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);
14441     }
14442     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
14443         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
14444         Py_INCREF(r);
14445         return r;
14446     }
14447     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14448 #else
14449     return PySequence_GetItem(o, i);
14450 #endif
14451 }
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);
14459     }
14460     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
14461         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
14462         Py_INCREF(r);
14463         return r;
14464     }
14465     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14466 #else
14467     return PySequence_GetItem(o, i);
14468 #endif
14469 }
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);
14478             Py_INCREF(r);
14479             return r;
14480         }
14481     }
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);
14486             Py_INCREF(r);
14487             return r;
14488         }
14489     } else {
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)) {
14495                     i += l;
14496                 } else {
14497                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
14498                         return NULL;
14499                     PyErr_Clear();
14500                 }
14501             }
14502             return m->sq_item(o, i);
14503         }
14504     }
14505 #else
14506     if (is_list || PySequence_Check(o)) {
14507         return PySequence_GetItem(o, i);
14508     }
14509 #endif
14510     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
14511 }
14512
14513 /* BytesEquals */
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);
14517 #else
14518     if (s1 == s2) {
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);
14531         } else {
14532             int result;
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);
14539             }
14540 #endif
14541             result = memcmp(ps1, ps2, (size_t)length);
14542             return (equals == Py_EQ) ? (result == 0) : (result != 0);
14543         }
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);
14548     } else {
14549         int result;
14550         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14551         if (!py_result)
14552             return -1;
14553         result = __Pyx_PyObject_IsTrue(py_result);
14554         Py_DECREF(py_result);
14555         return result;
14556     }
14557 #endif
14558 }
14559
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);
14564 #else
14565 #if PY_MAJOR_VERSION < 3
14566     PyObject* owned_ref = NULL;
14567 #endif
14568     int s1_is_unicode, s2_is_unicode;
14569     if (s1 == s2) {
14570         goto return_eq;
14571     }
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))
14578             return -1;
14579         s2 = owned_ref;
14580         s2_is_unicode = 1;
14581     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
14582         owned_ref = PyUnicode_FromObject(s1);
14583         if (unlikely(!owned_ref))
14584             return -1;
14585         s1 = owned_ref;
14586         s1_is_unicode = 1;
14587     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
14588         return __Pyx_PyBytes_Equals(s1, s2, equals);
14589     }
14590 #endif
14591     if (s1_is_unicode & s2_is_unicode) {
14592         Py_ssize_t length;
14593         int kind;
14594         void *data1, *data2;
14595         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
14596             return -1;
14597         length = __Pyx_PyUnicode_GET_LENGTH(s1);
14598         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
14599             goto return_ne;
14600         }
14601 #if CYTHON_USE_UNICODE_INTERNALS
14602         {
14603             Py_hash_t hash1, hash2;
14604         #if CYTHON_PEP393_ENABLED
14605             hash1 = ((PyASCIIObject*)s1)->hash;
14606             hash2 = ((PyASCIIObject*)s2)->hash;
14607         #else
14608             hash1 = ((PyUnicodeObject*)s1)->hash;
14609             hash2 = ((PyUnicodeObject*)s2)->hash;
14610         #endif
14611             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
14612                 goto return_ne;
14613             }
14614         }
14615 #endif
14616         kind = __Pyx_PyUnicode_KIND(s1);
14617         if (kind != __Pyx_PyUnicode_KIND(s2)) {
14618             goto return_ne;
14619         }
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)) {
14623             goto return_ne;
14624         } else if (length == 1) {
14625             goto return_eq;
14626         } else {
14627             int result = memcmp(data1, data2, (size_t)(length * kind));
14628             #if PY_MAJOR_VERSION < 3
14629             Py_XDECREF(owned_ref);
14630             #endif
14631             return (equals == Py_EQ) ? (result == 0) : (result != 0);
14632         }
14633     } else if ((s1 == Py_None) & s2_is_unicode) {
14634         goto return_ne;
14635     } else if ((s2 == Py_None) & s1_is_unicode) {
14636         goto return_ne;
14637     } else {
14638         int result;
14639         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
14640         #if PY_MAJOR_VERSION < 3
14641         Py_XDECREF(owned_ref);
14642         #endif
14643         if (!py_result)
14644             return -1;
14645         result = __Pyx_PyObject_IsTrue(py_result);
14646         Py_DECREF(py_result);
14647         return result;
14648     }
14649 return_eq:
14650     #if PY_MAJOR_VERSION < 3
14651     Py_XDECREF(owned_ref);
14652     #endif
14653     return (equals == Py_EQ);
14654 return_ne:
14655     #if PY_MAJOR_VERSION < 3
14656     Py_XDECREF(owned_ref);
14657     #endif
14658     return (equals == Py_NE);
14659 #endif
14660 }
14661
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);
14675 }
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;
14683 }
14684 #endif
14685
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
14691     Py_XINCREF(type);
14692     if (!value || value == Py_None)
14693         value = NULL;
14694     else
14695         Py_INCREF(value);
14696     if (!tb || tb == Py_None)
14697         tb = NULL;
14698     else {
14699         Py_INCREF(tb);
14700         if (!PyTraceBack_Check(tb)) {
14701             PyErr_SetString(PyExc_TypeError,
14702                 "raise: arg 3 must be a traceback or None");
14703             goto raise_error;
14704         }
14705     }
14706     if (PyType_Check(type)) {
14707 #if CYTHON_COMPILING_IN_PYPY
14708         if (!value) {
14709             Py_INCREF(Py_None);
14710             value = Py_None;
14711         }
14712 #endif
14713         PyErr_NormalizeException(&type, &value, &tb);
14714     } else {
14715         if (value) {
14716             PyErr_SetString(PyExc_TypeError,
14717                 "instance exception may not have a separate value");
14718             goto raise_error;
14719         }
14720         value = type;
14721         type = (PyObject*) Py_TYPE(type);
14722         Py_INCREF(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");
14726             goto raise_error;
14727         }
14728     }
14729     __Pyx_PyThreadState_assign
14730     __Pyx_ErrRestore(type, value, tb);
14731     return;
14732 raise_error:
14733     Py_XDECREF(value);
14734     Py_XDECREF(type);
14735     Py_XDECREF(tb);
14736     return;
14737 }
14738 #else
14739 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
14740     PyObject* owned_instance = NULL;
14741     if (tb == Py_None) {
14742         tb = 0;
14743     } else if (tb && !PyTraceBack_Check(tb)) {
14744         PyErr_SetString(PyExc_TypeError,
14745             "raise: arg 3 must be a traceback or None");
14746         goto bad;
14747     }
14748     if (value == Py_None)
14749         value = 0;
14750     if (PyExceptionInstance_Check(type)) {
14751         if (value) {
14752             PyErr_SetString(PyExc_TypeError,
14753                 "instance exception may not have a separate value");
14754             goto bad;
14755         }
14756         value = type;
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)) {
14767                     goto bad;
14768                 } else {
14769                     type = instance_class;
14770                 }
14771             }
14772         }
14773         if (!instance_class) {
14774             PyObject *args;
14775             if (!value)
14776                 args = PyTuple_New(0);
14777             else if (PyTuple_Check(value)) {
14778                 Py_INCREF(value);
14779                 args = value;
14780             } else
14781                 args = PyTuple_Pack(1, value);
14782             if (!args)
14783                 goto bad;
14784             owned_instance = PyObject_Call(type, args, NULL);
14785             Py_DECREF(args);
14786             if (!owned_instance)
14787                 goto bad;
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));
14794                 goto bad;
14795             }
14796         }
14797     } else {
14798         PyErr_SetString(PyExc_TypeError,
14799             "raise: exception class must be a subclass of BaseException");
14800         goto bad;
14801     }
14802     if (cause) {
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)
14809                 goto bad;
14810         } else if (PyExceptionInstance_Check(cause)) {
14811             fixed_cause = cause;
14812             Py_INCREF(fixed_cause);
14813         } else {
14814             PyErr_SetString(PyExc_TypeError,
14815                             "exception causes must derive from "
14816                             "BaseException");
14817             goto bad;
14818         }
14819         PyException_SetCause(value, fixed_cause);
14820     }
14821     PyErr_SetObject(type, value);
14822     if (tb) {
14823 #if CYTHON_COMPILING_IN_PYPY
14824         PyObject *tmp_type, *tmp_value, *tmp_tb;
14825         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
14826         Py_INCREF(tb);
14827         PyErr_Restore(tmp_type, tmp_value, tb);
14828         Py_XDECREF(tmp_tb);
14829 #else
14830         PyThreadState *tstate = __Pyx_PyThreadState_Current;
14831         PyObject* tmp_tb = tstate->curexc_traceback;
14832         if (tb != tmp_tb) {
14833             Py_INCREF(tb);
14834             tstate->curexc_traceback = tb;
14835             Py_XDECREF(tmp_tb);
14836         }
14837 #endif
14838     }
14839 bad:
14840     Py_XDECREF(owned_instance);
14841     return;
14842 }
14843 #endif
14844
14845 /* ObjectGetItem */
14846 #if CYTHON_USE_TYPE_SLOTS
14847 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
14848     PyObject *runerr;
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);
14853         return NULL;
14854     }
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);
14858     }
14859     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
14860         PyErr_Clear();
14861         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
14862     }
14863     return NULL;
14864 }
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);
14869     }
14870     return __Pyx_PyObject_GetIndex(obj, key);
14871 }
14872 #endif
14873
14874 /* GetTopmostException */
14875 #if CYTHON_USE_EXC_INFO_STACK
14876 static _PyErr_StackItem *
14877 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
14878 {
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)
14882     {
14883         exc_info = exc_info->previous_item;
14884     }
14885     return exc_info;
14886 }
14887 #endif
14888
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;
14897     #else
14898     *type = tstate->exc_type;
14899     *value = tstate->exc_value;
14900     *tb = tstate->exc_traceback;
14901     #endif
14902     Py_XINCREF(*type);
14903     Py_XINCREF(*value);
14904     Py_XINCREF(*tb);
14905 }
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;
14916     #else
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;
14923     #endif
14924     Py_XDECREF(tmp_type);
14925     Py_XDECREF(tmp_value);
14926     Py_XDECREF(tmp_tb);
14927 }
14928 #endif
14929
14930 /* PyErrExceptionMatches */
14931 #if CYTHON_FAST_THREAD_STATE
14932 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14933     Py_ssize_t i, n;
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;
14938     }
14939 #endif
14940     for (i=0; i<n; i++) {
14941         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
14942     }
14943     return 0;
14944 }
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);
14952 }
14953 #endif
14954
14955 /* GetException */
14956 #if CYTHON_FAST_THREAD_STATE
14957 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
14958 #else
14959 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
14960 #endif
14961 {
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;
14971 #else
14972     PyErr_Fetch(&local_type, &local_value, &local_tb);
14973 #endif
14974     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14975 #if CYTHON_FAST_THREAD_STATE
14976     if (unlikely(tstate->curexc_type))
14977 #else
14978     if (unlikely(PyErr_Occurred()))
14979 #endif
14980         goto bad;
14981     #if PY_MAJOR_VERSION >= 3
14982     if (local_tb) {
14983         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14984             goto bad;
14985     }
14986     #endif
14987     Py_XINCREF(local_tb);
14988     Py_XINCREF(local_type);
14989     Py_XINCREF(local_value);
14990     *type = local_type;
14991     *value = local_value;
14992     *tb = local_tb;
14993 #if CYTHON_FAST_THREAD_STATE
14994     #if CYTHON_USE_EXC_INFO_STACK
14995     {
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;
15003     }
15004     #else
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;
15011     #endif
15012     Py_XDECREF(tmp_type);
15013     Py_XDECREF(tmp_value);
15014     Py_XDECREF(tmp_tb);
15015 #else
15016     PyErr_SetExcInfo(local_type, local_value, local_tb);
15017 #endif
15018     return 0;
15019 bad:
15020     *type = 0;
15021     *value = 0;
15022     *tb = 0;
15023     Py_XDECREF(local_type);
15024     Py_XDECREF(local_value);
15025     Py_XDECREF(local_tb);
15026     return -1;
15027 }
15028
15029 /* None */
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);
15032 }
15033
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);
15042     if (cached_type) {
15043         if (!PyType_Check((PyObject*)cached_type)) {
15044             PyErr_Format(PyExc_TypeError,
15045                 "Shared Cython type %.200s is not a type object",
15046                 type->tp_name);
15047             goto bad;
15048         }
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",
15052                 type->tp_name);
15053             goto bad;
15054         }
15055     } else {
15056         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
15057         PyErr_Clear();
15058         if (PyType_Ready(type) < 0) goto bad;
15059         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
15060             goto bad;
15061         Py_INCREF(type);
15062         cached_type = type;
15063     }
15064 done:
15065     Py_DECREF(fake_module);
15066     return cached_type;
15067 bad:
15068     Py_XDECREF(cached_type);
15069     cached_type = NULL;
15070     goto done;
15071 }
15072
15073 /* CythonFunctionShared */
15074 #include <structmember.h>
15075 static PyObject *
15076 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
15077 {
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);
15082 #else
15083             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
15084 #endif
15085             if (unlikely(op->func_doc == NULL))
15086                 return NULL;
15087         } else {
15088             Py_INCREF(Py_None);
15089             return Py_None;
15090         }
15091     }
15092     Py_INCREF(op->func_doc);
15093     return op->func_doc;
15094 }
15095 static int
15096 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15097 {
15098     PyObject *tmp = op->func_doc;
15099     if (value == NULL) {
15100         value = Py_None;
15101     }
15102     Py_INCREF(value);
15103     op->func_doc = value;
15104     Py_XDECREF(tmp);
15105     return 0;
15106 }
15107 static PyObject *
15108 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15109 {
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);
15113 #else
15114         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
15115 #endif
15116         if (unlikely(op->func_name == NULL))
15117             return NULL;
15118     }
15119     Py_INCREF(op->func_name);
15120     return op->func_name;
15121 }
15122 static int
15123 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15124 {
15125     PyObject *tmp;
15126 #if PY_MAJOR_VERSION >= 3
15127     if (unlikely(value == NULL || !PyUnicode_Check(value)))
15128 #else
15129     if (unlikely(value == NULL || !PyString_Check(value)))
15130 #endif
15131     {
15132         PyErr_SetString(PyExc_TypeError,
15133                         "__name__ must be set to a string object");
15134         return -1;
15135     }
15136     tmp = op->func_name;
15137     Py_INCREF(value);
15138     op->func_name = value;
15139     Py_XDECREF(tmp);
15140     return 0;
15141 }
15142 static PyObject *
15143 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15144 {
15145     Py_INCREF(op->func_qualname);
15146     return op->func_qualname;
15147 }
15148 static int
15149 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15150 {
15151     PyObject *tmp;
15152 #if PY_MAJOR_VERSION >= 3
15153     if (unlikely(value == NULL || !PyUnicode_Check(value)))
15154 #else
15155     if (unlikely(value == NULL || !PyString_Check(value)))
15156 #endif
15157     {
15158         PyErr_SetString(PyExc_TypeError,
15159                         "__qualname__ must be set to a string object");
15160         return -1;
15161     }
15162     tmp = op->func_qualname;
15163     Py_INCREF(value);
15164     op->func_qualname = value;
15165     Py_XDECREF(tmp);
15166     return 0;
15167 }
15168 static PyObject *
15169 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
15170 {
15171     PyObject *self;
15172     self = m->func_closure;
15173     if (self == NULL)
15174         self = Py_None;
15175     Py_INCREF(self);
15176     return self;
15177 }
15178 static PyObject *
15179 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15180 {
15181     if (unlikely(op->func_dict == NULL)) {
15182         op->func_dict = PyDict_New();
15183         if (unlikely(op->func_dict == NULL))
15184             return NULL;
15185     }
15186     Py_INCREF(op->func_dict);
15187     return op->func_dict;
15188 }
15189 static int
15190 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
15191 {
15192     PyObject *tmp;
15193     if (unlikely(value == NULL)) {
15194         PyErr_SetString(PyExc_TypeError,
15195                "function's dictionary may not be deleted");
15196         return -1;
15197     }
15198     if (unlikely(!PyDict_Check(value))) {
15199         PyErr_SetString(PyExc_TypeError,
15200                "setting function's dictionary to a non-dict");
15201         return -1;
15202     }
15203     tmp = op->func_dict;
15204     Py_INCREF(value);
15205     op->func_dict = value;
15206     Py_XDECREF(tmp);
15207     return 0;
15208 }
15209 static PyObject *
15210 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15211 {
15212     Py_INCREF(op->func_globals);
15213     return op->func_globals;
15214 }
15215 static PyObject *
15216 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15217 {
15218     Py_INCREF(Py_None);
15219     return Py_None;
15220 }
15221 static PyObject *
15222 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
15223 {
15224     PyObject* result = (op->func_code) ? op->func_code : Py_None;
15225     Py_INCREF(result);
15226     return result;
15227 }
15228 static int
15229 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
15230     int result = 0;
15231     PyObject *res = op->defaults_getter((PyObject *) op);
15232     if (unlikely(!res))
15233         return -1;
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);
15239     #else
15240     op->defaults_tuple = PySequence_ITEM(res, 0);
15241     if (unlikely(!op->defaults_tuple)) result = -1;
15242     else {
15243         op->defaults_kwdict = PySequence_ITEM(res, 1);
15244         if (unlikely(!op->defaults_kwdict)) result = -1;
15245     }
15246     #endif
15247     Py_DECREF(res);
15248     return result;
15249 }
15250 static int
15251 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15252     PyObject* tmp;
15253     if (!value) {
15254         value = Py_None;
15255     } else if (value != Py_None && !PyTuple_Check(value)) {
15256         PyErr_SetString(PyExc_TypeError,
15257                         "__defaults__ must be set to a tuple object");
15258         return -1;
15259     }
15260     Py_INCREF(value);
15261     tmp = op->defaults_tuple;
15262     op->defaults_tuple = value;
15263     Py_XDECREF(tmp);
15264     return 0;
15265 }
15266 static PyObject *
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;
15273         } else {
15274             result = Py_None;
15275         }
15276     }
15277     Py_INCREF(result);
15278     return result;
15279 }
15280 static int
15281 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15282     PyObject* tmp;
15283     if (!value) {
15284         value = Py_None;
15285     } else if (value != Py_None && !PyDict_Check(value)) {
15286         PyErr_SetString(PyExc_TypeError,
15287                         "__kwdefaults__ must be set to a dict object");
15288         return -1;
15289     }
15290     Py_INCREF(value);
15291     tmp = op->defaults_kwdict;
15292     op->defaults_kwdict = value;
15293     Py_XDECREF(tmp);
15294     return 0;
15295 }
15296 static PyObject *
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;
15303         } else {
15304             result = Py_None;
15305         }
15306     }
15307     Py_INCREF(result);
15308     return result;
15309 }
15310 static int
15311 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
15312     PyObject* tmp;
15313     if (!value || value == Py_None) {
15314         value = NULL;
15315     } else if (!PyDict_Check(value)) {
15316         PyErr_SetString(PyExc_TypeError,
15317                         "__annotations__ must be set to a dict object");
15318         return -1;
15319     }
15320     Py_XINCREF(value);
15321     tmp = op->func_annotations;
15322     op->func_annotations = value;
15323     Py_XDECREF(tmp);
15324     return 0;
15325 }
15326 static PyObject *
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;
15333     }
15334     Py_INCREF(result);
15335     return result;
15336 }
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},
15356     {0, 0, 0, 0, 0}
15357 };
15358 static PyMemberDef __pyx_CyFunction_members[] = {
15359     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
15360     {0, 0, 0,  0, 0}
15361 };
15362 static PyObject *
15363 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
15364 {
15365 #if PY_MAJOR_VERSION >= 3
15366     return PyUnicode_FromString(m->func.m_ml->ml_name);
15367 #else
15368     return PyString_FromString(m->func.m_ml->ml_name);
15369 #endif
15370 }
15371 static PyMethodDef __pyx_CyFunction_methods[] = {
15372     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
15373     {0, 0, 0, 0}
15374 };
15375 #if PY_VERSION_HEX < 0x030500A0
15376 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
15377 #else
15378 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
15379 #endif
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))
15383         return NULL;
15384     op->flags = flags;
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);
15400     Py_XINCREF(code);
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;
15410 }
15411 static int
15412 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
15413 {
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);
15426     if (m->defaults) {
15427         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15428         int i;
15429         for (i = 0; i < m->defaults_pyobjects; i++)
15430             Py_XDECREF(pydefaults[i]);
15431         PyObject_Free(m->defaults);
15432         m->defaults = NULL;
15433     }
15434     return 0;
15435 }
15436 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
15437 {
15438     if (__Pyx_CyFunction_weakreflist(m) != NULL)
15439         PyObject_ClearWeakRefs((PyObject *) m);
15440     __Pyx_CyFunction_clear(m);
15441     PyObject_GC_Del(m);
15442 }
15443 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
15444 {
15445     PyObject_GC_UnTrack(m);
15446     __Pyx__CyFunction_dealloc(m);
15447 }
15448 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
15449 {
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);
15461     if (m->defaults) {
15462         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
15463         int i;
15464         for (i = 0; i < m->defaults_pyobjects; i++)
15465             Py_VISIT(pydefaults[i]);
15466     }
15467     return 0;
15468 }
15469 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
15470 {
15471     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15472     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
15473         Py_INCREF(func);
15474         return func;
15475     }
15476     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
15477         if (type == NULL)
15478             type = (PyObject *)(Py_TYPE(obj));
15479         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
15480     }
15481     if (obj == Py_None)
15482         obj = NULL;
15483     return __Pyx_PyMethod_New(func, obj, type);
15484 }
15485 static PyObject*
15486 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
15487 {
15488 #if PY_MAJOR_VERSION >= 3
15489     return PyUnicode_FromFormat("<cyfunction %U at %p>",
15490                                 op->func_qualname, (void *)op);
15491 #else
15492     return PyString_FromFormat("<cyfunction %s at %p>",
15493                                PyString_AsString(op->func_qualname), (void *)op);
15494 #endif
15495 }
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;
15499     Py_ssize_t size;
15500     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
15501     case METH_VARARGS:
15502         if (likely(kw == NULL || PyDict_Size(kw) == 0))
15503             return (*meth)(self, arg);
15504         break;
15505     case METH_VARARGS | METH_KEYWORDS:
15506         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
15507     case METH_NOARGS:
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);
15515             return NULL;
15516         }
15517         break;
15518     case METH_O:
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);
15525                 #else
15526                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
15527                 #endif
15528                 result = (*meth)(self, arg0);
15529                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
15530                 Py_DECREF(arg0);
15531                 #endif
15532                 return result;
15533             }
15534             PyErr_Format(PyExc_TypeError,
15535                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
15536                 f->m_ml->ml_name, size);
15537             return NULL;
15538         }
15539         break;
15540     default:
15541         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
15542                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
15543                         "longer supported!");
15544         return NULL;
15545     }
15546     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
15547                  f->m_ml->ml_name);
15548     return NULL;
15549 }
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);
15552 }
15553 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
15554     PyObject *result;
15555     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
15556     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
15557         Py_ssize_t argc;
15558         PyObject *new_args;
15559         PyObject *self;
15560         argc = PyTuple_GET_SIZE(args);
15561         new_args = PyTuple_GetSlice(args, 1, argc);
15562         if (unlikely(!new_args))
15563             return NULL;
15564         self = PyTuple_GetItem(args, 0);
15565         if (unlikely(!self)) {
15566             Py_DECREF(new_args);
15567             return NULL;
15568         }
15569         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
15570         Py_DECREF(new_args);
15571     } else {
15572         result = __Pyx_CyFunction_Call(func, args, kw);
15573     }
15574     return result;
15575 }
15576 static PyTypeObject __pyx_CyFunctionType_type = {
15577     PyVarObject_HEAD_INIT(0, 0)
15578     "cython_function_or_method",
15579     sizeof(__pyx_CyFunctionObject),
15580     0,
15581     (destructor) __Pyx_CyFunction_dealloc,
15582     0,
15583     0,
15584     0,
15585 #if PY_MAJOR_VERSION < 3
15586     0,
15587 #else
15588     0,
15589 #endif
15590     (reprfunc) __Pyx_CyFunction_repr,
15591     0,
15592     0,
15593     0,
15594     0,
15595     __Pyx_CyFunction_CallAsMethod,
15596     0,
15597     0,
15598     0,
15599     0,
15600     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
15601     0,
15602     (traverseproc) __Pyx_CyFunction_traverse,
15603     (inquiry) __Pyx_CyFunction_clear,
15604     0,
15605 #if PY_VERSION_HEX < 0x030500A0
15606     offsetof(__pyx_CyFunctionObject, func_weakreflist),
15607 #else
15608     offsetof(PyCFunctionObject, m_weakreflist),
15609 #endif
15610     0,
15611     0,
15612     __pyx_CyFunction_methods,
15613     __pyx_CyFunction_members,
15614     __pyx_CyFunction_getsets,
15615     0,
15616     0,
15617     __Pyx_CyFunction_descr_get,
15618     0,
15619     offsetof(__pyx_CyFunctionObject, func_dict),
15620     0,
15621     0,
15622     0,
15623     0,
15624     0,
15625     0,
15626     0,
15627     0,
15628     0,
15629     0,
15630     0,
15631     0,
15632 #if PY_VERSION_HEX >= 0x030400a1
15633     0,
15634 #endif
15635 #if PY_VERSION_HEX >= 0x030800b1
15636     0,
15637 #endif
15638 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15639     0,
15640 #endif
15641 };
15642 static int __pyx_CyFunction_init(void) {
15643     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
15644     if (unlikely(__pyx_CyFunctionType == NULL)) {
15645         return -1;
15646     }
15647     return 0;
15648 }
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;
15658 }
15659 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
15660     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15661     m->defaults_tuple = tuple;
15662     Py_INCREF(tuple);
15663 }
15664 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
15665     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15666     m->defaults_kwdict = dict;
15667     Py_INCREF(dict);
15668 }
15669 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
15670     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
15671     m->func_annotations = dict;
15672     Py_INCREF(dict);
15673 }
15674
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
15681     );
15682     if (likely(op)) {
15683         PyObject_GC_Track(op);
15684     }
15685     return op;
15686 }
15687
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);
15694     }
15695 #endif
15696 #ifdef __Pyx_CyFunction_USED
15697     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
15698 #else
15699     if (likely(PyCFunction_Check(func)))
15700 #endif
15701     {
15702         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
15703             return __Pyx_PyObject_CallMethO(func, NULL);
15704         }
15705     }
15706     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
15707 }
15708 #endif
15709
15710 /* StringJoin */
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);
15714 }
15715 #endif
15716
15717 /* SliceObject */
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)) {
15727         if (!has_cstart) {
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;
15731             } else
15732                 cstart = 0;
15733         }
15734         if (!has_cstop) {
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;
15738             } else
15739                 cstop = PY_SSIZE_T_MAX;
15740         }
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)) {
15744                 if (cstop < 0) {
15745                     cstop += l;
15746                     if (cstop < 0) cstop = 0;
15747                 }
15748                 if (cstart < 0) {
15749                     cstart += l;
15750                     if (cstart < 0) cstart = 0;
15751                 }
15752             } else {
15753                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
15754                     goto bad;
15755                 PyErr_Clear();
15756             }
15757         }
15758         return ms->sq_slice(obj, cstart, cstop);
15759     }
15760 #endif
15761     mp = Py_TYPE(obj)->tp_as_mapping;
15762     if (likely(mp && mp->mp_subscript))
15763 #endif
15764     {
15765         PyObject* result;
15766         PyObject *py_slice, *py_start, *py_stop;
15767         if (_py_slice) {
15768             py_slice = *_py_slice;
15769         } else {
15770             PyObject* owned_start = NULL;
15771             PyObject* owned_stop = NULL;
15772             if (_py_start) {
15773                 py_start = *_py_start;
15774             } else {
15775                 if (has_cstart) {
15776                     owned_start = py_start = PyInt_FromSsize_t(cstart);
15777                     if (unlikely(!py_start)) goto bad;
15778                 } else
15779                     py_start = Py_None;
15780             }
15781             if (_py_stop) {
15782                 py_stop = *_py_stop;
15783             } else {
15784                 if (has_cstop) {
15785                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
15786                     if (unlikely(!py_stop)) {
15787                         Py_XDECREF(owned_start);
15788                         goto bad;
15789                     }
15790                 } else
15791                     py_stop = Py_None;
15792             }
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;
15797         }
15798 #if CYTHON_USE_TYPE_SLOTS
15799         result = mp->mp_subscript(obj, py_slice);
15800 #else
15801         result = PyObject_GetItem(obj, py_slice);
15802 #endif
15803         if (!_py_slice) {
15804             Py_DECREF(py_slice);
15805         }
15806         return result;
15807     }
15808     PyErr_Format(PyExc_TypeError,
15809         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
15810 bad:
15811     return NULL;
15812 }
15813
15814 /* PyIntBinop */
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) {
15817     (void)inplace;
15818     (void)zerodivision_check;
15819     #if PY_MAJOR_VERSION < 3
15820     if (likely(PyInt_CheckExact(op1))) {
15821         const long b = intval;
15822         long x;
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);
15828     }
15829     #endif
15830     #if CYTHON_USE_PYLONG_INTERNALS
15831     if (likely(PyLong_CheckExact(op1))) {
15832         const long b = intval;
15833         long a, x;
15834 #ifdef HAVE_LONG_LONG
15835         const PY_LONG_LONG llb = intval;
15836         PY_LONG_LONG lla, llx;
15837 #endif
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;
15843         } else {
15844             switch (size) {
15845                 case -2:
15846                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15847                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15848                         break;
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]));
15852                         goto long_long;
15853 #endif
15854                     }
15855                     CYTHON_FALLTHROUGH;
15856                 case 2:
15857                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15858                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15859                         break;
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]));
15863                         goto long_long;
15864 #endif
15865                     }
15866                     CYTHON_FALLTHROUGH;
15867                 case -3:
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]));
15870                         break;
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]));
15874                         goto long_long;
15875 #endif
15876                     }
15877                     CYTHON_FALLTHROUGH;
15878                 case 3:
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]));
15881                         break;
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]));
15885                         goto long_long;
15886 #endif
15887                     }
15888                     CYTHON_FALLTHROUGH;
15889                 case -4:
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]));
15892                         break;
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]));
15896                         goto long_long;
15897 #endif
15898                     }
15899                     CYTHON_FALLTHROUGH;
15900                 case 4:
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]));
15903                         break;
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]));
15907                         goto long_long;
15908 #endif
15909                     }
15910                     CYTHON_FALLTHROUGH;
15911                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
15912             }
15913         }
15914                 x = a - b;
15915             return PyLong_FromLong(x);
15916 #ifdef HAVE_LONG_LONG
15917         long_long:
15918                 llx = lla - llb;
15919             return PyLong_FromLongLong(llx);
15920 #endif
15921         
15922         
15923     }
15924     #endif
15925     if (PyFloat_CheckExact(op1)) {
15926         const long b = intval;
15927         double a = PyFloat_AS_DOUBLE(op1);
15928             double result;
15929             PyFPE_START_PROTECT("subtract", return NULL)
15930             result = ((double)a) - (double)b;
15931             PyFPE_END_PROTECT(result)
15932             return PyFloat_FromDouble(result);
15933     }
15934     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
15935 }
15936 #endif
15937
15938 /* PyIntCompare */
15939 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
15940     if (op1 == op2) {
15941         Py_RETURN_TRUE;
15942     }
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;
15948     }
15949     #endif
15950     #if CYTHON_USE_PYLONG_INTERNALS
15951     if (likely(PyLong_CheckExact(op1))) {
15952         int unequal;
15953         unsigned long uintval;
15954         Py_ssize_t size = Py_SIZE(op1);
15955         const digit* digits = ((PyLongObject*)op1)->ob_digit;
15956         if (intval == 0) {
15957             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
15958         } else if (intval < 0) {
15959             if (size >= 0)
15960                 Py_RETURN_FALSE;
15961             intval = -intval;
15962             size = -size;
15963         } else {
15964             if (size <= 0)
15965                 Py_RETURN_FALSE;
15966         }
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));
15972         } else
15973 #endif
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));
15978         } else
15979 #endif
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));
15984         } else
15985 #endif
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));
15990         } else
15991 #endif
15992             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
15993         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
15994     }
15995     #endif
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;
16000     }
16001     return (
16002         PyObject_RichCompare(op1, op2, Py_EQ));
16003 }
16004
16005 /* DictGetItem */
16006 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
16007 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
16008     PyObject *value;
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);
16016                     Py_DECREF(args);
16017                 }
16018             } else {
16019                 PyErr_SetObject(PyExc_KeyError, key);
16020             }
16021         }
16022         return NULL;
16023     }
16024     Py_INCREF(value);
16025     return value;
16026 }
16027 #endif
16028
16029 /* IterNext */
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)))
16037             return NULL;
16038         __Pyx_PyErr_Clear();
16039         Py_INCREF(defval);
16040         return defval;
16041     }
16042     if (defval) {
16043         Py_INCREF(defval);
16044         return defval;
16045     }
16046     __Pyx_PyErr_SetNone(PyExc_StopIteration);
16047     return NULL;
16048 }
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);
16052 }
16053 static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
16054     PyObject* next;
16055     iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
16056     if (likely(iternext)) {
16057 #if CYTHON_USE_TYPE_SLOTS
16058         next = iternext(iterator);
16059         if (likely(next))
16060             return next;
16061         #if PY_VERSION_HEX >= 0x02070000
16062         if (unlikely(iternext == &_PyObject_NextNotImplemented))
16063             return NULL;
16064         #endif
16065 #else
16066         next = PyIter_Next(iterator);
16067         if (likely(next))
16068             return next;
16069 #endif
16070     } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
16071         __Pyx_PyIter_Next_ErrorNoIterator(iterator);
16072         return NULL;
16073     }
16074 #if !CYTHON_USE_TYPE_SLOTS
16075     else {
16076         next = PyIter_Next(iterator);
16077         if (likely(next))
16078             return next;
16079     }
16080 #endif
16081     return __Pyx_PyIter_Next2Default(defval);
16082 }
16083
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);
16091 #else
16092                  "'%.50s' object has no attribute '%.400s'",
16093                  tp->tp_name, PyString_AS_STRING(attr_name));
16094 #endif
16095     return NULL;
16096 }
16097 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
16098     PyObject *descr;
16099     PyTypeObject *tp = Py_TYPE(obj);
16100     if (unlikely(!PyString_Check(attr_name))) {
16101         return PyObject_GenericGetAttr(obj, attr_name);
16102     }
16103     assert(!tp->tp_dictoffset);
16104     descr = _PyType_Lookup(tp, attr_name);
16105     if (unlikely(!descr)) {
16106         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
16107     }
16108     Py_INCREF(descr);
16109     #if PY_MAJOR_VERSION < 3
16110     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
16111     #endif
16112     {
16113         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
16114         if (unlikely(f)) {
16115             PyObject *res = f(descr, obj, (PyObject *)tp);
16116             Py_DECREF(descr);
16117             return res;
16118         }
16119     }
16120     return descr;
16121 }
16122 #endif
16123
16124 /* Import */
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;
16130     PyObject *list;
16131     #if PY_MAJOR_VERSION < 3
16132     PyObject *py_import;
16133     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
16134     if (!py_import)
16135         goto bad;
16136     #endif
16137     if (from_list)
16138         list = from_list;
16139     else {
16140         empty_list = PyList_New(0);
16141         if (!empty_list)
16142             goto bad;
16143         list = empty_list;
16144     }
16145     global_dict = PyModule_GetDict(__pyx_m);
16146     if (!global_dict)
16147         goto bad;
16148     empty_dict = PyDict_New();
16149     if (!empty_dict)
16150         goto bad;
16151     {
16152         #if PY_MAJOR_VERSION >= 3
16153         if (level == -1) {
16154             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
16155                 module = PyImport_ImportModuleLevelObject(
16156                     name, global_dict, empty_dict, list, 1);
16157                 if (!module) {
16158                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
16159                         goto bad;
16160                     PyErr_Clear();
16161                 }
16162             }
16163             level = 0;
16164         }
16165         #endif
16166         if (!module) {
16167             #if PY_MAJOR_VERSION < 3
16168             PyObject *py_level = PyInt_FromLong(level);
16169             if (!py_level)
16170                 goto bad;
16171             module = PyObject_CallFunctionObjArgs(py_import,
16172                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
16173             Py_DECREF(py_level);
16174             #else
16175             module = PyImport_ImportModuleLevelObject(
16176                 name, global_dict, empty_dict, list, level);
16177             #endif
16178         }
16179     }
16180 bad:
16181     #if PY_MAJOR_VERSION < 3
16182     Py_XDECREF(py_import);
16183     #endif
16184     Py_XDECREF(empty_list);
16185     Py_XDECREF(empty_dict);
16186     return module;
16187 }
16188
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;
16194 }
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;
16200     PyObject *reg = 0;
16201     PyObject *args = 0;
16202     PyObject *res = 0;
16203     int ret = -1;
16204     cleanup_func = PyCFunction_New(&cleanup_def, 0);
16205     if (!cleanup_func)
16206         goto bad;
16207     atexit = PyImport_ImportModule("atexit");
16208     if (!atexit)
16209         goto bad;
16210     reg = PyObject_GetAttrString(atexit, "_exithandlers");
16211     if (reg && PyList_Check(reg)) {
16212         PyObject *a, *kw;
16213         a = PyTuple_New(0);
16214         kw = PyDict_New();
16215         if (!a || !kw) {
16216             Py_XDECREF(a);
16217             Py_XDECREF(kw);
16218             goto bad;
16219         }
16220         args = PyTuple_Pack(3, cleanup_func, a, kw);
16221         Py_DECREF(a);
16222         Py_DECREF(kw);
16223         if (!args)
16224             goto bad;
16225         ret = PyList_Insert(reg, 0, args);
16226     } else {
16227         if (!reg)
16228             PyErr_Clear();
16229         Py_XDECREF(reg);
16230         reg = PyObject_GetAttrString(atexit, "register");
16231         if (!reg)
16232             goto bad;
16233         args = PyTuple_Pack(1, cleanup_func);
16234         if (!args)
16235             goto bad;
16236         res = PyObject_CallObject(reg, args);
16237         if (!res)
16238             goto bad;
16239         ret = 0;
16240     }
16241 bad:
16242     Py_XDECREF(cleanup_func);
16243     Py_XDECREF(atexit);
16244     Py_XDECREF(reg);
16245     Py_XDECREF(args);
16246     Py_XDECREF(res);
16247     return ret;
16248 }
16249 #endif
16250
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;
16258 #endif
16259     if (unlikely(!__pyx_cython_runtime)) {
16260         return c_line;
16261     }
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))
16269     } else
16270 #endif
16271     {
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);
16276       } else {
16277         PyErr_Clear();
16278         use_cline = NULL;
16279       }
16280     }
16281     if (!use_cline) {
16282         c_line = 0;
16283         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
16284     }
16285     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
16286         c_line = 0;
16287     }
16288     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
16289     return c_line;
16290 }
16291 #endif
16292
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) {
16297         return count;
16298     }
16299     while (start < end) {
16300         mid = start + (end - start) / 2;
16301         if (code_line < entries[mid].code_line) {
16302             end = mid;
16303         } else if (code_line > entries[mid].code_line) {
16304              start = mid + 1;
16305         } else {
16306             return mid;
16307         }
16308     }
16309     if (code_line <= entries[mid].code_line) {
16310         return mid;
16311     } else {
16312         return mid + 1;
16313     }
16314 }
16315 static PyCodeObject *__pyx_find_code_object(int code_line) {
16316     PyCodeObject* code_object;
16317     int pos;
16318     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
16319         return NULL;
16320     }
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)) {
16323         return NULL;
16324     }
16325     code_object = __pyx_code_cache.entries[pos].code_object;
16326     Py_INCREF(code_object);
16327     return code_object;
16328 }
16329 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
16330     int pos, i;
16331     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
16332     if (unlikely(!code_line)) {
16333         return;
16334     }
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);
16344         }
16345         return;
16346     }
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;
16351         Py_DECREF(tmp);
16352         return;
16353     }
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)) {
16359             return;
16360         }
16361         __pyx_code_cache.entries = entries;
16362         __pyx_code_cache.max_count = new_max;
16363     }
16364     for (i=__pyx_code_cache.count; i>pos; i--) {
16365         entries[i] = entries[i-1];
16366     }
16367     entries[pos].code_line = code_line;
16368     entries[pos].code_object = code_object;
16369     __pyx_code_cache.count++;
16370     Py_INCREF(code_object);
16371 }
16372
16373 /* AddTraceback */
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);
16385     #else
16386     py_srcfile = PyUnicode_FromString(filename);
16387     #endif
16388     if (!py_srcfile) goto bad;
16389     if (c_line) {
16390         #if PY_MAJOR_VERSION < 3
16391         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16392         #else
16393         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16394         #endif
16395     }
16396     else {
16397         #if PY_MAJOR_VERSION < 3
16398         py_funcname = PyString_FromString(funcname);
16399         #else
16400         py_funcname = PyUnicode_FromString(funcname);
16401         #endif
16402     }
16403     if (!py_funcname) goto bad;
16404     py_code = __Pyx_PyCode_New(
16405         0,
16406         0,
16407         0,
16408         0,
16409         0,
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,*/
16418         py_line,
16419         __pyx_empty_bytes  /*PyObject *lnotab*/
16420     );
16421     Py_DECREF(py_srcfile);
16422     Py_DECREF(py_funcname);
16423     return py_code;
16424 bad:
16425     Py_XDECREF(py_srcfile);
16426     Py_XDECREF(py_funcname);
16427     return NULL;
16428 }
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;
16434     if (c_line) {
16435         c_line = __Pyx_CLineForTraceback(tstate, c_line);
16436     }
16437     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
16438     if (!py_code) {
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);
16443     }
16444     py_frame = PyFrame_New(
16445         tstate,            /*PyThreadState *tstate,*/
16446         py_code,           /*PyCodeObject *code,*/
16447         __pyx_d,    /*PyObject *globals,*/
16448         0                  /*PyObject *locals*/
16449     );
16450     if (!py_frame) goto bad;
16451     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
16452     PyTraceBack_Here(py_frame);
16453 bad:
16454     Py_XDECREF(py_code);
16455     Py_XDECREF(py_frame);
16456 }
16457
16458 /* CIntToPy */
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;
16462     if (is_unsigned) {
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);
16470 #endif
16471         }
16472     } else {
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);
16478 #endif
16479         }
16480     }
16481     {
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);
16486     }
16487 }
16488
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)\
16495     {\
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;\
16504                 else\
16505                     goto raise_overflow;\
16506             }\
16507         }\
16508         return (target_type) value;\
16509     }
16510
16511 /* CIntFromPy */
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))
16519         } else {
16520             long val = PyInt_AS_LONG(x);
16521             if (is_unsigned && unlikely(val < 0)) {
16522                 goto raise_neg_overflow;
16523             }
16524             return (long) val;
16525         }
16526     } else
16527 #endif
16528     if (likely(PyLong_Check(x))) {
16529         if (is_unsigned) {
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])
16535                 case 2:
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]));
16541                         }
16542                     }
16543                     break;
16544                 case 3:
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]));
16550                         }
16551                     }
16552                     break;
16553                 case 4:
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]));
16559                         }
16560                     }
16561                     break;
16562             }
16563 #endif
16564 #if CYTHON_COMPILING_IN_CPYTHON
16565             if (unlikely(Py_SIZE(x) < 0)) {
16566                 goto raise_neg_overflow;
16567             }
16568 #else
16569             {
16570                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16571                 if (unlikely(result < 0))
16572                     return (long) -1;
16573                 if (unlikely(result == 1))
16574                     goto raise_neg_overflow;
16575             }
16576 #endif
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))
16582 #endif
16583             }
16584         } else {
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])
16591                 case -2:
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])));
16597                         }
16598                     }
16599                     break;
16600                 case 2:
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])));
16606                         }
16607                     }
16608                     break;
16609                 case -3:
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])));
16615                         }
16616                     }
16617                     break;
16618                 case 3:
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])));
16624                         }
16625                     }
16626                     break;
16627                 case -4:
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])));
16633                         }
16634                     }
16635                     break;
16636                 case 4:
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])));
16642                         }
16643                     }
16644                     break;
16645             }
16646 #endif
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))
16652 #endif
16653             }
16654         }
16655         {
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");
16659 #else
16660             long val;
16661             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16662  #if PY_MAJOR_VERSION < 3
16663             if (likely(v) && !PyLong_Check(v)) {
16664                 PyObject *tmp = v;
16665                 v = PyNumber_Long(tmp);
16666                 Py_DECREF(tmp);
16667             }
16668  #endif
16669             if (likely(v)) {
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);
16675                 Py_DECREF(v);
16676                 if (likely(!ret))
16677                     return val;
16678             }
16679 #endif
16680             return (long) -1;
16681         }
16682     } else {
16683         long val;
16684         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16685         if (!tmp) return (long) -1;
16686         val = __Pyx_PyInt_As_long(tmp);
16687         Py_DECREF(tmp);
16688         return val;
16689     }
16690 raise_overflow:
16691     PyErr_SetString(PyExc_OverflowError,
16692         "value too large to convert to long");
16693     return (long) -1;
16694 raise_neg_overflow:
16695     PyErr_SetString(PyExc_OverflowError,
16696         "can't convert negative value to long");
16697     return (long) -1;
16698 }
16699
16700 /* CIntFromPy */
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))
16708         } else {
16709             long val = PyInt_AS_LONG(x);
16710             if (is_unsigned && unlikely(val < 0)) {
16711                 goto raise_neg_overflow;
16712             }
16713             return (int) val;
16714         }
16715     } else
16716 #endif
16717     if (likely(PyLong_Check(x))) {
16718         if (is_unsigned) {
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])
16724                 case 2:
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]));
16730                         }
16731                     }
16732                     break;
16733                 case 3:
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]));
16739                         }
16740                     }
16741                     break;
16742                 case 4:
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]));
16748                         }
16749                     }
16750                     break;
16751             }
16752 #endif
16753 #if CYTHON_COMPILING_IN_CPYTHON
16754             if (unlikely(Py_SIZE(x) < 0)) {
16755                 goto raise_neg_overflow;
16756             }
16757 #else
16758             {
16759                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16760                 if (unlikely(result < 0))
16761                     return (int) -1;
16762                 if (unlikely(result == 1))
16763                     goto raise_neg_overflow;
16764             }
16765 #endif
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))
16771 #endif
16772             }
16773         } else {
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])
16780                 case -2:
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])));
16786                         }
16787                     }
16788                     break;
16789                 case 2:
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])));
16795                         }
16796                     }
16797                     break;
16798                 case -3:
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])));
16804                         }
16805                     }
16806                     break;
16807                 case 3:
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])));
16813                         }
16814                     }
16815                     break;
16816                 case -4:
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])));
16822                         }
16823                     }
16824                     break;
16825                 case 4:
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])));
16831                         }
16832                     }
16833                     break;
16834             }
16835 #endif
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))
16841 #endif
16842             }
16843         }
16844         {
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");
16848 #else
16849             int val;
16850             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16851  #if PY_MAJOR_VERSION < 3
16852             if (likely(v) && !PyLong_Check(v)) {
16853                 PyObject *tmp = v;
16854                 v = PyNumber_Long(tmp);
16855                 Py_DECREF(tmp);
16856             }
16857  #endif
16858             if (likely(v)) {
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);
16864                 Py_DECREF(v);
16865                 if (likely(!ret))
16866                     return val;
16867             }
16868 #endif
16869             return (int) -1;
16870         }
16871     } else {
16872         int val;
16873         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16874         if (!tmp) return (int) -1;
16875         val = __Pyx_PyInt_As_int(tmp);
16876         Py_DECREF(tmp);
16877         return val;
16878     }
16879 raise_overflow:
16880     PyErr_SetString(PyExc_OverflowError,
16881         "value too large to convert to int");
16882     return (int) -1;
16883 raise_neg_overflow:
16884     PyErr_SetString(PyExc_OverflowError,
16885         "can't convert negative value to int");
16886     return (int) -1;
16887 }
16888
16889 /* FastTypeChecks */
16890 #if CYTHON_COMPILING_IN_CPYTHON
16891 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
16892     while (a) {
16893         a = a->tp_base;
16894         if (a == b)
16895             return 1;
16896     }
16897     return b == &PyBaseObject_Type;
16898 }
16899 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
16900     PyObject *mro;
16901     if (a == b) return 1;
16902     mro = a->tp_mro;
16903     if (likely(mro)) {
16904         Py_ssize_t i, n;
16905         n = PyTuple_GET_SIZE(mro);
16906         for (i = 0; i < n; i++) {
16907             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
16908                 return 1;
16909         }
16910         return 0;
16911     }
16912     return __Pyx_InBases(a, b);
16913 }
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;
16917     int res;
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);
16924         res = 0;
16925     }
16926     if (!res) {
16927         res = PyObject_IsSubclass(err, exc_type2);
16928         if (unlikely(res == -1)) {
16929             PyErr_WriteUnraisable(err);
16930             res = 0;
16931         }
16932     }
16933     __Pyx_ErrRestore(exception, value, tb);
16934     return res;
16935 }
16936 #else
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;
16939     if (!res) {
16940         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
16941     }
16942     return res;
16943 }
16944 #endif
16945 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
16946     Py_ssize_t i, n;
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;
16952     }
16953 #endif
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;
16958         #endif
16959         if (likely(PyExceptionClass_Check(t))) {
16960             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
16961         } else {
16962         }
16963     }
16964     return 0;
16965 }
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);
16973         } else {
16974         }
16975     }
16976     return PyErr_GivenExceptionMatches(err, exc_type);
16977 }
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);
16984     }
16985     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
16986 }
16987 #endif
16988
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;
17001     #else
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;
17008     #endif
17009     *type = tmp_type;
17010     *value = tmp_value;
17011     *tb = tmp_tb;
17012 }
17013 #else
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);
17018     *type = tmp_type;
17019     *value = tmp_value;
17020     *tb = tmp_tb;
17021 }
17022 #endif
17023
17024 /* PyObjectGetMethod */
17025 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
17026     PyObject *attr;
17027 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
17028     PyTypeObject *tp = Py_TYPE(obj);
17029     PyObject *descr;
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);
17036         goto try_unpack;
17037     }
17038     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
17039         return 0;
17040     }
17041     descr = _PyType_Lookup(tp, name);
17042     if (likely(descr != NULL)) {
17043         Py_INCREF(descr);
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)))
17047         #else
17048         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
17049         #endif
17050 #else
17051         #ifdef __Pyx_CyFunction_USED
17052         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
17053         #else
17054         if (likely(PyFunction_Check(descr)))
17055         #endif
17056 #endif
17057         {
17058             meth_found = 1;
17059         } else {
17060             f = Py_TYPE(descr)->tp_descr_get;
17061             if (f != NULL && PyDescr_IsData(descr)) {
17062                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
17063                 Py_DECREF(descr);
17064                 goto try_unpack;
17065             }
17066         }
17067     }
17068     dictptr = _PyObject_GetDictPtr(obj);
17069     if (dictptr != NULL && (dict = *dictptr) != NULL) {
17070         Py_INCREF(dict);
17071         attr = __Pyx_PyDict_GetItemStr(dict, name);
17072         if (attr != NULL) {
17073             Py_INCREF(attr);
17074             Py_DECREF(dict);
17075             Py_XDECREF(descr);
17076             goto try_unpack;
17077         }
17078         Py_DECREF(dict);
17079     }
17080     if (meth_found) {
17081         *method = descr;
17082         return 1;
17083     }
17084     if (f != NULL) {
17085         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
17086         Py_DECREF(descr);
17087         goto try_unpack;
17088     }
17089     if (descr != NULL) {
17090         *method = descr;
17091         return 0;
17092     }
17093     PyErr_Format(PyExc_AttributeError,
17094 #if PY_MAJOR_VERSION >= 3
17095                  "'%.50s' object has no attribute '%U'",
17096                  tp->tp_name, name);
17097 #else
17098                  "'%.50s' object has no attribute '%.400s'",
17099                  tp->tp_name, PyString_AS_STRING(name));
17100 #endif
17101     return 0;
17102 #else
17103     attr = __Pyx_PyObject_GetAttrStr(obj, name);
17104     goto try_unpack;
17105 #endif
17106 try_unpack:
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);
17111         Py_DECREF(attr);
17112         *method = function;
17113         return 1;
17114     }
17115 #endif
17116     *method = attr;
17117     return 0;
17118 }
17119
17120 /* PyObjectCallMethod1 */
17121 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
17122     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
17123     Py_DECREF(method);
17124     return result;
17125 }
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);
17131         Py_DECREF(method);
17132         return result;
17133     }
17134     if (unlikely(!method)) return NULL;
17135     return __Pyx__PyObject_CallMethod1(method, arg);
17136 }
17137
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);
17146     if (!et) {
17147         Py_XDECREF(tb);
17148         Py_XDECREF(ev);
17149         Py_INCREF(Py_None);
17150         *pvalue = Py_None;
17151         return 0;
17152     }
17153     if (likely(et == PyExc_StopIteration)) {
17154         if (!ev) {
17155             Py_INCREF(Py_None);
17156             value = Py_None;
17157         }
17158 #if PY_VERSION_HEX >= 0x030300A0
17159         else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
17160             value = ((PyStopIterationObject *)ev)->value;
17161             Py_INCREF(value);
17162             Py_DECREF(ev);
17163         }
17164 #endif
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);
17169                 Py_INCREF(value);
17170 #else
17171                 value = PySequence_ITEM(ev, 0);
17172 #endif
17173             } else {
17174                 Py_INCREF(Py_None);
17175                 value = Py_None;
17176             }
17177             Py_DECREF(ev);
17178         }
17179         else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
17180             value = ev;
17181         }
17182         if (likely(value)) {
17183             Py_XDECREF(tb);
17184             Py_DECREF(et);
17185             *pvalue = value;
17186             return 0;
17187         }
17188     } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
17189         __Pyx_ErrRestore(et, ev, tb);
17190         return -1;
17191     }
17192     PyErr_NormalizeException(&et, &ev, &tb);
17193     if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
17194         __Pyx_ErrRestore(et, ev, tb);
17195         return -1;
17196     }
17197     Py_XDECREF(tb);
17198     Py_DECREF(et);
17199 #if PY_VERSION_HEX >= 0x030300A0
17200     value = ((PyStopIterationObject *)ev)->value;
17201     Py_INCREF(value);
17202     Py_DECREF(ev);
17203 #else
17204     {
17205         PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
17206         Py_DECREF(ev);
17207         if (likely(args)) {
17208             value = PySequence_GetItem(args, 0);
17209             Py_DECREF(args);
17210         }
17211         if (unlikely(!value)) {
17212             __Pyx_ErrRestore(NULL, NULL, NULL);
17213             Py_INCREF(Py_None);
17214             value = Py_None;
17215         }
17216     }
17217 #endif
17218     *pvalue = value;
17219     return 0;
17220 }
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;
17230     Py_XDECREF(t);
17231     Py_XDECREF(v);
17232     Py_XDECREF(tb);
17233 }
17234 #define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
17235 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
17236     const char *msg;
17237     if ((0)) {
17238     #ifdef __Pyx_Coroutine_USED
17239     } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
17240         msg = "coroutine already executing";
17241     #endif
17242     #ifdef __Pyx_AsyncGen_USED
17243     } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
17244         msg = "async generator already executing";
17245     #endif
17246     } else {
17247         msg = "generator already executing";
17248     }
17249     PyErr_SetString(PyExc_ValueError, msg);
17250 }
17251 #define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
17252 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
17253     const char *msg;
17254     if ((0)) {
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";
17258     #endif
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";
17262     #endif
17263     } else {
17264         msg = "can't send non-None value to a just-started generator";
17265     }
17266     PyErr_SetString(PyExc_TypeError, msg);
17267 }
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");
17273     } else
17274     #endif
17275     if (value) {
17276         #ifdef __Pyx_AsyncGen_USED
17277         if (__Pyx_AsyncGen_CheckExact(gen))
17278             PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
17279         else
17280         #endif
17281         PyErr_SetNone(PyExc_StopIteration);
17282     }
17283 }
17284 static
17285 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
17286     __Pyx_PyThreadState_declare
17287     PyThreadState *tstate;
17288     __Pyx_ExcInfoStruct *exc_state;
17289     PyObject *retval;
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);
17294         }
17295     }
17296     if (unlikely(self->resume_label == -1)) {
17297         return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
17298     }
17299 #if CYTHON_FAST_THREAD_STATE
17300     __Pyx_PyThreadState_assign
17301     tstate = __pyx_tstate;
17302 #else
17303     tstate = __Pyx_PyThreadState_Current;
17304 #endif
17305     exc_state = &self->gi_exc_state;
17306     if (exc_state->exc_type) {
17307         #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
17308         #else
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;
17315         }
17316         #endif
17317     }
17318 #if CYTHON_USE_EXC_INFO_STACK
17319     exc_state->previous_item = tstate->exc_info;
17320     tstate->exc_info = exc_state;
17321 #else
17322     if (exc_state->exc_type) {
17323         __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
17324     } else {
17325         __Pyx_Coroutine_ExceptionClear(exc_state);
17326         __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
17327     }
17328 #endif
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);
17337 #endif
17338     return retval;
17339 }
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
17344 #else
17345         PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
17346         PyFrameObject *f = tb->tb_frame;
17347         Py_CLEAR(f->f_back);
17348 #endif
17349     }
17350 }
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;
17361             #endif
17362             __Pyx_PyErr_SetNone(exc);
17363         }
17364     }
17365     return retval;
17366 }
17367 static CYTHON_INLINE
17368 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
17369     PyObject *ret;
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);
17374     Py_XDECREF(val);
17375     return ret;
17376 }
17377 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
17378     PyObject *retval;
17379     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
17380     PyObject *yf = gen->yieldfrom;
17381     if (unlikely(gen->is_running))
17382         return __Pyx_Coroutine_AlreadyRunningError(gen);
17383     if (yf) {
17384         PyObject *ret;
17385         gen->is_running = 1;
17386         #ifdef __Pyx_Generator_USED
17387         if (__Pyx_Generator_CheckExact(yf)) {
17388             ret = __Pyx_Coroutine_Send(yf, value);
17389         } else
17390         #endif
17391         #ifdef __Pyx_Coroutine_USED
17392         if (__Pyx_Coroutine_Check(yf)) {
17393             ret = __Pyx_Coroutine_Send(yf, value);
17394         } else
17395         #endif
17396         #ifdef __Pyx_AsyncGen_USED
17397         if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
17398             ret = __Pyx_async_gen_asend_send(yf, value);
17399         } else
17400         #endif
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);
17404         } else
17405         #endif
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);
17409         } else
17410         #endif
17411         {
17412             if (value == Py_None)
17413                 ret = Py_TYPE(yf)->tp_iternext(yf);
17414             else
17415                 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
17416         }
17417         gen->is_running = 0;
17418         if (likely(ret)) {
17419             return ret;
17420         }
17421         retval = __Pyx_Coroutine_FinishDelegation(gen);
17422     } else {
17423         retval = __Pyx_Coroutine_SendEx(gen, value, 0);
17424     }
17425     return __Pyx_Coroutine_MethodReturn(self, retval);
17426 }
17427 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
17428     PyObject *retval = NULL;
17429     int err = 0;
17430     #ifdef __Pyx_Generator_USED
17431     if (__Pyx_Generator_CheckExact(yf)) {
17432         retval = __Pyx_Coroutine_Close(yf);
17433         if (!retval)
17434             return -1;
17435     } else
17436     #endif
17437     #ifdef __Pyx_Coroutine_USED
17438     if (__Pyx_Coroutine_Check(yf)) {
17439         retval = __Pyx_Coroutine_Close(yf);
17440         if (!retval)
17441             return -1;
17442     } else
17443     if (__Pyx_CoroutineAwait_CheckExact(yf)) {
17444         retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
17445         if (!retval)
17446             return -1;
17447     } else
17448     #endif
17449     #ifdef __Pyx_AsyncGen_USED
17450     if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
17451         retval = __Pyx_async_gen_asend_close(yf, NULL);
17452     } else
17453     if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
17454         retval = __Pyx_async_gen_athrow_close(yf, NULL);
17455     } else
17456     #endif
17457     {
17458         PyObject *meth;
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);
17464             }
17465             PyErr_Clear();
17466         } else {
17467             retval = PyObject_CallFunction(meth, NULL);
17468             Py_DECREF(meth);
17469             if (!retval)
17470                 err = -1;
17471         }
17472         gen->is_running = 0;
17473     }
17474     Py_XDECREF(retval);
17475     return err;
17476 }
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);
17482     if (yf) {
17483         PyObject *ret;
17484         gen->is_running = 1;
17485         #ifdef __Pyx_Generator_USED
17486         if (__Pyx_Generator_CheckExact(yf)) {
17487             ret = __Pyx_Generator_Next(yf);
17488         } else
17489         #endif
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);
17493         } else
17494         #endif
17495         #ifdef __Pyx_Coroutine_USED
17496         if (__Pyx_Coroutine_Check(yf)) {
17497             ret = __Pyx_Coroutine_Send(yf, Py_None);
17498         } else
17499         #endif
17500             ret = Py_TYPE(yf)->tp_iternext(yf);
17501         gen->is_running = 0;
17502         if (likely(ret)) {
17503             return ret;
17504         }
17505         return __Pyx_Coroutine_FinishDelegation(gen);
17506     }
17507     return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
17508 }
17509 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
17510     return __Pyx_Coroutine_Close(self);
17511 }
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;
17516     int err = 0;
17517     if (unlikely(gen->is_running))
17518         return __Pyx_Coroutine_AlreadyRunningError(gen);
17519     if (yf) {
17520         Py_INCREF(yf);
17521         err = __Pyx_Coroutine_CloseIter(gen, yf);
17522         __Pyx_Coroutine_Undelegate(gen);
17523         Py_DECREF(yf);
17524     }
17525     if (err == 0)
17526         PyErr_SetNone(PyExc_GeneratorExit);
17527     retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
17528     if (unlikely(retval)) {
17529         const char *msg;
17530         Py_DECREF(retval);
17531         if ((0)) {
17532         #ifdef __Pyx_Coroutine_USED
17533         } else if (__Pyx_Coroutine_Check(self)) {
17534             msg = "coroutine ignored GeneratorExit";
17535         #endif
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)";
17540 #else
17541             msg = "async generator ignored GeneratorExit";
17542 #endif
17543         #endif
17544         } else {
17545             msg = "generator ignored GeneratorExit";
17546         }
17547         PyErr_SetString(PyExc_RuntimeError, msg);
17548         return NULL;
17549     }
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);
17554         return Py_None;
17555     }
17556     return NULL;
17557 }
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);
17564     if (yf) {
17565         PyObject *ret;
17566         Py_INCREF(yf);
17567         if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
17568             int err = __Pyx_Coroutine_CloseIter(gen, yf);
17569             Py_DECREF(yf);
17570             __Pyx_Coroutine_Undelegate(gen);
17571             if (err < 0)
17572                 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
17573             goto throw_here;
17574         }
17575         gen->is_running = 1;
17576         if (0
17577         #ifdef __Pyx_Generator_USED
17578             || __Pyx_Generator_CheckExact(yf)
17579         #endif
17580         #ifdef __Pyx_Coroutine_USED
17581             || __Pyx_Coroutine_Check(yf)
17582         #endif
17583             ) {
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);
17588         #endif
17589         } else {
17590             PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
17591             if (unlikely(!meth)) {
17592                 Py_DECREF(yf);
17593                 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
17594                     gen->is_running = 0;
17595                     return NULL;
17596                 }
17597                 PyErr_Clear();
17598                 __Pyx_Coroutine_Undelegate(gen);
17599                 gen->is_running = 0;
17600                 goto throw_here;
17601             }
17602             if (likely(args)) {
17603                 ret = PyObject_CallObject(meth, args);
17604             } else {
17605                 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
17606             }
17607             Py_DECREF(meth);
17608         }
17609         gen->is_running = 0;
17610         Py_DECREF(yf);
17611         if (!ret) {
17612             ret = __Pyx_Coroutine_FinishDelegation(gen);
17613         }
17614         return __Pyx_Coroutine_MethodReturn(self, ret);
17615     }
17616 throw_here:
17617     __Pyx_Raise(typ, val, tb, NULL);
17618     return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
17619 }
17620 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
17621     PyObject *typ;
17622     PyObject *val = NULL;
17623     PyObject *tb = NULL;
17624     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
17625         return NULL;
17626     return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
17627 }
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);
17632     return 0;
17633 }
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);
17639 }
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);
17649     }
17650 #endif
17651     Py_CLEAR(gen->gi_code);
17652     Py_CLEAR(gen->gi_name);
17653     Py_CLEAR(gen->gi_qualname);
17654     Py_CLEAR(gen->gi_modulename);
17655     return 0;
17656 }
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))
17666 #else
17667         Py_TYPE(gen)->tp_del(self);
17668         if (self->ob_refcnt > 0)
17669 #endif
17670         {
17671             return;
17672         }
17673         PyObject_GC_UnTrack(self);
17674     }
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
17679            and GC_Del. */
17680         Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
17681     }
17682 #endif
17683     __Pyx_Coroutine_clear(self);
17684     PyObject_GC_Del(gen);
17685 }
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) {
17691         return;
17692     }
17693 #if !CYTHON_USE_TP_FINALIZE
17694     assert(self->ob_refcnt == 0);
17695     self->ob_refcnt = 1;
17696 #endif
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);
17707             } else {
17708                 Py_DECREF(res);
17709             }
17710             __Pyx_ErrRestore(error_type, error_value, error_traceback);
17711             return;
17712         }
17713     }
17714 #endif
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))
17719 #endif
17720         {
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);
17725 #else
17726         {PyObject *msg;
17727         char *cmsg;
17728         #if CYTHON_COMPILING_IN_PYPY
17729         msg = NULL;
17730         cmsg = (char*) "coroutine was never awaited";
17731         #else
17732         char *cname;
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)) {
17738             PyErr_Clear();
17739             cmsg = (char*) "coroutine was never awaited";
17740         } else {
17741             cmsg = PyString_AS_STRING(msg);
17742         }
17743         #endif
17744         if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
17745             PyErr_WriteUnraisable(self);
17746         Py_XDECREF(msg);}
17747 #endif
17748         PyObject_GC_Track(self);
17749         }
17750 #endif
17751     } else {
17752         PyObject *res = __Pyx_Coroutine_Close(self);
17753         if (unlikely(!res)) {
17754             if (PyErr_Occurred())
17755                 PyErr_WriteUnraisable(self);
17756         } else {
17757             Py_DECREF(res);
17758         }
17759     }
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) {
17764         return;
17765     }
17766     {
17767         Py_ssize_t refcnt = self->ob_refcnt;
17768         _Py_NewReference(self);
17769         self->ob_refcnt = refcnt;
17770     }
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);
17774     _Py_DEC_REFTOTAL;
17775 #endif
17776 #ifdef COUNT_ALLOCS
17777     --Py_TYPE(self)->tp_frees;
17778     --Py_TYPE(self)->tp_allocs;
17779 #endif
17780 #endif
17781 }
17782 static PyObject *
17783 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
17784 {
17785     PyObject *name = self->gi_name;
17786     if (unlikely(!name)) name = Py_None;
17787     Py_INCREF(name);
17788     return name;
17789 }
17790 static int
17791 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
17792 {
17793     PyObject *tmp;
17794 #if PY_MAJOR_VERSION >= 3
17795     if (unlikely(value == NULL || !PyUnicode_Check(value)))
17796 #else
17797     if (unlikely(value == NULL || !PyString_Check(value)))
17798 #endif
17799     {
17800         PyErr_SetString(PyExc_TypeError,
17801                         "__name__ must be set to a string object");
17802         return -1;
17803     }
17804     tmp = self->gi_name;
17805     Py_INCREF(value);
17806     self->gi_name = value;
17807     Py_XDECREF(tmp);
17808     return 0;
17809 }
17810 static PyObject *
17811 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
17812 {
17813     PyObject *name = self->gi_qualname;
17814     if (unlikely(!name)) name = Py_None;
17815     Py_INCREF(name);
17816     return name;
17817 }
17818 static int
17819 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
17820 {
17821     PyObject *tmp;
17822 #if PY_MAJOR_VERSION >= 3
17823     if (unlikely(value == NULL || !PyUnicode_Check(value)))
17824 #else
17825     if (unlikely(value == NULL || !PyString_Check(value)))
17826 #endif
17827     {
17828         PyErr_SetString(PyExc_TypeError,
17829                         "__qualname__ must be set to a string object");
17830         return -1;
17831     }
17832     tmp = self->gi_qualname;
17833     Py_INCREF(value);
17834     self->gi_qualname = value;
17835     Py_XDECREF(tmp);
17836     return 0;
17837 }
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))
17843         return NULL;
17844     return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
17845 }
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) {
17849     gen->body = body;
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;
17861 #endif
17862     gen->gi_weakreflist = NULL;
17863     Py_XINCREF(qualname);
17864     gen->gi_qualname = qualname;
17865     Py_XINCREF(name);
17866     gen->gi_name = name;
17867     Py_XINCREF(module_name);
17868     gen->gi_modulename = module_name;
17869     Py_XINCREF(code);
17870     gen->gi_code = code;
17871     PyObject_GC_Track(gen);
17872     return gen;
17873 }
17874
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)
17878     int result;
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);
17884     #else
17885         Py_None);
17886     #endif
17887     if (unlikely(result < 0)) goto ignore;
17888     result = PyDict_SetItemString(globals, "_cython_generator_type",
17889     #ifdef __Pyx_Generator_USED
17890         (PyObject*)__pyx_GeneratorType);
17891     #else
17892         Py_None);
17893     #endif
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);
17901     return module;
17902 ignore:
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)) {
17906         Py_DECREF(module);
17907         module = NULL;
17908     }
17909 #else
17910     py_code++;
17911 #endif
17912     return module;
17913 }
17914
17915 /* PatchGeneratorABC */
17916 #ifndef CYTHON_REGISTER_ABCS
17917 #define CYTHON_REGISTER_ABCS 1
17918 #endif
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(
17923         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"
17932     );
17933     return module;
17934 }
17935 #endif
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) {
17940         PyObject *module;
17941         module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
17942         if (!module) {
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)) {
17948                 return -1;
17949             }
17950         } else {
17951             module = __Pyx_patch_abc_module(module);
17952             abc_patched = 1;
17953             if (unlikely(!module))
17954                 return -1;
17955             Py_DECREF(module);
17956         }
17957         module = PyImport_ImportModule("backports_abc");
17958         if (module) {
17959             module = __Pyx_patch_abc_module(module);
17960             Py_XDECREF(module);
17961         }
17962         if (!module) {
17963             PyErr_Clear();
17964         }
17965     }
17966 #else
17967     if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
17968 #endif
17969     return 0;
17970 }
17971
17972 /* Generator */
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.")},
17980     {0, 0, 0, 0}
17981 };
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},
17987     {0, 0, 0, 0, 0}
17988 };
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},
17994     {0, 0, 0, 0, 0}
17995 };
17996 static PyTypeObject __pyx_GeneratorType_type = {
17997     PyVarObject_HEAD_INIT(0, 0)
17998     "generator",
17999     sizeof(__pyx_CoroutineObject),
18000     0,
18001     (destructor) __Pyx_Coroutine_dealloc,
18002     0,
18003     0,
18004     0,
18005     0,
18006     0,
18007     0,
18008     0,
18009     0,
18010     0,
18011     0,
18012     0,
18013     0,
18014     0,
18015     0,
18016     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
18017     0,
18018     (traverseproc) __Pyx_Coroutine_traverse,
18019     0,
18020     0,
18021     offsetof(__pyx_CoroutineObject, gi_weakreflist),
18022     0,
18023     (iternextfunc) __Pyx_Generator_Next,
18024     __pyx_Generator_methods,
18025     __pyx_Generator_memberlist,
18026     __pyx_Generator_getsets,
18027     0,
18028     0,
18029     0,
18030     0,
18031     0,
18032     0,
18033     0,
18034     0,
18035     0,
18036     0,
18037     0,
18038     0,
18039     0,
18040     0,
18041     0,
18042 #if CYTHON_USE_TP_FINALIZE
18043     0,
18044 #else
18045     __Pyx_Coroutine_del,
18046 #endif
18047     0,
18048 #if CYTHON_USE_TP_FINALIZE
18049     __Pyx_Coroutine_del,
18050 #elif PY_VERSION_HEX >= 0x030400a1
18051     0,
18052 #endif
18053 #if PY_VERSION_HEX >= 0x030800b1
18054     0,
18055 #endif
18056 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18057     0,
18058 #endif
18059 };
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)) {
18065         return -1;
18066     }
18067     return 0;
18068 }
18069
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]) {
18076         char message[200];
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);
18082     }
18083     return 0;
18084 }
18085
18086 /* InitStrings */
18087 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
18088     while (t->p) {
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);
18094         } else {
18095             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
18096         }
18097         #else
18098         if (t->is_unicode | t->is_str) {
18099             if (t->intern) {
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);
18103             } else {
18104                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
18105             }
18106         } else {
18107             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
18108         }
18109         #endif
18110         if (!*t->p)
18111             return -1;
18112         if (PyObject_Hash(*t->p) == -1)
18113             return -1;
18114         ++t;
18115     }
18116     return 0;
18117 }
18118
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));
18121 }
18122 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
18123     Py_ssize_t ignore;
18124     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
18125 }
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) {
18129     char* defenc_c;
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
18134     {
18135         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
18136         char* c;
18137         for (c = defenc_c; c < end; c++) {
18138             if ((unsigned char) (*c) >= 128) {
18139                 PyUnicode_AsASCIIString(o);
18140                 return NULL;
18141             }
18142         }
18143     }
18144 #endif
18145     *length = PyBytes_GET_SIZE(defenc);
18146     return defenc_c;
18147 }
18148 #else
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);
18155     } else {
18156         PyUnicode_AsASCIIString(o);
18157         return NULL;
18158     }
18159 #else
18160     return PyUnicode_AsUTF8AndSize(o, length);
18161 #endif
18162 }
18163 #endif
18164 #endif
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
18167     if (
18168 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
18169             __Pyx_sys_getdefaultencoding_not_ascii &&
18170 #endif
18171             PyUnicode_Check(o)) {
18172         return __Pyx_PyUnicode_AsStringAndSize(o, length);
18173     } else
18174 #endif
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);
18179     } else
18180 #endif
18181     {
18182         char* result;
18183         int r = PyBytes_AsStringAndSize(o, &result, length);
18184         if (unlikely(r < 0)) {
18185             return NULL;
18186         } else {
18187             return result;
18188         }
18189     }
18190 }
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);
18195 }
18196 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
18197     int retval;
18198     if (unlikely(!x)) return -1;
18199     retval = __Pyx_PyObject_IsTrue(x);
18200     Py_DECREF(x);
18201     return retval;
18202 }
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)) {
18211             Py_DECREF(result);
18212             return NULL;
18213         }
18214         return result;
18215     }
18216 #endif
18217     PyErr_Format(PyExc_TypeError,
18218                  "__%.4s__ returned non-%.4s (type %.200s)",
18219                  type_name, type_name, Py_TYPE(result)->tp_name);
18220     Py_DECREF(result);
18221     return NULL;
18222 }
18223 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
18224 #if CYTHON_USE_TYPE_SLOTS
18225   PyNumberMethods *m;
18226 #endif
18227   const char *name = NULL;
18228   PyObject *res = NULL;
18229 #if PY_MAJOR_VERSION < 3
18230   if (likely(PyInt_Check(x) || PyLong_Check(x)))
18231 #else
18232   if (likely(PyLong_Check(x)))
18233 #endif
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) {
18239     name = "int";
18240     res = m->nb_int(x);
18241   }
18242   else if (m && m->nb_long) {
18243     name = "long";
18244     res = m->nb_long(x);
18245   }
18246   #else
18247   if (likely(m && m->nb_int)) {
18248     name = "int";
18249     res = m->nb_int(x);
18250   }
18251   #endif
18252 #else
18253   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
18254     res = PyNumber_Int(x);
18255   }
18256 #endif
18257   if (likely(res)) {
18258 #if PY_MAJOR_VERSION < 3
18259     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
18260 #else
18261     if (unlikely(!PyLong_CheckExact(res))) {
18262 #endif
18263         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
18264     }
18265   }
18266   else if (!PyErr_Occurred()) {
18267     PyErr_SetString(PyExc_TypeError,
18268                     "an integer is required");
18269   }
18270   return res;
18271 }
18272 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
18273   Py_ssize_t ival;
18274   PyObject *x;
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);
18279     else
18280         return PyInt_AsSsize_t(b);
18281   }
18282 #endif
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;
18290         return ival;
18291     } else {
18292       switch (size) {
18293          case 2:
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]));
18296            }
18297            break;
18298          case -2:
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]));
18301            }
18302            break;
18303          case 3:
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]));
18306            }
18307            break;
18308          case -3:
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]));
18311            }
18312            break;
18313          case 4:
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]));
18316            }
18317            break;
18318          case -4:
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]));
18321            }
18322            break;
18323       }
18324     }
18325     #endif
18326     return PyLong_AsSsize_t(b);
18327   }
18328   x = PyNumber_Index(b);
18329   if (!x) return -1;
18330   ival = PyInt_AsSsize_t(x);
18331   Py_DECREF(x);
18332   return ival;
18333 }
18334 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
18335   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
18336 }
18337 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
18338     return PyInt_FromSize_t(ival);
18339 }
18340
18341
18342 #endif /* Py_PYTHON_H */