1 /* Generated by Cython 0.28.6 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6     #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8     #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_28_6"
11 #define CYTHON_FUTURE_DIVISION 0
12 #include <stddef.h>
13 #ifndef offsetof
14   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15 #endif
16 #if !defined(WIN32) && !defined(MS_WINDOWS)
17   #ifndef __stdcall
18     #define __stdcall
19   #endif
20   #ifndef __cdecl
21     #define __cdecl
22   #endif
23   #ifndef __fastcall
24     #define __fastcall
25   #endif
26 #endif
27 #ifndef DL_IMPORT
28   #define DL_IMPORT(t) t
29 #endif
30 #ifndef DL_EXPORT
31   #define DL_EXPORT(t) t
32 #endif
33 #define __PYX_COMMA ,
34 #ifndef HAVE_LONG_LONG
35   #if PY_VERSION_HEX >= 0x02070000
36     #define HAVE_LONG_LONG
37   #endif
38 #endif
39 #ifndef PY_LONG_LONG
40   #define PY_LONG_LONG LONG_LONG
41 #endif
42 #ifndef Py_HUGE_VAL
43   #define Py_HUGE_VAL HUGE_VAL
44 #endif
45 #ifdef PYPY_VERSION
46   #define CYTHON_COMPILING_IN_PYPY 1
47   #define CYTHON_COMPILING_IN_PYSTON 0
48   #define CYTHON_COMPILING_IN_CPYTHON 0
49   #undef CYTHON_USE_TYPE_SLOTS
50   #define CYTHON_USE_TYPE_SLOTS 0
51   #undef CYTHON_USE_PYTYPE_LOOKUP
52   #define CYTHON_USE_PYTYPE_LOOKUP 0
53   #if PY_VERSION_HEX < 0x03050000
54     #undef CYTHON_USE_ASYNC_SLOTS
55     #define CYTHON_USE_ASYNC_SLOTS 0
56   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
57     #define CYTHON_USE_ASYNC_SLOTS 1
58   #endif
59   #undef CYTHON_USE_PYLIST_INTERNALS
60   #define CYTHON_USE_PYLIST_INTERNALS 0
61   #undef CYTHON_USE_UNICODE_INTERNALS
62   #define CYTHON_USE_UNICODE_INTERNALS 0
63   #undef CYTHON_USE_UNICODE_WRITER
64   #define CYTHON_USE_UNICODE_WRITER 0
65   #undef CYTHON_USE_PYLONG_INTERNALS
66   #define CYTHON_USE_PYLONG_INTERNALS 0
67   #undef CYTHON_AVOID_BORROWED_REFS
68   #define CYTHON_AVOID_BORROWED_REFS 1
69   #undef CYTHON_ASSUME_SAFE_MACROS
70   #define CYTHON_ASSUME_SAFE_MACROS 0
71   #undef CYTHON_UNPACK_METHODS
72   #define CYTHON_UNPACK_METHODS 0
73   #undef CYTHON_FAST_THREAD_STATE
74   #define CYTHON_FAST_THREAD_STATE 0
75   #undef CYTHON_FAST_PYCALL
76   #define CYTHON_FAST_PYCALL 0
77   #undef CYTHON_PEP489_MULTI_PHASE_INIT
78   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
79   #undef CYTHON_USE_TP_FINALIZE
80   #define CYTHON_USE_TP_FINALIZE 0
81 #elif defined(PYSTON_VERSION)
82   #define CYTHON_COMPILING_IN_PYPY 0
83   #define CYTHON_COMPILING_IN_PYSTON 1
84   #define CYTHON_COMPILING_IN_CPYTHON 0
85   #ifndef CYTHON_USE_TYPE_SLOTS
86     #define CYTHON_USE_TYPE_SLOTS 1
87   #endif
88   #undef CYTHON_USE_PYTYPE_LOOKUP
89   #define CYTHON_USE_PYTYPE_LOOKUP 0
90   #undef CYTHON_USE_ASYNC_SLOTS
91   #define CYTHON_USE_ASYNC_SLOTS 0
92   #undef CYTHON_USE_PYLIST_INTERNALS
93   #define CYTHON_USE_PYLIST_INTERNALS 0
94   #ifndef CYTHON_USE_UNICODE_INTERNALS
95     #define CYTHON_USE_UNICODE_INTERNALS 1
96   #endif
97   #undef CYTHON_USE_UNICODE_WRITER
98   #define CYTHON_USE_UNICODE_WRITER 0
99   #undef CYTHON_USE_PYLONG_INTERNALS
100   #define CYTHON_USE_PYLONG_INTERNALS 0
101   #ifndef CYTHON_AVOID_BORROWED_REFS
102     #define CYTHON_AVOID_BORROWED_REFS 0
103   #endif
104   #ifndef CYTHON_ASSUME_SAFE_MACROS
105     #define CYTHON_ASSUME_SAFE_MACROS 1
106   #endif
107   #ifndef CYTHON_UNPACK_METHODS
108     #define CYTHON_UNPACK_METHODS 1
109   #endif
110   #undef CYTHON_FAST_THREAD_STATE
111   #define CYTHON_FAST_THREAD_STATE 0
112   #undef CYTHON_FAST_PYCALL
113   #define CYTHON_FAST_PYCALL 0
114   #undef CYTHON_PEP489_MULTI_PHASE_INIT
115   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
116   #undef CYTHON_USE_TP_FINALIZE
117   #define CYTHON_USE_TP_FINALIZE 0
118 #else
119   #define CYTHON_COMPILING_IN_PYPY 0
120   #define CYTHON_COMPILING_IN_PYSTON 0
121   #define CYTHON_COMPILING_IN_CPYTHON 1
122   #ifndef CYTHON_USE_TYPE_SLOTS
123     #define CYTHON_USE_TYPE_SLOTS 1
124   #endif
125   #if PY_VERSION_HEX < 0x02070000
126     #undef CYTHON_USE_PYTYPE_LOOKUP
127     #define CYTHON_USE_PYTYPE_LOOKUP 0
128   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
129     #define CYTHON_USE_PYTYPE_LOOKUP 1
130   #endif
131   #if PY_MAJOR_VERSION < 3
132     #undef CYTHON_USE_ASYNC_SLOTS
133     #define CYTHON_USE_ASYNC_SLOTS 0
134   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
135     #define CYTHON_USE_ASYNC_SLOTS 1
136   #endif
137   #if PY_VERSION_HEX < 0x02070000
138     #undef CYTHON_USE_PYLONG_INTERNALS
139     #define CYTHON_USE_PYLONG_INTERNALS 0
140   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
141     #define CYTHON_USE_PYLONG_INTERNALS 1
142   #endif
143   #ifndef CYTHON_USE_PYLIST_INTERNALS
144     #define CYTHON_USE_PYLIST_INTERNALS 1
145   #endif
146   #ifndef CYTHON_USE_UNICODE_INTERNALS
147     #define CYTHON_USE_UNICODE_INTERNALS 1
148   #endif
149   #if PY_VERSION_HEX < 0x030300F0
150     #undef CYTHON_USE_UNICODE_WRITER
151     #define CYTHON_USE_UNICODE_WRITER 0
152   #elif !defined(CYTHON_USE_UNICODE_WRITER)
153     #define CYTHON_USE_UNICODE_WRITER 1
154   #endif
155   #ifndef CYTHON_AVOID_BORROWED_REFS
156     #define CYTHON_AVOID_BORROWED_REFS 0
157   #endif
158   #ifndef CYTHON_ASSUME_SAFE_MACROS
159     #define CYTHON_ASSUME_SAFE_MACROS 1
160   #endif
161   #ifndef CYTHON_UNPACK_METHODS
162     #define CYTHON_UNPACK_METHODS 1
163   #endif
164   #ifndef CYTHON_FAST_THREAD_STATE
165     #define CYTHON_FAST_THREAD_STATE 1
166   #endif
167   #ifndef CYTHON_FAST_PYCALL
168     #define CYTHON_FAST_PYCALL 1
169   #endif
170   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
171     #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
172   #endif
173   #ifndef CYTHON_USE_TP_FINALIZE
174     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
175   #endif
176 #endif
177 #if !defined(CYTHON_FAST_PYCCALL)
178 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
179 #endif
180 #if CYTHON_USE_PYLONG_INTERNALS
181   #include "longintrepr.h"
182   #undef SHIFT
183   #undef BASE
184   #undef MASK
185   #ifdef SIZEOF_VOID_P
186     enum { __pyx_check_sizeof_voidp = 1/(SIZEOF_VOID_P == sizeof(void*)) };
187   #endif
188 #endif
189 #ifndef __has_attribute
190   #define __has_attribute(x) 0
191 #endif
192 #ifndef __has_cpp_attribute
193   #define __has_cpp_attribute(x) 0
194 #endif
195 #ifndef CYTHON_RESTRICT
196   #if defined(__GNUC__)
197     #define CYTHON_RESTRICT __restrict__
198   #elif defined(_MSC_VER) && _MSC_VER >= 1400
199     #define CYTHON_RESTRICT __restrict
200   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
201     #define CYTHON_RESTRICT restrict
202   #else
203     #define CYTHON_RESTRICT
204   #endif
205 #endif
206 #ifndef CYTHON_UNUSED
207 # if defined(__GNUC__)
208 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
209 #     define CYTHON_UNUSED __attribute__ ((__unused__))
210 #   else
211 #     define CYTHON_UNUSED
212 #   endif
213 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
214 #   define CYTHON_UNUSED __attribute__ ((__unused__))
215 # else
216 #   define CYTHON_UNUSED
217 # endif
218 #endif
219 #ifndef CYTHON_MAYBE_UNUSED_VAR
220 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)221      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
222 #  else
223 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
224 #  endif
225 #endif
226 #ifndef CYTHON_NCP_UNUSED
227 # if CYTHON_COMPILING_IN_CPYTHON
228 #  define CYTHON_NCP_UNUSED
229 # else
230 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
231 # endif
232 #endif
233 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
234 #ifdef _MSC_VER
235     #ifndef _MSC_STDINT_H_
236         #if _MSC_VER < 1300
237            typedef unsigned char     uint8_t;
238            typedef unsigned int      uint32_t;
239         #else
240            typedef unsigned __int8   uint8_t;
241            typedef unsigned __int32  uint32_t;
242         #endif
243     #endif
244 #else
245    #include <stdint.h>
246 #endif
247 #ifndef CYTHON_FALLTHROUGH
248   #if defined(__cplusplus) && __cplusplus >= 201103L
249     #if __has_cpp_attribute(fallthrough)
250       #define CYTHON_FALLTHROUGH [[fallthrough]]
251     #elif __has_cpp_attribute(clang::fallthrough)
252       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
253     #elif __has_cpp_attribute(gnu::fallthrough)
254       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
255     #endif
256   #endif
257   #ifndef CYTHON_FALLTHROUGH
258     #if __has_attribute(fallthrough)
259       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
260     #else
261       #define CYTHON_FALLTHROUGH
262     #endif
263   #endif
264   #if defined(__clang__ ) && defined(__apple_build_version__)
265     #if __apple_build_version__ < 7000000
266       #undef  CYTHON_FALLTHROUGH
267       #define CYTHON_FALLTHROUGH
268     #endif
269   #endif
270 #endif
271 
272 #ifndef CYTHON_INLINE
273   #if defined(__clang__)
274     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
275   #elif defined(__GNUC__)
276     #define CYTHON_INLINE __inline__
277   #elif defined(_MSC_VER)
278     #define CYTHON_INLINE __inline
279   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
280     #define CYTHON_INLINE inline
281   #else
282     #define CYTHON_INLINE
283   #endif
284 #endif
285 
286 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
287   #define Py_OptimizeFlag 0
288 #endif
289 #define __PYX_BUILD_PY_SSIZE_T "n"
290 #define CYTHON_FORMAT_SSIZE_T "z"
291 #if PY_MAJOR_VERSION < 3
292   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
293   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
294           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
295   #define __Pyx_DefaultClassType PyClass_Type
296 #else
297   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
298   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
299           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
300   #define __Pyx_DefaultClassType PyType_Type
301 #endif
302 #ifndef Py_TPFLAGS_CHECKTYPES
303   #define Py_TPFLAGS_CHECKTYPES 0
304 #endif
305 #ifndef Py_TPFLAGS_HAVE_INDEX
306   #define Py_TPFLAGS_HAVE_INDEX 0
307 #endif
308 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
309   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
310 #endif
311 #ifndef Py_TPFLAGS_HAVE_FINALIZE
312   #define Py_TPFLAGS_HAVE_FINALIZE 0
313 #endif
314 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
315   #ifndef METH_FASTCALL
316      #define METH_FASTCALL 0x80
317   #endif
318   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
319   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
320                                                           Py_ssize_t nargs, PyObject *kwnames);
321 #else
322   #define __Pyx_PyCFunctionFast _PyCFunctionFast
323   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
324 #endif
325 #if CYTHON_FAST_PYCCALL
326 #define __Pyx_PyFastCFunction_Check(func)\
327     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
328 #else
329 #define __Pyx_PyFastCFunction_Check(func) 0
330 #endif
331 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
332   #define PyObject_Malloc(s)   PyMem_Malloc(s)
333   #define PyObject_Free(p)     PyMem_Free(p)
334   #define PyObject_Realloc(p)  PyMem_Realloc(p)
335 #endif
336 #if CYTHON_COMPILING_IN_PYSTON
337   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
338   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
339 #else
340   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
341   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
342 #endif
343 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
344   #define __Pyx_PyThreadState_Current PyThreadState_GET()
345 #elif PY_VERSION_HEX >= 0x03060000
346   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
347 #elif PY_VERSION_HEX >= 0x03000000
348   #define __Pyx_PyThreadState_Current PyThreadState_GET()
349 #else
350   #define __Pyx_PyThreadState_Current _PyThreadState_Current
351 #endif
352 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
353 #include "pythread.h"
354 #define Py_tss_NEEDS_INIT 0
355 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)356 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
357   *key = PyThread_create_key();
358   return 0; // PyThread_create_key reports success always
359 }
PyThread_tss_alloc(void)360 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
361   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
362   *key = Py_tss_NEEDS_INIT;
363   return key;
364 }
PyThread_tss_free(Py_tss_t * key)365 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
366   PyObject_Free(key);
367 }
PyThread_tss_is_created(Py_tss_t * key)368 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
369   return *key != Py_tss_NEEDS_INIT;
370 }
PyThread_tss_delete(Py_tss_t * key)371 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
372   PyThread_delete_key(*key);
373   *key = Py_tss_NEEDS_INIT;
374 }
PyThread_tss_set(Py_tss_t * key,void * value)375 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
376   return PyThread_set_key_value(*key, value);
377 }
PyThread_tss_get(Py_tss_t * key)378 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
379   return PyThread_get_key_value(*key);
380 }
381 #endif // TSS (Thread Specific Storage) API
382 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
383 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
384 #else
385 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
386 #endif
387 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
388   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
389   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
390 #else
391   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
392   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
393 #endif
394 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
395 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
396 #else
397 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
398 #endif
399 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
400   #define CYTHON_PEP393_ENABLED 1
401   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
402                                               0 : _PyUnicode_Ready((PyObject *)(op)))
403   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
404   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
405   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
406   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
407   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
408   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
409   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
410   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
411 #else
412   #define CYTHON_PEP393_ENABLED 0
413   #define PyUnicode_1BYTE_KIND  1
414   #define PyUnicode_2BYTE_KIND  2
415   #define PyUnicode_4BYTE_KIND  4
416   #define __Pyx_PyUnicode_READY(op)       (0)
417   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
418   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
419   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
420   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
421   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
422   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
423   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
424   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
425 #endif
426 #if CYTHON_COMPILING_IN_PYPY
427   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
428   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
429 #else
430   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
431   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
432       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
433 #endif
434 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
435   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
436 #endif
437 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
438   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
439 #endif
440 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
441   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
442 #endif
443 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
444 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
445 #if PY_MAJOR_VERSION >= 3
446   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
447 #else
448   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
449 #endif
450 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
451   #define PyObject_ASCII(o)            PyObject_Repr(o)
452 #endif
453 #if PY_MAJOR_VERSION >= 3
454   #define PyBaseString_Type            PyUnicode_Type
455   #define PyStringObject               PyUnicodeObject
456   #define PyString_Type                PyUnicode_Type
457   #define PyString_Check               PyUnicode_Check
458   #define PyString_CheckExact          PyUnicode_CheckExact
459   #define PyObject_Unicode             PyObject_Str
460 #endif
461 #if PY_MAJOR_VERSION >= 3
462   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
463   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
464 #else
465   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
466   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
467 #endif
468 #ifndef PySet_CheckExact
469   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
470 #endif
471 #if CYTHON_ASSUME_SAFE_MACROS
472   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
473 #else
474   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
475 #endif
476 #if PY_MAJOR_VERSION >= 3
477   #define PyIntObject                  PyLongObject
478   #define PyInt_Type                   PyLong_Type
479   #define PyInt_Check(op)              PyLong_Check(op)
480   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
481   #define PyInt_FromString             PyLong_FromString
482   #define PyInt_FromUnicode            PyLong_FromUnicode
483   #define PyInt_FromLong               PyLong_FromLong
484   #define PyInt_FromSize_t             PyLong_FromSize_t
485   #define PyInt_FromSsize_t            PyLong_FromSsize_t
486   #define PyInt_AsLong                 PyLong_AsLong
487   #define PyInt_AS_LONG                PyLong_AS_LONG
488   #define PyInt_AsSsize_t              PyLong_AsSsize_t
489   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
490   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
491   #define PyNumber_Int                 PyNumber_Long
492 #endif
493 #if PY_MAJOR_VERSION >= 3
494   #define PyBoolObject                 PyLongObject
495 #endif
496 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
497   #ifndef PyUnicode_InternFromString
498     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
499   #endif
500 #endif
501 #if PY_VERSION_HEX < 0x030200A4
502   typedef long Py_hash_t;
503   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
504   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
505 #else
506   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
507   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
508 #endif
509 #if PY_MAJOR_VERSION >= 3
510   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
511 #else
512   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
513 #endif
514 #if CYTHON_USE_ASYNC_SLOTS
515   #if PY_VERSION_HEX >= 0x030500B1
516     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
517     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
518   #else
519     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
520   #endif
521 #else
522   #define __Pyx_PyType_AsAsync(obj) NULL
523 #endif
524 #ifndef __Pyx_PyAsyncMethodsStruct
525     typedef struct {
526         unaryfunc am_await;
527         unaryfunc am_aiter;
528         unaryfunc am_anext;
529     } __Pyx_PyAsyncMethodsStruct;
530 #endif
531 
532 #if defined(WIN32) || defined(MS_WINDOWS)
533   #define _USE_MATH_DEFINES
534 #endif
535 #include <math.h>
536 #ifdef NAN
537 #define __PYX_NAN() ((float) NAN)
538 #else
__PYX_NAN()539 static CYTHON_INLINE float __PYX_NAN() {
540   float value;
541   memset(&value, 0xFF, sizeof(value));
542   return value;
543 }
544 #endif
545 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
546 #define __Pyx_truncl trunc
547 #else
548 #define __Pyx_truncl truncl
549 #endif
550 
551 
552 #define __PYX_ERR(f_index, lineno, Ln_error) \
553 { \
554   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
555 }
556 
557 #ifndef __PYX_EXTERN_C
558   #ifdef __cplusplus
559     #define __PYX_EXTERN_C extern "C"
560   #else
561     #define __PYX_EXTERN_C extern
562   #endif
563 #endif
564 
565 #define __PYX_HAVE__timelib
566 #define __PYX_HAVE_API__timelib
567 /* Early includes */
568 #include "timelib.h"
569 #ifdef _OPENMP
570 #include <omp.h>
571 #endif /* _OPENMP */
572 
573 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
574 #define CYTHON_WITHOUT_ASSERTIONS
575 #endif
576 
577 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
578                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
579 
580 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
581 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
582 #define __PYX_DEFAULT_STRING_ENCODING ""
583 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
584 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
585 #define __Pyx_uchar_cast(c) ((unsigned char)c)
586 #define __Pyx_long_cast(x) ((long)x)
587 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
588     (sizeof(type) < sizeof(Py_ssize_t))  ||\
589     (sizeof(type) > sizeof(Py_ssize_t) &&\
590           likely(v < (type)PY_SSIZE_T_MAX ||\
591                  v == (type)PY_SSIZE_T_MAX)  &&\
592           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
593                                 v == (type)PY_SSIZE_T_MIN)))  ||\
594     (sizeof(type) == sizeof(Py_ssize_t) &&\
595           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
596                                v == (type)PY_SSIZE_T_MAX)))  )
597 #if defined (__cplusplus) && __cplusplus >= 201103L
598     #include <cstdlib>
599     #define __Pyx_sst_abs(value) std::abs(value)
600 #elif SIZEOF_INT >= SIZEOF_SIZE_T
601     #define __Pyx_sst_abs(value) abs(value)
602 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
603     #define __Pyx_sst_abs(value) labs(value)
604 #elif defined (_MSC_VER)
605     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
606 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
607     #define __Pyx_sst_abs(value) llabs(value)
608 #elif defined (__GNUC__)
609     #define __Pyx_sst_abs(value) __builtin_llabs(value)
610 #else
611     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
612 #endif
613 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
614 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
615 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
616 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
617 #define __Pyx_PyBytes_FromString        PyBytes_FromString
618 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
619 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
620 #if PY_MAJOR_VERSION < 3
621     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
622     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
623 #else
624     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
625     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
626 #endif
627 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
628 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
629 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
630 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
631 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
632 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
633 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
634 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
635 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
636 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
637 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
638 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
639 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
640 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
641 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
642 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)643 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
644     const Py_UNICODE *u_end = u;
645     while (*u_end++) ;
646     return (size_t)(u_end - u - 1);
647 }
648 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
649 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
650 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
651 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
652 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
653 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
654 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
655 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
656 #define __Pyx_PySequence_Tuple(obj)\
657     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
658 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
659 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
660 #if CYTHON_ASSUME_SAFE_MACROS
661 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
662 #else
663 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
664 #endif
665 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
666 #if PY_MAJOR_VERSION >= 3
667 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
668 #else
669 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
670 #endif
671 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
672 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
673 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)674 static int __Pyx_init_sys_getdefaultencoding_params(void) {
675     PyObject* sys;
676     PyObject* default_encoding = NULL;
677     PyObject* ascii_chars_u = NULL;
678     PyObject* ascii_chars_b = NULL;
679     const char* default_encoding_c;
680     sys = PyImport_ImportModule("sys");
681     if (!sys) goto bad;
682     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
683     Py_DECREF(sys);
684     if (!default_encoding) goto bad;
685     default_encoding_c = PyBytes_AsString(default_encoding);
686     if (!default_encoding_c) goto bad;
687     if (strcmp(default_encoding_c, "ascii") == 0) {
688         __Pyx_sys_getdefaultencoding_not_ascii = 0;
689     } else {
690         char ascii_chars[128];
691         int c;
692         for (c = 0; c < 128; c++) {
693             ascii_chars[c] = c;
694         }
695         __Pyx_sys_getdefaultencoding_not_ascii = 1;
696         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
697         if (!ascii_chars_u) goto bad;
698         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
699         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
700             PyErr_Format(
701                 PyExc_ValueError,
702                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
703                 default_encoding_c);
704             goto bad;
705         }
706         Py_DECREF(ascii_chars_u);
707         Py_DECREF(ascii_chars_b);
708     }
709     Py_DECREF(default_encoding);
710     return 0;
711 bad:
712     Py_XDECREF(default_encoding);
713     Py_XDECREF(ascii_chars_u);
714     Py_XDECREF(ascii_chars_b);
715     return -1;
716 }
717 #endif
718 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
719 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
720 #else
721 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
722 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
723 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)724 static int __Pyx_init_sys_getdefaultencoding_params(void) {
725     PyObject* sys;
726     PyObject* default_encoding = NULL;
727     char* default_encoding_c;
728     sys = PyImport_ImportModule("sys");
729     if (!sys) goto bad;
730     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
731     Py_DECREF(sys);
732     if (!default_encoding) goto bad;
733     default_encoding_c = PyBytes_AsString(default_encoding);
734     if (!default_encoding_c) goto bad;
735     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
736     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
737     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
738     Py_DECREF(default_encoding);
739     return 0;
740 bad:
741     Py_XDECREF(default_encoding);
742     return -1;
743 }
744 #endif
745 #endif
746 
747 
748 /* Test for GCC > 2.95 */
749 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
750   #define likely(x)   __builtin_expect(!!(x), 1)
751   #define unlikely(x) __builtin_expect(!!(x), 0)
752 #else /* !__GNUC__ or GCC < 2.95 */
753   #define likely(x)   (x)
754   #define unlikely(x) (x)
755 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)756 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
757 
758 static PyObject *__pyx_m = NULL;
759 static PyObject *__pyx_d;
760 static PyObject *__pyx_b;
761 static PyObject *__pyx_cython_runtime = NULL;
762 static PyObject *__pyx_empty_tuple;
763 static PyObject *__pyx_empty_bytes;
764 static PyObject *__pyx_empty_unicode;
765 static int __pyx_lineno;
766 static int __pyx_clineno = 0;
767 static const char * __pyx_cfilenm= __FILE__;
768 static const char *__pyx_filename;
769 
770 
771 static const char *__pyx_f[] = {
772   "timelib.pyx",
773 };
774 
775 /*--- Type declarations ---*/
776 struct __pyx_opt_args_7timelib_strtotimelib_time;
777 
778 /* "timelib.pyx":57
779  *     raise ValueError(description)
780  *
781  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:             # <<<<<<<<<<<<<<
782  *     cdef timelib_time *t = NULL
783  *     cdef timelib_time *tm_now = NULL
784  */
785 struct __pyx_opt_args_7timelib_strtotimelib_time {
786   int __pyx_n;
787   PyObject *now;
788 };
789 
790 /* --- Runtime support code (head) --- */
791 /* Refnanny.proto */
792 #ifndef CYTHON_REFNANNY
793   #define CYTHON_REFNANNY 0
794 #endif
795 #if CYTHON_REFNANNY
796   typedef struct {
797     void (*INCREF)(void*, PyObject*, int);
798     void (*DECREF)(void*, PyObject*, int);
799     void (*GOTREF)(void*, PyObject*, int);
800     void (*GIVEREF)(void*, PyObject*, int);
801     void* (*SetupContext)(const char*, int, const char*);
802     void (*FinishContext)(void**);
803   } __Pyx_RefNannyAPIStruct;
804   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
805   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
806   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
807 #ifdef WITH_THREAD
808   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
809           if (acquire_gil) {\
810               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
811               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
812               PyGILState_Release(__pyx_gilstate_save);\
813           } else {\
814               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
815           }
816 #else
817   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
818           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
819 #endif
820   #define __Pyx_RefNannyFinishContext()\
821           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
822   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
823   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
824   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
825   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
826   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
827   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
828   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
829   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
830 #else
831   #define __Pyx_RefNannyDeclarations
832   #define __Pyx_RefNannySetupContext(name, acquire_gil)
833   #define __Pyx_RefNannyFinishContext()
834   #define __Pyx_INCREF(r) Py_INCREF(r)
835   #define __Pyx_DECREF(r) Py_DECREF(r)
836   #define __Pyx_GOTREF(r)
837   #define __Pyx_GIVEREF(r)
838   #define __Pyx_XINCREF(r) Py_XINCREF(r)
839   #define __Pyx_XDECREF(r) Py_XDECREF(r)
840   #define __Pyx_XGOTREF(r)
841   #define __Pyx_XGIVEREF(r)
842 #endif
843 #define __Pyx_XDECREF_SET(r, v) do {\
844         PyObject *tmp = (PyObject *) r;\
845         r = v; __Pyx_XDECREF(tmp);\
846     } while (0)
847 #define __Pyx_DECREF_SET(r, v) do {\
848         PyObject *tmp = (PyObject *) r;\
849         r = v; __Pyx_DECREF(tmp);\
850     } while (0)
851 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
852 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
853 
854 /* PyObjectGetAttrStr.proto */
855 #if CYTHON_USE_TYPE_SLOTS
856 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
857 #else
858 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
859 #endif
860 
861 /* GetBuiltinName.proto */
862 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
863 
864 /* PyCFunctionFastCall.proto */
865 #if CYTHON_FAST_PYCCALL
866 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
867 #else
868 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
869 #endif
870 
871 /* PyFunctionFastCall.proto */
872 #if CYTHON_FAST_PYCALL
873 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
874     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
875 #if 1 || PY_VERSION_HEX < 0x030600B1
876 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
877 #else
878 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
879 #endif
880 #endif
881 
882 /* PyObjectCall.proto */
883 #if CYTHON_COMPILING_IN_CPYTHON
884 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
885 #else
886 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
887 #endif
888 
889 /* PyObjectCallMethO.proto */
890 #if CYTHON_COMPILING_IN_CPYTHON
891 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
892 #endif
893 
894 /* PyObjectCallOneArg.proto */
895 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
896 
897 /* PyThreadStateGet.proto */
898 #if CYTHON_FAST_THREAD_STATE
899 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
900 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
901 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
902 #else
903 #define __Pyx_PyThreadState_declare
904 #define __Pyx_PyThreadState_assign
905 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
906 #endif
907 
908 /* PyErrFetchRestore.proto */
909 #if CYTHON_FAST_THREAD_STATE
910 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
911 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
912 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
913 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
914 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
915 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
916 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
917 #if CYTHON_COMPILING_IN_CPYTHON
918 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
919 #else
920 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
921 #endif
922 #else
923 #define __Pyx_PyErr_Clear() PyErr_Clear()
924 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
925 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
926 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
927 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
928 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
929 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
930 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
931 #endif
932 
933 /* RaiseException.proto */
934 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
935 
936 /* IncludeStringH.proto */
937 #include <string.h>
938 
939 /* GetModuleGlobalName.proto */
940 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
941 
942 /* PyObjectCallNoArg.proto */
943 #if CYTHON_COMPILING_IN_CPYTHON
944 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
945 #else
946 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
947 #endif
948 
949 /* RaiseDoubleKeywords.proto */
950 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
951 
952 /* ParseKeywords.proto */
953 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
954     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
955     const char* function_name);
956 
957 /* RaiseArgTupleInvalid.proto */
958 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
959     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
960 
961 /* Import.proto */
962 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
963 
964 /* CLineInTraceback.proto */
965 #ifdef CYTHON_CLINE_IN_TRACEBACK
966 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
967 #else
968 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
969 #endif
970 
971 /* CodeObjectCache.proto */
972 typedef struct {
973     PyCodeObject* code_object;
974     int code_line;
975 } __Pyx_CodeObjectCacheEntry;
976 struct __Pyx_CodeObjectCache {
977     int count;
978     int max_count;
979     __Pyx_CodeObjectCacheEntry* entries;
980 };
981 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
982 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
983 static PyCodeObject *__pyx_find_code_object(int code_line);
984 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
985 
986 /* AddTraceback.proto */
987 static void __Pyx_AddTraceback(const char *funcname, int c_line,
988                                int py_line, const char *filename);
989 
990 /* CIntToPy.proto */
991 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
992 
993 /* CIntToPy.proto */
994 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
995 
996 /* CIntFromPy.proto */
997 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
998 
999 /* CIntFromPy.proto */
1000 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1001 
1002 /* FastTypeChecks.proto */
1003 #if CYTHON_COMPILING_IN_CPYTHON
1004 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1005 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1006 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1007 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1008 #else
1009 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1010 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1011 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1012 #endif
1013 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1014 
1015 /* CheckBinaryVersion.proto */
1016 static int __Pyx_check_binary_version(void);
1017 
1018 /* InitStrings.proto */
1019 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1020 
1021 
1022 /* Module declarations from 'timelib' */
1023 static struct timelib_time *__pyx_f_7timelib_strtotimelib_time(char *, struct __pyx_opt_args_7timelib_strtotimelib_time *__pyx_optional_args); /*proto*/
1024 #define __Pyx_MODULE_NAME "timelib"
1025 extern int __pyx_module_is_main_timelib;
1026 int __pyx_module_is_main_timelib = 0;
1027 
1028 /* Implementation of 'timelib' */
1029 static PyObject *__pyx_builtin_ValueError;
1030 static const char __pyx_k_s[] = "s";
1031 static const char __pyx_k_t[] = "t";
1032 static const char __pyx_k_now[] = "now";
1033 static const char __pyx_k_main[] = "__main__";
1034 static const char __pyx_k_test[] = "__test__";
1035 static const char __pyx_k_time[] = "time";
1036 static const char __pyx_k_0_2_4[] = "0.2.4";
1037 static const char __pyx_k_import[] = "__import__";
1038 static const char __pyx_k_retval[] = "retval";
1039 static const char __pyx_k_timelib[] = "timelib";
1040 static const char __pyx_k_version[] = "version";
1041 static const char __pyx_k_datetime[] = "datetime";
1042 static const char __pyx_k_strtotime[] = "strtotime";
1043 static const char __pyx_k_ValueError[] = "ValueError";
1044 static const char __pyx_k_description[] = "description";
1045 static const char __pyx_k_raise_error[] = "_raise_error";
1046 static const char __pyx_k_timelib_pyx[] = "timelib.pyx";
1047 static const char __pyx_k_version_info[] = "version_info";
1048 static const char __pyx_k_strtodatetime[] = "strtodatetime";
1049 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1050 static const char __pyx_k_while_parsing_date_r[] = " (while parsing date %r)";
1051 static PyObject *__pyx_kp_s_0_2_4;
1052 static PyObject *__pyx_n_s_ValueError;
1053 static PyObject *__pyx_n_s_cline_in_traceback;
1054 static PyObject *__pyx_n_s_datetime;
1055 static PyObject *__pyx_n_s_description;
1056 static PyObject *__pyx_n_s_import;
1057 static PyObject *__pyx_n_s_main;
1058 static PyObject *__pyx_n_s_now;
1059 static PyObject *__pyx_n_s_raise_error;
1060 static PyObject *__pyx_n_s_retval;
1061 static PyObject *__pyx_n_s_s;
1062 static PyObject *__pyx_n_s_strtodatetime;
1063 static PyObject *__pyx_n_s_strtotime;
1064 static PyObject *__pyx_n_s_t;
1065 static PyObject *__pyx_n_s_test;
1066 static PyObject *__pyx_n_s_time;
1067 static PyObject *__pyx_n_s_timelib;
1068 static PyObject *__pyx_kp_s_timelib_pyx;
1069 static PyObject *__pyx_n_s_version;
1070 static PyObject *__pyx_n_s_version_info;
1071 static PyObject *__pyx_kp_s_while_parsing_date_r;
1072 static PyObject *__pyx_pf_7timelib__raise_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_description); /* proto */
1073 static PyObject *__pyx_pf_7timelib_2strtodatetime(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_s, PyObject *__pyx_v_now); /* proto */
1074 static PyObject *__pyx_pf_7timelib_4strtotime(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_s, PyObject *__pyx_v_now); /* proto */
1075 static PyObject *__pyx_int_0;
1076 static PyObject *__pyx_int_2;
1077 static PyObject *__pyx_int_4;
1078 static PyObject *__pyx_tuple_;
1079 static PyObject *__pyx_tuple__2;
1080 static PyObject *__pyx_tuple__4;
1081 static PyObject *__pyx_tuple__6;
1082 static PyObject *__pyx_codeobj__3;
1083 static PyObject *__pyx_codeobj__5;
1084 static PyObject *__pyx_codeobj__7;
1085 /* Late includes */
1086 
1087 /* "timelib.pyx":54
1088  *
1089  *
1090  * def _raise_error(description):             # <<<<<<<<<<<<<<
1091  *     raise ValueError(description)
1092  *
1093  */
1094 
1095 /* Python wrapper */
1096 static PyObject *__pyx_pw_7timelib_1_raise_error(PyObject *__pyx_self, PyObject *__pyx_v_description); /*proto*/
1097 static PyMethodDef __pyx_mdef_7timelib_1_raise_error = {"_raise_error", (PyCFunction)__pyx_pw_7timelib_1_raise_error, METH_O, 0};
__pyx_pw_7timelib_1_raise_error(PyObject * __pyx_self,PyObject * __pyx_v_description)1098 static PyObject *__pyx_pw_7timelib_1_raise_error(PyObject *__pyx_self, PyObject *__pyx_v_description) {
1099   PyObject *__pyx_r = 0;
1100   __Pyx_RefNannyDeclarations
1101   __Pyx_RefNannySetupContext("_raise_error (wrapper)", 0);
1102   __pyx_r = __pyx_pf_7timelib__raise_error(__pyx_self, ((PyObject *)__pyx_v_description));
1103 
1104   /* function exit code */
1105   __Pyx_RefNannyFinishContext();
1106   return __pyx_r;
1107 }
1108 
__pyx_pf_7timelib__raise_error(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_description)1109 static PyObject *__pyx_pf_7timelib__raise_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_description) {
1110   PyObject *__pyx_r = NULL;
1111   __Pyx_RefNannyDeclarations
1112   PyObject *__pyx_t_1 = NULL;
1113   __Pyx_RefNannySetupContext("_raise_error", 0);
1114 
1115   /* "timelib.pyx":55
1116  *
1117  * def _raise_error(description):
1118  *     raise ValueError(description)             # <<<<<<<<<<<<<<
1119  *
1120  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:
1121  */
1122   __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_v_description); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
1123   __Pyx_GOTREF(__pyx_t_1);
1124   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
1125   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1126   __PYX_ERR(0, 55, __pyx_L1_error)
1127 
1128   /* "timelib.pyx":54
1129  *
1130  *
1131  * def _raise_error(description):             # <<<<<<<<<<<<<<
1132  *     raise ValueError(description)
1133  *
1134  */
1135 
1136   /* function exit code */
1137   __pyx_L1_error:;
1138   __Pyx_XDECREF(__pyx_t_1);
1139   __Pyx_AddTraceback("timelib._raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
1140   __pyx_r = NULL;
1141   __Pyx_XGIVEREF(__pyx_r);
1142   __Pyx_RefNannyFinishContext();
1143   return __pyx_r;
1144 }
1145 
1146 /* "timelib.pyx":57
1147  *     raise ValueError(description)
1148  *
1149  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:             # <<<<<<<<<<<<<<
1150  *     cdef timelib_time *t = NULL
1151  *     cdef timelib_time *tm_now = NULL
1152  */
1153 
__pyx_f_7timelib_strtotimelib_time(char * __pyx_v_s,struct __pyx_opt_args_7timelib_strtotimelib_time * __pyx_optional_args)1154 static struct timelib_time *__pyx_f_7timelib_strtotimelib_time(char *__pyx_v_s, struct __pyx_opt_args_7timelib_strtotimelib_time *__pyx_optional_args) {
1155   PyObject *__pyx_v_now = ((PyObject *)Py_None);
1156   struct timelib_time *__pyx_v_t;
1157   struct timelib_time *__pyx_v_tm_now;
1158   struct timelib_error_container *__pyx_v_error;
1159   PyObject *__pyx_v_msg = NULL;
1160   struct timelib_time *__pyx_r;
1161   __Pyx_RefNannyDeclarations
1162   size_t __pyx_t_1;
1163   int __pyx_t_2;
1164   int __pyx_t_3;
1165   PyObject *__pyx_t_4 = NULL;
1166   PyObject *__pyx_t_5 = NULL;
1167   PyObject *__pyx_t_6 = NULL;
1168   PyObject *__pyx_t_7 = NULL;
1169   long __pyx_t_8;
1170   __Pyx_RefNannySetupContext("strtotimelib_time", 0);
1171   if (__pyx_optional_args) {
1172     if (__pyx_optional_args->__pyx_n > 0) {
1173       __pyx_v_now = __pyx_optional_args->now;
1174     }
1175   }
1176   __Pyx_INCREF(__pyx_v_now);
1177 
1178   /* "timelib.pyx":58
1179  *
1180  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:
1181  *     cdef timelib_time *t = NULL             # <<<<<<<<<<<<<<
1182  *     cdef timelib_time *tm_now = NULL
1183  *     cdef timelib_error_container *error = NULL
1184  */
1185   __pyx_v_t = NULL;
1186 
1187   /* "timelib.pyx":59
1188  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:
1189  *     cdef timelib_time *t = NULL
1190  *     cdef timelib_time *tm_now = NULL             # <<<<<<<<<<<<<<
1191  *     cdef timelib_error_container *error = NULL
1192  *
1193  */
1194   __pyx_v_tm_now = NULL;
1195 
1196   /* "timelib.pyx":60
1197  *     cdef timelib_time *t = NULL
1198  *     cdef timelib_time *tm_now = NULL
1199  *     cdef timelib_error_container *error = NULL             # <<<<<<<<<<<<<<
1200  *
1201  *     t = timelib_strtotime(s, len(s), &error, timelib_builtin_db())
1202  */
1203   __pyx_v_error = NULL;
1204 
1205   /* "timelib.pyx":62
1206  *     cdef timelib_error_container *error = NULL
1207  *
1208  *     t = timelib_strtotime(s, len(s), &error, timelib_builtin_db())             # <<<<<<<<<<<<<<
1209  *
1210  *     if error and error.error_count:
1211  */
1212   __pyx_t_1 = strlen(__pyx_v_s);
1213   __pyx_v_t = timelib_strtotime(__pyx_v_s, __pyx_t_1, (&__pyx_v_error), timelib_builtin_db());
1214 
1215   /* "timelib.pyx":64
1216  *     t = timelib_strtotime(s, len(s), &error, timelib_builtin_db())
1217  *
1218  *     if error and error.error_count:             # <<<<<<<<<<<<<<
1219  *         timelib_time_dtor(t)
1220  *
1221  */
1222   __pyx_t_3 = (__pyx_v_error != 0);
1223   if (__pyx_t_3) {
1224   } else {
1225     __pyx_t_2 = __pyx_t_3;
1226     goto __pyx_L4_bool_binop_done;
1227   }
1228   __pyx_t_3 = (__pyx_v_error->error_count != 0);
1229   __pyx_t_2 = __pyx_t_3;
1230   __pyx_L4_bool_binop_done:;
1231   if (__pyx_t_2) {
1232 
1233     /* "timelib.pyx":65
1234  *
1235  *     if error and error.error_count:
1236  *         timelib_time_dtor(t)             # <<<<<<<<<<<<<<
1237  *
1238  *         msg = str(error.error_messages[0].message)
1239  */
1240     timelib_time_dtor(__pyx_v_t);
1241 
1242     /* "timelib.pyx":67
1243  *         timelib_time_dtor(t)
1244  *
1245  *         msg = str(error.error_messages[0].message)             # <<<<<<<<<<<<<<
1246  *         msg += " (while parsing date %r)" % (s, )
1247  *
1248  */
1249     __pyx_t_4 = __Pyx_PyBytes_FromString((__pyx_v_error->error_messages[0]).message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
1250     __Pyx_GOTREF(__pyx_t_4);
1251     __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
1252     __Pyx_GOTREF(__pyx_t_5);
1253     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1254     __pyx_v_msg = __pyx_t_5;
1255     __pyx_t_5 = 0;
1256 
1257     /* "timelib.pyx":68
1258  *
1259  *         msg = str(error.error_messages[0].message)
1260  *         msg += " (while parsing date %r)" % (s, )             # <<<<<<<<<<<<<<
1261  *
1262  *         _raise_error(msg)
1263  */
1264     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
1265     __Pyx_GOTREF(__pyx_t_5);
1266     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
1267     __Pyx_GOTREF(__pyx_t_4);
1268     __Pyx_GIVEREF(__pyx_t_5);
1269     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
1270     __pyx_t_5 = 0;
1271     __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_while_parsing_date_r, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
1272     __Pyx_GOTREF(__pyx_t_5);
1273     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1274     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_msg, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
1275     __Pyx_GOTREF(__pyx_t_4);
1276     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1277     __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_4);
1278     __pyx_t_4 = 0;
1279 
1280     /* "timelib.pyx":70
1281  *         msg += " (while parsing date %r)" % (s, )
1282  *
1283  *         _raise_error(msg)             # <<<<<<<<<<<<<<
1284  *         timelib_error_container_dtor(error)
1285  *         return NULL
1286  */
1287     __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_raise_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error)
1288     __Pyx_GOTREF(__pyx_t_5);
1289     __pyx_t_6 = NULL;
1290     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
1291       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
1292       if (likely(__pyx_t_6)) {
1293         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
1294         __Pyx_INCREF(__pyx_t_6);
1295         __Pyx_INCREF(function);
1296         __Pyx_DECREF_SET(__pyx_t_5, function);
1297       }
1298     }
1299     if (!__pyx_t_6) {
1300       __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
1301       __Pyx_GOTREF(__pyx_t_4);
1302     } else {
1303       #if CYTHON_FAST_PYCALL
1304       if (PyFunction_Check(__pyx_t_5)) {
1305         PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg};
1306         __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
1307         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1308         __Pyx_GOTREF(__pyx_t_4);
1309       } else
1310       #endif
1311       #if CYTHON_FAST_PYCCALL
1312       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
1313         PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg};
1314         __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
1315         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1316         __Pyx_GOTREF(__pyx_t_4);
1317       } else
1318       #endif
1319       {
1320         __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
1321         __Pyx_GOTREF(__pyx_t_7);
1322         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
1323         __Pyx_INCREF(__pyx_v_msg);
1324         __Pyx_GIVEREF(__pyx_v_msg);
1325         PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_msg);
1326         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
1327         __Pyx_GOTREF(__pyx_t_4);
1328         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1329       }
1330     }
1331     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1332     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1333 
1334     /* "timelib.pyx":71
1335  *
1336  *         _raise_error(msg)
1337  *         timelib_error_container_dtor(error)             # <<<<<<<<<<<<<<
1338  *         return NULL
1339  *
1340  */
1341     timelib_error_container_dtor(__pyx_v_error);
1342 
1343     /* "timelib.pyx":72
1344  *         _raise_error(msg)
1345  *         timelib_error_container_dtor(error)
1346  *         return NULL             # <<<<<<<<<<<<<<
1347  *
1348  *     if error:  # warnings we don't care about
1349  */
1350     __pyx_r = NULL;
1351     goto __pyx_L0;
1352 
1353     /* "timelib.pyx":64
1354  *     t = timelib_strtotime(s, len(s), &error, timelib_builtin_db())
1355  *
1356  *     if error and error.error_count:             # <<<<<<<<<<<<<<
1357  *         timelib_time_dtor(t)
1358  *
1359  */
1360   }
1361 
1362   /* "timelib.pyx":74
1363  *         return NULL
1364  *
1365  *     if error:  # warnings we don't care about             # <<<<<<<<<<<<<<
1366  *         timelib_error_container_dtor(error)
1367  *         error = NULL
1368  */
1369   __pyx_t_2 = (__pyx_v_error != 0);
1370   if (__pyx_t_2) {
1371 
1372     /* "timelib.pyx":75
1373  *
1374  *     if error:  # warnings we don't care about
1375  *         timelib_error_container_dtor(error)             # <<<<<<<<<<<<<<
1376  *         error = NULL
1377  *
1378  */
1379     timelib_error_container_dtor(__pyx_v_error);
1380 
1381     /* "timelib.pyx":76
1382  *     if error:  # warnings we don't care about
1383  *         timelib_error_container_dtor(error)
1384  *         error = NULL             # <<<<<<<<<<<<<<
1385  *
1386  *     if now is None:
1387  */
1388     __pyx_v_error = NULL;
1389 
1390     /* "timelib.pyx":74
1391  *         return NULL
1392  *
1393  *     if error:  # warnings we don't care about             # <<<<<<<<<<<<<<
1394  *         timelib_error_container_dtor(error)
1395  *         error = NULL
1396  */
1397   }
1398 
1399   /* "timelib.pyx":78
1400  *         error = NULL
1401  *
1402  *     if now is None:             # <<<<<<<<<<<<<<
1403  *         now = int(time.time())
1404  *     else:
1405  */
1406   __pyx_t_2 = (__pyx_v_now == Py_None);
1407   __pyx_t_3 = (__pyx_t_2 != 0);
1408   if (__pyx_t_3) {
1409 
1410     /* "timelib.pyx":79
1411  *
1412  *     if now is None:
1413  *         now = int(time.time())             # <<<<<<<<<<<<<<
1414  *     else:
1415  *         now = int(now)
1416  */
1417     __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
1418     __Pyx_GOTREF(__pyx_t_5);
1419     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
1420     __Pyx_GOTREF(__pyx_t_7);
1421     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1422     __pyx_t_5 = NULL;
1423     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
1424       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
1425       if (likely(__pyx_t_5)) {
1426         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
1427         __Pyx_INCREF(__pyx_t_5);
1428         __Pyx_INCREF(function);
1429         __Pyx_DECREF_SET(__pyx_t_7, function);
1430       }
1431     }
1432     if (__pyx_t_5) {
1433       __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
1434       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1435     } else {
1436       __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
1437     }
1438     __Pyx_GOTREF(__pyx_t_4);
1439     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1440     __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
1441     __Pyx_GOTREF(__pyx_t_7);
1442     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1443     __Pyx_DECREF_SET(__pyx_v_now, __pyx_t_7);
1444     __pyx_t_7 = 0;
1445 
1446     /* "timelib.pyx":78
1447  *         error = NULL
1448  *
1449  *     if now is None:             # <<<<<<<<<<<<<<
1450  *         now = int(time.time())
1451  *     else:
1452  */
1453     goto __pyx_L7;
1454   }
1455 
1456   /* "timelib.pyx":81
1457  *         now = int(time.time())
1458  *     else:
1459  *         now = int(now)             # <<<<<<<<<<<<<<
1460  *
1461  *     tm_now = timelib_time_ctor()
1462  */
1463   /*else*/ {
1464     __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_now); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error)
1465     __Pyx_GOTREF(__pyx_t_7);
1466     __Pyx_DECREF_SET(__pyx_v_now, __pyx_t_7);
1467     __pyx_t_7 = 0;
1468   }
1469   __pyx_L7:;
1470 
1471   /* "timelib.pyx":83
1472  *         now = int(now)
1473  *
1474  *     tm_now = timelib_time_ctor()             # <<<<<<<<<<<<<<
1475  *
1476  *     # tm_now.sse = now
1477  */
1478   __pyx_v_tm_now = timelib_time_ctor();
1479 
1480   /* "timelib.pyx":88
1481  *     # timelib_update_from_sse(tm_now)
1482  *
1483  *     timelib_unixtime2gmt(tm_now, now)             # <<<<<<<<<<<<<<
1484  *     # timelib_unixtime2local(tm_now, now)
1485  *
1486  */
1487   __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_now); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
1488   timelib_unixtime2gmt(__pyx_v_tm_now, __pyx_t_8);
1489 
1490   /* "timelib.pyx":91
1491  *     # timelib_unixtime2local(tm_now, now)
1492  *
1493  *     timelib_fill_holes(t, tm_now, 0)             # <<<<<<<<<<<<<<
1494  *
1495  *     timelib_update_ts(t, NULL)
1496  */
1497   timelib_fill_holes(__pyx_v_t, __pyx_v_tm_now, 0);
1498 
1499   /* "timelib.pyx":93
1500  *     timelib_fill_holes(t, tm_now, 0)
1501  *
1502  *     timelib_update_ts(t, NULL)             # <<<<<<<<<<<<<<
1503  *     timelib_time_dtor(tm_now)
1504  *     return t
1505  */
1506   timelib_update_ts(__pyx_v_t, NULL);
1507 
1508   /* "timelib.pyx":94
1509  *
1510  *     timelib_update_ts(t, NULL)
1511  *     timelib_time_dtor(tm_now)             # <<<<<<<<<<<<<<
1512  *     return t
1513  *
1514  */
1515   timelib_time_dtor(__pyx_v_tm_now);
1516 
1517   /* "timelib.pyx":95
1518  *     timelib_update_ts(t, NULL)
1519  *     timelib_time_dtor(tm_now)
1520  *     return t             # <<<<<<<<<<<<<<
1521  *
1522  *
1523  */
1524   __pyx_r = __pyx_v_t;
1525   goto __pyx_L0;
1526 
1527   /* "timelib.pyx":57
1528  *     raise ValueError(description)
1529  *
1530  * cdef timelib_time *strtotimelib_time(char *s, now=None) except NULL:             # <<<<<<<<<<<<<<
1531  *     cdef timelib_time *t = NULL
1532  *     cdef timelib_time *tm_now = NULL
1533  */
1534 
1535   /* function exit code */
1536   __pyx_L1_error:;
1537   __Pyx_XDECREF(__pyx_t_4);
1538   __Pyx_XDECREF(__pyx_t_5);
1539   __Pyx_XDECREF(__pyx_t_6);
1540   __Pyx_XDECREF(__pyx_t_7);
1541   __Pyx_AddTraceback("timelib.strtotimelib_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
1542   __pyx_r = NULL;
1543   __pyx_L0:;
1544   __Pyx_XDECREF(__pyx_v_msg);
1545   __Pyx_XDECREF(__pyx_v_now);
1546   __Pyx_RefNannyFinishContext();
1547   return __pyx_r;
1548 }
1549 
1550 /* "timelib.pyx":98
1551  *
1552  *
1553  * def strtodatetime(char *s, now=None):             # <<<<<<<<<<<<<<
1554  *     import datetime
1555  *     cdef timelib_time *t
1556  */
1557 
1558 /* Python wrapper */
1559 static PyObject *__pyx_pw_7timelib_3strtodatetime(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1560 static PyMethodDef __pyx_mdef_7timelib_3strtodatetime = {"strtodatetime", (PyCFunction)__pyx_pw_7timelib_3strtodatetime, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_7timelib_3strtodatetime(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1561 static PyObject *__pyx_pw_7timelib_3strtodatetime(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1562   char *__pyx_v_s;
1563   PyObject *__pyx_v_now = 0;
1564   PyObject *__pyx_r = 0;
1565   __Pyx_RefNannyDeclarations
1566   __Pyx_RefNannySetupContext("strtodatetime (wrapper)", 0);
1567   {
1568     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_now,0};
1569     PyObject* values[2] = {0,0};
1570     values[1] = ((PyObject *)Py_None);
1571     if (unlikely(__pyx_kwds)) {
1572       Py_ssize_t kw_args;
1573       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1574       switch (pos_args) {
1575         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1576         CYTHON_FALLTHROUGH;
1577         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1578         CYTHON_FALLTHROUGH;
1579         case  0: break;
1580         default: goto __pyx_L5_argtuple_error;
1581       }
1582       kw_args = PyDict_Size(__pyx_kwds);
1583       switch (pos_args) {
1584         case  0:
1585         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
1586         else goto __pyx_L5_argtuple_error;
1587         CYTHON_FALLTHROUGH;
1588         case  1:
1589         if (kw_args > 0) {
1590           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_now);
1591           if (value) { values[1] = value; kw_args--; }
1592         }
1593       }
1594       if (unlikely(kw_args > 0)) {
1595         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strtodatetime") < 0)) __PYX_ERR(0, 98, __pyx_L3_error)
1596       }
1597     } else {
1598       switch (PyTuple_GET_SIZE(__pyx_args)) {
1599         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1600         CYTHON_FALLTHROUGH;
1601         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1602         break;
1603         default: goto __pyx_L5_argtuple_error;
1604       }
1605     }
1606     __pyx_v_s = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_s) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
1607     __pyx_v_now = values[1];
1608   }
1609   goto __pyx_L4_argument_unpacking_done;
1610   __pyx_L5_argtuple_error:;
1611   __Pyx_RaiseArgtupleInvalid("strtodatetime", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 98, __pyx_L3_error)
1612   __pyx_L3_error:;
1613   __Pyx_AddTraceback("timelib.strtodatetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
1614   __Pyx_RefNannyFinishContext();
1615   return NULL;
1616   __pyx_L4_argument_unpacking_done:;
1617   __pyx_r = __pyx_pf_7timelib_2strtodatetime(__pyx_self, __pyx_v_s, __pyx_v_now);
1618 
1619   /* function exit code */
1620   __Pyx_RefNannyFinishContext();
1621   return __pyx_r;
1622 }
1623 
__pyx_pf_7timelib_2strtodatetime(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_s,PyObject * __pyx_v_now)1624 static PyObject *__pyx_pf_7timelib_2strtodatetime(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_s, PyObject *__pyx_v_now) {
1625   PyObject *__pyx_v_datetime = NULL;
1626   struct timelib_time *__pyx_v_t;
1627   PyObject *__pyx_v_retval = NULL;
1628   PyObject *__pyx_r = NULL;
1629   __Pyx_RefNannyDeclarations
1630   PyObject *__pyx_t_1 = NULL;
1631   struct timelib_time *__pyx_t_2;
1632   struct __pyx_opt_args_7timelib_strtotimelib_time __pyx_t_3;
1633   PyObject *__pyx_t_4 = NULL;
1634   PyObject *__pyx_t_5 = NULL;
1635   PyObject *__pyx_t_6 = NULL;
1636   PyObject *__pyx_t_7 = NULL;
1637   PyObject *__pyx_t_8 = NULL;
1638   PyObject *__pyx_t_9 = NULL;
1639   PyObject *__pyx_t_10 = NULL;
1640   PyObject *__pyx_t_11 = NULL;
1641   int __pyx_t_12;
1642   PyObject *__pyx_t_13 = NULL;
1643   int __pyx_t_14;
1644   __Pyx_RefNannySetupContext("strtodatetime", 0);
1645 
1646   /* "timelib.pyx":99
1647  *
1648  * def strtodatetime(char *s, now=None):
1649  *     import datetime             # <<<<<<<<<<<<<<
1650  *     cdef timelib_time *t
1651  *     t = strtotimelib_time(s, now)
1652  */
1653   __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
1654   __Pyx_GOTREF(__pyx_t_1);
1655   __pyx_v_datetime = __pyx_t_1;
1656   __pyx_t_1 = 0;
1657 
1658   /* "timelib.pyx":101
1659  *     import datetime
1660  *     cdef timelib_time *t
1661  *     t = strtotimelib_time(s, now)             # <<<<<<<<<<<<<<
1662  *
1663  *     retval = datetime.datetime(t.y, t.m, t.d, t.h, t.i, t.s)
1664  */
1665   __pyx_t_3.__pyx_n = 1;
1666   __pyx_t_3.now = __pyx_v_now;
1667   __pyx_t_2 = __pyx_f_7timelib_strtotimelib_time(__pyx_v_s, &__pyx_t_3); if (unlikely(__pyx_t_2 == ((struct timelib_time *)NULL))) __PYX_ERR(0, 101, __pyx_L1_error)
1668   __pyx_v_t = __pyx_t_2;
1669 
1670   /* "timelib.pyx":103
1671  *     t = strtotimelib_time(s, now)
1672  *
1673  *     retval = datetime.datetime(t.y, t.m, t.d, t.h, t.i, t.s)             # <<<<<<<<<<<<<<
1674  *     if t:
1675  *         timelib_time_dtor(t)
1676  */
1677   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_datetime, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
1678   __Pyx_GOTREF(__pyx_t_4);
1679   __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_t->y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error)
1680   __Pyx_GOTREF(__pyx_t_5);
1681   __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_t->m); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L1_error)
1682   __Pyx_GOTREF(__pyx_t_6);
1683   __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_t->d); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error)
1684   __Pyx_GOTREF(__pyx_t_7);
1685   __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_t->h); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L1_error)
1686   __Pyx_GOTREF(__pyx_t_8);
1687   __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_t->i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 103, __pyx_L1_error)
1688   __Pyx_GOTREF(__pyx_t_9);
1689   __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_t->s); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 103, __pyx_L1_error)
1690   __Pyx_GOTREF(__pyx_t_10);
1691   __pyx_t_11 = NULL;
1692   __pyx_t_12 = 0;
1693   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
1694     __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
1695     if (likely(__pyx_t_11)) {
1696       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
1697       __Pyx_INCREF(__pyx_t_11);
1698       __Pyx_INCREF(function);
1699       __Pyx_DECREF_SET(__pyx_t_4, function);
1700       __pyx_t_12 = 1;
1701     }
1702   }
1703   #if CYTHON_FAST_PYCALL
1704   if (PyFunction_Check(__pyx_t_4)) {
1705     PyObject *__pyx_temp[7] = {__pyx_t_11, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10};
1706     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
1707     __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
1708     __Pyx_GOTREF(__pyx_t_1);
1709     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1710     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1711     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1712     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1713     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
1714     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
1715   } else
1716   #endif
1717   #if CYTHON_FAST_PYCCALL
1718   if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
1719     PyObject *__pyx_temp[7] = {__pyx_t_11, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10};
1720     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
1721     __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
1722     __Pyx_GOTREF(__pyx_t_1);
1723     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1724     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1725     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1726     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1727     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
1728     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
1729   } else
1730   #endif
1731   {
1732     __pyx_t_13 = PyTuple_New(6+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 103, __pyx_L1_error)
1733     __Pyx_GOTREF(__pyx_t_13);
1734     if (__pyx_t_11) {
1735       __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
1736     }
1737     __Pyx_GIVEREF(__pyx_t_5);
1738     PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_5);
1739     __Pyx_GIVEREF(__pyx_t_6);
1740     PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_6);
1741     __Pyx_GIVEREF(__pyx_t_7);
1742     PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_7);
1743     __Pyx_GIVEREF(__pyx_t_8);
1744     PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_12, __pyx_t_8);
1745     __Pyx_GIVEREF(__pyx_t_9);
1746     PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_12, __pyx_t_9);
1747     __Pyx_GIVEREF(__pyx_t_10);
1748     PyTuple_SET_ITEM(__pyx_t_13, 5+__pyx_t_12, __pyx_t_10);
1749     __pyx_t_5 = 0;
1750     __pyx_t_6 = 0;
1751     __pyx_t_7 = 0;
1752     __pyx_t_8 = 0;
1753     __pyx_t_9 = 0;
1754     __pyx_t_10 = 0;
1755     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
1756     __Pyx_GOTREF(__pyx_t_1);
1757     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
1758   }
1759   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1760   __pyx_v_retval = __pyx_t_1;
1761   __pyx_t_1 = 0;
1762 
1763   /* "timelib.pyx":104
1764  *
1765  *     retval = datetime.datetime(t.y, t.m, t.d, t.h, t.i, t.s)
1766  *     if t:             # <<<<<<<<<<<<<<
1767  *         timelib_time_dtor(t)
1768  *
1769  */
1770   __pyx_t_14 = (__pyx_v_t != 0);
1771   if (__pyx_t_14) {
1772 
1773     /* "timelib.pyx":105
1774  *     retval = datetime.datetime(t.y, t.m, t.d, t.h, t.i, t.s)
1775  *     if t:
1776  *         timelib_time_dtor(t)             # <<<<<<<<<<<<<<
1777  *
1778  *     return retval
1779  */
1780     timelib_time_dtor(__pyx_v_t);
1781 
1782     /* "timelib.pyx":104
1783  *
1784  *     retval = datetime.datetime(t.y, t.m, t.d, t.h, t.i, t.s)
1785  *     if t:             # <<<<<<<<<<<<<<
1786  *         timelib_time_dtor(t)
1787  *
1788  */
1789   }
1790 
1791   /* "timelib.pyx":107
1792  *         timelib_time_dtor(t)
1793  *
1794  *     return retval             # <<<<<<<<<<<<<<
1795  *
1796  *
1797  */
1798   __Pyx_XDECREF(__pyx_r);
1799   __Pyx_INCREF(__pyx_v_retval);
1800   __pyx_r = __pyx_v_retval;
1801   goto __pyx_L0;
1802 
1803   /* "timelib.pyx":98
1804  *
1805  *
1806  * def strtodatetime(char *s, now=None):             # <<<<<<<<<<<<<<
1807  *     import datetime
1808  *     cdef timelib_time *t
1809  */
1810 
1811   /* function exit code */
1812   __pyx_L1_error:;
1813   __Pyx_XDECREF(__pyx_t_1);
1814   __Pyx_XDECREF(__pyx_t_4);
1815   __Pyx_XDECREF(__pyx_t_5);
1816   __Pyx_XDECREF(__pyx_t_6);
1817   __Pyx_XDECREF(__pyx_t_7);
1818   __Pyx_XDECREF(__pyx_t_8);
1819   __Pyx_XDECREF(__pyx_t_9);
1820   __Pyx_XDECREF(__pyx_t_10);
1821   __Pyx_XDECREF(__pyx_t_11);
1822   __Pyx_XDECREF(__pyx_t_13);
1823   __Pyx_AddTraceback("timelib.strtodatetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
1824   __pyx_r = NULL;
1825   __pyx_L0:;
1826   __Pyx_XDECREF(__pyx_v_datetime);
1827   __Pyx_XDECREF(__pyx_v_retval);
1828   __Pyx_XGIVEREF(__pyx_r);
1829   __Pyx_RefNannyFinishContext();
1830   return __pyx_r;
1831 }
1832 
1833 /* "timelib.pyx":110
1834  *
1835  *
1836  * def strtotime(char *s, now=None):             # <<<<<<<<<<<<<<
1837  *     cdef timelib_time *t
1838  *     t = strtotimelib_time(s, now)
1839  */
1840 
1841 /* Python wrapper */
1842 static PyObject *__pyx_pw_7timelib_5strtotime(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1843 static PyMethodDef __pyx_mdef_7timelib_5strtotime = {"strtotime", (PyCFunction)__pyx_pw_7timelib_5strtotime, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_7timelib_5strtotime(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1844 static PyObject *__pyx_pw_7timelib_5strtotime(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1845   char *__pyx_v_s;
1846   PyObject *__pyx_v_now = 0;
1847   PyObject *__pyx_r = 0;
1848   __Pyx_RefNannyDeclarations
1849   __Pyx_RefNannySetupContext("strtotime (wrapper)", 0);
1850   {
1851     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_now,0};
1852     PyObject* values[2] = {0,0};
1853     values[1] = ((PyObject *)Py_None);
1854     if (unlikely(__pyx_kwds)) {
1855       Py_ssize_t kw_args;
1856       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1857       switch (pos_args) {
1858         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1859         CYTHON_FALLTHROUGH;
1860         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1861         CYTHON_FALLTHROUGH;
1862         case  0: break;
1863         default: goto __pyx_L5_argtuple_error;
1864       }
1865       kw_args = PyDict_Size(__pyx_kwds);
1866       switch (pos_args) {
1867         case  0:
1868         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
1869         else goto __pyx_L5_argtuple_error;
1870         CYTHON_FALLTHROUGH;
1871         case  1:
1872         if (kw_args > 0) {
1873           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_now);
1874           if (value) { values[1] = value; kw_args--; }
1875         }
1876       }
1877       if (unlikely(kw_args > 0)) {
1878         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strtotime") < 0)) __PYX_ERR(0, 110, __pyx_L3_error)
1879       }
1880     } else {
1881       switch (PyTuple_GET_SIZE(__pyx_args)) {
1882         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1883         CYTHON_FALLTHROUGH;
1884         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1885         break;
1886         default: goto __pyx_L5_argtuple_error;
1887       }
1888     }
1889     __pyx_v_s = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_s) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error)
1890     __pyx_v_now = values[1];
1891   }
1892   goto __pyx_L4_argument_unpacking_done;
1893   __pyx_L5_argtuple_error:;
1894   __Pyx_RaiseArgtupleInvalid("strtotime", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 110, __pyx_L3_error)
1895   __pyx_L3_error:;
1896   __Pyx_AddTraceback("timelib.strtotime", __pyx_clineno, __pyx_lineno, __pyx_filename);
1897   __Pyx_RefNannyFinishContext();
1898   return NULL;
1899   __pyx_L4_argument_unpacking_done:;
1900   __pyx_r = __pyx_pf_7timelib_4strtotime(__pyx_self, __pyx_v_s, __pyx_v_now);
1901 
1902   /* function exit code */
1903   __Pyx_RefNannyFinishContext();
1904   return __pyx_r;
1905 }
1906 
__pyx_pf_7timelib_4strtotime(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_s,PyObject * __pyx_v_now)1907 static PyObject *__pyx_pf_7timelib_4strtotime(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_s, PyObject *__pyx_v_now) {
1908   struct timelib_time *__pyx_v_t;
1909   long __pyx_v_retval;
1910   PyObject *__pyx_r = NULL;
1911   __Pyx_RefNannyDeclarations
1912   struct timelib_time *__pyx_t_1;
1913   struct __pyx_opt_args_7timelib_strtotimelib_time __pyx_t_2;
1914   long __pyx_t_3;
1915   PyObject *__pyx_t_4 = NULL;
1916   __Pyx_RefNannySetupContext("strtotime", 0);
1917 
1918   /* "timelib.pyx":112
1919  * def strtotime(char *s, now=None):
1920  *     cdef timelib_time *t
1921  *     t = strtotimelib_time(s, now)             # <<<<<<<<<<<<<<
1922  *     retval = t.sse
1923  *     timelib_time_dtor(t)
1924  */
1925   __pyx_t_2.__pyx_n = 1;
1926   __pyx_t_2.now = __pyx_v_now;
1927   __pyx_t_1 = __pyx_f_7timelib_strtotimelib_time(__pyx_v_s, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((struct timelib_time *)NULL))) __PYX_ERR(0, 112, __pyx_L1_error)
1928   __pyx_v_t = __pyx_t_1;
1929 
1930   /* "timelib.pyx":113
1931  *     cdef timelib_time *t
1932  *     t = strtotimelib_time(s, now)
1933  *     retval = t.sse             # <<<<<<<<<<<<<<
1934  *     timelib_time_dtor(t)
1935  *     return retval
1936  */
1937   __pyx_t_3 = __pyx_v_t->sse;
1938   __pyx_v_retval = __pyx_t_3;
1939 
1940   /* "timelib.pyx":114
1941  *     t = strtotimelib_time(s, now)
1942  *     retval = t.sse
1943  *     timelib_time_dtor(t)             # <<<<<<<<<<<<<<
1944  *     return retval
1945  */
1946   timelib_time_dtor(__pyx_v_t);
1947 
1948   /* "timelib.pyx":115
1949  *     retval = t.sse
1950  *     timelib_time_dtor(t)
1951  *     return retval             # <<<<<<<<<<<<<<
1952  */
1953   __Pyx_XDECREF(__pyx_r);
1954   __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_retval); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
1955   __Pyx_GOTREF(__pyx_t_4);
1956   __pyx_r = __pyx_t_4;
1957   __pyx_t_4 = 0;
1958   goto __pyx_L0;
1959 
1960   /* "timelib.pyx":110
1961  *
1962  *
1963  * def strtotime(char *s, now=None):             # <<<<<<<<<<<<<<
1964  *     cdef timelib_time *t
1965  *     t = strtotimelib_time(s, now)
1966  */
1967 
1968   /* function exit code */
1969   __pyx_L1_error:;
1970   __Pyx_XDECREF(__pyx_t_4);
1971   __Pyx_AddTraceback("timelib.strtotime", __pyx_clineno, __pyx_lineno, __pyx_filename);
1972   __pyx_r = NULL;
1973   __pyx_L0:;
1974   __Pyx_XGIVEREF(__pyx_r);
1975   __Pyx_RefNannyFinishContext();
1976   return __pyx_r;
1977 }
1978 
1979 static PyMethodDef __pyx_methods[] = {
1980   {0, 0, 0, 0}
1981 };
1982 
1983 #if PY_MAJOR_VERSION >= 3
1984 #if CYTHON_PEP489_MULTI_PHASE_INIT
1985 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
1986 static int __pyx_pymod_exec_timelib(PyObject* module); /*proto*/
1987 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
1988   {Py_mod_create, (void*)__pyx_pymod_create},
1989   {Py_mod_exec, (void*)__pyx_pymod_exec_timelib},
1990   {0, NULL}
1991 };
1992 #endif
1993 
1994 static struct PyModuleDef __pyx_moduledef = {
1995     PyModuleDef_HEAD_INIT,
1996     "timelib",
1997     0, /* m_doc */
1998   #if CYTHON_PEP489_MULTI_PHASE_INIT
1999     0, /* m_size */
2000   #else
2001     -1, /* m_size */
2002   #endif
2003     __pyx_methods /* m_methods */,
2004   #if CYTHON_PEP489_MULTI_PHASE_INIT
2005     __pyx_moduledef_slots, /* m_slots */
2006   #else
2007     NULL, /* m_reload */
2008   #endif
2009     NULL, /* m_traverse */
2010     NULL, /* m_clear */
2011     NULL /* m_free */
2012 };
2013 #endif
2014 
2015 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2016   {&__pyx_kp_s_0_2_4, __pyx_k_0_2_4, sizeof(__pyx_k_0_2_4), 0, 0, 1, 0},
2017   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
2018   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2019   {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
2020   {&__pyx_n_s_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 0, 1, 1},
2021   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
2022   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
2023   {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
2024   {&__pyx_n_s_raise_error, __pyx_k_raise_error, sizeof(__pyx_k_raise_error), 0, 0, 1, 1},
2025   {&__pyx_n_s_retval, __pyx_k_retval, sizeof(__pyx_k_retval), 0, 0, 1, 1},
2026   {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
2027   {&__pyx_n_s_strtodatetime, __pyx_k_strtodatetime, sizeof(__pyx_k_strtodatetime), 0, 0, 1, 1},
2028   {&__pyx_n_s_strtotime, __pyx_k_strtotime, sizeof(__pyx_k_strtotime), 0, 0, 1, 1},
2029   {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
2030   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
2031   {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
2032   {&__pyx_n_s_timelib, __pyx_k_timelib, sizeof(__pyx_k_timelib), 0, 0, 1, 1},
2033   {&__pyx_kp_s_timelib_pyx, __pyx_k_timelib_pyx, sizeof(__pyx_k_timelib_pyx), 0, 0, 1, 0},
2034   {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
2035   {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
2036   {&__pyx_kp_s_while_parsing_date_r, __pyx_k_while_parsing_date_r, sizeof(__pyx_k_while_parsing_date_r), 0, 0, 1, 0},
2037   {0, 0, 0, 0, 0, 0, 0}
2038 };
__Pyx_InitCachedBuiltins(void)2039 static int __Pyx_InitCachedBuiltins(void) {
2040   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 55, __pyx_L1_error)
2041   return 0;
2042   __pyx_L1_error:;
2043   return -1;
2044 }
2045 
__Pyx_InitCachedConstants(void)2046 static int __Pyx_InitCachedConstants(void) {
2047   __Pyx_RefNannyDeclarations
2048   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
2049 
2050   /* "timelib.pyx":5
2051  *
2052  * version = "0.2.4"
2053  * version_info = (0, 2, 4)             # <<<<<<<<<<<<<<
2054  *
2055  * cdef extern from "timelib.h":
2056  */
2057   __pyx_tuple_ = PyTuple_Pack(3, __pyx_int_0, __pyx_int_2, __pyx_int_4); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 5, __pyx_L1_error)
2058   __Pyx_GOTREF(__pyx_tuple_);
2059   __Pyx_GIVEREF(__pyx_tuple_);
2060 
2061   /* "timelib.pyx":54
2062  *
2063  *
2064  * def _raise_error(description):             # <<<<<<<<<<<<<<
2065  *     raise ValueError(description)
2066  *
2067  */
2068   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_description); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 54, __pyx_L1_error)
2069   __Pyx_GOTREF(__pyx_tuple__2);
2070   __Pyx_GIVEREF(__pyx_tuple__2);
2071   __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_timelib_pyx, __pyx_n_s_raise_error, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 54, __pyx_L1_error)
2072 
2073   /* "timelib.pyx":98
2074  *
2075  *
2076  * def strtodatetime(char *s, now=None):             # <<<<<<<<<<<<<<
2077  *     import datetime
2078  *     cdef timelib_time *t
2079  */
2080   __pyx_tuple__4 = PyTuple_Pack(5, __pyx_n_s_s, __pyx_n_s_now, __pyx_n_s_datetime, __pyx_n_s_t, __pyx_n_s_retval); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 98, __pyx_L1_error)
2081   __Pyx_GOTREF(__pyx_tuple__4);
2082   __Pyx_GIVEREF(__pyx_tuple__4);
2083   __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_timelib_pyx, __pyx_n_s_strtodatetime, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 98, __pyx_L1_error)
2084 
2085   /* "timelib.pyx":110
2086  *
2087  *
2088  * def strtotime(char *s, now=None):             # <<<<<<<<<<<<<<
2089  *     cdef timelib_time *t
2090  *     t = strtotimelib_time(s, now)
2091  */
2092   __pyx_tuple__6 = PyTuple_Pack(4, __pyx_n_s_s, __pyx_n_s_now, __pyx_n_s_t, __pyx_n_s_retval); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 110, __pyx_L1_error)
2093   __Pyx_GOTREF(__pyx_tuple__6);
2094   __Pyx_GIVEREF(__pyx_tuple__6);
2095   __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_timelib_pyx, __pyx_n_s_strtotime, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 110, __pyx_L1_error)
2096   __Pyx_RefNannyFinishContext();
2097   return 0;
2098   __pyx_L1_error:;
2099   __Pyx_RefNannyFinishContext();
2100   return -1;
2101 }
2102 
__Pyx_InitGlobals(void)2103 static int __Pyx_InitGlobals(void) {
2104   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
2105   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
2106   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 2, __pyx_L1_error)
2107   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 2, __pyx_L1_error)
2108   return 0;
2109   __pyx_L1_error:;
2110   return -1;
2111 }
2112 
2113 static int __Pyx_modinit_global_init_code(void); /*proto*/
2114 static int __Pyx_modinit_variable_export_code(void); /*proto*/
2115 static int __Pyx_modinit_function_export_code(void); /*proto*/
2116 static int __Pyx_modinit_type_init_code(void); /*proto*/
2117 static int __Pyx_modinit_type_import_code(void); /*proto*/
2118 static int __Pyx_modinit_variable_import_code(void); /*proto*/
2119 static int __Pyx_modinit_function_import_code(void); /*proto*/
2120 
__Pyx_modinit_global_init_code(void)2121 static int __Pyx_modinit_global_init_code(void) {
2122   __Pyx_RefNannyDeclarations
2123   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
2124   /*--- Global init code ---*/
2125   __Pyx_RefNannyFinishContext();
2126   return 0;
2127 }
2128 
__Pyx_modinit_variable_export_code(void)2129 static int __Pyx_modinit_variable_export_code(void) {
2130   __Pyx_RefNannyDeclarations
2131   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
2132   /*--- Variable export code ---*/
2133   __Pyx_RefNannyFinishContext();
2134   return 0;
2135 }
2136 
__Pyx_modinit_function_export_code(void)2137 static int __Pyx_modinit_function_export_code(void) {
2138   __Pyx_RefNannyDeclarations
2139   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
2140   /*--- Function export code ---*/
2141   __Pyx_RefNannyFinishContext();
2142   return 0;
2143 }
2144 
__Pyx_modinit_type_init_code(void)2145 static int __Pyx_modinit_type_init_code(void) {
2146   __Pyx_RefNannyDeclarations
2147   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
2148   /*--- Type init code ---*/
2149   __Pyx_RefNannyFinishContext();
2150   return 0;
2151 }
2152 
__Pyx_modinit_type_import_code(void)2153 static int __Pyx_modinit_type_import_code(void) {
2154   __Pyx_RefNannyDeclarations
2155   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
2156   /*--- Type import code ---*/
2157   __Pyx_RefNannyFinishContext();
2158   return 0;
2159 }
2160 
__Pyx_modinit_variable_import_code(void)2161 static int __Pyx_modinit_variable_import_code(void) {
2162   __Pyx_RefNannyDeclarations
2163   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
2164   /*--- Variable import code ---*/
2165   __Pyx_RefNannyFinishContext();
2166   return 0;
2167 }
2168 
__Pyx_modinit_function_import_code(void)2169 static int __Pyx_modinit_function_import_code(void) {
2170   __Pyx_RefNannyDeclarations
2171   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
2172   /*--- Function import code ---*/
2173   __Pyx_RefNannyFinishContext();
2174   return 0;
2175 }
2176 
2177 
2178 #if PY_MAJOR_VERSION < 3
2179 #ifdef CYTHON_NO_PYINIT_EXPORT
2180 #define __Pyx_PyMODINIT_FUNC void
2181 #else
2182 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2183 #endif
2184 #else
2185 #ifdef CYTHON_NO_PYINIT_EXPORT
2186 #define __Pyx_PyMODINIT_FUNC PyObject *
2187 #else
2188 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2189 #endif
2190 #endif
2191 #ifndef CYTHON_SMALL_CODE
2192 #if defined(__clang__)
2193     #define CYTHON_SMALL_CODE
2194 #elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
2195     #define CYTHON_SMALL_CODE __attribute__((cold))
2196 #else
2197     #define CYTHON_SMALL_CODE
2198 #endif
2199 #endif
2200 
2201 
2202 #if PY_MAJOR_VERSION < 3
2203 __Pyx_PyMODINIT_FUNC inittimelib(void) CYTHON_SMALL_CODE; /*proto*/
inittimelib(void)2204 __Pyx_PyMODINIT_FUNC inittimelib(void)
2205 #else
2206 __Pyx_PyMODINIT_FUNC PyInit_timelib(void) CYTHON_SMALL_CODE; /*proto*/
2207 __Pyx_PyMODINIT_FUNC PyInit_timelib(void)
2208 #if CYTHON_PEP489_MULTI_PHASE_INIT
2209 {
2210   return PyModuleDef_Init(&__pyx_moduledef);
2211 }
2212 static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
2213     PyObject *value = PyObject_GetAttrString(spec, from_name);
2214     int result = 0;
2215     if (likely(value)) {
2216         result = PyDict_SetItemString(moddict, to_name, value);
2217         Py_DECREF(value);
2218     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
2219         PyErr_Clear();
2220     } else {
2221         result = -1;
2222     }
2223     return result;
2224 }
2225 static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
2226     PyObject *module = NULL, *moddict, *modname;
2227     if (__pyx_m)
2228         return __Pyx_NewRef(__pyx_m);
2229     modname = PyObject_GetAttrString(spec, "name");
2230     if (unlikely(!modname)) goto bad;
2231     module = PyModule_NewObject(modname);
2232     Py_DECREF(modname);
2233     if (unlikely(!module)) goto bad;
2234     moddict = PyModule_GetDict(module);
2235     if (unlikely(!moddict)) goto bad;
2236     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
2237     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
2238     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
2239     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
2240     return module;
2241 bad:
2242     Py_XDECREF(module);
2243     return NULL;
2244 }
2245 
2246 
2247 static int __pyx_pymod_exec_timelib(PyObject *__pyx_pyinit_module)
2248 #endif
2249 #endif
2250 {
2251   PyObject *__pyx_t_1 = NULL;
2252   __Pyx_RefNannyDeclarations
2253   #if CYTHON_PEP489_MULTI_PHASE_INIT
2254   if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
2255   #elif PY_MAJOR_VERSION >= 3
2256   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
2257   #endif
2258   #if CYTHON_REFNANNY
2259 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
2260 if (!__Pyx_RefNanny) {
2261   PyErr_Clear();
2262   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
2263   if (!__Pyx_RefNanny)
2264       Py_FatalError("failed to import 'refnanny' module");
2265 }
2266 #endif
2267   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_timelib(void)", 0);
2268   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2269   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
2270   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
2271   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
2272   #ifdef __Pyx_CyFunction_USED
2273   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2274   #endif
2275   #ifdef __Pyx_FusedFunction_USED
2276   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2277   #endif
2278   #ifdef __Pyx_Coroutine_USED
2279   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2280   #endif
2281   #ifdef __Pyx_Generator_USED
2282   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2283   #endif
2284   #ifdef __Pyx_AsyncGen_USED
2285   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2286   #endif
2287   #ifdef __Pyx_StopAsyncIteration_USED
2288   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2289   #endif
2290   /*--- Library function declarations ---*/
2291   /*--- Threads initialization code ---*/
2292   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
2293   #ifdef WITH_THREAD /* Python build with threading support? */
2294   PyEval_InitThreads();
2295   #endif
2296   #endif
2297   /*--- Module creation code ---*/
2298   #if CYTHON_PEP489_MULTI_PHASE_INIT
2299   __pyx_m = __pyx_pyinit_module;
2300   Py_INCREF(__pyx_m);
2301   #else
2302   #if PY_MAJOR_VERSION < 3
2303   __pyx_m = Py_InitModule4("timelib", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
2304   #else
2305   __pyx_m = PyModule_Create(&__pyx_moduledef);
2306   #endif
2307   if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
2308   #endif
2309   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
2310   Py_INCREF(__pyx_d);
2311   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
2312   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
2313   #if CYTHON_COMPILING_IN_PYPY
2314   Py_INCREF(__pyx_b);
2315   #endif
2316   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
2317   /*--- Initialize various global constants etc. ---*/
2318   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2319   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
2320   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2321   #endif
2322   if (__pyx_module_is_main_timelib) {
2323     if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2324   }
2325   #if PY_MAJOR_VERSION >= 3
2326   {
2327     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
2328     if (!PyDict_GetItemString(modules, "timelib")) {
2329       if (unlikely(PyDict_SetItemString(modules, "timelib", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
2330     }
2331   }
2332   #endif
2333   /*--- Builtin init code ---*/
2334   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2335   /*--- Constants init code ---*/
2336   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2337   /*--- Global type/function init code ---*/
2338   (void)__Pyx_modinit_global_init_code();
2339   (void)__Pyx_modinit_variable_export_code();
2340   (void)__Pyx_modinit_function_export_code();
2341   (void)__Pyx_modinit_type_init_code();
2342   (void)__Pyx_modinit_type_import_code();
2343   (void)__Pyx_modinit_variable_import_code();
2344   (void)__Pyx_modinit_function_import_code();
2345   /*--- Execution code ---*/
2346   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2347   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2348   #endif
2349 
2350   /* "timelib.pyx":2
2351  *
2352  * import time, datetime             # <<<<<<<<<<<<<<
2353  *
2354  * version = "0.2.4"
2355  */
2356   __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
2357   __Pyx_GOTREF(__pyx_t_1);
2358   if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2359   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2360   __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
2361   __Pyx_GOTREF(__pyx_t_1);
2362   if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2363   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2364 
2365   /* "timelib.pyx":4
2366  * import time, datetime
2367  *
2368  * version = "0.2.4"             # <<<<<<<<<<<<<<
2369  * version_info = (0, 2, 4)
2370  *
2371  */
2372   if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_2_4) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
2373 
2374   /* "timelib.pyx":5
2375  *
2376  * version = "0.2.4"
2377  * version_info = (0, 2, 4)             # <<<<<<<<<<<<<<
2378  *
2379  * cdef extern from "timelib.h":
2380  */
2381   if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_info, __pyx_tuple_) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
2382 
2383   /* "timelib.pyx":54
2384  *
2385  *
2386  * def _raise_error(description):             # <<<<<<<<<<<<<<
2387  *     raise ValueError(description)
2388  *
2389  */
2390   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7timelib_1_raise_error, NULL, __pyx_n_s_timelib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
2391   __Pyx_GOTREF(__pyx_t_1);
2392   if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_error, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
2393   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2394 
2395   /* "timelib.pyx":98
2396  *
2397  *
2398  * def strtodatetime(char *s, now=None):             # <<<<<<<<<<<<<<
2399  *     import datetime
2400  *     cdef timelib_time *t
2401  */
2402   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7timelib_3strtodatetime, NULL, __pyx_n_s_timelib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
2403   __Pyx_GOTREF(__pyx_t_1);
2404   if (PyDict_SetItem(__pyx_d, __pyx_n_s_strtodatetime, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
2405   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2406 
2407   /* "timelib.pyx":110
2408  *
2409  *
2410  * def strtotime(char *s, now=None):             # <<<<<<<<<<<<<<
2411  *     cdef timelib_time *t
2412  *     t = strtotimelib_time(s, now)
2413  */
2414   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7timelib_5strtotime, NULL, __pyx_n_s_timelib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
2415   __Pyx_GOTREF(__pyx_t_1);
2416   if (PyDict_SetItem(__pyx_d, __pyx_n_s_strtotime, __pyx_t_1) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
2417   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2418 
2419   /* "timelib.pyx":2
2420  *
2421  * import time, datetime             # <<<<<<<<<<<<<<
2422  *
2423  * version = "0.2.4"
2424  */
2425   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
2426   __Pyx_GOTREF(__pyx_t_1);
2427   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2428   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2429 
2430   /*--- Wrapped vars code ---*/
2431 
2432   goto __pyx_L0;
2433   __pyx_L1_error:;
2434   __Pyx_XDECREF(__pyx_t_1);
2435   if (__pyx_m) {
2436     if (__pyx_d) {
2437       __Pyx_AddTraceback("init timelib", 0, __pyx_lineno, __pyx_filename);
2438     }
2439     Py_DECREF(__pyx_m); __pyx_m = 0;
2440   } else if (!PyErr_Occurred()) {
2441     PyErr_SetString(PyExc_ImportError, "init timelib");
2442   }
2443   __pyx_L0:;
2444   __Pyx_RefNannyFinishContext();
2445   #if CYTHON_PEP489_MULTI_PHASE_INIT
2446   return (__pyx_m != NULL) ? 0 : -1;
2447   #elif PY_MAJOR_VERSION >= 3
2448   return __pyx_m;
2449   #else
2450   return;
2451   #endif
2452 }
2453 
2454 /* --- Runtime support code --- */
2455 /* Refnanny */
2456 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)2457 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2458     PyObject *m = NULL, *p = NULL;
2459     void *r = NULL;
2460     m = PyImport_ImportModule((char *)modname);
2461     if (!m) goto end;
2462     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
2463     if (!p) goto end;
2464     r = PyLong_AsVoidPtr(p);
2465 end:
2466     Py_XDECREF(p);
2467     Py_XDECREF(m);
2468     return (__Pyx_RefNannyAPIStruct *)r;
2469 }
2470 #endif
2471 
2472 /* PyObjectGetAttrStr */
2473 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)2474 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2475     PyTypeObject* tp = Py_TYPE(obj);
2476     if (likely(tp->tp_getattro))
2477         return tp->tp_getattro(obj, attr_name);
2478 #if PY_MAJOR_VERSION < 3
2479     if (likely(tp->tp_getattr))
2480         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2481 #endif
2482     return PyObject_GetAttr(obj, attr_name);
2483 }
2484 #endif
2485 
2486 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)2487 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
2488     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
2489     if (unlikely(!result)) {
2490         PyErr_Format(PyExc_NameError,
2491 #if PY_MAJOR_VERSION >= 3
2492             "name '%U' is not defined", name);
2493 #else
2494             "name '%.200s' is not defined", PyString_AS_STRING(name));
2495 #endif
2496     }
2497     return result;
2498 }
2499 
2500 /* PyCFunctionFastCall */
2501 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)2502 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
2503     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
2504     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
2505     PyObject *self = PyCFunction_GET_SELF(func);
2506     int flags = PyCFunction_GET_FLAGS(func);
2507     assert(PyCFunction_Check(func));
2508     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
2509     assert(nargs >= 0);
2510     assert(nargs == 0 || args != NULL);
2511     /* _PyCFunction_FastCallDict() must not be called with an exception set,
2512        because it may clear it (directly or indirectly) and so the
2513        caller loses its exception */
2514     assert(!PyErr_Occurred());
2515     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
2516         return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
2517     } else {
2518         return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
2519     }
2520 }
2521 #endif
2522 
2523 /* PyFunctionFastCall */
2524 #if CYTHON_FAST_PYCALL
2525 #include "frameobject.h"
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)2526 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2527                                                PyObject *globals) {
2528     PyFrameObject *f;
2529     PyThreadState *tstate = __Pyx_PyThreadState_Current;
2530     PyObject **fastlocals;
2531     Py_ssize_t i;
2532     PyObject *result;
2533     assert(globals != NULL);
2534     /* XXX Perhaps we should create a specialized
2535        PyFrame_New() that doesn't take locals, but does
2536        take builtins without sanity checking them.
2537        */
2538     assert(tstate != NULL);
2539     f = PyFrame_New(tstate, co, globals, NULL);
2540     if (f == NULL) {
2541         return NULL;
2542     }
2543     fastlocals = f->f_localsplus;
2544     for (i = 0; i < na; i++) {
2545         Py_INCREF(*args);
2546         fastlocals[i] = *args++;
2547     }
2548     result = PyEval_EvalFrameEx(f,0);
2549     ++tstate->recursion_depth;
2550     Py_DECREF(f);
2551     --tstate->recursion_depth;
2552     return result;
2553 }
2554 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,int nargs,PyObject * kwargs)2555 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
2556     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2557     PyObject *globals = PyFunction_GET_GLOBALS(func);
2558     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2559     PyObject *closure;
2560 #if PY_MAJOR_VERSION >= 3
2561     PyObject *kwdefs;
2562 #endif
2563     PyObject *kwtuple, **k;
2564     PyObject **d;
2565     Py_ssize_t nd;
2566     Py_ssize_t nk;
2567     PyObject *result;
2568     assert(kwargs == NULL || PyDict_Check(kwargs));
2569     nk = kwargs ? PyDict_Size(kwargs) : 0;
2570     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
2571         return NULL;
2572     }
2573     if (
2574 #if PY_MAJOR_VERSION >= 3
2575             co->co_kwonlyargcount == 0 &&
2576 #endif
2577             likely(kwargs == NULL || nk == 0) &&
2578             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2579         if (argdefs == NULL && co->co_argcount == nargs) {
2580             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2581             goto done;
2582         }
2583         else if (nargs == 0 && argdefs != NULL
2584                  && co->co_argcount == Py_SIZE(argdefs)) {
2585             /* function called with no arguments, but all parameters have
2586                a default value: use default values as arguments .*/
2587             args = &PyTuple_GET_ITEM(argdefs, 0);
2588             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2589             goto done;
2590         }
2591     }
2592     if (kwargs != NULL) {
2593         Py_ssize_t pos, i;
2594         kwtuple = PyTuple_New(2 * nk);
2595         if (kwtuple == NULL) {
2596             result = NULL;
2597             goto done;
2598         }
2599         k = &PyTuple_GET_ITEM(kwtuple, 0);
2600         pos = i = 0;
2601         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2602             Py_INCREF(k[i]);
2603             Py_INCREF(k[i+1]);
2604             i += 2;
2605         }
2606         nk = i / 2;
2607     }
2608     else {
2609         kwtuple = NULL;
2610         k = NULL;
2611     }
2612     closure = PyFunction_GET_CLOSURE(func);
2613 #if PY_MAJOR_VERSION >= 3
2614     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2615 #endif
2616     if (argdefs != NULL) {
2617         d = &PyTuple_GET_ITEM(argdefs, 0);
2618         nd = Py_SIZE(argdefs);
2619     }
2620     else {
2621         d = NULL;
2622         nd = 0;
2623     }
2624 #if PY_MAJOR_VERSION >= 3
2625     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2626                                args, nargs,
2627                                k, (int)nk,
2628                                d, (int)nd, kwdefs, closure);
2629 #else
2630     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2631                                args, nargs,
2632                                k, (int)nk,
2633                                d, (int)nd, closure);
2634 #endif
2635     Py_XDECREF(kwtuple);
2636 done:
2637     Py_LeaveRecursiveCall();
2638     return result;
2639 }
2640 #endif
2641 #endif
2642 
2643 /* PyObjectCall */
2644 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)2645 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2646     PyObject *result;
2647     ternaryfunc call = func->ob_type->tp_call;
2648     if (unlikely(!call))
2649         return PyObject_Call(func, arg, kw);
2650     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2651         return NULL;
2652     result = (*call)(func, arg, kw);
2653     Py_LeaveRecursiveCall();
2654     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2655         PyErr_SetString(
2656             PyExc_SystemError,
2657             "NULL result without error in PyObject_Call");
2658     }
2659     return result;
2660 }
2661 #endif
2662 
2663 /* PyObjectCallMethO */
2664 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)2665 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2666     PyObject *self, *result;
2667     PyCFunction cfunc;
2668     cfunc = PyCFunction_GET_FUNCTION(func);
2669     self = PyCFunction_GET_SELF(func);
2670     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2671         return NULL;
2672     result = cfunc(self, arg);
2673     Py_LeaveRecursiveCall();
2674     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2675         PyErr_SetString(
2676             PyExc_SystemError,
2677             "NULL result without error in PyObject_Call");
2678     }
2679     return result;
2680 }
2681 #endif
2682 
2683 /* PyObjectCallOneArg */
2684 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)2685 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2686     PyObject *result;
2687     PyObject *args = PyTuple_New(1);
2688     if (unlikely(!args)) return NULL;
2689     Py_INCREF(arg);
2690     PyTuple_SET_ITEM(args, 0, arg);
2691     result = __Pyx_PyObject_Call(func, args, NULL);
2692     Py_DECREF(args);
2693     return result;
2694 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2695 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2696 #if CYTHON_FAST_PYCALL
2697     if (PyFunction_Check(func)) {
2698         return __Pyx_PyFunction_FastCall(func, &arg, 1);
2699     }
2700 #endif
2701     if (likely(PyCFunction_Check(func))) {
2702         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
2703             return __Pyx_PyObject_CallMethO(func, arg);
2704 #if CYTHON_FAST_PYCCALL
2705         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
2706             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
2707 #endif
2708         }
2709     }
2710     return __Pyx__PyObject_CallOneArg(func, arg);
2711 }
2712 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2713 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2714     PyObject *result;
2715     PyObject *args = PyTuple_Pack(1, arg);
2716     if (unlikely(!args)) return NULL;
2717     result = __Pyx_PyObject_Call(func, args, NULL);
2718     Py_DECREF(args);
2719     return result;
2720 }
2721 #endif
2722 
2723 /* PyErrFetchRestore */
2724 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)2725 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2726     PyObject *tmp_type, *tmp_value, *tmp_tb;
2727     tmp_type = tstate->curexc_type;
2728     tmp_value = tstate->curexc_value;
2729     tmp_tb = tstate->curexc_traceback;
2730     tstate->curexc_type = type;
2731     tstate->curexc_value = value;
2732     tstate->curexc_traceback = tb;
2733     Py_XDECREF(tmp_type);
2734     Py_XDECREF(tmp_value);
2735     Py_XDECREF(tmp_tb);
2736 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)2737 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2738     *type = tstate->curexc_type;
2739     *value = tstate->curexc_value;
2740     *tb = tstate->curexc_traceback;
2741     tstate->curexc_type = 0;
2742     tstate->curexc_value = 0;
2743     tstate->curexc_traceback = 0;
2744 }
2745 #endif
2746 
2747 /* RaiseException */
2748 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)2749 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
2750                         CYTHON_UNUSED PyObject *cause) {
2751     __Pyx_PyThreadState_declare
2752     Py_XINCREF(type);
2753     if (!value || value == Py_None)
2754         value = NULL;
2755     else
2756         Py_INCREF(value);
2757     if (!tb || tb == Py_None)
2758         tb = NULL;
2759     else {
2760         Py_INCREF(tb);
2761         if (!PyTraceBack_Check(tb)) {
2762             PyErr_SetString(PyExc_TypeError,
2763                 "raise: arg 3 must be a traceback or None");
2764             goto raise_error;
2765         }
2766     }
2767     if (PyType_Check(type)) {
2768 #if CYTHON_COMPILING_IN_PYPY
2769         if (!value) {
2770             Py_INCREF(Py_None);
2771             value = Py_None;
2772         }
2773 #endif
2774         PyErr_NormalizeException(&type, &value, &tb);
2775     } else {
2776         if (value) {
2777             PyErr_SetString(PyExc_TypeError,
2778                 "instance exception may not have a separate value");
2779             goto raise_error;
2780         }
2781         value = type;
2782         type = (PyObject*) Py_TYPE(type);
2783         Py_INCREF(type);
2784         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
2785             PyErr_SetString(PyExc_TypeError,
2786                 "raise: exception class must be a subclass of BaseException");
2787             goto raise_error;
2788         }
2789     }
2790     __Pyx_PyThreadState_assign
2791     __Pyx_ErrRestore(type, value, tb);
2792     return;
2793 raise_error:
2794     Py_XDECREF(value);
2795     Py_XDECREF(type);
2796     Py_XDECREF(tb);
2797     return;
2798 }
2799 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)2800 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
2801     PyObject* owned_instance = NULL;
2802     if (tb == Py_None) {
2803         tb = 0;
2804     } else if (tb && !PyTraceBack_Check(tb)) {
2805         PyErr_SetString(PyExc_TypeError,
2806             "raise: arg 3 must be a traceback or None");
2807         goto bad;
2808     }
2809     if (value == Py_None)
2810         value = 0;
2811     if (PyExceptionInstance_Check(type)) {
2812         if (value) {
2813             PyErr_SetString(PyExc_TypeError,
2814                 "instance exception may not have a separate value");
2815             goto bad;
2816         }
2817         value = type;
2818         type = (PyObject*) Py_TYPE(value);
2819     } else if (PyExceptionClass_Check(type)) {
2820         PyObject *instance_class = NULL;
2821         if (value && PyExceptionInstance_Check(value)) {
2822             instance_class = (PyObject*) Py_TYPE(value);
2823             if (instance_class != type) {
2824                 int is_subclass = PyObject_IsSubclass(instance_class, type);
2825                 if (!is_subclass) {
2826                     instance_class = NULL;
2827                 } else if (unlikely(is_subclass == -1)) {
2828                     goto bad;
2829                 } else {
2830                     type = instance_class;
2831                 }
2832             }
2833         }
2834         if (!instance_class) {
2835             PyObject *args;
2836             if (!value)
2837                 args = PyTuple_New(0);
2838             else if (PyTuple_Check(value)) {
2839                 Py_INCREF(value);
2840                 args = value;
2841             } else
2842                 args = PyTuple_Pack(1, value);
2843             if (!args)
2844                 goto bad;
2845             owned_instance = PyObject_Call(type, args, NULL);
2846             Py_DECREF(args);
2847             if (!owned_instance)
2848                 goto bad;
2849             value = owned_instance;
2850             if (!PyExceptionInstance_Check(value)) {
2851                 PyErr_Format(PyExc_TypeError,
2852                              "calling %R should have returned an instance of "
2853                              "BaseException, not %R",
2854                              type, Py_TYPE(value));
2855                 goto bad;
2856             }
2857         }
2858     } else {
2859         PyErr_SetString(PyExc_TypeError,
2860             "raise: exception class must be a subclass of BaseException");
2861         goto bad;
2862     }
2863     if (cause) {
2864         PyObject *fixed_cause;
2865         if (cause == Py_None) {
2866             fixed_cause = NULL;
2867         } else if (PyExceptionClass_Check(cause)) {
2868             fixed_cause = PyObject_CallObject(cause, NULL);
2869             if (fixed_cause == NULL)
2870                 goto bad;
2871         } else if (PyExceptionInstance_Check(cause)) {
2872             fixed_cause = cause;
2873             Py_INCREF(fixed_cause);
2874         } else {
2875             PyErr_SetString(PyExc_TypeError,
2876                             "exception causes must derive from "
2877                             "BaseException");
2878             goto bad;
2879         }
2880         PyException_SetCause(value, fixed_cause);
2881     }
2882     PyErr_SetObject(type, value);
2883     if (tb) {
2884 #if CYTHON_COMPILING_IN_PYPY
2885         PyObject *tmp_type, *tmp_value, *tmp_tb;
2886         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
2887         Py_INCREF(tb);
2888         PyErr_Restore(tmp_type, tmp_value, tb);
2889         Py_XDECREF(tmp_tb);
2890 #else
2891         PyThreadState *tstate = __Pyx_PyThreadState_Current;
2892         PyObject* tmp_tb = tstate->curexc_traceback;
2893         if (tb != tmp_tb) {
2894             Py_INCREF(tb);
2895             tstate->curexc_traceback = tb;
2896             Py_XDECREF(tmp_tb);
2897         }
2898 #endif
2899     }
2900 bad:
2901     Py_XDECREF(owned_instance);
2902     return;
2903 }
2904 #endif
2905 
2906 /* GetModuleGlobalName */
__Pyx_GetModuleGlobalName(PyObject * name)2907 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
2908     PyObject *result;
2909 #if !CYTHON_AVOID_BORROWED_REFS
2910 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
2911     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
2912     if (likely(result)) {
2913         Py_INCREF(result);
2914     } else if (unlikely(PyErr_Occurred())) {
2915         result = NULL;
2916     } else {
2917 #else
2918     result = PyDict_GetItem(__pyx_d, name);
2919     if (likely(result)) {
2920         Py_INCREF(result);
2921     } else {
2922 #endif
2923 #else
2924     result = PyObject_GetItem(__pyx_d, name);
2925     if (!result) {
2926         PyErr_Clear();
2927 #endif
2928         result = __Pyx_GetBuiltinName(name);
2929     }
2930     return result;
2931 }
2932 
2933 /* PyObjectCallNoArg */
2934     #if CYTHON_COMPILING_IN_CPYTHON
2935 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
2936 #if CYTHON_FAST_PYCALL
2937     if (PyFunction_Check(func)) {
2938         return __Pyx_PyFunction_FastCall(func, NULL, 0);
2939     }
2940 #endif
2941 #ifdef __Pyx_CyFunction_USED
2942     if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
2943 #else
2944     if (likely(PyCFunction_Check(func))) {
2945 #endif
2946         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
2947             return __Pyx_PyObject_CallMethO(func, NULL);
2948         }
2949     }
2950     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
2951 }
2952 #endif
2953 
2954 /* RaiseDoubleKeywords */
2955       static void __Pyx_RaiseDoubleKeywordsError(
2956     const char* func_name,
2957     PyObject* kw_name)
2958 {
2959     PyErr_Format(PyExc_TypeError,
2960         #if PY_MAJOR_VERSION >= 3
2961         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
2962         #else
2963         "%s() got multiple values for keyword argument '%s'", func_name,
2964         PyString_AsString(kw_name));
2965         #endif
2966 }
2967 
2968 /* ParseKeywords */
2969       static int __Pyx_ParseOptionalKeywords(
2970     PyObject *kwds,
2971     PyObject **argnames[],
2972     PyObject *kwds2,
2973     PyObject *values[],
2974     Py_ssize_t num_pos_args,
2975     const char* function_name)
2976 {
2977     PyObject *key = 0, *value = 0;
2978     Py_ssize_t pos = 0;
2979     PyObject*** name;
2980     PyObject*** first_kw_arg = argnames + num_pos_args;
2981     while (PyDict_Next(kwds, &pos, &key, &value)) {
2982         name = first_kw_arg;
2983         while (*name && (**name != key)) name++;
2984         if (*name) {
2985             values[name-argnames] = value;
2986             continue;
2987         }
2988         name = first_kw_arg;
2989         #if PY_MAJOR_VERSION < 3
2990         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
2991             while (*name) {
2992                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
2993                         && _PyString_Eq(**name, key)) {
2994                     values[name-argnames] = value;
2995                     break;
2996                 }
2997                 name++;
2998             }
2999             if (*name) continue;
3000             else {
3001                 PyObject*** argname = argnames;
3002                 while (argname != first_kw_arg) {
3003                     if ((**argname == key) || (
3004                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
3005                              && _PyString_Eq(**argname, key))) {
3006                         goto arg_passed_twice;
3007                     }
3008                     argname++;
3009                 }
3010             }
3011         } else
3012         #endif
3013         if (likely(PyUnicode_Check(key))) {
3014             while (*name) {
3015                 int cmp = (**name == key) ? 0 :
3016                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3017                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
3018                 #endif
3019                     PyUnicode_Compare(**name, key);
3020                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
3021                 if (cmp == 0) {
3022                     values[name-argnames] = value;
3023                     break;
3024                 }
3025                 name++;
3026             }
3027             if (*name) continue;
3028             else {
3029                 PyObject*** argname = argnames;
3030                 while (argname != first_kw_arg) {
3031                     int cmp = (**argname == key) ? 0 :
3032                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3033                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
3034                     #endif
3035                         PyUnicode_Compare(**argname, key);
3036                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
3037                     if (cmp == 0) goto arg_passed_twice;
3038                     argname++;
3039                 }
3040             }
3041         } else
3042             goto invalid_keyword_type;
3043         if (kwds2) {
3044             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
3045         } else {
3046             goto invalid_keyword;
3047         }
3048     }
3049     return 0;
3050 arg_passed_twice:
3051     __Pyx_RaiseDoubleKeywordsError(function_name, key);
3052     goto bad;
3053 invalid_keyword_type:
3054     PyErr_Format(PyExc_TypeError,
3055         "%.200s() keywords must be strings", function_name);
3056     goto bad;
3057 invalid_keyword:
3058     PyErr_Format(PyExc_TypeError,
3059     #if PY_MAJOR_VERSION < 3
3060         "%.200s() got an unexpected keyword argument '%.200s'",
3061         function_name, PyString_AsString(key));
3062     #else
3063         "%s() got an unexpected keyword argument '%U'",
3064         function_name, key);
3065     #endif
3066 bad:
3067     return -1;
3068 }
3069 
3070 /* RaiseArgTupleInvalid */
3071       static void __Pyx_RaiseArgtupleInvalid(
3072     const char* func_name,
3073     int exact,
3074     Py_ssize_t num_min,
3075     Py_ssize_t num_max,
3076     Py_ssize_t num_found)
3077 {
3078     Py_ssize_t num_expected;
3079     const char *more_or_less;
3080     if (num_found < num_min) {
3081         num_expected = num_min;
3082         more_or_less = "at least";
3083     } else {
3084         num_expected = num_max;
3085         more_or_less = "at most";
3086     }
3087     if (exact) {
3088         more_or_less = "exactly";
3089     }
3090     PyErr_Format(PyExc_TypeError,
3091                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
3092                  func_name, more_or_less, num_expected,
3093                  (num_expected == 1) ? "" : "s", num_found);
3094 }
3095 
3096 /* Import */
3097       static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
3098     PyObject *empty_list = 0;
3099     PyObject *module = 0;
3100     PyObject *global_dict = 0;
3101     PyObject *empty_dict = 0;
3102     PyObject *list;
3103     #if PY_MAJOR_VERSION < 3
3104     PyObject *py_import;
3105     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
3106     if (!py_import)
3107         goto bad;
3108     #endif
3109     if (from_list)
3110         list = from_list;
3111     else {
3112         empty_list = PyList_New(0);
3113         if (!empty_list)
3114             goto bad;
3115         list = empty_list;
3116     }
3117     global_dict = PyModule_GetDict(__pyx_m);
3118     if (!global_dict)
3119         goto bad;
3120     empty_dict = PyDict_New();
3121     if (!empty_dict)
3122         goto bad;
3123     {
3124         #if PY_MAJOR_VERSION >= 3
3125         if (level == -1) {
3126             if (strchr(__Pyx_MODULE_NAME, '.')) {
3127                 module = PyImport_ImportModuleLevelObject(
3128                     name, global_dict, empty_dict, list, 1);
3129                 if (!module) {
3130                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
3131                         goto bad;
3132                     PyErr_Clear();
3133                 }
3134             }
3135             level = 0;
3136         }
3137         #endif
3138         if (!module) {
3139             #if PY_MAJOR_VERSION < 3
3140             PyObject *py_level = PyInt_FromLong(level);
3141             if (!py_level)
3142                 goto bad;
3143             module = PyObject_CallFunctionObjArgs(py_import,
3144                 name, global_dict, empty_dict, list, py_level, NULL);
3145             Py_DECREF(py_level);
3146             #else
3147             module = PyImport_ImportModuleLevelObject(
3148                 name, global_dict, empty_dict, list, level);
3149             #endif
3150         }
3151     }
3152 bad:
3153     #if PY_MAJOR_VERSION < 3
3154     Py_XDECREF(py_import);
3155     #endif
3156     Py_XDECREF(empty_list);
3157     Py_XDECREF(empty_dict);
3158     return module;
3159 }
3160 
3161 /* CLineInTraceback */
3162       #ifndef CYTHON_CLINE_IN_TRACEBACK
3163 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
3164     PyObject *use_cline;
3165     PyObject *ptype, *pvalue, *ptraceback;
3166 #if CYTHON_COMPILING_IN_CPYTHON
3167     PyObject **cython_runtime_dict;
3168 #endif
3169     if (unlikely(!__pyx_cython_runtime)) {
3170         return c_line;
3171     }
3172     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3173 #if CYTHON_COMPILING_IN_CPYTHON
3174     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3175     if (likely(cython_runtime_dict)) {
3176       use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
3177     } else
3178 #endif
3179     {
3180       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3181       if (use_cline_obj) {
3182         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3183         Py_DECREF(use_cline_obj);
3184       } else {
3185         PyErr_Clear();
3186         use_cline = NULL;
3187       }
3188     }
3189     if (!use_cline) {
3190         c_line = 0;
3191         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3192     }
3193     else if (PyObject_Not(use_cline) != 0) {
3194         c_line = 0;
3195     }
3196     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3197     return c_line;
3198 }
3199 #endif
3200 
3201 /* CodeObjectCache */
3202       static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
3203     int start = 0, mid = 0, end = count - 1;
3204     if (end >= 0 && code_line > entries[end].code_line) {
3205         return count;
3206     }
3207     while (start < end) {
3208         mid = start + (end - start) / 2;
3209         if (code_line < entries[mid].code_line) {
3210             end = mid;
3211         } else if (code_line > entries[mid].code_line) {
3212              start = mid + 1;
3213         } else {
3214             return mid;
3215         }
3216     }
3217     if (code_line <= entries[mid].code_line) {
3218         return mid;
3219     } else {
3220         return mid + 1;
3221     }
3222 }
3223 static PyCodeObject *__pyx_find_code_object(int code_line) {
3224     PyCodeObject* code_object;
3225     int pos;
3226     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3227         return NULL;
3228     }
3229     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3230     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
3231         return NULL;
3232     }
3233     code_object = __pyx_code_cache.entries[pos].code_object;
3234     Py_INCREF(code_object);
3235     return code_object;
3236 }
3237 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
3238     int pos, i;
3239     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3240     if (unlikely(!code_line)) {
3241         return;
3242     }
3243     if (unlikely(!entries)) {
3244         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
3245         if (likely(entries)) {
3246             __pyx_code_cache.entries = entries;
3247             __pyx_code_cache.max_count = 64;
3248             __pyx_code_cache.count = 1;
3249             entries[0].code_line = code_line;
3250             entries[0].code_object = code_object;
3251             Py_INCREF(code_object);
3252         }
3253         return;
3254     }
3255     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3256     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
3257         PyCodeObject* tmp = entries[pos].code_object;
3258         entries[pos].code_object = code_object;
3259         Py_DECREF(tmp);
3260         return;
3261     }
3262     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
3263         int new_max = __pyx_code_cache.max_count + 64;
3264         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
3265             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
3266         if (unlikely(!entries)) {
3267             return;
3268         }
3269         __pyx_code_cache.entries = entries;
3270         __pyx_code_cache.max_count = new_max;
3271     }
3272     for (i=__pyx_code_cache.count; i>pos; i--) {
3273         entries[i] = entries[i-1];
3274     }
3275     entries[pos].code_line = code_line;
3276     entries[pos].code_object = code_object;
3277     __pyx_code_cache.count++;
3278     Py_INCREF(code_object);
3279 }
3280 
3281 /* AddTraceback */
3282       #include "compile.h"
3283 #include "frameobject.h"
3284 #include "traceback.h"
3285 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3286             const char *funcname, int c_line,
3287             int py_line, const char *filename) {
3288     PyCodeObject *py_code = 0;
3289     PyObject *py_srcfile = 0;
3290     PyObject *py_funcname = 0;
3291     #if PY_MAJOR_VERSION < 3
3292     py_srcfile = PyString_FromString(filename);
3293     #else
3294     py_srcfile = PyUnicode_FromString(filename);
3295     #endif
3296     if (!py_srcfile) goto bad;
3297     if (c_line) {
3298         #if PY_MAJOR_VERSION < 3
3299         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3300         #else
3301         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3302         #endif
3303     }
3304     else {
3305         #if PY_MAJOR_VERSION < 3
3306         py_funcname = PyString_FromString(funcname);
3307         #else
3308         py_funcname = PyUnicode_FromString(funcname);
3309         #endif
3310     }
3311     if (!py_funcname) goto bad;
3312     py_code = __Pyx_PyCode_New(
3313         0,
3314         0,
3315         0,
3316         0,
3317         0,
3318         __pyx_empty_bytes, /*PyObject *code,*/
3319         __pyx_empty_tuple, /*PyObject *consts,*/
3320         __pyx_empty_tuple, /*PyObject *names,*/
3321         __pyx_empty_tuple, /*PyObject *varnames,*/
3322         __pyx_empty_tuple, /*PyObject *freevars,*/
3323         __pyx_empty_tuple, /*PyObject *cellvars,*/
3324         py_srcfile,   /*PyObject *filename,*/
3325         py_funcname,  /*PyObject *name,*/
3326         py_line,
3327         __pyx_empty_bytes  /*PyObject *lnotab*/
3328     );
3329     Py_DECREF(py_srcfile);
3330     Py_DECREF(py_funcname);
3331     return py_code;
3332 bad:
3333     Py_XDECREF(py_srcfile);
3334     Py_XDECREF(py_funcname);
3335     return NULL;
3336 }
3337 static void __Pyx_AddTraceback(const char *funcname, int c_line,
3338                                int py_line, const char *filename) {
3339     PyCodeObject *py_code = 0;
3340     PyFrameObject *py_frame = 0;
3341     PyThreadState *tstate = __Pyx_PyThreadState_Current;
3342     if (c_line) {
3343         c_line = __Pyx_CLineForTraceback(tstate, c_line);
3344     }
3345     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3346     if (!py_code) {
3347         py_code = __Pyx_CreateCodeObjectForTraceback(
3348             funcname, c_line, py_line, filename);
3349         if (!py_code) goto bad;
3350         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3351     }
3352     py_frame = PyFrame_New(
3353         tstate,            /*PyThreadState *tstate,*/
3354         py_code,           /*PyCodeObject *code,*/
3355         __pyx_d,    /*PyObject *globals,*/
3356         0                  /*PyObject *locals*/
3357     );
3358     if (!py_frame) goto bad;
3359     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3360     PyTraceBack_Here(py_frame);
3361 bad:
3362     Py_XDECREF(py_code);
3363     Py_XDECREF(py_frame);
3364 }
3365 
3366 /* CIntFromPyVerify */
3367       #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
3368     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
3369 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
3370     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
3371 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
3372     {\
3373         func_type value = func_value;\
3374         if (sizeof(target_type) < sizeof(func_type)) {\
3375             if (unlikely(value != (func_type) (target_type) value)) {\
3376                 func_type zero = 0;\
3377                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
3378                     return (target_type) -1;\
3379                 if (is_unsigned && unlikely(value < zero))\
3380                     goto raise_neg_overflow;\
3381                 else\
3382                     goto raise_overflow;\
3383             }\
3384         }\
3385         return (target_type) value;\
3386     }
3387 
3388 /* CIntToPy */
3389       static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
3390     const int neg_one = (int) -1, const_zero = (int) 0;
3391     const int is_unsigned = neg_one > const_zero;
3392     if (is_unsigned) {
3393         if (sizeof(int) < sizeof(long)) {
3394             return PyInt_FromLong((long) value);
3395         } else if (sizeof(int) <= sizeof(unsigned long)) {
3396             return PyLong_FromUnsignedLong((unsigned long) value);
3397 #ifdef HAVE_LONG_LONG
3398         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
3399             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3400 #endif
3401         }
3402     } else {
3403         if (sizeof(int) <= sizeof(long)) {
3404             return PyInt_FromLong((long) value);
3405 #ifdef HAVE_LONG_LONG
3406         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
3407             return PyLong_FromLongLong((PY_LONG_LONG) value);
3408 #endif
3409         }
3410     }
3411     {
3412         int one = 1; int little = (int)*(unsigned char *)&one;
3413         unsigned char *bytes = (unsigned char *)&value;
3414         return _PyLong_FromByteArray(bytes, sizeof(int),
3415                                      little, !is_unsigned);
3416     }
3417 }
3418 
3419 /* CIntToPy */
3420       static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
3421     const long neg_one = (long) -1, const_zero = (long) 0;
3422     const int is_unsigned = neg_one > const_zero;
3423     if (is_unsigned) {
3424         if (sizeof(long) < sizeof(long)) {
3425             return PyInt_FromLong((long) value);
3426         } else if (sizeof(long) <= sizeof(unsigned long)) {
3427             return PyLong_FromUnsignedLong((unsigned long) value);
3428 #ifdef HAVE_LONG_LONG
3429         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3430             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3431 #endif
3432         }
3433     } else {
3434         if (sizeof(long) <= sizeof(long)) {
3435             return PyInt_FromLong((long) value);
3436 #ifdef HAVE_LONG_LONG
3437         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3438             return PyLong_FromLongLong((PY_LONG_LONG) value);
3439 #endif
3440         }
3441     }
3442     {
3443         int one = 1; int little = (int)*(unsigned char *)&one;
3444         unsigned char *bytes = (unsigned char *)&value;
3445         return _PyLong_FromByteArray(bytes, sizeof(long),
3446                                      little, !is_unsigned);
3447     }
3448 }
3449 
3450 /* CIntFromPy */
3451       static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
3452     const long neg_one = (long) -1, const_zero = (long) 0;
3453     const int is_unsigned = neg_one > const_zero;
3454 #if PY_MAJOR_VERSION < 3
3455     if (likely(PyInt_Check(x))) {
3456         if (sizeof(long) < sizeof(long)) {
3457             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
3458         } else {
3459             long val = PyInt_AS_LONG(x);
3460             if (is_unsigned && unlikely(val < 0)) {
3461                 goto raise_neg_overflow;
3462             }
3463             return (long) val;
3464         }
3465     } else
3466 #endif
3467     if (likely(PyLong_Check(x))) {
3468         if (is_unsigned) {
3469 #if CYTHON_USE_PYLONG_INTERNALS
3470             const digit* digits = ((PyLongObject*)x)->ob_digit;
3471             switch (Py_SIZE(x)) {
3472                 case  0: return (long) 0;
3473                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
3474                 case 2:
3475                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3476                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3477                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3478                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
3479                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3480                         }
3481                     }
3482                     break;
3483                 case 3:
3484                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3485                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3486                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3487                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
3488                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3489                         }
3490                     }
3491                     break;
3492                 case 4:
3493                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3494                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3495                             __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])))
3496                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
3497                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3498                         }
3499                     }
3500                     break;
3501             }
3502 #endif
3503 #if CYTHON_COMPILING_IN_CPYTHON
3504             if (unlikely(Py_SIZE(x) < 0)) {
3505                 goto raise_neg_overflow;
3506             }
3507 #else
3508             {
3509                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3510                 if (unlikely(result < 0))
3511                     return (long) -1;
3512                 if (unlikely(result == 1))
3513                     goto raise_neg_overflow;
3514             }
3515 #endif
3516             if (sizeof(long) <= sizeof(unsigned long)) {
3517                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
3518 #ifdef HAVE_LONG_LONG
3519             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3520                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3521 #endif
3522             }
3523         } else {
3524 #if CYTHON_USE_PYLONG_INTERNALS
3525             const digit* digits = ((PyLongObject*)x)->ob_digit;
3526             switch (Py_SIZE(x)) {
3527                 case  0: return (long) 0;
3528                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
3529                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
3530                 case -2:
3531                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
3532                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3533                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3534                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3535                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3536                         }
3537                     }
3538                     break;
3539                 case 2:
3540                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3541                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3542                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3543                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3544                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3545                         }
3546                     }
3547                     break;
3548                 case -3:
3549                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3550                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3551                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3552                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3553                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3554                         }
3555                     }
3556                     break;
3557                 case 3:
3558                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3559                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3560                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3561                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3562                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3563                         }
3564                     }
3565                     break;
3566                 case -4:
3567                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3568                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3569                             __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])))
3570                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3571                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3572                         }
3573                     }
3574                     break;
3575                 case 4:
3576                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3577                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3578                             __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])))
3579                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3580                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3581                         }
3582                     }
3583                     break;
3584             }
3585 #endif
3586             if (sizeof(long) <= sizeof(long)) {
3587                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
3588 #ifdef HAVE_LONG_LONG
3589             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3590                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
3591 #endif
3592             }
3593         }
3594         {
3595 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3596             PyErr_SetString(PyExc_RuntimeError,
3597                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3598 #else
3599             long val;
3600             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3601  #if PY_MAJOR_VERSION < 3
3602             if (likely(v) && !PyLong_Check(v)) {
3603                 PyObject *tmp = v;
3604                 v = PyNumber_Long(tmp);
3605                 Py_DECREF(tmp);
3606             }
3607  #endif
3608             if (likely(v)) {
3609                 int one = 1; int is_little = (int)*(unsigned char *)&one;
3610                 unsigned char *bytes = (unsigned char *)&val;
3611                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3612                                               bytes, sizeof(val),
3613                                               is_little, !is_unsigned);
3614                 Py_DECREF(v);
3615                 if (likely(!ret))
3616                     return val;
3617             }
3618 #endif
3619             return (long) -1;
3620         }
3621     } else {
3622         long val;
3623         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3624         if (!tmp) return (long) -1;
3625         val = __Pyx_PyInt_As_long(tmp);
3626         Py_DECREF(tmp);
3627         return val;
3628     }
3629 raise_overflow:
3630     PyErr_SetString(PyExc_OverflowError,
3631         "value too large to convert to long");
3632     return (long) -1;
3633 raise_neg_overflow:
3634     PyErr_SetString(PyExc_OverflowError,
3635         "can't convert negative value to long");
3636     return (long) -1;
3637 }
3638 
3639 /* CIntFromPy */
3640       static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
3641     const int neg_one = (int) -1, const_zero = (int) 0;
3642     const int is_unsigned = neg_one > const_zero;
3643 #if PY_MAJOR_VERSION < 3
3644     if (likely(PyInt_Check(x))) {
3645         if (sizeof(int) < sizeof(long)) {
3646             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
3647         } else {
3648             long val = PyInt_AS_LONG(x);
3649             if (is_unsigned && unlikely(val < 0)) {
3650                 goto raise_neg_overflow;
3651             }
3652             return (int) val;
3653         }
3654     } else
3655 #endif
3656     if (likely(PyLong_Check(x))) {
3657         if (is_unsigned) {
3658 #if CYTHON_USE_PYLONG_INTERNALS
3659             const digit* digits = ((PyLongObject*)x)->ob_digit;
3660             switch (Py_SIZE(x)) {
3661                 case  0: return (int) 0;
3662                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
3663                 case 2:
3664                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
3665                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3666                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3667                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
3668                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3669                         }
3670                     }
3671                     break;
3672                 case 3:
3673                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
3674                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3675                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3676                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
3677                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3678                         }
3679                     }
3680                     break;
3681                 case 4:
3682                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
3683                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3684                             __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])))
3685                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
3686                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3687                         }
3688                     }
3689                     break;
3690             }
3691 #endif
3692 #if CYTHON_COMPILING_IN_CPYTHON
3693             if (unlikely(Py_SIZE(x) < 0)) {
3694                 goto raise_neg_overflow;
3695             }
3696 #else
3697             {
3698                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3699                 if (unlikely(result < 0))
3700                     return (int) -1;
3701                 if (unlikely(result == 1))
3702                     goto raise_neg_overflow;
3703             }
3704 #endif
3705             if (sizeof(int) <= sizeof(unsigned long)) {
3706                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
3707 #ifdef HAVE_LONG_LONG
3708             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
3709                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3710 #endif
3711             }
3712         } else {
3713 #if CYTHON_USE_PYLONG_INTERNALS
3714             const digit* digits = ((PyLongObject*)x)->ob_digit;
3715             switch (Py_SIZE(x)) {
3716                 case  0: return (int) 0;
3717                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
3718                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
3719                 case -2:
3720                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
3721                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3722                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3723                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3724                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3725                         }
3726                     }
3727                     break;
3728                 case 2:
3729                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
3730                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3731                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3732                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3733                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3734                         }
3735                     }
3736                     break;
3737                 case -3:
3738                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3739                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3740                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3741                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3742                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3743                         }
3744                     }
3745                     break;
3746                 case 3:
3747                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
3748                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3749                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3750                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3751                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3752                         }
3753                     }
3754                     break;
3755                 case -4:
3756                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3757                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3758                             __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])))
3759                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3760                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3761                         }
3762                     }
3763                     break;
3764                 case 4:
3765                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
3766                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3767                             __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])))
3768                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3769                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3770                         }
3771                     }
3772                     break;
3773             }
3774 #endif
3775             if (sizeof(int) <= sizeof(long)) {
3776                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
3777 #ifdef HAVE_LONG_LONG
3778             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
3779                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
3780 #endif
3781             }
3782         }
3783         {
3784 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3785             PyErr_SetString(PyExc_RuntimeError,
3786                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3787 #else
3788             int val;
3789             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3790  #if PY_MAJOR_VERSION < 3
3791             if (likely(v) && !PyLong_Check(v)) {
3792                 PyObject *tmp = v;
3793                 v = PyNumber_Long(tmp);
3794                 Py_DECREF(tmp);
3795             }
3796  #endif
3797             if (likely(v)) {
3798                 int one = 1; int is_little = (int)*(unsigned char *)&one;
3799                 unsigned char *bytes = (unsigned char *)&val;
3800                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3801                                               bytes, sizeof(val),
3802                                               is_little, !is_unsigned);
3803                 Py_DECREF(v);
3804                 if (likely(!ret))
3805                     return val;
3806             }
3807 #endif
3808             return (int) -1;
3809         }
3810     } else {
3811         int val;
3812         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3813         if (!tmp) return (int) -1;
3814         val = __Pyx_PyInt_As_int(tmp);
3815         Py_DECREF(tmp);
3816         return val;
3817     }
3818 raise_overflow:
3819     PyErr_SetString(PyExc_OverflowError,
3820         "value too large to convert to int");
3821     return (int) -1;
3822 raise_neg_overflow:
3823     PyErr_SetString(PyExc_OverflowError,
3824         "can't convert negative value to int");
3825     return (int) -1;
3826 }
3827 
3828 /* FastTypeChecks */
3829       #if CYTHON_COMPILING_IN_CPYTHON
3830 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
3831     while (a) {
3832         a = a->tp_base;
3833         if (a == b)
3834             return 1;
3835     }
3836     return b == &PyBaseObject_Type;
3837 }
3838 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
3839     PyObject *mro;
3840     if (a == b) return 1;
3841     mro = a->tp_mro;
3842     if (likely(mro)) {
3843         Py_ssize_t i, n;
3844         n = PyTuple_GET_SIZE(mro);
3845         for (i = 0; i < n; i++) {
3846             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
3847                 return 1;
3848         }
3849         return 0;
3850     }
3851     return __Pyx_InBases(a, b);
3852 }
3853 #if PY_MAJOR_VERSION == 2
3854 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
3855     PyObject *exception, *value, *tb;
3856     int res;
3857     __Pyx_PyThreadState_declare
3858     __Pyx_PyThreadState_assign
3859     __Pyx_ErrFetch(&exception, &value, &tb);
3860     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
3861     if (unlikely(res == -1)) {
3862         PyErr_WriteUnraisable(err);
3863         res = 0;
3864     }
3865     if (!res) {
3866         res = PyObject_IsSubclass(err, exc_type2);
3867         if (unlikely(res == -1)) {
3868             PyErr_WriteUnraisable(err);
3869             res = 0;
3870         }
3871     }
3872     __Pyx_ErrRestore(exception, value, tb);
3873     return res;
3874 }
3875 #else
3876 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
3877     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
3878     if (!res) {
3879         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
3880     }
3881     return res;
3882 }
3883 #endif
3884 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
3885     Py_ssize_t i, n;
3886     assert(PyExceptionClass_Check(exc_type));
3887     n = PyTuple_GET_SIZE(tuple);
3888 #if PY_MAJOR_VERSION >= 3
3889     for (i=0; i<n; i++) {
3890         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
3891     }
3892 #endif
3893     for (i=0; i<n; i++) {
3894         PyObject *t = PyTuple_GET_ITEM(tuple, i);
3895         #if PY_MAJOR_VERSION < 3
3896         if (likely(exc_type == t)) return 1;
3897         #endif
3898         if (likely(PyExceptionClass_Check(t))) {
3899             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
3900         } else {
3901         }
3902     }
3903     return 0;
3904 }
3905 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
3906     if (likely(err == exc_type)) return 1;
3907     if (likely(PyExceptionClass_Check(err))) {
3908         if (likely(PyExceptionClass_Check(exc_type))) {
3909             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
3910         } else if (likely(PyTuple_Check(exc_type))) {
3911             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
3912         } else {
3913         }
3914     }
3915     return PyErr_GivenExceptionMatches(err, exc_type);
3916 }
3917 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
3918     assert(PyExceptionClass_Check(exc_type1));
3919     assert(PyExceptionClass_Check(exc_type2));
3920     if (likely(err == exc_type1 || err == exc_type2)) return 1;
3921     if (likely(PyExceptionClass_Check(err))) {
3922         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
3923     }
3924     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
3925 }
3926 #endif
3927 
3928 /* CheckBinaryVersion */
3929       static int __Pyx_check_binary_version(void) {
3930     char ctversion[4], rtversion[4];
3931     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
3932     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
3933     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
3934         char message[200];
3935         PyOS_snprintf(message, sizeof(message),
3936                       "compiletime version %s of module '%.100s' "
3937                       "does not match runtime version %s",
3938                       ctversion, __Pyx_MODULE_NAME, rtversion);
3939         return PyErr_WarnEx(NULL, message, 1);
3940     }
3941     return 0;
3942 }
3943 
3944 /* InitStrings */
3945       static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
3946     while (t->p) {
3947         #if PY_MAJOR_VERSION < 3
3948         if (t->is_unicode) {
3949             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
3950         } else if (t->intern) {
3951             *t->p = PyString_InternFromString(t->s);
3952         } else {
3953             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
3954         }
3955         #else
3956         if (t->is_unicode | t->is_str) {
3957             if (t->intern) {
3958                 *t->p = PyUnicode_InternFromString(t->s);
3959             } else if (t->encoding) {
3960                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
3961             } else {
3962                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
3963             }
3964         } else {
3965             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
3966         }
3967         #endif
3968         if (!*t->p)
3969             return -1;
3970         if (PyObject_Hash(*t->p) == -1)
3971             return -1;
3972         ++t;
3973     }
3974     return 0;
3975 }
3976 
3977 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
3978     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
3979 }
3980 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
3981     Py_ssize_t ignore;
3982     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
3983 }
3984 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
3985 #if !CYTHON_PEP393_ENABLED
3986 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3987     char* defenc_c;
3988     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
3989     if (!defenc) return NULL;
3990     defenc_c = PyBytes_AS_STRING(defenc);
3991 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3992     {
3993         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
3994         char* c;
3995         for (c = defenc_c; c < end; c++) {
3996             if ((unsigned char) (*c) >= 128) {
3997                 PyUnicode_AsASCIIString(o);
3998                 return NULL;
3999             }
4000         }
4001     }
4002 #endif
4003     *length = PyBytes_GET_SIZE(defenc);
4004     return defenc_c;
4005 }
4006 #else
4007 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4008     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
4009 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4010     if (likely(PyUnicode_IS_ASCII(o))) {
4011         *length = PyUnicode_GET_LENGTH(o);
4012         return PyUnicode_AsUTF8(o);
4013     } else {
4014         PyUnicode_AsASCIIString(o);
4015         return NULL;
4016     }
4017 #else
4018     return PyUnicode_AsUTF8AndSize(o, length);
4019 #endif
4020 }
4021 #endif
4022 #endif
4023 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4024 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4025     if (
4026 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4027             __Pyx_sys_getdefaultencoding_not_ascii &&
4028 #endif
4029             PyUnicode_Check(o)) {
4030         return __Pyx_PyUnicode_AsStringAndSize(o, length);
4031     } else
4032 #endif
4033 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
4034     if (PyByteArray_Check(o)) {
4035         *length = PyByteArray_GET_SIZE(o);
4036         return PyByteArray_AS_STRING(o);
4037     } else
4038 #endif
4039     {
4040         char* result;
4041         int r = PyBytes_AsStringAndSize(o, &result, length);
4042         if (unlikely(r < 0)) {
4043             return NULL;
4044         } else {
4045             return result;
4046         }
4047     }
4048 }
4049 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
4050    int is_true = x == Py_True;
4051    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
4052    else return PyObject_IsTrue(x);
4053 }
4054 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
4055 #if PY_MAJOR_VERSION >= 3
4056     if (PyLong_Check(result)) {
4057         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
4058                 "__int__ returned non-int (type %.200s).  "
4059                 "The ability to return an instance of a strict subclass of int "
4060                 "is deprecated, and may be removed in a future version of Python.",
4061                 Py_TYPE(result)->tp_name)) {
4062             Py_DECREF(result);
4063             return NULL;
4064         }
4065         return result;
4066     }
4067 #endif
4068     PyErr_Format(PyExc_TypeError,
4069                  "__%.4s__ returned non-%.4s (type %.200s)",
4070                  type_name, type_name, Py_TYPE(result)->tp_name);
4071     Py_DECREF(result);
4072     return NULL;
4073 }
4074 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4075 #if CYTHON_USE_TYPE_SLOTS
4076   PyNumberMethods *m;
4077 #endif
4078   const char *name = NULL;
4079   PyObject *res = NULL;
4080 #if PY_MAJOR_VERSION < 3
4081   if (likely(PyInt_Check(x) || PyLong_Check(x)))
4082 #else
4083   if (likely(PyLong_Check(x)))
4084 #endif
4085     return __Pyx_NewRef(x);
4086 #if CYTHON_USE_TYPE_SLOTS
4087   m = Py_TYPE(x)->tp_as_number;
4088   #if PY_MAJOR_VERSION < 3
4089   if (m && m->nb_int) {
4090     name = "int";
4091     res = m->nb_int(x);
4092   }
4093   else if (m && m->nb_long) {
4094     name = "long";
4095     res = m->nb_long(x);
4096   }
4097   #else
4098   if (likely(m && m->nb_int)) {
4099     name = "int";
4100     res = m->nb_int(x);
4101   }
4102   #endif
4103 #else
4104   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4105     res = PyNumber_Int(x);
4106   }
4107 #endif
4108   if (likely(res)) {
4109 #if PY_MAJOR_VERSION < 3
4110     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
4111 #else
4112     if (unlikely(!PyLong_CheckExact(res))) {
4113 #endif
4114         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
4115     }
4116   }
4117   else if (!PyErr_Occurred()) {
4118     PyErr_SetString(PyExc_TypeError,
4119                     "an integer is required");
4120   }
4121   return res;
4122 }
4123 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4124   Py_ssize_t ival;
4125   PyObject *x;
4126 #if PY_MAJOR_VERSION < 3
4127   if (likely(PyInt_CheckExact(b))) {
4128     if (sizeof(Py_ssize_t) >= sizeof(long))
4129         return PyInt_AS_LONG(b);
4130     else
4131         return PyInt_AsSsize_t(x);
4132   }
4133 #endif
4134   if (likely(PyLong_CheckExact(b))) {
4135     #if CYTHON_USE_PYLONG_INTERNALS
4136     const digit* digits = ((PyLongObject*)b)->ob_digit;
4137     const Py_ssize_t size = Py_SIZE(b);
4138     if (likely(__Pyx_sst_abs(size) <= 1)) {
4139         ival = likely(size) ? digits[0] : 0;
4140         if (size == -1) ival = -ival;
4141         return ival;
4142     } else {
4143       switch (size) {
4144          case 2:
4145            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4146              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4147            }
4148            break;
4149          case -2:
4150            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4151              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4152            }
4153            break;
4154          case 3:
4155            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4156              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4157            }
4158            break;
4159          case -3:
4160            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4161              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4162            }
4163            break;
4164          case 4:
4165            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4166              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]));
4167            }
4168            break;
4169          case -4:
4170            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4171              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]));
4172            }
4173            break;
4174       }
4175     }
4176     #endif
4177     return PyLong_AsSsize_t(b);
4178   }
4179   x = PyNumber_Index(b);
4180   if (!x) return -1;
4181   ival = PyInt_AsSsize_t(x);
4182   Py_DECREF(x);
4183   return ival;
4184 }
4185 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
4186   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
4187 }
4188 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
4189     return PyInt_FromSize_t(ival);
4190 }
4191 
4192 
4193 #endif /* Py_PYTHON_H */
4194