1 /* Generated by Cython 0.29.23 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8     #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10     #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_23"
13 #define CYTHON_HEX_VERSION 0x001D17F0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20   #ifndef __stdcall
21     #define __stdcall
22   #endif
23   #ifndef __cdecl
24     #define __cdecl
25   #endif
26   #ifndef __fastcall
27     #define __fastcall
28   #endif
29 #endif
30 #ifndef DL_IMPORT
31   #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34   #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38   #if PY_VERSION_HEX >= 0x02070000
39     #define HAVE_LONG_LONG
40   #endif
41 #endif
42 #ifndef PY_LONG_LONG
43   #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46   #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49   #define CYTHON_COMPILING_IN_PYPY 1
50   #define CYTHON_COMPILING_IN_PYSTON 0
51   #define CYTHON_COMPILING_IN_CPYTHON 0
52   #undef CYTHON_USE_TYPE_SLOTS
53   #define CYTHON_USE_TYPE_SLOTS 0
54   #undef CYTHON_USE_PYTYPE_LOOKUP
55   #define CYTHON_USE_PYTYPE_LOOKUP 0
56   #if PY_VERSION_HEX < 0x03050000
57     #undef CYTHON_USE_ASYNC_SLOTS
58     #define CYTHON_USE_ASYNC_SLOTS 0
59   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60     #define CYTHON_USE_ASYNC_SLOTS 1
61   #endif
62   #undef CYTHON_USE_PYLIST_INTERNALS
63   #define CYTHON_USE_PYLIST_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_INTERNALS
65   #define CYTHON_USE_UNICODE_INTERNALS 0
66   #undef CYTHON_USE_UNICODE_WRITER
67   #define CYTHON_USE_UNICODE_WRITER 0
68   #undef CYTHON_USE_PYLONG_INTERNALS
69   #define CYTHON_USE_PYLONG_INTERNALS 0
70   #undef CYTHON_AVOID_BORROWED_REFS
71   #define CYTHON_AVOID_BORROWED_REFS 1
72   #undef CYTHON_ASSUME_SAFE_MACROS
73   #define CYTHON_ASSUME_SAFE_MACROS 0
74   #undef CYTHON_UNPACK_METHODS
75   #define CYTHON_UNPACK_METHODS 0
76   #undef CYTHON_FAST_THREAD_STATE
77   #define CYTHON_FAST_THREAD_STATE 0
78   #undef CYTHON_FAST_PYCALL
79   #define CYTHON_FAST_PYCALL 0
80   #undef CYTHON_PEP489_MULTI_PHASE_INIT
81   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82   #undef CYTHON_USE_TP_FINALIZE
83   #define CYTHON_USE_TP_FINALIZE 0
84   #undef CYTHON_USE_DICT_VERSIONS
85   #define CYTHON_USE_DICT_VERSIONS 0
86   #undef CYTHON_USE_EXC_INFO_STACK
87   #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89   #define CYTHON_COMPILING_IN_PYPY 0
90   #define CYTHON_COMPILING_IN_PYSTON 1
91   #define CYTHON_COMPILING_IN_CPYTHON 0
92   #ifndef CYTHON_USE_TYPE_SLOTS
93     #define CYTHON_USE_TYPE_SLOTS 1
94   #endif
95   #undef CYTHON_USE_PYTYPE_LOOKUP
96   #define CYTHON_USE_PYTYPE_LOOKUP 0
97   #undef CYTHON_USE_ASYNC_SLOTS
98   #define CYTHON_USE_ASYNC_SLOTS 0
99   #undef CYTHON_USE_PYLIST_INTERNALS
100   #define CYTHON_USE_PYLIST_INTERNALS 0
101   #ifndef CYTHON_USE_UNICODE_INTERNALS
102     #define CYTHON_USE_UNICODE_INTERNALS 1
103   #endif
104   #undef CYTHON_USE_UNICODE_WRITER
105   #define CYTHON_USE_UNICODE_WRITER 0
106   #undef CYTHON_USE_PYLONG_INTERNALS
107   #define CYTHON_USE_PYLONG_INTERNALS 0
108   #ifndef CYTHON_AVOID_BORROWED_REFS
109     #define CYTHON_AVOID_BORROWED_REFS 0
110   #endif
111   #ifndef CYTHON_ASSUME_SAFE_MACROS
112     #define CYTHON_ASSUME_SAFE_MACROS 1
113   #endif
114   #ifndef CYTHON_UNPACK_METHODS
115     #define CYTHON_UNPACK_METHODS 1
116   #endif
117   #undef CYTHON_FAST_THREAD_STATE
118   #define CYTHON_FAST_THREAD_STATE 0
119   #undef CYTHON_FAST_PYCALL
120   #define CYTHON_FAST_PYCALL 0
121   #undef CYTHON_PEP489_MULTI_PHASE_INIT
122   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123   #undef CYTHON_USE_TP_FINALIZE
124   #define CYTHON_USE_TP_FINALIZE 0
125   #undef CYTHON_USE_DICT_VERSIONS
126   #define CYTHON_USE_DICT_VERSIONS 0
127   #undef CYTHON_USE_EXC_INFO_STACK
128   #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130   #define CYTHON_COMPILING_IN_PYPY 0
131   #define CYTHON_COMPILING_IN_PYSTON 0
132   #define CYTHON_COMPILING_IN_CPYTHON 1
133   #ifndef CYTHON_USE_TYPE_SLOTS
134     #define CYTHON_USE_TYPE_SLOTS 1
135   #endif
136   #if PY_VERSION_HEX < 0x02070000
137     #undef CYTHON_USE_PYTYPE_LOOKUP
138     #define CYTHON_USE_PYTYPE_LOOKUP 0
139   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140     #define CYTHON_USE_PYTYPE_LOOKUP 1
141   #endif
142   #if PY_MAJOR_VERSION < 3
143     #undef CYTHON_USE_ASYNC_SLOTS
144     #define CYTHON_USE_ASYNC_SLOTS 0
145   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146     #define CYTHON_USE_ASYNC_SLOTS 1
147   #endif
148   #if PY_VERSION_HEX < 0x02070000
149     #undef CYTHON_USE_PYLONG_INTERNALS
150     #define CYTHON_USE_PYLONG_INTERNALS 0
151   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152     #define CYTHON_USE_PYLONG_INTERNALS 1
153   #endif
154   #ifndef CYTHON_USE_PYLIST_INTERNALS
155     #define CYTHON_USE_PYLIST_INTERNALS 1
156   #endif
157   #ifndef CYTHON_USE_UNICODE_INTERNALS
158     #define CYTHON_USE_UNICODE_INTERNALS 1
159   #endif
160   #if PY_VERSION_HEX < 0x030300F0
161     #undef CYTHON_USE_UNICODE_WRITER
162     #define CYTHON_USE_UNICODE_WRITER 0
163   #elif !defined(CYTHON_USE_UNICODE_WRITER)
164     #define CYTHON_USE_UNICODE_WRITER 1
165   #endif
166   #ifndef CYTHON_AVOID_BORROWED_REFS
167     #define CYTHON_AVOID_BORROWED_REFS 0
168   #endif
169   #ifndef CYTHON_ASSUME_SAFE_MACROS
170     #define CYTHON_ASSUME_SAFE_MACROS 1
171   #endif
172   #ifndef CYTHON_UNPACK_METHODS
173     #define CYTHON_UNPACK_METHODS 1
174   #endif
175   #ifndef CYTHON_FAST_THREAD_STATE
176     #define CYTHON_FAST_THREAD_STATE 1
177   #endif
178   #ifndef CYTHON_FAST_PYCALL
179     #define CYTHON_FAST_PYCALL 1
180   #endif
181   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183   #endif
184   #ifndef CYTHON_USE_TP_FINALIZE
185     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186   #endif
187   #ifndef CYTHON_USE_DICT_VERSIONS
188     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189   #endif
190   #ifndef CYTHON_USE_EXC_INFO_STACK
191     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192   #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198   #include "longintrepr.h"
199   #undef SHIFT
200   #undef BASE
201   #undef MASK
202   #ifdef SIZEOF_VOID_P
203     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204   #endif
205 #endif
206 #ifndef __has_attribute
207   #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210   #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213   #if defined(__GNUC__)
214     #define CYTHON_RESTRICT __restrict__
215   #elif defined(_MSC_VER) && _MSC_VER >= 1400
216     #define CYTHON_RESTRICT __restrict
217   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218     #define CYTHON_RESTRICT restrict
219   #else
220     #define CYTHON_RESTRICT
221   #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 #     define CYTHON_UNUSED __attribute__ ((__unused__))
227 #   else
228 #     define CYTHON_UNUSED
229 #   endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 #   define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 #   define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)238      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 #  else
240 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 #  endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 #  define CYTHON_NCP_UNUSED
246 # else
247 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252     #ifndef _MSC_STDINT_H_
253         #if _MSC_VER < 1300
254            typedef unsigned char     uint8_t;
255            typedef unsigned int      uint32_t;
256         #else
257            typedef unsigned __int8   uint8_t;
258            typedef unsigned __int32  uint32_t;
259         #endif
260     #endif
261 #else
262    #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265   #if defined(__cplusplus) && __cplusplus >= 201103L
266     #if __has_cpp_attribute(fallthrough)
267       #define CYTHON_FALLTHROUGH [[fallthrough]]
268     #elif __has_cpp_attribute(clang::fallthrough)
269       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270     #elif __has_cpp_attribute(gnu::fallthrough)
271       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272     #endif
273   #endif
274   #ifndef CYTHON_FALLTHROUGH
275     #if __has_attribute(fallthrough)
276       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277     #else
278       #define CYTHON_FALLTHROUGH
279     #endif
280   #endif
281   #if defined(__clang__ ) && defined(__apple_build_version__)
282     #if __apple_build_version__ < 7000000
283       #undef  CYTHON_FALLTHROUGH
284       #define CYTHON_FALLTHROUGH
285     #endif
286   #endif
287 #endif
288 
289 #ifndef __cplusplus
290   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
291 #endif
292 #ifndef CYTHON_INLINE
293   #if defined(__clang__)
294     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
295   #else
296     #define CYTHON_INLINE inline
297   #endif
298 #endif
299 template<typename T>
__Pyx_call_destructor(T & x)300 void __Pyx_call_destructor(T& x) {
301     x.~T();
302 }
303 template<typename T>
304 class __Pyx_FakeReference {
305   public:
__Pyx_FakeReference()306     __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)307     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()308     T *operator->() { return ptr; }
operator &()309     T *operator&() { return ptr; }
operator T&()310     operator T&() { return *ptr; }
operator ==(U other)311     template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)312     template<typename U> bool operator !=(U other) { return *ptr != other; }
313   private:
314     T *ptr;
315 };
316 
317 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
318   #define Py_OptimizeFlag 0
319 #endif
320 #define __PYX_BUILD_PY_SSIZE_T "n"
321 #define CYTHON_FORMAT_SSIZE_T "z"
322 #if PY_MAJOR_VERSION < 3
323   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
324   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
325           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
326   #define __Pyx_DefaultClassType PyClass_Type
327 #else
328   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
329 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
330   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #else
333   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
334           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
335 #endif
336   #define __Pyx_DefaultClassType PyType_Type
337 #endif
338 #ifndef Py_TPFLAGS_CHECKTYPES
339   #define Py_TPFLAGS_CHECKTYPES 0
340 #endif
341 #ifndef Py_TPFLAGS_HAVE_INDEX
342   #define Py_TPFLAGS_HAVE_INDEX 0
343 #endif
344 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
345   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
346 #endif
347 #ifndef Py_TPFLAGS_HAVE_FINALIZE
348   #define Py_TPFLAGS_HAVE_FINALIZE 0
349 #endif
350 #ifndef METH_STACKLESS
351   #define METH_STACKLESS 0
352 #endif
353 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
354   #ifndef METH_FASTCALL
355      #define METH_FASTCALL 0x80
356   #endif
357   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
358   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
359                                                           Py_ssize_t nargs, PyObject *kwnames);
360 #else
361   #define __Pyx_PyCFunctionFast _PyCFunctionFast
362   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
363 #endif
364 #if CYTHON_FAST_PYCCALL
365 #define __Pyx_PyFastCFunction_Check(func)\
366     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
367 #else
368 #define __Pyx_PyFastCFunction_Check(func) 0
369 #endif
370 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
371   #define PyObject_Malloc(s)   PyMem_Malloc(s)
372   #define PyObject_Free(p)     PyMem_Free(p)
373   #define PyObject_Realloc(p)  PyMem_Realloc(p)
374 #endif
375 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
376   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
377   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
378   #define PyMem_RawFree(p)             PyMem_Free(p)
379 #endif
380 #if CYTHON_COMPILING_IN_PYSTON
381   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
382   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
383 #else
384   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
385   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
386 #endif
387 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
388   #define __Pyx_PyThreadState_Current PyThreadState_GET()
389 #elif PY_VERSION_HEX >= 0x03060000
390   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
391 #elif PY_VERSION_HEX >= 0x03000000
392   #define __Pyx_PyThreadState_Current PyThreadState_GET()
393 #else
394   #define __Pyx_PyThreadState_Current _PyThreadState_Current
395 #endif
396 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
397 #include "pythread.h"
398 #define Py_tss_NEEDS_INIT 0
399 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)400 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
401   *key = PyThread_create_key();
402   return 0;
403 }
PyThread_tss_alloc(void)404 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
405   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
406   *key = Py_tss_NEEDS_INIT;
407   return key;
408 }
PyThread_tss_free(Py_tss_t * key)409 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
410   PyObject_Free(key);
411 }
PyThread_tss_is_created(Py_tss_t * key)412 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
413   return *key != Py_tss_NEEDS_INIT;
414 }
PyThread_tss_delete(Py_tss_t * key)415 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
416   PyThread_delete_key(*key);
417   *key = Py_tss_NEEDS_INIT;
418 }
PyThread_tss_set(Py_tss_t * key,void * value)419 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
420   return PyThread_set_key_value(*key, value);
421 }
PyThread_tss_get(Py_tss_t * key)422 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
423   return PyThread_get_key_value(*key);
424 }
425 #endif
426 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
427 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
428 #else
429 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
430 #endif
431 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
434 #else
435   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
436   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
437 #endif
438 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
439 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
440 #else
441 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
442 #endif
443 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
444   #define CYTHON_PEP393_ENABLED 1
445   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
446                                               0 : _PyUnicode_Ready((PyObject *)(op)))
447   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
448   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
449   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
450   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
451   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
452   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
453   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
454   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
455   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
456   #else
457   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
458   #endif
459 #else
460   #define CYTHON_PEP393_ENABLED 0
461   #define PyUnicode_1BYTE_KIND  1
462   #define PyUnicode_2BYTE_KIND  2
463   #define PyUnicode_4BYTE_KIND  4
464   #define __Pyx_PyUnicode_READY(op)       (0)
465   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
466   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
467   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
468   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
469   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
470   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
471   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
472   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
473 #endif
474 #if CYTHON_COMPILING_IN_PYPY
475   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
476   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
477 #else
478   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
479   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
480       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
483   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
484 #endif
485 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
486   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
487 #endif
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
489   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
490 #endif
491 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
492 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
493 #if PY_MAJOR_VERSION >= 3
494   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
495 #else
496   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
497 #endif
498 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
499   #define PyObject_ASCII(o)            PyObject_Repr(o)
500 #endif
501 #if PY_MAJOR_VERSION >= 3
502   #define PyBaseString_Type            PyUnicode_Type
503   #define PyStringObject               PyUnicodeObject
504   #define PyString_Type                PyUnicode_Type
505   #define PyString_Check               PyUnicode_Check
506   #define PyString_CheckExact          PyUnicode_CheckExact
507 #ifndef PyObject_Unicode
508   #define PyObject_Unicode             PyObject_Str
509 #endif
510 #endif
511 #if PY_MAJOR_VERSION >= 3
512   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
513   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
514 #else
515   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
516   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
517 #endif
518 #ifndef PySet_CheckExact
519   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
520 #endif
521 #if PY_VERSION_HEX >= 0x030900A4
522   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
523   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
524 #else
525   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
526   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
527 #endif
528 #if CYTHON_ASSUME_SAFE_MACROS
529   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
530 #else
531   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
532 #endif
533 #if PY_MAJOR_VERSION >= 3
534   #define PyIntObject                  PyLongObject
535   #define PyInt_Type                   PyLong_Type
536   #define PyInt_Check(op)              PyLong_Check(op)
537   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
538   #define PyInt_FromString             PyLong_FromString
539   #define PyInt_FromUnicode            PyLong_FromUnicode
540   #define PyInt_FromLong               PyLong_FromLong
541   #define PyInt_FromSize_t             PyLong_FromSize_t
542   #define PyInt_FromSsize_t            PyLong_FromSsize_t
543   #define PyInt_AsLong                 PyLong_AsLong
544   #define PyInt_AS_LONG                PyLong_AS_LONG
545   #define PyInt_AsSsize_t              PyLong_AsSsize_t
546   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
547   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
548   #define PyNumber_Int                 PyNumber_Long
549 #endif
550 #if PY_MAJOR_VERSION >= 3
551   #define PyBoolObject                 PyLongObject
552 #endif
553 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
554   #ifndef PyUnicode_InternFromString
555     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
556   #endif
557 #endif
558 #if PY_VERSION_HEX < 0x030200A4
559   typedef long Py_hash_t;
560   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
561   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
562 #else
563   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
564   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
565 #endif
566 #if PY_MAJOR_VERSION >= 3
567   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
568 #else
569   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
570 #endif
571 #if CYTHON_USE_ASYNC_SLOTS
572   #if PY_VERSION_HEX >= 0x030500B1
573     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
574     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
575   #else
576     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
577   #endif
578 #else
579   #define __Pyx_PyType_AsAsync(obj) NULL
580 #endif
581 #ifndef __Pyx_PyAsyncMethodsStruct
582     typedef struct {
583         unaryfunc am_await;
584         unaryfunc am_aiter;
585         unaryfunc am_anext;
586     } __Pyx_PyAsyncMethodsStruct;
587 #endif
588 
589 #if defined(WIN32) || defined(MS_WINDOWS)
590   #define _USE_MATH_DEFINES
591 #endif
592 #include <math.h>
593 #ifdef NAN
594 #define __PYX_NAN() ((float) NAN)
595 #else
__PYX_NAN()596 static CYTHON_INLINE float __PYX_NAN() {
597   float value;
598   memset(&value, 0xFF, sizeof(value));
599   return value;
600 }
601 #endif
602 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
603 #define __Pyx_truncl trunc
604 #else
605 #define __Pyx_truncl truncl
606 #endif
607 
608 #define __PYX_MARK_ERR_POS(f_index, lineno) \
609     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
610 #define __PYX_ERR(f_index, lineno, Ln_error) \
611     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
612 
613 #ifndef __PYX_EXTERN_C
614   #ifdef __cplusplus
615     #define __PYX_EXTERN_C extern "C"
616   #else
617     #define __PYX_EXTERN_C extern
618   #endif
619 #endif
620 
621 #define __PYX_HAVE__cartopy__trace
622 #define __PYX_HAVE_API__cartopy__trace
623 /* Early includes */
624 #include <math.h>
625 #include "numpy/npy_math.h"
626 #include <stdint.h>
627 #include "ios"
628 #include "new"
629 #include "stdexcept"
630 #include "typeinfo"
631 #include <list>
632 #include <vector>
633 #include "geos_c.h"
634 #include "proj_api.h"
635 #include "geodesic.h"
636 #ifdef _OPENMP
637 #include <omp.h>
638 #endif /* _OPENMP */
639 
640 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
641 #define CYTHON_WITHOUT_ASSERTIONS
642 #endif
643 
644 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
645                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
646 
647 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
648 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
649 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
650 #define __PYX_DEFAULT_STRING_ENCODING ""
651 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
652 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
653 #define __Pyx_uchar_cast(c) ((unsigned char)c)
654 #define __Pyx_long_cast(x) ((long)x)
655 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
656     (sizeof(type) < sizeof(Py_ssize_t))  ||\
657     (sizeof(type) > sizeof(Py_ssize_t) &&\
658           likely(v < (type)PY_SSIZE_T_MAX ||\
659                  v == (type)PY_SSIZE_T_MAX)  &&\
660           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
661                                 v == (type)PY_SSIZE_T_MIN)))  ||\
662     (sizeof(type) == sizeof(Py_ssize_t) &&\
663           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
664                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)665 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
666     return (size_t) i < (size_t) limit;
667 }
668 #if defined (__cplusplus) && __cplusplus >= 201103L
669     #include <cstdlib>
670     #define __Pyx_sst_abs(value) std::abs(value)
671 #elif SIZEOF_INT >= SIZEOF_SIZE_T
672     #define __Pyx_sst_abs(value) abs(value)
673 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
674     #define __Pyx_sst_abs(value) labs(value)
675 #elif defined (_MSC_VER)
676     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
677 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
678     #define __Pyx_sst_abs(value) llabs(value)
679 #elif defined (__GNUC__)
680     #define __Pyx_sst_abs(value) __builtin_llabs(value)
681 #else
682     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
683 #endif
684 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
685 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
686 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
687 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
688 #define __Pyx_PyBytes_FromString        PyBytes_FromString
689 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
690 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
691 #if PY_MAJOR_VERSION < 3
692     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
693     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
694 #else
695     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
696     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
697 #endif
698 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
699 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
700 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
701 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
702 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
703 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
704 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
705 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
706 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
707 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
708 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
709 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
710 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
711 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
712 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
713 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)714 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
715     const Py_UNICODE *u_end = u;
716     while (*u_end++) ;
717     return (size_t)(u_end - u - 1);
718 }
719 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
720 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
721 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
722 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
723 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
724 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
725 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
726 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
727 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
728 #define __Pyx_PySequence_Tuple(obj)\
729     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
730 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
731 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
732 #if CYTHON_ASSUME_SAFE_MACROS
733 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
734 #else
735 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
736 #endif
737 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
738 #if PY_MAJOR_VERSION >= 3
739 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
740 #else
741 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
742 #endif
743 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
744 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
745 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)746 static int __Pyx_init_sys_getdefaultencoding_params(void) {
747     PyObject* sys;
748     PyObject* default_encoding = NULL;
749     PyObject* ascii_chars_u = NULL;
750     PyObject* ascii_chars_b = NULL;
751     const char* default_encoding_c;
752     sys = PyImport_ImportModule("sys");
753     if (!sys) goto bad;
754     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
755     Py_DECREF(sys);
756     if (!default_encoding) goto bad;
757     default_encoding_c = PyBytes_AsString(default_encoding);
758     if (!default_encoding_c) goto bad;
759     if (strcmp(default_encoding_c, "ascii") == 0) {
760         __Pyx_sys_getdefaultencoding_not_ascii = 0;
761     } else {
762         char ascii_chars[128];
763         int c;
764         for (c = 0; c < 128; c++) {
765             ascii_chars[c] = c;
766         }
767         __Pyx_sys_getdefaultencoding_not_ascii = 1;
768         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
769         if (!ascii_chars_u) goto bad;
770         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
771         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
772             PyErr_Format(
773                 PyExc_ValueError,
774                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
775                 default_encoding_c);
776             goto bad;
777         }
778         Py_DECREF(ascii_chars_u);
779         Py_DECREF(ascii_chars_b);
780     }
781     Py_DECREF(default_encoding);
782     return 0;
783 bad:
784     Py_XDECREF(default_encoding);
785     Py_XDECREF(ascii_chars_u);
786     Py_XDECREF(ascii_chars_b);
787     return -1;
788 }
789 #endif
790 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
791 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
792 #else
793 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
794 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
795 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)796 static int __Pyx_init_sys_getdefaultencoding_params(void) {
797     PyObject* sys;
798     PyObject* default_encoding = NULL;
799     char* default_encoding_c;
800     sys = PyImport_ImportModule("sys");
801     if (!sys) goto bad;
802     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
803     Py_DECREF(sys);
804     if (!default_encoding) goto bad;
805     default_encoding_c = PyBytes_AsString(default_encoding);
806     if (!default_encoding_c) goto bad;
807     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
808     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
809     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
810     Py_DECREF(default_encoding);
811     return 0;
812 bad:
813     Py_XDECREF(default_encoding);
814     return -1;
815 }
816 #endif
817 #endif
818 
819 
820 /* Test for GCC > 2.95 */
821 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
822   #define likely(x)   __builtin_expect(!!(x), 1)
823   #define unlikely(x) __builtin_expect(!!(x), 0)
824 #else /* !__GNUC__ or GCC < 2.95 */
825   #define likely(x)   (x)
826   #define unlikely(x) (x)
827 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)828 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
829 
830 static PyObject *__pyx_m = NULL;
831 static PyObject *__pyx_d;
832 static PyObject *__pyx_b;
833 static PyObject *__pyx_cython_runtime = NULL;
834 static PyObject *__pyx_empty_tuple;
835 static PyObject *__pyx_empty_bytes;
836 static PyObject *__pyx_empty_unicode;
837 static int __pyx_lineno;
838 static int __pyx_clineno = 0;
839 static const char * __pyx_cfilenm= __FILE__;
840 static const char *__pyx_filename;
841 
842 
843 static const char *__pyx_f[] = {
844   "lib/cartopy/trace.pyx",
845   "stringsource",
846   "lib/cartopy/_crs.pxd",
847 };
848 
849 /*--- Type declarations ---*/
850 struct __pyx_obj_7cartopy_4_crs_CRS;
851 struct __pyx_obj_7cartopy_5trace_LineAccumulator;
852 struct __pyx_obj_7cartopy_5trace_Interpolator;
853 struct __pyx_obj_7cartopy_5trace_CartesianInterpolator;
854 struct __pyx_obj_7cartopy_5trace_SphericalInterpolator;
855 struct __pyx_t_7cartopy_5trace_Point;
856 typedef struct __pyx_t_7cartopy_5trace_Point __pyx_t_7cartopy_5trace_Point;
857 
858 /* "cartopy/trace.pyx":271
859  *
860  *
861  * cdef enum State:             # <<<<<<<<<<<<<<
862  *     POINT_IN = 1,
863  *     POINT_OUT,
864  */
865 enum __pyx_t_7cartopy_5trace_State {
866   __pyx_e_7cartopy_5trace_POINT_IN = 1,
867   __pyx_e_7cartopy_5trace_POINT_OUT,
868   __pyx_e_7cartopy_5trace_POINT_NAN
869 };
870 
871 /* "cartopy/trace.pyx":81
872  *
873  *
874  * ctypedef struct Point:             # <<<<<<<<<<<<<<
875  *     double x
876  *     double y
877  */
878 struct __pyx_t_7cartopy_5trace_Point {
879   double x;
880   double y;
881 };
882 
883 /* "cartopy/trace.pyx":85
884  *     double y
885  *
886  * ctypedef list[Point] Line             # <<<<<<<<<<<<<<
887  *
888  *
889  */
890 typedef std::list<__pyx_t_7cartopy_5trace_Point>  __pyx_t_7cartopy_5trace_Line;
891 
892 /* "cartopy/_crs.pxd":10
893  *
894  *
895  * cdef class CRS:             # <<<<<<<<<<<<<<
896  *     """
897  *     Defines a Coordinate Reference System using proj.
898  */
899 struct __pyx_obj_7cartopy_4_crs_CRS {
900   PyObject_HEAD
901   struct __pyx_vtabstruct_7cartopy_4_crs_CRS *__pyx_vtab;
902   projPJ proj4;
903   PyObject *proj4_init;
904   PyObject *proj4_params;
905 };
906 
907 
908 /* "cartopy/trace.pyx":97
909  *
910  * @cython.final
911  * cdef class LineAccumulator:             # <<<<<<<<<<<<<<
912  *     cdef list[Line] lines
913  *
914  */
915 struct __pyx_obj_7cartopy_5trace_LineAccumulator {
916   PyObject_HEAD
917   struct __pyx_vtabstruct_7cartopy_5trace_LineAccumulator *__pyx_vtab;
918   std::list<__pyx_t_7cartopy_5trace_Line>  lines;
919 };
920 
921 
922 /* "cartopy/trace.pyx":160
923  *
924  *
925  * cdef class Interpolator:             # <<<<<<<<<<<<<<
926  *     cdef Point start
927  *     cdef Point end
928  */
929 struct __pyx_obj_7cartopy_5trace_Interpolator {
930   PyObject_HEAD
931   struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *__pyx_vtab;
932   __pyx_t_7cartopy_5trace_Point start;
933   __pyx_t_7cartopy_5trace_Point end;
934   projPJ src_proj;
935   projPJ dest_proj;
936   double src_scale;
937   double dest_scale;
938 };
939 
940 
941 /* "cartopy/trace.pyx":187
942  *
943  *
944  * cdef class CartesianInterpolator(Interpolator):             # <<<<<<<<<<<<<<
945  *     cdef Point interpolate(self, double t):
946  *         cdef Point xy
947  */
948 struct __pyx_obj_7cartopy_5trace_CartesianInterpolator {
949   struct __pyx_obj_7cartopy_5trace_Interpolator __pyx_base;
950 };
951 
952 
953 /* "cartopy/trace.pyx":217
954  *
955  *
956  * cdef class SphericalInterpolator(Interpolator):             # <<<<<<<<<<<<<<
957  *     cdef geod_geodesic geod
958  *     cdef geod_geodesicline geod_line
959  */
960 struct __pyx_obj_7cartopy_5trace_SphericalInterpolator {
961   struct __pyx_obj_7cartopy_5trace_Interpolator __pyx_base;
962   struct geod_geodesic geod;
963   struct geod_geodesicline geod_line;
964   double a13;
965 };
966 
967 
968 
969 /* "cartopy/_crs.pxd":10
970  *
971  *
972  * cdef class CRS:             # <<<<<<<<<<<<<<
973  *     """
974  *     Defines a Coordinate Reference System using proj.
975  */
976 
977 struct __pyx_vtabstruct_7cartopy_4_crs_CRS {
978   PyObject *(*is_geodetic)(struct __pyx_obj_7cartopy_4_crs_CRS *, int __pyx_skip_dispatch);
979 };
980 static struct __pyx_vtabstruct_7cartopy_4_crs_CRS *__pyx_vtabptr_7cartopy_4_crs_CRS;
981 
982 
983 /* "cartopy/trace.pyx":97
984  *
985  * @cython.final
986  * cdef class LineAccumulator:             # <<<<<<<<<<<<<<
987  *     cdef list[Line] lines
988  *
989  */
990 
991 struct __pyx_vtabstruct_7cartopy_5trace_LineAccumulator {
992   void (*new_line)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *);
993   void (*add_point)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &);
994   void (*add_point_if_empty)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &);
995   GEOSGeometry *(*as_geom)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, GEOSContextHandle_t);
996   size_t (*size)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *);
997 };
998 static struct __pyx_vtabstruct_7cartopy_5trace_LineAccumulator *__pyx_vtabptr_7cartopy_5trace_LineAccumulator;
999 static void __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(struct __pyx_obj_7cartopy_5trace_LineAccumulator *);
1000 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &);
1001 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &);
1002 static GEOSGeometry *__pyx_f_7cartopy_5trace_15LineAccumulator_as_geom(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, GEOSContextHandle_t);
1003 static size_t __pyx_f_7cartopy_5trace_15LineAccumulator_size(struct __pyx_obj_7cartopy_5trace_LineAccumulator *);
1004 
1005 
1006 /* "cartopy/trace.pyx":160
1007  *
1008  *
1009  * cdef class Interpolator:             # <<<<<<<<<<<<<<
1010  *     cdef Point start
1011  *     cdef Point end
1012  */
1013 
1014 struct __pyx_vtabstruct_7cartopy_5trace_Interpolator {
1015   void (*init)(struct __pyx_obj_7cartopy_5trace_Interpolator *, projPJ, projPJ);
1016   void (*set_line)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &, __pyx_t_7cartopy_5trace_Point const &);
1017   __pyx_t_7cartopy_5trace_Point (*interpolate)(struct __pyx_obj_7cartopy_5trace_Interpolator *, double);
1018   __pyx_t_7cartopy_5trace_Point (*project)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &);
1019 };
1020 static struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *__pyx_vtabptr_7cartopy_5trace_Interpolator;
1021 
1022 
1023 /* "cartopy/trace.pyx":187
1024  *
1025  *
1026  * cdef class CartesianInterpolator(Interpolator):             # <<<<<<<<<<<<<<
1027  *     cdef Point interpolate(self, double t):
1028  *         cdef Point xy
1029  */
1030 
1031 struct __pyx_vtabstruct_7cartopy_5trace_CartesianInterpolator {
1032   struct __pyx_vtabstruct_7cartopy_5trace_Interpolator __pyx_base;
1033 };
1034 static struct __pyx_vtabstruct_7cartopy_5trace_CartesianInterpolator *__pyx_vtabptr_7cartopy_5trace_CartesianInterpolator;
1035 
1036 
1037 /* "cartopy/trace.pyx":217
1038  *
1039  *
1040  * cdef class SphericalInterpolator(Interpolator):             # <<<<<<<<<<<<<<
1041  *     cdef geod_geodesic geod
1042  *     cdef geod_geodesicline geod_line
1043  */
1044 
1045 struct __pyx_vtabstruct_7cartopy_5trace_SphericalInterpolator {
1046   struct __pyx_vtabstruct_7cartopy_5trace_Interpolator __pyx_base;
1047 };
1048 static struct __pyx_vtabstruct_7cartopy_5trace_SphericalInterpolator *__pyx_vtabptr_7cartopy_5trace_SphericalInterpolator;
1049 
1050 /* --- Runtime support code (head) --- */
1051 /* Refnanny.proto */
1052 #ifndef CYTHON_REFNANNY
1053   #define CYTHON_REFNANNY 0
1054 #endif
1055 #if CYTHON_REFNANNY
1056   typedef struct {
1057     void (*INCREF)(void*, PyObject*, int);
1058     void (*DECREF)(void*, PyObject*, int);
1059     void (*GOTREF)(void*, PyObject*, int);
1060     void (*GIVEREF)(void*, PyObject*, int);
1061     void* (*SetupContext)(const char*, int, const char*);
1062     void (*FinishContext)(void**);
1063   } __Pyx_RefNannyAPIStruct;
1064   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1065   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1066   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1067 #ifdef WITH_THREAD
1068   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1069           if (acquire_gil) {\
1070               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1071               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1072               PyGILState_Release(__pyx_gilstate_save);\
1073           } else {\
1074               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1075           }
1076 #else
1077   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1078           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1079 #endif
1080   #define __Pyx_RefNannyFinishContext()\
1081           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1082   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1083   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1084   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1085   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1086   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1087   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1088   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1089   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1090 #else
1091   #define __Pyx_RefNannyDeclarations
1092   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1093   #define __Pyx_RefNannyFinishContext()
1094   #define __Pyx_INCREF(r) Py_INCREF(r)
1095   #define __Pyx_DECREF(r) Py_DECREF(r)
1096   #define __Pyx_GOTREF(r)
1097   #define __Pyx_GIVEREF(r)
1098   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1099   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1100   #define __Pyx_XGOTREF(r)
1101   #define __Pyx_XGIVEREF(r)
1102 #endif
1103 #define __Pyx_XDECREF_SET(r, v) do {\
1104         PyObject *tmp = (PyObject *) r;\
1105         r = v; __Pyx_XDECREF(tmp);\
1106     } while (0)
1107 #define __Pyx_DECREF_SET(r, v) do {\
1108         PyObject *tmp = (PyObject *) r;\
1109         r = v; __Pyx_DECREF(tmp);\
1110     } while (0)
1111 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1112 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1113 
1114 /* PyObjectGetAttrStr.proto */
1115 #if CYTHON_USE_TYPE_SLOTS
1116 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1117 #else
1118 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1119 #endif
1120 
1121 /* GetBuiltinName.proto */
1122 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1123 
1124 /* PyDictVersioning.proto */
1125 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1126 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1127 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1128 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1129     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1130     (cache_var) = (value);
1131 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1132     static PY_UINT64_T __pyx_dict_version = 0;\
1133     static PyObject *__pyx_dict_cached_value = NULL;\
1134     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1135         (VAR) = __pyx_dict_cached_value;\
1136     } else {\
1137         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1138         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1139     }\
1140 }
1141 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1142 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1143 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1144 #else
1145 #define __PYX_GET_DICT_VERSION(dict)  (0)
1146 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1147 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1148 #endif
1149 
1150 /* GetModuleGlobalName.proto */
1151 #if CYTHON_USE_DICT_VERSIONS
1152 #define __Pyx_GetModuleGlobalName(var, name)  {\
1153     static PY_UINT64_T __pyx_dict_version = 0;\
1154     static PyObject *__pyx_dict_cached_value = NULL;\
1155     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1156         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1157         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1158 }
1159 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1160     PY_UINT64_T __pyx_dict_version;\
1161     PyObject *__pyx_dict_cached_value;\
1162     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1163 }
1164 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1165 #else
1166 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1167 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1168 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1169 #endif
1170 
1171 /* PyThreadStateGet.proto */
1172 #if CYTHON_FAST_THREAD_STATE
1173 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1174 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1175 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1176 #else
1177 #define __Pyx_PyThreadState_declare
1178 #define __Pyx_PyThreadState_assign
1179 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1180 #endif
1181 
1182 /* PyErrFetchRestore.proto */
1183 #if CYTHON_FAST_THREAD_STATE
1184 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1185 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1186 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1187 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1188 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1189 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1190 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1191 #if CYTHON_COMPILING_IN_CPYTHON
1192 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1193 #else
1194 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1195 #endif
1196 #else
1197 #define __Pyx_PyErr_Clear() PyErr_Clear()
1198 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1199 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1200 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1201 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1202 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1203 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1204 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1205 #endif
1206 
1207 /* WriteUnraisableException.proto */
1208 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1209                                   int lineno, const char *filename,
1210                                   int full_traceback, int nogil);
1211 
1212 /* PyCFunctionFastCall.proto */
1213 #if CYTHON_FAST_PYCCALL
1214 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1215 #else
1216 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1217 #endif
1218 
1219 /* PyFunctionFastCall.proto */
1220 #if CYTHON_FAST_PYCALL
1221 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1222     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1223 #if 1 || PY_VERSION_HEX < 0x030600B1
1224 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1225 #else
1226 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1227 #endif
1228 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1229     (sizeof(char [1 - 2*!(cond)]) - 1)
1230 #ifndef Py_MEMBER_SIZE
1231 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1232 #endif
1233   static size_t __pyx_pyframe_localsplus_offset = 0;
1234   #include "frameobject.h"
1235   #define __Pxy_PyFrame_Initialize_Offsets()\
1236     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1237      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1238   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1239     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1240 #endif
1241 
1242 /* PyObjectCall.proto */
1243 #if CYTHON_COMPILING_IN_CPYTHON
1244 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1245 #else
1246 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1247 #endif
1248 
1249 /* PyObjectCall2Args.proto */
1250 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1251 
1252 /* PyObjectCallMethO.proto */
1253 #if CYTHON_COMPILING_IN_CPYTHON
1254 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1255 #endif
1256 
1257 /* PyObjectCallOneArg.proto */
1258 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1259 
1260 /* RaiseArgTupleInvalid.proto */
1261 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1262     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1263 
1264 /* KeywordStringCheck.proto */
1265 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1266 
1267 /* PyErrExceptionMatches.proto */
1268 #if CYTHON_FAST_THREAD_STATE
1269 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1270 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1271 #else
1272 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1273 #endif
1274 
1275 /* GetAttr.proto */
1276 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1277 
1278 /* GetAttr3.proto */
1279 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1280 
1281 /* RaiseException.proto */
1282 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1283 
1284 /* PyObjectCallNoArg.proto */
1285 #if CYTHON_COMPILING_IN_CPYTHON
1286 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1287 #else
1288 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1289 #endif
1290 
1291 /* IncludeStringH.proto */
1292 #include <string.h>
1293 
1294 /* BytesEquals.proto */
1295 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1296 
1297 /* UnicodeEquals.proto */
1298 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1299 
1300 /* StrEquals.proto */
1301 #if PY_MAJOR_VERSION >= 3
1302 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1303 #else
1304 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1305 #endif
1306 
1307 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)1308 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1309     int result = PySequence_Contains(seq, item);
1310     return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1311 }
1312 
1313 /* DictGetItem.proto */
1314 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1315 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1316 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1317     (likely(PyDict_CheckExact(obj)) ?\
1318      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1319 #else
1320 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1321 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1322 #endif
1323 
1324 /* RaiseDoubleKeywords.proto */
1325 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1326 
1327 /* ParseKeywords.proto */
1328 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1329     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1330     const char* function_name);
1331 
1332 /* ArgTypeTest.proto */
1333 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1334     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1335         __Pyx__ArgTypeTest(obj, type, name, exact))
1336 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1337 
1338 /* ExtTypeTest.proto */
1339 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1340 
1341 /* Import.proto */
1342 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1343 
1344 /* ImportFrom.proto */
1345 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1346 
1347 /* GetItemInt.proto */
1348 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1349     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1350     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1351     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1352                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1353 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1354     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1355     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1356     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1357 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1358                                                               int wraparound, int boundscheck);
1359 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1360     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1361     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1362     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1363 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1364                                                               int wraparound, int boundscheck);
1365 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1366 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1367                                                      int is_list, int wraparound, int boundscheck);
1368 
1369 /* HasAttr.proto */
1370 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1371 
1372 /* ListAppend.proto */
1373 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1374 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1375     PyListObject* L = (PyListObject*) list;
1376     Py_ssize_t len = Py_SIZE(list);
1377     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1378         Py_INCREF(x);
1379         PyList_SET_ITEM(list, len, x);
1380         __Pyx_SET_SIZE(list, len + 1);
1381         return 0;
1382     }
1383     return PyList_Append(list, x);
1384 }
1385 #else
1386 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1387 #endif
1388 
1389 /* GetTopmostException.proto */
1390 #if CYTHON_USE_EXC_INFO_STACK
1391 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1392 #endif
1393 
1394 /* SaveResetException.proto */
1395 #if CYTHON_FAST_THREAD_STATE
1396 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1397 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1398 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1399 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1400 #else
1401 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1402 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1403 #endif
1404 
1405 /* GetException.proto */
1406 #if CYTHON_FAST_THREAD_STATE
1407 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1408 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1409 #else
1410 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1411 #endif
1412 
1413 /* PyObject_GenericGetAttrNoDict.proto */
1414 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1415 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1416 #else
1417 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1418 #endif
1419 
1420 /* SetVTable.proto */
1421 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1422 
1423 /* PyObjectGetAttrStrNoError.proto */
1424 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1425 
1426 /* SetupReduce.proto */
1427 static int __Pyx_setup_reduce(PyObject* type_obj);
1428 
1429 /* PyObject_GenericGetAttr.proto */
1430 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1431 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1432 #else
1433 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1434 #endif
1435 
1436 /* TypeImport.proto */
1437 #ifndef __PYX_HAVE_RT_ImportType_proto
1438 #define __PYX_HAVE_RT_ImportType_proto
1439 enum __Pyx_ImportType_CheckSize {
1440    __Pyx_ImportType_CheckSize_Error = 0,
1441    __Pyx_ImportType_CheckSize_Warn = 1,
1442    __Pyx_ImportType_CheckSize_Ignore = 2
1443 };
1444 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1445 #endif
1446 
1447 /* GetVTable.proto */
1448 static void* __Pyx_GetVtable(PyObject *dict);
1449 
1450 /* FetchCommonType.proto */
1451 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1452 
1453 /* CythonFunctionShared.proto */
1454 #define __Pyx_CyFunction_USED 1
1455 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1456 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1457 #define __Pyx_CYFUNCTION_CCLASS        0x04
1458 #define __Pyx_CyFunction_GetClosure(f)\
1459     (((__pyx_CyFunctionObject *) (f))->func_closure)
1460 #define __Pyx_CyFunction_GetClassObj(f)\
1461     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1462 #define __Pyx_CyFunction_Defaults(type, f)\
1463     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1464 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1465     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1466 typedef struct {
1467     PyCFunctionObject func;
1468 #if PY_VERSION_HEX < 0x030500A0
1469     PyObject *func_weakreflist;
1470 #endif
1471     PyObject *func_dict;
1472     PyObject *func_name;
1473     PyObject *func_qualname;
1474     PyObject *func_doc;
1475     PyObject *func_globals;
1476     PyObject *func_code;
1477     PyObject *func_closure;
1478     PyObject *func_classobj;
1479     void *defaults;
1480     int defaults_pyobjects;
1481     size_t defaults_size;  // used by FusedFunction for copying defaults
1482     int flags;
1483     PyObject *defaults_tuple;
1484     PyObject *defaults_kwdict;
1485     PyObject *(*defaults_getter)(PyObject *);
1486     PyObject *func_annotations;
1487 } __pyx_CyFunctionObject;
1488 static PyTypeObject *__pyx_CyFunctionType = 0;
1489 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1490 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1491                                       int flags, PyObject* qualname,
1492                                       PyObject *self,
1493                                       PyObject *module, PyObject *globals,
1494                                       PyObject* code);
1495 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1496                                                          size_t size,
1497                                                          int pyobjects);
1498 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1499                                                             PyObject *tuple);
1500 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1501                                                              PyObject *dict);
1502 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1503                                                               PyObject *dict);
1504 static int __pyx_CyFunction_init(void);
1505 
1506 /* CythonFunction.proto */
1507 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1508                                       int flags, PyObject* qualname,
1509                                       PyObject *closure,
1510                                       PyObject *module, PyObject *globals,
1511                                       PyObject* code);
1512 
1513 /* SetNameInClass.proto */
1514 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1515 #define __Pyx_SetNameInClass(ns, name, value)\
1516     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1517 #elif CYTHON_COMPILING_IN_CPYTHON
1518 #define __Pyx_SetNameInClass(ns, name, value)\
1519     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1520 #else
1521 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1522 #endif
1523 
1524 /* CalculateMetaclass.proto */
1525 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1526 
1527 /* Py3ClassCreate.proto */
1528 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1529                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1530 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1531                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1532 
1533 /* CLineInTraceback.proto */
1534 #ifdef CYTHON_CLINE_IN_TRACEBACK
1535 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1536 #else
1537 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1538 #endif
1539 
1540 /* CodeObjectCache.proto */
1541 typedef struct {
1542     PyCodeObject* code_object;
1543     int code_line;
1544 } __Pyx_CodeObjectCacheEntry;
1545 struct __Pyx_CodeObjectCache {
1546     int count;
1547     int max_count;
1548     __Pyx_CodeObjectCacheEntry* entries;
1549 };
1550 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1551 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1552 static PyCodeObject *__pyx_find_code_object(int code_line);
1553 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1554 
1555 /* AddTraceback.proto */
1556 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1557                                int py_line, const char *filename);
1558 
1559 /* None.proto */
1560 #include <new>
1561 
1562 static PyObject* __pyx_convert__to_py___pyx_t_7cartopy_5trace_Point(__pyx_t_7cartopy_5trace_Point s);
1563 /* GCCDiagnostics.proto */
1564 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1565 #define __Pyx_HAS_GCC_DIAGNOSTIC
1566 #endif
1567 
1568 /* CppExceptionConversion.proto */
1569 #ifndef __Pyx_CppExn2PyErr
1570 #include <new>
1571 #include <typeinfo>
1572 #include <stdexcept>
1573 #include <ios>
__Pyx_CppExn2PyErr()1574 static void __Pyx_CppExn2PyErr() {
1575   try {
1576     if (PyErr_Occurred())
1577       ; // let the latest Python exn pass through and ignore the current one
1578     else
1579       throw;
1580   } catch (const std::bad_alloc& exn) {
1581     PyErr_SetString(PyExc_MemoryError, exn.what());
1582   } catch (const std::bad_cast& exn) {
1583     PyErr_SetString(PyExc_TypeError, exn.what());
1584   } catch (const std::bad_typeid& exn) {
1585     PyErr_SetString(PyExc_TypeError, exn.what());
1586   } catch (const std::domain_error& exn) {
1587     PyErr_SetString(PyExc_ValueError, exn.what());
1588   } catch (const std::invalid_argument& exn) {
1589     PyErr_SetString(PyExc_ValueError, exn.what());
1590   } catch (const std::ios_base::failure& exn) {
1591     PyErr_SetString(PyExc_IOError, exn.what());
1592   } catch (const std::out_of_range& exn) {
1593     PyErr_SetString(PyExc_IndexError, exn.what());
1594   } catch (const std::overflow_error& exn) {
1595     PyErr_SetString(PyExc_OverflowError, exn.what());
1596   } catch (const std::range_error& exn) {
1597     PyErr_SetString(PyExc_ArithmeticError, exn.what());
1598   } catch (const std::underflow_error& exn) {
1599     PyErr_SetString(PyExc_ArithmeticError, exn.what());
1600   } catch (const std::exception& exn) {
1601     PyErr_SetString(PyExc_RuntimeError, exn.what());
1602   }
1603   catch (...)
1604   {
1605     PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
1606   }
1607 }
1608 #endif
1609 
1610 /* CIntFromPy.proto */
1611 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1612 
1613 /* CIntFromPy.proto */
1614 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1615 
1616 /* CIntFromPy.proto */
1617 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1618 
1619 /* CIntToPy.proto */
1620 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1621 
1622 /* CIntFromPy.proto */
1623 static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
1624 
1625 /* CIntToPy.proto */
1626 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
1627 
1628 /* CIntToPy.proto */
1629 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1630 
1631 /* FastTypeChecks.proto */
1632 #if CYTHON_COMPILING_IN_CPYTHON
1633 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1634 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1635 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1636 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1637 #else
1638 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1639 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1640 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1641 #endif
1642 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1643 
1644 /* CheckBinaryVersion.proto */
1645 static int __Pyx_check_binary_version(void);
1646 
1647 /* InitStrings.proto */
1648 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1649 
1650 static void __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self); /* proto*/
1651 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_point); /* proto*/
1652 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_point); /* proto*/
1653 static GEOSGeometry *__pyx_f_7cartopy_5trace_15LineAccumulator_as_geom(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, GEOSContextHandle_t __pyx_v_handle); /* proto*/
1654 static size_t __pyx_f_7cartopy_5trace_15LineAccumulator_size(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self); /* proto*/
1655 static void __pyx_f_7cartopy_5trace_12Interpolator_init(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, projPJ __pyx_v_src_proj, projPJ __pyx_v_dest_proj); /* proto*/
1656 static void __pyx_f_7cartopy_5trace_12Interpolator_set_line(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_end); /* proto*/
1657 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_12Interpolator_interpolate(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED double __pyx_v_t); /* proto*/
1658 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_12Interpolator_project(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED __pyx_t_7cartopy_5trace_Point const &__pyx_v_point); /* proto*/
1659 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21CartesianInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, double __pyx_v_t); /* proto*/
1660 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21CartesianInterpolator_project(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_src_xy); /* proto*/
1661 static void __pyx_f_7cartopy_5trace_21SphericalInterpolator_init(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, projPJ __pyx_v_src_proj, projPJ __pyx_v_dest_proj); /* proto*/
1662 static void __pyx_f_7cartopy_5trace_21SphericalInterpolator_set_line(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_end); /* proto*/
1663 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21SphericalInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, double __pyx_v_t); /* proto*/
1664 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21SphericalInterpolator_project(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_lonlat); /* proto*/
1665 
1666 /* Module declarations from 'cython' */
1667 
1668 /* Module declarations from 'libc.math' */
1669 
1670 /* Module declarations from 'numpy.math' */
1671 
1672 /* Module declarations from 'libc.stdint' */
1673 
1674 /* Module declarations from 'libcpp' */
1675 
1676 /* Module declarations from 'libcpp.list' */
1677 
1678 /* Module declarations from 'libcpp.vector' */
1679 
1680 /* Module declarations from 'cartopy._proj4' */
1681 
1682 /* Module declarations from 'cartopy._crs' */
1683 static PyTypeObject *__pyx_ptype_7cartopy_4_crs_CRS = 0;
1684 
1685 /* Module declarations from 'cartopy.geodesic._geodesic' */
1686 
1687 /* Module declarations from 'cartopy.trace' */
1688 static PyTypeObject *__pyx_ptype_7cartopy_5trace_LineAccumulator = 0;
1689 static PyTypeObject *__pyx_ptype_7cartopy_5trace_Interpolator = 0;
1690 static PyTypeObject *__pyx_ptype_7cartopy_5trace_CartesianInterpolator = 0;
1691 static PyTypeObject *__pyx_ptype_7cartopy_5trace_SphericalInterpolator = 0;
1692 static bool __pyx_v_7cartopy_5trace_DEBUG;
1693 static GEOSContextHandle_t __pyx_f_7cartopy_5trace_get_geos_context_handle(void); /*proto*/
1694 static GEOSGeometry *__pyx_f_7cartopy_5trace_geos_from_shapely(PyObject *); /*proto*/
1695 static PyObject *__pyx_f_7cartopy_5trace_shapely_from_geos(GEOSGeometry *); /*proto*/
1696 static bool __pyx_f_7cartopy_5trace_degenerate_line(__pyx_t_7cartopy_5trace_Line const &); /*proto*/
1697 static bool __pyx_f_7cartopy_5trace_close(double, double); /*proto*/
1698 static enum __pyx_t_7cartopy_5trace_State __pyx_f_7cartopy_5trace_get_state(__pyx_t_7cartopy_5trace_Point const &, GEOSPreparedGeometry const *, GEOSContextHandle_t); /*proto*/
1699 static bool __pyx_f_7cartopy_5trace_straightAndDomain(double, __pyx_t_7cartopy_5trace_Point const &, double, __pyx_t_7cartopy_5trace_Point const &, struct __pyx_obj_7cartopy_5trace_Interpolator *, double, GEOSContextHandle_t, GEOSPreparedGeometry const *, bool); /*proto*/
1700 static void __pyx_f_7cartopy_5trace_bisect(double, __pyx_t_7cartopy_5trace_Point const &, __pyx_t_7cartopy_5trace_Point const &, GEOSContextHandle_t, GEOSPreparedGeometry const *, enum __pyx_t_7cartopy_5trace_State const &, struct __pyx_obj_7cartopy_5trace_Interpolator *, double, double &, __pyx_t_7cartopy_5trace_Point &, double &, __pyx_t_7cartopy_5trace_Point &); /*proto*/
1701 static void __pyx_f_7cartopy_5trace__project_segment(GEOSContextHandle_t, GEOSCoordSequence const *, unsigned int, unsigned int, struct __pyx_obj_7cartopy_5trace_Interpolator *, GEOSPreparedGeometry const *, double, struct __pyx_obj_7cartopy_5trace_LineAccumulator *); /*proto*/
1702 static PyObject *__pyx_f_7cartopy_5trace__interpolator(struct __pyx_obj_7cartopy_4_crs_CRS *, struct __pyx_obj_7cartopy_4_crs_CRS *); /*proto*/
1703 static PyObject *__pyx_f_7cartopy_5trace___pyx_unpickle_LineAccumulator__set_state(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, PyObject *); /*proto*/
1704 static PyObject *__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(std::list<__pyx_t_7cartopy_5trace_Point>  const &); /*proto*/
1705 static PyObject *__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(std::list<__pyx_t_7cartopy_5trace_Line>  const &); /*proto*/
1706 static __pyx_t_7cartopy_5trace_Point __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(PyObject *); /*proto*/
1707 static std::list<__pyx_t_7cartopy_5trace_Point>  __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(PyObject *); /*proto*/
1708 static std::list<__pyx_t_7cartopy_5trace_Line>  __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(PyObject *); /*proto*/
1709 #define __Pyx_MODULE_NAME "cartopy.trace"
1710 extern int __pyx_module_is_main_cartopy__trace;
1711 int __pyx_module_is_main_cartopy__trace = 0;
1712 
1713 /* Implementation of 'cartopy.trace' */
1714 static PyObject *__pyx_builtin_staticmethod;
1715 static PyObject *__pyx_builtin_enumerate;
1716 static PyObject *__pyx_builtin_NotImplementedError;
1717 static PyObject *__pyx_builtin_TypeError;
1718 static PyObject *__pyx_builtin_print;
1719 static PyObject *__pyx_builtin_range;
1720 static PyObject *__pyx_builtin_KeyError;
1721 static PyObject *__pyx_builtin_ValueError;
1722 static const char __pyx_k_t[] = "t: ";
1723 static const char __pyx_k_x[] = "x";
1724 static const char __pyx_k_y[] = "y";
1725 static const char __pyx_k_IN[] = "IN";
1726 static const char __pyx_k__8[] = "   ";
1727 static const char __pyx_k__9[] = ", ";
1728 static const char __pyx_k_p0[] = "p0";
1729 static const char __pyx_k_p1[] = "p1";
1730 static const char __pyx_k_to[] = "to";
1731 static const char __pyx_k_NAN[] = "NAN";
1732 static const char __pyx_k_OUT[] = "OUT";
1733 static const char __pyx_k__11[] = " (";
1734 static const char __pyx_k__15[] = ")";
1735 static const char __pyx_k__17[] = "   => ";
1736 static const char __pyx_k__18[] = "   => (";
1737 static const char __pyx_k__22[] = "";
1738 static const char __pyx_k__27[] = "*";
1739 static const char __pyx_k_doc[] = "__doc__";
1740 static const char __pyx_k_end[] = "end";
1741 static const char __pyx_k_get[] = "get";
1742 static const char __pyx_k_new[] = "__new__";
1743 static const char __pyx_k_t_2[] = "t";
1744 static const char __pyx_k_base[] = "base";
1745 static const char __pyx_k_dict[] = "__dict__";
1746 static const char __pyx_k_geom[] = "_geom";
1747 static const char __pyx_k_main[] = "__main__";
1748 static const char __pyx_k_name[] = "__name__";
1749 static const char __pyx_k_proj[] = "proj";
1750 static const char __pyx_k_test[] = "__test__";
1751 static const char __pyx_k_to_2[] = ") to (";
1752 static const char __pyx_k_l_end[] = "l_end";
1753 static const char __pyx_k_lgeos[] = "lgeos";
1754 static const char __pyx_k_lines[] = "lines";
1755 static const char __pyx_k_print[] = "print";
1756 static const char __pyx_k_range[] = "range";
1757 static const char __pyx_k_sgeom[] = "sgeom";
1758 static const char __pyx_k_start[] = "start";
1759 static const char __pyx_k_state[] = "state";
1760 static const char __pyx_k_t_end[] = "t_end";
1761 static const char __pyx_k_valid[] = "   => valid: ";
1762 static const char __pyx_k_domain[] = "domain";
1763 static const char __pyx_k_handle[] = "handle";
1764 static const char __pyx_k_import[] = "__import__";
1765 static const char __pyx_k_interp[] = "interp";
1766 static const char __pyx_k_latlon[] = "latlon";
1767 static const char __pyx_k_lonlat[] = "lonlat";
1768 static const char __pyx_k_module[] = "__module__";
1769 static const char __pyx_k_o_proj[] = "o_proj";
1770 static const char __pyx_k_pickle[] = "pickle";
1771 static const char __pyx_k_reduce[] = "__reduce__";
1772 static const char __pyx_k_update[] = "update";
1773 static const char __pyx_k_Testing[] = "_Testing";
1774 static const char __pyx_k_l_start[] = "l_start";
1775 static const char __pyx_k_latlong[] = "latlong";
1776 static const char __pyx_k_longlat[] = "longlat";
1777 static const char __pyx_k_ob_tran[] = "ob_tran";
1778 static const char __pyx_k_prepare[] = "__prepare__";
1779 static const char __pyx_k_src_crs[] = "src_crs";
1780 static const char __pyx_k_src_idx[] = "src_idx";
1781 static const char __pyx_k_t_start[] = "t_start";
1782 static const char __pyx_k_valid_2[] = "valid";
1783 static const char __pyx_k_KeyError[] = "KeyError";
1784 static const char __pyx_k_g_domain[] = "g_domain";
1785 static const char __pyx_k_g_linear[] = "g_linear";
1786 static const char __pyx_k_geometry[] = "geometry";
1787 static const char __pyx_k_getstate[] = "__getstate__";
1788 static const char __pyx_k_pyx_type[] = "__pyx_type";
1789 static const char __pyx_k_qualname[] = "__qualname__";
1790 static const char __pyx_k_setstate[] = "__setstate__";
1791 static const char __pyx_k_src_size[] = "src_size";
1792 static const char __pyx_k_to_meter[] = "to_meter";
1793 static const char __pyx_k_TypeError[] = "TypeError";
1794 static const char __pyx_k_enumerate[] = "enumerate";
1795 static const char __pyx_k_gp_domain[] = "gp_domain";
1796 static const char __pyx_k_metaclass[] = "__metaclass__";
1797 static const char __pyx_k_pyx_state[] = "__pyx_state";
1798 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1799 static const char __pyx_k_threshold[] = "threshold";
1800 static const char __pyx_k_ValueError[] = "ValueError";
1801 static const char __pyx_k_pyx_result[] = "__pyx_result";
1802 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1803 static const char __pyx_k_source_crs[] = "source_crs";
1804 static const char __pyx_k_src_coords[] = "src_coords";
1805 static const char __pyx_k_PickleError[] = "PickleError";
1806 static const char __pyx_k_geos_handle[] = "geos_handle";
1807 static const char __pyx_k_interp_t_pt[] = "interp_t_pt";
1808 static const char __pyx_k_Interpolator[] = "Interpolator";
1809 static const char __pyx_k_Projected_as[] = "Projected as:";
1810 static const char __pyx_k_Setting_line[] = "Setting line:";
1811 static const char __pyx_k_cartopy__crs[] = "cartopy._crs";
1812 static const char __pyx_k_geom_factory[] = "geom_factory";
1813 static const char __pyx_k_interpolator[] = "interpolator";
1814 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1815 static const char __pyx_k_shapely_geos[] = "shapely.geos";
1816 static const char __pyx_k_staticmethod[] = "staticmethod";
1817 static const char __pyx_k_stringsource[] = "stringsource";
1818 static const char __pyx_k_PROJ4_VERSION[] = "PROJ4_VERSION";
1819 static const char __pyx_k_cartopy_trace[] = "cartopy.trace";
1820 static const char __pyx_k_interp_prj_pt[] = "interp_prj_pt";
1821 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1822 static const char __pyx_k_Bisecting_from[] = "Bisecting from: ";
1823 static const char __pyx_k_project_linear[] = "project_linear";
1824 static const char __pyx_k_LineAccumulator[] = "LineAccumulator";
1825 static const char __pyx_k_dest_projection[] = "dest_projection";
1826 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1827 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1828 static const char __pyx_k_shapely_geometry[] = "shapely.geometry";
1829 static const char __pyx_k_multi_line_string[] = "multi_line_string";
1830 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1831 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1832 static const char __pyx_k_Testing_interp_t_pt[] = "_Testing.interp_t_pt";
1833 static const char __pyx_k_g_multi_line_string[] = "g_multi_line_string";
1834 static const char __pyx_k_straight_and_within[] = "straight_and_within";
1835 static const char __pyx_k_Testing_interpolator[] = "_Testing.interpolator";
1836 static const char __pyx_k_CartesianInterpolator[] = "CartesianInterpolator";
1837 static const char __pyx_k_SphericalInterpolator[] = "SphericalInterpolator";
1838 static const char __pyx_k_Testing_interp_prj_pt[] = "_Testing.interp_prj_pt";
1839 static const char __pyx_k_lib_cartopy_trace_pyx[] = "lib/cartopy/trace.pyx";
1840 static const char __pyx_k_p_start_inside_domain[] = "p_start_inside_domain";
1841 static const char __pyx_k_destination_projection[] = "destination_projection";
1842 static const char __pyx_k_pj_transform_failed_d_s[] = "pj_transform failed: %d\n%s";
1843 static const char __pyx_k_Testing_straight_and_within[] = "_Testing.straight_and_within";
1844 static const char __pyx_k_pyx_unpickle_LineAccumulator[] = "__pyx_unpickle_LineAccumulator";
1845 static const char __pyx_k_This_module_pulls_together_proj[] = "\nThis module pulls together proj, GEOS and ``_crs.pyx`` to implement a function\nto project a `~shapely.geometry.LinearRing` / `~shapely.geometry.LineString`.\nIn general, this should never be called manually, instead leaving the\nprocessing to be done by the :class:`cartopy.crs.Projection` subclasses.\n";
1846 static const char __pyx_k_Incompatible_checksums_s_vs_0x98[] = "Incompatible checksums (%s vs 0x980da98 = (lines))";
1847 static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'x'";
1848 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1849 static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'y'";
1850 static PyObject *__pyx_kp_s_Bisecting_from;
1851 static PyObject *__pyx_n_s_CartesianInterpolator;
1852 static PyObject *__pyx_n_s_IN;
1853 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x98;
1854 static PyObject *__pyx_n_s_Interpolator;
1855 static PyObject *__pyx_n_s_KeyError;
1856 static PyObject *__pyx_n_s_LineAccumulator;
1857 static PyObject *__pyx_n_s_NAN;
1858 static PyObject *__pyx_kp_s_No_value_specified_for_struct_at;
1859 static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_2;
1860 static PyObject *__pyx_n_s_NotImplementedError;
1861 static PyObject *__pyx_n_s_OUT;
1862 static PyObject *__pyx_n_s_PROJ4_VERSION;
1863 static PyObject *__pyx_n_s_PickleError;
1864 static PyObject *__pyx_kp_s_Projected_as;
1865 static PyObject *__pyx_kp_s_Setting_line;
1866 static PyObject *__pyx_n_s_SphericalInterpolator;
1867 static PyObject *__pyx_n_s_Testing;
1868 static PyObject *__pyx_n_s_Testing_interp_prj_pt;
1869 static PyObject *__pyx_n_s_Testing_interp_t_pt;
1870 static PyObject *__pyx_n_s_Testing_interpolator;
1871 static PyObject *__pyx_n_s_Testing_straight_and_within;
1872 static PyObject *__pyx_n_s_TypeError;
1873 static PyObject *__pyx_n_s_ValueError;
1874 static PyObject *__pyx_kp_s__11;
1875 static PyObject *__pyx_kp_s__15;
1876 static PyObject *__pyx_kp_s__17;
1877 static PyObject *__pyx_kp_s__18;
1878 static PyObject *__pyx_kp_s__22;
1879 static PyObject *__pyx_n_s__27;
1880 static PyObject *__pyx_kp_s__8;
1881 static PyObject *__pyx_kp_s__9;
1882 static PyObject *__pyx_n_s_base;
1883 static PyObject *__pyx_n_s_cartopy__crs;
1884 static PyObject *__pyx_n_s_cartopy_trace;
1885 static PyObject *__pyx_n_s_cline_in_traceback;
1886 static PyObject *__pyx_n_s_dest_projection;
1887 static PyObject *__pyx_n_s_destination_projection;
1888 static PyObject *__pyx_n_s_dict;
1889 static PyObject *__pyx_n_s_doc;
1890 static PyObject *__pyx_n_s_domain;
1891 static PyObject *__pyx_n_s_end;
1892 static PyObject *__pyx_n_s_enumerate;
1893 static PyObject *__pyx_n_s_g_domain;
1894 static PyObject *__pyx_n_s_g_linear;
1895 static PyObject *__pyx_n_s_g_multi_line_string;
1896 static PyObject *__pyx_n_s_geom;
1897 static PyObject *__pyx_n_s_geom_factory;
1898 static PyObject *__pyx_n_s_geometry;
1899 static PyObject *__pyx_n_s_geos_handle;
1900 static PyObject *__pyx_n_s_get;
1901 static PyObject *__pyx_n_s_getstate;
1902 static PyObject *__pyx_n_s_gp_domain;
1903 static PyObject *__pyx_n_s_handle;
1904 static PyObject *__pyx_n_s_import;
1905 static PyObject *__pyx_n_s_interp;
1906 static PyObject *__pyx_n_s_interp_prj_pt;
1907 static PyObject *__pyx_n_s_interp_t_pt;
1908 static PyObject *__pyx_n_s_interpolator;
1909 static PyObject *__pyx_n_s_l_end;
1910 static PyObject *__pyx_n_s_l_start;
1911 static PyObject *__pyx_n_s_latlon;
1912 static PyObject *__pyx_n_s_latlong;
1913 static PyObject *__pyx_n_s_lgeos;
1914 static PyObject *__pyx_kp_s_lib_cartopy_trace_pyx;
1915 static PyObject *__pyx_n_s_lines;
1916 static PyObject *__pyx_n_s_longlat;
1917 static PyObject *__pyx_n_s_lonlat;
1918 static PyObject *__pyx_n_s_main;
1919 static PyObject *__pyx_n_s_metaclass;
1920 static PyObject *__pyx_n_s_module;
1921 static PyObject *__pyx_n_s_multi_line_string;
1922 static PyObject *__pyx_n_s_name;
1923 static PyObject *__pyx_n_s_new;
1924 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1925 static PyObject *__pyx_n_s_o_proj;
1926 static PyObject *__pyx_n_s_ob_tran;
1927 static PyObject *__pyx_n_s_p0;
1928 static PyObject *__pyx_n_s_p1;
1929 static PyObject *__pyx_n_s_p_start_inside_domain;
1930 static PyObject *__pyx_n_s_pickle;
1931 static PyObject *__pyx_kp_s_pj_transform_failed_d_s;
1932 static PyObject *__pyx_n_s_prepare;
1933 static PyObject *__pyx_n_s_print;
1934 static PyObject *__pyx_n_s_proj;
1935 static PyObject *__pyx_n_s_project_linear;
1936 static PyObject *__pyx_n_s_pyx_PickleError;
1937 static PyObject *__pyx_n_s_pyx_checksum;
1938 static PyObject *__pyx_n_s_pyx_result;
1939 static PyObject *__pyx_n_s_pyx_state;
1940 static PyObject *__pyx_n_s_pyx_type;
1941 static PyObject *__pyx_n_s_pyx_unpickle_LineAccumulator;
1942 static PyObject *__pyx_n_s_pyx_vtable;
1943 static PyObject *__pyx_n_s_qualname;
1944 static PyObject *__pyx_n_s_range;
1945 static PyObject *__pyx_n_s_reduce;
1946 static PyObject *__pyx_n_s_reduce_cython;
1947 static PyObject *__pyx_n_s_reduce_ex;
1948 static PyObject *__pyx_n_s_setstate;
1949 static PyObject *__pyx_n_s_setstate_cython;
1950 static PyObject *__pyx_n_s_sgeom;
1951 static PyObject *__pyx_n_s_shapely_geometry;
1952 static PyObject *__pyx_n_s_shapely_geos;
1953 static PyObject *__pyx_n_s_source_crs;
1954 static PyObject *__pyx_n_s_src_coords;
1955 static PyObject *__pyx_n_s_src_crs;
1956 static PyObject *__pyx_n_s_src_idx;
1957 static PyObject *__pyx_n_s_src_size;
1958 static PyObject *__pyx_n_s_start;
1959 static PyObject *__pyx_n_s_state;
1960 static PyObject *__pyx_n_s_staticmethod;
1961 static PyObject *__pyx_n_s_straight_and_within;
1962 static PyObject *__pyx_kp_s_stringsource;
1963 static PyObject *__pyx_kp_s_t;
1964 static PyObject *__pyx_n_s_t_2;
1965 static PyObject *__pyx_n_s_t_end;
1966 static PyObject *__pyx_n_s_t_start;
1967 static PyObject *__pyx_n_s_test;
1968 static PyObject *__pyx_n_s_threshold;
1969 static PyObject *__pyx_n_s_to;
1970 static PyObject *__pyx_kp_s_to_2;
1971 static PyObject *__pyx_n_s_to_meter;
1972 static PyObject *__pyx_n_s_update;
1973 static PyObject *__pyx_kp_s_valid;
1974 static PyObject *__pyx_n_s_valid_2;
1975 static PyObject *__pyx_n_s_x;
1976 static PyObject *__pyx_n_s_y;
1977 static int __pyx_pf_7cartopy_5trace_15LineAccumulator___init__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self); /* proto */
1978 static PyObject *__pyx_pf_7cartopy_5trace_15LineAccumulator_2__reduce_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self); /* proto */
1979 static PyObject *__pyx_pf_7cartopy_5trace_15LineAccumulator_4__setstate_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1980 static int __pyx_pf_7cartopy_5trace_12Interpolator___cinit__(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self); /* proto */
1981 static PyObject *__pyx_pf_7cartopy_5trace_12Interpolator_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self); /* proto */
1982 static PyObject *__pyx_pf_7cartopy_5trace_12Interpolator_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1983 static PyObject *__pyx_pf_7cartopy_5trace_21CartesianInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self); /* proto */
1984 static PyObject *__pyx_pf_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1985 static PyObject *__pyx_pf_7cartopy_5trace_21SphericalInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self); /* proto */
1986 static PyObject *__pyx_pf_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1987 static PyObject *__pyx_pf_7cartopy_5trace_project_linear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry, struct __pyx_obj_7cartopy_4_crs_CRS *__pyx_v_src_crs, PyObject *__pyx_v_dest_projection); /* proto */
1988 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_straight_and_within(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7cartopy_5trace_Point __pyx_v_l_start, __pyx_t_7cartopy_5trace_Point __pyx_v_l_end, double __pyx_v_t_start, double __pyx_v_t_end, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator, double __pyx_v_threshold, PyObject *__pyx_v_domain); /* proto */
1989 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_2interpolator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source_crs, PyObject *__pyx_v_destination_projection); /* proto */
1990 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_4interp_prj_pt(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp, __pyx_t_7cartopy_5trace_Point __pyx_v_lonlat); /* proto */
1991 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_6interp_t_pt(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp, __pyx_t_7cartopy_5trace_Point __pyx_v_start, __pyx_t_7cartopy_5trace_Point __pyx_v_end, double __pyx_v_t); /* proto */
1992 static PyObject *__pyx_pf_7cartopy_5trace_2__pyx_unpickle_LineAccumulator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1993 static PyObject *__pyx_tp_new_7cartopy_5trace_LineAccumulator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1994 static PyObject *__pyx_tp_new_7cartopy_5trace_Interpolator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1995 static PyObject *__pyx_tp_new_7cartopy_5trace_CartesianInterpolator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1996 static PyObject *__pyx_tp_new_7cartopy_5trace_SphericalInterpolator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1997 static PyObject *__pyx_int_0;
1998 static PyObject *__pyx_int_1;
1999 static PyObject *__pyx_int_3;
2000 static PyObject *__pyx_int_6;
2001 static PyObject *__pyx_int_159439512;
2002 static PyObject *__pyx_tuple_;
2003 static PyObject *__pyx_tuple__2;
2004 static PyObject *__pyx_tuple__3;
2005 static PyObject *__pyx_tuple__4;
2006 static PyObject *__pyx_tuple__5;
2007 static PyObject *__pyx_tuple__6;
2008 static PyObject *__pyx_tuple__7;
2009 static PyObject *__pyx_tuple__10;
2010 static PyObject *__pyx_tuple__12;
2011 static PyObject *__pyx_tuple__13;
2012 static PyObject *__pyx_tuple__14;
2013 static PyObject *__pyx_tuple__16;
2014 static PyObject *__pyx_tuple__19;
2015 static PyObject *__pyx_tuple__20;
2016 static PyObject *__pyx_tuple__21;
2017 static PyObject *__pyx_tuple__23;
2018 static PyObject *__pyx_tuple__24;
2019 static PyObject *__pyx_tuple__25;
2020 static PyObject *__pyx_tuple__26;
2021 static PyObject *__pyx_tuple__28;
2022 static PyObject *__pyx_tuple__30;
2023 static PyObject *__pyx_tuple__32;
2024 static PyObject *__pyx_tuple__34;
2025 static PyObject *__pyx_tuple__36;
2026 static PyObject *__pyx_tuple__38;
2027 static PyObject *__pyx_codeobj__29;
2028 static PyObject *__pyx_codeobj__31;
2029 static PyObject *__pyx_codeobj__33;
2030 static PyObject *__pyx_codeobj__35;
2031 static PyObject *__pyx_codeobj__37;
2032 static PyObject *__pyx_codeobj__39;
2033 /* Late includes */
2034 
2035 /* "cartopy/trace.pyx":65
2036  *
2037  *
2038  * cdef GEOSContextHandle_t get_geos_context_handle():             # <<<<<<<<<<<<<<
2039  *     cdef ptr handle = lgeos.geos_handle
2040  *     return <GEOSContextHandle_t>handle
2041  */
2042 
__pyx_f_7cartopy_5trace_get_geos_context_handle(void)2043 static GEOSContextHandle_t __pyx_f_7cartopy_5trace_get_geos_context_handle(void) {
2044   uintptr_t __pyx_v_handle;
2045   GEOSContextHandle_t __pyx_r;
2046   __Pyx_RefNannyDeclarations
2047   PyObject *__pyx_t_1 = NULL;
2048   PyObject *__pyx_t_2 = NULL;
2049   uintptr_t __pyx_t_3;
2050   int __pyx_lineno = 0;
2051   const char *__pyx_filename = NULL;
2052   int __pyx_clineno = 0;
2053   __Pyx_RefNannySetupContext("get_geos_context_handle", 0);
2054 
2055   /* "cartopy/trace.pyx":66
2056  *
2057  * cdef GEOSContextHandle_t get_geos_context_handle():
2058  *     cdef ptr handle = lgeos.geos_handle             # <<<<<<<<<<<<<<
2059  *     return <GEOSContextHandle_t>handle
2060  *
2061  */
2062   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_lgeos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
2063   __Pyx_GOTREF(__pyx_t_1);
2064   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_geos_handle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
2065   __Pyx_GOTREF(__pyx_t_2);
2066   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2067   __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error)
2068   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2069   __pyx_v_handle = __pyx_t_3;
2070 
2071   /* "cartopy/trace.pyx":67
2072  * cdef GEOSContextHandle_t get_geos_context_handle():
2073  *     cdef ptr handle = lgeos.geos_handle
2074  *     return <GEOSContextHandle_t>handle             # <<<<<<<<<<<<<<
2075  *
2076  *
2077  */
2078   __pyx_r = ((GEOSContextHandle_t)__pyx_v_handle);
2079   goto __pyx_L0;
2080 
2081   /* "cartopy/trace.pyx":65
2082  *
2083  *
2084  * cdef GEOSContextHandle_t get_geos_context_handle():             # <<<<<<<<<<<<<<
2085  *     cdef ptr handle = lgeos.geos_handle
2086  *     return <GEOSContextHandle_t>handle
2087  */
2088 
2089   /* function exit code */
2090   __pyx_L1_error:;
2091   __Pyx_XDECREF(__pyx_t_1);
2092   __Pyx_XDECREF(__pyx_t_2);
2093   __Pyx_WriteUnraisable("cartopy.trace.get_geos_context_handle", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
2094   __pyx_r = 0;
2095   __pyx_L0:;
2096   __Pyx_RefNannyFinishContext();
2097   return __pyx_r;
2098 }
2099 
2100 /* "cartopy/trace.pyx":70
2101  *
2102  *
2103  * cdef GEOSGeometry *geos_from_shapely(shapely_geom) except *:             # <<<<<<<<<<<<<<
2104  *     """Get the GEOS pointer from the given shapely geometry."""
2105  *     cdef ptr geos_geom = shapely_geom._geom
2106  */
2107 
__pyx_f_7cartopy_5trace_geos_from_shapely(PyObject * __pyx_v_shapely_geom)2108 static GEOSGeometry *__pyx_f_7cartopy_5trace_geos_from_shapely(PyObject *__pyx_v_shapely_geom) {
2109   uintptr_t __pyx_v_geos_geom;
2110   GEOSGeometry *__pyx_r;
2111   __Pyx_RefNannyDeclarations
2112   PyObject *__pyx_t_1 = NULL;
2113   uintptr_t __pyx_t_2;
2114   int __pyx_lineno = 0;
2115   const char *__pyx_filename = NULL;
2116   int __pyx_clineno = 0;
2117   __Pyx_RefNannySetupContext("geos_from_shapely", 0);
2118 
2119   /* "cartopy/trace.pyx":72
2120  * cdef GEOSGeometry *geos_from_shapely(shapely_geom) except *:
2121  *     """Get the GEOS pointer from the given shapely geometry."""
2122  *     cdef ptr geos_geom = shapely_geom._geom             # <<<<<<<<<<<<<<
2123  *     return <GEOSGeometry *>geos_geom
2124  *
2125  */
2126   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_shapely_geom, __pyx_n_s_geom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
2127   __Pyx_GOTREF(__pyx_t_1);
2128   __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
2129   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2130   __pyx_v_geos_geom = __pyx_t_2;
2131 
2132   /* "cartopy/trace.pyx":73
2133  *     """Get the GEOS pointer from the given shapely geometry."""
2134  *     cdef ptr geos_geom = shapely_geom._geom
2135  *     return <GEOSGeometry *>geos_geom             # <<<<<<<<<<<<<<
2136  *
2137  *
2138  */
2139   __pyx_r = ((GEOSGeometry *)__pyx_v_geos_geom);
2140   goto __pyx_L0;
2141 
2142   /* "cartopy/trace.pyx":70
2143  *
2144  *
2145  * cdef GEOSGeometry *geos_from_shapely(shapely_geom) except *:             # <<<<<<<<<<<<<<
2146  *     """Get the GEOS pointer from the given shapely geometry."""
2147  *     cdef ptr geos_geom = shapely_geom._geom
2148  */
2149 
2150   /* function exit code */
2151   __pyx_L1_error:;
2152   __Pyx_XDECREF(__pyx_t_1);
2153   __Pyx_AddTraceback("cartopy.trace.geos_from_shapely", __pyx_clineno, __pyx_lineno, __pyx_filename);
2154   __pyx_r = 0;
2155   __pyx_L0:;
2156   __Pyx_RefNannyFinishContext();
2157   return __pyx_r;
2158 }
2159 
2160 /* "cartopy/trace.pyx":76
2161  *
2162  *
2163  * cdef shapely_from_geos(GEOSGeometry *geom):             # <<<<<<<<<<<<<<
2164  *     """Turn the given GEOS geometry pointer into a shapely geometry."""
2165  *     return sgeom.base.geom_factory(<ptr>geom)
2166  */
2167 
__pyx_f_7cartopy_5trace_shapely_from_geos(GEOSGeometry * __pyx_v_geom)2168 static PyObject *__pyx_f_7cartopy_5trace_shapely_from_geos(GEOSGeometry *__pyx_v_geom) {
2169   PyObject *__pyx_r = NULL;
2170   __Pyx_RefNannyDeclarations
2171   PyObject *__pyx_t_1 = NULL;
2172   PyObject *__pyx_t_2 = NULL;
2173   PyObject *__pyx_t_3 = NULL;
2174   PyObject *__pyx_t_4 = NULL;
2175   int __pyx_lineno = 0;
2176   const char *__pyx_filename = NULL;
2177   int __pyx_clineno = 0;
2178   __Pyx_RefNannySetupContext("shapely_from_geos", 0);
2179 
2180   /* "cartopy/trace.pyx":78
2181  * cdef shapely_from_geos(GEOSGeometry *geom):
2182  *     """Turn the given GEOS geometry pointer into a shapely geometry."""
2183  *     return sgeom.base.geom_factory(<ptr>geom)             # <<<<<<<<<<<<<<
2184  *
2185  *
2186  */
2187   __Pyx_XDECREF(__pyx_r);
2188   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sgeom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
2189   __Pyx_GOTREF(__pyx_t_2);
2190   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
2191   __Pyx_GOTREF(__pyx_t_3);
2192   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2193   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_geom_factory); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
2194   __Pyx_GOTREF(__pyx_t_2);
2195   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2196   __pyx_t_3 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_geom)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
2197   __Pyx_GOTREF(__pyx_t_3);
2198   __pyx_t_4 = NULL;
2199   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2200     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
2201     if (likely(__pyx_t_4)) {
2202       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2203       __Pyx_INCREF(__pyx_t_4);
2204       __Pyx_INCREF(function);
2205       __Pyx_DECREF_SET(__pyx_t_2, function);
2206     }
2207   }
2208   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
2209   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2210   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2211   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2212   __Pyx_GOTREF(__pyx_t_1);
2213   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2214   __pyx_r = __pyx_t_1;
2215   __pyx_t_1 = 0;
2216   goto __pyx_L0;
2217 
2218   /* "cartopy/trace.pyx":76
2219  *
2220  *
2221  * cdef shapely_from_geos(GEOSGeometry *geom):             # <<<<<<<<<<<<<<
2222  *     """Turn the given GEOS geometry pointer into a shapely geometry."""
2223  *     return sgeom.base.geom_factory(<ptr>geom)
2224  */
2225 
2226   /* function exit code */
2227   __pyx_L1_error:;
2228   __Pyx_XDECREF(__pyx_t_1);
2229   __Pyx_XDECREF(__pyx_t_2);
2230   __Pyx_XDECREF(__pyx_t_3);
2231   __Pyx_XDECREF(__pyx_t_4);
2232   __Pyx_AddTraceback("cartopy.trace.shapely_from_geos", __pyx_clineno, __pyx_lineno, __pyx_filename);
2233   __pyx_r = 0;
2234   __pyx_L0:;
2235   __Pyx_XGIVEREF(__pyx_r);
2236   __Pyx_RefNannyFinishContext();
2237   return __pyx_r;
2238 }
2239 
2240 /* "cartopy/trace.pyx":88
2241  *
2242  *
2243  * cdef bool degenerate_line(const Line &value):             # <<<<<<<<<<<<<<
2244  *     return value.size() < 2
2245  *
2246  */
2247 
__pyx_f_7cartopy_5trace_degenerate_line(__pyx_t_7cartopy_5trace_Line const & __pyx_v_value)2248 static bool __pyx_f_7cartopy_5trace_degenerate_line(__pyx_t_7cartopy_5trace_Line const &__pyx_v_value) {
2249   bool __pyx_r;
2250   __Pyx_RefNannyDeclarations
2251   __Pyx_RefNannySetupContext("degenerate_line", 0);
2252 
2253   /* "cartopy/trace.pyx":89
2254  *
2255  * cdef bool degenerate_line(const Line &value):
2256  *     return value.size() < 2             # <<<<<<<<<<<<<<
2257  *
2258  *
2259  */
2260   __pyx_r = (__pyx_v_value.size() < 2);
2261   goto __pyx_L0;
2262 
2263   /* "cartopy/trace.pyx":88
2264  *
2265  *
2266  * cdef bool degenerate_line(const Line &value):             # <<<<<<<<<<<<<<
2267  *     return value.size() < 2
2268  *
2269  */
2270 
2271   /* function exit code */
2272   __pyx_L0:;
2273   __Pyx_RefNannyFinishContext();
2274   return __pyx_r;
2275 }
2276 
2277 /* "cartopy/trace.pyx":92
2278  *
2279  *
2280  * cdef bool close(double a, double b):             # <<<<<<<<<<<<<<
2281  *     return abs(a - b) <= (1e-8 + 1e-5 * abs(b))
2282  *
2283  */
2284 
__pyx_f_7cartopy_5trace_close(double __pyx_v_a,double __pyx_v_b)2285 static bool __pyx_f_7cartopy_5trace_close(double __pyx_v_a, double __pyx_v_b) {
2286   bool __pyx_r;
2287   __Pyx_RefNannyDeclarations
2288   __Pyx_RefNannySetupContext("close", 0);
2289 
2290   /* "cartopy/trace.pyx":93
2291  *
2292  * cdef bool close(double a, double b):
2293  *     return abs(a - b) <= (1e-8 + 1e-5 * abs(b))             # <<<<<<<<<<<<<<
2294  *
2295  *
2296  */
2297   __pyx_r = (fabs((__pyx_v_a - __pyx_v_b)) <= (1e-8 + (1e-5 * fabs(__pyx_v_b))));
2298   goto __pyx_L0;
2299 
2300   /* "cartopy/trace.pyx":92
2301  *
2302  *
2303  * cdef bool close(double a, double b):             # <<<<<<<<<<<<<<
2304  *     return abs(a - b) <= (1e-8 + 1e-5 * abs(b))
2305  *
2306  */
2307 
2308   /* function exit code */
2309   __pyx_L0:;
2310   __Pyx_RefNannyFinishContext();
2311   return __pyx_r;
2312 }
2313 
2314 /* "cartopy/trace.pyx":100
2315  *     cdef list[Line] lines
2316  *
2317  *     def __init__(self):             # <<<<<<<<<<<<<<
2318  *         self.new_line()
2319  *
2320  */
2321 
2322 /* Python wrapper */
2323 static int __pyx_pw_7cartopy_5trace_15LineAccumulator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7cartopy_5trace_15LineAccumulator_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2324 static int __pyx_pw_7cartopy_5trace_15LineAccumulator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2325   int __pyx_r;
2326   __Pyx_RefNannyDeclarations
2327   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2328   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
2329     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
2330   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
2331   __pyx_r = __pyx_pf_7cartopy_5trace_15LineAccumulator___init__(((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)__pyx_v_self));
2332 
2333   /* function exit code */
2334   __Pyx_RefNannyFinishContext();
2335   return __pyx_r;
2336 }
2337 
__pyx_pf_7cartopy_5trace_15LineAccumulator___init__(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self)2338 static int __pyx_pf_7cartopy_5trace_15LineAccumulator___init__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self) {
2339   int __pyx_r;
2340   __Pyx_RefNannyDeclarations
2341   __Pyx_RefNannySetupContext("__init__", 0);
2342 
2343   /* "cartopy/trace.pyx":101
2344  *
2345  *     def __init__(self):
2346  *         self.new_line()             # <<<<<<<<<<<<<<
2347  *
2348  *     cdef void new_line(self):
2349  */
2350   __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(__pyx_v_self);
2351 
2352   /* "cartopy/trace.pyx":100
2353  *     cdef list[Line] lines
2354  *
2355  *     def __init__(self):             # <<<<<<<<<<<<<<
2356  *         self.new_line()
2357  *
2358  */
2359 
2360   /* function exit code */
2361   __pyx_r = 0;
2362   __Pyx_RefNannyFinishContext();
2363   return __pyx_r;
2364 }
2365 
2366 /* "cartopy/trace.pyx":103
2367  *         self.new_line()
2368  *
2369  *     cdef void new_line(self):             # <<<<<<<<<<<<<<
2370  *         cdef Line line
2371  *         self.lines.push_back(line)
2372  */
2373 
__pyx_f_7cartopy_5trace_15LineAccumulator_new_line(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self)2374 static void __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self) {
2375   __pyx_t_7cartopy_5trace_Line __pyx_v_line;
2376   __Pyx_RefNannyDeclarations
2377   __Pyx_RefNannySetupContext("new_line", 0);
2378 
2379   /* "cartopy/trace.pyx":105
2380  *     cdef void new_line(self):
2381  *         cdef Line line
2382  *         self.lines.push_back(line)             # <<<<<<<<<<<<<<
2383  *
2384  *     cdef void add_point(self, const Point &point):
2385  */
2386   __pyx_v_self->lines.push_back(__pyx_v_line);
2387 
2388   /* "cartopy/trace.pyx":103
2389  *         self.new_line()
2390  *
2391  *     cdef void new_line(self):             # <<<<<<<<<<<<<<
2392  *         cdef Line line
2393  *         self.lines.push_back(line)
2394  */
2395 
2396   /* function exit code */
2397   __Pyx_RefNannyFinishContext();
2398 }
2399 
2400 /* "cartopy/trace.pyx":107
2401  *         self.lines.push_back(line)
2402  *
2403  *     cdef void add_point(self, const Point &point):             # <<<<<<<<<<<<<<
2404  *         self.lines.back().push_back(point)
2405  *
2406  */
2407 
__pyx_f_7cartopy_5trace_15LineAccumulator_add_point(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_point)2408 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_point) {
2409   __Pyx_RefNannyDeclarations
2410   __Pyx_RefNannySetupContext("add_point", 0);
2411 
2412   /* "cartopy/trace.pyx":108
2413  *
2414  *     cdef void add_point(self, const Point &point):
2415  *         self.lines.back().push_back(point)             # <<<<<<<<<<<<<<
2416  *
2417  *     cdef void add_point_if_empty(self, const Point &point):
2418  */
2419   __pyx_v_self->lines.back().push_back(__pyx_v_point);
2420 
2421   /* "cartopy/trace.pyx":107
2422  *         self.lines.push_back(line)
2423  *
2424  *     cdef void add_point(self, const Point &point):             # <<<<<<<<<<<<<<
2425  *         self.lines.back().push_back(point)
2426  *
2427  */
2428 
2429   /* function exit code */
2430   __Pyx_RefNannyFinishContext();
2431 }
2432 
2433 /* "cartopy/trace.pyx":110
2434  *         self.lines.back().push_back(point)
2435  *
2436  *     cdef void add_point_if_empty(self, const Point &point):             # <<<<<<<<<<<<<<
2437  *         if self.lines.back().empty():
2438  *             self.add_point(point)
2439  */
2440 
__pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_point)2441 static void __pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_point) {
2442   __Pyx_RefNannyDeclarations
2443   int __pyx_t_1;
2444   __Pyx_RefNannySetupContext("add_point_if_empty", 0);
2445 
2446   /* "cartopy/trace.pyx":111
2447  *
2448  *     cdef void add_point_if_empty(self, const Point &point):
2449  *         if self.lines.back().empty():             # <<<<<<<<<<<<<<
2450  *             self.add_point(point)
2451  *
2452  */
2453   __pyx_t_1 = (__pyx_v_self->lines.back().empty() != 0);
2454   if (__pyx_t_1) {
2455 
2456     /* "cartopy/trace.pyx":112
2457  *     cdef void add_point_if_empty(self, const Point &point):
2458  *         if self.lines.back().empty():
2459  *             self.add_point(point)             # <<<<<<<<<<<<<<
2460  *
2461  *     cdef GEOSGeometry *as_geom(self, GEOSContextHandle_t handle):
2462  */
2463     __pyx_f_7cartopy_5trace_15LineAccumulator_add_point(__pyx_v_self, __pyx_v_point);
2464 
2465     /* "cartopy/trace.pyx":111
2466  *
2467  *     cdef void add_point_if_empty(self, const Point &point):
2468  *         if self.lines.back().empty():             # <<<<<<<<<<<<<<
2469  *             self.add_point(point)
2470  *
2471  */
2472   }
2473 
2474   /* "cartopy/trace.pyx":110
2475  *         self.lines.back().push_back(point)
2476  *
2477  *     cdef void add_point_if_empty(self, const Point &point):             # <<<<<<<<<<<<<<
2478  *         if self.lines.back().empty():
2479  *             self.add_point(point)
2480  */
2481 
2482   /* function exit code */
2483   __Pyx_RefNannyFinishContext();
2484 }
2485 
2486 /* "cartopy/trace.pyx":114
2487  *             self.add_point(point)
2488  *
2489  *     cdef GEOSGeometry *as_geom(self, GEOSContextHandle_t handle):             # <<<<<<<<<<<<<<
2490  *         from cython.operator cimport dereference, preincrement
2491  *         # self.lines.remove_if(degenerate_line) is not available in Cython.
2492  */
2493 
__pyx_f_7cartopy_5trace_15LineAccumulator_as_geom(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self,GEOSContextHandle_t __pyx_v_handle)2494 static GEOSGeometry *__pyx_f_7cartopy_5trace_15LineAccumulator_as_geom(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, GEOSContextHandle_t __pyx_v_handle) {
2495   std::list<__pyx_t_7cartopy_5trace_Line> ::iterator __pyx_v_it;
2496   __pyx_t_7cartopy_5trace_Point __pyx_v_first;
2497   __pyx_t_7cartopy_5trace_Point __pyx_v_last;
2498   __pyx_t_7cartopy_5trace_Line __pyx_v_ilines;
2499   __pyx_t_7cartopy_5trace_Point __pyx_v_ipoints;
2500   std::vector<GEOSGeometry *>  __pyx_v_geoms;
2501   int __pyx_v_i;
2502   GEOSCoordSequence *__pyx_v_coords;
2503   GEOSGeometry *__pyx_v_geom;
2504   GEOSGeometry *__pyx_r;
2505   __Pyx_RefNannyDeclarations
2506   int __pyx_t_1;
2507   int __pyx_t_2;
2508   std::list<__pyx_t_7cartopy_5trace_Line> ::iterator __pyx_t_3;
2509   std::list<__pyx_t_7cartopy_5trace_Line>  *__pyx_t_4;
2510   __pyx_t_7cartopy_5trace_Line __pyx_t_5;
2511   int __pyx_t_6;
2512   PyObject *__pyx_t_7 = NULL;
2513   PyObject *__pyx_t_8 = NULL;
2514   Py_ssize_t __pyx_t_9;
2515   PyObject *(*__pyx_t_10)(PyObject *);
2516   __pyx_t_7cartopy_5trace_Point __pyx_t_11;
2517   int __pyx_lineno = 0;
2518   const char *__pyx_filename = NULL;
2519   int __pyx_clineno = 0;
2520   __Pyx_RefNannySetupContext("as_geom", 0);
2521 
2522   /* "cartopy/trace.pyx":117
2523  *         from cython.operator cimport dereference, preincrement
2524  *         # self.lines.remove_if(degenerate_line) is not available in Cython.
2525  *         cdef list[Line].iterator it = self.lines.begin()             # <<<<<<<<<<<<<<
2526  *         while it != self.lines.end():
2527  *             if degenerate_line(dereference(it)):
2528  */
2529   __pyx_v_it = __pyx_v_self->lines.begin();
2530 
2531   /* "cartopy/trace.pyx":118
2532  *         # self.lines.remove_if(degenerate_line) is not available in Cython.
2533  *         cdef list[Line].iterator it = self.lines.begin()
2534  *         while it != self.lines.end():             # <<<<<<<<<<<<<<
2535  *             if degenerate_line(dereference(it)):
2536  *                 it = self.lines.erase(it)
2537  */
2538   while (1) {
2539     __pyx_t_1 = ((__pyx_v_it != __pyx_v_self->lines.end()) != 0);
2540     if (!__pyx_t_1) break;
2541 
2542     /* "cartopy/trace.pyx":119
2543  *         cdef list[Line].iterator it = self.lines.begin()
2544  *         while it != self.lines.end():
2545  *             if degenerate_line(dereference(it)):             # <<<<<<<<<<<<<<
2546  *                 it = self.lines.erase(it)
2547  *             else:
2548  */
2549     __pyx_t_1 = (__pyx_f_7cartopy_5trace_degenerate_line((*__pyx_v_it)) != 0);
2550     if (__pyx_t_1) {
2551 
2552       /* "cartopy/trace.pyx":120
2553  *         while it != self.lines.end():
2554  *             if degenerate_line(dereference(it)):
2555  *                 it = self.lines.erase(it)             # <<<<<<<<<<<<<<
2556  *             else:
2557  *                 preincrement(it)
2558  */
2559       __pyx_v_it = __pyx_v_self->lines.erase(__pyx_v_it);
2560 
2561       /* "cartopy/trace.pyx":119
2562  *         cdef list[Line].iterator it = self.lines.begin()
2563  *         while it != self.lines.end():
2564  *             if degenerate_line(dereference(it)):             # <<<<<<<<<<<<<<
2565  *                 it = self.lines.erase(it)
2566  *             else:
2567  */
2568       goto __pyx_L5;
2569     }
2570 
2571     /* "cartopy/trace.pyx":122
2572  *                 it = self.lines.erase(it)
2573  *             else:
2574  *                 preincrement(it)             # <<<<<<<<<<<<<<
2575  *
2576  *         cdef Point first, last
2577  */
2578     /*else*/ {
2579       (void)((++__pyx_v_it));
2580     }
2581     __pyx_L5:;
2582   }
2583 
2584   /* "cartopy/trace.pyx":125
2585  *
2586  *         cdef Point first, last
2587  *         if self.lines.size() > 1:             # <<<<<<<<<<<<<<
2588  *             first = self.lines.front().front()
2589  *             last = self.lines.back().back()
2590  */
2591   __pyx_t_1 = ((__pyx_v_self->lines.size() > 1) != 0);
2592   if (__pyx_t_1) {
2593 
2594     /* "cartopy/trace.pyx":126
2595  *         cdef Point first, last
2596  *         if self.lines.size() > 1:
2597  *             first = self.lines.front().front()             # <<<<<<<<<<<<<<
2598  *             last = self.lines.back().back()
2599  *             if close(first.x, last.x) and close(first.y, last.y):
2600  */
2601     __pyx_v_first = __pyx_v_self->lines.front().front();
2602 
2603     /* "cartopy/trace.pyx":127
2604  *         if self.lines.size() > 1:
2605  *             first = self.lines.front().front()
2606  *             last = self.lines.back().back()             # <<<<<<<<<<<<<<
2607  *             if close(first.x, last.x) and close(first.y, last.y):
2608  *                 self.lines.front().pop_front()
2609  */
2610     __pyx_v_last = __pyx_v_self->lines.back().back();
2611 
2612     /* "cartopy/trace.pyx":128
2613  *             first = self.lines.front().front()
2614  *             last = self.lines.back().back()
2615  *             if close(first.x, last.x) and close(first.y, last.y):             # <<<<<<<<<<<<<<
2616  *                 self.lines.front().pop_front()
2617  *                 self.lines.back().splice(self.lines.back().end(),
2618  */
2619     __pyx_t_2 = (__pyx_f_7cartopy_5trace_close(__pyx_v_first.x, __pyx_v_last.x) != 0);
2620     if (__pyx_t_2) {
2621     } else {
2622       __pyx_t_1 = __pyx_t_2;
2623       goto __pyx_L8_bool_binop_done;
2624     }
2625     __pyx_t_2 = (__pyx_f_7cartopy_5trace_close(__pyx_v_first.y, __pyx_v_last.y) != 0);
2626     __pyx_t_1 = __pyx_t_2;
2627     __pyx_L8_bool_binop_done:;
2628     if (__pyx_t_1) {
2629 
2630       /* "cartopy/trace.pyx":129
2631  *             last = self.lines.back().back()
2632  *             if close(first.x, last.x) and close(first.y, last.y):
2633  *                 self.lines.front().pop_front()             # <<<<<<<<<<<<<<
2634  *                 self.lines.back().splice(self.lines.back().end(),
2635  *                                          self.lines.front())
2636  */
2637       __pyx_v_self->lines.front().pop_front();
2638 
2639       /* "cartopy/trace.pyx":130
2640  *             if close(first.x, last.x) and close(first.y, last.y):
2641  *                 self.lines.front().pop_front()
2642  *                 self.lines.back().splice(self.lines.back().end(),             # <<<<<<<<<<<<<<
2643  *                                          self.lines.front())
2644  *                 self.lines.pop_front()
2645  */
2646       __pyx_v_self->lines.back().splice(__pyx_v_self->lines.back().end(), __pyx_v_self->lines.front());
2647 
2648       /* "cartopy/trace.pyx":132
2649  *                 self.lines.back().splice(self.lines.back().end(),
2650  *                                          self.lines.front())
2651  *                 self.lines.pop_front()             # <<<<<<<<<<<<<<
2652  *
2653  *         cdef Line ilines
2654  */
2655       __pyx_v_self->lines.pop_front();
2656 
2657       /* "cartopy/trace.pyx":128
2658  *             first = self.lines.front().front()
2659  *             last = self.lines.back().back()
2660  *             if close(first.x, last.x) and close(first.y, last.y):             # <<<<<<<<<<<<<<
2661  *                 self.lines.front().pop_front()
2662  *                 self.lines.back().splice(self.lines.back().end(),
2663  */
2664     }
2665 
2666     /* "cartopy/trace.pyx":125
2667  *
2668  *         cdef Point first, last
2669  *         if self.lines.size() > 1:             # <<<<<<<<<<<<<<
2670  *             first = self.lines.front().front()
2671  *             last = self.lines.back().back()
2672  */
2673   }
2674 
2675   /* "cartopy/trace.pyx":139
2676  *         cdef int i
2677  *         cdef GEOSCoordSequence *coords
2678  *         for ilines in self.lines:             # <<<<<<<<<<<<<<
2679  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)
2680  *             for i, ipoints in enumerate(ilines):
2681  */
2682   __pyx_t_4 = &__pyx_v_self->lines;
2683   __pyx_t_3 = __pyx_t_4->begin();
2684   for (;;) {
2685     if (!(__pyx_t_3 != __pyx_t_4->end())) break;
2686     __pyx_t_5 = *__pyx_t_3;
2687     ++__pyx_t_3;
2688     __pyx_v_ilines = __pyx_t_5;
2689 
2690     /* "cartopy/trace.pyx":140
2691  *         cdef GEOSCoordSequence *coords
2692  *         for ilines in self.lines:
2693  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)             # <<<<<<<<<<<<<<
2694  *             for i, ipoints in enumerate(ilines):
2695  *                 GEOSCoordSeq_setX_r(handle, coords, i, ipoints.x)
2696  */
2697     __pyx_v_coords = GEOSCoordSeq_create_r(__pyx_v_handle, __pyx_v_ilines.size(), 2);
2698 
2699     /* "cartopy/trace.pyx":141
2700  *         for ilines in self.lines:
2701  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)
2702  *             for i, ipoints in enumerate(ilines):             # <<<<<<<<<<<<<<
2703  *                 GEOSCoordSeq_setX_r(handle, coords, i, ipoints.x)
2704  *                 GEOSCoordSeq_setY_r(handle, coords, i, ipoints.y)
2705  */
2706     __pyx_t_6 = 0;
2707     __pyx_t_7 = __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(__pyx_v_ilines); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error)
2708     __Pyx_GOTREF(__pyx_t_7);
2709     if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
2710       __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
2711       __pyx_t_10 = NULL;
2712     } else {
2713       __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 141, __pyx_L1_error)
2714       __Pyx_GOTREF(__pyx_t_8);
2715       __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 141, __pyx_L1_error)
2716     }
2717     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2718     for (;;) {
2719       if (likely(!__pyx_t_10)) {
2720         if (likely(PyList_CheckExact(__pyx_t_8))) {
2721           if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
2722           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2723           __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 141, __pyx_L1_error)
2724           #else
2725           __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error)
2726           __Pyx_GOTREF(__pyx_t_7);
2727           #endif
2728         } else {
2729           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
2730           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2731           __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 141, __pyx_L1_error)
2732           #else
2733           __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error)
2734           __Pyx_GOTREF(__pyx_t_7);
2735           #endif
2736         }
2737       } else {
2738         __pyx_t_7 = __pyx_t_10(__pyx_t_8);
2739         if (unlikely(!__pyx_t_7)) {
2740           PyObject* exc_type = PyErr_Occurred();
2741           if (exc_type) {
2742             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2743             else __PYX_ERR(0, 141, __pyx_L1_error)
2744           }
2745           break;
2746         }
2747         __Pyx_GOTREF(__pyx_t_7);
2748       }
2749       __pyx_t_11 = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
2750       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2751       __pyx_v_ipoints = __pyx_t_11;
2752       __pyx_v_i = __pyx_t_6;
2753       __pyx_t_6 = (__pyx_t_6 + 1);
2754 
2755       /* "cartopy/trace.pyx":142
2756  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)
2757  *             for i, ipoints in enumerate(ilines):
2758  *                 GEOSCoordSeq_setX_r(handle, coords, i, ipoints.x)             # <<<<<<<<<<<<<<
2759  *                 GEOSCoordSeq_setY_r(handle, coords, i, ipoints.y)
2760  *
2761  */
2762       (void)(GEOSCoordSeq_setX_r(__pyx_v_handle, __pyx_v_coords, __pyx_v_i, __pyx_v_ipoints.x));
2763 
2764       /* "cartopy/trace.pyx":143
2765  *             for i, ipoints in enumerate(ilines):
2766  *                 GEOSCoordSeq_setX_r(handle, coords, i, ipoints.x)
2767  *                 GEOSCoordSeq_setY_r(handle, coords, i, ipoints.y)             # <<<<<<<<<<<<<<
2768  *
2769  *             geoms.push_back(GEOSGeom_createLineString_r(handle, coords))
2770  */
2771       (void)(GEOSCoordSeq_setY_r(__pyx_v_handle, __pyx_v_coords, __pyx_v_i, __pyx_v_ipoints.y));
2772 
2773       /* "cartopy/trace.pyx":141
2774  *         for ilines in self.lines:
2775  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)
2776  *             for i, ipoints in enumerate(ilines):             # <<<<<<<<<<<<<<
2777  *                 GEOSCoordSeq_setX_r(handle, coords, i, ipoints.x)
2778  *                 GEOSCoordSeq_setY_r(handle, coords, i, ipoints.y)
2779  */
2780     }
2781     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2782 
2783     /* "cartopy/trace.pyx":145
2784  *                 GEOSCoordSeq_setY_r(handle, coords, i, ipoints.y)
2785  *
2786  *             geoms.push_back(GEOSGeom_createLineString_r(handle, coords))             # <<<<<<<<<<<<<<
2787  *
2788  *         cdef GEOSGeometry *geom
2789  */
2790     try {
2791       __pyx_v_geoms.push_back(GEOSGeom_createLineString_r(__pyx_v_handle, __pyx_v_coords));
2792     } catch(...) {
2793       __Pyx_CppExn2PyErr();
2794       __PYX_ERR(0, 145, __pyx_L1_error)
2795     }
2796 
2797     /* "cartopy/trace.pyx":139
2798  *         cdef int i
2799  *         cdef GEOSCoordSequence *coords
2800  *         for ilines in self.lines:             # <<<<<<<<<<<<<<
2801  *             coords = GEOSCoordSeq_create_r(handle, ilines.size(), 2)
2802  *             for i, ipoints in enumerate(ilines):
2803  */
2804   }
2805 
2806   /* "cartopy/trace.pyx":148
2807  *
2808  *         cdef GEOSGeometry *geom
2809  *         if geoms.empty():             # <<<<<<<<<<<<<<
2810  *             geom = GEOSGeom_createEmptyCollection_r(handle,
2811  *                                                     GEOS_MULTILINESTRING)
2812  */
2813   __pyx_t_1 = (__pyx_v_geoms.empty() != 0);
2814   if (__pyx_t_1) {
2815 
2816     /* "cartopy/trace.pyx":149
2817  *         cdef GEOSGeometry *geom
2818  *         if geoms.empty():
2819  *             geom = GEOSGeom_createEmptyCollection_r(handle,             # <<<<<<<<<<<<<<
2820  *                                                     GEOS_MULTILINESTRING)
2821  *         else:
2822  */
2823     __pyx_v_geom = GEOSGeom_createEmptyCollection_r(__pyx_v_handle, GEOS_MULTILINESTRING);
2824 
2825     /* "cartopy/trace.pyx":148
2826  *
2827  *         cdef GEOSGeometry *geom
2828  *         if geoms.empty():             # <<<<<<<<<<<<<<
2829  *             geom = GEOSGeom_createEmptyCollection_r(handle,
2830  *                                                     GEOS_MULTILINESTRING)
2831  */
2832     goto __pyx_L14;
2833   }
2834 
2835   /* "cartopy/trace.pyx":152
2836  *                                                     GEOS_MULTILINESTRING)
2837  *         else:
2838  *             geom = GEOSGeom_createCollection_r(handle, GEOS_MULTILINESTRING,             # <<<<<<<<<<<<<<
2839  *                                                &geoms[0], geoms.size())
2840  *         return geom
2841  */
2842   /*else*/ {
2843 
2844     /* "cartopy/trace.pyx":153
2845  *         else:
2846  *             geom = GEOSGeom_createCollection_r(handle, GEOS_MULTILINESTRING,
2847  *                                                &geoms[0], geoms.size())             # <<<<<<<<<<<<<<
2848  *         return geom
2849  *
2850  */
2851     __pyx_v_geom = GEOSGeom_createCollection_r(__pyx_v_handle, GEOS_MULTILINESTRING, (&(__pyx_v_geoms[0])), __pyx_v_geoms.size());
2852   }
2853   __pyx_L14:;
2854 
2855   /* "cartopy/trace.pyx":154
2856  *             geom = GEOSGeom_createCollection_r(handle, GEOS_MULTILINESTRING,
2857  *                                                &geoms[0], geoms.size())
2858  *         return geom             # <<<<<<<<<<<<<<
2859  *
2860  *     cdef size_t size(self):
2861  */
2862   __pyx_r = __pyx_v_geom;
2863   goto __pyx_L0;
2864 
2865   /* "cartopy/trace.pyx":114
2866  *             self.add_point(point)
2867  *
2868  *     cdef GEOSGeometry *as_geom(self, GEOSContextHandle_t handle):             # <<<<<<<<<<<<<<
2869  *         from cython.operator cimport dereference, preincrement
2870  *         # self.lines.remove_if(degenerate_line) is not available in Cython.
2871  */
2872 
2873   /* function exit code */
2874   __pyx_L1_error:;
2875   __Pyx_XDECREF(__pyx_t_7);
2876   __Pyx_XDECREF(__pyx_t_8);
2877   __Pyx_WriteUnraisable("cartopy.trace.LineAccumulator.as_geom", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
2878   __pyx_r = 0;
2879   __pyx_L0:;
2880   __Pyx_RefNannyFinishContext();
2881   return __pyx_r;
2882 }
2883 
2884 /* "cartopy/trace.pyx":156
2885  *         return geom
2886  *
2887  *     cdef size_t size(self):             # <<<<<<<<<<<<<<
2888  *         return self.lines.size()
2889  *
2890  */
2891 
__pyx_f_7cartopy_5trace_15LineAccumulator_size(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self)2892 static size_t __pyx_f_7cartopy_5trace_15LineAccumulator_size(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self) {
2893   size_t __pyx_r;
2894   __Pyx_RefNannyDeclarations
2895   __Pyx_RefNannySetupContext("size", 0);
2896 
2897   /* "cartopy/trace.pyx":157
2898  *
2899  *     cdef size_t size(self):
2900  *         return self.lines.size()             # <<<<<<<<<<<<<<
2901  *
2902  *
2903  */
2904   __pyx_r = __pyx_v_self->lines.size();
2905   goto __pyx_L0;
2906 
2907   /* "cartopy/trace.pyx":156
2908  *         return geom
2909  *
2910  *     cdef size_t size(self):             # <<<<<<<<<<<<<<
2911  *         return self.lines.size()
2912  *
2913  */
2914 
2915   /* function exit code */
2916   __pyx_L0:;
2917   __Pyx_RefNannyFinishContext();
2918   return __pyx_r;
2919 }
2920 
2921 /* "(tree fragment)":1
2922  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
2923  *     cdef tuple state
2924  *     cdef object _dict
2925  */
2926 
2927 /* Python wrapper */
2928 static PyObject *__pyx_pw_7cartopy_5trace_15LineAccumulator_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2929 static char __pyx_doc_7cartopy_5trace_15LineAccumulator_2__reduce_cython__[] = "LineAccumulator.__reduce_cython__(self)";
__pyx_pw_7cartopy_5trace_15LineAccumulator_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2930 static PyObject *__pyx_pw_7cartopy_5trace_15LineAccumulator_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2931   PyObject *__pyx_r = 0;
2932   __Pyx_RefNannyDeclarations
2933   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
2934   __pyx_r = __pyx_pf_7cartopy_5trace_15LineAccumulator_2__reduce_cython__(((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)__pyx_v_self));
2935 
2936   /* function exit code */
2937   __Pyx_RefNannyFinishContext();
2938   return __pyx_r;
2939 }
2940 
__pyx_pf_7cartopy_5trace_15LineAccumulator_2__reduce_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self)2941 static PyObject *__pyx_pf_7cartopy_5trace_15LineAccumulator_2__reduce_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self) {
2942   PyObject *__pyx_v_state = 0;
2943   PyObject *__pyx_v__dict = 0;
2944   int __pyx_v_use_setstate;
2945   PyObject *__pyx_r = NULL;
2946   __Pyx_RefNannyDeclarations
2947   PyObject *__pyx_t_1 = NULL;
2948   PyObject *__pyx_t_2 = NULL;
2949   int __pyx_t_3;
2950   int __pyx_t_4;
2951   PyObject *__pyx_t_5 = NULL;
2952   int __pyx_lineno = 0;
2953   const char *__pyx_filename = NULL;
2954   int __pyx_clineno = 0;
2955   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
2956 
2957   /* "(tree fragment)":5
2958  *     cdef object _dict
2959  *     cdef bint use_setstate
2960  *     state = (self.lines,)             # <<<<<<<<<<<<<<
2961  *     _dict = getattr(self, '__dict__', None)
2962  *     if _dict is not None:
2963  */
2964   __pyx_t_1 = __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(__pyx_v_self->lines); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
2965   __Pyx_GOTREF(__pyx_t_1);
2966   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
2967   __Pyx_GOTREF(__pyx_t_2);
2968   __Pyx_GIVEREF(__pyx_t_1);
2969   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
2970   __pyx_t_1 = 0;
2971   __pyx_v_state = ((PyObject*)__pyx_t_2);
2972   __pyx_t_2 = 0;
2973 
2974   /* "(tree fragment)":6
2975  *     cdef bint use_setstate
2976  *     state = (self.lines,)
2977  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
2978  *     if _dict is not None:
2979  *         state += (_dict,)
2980  */
2981   __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
2982   __Pyx_GOTREF(__pyx_t_2);
2983   __pyx_v__dict = __pyx_t_2;
2984   __pyx_t_2 = 0;
2985 
2986   /* "(tree fragment)":7
2987  *     state = (self.lines,)
2988  *     _dict = getattr(self, '__dict__', None)
2989  *     if _dict is not None:             # <<<<<<<<<<<<<<
2990  *         state += (_dict,)
2991  *         use_setstate = True
2992  */
2993   __pyx_t_3 = (__pyx_v__dict != Py_None);
2994   __pyx_t_4 = (__pyx_t_3 != 0);
2995   if (__pyx_t_4) {
2996 
2997     /* "(tree fragment)":8
2998  *     _dict = getattr(self, '__dict__', None)
2999  *     if _dict is not None:
3000  *         state += (_dict,)             # <<<<<<<<<<<<<<
3001  *         use_setstate = True
3002  *     else:
3003  */
3004     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
3005     __Pyx_GOTREF(__pyx_t_2);
3006     __Pyx_INCREF(__pyx_v__dict);
3007     __Pyx_GIVEREF(__pyx_v__dict);
3008     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
3009     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
3010     __Pyx_GOTREF(__pyx_t_1);
3011     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3012     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
3013     __pyx_t_1 = 0;
3014 
3015     /* "(tree fragment)":9
3016  *     if _dict is not None:
3017  *         state += (_dict,)
3018  *         use_setstate = True             # <<<<<<<<<<<<<<
3019  *     else:
3020  *         use_setstate = False
3021  */
3022     __pyx_v_use_setstate = 1;
3023 
3024     /* "(tree fragment)":7
3025  *     state = (self.lines,)
3026  *     _dict = getattr(self, '__dict__', None)
3027  *     if _dict is not None:             # <<<<<<<<<<<<<<
3028  *         state += (_dict,)
3029  *         use_setstate = True
3030  */
3031     goto __pyx_L3;
3032   }
3033 
3034   /* "(tree fragment)":11
3035  *         use_setstate = True
3036  *     else:
3037  *         use_setstate = False             # <<<<<<<<<<<<<<
3038  *     if use_setstate:
3039  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, None), state
3040  */
3041   /*else*/ {
3042     __pyx_v_use_setstate = 0;
3043   }
3044   __pyx_L3:;
3045 
3046   /* "(tree fragment)":12
3047  *     else:
3048  *         use_setstate = False
3049  *     if use_setstate:             # <<<<<<<<<<<<<<
3050  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, None), state
3051  *     else:
3052  */
3053   __pyx_t_4 = (__pyx_v_use_setstate != 0);
3054   if (__pyx_t_4) {
3055 
3056     /* "(tree fragment)":13
3057  *         use_setstate = False
3058  *     if use_setstate:
3059  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, None), state             # <<<<<<<<<<<<<<
3060  *     else:
3061  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, state)
3062  */
3063     __Pyx_XDECREF(__pyx_r);
3064     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle_LineAccumulator); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
3065     __Pyx_GOTREF(__pyx_t_1);
3066     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
3067     __Pyx_GOTREF(__pyx_t_2);
3068     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3069     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3070     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3071     __Pyx_INCREF(__pyx_int_159439512);
3072     __Pyx_GIVEREF(__pyx_int_159439512);
3073     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_159439512);
3074     __Pyx_INCREF(Py_None);
3075     __Pyx_GIVEREF(Py_None);
3076     PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
3077     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
3078     __Pyx_GOTREF(__pyx_t_5);
3079     __Pyx_GIVEREF(__pyx_t_1);
3080     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
3081     __Pyx_GIVEREF(__pyx_t_2);
3082     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
3083     __Pyx_INCREF(__pyx_v_state);
3084     __Pyx_GIVEREF(__pyx_v_state);
3085     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
3086     __pyx_t_1 = 0;
3087     __pyx_t_2 = 0;
3088     __pyx_r = __pyx_t_5;
3089     __pyx_t_5 = 0;
3090     goto __pyx_L0;
3091 
3092     /* "(tree fragment)":12
3093  *     else:
3094  *         use_setstate = False
3095  *     if use_setstate:             # <<<<<<<<<<<<<<
3096  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, None), state
3097  *     else:
3098  */
3099   }
3100 
3101   /* "(tree fragment)":15
3102  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, None), state
3103  *     else:
3104  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, state)             # <<<<<<<<<<<<<<
3105  * def __setstate_cython__(self, __pyx_state):
3106  *     __pyx_unpickle_LineAccumulator__set_state(self, __pyx_state)
3107  */
3108   /*else*/ {
3109     __Pyx_XDECREF(__pyx_r);
3110     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_LineAccumulator); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
3111     __Pyx_GOTREF(__pyx_t_5);
3112     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
3113     __Pyx_GOTREF(__pyx_t_2);
3114     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3115     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3116     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
3117     __Pyx_INCREF(__pyx_int_159439512);
3118     __Pyx_GIVEREF(__pyx_int_159439512);
3119     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_159439512);
3120     __Pyx_INCREF(__pyx_v_state);
3121     __Pyx_GIVEREF(__pyx_v_state);
3122     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
3123     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
3124     __Pyx_GOTREF(__pyx_t_1);
3125     __Pyx_GIVEREF(__pyx_t_5);
3126     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
3127     __Pyx_GIVEREF(__pyx_t_2);
3128     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
3129     __pyx_t_5 = 0;
3130     __pyx_t_2 = 0;
3131     __pyx_r = __pyx_t_1;
3132     __pyx_t_1 = 0;
3133     goto __pyx_L0;
3134   }
3135 
3136   /* "(tree fragment)":1
3137  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3138  *     cdef tuple state
3139  *     cdef object _dict
3140  */
3141 
3142   /* function exit code */
3143   __pyx_L1_error:;
3144   __Pyx_XDECREF(__pyx_t_1);
3145   __Pyx_XDECREF(__pyx_t_2);
3146   __Pyx_XDECREF(__pyx_t_5);
3147   __Pyx_AddTraceback("cartopy.trace.LineAccumulator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3148   __pyx_r = NULL;
3149   __pyx_L0:;
3150   __Pyx_XDECREF(__pyx_v_state);
3151   __Pyx_XDECREF(__pyx_v__dict);
3152   __Pyx_XGIVEREF(__pyx_r);
3153   __Pyx_RefNannyFinishContext();
3154   return __pyx_r;
3155 }
3156 
3157 /* "(tree fragment)":16
3158  *     else:
3159  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, state)
3160  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3161  *     __pyx_unpickle_LineAccumulator__set_state(self, __pyx_state)
3162  */
3163 
3164 /* Python wrapper */
3165 static PyObject *__pyx_pw_7cartopy_5trace_15LineAccumulator_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
3166 static char __pyx_doc_7cartopy_5trace_15LineAccumulator_4__setstate_cython__[] = "LineAccumulator.__setstate_cython__(self, __pyx_state)";
__pyx_pw_7cartopy_5trace_15LineAccumulator_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3167 static PyObject *__pyx_pw_7cartopy_5trace_15LineAccumulator_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3168   PyObject *__pyx_r = 0;
3169   __Pyx_RefNannyDeclarations
3170   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3171   __pyx_r = __pyx_pf_7cartopy_5trace_15LineAccumulator_4__setstate_cython__(((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3172 
3173   /* function exit code */
3174   __Pyx_RefNannyFinishContext();
3175   return __pyx_r;
3176 }
3177 
__pyx_pf_7cartopy_5trace_15LineAccumulator_4__setstate_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_self,PyObject * __pyx_v___pyx_state)3178 static PyObject *__pyx_pf_7cartopy_5trace_15LineAccumulator_4__setstate_cython__(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3179   PyObject *__pyx_r = NULL;
3180   __Pyx_RefNannyDeclarations
3181   PyObject *__pyx_t_1 = NULL;
3182   int __pyx_lineno = 0;
3183   const char *__pyx_filename = NULL;
3184   int __pyx_clineno = 0;
3185   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3186 
3187   /* "(tree fragment)":17
3188  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, state)
3189  * def __setstate_cython__(self, __pyx_state):
3190  *     __pyx_unpickle_LineAccumulator__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
3191  */
3192   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
3193   __pyx_t_1 = __pyx_f_7cartopy_5trace___pyx_unpickle_LineAccumulator__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
3194   __Pyx_GOTREF(__pyx_t_1);
3195   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3196 
3197   /* "(tree fragment)":16
3198  *     else:
3199  *         return __pyx_unpickle_LineAccumulator, (type(self), 0x980da98, state)
3200  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3201  *     __pyx_unpickle_LineAccumulator__set_state(self, __pyx_state)
3202  */
3203 
3204   /* function exit code */
3205   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3206   goto __pyx_L0;
3207   __pyx_L1_error:;
3208   __Pyx_XDECREF(__pyx_t_1);
3209   __Pyx_AddTraceback("cartopy.trace.LineAccumulator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3210   __pyx_r = NULL;
3211   __pyx_L0:;
3212   __Pyx_XGIVEREF(__pyx_r);
3213   __Pyx_RefNannyFinishContext();
3214   return __pyx_r;
3215 }
3216 
3217 /* "cartopy/trace.pyx":168
3218  *     cdef double dest_scale
3219  *
3220  *     def __cinit__(self):             # <<<<<<<<<<<<<<
3221  *         self.src_scale = 1
3222  *         self.dest_scale = 1
3223  */
3224 
3225 /* Python wrapper */
3226 static int __pyx_pw_7cartopy_5trace_12Interpolator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7cartopy_5trace_12Interpolator_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3227 static int __pyx_pw_7cartopy_5trace_12Interpolator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3228   int __pyx_r;
3229   __Pyx_RefNannyDeclarations
3230   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
3231   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
3232     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
3233   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
3234   __pyx_r = __pyx_pf_7cartopy_5trace_12Interpolator___cinit__(((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_v_self));
3235 
3236   /* function exit code */
3237   __Pyx_RefNannyFinishContext();
3238   return __pyx_r;
3239 }
3240 
__pyx_pf_7cartopy_5trace_12Interpolator___cinit__(struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self)3241 static int __pyx_pf_7cartopy_5trace_12Interpolator___cinit__(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self) {
3242   int __pyx_r;
3243   __Pyx_RefNannyDeclarations
3244   __Pyx_RefNannySetupContext("__cinit__", 0);
3245 
3246   /* "cartopy/trace.pyx":169
3247  *
3248  *     def __cinit__(self):
3249  *         self.src_scale = 1             # <<<<<<<<<<<<<<
3250  *         self.dest_scale = 1
3251  *
3252  */
3253   __pyx_v_self->src_scale = 1.0;
3254 
3255   /* "cartopy/trace.pyx":170
3256  *     def __cinit__(self):
3257  *         self.src_scale = 1
3258  *         self.dest_scale = 1             # <<<<<<<<<<<<<<
3259  *
3260  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):
3261  */
3262   __pyx_v_self->dest_scale = 1.0;
3263 
3264   /* "cartopy/trace.pyx":168
3265  *     cdef double dest_scale
3266  *
3267  *     def __cinit__(self):             # <<<<<<<<<<<<<<
3268  *         self.src_scale = 1
3269  *         self.dest_scale = 1
3270  */
3271 
3272   /* function exit code */
3273   __pyx_r = 0;
3274   __Pyx_RefNannyFinishContext();
3275   return __pyx_r;
3276 }
3277 
3278 /* "cartopy/trace.pyx":172
3279  *         self.dest_scale = 1
3280  *
3281  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):             # <<<<<<<<<<<<<<
3282  *         self.src_proj = src_proj
3283  *         self.dest_proj = dest_proj
3284  */
3285 
__pyx_f_7cartopy_5trace_12Interpolator_init(struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self,projPJ __pyx_v_src_proj,projPJ __pyx_v_dest_proj)3286 static void __pyx_f_7cartopy_5trace_12Interpolator_init(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, projPJ __pyx_v_src_proj, projPJ __pyx_v_dest_proj) {
3287   __Pyx_RefNannyDeclarations
3288   __Pyx_RefNannySetupContext("init", 0);
3289 
3290   /* "cartopy/trace.pyx":173
3291  *
3292  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):
3293  *         self.src_proj = src_proj             # <<<<<<<<<<<<<<
3294  *         self.dest_proj = dest_proj
3295  *
3296  */
3297   __pyx_v_self->src_proj = __pyx_v_src_proj;
3298 
3299   /* "cartopy/trace.pyx":174
3300  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):
3301  *         self.src_proj = src_proj
3302  *         self.dest_proj = dest_proj             # <<<<<<<<<<<<<<
3303  *
3304  *     cdef void set_line(self, const Point &start, const Point &end):
3305  */
3306   __pyx_v_self->dest_proj = __pyx_v_dest_proj;
3307 
3308   /* "cartopy/trace.pyx":172
3309  *         self.dest_scale = 1
3310  *
3311  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):             # <<<<<<<<<<<<<<
3312  *         self.src_proj = src_proj
3313  *         self.dest_proj = dest_proj
3314  */
3315 
3316   /* function exit code */
3317   __Pyx_RefNannyFinishContext();
3318 }
3319 
3320 /* "cartopy/trace.pyx":176
3321  *         self.dest_proj = dest_proj
3322  *
3323  *     cdef void set_line(self, const Point &start, const Point &end):             # <<<<<<<<<<<<<<
3324  *         self.start = start
3325  *         self.end = end
3326  */
3327 
__pyx_f_7cartopy_5trace_12Interpolator_set_line(struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_start,__pyx_t_7cartopy_5trace_Point const & __pyx_v_end)3328 static void __pyx_f_7cartopy_5trace_12Interpolator_set_line(struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_end) {
3329   __Pyx_RefNannyDeclarations
3330   __Pyx_RefNannySetupContext("set_line", 0);
3331 
3332   /* "cartopy/trace.pyx":177
3333  *
3334  *     cdef void set_line(self, const Point &start, const Point &end):
3335  *         self.start = start             # <<<<<<<<<<<<<<
3336  *         self.end = end
3337  *
3338  */
3339   __pyx_v_self->start = __pyx_v_start;
3340 
3341   /* "cartopy/trace.pyx":178
3342  *     cdef void set_line(self, const Point &start, const Point &end):
3343  *         self.start = start
3344  *         self.end = end             # <<<<<<<<<<<<<<
3345  *
3346  *     cdef Point interpolate(self, double t):
3347  */
3348   __pyx_v_self->end = __pyx_v_end;
3349 
3350   /* "cartopy/trace.pyx":176
3351  *         self.dest_proj = dest_proj
3352  *
3353  *     cdef void set_line(self, const Point &start, const Point &end):             # <<<<<<<<<<<<<<
3354  *         self.start = start
3355  *         self.end = end
3356  */
3357 
3358   /* function exit code */
3359   __Pyx_RefNannyFinishContext();
3360 }
3361 
3362 /* "cartopy/trace.pyx":180
3363  *         self.end = end
3364  *
3365  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
3366  *         raise NotImplementedError
3367  *
3368  */
3369 
__pyx_f_7cartopy_5trace_12Interpolator_interpolate(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self,CYTHON_UNUSED double __pyx_v_t)3370 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_12Interpolator_interpolate(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED double __pyx_v_t) {
3371   __pyx_t_7cartopy_5trace_Point __pyx_r;
3372   __Pyx_RefNannyDeclarations
3373   int __pyx_lineno = 0;
3374   const char *__pyx_filename = NULL;
3375   int __pyx_clineno = 0;
3376   __Pyx_RefNannySetupContext("interpolate", 0);
3377 
3378   /* "cartopy/trace.pyx":181
3379  *
3380  *     cdef Point interpolate(self, double t):
3381  *         raise NotImplementedError             # <<<<<<<<<<<<<<
3382  *
3383  *     cdef Point project(self, const Point &point):
3384  */
3385   __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
3386   __PYX_ERR(0, 181, __pyx_L1_error)
3387 
3388   /* "cartopy/trace.pyx":180
3389  *         self.end = end
3390  *
3391  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
3392  *         raise NotImplementedError
3393  *
3394  */
3395 
3396   /* function exit code */
3397   __pyx_L1_error:;
3398   __Pyx_WriteUnraisable("cartopy.trace.Interpolator.interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3399   __Pyx_pretend_to_initialize(&__pyx_r);
3400   __Pyx_RefNannyFinishContext();
3401   return __pyx_r;
3402 }
3403 
3404 /* "cartopy/trace.pyx":183
3405  *         raise NotImplementedError
3406  *
3407  *     cdef Point project(self, const Point &point):             # <<<<<<<<<<<<<<
3408  *         raise NotImplementedError
3409  *
3410  */
3411 
__pyx_f_7cartopy_5trace_12Interpolator_project(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self,CYTHON_UNUSED __pyx_t_7cartopy_5trace_Point const & __pyx_v_point)3412 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_12Interpolator_project(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED __pyx_t_7cartopy_5trace_Point const &__pyx_v_point) {
3413   __pyx_t_7cartopy_5trace_Point __pyx_r;
3414   __Pyx_RefNannyDeclarations
3415   int __pyx_lineno = 0;
3416   const char *__pyx_filename = NULL;
3417   int __pyx_clineno = 0;
3418   __Pyx_RefNannySetupContext("project", 0);
3419 
3420   /* "cartopy/trace.pyx":184
3421  *
3422  *     cdef Point project(self, const Point &point):
3423  *         raise NotImplementedError             # <<<<<<<<<<<<<<
3424  *
3425  *
3426  */
3427   __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
3428   __PYX_ERR(0, 184, __pyx_L1_error)
3429 
3430   /* "cartopy/trace.pyx":183
3431  *         raise NotImplementedError
3432  *
3433  *     cdef Point project(self, const Point &point):             # <<<<<<<<<<<<<<
3434  *         raise NotImplementedError
3435  *
3436  */
3437 
3438   /* function exit code */
3439   __pyx_L1_error:;
3440   __Pyx_WriteUnraisable("cartopy.trace.Interpolator.project", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3441   __Pyx_pretend_to_initialize(&__pyx_r);
3442   __Pyx_RefNannyFinishContext();
3443   return __pyx_r;
3444 }
3445 
3446 /* "(tree fragment)":1
3447  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3448  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3449  * def __setstate_cython__(self, __pyx_state):
3450  */
3451 
3452 /* Python wrapper */
3453 static PyObject *__pyx_pw_7cartopy_5trace_12Interpolator_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3454 static char __pyx_doc_7cartopy_5trace_12Interpolator_2__reduce_cython__[] = "Interpolator.__reduce_cython__(self)";
__pyx_pw_7cartopy_5trace_12Interpolator_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3455 static PyObject *__pyx_pw_7cartopy_5trace_12Interpolator_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3456   PyObject *__pyx_r = 0;
3457   __Pyx_RefNannyDeclarations
3458   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3459   __pyx_r = __pyx_pf_7cartopy_5trace_12Interpolator_2__reduce_cython__(((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_v_self));
3460 
3461   /* function exit code */
3462   __Pyx_RefNannyFinishContext();
3463   return __pyx_r;
3464 }
3465 
__pyx_pf_7cartopy_5trace_12Interpolator_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self)3466 static PyObject *__pyx_pf_7cartopy_5trace_12Interpolator_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self) {
3467   PyObject *__pyx_r = NULL;
3468   __Pyx_RefNannyDeclarations
3469   PyObject *__pyx_t_1 = NULL;
3470   int __pyx_lineno = 0;
3471   const char *__pyx_filename = NULL;
3472   int __pyx_clineno = 0;
3473   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3474 
3475   /* "(tree fragment)":2
3476  * def __reduce_cython__(self):
3477  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3478  * def __setstate_cython__(self, __pyx_state):
3479  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3480  */
3481   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3482   __Pyx_GOTREF(__pyx_t_1);
3483   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3484   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3485   __PYX_ERR(1, 2, __pyx_L1_error)
3486 
3487   /* "(tree fragment)":1
3488  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3489  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3490  * def __setstate_cython__(self, __pyx_state):
3491  */
3492 
3493   /* function exit code */
3494   __pyx_L1_error:;
3495   __Pyx_XDECREF(__pyx_t_1);
3496   __Pyx_AddTraceback("cartopy.trace.Interpolator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3497   __pyx_r = NULL;
3498   __Pyx_XGIVEREF(__pyx_r);
3499   __Pyx_RefNannyFinishContext();
3500   return __pyx_r;
3501 }
3502 
3503 /* "(tree fragment)":3
3504  * def __reduce_cython__(self):
3505  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3506  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3507  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3508  */
3509 
3510 /* Python wrapper */
3511 static PyObject *__pyx_pw_7cartopy_5trace_12Interpolator_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
3512 static char __pyx_doc_7cartopy_5trace_12Interpolator_4__setstate_cython__[] = "Interpolator.__setstate_cython__(self, __pyx_state)";
__pyx_pw_7cartopy_5trace_12Interpolator_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3513 static PyObject *__pyx_pw_7cartopy_5trace_12Interpolator_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3514   PyObject *__pyx_r = 0;
3515   __Pyx_RefNannyDeclarations
3516   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3517   __pyx_r = __pyx_pf_7cartopy_5trace_12Interpolator_4__setstate_cython__(((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3518 
3519   /* function exit code */
3520   __Pyx_RefNannyFinishContext();
3521   return __pyx_r;
3522 }
3523 
__pyx_pf_7cartopy_5trace_12Interpolator_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3524 static PyObject *__pyx_pf_7cartopy_5trace_12Interpolator_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3525   PyObject *__pyx_r = NULL;
3526   __Pyx_RefNannyDeclarations
3527   PyObject *__pyx_t_1 = NULL;
3528   int __pyx_lineno = 0;
3529   const char *__pyx_filename = NULL;
3530   int __pyx_clineno = 0;
3531   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3532 
3533   /* "(tree fragment)":4
3534  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3535  * def __setstate_cython__(self, __pyx_state):
3536  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3537  */
3538   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3539   __Pyx_GOTREF(__pyx_t_1);
3540   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3541   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3542   __PYX_ERR(1, 4, __pyx_L1_error)
3543 
3544   /* "(tree fragment)":3
3545  * def __reduce_cython__(self):
3546  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3547  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3548  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3549  */
3550 
3551   /* function exit code */
3552   __pyx_L1_error:;
3553   __Pyx_XDECREF(__pyx_t_1);
3554   __Pyx_AddTraceback("cartopy.trace.Interpolator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3555   __pyx_r = NULL;
3556   __Pyx_XGIVEREF(__pyx_r);
3557   __Pyx_RefNannyFinishContext();
3558   return __pyx_r;
3559 }
3560 
3561 /* "cartopy/trace.pyx":188
3562  *
3563  * cdef class CartesianInterpolator(Interpolator):
3564  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
3565  *         cdef Point xy
3566  *         xy.x = self.start.x + (self.end.x - self.start.x) * t
3567  */
3568 
__pyx_f_7cartopy_5trace_21CartesianInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator * __pyx_v_self,double __pyx_v_t)3569 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21CartesianInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, double __pyx_v_t) {
3570   __pyx_t_7cartopy_5trace_Point __pyx_v_xy;
3571   __pyx_t_7cartopy_5trace_Point __pyx_r;
3572   __Pyx_RefNannyDeclarations
3573   __Pyx_RefNannySetupContext("interpolate", 0);
3574 
3575   /* "cartopy/trace.pyx":190
3576  *     cdef Point interpolate(self, double t):
3577  *         cdef Point xy
3578  *         xy.x = self.start.x + (self.end.x - self.start.x) * t             # <<<<<<<<<<<<<<
3579  *         xy.y = self.start.y + (self.end.y - self.start.y) * t
3580  *         return self.project(xy)
3581  */
3582   __pyx_v_xy.x = (__pyx_v_self->__pyx_base.start.x + ((__pyx_v_self->__pyx_base.end.x - __pyx_v_self->__pyx_base.start.x) * __pyx_v_t));
3583 
3584   /* "cartopy/trace.pyx":191
3585  *         cdef Point xy
3586  *         xy.x = self.start.x + (self.end.x - self.start.x) * t
3587  *         xy.y = self.start.y + (self.end.y - self.start.y) * t             # <<<<<<<<<<<<<<
3588  *         return self.project(xy)
3589  *
3590  */
3591   __pyx_v_xy.y = (__pyx_v_self->__pyx_base.start.y + ((__pyx_v_self->__pyx_base.end.y - __pyx_v_self->__pyx_base.start.y) * __pyx_v_t));
3592 
3593   /* "cartopy/trace.pyx":192
3594  *         xy.x = self.start.x + (self.end.x - self.start.x) * t
3595  *         xy.y = self.start.y + (self.end.y - self.start.y) * t
3596  *         return self.project(xy)             # <<<<<<<<<<<<<<
3597  *
3598  *     cdef Point project(self, const Point &src_xy):
3599  */
3600   __pyx_r = ((struct __pyx_vtabstruct_7cartopy_5trace_CartesianInterpolator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.project(((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_v_self), __pyx_v_xy);
3601   goto __pyx_L0;
3602 
3603   /* "cartopy/trace.pyx":188
3604  *
3605  * cdef class CartesianInterpolator(Interpolator):
3606  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
3607  *         cdef Point xy
3608  *         xy.x = self.start.x + (self.end.x - self.start.x) * t
3609  */
3610 
3611   /* function exit code */
3612   __pyx_L0:;
3613   __Pyx_RefNannyFinishContext();
3614   return __pyx_r;
3615 }
3616 
3617 /* "cartopy/trace.pyx":194
3618  *         return self.project(xy)
3619  *
3620  *     cdef Point project(self, const Point &src_xy):             # <<<<<<<<<<<<<<
3621  *         cdef Point dest_xy
3622  *         cdef projLP xy
3623  */
3624 
__pyx_f_7cartopy_5trace_21CartesianInterpolator_project(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_src_xy)3625 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21CartesianInterpolator_project(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_src_xy) {
3626   __pyx_t_7cartopy_5trace_Point __pyx_v_dest_xy;
3627   projLP __pyx_v_xy;
3628   int __pyx_v_status;
3629   __pyx_t_7cartopy_5trace_Point __pyx_r;
3630   __Pyx_RefNannyDeclarations
3631   int __pyx_t_1;
3632   int __pyx_t_2;
3633   PyObject *__pyx_t_3 = NULL;
3634   PyObject *__pyx_t_4 = NULL;
3635   PyObject *__pyx_t_5 = NULL;
3636   int __pyx_lineno = 0;
3637   const char *__pyx_filename = NULL;
3638   int __pyx_clineno = 0;
3639   __Pyx_RefNannySetupContext("project", 0);
3640 
3641   /* "cartopy/trace.pyx":198
3642  *         cdef projLP xy
3643  *
3644  *         xy.u = src_xy.x * self.src_scale             # <<<<<<<<<<<<<<
3645  *         xy.v = src_xy.y * self.src_scale
3646  *
3647  */
3648   __pyx_v_xy.u = (__pyx_v_src_xy.x * __pyx_v_self->__pyx_base.src_scale);
3649 
3650   /* "cartopy/trace.pyx":199
3651  *
3652  *         xy.u = src_xy.x * self.src_scale
3653  *         xy.v = src_xy.y * self.src_scale             # <<<<<<<<<<<<<<
3654  *
3655  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
3656  */
3657   __pyx_v_xy.v = (__pyx_v_src_xy.y * __pyx_v_self->__pyx_base.src_scale);
3658 
3659   /* "cartopy/trace.pyx":201
3660  *         xy.v = src_xy.y * self.src_scale
3661  *
3662  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,             # <<<<<<<<<<<<<<
3663  *                                        1, 1, &xy.u, &xy.v, NULL)
3664  *         if status in (-14, -20):
3665  */
3666   __pyx_v_status = pj_transform(__pyx_v_self->__pyx_base.src_proj, __pyx_v_self->__pyx_base.dest_proj, 1, 1, (&__pyx_v_xy.u), (&__pyx_v_xy.v), NULL);
3667 
3668   /* "cartopy/trace.pyx":203
3669  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
3670  *                                        1, 1, &xy.u, &xy.v, NULL)
3671  *         if status in (-14, -20):             # <<<<<<<<<<<<<<
3672  *             # -14 => "latitude or longitude exceeded limits"
3673  *             # -20 => "tolerance condition error"
3674  */
3675   switch (__pyx_v_status) {
3676     case -14L:
3677     case -20L:
3678     __pyx_t_1 = 1;
3679     break;
3680     default:
3681     __pyx_t_1 = 0;
3682     break;
3683   }
3684   __pyx_t_2 = (__pyx_t_1 != 0);
3685   if (__pyx_t_2) {
3686 
3687     /* "cartopy/trace.pyx":206
3688  *             # -14 => "latitude or longitude exceeded limits"
3689  *             # -20 => "tolerance condition error"
3690  *             xy.u = xy.v = HUGE_VAL             # <<<<<<<<<<<<<<
3691  *         elif status != 0:
3692  *             raise Exception('pj_transform failed: %d\n%s' % (
3693  */
3694     __pyx_v_xy.u = HUGE_VAL;
3695     __pyx_v_xy.v = HUGE_VAL;
3696 
3697     /* "cartopy/trace.pyx":203
3698  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
3699  *                                        1, 1, &xy.u, &xy.v, NULL)
3700  *         if status in (-14, -20):             # <<<<<<<<<<<<<<
3701  *             # -14 => "latitude or longitude exceeded limits"
3702  *             # -20 => "tolerance condition error"
3703  */
3704     goto __pyx_L3;
3705   }
3706 
3707   /* "cartopy/trace.pyx":207
3708  *             # -20 => "tolerance condition error"
3709  *             xy.u = xy.v = HUGE_VAL
3710  *         elif status != 0:             # <<<<<<<<<<<<<<
3711  *             raise Exception('pj_transform failed: %d\n%s' % (
3712  *                 status,
3713  */
3714   __pyx_t_2 = ((__pyx_v_status != 0) != 0);
3715   if (unlikely(__pyx_t_2)) {
3716 
3717     /* "cartopy/trace.pyx":209
3718  *         elif status != 0:
3719  *             raise Exception('pj_transform failed: %d\n%s' % (
3720  *                 status,             # <<<<<<<<<<<<<<
3721  *                 pj_strerrno(status)))
3722  *
3723  */
3724     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
3725     __Pyx_GOTREF(__pyx_t_3);
3726 
3727     /* "cartopy/trace.pyx":210
3728  *             raise Exception('pj_transform failed: %d\n%s' % (
3729  *                 status,
3730  *                 pj_strerrno(status)))             # <<<<<<<<<<<<<<
3731  *
3732  *         dest_xy.x = xy.u * self.dest_scale
3733  */
3734     __pyx_t_4 = __Pyx_PyBytes_FromString(pj_strerrno(__pyx_v_status)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
3735     __Pyx_GOTREF(__pyx_t_4);
3736 
3737     /* "cartopy/trace.pyx":209
3738  *         elif status != 0:
3739  *             raise Exception('pj_transform failed: %d\n%s' % (
3740  *                 status,             # <<<<<<<<<<<<<<
3741  *                 pj_strerrno(status)))
3742  *
3743  */
3744     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
3745     __Pyx_GOTREF(__pyx_t_5);
3746     __Pyx_GIVEREF(__pyx_t_3);
3747     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
3748     __Pyx_GIVEREF(__pyx_t_4);
3749     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
3750     __pyx_t_3 = 0;
3751     __pyx_t_4 = 0;
3752 
3753     /* "cartopy/trace.pyx":208
3754  *             xy.u = xy.v = HUGE_VAL
3755  *         elif status != 0:
3756  *             raise Exception('pj_transform failed: %d\n%s' % (             # <<<<<<<<<<<<<<
3757  *                 status,
3758  *                 pj_strerrno(status)))
3759  */
3760     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_pj_transform_failed_d_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error)
3761     __Pyx_GOTREF(__pyx_t_4);
3762     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3763     __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error)
3764     __Pyx_GOTREF(__pyx_t_5);
3765     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3766     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
3767     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3768     __PYX_ERR(0, 208, __pyx_L1_error)
3769 
3770     /* "cartopy/trace.pyx":207
3771  *             # -20 => "tolerance condition error"
3772  *             xy.u = xy.v = HUGE_VAL
3773  *         elif status != 0:             # <<<<<<<<<<<<<<
3774  *             raise Exception('pj_transform failed: %d\n%s' % (
3775  *                 status,
3776  */
3777   }
3778   __pyx_L3:;
3779 
3780   /* "cartopy/trace.pyx":212
3781  *                 pj_strerrno(status)))
3782  *
3783  *         dest_xy.x = xy.u * self.dest_scale             # <<<<<<<<<<<<<<
3784  *         dest_xy.y = xy.v * self.dest_scale
3785  *         return dest_xy
3786  */
3787   __pyx_v_dest_xy.x = (__pyx_v_xy.u * __pyx_v_self->__pyx_base.dest_scale);
3788 
3789   /* "cartopy/trace.pyx":213
3790  *
3791  *         dest_xy.x = xy.u * self.dest_scale
3792  *         dest_xy.y = xy.v * self.dest_scale             # <<<<<<<<<<<<<<
3793  *         return dest_xy
3794  *
3795  */
3796   __pyx_v_dest_xy.y = (__pyx_v_xy.v * __pyx_v_self->__pyx_base.dest_scale);
3797 
3798   /* "cartopy/trace.pyx":214
3799  *         dest_xy.x = xy.u * self.dest_scale
3800  *         dest_xy.y = xy.v * self.dest_scale
3801  *         return dest_xy             # <<<<<<<<<<<<<<
3802  *
3803  *
3804  */
3805   __pyx_r = __pyx_v_dest_xy;
3806   goto __pyx_L0;
3807 
3808   /* "cartopy/trace.pyx":194
3809  *         return self.project(xy)
3810  *
3811  *     cdef Point project(self, const Point &src_xy):             # <<<<<<<<<<<<<<
3812  *         cdef Point dest_xy
3813  *         cdef projLP xy
3814  */
3815 
3816   /* function exit code */
3817   __pyx_L1_error:;
3818   __Pyx_XDECREF(__pyx_t_3);
3819   __Pyx_XDECREF(__pyx_t_4);
3820   __Pyx_XDECREF(__pyx_t_5);
3821   __Pyx_WriteUnraisable("cartopy.trace.CartesianInterpolator.project", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3822   __Pyx_pretend_to_initialize(&__pyx_r);
3823   __pyx_L0:;
3824   __Pyx_RefNannyFinishContext();
3825   return __pyx_r;
3826 }
3827 
3828 /* "(tree fragment)":1
3829  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3830  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3831  * def __setstate_cython__(self, __pyx_state):
3832  */
3833 
3834 /* Python wrapper */
3835 static PyObject *__pyx_pw_7cartopy_5trace_21CartesianInterpolator_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3836 static char __pyx_doc_7cartopy_5trace_21CartesianInterpolator___reduce_cython__[] = "CartesianInterpolator.__reduce_cython__(self)";
__pyx_pw_7cartopy_5trace_21CartesianInterpolator_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3837 static PyObject *__pyx_pw_7cartopy_5trace_21CartesianInterpolator_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3838   PyObject *__pyx_r = 0;
3839   __Pyx_RefNannyDeclarations
3840   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3841   __pyx_r = __pyx_pf_7cartopy_5trace_21CartesianInterpolator___reduce_cython__(((struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *)__pyx_v_self));
3842 
3843   /* function exit code */
3844   __Pyx_RefNannyFinishContext();
3845   return __pyx_r;
3846 }
3847 
__pyx_pf_7cartopy_5trace_21CartesianInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator * __pyx_v_self)3848 static PyObject *__pyx_pf_7cartopy_5trace_21CartesianInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self) {
3849   PyObject *__pyx_r = NULL;
3850   __Pyx_RefNannyDeclarations
3851   PyObject *__pyx_t_1 = NULL;
3852   int __pyx_lineno = 0;
3853   const char *__pyx_filename = NULL;
3854   int __pyx_clineno = 0;
3855   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3856 
3857   /* "(tree fragment)":2
3858  * def __reduce_cython__(self):
3859  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3860  * def __setstate_cython__(self, __pyx_state):
3861  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3862  */
3863   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3864   __Pyx_GOTREF(__pyx_t_1);
3865   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3866   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3867   __PYX_ERR(1, 2, __pyx_L1_error)
3868 
3869   /* "(tree fragment)":1
3870  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3871  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3872  * def __setstate_cython__(self, __pyx_state):
3873  */
3874 
3875   /* function exit code */
3876   __pyx_L1_error:;
3877   __Pyx_XDECREF(__pyx_t_1);
3878   __Pyx_AddTraceback("cartopy.trace.CartesianInterpolator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3879   __pyx_r = NULL;
3880   __Pyx_XGIVEREF(__pyx_r);
3881   __Pyx_RefNannyFinishContext();
3882   return __pyx_r;
3883 }
3884 
3885 /* "(tree fragment)":3
3886  * def __reduce_cython__(self):
3887  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3888  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3889  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3890  */
3891 
3892 /* Python wrapper */
3893 static PyObject *__pyx_pw_7cartopy_5trace_21CartesianInterpolator_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
3894 static char __pyx_doc_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__[] = "CartesianInterpolator.__setstate_cython__(self, __pyx_state)";
__pyx_pw_7cartopy_5trace_21CartesianInterpolator_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3895 static PyObject *__pyx_pw_7cartopy_5trace_21CartesianInterpolator_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3896   PyObject *__pyx_r = 0;
3897   __Pyx_RefNannyDeclarations
3898   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3899   __pyx_r = __pyx_pf_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__(((struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3900 
3901   /* function exit code */
3902   __Pyx_RefNannyFinishContext();
3903   return __pyx_r;
3904 }
3905 
__pyx_pf_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3906 static PyObject *__pyx_pf_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3907   PyObject *__pyx_r = NULL;
3908   __Pyx_RefNannyDeclarations
3909   PyObject *__pyx_t_1 = NULL;
3910   int __pyx_lineno = 0;
3911   const char *__pyx_filename = NULL;
3912   int __pyx_clineno = 0;
3913   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3914 
3915   /* "(tree fragment)":4
3916  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3917  * def __setstate_cython__(self, __pyx_state):
3918  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3919  */
3920   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3921   __Pyx_GOTREF(__pyx_t_1);
3922   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3923   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3924   __PYX_ERR(1, 4, __pyx_L1_error)
3925 
3926   /* "(tree fragment)":3
3927  * def __reduce_cython__(self):
3928  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3929  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3930  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3931  */
3932 
3933   /* function exit code */
3934   __pyx_L1_error:;
3935   __Pyx_XDECREF(__pyx_t_1);
3936   __Pyx_AddTraceback("cartopy.trace.CartesianInterpolator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3937   __pyx_r = NULL;
3938   __Pyx_XGIVEREF(__pyx_r);
3939   __Pyx_RefNannyFinishContext();
3940   return __pyx_r;
3941 }
3942 
3943 /* "cartopy/trace.pyx":222
3944  *     cdef double a13
3945  *
3946  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):             # <<<<<<<<<<<<<<
3947  *         self.src_proj = src_proj
3948  *         self.dest_proj = dest_proj
3949  */
3950 
__pyx_f_7cartopy_5trace_21SphericalInterpolator_init(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self,projPJ __pyx_v_src_proj,projPJ __pyx_v_dest_proj)3951 static void __pyx_f_7cartopy_5trace_21SphericalInterpolator_init(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, projPJ __pyx_v_src_proj, projPJ __pyx_v_dest_proj) {
3952   double __pyx_v_major_axis;
3953   double __pyx_v_eccentricity_squared;
3954   __Pyx_RefNannyDeclarations
3955   __Pyx_RefNannySetupContext("init", 0);
3956 
3957   /* "cartopy/trace.pyx":223
3958  *
3959  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):
3960  *         self.src_proj = src_proj             # <<<<<<<<<<<<<<
3961  *         self.dest_proj = dest_proj
3962  *
3963  */
3964   __pyx_v_self->__pyx_base.src_proj = __pyx_v_src_proj;
3965 
3966   /* "cartopy/trace.pyx":224
3967  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):
3968  *         self.src_proj = src_proj
3969  *         self.dest_proj = dest_proj             # <<<<<<<<<<<<<<
3970  *
3971  *         cdef double major_axis
3972  */
3973   __pyx_v_self->__pyx_base.dest_proj = __pyx_v_dest_proj;
3974 
3975   /* "cartopy/trace.pyx":228
3976  *         cdef double major_axis
3977  *         cdef double eccentricity_squared
3978  *         pj_get_spheroid_defn(self.src_proj, &major_axis, &eccentricity_squared)             # <<<<<<<<<<<<<<
3979  *         geod_init(&self.geod, major_axis, 1 - sqrt(1 - eccentricity_squared))
3980  *
3981  */
3982   pj_get_spheroid_defn(__pyx_v_self->__pyx_base.src_proj, (&__pyx_v_major_axis), (&__pyx_v_eccentricity_squared));
3983 
3984   /* "cartopy/trace.pyx":229
3985  *         cdef double eccentricity_squared
3986  *         pj_get_spheroid_defn(self.src_proj, &major_axis, &eccentricity_squared)
3987  *         geod_init(&self.geod, major_axis, 1 - sqrt(1 - eccentricity_squared))             # <<<<<<<<<<<<<<
3988  *
3989  *     cdef void set_line(self, const Point &start, const Point &end):
3990  */
3991   geod_init((&__pyx_v_self->geod), __pyx_v_major_axis, (1.0 - sqrt((1.0 - __pyx_v_eccentricity_squared))));
3992 
3993   /* "cartopy/trace.pyx":222
3994  *     cdef double a13
3995  *
3996  *     cdef void init(self, projPJ src_proj, projPJ dest_proj):             # <<<<<<<<<<<<<<
3997  *         self.src_proj = src_proj
3998  *         self.dest_proj = dest_proj
3999  */
4000 
4001   /* function exit code */
4002   __Pyx_RefNannyFinishContext();
4003 }
4004 
4005 /* "cartopy/trace.pyx":231
4006  *         geod_init(&self.geod, major_axis, 1 - sqrt(1 - eccentricity_squared))
4007  *
4008  *     cdef void set_line(self, const Point &start, const Point &end):             # <<<<<<<<<<<<<<
4009  *         cdef double azi1
4010  *         self.a13 = geod_geninverse(&self.geod,
4011  */
4012 
__pyx_f_7cartopy_5trace_21SphericalInterpolator_set_line(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_start,__pyx_t_7cartopy_5trace_Point const & __pyx_v_end)4013 static void __pyx_f_7cartopy_5trace_21SphericalInterpolator_set_line(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_end) {
4014   double __pyx_v_azi1;
4015   __Pyx_RefNannyDeclarations
4016   __Pyx_RefNannySetupContext("set_line", 0);
4017 
4018   /* "cartopy/trace.pyx":233
4019  *     cdef void set_line(self, const Point &start, const Point &end):
4020  *         cdef double azi1
4021  *         self.a13 = geod_geninverse(&self.geod,             # <<<<<<<<<<<<<<
4022  *                                    start.y, start.x, end.y, end.x,
4023  *                                    NULL, &azi1, NULL, NULL, NULL, NULL, NULL)
4024  */
4025   __pyx_v_self->a13 = geod_geninverse((&__pyx_v_self->geod), __pyx_v_start.y, __pyx_v_start.x, __pyx_v_end.y, __pyx_v_end.x, NULL, (&__pyx_v_azi1), NULL, NULL, NULL, NULL, NULL);
4026 
4027   /* "cartopy/trace.pyx":236
4028  *                                    start.y, start.x, end.y, end.x,
4029  *                                    NULL, &azi1, NULL, NULL, NULL, NULL, NULL)
4030  *         geod_lineinit(&self.geod_line, &self.geod, start.y, start.x, azi1,             # <<<<<<<<<<<<<<
4031  *                       GEOD_LATITUDE | GEOD_LONGITUDE);
4032  *
4033  */
4034   geod_lineinit((&__pyx_v_self->geod_line), (&__pyx_v_self->geod), __pyx_v_start.y, __pyx_v_start.x, __pyx_v_azi1, (GEOD_LATITUDE | GEOD_LONGITUDE));
4035 
4036   /* "cartopy/trace.pyx":231
4037  *         geod_init(&self.geod, major_axis, 1 - sqrt(1 - eccentricity_squared))
4038  *
4039  *     cdef void set_line(self, const Point &start, const Point &end):             # <<<<<<<<<<<<<<
4040  *         cdef double azi1
4041  *         self.a13 = geod_geninverse(&self.geod,
4042  */
4043 
4044   /* function exit code */
4045   __Pyx_RefNannyFinishContext();
4046 }
4047 
4048 /* "cartopy/trace.pyx":239
4049  *                       GEOD_LATITUDE | GEOD_LONGITUDE);
4050  *
4051  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
4052  *         cdef Point lonlat
4053  *
4054  */
4055 
__pyx_f_7cartopy_5trace_21SphericalInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self,double __pyx_v_t)4056 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21SphericalInterpolator_interpolate(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, double __pyx_v_t) {
4057   __pyx_t_7cartopy_5trace_Point __pyx_v_lonlat;
4058   __pyx_t_7cartopy_5trace_Point __pyx_r;
4059   __Pyx_RefNannyDeclarations
4060   __Pyx_RefNannySetupContext("interpolate", 0);
4061 
4062   /* "cartopy/trace.pyx":242
4063  *         cdef Point lonlat
4064  *
4065  *         geod_genposition(&self.geod_line, GEOD_ARCMODE, self.a13 * t,             # <<<<<<<<<<<<<<
4066  *                          &lonlat.y, &lonlat.x, NULL, NULL, NULL, NULL, NULL,
4067  *                          NULL)
4068  */
4069   geod_genposition((&__pyx_v_self->geod_line), GEOD_ARCMODE, (__pyx_v_self->a13 * __pyx_v_t), (&__pyx_v_lonlat.y), (&__pyx_v_lonlat.x), NULL, NULL, NULL, NULL, NULL, NULL);
4070 
4071   /* "cartopy/trace.pyx":246
4072  *                          NULL)
4073  *
4074  *         return self.project(lonlat)             # <<<<<<<<<<<<<<
4075  *
4076  *     cdef Point project(self, const Point &lonlat):
4077  */
4078   __pyx_r = ((struct __pyx_vtabstruct_7cartopy_5trace_SphericalInterpolator *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.project(((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_v_self), __pyx_v_lonlat);
4079   goto __pyx_L0;
4080 
4081   /* "cartopy/trace.pyx":239
4082  *                       GEOD_LATITUDE | GEOD_LONGITUDE);
4083  *
4084  *     cdef Point interpolate(self, double t):             # <<<<<<<<<<<<<<
4085  *         cdef Point lonlat
4086  *
4087  */
4088 
4089   /* function exit code */
4090   __pyx_L0:;
4091   __Pyx_RefNannyFinishContext();
4092   return __pyx_r;
4093 }
4094 
4095 /* "cartopy/trace.pyx":248
4096  *         return self.project(lonlat)
4097  *
4098  *     cdef Point project(self, const Point &lonlat):             # <<<<<<<<<<<<<<
4099  *         cdef Point xy
4100  *         cdef projLP dest
4101  */
4102 
__pyx_f_7cartopy_5trace_21SphericalInterpolator_project(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self,__pyx_t_7cartopy_5trace_Point const & __pyx_v_lonlat)4103 static __pyx_t_7cartopy_5trace_Point __pyx_f_7cartopy_5trace_21SphericalInterpolator_project(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, __pyx_t_7cartopy_5trace_Point const &__pyx_v_lonlat) {
4104   __pyx_t_7cartopy_5trace_Point __pyx_v_xy;
4105   projLP __pyx_v_dest;
4106   int __pyx_v_status;
4107   __pyx_t_7cartopy_5trace_Point __pyx_r;
4108   __Pyx_RefNannyDeclarations
4109   int __pyx_t_1;
4110   int __pyx_t_2;
4111   PyObject *__pyx_t_3 = NULL;
4112   PyObject *__pyx_t_4 = NULL;
4113   PyObject *__pyx_t_5 = NULL;
4114   int __pyx_lineno = 0;
4115   const char *__pyx_filename = NULL;
4116   int __pyx_clineno = 0;
4117   __Pyx_RefNannySetupContext("project", 0);
4118 
4119   /* "cartopy/trace.pyx":252
4120  *         cdef projLP dest
4121  *
4122  *         dest.u = (lonlat.x * DEG_TO_RAD) * self.src_scale             # <<<<<<<<<<<<<<
4123  *         dest.v = (lonlat.y * DEG_TO_RAD) * self.src_scale
4124  *
4125  */
4126   __pyx_v_dest.u = ((__pyx_v_lonlat.x * DEG_TO_RAD) * __pyx_v_self->__pyx_base.src_scale);
4127 
4128   /* "cartopy/trace.pyx":253
4129  *
4130  *         dest.u = (lonlat.x * DEG_TO_RAD) * self.src_scale
4131  *         dest.v = (lonlat.y * DEG_TO_RAD) * self.src_scale             # <<<<<<<<<<<<<<
4132  *
4133  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
4134  */
4135   __pyx_v_dest.v = ((__pyx_v_lonlat.y * DEG_TO_RAD) * __pyx_v_self->__pyx_base.src_scale);
4136 
4137   /* "cartopy/trace.pyx":255
4138  *         dest.v = (lonlat.y * DEG_TO_RAD) * self.src_scale
4139  *
4140  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,             # <<<<<<<<<<<<<<
4141  *                                        1, 1, &dest.u, &dest.v, NULL)
4142  *         if status in (-14, -20):
4143  */
4144   __pyx_v_status = pj_transform(__pyx_v_self->__pyx_base.src_proj, __pyx_v_self->__pyx_base.dest_proj, 1, 1, (&__pyx_v_dest.u), (&__pyx_v_dest.v), NULL);
4145 
4146   /* "cartopy/trace.pyx":257
4147  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
4148  *                                        1, 1, &dest.u, &dest.v, NULL)
4149  *         if status in (-14, -20):             # <<<<<<<<<<<<<<
4150  *             # -14 => "latitude or longitude exceeded limits"
4151  *             # -20 => "tolerance condition error"
4152  */
4153   switch (__pyx_v_status) {
4154     case -14L:
4155     case -20L:
4156     __pyx_t_1 = 1;
4157     break;
4158     default:
4159     __pyx_t_1 = 0;
4160     break;
4161   }
4162   __pyx_t_2 = (__pyx_t_1 != 0);
4163   if (__pyx_t_2) {
4164 
4165     /* "cartopy/trace.pyx":260
4166  *             # -14 => "latitude or longitude exceeded limits"
4167  *             # -20 => "tolerance condition error"
4168  *             dest.u = dest.v = HUGE_VAL             # <<<<<<<<<<<<<<
4169  *         elif status != 0:
4170  *             raise Exception('pj_transform failed: %d\n%s' % (
4171  */
4172     __pyx_v_dest.u = HUGE_VAL;
4173     __pyx_v_dest.v = HUGE_VAL;
4174 
4175     /* "cartopy/trace.pyx":257
4176  *         cdef int status = pj_transform(self.src_proj, self.dest_proj,
4177  *                                        1, 1, &dest.u, &dest.v, NULL)
4178  *         if status in (-14, -20):             # <<<<<<<<<<<<<<
4179  *             # -14 => "latitude or longitude exceeded limits"
4180  *             # -20 => "tolerance condition error"
4181  */
4182     goto __pyx_L3;
4183   }
4184 
4185   /* "cartopy/trace.pyx":261
4186  *             # -20 => "tolerance condition error"
4187  *             dest.u = dest.v = HUGE_VAL
4188  *         elif status != 0:             # <<<<<<<<<<<<<<
4189  *             raise Exception('pj_transform failed: %d\n%s' % (
4190  *                 status,
4191  */
4192   __pyx_t_2 = ((__pyx_v_status != 0) != 0);
4193   if (unlikely(__pyx_t_2)) {
4194 
4195     /* "cartopy/trace.pyx":263
4196  *         elif status != 0:
4197  *             raise Exception('pj_transform failed: %d\n%s' % (
4198  *                 status,             # <<<<<<<<<<<<<<
4199  *                 pj_strerrno(status)))
4200  *
4201  */
4202     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_status); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
4203     __Pyx_GOTREF(__pyx_t_3);
4204 
4205     /* "cartopy/trace.pyx":264
4206  *             raise Exception('pj_transform failed: %d\n%s' % (
4207  *                 status,
4208  *                 pj_strerrno(status)))             # <<<<<<<<<<<<<<
4209  *
4210  *         xy.x = dest.u * self.dest_scale
4211  */
4212     __pyx_t_4 = __Pyx_PyBytes_FromString(pj_strerrno(__pyx_v_status)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
4213     __Pyx_GOTREF(__pyx_t_4);
4214 
4215     /* "cartopy/trace.pyx":263
4216  *         elif status != 0:
4217  *             raise Exception('pj_transform failed: %d\n%s' % (
4218  *                 status,             # <<<<<<<<<<<<<<
4219  *                 pj_strerrno(status)))
4220  *
4221  */
4222     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error)
4223     __Pyx_GOTREF(__pyx_t_5);
4224     __Pyx_GIVEREF(__pyx_t_3);
4225     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
4226     __Pyx_GIVEREF(__pyx_t_4);
4227     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
4228     __pyx_t_3 = 0;
4229     __pyx_t_4 = 0;
4230 
4231     /* "cartopy/trace.pyx":262
4232  *             dest.u = dest.v = HUGE_VAL
4233  *         elif status != 0:
4234  *             raise Exception('pj_transform failed: %d\n%s' % (             # <<<<<<<<<<<<<<
4235  *                 status,
4236  *                 pj_strerrno(status)))
4237  */
4238     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_pj_transform_failed_d_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error)
4239     __Pyx_GOTREF(__pyx_t_4);
4240     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4241     __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
4242     __Pyx_GOTREF(__pyx_t_5);
4243     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4244     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
4245     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4246     __PYX_ERR(0, 262, __pyx_L1_error)
4247 
4248     /* "cartopy/trace.pyx":261
4249  *             # -20 => "tolerance condition error"
4250  *             dest.u = dest.v = HUGE_VAL
4251  *         elif status != 0:             # <<<<<<<<<<<<<<
4252  *             raise Exception('pj_transform failed: %d\n%s' % (
4253  *                 status,
4254  */
4255   }
4256   __pyx_L3:;
4257 
4258   /* "cartopy/trace.pyx":266
4259  *                 pj_strerrno(status)))
4260  *
4261  *         xy.x = dest.u * self.dest_scale             # <<<<<<<<<<<<<<
4262  *         xy.y = dest.v * self.dest_scale
4263  *         return xy
4264  */
4265   __pyx_v_xy.x = (__pyx_v_dest.u * __pyx_v_self->__pyx_base.dest_scale);
4266 
4267   /* "cartopy/trace.pyx":267
4268  *
4269  *         xy.x = dest.u * self.dest_scale
4270  *         xy.y = dest.v * self.dest_scale             # <<<<<<<<<<<<<<
4271  *         return xy
4272  *
4273  */
4274   __pyx_v_xy.y = (__pyx_v_dest.v * __pyx_v_self->__pyx_base.dest_scale);
4275 
4276   /* "cartopy/trace.pyx":268
4277  *         xy.x = dest.u * self.dest_scale
4278  *         xy.y = dest.v * self.dest_scale
4279  *         return xy             # <<<<<<<<<<<<<<
4280  *
4281  *
4282  */
4283   __pyx_r = __pyx_v_xy;
4284   goto __pyx_L0;
4285 
4286   /* "cartopy/trace.pyx":248
4287  *         return self.project(lonlat)
4288  *
4289  *     cdef Point project(self, const Point &lonlat):             # <<<<<<<<<<<<<<
4290  *         cdef Point xy
4291  *         cdef projLP dest
4292  */
4293 
4294   /* function exit code */
4295   __pyx_L1_error:;
4296   __Pyx_XDECREF(__pyx_t_3);
4297   __Pyx_XDECREF(__pyx_t_4);
4298   __Pyx_XDECREF(__pyx_t_5);
4299   __Pyx_WriteUnraisable("cartopy.trace.SphericalInterpolator.project", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4300   __Pyx_pretend_to_initialize(&__pyx_r);
4301   __pyx_L0:;
4302   __Pyx_RefNannyFinishContext();
4303   return __pyx_r;
4304 }
4305 
4306 /* "(tree fragment)":1
4307  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4308  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4309  * def __setstate_cython__(self, __pyx_state):
4310  */
4311 
4312 /* Python wrapper */
4313 static PyObject *__pyx_pw_7cartopy_5trace_21SphericalInterpolator_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4314 static char __pyx_doc_7cartopy_5trace_21SphericalInterpolator___reduce_cython__[] = "SphericalInterpolator.__reduce_cython__(self)";
__pyx_pw_7cartopy_5trace_21SphericalInterpolator_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4315 static PyObject *__pyx_pw_7cartopy_5trace_21SphericalInterpolator_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4316   PyObject *__pyx_r = 0;
4317   __Pyx_RefNannyDeclarations
4318   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4319   __pyx_r = __pyx_pf_7cartopy_5trace_21SphericalInterpolator___reduce_cython__(((struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *)__pyx_v_self));
4320 
4321   /* function exit code */
4322   __Pyx_RefNannyFinishContext();
4323   return __pyx_r;
4324 }
4325 
__pyx_pf_7cartopy_5trace_21SphericalInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self)4326 static PyObject *__pyx_pf_7cartopy_5trace_21SphericalInterpolator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self) {
4327   PyObject *__pyx_r = NULL;
4328   __Pyx_RefNannyDeclarations
4329   PyObject *__pyx_t_1 = NULL;
4330   int __pyx_lineno = 0;
4331   const char *__pyx_filename = NULL;
4332   int __pyx_clineno = 0;
4333   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4334 
4335   /* "(tree fragment)":2
4336  * def __reduce_cython__(self):
4337  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
4338  * def __setstate_cython__(self, __pyx_state):
4339  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4340  */
4341   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4342   __Pyx_GOTREF(__pyx_t_1);
4343   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4344   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4345   __PYX_ERR(1, 2, __pyx_L1_error)
4346 
4347   /* "(tree fragment)":1
4348  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4349  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4350  * def __setstate_cython__(self, __pyx_state):
4351  */
4352 
4353   /* function exit code */
4354   __pyx_L1_error:;
4355   __Pyx_XDECREF(__pyx_t_1);
4356   __Pyx_AddTraceback("cartopy.trace.SphericalInterpolator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4357   __pyx_r = NULL;
4358   __Pyx_XGIVEREF(__pyx_r);
4359   __Pyx_RefNannyFinishContext();
4360   return __pyx_r;
4361 }
4362 
4363 /* "(tree fragment)":3
4364  * def __reduce_cython__(self):
4365  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4366  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4367  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4368  */
4369 
4370 /* Python wrapper */
4371 static PyObject *__pyx_pw_7cartopy_5trace_21SphericalInterpolator_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
4372 static char __pyx_doc_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__[] = "SphericalInterpolator.__setstate_cython__(self, __pyx_state)";
__pyx_pw_7cartopy_5trace_21SphericalInterpolator_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4373 static PyObject *__pyx_pw_7cartopy_5trace_21SphericalInterpolator_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4374   PyObject *__pyx_r = 0;
4375   __Pyx_RefNannyDeclarations
4376   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4377   __pyx_r = __pyx_pf_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__(((struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4378 
4379   /* function exit code */
4380   __Pyx_RefNannyFinishContext();
4381   return __pyx_r;
4382 }
4383 
__pyx_pf_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)4384 static PyObject *__pyx_pf_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4385   PyObject *__pyx_r = NULL;
4386   __Pyx_RefNannyDeclarations
4387   PyObject *__pyx_t_1 = NULL;
4388   int __pyx_lineno = 0;
4389   const char *__pyx_filename = NULL;
4390   int __pyx_clineno = 0;
4391   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4392 
4393   /* "(tree fragment)":4
4394  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4395  * def __setstate_cython__(self, __pyx_state):
4396  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
4397  */
4398   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4399   __Pyx_GOTREF(__pyx_t_1);
4400   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4401   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4402   __PYX_ERR(1, 4, __pyx_L1_error)
4403 
4404   /* "(tree fragment)":3
4405  * def __reduce_cython__(self):
4406  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4407  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4408  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4409  */
4410 
4411   /* function exit code */
4412   __pyx_L1_error:;
4413   __Pyx_XDECREF(__pyx_t_1);
4414   __Pyx_AddTraceback("cartopy.trace.SphericalInterpolator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4415   __pyx_r = NULL;
4416   __Pyx_XGIVEREF(__pyx_r);
4417   __Pyx_RefNannyFinishContext();
4418   return __pyx_r;
4419 }
4420 
4421 /* "cartopy/trace.pyx":277
4422  *
4423  *
4424  * cdef State get_state(const Point &point, const GEOSPreparedGeometry *gp_domain,             # <<<<<<<<<<<<<<
4425  *                      GEOSContextHandle_t handle):
4426  *     cdef State state
4427  */
4428 
__pyx_f_7cartopy_5trace_get_state(__pyx_t_7cartopy_5trace_Point const & __pyx_v_point,GEOSPreparedGeometry const * __pyx_v_gp_domain,GEOSContextHandle_t __pyx_v_handle)4429 static enum __pyx_t_7cartopy_5trace_State __pyx_f_7cartopy_5trace_get_state(__pyx_t_7cartopy_5trace_Point const &__pyx_v_point, GEOSPreparedGeometry const *__pyx_v_gp_domain, GEOSContextHandle_t __pyx_v_handle) {
4430   enum __pyx_t_7cartopy_5trace_State __pyx_v_state;
4431   GEOSCoordSequence *__pyx_v_coords;
4432   GEOSGeometry *__pyx_v_g_point;
4433   enum __pyx_t_7cartopy_5trace_State __pyx_r;
4434   __Pyx_RefNannyDeclarations
4435   int __pyx_t_1;
4436   int __pyx_t_2;
4437   enum __pyx_t_7cartopy_5trace_State __pyx_t_3;
4438   __Pyx_RefNannySetupContext("get_state", 0);
4439 
4440   /* "cartopy/trace.pyx":283
4441  *     cdef GEOSGeometry *g_point
4442  *
4443  *     if isfinite(point.x) and isfinite(point.y):             # <<<<<<<<<<<<<<
4444  *         # TODO: Avoid create-destroy
4445  *         coords = GEOSCoordSeq_create_r(handle, 1, 2)
4446  */
4447   __pyx_t_2 = (npy_isfinite(__pyx_v_point.x) != 0);
4448   if (__pyx_t_2) {
4449   } else {
4450     __pyx_t_1 = __pyx_t_2;
4451     goto __pyx_L4_bool_binop_done;
4452   }
4453   __pyx_t_2 = (npy_isfinite(__pyx_v_point.y) != 0);
4454   __pyx_t_1 = __pyx_t_2;
4455   __pyx_L4_bool_binop_done:;
4456   if (__pyx_t_1) {
4457 
4458     /* "cartopy/trace.pyx":285
4459  *     if isfinite(point.x) and isfinite(point.y):
4460  *         # TODO: Avoid create-destroy
4461  *         coords = GEOSCoordSeq_create_r(handle, 1, 2)             # <<<<<<<<<<<<<<
4462  *         GEOSCoordSeq_setX_r(handle, coords, 0, point.x)
4463  *         GEOSCoordSeq_setY_r(handle, coords, 0, point.y)
4464  */
4465     __pyx_v_coords = GEOSCoordSeq_create_r(__pyx_v_handle, 1, 2);
4466 
4467     /* "cartopy/trace.pyx":286
4468  *         # TODO: Avoid create-destroy
4469  *         coords = GEOSCoordSeq_create_r(handle, 1, 2)
4470  *         GEOSCoordSeq_setX_r(handle, coords, 0, point.x)             # <<<<<<<<<<<<<<
4471  *         GEOSCoordSeq_setY_r(handle, coords, 0, point.y)
4472  *         g_point = GEOSGeom_createPoint_r(handle, coords)
4473  */
4474     (void)(GEOSCoordSeq_setX_r(__pyx_v_handle, __pyx_v_coords, 0, __pyx_v_point.x));
4475 
4476     /* "cartopy/trace.pyx":287
4477  *         coords = GEOSCoordSeq_create_r(handle, 1, 2)
4478  *         GEOSCoordSeq_setX_r(handle, coords, 0, point.x)
4479  *         GEOSCoordSeq_setY_r(handle, coords, 0, point.y)             # <<<<<<<<<<<<<<
4480  *         g_point = GEOSGeom_createPoint_r(handle, coords)
4481  *         state = (POINT_IN
4482  */
4483     (void)(GEOSCoordSeq_setY_r(__pyx_v_handle, __pyx_v_coords, 0, __pyx_v_point.y));
4484 
4485     /* "cartopy/trace.pyx":288
4486  *         GEOSCoordSeq_setX_r(handle, coords, 0, point.x)
4487  *         GEOSCoordSeq_setY_r(handle, coords, 0, point.y)
4488  *         g_point = GEOSGeom_createPoint_r(handle, coords)             # <<<<<<<<<<<<<<
4489  *         state = (POINT_IN
4490  *                  if GEOSPreparedCovers_r(handle, gp_domain, g_point)
4491  */
4492     __pyx_v_g_point = GEOSGeom_createPoint_r(__pyx_v_handle, __pyx_v_coords);
4493 
4494     /* "cartopy/trace.pyx":290
4495  *         g_point = GEOSGeom_createPoint_r(handle, coords)
4496  *         state = (POINT_IN
4497  *                  if GEOSPreparedCovers_r(handle, gp_domain, g_point)             # <<<<<<<<<<<<<<
4498  *                  else POINT_OUT)
4499  *         GEOSGeom_destroy_r(handle, g_point)
4500  */
4501     if ((GEOSPreparedCovers_r(__pyx_v_handle, __pyx_v_gp_domain, __pyx_v_g_point) != 0)) {
4502 
4503       /* "cartopy/trace.pyx":289
4504  *         GEOSCoordSeq_setY_r(handle, coords, 0, point.y)
4505  *         g_point = GEOSGeom_createPoint_r(handle, coords)
4506  *         state = (POINT_IN             # <<<<<<<<<<<<<<
4507  *                  if GEOSPreparedCovers_r(handle, gp_domain, g_point)
4508  *                  else POINT_OUT)
4509  */
4510       __pyx_t_3 = __pyx_e_7cartopy_5trace_POINT_IN;
4511     } else {
4512 
4513       /* "cartopy/trace.pyx":291
4514  *         state = (POINT_IN
4515  *                  if GEOSPreparedCovers_r(handle, gp_domain, g_point)
4516  *                  else POINT_OUT)             # <<<<<<<<<<<<<<
4517  *         GEOSGeom_destroy_r(handle, g_point)
4518  *     else:
4519  */
4520       __pyx_t_3 = __pyx_e_7cartopy_5trace_POINT_OUT;
4521     }
4522     __pyx_v_state = __pyx_t_3;
4523 
4524     /* "cartopy/trace.pyx":292
4525  *                  if GEOSPreparedCovers_r(handle, gp_domain, g_point)
4526  *                  else POINT_OUT)
4527  *         GEOSGeom_destroy_r(handle, g_point)             # <<<<<<<<<<<<<<
4528  *     else:
4529  *         state = POINT_NAN
4530  */
4531     GEOSGeom_destroy_r(__pyx_v_handle, __pyx_v_g_point);
4532 
4533     /* "cartopy/trace.pyx":283
4534  *     cdef GEOSGeometry *g_point
4535  *
4536  *     if isfinite(point.x) and isfinite(point.y):             # <<<<<<<<<<<<<<
4537  *         # TODO: Avoid create-destroy
4538  *         coords = GEOSCoordSeq_create_r(handle, 1, 2)
4539  */
4540     goto __pyx_L3;
4541   }
4542 
4543   /* "cartopy/trace.pyx":294
4544  *         GEOSGeom_destroy_r(handle, g_point)
4545  *     else:
4546  *         state = POINT_NAN             # <<<<<<<<<<<<<<
4547  *     return state
4548  *
4549  */
4550   /*else*/ {
4551     __pyx_v_state = __pyx_e_7cartopy_5trace_POINT_NAN;
4552   }
4553   __pyx_L3:;
4554 
4555   /* "cartopy/trace.pyx":295
4556  *     else:
4557  *         state = POINT_NAN
4558  *     return state             # <<<<<<<<<<<<<<
4559  *
4560  *
4561  */
4562   __pyx_r = __pyx_v_state;
4563   goto __pyx_L0;
4564 
4565   /* "cartopy/trace.pyx":277
4566  *
4567  *
4568  * cdef State get_state(const Point &point, const GEOSPreparedGeometry *gp_domain,             # <<<<<<<<<<<<<<
4569  *                      GEOSContextHandle_t handle):
4570  *     cdef State state
4571  */
4572 
4573   /* function exit code */
4574   __pyx_L0:;
4575   __Pyx_RefNannyFinishContext();
4576   return __pyx_r;
4577 }
4578 
4579 /* "cartopy/trace.pyx":299
4580  *
4581  * @cython.cdivision(True)  # Want divide-by-zero to produce NaN.
4582  * cdef bool straightAndDomain(double t_start, const Point &p_start,             # <<<<<<<<<<<<<<
4583  *                             double t_end, const Point &p_end,
4584  *                             Interpolator interpolator, double threshold,
4585  */
4586 
__pyx_f_7cartopy_5trace_straightAndDomain(double __pyx_v_t_start,__pyx_t_7cartopy_5trace_Point const & __pyx_v_p_start,double __pyx_v_t_end,__pyx_t_7cartopy_5trace_Point const & __pyx_v_p_end,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interpolator,double __pyx_v_threshold,GEOSContextHandle_t __pyx_v_handle,GEOSPreparedGeometry const * __pyx_v_gp_domain,bool __pyx_v_inside)4587 static bool __pyx_f_7cartopy_5trace_straightAndDomain(double __pyx_v_t_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_p_start, double __pyx_v_t_end, __pyx_t_7cartopy_5trace_Point const &__pyx_v_p_end, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator, double __pyx_v_threshold, GEOSContextHandle_t __pyx_v_handle, GEOSPreparedGeometry const *__pyx_v_gp_domain, bool __pyx_v_inside) {
4588   bool __pyx_v_valid;
4589   double __pyx_v_t_mid;
4590   __pyx_t_7cartopy_5trace_Point __pyx_v_p_mid;
4591   double __pyx_v_seg_dx;
4592   double __pyx_v_seg_dy;
4593   double __pyx_v_mid_dx;
4594   double __pyx_v_mid_dy;
4595   double __pyx_v_seg_hypot_sq;
4596   double __pyx_v_along;
4597   double __pyx_v_separation;
4598   double __pyx_v_hypot;
4599   GEOSCoordSequence *__pyx_v_coords;
4600   GEOSGeometry *__pyx_v_g_segment;
4601   bool __pyx_r;
4602   __Pyx_RefNannyDeclarations
4603   int __pyx_t_1;
4604   int __pyx_t_2;
4605   __Pyx_RefNannySetupContext("straightAndDomain", 0);
4606 
4607   /* "cartopy/trace.pyx":334
4608  *
4609  *     # This could be optimised out of the loop.
4610  *     if not (isfinite(p_start.x) and isfinite(p_start.y)):             # <<<<<<<<<<<<<<
4611  *         valid = False
4612  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):
4613  */
4614   __pyx_t_2 = (npy_isfinite(__pyx_v_p_start.x) != 0);
4615   if (__pyx_t_2) {
4616   } else {
4617     __pyx_t_1 = __pyx_t_2;
4618     goto __pyx_L4_bool_binop_done;
4619   }
4620   __pyx_t_2 = (npy_isfinite(__pyx_v_p_start.y) != 0);
4621   __pyx_t_1 = __pyx_t_2;
4622   __pyx_L4_bool_binop_done:;
4623   __pyx_t_2 = ((!__pyx_t_1) != 0);
4624   if (__pyx_t_2) {
4625 
4626     /* "cartopy/trace.pyx":335
4627  *     # This could be optimised out of the loop.
4628  *     if not (isfinite(p_start.x) and isfinite(p_start.y)):
4629  *         valid = False             # <<<<<<<<<<<<<<
4630  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):
4631  *         valid = False
4632  */
4633     __pyx_v_valid = 0;
4634 
4635     /* "cartopy/trace.pyx":334
4636  *
4637  *     # This could be optimised out of the loop.
4638  *     if not (isfinite(p_start.x) and isfinite(p_start.y)):             # <<<<<<<<<<<<<<
4639  *         valid = False
4640  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):
4641  */
4642     goto __pyx_L3;
4643   }
4644 
4645   /* "cartopy/trace.pyx":336
4646  *     if not (isfinite(p_start.x) and isfinite(p_start.y)):
4647  *         valid = False
4648  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):             # <<<<<<<<<<<<<<
4649  *         valid = False
4650  *     else:
4651  */
4652   __pyx_t_1 = (npy_isfinite(__pyx_v_p_end.x) != 0);
4653   if (__pyx_t_1) {
4654   } else {
4655     __pyx_t_2 = __pyx_t_1;
4656     goto __pyx_L6_bool_binop_done;
4657   }
4658   __pyx_t_1 = (npy_isfinite(__pyx_v_p_end.y) != 0);
4659   __pyx_t_2 = __pyx_t_1;
4660   __pyx_L6_bool_binop_done:;
4661   __pyx_t_1 = ((!__pyx_t_2) != 0);
4662   if (__pyx_t_1) {
4663 
4664     /* "cartopy/trace.pyx":337
4665  *         valid = False
4666  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):
4667  *         valid = False             # <<<<<<<<<<<<<<
4668  *     else:
4669  *         # Find the projected mid-point
4670  */
4671     __pyx_v_valid = 0;
4672 
4673     /* "cartopy/trace.pyx":336
4674  *     if not (isfinite(p_start.x) and isfinite(p_start.y)):
4675  *         valid = False
4676  *     elif not (isfinite(p_end.x) and isfinite(p_end.y)):             # <<<<<<<<<<<<<<
4677  *         valid = False
4678  *     else:
4679  */
4680     goto __pyx_L3;
4681   }
4682 
4683   /* "cartopy/trace.pyx":340
4684  *     else:
4685  *         # Find the projected mid-point
4686  *         t_mid = (t_start + t_end) * 0.5             # <<<<<<<<<<<<<<
4687  *         p_mid = interpolator.interpolate(t_mid)
4688  *
4689  */
4690   /*else*/ {
4691     __pyx_v_t_mid = ((__pyx_v_t_start + __pyx_v_t_end) * 0.5);
4692 
4693     /* "cartopy/trace.pyx":341
4694  *         # Find the projected mid-point
4695  *         t_mid = (t_start + t_end) * 0.5
4696  *         p_mid = interpolator.interpolate(t_mid)             # <<<<<<<<<<<<<<
4697  *
4698  *         # Determine the closest point on the segment to the midpoint, in
4699  */
4700     __pyx_v_p_mid = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->interpolate(__pyx_v_interpolator, __pyx_v_t_mid);
4701 
4702     /* "cartopy/trace.pyx":370
4703  *         # following equations (with a slight refactoring to reuse some
4704  *         # intermediate values):
4705  *         seg_dx = p_end.x - p_start.x             # <<<<<<<<<<<<<<
4706  *         seg_dy = p_end.y - p_start.y
4707  *         mid_dx = p_mid.x - p_start.x
4708  */
4709     __pyx_v_seg_dx = (__pyx_v_p_end.x - __pyx_v_p_start.x);
4710 
4711     /* "cartopy/trace.pyx":371
4712  *         # intermediate values):
4713  *         seg_dx = p_end.x - p_start.x
4714  *         seg_dy = p_end.y - p_start.y             # <<<<<<<<<<<<<<
4715  *         mid_dx = p_mid.x - p_start.x
4716  *         mid_dy = p_mid.y - p_start.y
4717  */
4718     __pyx_v_seg_dy = (__pyx_v_p_end.y - __pyx_v_p_start.y);
4719 
4720     /* "cartopy/trace.pyx":372
4721  *         seg_dx = p_end.x - p_start.x
4722  *         seg_dy = p_end.y - p_start.y
4723  *         mid_dx = p_mid.x - p_start.x             # <<<<<<<<<<<<<<
4724  *         mid_dy = p_mid.y - p_start.y
4725  *         seg_hypot_sq = seg_dx*seg_dx + seg_dy*seg_dy
4726  */
4727     __pyx_v_mid_dx = (__pyx_v_p_mid.x - __pyx_v_p_start.x);
4728 
4729     /* "cartopy/trace.pyx":373
4730  *         seg_dy = p_end.y - p_start.y
4731  *         mid_dx = p_mid.x - p_start.x
4732  *         mid_dy = p_mid.y - p_start.y             # <<<<<<<<<<<<<<
4733  *         seg_hypot_sq = seg_dx*seg_dx + seg_dy*seg_dy
4734  *
4735  */
4736     __pyx_v_mid_dy = (__pyx_v_p_mid.y - __pyx_v_p_start.y);
4737 
4738     /* "cartopy/trace.pyx":374
4739  *         mid_dx = p_mid.x - p_start.x
4740  *         mid_dy = p_mid.y - p_start.y
4741  *         seg_hypot_sq = seg_dx*seg_dx + seg_dy*seg_dy             # <<<<<<<<<<<<<<
4742  *
4743  *         along = (seg_dx*mid_dx + seg_dy*mid_dy) / seg_hypot_sq
4744  */
4745     __pyx_v_seg_hypot_sq = ((__pyx_v_seg_dx * __pyx_v_seg_dx) + (__pyx_v_seg_dy * __pyx_v_seg_dy));
4746 
4747     /* "cartopy/trace.pyx":376
4748  *         seg_hypot_sq = seg_dx*seg_dx + seg_dy*seg_dy
4749  *
4750  *         along = (seg_dx*mid_dx + seg_dy*mid_dy) / seg_hypot_sq             # <<<<<<<<<<<<<<
4751  *
4752  *         if isnan(along):
4753  */
4754     __pyx_v_along = (((__pyx_v_seg_dx * __pyx_v_mid_dx) + (__pyx_v_seg_dy * __pyx_v_mid_dy)) / __pyx_v_seg_hypot_sq);
4755 
4756     /* "cartopy/trace.pyx":378
4757  *         along = (seg_dx*mid_dx + seg_dy*mid_dy) / seg_hypot_sq
4758  *
4759  *         if isnan(along):             # <<<<<<<<<<<<<<
4760  *             valid = True
4761  *         else:
4762  */
4763     __pyx_t_1 = (npy_isnan(__pyx_v_along) != 0);
4764     if (__pyx_t_1) {
4765 
4766       /* "cartopy/trace.pyx":379
4767  *
4768  *         if isnan(along):
4769  *             valid = True             # <<<<<<<<<<<<<<
4770  *         else:
4771  *             valid = 0.0 < along < 1.0
4772  */
4773       __pyx_v_valid = 1;
4774 
4775       /* "cartopy/trace.pyx":378
4776  *         along = (seg_dx*mid_dx + seg_dy*mid_dy) / seg_hypot_sq
4777  *
4778  *         if isnan(along):             # <<<<<<<<<<<<<<
4779  *             valid = True
4780  *         else:
4781  */
4782       goto __pyx_L8;
4783     }
4784 
4785     /* "cartopy/trace.pyx":381
4786  *             valid = True
4787  *         else:
4788  *             valid = 0.0 < along < 1.0             # <<<<<<<<<<<<<<
4789  *             if valid:
4790  *                 # For the distance of the point from the line segment, using
4791  */
4792     /*else*/ {
4793       __pyx_t_1 = (0.0 < __pyx_v_along);
4794       if (__pyx_t_1) {
4795         __pyx_t_1 = (__pyx_v_along < 1.0);
4796       }
4797       __pyx_v_valid = __pyx_t_1;
4798 
4799       /* "cartopy/trace.pyx":382
4800  *         else:
4801  *             valid = 0.0 < along < 1.0
4802  *             if valid:             # <<<<<<<<<<<<<<
4803  *                 # For the distance of the point from the line segment, using
4804  *                 # the same geometry above, use sin instead of cos:
4805  */
4806       __pyx_t_1 = (__pyx_v_valid != 0);
4807       if (__pyx_t_1) {
4808 
4809         /* "cartopy/trace.pyx":387
4810  *                 #     D = hypot(x - x0, y - y0) * sin()
4811  *                 # and then simplify with SymPy again:
4812  *                 separation = (abs(mid_dx*seg_dy - mid_dy*seg_dx) /             # <<<<<<<<<<<<<<
4813  *                               sqrt(seg_hypot_sq))
4814  *                 if inside:
4815  */
4816         __pyx_v_separation = (fabs(((__pyx_v_mid_dx * __pyx_v_seg_dy) - (__pyx_v_mid_dy * __pyx_v_seg_dx))) / sqrt(__pyx_v_seg_hypot_sq));
4817 
4818         /* "cartopy/trace.pyx":389
4819  *                 separation = (abs(mid_dx*seg_dy - mid_dy*seg_dx) /
4820  *                               sqrt(seg_hypot_sq))
4821  *                 if inside:             # <<<<<<<<<<<<<<
4822  *                     # Scale the lateral threshold by the distance from
4823  *                     # the nearest end. I.e. Near the ends the lateral
4824  */
4825         __pyx_t_1 = (__pyx_v_inside != 0);
4826         if (__pyx_t_1) {
4827 
4828           /* "cartopy/trace.pyx":395
4829  *                     # value in the middle.
4830  *                     valid = (separation <=
4831  *                              threshold * 2.0 * (0.5 - abs(0.5 - along)))             # <<<<<<<<<<<<<<
4832  *                 else:
4833  *                     # Check if the mid-point makes less than ~11 degree
4834  */
4835           __pyx_v_valid = (__pyx_v_separation <= ((__pyx_v_threshold * 2.0) * (0.5 - fabs((0.5 - __pyx_v_along)))));
4836 
4837           /* "cartopy/trace.pyx":389
4838  *                 separation = (abs(mid_dx*seg_dy - mid_dy*seg_dx) /
4839  *                               sqrt(seg_hypot_sq))
4840  *                 if inside:             # <<<<<<<<<<<<<<
4841  *                     # Scale the lateral threshold by the distance from
4842  *                     # the nearest end. I.e. Near the ends the lateral
4843  */
4844           goto __pyx_L10;
4845         }
4846 
4847         /* "cartopy/trace.pyx":403
4848  *                     # the lengths, hence:
4849  *                     # 0.2 ^ 2 => 0.04
4850  *                     hypot = mid_dx*mid_dx + mid_dy*mid_dy             # <<<<<<<<<<<<<<
4851  *                     valid = ((separation * separation) / hypot) < 0.04
4852  *
4853  */
4854         /*else*/ {
4855           __pyx_v_hypot = ((__pyx_v_mid_dx * __pyx_v_mid_dx) + (__pyx_v_mid_dy * __pyx_v_mid_dy));
4856 
4857           /* "cartopy/trace.pyx":404
4858  *                     # 0.2 ^ 2 => 0.04
4859  *                     hypot = mid_dx*mid_dx + mid_dy*mid_dy
4860  *                     valid = ((separation * separation) / hypot) < 0.04             # <<<<<<<<<<<<<<
4861  *
4862  *         if valid:
4863  */
4864           __pyx_v_valid = (((__pyx_v_separation * __pyx_v_separation) / __pyx_v_hypot) < 0.04);
4865         }
4866         __pyx_L10:;
4867 
4868         /* "cartopy/trace.pyx":382
4869  *         else:
4870  *             valid = 0.0 < along < 1.0
4871  *             if valid:             # <<<<<<<<<<<<<<
4872  *                 # For the distance of the point from the line segment, using
4873  *                 # the same geometry above, use sin instead of cos:
4874  */
4875       }
4876     }
4877     __pyx_L8:;
4878 
4879     /* "cartopy/trace.pyx":406
4880  *                     valid = ((separation * separation) / hypot) < 0.04
4881  *
4882  *         if valid:             # <<<<<<<<<<<<<<
4883  *             # TODO: Re-use geometries, instead of create-destroy!
4884  *
4885  */
4886     __pyx_t_1 = (__pyx_v_valid != 0);
4887     if (__pyx_t_1) {
4888 
4889       /* "cartopy/trace.pyx":410
4890  *
4891  *             # Create a LineString for the current end-point.
4892  *             coords = GEOSCoordSeq_create_r(handle, 2, 2)             # <<<<<<<<<<<<<<
4893  *             GEOSCoordSeq_setX_r(handle, coords, 0, p_start.x)
4894  *             GEOSCoordSeq_setY_r(handle, coords, 0, p_start.y)
4895  */
4896       __pyx_v_coords = GEOSCoordSeq_create_r(__pyx_v_handle, 2, 2);
4897 
4898       /* "cartopy/trace.pyx":411
4899  *             # Create a LineString for the current end-point.
4900  *             coords = GEOSCoordSeq_create_r(handle, 2, 2)
4901  *             GEOSCoordSeq_setX_r(handle, coords, 0, p_start.x)             # <<<<<<<<<<<<<<
4902  *             GEOSCoordSeq_setY_r(handle, coords, 0, p_start.y)
4903  *             GEOSCoordSeq_setX_r(handle, coords, 1, p_end.x)
4904  */
4905       (void)(GEOSCoordSeq_setX_r(__pyx_v_handle, __pyx_v_coords, 0, __pyx_v_p_start.x));
4906 
4907       /* "cartopy/trace.pyx":412
4908  *             coords = GEOSCoordSeq_create_r(handle, 2, 2)
4909  *             GEOSCoordSeq_setX_r(handle, coords, 0, p_start.x)
4910  *             GEOSCoordSeq_setY_r(handle, coords, 0, p_start.y)             # <<<<<<<<<<<<<<
4911  *             GEOSCoordSeq_setX_r(handle, coords, 1, p_end.x)
4912  *             GEOSCoordSeq_setY_r(handle, coords, 1, p_end.y)
4913  */
4914       (void)(GEOSCoordSeq_setY_r(__pyx_v_handle, __pyx_v_coords, 0, __pyx_v_p_start.y));
4915 
4916       /* "cartopy/trace.pyx":413
4917  *             GEOSCoordSeq_setX_r(handle, coords, 0, p_start.x)
4918  *             GEOSCoordSeq_setY_r(handle, coords, 0, p_start.y)
4919  *             GEOSCoordSeq_setX_r(handle, coords, 1, p_end.x)             # <<<<<<<<<<<<<<
4920  *             GEOSCoordSeq_setY_r(handle, coords, 1, p_end.y)
4921  *             g_segment = GEOSGeom_createLineString_r(handle, coords)
4922  */
4923       (void)(GEOSCoordSeq_setX_r(__pyx_v_handle, __pyx_v_coords, 1, __pyx_v_p_end.x));
4924 
4925       /* "cartopy/trace.pyx":414
4926  *             GEOSCoordSeq_setY_r(handle, coords, 0, p_start.y)
4927  *             GEOSCoordSeq_setX_r(handle, coords, 1, p_end.x)
4928  *             GEOSCoordSeq_setY_r(handle, coords, 1, p_end.y)             # <<<<<<<<<<<<<<
4929  *             g_segment = GEOSGeom_createLineString_r(handle, coords)
4930  *
4931  */
4932       (void)(GEOSCoordSeq_setY_r(__pyx_v_handle, __pyx_v_coords, 1, __pyx_v_p_end.y));
4933 
4934       /* "cartopy/trace.pyx":415
4935  *             GEOSCoordSeq_setX_r(handle, coords, 1, p_end.x)
4936  *             GEOSCoordSeq_setY_r(handle, coords, 1, p_end.y)
4937  *             g_segment = GEOSGeom_createLineString_r(handle, coords)             # <<<<<<<<<<<<<<
4938  *
4939  *             if inside:
4940  */
4941       __pyx_v_g_segment = GEOSGeom_createLineString_r(__pyx_v_handle, __pyx_v_coords);
4942 
4943       /* "cartopy/trace.pyx":417
4944  *             g_segment = GEOSGeom_createLineString_r(handle, coords)
4945  *
4946  *             if inside:             # <<<<<<<<<<<<<<
4947  *                 valid = GEOSPreparedCovers_r(handle, gp_domain, g_segment)
4948  *             else:
4949  */
4950       __pyx_t_1 = (__pyx_v_inside != 0);
4951       if (__pyx_t_1) {
4952 
4953         /* "cartopy/trace.pyx":418
4954  *
4955  *             if inside:
4956  *                 valid = GEOSPreparedCovers_r(handle, gp_domain, g_segment)             # <<<<<<<<<<<<<<
4957  *             else:
4958  *                 valid = GEOSPreparedDisjoint_r(handle, gp_domain, g_segment)
4959  */
4960         __pyx_v_valid = GEOSPreparedCovers_r(__pyx_v_handle, __pyx_v_gp_domain, __pyx_v_g_segment);
4961 
4962         /* "cartopy/trace.pyx":417
4963  *             g_segment = GEOSGeom_createLineString_r(handle, coords)
4964  *
4965  *             if inside:             # <<<<<<<<<<<<<<
4966  *                 valid = GEOSPreparedCovers_r(handle, gp_domain, g_segment)
4967  *             else:
4968  */
4969         goto __pyx_L12;
4970       }
4971 
4972       /* "cartopy/trace.pyx":420
4973  *                 valid = GEOSPreparedCovers_r(handle, gp_domain, g_segment)
4974  *             else:
4975  *                 valid = GEOSPreparedDisjoint_r(handle, gp_domain, g_segment)             # <<<<<<<<<<<<<<
4976  *
4977  *             GEOSGeom_destroy_r(handle, g_segment)
4978  */
4979       /*else*/ {
4980         __pyx_v_valid = GEOSPreparedDisjoint_r(__pyx_v_handle, __pyx_v_gp_domain, __pyx_v_g_segment);
4981       }
4982       __pyx_L12:;
4983 
4984       /* "cartopy/trace.pyx":422
4985  *                 valid = GEOSPreparedDisjoint_r(handle, gp_domain, g_segment)
4986  *
4987  *             GEOSGeom_destroy_r(handle, g_segment)             # <<<<<<<<<<<<<<
4988  *
4989  *     return valid
4990  */
4991       GEOSGeom_destroy_r(__pyx_v_handle, __pyx_v_g_segment);
4992 
4993       /* "cartopy/trace.pyx":406
4994  *                     valid = ((separation * separation) / hypot) < 0.04
4995  *
4996  *         if valid:             # <<<<<<<<<<<<<<
4997  *             # TODO: Re-use geometries, instead of create-destroy!
4998  *
4999  */
5000     }
5001   }
5002   __pyx_L3:;
5003 
5004   /* "cartopy/trace.pyx":424
5005  *             GEOSGeom_destroy_r(handle, g_segment)
5006  *
5007  *     return valid             # <<<<<<<<<<<<<<
5008  *
5009  *
5010  */
5011   __pyx_r = __pyx_v_valid;
5012   goto __pyx_L0;
5013 
5014   /* "cartopy/trace.pyx":299
5015  *
5016  * @cython.cdivision(True)  # Want divide-by-zero to produce NaN.
5017  * cdef bool straightAndDomain(double t_start, const Point &p_start,             # <<<<<<<<<<<<<<
5018  *                             double t_end, const Point &p_end,
5019  *                             Interpolator interpolator, double threshold,
5020  */
5021 
5022   /* function exit code */
5023   __pyx_L0:;
5024   __Pyx_RefNannyFinishContext();
5025   return __pyx_r;
5026 }
5027 
5028 /* "cartopy/trace.pyx":427
5029  *
5030  *
5031  * cdef void bisect(double t_start, const Point &p_start, const Point &p_end,             # <<<<<<<<<<<<<<
5032  *                  GEOSContextHandle_t handle,
5033  *                  const GEOSPreparedGeometry *gp_domain, const State &state,
5034  */
5035 
__pyx_f_7cartopy_5trace_bisect(double __pyx_v_t_start,__pyx_t_7cartopy_5trace_Point const & __pyx_v_p_start,__pyx_t_7cartopy_5trace_Point const & __pyx_v_p_end,GEOSContextHandle_t __pyx_v_handle,GEOSPreparedGeometry const * __pyx_v_gp_domain,enum __pyx_t_7cartopy_5trace_State const & __pyx_v_state,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interpolator,double __pyx_v_threshold,double & __pyx_v_t_min,__pyx_t_7cartopy_5trace_Point & __pyx_v_p_min,double & __pyx_v_t_max,__pyx_t_7cartopy_5trace_Point & __pyx_v_p_max)5036 static void __pyx_f_7cartopy_5trace_bisect(double __pyx_v_t_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_p_start, __pyx_t_7cartopy_5trace_Point const &__pyx_v_p_end, GEOSContextHandle_t __pyx_v_handle, GEOSPreparedGeometry const *__pyx_v_gp_domain, enum __pyx_t_7cartopy_5trace_State const &__pyx_v_state, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator, double __pyx_v_threshold, double &__pyx_v_t_min, __pyx_t_7cartopy_5trace_Point &__pyx_v_p_min, double &__pyx_v_t_max, __pyx_t_7cartopy_5trace_Point &__pyx_v_p_max) {
5037   double __pyx_v_t_current;
5038   __pyx_t_7cartopy_5trace_Point __pyx_v_p_current;
5039   bool __pyx_v_valid;
5040   __Pyx_RefNannyDeclarations
5041   int __pyx_t_1;
5042   PyObject *__pyx_t_2 = NULL;
5043   PyObject *__pyx_t_3 = NULL;
5044   bool __pyx_t_4;
5045   int __pyx_lineno = 0;
5046   const char *__pyx_filename = NULL;
5047   int __pyx_clineno = 0;
5048   __Pyx_RefNannySetupContext("bisect", 0);
5049 
5050   /* "cartopy/trace.pyx":437
5051  *
5052  *     # Initialise our bisection range to the start and end points.
5053  *     (&t_min)[0] = t_start             # <<<<<<<<<<<<<<
5054  *     (&p_min)[0] = p_start
5055  *     (&t_max)[0] = 1.0
5056  */
5057   ((&__pyx_v_t_min)[0]) = __pyx_v_t_start;
5058 
5059   /* "cartopy/trace.pyx":438
5060  *     # Initialise our bisection range to the start and end points.
5061  *     (&t_min)[0] = t_start
5062  *     (&p_min)[0] = p_start             # <<<<<<<<<<<<<<
5063  *     (&t_max)[0] = 1.0
5064  *     (&p_max)[0] = p_end
5065  */
5066   ((&__pyx_v_p_min)[0]) = __pyx_v_p_start;
5067 
5068   /* "cartopy/trace.pyx":439
5069  *     (&t_min)[0] = t_start
5070  *     (&p_min)[0] = p_start
5071  *     (&t_max)[0] = 1.0             # <<<<<<<<<<<<<<
5072  *     (&p_max)[0] = p_end
5073  *
5074  */
5075   ((&__pyx_v_t_max)[0]) = 1.0;
5076 
5077   /* "cartopy/trace.pyx":440
5078  *     (&p_min)[0] = p_start
5079  *     (&t_max)[0] = 1.0
5080  *     (&p_max)[0] = p_end             # <<<<<<<<<<<<<<
5081  *
5082  *     # Start the search at the end.
5083  */
5084   ((&__pyx_v_p_max)[0]) = __pyx_v_p_end;
5085 
5086   /* "cartopy/trace.pyx":443
5087  *
5088  *     # Start the search at the end.
5089  *     t_current = t_max             # <<<<<<<<<<<<<<
5090  *     p_current = p_max
5091  *
5092  */
5093   __pyx_v_t_current = __pyx_v_t_max;
5094 
5095   /* "cartopy/trace.pyx":444
5096  *     # Start the search at the end.
5097  *     t_current = t_max
5098  *     p_current = p_max             # <<<<<<<<<<<<<<
5099  *
5100  *     # TODO: See if we can convert the 't' threshold into one based on the
5101  */
5102   __pyx_v_p_current = __pyx_v_p_max;
5103 
5104   /* "cartopy/trace.pyx":449
5105  *     # projected coordinates - e.g. the resulting line length.
5106  *
5107  *     while abs(t_max - t_min) > 1.0e-6:             # <<<<<<<<<<<<<<
5108  *         if DEBUG:
5109  *             print("t: ", t_current)
5110  */
5111   while (1) {
5112     __pyx_t_1 = ((fabs((__pyx_v_t_max - __pyx_v_t_min)) > 1.0e-6) != 0);
5113     if (!__pyx_t_1) break;
5114 
5115     /* "cartopy/trace.pyx":450
5116  *
5117  *     while abs(t_max - t_min) > 1.0e-6:
5118  *         if DEBUG:             # <<<<<<<<<<<<<<
5119  *             print("t: ", t_current)
5120  *
5121  */
5122     __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5123     if (__pyx_t_1) {
5124 
5125       /* "cartopy/trace.pyx":451
5126  *     while abs(t_max - t_min) > 1.0e-6:
5127  *         if DEBUG:
5128  *             print("t: ", t_current)             # <<<<<<<<<<<<<<
5129  *
5130  *         if state == POINT_IN:
5131  */
5132       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t_current); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
5133       __Pyx_GOTREF(__pyx_t_2);
5134       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error)
5135       __Pyx_GOTREF(__pyx_t_3);
5136       __Pyx_INCREF(__pyx_kp_s_t);
5137       __Pyx_GIVEREF(__pyx_kp_s_t);
5138       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_t);
5139       __Pyx_GIVEREF(__pyx_t_2);
5140       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
5141       __pyx_t_2 = 0;
5142       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
5143       __Pyx_GOTREF(__pyx_t_2);
5144       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5145       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5146 
5147       /* "cartopy/trace.pyx":450
5148  *
5149  *     while abs(t_max - t_min) > 1.0e-6:
5150  *         if DEBUG:             # <<<<<<<<<<<<<<
5151  *             print("t: ", t_current)
5152  *
5153  */
5154     }
5155 
5156     /* "cartopy/trace.pyx":453
5157  *             print("t: ", t_current)
5158  *
5159  *         if state == POINT_IN:             # <<<<<<<<<<<<<<
5160  *             # Straight and entirely-inside-domain
5161  *             valid = straightAndDomain(t_start, p_start, t_current, p_current,
5162  */
5163     switch (__pyx_v_state) {
5164       case __pyx_e_7cartopy_5trace_POINT_IN:
5165 
5166       /* "cartopy/trace.pyx":455
5167  *         if state == POINT_IN:
5168  *             # Straight and entirely-inside-domain
5169  *             valid = straightAndDomain(t_start, p_start, t_current, p_current,             # <<<<<<<<<<<<<<
5170  *                                       interpolator, threshold,
5171  *                                       handle, gp_domain, True)
5172  */
5173       __pyx_v_valid = __pyx_f_7cartopy_5trace_straightAndDomain(__pyx_v_t_start, __pyx_v_p_start, __pyx_v_t_current, __pyx_v_p_current, __pyx_v_interpolator, __pyx_v_threshold, __pyx_v_handle, __pyx_v_gp_domain, 1);
5174 
5175       /* "cartopy/trace.pyx":453
5176  *             print("t: ", t_current)
5177  *
5178  *         if state == POINT_IN:             # <<<<<<<<<<<<<<
5179  *             # Straight and entirely-inside-domain
5180  *             valid = straightAndDomain(t_start, p_start, t_current, p_current,
5181  */
5182       break;
5183       case __pyx_e_7cartopy_5trace_POINT_OUT:
5184 
5185       /* "cartopy/trace.pyx":461
5186  *         elif state == POINT_OUT:
5187  *             # Straight and entirely-outside-domain
5188  *             valid = straightAndDomain(t_start, p_start, t_current, p_current,             # <<<<<<<<<<<<<<
5189  *                                       interpolator, threshold,
5190  *                                       handle, gp_domain, False)
5191  */
5192       __pyx_v_valid = __pyx_f_7cartopy_5trace_straightAndDomain(__pyx_v_t_start, __pyx_v_p_start, __pyx_v_t_current, __pyx_v_p_current, __pyx_v_interpolator, __pyx_v_threshold, __pyx_v_handle, __pyx_v_gp_domain, 0);
5193 
5194       /* "cartopy/trace.pyx":459
5195  *                                       handle, gp_domain, True)
5196  *
5197  *         elif state == POINT_OUT:             # <<<<<<<<<<<<<<
5198  *             # Straight and entirely-outside-domain
5199  *             valid = straightAndDomain(t_start, p_start, t_current, p_current,
5200  */
5201       break;
5202       default:
5203 
5204       /* "cartopy/trace.pyx":465
5205  *                                       handle, gp_domain, False)
5206  *         else:
5207  *             valid = not isfinite(p_current.x) or not isfinite(p_current.y)             # <<<<<<<<<<<<<<
5208  *
5209  *         if DEBUG:
5210  */
5211       __pyx_t_1 = (!(npy_isfinite(__pyx_v_p_current.x) != 0));
5212       if (!__pyx_t_1) {
5213       } else {
5214         __pyx_t_4 = __pyx_t_1;
5215         goto __pyx_L6_bool_binop_done;
5216       }
5217       __pyx_t_1 = (!(npy_isfinite(__pyx_v_p_current.y) != 0));
5218       __pyx_t_4 = __pyx_t_1;
5219       __pyx_L6_bool_binop_done:;
5220       __pyx_v_valid = __pyx_t_4;
5221       break;
5222     }
5223 
5224     /* "cartopy/trace.pyx":467
5225  *             valid = not isfinite(p_current.x) or not isfinite(p_current.y)
5226  *
5227  *         if DEBUG:             # <<<<<<<<<<<<<<
5228  *             print("   => valid: ", valid)
5229  *
5230  */
5231     __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5232     if (__pyx_t_1) {
5233 
5234       /* "cartopy/trace.pyx":468
5235  *
5236  *         if DEBUG:
5237  *             print("   => valid: ", valid)             # <<<<<<<<<<<<<<
5238  *
5239  *         if valid:
5240  */
5241       __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_valid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
5242       __Pyx_GOTREF(__pyx_t_2);
5243       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error)
5244       __Pyx_GOTREF(__pyx_t_3);
5245       __Pyx_INCREF(__pyx_kp_s_valid);
5246       __Pyx_GIVEREF(__pyx_kp_s_valid);
5247       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_valid);
5248       __Pyx_GIVEREF(__pyx_t_2);
5249       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
5250       __pyx_t_2 = 0;
5251       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
5252       __Pyx_GOTREF(__pyx_t_2);
5253       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5254       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5255 
5256       /* "cartopy/trace.pyx":467
5257  *             valid = not isfinite(p_current.x) or not isfinite(p_current.y)
5258  *
5259  *         if DEBUG:             # <<<<<<<<<<<<<<
5260  *             print("   => valid: ", valid)
5261  *
5262  */
5263     }
5264 
5265     /* "cartopy/trace.pyx":470
5266  *             print("   => valid: ", valid)
5267  *
5268  *         if valid:             # <<<<<<<<<<<<<<
5269  *             (&t_min)[0] = t_current
5270  *             (&p_min)[0] = p_current
5271  */
5272     __pyx_t_1 = (__pyx_v_valid != 0);
5273     if (__pyx_t_1) {
5274 
5275       /* "cartopy/trace.pyx":471
5276  *
5277  *         if valid:
5278  *             (&t_min)[0] = t_current             # <<<<<<<<<<<<<<
5279  *             (&p_min)[0] = p_current
5280  *         else:
5281  */
5282       ((&__pyx_v_t_min)[0]) = __pyx_v_t_current;
5283 
5284       /* "cartopy/trace.pyx":472
5285  *         if valid:
5286  *             (&t_min)[0] = t_current
5287  *             (&p_min)[0] = p_current             # <<<<<<<<<<<<<<
5288  *         else:
5289  *             (&t_max)[0] = t_current
5290  */
5291       ((&__pyx_v_p_min)[0]) = __pyx_v_p_current;
5292 
5293       /* "cartopy/trace.pyx":470
5294  *             print("   => valid: ", valid)
5295  *
5296  *         if valid:             # <<<<<<<<<<<<<<
5297  *             (&t_min)[0] = t_current
5298  *             (&p_min)[0] = p_current
5299  */
5300       goto __pyx_L9;
5301     }
5302 
5303     /* "cartopy/trace.pyx":474
5304  *             (&p_min)[0] = p_current
5305  *         else:
5306  *             (&t_max)[0] = t_current             # <<<<<<<<<<<<<<
5307  *             (&p_max)[0] = p_current
5308  *
5309  */
5310     /*else*/ {
5311       ((&__pyx_v_t_max)[0]) = __pyx_v_t_current;
5312 
5313       /* "cartopy/trace.pyx":475
5314  *         else:
5315  *             (&t_max)[0] = t_current
5316  *             (&p_max)[0] = p_current             # <<<<<<<<<<<<<<
5317  *
5318  *         t_current = (t_min + t_max) * 0.5
5319  */
5320       ((&__pyx_v_p_max)[0]) = __pyx_v_p_current;
5321     }
5322     __pyx_L9:;
5323 
5324     /* "cartopy/trace.pyx":477
5325  *             (&p_max)[0] = p_current
5326  *
5327  *         t_current = (t_min + t_max) * 0.5             # <<<<<<<<<<<<<<
5328  *         p_current = interpolator.interpolate(t_current)
5329  *
5330  */
5331     __pyx_v_t_current = ((__pyx_v_t_min + __pyx_v_t_max) * 0.5);
5332 
5333     /* "cartopy/trace.pyx":478
5334  *
5335  *         t_current = (t_min + t_max) * 0.5
5336  *         p_current = interpolator.interpolate(t_current)             # <<<<<<<<<<<<<<
5337  *
5338  *
5339  */
5340     __pyx_v_p_current = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->interpolate(__pyx_v_interpolator, __pyx_v_t_current);
5341   }
5342 
5343   /* "cartopy/trace.pyx":427
5344  *
5345  *
5346  * cdef void bisect(double t_start, const Point &p_start, const Point &p_end,             # <<<<<<<<<<<<<<
5347  *                  GEOSContextHandle_t handle,
5348  *                  const GEOSPreparedGeometry *gp_domain, const State &state,
5349  */
5350 
5351   /* function exit code */
5352   goto __pyx_L0;
5353   __pyx_L1_error:;
5354   __Pyx_XDECREF(__pyx_t_2);
5355   __Pyx_XDECREF(__pyx_t_3);
5356   __Pyx_WriteUnraisable("cartopy.trace.bisect", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5357   __pyx_L0:;
5358   __Pyx_RefNannyFinishContext();
5359 }
5360 
5361 /* "cartopy/trace.pyx":481
5362  *
5363  *
5364  * cdef void _project_segment(GEOSContextHandle_t handle,             # <<<<<<<<<<<<<<
5365  *                            const GEOSCoordSequence *src_coords,
5366  *                            unsigned int src_idx_from, unsigned int src_idx_to,
5367  */
5368 
__pyx_f_7cartopy_5trace__project_segment(GEOSContextHandle_t __pyx_v_handle,GEOSCoordSequence const * __pyx_v_src_coords,unsigned int __pyx_v_src_idx_from,unsigned int __pyx_v_src_idx_to,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interpolator,GEOSPreparedGeometry const * __pyx_v_gp_domain,double __pyx_v_threshold,struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v_lines)5369 static void __pyx_f_7cartopy_5trace__project_segment(GEOSContextHandle_t __pyx_v_handle, GEOSCoordSequence const *__pyx_v_src_coords, unsigned int __pyx_v_src_idx_from, unsigned int __pyx_v_src_idx_to, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator, GEOSPreparedGeometry const *__pyx_v_gp_domain, double __pyx_v_threshold, struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_lines) {
5370   __pyx_t_7cartopy_5trace_Point __pyx_v_p_current;
5371   __pyx_t_7cartopy_5trace_Point __pyx_v_p_min;
5372   __pyx_t_7cartopy_5trace_Point __pyx_v_p_max;
5373   __pyx_t_7cartopy_5trace_Point __pyx_v_p_end;
5374   double __pyx_v_t_current;
5375   double __pyx_v_t_min;
5376   double __pyx_v_t_max;
5377   enum __pyx_t_7cartopy_5trace_State __pyx_v_state;
5378   size_t __pyx_v_old_lines_size;
5379   __Pyx_RefNannyDeclarations
5380   int __pyx_t_1;
5381   PyObject *__pyx_t_2 = NULL;
5382   PyObject *__pyx_t_3 = NULL;
5383   PyObject *__pyx_t_4 = NULL;
5384   int __pyx_t_5;
5385   PyObject *__pyx_t_6 = NULL;
5386   PyObject *__pyx_t_7 = NULL;
5387   int __pyx_lineno = 0;
5388   const char *__pyx_filename = NULL;
5389   int __pyx_clineno = 0;
5390   __Pyx_RefNannySetupContext("_project_segment", 0);
5391 
5392   /* "cartopy/trace.pyx":491
5393  *     cdef State state
5394  *
5395  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_from, &p_current.x)             # <<<<<<<<<<<<<<
5396  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_from, &p_current.y)
5397  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)
5398  */
5399   (void)(GEOSCoordSeq_getX_r(__pyx_v_handle, __pyx_v_src_coords, __pyx_v_src_idx_from, (&__pyx_v_p_current.x)));
5400 
5401   /* "cartopy/trace.pyx":492
5402  *
5403  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_from, &p_current.x)
5404  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_from, &p_current.y)             # <<<<<<<<<<<<<<
5405  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)
5406  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
5407  */
5408   (void)(GEOSCoordSeq_getY_r(__pyx_v_handle, __pyx_v_src_coords, __pyx_v_src_idx_from, (&__pyx_v_p_current.y)));
5409 
5410   /* "cartopy/trace.pyx":493
5411  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_from, &p_current.x)
5412  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_from, &p_current.y)
5413  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)             # <<<<<<<<<<<<<<
5414  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
5415  *     if DEBUG:
5416  */
5417   (void)(GEOSCoordSeq_getX_r(__pyx_v_handle, __pyx_v_src_coords, __pyx_v_src_idx_to, (&__pyx_v_p_end.x)));
5418 
5419   /* "cartopy/trace.pyx":494
5420  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_from, &p_current.y)
5421  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)
5422  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)             # <<<<<<<<<<<<<<
5423  *     if DEBUG:
5424  *         print("Setting line:")
5425  */
5426   (void)(GEOSCoordSeq_getY_r(__pyx_v_handle, __pyx_v_src_coords, __pyx_v_src_idx_to, (&__pyx_v_p_end.y)));
5427 
5428   /* "cartopy/trace.pyx":495
5429  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)
5430  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
5431  *     if DEBUG:             # <<<<<<<<<<<<<<
5432  *         print("Setting line:")
5433  *         print("   ", p_current.x, ", ", p_current.y)
5434  */
5435   __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5436   if (__pyx_t_1) {
5437 
5438     /* "cartopy/trace.pyx":496
5439  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
5440  *     if DEBUG:
5441  *         print("Setting line:")             # <<<<<<<<<<<<<<
5442  *         print("   ", p_current.x, ", ", p_current.y)
5443  *         print("   ", p_end.x, ", ", p_end.y)
5444  */
5445     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
5446     __Pyx_GOTREF(__pyx_t_2);
5447     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5448 
5449     /* "cartopy/trace.pyx":497
5450  *     if DEBUG:
5451  *         print("Setting line:")
5452  *         print("   ", p_current.x, ", ", p_current.y)             # <<<<<<<<<<<<<<
5453  *         print("   ", p_end.x, ", ", p_end.y)
5454  *
5455  */
5456     __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p_current.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
5457     __Pyx_GOTREF(__pyx_t_2);
5458     __pyx_t_3 = PyFloat_FromDouble(__pyx_v_p_current.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error)
5459     __Pyx_GOTREF(__pyx_t_3);
5460     __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
5461     __Pyx_GOTREF(__pyx_t_4);
5462     __Pyx_INCREF(__pyx_kp_s__8);
5463     __Pyx_GIVEREF(__pyx_kp_s__8);
5464     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s__8);
5465     __Pyx_GIVEREF(__pyx_t_2);
5466     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
5467     __Pyx_INCREF(__pyx_kp_s__9);
5468     __Pyx_GIVEREF(__pyx_kp_s__9);
5469     PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_s__9);
5470     __Pyx_GIVEREF(__pyx_t_3);
5471     PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
5472     __pyx_t_2 = 0;
5473     __pyx_t_3 = 0;
5474     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error)
5475     __Pyx_GOTREF(__pyx_t_3);
5476     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5477     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5478 
5479     /* "cartopy/trace.pyx":498
5480  *         print("Setting line:")
5481  *         print("   ", p_current.x, ", ", p_current.y)
5482  *         print("   ", p_end.x, ", ", p_end.y)             # <<<<<<<<<<<<<<
5483  *
5484  *     interpolator.set_line(p_current, p_end)
5485  */
5486     __pyx_t_3 = PyFloat_FromDouble(__pyx_v_p_end.x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L1_error)
5487     __Pyx_GOTREF(__pyx_t_3);
5488     __pyx_t_4 = PyFloat_FromDouble(__pyx_v_p_end.y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L1_error)
5489     __Pyx_GOTREF(__pyx_t_4);
5490     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
5491     __Pyx_GOTREF(__pyx_t_2);
5492     __Pyx_INCREF(__pyx_kp_s__8);
5493     __Pyx_GIVEREF(__pyx_kp_s__8);
5494     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__8);
5495     __Pyx_GIVEREF(__pyx_t_3);
5496     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
5497     __Pyx_INCREF(__pyx_kp_s__9);
5498     __Pyx_GIVEREF(__pyx_kp_s__9);
5499     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_s__9);
5500     __Pyx_GIVEREF(__pyx_t_4);
5501     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
5502     __pyx_t_3 = 0;
5503     __pyx_t_4 = 0;
5504     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L1_error)
5505     __Pyx_GOTREF(__pyx_t_4);
5506     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5507     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5508 
5509     /* "cartopy/trace.pyx":495
5510  *     GEOSCoordSeq_getX_r(handle, src_coords, src_idx_to, &p_end.x)
5511  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
5512  *     if DEBUG:             # <<<<<<<<<<<<<<
5513  *         print("Setting line:")
5514  *         print("   ", p_current.x, ", ", p_current.y)
5515  */
5516   }
5517 
5518   /* "cartopy/trace.pyx":500
5519  *         print("   ", p_end.x, ", ", p_end.y)
5520  *
5521  *     interpolator.set_line(p_current, p_end)             # <<<<<<<<<<<<<<
5522  *     p_current = interpolator.project(p_current)
5523  *     p_end = interpolator.project(p_end)
5524  */
5525   ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->set_line(__pyx_v_interpolator, __pyx_v_p_current, __pyx_v_p_end);
5526 
5527   /* "cartopy/trace.pyx":501
5528  *
5529  *     interpolator.set_line(p_current, p_end)
5530  *     p_current = interpolator.project(p_current)             # <<<<<<<<<<<<<<
5531  *     p_end = interpolator.project(p_end)
5532  *     if DEBUG:
5533  */
5534   __pyx_v_p_current = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->project(__pyx_v_interpolator, __pyx_v_p_current);
5535 
5536   /* "cartopy/trace.pyx":502
5537  *     interpolator.set_line(p_current, p_end)
5538  *     p_current = interpolator.project(p_current)
5539  *     p_end = interpolator.project(p_end)             # <<<<<<<<<<<<<<
5540  *     if DEBUG:
5541  *         print("Projected as:")
5542  */
5543   __pyx_v_p_end = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->project(__pyx_v_interpolator, __pyx_v_p_end);
5544 
5545   /* "cartopy/trace.pyx":503
5546  *     p_current = interpolator.project(p_current)
5547  *     p_end = interpolator.project(p_end)
5548  *     if DEBUG:             # <<<<<<<<<<<<<<
5549  *         print("Projected as:")
5550  *         print("   ", p_current.x, ", ", p_current.y)
5551  */
5552   __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5553   if (__pyx_t_1) {
5554 
5555     /* "cartopy/trace.pyx":504
5556  *     p_end = interpolator.project(p_end)
5557  *     if DEBUG:
5558  *         print("Projected as:")             # <<<<<<<<<<<<<<
5559  *         print("   ", p_current.x, ", ", p_current.y)
5560  *         print("   ", p_end.x, ", ", p_end.y)
5561  */
5562     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
5563     __Pyx_GOTREF(__pyx_t_4);
5564     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5565 
5566     /* "cartopy/trace.pyx":505
5567  *     if DEBUG:
5568  *         print("Projected as:")
5569  *         print("   ", p_current.x, ", ", p_current.y)             # <<<<<<<<<<<<<<
5570  *         print("   ", p_end.x, ", ", p_end.y)
5571  *
5572  */
5573     __pyx_t_4 = PyFloat_FromDouble(__pyx_v_p_current.x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
5574     __Pyx_GOTREF(__pyx_t_4);
5575     __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p_current.y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
5576     __Pyx_GOTREF(__pyx_t_2);
5577     __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error)
5578     __Pyx_GOTREF(__pyx_t_3);
5579     __Pyx_INCREF(__pyx_kp_s__8);
5580     __Pyx_GIVEREF(__pyx_kp_s__8);
5581     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s__8);
5582     __Pyx_GIVEREF(__pyx_t_4);
5583     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
5584     __Pyx_INCREF(__pyx_kp_s__9);
5585     __Pyx_GIVEREF(__pyx_kp_s__9);
5586     PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s__9);
5587     __Pyx_GIVEREF(__pyx_t_2);
5588     PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
5589     __pyx_t_4 = 0;
5590     __pyx_t_2 = 0;
5591     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
5592     __Pyx_GOTREF(__pyx_t_2);
5593     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5594     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5595 
5596     /* "cartopy/trace.pyx":506
5597  *         print("Projected as:")
5598  *         print("   ", p_current.x, ", ", p_current.y)
5599  *         print("   ", p_end.x, ", ", p_end.y)             # <<<<<<<<<<<<<<
5600  *
5601  *     t_current = 0.0
5602  */
5603     __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p_end.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
5604     __Pyx_GOTREF(__pyx_t_2);
5605     __pyx_t_3 = PyFloat_FromDouble(__pyx_v_p_end.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error)
5606     __Pyx_GOTREF(__pyx_t_3);
5607     __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error)
5608     __Pyx_GOTREF(__pyx_t_4);
5609     __Pyx_INCREF(__pyx_kp_s__8);
5610     __Pyx_GIVEREF(__pyx_kp_s__8);
5611     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s__8);
5612     __Pyx_GIVEREF(__pyx_t_2);
5613     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
5614     __Pyx_INCREF(__pyx_kp_s__9);
5615     __Pyx_GIVEREF(__pyx_kp_s__9);
5616     PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_s__9);
5617     __Pyx_GIVEREF(__pyx_t_3);
5618     PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
5619     __pyx_t_2 = 0;
5620     __pyx_t_3 = 0;
5621     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error)
5622     __Pyx_GOTREF(__pyx_t_3);
5623     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5624     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5625 
5626     /* "cartopy/trace.pyx":503
5627  *     p_current = interpolator.project(p_current)
5628  *     p_end = interpolator.project(p_end)
5629  *     if DEBUG:             # <<<<<<<<<<<<<<
5630  *         print("Projected as:")
5631  *         print("   ", p_current.x, ", ", p_current.y)
5632  */
5633   }
5634 
5635   /* "cartopy/trace.pyx":508
5636  *         print("   ", p_end.x, ", ", p_end.y)
5637  *
5638  *     t_current = 0.0             # <<<<<<<<<<<<<<
5639  *     state = get_state(p_current, gp_domain, handle)
5640  *
5641  */
5642   __pyx_v_t_current = 0.0;
5643 
5644   /* "cartopy/trace.pyx":509
5645  *
5646  *     t_current = 0.0
5647  *     state = get_state(p_current, gp_domain, handle)             # <<<<<<<<<<<<<<
5648  *
5649  *     cdef size_t old_lines_size = lines.size()
5650  */
5651   __pyx_v_state = __pyx_f_7cartopy_5trace_get_state(__pyx_v_p_current, __pyx_v_gp_domain, __pyx_v_handle);
5652 
5653   /* "cartopy/trace.pyx":511
5654  *     state = get_state(p_current, gp_domain, handle)
5655  *
5656  *     cdef size_t old_lines_size = lines.size()             # <<<<<<<<<<<<<<
5657  *     while t_current < 1.0 and (lines.size() - old_lines_size) < 100:
5658  *         if DEBUG:
5659  */
5660   __pyx_v_old_lines_size = __pyx_f_7cartopy_5trace_15LineAccumulator_size(__pyx_v_lines);
5661 
5662   /* "cartopy/trace.pyx":512
5663  *
5664  *     cdef size_t old_lines_size = lines.size()
5665  *     while t_current < 1.0 and (lines.size() - old_lines_size) < 100:             # <<<<<<<<<<<<<<
5666  *         if DEBUG:
5667  *             print("Bisecting from: ", t_current, " (")
5668  */
5669   while (1) {
5670     __pyx_t_5 = ((__pyx_v_t_current < 1.0) != 0);
5671     if (__pyx_t_5) {
5672     } else {
5673       __pyx_t_1 = __pyx_t_5;
5674       goto __pyx_L7_bool_binop_done;
5675     }
5676     __pyx_t_5 = (((__pyx_f_7cartopy_5trace_15LineAccumulator_size(__pyx_v_lines) - __pyx_v_old_lines_size) < 0x64) != 0);
5677     __pyx_t_1 = __pyx_t_5;
5678     __pyx_L7_bool_binop_done:;
5679     if (!__pyx_t_1) break;
5680 
5681     /* "cartopy/trace.pyx":513
5682  *     cdef size_t old_lines_size = lines.size()
5683  *     while t_current < 1.0 and (lines.size() - old_lines_size) < 100:
5684  *         if DEBUG:             # <<<<<<<<<<<<<<
5685  *             print("Bisecting from: ", t_current, " (")
5686  *             if state == POINT_IN:
5687  */
5688     __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5689     if (__pyx_t_1) {
5690 
5691       /* "cartopy/trace.pyx":514
5692  *     while t_current < 1.0 and (lines.size() - old_lines_size) < 100:
5693  *         if DEBUG:
5694  *             print("Bisecting from: ", t_current, " (")             # <<<<<<<<<<<<<<
5695  *             if state == POINT_IN:
5696  *                 print("IN")
5697  */
5698       __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t_current); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
5699       __Pyx_GOTREF(__pyx_t_3);
5700       __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error)
5701       __Pyx_GOTREF(__pyx_t_4);
5702       __Pyx_INCREF(__pyx_kp_s_Bisecting_from);
5703       __Pyx_GIVEREF(__pyx_kp_s_Bisecting_from);
5704       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Bisecting_from);
5705       __Pyx_GIVEREF(__pyx_t_3);
5706       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5707       __Pyx_INCREF(__pyx_kp_s__11);
5708       __Pyx_GIVEREF(__pyx_kp_s__11);
5709       PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_s__11);
5710       __pyx_t_3 = 0;
5711       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
5712       __Pyx_GOTREF(__pyx_t_3);
5713       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5714       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5715 
5716       /* "cartopy/trace.pyx":515
5717  *         if DEBUG:
5718  *             print("Bisecting from: ", t_current, " (")
5719  *             if state == POINT_IN:             # <<<<<<<<<<<<<<
5720  *                 print("IN")
5721  *             elif state == POINT_OUT:
5722  */
5723       switch (__pyx_v_state) {
5724         case __pyx_e_7cartopy_5trace_POINT_IN:
5725 
5726         /* "cartopy/trace.pyx":516
5727  *             print("Bisecting from: ", t_current, " (")
5728  *             if state == POINT_IN:
5729  *                 print("IN")             # <<<<<<<<<<<<<<
5730  *             elif state == POINT_OUT:
5731  *                 print("OUT")
5732  */
5733         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
5734         __Pyx_GOTREF(__pyx_t_3);
5735         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5736 
5737         /* "cartopy/trace.pyx":515
5738  *         if DEBUG:
5739  *             print("Bisecting from: ", t_current, " (")
5740  *             if state == POINT_IN:             # <<<<<<<<<<<<<<
5741  *                 print("IN")
5742  *             elif state == POINT_OUT:
5743  */
5744         break;
5745         case __pyx_e_7cartopy_5trace_POINT_OUT:
5746 
5747         /* "cartopy/trace.pyx":518
5748  *                 print("IN")
5749  *             elif state == POINT_OUT:
5750  *                 print("OUT")             # <<<<<<<<<<<<<<
5751  *             else:
5752  *                 print("NAN")
5753  */
5754         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error)
5755         __Pyx_GOTREF(__pyx_t_3);
5756         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5757 
5758         /* "cartopy/trace.pyx":517
5759  *             if state == POINT_IN:
5760  *                 print("IN")
5761  *             elif state == POINT_OUT:             # <<<<<<<<<<<<<<
5762  *                 print("OUT")
5763  *             else:
5764  */
5765         break;
5766         default:
5767 
5768         /* "cartopy/trace.pyx":520
5769  *                 print("OUT")
5770  *             else:
5771  *                 print("NAN")             # <<<<<<<<<<<<<<
5772  *             print(")")
5773  *             print("   ", p_current.x, ", ", p_current.y)
5774  */
5775         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
5776         __Pyx_GOTREF(__pyx_t_3);
5777         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5778         break;
5779       }
5780 
5781       /* "cartopy/trace.pyx":521
5782  *             else:
5783  *                 print("NAN")
5784  *             print(")")             # <<<<<<<<<<<<<<
5785  *             print("   ", p_current.x, ", ", p_current.y)
5786  *             print("   ", p_end.x, ", ", p_end.y)
5787  */
5788       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error)
5789       __Pyx_GOTREF(__pyx_t_3);
5790       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5791 
5792       /* "cartopy/trace.pyx":522
5793  *                 print("NAN")
5794  *             print(")")
5795  *             print("   ", p_current.x, ", ", p_current.y)             # <<<<<<<<<<<<<<
5796  *             print("   ", p_end.x, ", ", p_end.y)
5797  *
5798  */
5799       __pyx_t_3 = PyFloat_FromDouble(__pyx_v_p_current.x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __pyx_L1_error)
5800       __Pyx_GOTREF(__pyx_t_3);
5801       __pyx_t_4 = PyFloat_FromDouble(__pyx_v_p_current.y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error)
5802       __Pyx_GOTREF(__pyx_t_4);
5803       __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
5804       __Pyx_GOTREF(__pyx_t_2);
5805       __Pyx_INCREF(__pyx_kp_s__8);
5806       __Pyx_GIVEREF(__pyx_kp_s__8);
5807       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__8);
5808       __Pyx_GIVEREF(__pyx_t_3);
5809       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
5810       __Pyx_INCREF(__pyx_kp_s__9);
5811       __Pyx_GIVEREF(__pyx_kp_s__9);
5812       PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_s__9);
5813       __Pyx_GIVEREF(__pyx_t_4);
5814       PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
5815       __pyx_t_3 = 0;
5816       __pyx_t_4 = 0;
5817       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error)
5818       __Pyx_GOTREF(__pyx_t_4);
5819       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5820       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5821 
5822       /* "cartopy/trace.pyx":523
5823  *             print(")")
5824  *             print("   ", p_current.x, ", ", p_current.y)
5825  *             print("   ", p_end.x, ", ", p_end.y)             # <<<<<<<<<<<<<<
5826  *
5827  *         bisect(t_current, p_current, p_end, handle, gp_domain, state,
5828  */
5829       __pyx_t_4 = PyFloat_FromDouble(__pyx_v_p_end.x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
5830       __Pyx_GOTREF(__pyx_t_4);
5831       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p_end.y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
5832       __Pyx_GOTREF(__pyx_t_2);
5833       __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error)
5834       __Pyx_GOTREF(__pyx_t_3);
5835       __Pyx_INCREF(__pyx_kp_s__8);
5836       __Pyx_GIVEREF(__pyx_kp_s__8);
5837       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s__8);
5838       __Pyx_GIVEREF(__pyx_t_4);
5839       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
5840       __Pyx_INCREF(__pyx_kp_s__9);
5841       __Pyx_GIVEREF(__pyx_kp_s__9);
5842       PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s__9);
5843       __Pyx_GIVEREF(__pyx_t_2);
5844       PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
5845       __pyx_t_4 = 0;
5846       __pyx_t_2 = 0;
5847       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
5848       __Pyx_GOTREF(__pyx_t_2);
5849       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5850       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5851 
5852       /* "cartopy/trace.pyx":513
5853  *     cdef size_t old_lines_size = lines.size()
5854  *     while t_current < 1.0 and (lines.size() - old_lines_size) < 100:
5855  *         if DEBUG:             # <<<<<<<<<<<<<<
5856  *             print("Bisecting from: ", t_current, " (")
5857  *             if state == POINT_IN:
5858  */
5859     }
5860 
5861     /* "cartopy/trace.pyx":525
5862  *             print("   ", p_end.x, ", ", p_end.y)
5863  *
5864  *         bisect(t_current, p_current, p_end, handle, gp_domain, state,             # <<<<<<<<<<<<<<
5865  *                interpolator, threshold,
5866  *                t_min, p_min, t_max, p_max)
5867  */
5868     __pyx_f_7cartopy_5trace_bisect(__pyx_v_t_current, __pyx_v_p_current, __pyx_v_p_end, __pyx_v_handle, __pyx_v_gp_domain, __pyx_v_state, __pyx_v_interpolator, __pyx_v_threshold, __pyx_v_t_min, __pyx_v_p_min, __pyx_v_t_max, __pyx_v_p_max);
5869 
5870     /* "cartopy/trace.pyx":528
5871  *                interpolator, threshold,
5872  *                t_min, p_min, t_max, p_max)
5873  *         if DEBUG:             # <<<<<<<<<<<<<<
5874  *             print("   => ", t_min, "to", t_max)
5875  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",
5876  */
5877     __pyx_t_1 = (__pyx_v_7cartopy_5trace_DEBUG != 0);
5878     if (__pyx_t_1) {
5879 
5880       /* "cartopy/trace.pyx":529
5881  *                t_min, p_min, t_max, p_max)
5882  *         if DEBUG:
5883  *             print("   => ", t_min, "to", t_max)             # <<<<<<<<<<<<<<
5884  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",
5885  *                   p_max.x, ", ", p_max.y, ")")
5886  */
5887       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_t_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
5888       __Pyx_GOTREF(__pyx_t_2);
5889       __pyx_t_3 = PyFloat_FromDouble(__pyx_v_t_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error)
5890       __Pyx_GOTREF(__pyx_t_3);
5891       __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
5892       __Pyx_GOTREF(__pyx_t_4);
5893       __Pyx_INCREF(__pyx_kp_s__17);
5894       __Pyx_GIVEREF(__pyx_kp_s__17);
5895       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s__17);
5896       __Pyx_GIVEREF(__pyx_t_2);
5897       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
5898       __Pyx_INCREF(__pyx_n_s_to);
5899       __Pyx_GIVEREF(__pyx_n_s_to);
5900       PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_n_s_to);
5901       __Pyx_GIVEREF(__pyx_t_3);
5902       PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
5903       __pyx_t_2 = 0;
5904       __pyx_t_3 = 0;
5905       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error)
5906       __Pyx_GOTREF(__pyx_t_3);
5907       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5908       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5909 
5910       /* "cartopy/trace.pyx":530
5911  *         if DEBUG:
5912  *             print("   => ", t_min, "to", t_max)
5913  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",             # <<<<<<<<<<<<<<
5914  *                   p_max.x, ", ", p_max.y, ")")
5915  *
5916  */
5917       __pyx_t_3 = PyFloat_FromDouble(__pyx_v_p_min.x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
5918       __Pyx_GOTREF(__pyx_t_3);
5919       __pyx_t_4 = PyFloat_FromDouble(__pyx_v_p_min.y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
5920       __Pyx_GOTREF(__pyx_t_4);
5921 
5922       /* "cartopy/trace.pyx":531
5923  *             print("   => ", t_min, "to", t_max)
5924  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",
5925  *                   p_max.x, ", ", p_max.y, ")")             # <<<<<<<<<<<<<<
5926  *
5927  *         if state == POINT_IN:
5928  */
5929       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p_max.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
5930       __Pyx_GOTREF(__pyx_t_2);
5931       __pyx_t_6 = PyFloat_FromDouble(__pyx_v_p_max.y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error)
5932       __Pyx_GOTREF(__pyx_t_6);
5933 
5934       /* "cartopy/trace.pyx":530
5935  *         if DEBUG:
5936  *             print("   => ", t_min, "to", t_max)
5937  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",             # <<<<<<<<<<<<<<
5938  *                   p_max.x, ", ", p_max.y, ")")
5939  *
5940  */
5941       __pyx_t_7 = PyTuple_New(9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 530, __pyx_L1_error)
5942       __Pyx_GOTREF(__pyx_t_7);
5943       __Pyx_INCREF(__pyx_kp_s__18);
5944       __Pyx_GIVEREF(__pyx_kp_s__18);
5945       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s__18);
5946       __Pyx_GIVEREF(__pyx_t_3);
5947       PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
5948       __Pyx_INCREF(__pyx_kp_s__9);
5949       __Pyx_GIVEREF(__pyx_kp_s__9);
5950       PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_s__9);
5951       __Pyx_GIVEREF(__pyx_t_4);
5952       PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
5953       __Pyx_INCREF(__pyx_kp_s_to_2);
5954       __Pyx_GIVEREF(__pyx_kp_s_to_2);
5955       PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_kp_s_to_2);
5956       __Pyx_GIVEREF(__pyx_t_2);
5957       PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_2);
5958       __Pyx_INCREF(__pyx_kp_s__9);
5959       __Pyx_GIVEREF(__pyx_kp_s__9);
5960       PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_kp_s__9);
5961       __Pyx_GIVEREF(__pyx_t_6);
5962       PyTuple_SET_ITEM(__pyx_t_7, 7, __pyx_t_6);
5963       __Pyx_INCREF(__pyx_kp_s__15);
5964       __Pyx_GIVEREF(__pyx_kp_s__15);
5965       PyTuple_SET_ITEM(__pyx_t_7, 8, __pyx_kp_s__15);
5966       __pyx_t_3 = 0;
5967       __pyx_t_4 = 0;
5968       __pyx_t_2 = 0;
5969       __pyx_t_6 = 0;
5970       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 530, __pyx_L1_error)
5971       __Pyx_GOTREF(__pyx_t_6);
5972       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5973       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5974 
5975       /* "cartopy/trace.pyx":528
5976  *                interpolator, threshold,
5977  *                t_min, p_min, t_max, p_max)
5978  *         if DEBUG:             # <<<<<<<<<<<<<<
5979  *             print("   => ", t_min, "to", t_max)
5980  *             print("   => (", p_min.x, ", ", p_min.y, ") to (",
5981  */
5982     }
5983 
5984     /* "cartopy/trace.pyx":533
5985  *                   p_max.x, ", ", p_max.y, ")")
5986  *
5987  *         if state == POINT_IN:             # <<<<<<<<<<<<<<
5988  *             lines.add_point_if_empty(p_current)
5989  *             if t_min != t_current:
5990  */
5991     switch (__pyx_v_state) {
5992       case __pyx_e_7cartopy_5trace_POINT_IN:
5993 
5994       /* "cartopy/trace.pyx":534
5995  *
5996  *         if state == POINT_IN:
5997  *             lines.add_point_if_empty(p_current)             # <<<<<<<<<<<<<<
5998  *             if t_min != t_current:
5999  *                 lines.add_point(p_min)
6000  */
6001       __pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty(__pyx_v_lines, __pyx_v_p_current);
6002 
6003       /* "cartopy/trace.pyx":535
6004  *         if state == POINT_IN:
6005  *             lines.add_point_if_empty(p_current)
6006  *             if t_min != t_current:             # <<<<<<<<<<<<<<
6007  *                 lines.add_point(p_min)
6008  *                 t_current = t_min
6009  */
6010       __pyx_t_1 = ((__pyx_v_t_min != __pyx_v_t_current) != 0);
6011       if (__pyx_t_1) {
6012 
6013         /* "cartopy/trace.pyx":536
6014  *             lines.add_point_if_empty(p_current)
6015  *             if t_min != t_current:
6016  *                 lines.add_point(p_min)             # <<<<<<<<<<<<<<
6017  *                 t_current = t_min
6018  *                 p_current = p_min
6019  */
6020         __pyx_f_7cartopy_5trace_15LineAccumulator_add_point(__pyx_v_lines, __pyx_v_p_min);
6021 
6022         /* "cartopy/trace.pyx":537
6023  *             if t_min != t_current:
6024  *                 lines.add_point(p_min)
6025  *                 t_current = t_min             # <<<<<<<<<<<<<<
6026  *                 p_current = p_min
6027  *             else:
6028  */
6029         __pyx_v_t_current = __pyx_v_t_min;
6030 
6031         /* "cartopy/trace.pyx":538
6032  *                 lines.add_point(p_min)
6033  *                 t_current = t_min
6034  *                 p_current = p_min             # <<<<<<<<<<<<<<
6035  *             else:
6036  *                 t_current = t_max
6037  */
6038         __pyx_v_p_current = __pyx_v_p_min;
6039 
6040         /* "cartopy/trace.pyx":535
6041  *         if state == POINT_IN:
6042  *             lines.add_point_if_empty(p_current)
6043  *             if t_min != t_current:             # <<<<<<<<<<<<<<
6044  *                 lines.add_point(p_min)
6045  *                 t_current = t_min
6046  */
6047         goto __pyx_L11;
6048       }
6049 
6050       /* "cartopy/trace.pyx":540
6051  *                 p_current = p_min
6052  *             else:
6053  *                 t_current = t_max             # <<<<<<<<<<<<<<
6054  *                 p_current = p_max
6055  *                 state = get_state(p_current, gp_domain, handle)
6056  */
6057       /*else*/ {
6058         __pyx_v_t_current = __pyx_v_t_max;
6059 
6060         /* "cartopy/trace.pyx":541
6061  *             else:
6062  *                 t_current = t_max
6063  *                 p_current = p_max             # <<<<<<<<<<<<<<
6064  *                 state = get_state(p_current, gp_domain, handle)
6065  *                 if state == POINT_IN:
6066  */
6067         __pyx_v_p_current = __pyx_v_p_max;
6068 
6069         /* "cartopy/trace.pyx":542
6070  *                 t_current = t_max
6071  *                 p_current = p_max
6072  *                 state = get_state(p_current, gp_domain, handle)             # <<<<<<<<<<<<<<
6073  *                 if state == POINT_IN:
6074  *                     lines.new_line()
6075  */
6076         __pyx_v_state = __pyx_f_7cartopy_5trace_get_state(__pyx_v_p_current, __pyx_v_gp_domain, __pyx_v_handle);
6077 
6078         /* "cartopy/trace.pyx":543
6079  *                 p_current = p_max
6080  *                 state = get_state(p_current, gp_domain, handle)
6081  *                 if state == POINT_IN:             # <<<<<<<<<<<<<<
6082  *                     lines.new_line()
6083  *
6084  */
6085         __pyx_t_1 = ((__pyx_v_state == __pyx_e_7cartopy_5trace_POINT_IN) != 0);
6086         if (__pyx_t_1) {
6087 
6088           /* "cartopy/trace.pyx":544
6089  *                 state = get_state(p_current, gp_domain, handle)
6090  *                 if state == POINT_IN:
6091  *                     lines.new_line()             # <<<<<<<<<<<<<<
6092  *
6093  *         elif state == POINT_OUT:
6094  */
6095           __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(__pyx_v_lines);
6096 
6097           /* "cartopy/trace.pyx":543
6098  *                 p_current = p_max
6099  *                 state = get_state(p_current, gp_domain, handle)
6100  *                 if state == POINT_IN:             # <<<<<<<<<<<<<<
6101  *                     lines.new_line()
6102  *
6103  */
6104         }
6105       }
6106       __pyx_L11:;
6107 
6108       /* "cartopy/trace.pyx":533
6109  *                   p_max.x, ", ", p_max.y, ")")
6110  *
6111  *         if state == POINT_IN:             # <<<<<<<<<<<<<<
6112  *             lines.add_point_if_empty(p_current)
6113  *             if t_min != t_current:
6114  */
6115       break;
6116       case __pyx_e_7cartopy_5trace_POINT_OUT:
6117 
6118       /* "cartopy/trace.pyx":547
6119  *
6120  *         elif state == POINT_OUT:
6121  *             if t_min != t_current:             # <<<<<<<<<<<<<<
6122  *                 t_current = t_min
6123  *                 p_current = p_min
6124  */
6125       __pyx_t_1 = ((__pyx_v_t_min != __pyx_v_t_current) != 0);
6126       if (__pyx_t_1) {
6127 
6128         /* "cartopy/trace.pyx":548
6129  *         elif state == POINT_OUT:
6130  *             if t_min != t_current:
6131  *                 t_current = t_min             # <<<<<<<<<<<<<<
6132  *                 p_current = p_min
6133  *             else:
6134  */
6135         __pyx_v_t_current = __pyx_v_t_min;
6136 
6137         /* "cartopy/trace.pyx":549
6138  *             if t_min != t_current:
6139  *                 t_current = t_min
6140  *                 p_current = p_min             # <<<<<<<<<<<<<<
6141  *             else:
6142  *                 t_current = t_max
6143  */
6144         __pyx_v_p_current = __pyx_v_p_min;
6145 
6146         /* "cartopy/trace.pyx":547
6147  *
6148  *         elif state == POINT_OUT:
6149  *             if t_min != t_current:             # <<<<<<<<<<<<<<
6150  *                 t_current = t_min
6151  *                 p_current = p_min
6152  */
6153         goto __pyx_L13;
6154       }
6155 
6156       /* "cartopy/trace.pyx":551
6157  *                 p_current = p_min
6158  *             else:
6159  *                 t_current = t_max             # <<<<<<<<<<<<<<
6160  *                 p_current = p_max
6161  *                 state = get_state(p_current, gp_domain, handle)
6162  */
6163       /*else*/ {
6164         __pyx_v_t_current = __pyx_v_t_max;
6165 
6166         /* "cartopy/trace.pyx":552
6167  *             else:
6168  *                 t_current = t_max
6169  *                 p_current = p_max             # <<<<<<<<<<<<<<
6170  *                 state = get_state(p_current, gp_domain, handle)
6171  *                 if state == POINT_IN:
6172  */
6173         __pyx_v_p_current = __pyx_v_p_max;
6174 
6175         /* "cartopy/trace.pyx":553
6176  *                 t_current = t_max
6177  *                 p_current = p_max
6178  *                 state = get_state(p_current, gp_domain, handle)             # <<<<<<<<<<<<<<
6179  *                 if state == POINT_IN:
6180  *                     lines.new_line()
6181  */
6182         __pyx_v_state = __pyx_f_7cartopy_5trace_get_state(__pyx_v_p_current, __pyx_v_gp_domain, __pyx_v_handle);
6183 
6184         /* "cartopy/trace.pyx":554
6185  *                 p_current = p_max
6186  *                 state = get_state(p_current, gp_domain, handle)
6187  *                 if state == POINT_IN:             # <<<<<<<<<<<<<<
6188  *                     lines.new_line()
6189  *
6190  */
6191         __pyx_t_1 = ((__pyx_v_state == __pyx_e_7cartopy_5trace_POINT_IN) != 0);
6192         if (__pyx_t_1) {
6193 
6194           /* "cartopy/trace.pyx":555
6195  *                 state = get_state(p_current, gp_domain, handle)
6196  *                 if state == POINT_IN:
6197  *                     lines.new_line()             # <<<<<<<<<<<<<<
6198  *
6199  *         else:
6200  */
6201           __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(__pyx_v_lines);
6202 
6203           /* "cartopy/trace.pyx":554
6204  *                 p_current = p_max
6205  *                 state = get_state(p_current, gp_domain, handle)
6206  *                 if state == POINT_IN:             # <<<<<<<<<<<<<<
6207  *                     lines.new_line()
6208  *
6209  */
6210         }
6211       }
6212       __pyx_L13:;
6213 
6214       /* "cartopy/trace.pyx":546
6215  *                     lines.new_line()
6216  *
6217  *         elif state == POINT_OUT:             # <<<<<<<<<<<<<<
6218  *             if t_min != t_current:
6219  *                 t_current = t_min
6220  */
6221       break;
6222       default:
6223 
6224       /* "cartopy/trace.pyx":558
6225  *
6226  *         else:
6227  *             t_current = t_max             # <<<<<<<<<<<<<<
6228  *             p_current = p_max
6229  *             state = get_state(p_current, gp_domain, handle)
6230  */
6231       __pyx_v_t_current = __pyx_v_t_max;
6232 
6233       /* "cartopy/trace.pyx":559
6234  *         else:
6235  *             t_current = t_max
6236  *             p_current = p_max             # <<<<<<<<<<<<<<
6237  *             state = get_state(p_current, gp_domain, handle)
6238  *             if state == POINT_IN:
6239  */
6240       __pyx_v_p_current = __pyx_v_p_max;
6241 
6242       /* "cartopy/trace.pyx":560
6243  *             t_current = t_max
6244  *             p_current = p_max
6245  *             state = get_state(p_current, gp_domain, handle)             # <<<<<<<<<<<<<<
6246  *             if state == POINT_IN:
6247  *                 lines.new_line()
6248  */
6249       __pyx_v_state = __pyx_f_7cartopy_5trace_get_state(__pyx_v_p_current, __pyx_v_gp_domain, __pyx_v_handle);
6250 
6251       /* "cartopy/trace.pyx":561
6252  *             p_current = p_max
6253  *             state = get_state(p_current, gp_domain, handle)
6254  *             if state == POINT_IN:             # <<<<<<<<<<<<<<
6255  *                 lines.new_line()
6256  *
6257  */
6258       __pyx_t_1 = ((__pyx_v_state == __pyx_e_7cartopy_5trace_POINT_IN) != 0);
6259       if (__pyx_t_1) {
6260 
6261         /* "cartopy/trace.pyx":562
6262  *             state = get_state(p_current, gp_domain, handle)
6263  *             if state == POINT_IN:
6264  *                 lines.new_line()             # <<<<<<<<<<<<<<
6265  *
6266  *
6267  */
6268         __pyx_f_7cartopy_5trace_15LineAccumulator_new_line(__pyx_v_lines);
6269 
6270         /* "cartopy/trace.pyx":561
6271  *             p_current = p_max
6272  *             state = get_state(p_current, gp_domain, handle)
6273  *             if state == POINT_IN:             # <<<<<<<<<<<<<<
6274  *                 lines.new_line()
6275  *
6276  */
6277       }
6278       break;
6279     }
6280   }
6281 
6282   /* "cartopy/trace.pyx":481
6283  *
6284  *
6285  * cdef void _project_segment(GEOSContextHandle_t handle,             # <<<<<<<<<<<<<<
6286  *                            const GEOSCoordSequence *src_coords,
6287  *                            unsigned int src_idx_from, unsigned int src_idx_to,
6288  */
6289 
6290   /* function exit code */
6291   goto __pyx_L0;
6292   __pyx_L1_error:;
6293   __Pyx_XDECREF(__pyx_t_2);
6294   __Pyx_XDECREF(__pyx_t_3);
6295   __Pyx_XDECREF(__pyx_t_4);
6296   __Pyx_XDECREF(__pyx_t_6);
6297   __Pyx_XDECREF(__pyx_t_7);
6298   __Pyx_WriteUnraisable("cartopy.trace._project_segment", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6299   __pyx_L0:;
6300   __Pyx_RefNannyFinishContext();
6301 }
6302 
6303 /* "cartopy/trace.pyx":565
6304  *
6305  *
6306  * cdef _interpolator(CRS src_crs, CRS dest_projection):             # <<<<<<<<<<<<<<
6307  *     # Get an Interpolator from the given CRS and projection.
6308  *     # Callers must hold a reference to these systems for the lifetime
6309  */
6310 
__pyx_f_7cartopy_5trace__interpolator(struct __pyx_obj_7cartopy_4_crs_CRS * __pyx_v_src_crs,struct __pyx_obj_7cartopy_4_crs_CRS * __pyx_v_dest_projection)6311 static PyObject *__pyx_f_7cartopy_5trace__interpolator(struct __pyx_obj_7cartopy_4_crs_CRS *__pyx_v_src_crs, struct __pyx_obj_7cartopy_4_crs_CRS *__pyx_v_dest_projection) {
6312   struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator = 0;
6313   PyObject *__pyx_v_lonlat = NULL;
6314   PyObject *__pyx_r = NULL;
6315   __Pyx_RefNannyDeclarations
6316   PyObject *__pyx_t_1 = NULL;
6317   int __pyx_t_2;
6318   PyObject *__pyx_t_3 = NULL;
6319   int __pyx_t_4;
6320   int __pyx_t_5;
6321   double __pyx_t_6;
6322   int __pyx_lineno = 0;
6323   const char *__pyx_filename = NULL;
6324   int __pyx_clineno = 0;
6325   __Pyx_RefNannySetupContext("_interpolator", 0);
6326 
6327   /* "cartopy/trace.pyx":572
6328  *
6329  *     cdef Interpolator interpolator
6330  *     if src_crs.is_geodetic():             # <<<<<<<<<<<<<<
6331  *         interpolator = SphericalInterpolator()
6332  *     else:
6333  */
6334   __pyx_t_1 = ((struct __pyx_vtabstruct_7cartopy_4_crs_CRS *)__pyx_v_src_crs->__pyx_vtab)->is_geodetic(__pyx_v_src_crs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
6335   __Pyx_GOTREF(__pyx_t_1);
6336   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 572, __pyx_L1_error)
6337   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6338   if (__pyx_t_2) {
6339 
6340     /* "cartopy/trace.pyx":573
6341  *     cdef Interpolator interpolator
6342  *     if src_crs.is_geodetic():
6343  *         interpolator = SphericalInterpolator()             # <<<<<<<<<<<<<<
6344  *     else:
6345  *         interpolator = CartesianInterpolator()
6346  */
6347     __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7cartopy_5trace_SphericalInterpolator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
6348     __Pyx_GOTREF(__pyx_t_1);
6349     __pyx_v_interpolator = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_t_1);
6350     __pyx_t_1 = 0;
6351 
6352     /* "cartopy/trace.pyx":572
6353  *
6354  *     cdef Interpolator interpolator
6355  *     if src_crs.is_geodetic():             # <<<<<<<<<<<<<<
6356  *         interpolator = SphericalInterpolator()
6357  *     else:
6358  */
6359     goto __pyx_L3;
6360   }
6361 
6362   /* "cartopy/trace.pyx":575
6363  *         interpolator = SphericalInterpolator()
6364  *     else:
6365  *         interpolator = CartesianInterpolator()             # <<<<<<<<<<<<<<
6366  *     interpolator.init(src_crs.proj4, (<CRS>dest_projection).proj4)
6367  *     if (6, 1, 1) <= PROJ4_VERSION < (6, 3, 0):
6368  */
6369   /*else*/ {
6370     __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7cartopy_5trace_CartesianInterpolator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
6371     __Pyx_GOTREF(__pyx_t_1);
6372     __pyx_v_interpolator = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_t_1);
6373     __pyx_t_1 = 0;
6374   }
6375   __pyx_L3:;
6376 
6377   /* "cartopy/trace.pyx":576
6378  *     else:
6379  *         interpolator = CartesianInterpolator()
6380  *     interpolator.init(src_crs.proj4, (<CRS>dest_projection).proj4)             # <<<<<<<<<<<<<<
6381  *     if (6, 1, 1) <= PROJ4_VERSION < (6, 3, 0):
6382  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
6383  */
6384   ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->init(__pyx_v_interpolator, __pyx_v_src_crs->proj4, __pyx_v_dest_projection->proj4);
6385 
6386   /* "cartopy/trace.pyx":577
6387  *         interpolator = CartesianInterpolator()
6388  *     interpolator.init(src_crs.proj4, (<CRS>dest_projection).proj4)
6389  *     if (6, 1, 1) <= PROJ4_VERSION < (6, 3, 0):             # <<<<<<<<<<<<<<
6390  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
6391  *         # See https://github.com/OSGeo/proj#1782.
6392  */
6393   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PROJ4_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
6394   __Pyx_GOTREF(__pyx_t_1);
6395   __pyx_t_3 = PyObject_RichCompare(__pyx_tuple__19, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
6396   if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
6397     __Pyx_DECREF(__pyx_t_3);
6398     __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_tuple__20, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
6399   }
6400   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6401   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 577, __pyx_L1_error)
6402   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6403   if (__pyx_t_2) {
6404 
6405     /* "cartopy/trace.pyx":580
6406  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
6407  *         # See https://github.com/OSGeo/proj#1782.
6408  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')             # <<<<<<<<<<<<<<
6409  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and
6410  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6411  */
6412     __Pyx_INCREF(__pyx_tuple__21);
6413     __pyx_v_lonlat = __pyx_tuple__21;
6414 
6415     /* "cartopy/trace.pyx":581
6416  *         # See https://github.com/OSGeo/proj#1782.
6417  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
6418  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6419  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6420  *                 'to_meter' in src_crs.proj4_params):
6421  */
6422     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src_crs->proj4_params, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
6423     __Pyx_GOTREF(__pyx_t_3);
6424     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
6425     __Pyx_GOTREF(__pyx_t_1);
6426     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6427     __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_ob_tran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 581, __pyx_L1_error)
6428     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6429     if (__pyx_t_4) {
6430     } else {
6431       __pyx_t_2 = __pyx_t_4;
6432       goto __pyx_L6_bool_binop_done;
6433     }
6434 
6435     /* "cartopy/trace.pyx":582
6436  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
6437  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and
6438  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and             # <<<<<<<<<<<<<<
6439  *                 'to_meter' in src_crs.proj4_params):
6440  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6441  */
6442     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src_crs->proj4_params, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
6443     __Pyx_GOTREF(__pyx_t_1);
6444     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error)
6445     __Pyx_GOTREF(__pyx_t_3);
6446     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6447     __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_lonlat, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 582, __pyx_L1_error)
6448     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6449     __pyx_t_5 = (__pyx_t_4 != 0);
6450     if (__pyx_t_5) {
6451     } else {
6452       __pyx_t_2 = __pyx_t_5;
6453       goto __pyx_L6_bool_binop_done;
6454     }
6455 
6456     /* "cartopy/trace.pyx":583
6457  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and
6458  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6459  *                 'to_meter' in src_crs.proj4_params):             # <<<<<<<<<<<<<<
6460  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6461  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and
6462  */
6463     __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_to_meter, __pyx_v_src_crs->proj4_params, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 583, __pyx_L1_error)
6464     __pyx_t_4 = (__pyx_t_5 != 0);
6465     __pyx_t_2 = __pyx_t_4;
6466     __pyx_L6_bool_binop_done:;
6467 
6468     /* "cartopy/trace.pyx":581
6469  *         # See https://github.com/OSGeo/proj#1782.
6470  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
6471  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6472  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6473  *                 'to_meter' in src_crs.proj4_params):
6474  */
6475     if (__pyx_t_2) {
6476 
6477       /* "cartopy/trace.pyx":584
6478  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6479  *                 'to_meter' in src_crs.proj4_params):
6480  *             interpolator.src_scale = src_crs.proj4_params['to_meter']             # <<<<<<<<<<<<<<
6481  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and
6482  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6483  */
6484       __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_src_crs->proj4_params, __pyx_n_s_to_meter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error)
6485       __Pyx_GOTREF(__pyx_t_3);
6486       __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L1_error)
6487       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6488       __pyx_v_interpolator->src_scale = __pyx_t_6;
6489 
6490       /* "cartopy/trace.pyx":581
6491  *         # See https://github.com/OSGeo/proj#1782.
6492  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
6493  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6494  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
6495  *                 'to_meter' in src_crs.proj4_params):
6496  */
6497     }
6498 
6499     /* "cartopy/trace.pyx":585
6500  *                 'to_meter' in src_crs.proj4_params):
6501  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6502  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6503  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6504  *                 'to_meter' in dest_projection.proj4_params):
6505  */
6506     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dest_projection->proj4_params, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 585, __pyx_L1_error)
6507     __Pyx_GOTREF(__pyx_t_3);
6508     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error)
6509     __Pyx_GOTREF(__pyx_t_1);
6510     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6511     __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_ob_tran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 585, __pyx_L1_error)
6512     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6513     if (__pyx_t_4) {
6514     } else {
6515       __pyx_t_2 = __pyx_t_4;
6516       goto __pyx_L10_bool_binop_done;
6517     }
6518 
6519     /* "cartopy/trace.pyx":586
6520  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6521  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and
6522  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and             # <<<<<<<<<<<<<<
6523  *                 'to_meter' in dest_projection.proj4_params):
6524  *             interpolator.dest_scale = 1 / dest_projection.proj4_params['to_meter']
6525  */
6526     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dest_projection->proj4_params, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
6527     __Pyx_GOTREF(__pyx_t_1);
6528     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error)
6529     __Pyx_GOTREF(__pyx_t_3);
6530     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6531     __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_lonlat, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 586, __pyx_L1_error)
6532     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6533     __pyx_t_5 = (__pyx_t_4 != 0);
6534     if (__pyx_t_5) {
6535     } else {
6536       __pyx_t_2 = __pyx_t_5;
6537       goto __pyx_L10_bool_binop_done;
6538     }
6539 
6540     /* "cartopy/trace.pyx":587
6541  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and
6542  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6543  *                 'to_meter' in dest_projection.proj4_params):             # <<<<<<<<<<<<<<
6544  *             interpolator.dest_scale = 1 / dest_projection.proj4_params['to_meter']
6545  *     return interpolator
6546  */
6547     __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_to_meter, __pyx_v_dest_projection->proj4_params, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 587, __pyx_L1_error)
6548     __pyx_t_4 = (__pyx_t_5 != 0);
6549     __pyx_t_2 = __pyx_t_4;
6550     __pyx_L10_bool_binop_done:;
6551 
6552     /* "cartopy/trace.pyx":585
6553  *                 'to_meter' in src_crs.proj4_params):
6554  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6555  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6556  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6557  *                 'to_meter' in dest_projection.proj4_params):
6558  */
6559     if (__pyx_t_2) {
6560 
6561       /* "cartopy/trace.pyx":588
6562  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6563  *                 'to_meter' in dest_projection.proj4_params):
6564  *             interpolator.dest_scale = 1 / dest_projection.proj4_params['to_meter']             # <<<<<<<<<<<<<<
6565  *     return interpolator
6566  *
6567  */
6568       __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_dest_projection->proj4_params, __pyx_n_s_to_meter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error)
6569       __Pyx_GOTREF(__pyx_t_3);
6570       __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
6571       __Pyx_GOTREF(__pyx_t_1);
6572       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6573       __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 588, __pyx_L1_error)
6574       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6575       __pyx_v_interpolator->dest_scale = __pyx_t_6;
6576 
6577       /* "cartopy/trace.pyx":585
6578  *                 'to_meter' in src_crs.proj4_params):
6579  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
6580  *         if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
6581  *                 dest_projection.proj4_params.get('o_proj', '') in lonlat and
6582  *                 'to_meter' in dest_projection.proj4_params):
6583  */
6584     }
6585 
6586     /* "cartopy/trace.pyx":577
6587  *         interpolator = CartesianInterpolator()
6588  *     interpolator.init(src_crs.proj4, (<CRS>dest_projection).proj4)
6589  *     if (6, 1, 1) <= PROJ4_VERSION < (6, 3, 0):             # <<<<<<<<<<<<<<
6590  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
6591  *         # See https://github.com/OSGeo/proj#1782.
6592  */
6593   }
6594 
6595   /* "cartopy/trace.pyx":589
6596  *                 'to_meter' in dest_projection.proj4_params):
6597  *             interpolator.dest_scale = 1 / dest_projection.proj4_params['to_meter']
6598  *     return interpolator             # <<<<<<<<<<<<<<
6599  *
6600  *
6601  */
6602   __Pyx_XDECREF(__pyx_r);
6603   __Pyx_INCREF(((PyObject *)__pyx_v_interpolator));
6604   __pyx_r = ((PyObject *)__pyx_v_interpolator);
6605   goto __pyx_L0;
6606 
6607   /* "cartopy/trace.pyx":565
6608  *
6609  *
6610  * cdef _interpolator(CRS src_crs, CRS dest_projection):             # <<<<<<<<<<<<<<
6611  *     # Get an Interpolator from the given CRS and projection.
6612  *     # Callers must hold a reference to these systems for the lifetime
6613  */
6614 
6615   /* function exit code */
6616   __pyx_L1_error:;
6617   __Pyx_XDECREF(__pyx_t_1);
6618   __Pyx_XDECREF(__pyx_t_3);
6619   __Pyx_AddTraceback("cartopy.trace._interpolator", __pyx_clineno, __pyx_lineno, __pyx_filename);
6620   __pyx_r = 0;
6621   __pyx_L0:;
6622   __Pyx_XDECREF((PyObject *)__pyx_v_interpolator);
6623   __Pyx_XDECREF(__pyx_v_lonlat);
6624   __Pyx_XGIVEREF(__pyx_r);
6625   __Pyx_RefNannyFinishContext();
6626   return __pyx_r;
6627 }
6628 
6629 /* "cartopy/trace.pyx":592
6630  *
6631  *
6632  * def project_linear(geometry not None, CRS src_crs not None,             # <<<<<<<<<<<<<<
6633  *                    dest_projection not None):
6634  *     """
6635  */
6636 
6637 /* Python wrapper */
6638 static PyObject *__pyx_pw_7cartopy_5trace_1project_linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6639 static char __pyx_doc_7cartopy_5trace_project_linear[] = "project_linear(geometry, CRS src_crs, dest_projection)\n\n    Project a geometry from one projection to another.\n\n    Parameters\n    ----------\n    geometry : `shapely.geometry.LineString` or `shapely.geometry.LinearRing`\n        A geometry to be projected.\n    src_crs : cartopy.crs.CRS\n        The coordinate system of the line to be projected.\n    dest_projection : cartopy.crs.Projection\n        The projection for the resulting projected line.\n\n    Returns\n    -------\n    `shapely.geometry.MultiLineString`\n        The result of projecting the given geometry from the source projection\n        into the destination projection.\n\n    ";
6640 static PyMethodDef __pyx_mdef_7cartopy_5trace_1project_linear = {"project_linear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_1project_linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_project_linear};
__pyx_pw_7cartopy_5trace_1project_linear(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6641 static PyObject *__pyx_pw_7cartopy_5trace_1project_linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6642   PyObject *__pyx_v_geometry = 0;
6643   struct __pyx_obj_7cartopy_4_crs_CRS *__pyx_v_src_crs = 0;
6644   PyObject *__pyx_v_dest_projection = 0;
6645   int __pyx_lineno = 0;
6646   const char *__pyx_filename = NULL;
6647   int __pyx_clineno = 0;
6648   PyObject *__pyx_r = 0;
6649   __Pyx_RefNannyDeclarations
6650   __Pyx_RefNannySetupContext("project_linear (wrapper)", 0);
6651   {
6652     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_geometry,&__pyx_n_s_src_crs,&__pyx_n_s_dest_projection,0};
6653     PyObject* values[3] = {0,0,0};
6654     if (unlikely(__pyx_kwds)) {
6655       Py_ssize_t kw_args;
6656       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6657       switch (pos_args) {
6658         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6659         CYTHON_FALLTHROUGH;
6660         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6661         CYTHON_FALLTHROUGH;
6662         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6663         CYTHON_FALLTHROUGH;
6664         case  0: break;
6665         default: goto __pyx_L5_argtuple_error;
6666       }
6667       kw_args = PyDict_Size(__pyx_kwds);
6668       switch (pos_args) {
6669         case  0:
6670         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry)) != 0)) kw_args--;
6671         else goto __pyx_L5_argtuple_error;
6672         CYTHON_FALLTHROUGH;
6673         case  1:
6674         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_crs)) != 0)) kw_args--;
6675         else {
6676           __Pyx_RaiseArgtupleInvalid("project_linear", 1, 3, 3, 1); __PYX_ERR(0, 592, __pyx_L3_error)
6677         }
6678         CYTHON_FALLTHROUGH;
6679         case  2:
6680         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest_projection)) != 0)) kw_args--;
6681         else {
6682           __Pyx_RaiseArgtupleInvalid("project_linear", 1, 3, 3, 2); __PYX_ERR(0, 592, __pyx_L3_error)
6683         }
6684       }
6685       if (unlikely(kw_args > 0)) {
6686         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "project_linear") < 0)) __PYX_ERR(0, 592, __pyx_L3_error)
6687       }
6688     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6689       goto __pyx_L5_argtuple_error;
6690     } else {
6691       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6692       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6693       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6694     }
6695     __pyx_v_geometry = values[0];
6696     __pyx_v_src_crs = ((struct __pyx_obj_7cartopy_4_crs_CRS *)values[1]);
6697     __pyx_v_dest_projection = values[2];
6698   }
6699   goto __pyx_L4_argument_unpacking_done;
6700   __pyx_L5_argtuple_error:;
6701   __Pyx_RaiseArgtupleInvalid("project_linear", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 592, __pyx_L3_error)
6702   __pyx_L3_error:;
6703   __Pyx_AddTraceback("cartopy.trace.project_linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
6704   __Pyx_RefNannyFinishContext();
6705   return NULL;
6706   __pyx_L4_argument_unpacking_done:;
6707   if (unlikely(((PyObject *)__pyx_v_geometry) == Py_None)) {
6708     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "geometry"); __PYX_ERR(0, 592, __pyx_L1_error)
6709   }
6710   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_src_crs), __pyx_ptype_7cartopy_4_crs_CRS, 0, "src_crs", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
6711   if (unlikely(((PyObject *)__pyx_v_dest_projection) == Py_None)) {
6712     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "dest_projection"); __PYX_ERR(0, 593, __pyx_L1_error)
6713   }
6714   __pyx_r = __pyx_pf_7cartopy_5trace_project_linear(__pyx_self, __pyx_v_geometry, __pyx_v_src_crs, __pyx_v_dest_projection);
6715 
6716   /* function exit code */
6717   goto __pyx_L0;
6718   __pyx_L1_error:;
6719   __pyx_r = NULL;
6720   __pyx_L0:;
6721   __Pyx_RefNannyFinishContext();
6722   return __pyx_r;
6723 }
6724 
__pyx_pf_7cartopy_5trace_project_linear(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_geometry,struct __pyx_obj_7cartopy_4_crs_CRS * __pyx_v_src_crs,PyObject * __pyx_v_dest_projection)6725 static PyObject *__pyx_pf_7cartopy_5trace_project_linear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry, struct __pyx_obj_7cartopy_4_crs_CRS *__pyx_v_src_crs, PyObject *__pyx_v_dest_projection) {
6726   double __pyx_v_threshold;
6727   GEOSContextHandle_t __pyx_v_handle;
6728   GEOSGeometry *__pyx_v_g_linear;
6729   struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator = 0;
6730   GEOSGeometry *__pyx_v_g_domain;
6731   GEOSCoordSequence const *__pyx_v_src_coords;
6732   unsigned int __pyx_v_src_size;
6733   unsigned int __pyx_v_src_idx;
6734   GEOSPreparedGeometry const *__pyx_v_gp_domain;
6735   struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v_lines = 0;
6736   GEOSGeometry *__pyx_v_g_multi_line_string;
6737   PyObject *__pyx_v_multi_line_string = NULL;
6738   PyObject *__pyx_r = NULL;
6739   __Pyx_RefNannyDeclarations
6740   PyObject *__pyx_t_1 = NULL;
6741   double __pyx_t_2;
6742   GEOSGeometry *__pyx_t_3;
6743   unsigned int __pyx_t_4;
6744   unsigned int __pyx_t_5;
6745   unsigned int __pyx_t_6;
6746   int __pyx_lineno = 0;
6747   const char *__pyx_filename = NULL;
6748   int __pyx_clineno = 0;
6749   __Pyx_RefNannySetupContext("project_linear", 0);
6750 
6751   /* "cartopy/trace.pyx":614
6752  *     """
6753  *     cdef:
6754  *         double threshold = dest_projection.threshold             # <<<<<<<<<<<<<<
6755  *         GEOSContextHandle_t handle = get_geos_context_handle()
6756  *         GEOSGeometry *g_linear = geos_from_shapely(geometry)
6757  */
6758   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dest_projection, __pyx_n_s_threshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
6759   __Pyx_GOTREF(__pyx_t_1);
6760   __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 614, __pyx_L1_error)
6761   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6762   __pyx_v_threshold = __pyx_t_2;
6763 
6764   /* "cartopy/trace.pyx":615
6765  *     cdef:
6766  *         double threshold = dest_projection.threshold
6767  *         GEOSContextHandle_t handle = get_geos_context_handle()             # <<<<<<<<<<<<<<
6768  *         GEOSGeometry *g_linear = geos_from_shapely(geometry)
6769  *         Interpolator interpolator
6770  */
6771   __pyx_v_handle = __pyx_f_7cartopy_5trace_get_geos_context_handle();
6772 
6773   /* "cartopy/trace.pyx":616
6774  *         double threshold = dest_projection.threshold
6775  *         GEOSContextHandle_t handle = get_geos_context_handle()
6776  *         GEOSGeometry *g_linear = geos_from_shapely(geometry)             # <<<<<<<<<<<<<<
6777  *         Interpolator interpolator
6778  *         GEOSGeometry *g_domain
6779  */
6780   __pyx_t_3 = __pyx_f_7cartopy_5trace_geos_from_shapely(__pyx_v_geometry); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 616, __pyx_L1_error)
6781   __pyx_v_g_linear = __pyx_t_3;
6782 
6783   /* "cartopy/trace.pyx":625
6784  *         GEOSGeometry *g_multi_line_string
6785  *
6786  *     g_domain = geos_from_shapely(dest_projection.domain)             # <<<<<<<<<<<<<<
6787  *
6788  *     interpolator = _interpolator(src_crs, dest_projection)
6789  */
6790   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dest_projection, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
6791   __Pyx_GOTREF(__pyx_t_1);
6792   __pyx_t_3 = __pyx_f_7cartopy_5trace_geos_from_shapely(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 625, __pyx_L1_error)
6793   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6794   __pyx_v_g_domain = __pyx_t_3;
6795 
6796   /* "cartopy/trace.pyx":627
6797  *     g_domain = geos_from_shapely(dest_projection.domain)
6798  *
6799  *     interpolator = _interpolator(src_crs, dest_projection)             # <<<<<<<<<<<<<<
6800  *
6801  *     src_coords = GEOSGeom_getCoordSeq_r(handle, g_linear)
6802  */
6803   if (!(likely(__Pyx_TypeTest(__pyx_v_dest_projection, __pyx_ptype_7cartopy_4_crs_CRS)))) __PYX_ERR(0, 627, __pyx_L1_error)
6804   __pyx_t_1 = __pyx_f_7cartopy_5trace__interpolator(__pyx_v_src_crs, ((struct __pyx_obj_7cartopy_4_crs_CRS *)__pyx_v_dest_projection)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
6805   __Pyx_GOTREF(__pyx_t_1);
6806   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cartopy_5trace_Interpolator))))) __PYX_ERR(0, 627, __pyx_L1_error)
6807   __pyx_v_interpolator = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)__pyx_t_1);
6808   __pyx_t_1 = 0;
6809 
6810   /* "cartopy/trace.pyx":629
6811  *     interpolator = _interpolator(src_crs, dest_projection)
6812  *
6813  *     src_coords = GEOSGeom_getCoordSeq_r(handle, g_linear)             # <<<<<<<<<<<<<<
6814  *     gp_domain = GEOSPrepare_r(handle, g_domain)
6815  *
6816  */
6817   __pyx_v_src_coords = GEOSGeom_getCoordSeq_r(__pyx_v_handle, __pyx_v_g_linear);
6818 
6819   /* "cartopy/trace.pyx":630
6820  *
6821  *     src_coords = GEOSGeom_getCoordSeq_r(handle, g_linear)
6822  *     gp_domain = GEOSPrepare_r(handle, g_domain)             # <<<<<<<<<<<<<<
6823  *
6824  *     GEOSCoordSeq_getSize_r(handle, src_coords, &src_size)  # check exceptions
6825  */
6826   __pyx_v_gp_domain = GEOSPrepare_r(__pyx_v_handle, __pyx_v_g_domain);
6827 
6828   /* "cartopy/trace.pyx":632
6829  *     gp_domain = GEOSPrepare_r(handle, g_domain)
6830  *
6831  *     GEOSCoordSeq_getSize_r(handle, src_coords, &src_size)  # check exceptions             # <<<<<<<<<<<<<<
6832  *
6833  *     lines = LineAccumulator()
6834  */
6835   (void)(GEOSCoordSeq_getSize_r(__pyx_v_handle, __pyx_v_src_coords, (&__pyx_v_src_size)));
6836 
6837   /* "cartopy/trace.pyx":634
6838  *     GEOSCoordSeq_getSize_r(handle, src_coords, &src_size)  # check exceptions
6839  *
6840  *     lines = LineAccumulator()             # <<<<<<<<<<<<<<
6841  *     for src_idx in range(1, src_size):
6842  *         _project_segment(handle, src_coords, src_idx - 1, src_idx,
6843  */
6844   __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7cartopy_5trace_LineAccumulator)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
6845   __Pyx_GOTREF(__pyx_t_1);
6846   __pyx_v_lines = ((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)__pyx_t_1);
6847   __pyx_t_1 = 0;
6848 
6849   /* "cartopy/trace.pyx":635
6850  *
6851  *     lines = LineAccumulator()
6852  *     for src_idx in range(1, src_size):             # <<<<<<<<<<<<<<
6853  *         _project_segment(handle, src_coords, src_idx - 1, src_idx,
6854  *                          interpolator, gp_domain, threshold, lines);
6855  */
6856   __pyx_t_4 = __pyx_v_src_size;
6857   __pyx_t_5 = __pyx_t_4;
6858   for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6859     __pyx_v_src_idx = __pyx_t_6;
6860 
6861     /* "cartopy/trace.pyx":636
6862  *     lines = LineAccumulator()
6863  *     for src_idx in range(1, src_size):
6864  *         _project_segment(handle, src_coords, src_idx - 1, src_idx,             # <<<<<<<<<<<<<<
6865  *                          interpolator, gp_domain, threshold, lines);
6866  *
6867  */
6868     __pyx_f_7cartopy_5trace__project_segment(__pyx_v_handle, __pyx_v_src_coords, (__pyx_v_src_idx - 1), __pyx_v_src_idx, __pyx_v_interpolator, __pyx_v_gp_domain, __pyx_v_threshold, __pyx_v_lines);
6869   }
6870 
6871   /* "cartopy/trace.pyx":639
6872  *                          interpolator, gp_domain, threshold, lines);
6873  *
6874  *     GEOSPreparedGeom_destroy_r(handle, gp_domain)             # <<<<<<<<<<<<<<
6875  *
6876  *     g_multi_line_string = lines.as_geom(handle)
6877  */
6878   GEOSPreparedGeom_destroy_r(__pyx_v_handle, __pyx_v_gp_domain);
6879 
6880   /* "cartopy/trace.pyx":641
6881  *     GEOSPreparedGeom_destroy_r(handle, gp_domain)
6882  *
6883  *     g_multi_line_string = lines.as_geom(handle)             # <<<<<<<<<<<<<<
6884  *
6885  *     del lines, interpolator
6886  */
6887   __pyx_v_g_multi_line_string = __pyx_f_7cartopy_5trace_15LineAccumulator_as_geom(__pyx_v_lines, __pyx_v_handle);
6888 
6889   /* "cartopy/trace.pyx":643
6890  *     g_multi_line_string = lines.as_geom(handle)
6891  *
6892  *     del lines, interpolator             # <<<<<<<<<<<<<<
6893  *     multi_line_string = shapely_from_geos(g_multi_line_string)
6894  *     return multi_line_string
6895  */
6896   __Pyx_DECREF(((PyObject *)__pyx_v_lines));
6897   __pyx_v_lines = NULL;
6898   __Pyx_DECREF(((PyObject *)__pyx_v_interpolator));
6899   __pyx_v_interpolator = NULL;
6900 
6901   /* "cartopy/trace.pyx":644
6902  *
6903  *     del lines, interpolator
6904  *     multi_line_string = shapely_from_geos(g_multi_line_string)             # <<<<<<<<<<<<<<
6905  *     return multi_line_string
6906  *
6907  */
6908   __pyx_t_1 = __pyx_f_7cartopy_5trace_shapely_from_geos(__pyx_v_g_multi_line_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error)
6909   __Pyx_GOTREF(__pyx_t_1);
6910   __pyx_v_multi_line_string = __pyx_t_1;
6911   __pyx_t_1 = 0;
6912 
6913   /* "cartopy/trace.pyx":645
6914  *     del lines, interpolator
6915  *     multi_line_string = shapely_from_geos(g_multi_line_string)
6916  *     return multi_line_string             # <<<<<<<<<<<<<<
6917  *
6918  *
6919  */
6920   __Pyx_XDECREF(__pyx_r);
6921   __Pyx_INCREF(__pyx_v_multi_line_string);
6922   __pyx_r = __pyx_v_multi_line_string;
6923   goto __pyx_L0;
6924 
6925   /* "cartopy/trace.pyx":592
6926  *
6927  *
6928  * def project_linear(geometry not None, CRS src_crs not None,             # <<<<<<<<<<<<<<
6929  *                    dest_projection not None):
6930  *     """
6931  */
6932 
6933   /* function exit code */
6934   __pyx_L1_error:;
6935   __Pyx_XDECREF(__pyx_t_1);
6936   __Pyx_AddTraceback("cartopy.trace.project_linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
6937   __pyx_r = NULL;
6938   __pyx_L0:;
6939   __Pyx_XDECREF((PyObject *)__pyx_v_interpolator);
6940   __Pyx_XDECREF((PyObject *)__pyx_v_lines);
6941   __Pyx_XDECREF(__pyx_v_multi_line_string);
6942   __Pyx_XGIVEREF(__pyx_r);
6943   __Pyx_RefNannyFinishContext();
6944   return __pyx_r;
6945 }
6946 
6947 /* "cartopy/trace.pyx":650
6948  * class _Testing:
6949  *     @staticmethod
6950  *     def straight_and_within(Point l_start, Point l_end,             # <<<<<<<<<<<<<<
6951  *                             double t_start, double t_end,
6952  *                             Interpolator interpolator, double threshold,
6953  */
6954 
6955 /* Python wrapper */
6956 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_1straight_and_within(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6957 static char __pyx_doc_7cartopy_5trace_8_Testing_straight_and_within[] = "_Testing.straight_and_within(Point l_start, Point l_end, double t_start, double t_end, Interpolator interpolator, double threshold, domain)";
6958 static PyMethodDef __pyx_mdef_7cartopy_5trace_8_Testing_1straight_and_within = {"straight_and_within", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_8_Testing_1straight_and_within, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_8_Testing_straight_and_within};
__pyx_pw_7cartopy_5trace_8_Testing_1straight_and_within(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6959 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_1straight_and_within(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6960   __pyx_t_7cartopy_5trace_Point __pyx_v_l_start;
6961   __pyx_t_7cartopy_5trace_Point __pyx_v_l_end;
6962   double __pyx_v_t_start;
6963   double __pyx_v_t_end;
6964   struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator = 0;
6965   double __pyx_v_threshold;
6966   PyObject *__pyx_v_domain = 0;
6967   int __pyx_lineno = 0;
6968   const char *__pyx_filename = NULL;
6969   int __pyx_clineno = 0;
6970   PyObject *__pyx_r = 0;
6971   __Pyx_RefNannyDeclarations
6972   __Pyx_RefNannySetupContext("straight_and_within (wrapper)", 0);
6973   {
6974     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_l_start,&__pyx_n_s_l_end,&__pyx_n_s_t_start,&__pyx_n_s_t_end,&__pyx_n_s_interpolator,&__pyx_n_s_threshold,&__pyx_n_s_domain,0};
6975     PyObject* values[7] = {0,0,0,0,0,0,0};
6976     if (unlikely(__pyx_kwds)) {
6977       Py_ssize_t kw_args;
6978       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6979       switch (pos_args) {
6980         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6981         CYTHON_FALLTHROUGH;
6982         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6983         CYTHON_FALLTHROUGH;
6984         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6985         CYTHON_FALLTHROUGH;
6986         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6987         CYTHON_FALLTHROUGH;
6988         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6989         CYTHON_FALLTHROUGH;
6990         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6991         CYTHON_FALLTHROUGH;
6992         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6993         CYTHON_FALLTHROUGH;
6994         case  0: break;
6995         default: goto __pyx_L5_argtuple_error;
6996       }
6997       kw_args = PyDict_Size(__pyx_kwds);
6998       switch (pos_args) {
6999         case  0:
7000         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l_start)) != 0)) kw_args--;
7001         else goto __pyx_L5_argtuple_error;
7002         CYTHON_FALLTHROUGH;
7003         case  1:
7004         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l_end)) != 0)) kw_args--;
7005         else {
7006           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 1); __PYX_ERR(0, 650, __pyx_L3_error)
7007         }
7008         CYTHON_FALLTHROUGH;
7009         case  2:
7010         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_start)) != 0)) kw_args--;
7011         else {
7012           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 2); __PYX_ERR(0, 650, __pyx_L3_error)
7013         }
7014         CYTHON_FALLTHROUGH;
7015         case  3:
7016         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_end)) != 0)) kw_args--;
7017         else {
7018           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 3); __PYX_ERR(0, 650, __pyx_L3_error)
7019         }
7020         CYTHON_FALLTHROUGH;
7021         case  4:
7022         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interpolator)) != 0)) kw_args--;
7023         else {
7024           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 4); __PYX_ERR(0, 650, __pyx_L3_error)
7025         }
7026         CYTHON_FALLTHROUGH;
7027         case  5:
7028         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
7029         else {
7030           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 5); __PYX_ERR(0, 650, __pyx_L3_error)
7031         }
7032         CYTHON_FALLTHROUGH;
7033         case  6:
7034         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_domain)) != 0)) kw_args--;
7035         else {
7036           __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, 6); __PYX_ERR(0, 650, __pyx_L3_error)
7037         }
7038       }
7039       if (unlikely(kw_args > 0)) {
7040         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "straight_and_within") < 0)) __PYX_ERR(0, 650, __pyx_L3_error)
7041       }
7042     } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7043       goto __pyx_L5_argtuple_error;
7044     } else {
7045       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7046       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7047       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7048       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7049       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7050       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7051       values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7052     }
7053     __pyx_v_l_start = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 650, __pyx_L3_error)
7054     __pyx_v_l_end = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 650, __pyx_L3_error)
7055     __pyx_v_t_start = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_t_start == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 651, __pyx_L3_error)
7056     __pyx_v_t_end = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_t_end == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 651, __pyx_L3_error)
7057     __pyx_v_interpolator = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)values[4]);
7058     __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 652, __pyx_L3_error)
7059     __pyx_v_domain = values[6];
7060   }
7061   goto __pyx_L4_argument_unpacking_done;
7062   __pyx_L5_argtuple_error:;
7063   __Pyx_RaiseArgtupleInvalid("straight_and_within", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 650, __pyx_L3_error)
7064   __pyx_L3_error:;
7065   __Pyx_AddTraceback("cartopy.trace._Testing.straight_and_within", __pyx_clineno, __pyx_lineno, __pyx_filename);
7066   __Pyx_RefNannyFinishContext();
7067   return NULL;
7068   __pyx_L4_argument_unpacking_done:;
7069   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interpolator), __pyx_ptype_7cartopy_5trace_Interpolator, 1, "interpolator", 0))) __PYX_ERR(0, 652, __pyx_L1_error)
7070   __pyx_r = __pyx_pf_7cartopy_5trace_8_Testing_straight_and_within(__pyx_self, __pyx_v_l_start, __pyx_v_l_end, __pyx_v_t_start, __pyx_v_t_end, __pyx_v_interpolator, __pyx_v_threshold, __pyx_v_domain);
7071 
7072   /* function exit code */
7073   goto __pyx_L0;
7074   __pyx_L1_error:;
7075   __pyx_r = NULL;
7076   __pyx_L0:;
7077   __Pyx_RefNannyFinishContext();
7078   return __pyx_r;
7079 }
7080 
__pyx_pf_7cartopy_5trace_8_Testing_straight_and_within(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_7cartopy_5trace_Point __pyx_v_l_start,__pyx_t_7cartopy_5trace_Point __pyx_v_l_end,double __pyx_v_t_start,double __pyx_v_t_end,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interpolator,double __pyx_v_threshold,PyObject * __pyx_v_domain)7081 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_straight_and_within(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7cartopy_5trace_Point __pyx_v_l_start, __pyx_t_7cartopy_5trace_Point __pyx_v_l_end, double __pyx_v_t_start, double __pyx_v_t_end, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interpolator, double __pyx_v_threshold, PyObject *__pyx_v_domain) {
7082   GEOSContextHandle_t __pyx_v_handle;
7083   GEOSGeometry *__pyx_v_g_domain;
7084   GEOSPreparedGeometry const *__pyx_v_gp_domain;
7085   enum __pyx_t_7cartopy_5trace_State __pyx_v_state;
7086   bool __pyx_v_p_start_inside_domain;
7087   __pyx_t_7cartopy_5trace_Point __pyx_v_p0;
7088   __pyx_t_7cartopy_5trace_Point __pyx_v_p1;
7089   bool __pyx_v_valid;
7090   PyObject *__pyx_r = NULL;
7091   __Pyx_RefNannyDeclarations
7092   GEOSGeometry *__pyx_t_1;
7093   PyObject *__pyx_t_2 = NULL;
7094   int __pyx_lineno = 0;
7095   const char *__pyx_filename = NULL;
7096   int __pyx_clineno = 0;
7097   __Pyx_RefNannySetupContext("straight_and_within", 0);
7098 
7099   /* "cartopy/trace.pyx":659
7100  *         # a convenient signature).
7101  *
7102  *         cdef GEOSContextHandle_t handle = get_geos_context_handle()             # <<<<<<<<<<<<<<
7103  *
7104  *         cdef GEOSGeometry *g_domain = geos_from_shapely(domain)
7105  */
7106   __pyx_v_handle = __pyx_f_7cartopy_5trace_get_geos_context_handle();
7107 
7108   /* "cartopy/trace.pyx":661
7109  *         cdef GEOSContextHandle_t handle = get_geos_context_handle()
7110  *
7111  *         cdef GEOSGeometry *g_domain = geos_from_shapely(domain)             # <<<<<<<<<<<<<<
7112  *         cdef const GEOSPreparedGeometry *gp_domain
7113  *         gp_domain = GEOSPrepare_r(handle, g_domain)
7114  */
7115   __pyx_t_1 = __pyx_f_7cartopy_5trace_geos_from_shapely(__pyx_v_domain); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error)
7116   __pyx_v_g_domain = __pyx_t_1;
7117 
7118   /* "cartopy/trace.pyx":663
7119  *         cdef GEOSGeometry *g_domain = geos_from_shapely(domain)
7120  *         cdef const GEOSPreparedGeometry *gp_domain
7121  *         gp_domain = GEOSPrepare_r(handle, g_domain)             # <<<<<<<<<<<<<<
7122  *
7123  *         state = get_state(interpolator.project(l_start), gp_domain, handle)
7124  */
7125   __pyx_v_gp_domain = GEOSPrepare_r(__pyx_v_handle, __pyx_v_g_domain);
7126 
7127   /* "cartopy/trace.pyx":665
7128  *         gp_domain = GEOSPrepare_r(handle, g_domain)
7129  *
7130  *         state = get_state(interpolator.project(l_start), gp_domain, handle)             # <<<<<<<<<<<<<<
7131  *         cdef bool p_start_inside_domain = state == POINT_IN
7132  *
7133  */
7134   __pyx_v_state = __pyx_f_7cartopy_5trace_get_state(((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->project(__pyx_v_interpolator, __pyx_v_l_start), __pyx_v_gp_domain, __pyx_v_handle);
7135 
7136   /* "cartopy/trace.pyx":666
7137  *
7138  *         state = get_state(interpolator.project(l_start), gp_domain, handle)
7139  *         cdef bool p_start_inside_domain = state == POINT_IN             # <<<<<<<<<<<<<<
7140  *
7141  *         # l_end and l_start should be un-projected.
7142  */
7143   __pyx_v_p_start_inside_domain = (__pyx_v_state == __pyx_e_7cartopy_5trace_POINT_IN);
7144 
7145   /* "cartopy/trace.pyx":669
7146  *
7147  *         # l_end and l_start should be un-projected.
7148  *         interpolator.set_line(l_start, l_end)             # <<<<<<<<<<<<<<
7149  *
7150  *         cdef Point p0 = interpolator.interpolate(t_start)
7151  */
7152   ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->set_line(__pyx_v_interpolator, __pyx_v_l_start, __pyx_v_l_end);
7153 
7154   /* "cartopy/trace.pyx":671
7155  *         interpolator.set_line(l_start, l_end)
7156  *
7157  *         cdef Point p0 = interpolator.interpolate(t_start)             # <<<<<<<<<<<<<<
7158  *         cdef Point p1 = interpolator.interpolate(t_end)
7159  *
7160  */
7161   __pyx_v_p0 = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->interpolate(__pyx_v_interpolator, __pyx_v_t_start);
7162 
7163   /* "cartopy/trace.pyx":672
7164  *
7165  *         cdef Point p0 = interpolator.interpolate(t_start)
7166  *         cdef Point p1 = interpolator.interpolate(t_end)             # <<<<<<<<<<<<<<
7167  *
7168  *         valid = straightAndDomain(
7169  */
7170   __pyx_v_p1 = ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interpolator->__pyx_vtab)->interpolate(__pyx_v_interpolator, __pyx_v_t_end);
7171 
7172   /* "cartopy/trace.pyx":674
7173  *         cdef Point p1 = interpolator.interpolate(t_end)
7174  *
7175  *         valid = straightAndDomain(             # <<<<<<<<<<<<<<
7176  *             t_start, p0, t_end, p1,
7177  *             interpolator, threshold,
7178  */
7179   __pyx_v_valid = __pyx_f_7cartopy_5trace_straightAndDomain(__pyx_v_t_start, __pyx_v_p0, __pyx_v_t_end, __pyx_v_p1, __pyx_v_interpolator, __pyx_v_threshold, __pyx_v_handle, __pyx_v_gp_domain, __pyx_v_p_start_inside_domain);
7180 
7181   /* "cartopy/trace.pyx":679
7182  *             handle, gp_domain, p_start_inside_domain)
7183  *
7184  *         GEOSPreparedGeom_destroy_r(handle, gp_domain)             # <<<<<<<<<<<<<<
7185  *         return valid
7186  *
7187  */
7188   GEOSPreparedGeom_destroy_r(__pyx_v_handle, __pyx_v_gp_domain);
7189 
7190   /* "cartopy/trace.pyx":680
7191  *
7192  *         GEOSPreparedGeom_destroy_r(handle, gp_domain)
7193  *         return valid             # <<<<<<<<<<<<<<
7194  *
7195  *     @staticmethod
7196  */
7197   __Pyx_XDECREF(__pyx_r);
7198   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_valid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
7199   __Pyx_GOTREF(__pyx_t_2);
7200   __pyx_r = __pyx_t_2;
7201   __pyx_t_2 = 0;
7202   goto __pyx_L0;
7203 
7204   /* "cartopy/trace.pyx":650
7205  * class _Testing:
7206  *     @staticmethod
7207  *     def straight_and_within(Point l_start, Point l_end,             # <<<<<<<<<<<<<<
7208  *                             double t_start, double t_end,
7209  *                             Interpolator interpolator, double threshold,
7210  */
7211 
7212   /* function exit code */
7213   __pyx_L1_error:;
7214   __Pyx_XDECREF(__pyx_t_2);
7215   __Pyx_AddTraceback("cartopy.trace._Testing.straight_and_within", __pyx_clineno, __pyx_lineno, __pyx_filename);
7216   __pyx_r = NULL;
7217   __pyx_L0:;
7218   __Pyx_XGIVEREF(__pyx_r);
7219   __Pyx_RefNannyFinishContext();
7220   return __pyx_r;
7221 }
7222 
7223 /* "cartopy/trace.pyx":683
7224  *
7225  *     @staticmethod
7226  *     def interpolator(source_crs, destination_projection):             # <<<<<<<<<<<<<<
7227  *         return _interpolator(source_crs, destination_projection)
7228  *
7229  */
7230 
7231 /* Python wrapper */
7232 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_3interpolator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7233 static char __pyx_doc_7cartopy_5trace_8_Testing_2interpolator[] = "_Testing.interpolator(source_crs, destination_projection)";
7234 static PyMethodDef __pyx_mdef_7cartopy_5trace_8_Testing_3interpolator = {"interpolator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_8_Testing_3interpolator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_8_Testing_2interpolator};
__pyx_pw_7cartopy_5trace_8_Testing_3interpolator(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7235 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_3interpolator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7236   PyObject *__pyx_v_source_crs = 0;
7237   PyObject *__pyx_v_destination_projection = 0;
7238   int __pyx_lineno = 0;
7239   const char *__pyx_filename = NULL;
7240   int __pyx_clineno = 0;
7241   PyObject *__pyx_r = 0;
7242   __Pyx_RefNannyDeclarations
7243   __Pyx_RefNannySetupContext("interpolator (wrapper)", 0);
7244   {
7245     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source_crs,&__pyx_n_s_destination_projection,0};
7246     PyObject* values[2] = {0,0};
7247     if (unlikely(__pyx_kwds)) {
7248       Py_ssize_t kw_args;
7249       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7250       switch (pos_args) {
7251         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7252         CYTHON_FALLTHROUGH;
7253         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7254         CYTHON_FALLTHROUGH;
7255         case  0: break;
7256         default: goto __pyx_L5_argtuple_error;
7257       }
7258       kw_args = PyDict_Size(__pyx_kwds);
7259       switch (pos_args) {
7260         case  0:
7261         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source_crs)) != 0)) kw_args--;
7262         else goto __pyx_L5_argtuple_error;
7263         CYTHON_FALLTHROUGH;
7264         case  1:
7265         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destination_projection)) != 0)) kw_args--;
7266         else {
7267           __Pyx_RaiseArgtupleInvalid("interpolator", 1, 2, 2, 1); __PYX_ERR(0, 683, __pyx_L3_error)
7268         }
7269       }
7270       if (unlikely(kw_args > 0)) {
7271         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "interpolator") < 0)) __PYX_ERR(0, 683, __pyx_L3_error)
7272       }
7273     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7274       goto __pyx_L5_argtuple_error;
7275     } else {
7276       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7277       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7278     }
7279     __pyx_v_source_crs = values[0];
7280     __pyx_v_destination_projection = values[1];
7281   }
7282   goto __pyx_L4_argument_unpacking_done;
7283   __pyx_L5_argtuple_error:;
7284   __Pyx_RaiseArgtupleInvalid("interpolator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 683, __pyx_L3_error)
7285   __pyx_L3_error:;
7286   __Pyx_AddTraceback("cartopy.trace._Testing.interpolator", __pyx_clineno, __pyx_lineno, __pyx_filename);
7287   __Pyx_RefNannyFinishContext();
7288   return NULL;
7289   __pyx_L4_argument_unpacking_done:;
7290   __pyx_r = __pyx_pf_7cartopy_5trace_8_Testing_2interpolator(__pyx_self, __pyx_v_source_crs, __pyx_v_destination_projection);
7291 
7292   /* function exit code */
7293   __Pyx_RefNannyFinishContext();
7294   return __pyx_r;
7295 }
7296 
__pyx_pf_7cartopy_5trace_8_Testing_2interpolator(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_source_crs,PyObject * __pyx_v_destination_projection)7297 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_2interpolator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source_crs, PyObject *__pyx_v_destination_projection) {
7298   PyObject *__pyx_r = NULL;
7299   __Pyx_RefNannyDeclarations
7300   PyObject *__pyx_t_1 = NULL;
7301   int __pyx_lineno = 0;
7302   const char *__pyx_filename = NULL;
7303   int __pyx_clineno = 0;
7304   __Pyx_RefNannySetupContext("interpolator", 0);
7305 
7306   /* "cartopy/trace.pyx":684
7307  *     @staticmethod
7308  *     def interpolator(source_crs, destination_projection):
7309  *         return _interpolator(source_crs, destination_projection)             # <<<<<<<<<<<<<<
7310  *
7311  *     @staticmethod
7312  */
7313   __Pyx_XDECREF(__pyx_r);
7314   if (!(likely(((__pyx_v_source_crs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_source_crs, __pyx_ptype_7cartopy_4_crs_CRS))))) __PYX_ERR(0, 684, __pyx_L1_error)
7315   if (!(likely(((__pyx_v_destination_projection) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_destination_projection, __pyx_ptype_7cartopy_4_crs_CRS))))) __PYX_ERR(0, 684, __pyx_L1_error)
7316   __pyx_t_1 = __pyx_f_7cartopy_5trace__interpolator(((struct __pyx_obj_7cartopy_4_crs_CRS *)__pyx_v_source_crs), ((struct __pyx_obj_7cartopy_4_crs_CRS *)__pyx_v_destination_projection)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error)
7317   __Pyx_GOTREF(__pyx_t_1);
7318   __pyx_r = __pyx_t_1;
7319   __pyx_t_1 = 0;
7320   goto __pyx_L0;
7321 
7322   /* "cartopy/trace.pyx":683
7323  *
7324  *     @staticmethod
7325  *     def interpolator(source_crs, destination_projection):             # <<<<<<<<<<<<<<
7326  *         return _interpolator(source_crs, destination_projection)
7327  *
7328  */
7329 
7330   /* function exit code */
7331   __pyx_L1_error:;
7332   __Pyx_XDECREF(__pyx_t_1);
7333   __Pyx_AddTraceback("cartopy.trace._Testing.interpolator", __pyx_clineno, __pyx_lineno, __pyx_filename);
7334   __pyx_r = NULL;
7335   __pyx_L0:;
7336   __Pyx_XGIVEREF(__pyx_r);
7337   __Pyx_RefNannyFinishContext();
7338   return __pyx_r;
7339 }
7340 
7341 /* "cartopy/trace.pyx":687
7342  *
7343  *     @staticmethod
7344  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):             # <<<<<<<<<<<<<<
7345  *         return interp.project(lonlat)
7346  *
7347  */
7348 
7349 /* Python wrapper */
7350 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_5interp_prj_pt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7351 static char __pyx_doc_7cartopy_5trace_8_Testing_4interp_prj_pt[] = "_Testing.interp_prj_pt(Interpolator interp, Point lonlat)";
7352 static PyMethodDef __pyx_mdef_7cartopy_5trace_8_Testing_5interp_prj_pt = {"interp_prj_pt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_8_Testing_5interp_prj_pt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_8_Testing_4interp_prj_pt};
__pyx_pw_7cartopy_5trace_8_Testing_5interp_prj_pt(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7353 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_5interp_prj_pt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7354   struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp = 0;
7355   __pyx_t_7cartopy_5trace_Point __pyx_v_lonlat;
7356   int __pyx_lineno = 0;
7357   const char *__pyx_filename = NULL;
7358   int __pyx_clineno = 0;
7359   PyObject *__pyx_r = 0;
7360   __Pyx_RefNannyDeclarations
7361   __Pyx_RefNannySetupContext("interp_prj_pt (wrapper)", 0);
7362   {
7363     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interp,&__pyx_n_s_lonlat,0};
7364     PyObject* values[2] = {0,0};
7365     if (unlikely(__pyx_kwds)) {
7366       Py_ssize_t kw_args;
7367       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7368       switch (pos_args) {
7369         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7370         CYTHON_FALLTHROUGH;
7371         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7372         CYTHON_FALLTHROUGH;
7373         case  0: break;
7374         default: goto __pyx_L5_argtuple_error;
7375       }
7376       kw_args = PyDict_Size(__pyx_kwds);
7377       switch (pos_args) {
7378         case  0:
7379         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interp)) != 0)) kw_args--;
7380         else goto __pyx_L5_argtuple_error;
7381         CYTHON_FALLTHROUGH;
7382         case  1:
7383         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lonlat)) != 0)) kw_args--;
7384         else {
7385           __Pyx_RaiseArgtupleInvalid("interp_prj_pt", 1, 2, 2, 1); __PYX_ERR(0, 687, __pyx_L3_error)
7386         }
7387       }
7388       if (unlikely(kw_args > 0)) {
7389         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "interp_prj_pt") < 0)) __PYX_ERR(0, 687, __pyx_L3_error)
7390       }
7391     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7392       goto __pyx_L5_argtuple_error;
7393     } else {
7394       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7395       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7396     }
7397     __pyx_v_interp = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)values[0]);
7398     __pyx_v_lonlat = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L3_error)
7399   }
7400   goto __pyx_L4_argument_unpacking_done;
7401   __pyx_L5_argtuple_error:;
7402   __Pyx_RaiseArgtupleInvalid("interp_prj_pt", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 687, __pyx_L3_error)
7403   __pyx_L3_error:;
7404   __Pyx_AddTraceback("cartopy.trace._Testing.interp_prj_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
7405   __Pyx_RefNannyFinishContext();
7406   return NULL;
7407   __pyx_L4_argument_unpacking_done:;
7408   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interp), __pyx_ptype_7cartopy_5trace_Interpolator, 1, "interp", 0))) __PYX_ERR(0, 687, __pyx_L1_error)
7409   __pyx_r = __pyx_pf_7cartopy_5trace_8_Testing_4interp_prj_pt(__pyx_self, __pyx_v_interp, __pyx_v_lonlat);
7410 
7411   /* function exit code */
7412   goto __pyx_L0;
7413   __pyx_L1_error:;
7414   __pyx_r = NULL;
7415   __pyx_L0:;
7416   __Pyx_RefNannyFinishContext();
7417   return __pyx_r;
7418 }
7419 
__pyx_pf_7cartopy_5trace_8_Testing_4interp_prj_pt(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interp,__pyx_t_7cartopy_5trace_Point __pyx_v_lonlat)7420 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_4interp_prj_pt(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp, __pyx_t_7cartopy_5trace_Point __pyx_v_lonlat) {
7421   PyObject *__pyx_r = NULL;
7422   __Pyx_RefNannyDeclarations
7423   PyObject *__pyx_t_1 = NULL;
7424   int __pyx_lineno = 0;
7425   const char *__pyx_filename = NULL;
7426   int __pyx_clineno = 0;
7427   __Pyx_RefNannySetupContext("interp_prj_pt", 0);
7428 
7429   /* "cartopy/trace.pyx":688
7430  *     @staticmethod
7431  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):
7432  *         return interp.project(lonlat)             # <<<<<<<<<<<<<<
7433  *
7434  *     @staticmethod
7435  */
7436   __Pyx_XDECREF(__pyx_r);
7437   __pyx_t_1 = __pyx_convert__to_py___pyx_t_7cartopy_5trace_Point(((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interp->__pyx_vtab)->project(__pyx_v_interp, __pyx_v_lonlat)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
7438   __Pyx_GOTREF(__pyx_t_1);
7439   __pyx_r = __pyx_t_1;
7440   __pyx_t_1 = 0;
7441   goto __pyx_L0;
7442 
7443   /* "cartopy/trace.pyx":687
7444  *
7445  *     @staticmethod
7446  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):             # <<<<<<<<<<<<<<
7447  *         return interp.project(lonlat)
7448  *
7449  */
7450 
7451   /* function exit code */
7452   __pyx_L1_error:;
7453   __Pyx_XDECREF(__pyx_t_1);
7454   __Pyx_AddTraceback("cartopy.trace._Testing.interp_prj_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
7455   __pyx_r = NULL;
7456   __pyx_L0:;
7457   __Pyx_XGIVEREF(__pyx_r);
7458   __Pyx_RefNannyFinishContext();
7459   return __pyx_r;
7460 }
7461 
7462 /* "cartopy/trace.pyx":691
7463  *
7464  *     @staticmethod
7465  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):             # <<<<<<<<<<<<<<
7466  *         interp.set_line(start, end)
7467  *         return interp.interpolate(t)
7468  */
7469 
7470 /* Python wrapper */
7471 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_7interp_t_pt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7472 static char __pyx_doc_7cartopy_5trace_8_Testing_6interp_t_pt[] = "_Testing.interp_t_pt(Interpolator interp, Point start, Point end, double t)";
7473 static PyMethodDef __pyx_mdef_7cartopy_5trace_8_Testing_7interp_t_pt = {"interp_t_pt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_8_Testing_7interp_t_pt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_8_Testing_6interp_t_pt};
__pyx_pw_7cartopy_5trace_8_Testing_7interp_t_pt(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7474 static PyObject *__pyx_pw_7cartopy_5trace_8_Testing_7interp_t_pt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7475   struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp = 0;
7476   __pyx_t_7cartopy_5trace_Point __pyx_v_start;
7477   __pyx_t_7cartopy_5trace_Point __pyx_v_end;
7478   double __pyx_v_t;
7479   int __pyx_lineno = 0;
7480   const char *__pyx_filename = NULL;
7481   int __pyx_clineno = 0;
7482   PyObject *__pyx_r = 0;
7483   __Pyx_RefNannyDeclarations
7484   __Pyx_RefNannySetupContext("interp_t_pt (wrapper)", 0);
7485   {
7486     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interp,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_t_2,0};
7487     PyObject* values[4] = {0,0,0,0};
7488     if (unlikely(__pyx_kwds)) {
7489       Py_ssize_t kw_args;
7490       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7491       switch (pos_args) {
7492         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7493         CYTHON_FALLTHROUGH;
7494         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7495         CYTHON_FALLTHROUGH;
7496         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7497         CYTHON_FALLTHROUGH;
7498         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7499         CYTHON_FALLTHROUGH;
7500         case  0: break;
7501         default: goto __pyx_L5_argtuple_error;
7502       }
7503       kw_args = PyDict_Size(__pyx_kwds);
7504       switch (pos_args) {
7505         case  0:
7506         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interp)) != 0)) kw_args--;
7507         else goto __pyx_L5_argtuple_error;
7508         CYTHON_FALLTHROUGH;
7509         case  1:
7510         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
7511         else {
7512           __Pyx_RaiseArgtupleInvalid("interp_t_pt", 1, 4, 4, 1); __PYX_ERR(0, 691, __pyx_L3_error)
7513         }
7514         CYTHON_FALLTHROUGH;
7515         case  2:
7516         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
7517         else {
7518           __Pyx_RaiseArgtupleInvalid("interp_t_pt", 1, 4, 4, 2); __PYX_ERR(0, 691, __pyx_L3_error)
7519         }
7520         CYTHON_FALLTHROUGH;
7521         case  3:
7522         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_2)) != 0)) kw_args--;
7523         else {
7524           __Pyx_RaiseArgtupleInvalid("interp_t_pt", 1, 4, 4, 3); __PYX_ERR(0, 691, __pyx_L3_error)
7525         }
7526       }
7527       if (unlikely(kw_args > 0)) {
7528         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "interp_t_pt") < 0)) __PYX_ERR(0, 691, __pyx_L3_error)
7529       }
7530     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
7531       goto __pyx_L5_argtuple_error;
7532     } else {
7533       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7534       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7535       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7536       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7537     }
7538     __pyx_v_interp = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)values[0]);
7539     __pyx_v_start = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
7540     __pyx_v_end = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
7541     __pyx_v_t = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
7542   }
7543   goto __pyx_L4_argument_unpacking_done;
7544   __pyx_L5_argtuple_error:;
7545   __Pyx_RaiseArgtupleInvalid("interp_t_pt", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 691, __pyx_L3_error)
7546   __pyx_L3_error:;
7547   __Pyx_AddTraceback("cartopy.trace._Testing.interp_t_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
7548   __Pyx_RefNannyFinishContext();
7549   return NULL;
7550   __pyx_L4_argument_unpacking_done:;
7551   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interp), __pyx_ptype_7cartopy_5trace_Interpolator, 1, "interp", 0))) __PYX_ERR(0, 691, __pyx_L1_error)
7552   __pyx_r = __pyx_pf_7cartopy_5trace_8_Testing_6interp_t_pt(__pyx_self, __pyx_v_interp, __pyx_v_start, __pyx_v_end, __pyx_v_t);
7553 
7554   /* function exit code */
7555   goto __pyx_L0;
7556   __pyx_L1_error:;
7557   __pyx_r = NULL;
7558   __pyx_L0:;
7559   __Pyx_RefNannyFinishContext();
7560   return __pyx_r;
7561 }
7562 
__pyx_pf_7cartopy_5trace_8_Testing_6interp_t_pt(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_7cartopy_5trace_Interpolator * __pyx_v_interp,__pyx_t_7cartopy_5trace_Point __pyx_v_start,__pyx_t_7cartopy_5trace_Point __pyx_v_end,double __pyx_v_t)7563 static PyObject *__pyx_pf_7cartopy_5trace_8_Testing_6interp_t_pt(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7cartopy_5trace_Interpolator *__pyx_v_interp, __pyx_t_7cartopy_5trace_Point __pyx_v_start, __pyx_t_7cartopy_5trace_Point __pyx_v_end, double __pyx_v_t) {
7564   PyObject *__pyx_r = NULL;
7565   __Pyx_RefNannyDeclarations
7566   PyObject *__pyx_t_1 = NULL;
7567   int __pyx_lineno = 0;
7568   const char *__pyx_filename = NULL;
7569   int __pyx_clineno = 0;
7570   __Pyx_RefNannySetupContext("interp_t_pt", 0);
7571 
7572   /* "cartopy/trace.pyx":692
7573  *     @staticmethod
7574  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):
7575  *         interp.set_line(start, end)             # <<<<<<<<<<<<<<
7576  *         return interp.interpolate(t)
7577  */
7578   ((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interp->__pyx_vtab)->set_line(__pyx_v_interp, __pyx_v_start, __pyx_v_end);
7579 
7580   /* "cartopy/trace.pyx":693
7581  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):
7582  *         interp.set_line(start, end)
7583  *         return interp.interpolate(t)             # <<<<<<<<<<<<<<
7584  */
7585   __Pyx_XDECREF(__pyx_r);
7586   __pyx_t_1 = __pyx_convert__to_py___pyx_t_7cartopy_5trace_Point(((struct __pyx_vtabstruct_7cartopy_5trace_Interpolator *)__pyx_v_interp->__pyx_vtab)->interpolate(__pyx_v_interp, __pyx_v_t)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
7587   __Pyx_GOTREF(__pyx_t_1);
7588   __pyx_r = __pyx_t_1;
7589   __pyx_t_1 = 0;
7590   goto __pyx_L0;
7591 
7592   /* "cartopy/trace.pyx":691
7593  *
7594  *     @staticmethod
7595  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):             # <<<<<<<<<<<<<<
7596  *         interp.set_line(start, end)
7597  *         return interp.interpolate(t)
7598  */
7599 
7600   /* function exit code */
7601   __pyx_L1_error:;
7602   __Pyx_XDECREF(__pyx_t_1);
7603   __Pyx_AddTraceback("cartopy.trace._Testing.interp_t_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
7604   __pyx_r = NULL;
7605   __pyx_L0:;
7606   __Pyx_XGIVEREF(__pyx_r);
7607   __Pyx_RefNannyFinishContext();
7608   return __pyx_r;
7609 }
7610 
7611 /* "(tree fragment)":1
7612  * def __pyx_unpickle_LineAccumulator(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
7613  *     cdef object __pyx_PickleError
7614  *     cdef object __pyx_result
7615  */
7616 
7617 /* Python wrapper */
7618 static PyObject *__pyx_pw_7cartopy_5trace_3__pyx_unpickle_LineAccumulator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7619 static char __pyx_doc_7cartopy_5trace_2__pyx_unpickle_LineAccumulator[] = "__pyx_unpickle_LineAccumulator(__pyx_type, long __pyx_checksum, __pyx_state)";
7620 static PyMethodDef __pyx_mdef_7cartopy_5trace_3__pyx_unpickle_LineAccumulator = {"__pyx_unpickle_LineAccumulator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7cartopy_5trace_3__pyx_unpickle_LineAccumulator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cartopy_5trace_2__pyx_unpickle_LineAccumulator};
__pyx_pw_7cartopy_5trace_3__pyx_unpickle_LineAccumulator(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7621 static PyObject *__pyx_pw_7cartopy_5trace_3__pyx_unpickle_LineAccumulator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7622   PyObject *__pyx_v___pyx_type = 0;
7623   long __pyx_v___pyx_checksum;
7624   PyObject *__pyx_v___pyx_state = 0;
7625   int __pyx_lineno = 0;
7626   const char *__pyx_filename = NULL;
7627   int __pyx_clineno = 0;
7628   PyObject *__pyx_r = 0;
7629   __Pyx_RefNannyDeclarations
7630   __Pyx_RefNannySetupContext("__pyx_unpickle_LineAccumulator (wrapper)", 0);
7631   {
7632     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
7633     PyObject* values[3] = {0,0,0};
7634     if (unlikely(__pyx_kwds)) {
7635       Py_ssize_t kw_args;
7636       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7637       switch (pos_args) {
7638         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7639         CYTHON_FALLTHROUGH;
7640         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7641         CYTHON_FALLTHROUGH;
7642         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7643         CYTHON_FALLTHROUGH;
7644         case  0: break;
7645         default: goto __pyx_L5_argtuple_error;
7646       }
7647       kw_args = PyDict_Size(__pyx_kwds);
7648       switch (pos_args) {
7649         case  0:
7650         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
7651         else goto __pyx_L5_argtuple_error;
7652         CYTHON_FALLTHROUGH;
7653         case  1:
7654         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
7655         else {
7656           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_LineAccumulator", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
7657         }
7658         CYTHON_FALLTHROUGH;
7659         case  2:
7660         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
7661         else {
7662           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_LineAccumulator", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
7663         }
7664       }
7665       if (unlikely(kw_args > 0)) {
7666         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_LineAccumulator") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
7667       }
7668     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7669       goto __pyx_L5_argtuple_error;
7670     } else {
7671       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7672       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7673       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7674     }
7675     __pyx_v___pyx_type = values[0];
7676     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
7677     __pyx_v___pyx_state = values[2];
7678   }
7679   goto __pyx_L4_argument_unpacking_done;
7680   __pyx_L5_argtuple_error:;
7681   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_LineAccumulator", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
7682   __pyx_L3_error:;
7683   __Pyx_AddTraceback("cartopy.trace.__pyx_unpickle_LineAccumulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
7684   __Pyx_RefNannyFinishContext();
7685   return NULL;
7686   __pyx_L4_argument_unpacking_done:;
7687   __pyx_r = __pyx_pf_7cartopy_5trace_2__pyx_unpickle_LineAccumulator(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
7688 
7689   /* function exit code */
7690   __Pyx_RefNannyFinishContext();
7691   return __pyx_r;
7692 }
7693 
__pyx_pf_7cartopy_5trace_2__pyx_unpickle_LineAccumulator(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)7694 static PyObject *__pyx_pf_7cartopy_5trace_2__pyx_unpickle_LineAccumulator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
7695   PyObject *__pyx_v___pyx_PickleError = 0;
7696   PyObject *__pyx_v___pyx_result = 0;
7697   PyObject *__pyx_r = NULL;
7698   __Pyx_RefNannyDeclarations
7699   int __pyx_t_1;
7700   PyObject *__pyx_t_2 = NULL;
7701   PyObject *__pyx_t_3 = NULL;
7702   PyObject *__pyx_t_4 = NULL;
7703   PyObject *__pyx_t_5 = NULL;
7704   int __pyx_t_6;
7705   int __pyx_lineno = 0;
7706   const char *__pyx_filename = NULL;
7707   int __pyx_clineno = 0;
7708   __Pyx_RefNannySetupContext("__pyx_unpickle_LineAccumulator", 0);
7709 
7710   /* "(tree fragment)":4
7711  *     cdef object __pyx_PickleError
7712  *     cdef object __pyx_result
7713  *     if __pyx_checksum != 0x980da98:             # <<<<<<<<<<<<<<
7714  *         from pickle import PickleError as __pyx_PickleError
7715  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7716  */
7717   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x980da98) != 0);
7718   if (__pyx_t_1) {
7719 
7720     /* "(tree fragment)":5
7721  *     cdef object __pyx_result
7722  *     if __pyx_checksum != 0x980da98:
7723  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
7724  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7725  *     __pyx_result = LineAccumulator.__new__(__pyx_type)
7726  */
7727     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
7728     __Pyx_GOTREF(__pyx_t_2);
7729     __Pyx_INCREF(__pyx_n_s_PickleError);
7730     __Pyx_GIVEREF(__pyx_n_s_PickleError);
7731     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
7732     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
7733     __Pyx_GOTREF(__pyx_t_3);
7734     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7735     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
7736     __Pyx_GOTREF(__pyx_t_2);
7737     __Pyx_INCREF(__pyx_t_2);
7738     __pyx_v___pyx_PickleError = __pyx_t_2;
7739     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7740     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7741 
7742     /* "(tree fragment)":6
7743  *     if __pyx_checksum != 0x980da98:
7744  *         from pickle import PickleError as __pyx_PickleError
7745  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)             # <<<<<<<<<<<<<<
7746  *     __pyx_result = LineAccumulator.__new__(__pyx_type)
7747  *     if __pyx_state is not None:
7748  */
7749     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
7750     __Pyx_GOTREF(__pyx_t_2);
7751     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x98, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
7752     __Pyx_GOTREF(__pyx_t_4);
7753     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7754     __Pyx_INCREF(__pyx_v___pyx_PickleError);
7755     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
7756     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7757       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
7758       if (likely(__pyx_t_5)) {
7759         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7760         __Pyx_INCREF(__pyx_t_5);
7761         __Pyx_INCREF(function);
7762         __Pyx_DECREF_SET(__pyx_t_2, function);
7763       }
7764     }
7765     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
7766     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7767     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7768     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
7769     __Pyx_GOTREF(__pyx_t_3);
7770     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7771     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7772     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7773     __PYX_ERR(1, 6, __pyx_L1_error)
7774 
7775     /* "(tree fragment)":4
7776  *     cdef object __pyx_PickleError
7777  *     cdef object __pyx_result
7778  *     if __pyx_checksum != 0x980da98:             # <<<<<<<<<<<<<<
7779  *         from pickle import PickleError as __pyx_PickleError
7780  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7781  */
7782   }
7783 
7784   /* "(tree fragment)":7
7785  *         from pickle import PickleError as __pyx_PickleError
7786  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7787  *     __pyx_result = LineAccumulator.__new__(__pyx_type)             # <<<<<<<<<<<<<<
7788  *     if __pyx_state is not None:
7789  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7790  */
7791   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_7cartopy_5trace_LineAccumulator), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
7792   __Pyx_GOTREF(__pyx_t_2);
7793   __pyx_t_4 = NULL;
7794   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7795     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
7796     if (likely(__pyx_t_4)) {
7797       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7798       __Pyx_INCREF(__pyx_t_4);
7799       __Pyx_INCREF(function);
7800       __Pyx_DECREF_SET(__pyx_t_2, function);
7801     }
7802   }
7803   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
7804   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7805   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
7806   __Pyx_GOTREF(__pyx_t_3);
7807   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7808   __pyx_v___pyx_result = __pyx_t_3;
7809   __pyx_t_3 = 0;
7810 
7811   /* "(tree fragment)":8
7812  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7813  *     __pyx_result = LineAccumulator.__new__(__pyx_type)
7814  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
7815  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7816  *     return __pyx_result
7817  */
7818   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
7819   __pyx_t_6 = (__pyx_t_1 != 0);
7820   if (__pyx_t_6) {
7821 
7822     /* "(tree fragment)":9
7823  *     __pyx_result = LineAccumulator.__new__(__pyx_type)
7824  *     if __pyx_state is not None:
7825  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
7826  *     return __pyx_result
7827  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):
7828  */
7829     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
7830     __pyx_t_3 = __pyx_f_7cartopy_5trace___pyx_unpickle_LineAccumulator__set_state(((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
7831     __Pyx_GOTREF(__pyx_t_3);
7832     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7833 
7834     /* "(tree fragment)":8
7835  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x980da98 = (lines))" % __pyx_checksum)
7836  *     __pyx_result = LineAccumulator.__new__(__pyx_type)
7837  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
7838  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7839  *     return __pyx_result
7840  */
7841   }
7842 
7843   /* "(tree fragment)":10
7844  *     if __pyx_state is not None:
7845  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7846  *     return __pyx_result             # <<<<<<<<<<<<<<
7847  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):
7848  *     __pyx_result.lines = __pyx_state[0]
7849  */
7850   __Pyx_XDECREF(__pyx_r);
7851   __Pyx_INCREF(__pyx_v___pyx_result);
7852   __pyx_r = __pyx_v___pyx_result;
7853   goto __pyx_L0;
7854 
7855   /* "(tree fragment)":1
7856  * def __pyx_unpickle_LineAccumulator(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
7857  *     cdef object __pyx_PickleError
7858  *     cdef object __pyx_result
7859  */
7860 
7861   /* function exit code */
7862   __pyx_L1_error:;
7863   __Pyx_XDECREF(__pyx_t_2);
7864   __Pyx_XDECREF(__pyx_t_3);
7865   __Pyx_XDECREF(__pyx_t_4);
7866   __Pyx_XDECREF(__pyx_t_5);
7867   __Pyx_AddTraceback("cartopy.trace.__pyx_unpickle_LineAccumulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
7868   __pyx_r = NULL;
7869   __pyx_L0:;
7870   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
7871   __Pyx_XDECREF(__pyx_v___pyx_result);
7872   __Pyx_XGIVEREF(__pyx_r);
7873   __Pyx_RefNannyFinishContext();
7874   return __pyx_r;
7875 }
7876 
7877 /* "(tree fragment)":11
7878  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7879  *     return __pyx_result
7880  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
7881  *     __pyx_result.lines = __pyx_state[0]
7882  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
7883  */
7884 
__pyx_f_7cartopy_5trace___pyx_unpickle_LineAccumulator__set_state(struct __pyx_obj_7cartopy_5trace_LineAccumulator * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)7885 static PyObject *__pyx_f_7cartopy_5trace___pyx_unpickle_LineAccumulator__set_state(struct __pyx_obj_7cartopy_5trace_LineAccumulator *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
7886   PyObject *__pyx_r = NULL;
7887   __Pyx_RefNannyDeclarations
7888   PyObject *__pyx_t_1 = NULL;
7889   std::list<__pyx_t_7cartopy_5trace_Line>  __pyx_t_2;
7890   int __pyx_t_3;
7891   Py_ssize_t __pyx_t_4;
7892   int __pyx_t_5;
7893   int __pyx_t_6;
7894   PyObject *__pyx_t_7 = NULL;
7895   PyObject *__pyx_t_8 = NULL;
7896   PyObject *__pyx_t_9 = NULL;
7897   int __pyx_lineno = 0;
7898   const char *__pyx_filename = NULL;
7899   int __pyx_clineno = 0;
7900   __Pyx_RefNannySetupContext("__pyx_unpickle_LineAccumulator__set_state", 0);
7901 
7902   /* "(tree fragment)":12
7903  *     return __pyx_result
7904  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):
7905  *     __pyx_result.lines = __pyx_state[0]             # <<<<<<<<<<<<<<
7906  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
7907  *         __pyx_result.__dict__.update(__pyx_state[1])
7908  */
7909   if (unlikely(__pyx_v___pyx_state == Py_None)) {
7910     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7911     __PYX_ERR(1, 12, __pyx_L1_error)
7912   }
7913   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
7914   __Pyx_GOTREF(__pyx_t_1);
7915   __pyx_t_2 = __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
7916   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7917   __pyx_v___pyx_result->lines = __pyx_t_2;
7918 
7919   /* "(tree fragment)":13
7920  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):
7921  *     __pyx_result.lines = __pyx_state[0]
7922  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
7923  *         __pyx_result.__dict__.update(__pyx_state[1])
7924  */
7925   if (unlikely(__pyx_v___pyx_state == Py_None)) {
7926     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
7927     __PYX_ERR(1, 13, __pyx_L1_error)
7928   }
7929   __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
7930   __pyx_t_5 = ((__pyx_t_4 > 1) != 0);
7931   if (__pyx_t_5) {
7932   } else {
7933     __pyx_t_3 = __pyx_t_5;
7934     goto __pyx_L4_bool_binop_done;
7935   }
7936   __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
7937   __pyx_t_6 = (__pyx_t_5 != 0);
7938   __pyx_t_3 = __pyx_t_6;
7939   __pyx_L4_bool_binop_done:;
7940   if (__pyx_t_3) {
7941 
7942     /* "(tree fragment)":14
7943  *     __pyx_result.lines = __pyx_state[0]
7944  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
7945  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
7946  */
7947     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
7948     __Pyx_GOTREF(__pyx_t_7);
7949     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
7950     __Pyx_GOTREF(__pyx_t_8);
7951     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7952     if (unlikely(__pyx_v___pyx_state == Py_None)) {
7953       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7954       __PYX_ERR(1, 14, __pyx_L1_error)
7955     }
7956     __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
7957     __Pyx_GOTREF(__pyx_t_7);
7958     __pyx_t_9 = NULL;
7959     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
7960       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
7961       if (likely(__pyx_t_9)) {
7962         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
7963         __Pyx_INCREF(__pyx_t_9);
7964         __Pyx_INCREF(function);
7965         __Pyx_DECREF_SET(__pyx_t_8, function);
7966       }
7967     }
7968     __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
7969     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7970     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7971     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
7972     __Pyx_GOTREF(__pyx_t_1);
7973     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7974     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7975 
7976     /* "(tree fragment)":13
7977  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):
7978  *     __pyx_result.lines = __pyx_state[0]
7979  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
7980  *         __pyx_result.__dict__.update(__pyx_state[1])
7981  */
7982   }
7983 
7984   /* "(tree fragment)":11
7985  *         __pyx_unpickle_LineAccumulator__set_state(<LineAccumulator> __pyx_result, __pyx_state)
7986  *     return __pyx_result
7987  * cdef __pyx_unpickle_LineAccumulator__set_state(LineAccumulator __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
7988  *     __pyx_result.lines = __pyx_state[0]
7989  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
7990  */
7991 
7992   /* function exit code */
7993   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7994   goto __pyx_L0;
7995   __pyx_L1_error:;
7996   __Pyx_XDECREF(__pyx_t_1);
7997   __Pyx_XDECREF(__pyx_t_7);
7998   __Pyx_XDECREF(__pyx_t_8);
7999   __Pyx_XDECREF(__pyx_t_9);
8000   __Pyx_AddTraceback("cartopy.trace.__pyx_unpickle_LineAccumulator__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
8001   __pyx_r = 0;
8002   __pyx_L0:;
8003   __Pyx_XGIVEREF(__pyx_r);
8004   __Pyx_RefNannyFinishContext();
8005   return __pyx_r;
8006 }
8007 
8008 /* "list.to_py":92
8009  *
8010  * @cname("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point")
8011  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(const cpp_list[X]& v):             # <<<<<<<<<<<<<<
8012  *     o = []
8013  *     cdef cpp_list[X].const_iterator iter = v.begin()
8014  */
8015 
__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(std::list<__pyx_t_7cartopy_5trace_Point> const & __pyx_v_v)8016 static PyObject *__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(std::list<__pyx_t_7cartopy_5trace_Point>  const &__pyx_v_v) {
8017   PyObject *__pyx_v_o = NULL;
8018   std::list<__pyx_t_7cartopy_5trace_Point> ::const_iterator __pyx_v_iter;
8019   PyObject *__pyx_r = NULL;
8020   __Pyx_RefNannyDeclarations
8021   PyObject *__pyx_t_1 = NULL;
8022   int __pyx_t_2;
8023   int __pyx_t_3;
8024   int __pyx_lineno = 0;
8025   const char *__pyx_filename = NULL;
8026   int __pyx_clineno = 0;
8027   __Pyx_RefNannySetupContext("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point", 0);
8028 
8029   /* "list.to_py":93
8030  * @cname("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point")
8031  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(const cpp_list[X]& v):
8032  *     o = []             # <<<<<<<<<<<<<<
8033  *     cdef cpp_list[X].const_iterator iter = v.begin()
8034  *     while iter != v.end():
8035  */
8036   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 93, __pyx_L1_error)
8037   __Pyx_GOTREF(__pyx_t_1);
8038   __pyx_v_o = ((PyObject*)__pyx_t_1);
8039   __pyx_t_1 = 0;
8040 
8041   /* "list.to_py":94
8042  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(const cpp_list[X]& v):
8043  *     o = []
8044  *     cdef cpp_list[X].const_iterator iter = v.begin()             # <<<<<<<<<<<<<<
8045  *     while iter != v.end():
8046  *         o.append(cython.operator.dereference(iter))
8047  */
8048   __pyx_v_iter = __pyx_v_v.begin();
8049 
8050   /* "list.to_py":95
8051  *     o = []
8052  *     cdef cpp_list[X].const_iterator iter = v.begin()
8053  *     while iter != v.end():             # <<<<<<<<<<<<<<
8054  *         o.append(cython.operator.dereference(iter))
8055  *         cython.operator.preincrement(iter)
8056  */
8057   while (1) {
8058     __pyx_t_2 = ((__pyx_v_iter != __pyx_v_v.end()) != 0);
8059     if (!__pyx_t_2) break;
8060 
8061     /* "list.to_py":96
8062  *     cdef cpp_list[X].const_iterator iter = v.begin()
8063  *     while iter != v.end():
8064  *         o.append(cython.operator.dereference(iter))             # <<<<<<<<<<<<<<
8065  *         cython.operator.preincrement(iter)
8066  *     return o
8067  */
8068     __pyx_t_1 = __pyx_convert__to_py___pyx_t_7cartopy_5trace_Point((*__pyx_v_iter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error)
8069     __Pyx_GOTREF(__pyx_t_1);
8070     __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_o, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 96, __pyx_L1_error)
8071     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8072 
8073     /* "list.to_py":97
8074  *     while iter != v.end():
8075  *         o.append(cython.operator.dereference(iter))
8076  *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
8077  *     return o
8078  *
8079  */
8080     (void)((++__pyx_v_iter));
8081   }
8082 
8083   /* "list.to_py":98
8084  *         o.append(cython.operator.dereference(iter))
8085  *         cython.operator.preincrement(iter)
8086  *     return o             # <<<<<<<<<<<<<<
8087  *
8088  *
8089  */
8090   __Pyx_XDECREF(__pyx_r);
8091   __Pyx_INCREF(__pyx_v_o);
8092   __pyx_r = __pyx_v_o;
8093   goto __pyx_L0;
8094 
8095   /* "list.to_py":92
8096  *
8097  * @cname("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point")
8098  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point(const cpp_list[X]& v):             # <<<<<<<<<<<<<<
8099  *     o = []
8100  *     cdef cpp_list[X].const_iterator iter = v.begin()
8101  */
8102 
8103   /* function exit code */
8104   __pyx_L1_error:;
8105   __Pyx_XDECREF(__pyx_t_1);
8106   __Pyx_AddTraceback("list.to_py.__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point", __pyx_clineno, __pyx_lineno, __pyx_filename);
8107   __pyx_r = 0;
8108   __pyx_L0:;
8109   __Pyx_XDECREF(__pyx_v_o);
8110   __Pyx_XGIVEREF(__pyx_r);
8111   __Pyx_RefNannyFinishContext();
8112   return __pyx_r;
8113 }
8114 
__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(std::list<__pyx_t_7cartopy_5trace_Line> const & __pyx_v_v)8115 static PyObject *__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(std::list<__pyx_t_7cartopy_5trace_Line>  const &__pyx_v_v) {
8116   PyObject *__pyx_v_o = NULL;
8117   std::list<__pyx_t_7cartopy_5trace_Line> ::const_iterator __pyx_v_iter;
8118   PyObject *__pyx_r = NULL;
8119   __Pyx_RefNannyDeclarations
8120   PyObject *__pyx_t_1 = NULL;
8121   int __pyx_t_2;
8122   int __pyx_t_3;
8123   int __pyx_lineno = 0;
8124   const char *__pyx_filename = NULL;
8125   int __pyx_clineno = 0;
8126   __Pyx_RefNannySetupContext("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line", 0);
8127 
8128   /* "list.to_py":93
8129  * @cname("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line")
8130  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(const cpp_list[X]& v):
8131  *     o = []             # <<<<<<<<<<<<<<
8132  *     cdef cpp_list[X].const_iterator iter = v.begin()
8133  *     while iter != v.end():
8134  */
8135   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 93, __pyx_L1_error)
8136   __Pyx_GOTREF(__pyx_t_1);
8137   __pyx_v_o = ((PyObject*)__pyx_t_1);
8138   __pyx_t_1 = 0;
8139 
8140   /* "list.to_py":94
8141  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(const cpp_list[X]& v):
8142  *     o = []
8143  *     cdef cpp_list[X].const_iterator iter = v.begin()             # <<<<<<<<<<<<<<
8144  *     while iter != v.end():
8145  *         o.append(cython.operator.dereference(iter))
8146  */
8147   __pyx_v_iter = __pyx_v_v.begin();
8148 
8149   /* "list.to_py":95
8150  *     o = []
8151  *     cdef cpp_list[X].const_iterator iter = v.begin()
8152  *     while iter != v.end():             # <<<<<<<<<<<<<<
8153  *         o.append(cython.operator.dereference(iter))
8154  *         cython.operator.preincrement(iter)
8155  */
8156   while (1) {
8157     __pyx_t_2 = ((__pyx_v_iter != __pyx_v_v.end()) != 0);
8158     if (!__pyx_t_2) break;
8159 
8160     /* "list.to_py":96
8161  *     cdef cpp_list[X].const_iterator iter = v.begin()
8162  *     while iter != v.end():
8163  *         o.append(cython.operator.dereference(iter))             # <<<<<<<<<<<<<<
8164  *         cython.operator.preincrement(iter)
8165  *     return o
8166  */
8167     __pyx_t_1 = __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Point((*__pyx_v_iter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error)
8168     __Pyx_GOTREF(__pyx_t_1);
8169     __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_o, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 96, __pyx_L1_error)
8170     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8171 
8172     /* "list.to_py":97
8173  *     while iter != v.end():
8174  *         o.append(cython.operator.dereference(iter))
8175  *         cython.operator.preincrement(iter)             # <<<<<<<<<<<<<<
8176  *     return o
8177  *
8178  */
8179     (void)((++__pyx_v_iter));
8180   }
8181 
8182   /* "list.to_py":98
8183  *         o.append(cython.operator.dereference(iter))
8184  *         cython.operator.preincrement(iter)
8185  *     return o             # <<<<<<<<<<<<<<
8186  *
8187  *
8188  */
8189   __Pyx_XDECREF(__pyx_r);
8190   __Pyx_INCREF(__pyx_v_o);
8191   __pyx_r = __pyx_v_o;
8192   goto __pyx_L0;
8193 
8194   /* "list.to_py":92
8195  *
8196  * @cname("__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line")
8197  * cdef object __pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line(const cpp_list[X]& v):             # <<<<<<<<<<<<<<
8198  *     o = []
8199  *     cdef cpp_list[X].const_iterator iter = v.begin()
8200  */
8201 
8202   /* function exit code */
8203   __pyx_L1_error:;
8204   __Pyx_XDECREF(__pyx_t_1);
8205   __Pyx_AddTraceback("list.to_py.__pyx_convert_list_to_py___pyx_t_7cartopy_5trace_Line", __pyx_clineno, __pyx_lineno, __pyx_filename);
8206   __pyx_r = 0;
8207   __pyx_L0:;
8208   __Pyx_XDECREF(__pyx_v_o);
8209   __Pyx_XGIVEREF(__pyx_r);
8210   __Pyx_RefNannyFinishContext();
8211   return __pyx_r;
8212 }
8213 
8214 /* "FromPyStructUtility":11
8215  *
8216  * @cname("__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point")
8217  * cdef struct_type __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(obj) except *:             # <<<<<<<<<<<<<<
8218  *     cdef struct_type result
8219  *     if not PyMapping_Check(obj):
8220  */
8221 
__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(PyObject * __pyx_v_obj)8222 static __pyx_t_7cartopy_5trace_Point __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(PyObject *__pyx_v_obj) {
8223   __pyx_t_7cartopy_5trace_Point __pyx_v_result;
8224   PyObject *__pyx_v_value = NULL;
8225   __pyx_t_7cartopy_5trace_Point __pyx_r;
8226   __Pyx_RefNannyDeclarations
8227   int __pyx_t_1;
8228   PyObject *__pyx_t_2 = NULL;
8229   PyObject *__pyx_t_3 = NULL;
8230   PyObject *__pyx_t_4 = NULL;
8231   PyObject *__pyx_t_5 = NULL;
8232   int __pyx_t_6;
8233   PyObject *__pyx_t_7 = NULL;
8234   PyObject *__pyx_t_8 = NULL;
8235   PyObject *__pyx_t_9 = NULL;
8236   double __pyx_t_10;
8237   int __pyx_lineno = 0;
8238   const char *__pyx_filename = NULL;
8239   int __pyx_clineno = 0;
8240   __Pyx_RefNannySetupContext("__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point", 0);
8241 
8242   /* "FromPyStructUtility":13
8243  * cdef struct_type __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(obj) except *:
8244  *     cdef struct_type result
8245  *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
8246  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
8247  *
8248  */
8249   __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0);
8250   if (__pyx_t_1) {
8251 
8252     /* "FromPyStructUtility":14
8253  *     cdef struct_type result
8254  *     if not PyMapping_Check(obj):
8255  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)             # <<<<<<<<<<<<<<
8256  *
8257  *     try:
8258  */
8259     __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 14, __pyx_L1_error)
8260     __Pyx_GOTREF(__pyx_t_2);
8261     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8262 
8263     /* "FromPyStructUtility":13
8264  * cdef struct_type __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(obj) except *:
8265  *     cdef struct_type result
8266  *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
8267  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
8268  *
8269  */
8270   }
8271 
8272   /* "FromPyStructUtility":16
8273  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
8274  *
8275  *     try:             # <<<<<<<<<<<<<<
8276  *         value = obj['x']
8277  *     except KeyError:
8278  */
8279   {
8280     __Pyx_PyThreadState_declare
8281     __Pyx_PyThreadState_assign
8282     __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
8283     __Pyx_XGOTREF(__pyx_t_3);
8284     __Pyx_XGOTREF(__pyx_t_4);
8285     __Pyx_XGOTREF(__pyx_t_5);
8286     /*try:*/ {
8287 
8288       /* "FromPyStructUtility":17
8289  *
8290  *     try:
8291  *         value = obj['x']             # <<<<<<<<<<<<<<
8292  *     except KeyError:
8293  *         raise ValueError("No value specified for struct attribute 'x'")
8294  */
8295       __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L4_error)
8296       __Pyx_GOTREF(__pyx_t_2);
8297       __pyx_v_value = __pyx_t_2;
8298       __pyx_t_2 = 0;
8299 
8300       /* "FromPyStructUtility":16
8301  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
8302  *
8303  *     try:             # <<<<<<<<<<<<<<
8304  *         value = obj['x']
8305  *     except KeyError:
8306  */
8307     }
8308     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8309     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8310     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8311     goto __pyx_L9_try_end;
8312     __pyx_L4_error:;
8313     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8314 
8315     /* "FromPyStructUtility":18
8316  *     try:
8317  *         value = obj['x']
8318  *     except KeyError:             # <<<<<<<<<<<<<<
8319  *         raise ValueError("No value specified for struct attribute 'x'")
8320  *     result.x = value
8321  */
8322     __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
8323     if (__pyx_t_6) {
8324       __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point", __pyx_clineno, __pyx_lineno, __pyx_filename);
8325       if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 18, __pyx_L6_except_error)
8326       __Pyx_GOTREF(__pyx_t_2);
8327       __Pyx_GOTREF(__pyx_t_7);
8328       __Pyx_GOTREF(__pyx_t_8);
8329 
8330       /* "FromPyStructUtility":19
8331  *         value = obj['x']
8332  *     except KeyError:
8333  *         raise ValueError("No value specified for struct attribute 'x'")             # <<<<<<<<<<<<<<
8334  *     result.x = value
8335  *     try:
8336  */
8337       __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error)
8338       __Pyx_GOTREF(__pyx_t_9);
8339       __Pyx_Raise(__pyx_t_9, 0, 0, 0);
8340       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
8341       __PYX_ERR(1, 19, __pyx_L6_except_error)
8342     }
8343     goto __pyx_L6_except_error;
8344     __pyx_L6_except_error:;
8345 
8346     /* "FromPyStructUtility":16
8347  *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
8348  *
8349  *     try:             # <<<<<<<<<<<<<<
8350  *         value = obj['x']
8351  *     except KeyError:
8352  */
8353     __Pyx_XGIVEREF(__pyx_t_3);
8354     __Pyx_XGIVEREF(__pyx_t_4);
8355     __Pyx_XGIVEREF(__pyx_t_5);
8356     __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
8357     goto __pyx_L1_error;
8358     __pyx_L9_try_end:;
8359   }
8360 
8361   /* "FromPyStructUtility":20
8362  *     except KeyError:
8363  *         raise ValueError("No value specified for struct attribute 'x'")
8364  *     result.x = value             # <<<<<<<<<<<<<<
8365  *     try:
8366  *         value = obj['y']
8367  */
8368   __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error)
8369   __pyx_v_result.x = __pyx_t_10;
8370 
8371   /* "FromPyStructUtility":21
8372  *         raise ValueError("No value specified for struct attribute 'x'")
8373  *     result.x = value
8374  *     try:             # <<<<<<<<<<<<<<
8375  *         value = obj['y']
8376  *     except KeyError:
8377  */
8378   {
8379     __Pyx_PyThreadState_declare
8380     __Pyx_PyThreadState_assign
8381     __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
8382     __Pyx_XGOTREF(__pyx_t_5);
8383     __Pyx_XGOTREF(__pyx_t_4);
8384     __Pyx_XGOTREF(__pyx_t_3);
8385     /*try:*/ {
8386 
8387       /* "FromPyStructUtility":22
8388  *     result.x = value
8389  *     try:
8390  *         value = obj['y']             # <<<<<<<<<<<<<<
8391  *     except KeyError:
8392  *         raise ValueError("No value specified for struct attribute 'y'")
8393  */
8394       __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_y); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error)
8395       __Pyx_GOTREF(__pyx_t_8);
8396       __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
8397       __pyx_t_8 = 0;
8398 
8399       /* "FromPyStructUtility":21
8400  *         raise ValueError("No value specified for struct attribute 'x'")
8401  *     result.x = value
8402  *     try:             # <<<<<<<<<<<<<<
8403  *         value = obj['y']
8404  *     except KeyError:
8405  */
8406     }
8407     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8408     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8409     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8410     goto __pyx_L17_try_end;
8411     __pyx_L12_error:;
8412     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8413     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8414     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8415     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
8416 
8417     /* "FromPyStructUtility":23
8418  *     try:
8419  *         value = obj['y']
8420  *     except KeyError:             # <<<<<<<<<<<<<<
8421  *         raise ValueError("No value specified for struct attribute 'y'")
8422  *     result.y = value
8423  */
8424     __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
8425     if (__pyx_t_6) {
8426       __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point", __pyx_clineno, __pyx_lineno, __pyx_filename);
8427       if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 23, __pyx_L14_except_error)
8428       __Pyx_GOTREF(__pyx_t_8);
8429       __Pyx_GOTREF(__pyx_t_7);
8430       __Pyx_GOTREF(__pyx_t_2);
8431 
8432       /* "FromPyStructUtility":24
8433  *         value = obj['y']
8434  *     except KeyError:
8435  *         raise ValueError("No value specified for struct attribute 'y'")             # <<<<<<<<<<<<<<
8436  *     result.y = value
8437  *     return result
8438  */
8439       __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error)
8440       __Pyx_GOTREF(__pyx_t_9);
8441       __Pyx_Raise(__pyx_t_9, 0, 0, 0);
8442       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
8443       __PYX_ERR(1, 24, __pyx_L14_except_error)
8444     }
8445     goto __pyx_L14_except_error;
8446     __pyx_L14_except_error:;
8447 
8448     /* "FromPyStructUtility":21
8449  *         raise ValueError("No value specified for struct attribute 'x'")
8450  *     result.x = value
8451  *     try:             # <<<<<<<<<<<<<<
8452  *         value = obj['y']
8453  *     except KeyError:
8454  */
8455     __Pyx_XGIVEREF(__pyx_t_5);
8456     __Pyx_XGIVEREF(__pyx_t_4);
8457     __Pyx_XGIVEREF(__pyx_t_3);
8458     __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
8459     goto __pyx_L1_error;
8460     __pyx_L17_try_end:;
8461   }
8462 
8463   /* "FromPyStructUtility":25
8464  *     except KeyError:
8465  *         raise ValueError("No value specified for struct attribute 'y'")
8466  *     result.y = value             # <<<<<<<<<<<<<<
8467  *     return result
8468  *
8469  */
8470   __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error)
8471   __pyx_v_result.y = __pyx_t_10;
8472 
8473   /* "FromPyStructUtility":26
8474  *         raise ValueError("No value specified for struct attribute 'y'")
8475  *     result.y = value
8476  *     return result             # <<<<<<<<<<<<<<
8477  *
8478  *
8479  */
8480   __pyx_r = __pyx_v_result;
8481   goto __pyx_L0;
8482 
8483   /* "FromPyStructUtility":11
8484  *
8485  * @cname("__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point")
8486  * cdef struct_type __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(obj) except *:             # <<<<<<<<<<<<<<
8487  *     cdef struct_type result
8488  *     if not PyMapping_Check(obj):
8489  */
8490 
8491   /* function exit code */
8492   __pyx_L1_error:;
8493   __Pyx_XDECREF(__pyx_t_2);
8494   __Pyx_XDECREF(__pyx_t_7);
8495   __Pyx_XDECREF(__pyx_t_8);
8496   __Pyx_XDECREF(__pyx_t_9);
8497   __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py___pyx_t_7cartopy_5trace_Point", __pyx_clineno, __pyx_lineno, __pyx_filename);
8498   __Pyx_pretend_to_initialize(&__pyx_r);
8499   __pyx_L0:;
8500   __Pyx_XDECREF(__pyx_v_value);
8501   __Pyx_RefNannyFinishContext();
8502   return __pyx_r;
8503 }
8504 
8505 /* "list.from_py":71
8506  *
8507  * @cname("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point")
8508  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(object o) except *:             # <<<<<<<<<<<<<<
8509  *     cdef cpp_list[X] l
8510  *     for item in o:
8511  */
8512 
__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(PyObject * __pyx_v_o)8513 static std::list<__pyx_t_7cartopy_5trace_Point>  __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(PyObject *__pyx_v_o) {
8514   std::list<__pyx_t_7cartopy_5trace_Point>  __pyx_v_l;
8515   PyObject *__pyx_v_item = NULL;
8516   std::list<__pyx_t_7cartopy_5trace_Point>  __pyx_r;
8517   __Pyx_RefNannyDeclarations
8518   PyObject *__pyx_t_1 = NULL;
8519   Py_ssize_t __pyx_t_2;
8520   PyObject *(*__pyx_t_3)(PyObject *);
8521   PyObject *__pyx_t_4 = NULL;
8522   __pyx_t_7cartopy_5trace_Point __pyx_t_5;
8523   int __pyx_lineno = 0;
8524   const char *__pyx_filename = NULL;
8525   int __pyx_clineno = 0;
8526   __Pyx_RefNannySetupContext("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point", 0);
8527 
8528   /* "list.from_py":73
8529  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(object o) except *:
8530  *     cdef cpp_list[X] l
8531  *     for item in o:             # <<<<<<<<<<<<<<
8532  *         l.push_back(<X>item)
8533  *     return l
8534  */
8535   if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
8536     __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8537     __pyx_t_3 = NULL;
8538   } else {
8539     __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 73, __pyx_L1_error)
8540     __Pyx_GOTREF(__pyx_t_1);
8541     __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 73, __pyx_L1_error)
8542   }
8543   for (;;) {
8544     if (likely(!__pyx_t_3)) {
8545       if (likely(PyList_CheckExact(__pyx_t_1))) {
8546         if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
8547         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8548         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 73, __pyx_L1_error)
8549         #else
8550         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 73, __pyx_L1_error)
8551         __Pyx_GOTREF(__pyx_t_4);
8552         #endif
8553       } else {
8554         if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8555         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8556         __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 73, __pyx_L1_error)
8557         #else
8558         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 73, __pyx_L1_error)
8559         __Pyx_GOTREF(__pyx_t_4);
8560         #endif
8561       }
8562     } else {
8563       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
8564       if (unlikely(!__pyx_t_4)) {
8565         PyObject* exc_type = PyErr_Occurred();
8566         if (exc_type) {
8567           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8568           else __PYX_ERR(1, 73, __pyx_L1_error)
8569         }
8570         break;
8571       }
8572       __Pyx_GOTREF(__pyx_t_4);
8573     }
8574     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
8575     __pyx_t_4 = 0;
8576 
8577     /* "list.from_py":74
8578  *     cdef cpp_list[X] l
8579  *     for item in o:
8580  *         l.push_back(<X>item)             # <<<<<<<<<<<<<<
8581  *     return l
8582  *
8583  */
8584     __pyx_t_5 = __pyx_convert__from_py___pyx_t_7cartopy_5trace_Point(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 74, __pyx_L1_error)
8585     __pyx_v_l.push_back(__pyx_t_5);
8586 
8587     /* "list.from_py":73
8588  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(object o) except *:
8589  *     cdef cpp_list[X] l
8590  *     for item in o:             # <<<<<<<<<<<<<<
8591  *         l.push_back(<X>item)
8592  *     return l
8593  */
8594   }
8595   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8596 
8597   /* "list.from_py":75
8598  *     for item in o:
8599  *         l.push_back(<X>item)
8600  *     return l             # <<<<<<<<<<<<<<
8601  *
8602  *
8603  */
8604   __pyx_r = __pyx_v_l;
8605   goto __pyx_L0;
8606 
8607   /* "list.from_py":71
8608  *
8609  * @cname("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point")
8610  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(object o) except *:             # <<<<<<<<<<<<<<
8611  *     cdef cpp_list[X] l
8612  *     for item in o:
8613  */
8614 
8615   /* function exit code */
8616   __pyx_L1_error:;
8617   __Pyx_XDECREF(__pyx_t_1);
8618   __Pyx_XDECREF(__pyx_t_4);
8619   __Pyx_AddTraceback("list.from_py.__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point", __pyx_clineno, __pyx_lineno, __pyx_filename);
8620   __Pyx_pretend_to_initialize(&__pyx_r);
8621   __pyx_L0:;
8622   __Pyx_XDECREF(__pyx_v_item);
8623   __Pyx_RefNannyFinishContext();
8624   return __pyx_r;
8625 }
8626 
__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(PyObject * __pyx_v_o)8627 static std::list<__pyx_t_7cartopy_5trace_Line>  __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(PyObject *__pyx_v_o) {
8628   std::list<__pyx_t_7cartopy_5trace_Line>  __pyx_v_l;
8629   PyObject *__pyx_v_item = NULL;
8630   std::list<__pyx_t_7cartopy_5trace_Line>  __pyx_r;
8631   __Pyx_RefNannyDeclarations
8632   PyObject *__pyx_t_1 = NULL;
8633   Py_ssize_t __pyx_t_2;
8634   PyObject *(*__pyx_t_3)(PyObject *);
8635   PyObject *__pyx_t_4 = NULL;
8636   __pyx_t_7cartopy_5trace_Line __pyx_t_5;
8637   int __pyx_lineno = 0;
8638   const char *__pyx_filename = NULL;
8639   int __pyx_clineno = 0;
8640   __Pyx_RefNannySetupContext("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line", 0);
8641 
8642   /* "list.from_py":73
8643  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(object o) except *:
8644  *     cdef cpp_list[X] l
8645  *     for item in o:             # <<<<<<<<<<<<<<
8646  *         l.push_back(<X>item)
8647  *     return l
8648  */
8649   if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
8650     __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8651     __pyx_t_3 = NULL;
8652   } else {
8653     __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 73, __pyx_L1_error)
8654     __Pyx_GOTREF(__pyx_t_1);
8655     __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 73, __pyx_L1_error)
8656   }
8657   for (;;) {
8658     if (likely(!__pyx_t_3)) {
8659       if (likely(PyList_CheckExact(__pyx_t_1))) {
8660         if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
8661         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8662         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 73, __pyx_L1_error)
8663         #else
8664         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 73, __pyx_L1_error)
8665         __Pyx_GOTREF(__pyx_t_4);
8666         #endif
8667       } else {
8668         if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8669         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8670         __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 73, __pyx_L1_error)
8671         #else
8672         __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 73, __pyx_L1_error)
8673         __Pyx_GOTREF(__pyx_t_4);
8674         #endif
8675       }
8676     } else {
8677       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
8678       if (unlikely(!__pyx_t_4)) {
8679         PyObject* exc_type = PyErr_Occurred();
8680         if (exc_type) {
8681           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8682           else __PYX_ERR(1, 73, __pyx_L1_error)
8683         }
8684         break;
8685       }
8686       __Pyx_GOTREF(__pyx_t_4);
8687     }
8688     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
8689     __pyx_t_4 = 0;
8690 
8691     /* "list.from_py":74
8692  *     cdef cpp_list[X] l
8693  *     for item in o:
8694  *         l.push_back(<X>item)             # <<<<<<<<<<<<<<
8695  *     return l
8696  *
8697  */
8698     __pyx_t_5 = __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Point(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 74, __pyx_L1_error)
8699     __pyx_v_l.push_back(((__pyx_t_7cartopy_5trace_Line)__pyx_t_5));
8700 
8701     /* "list.from_py":73
8702  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(object o) except *:
8703  *     cdef cpp_list[X] l
8704  *     for item in o:             # <<<<<<<<<<<<<<
8705  *         l.push_back(<X>item)
8706  *     return l
8707  */
8708   }
8709   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8710 
8711   /* "list.from_py":75
8712  *     for item in o:
8713  *         l.push_back(<X>item)
8714  *     return l             # <<<<<<<<<<<<<<
8715  *
8716  *
8717  */
8718   __pyx_r = __pyx_v_l;
8719   goto __pyx_L0;
8720 
8721   /* "list.from_py":71
8722  *
8723  * @cname("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line")
8724  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(object o) except *:             # <<<<<<<<<<<<<<
8725  *     cdef cpp_list[X] l
8726  *     for item in o:
8727  */
8728 
8729   /* function exit code */
8730   __pyx_L1_error:;
8731   __Pyx_XDECREF(__pyx_t_1);
8732   __Pyx_XDECREF(__pyx_t_4);
8733   __Pyx_AddTraceback("list.from_py.__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line", __pyx_clineno, __pyx_lineno, __pyx_filename);
8734   __Pyx_pretend_to_initialize(&__pyx_r);
8735   __pyx_L0:;
8736   __Pyx_XDECREF(__pyx_v_item);
8737   __Pyx_RefNannyFinishContext();
8738   return __pyx_r;
8739 }
8740 static struct __pyx_vtabstruct_7cartopy_5trace_LineAccumulator __pyx_vtable_7cartopy_5trace_LineAccumulator;
8741 
__pyx_tp_new_7cartopy_5trace_LineAccumulator(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)8742 static PyObject *__pyx_tp_new_7cartopy_5trace_LineAccumulator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8743   struct __pyx_obj_7cartopy_5trace_LineAccumulator *p;
8744   PyObject *o;
8745   o = (*t->tp_alloc)(t, 0);
8746   if (unlikely(!o)) return 0;
8747   p = ((struct __pyx_obj_7cartopy_5trace_LineAccumulator *)o);
8748   p->__pyx_vtab = __pyx_vtabptr_7cartopy_5trace_LineAccumulator;
8749   new((void*)&(p->lines)) std::list<__pyx_t_7cartopy_5trace_Line> ();
8750   return o;
8751 }
8752 
__pyx_tp_dealloc_7cartopy_5trace_LineAccumulator(PyObject * o)8753 static void __pyx_tp_dealloc_7cartopy_5trace_LineAccumulator(PyObject *o) {
8754   struct __pyx_obj_7cartopy_5trace_LineAccumulator *p = (struct __pyx_obj_7cartopy_5trace_LineAccumulator *)o;
8755   __Pyx_call_destructor(p->lines);
8756   (*Py_TYPE(o)->tp_free)(o);
8757 }
8758 
8759 static PyMethodDef __pyx_methods_7cartopy_5trace_LineAccumulator[] = {
8760   {"__reduce_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_15LineAccumulator_3__reduce_cython__, METH_NOARGS, __pyx_doc_7cartopy_5trace_15LineAccumulator_2__reduce_cython__},
8761   {"__setstate_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_15LineAccumulator_5__setstate_cython__, METH_O, __pyx_doc_7cartopy_5trace_15LineAccumulator_4__setstate_cython__},
8762   {0, 0, 0, 0}
8763 };
8764 
8765 static PyTypeObject __pyx_type_7cartopy_5trace_LineAccumulator = {
8766   PyVarObject_HEAD_INIT(0, 0)
8767   "cartopy.trace.LineAccumulator", /*tp_name*/
8768   sizeof(struct __pyx_obj_7cartopy_5trace_LineAccumulator), /*tp_basicsize*/
8769   0, /*tp_itemsize*/
8770   __pyx_tp_dealloc_7cartopy_5trace_LineAccumulator, /*tp_dealloc*/
8771   #if PY_VERSION_HEX < 0x030800b4
8772   0, /*tp_print*/
8773   #endif
8774   #if PY_VERSION_HEX >= 0x030800b4
8775   0, /*tp_vectorcall_offset*/
8776   #endif
8777   0, /*tp_getattr*/
8778   0, /*tp_setattr*/
8779   #if PY_MAJOR_VERSION < 3
8780   0, /*tp_compare*/
8781   #endif
8782   #if PY_MAJOR_VERSION >= 3
8783   0, /*tp_as_async*/
8784   #endif
8785   0, /*tp_repr*/
8786   0, /*tp_as_number*/
8787   0, /*tp_as_sequence*/
8788   0, /*tp_as_mapping*/
8789   0, /*tp_hash*/
8790   0, /*tp_call*/
8791   0, /*tp_str*/
8792   0, /*tp_getattro*/
8793   0, /*tp_setattro*/
8794   0, /*tp_as_buffer*/
8795   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
8796   "LineAccumulator()", /*tp_doc*/
8797   0, /*tp_traverse*/
8798   0, /*tp_clear*/
8799   0, /*tp_richcompare*/
8800   0, /*tp_weaklistoffset*/
8801   0, /*tp_iter*/
8802   0, /*tp_iternext*/
8803   __pyx_methods_7cartopy_5trace_LineAccumulator, /*tp_methods*/
8804   0, /*tp_members*/
8805   0, /*tp_getset*/
8806   0, /*tp_base*/
8807   0, /*tp_dict*/
8808   0, /*tp_descr_get*/
8809   0, /*tp_descr_set*/
8810   0, /*tp_dictoffset*/
8811   __pyx_pw_7cartopy_5trace_15LineAccumulator_1__init__, /*tp_init*/
8812   0, /*tp_alloc*/
8813   __pyx_tp_new_7cartopy_5trace_LineAccumulator, /*tp_new*/
8814   0, /*tp_free*/
8815   0, /*tp_is_gc*/
8816   0, /*tp_bases*/
8817   0, /*tp_mro*/
8818   0, /*tp_cache*/
8819   0, /*tp_subclasses*/
8820   0, /*tp_weaklist*/
8821   0, /*tp_del*/
8822   0, /*tp_version_tag*/
8823   #if PY_VERSION_HEX >= 0x030400a1
8824   0, /*tp_finalize*/
8825   #endif
8826   #if PY_VERSION_HEX >= 0x030800b1
8827   0, /*tp_vectorcall*/
8828   #endif
8829   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
8830   0, /*tp_print*/
8831   #endif
8832 };
8833 static struct __pyx_vtabstruct_7cartopy_5trace_Interpolator __pyx_vtable_7cartopy_5trace_Interpolator;
8834 
__pyx_tp_new_7cartopy_5trace_Interpolator(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)8835 static PyObject *__pyx_tp_new_7cartopy_5trace_Interpolator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8836   struct __pyx_obj_7cartopy_5trace_Interpolator *p;
8837   PyObject *o;
8838   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
8839     o = (*t->tp_alloc)(t, 0);
8840   } else {
8841     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
8842   }
8843   if (unlikely(!o)) return 0;
8844   p = ((struct __pyx_obj_7cartopy_5trace_Interpolator *)o);
8845   p->__pyx_vtab = __pyx_vtabptr_7cartopy_5trace_Interpolator;
8846   if (unlikely(__pyx_pw_7cartopy_5trace_12Interpolator_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
8847   return o;
8848   bad:
8849   Py_DECREF(o); o = 0;
8850   return NULL;
8851 }
8852 
__pyx_tp_dealloc_7cartopy_5trace_Interpolator(PyObject * o)8853 static void __pyx_tp_dealloc_7cartopy_5trace_Interpolator(PyObject *o) {
8854   #if CYTHON_USE_TP_FINALIZE
8855   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
8856     if (PyObject_CallFinalizerFromDealloc(o)) return;
8857   }
8858   #endif
8859   (*Py_TYPE(o)->tp_free)(o);
8860 }
8861 
8862 static PyMethodDef __pyx_methods_7cartopy_5trace_Interpolator[] = {
8863   {"__reduce_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_12Interpolator_3__reduce_cython__, METH_NOARGS, __pyx_doc_7cartopy_5trace_12Interpolator_2__reduce_cython__},
8864   {"__setstate_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_12Interpolator_5__setstate_cython__, METH_O, __pyx_doc_7cartopy_5trace_12Interpolator_4__setstate_cython__},
8865   {0, 0, 0, 0}
8866 };
8867 
8868 static PyTypeObject __pyx_type_7cartopy_5trace_Interpolator = {
8869   PyVarObject_HEAD_INIT(0, 0)
8870   "cartopy.trace.Interpolator", /*tp_name*/
8871   sizeof(struct __pyx_obj_7cartopy_5trace_Interpolator), /*tp_basicsize*/
8872   0, /*tp_itemsize*/
8873   __pyx_tp_dealloc_7cartopy_5trace_Interpolator, /*tp_dealloc*/
8874   #if PY_VERSION_HEX < 0x030800b4
8875   0, /*tp_print*/
8876   #endif
8877   #if PY_VERSION_HEX >= 0x030800b4
8878   0, /*tp_vectorcall_offset*/
8879   #endif
8880   0, /*tp_getattr*/
8881   0, /*tp_setattr*/
8882   #if PY_MAJOR_VERSION < 3
8883   0, /*tp_compare*/
8884   #endif
8885   #if PY_MAJOR_VERSION >= 3
8886   0, /*tp_as_async*/
8887   #endif
8888   0, /*tp_repr*/
8889   0, /*tp_as_number*/
8890   0, /*tp_as_sequence*/
8891   0, /*tp_as_mapping*/
8892   0, /*tp_hash*/
8893   0, /*tp_call*/
8894   0, /*tp_str*/
8895   0, /*tp_getattro*/
8896   0, /*tp_setattro*/
8897   0, /*tp_as_buffer*/
8898   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
8899   0, /*tp_doc*/
8900   0, /*tp_traverse*/
8901   0, /*tp_clear*/
8902   0, /*tp_richcompare*/
8903   0, /*tp_weaklistoffset*/
8904   0, /*tp_iter*/
8905   0, /*tp_iternext*/
8906   __pyx_methods_7cartopy_5trace_Interpolator, /*tp_methods*/
8907   0, /*tp_members*/
8908   0, /*tp_getset*/
8909   0, /*tp_base*/
8910   0, /*tp_dict*/
8911   0, /*tp_descr_get*/
8912   0, /*tp_descr_set*/
8913   0, /*tp_dictoffset*/
8914   0, /*tp_init*/
8915   0, /*tp_alloc*/
8916   __pyx_tp_new_7cartopy_5trace_Interpolator, /*tp_new*/
8917   0, /*tp_free*/
8918   0, /*tp_is_gc*/
8919   0, /*tp_bases*/
8920   0, /*tp_mro*/
8921   0, /*tp_cache*/
8922   0, /*tp_subclasses*/
8923   0, /*tp_weaklist*/
8924   0, /*tp_del*/
8925   0, /*tp_version_tag*/
8926   #if PY_VERSION_HEX >= 0x030400a1
8927   0, /*tp_finalize*/
8928   #endif
8929   #if PY_VERSION_HEX >= 0x030800b1
8930   0, /*tp_vectorcall*/
8931   #endif
8932   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
8933   0, /*tp_print*/
8934   #endif
8935 };
8936 static struct __pyx_vtabstruct_7cartopy_5trace_CartesianInterpolator __pyx_vtable_7cartopy_5trace_CartesianInterpolator;
8937 
__pyx_tp_new_7cartopy_5trace_CartesianInterpolator(PyTypeObject * t,PyObject * a,PyObject * k)8938 static PyObject *__pyx_tp_new_7cartopy_5trace_CartesianInterpolator(PyTypeObject *t, PyObject *a, PyObject *k) {
8939   struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *p;
8940   PyObject *o = __pyx_tp_new_7cartopy_5trace_Interpolator(t, a, k);
8941   if (unlikely(!o)) return 0;
8942   p = ((struct __pyx_obj_7cartopy_5trace_CartesianInterpolator *)o);
8943   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7cartopy_5trace_Interpolator*)__pyx_vtabptr_7cartopy_5trace_CartesianInterpolator;
8944   return o;
8945 }
8946 
8947 static PyMethodDef __pyx_methods_7cartopy_5trace_CartesianInterpolator[] = {
8948   {"__reduce_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_21CartesianInterpolator_1__reduce_cython__, METH_NOARGS, __pyx_doc_7cartopy_5trace_21CartesianInterpolator___reduce_cython__},
8949   {"__setstate_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_21CartesianInterpolator_3__setstate_cython__, METH_O, __pyx_doc_7cartopy_5trace_21CartesianInterpolator_2__setstate_cython__},
8950   {0, 0, 0, 0}
8951 };
8952 
8953 static PyTypeObject __pyx_type_7cartopy_5trace_CartesianInterpolator = {
8954   PyVarObject_HEAD_INIT(0, 0)
8955   "cartopy.trace.CartesianInterpolator", /*tp_name*/
8956   sizeof(struct __pyx_obj_7cartopy_5trace_CartesianInterpolator), /*tp_basicsize*/
8957   0, /*tp_itemsize*/
8958   __pyx_tp_dealloc_7cartopy_5trace_Interpolator, /*tp_dealloc*/
8959   #if PY_VERSION_HEX < 0x030800b4
8960   0, /*tp_print*/
8961   #endif
8962   #if PY_VERSION_HEX >= 0x030800b4
8963   0, /*tp_vectorcall_offset*/
8964   #endif
8965   0, /*tp_getattr*/
8966   0, /*tp_setattr*/
8967   #if PY_MAJOR_VERSION < 3
8968   0, /*tp_compare*/
8969   #endif
8970   #if PY_MAJOR_VERSION >= 3
8971   0, /*tp_as_async*/
8972   #endif
8973   0, /*tp_repr*/
8974   0, /*tp_as_number*/
8975   0, /*tp_as_sequence*/
8976   0, /*tp_as_mapping*/
8977   0, /*tp_hash*/
8978   0, /*tp_call*/
8979   0, /*tp_str*/
8980   0, /*tp_getattro*/
8981   0, /*tp_setattro*/
8982   0, /*tp_as_buffer*/
8983   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
8984   0, /*tp_doc*/
8985   0, /*tp_traverse*/
8986   0, /*tp_clear*/
8987   0, /*tp_richcompare*/
8988   0, /*tp_weaklistoffset*/
8989   0, /*tp_iter*/
8990   0, /*tp_iternext*/
8991   __pyx_methods_7cartopy_5trace_CartesianInterpolator, /*tp_methods*/
8992   0, /*tp_members*/
8993   0, /*tp_getset*/
8994   0, /*tp_base*/
8995   0, /*tp_dict*/
8996   0, /*tp_descr_get*/
8997   0, /*tp_descr_set*/
8998   0, /*tp_dictoffset*/
8999   0, /*tp_init*/
9000   0, /*tp_alloc*/
9001   __pyx_tp_new_7cartopy_5trace_CartesianInterpolator, /*tp_new*/
9002   0, /*tp_free*/
9003   0, /*tp_is_gc*/
9004   0, /*tp_bases*/
9005   0, /*tp_mro*/
9006   0, /*tp_cache*/
9007   0, /*tp_subclasses*/
9008   0, /*tp_weaklist*/
9009   0, /*tp_del*/
9010   0, /*tp_version_tag*/
9011   #if PY_VERSION_HEX >= 0x030400a1
9012   0, /*tp_finalize*/
9013   #endif
9014   #if PY_VERSION_HEX >= 0x030800b1
9015   0, /*tp_vectorcall*/
9016   #endif
9017   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9018   0, /*tp_print*/
9019   #endif
9020 };
9021 static struct __pyx_vtabstruct_7cartopy_5trace_SphericalInterpolator __pyx_vtable_7cartopy_5trace_SphericalInterpolator;
9022 
__pyx_tp_new_7cartopy_5trace_SphericalInterpolator(PyTypeObject * t,PyObject * a,PyObject * k)9023 static PyObject *__pyx_tp_new_7cartopy_5trace_SphericalInterpolator(PyTypeObject *t, PyObject *a, PyObject *k) {
9024   struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *p;
9025   PyObject *o = __pyx_tp_new_7cartopy_5trace_Interpolator(t, a, k);
9026   if (unlikely(!o)) return 0;
9027   p = ((struct __pyx_obj_7cartopy_5trace_SphericalInterpolator *)o);
9028   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7cartopy_5trace_Interpolator*)__pyx_vtabptr_7cartopy_5trace_SphericalInterpolator;
9029   return o;
9030 }
9031 
9032 static PyMethodDef __pyx_methods_7cartopy_5trace_SphericalInterpolator[] = {
9033   {"__reduce_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_21SphericalInterpolator_1__reduce_cython__, METH_NOARGS, __pyx_doc_7cartopy_5trace_21SphericalInterpolator___reduce_cython__},
9034   {"__setstate_cython__", (PyCFunction)__pyx_pw_7cartopy_5trace_21SphericalInterpolator_3__setstate_cython__, METH_O, __pyx_doc_7cartopy_5trace_21SphericalInterpolator_2__setstate_cython__},
9035   {0, 0, 0, 0}
9036 };
9037 
9038 static PyTypeObject __pyx_type_7cartopy_5trace_SphericalInterpolator = {
9039   PyVarObject_HEAD_INIT(0, 0)
9040   "cartopy.trace.SphericalInterpolator", /*tp_name*/
9041   sizeof(struct __pyx_obj_7cartopy_5trace_SphericalInterpolator), /*tp_basicsize*/
9042   0, /*tp_itemsize*/
9043   __pyx_tp_dealloc_7cartopy_5trace_Interpolator, /*tp_dealloc*/
9044   #if PY_VERSION_HEX < 0x030800b4
9045   0, /*tp_print*/
9046   #endif
9047   #if PY_VERSION_HEX >= 0x030800b4
9048   0, /*tp_vectorcall_offset*/
9049   #endif
9050   0, /*tp_getattr*/
9051   0, /*tp_setattr*/
9052   #if PY_MAJOR_VERSION < 3
9053   0, /*tp_compare*/
9054   #endif
9055   #if PY_MAJOR_VERSION >= 3
9056   0, /*tp_as_async*/
9057   #endif
9058   0, /*tp_repr*/
9059   0, /*tp_as_number*/
9060   0, /*tp_as_sequence*/
9061   0, /*tp_as_mapping*/
9062   0, /*tp_hash*/
9063   0, /*tp_call*/
9064   0, /*tp_str*/
9065   0, /*tp_getattro*/
9066   0, /*tp_setattro*/
9067   0, /*tp_as_buffer*/
9068   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9069   0, /*tp_doc*/
9070   0, /*tp_traverse*/
9071   0, /*tp_clear*/
9072   0, /*tp_richcompare*/
9073   0, /*tp_weaklistoffset*/
9074   0, /*tp_iter*/
9075   0, /*tp_iternext*/
9076   __pyx_methods_7cartopy_5trace_SphericalInterpolator, /*tp_methods*/
9077   0, /*tp_members*/
9078   0, /*tp_getset*/
9079   0, /*tp_base*/
9080   0, /*tp_dict*/
9081   0, /*tp_descr_get*/
9082   0, /*tp_descr_set*/
9083   0, /*tp_dictoffset*/
9084   0, /*tp_init*/
9085   0, /*tp_alloc*/
9086   __pyx_tp_new_7cartopy_5trace_SphericalInterpolator, /*tp_new*/
9087   0, /*tp_free*/
9088   0, /*tp_is_gc*/
9089   0, /*tp_bases*/
9090   0, /*tp_mro*/
9091   0, /*tp_cache*/
9092   0, /*tp_subclasses*/
9093   0, /*tp_weaklist*/
9094   0, /*tp_del*/
9095   0, /*tp_version_tag*/
9096   #if PY_VERSION_HEX >= 0x030400a1
9097   0, /*tp_finalize*/
9098   #endif
9099   #if PY_VERSION_HEX >= 0x030800b1
9100   0, /*tp_vectorcall*/
9101   #endif
9102   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
9103   0, /*tp_print*/
9104   #endif
9105 };
9106 
9107 static PyMethodDef __pyx_methods[] = {
9108   {0, 0, 0, 0}
9109 };
9110 
9111 #if PY_MAJOR_VERSION >= 3
9112 #if CYTHON_PEP489_MULTI_PHASE_INIT
9113 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9114 static int __pyx_pymod_exec_trace(PyObject* module); /*proto*/
9115 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9116   {Py_mod_create, (void*)__pyx_pymod_create},
9117   {Py_mod_exec, (void*)__pyx_pymod_exec_trace},
9118   {0, NULL}
9119 };
9120 #endif
9121 
9122 static struct PyModuleDef __pyx_moduledef = {
9123     PyModuleDef_HEAD_INIT,
9124     "trace",
9125     __pyx_k_This_module_pulls_together_proj, /* m_doc */
9126   #if CYTHON_PEP489_MULTI_PHASE_INIT
9127     0, /* m_size */
9128   #else
9129     -1, /* m_size */
9130   #endif
9131     __pyx_methods /* m_methods */,
9132   #if CYTHON_PEP489_MULTI_PHASE_INIT
9133     __pyx_moduledef_slots, /* m_slots */
9134   #else
9135     NULL, /* m_reload */
9136   #endif
9137     NULL, /* m_traverse */
9138     NULL, /* m_clear */
9139     NULL /* m_free */
9140 };
9141 #endif
9142 #ifndef CYTHON_SMALL_CODE
9143 #if defined(__clang__)
9144     #define CYTHON_SMALL_CODE
9145 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9146     #define CYTHON_SMALL_CODE __attribute__((cold))
9147 #else
9148     #define CYTHON_SMALL_CODE
9149 #endif
9150 #endif
9151 
9152 static __Pyx_StringTabEntry __pyx_string_tab[] = {
9153   {&__pyx_kp_s_Bisecting_from, __pyx_k_Bisecting_from, sizeof(__pyx_k_Bisecting_from), 0, 0, 1, 0},
9154   {&__pyx_n_s_CartesianInterpolator, __pyx_k_CartesianInterpolator, sizeof(__pyx_k_CartesianInterpolator), 0, 0, 1, 1},
9155   {&__pyx_n_s_IN, __pyx_k_IN, sizeof(__pyx_k_IN), 0, 0, 1, 1},
9156   {&__pyx_kp_s_Incompatible_checksums_s_vs_0x98, __pyx_k_Incompatible_checksums_s_vs_0x98, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x98), 0, 0, 1, 0},
9157   {&__pyx_n_s_Interpolator, __pyx_k_Interpolator, sizeof(__pyx_k_Interpolator), 0, 0, 1, 1},
9158   {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
9159   {&__pyx_n_s_LineAccumulator, __pyx_k_LineAccumulator, sizeof(__pyx_k_LineAccumulator), 0, 0, 1, 1},
9160   {&__pyx_n_s_NAN, __pyx_k_NAN, sizeof(__pyx_k_NAN), 0, 0, 1, 1},
9161   {&__pyx_kp_s_No_value_specified_for_struct_at, __pyx_k_No_value_specified_for_struct_at, sizeof(__pyx_k_No_value_specified_for_struct_at), 0, 0, 1, 0},
9162   {&__pyx_kp_s_No_value_specified_for_struct_at_2, __pyx_k_No_value_specified_for_struct_at_2, sizeof(__pyx_k_No_value_specified_for_struct_at_2), 0, 0, 1, 0},
9163   {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
9164   {&__pyx_n_s_OUT, __pyx_k_OUT, sizeof(__pyx_k_OUT), 0, 0, 1, 1},
9165   {&__pyx_n_s_PROJ4_VERSION, __pyx_k_PROJ4_VERSION, sizeof(__pyx_k_PROJ4_VERSION), 0, 0, 1, 1},
9166   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
9167   {&__pyx_kp_s_Projected_as, __pyx_k_Projected_as, sizeof(__pyx_k_Projected_as), 0, 0, 1, 0},
9168   {&__pyx_kp_s_Setting_line, __pyx_k_Setting_line, sizeof(__pyx_k_Setting_line), 0, 0, 1, 0},
9169   {&__pyx_n_s_SphericalInterpolator, __pyx_k_SphericalInterpolator, sizeof(__pyx_k_SphericalInterpolator), 0, 0, 1, 1},
9170   {&__pyx_n_s_Testing, __pyx_k_Testing, sizeof(__pyx_k_Testing), 0, 0, 1, 1},
9171   {&__pyx_n_s_Testing_interp_prj_pt, __pyx_k_Testing_interp_prj_pt, sizeof(__pyx_k_Testing_interp_prj_pt), 0, 0, 1, 1},
9172   {&__pyx_n_s_Testing_interp_t_pt, __pyx_k_Testing_interp_t_pt, sizeof(__pyx_k_Testing_interp_t_pt), 0, 0, 1, 1},
9173   {&__pyx_n_s_Testing_interpolator, __pyx_k_Testing_interpolator, sizeof(__pyx_k_Testing_interpolator), 0, 0, 1, 1},
9174   {&__pyx_n_s_Testing_straight_and_within, __pyx_k_Testing_straight_and_within, sizeof(__pyx_k_Testing_straight_and_within), 0, 0, 1, 1},
9175   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
9176   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
9177   {&__pyx_kp_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 0},
9178   {&__pyx_kp_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 0},
9179   {&__pyx_kp_s__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 0, 1, 0},
9180   {&__pyx_kp_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 0},
9181   {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0},
9182   {&__pyx_n_s__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 1, 1},
9183   {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
9184   {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
9185   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
9186   {&__pyx_n_s_cartopy__crs, __pyx_k_cartopy__crs, sizeof(__pyx_k_cartopy__crs), 0, 0, 1, 1},
9187   {&__pyx_n_s_cartopy_trace, __pyx_k_cartopy_trace, sizeof(__pyx_k_cartopy_trace), 0, 0, 1, 1},
9188   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9189   {&__pyx_n_s_dest_projection, __pyx_k_dest_projection, sizeof(__pyx_k_dest_projection), 0, 0, 1, 1},
9190   {&__pyx_n_s_destination_projection, __pyx_k_destination_projection, sizeof(__pyx_k_destination_projection), 0, 0, 1, 1},
9191   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
9192   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
9193   {&__pyx_n_s_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 0, 0, 1, 1},
9194   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
9195   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
9196   {&__pyx_n_s_g_domain, __pyx_k_g_domain, sizeof(__pyx_k_g_domain), 0, 0, 1, 1},
9197   {&__pyx_n_s_g_linear, __pyx_k_g_linear, sizeof(__pyx_k_g_linear), 0, 0, 1, 1},
9198   {&__pyx_n_s_g_multi_line_string, __pyx_k_g_multi_line_string, sizeof(__pyx_k_g_multi_line_string), 0, 0, 1, 1},
9199   {&__pyx_n_s_geom, __pyx_k_geom, sizeof(__pyx_k_geom), 0, 0, 1, 1},
9200   {&__pyx_n_s_geom_factory, __pyx_k_geom_factory, sizeof(__pyx_k_geom_factory), 0, 0, 1, 1},
9201   {&__pyx_n_s_geometry, __pyx_k_geometry, sizeof(__pyx_k_geometry), 0, 0, 1, 1},
9202   {&__pyx_n_s_geos_handle, __pyx_k_geos_handle, sizeof(__pyx_k_geos_handle), 0, 0, 1, 1},
9203   {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
9204   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9205   {&__pyx_n_s_gp_domain, __pyx_k_gp_domain, sizeof(__pyx_k_gp_domain), 0, 0, 1, 1},
9206   {&__pyx_n_s_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 0, 0, 1, 1},
9207   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9208   {&__pyx_n_s_interp, __pyx_k_interp, sizeof(__pyx_k_interp), 0, 0, 1, 1},
9209   {&__pyx_n_s_interp_prj_pt, __pyx_k_interp_prj_pt, sizeof(__pyx_k_interp_prj_pt), 0, 0, 1, 1},
9210   {&__pyx_n_s_interp_t_pt, __pyx_k_interp_t_pt, sizeof(__pyx_k_interp_t_pt), 0, 0, 1, 1},
9211   {&__pyx_n_s_interpolator, __pyx_k_interpolator, sizeof(__pyx_k_interpolator), 0, 0, 1, 1},
9212   {&__pyx_n_s_l_end, __pyx_k_l_end, sizeof(__pyx_k_l_end), 0, 0, 1, 1},
9213   {&__pyx_n_s_l_start, __pyx_k_l_start, sizeof(__pyx_k_l_start), 0, 0, 1, 1},
9214   {&__pyx_n_s_latlon, __pyx_k_latlon, sizeof(__pyx_k_latlon), 0, 0, 1, 1},
9215   {&__pyx_n_s_latlong, __pyx_k_latlong, sizeof(__pyx_k_latlong), 0, 0, 1, 1},
9216   {&__pyx_n_s_lgeos, __pyx_k_lgeos, sizeof(__pyx_k_lgeos), 0, 0, 1, 1},
9217   {&__pyx_kp_s_lib_cartopy_trace_pyx, __pyx_k_lib_cartopy_trace_pyx, sizeof(__pyx_k_lib_cartopy_trace_pyx), 0, 0, 1, 0},
9218   {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
9219   {&__pyx_n_s_longlat, __pyx_k_longlat, sizeof(__pyx_k_longlat), 0, 0, 1, 1},
9220   {&__pyx_n_s_lonlat, __pyx_k_lonlat, sizeof(__pyx_k_lonlat), 0, 0, 1, 1},
9221   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9222   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
9223   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
9224   {&__pyx_n_s_multi_line_string, __pyx_k_multi_line_string, sizeof(__pyx_k_multi_line_string), 0, 0, 1, 1},
9225   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9226   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
9227   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
9228   {&__pyx_n_s_o_proj, __pyx_k_o_proj, sizeof(__pyx_k_o_proj), 0, 0, 1, 1},
9229   {&__pyx_n_s_ob_tran, __pyx_k_ob_tran, sizeof(__pyx_k_ob_tran), 0, 0, 1, 1},
9230   {&__pyx_n_s_p0, __pyx_k_p0, sizeof(__pyx_k_p0), 0, 0, 1, 1},
9231   {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1},
9232   {&__pyx_n_s_p_start_inside_domain, __pyx_k_p_start_inside_domain, sizeof(__pyx_k_p_start_inside_domain), 0, 0, 1, 1},
9233   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
9234   {&__pyx_kp_s_pj_transform_failed_d_s, __pyx_k_pj_transform_failed_d_s, sizeof(__pyx_k_pj_transform_failed_d_s), 0, 0, 1, 0},
9235   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
9236   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
9237   {&__pyx_n_s_proj, __pyx_k_proj, sizeof(__pyx_k_proj), 0, 0, 1, 1},
9238   {&__pyx_n_s_project_linear, __pyx_k_project_linear, sizeof(__pyx_k_project_linear), 0, 0, 1, 1},
9239   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
9240   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
9241   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
9242   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9243   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
9244   {&__pyx_n_s_pyx_unpickle_LineAccumulator, __pyx_k_pyx_unpickle_LineAccumulator, sizeof(__pyx_k_pyx_unpickle_LineAccumulator), 0, 0, 1, 1},
9245   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
9246   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
9247   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
9248   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9249   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9250   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9251   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9252   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9253   {&__pyx_n_s_sgeom, __pyx_k_sgeom, sizeof(__pyx_k_sgeom), 0, 0, 1, 1},
9254   {&__pyx_n_s_shapely_geometry, __pyx_k_shapely_geometry, sizeof(__pyx_k_shapely_geometry), 0, 0, 1, 1},
9255   {&__pyx_n_s_shapely_geos, __pyx_k_shapely_geos, sizeof(__pyx_k_shapely_geos), 0, 0, 1, 1},
9256   {&__pyx_n_s_source_crs, __pyx_k_source_crs, sizeof(__pyx_k_source_crs), 0, 0, 1, 1},
9257   {&__pyx_n_s_src_coords, __pyx_k_src_coords, sizeof(__pyx_k_src_coords), 0, 0, 1, 1},
9258   {&__pyx_n_s_src_crs, __pyx_k_src_crs, sizeof(__pyx_k_src_crs), 0, 0, 1, 1},
9259   {&__pyx_n_s_src_idx, __pyx_k_src_idx, sizeof(__pyx_k_src_idx), 0, 0, 1, 1},
9260   {&__pyx_n_s_src_size, __pyx_k_src_size, sizeof(__pyx_k_src_size), 0, 0, 1, 1},
9261   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
9262   {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
9263   {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
9264   {&__pyx_n_s_straight_and_within, __pyx_k_straight_and_within, sizeof(__pyx_k_straight_and_within), 0, 0, 1, 1},
9265   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9266   {&__pyx_kp_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 0},
9267   {&__pyx_n_s_t_2, __pyx_k_t_2, sizeof(__pyx_k_t_2), 0, 0, 1, 1},
9268   {&__pyx_n_s_t_end, __pyx_k_t_end, sizeof(__pyx_k_t_end), 0, 0, 1, 1},
9269   {&__pyx_n_s_t_start, __pyx_k_t_start, sizeof(__pyx_k_t_start), 0, 0, 1, 1},
9270   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9271   {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1},
9272   {&__pyx_n_s_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 0, 1, 1},
9273   {&__pyx_kp_s_to_2, __pyx_k_to_2, sizeof(__pyx_k_to_2), 0, 0, 1, 0},
9274   {&__pyx_n_s_to_meter, __pyx_k_to_meter, sizeof(__pyx_k_to_meter), 0, 0, 1, 1},
9275   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
9276   {&__pyx_kp_s_valid, __pyx_k_valid, sizeof(__pyx_k_valid), 0, 0, 1, 0},
9277   {&__pyx_n_s_valid_2, __pyx_k_valid_2, sizeof(__pyx_k_valid_2), 0, 0, 1, 1},
9278   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
9279   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
9280   {0, 0, 0, 0, 0, 0, 0}
9281 };
__Pyx_InitCachedBuiltins(void)9282 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9283   __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 649, __pyx_L1_error)
9284   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 141, __pyx_L1_error)
9285   __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 181, __pyx_L1_error)
9286   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
9287   __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 451, __pyx_L1_error)
9288   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 635, __pyx_L1_error)
9289   __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(1, 18, __pyx_L1_error)
9290   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 19, __pyx_L1_error)
9291   return 0;
9292   __pyx_L1_error:;
9293   return -1;
9294 }
9295 
__Pyx_InitCachedConstants(void)9296 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9297   __Pyx_RefNannyDeclarations
9298   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9299 
9300   /* "(tree fragment)":2
9301  * def __reduce_cython__(self):
9302  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9303  * def __setstate_cython__(self, __pyx_state):
9304  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9305  */
9306   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
9307   __Pyx_GOTREF(__pyx_tuple_);
9308   __Pyx_GIVEREF(__pyx_tuple_);
9309 
9310   /* "(tree fragment)":4
9311  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9312  * def __setstate_cython__(self, __pyx_state):
9313  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9314  */
9315   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
9316   __Pyx_GOTREF(__pyx_tuple__2);
9317   __Pyx_GIVEREF(__pyx_tuple__2);
9318 
9319   /* "(tree fragment)":2
9320  * def __reduce_cython__(self):
9321  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9322  * def __setstate_cython__(self, __pyx_state):
9323  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9324  */
9325   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 2, __pyx_L1_error)
9326   __Pyx_GOTREF(__pyx_tuple__3);
9327   __Pyx_GIVEREF(__pyx_tuple__3);
9328 
9329   /* "(tree fragment)":4
9330  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9331  * def __setstate_cython__(self, __pyx_state):
9332  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9333  */
9334   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 4, __pyx_L1_error)
9335   __Pyx_GOTREF(__pyx_tuple__4);
9336   __Pyx_GIVEREF(__pyx_tuple__4);
9337 
9338   /* "(tree fragment)":2
9339  * def __reduce_cython__(self):
9340  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9341  * def __setstate_cython__(self, __pyx_state):
9342  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9343  */
9344   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error)
9345   __Pyx_GOTREF(__pyx_tuple__5);
9346   __Pyx_GIVEREF(__pyx_tuple__5);
9347 
9348   /* "(tree fragment)":4
9349  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9350  * def __setstate_cython__(self, __pyx_state):
9351  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
9352  */
9353   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error)
9354   __Pyx_GOTREF(__pyx_tuple__6);
9355   __Pyx_GIVEREF(__pyx_tuple__6);
9356 
9357   /* "cartopy/trace.pyx":496
9358  *     GEOSCoordSeq_getY_r(handle, src_coords, src_idx_to, &p_end.y)
9359  *     if DEBUG:
9360  *         print("Setting line:")             # <<<<<<<<<<<<<<
9361  *         print("   ", p_current.x, ", ", p_current.y)
9362  *         print("   ", p_end.x, ", ", p_end.y)
9363  */
9364   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Setting_line); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 496, __pyx_L1_error)
9365   __Pyx_GOTREF(__pyx_tuple__7);
9366   __Pyx_GIVEREF(__pyx_tuple__7);
9367 
9368   /* "cartopy/trace.pyx":504
9369  *     p_end = interpolator.project(p_end)
9370  *     if DEBUG:
9371  *         print("Projected as:")             # <<<<<<<<<<<<<<
9372  *         print("   ", p_current.x, ", ", p_current.y)
9373  *         print("   ", p_end.x, ", ", p_end.y)
9374  */
9375   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Projected_as); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 504, __pyx_L1_error)
9376   __Pyx_GOTREF(__pyx_tuple__10);
9377   __Pyx_GIVEREF(__pyx_tuple__10);
9378 
9379   /* "cartopy/trace.pyx":516
9380  *             print("Bisecting from: ", t_current, " (")
9381  *             if state == POINT_IN:
9382  *                 print("IN")             # <<<<<<<<<<<<<<
9383  *             elif state == POINT_OUT:
9384  *                 print("OUT")
9385  */
9386   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_IN); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 516, __pyx_L1_error)
9387   __Pyx_GOTREF(__pyx_tuple__12);
9388   __Pyx_GIVEREF(__pyx_tuple__12);
9389 
9390   /* "cartopy/trace.pyx":518
9391  *                 print("IN")
9392  *             elif state == POINT_OUT:
9393  *                 print("OUT")             # <<<<<<<<<<<<<<
9394  *             else:
9395  *                 print("NAN")
9396  */
9397   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_OUT); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 518, __pyx_L1_error)
9398   __Pyx_GOTREF(__pyx_tuple__13);
9399   __Pyx_GIVEREF(__pyx_tuple__13);
9400 
9401   /* "cartopy/trace.pyx":520
9402  *                 print("OUT")
9403  *             else:
9404  *                 print("NAN")             # <<<<<<<<<<<<<<
9405  *             print(")")
9406  *             print("   ", p_current.x, ", ", p_current.y)
9407  */
9408   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_NAN); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 520, __pyx_L1_error)
9409   __Pyx_GOTREF(__pyx_tuple__14);
9410   __Pyx_GIVEREF(__pyx_tuple__14);
9411 
9412   /* "cartopy/trace.pyx":521
9413  *             else:
9414  *                 print("NAN")
9415  *             print(")")             # <<<<<<<<<<<<<<
9416  *             print("   ", p_current.x, ", ", p_current.y)
9417  *             print("   ", p_end.x, ", ", p_end.y)
9418  */
9419   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 521, __pyx_L1_error)
9420   __Pyx_GOTREF(__pyx_tuple__16);
9421   __Pyx_GIVEREF(__pyx_tuple__16);
9422 
9423   /* "cartopy/trace.pyx":577
9424  *         interpolator = CartesianInterpolator()
9425  *     interpolator.init(src_crs.proj4, (<CRS>dest_projection).proj4)
9426  *     if (6, 1, 1) <= PROJ4_VERSION < (6, 3, 0):             # <<<<<<<<<<<<<<
9427  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
9428  *         # See https://github.com/OSGeo/proj#1782.
9429  */
9430   __pyx_tuple__19 = PyTuple_Pack(3, __pyx_int_6, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 577, __pyx_L1_error)
9431   __Pyx_GOTREF(__pyx_tuple__19);
9432   __Pyx_GIVEREF(__pyx_tuple__19);
9433   __pyx_tuple__20 = PyTuple_Pack(3, __pyx_int_6, __pyx_int_3, __pyx_int_0); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 577, __pyx_L1_error)
9434   __Pyx_GOTREF(__pyx_tuple__20);
9435   __Pyx_GIVEREF(__pyx_tuple__20);
9436 
9437   /* "cartopy/trace.pyx":580
9438  *         # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran.
9439  *         # See https://github.com/OSGeo/proj#1782.
9440  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')             # <<<<<<<<<<<<<<
9441  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and
9442  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
9443  */
9444   __pyx_tuple__21 = PyTuple_Pack(4, __pyx_n_s_latlon, __pyx_n_s_latlong, __pyx_n_s_lonlat, __pyx_n_s_longlat); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 580, __pyx_L1_error)
9445   __Pyx_GOTREF(__pyx_tuple__21);
9446   __Pyx_GIVEREF(__pyx_tuple__21);
9447 
9448   /* "cartopy/trace.pyx":581
9449  *         # See https://github.com/OSGeo/proj#1782.
9450  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
9451  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and             # <<<<<<<<<<<<<<
9452  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and
9453  *                 'to_meter' in src_crs.proj4_params):
9454  */
9455   __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_proj, __pyx_kp_s__22); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 581, __pyx_L1_error)
9456   __Pyx_GOTREF(__pyx_tuple__23);
9457   __Pyx_GIVEREF(__pyx_tuple__23);
9458 
9459   /* "cartopy/trace.pyx":582
9460  *         lonlat = ('latlon', 'latlong', 'lonlat', 'longlat')
9461  *         if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and
9462  *                 src_crs.proj4_params.get('o_proj', '') in lonlat and             # <<<<<<<<<<<<<<
9463  *                 'to_meter' in src_crs.proj4_params):
9464  *             interpolator.src_scale = src_crs.proj4_params['to_meter']
9465  */
9466   __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_o_proj, __pyx_kp_s__22); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 582, __pyx_L1_error)
9467   __Pyx_GOTREF(__pyx_tuple__24);
9468   __Pyx_GIVEREF(__pyx_tuple__24);
9469 
9470   /* "FromPyStructUtility":19
9471  *         value = obj['x']
9472  *     except KeyError:
9473  *         raise ValueError("No value specified for struct attribute 'x'")             # <<<<<<<<<<<<<<
9474  *     result.x = value
9475  *     try:
9476  */
9477   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 19, __pyx_L1_error)
9478   __Pyx_GOTREF(__pyx_tuple__25);
9479   __Pyx_GIVEREF(__pyx_tuple__25);
9480 
9481   /* "FromPyStructUtility":24
9482  *         value = obj['y']
9483  *     except KeyError:
9484  *         raise ValueError("No value specified for struct attribute 'y'")             # <<<<<<<<<<<<<<
9485  *     result.y = value
9486  *     return result
9487  */
9488   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 24, __pyx_L1_error)
9489   __Pyx_GOTREF(__pyx_tuple__26);
9490   __Pyx_GIVEREF(__pyx_tuple__26);
9491 
9492   /* "cartopy/trace.pyx":592
9493  *
9494  *
9495  * def project_linear(geometry not None, CRS src_crs not None,             # <<<<<<<<<<<<<<
9496  *                    dest_projection not None):
9497  *     """
9498  */
9499   __pyx_tuple__28 = PyTuple_Pack(15, __pyx_n_s_geometry, __pyx_n_s_src_crs, __pyx_n_s_dest_projection, __pyx_n_s_threshold, __pyx_n_s_handle, __pyx_n_s_g_linear, __pyx_n_s_interpolator, __pyx_n_s_g_domain, __pyx_n_s_src_coords, __pyx_n_s_src_size, __pyx_n_s_src_idx, __pyx_n_s_gp_domain, __pyx_n_s_lines, __pyx_n_s_g_multi_line_string, __pyx_n_s_multi_line_string); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 592, __pyx_L1_error)
9500   __Pyx_GOTREF(__pyx_tuple__28);
9501   __Pyx_GIVEREF(__pyx_tuple__28);
9502   __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_cartopy_trace_pyx, __pyx_n_s_project_linear, 592, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 592, __pyx_L1_error)
9503 
9504   /* "cartopy/trace.pyx":650
9505  * class _Testing:
9506  *     @staticmethod
9507  *     def straight_and_within(Point l_start, Point l_end,             # <<<<<<<<<<<<<<
9508  *                             double t_start, double t_end,
9509  *                             Interpolator interpolator, double threshold,
9510  */
9511   __pyx_tuple__30 = PyTuple_Pack(15, __pyx_n_s_l_start, __pyx_n_s_l_end, __pyx_n_s_t_start, __pyx_n_s_t_end, __pyx_n_s_interpolator, __pyx_n_s_threshold, __pyx_n_s_domain, __pyx_n_s_handle, __pyx_n_s_g_domain, __pyx_n_s_gp_domain, __pyx_n_s_state, __pyx_n_s_p_start_inside_domain, __pyx_n_s_p0, __pyx_n_s_p1, __pyx_n_s_valid_2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 650, __pyx_L1_error)
9512   __Pyx_GOTREF(__pyx_tuple__30);
9513   __Pyx_GIVEREF(__pyx_tuple__30);
9514   __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_cartopy_trace_pyx, __pyx_n_s_straight_and_within, 650, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 650, __pyx_L1_error)
9515 
9516   /* "cartopy/trace.pyx":683
9517  *
9518  *     @staticmethod
9519  *     def interpolator(source_crs, destination_projection):             # <<<<<<<<<<<<<<
9520  *         return _interpolator(source_crs, destination_projection)
9521  *
9522  */
9523   __pyx_tuple__32 = PyTuple_Pack(2, __pyx_n_s_source_crs, __pyx_n_s_destination_projection); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 683, __pyx_L1_error)
9524   __Pyx_GOTREF(__pyx_tuple__32);
9525   __Pyx_GIVEREF(__pyx_tuple__32);
9526   __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_cartopy_trace_pyx, __pyx_n_s_interpolator, 683, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 683, __pyx_L1_error)
9527 
9528   /* "cartopy/trace.pyx":687
9529  *
9530  *     @staticmethod
9531  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):             # <<<<<<<<<<<<<<
9532  *         return interp.project(lonlat)
9533  *
9534  */
9535   __pyx_tuple__34 = PyTuple_Pack(2, __pyx_n_s_interp, __pyx_n_s_lonlat); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 687, __pyx_L1_error)
9536   __Pyx_GOTREF(__pyx_tuple__34);
9537   __Pyx_GIVEREF(__pyx_tuple__34);
9538   __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_cartopy_trace_pyx, __pyx_n_s_interp_prj_pt, 687, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 687, __pyx_L1_error)
9539 
9540   /* "cartopy/trace.pyx":691
9541  *
9542  *     @staticmethod
9543  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):             # <<<<<<<<<<<<<<
9544  *         interp.set_line(start, end)
9545  *         return interp.interpolate(t)
9546  */
9547   __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_interp, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_t_2); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 691, __pyx_L1_error)
9548   __Pyx_GOTREF(__pyx_tuple__36);
9549   __Pyx_GIVEREF(__pyx_tuple__36);
9550   __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lib_cartopy_trace_pyx, __pyx_n_s_interp_t_pt, 691, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 691, __pyx_L1_error)
9551 
9552   /* "(tree fragment)":1
9553  * def __pyx_unpickle_LineAccumulator(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
9554  *     cdef object __pyx_PickleError
9555  *     cdef object __pyx_result
9556  */
9557   __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(1, 1, __pyx_L1_error)
9558   __Pyx_GOTREF(__pyx_tuple__38);
9559   __Pyx_GIVEREF(__pyx_tuple__38);
9560   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_LineAccumulator, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(1, 1, __pyx_L1_error)
9561   __Pyx_RefNannyFinishContext();
9562   return 0;
9563   __pyx_L1_error:;
9564   __Pyx_RefNannyFinishContext();
9565   return -1;
9566 }
9567 
__Pyx_InitGlobals(void)9568 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9569   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9570   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
9571   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9572   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
9573   __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
9574   __pyx_int_159439512 = PyInt_FromLong(159439512L); if (unlikely(!__pyx_int_159439512)) __PYX_ERR(0, 1, __pyx_L1_error)
9575   return 0;
9576   __pyx_L1_error:;
9577   return -1;
9578 }
9579 
9580 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9581 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9582 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9583 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9584 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9585 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9586 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9587 
__Pyx_modinit_global_init_code(void)9588 static int __Pyx_modinit_global_init_code(void) {
9589   __Pyx_RefNannyDeclarations
9590   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9591   /*--- Global init code ---*/
9592   __Pyx_RefNannyFinishContext();
9593   return 0;
9594 }
9595 
__Pyx_modinit_variable_export_code(void)9596 static int __Pyx_modinit_variable_export_code(void) {
9597   __Pyx_RefNannyDeclarations
9598   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9599   /*--- Variable export code ---*/
9600   __Pyx_RefNannyFinishContext();
9601   return 0;
9602 }
9603 
__Pyx_modinit_function_export_code(void)9604 static int __Pyx_modinit_function_export_code(void) {
9605   __Pyx_RefNannyDeclarations
9606   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9607   /*--- Function export code ---*/
9608   __Pyx_RefNannyFinishContext();
9609   return 0;
9610 }
9611 
__Pyx_modinit_type_init_code(void)9612 static int __Pyx_modinit_type_init_code(void) {
9613   __Pyx_RefNannyDeclarations
9614   int __pyx_lineno = 0;
9615   const char *__pyx_filename = NULL;
9616   int __pyx_clineno = 0;
9617   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9618   /*--- Type init code ---*/
9619   __pyx_vtabptr_7cartopy_5trace_LineAccumulator = &__pyx_vtable_7cartopy_5trace_LineAccumulator;
9620   __pyx_vtable_7cartopy_5trace_LineAccumulator.new_line = (void (*)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *))__pyx_f_7cartopy_5trace_15LineAccumulator_new_line;
9621   __pyx_vtable_7cartopy_5trace_LineAccumulator.add_point = (void (*)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_15LineAccumulator_add_point;
9622   __pyx_vtable_7cartopy_5trace_LineAccumulator.add_point_if_empty = (void (*)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_15LineAccumulator_add_point_if_empty;
9623   __pyx_vtable_7cartopy_5trace_LineAccumulator.as_geom = (GEOSGeometry *(*)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *, GEOSContextHandle_t))__pyx_f_7cartopy_5trace_15LineAccumulator_as_geom;
9624   __pyx_vtable_7cartopy_5trace_LineAccumulator.size = (size_t (*)(struct __pyx_obj_7cartopy_5trace_LineAccumulator *))__pyx_f_7cartopy_5trace_15LineAccumulator_size;
9625   if (PyType_Ready(&__pyx_type_7cartopy_5trace_LineAccumulator) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
9626   #if PY_VERSION_HEX < 0x030800B1
9627   __pyx_type_7cartopy_5trace_LineAccumulator.tp_print = 0;
9628   #endif
9629   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7cartopy_5trace_LineAccumulator.tp_dictoffset && __pyx_type_7cartopy_5trace_LineAccumulator.tp_getattro == PyObject_GenericGetAttr)) {
9630     __pyx_type_7cartopy_5trace_LineAccumulator.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
9631   }
9632   if (__Pyx_SetVtable(__pyx_type_7cartopy_5trace_LineAccumulator.tp_dict, __pyx_vtabptr_7cartopy_5trace_LineAccumulator) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
9633   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LineAccumulator, (PyObject *)&__pyx_type_7cartopy_5trace_LineAccumulator) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
9634   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7cartopy_5trace_LineAccumulator) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
9635   __pyx_ptype_7cartopy_5trace_LineAccumulator = &__pyx_type_7cartopy_5trace_LineAccumulator;
9636   __pyx_vtabptr_7cartopy_5trace_Interpolator = &__pyx_vtable_7cartopy_5trace_Interpolator;
9637   __pyx_vtable_7cartopy_5trace_Interpolator.init = (void (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, projPJ, projPJ))__pyx_f_7cartopy_5trace_12Interpolator_init;
9638   __pyx_vtable_7cartopy_5trace_Interpolator.set_line = (void (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_12Interpolator_set_line;
9639   __pyx_vtable_7cartopy_5trace_Interpolator.interpolate = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, double))__pyx_f_7cartopy_5trace_12Interpolator_interpolate;
9640   __pyx_vtable_7cartopy_5trace_Interpolator.project = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_12Interpolator_project;
9641   if (PyType_Ready(&__pyx_type_7cartopy_5trace_Interpolator) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
9642   #if PY_VERSION_HEX < 0x030800B1
9643   __pyx_type_7cartopy_5trace_Interpolator.tp_print = 0;
9644   #endif
9645   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7cartopy_5trace_Interpolator.tp_dictoffset && __pyx_type_7cartopy_5trace_Interpolator.tp_getattro == PyObject_GenericGetAttr)) {
9646     __pyx_type_7cartopy_5trace_Interpolator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9647   }
9648   if (__Pyx_SetVtable(__pyx_type_7cartopy_5trace_Interpolator.tp_dict, __pyx_vtabptr_7cartopy_5trace_Interpolator) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
9649   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Interpolator, (PyObject *)&__pyx_type_7cartopy_5trace_Interpolator) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
9650   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7cartopy_5trace_Interpolator) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
9651   __pyx_ptype_7cartopy_5trace_Interpolator = &__pyx_type_7cartopy_5trace_Interpolator;
9652   __pyx_vtabptr_7cartopy_5trace_CartesianInterpolator = &__pyx_vtable_7cartopy_5trace_CartesianInterpolator;
9653   __pyx_vtable_7cartopy_5trace_CartesianInterpolator.__pyx_base = *__pyx_vtabptr_7cartopy_5trace_Interpolator;
9654   __pyx_vtable_7cartopy_5trace_CartesianInterpolator.__pyx_base.interpolate = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, double))__pyx_f_7cartopy_5trace_21CartesianInterpolator_interpolate;
9655   __pyx_vtable_7cartopy_5trace_CartesianInterpolator.__pyx_base.project = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_21CartesianInterpolator_project;
9656   __pyx_type_7cartopy_5trace_CartesianInterpolator.tp_base = __pyx_ptype_7cartopy_5trace_Interpolator;
9657   if (PyType_Ready(&__pyx_type_7cartopy_5trace_CartesianInterpolator) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
9658   #if PY_VERSION_HEX < 0x030800B1
9659   __pyx_type_7cartopy_5trace_CartesianInterpolator.tp_print = 0;
9660   #endif
9661   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7cartopy_5trace_CartesianInterpolator.tp_dictoffset && __pyx_type_7cartopy_5trace_CartesianInterpolator.tp_getattro == PyObject_GenericGetAttr)) {
9662     __pyx_type_7cartopy_5trace_CartesianInterpolator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9663   }
9664   if (__Pyx_SetVtable(__pyx_type_7cartopy_5trace_CartesianInterpolator.tp_dict, __pyx_vtabptr_7cartopy_5trace_CartesianInterpolator) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
9665   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CartesianInterpolator, (PyObject *)&__pyx_type_7cartopy_5trace_CartesianInterpolator) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
9666   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7cartopy_5trace_CartesianInterpolator) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
9667   __pyx_ptype_7cartopy_5trace_CartesianInterpolator = &__pyx_type_7cartopy_5trace_CartesianInterpolator;
9668   __pyx_vtabptr_7cartopy_5trace_SphericalInterpolator = &__pyx_vtable_7cartopy_5trace_SphericalInterpolator;
9669   __pyx_vtable_7cartopy_5trace_SphericalInterpolator.__pyx_base = *__pyx_vtabptr_7cartopy_5trace_Interpolator;
9670   __pyx_vtable_7cartopy_5trace_SphericalInterpolator.__pyx_base.init = (void (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, projPJ, projPJ))__pyx_f_7cartopy_5trace_21SphericalInterpolator_init;
9671   __pyx_vtable_7cartopy_5trace_SphericalInterpolator.__pyx_base.set_line = (void (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_21SphericalInterpolator_set_line;
9672   __pyx_vtable_7cartopy_5trace_SphericalInterpolator.__pyx_base.interpolate = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, double))__pyx_f_7cartopy_5trace_21SphericalInterpolator_interpolate;
9673   __pyx_vtable_7cartopy_5trace_SphericalInterpolator.__pyx_base.project = (__pyx_t_7cartopy_5trace_Point (*)(struct __pyx_obj_7cartopy_5trace_Interpolator *, __pyx_t_7cartopy_5trace_Point const &))__pyx_f_7cartopy_5trace_21SphericalInterpolator_project;
9674   __pyx_type_7cartopy_5trace_SphericalInterpolator.tp_base = __pyx_ptype_7cartopy_5trace_Interpolator;
9675   if (PyType_Ready(&__pyx_type_7cartopy_5trace_SphericalInterpolator) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
9676   #if PY_VERSION_HEX < 0x030800B1
9677   __pyx_type_7cartopy_5trace_SphericalInterpolator.tp_print = 0;
9678   #endif
9679   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7cartopy_5trace_SphericalInterpolator.tp_dictoffset && __pyx_type_7cartopy_5trace_SphericalInterpolator.tp_getattro == PyObject_GenericGetAttr)) {
9680     __pyx_type_7cartopy_5trace_SphericalInterpolator.tp_getattro = __Pyx_PyObject_GenericGetAttr;
9681   }
9682   if (__Pyx_SetVtable(__pyx_type_7cartopy_5trace_SphericalInterpolator.tp_dict, __pyx_vtabptr_7cartopy_5trace_SphericalInterpolator) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
9683   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SphericalInterpolator, (PyObject *)&__pyx_type_7cartopy_5trace_SphericalInterpolator) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
9684   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7cartopy_5trace_SphericalInterpolator) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
9685   __pyx_ptype_7cartopy_5trace_SphericalInterpolator = &__pyx_type_7cartopy_5trace_SphericalInterpolator;
9686   __Pyx_RefNannyFinishContext();
9687   return 0;
9688   __pyx_L1_error:;
9689   __Pyx_RefNannyFinishContext();
9690   return -1;
9691 }
9692 
__Pyx_modinit_type_import_code(void)9693 static int __Pyx_modinit_type_import_code(void) {
9694   __Pyx_RefNannyDeclarations
9695   PyObject *__pyx_t_1 = NULL;
9696   int __pyx_lineno = 0;
9697   const char *__pyx_filename = NULL;
9698   int __pyx_clineno = 0;
9699   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9700   /*--- Type import code ---*/
9701   __pyx_t_1 = PyImport_ImportModule("cartopy._crs"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
9702   __Pyx_GOTREF(__pyx_t_1);
9703   __pyx_ptype_7cartopy_4_crs_CRS = __Pyx_ImportType(__pyx_t_1, "cartopy._crs", "CRS", sizeof(struct __pyx_obj_7cartopy_4_crs_CRS), __Pyx_ImportType_CheckSize_Warn);
9704    if (!__pyx_ptype_7cartopy_4_crs_CRS) __PYX_ERR(2, 10, __pyx_L1_error)
9705   __pyx_vtabptr_7cartopy_4_crs_CRS = (struct __pyx_vtabstruct_7cartopy_4_crs_CRS*)__Pyx_GetVtable(__pyx_ptype_7cartopy_4_crs_CRS->tp_dict); if (unlikely(!__pyx_vtabptr_7cartopy_4_crs_CRS)) __PYX_ERR(2, 10, __pyx_L1_error)
9706   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9707   __Pyx_RefNannyFinishContext();
9708   return 0;
9709   __pyx_L1_error:;
9710   __Pyx_XDECREF(__pyx_t_1);
9711   __Pyx_RefNannyFinishContext();
9712   return -1;
9713 }
9714 
__Pyx_modinit_variable_import_code(void)9715 static int __Pyx_modinit_variable_import_code(void) {
9716   __Pyx_RefNannyDeclarations
9717   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9718   /*--- Variable import code ---*/
9719   __Pyx_RefNannyFinishContext();
9720   return 0;
9721 }
9722 
__Pyx_modinit_function_import_code(void)9723 static int __Pyx_modinit_function_import_code(void) {
9724   __Pyx_RefNannyDeclarations
9725   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9726   /*--- Function import code ---*/
9727   __Pyx_RefNannyFinishContext();
9728   return 0;
9729 }
9730 
9731 
9732 #ifndef CYTHON_NO_PYINIT_EXPORT
9733 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9734 #elif PY_MAJOR_VERSION < 3
9735 #ifdef __cplusplus
9736 #define __Pyx_PyMODINIT_FUNC extern "C" void
9737 #else
9738 #define __Pyx_PyMODINIT_FUNC void
9739 #endif
9740 #else
9741 #ifdef __cplusplus
9742 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9743 #else
9744 #define __Pyx_PyMODINIT_FUNC PyObject *
9745 #endif
9746 #endif
9747 
9748 
9749 #if PY_MAJOR_VERSION < 3
9750 __Pyx_PyMODINIT_FUNC inittrace(void) CYTHON_SMALL_CODE; /*proto*/
inittrace(void)9751 __Pyx_PyMODINIT_FUNC inittrace(void)
9752 #else
9753 __Pyx_PyMODINIT_FUNC PyInit_trace(void) CYTHON_SMALL_CODE; /*proto*/
9754 __Pyx_PyMODINIT_FUNC PyInit_trace(void)
9755 #if CYTHON_PEP489_MULTI_PHASE_INIT
9756 {
9757   return PyModuleDef_Init(&__pyx_moduledef);
9758 }
9759 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
9760     #if PY_VERSION_HEX >= 0x030700A1
9761     static PY_INT64_T main_interpreter_id = -1;
9762     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
9763     if (main_interpreter_id == -1) {
9764         main_interpreter_id = current_id;
9765         return (unlikely(current_id == -1)) ? -1 : 0;
9766     } else if (unlikely(main_interpreter_id != current_id))
9767     #else
9768     static PyInterpreterState *main_interpreter = NULL;
9769     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
9770     if (!main_interpreter) {
9771         main_interpreter = current_interpreter;
9772     } else if (unlikely(main_interpreter != current_interpreter))
9773     #endif
9774     {
9775         PyErr_SetString(
9776             PyExc_ImportError,
9777             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
9778         return -1;
9779     }
9780     return 0;
9781 }
9782 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
9783     PyObject *value = PyObject_GetAttrString(spec, from_name);
9784     int result = 0;
9785     if (likely(value)) {
9786         if (allow_none || value != Py_None) {
9787             result = PyDict_SetItemString(moddict, to_name, value);
9788         }
9789         Py_DECREF(value);
9790     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
9791         PyErr_Clear();
9792     } else {
9793         result = -1;
9794     }
9795     return result;
9796 }
9797 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
9798     PyObject *module = NULL, *moddict, *modname;
9799     if (__Pyx_check_single_interpreter())
9800         return NULL;
9801     if (__pyx_m)
9802         return __Pyx_NewRef(__pyx_m);
9803     modname = PyObject_GetAttrString(spec, "name");
9804     if (unlikely(!modname)) goto bad;
9805     module = PyModule_NewObject(modname);
9806     Py_DECREF(modname);
9807     if (unlikely(!module)) goto bad;
9808     moddict = PyModule_GetDict(module);
9809     if (unlikely(!moddict)) goto bad;
9810     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
9811     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
9812     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
9813     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
9814     return module;
9815 bad:
9816     Py_XDECREF(module);
9817     return NULL;
9818 }
9819 
9820 
9821 static CYTHON_SMALL_CODE int __pyx_pymod_exec_trace(PyObject *__pyx_pyinit_module)
9822 #endif
9823 #endif
9824 {
9825   PyObject *__pyx_t_1 = NULL;
9826   PyObject *__pyx_t_2 = NULL;
9827   PyObject *__pyx_t_3 = NULL;
9828   int __pyx_lineno = 0;
9829   const char *__pyx_filename = NULL;
9830   int __pyx_clineno = 0;
9831   __Pyx_RefNannyDeclarations
9832   #if CYTHON_PEP489_MULTI_PHASE_INIT
9833   if (__pyx_m) {
9834     if (__pyx_m == __pyx_pyinit_module) return 0;
9835     PyErr_SetString(PyExc_RuntimeError, "Module 'trace' has already been imported. Re-initialisation is not supported.");
9836     return -1;
9837   }
9838   #elif PY_MAJOR_VERSION >= 3
9839   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
9840   #endif
9841   #if CYTHON_REFNANNY
9842 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9843 if (!__Pyx_RefNanny) {
9844   PyErr_Clear();
9845   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9846   if (!__Pyx_RefNanny)
9847       Py_FatalError("failed to import 'refnanny' module");
9848 }
9849 #endif
9850   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_trace(void)", 0);
9851   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9852   #ifdef __Pxy_PyFrame_Initialize_Offsets
9853   __Pxy_PyFrame_Initialize_Offsets();
9854   #endif
9855   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
9856   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
9857   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
9858   #ifdef __Pyx_CyFunction_USED
9859   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9860   #endif
9861   #ifdef __Pyx_FusedFunction_USED
9862   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9863   #endif
9864   #ifdef __Pyx_Coroutine_USED
9865   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9866   #endif
9867   #ifdef __Pyx_Generator_USED
9868   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9869   #endif
9870   #ifdef __Pyx_AsyncGen_USED
9871   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9872   #endif
9873   #ifdef __Pyx_StopAsyncIteration_USED
9874   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9875   #endif
9876   /*--- Library function declarations ---*/
9877   /*--- Threads initialization code ---*/
9878   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
9879   #ifdef WITH_THREAD /* Python build with threading support? */
9880   PyEval_InitThreads();
9881   #endif
9882   #endif
9883   /*--- Module creation code ---*/
9884   #if CYTHON_PEP489_MULTI_PHASE_INIT
9885   __pyx_m = __pyx_pyinit_module;
9886   Py_INCREF(__pyx_m);
9887   #else
9888   #if PY_MAJOR_VERSION < 3
9889   __pyx_m = Py_InitModule4("trace", __pyx_methods, __pyx_k_This_module_pulls_together_proj, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
9890   #else
9891   __pyx_m = PyModule_Create(&__pyx_moduledef);
9892   #endif
9893   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
9894   #endif
9895   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
9896   Py_INCREF(__pyx_d);
9897   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
9898   Py_INCREF(__pyx_b);
9899   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
9900   Py_INCREF(__pyx_cython_runtime);
9901   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9902   /*--- Initialize various global constants etc. ---*/
9903   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9904   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
9905   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9906   #endif
9907   if (__pyx_module_is_main_cartopy__trace) {
9908     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9909   }
9910   #if PY_MAJOR_VERSION >= 3
9911   {
9912     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
9913     if (!PyDict_GetItemString(modules, "cartopy.trace")) {
9914       if (unlikely(PyDict_SetItemString(modules, "cartopy.trace", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9915     }
9916   }
9917   #endif
9918   /*--- Builtin init code ---*/
9919   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9920   /*--- Constants init code ---*/
9921   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9922   /*--- Global type/function init code ---*/
9923   (void)__Pyx_modinit_global_init_code();
9924   (void)__Pyx_modinit_variable_export_code();
9925   (void)__Pyx_modinit_function_export_code();
9926   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9927   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
9928   (void)__Pyx_modinit_variable_import_code();
9929   (void)__Pyx_modinit_function_import_code();
9930   /*--- Execution code ---*/
9931   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
9932   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9933   #endif
9934 
9935   /* "cartopy/trace.pyx":25
9936  * from libcpp.vector cimport vector
9937  *
9938  * cdef bool DEBUG = False             # <<<<<<<<<<<<<<
9939  *
9940  * cdef extern from "geos_c.h":
9941  */
9942   __pyx_v_7cartopy_5trace_DEBUG = 0;
9943 
9944   /* "cartopy/trace.pyx":52
9945  *
9946  * from cartopy._crs cimport CRS
9947  * from cartopy._crs import PROJ4_VERSION             # <<<<<<<<<<<<<<
9948  * from ._proj4 cimport (projPJ, projLP, pj_get_spheroid_defn, pj_transform,
9949  *                       pj_strerrno, DEG_TO_RAD)
9950  */
9951   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
9952   __Pyx_GOTREF(__pyx_t_1);
9953   __Pyx_INCREF(__pyx_n_s_PROJ4_VERSION);
9954   __Pyx_GIVEREF(__pyx_n_s_PROJ4_VERSION);
9955   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PROJ4_VERSION);
9956   __pyx_t_2 = __Pyx_Import(__pyx_n_s_cartopy__crs, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
9957   __Pyx_GOTREF(__pyx_t_2);
9958   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9959   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PROJ4_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
9960   __Pyx_GOTREF(__pyx_t_1);
9961   if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROJ4_VERSION, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
9962   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9963   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9964 
9965   /* "cartopy/trace.pyx":61
9966  *
9967  *
9968  * import shapely.geometry as sgeom             # <<<<<<<<<<<<<<
9969  * from shapely.geos import lgeos
9970  *
9971  */
9972   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
9973   __Pyx_GOTREF(__pyx_t_2);
9974   __Pyx_INCREF(__pyx_n_s__27);
9975   __Pyx_GIVEREF(__pyx_n_s__27);
9976   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__27);
9977   __pyx_t_1 = __Pyx_Import(__pyx_n_s_shapely_geometry, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
9978   __Pyx_GOTREF(__pyx_t_1);
9979   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9980   if (PyDict_SetItem(__pyx_d, __pyx_n_s_sgeom, __pyx_t_1) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
9981   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9982 
9983   /* "cartopy/trace.pyx":62
9984  *
9985  * import shapely.geometry as sgeom
9986  * from shapely.geos import lgeos             # <<<<<<<<<<<<<<
9987  *
9988  *
9989  */
9990   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
9991   __Pyx_GOTREF(__pyx_t_1);
9992   __Pyx_INCREF(__pyx_n_s_lgeos);
9993   __Pyx_GIVEREF(__pyx_n_s_lgeos);
9994   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_lgeos);
9995   __pyx_t_2 = __Pyx_Import(__pyx_n_s_shapely_geos, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
9996   __Pyx_GOTREF(__pyx_t_2);
9997   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9998   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_lgeos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
9999   __Pyx_GOTREF(__pyx_t_1);
10000   if (PyDict_SetItem(__pyx_d, __pyx_n_s_lgeos, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
10001   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10002   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10003 
10004   /* "cartopy/trace.pyx":592
10005  *
10006  *
10007  * def project_linear(geometry not None, CRS src_crs not None,             # <<<<<<<<<<<<<<
10008  *                    dest_projection not None):
10009  *     """
10010  */
10011   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cartopy_5trace_1project_linear, NULL, __pyx_n_s_cartopy_trace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
10012   __Pyx_GOTREF(__pyx_t_2);
10013   if (PyDict_SetItem(__pyx_d, __pyx_n_s_project_linear, __pyx_t_2) < 0) __PYX_ERR(0, 592, __pyx_L1_error)
10014   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10015 
10016   /* "cartopy/trace.pyx":648
10017  *
10018  *
10019  * class _Testing:             # <<<<<<<<<<<<<<
10020  *     @staticmethod
10021  *     def straight_and_within(Point l_start, Point l_end,
10022  */
10023   __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Testing, __pyx_n_s_Testing, (PyObject *) NULL, __pyx_n_s_cartopy_trace, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L1_error)
10024   __Pyx_GOTREF(__pyx_t_2);
10025 
10026   /* "cartopy/trace.pyx":650
10027  * class _Testing:
10028  *     @staticmethod
10029  *     def straight_and_within(Point l_start, Point l_end,             # <<<<<<<<<<<<<<
10030  *                             double t_start, double t_end,
10031  *                             Interpolator interpolator, double threshold,
10032  */
10033   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7cartopy_5trace_8_Testing_1straight_and_within, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Testing_straight_and_within, NULL, __pyx_n_s_cartopy_trace, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L1_error)
10034   __Pyx_GOTREF(__pyx_t_1);
10035 
10036   /* "cartopy/trace.pyx":649
10037  *
10038  * class _Testing:
10039  *     @staticmethod             # <<<<<<<<<<<<<<
10040  *     def straight_and_within(Point l_start, Point l_end,
10041  *                             double t_start, double t_end,
10042  */
10043   __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 649, __pyx_L1_error)
10044   __Pyx_GOTREF(__pyx_t_3);
10045   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10046   if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_straight_and_within, __pyx_t_3) < 0) __PYX_ERR(0, 650, __pyx_L1_error)
10047   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10048 
10049   /* "cartopy/trace.pyx":683
10050  *
10051  *     @staticmethod
10052  *     def interpolator(source_crs, destination_projection):             # <<<<<<<<<<<<<<
10053  *         return _interpolator(source_crs, destination_projection)
10054  *
10055  */
10056   __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7cartopy_5trace_8_Testing_3interpolator, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Testing_interpolator, NULL, __pyx_n_s_cartopy_trace, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
10057   __Pyx_GOTREF(__pyx_t_3);
10058 
10059   /* "cartopy/trace.pyx":682
10060  *         return valid
10061  *
10062  *     @staticmethod             # <<<<<<<<<<<<<<
10063  *     def interpolator(source_crs, destination_projection):
10064  *         return _interpolator(source_crs, destination_projection)
10065  */
10066   __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
10067   __Pyx_GOTREF(__pyx_t_1);
10068   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10069   if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_interpolator, __pyx_t_1) < 0) __PYX_ERR(0, 683, __pyx_L1_error)
10070   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10071 
10072   /* "cartopy/trace.pyx":687
10073  *
10074  *     @staticmethod
10075  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):             # <<<<<<<<<<<<<<
10076  *         return interp.project(lonlat)
10077  *
10078  */
10079   __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7cartopy_5trace_8_Testing_5interp_prj_pt, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Testing_interp_prj_pt, NULL, __pyx_n_s_cartopy_trace, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error)
10080   __Pyx_GOTREF(__pyx_t_1);
10081 
10082   /* "cartopy/trace.pyx":686
10083  *         return _interpolator(source_crs, destination_projection)
10084  *
10085  *     @staticmethod             # <<<<<<<<<<<<<<
10086  *     def interp_prj_pt(Interpolator interp, const Point &lonlat):
10087  *         return interp.project(lonlat)
10088  */
10089   __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error)
10090   __Pyx_GOTREF(__pyx_t_3);
10091   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10092   if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_interp_prj_pt, __pyx_t_3) < 0) __PYX_ERR(0, 687, __pyx_L1_error)
10093   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10094 
10095   /* "cartopy/trace.pyx":691
10096  *
10097  *     @staticmethod
10098  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):             # <<<<<<<<<<<<<<
10099  *         interp.set_line(start, end)
10100  *         return interp.interpolate(t)
10101  */
10102   __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7cartopy_5trace_8_Testing_7interp_t_pt, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Testing_interp_t_pt, NULL, __pyx_n_s_cartopy_trace, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 691, __pyx_L1_error)
10103   __Pyx_GOTREF(__pyx_t_3);
10104 
10105   /* "cartopy/trace.pyx":690
10106  *         return interp.project(lonlat)
10107  *
10108  *     @staticmethod             # <<<<<<<<<<<<<<
10109  *     def interp_t_pt(Interpolator interp, const Point &start, const Point &end, double t):
10110  *         interp.set_line(start, end)
10111  */
10112   __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error)
10113   __Pyx_GOTREF(__pyx_t_1);
10114   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10115   if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_interp_t_pt, __pyx_t_1) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
10116   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10117 
10118   /* "cartopy/trace.pyx":648
10119  *
10120  *
10121  * class _Testing:             # <<<<<<<<<<<<<<
10122  *     @staticmethod
10123  *     def straight_and_within(Point l_start, Point l_end,
10124  */
10125   __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Testing, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
10126   __Pyx_GOTREF(__pyx_t_1);
10127   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Testing, __pyx_t_1) < 0) __PYX_ERR(0, 648, __pyx_L1_error)
10128   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10129   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10130 
10131   /* "(tree fragment)":1
10132  * def __pyx_unpickle_LineAccumulator(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
10133  *     cdef object __pyx_PickleError
10134  *     cdef object __pyx_result
10135  */
10136   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cartopy_5trace_3__pyx_unpickle_LineAccumulator, NULL, __pyx_n_s_cartopy_trace); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
10137   __Pyx_GOTREF(__pyx_t_2);
10138   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_LineAccumulator, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10139   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10140 
10141   /* "cartopy/trace.pyx":1
10142  * # Copyright Cartopy Contributors             # <<<<<<<<<<<<<<
10143  * #
10144  * # This file is part of Cartopy and is released under the LGPL license.
10145  */
10146   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
10147   __Pyx_GOTREF(__pyx_t_2);
10148   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10149   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10150 
10151   /* "list.from_py":71
10152  *
10153  * @cname("__pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line")
10154  * cdef cpp_list[X] __pyx_convert_list_from_py___pyx_t_7cartopy_5trace_Line(object o) except *:             # <<<<<<<<<<<<<<
10155  *     cdef cpp_list[X] l
10156  *     for item in o:
10157  */
10158 
10159   /*--- Wrapped vars code ---*/
10160 
10161   goto __pyx_L0;
10162   __pyx_L1_error:;
10163   __Pyx_XDECREF(__pyx_t_1);
10164   __Pyx_XDECREF(__pyx_t_2);
10165   __Pyx_XDECREF(__pyx_t_3);
10166   if (__pyx_m) {
10167     if (__pyx_d) {
10168       __Pyx_AddTraceback("init cartopy.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
10169     }
10170     Py_CLEAR(__pyx_m);
10171   } else if (!PyErr_Occurred()) {
10172     PyErr_SetString(PyExc_ImportError, "init cartopy.trace");
10173   }
10174   __pyx_L0:;
10175   __Pyx_RefNannyFinishContext();
10176   #if CYTHON_PEP489_MULTI_PHASE_INIT
10177   return (__pyx_m != NULL) ? 0 : -1;
10178   #elif PY_MAJOR_VERSION >= 3
10179   return __pyx_m;
10180   #else
10181   return;
10182   #endif
10183 }
10184 
10185 /* --- Runtime support code --- */
10186 /* Refnanny */
10187 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)10188 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10189     PyObject *m = NULL, *p = NULL;
10190     void *r = NULL;
10191     m = PyImport_ImportModule(modname);
10192     if (!m) goto end;
10193     p = PyObject_GetAttrString(m, "RefNannyAPI");
10194     if (!p) goto end;
10195     r = PyLong_AsVoidPtr(p);
10196 end:
10197     Py_XDECREF(p);
10198     Py_XDECREF(m);
10199     return (__Pyx_RefNannyAPIStruct *)r;
10200 }
10201 #endif
10202 
10203 /* PyObjectGetAttrStr */
10204 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)10205 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
10206     PyTypeObject* tp = Py_TYPE(obj);
10207     if (likely(tp->tp_getattro))
10208         return tp->tp_getattro(obj, attr_name);
10209 #if PY_MAJOR_VERSION < 3
10210     if (likely(tp->tp_getattr))
10211         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
10212 #endif
10213     return PyObject_GetAttr(obj, attr_name);
10214 }
10215 #endif
10216 
10217 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)10218 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
10219     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
10220     if (unlikely(!result)) {
10221         PyErr_Format(PyExc_NameError,
10222 #if PY_MAJOR_VERSION >= 3
10223             "name '%U' is not defined", name);
10224 #else
10225             "name '%.200s' is not defined", PyString_AS_STRING(name));
10226 #endif
10227     }
10228     return result;
10229 }
10230 
10231 /* PyDictVersioning */
10232 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)10233 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
10234     PyObject *dict = Py_TYPE(obj)->tp_dict;
10235     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
10236 }
__Pyx_get_object_dict_version(PyObject * obj)10237 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
10238     PyObject **dictptr = NULL;
10239     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
10240     if (offset) {
10241 #if CYTHON_COMPILING_IN_CPYTHON
10242         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
10243 #else
10244         dictptr = _PyObject_GetDictPtr(obj);
10245 #endif
10246     }
10247     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
10248 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)10249 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
10250     PyObject *dict = Py_TYPE(obj)->tp_dict;
10251     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
10252         return 0;
10253     return obj_dict_version == __Pyx_get_object_dict_version(obj);
10254 }
10255 #endif
10256 
10257 /* GetModuleGlobalName */
10258 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)10259 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
10260 #else
10261 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
10262 #endif
10263 {
10264     PyObject *result;
10265 #if !CYTHON_AVOID_BORROWED_REFS
10266 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
10267     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
10268     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
10269     if (likely(result)) {
10270         return __Pyx_NewRef(result);
10271     } else if (unlikely(PyErr_Occurred())) {
10272         return NULL;
10273     }
10274 #else
10275     result = PyDict_GetItem(__pyx_d, name);
10276     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
10277     if (likely(result)) {
10278         return __Pyx_NewRef(result);
10279     }
10280 #endif
10281 #else
10282     result = PyObject_GetItem(__pyx_d, name);
10283     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
10284     if (likely(result)) {
10285         return __Pyx_NewRef(result);
10286     }
10287     PyErr_Clear();
10288 #endif
10289     return __Pyx_GetBuiltinName(name);
10290 }
10291 
10292 /* PyErrFetchRestore */
10293 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)10294 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
10295     PyObject *tmp_type, *tmp_value, *tmp_tb;
10296     tmp_type = tstate->curexc_type;
10297     tmp_value = tstate->curexc_value;
10298     tmp_tb = tstate->curexc_traceback;
10299     tstate->curexc_type = type;
10300     tstate->curexc_value = value;
10301     tstate->curexc_traceback = tb;
10302     Py_XDECREF(tmp_type);
10303     Py_XDECREF(tmp_value);
10304     Py_XDECREF(tmp_tb);
10305 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)10306 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
10307     *type = tstate->curexc_type;
10308     *value = tstate->curexc_value;
10309     *tb = tstate->curexc_traceback;
10310     tstate->curexc_type = 0;
10311     tstate->curexc_value = 0;
10312     tstate->curexc_traceback = 0;
10313 }
10314 #endif
10315 
10316 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)10317 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
10318                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
10319                                   int full_traceback, CYTHON_UNUSED int nogil) {
10320     PyObject *old_exc, *old_val, *old_tb;
10321     PyObject *ctx;
10322     __Pyx_PyThreadState_declare
10323 #ifdef WITH_THREAD
10324     PyGILState_STATE state;
10325     if (nogil)
10326         state = PyGILState_Ensure();
10327 #ifdef _MSC_VER
10328     else state = (PyGILState_STATE)-1;
10329 #endif
10330 #endif
10331     __Pyx_PyThreadState_assign
10332     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
10333     if (full_traceback) {
10334         Py_XINCREF(old_exc);
10335         Py_XINCREF(old_val);
10336         Py_XINCREF(old_tb);
10337         __Pyx_ErrRestore(old_exc, old_val, old_tb);
10338         PyErr_PrintEx(1);
10339     }
10340     #if PY_MAJOR_VERSION < 3
10341     ctx = PyString_FromString(name);
10342     #else
10343     ctx = PyUnicode_FromString(name);
10344     #endif
10345     __Pyx_ErrRestore(old_exc, old_val, old_tb);
10346     if (!ctx) {
10347         PyErr_WriteUnraisable(Py_None);
10348     } else {
10349         PyErr_WriteUnraisable(ctx);
10350         Py_DECREF(ctx);
10351     }
10352 #ifdef WITH_THREAD
10353     if (nogil)
10354         PyGILState_Release(state);
10355 #endif
10356 }
10357 
10358 /* PyCFunctionFastCall */
10359 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)10360 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
10361     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
10362     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
10363     PyObject *self = PyCFunction_GET_SELF(func);
10364     int flags = PyCFunction_GET_FLAGS(func);
10365     assert(PyCFunction_Check(func));
10366     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
10367     assert(nargs >= 0);
10368     assert(nargs == 0 || args != NULL);
10369     /* _PyCFunction_FastCallDict() must not be called with an exception set,
10370        because it may clear it (directly or indirectly) and so the
10371        caller loses its exception */
10372     assert(!PyErr_Occurred());
10373     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
10374         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
10375     } else {
10376         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
10377     }
10378 }
10379 #endif
10380 
10381 /* PyFunctionFastCall */
10382 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)10383 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
10384                                                PyObject *globals) {
10385     PyFrameObject *f;
10386     PyThreadState *tstate = __Pyx_PyThreadState_Current;
10387     PyObject **fastlocals;
10388     Py_ssize_t i;
10389     PyObject *result;
10390     assert(globals != NULL);
10391     /* XXX Perhaps we should create a specialized
10392        PyFrame_New() that doesn't take locals, but does
10393        take builtins without sanity checking them.
10394        */
10395     assert(tstate != NULL);
10396     f = PyFrame_New(tstate, co, globals, NULL);
10397     if (f == NULL) {
10398         return NULL;
10399     }
10400     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
10401     for (i = 0; i < na; i++) {
10402         Py_INCREF(*args);
10403         fastlocals[i] = *args++;
10404     }
10405     result = PyEval_EvalFrameEx(f,0);
10406     ++tstate->recursion_depth;
10407     Py_DECREF(f);
10408     --tstate->recursion_depth;
10409     return result;
10410 }
10411 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)10412 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
10413     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
10414     PyObject *globals = PyFunction_GET_GLOBALS(func);
10415     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
10416     PyObject *closure;
10417 #if PY_MAJOR_VERSION >= 3
10418     PyObject *kwdefs;
10419 #endif
10420     PyObject *kwtuple, **k;
10421     PyObject **d;
10422     Py_ssize_t nd;
10423     Py_ssize_t nk;
10424     PyObject *result;
10425     assert(kwargs == NULL || PyDict_Check(kwargs));
10426     nk = kwargs ? PyDict_Size(kwargs) : 0;
10427     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
10428         return NULL;
10429     }
10430     if (
10431 #if PY_MAJOR_VERSION >= 3
10432             co->co_kwonlyargcount == 0 &&
10433 #endif
10434             likely(kwargs == NULL || nk == 0) &&
10435             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
10436         if (argdefs == NULL && co->co_argcount == nargs) {
10437             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
10438             goto done;
10439         }
10440         else if (nargs == 0 && argdefs != NULL
10441                  && co->co_argcount == Py_SIZE(argdefs)) {
10442             /* function called with no arguments, but all parameters have
10443                a default value: use default values as arguments .*/
10444             args = &PyTuple_GET_ITEM(argdefs, 0);
10445             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
10446             goto done;
10447         }
10448     }
10449     if (kwargs != NULL) {
10450         Py_ssize_t pos, i;
10451         kwtuple = PyTuple_New(2 * nk);
10452         if (kwtuple == NULL) {
10453             result = NULL;
10454             goto done;
10455         }
10456         k = &PyTuple_GET_ITEM(kwtuple, 0);
10457         pos = i = 0;
10458         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
10459             Py_INCREF(k[i]);
10460             Py_INCREF(k[i+1]);
10461             i += 2;
10462         }
10463         nk = i / 2;
10464     }
10465     else {
10466         kwtuple = NULL;
10467         k = NULL;
10468     }
10469     closure = PyFunction_GET_CLOSURE(func);
10470 #if PY_MAJOR_VERSION >= 3
10471     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
10472 #endif
10473     if (argdefs != NULL) {
10474         d = &PyTuple_GET_ITEM(argdefs, 0);
10475         nd = Py_SIZE(argdefs);
10476     }
10477     else {
10478         d = NULL;
10479         nd = 0;
10480     }
10481 #if PY_MAJOR_VERSION >= 3
10482     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
10483                                args, (int)nargs,
10484                                k, (int)nk,
10485                                d, (int)nd, kwdefs, closure);
10486 #else
10487     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
10488                                args, (int)nargs,
10489                                k, (int)nk,
10490                                d, (int)nd, closure);
10491 #endif
10492     Py_XDECREF(kwtuple);
10493 done:
10494     Py_LeaveRecursiveCall();
10495     return result;
10496 }
10497 #endif
10498 #endif
10499 
10500 /* PyObjectCall */
10501 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)10502 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
10503     PyObject *result;
10504     ternaryfunc call = func->ob_type->tp_call;
10505     if (unlikely(!call))
10506         return PyObject_Call(func, arg, kw);
10507     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
10508         return NULL;
10509     result = (*call)(func, arg, kw);
10510     Py_LeaveRecursiveCall();
10511     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10512         PyErr_SetString(
10513             PyExc_SystemError,
10514             "NULL result without error in PyObject_Call");
10515     }
10516     return result;
10517 }
10518 #endif
10519 
10520 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)10521 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
10522     PyObject *args, *result = NULL;
10523     #if CYTHON_FAST_PYCALL
10524     if (PyFunction_Check(function)) {
10525         PyObject *args[2] = {arg1, arg2};
10526         return __Pyx_PyFunction_FastCall(function, args, 2);
10527     }
10528     #endif
10529     #if CYTHON_FAST_PYCCALL
10530     if (__Pyx_PyFastCFunction_Check(function)) {
10531         PyObject *args[2] = {arg1, arg2};
10532         return __Pyx_PyCFunction_FastCall(function, args, 2);
10533     }
10534     #endif
10535     args = PyTuple_New(2);
10536     if (unlikely(!args)) goto done;
10537     Py_INCREF(arg1);
10538     PyTuple_SET_ITEM(args, 0, arg1);
10539     Py_INCREF(arg2);
10540     PyTuple_SET_ITEM(args, 1, arg2);
10541     Py_INCREF(function);
10542     result = __Pyx_PyObject_Call(function, args, NULL);
10543     Py_DECREF(args);
10544     Py_DECREF(function);
10545 done:
10546     return result;
10547 }
10548 
10549 /* PyObjectCallMethO */
10550 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)10551 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
10552     PyObject *self, *result;
10553     PyCFunction cfunc;
10554     cfunc = PyCFunction_GET_FUNCTION(func);
10555     self = PyCFunction_GET_SELF(func);
10556     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
10557         return NULL;
10558     result = cfunc(self, arg);
10559     Py_LeaveRecursiveCall();
10560     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
10561         PyErr_SetString(
10562             PyExc_SystemError,
10563             "NULL result without error in PyObject_Call");
10564     }
10565     return result;
10566 }
10567 #endif
10568 
10569 /* PyObjectCallOneArg */
10570 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)10571 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
10572     PyObject *result;
10573     PyObject *args = PyTuple_New(1);
10574     if (unlikely(!args)) return NULL;
10575     Py_INCREF(arg);
10576     PyTuple_SET_ITEM(args, 0, arg);
10577     result = __Pyx_PyObject_Call(func, args, NULL);
10578     Py_DECREF(args);
10579     return result;
10580 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)10581 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
10582 #if CYTHON_FAST_PYCALL
10583     if (PyFunction_Check(func)) {
10584         return __Pyx_PyFunction_FastCall(func, &arg, 1);
10585     }
10586 #endif
10587     if (likely(PyCFunction_Check(func))) {
10588         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
10589             return __Pyx_PyObject_CallMethO(func, arg);
10590 #if CYTHON_FAST_PYCCALL
10591         } else if (__Pyx_PyFastCFunction_Check(func)) {
10592             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
10593 #endif
10594         }
10595     }
10596     return __Pyx__PyObject_CallOneArg(func, arg);
10597 }
10598 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)10599 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
10600     PyObject *result;
10601     PyObject *args = PyTuple_Pack(1, arg);
10602     if (unlikely(!args)) return NULL;
10603     result = __Pyx_PyObject_Call(func, args, NULL);
10604     Py_DECREF(args);
10605     return result;
10606 }
10607 #endif
10608 
10609 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)10610 static void __Pyx_RaiseArgtupleInvalid(
10611     const char* func_name,
10612     int exact,
10613     Py_ssize_t num_min,
10614     Py_ssize_t num_max,
10615     Py_ssize_t num_found)
10616 {
10617     Py_ssize_t num_expected;
10618     const char *more_or_less;
10619     if (num_found < num_min) {
10620         num_expected = num_min;
10621         more_or_less = "at least";
10622     } else {
10623         num_expected = num_max;
10624         more_or_less = "at most";
10625     }
10626     if (exact) {
10627         more_or_less = "exactly";
10628     }
10629     PyErr_Format(PyExc_TypeError,
10630                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
10631                  func_name, more_or_less, num_expected,
10632                  (num_expected == 1) ? "" : "s", num_found);
10633 }
10634 
10635 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)10636 static int __Pyx_CheckKeywordStrings(
10637     PyObject *kwdict,
10638     const char* function_name,
10639     int kw_allowed)
10640 {
10641     PyObject* key = 0;
10642     Py_ssize_t pos = 0;
10643 #if CYTHON_COMPILING_IN_PYPY
10644     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
10645         goto invalid_keyword;
10646     return 1;
10647 #else
10648     while (PyDict_Next(kwdict, &pos, &key, 0)) {
10649         #if PY_MAJOR_VERSION < 3
10650         if (unlikely(!PyString_Check(key)))
10651         #endif
10652             if (unlikely(!PyUnicode_Check(key)))
10653                 goto invalid_keyword_type;
10654     }
10655     if ((!kw_allowed) && unlikely(key))
10656         goto invalid_keyword;
10657     return 1;
10658 invalid_keyword_type:
10659     PyErr_Format(PyExc_TypeError,
10660         "%.200s() keywords must be strings", function_name);
10661     return 0;
10662 #endif
10663 invalid_keyword:
10664     PyErr_Format(PyExc_TypeError,
10665     #if PY_MAJOR_VERSION < 3
10666         "%.200s() got an unexpected keyword argument '%.200s'",
10667         function_name, PyString_AsString(key));
10668     #else
10669         "%s() got an unexpected keyword argument '%U'",
10670         function_name, key);
10671     #endif
10672     return 0;
10673 }
10674 
10675 /* PyErrExceptionMatches */
10676 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)10677 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10678     Py_ssize_t i, n;
10679     n = PyTuple_GET_SIZE(tuple);
10680 #if PY_MAJOR_VERSION >= 3
10681     for (i=0; i<n; i++) {
10682         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10683     }
10684 #endif
10685     for (i=0; i<n; i++) {
10686         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
10687     }
10688     return 0;
10689 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)10690 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
10691     PyObject *exc_type = tstate->curexc_type;
10692     if (exc_type == err) return 1;
10693     if (unlikely(!exc_type)) return 0;
10694     if (unlikely(PyTuple_Check(err)))
10695         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
10696     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
10697 }
10698 #endif
10699 
10700 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)10701 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
10702 #if CYTHON_USE_TYPE_SLOTS
10703 #if PY_MAJOR_VERSION >= 3
10704     if (likely(PyUnicode_Check(n)))
10705 #else
10706     if (likely(PyString_Check(n)))
10707 #endif
10708         return __Pyx_PyObject_GetAttrStr(o, n);
10709 #endif
10710     return PyObject_GetAttr(o, n);
10711 }
10712 
10713 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)10714 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
10715     __Pyx_PyThreadState_declare
10716     __Pyx_PyThreadState_assign
10717     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
10718         return NULL;
10719     __Pyx_PyErr_Clear();
10720     Py_INCREF(d);
10721     return d;
10722 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)10723 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
10724     PyObject *r = __Pyx_GetAttr(o, n);
10725     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
10726 }
10727 
10728 /* RaiseException */
10729 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)10730 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
10731                         CYTHON_UNUSED PyObject *cause) {
10732     __Pyx_PyThreadState_declare
10733     Py_XINCREF(type);
10734     if (!value || value == Py_None)
10735         value = NULL;
10736     else
10737         Py_INCREF(value);
10738     if (!tb || tb == Py_None)
10739         tb = NULL;
10740     else {
10741         Py_INCREF(tb);
10742         if (!PyTraceBack_Check(tb)) {
10743             PyErr_SetString(PyExc_TypeError,
10744                 "raise: arg 3 must be a traceback or None");
10745             goto raise_error;
10746         }
10747     }
10748     if (PyType_Check(type)) {
10749 #if CYTHON_COMPILING_IN_PYPY
10750         if (!value) {
10751             Py_INCREF(Py_None);
10752             value = Py_None;
10753         }
10754 #endif
10755         PyErr_NormalizeException(&type, &value, &tb);
10756     } else {
10757         if (value) {
10758             PyErr_SetString(PyExc_TypeError,
10759                 "instance exception may not have a separate value");
10760             goto raise_error;
10761         }
10762         value = type;
10763         type = (PyObject*) Py_TYPE(type);
10764         Py_INCREF(type);
10765         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
10766             PyErr_SetString(PyExc_TypeError,
10767                 "raise: exception class must be a subclass of BaseException");
10768             goto raise_error;
10769         }
10770     }
10771     __Pyx_PyThreadState_assign
10772     __Pyx_ErrRestore(type, value, tb);
10773     return;
10774 raise_error:
10775     Py_XDECREF(value);
10776     Py_XDECREF(type);
10777     Py_XDECREF(tb);
10778     return;
10779 }
10780 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)10781 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
10782     PyObject* owned_instance = NULL;
10783     if (tb == Py_None) {
10784         tb = 0;
10785     } else if (tb && !PyTraceBack_Check(tb)) {
10786         PyErr_SetString(PyExc_TypeError,
10787             "raise: arg 3 must be a traceback or None");
10788         goto bad;
10789     }
10790     if (value == Py_None)
10791         value = 0;
10792     if (PyExceptionInstance_Check(type)) {
10793         if (value) {
10794             PyErr_SetString(PyExc_TypeError,
10795                 "instance exception may not have a separate value");
10796             goto bad;
10797         }
10798         value = type;
10799         type = (PyObject*) Py_TYPE(value);
10800     } else if (PyExceptionClass_Check(type)) {
10801         PyObject *instance_class = NULL;
10802         if (value && PyExceptionInstance_Check(value)) {
10803             instance_class = (PyObject*) Py_TYPE(value);
10804             if (instance_class != type) {
10805                 int is_subclass = PyObject_IsSubclass(instance_class, type);
10806                 if (!is_subclass) {
10807                     instance_class = NULL;
10808                 } else if (unlikely(is_subclass == -1)) {
10809                     goto bad;
10810                 } else {
10811                     type = instance_class;
10812                 }
10813             }
10814         }
10815         if (!instance_class) {
10816             PyObject *args;
10817             if (!value)
10818                 args = PyTuple_New(0);
10819             else if (PyTuple_Check(value)) {
10820                 Py_INCREF(value);
10821                 args = value;
10822             } else
10823                 args = PyTuple_Pack(1, value);
10824             if (!args)
10825                 goto bad;
10826             owned_instance = PyObject_Call(type, args, NULL);
10827             Py_DECREF(args);
10828             if (!owned_instance)
10829                 goto bad;
10830             value = owned_instance;
10831             if (!PyExceptionInstance_Check(value)) {
10832                 PyErr_Format(PyExc_TypeError,
10833                              "calling %R should have returned an instance of "
10834                              "BaseException, not %R",
10835                              type, Py_TYPE(value));
10836                 goto bad;
10837             }
10838         }
10839     } else {
10840         PyErr_SetString(PyExc_TypeError,
10841             "raise: exception class must be a subclass of BaseException");
10842         goto bad;
10843     }
10844     if (cause) {
10845         PyObject *fixed_cause;
10846         if (cause == Py_None) {
10847             fixed_cause = NULL;
10848         } else if (PyExceptionClass_Check(cause)) {
10849             fixed_cause = PyObject_CallObject(cause, NULL);
10850             if (fixed_cause == NULL)
10851                 goto bad;
10852         } else if (PyExceptionInstance_Check(cause)) {
10853             fixed_cause = cause;
10854             Py_INCREF(fixed_cause);
10855         } else {
10856             PyErr_SetString(PyExc_TypeError,
10857                             "exception causes must derive from "
10858                             "BaseException");
10859             goto bad;
10860         }
10861         PyException_SetCause(value, fixed_cause);
10862     }
10863     PyErr_SetObject(type, value);
10864     if (tb) {
10865 #if CYTHON_COMPILING_IN_PYPY
10866         PyObject *tmp_type, *tmp_value, *tmp_tb;
10867         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
10868         Py_INCREF(tb);
10869         PyErr_Restore(tmp_type, tmp_value, tb);
10870         Py_XDECREF(tmp_tb);
10871 #else
10872         PyThreadState *tstate = __Pyx_PyThreadState_Current;
10873         PyObject* tmp_tb = tstate->curexc_traceback;
10874         if (tb != tmp_tb) {
10875             Py_INCREF(tb);
10876             tstate->curexc_traceback = tb;
10877             Py_XDECREF(tmp_tb);
10878         }
10879 #endif
10880     }
10881 bad:
10882     Py_XDECREF(owned_instance);
10883     return;
10884 }
10885 #endif
10886 
10887 /* PyObjectCallNoArg */
10888 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)10889 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
10890 #if CYTHON_FAST_PYCALL
10891     if (PyFunction_Check(func)) {
10892         return __Pyx_PyFunction_FastCall(func, NULL, 0);
10893     }
10894 #endif
10895 #ifdef __Pyx_CyFunction_USED
10896     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
10897 #else
10898     if (likely(PyCFunction_Check(func)))
10899 #endif
10900     {
10901         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
10902             return __Pyx_PyObject_CallMethO(func, NULL);
10903         }
10904     }
10905     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
10906 }
10907 #endif
10908 
10909 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)10910 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10911 #if CYTHON_COMPILING_IN_PYPY
10912     return PyObject_RichCompareBool(s1, s2, equals);
10913 #else
10914     if (s1 == s2) {
10915         return (equals == Py_EQ);
10916     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10917         const char *ps1, *ps2;
10918         Py_ssize_t length = PyBytes_GET_SIZE(s1);
10919         if (length != PyBytes_GET_SIZE(s2))
10920             return (equals == Py_NE);
10921         ps1 = PyBytes_AS_STRING(s1);
10922         ps2 = PyBytes_AS_STRING(s2);
10923         if (ps1[0] != ps2[0]) {
10924             return (equals == Py_NE);
10925         } else if (length == 1) {
10926             return (equals == Py_EQ);
10927         } else {
10928             int result;
10929 #if CYTHON_USE_UNICODE_INTERNALS
10930             Py_hash_t hash1, hash2;
10931             hash1 = ((PyBytesObject*)s1)->ob_shash;
10932             hash2 = ((PyBytesObject*)s2)->ob_shash;
10933             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10934                 return (equals == Py_NE);
10935             }
10936 #endif
10937             result = memcmp(ps1, ps2, (size_t)length);
10938             return (equals == Py_EQ) ? (result == 0) : (result != 0);
10939         }
10940     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10941         return (equals == Py_NE);
10942     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10943         return (equals == Py_NE);
10944     } else {
10945         int result;
10946         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10947         if (!py_result)
10948             return -1;
10949         result = __Pyx_PyObject_IsTrue(py_result);
10950         Py_DECREF(py_result);
10951         return result;
10952     }
10953 #endif
10954 }
10955 
10956 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)10957 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10958 #if CYTHON_COMPILING_IN_PYPY
10959     return PyObject_RichCompareBool(s1, s2, equals);
10960 #else
10961 #if PY_MAJOR_VERSION < 3
10962     PyObject* owned_ref = NULL;
10963 #endif
10964     int s1_is_unicode, s2_is_unicode;
10965     if (s1 == s2) {
10966         goto return_eq;
10967     }
10968     s1_is_unicode = PyUnicode_CheckExact(s1);
10969     s2_is_unicode = PyUnicode_CheckExact(s2);
10970 #if PY_MAJOR_VERSION < 3
10971     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10972         owned_ref = PyUnicode_FromObject(s2);
10973         if (unlikely(!owned_ref))
10974             return -1;
10975         s2 = owned_ref;
10976         s2_is_unicode = 1;
10977     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10978         owned_ref = PyUnicode_FromObject(s1);
10979         if (unlikely(!owned_ref))
10980             return -1;
10981         s1 = owned_ref;
10982         s1_is_unicode = 1;
10983     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10984         return __Pyx_PyBytes_Equals(s1, s2, equals);
10985     }
10986 #endif
10987     if (s1_is_unicode & s2_is_unicode) {
10988         Py_ssize_t length;
10989         int kind;
10990         void *data1, *data2;
10991         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10992             return -1;
10993         length = __Pyx_PyUnicode_GET_LENGTH(s1);
10994         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10995             goto return_ne;
10996         }
10997 #if CYTHON_USE_UNICODE_INTERNALS
10998         {
10999             Py_hash_t hash1, hash2;
11000         #if CYTHON_PEP393_ENABLED
11001             hash1 = ((PyASCIIObject*)s1)->hash;
11002             hash2 = ((PyASCIIObject*)s2)->hash;
11003         #else
11004             hash1 = ((PyUnicodeObject*)s1)->hash;
11005             hash2 = ((PyUnicodeObject*)s2)->hash;
11006         #endif
11007             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
11008                 goto return_ne;
11009             }
11010         }
11011 #endif
11012         kind = __Pyx_PyUnicode_KIND(s1);
11013         if (kind != __Pyx_PyUnicode_KIND(s2)) {
11014             goto return_ne;
11015         }
11016         data1 = __Pyx_PyUnicode_DATA(s1);
11017         data2 = __Pyx_PyUnicode_DATA(s2);
11018         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
11019             goto return_ne;
11020         } else if (length == 1) {
11021             goto return_eq;
11022         } else {
11023             int result = memcmp(data1, data2, (size_t)(length * kind));
11024             #if PY_MAJOR_VERSION < 3
11025             Py_XDECREF(owned_ref);
11026             #endif
11027             return (equals == Py_EQ) ? (result == 0) : (result != 0);
11028         }
11029     } else if ((s1 == Py_None) & s2_is_unicode) {
11030         goto return_ne;
11031     } else if ((s2 == Py_None) & s1_is_unicode) {
11032         goto return_ne;
11033     } else {
11034         int result;
11035         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
11036         #if PY_MAJOR_VERSION < 3
11037         Py_XDECREF(owned_ref);
11038         #endif
11039         if (!py_result)
11040             return -1;
11041         result = __Pyx_PyObject_IsTrue(py_result);
11042         Py_DECREF(py_result);
11043         return result;
11044     }
11045 return_eq:
11046     #if PY_MAJOR_VERSION < 3
11047     Py_XDECREF(owned_ref);
11048     #endif
11049     return (equals == Py_EQ);
11050 return_ne:
11051     #if PY_MAJOR_VERSION < 3
11052     Py_XDECREF(owned_ref);
11053     #endif
11054     return (equals == Py_NE);
11055 #endif
11056 }
11057 
11058 /* DictGetItem */
11059 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)11060 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
11061     PyObject *value;
11062     value = PyDict_GetItemWithError(d, key);
11063     if (unlikely(!value)) {
11064         if (!PyErr_Occurred()) {
11065             if (unlikely(PyTuple_Check(key))) {
11066                 PyObject* args = PyTuple_Pack(1, key);
11067                 if (likely(args)) {
11068                     PyErr_SetObject(PyExc_KeyError, args);
11069                     Py_DECREF(args);
11070                 }
11071             } else {
11072                 PyErr_SetObject(PyExc_KeyError, key);
11073             }
11074         }
11075         return NULL;
11076     }
11077     Py_INCREF(value);
11078     return value;
11079 }
11080 #endif
11081 
11082 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)11083 static void __Pyx_RaiseDoubleKeywordsError(
11084     const char* func_name,
11085     PyObject* kw_name)
11086 {
11087     PyErr_Format(PyExc_TypeError,
11088         #if PY_MAJOR_VERSION >= 3
11089         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
11090         #else
11091         "%s() got multiple values for keyword argument '%s'", func_name,
11092         PyString_AsString(kw_name));
11093         #endif
11094 }
11095 
11096 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)11097 static int __Pyx_ParseOptionalKeywords(
11098     PyObject *kwds,
11099     PyObject **argnames[],
11100     PyObject *kwds2,
11101     PyObject *values[],
11102     Py_ssize_t num_pos_args,
11103     const char* function_name)
11104 {
11105     PyObject *key = 0, *value = 0;
11106     Py_ssize_t pos = 0;
11107     PyObject*** name;
11108     PyObject*** first_kw_arg = argnames + num_pos_args;
11109     while (PyDict_Next(kwds, &pos, &key, &value)) {
11110         name = first_kw_arg;
11111         while (*name && (**name != key)) name++;
11112         if (*name) {
11113             values[name-argnames] = value;
11114             continue;
11115         }
11116         name = first_kw_arg;
11117         #if PY_MAJOR_VERSION < 3
11118         if (likely(PyString_Check(key))) {
11119             while (*name) {
11120                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
11121                         && _PyString_Eq(**name, key)) {
11122                     values[name-argnames] = value;
11123                     break;
11124                 }
11125                 name++;
11126             }
11127             if (*name) continue;
11128             else {
11129                 PyObject*** argname = argnames;
11130                 while (argname != first_kw_arg) {
11131                     if ((**argname == key) || (
11132                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
11133                              && _PyString_Eq(**argname, key))) {
11134                         goto arg_passed_twice;
11135                     }
11136                     argname++;
11137                 }
11138             }
11139         } else
11140         #endif
11141         if (likely(PyUnicode_Check(key))) {
11142             while (*name) {
11143                 int cmp = (**name == key) ? 0 :
11144                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11145                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11146                 #endif
11147                     PyUnicode_Compare(**name, key);
11148                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11149                 if (cmp == 0) {
11150                     values[name-argnames] = value;
11151                     break;
11152                 }
11153                 name++;
11154             }
11155             if (*name) continue;
11156             else {
11157                 PyObject*** argname = argnames;
11158                 while (argname != first_kw_arg) {
11159                     int cmp = (**argname == key) ? 0 :
11160                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11161                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
11162                     #endif
11163                         PyUnicode_Compare(**argname, key);
11164                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11165                     if (cmp == 0) goto arg_passed_twice;
11166                     argname++;
11167                 }
11168             }
11169         } else
11170             goto invalid_keyword_type;
11171         if (kwds2) {
11172             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
11173         } else {
11174             goto invalid_keyword;
11175         }
11176     }
11177     return 0;
11178 arg_passed_twice:
11179     __Pyx_RaiseDoubleKeywordsError(function_name, key);
11180     goto bad;
11181 invalid_keyword_type:
11182     PyErr_Format(PyExc_TypeError,
11183         "%.200s() keywords must be strings", function_name);
11184     goto bad;
11185 invalid_keyword:
11186     PyErr_Format(PyExc_TypeError,
11187     #if PY_MAJOR_VERSION < 3
11188         "%.200s() got an unexpected keyword argument '%.200s'",
11189         function_name, PyString_AsString(key));
11190     #else
11191         "%s() got an unexpected keyword argument '%U'",
11192         function_name, key);
11193     #endif
11194 bad:
11195     return -1;
11196 }
11197 
11198 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)11199 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
11200 {
11201     if (unlikely(!type)) {
11202         PyErr_SetString(PyExc_SystemError, "Missing type object");
11203         return 0;
11204     }
11205     else if (exact) {
11206         #if PY_MAJOR_VERSION == 2
11207         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
11208         #endif
11209     }
11210     else {
11211         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
11212     }
11213     PyErr_Format(PyExc_TypeError,
11214         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
11215         name, type->tp_name, Py_TYPE(obj)->tp_name);
11216     return 0;
11217 }
11218 
11219 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)11220 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
11221     if (unlikely(!type)) {
11222         PyErr_SetString(PyExc_SystemError, "Missing type object");
11223         return 0;
11224     }
11225     if (likely(__Pyx_TypeCheck(obj, type)))
11226         return 1;
11227     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
11228                  Py_TYPE(obj)->tp_name, type->tp_name);
11229     return 0;
11230 }
11231 
11232 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)11233 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
11234     PyObject *empty_list = 0;
11235     PyObject *module = 0;
11236     PyObject *global_dict = 0;
11237     PyObject *empty_dict = 0;
11238     PyObject *list;
11239     #if PY_MAJOR_VERSION < 3
11240     PyObject *py_import;
11241     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
11242     if (!py_import)
11243         goto bad;
11244     #endif
11245     if (from_list)
11246         list = from_list;
11247     else {
11248         empty_list = PyList_New(0);
11249         if (!empty_list)
11250             goto bad;
11251         list = empty_list;
11252     }
11253     global_dict = PyModule_GetDict(__pyx_m);
11254     if (!global_dict)
11255         goto bad;
11256     empty_dict = PyDict_New();
11257     if (!empty_dict)
11258         goto bad;
11259     {
11260         #if PY_MAJOR_VERSION >= 3
11261         if (level == -1) {
11262             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
11263                 module = PyImport_ImportModuleLevelObject(
11264                     name, global_dict, empty_dict, list, 1);
11265                 if (!module) {
11266                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
11267                         goto bad;
11268                     PyErr_Clear();
11269                 }
11270             }
11271             level = 0;
11272         }
11273         #endif
11274         if (!module) {
11275             #if PY_MAJOR_VERSION < 3
11276             PyObject *py_level = PyInt_FromLong(level);
11277             if (!py_level)
11278                 goto bad;
11279             module = PyObject_CallFunctionObjArgs(py_import,
11280                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
11281             Py_DECREF(py_level);
11282             #else
11283             module = PyImport_ImportModuleLevelObject(
11284                 name, global_dict, empty_dict, list, level);
11285             #endif
11286         }
11287     }
11288 bad:
11289     #if PY_MAJOR_VERSION < 3
11290     Py_XDECREF(py_import);
11291     #endif
11292     Py_XDECREF(empty_list);
11293     Py_XDECREF(empty_dict);
11294     return module;
11295 }
11296 
11297 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)11298 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
11299     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
11300     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
11301         PyErr_Format(PyExc_ImportError,
11302         #if PY_MAJOR_VERSION < 3
11303             "cannot import name %.230s", PyString_AS_STRING(name));
11304         #else
11305             "cannot import name %S", name);
11306         #endif
11307     }
11308     return value;
11309 }
11310 
11311 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)11312 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
11313     PyObject *r;
11314     if (!j) return NULL;
11315     r = PyObject_GetItem(o, j);
11316     Py_DECREF(j);
11317     return r;
11318 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11319 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
11320                                                               CYTHON_NCP_UNUSED int wraparound,
11321                                                               CYTHON_NCP_UNUSED int boundscheck) {
11322 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11323     Py_ssize_t wrapped_i = i;
11324     if (wraparound & unlikely(i < 0)) {
11325         wrapped_i += PyList_GET_SIZE(o);
11326     }
11327     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
11328         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
11329         Py_INCREF(r);
11330         return r;
11331     }
11332     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11333 #else
11334     return PySequence_GetItem(o, i);
11335 #endif
11336 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11337 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
11338                                                               CYTHON_NCP_UNUSED int wraparound,
11339                                                               CYTHON_NCP_UNUSED int boundscheck) {
11340 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11341     Py_ssize_t wrapped_i = i;
11342     if (wraparound & unlikely(i < 0)) {
11343         wrapped_i += PyTuple_GET_SIZE(o);
11344     }
11345     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
11346         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
11347         Py_INCREF(r);
11348         return r;
11349     }
11350     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11351 #else
11352     return PySequence_GetItem(o, i);
11353 #endif
11354 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)11355 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
11356                                                      CYTHON_NCP_UNUSED int wraparound,
11357                                                      CYTHON_NCP_UNUSED int boundscheck) {
11358 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
11359     if (is_list || PyList_CheckExact(o)) {
11360         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
11361         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
11362             PyObject *r = PyList_GET_ITEM(o, n);
11363             Py_INCREF(r);
11364             return r;
11365         }
11366     }
11367     else if (PyTuple_CheckExact(o)) {
11368         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
11369         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
11370             PyObject *r = PyTuple_GET_ITEM(o, n);
11371             Py_INCREF(r);
11372             return r;
11373         }
11374     } else {
11375         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
11376         if (likely(m && m->sq_item)) {
11377             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
11378                 Py_ssize_t l = m->sq_length(o);
11379                 if (likely(l >= 0)) {
11380                     i += l;
11381                 } else {
11382                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
11383                         return NULL;
11384                     PyErr_Clear();
11385                 }
11386             }
11387             return m->sq_item(o, i);
11388         }
11389     }
11390 #else
11391     if (is_list || PySequence_Check(o)) {
11392         return PySequence_GetItem(o, i);
11393     }
11394 #endif
11395     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
11396 }
11397 
11398 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)11399 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
11400     PyObject *r;
11401     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
11402         PyErr_SetString(PyExc_TypeError,
11403                         "hasattr(): attribute name must be string");
11404         return -1;
11405     }
11406     r = __Pyx_GetAttr(o, n);
11407     if (unlikely(!r)) {
11408         PyErr_Clear();
11409         return 0;
11410     } else {
11411         Py_DECREF(r);
11412         return 1;
11413     }
11414 }
11415 
11416 /* GetTopmostException */
11417 #if CYTHON_USE_EXC_INFO_STACK
11418 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)11419 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
11420 {
11421     _PyErr_StackItem *exc_info = tstate->exc_info;
11422     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
11423            exc_info->previous_item != NULL)
11424     {
11425         exc_info = exc_info->previous_item;
11426     }
11427     return exc_info;
11428 }
11429 #endif
11430 
11431 /* SaveResetException */
11432 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)11433 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
11434     #if CYTHON_USE_EXC_INFO_STACK
11435     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
11436     *type = exc_info->exc_type;
11437     *value = exc_info->exc_value;
11438     *tb = exc_info->exc_traceback;
11439     #else
11440     *type = tstate->exc_type;
11441     *value = tstate->exc_value;
11442     *tb = tstate->exc_traceback;
11443     #endif
11444     Py_XINCREF(*type);
11445     Py_XINCREF(*value);
11446     Py_XINCREF(*tb);
11447 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)11448 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
11449     PyObject *tmp_type, *tmp_value, *tmp_tb;
11450     #if CYTHON_USE_EXC_INFO_STACK
11451     _PyErr_StackItem *exc_info = tstate->exc_info;
11452     tmp_type = exc_info->exc_type;
11453     tmp_value = exc_info->exc_value;
11454     tmp_tb = exc_info->exc_traceback;
11455     exc_info->exc_type = type;
11456     exc_info->exc_value = value;
11457     exc_info->exc_traceback = tb;
11458     #else
11459     tmp_type = tstate->exc_type;
11460     tmp_value = tstate->exc_value;
11461     tmp_tb = tstate->exc_traceback;
11462     tstate->exc_type = type;
11463     tstate->exc_value = value;
11464     tstate->exc_traceback = tb;
11465     #endif
11466     Py_XDECREF(tmp_type);
11467     Py_XDECREF(tmp_value);
11468     Py_XDECREF(tmp_tb);
11469 }
11470 #endif
11471 
11472 /* GetException */
11473 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)11474 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
11475 #else
11476 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
11477 #endif
11478 {
11479     PyObject *local_type, *local_value, *local_tb;
11480 #if CYTHON_FAST_THREAD_STATE
11481     PyObject *tmp_type, *tmp_value, *tmp_tb;
11482     local_type = tstate->curexc_type;
11483     local_value = tstate->curexc_value;
11484     local_tb = tstate->curexc_traceback;
11485     tstate->curexc_type = 0;
11486     tstate->curexc_value = 0;
11487     tstate->curexc_traceback = 0;
11488 #else
11489     PyErr_Fetch(&local_type, &local_value, &local_tb);
11490 #endif
11491     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
11492 #if CYTHON_FAST_THREAD_STATE
11493     if (unlikely(tstate->curexc_type))
11494 #else
11495     if (unlikely(PyErr_Occurred()))
11496 #endif
11497         goto bad;
11498     #if PY_MAJOR_VERSION >= 3
11499     if (local_tb) {
11500         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
11501             goto bad;
11502     }
11503     #endif
11504     Py_XINCREF(local_tb);
11505     Py_XINCREF(local_type);
11506     Py_XINCREF(local_value);
11507     *type = local_type;
11508     *value = local_value;
11509     *tb = local_tb;
11510 #if CYTHON_FAST_THREAD_STATE
11511     #if CYTHON_USE_EXC_INFO_STACK
11512     {
11513         _PyErr_StackItem *exc_info = tstate->exc_info;
11514         tmp_type = exc_info->exc_type;
11515         tmp_value = exc_info->exc_value;
11516         tmp_tb = exc_info->exc_traceback;
11517         exc_info->exc_type = local_type;
11518         exc_info->exc_value = local_value;
11519         exc_info->exc_traceback = local_tb;
11520     }
11521     #else
11522     tmp_type = tstate->exc_type;
11523     tmp_value = tstate->exc_value;
11524     tmp_tb = tstate->exc_traceback;
11525     tstate->exc_type = local_type;
11526     tstate->exc_value = local_value;
11527     tstate->exc_traceback = local_tb;
11528     #endif
11529     Py_XDECREF(tmp_type);
11530     Py_XDECREF(tmp_value);
11531     Py_XDECREF(tmp_tb);
11532 #else
11533     PyErr_SetExcInfo(local_type, local_value, local_tb);
11534 #endif
11535     return 0;
11536 bad:
11537     *type = 0;
11538     *value = 0;
11539     *tb = 0;
11540     Py_XDECREF(local_type);
11541     Py_XDECREF(local_value);
11542     Py_XDECREF(local_tb);
11543     return -1;
11544 }
11545 
11546 /* PyObject_GenericGetAttrNoDict */
11547 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)11548 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
11549     PyErr_Format(PyExc_AttributeError,
11550 #if PY_MAJOR_VERSION >= 3
11551                  "'%.50s' object has no attribute '%U'",
11552                  tp->tp_name, attr_name);
11553 #else
11554                  "'%.50s' object has no attribute '%.400s'",
11555                  tp->tp_name, PyString_AS_STRING(attr_name));
11556 #endif
11557     return NULL;
11558 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)11559 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
11560     PyObject *descr;
11561     PyTypeObject *tp = Py_TYPE(obj);
11562     if (unlikely(!PyString_Check(attr_name))) {
11563         return PyObject_GenericGetAttr(obj, attr_name);
11564     }
11565     assert(!tp->tp_dictoffset);
11566     descr = _PyType_Lookup(tp, attr_name);
11567     if (unlikely(!descr)) {
11568         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
11569     }
11570     Py_INCREF(descr);
11571     #if PY_MAJOR_VERSION < 3
11572     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
11573     #endif
11574     {
11575         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
11576         if (unlikely(f)) {
11577             PyObject *res = f(descr, obj, (PyObject *)tp);
11578             Py_DECREF(descr);
11579             return res;
11580         }
11581     }
11582     return descr;
11583 }
11584 #endif
11585 
11586 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)11587 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
11588 #if PY_VERSION_HEX >= 0x02070000
11589     PyObject *ob = PyCapsule_New(vtable, 0, 0);
11590 #else
11591     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
11592 #endif
11593     if (!ob)
11594         goto bad;
11595     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
11596         goto bad;
11597     Py_DECREF(ob);
11598     return 0;
11599 bad:
11600     Py_XDECREF(ob);
11601     return -1;
11602 }
11603 
11604 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)11605 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
11606     __Pyx_PyThreadState_declare
11607     __Pyx_PyThreadState_assign
11608     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
11609         __Pyx_PyErr_Clear();
11610 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)11611 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
11612     PyObject *result;
11613 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
11614     PyTypeObject* tp = Py_TYPE(obj);
11615     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
11616         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
11617     }
11618 #endif
11619     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
11620     if (unlikely(!result)) {
11621         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
11622     }
11623     return result;
11624 }
11625 
11626 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)11627 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
11628   int ret;
11629   PyObject *name_attr;
11630   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
11631   if (likely(name_attr)) {
11632       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
11633   } else {
11634       ret = -1;
11635   }
11636   if (unlikely(ret < 0)) {
11637       PyErr_Clear();
11638       ret = 0;
11639   }
11640   Py_XDECREF(name_attr);
11641   return ret;
11642 }
__Pyx_setup_reduce(PyObject * type_obj)11643 static int __Pyx_setup_reduce(PyObject* type_obj) {
11644     int ret = 0;
11645     PyObject *object_reduce = NULL;
11646     PyObject *object_reduce_ex = NULL;
11647     PyObject *reduce = NULL;
11648     PyObject *reduce_ex = NULL;
11649     PyObject *reduce_cython = NULL;
11650     PyObject *setstate = NULL;
11651     PyObject *setstate_cython = NULL;
11652 #if CYTHON_USE_PYTYPE_LOOKUP
11653     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
11654 #else
11655     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
11656 #endif
11657 #if CYTHON_USE_PYTYPE_LOOKUP
11658     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
11659 #else
11660     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
11661 #endif
11662     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
11663     if (reduce_ex == object_reduce_ex) {
11664 #if CYTHON_USE_PYTYPE_LOOKUP
11665         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
11666 #else
11667         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
11668 #endif
11669         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
11670         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
11671             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
11672             if (likely(reduce_cython)) {
11673                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
11674                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
11675             } else if (reduce == object_reduce || PyErr_Occurred()) {
11676                 goto __PYX_BAD;
11677             }
11678             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
11679             if (!setstate) PyErr_Clear();
11680             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
11681                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
11682                 if (likely(setstate_cython)) {
11683                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
11684                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
11685                 } else if (!setstate || PyErr_Occurred()) {
11686                     goto __PYX_BAD;
11687                 }
11688             }
11689             PyType_Modified((PyTypeObject*)type_obj);
11690         }
11691     }
11692     goto __PYX_GOOD;
11693 __PYX_BAD:
11694     if (!PyErr_Occurred())
11695         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
11696     ret = -1;
11697 __PYX_GOOD:
11698 #if !CYTHON_USE_PYTYPE_LOOKUP
11699     Py_XDECREF(object_reduce);
11700     Py_XDECREF(object_reduce_ex);
11701 #endif
11702     Py_XDECREF(reduce);
11703     Py_XDECREF(reduce_ex);
11704     Py_XDECREF(reduce_cython);
11705     Py_XDECREF(setstate);
11706     Py_XDECREF(setstate_cython);
11707     return ret;
11708 }
11709 
11710 /* PyObject_GenericGetAttr */
11711 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)11712 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
11713     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
11714         return PyObject_GenericGetAttr(obj, attr_name);
11715     }
11716     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
11717 }
11718 #endif
11719 
11720 /* TypeImport */
11721 #ifndef __PYX_HAVE_RT_ImportType
11722 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)11723 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
11724     size_t size, enum __Pyx_ImportType_CheckSize check_size)
11725 {
11726     PyObject *result = 0;
11727     char warning[200];
11728     Py_ssize_t basicsize;
11729 #ifdef Py_LIMITED_API
11730     PyObject *py_basicsize;
11731 #endif
11732     result = PyObject_GetAttrString(module, class_name);
11733     if (!result)
11734         goto bad;
11735     if (!PyType_Check(result)) {
11736         PyErr_Format(PyExc_TypeError,
11737             "%.200s.%.200s is not a type object",
11738             module_name, class_name);
11739         goto bad;
11740     }
11741 #ifndef Py_LIMITED_API
11742     basicsize = ((PyTypeObject *)result)->tp_basicsize;
11743 #else
11744     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
11745     if (!py_basicsize)
11746         goto bad;
11747     basicsize = PyLong_AsSsize_t(py_basicsize);
11748     Py_DECREF(py_basicsize);
11749     py_basicsize = 0;
11750     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
11751         goto bad;
11752 #endif
11753     if ((size_t)basicsize < size) {
11754         PyErr_Format(PyExc_ValueError,
11755             "%.200s.%.200s size changed, may indicate binary incompatibility. "
11756             "Expected %zd from C header, got %zd from PyObject",
11757             module_name, class_name, size, basicsize);
11758         goto bad;
11759     }
11760     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
11761         PyErr_Format(PyExc_ValueError,
11762             "%.200s.%.200s size changed, may indicate binary incompatibility. "
11763             "Expected %zd from C header, got %zd from PyObject",
11764             module_name, class_name, size, basicsize);
11765         goto bad;
11766     }
11767     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
11768         PyOS_snprintf(warning, sizeof(warning),
11769             "%s.%s size changed, may indicate binary incompatibility. "
11770             "Expected %zd from C header, got %zd from PyObject",
11771             module_name, class_name, size, basicsize);
11772         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
11773     }
11774     return (PyTypeObject *)result;
11775 bad:
11776     Py_XDECREF(result);
11777     return NULL;
11778 }
11779 #endif
11780 
11781 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)11782 static void* __Pyx_GetVtable(PyObject *dict) {
11783     void* ptr;
11784     PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
11785     if (!ob)
11786         goto bad;
11787 #if PY_VERSION_HEX >= 0x02070000
11788     ptr = PyCapsule_GetPointer(ob, 0);
11789 #else
11790     ptr = PyCObject_AsVoidPtr(ob);
11791 #endif
11792     if (!ptr && !PyErr_Occurred())
11793         PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
11794     Py_DECREF(ob);
11795     return ptr;
11796 bad:
11797     Py_XDECREF(ob);
11798     return NULL;
11799 }
11800 
11801 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)11802 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
11803     PyObject* fake_module;
11804     PyTypeObject* cached_type = NULL;
11805     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
11806     if (!fake_module) return NULL;
11807     Py_INCREF(fake_module);
11808     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
11809     if (cached_type) {
11810         if (!PyType_Check((PyObject*)cached_type)) {
11811             PyErr_Format(PyExc_TypeError,
11812                 "Shared Cython type %.200s is not a type object",
11813                 type->tp_name);
11814             goto bad;
11815         }
11816         if (cached_type->tp_basicsize != type->tp_basicsize) {
11817             PyErr_Format(PyExc_TypeError,
11818                 "Shared Cython type %.200s has the wrong size, try recompiling",
11819                 type->tp_name);
11820             goto bad;
11821         }
11822     } else {
11823         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
11824         PyErr_Clear();
11825         if (PyType_Ready(type) < 0) goto bad;
11826         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
11827             goto bad;
11828         Py_INCREF(type);
11829         cached_type = type;
11830     }
11831 done:
11832     Py_DECREF(fake_module);
11833     return cached_type;
11834 bad:
11835     Py_XDECREF(cached_type);
11836     cached_type = NULL;
11837     goto done;
11838 }
11839 
11840 /* CythonFunctionShared */
11841 #include <structmember.h>
11842 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)11843 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
11844 {
11845     if (unlikely(op->func_doc == NULL)) {
11846         if (op->func.m_ml->ml_doc) {
11847 #if PY_MAJOR_VERSION >= 3
11848             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
11849 #else
11850             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
11851 #endif
11852             if (unlikely(op->func_doc == NULL))
11853                 return NULL;
11854         } else {
11855             Py_INCREF(Py_None);
11856             return Py_None;
11857         }
11858     }
11859     Py_INCREF(op->func_doc);
11860     return op->func_doc;
11861 }
11862 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)11863 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
11864 {
11865     PyObject *tmp = op->func_doc;
11866     if (value == NULL) {
11867         value = Py_None;
11868     }
11869     Py_INCREF(value);
11870     op->func_doc = value;
11871     Py_XDECREF(tmp);
11872     return 0;
11873 }
11874 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11875 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11876 {
11877     if (unlikely(op->func_name == NULL)) {
11878 #if PY_MAJOR_VERSION >= 3
11879         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
11880 #else
11881         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
11882 #endif
11883         if (unlikely(op->func_name == NULL))
11884             return NULL;
11885     }
11886     Py_INCREF(op->func_name);
11887     return op->func_name;
11888 }
11889 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)11890 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
11891 {
11892     PyObject *tmp;
11893 #if PY_MAJOR_VERSION >= 3
11894     if (unlikely(value == NULL || !PyUnicode_Check(value)))
11895 #else
11896     if (unlikely(value == NULL || !PyString_Check(value)))
11897 #endif
11898     {
11899         PyErr_SetString(PyExc_TypeError,
11900                         "__name__ must be set to a string object");
11901         return -1;
11902     }
11903     tmp = op->func_name;
11904     Py_INCREF(value);
11905     op->func_name = value;
11906     Py_XDECREF(tmp);
11907     return 0;
11908 }
11909 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11910 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11911 {
11912     Py_INCREF(op->func_qualname);
11913     return op->func_qualname;
11914 }
11915 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)11916 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
11917 {
11918     PyObject *tmp;
11919 #if PY_MAJOR_VERSION >= 3
11920     if (unlikely(value == NULL || !PyUnicode_Check(value)))
11921 #else
11922     if (unlikely(value == NULL || !PyString_Check(value)))
11923 #endif
11924     {
11925         PyErr_SetString(PyExc_TypeError,
11926                         "__qualname__ must be set to a string object");
11927         return -1;
11928     }
11929     tmp = op->func_qualname;
11930     Py_INCREF(value);
11931     op->func_qualname = value;
11932     Py_XDECREF(tmp);
11933     return 0;
11934 }
11935 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)11936 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
11937 {
11938     PyObject *self;
11939     self = m->func_closure;
11940     if (self == NULL)
11941         self = Py_None;
11942     Py_INCREF(self);
11943     return self;
11944 }
11945 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11946 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11947 {
11948     if (unlikely(op->func_dict == NULL)) {
11949         op->func_dict = PyDict_New();
11950         if (unlikely(op->func_dict == NULL))
11951             return NULL;
11952     }
11953     Py_INCREF(op->func_dict);
11954     return op->func_dict;
11955 }
11956 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)11957 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
11958 {
11959     PyObject *tmp;
11960     if (unlikely(value == NULL)) {
11961         PyErr_SetString(PyExc_TypeError,
11962                "function's dictionary may not be deleted");
11963         return -1;
11964     }
11965     if (unlikely(!PyDict_Check(value))) {
11966         PyErr_SetString(PyExc_TypeError,
11967                "setting function's dictionary to a non-dict");
11968         return -1;
11969     }
11970     tmp = op->func_dict;
11971     Py_INCREF(value);
11972     op->func_dict = value;
11973     Py_XDECREF(tmp);
11974     return 0;
11975 }
11976 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11977 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11978 {
11979     Py_INCREF(op->func_globals);
11980     return op->func_globals;
11981 }
11982 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11983 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11984 {
11985     Py_INCREF(Py_None);
11986     return Py_None;
11987 }
11988 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)11989 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
11990 {
11991     PyObject* result = (op->func_code) ? op->func_code : Py_None;
11992     Py_INCREF(result);
11993     return result;
11994 }
11995 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)11996 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
11997     int result = 0;
11998     PyObject *res = op->defaults_getter((PyObject *) op);
11999     if (unlikely(!res))
12000         return -1;
12001     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12002     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
12003     Py_INCREF(op->defaults_tuple);
12004     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
12005     Py_INCREF(op->defaults_kwdict);
12006     #else
12007     op->defaults_tuple = PySequence_ITEM(res, 0);
12008     if (unlikely(!op->defaults_tuple)) result = -1;
12009     else {
12010         op->defaults_kwdict = PySequence_ITEM(res, 1);
12011         if (unlikely(!op->defaults_kwdict)) result = -1;
12012     }
12013     #endif
12014     Py_DECREF(res);
12015     return result;
12016 }
12017 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)12018 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12019     PyObject* tmp;
12020     if (!value) {
12021         value = Py_None;
12022     } else if (value != Py_None && !PyTuple_Check(value)) {
12023         PyErr_SetString(PyExc_TypeError,
12024                         "__defaults__ must be set to a tuple object");
12025         return -1;
12026     }
12027     Py_INCREF(value);
12028     tmp = op->defaults_tuple;
12029     op->defaults_tuple = value;
12030     Py_XDECREF(tmp);
12031     return 0;
12032 }
12033 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)12034 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12035     PyObject* result = op->defaults_tuple;
12036     if (unlikely(!result)) {
12037         if (op->defaults_getter) {
12038             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12039             result = op->defaults_tuple;
12040         } else {
12041             result = Py_None;
12042         }
12043     }
12044     Py_INCREF(result);
12045     return result;
12046 }
12047 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)12048 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12049     PyObject* tmp;
12050     if (!value) {
12051         value = Py_None;
12052     } else if (value != Py_None && !PyDict_Check(value)) {
12053         PyErr_SetString(PyExc_TypeError,
12054                         "__kwdefaults__ must be set to a dict object");
12055         return -1;
12056     }
12057     Py_INCREF(value);
12058     tmp = op->defaults_kwdict;
12059     op->defaults_kwdict = value;
12060     Py_XDECREF(tmp);
12061     return 0;
12062 }
12063 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)12064 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12065     PyObject* result = op->defaults_kwdict;
12066     if (unlikely(!result)) {
12067         if (op->defaults_getter) {
12068             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
12069             result = op->defaults_kwdict;
12070         } else {
12071             result = Py_None;
12072         }
12073     }
12074     Py_INCREF(result);
12075     return result;
12076 }
12077 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)12078 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
12079     PyObject* tmp;
12080     if (!value || value == Py_None) {
12081         value = NULL;
12082     } else if (!PyDict_Check(value)) {
12083         PyErr_SetString(PyExc_TypeError,
12084                         "__annotations__ must be set to a dict object");
12085         return -1;
12086     }
12087     Py_XINCREF(value);
12088     tmp = op->func_annotations;
12089     op->func_annotations = value;
12090     Py_XDECREF(tmp);
12091     return 0;
12092 }
12093 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)12094 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
12095     PyObject* result = op->func_annotations;
12096     if (unlikely(!result)) {
12097         result = PyDict_New();
12098         if (unlikely(!result)) return NULL;
12099         op->func_annotations = result;
12100     }
12101     Py_INCREF(result);
12102     return result;
12103 }
12104 static PyGetSetDef __pyx_CyFunction_getsets[] = {
12105     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12106     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12107     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12108     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12109     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
12110     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
12111     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12112     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12113     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12114     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12115     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12116     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
12117     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12118     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
12119     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12120     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
12121     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
12122     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
12123     {0, 0, 0, 0, 0}
12124 };
12125 static PyMemberDef __pyx_CyFunction_members[] = {
12126     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
12127     {0, 0, 0,  0, 0}
12128 };
12129 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)12130 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
12131 {
12132 #if PY_MAJOR_VERSION >= 3
12133     return PyUnicode_FromString(m->func.m_ml->ml_name);
12134 #else
12135     return PyString_FromString(m->func.m_ml->ml_name);
12136 #endif
12137 }
12138 static PyMethodDef __pyx_CyFunction_methods[] = {
12139     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
12140     {0, 0, 0, 0}
12141 };
12142 #if PY_VERSION_HEX < 0x030500A0
12143 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
12144 #else
12145 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
12146 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)12147 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
12148                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
12149     if (unlikely(op == NULL))
12150         return NULL;
12151     op->flags = flags;
12152     __Pyx_CyFunction_weakreflist(op) = NULL;
12153     op->func.m_ml = ml;
12154     op->func.m_self = (PyObject *) op;
12155     Py_XINCREF(closure);
12156     op->func_closure = closure;
12157     Py_XINCREF(module);
12158     op->func.m_module = module;
12159     op->func_dict = NULL;
12160     op->func_name = NULL;
12161     Py_INCREF(qualname);
12162     op->func_qualname = qualname;
12163     op->func_doc = NULL;
12164     op->func_classobj = NULL;
12165     op->func_globals = globals;
12166     Py_INCREF(op->func_globals);
12167     Py_XINCREF(code);
12168     op->func_code = code;
12169     op->defaults_pyobjects = 0;
12170     op->defaults_size = 0;
12171     op->defaults = NULL;
12172     op->defaults_tuple = NULL;
12173     op->defaults_kwdict = NULL;
12174     op->defaults_getter = NULL;
12175     op->func_annotations = NULL;
12176     return (PyObject *) op;
12177 }
12178 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)12179 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
12180 {
12181     Py_CLEAR(m->func_closure);
12182     Py_CLEAR(m->func.m_module);
12183     Py_CLEAR(m->func_dict);
12184     Py_CLEAR(m->func_name);
12185     Py_CLEAR(m->func_qualname);
12186     Py_CLEAR(m->func_doc);
12187     Py_CLEAR(m->func_globals);
12188     Py_CLEAR(m->func_code);
12189     Py_CLEAR(m->func_classobj);
12190     Py_CLEAR(m->defaults_tuple);
12191     Py_CLEAR(m->defaults_kwdict);
12192     Py_CLEAR(m->func_annotations);
12193     if (m->defaults) {
12194         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
12195         int i;
12196         for (i = 0; i < m->defaults_pyobjects; i++)
12197             Py_XDECREF(pydefaults[i]);
12198         PyObject_Free(m->defaults);
12199         m->defaults = NULL;
12200     }
12201     return 0;
12202 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)12203 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
12204 {
12205     if (__Pyx_CyFunction_weakreflist(m) != NULL)
12206         PyObject_ClearWeakRefs((PyObject *) m);
12207     __Pyx_CyFunction_clear(m);
12208     PyObject_GC_Del(m);
12209 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)12210 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
12211 {
12212     PyObject_GC_UnTrack(m);
12213     __Pyx__CyFunction_dealloc(m);
12214 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)12215 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
12216 {
12217     Py_VISIT(m->func_closure);
12218     Py_VISIT(m->func.m_module);
12219     Py_VISIT(m->func_dict);
12220     Py_VISIT(m->func_name);
12221     Py_VISIT(m->func_qualname);
12222     Py_VISIT(m->func_doc);
12223     Py_VISIT(m->func_globals);
12224     Py_VISIT(m->func_code);
12225     Py_VISIT(m->func_classobj);
12226     Py_VISIT(m->defaults_tuple);
12227     Py_VISIT(m->defaults_kwdict);
12228     if (m->defaults) {
12229         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
12230         int i;
12231         for (i = 0; i < m->defaults_pyobjects; i++)
12232             Py_VISIT(pydefaults[i]);
12233     }
12234     return 0;
12235 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)12236 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
12237 {
12238 #if PY_MAJOR_VERSION < 3
12239     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
12240     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
12241         Py_INCREF(func);
12242         return func;
12243     }
12244     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
12245         if (type == NULL)
12246             type = (PyObject *)(Py_TYPE(obj));
12247         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
12248     }
12249     if (obj == Py_None)
12250         obj = NULL;
12251 #endif
12252     return __Pyx_PyMethod_New(func, obj, type);
12253 }
12254 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)12255 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
12256 {
12257 #if PY_MAJOR_VERSION >= 3
12258     return PyUnicode_FromFormat("<cyfunction %U at %p>",
12259                                 op->func_qualname, (void *)op);
12260 #else
12261     return PyString_FromFormat("<cyfunction %s at %p>",
12262                                PyString_AsString(op->func_qualname), (void *)op);
12263 #endif
12264 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)12265 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
12266     PyCFunctionObject* f = (PyCFunctionObject*)func;
12267     PyCFunction meth = f->m_ml->ml_meth;
12268     Py_ssize_t size;
12269     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
12270     case METH_VARARGS:
12271         if (likely(kw == NULL || PyDict_Size(kw) == 0))
12272             return (*meth)(self, arg);
12273         break;
12274     case METH_VARARGS | METH_KEYWORDS:
12275         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
12276     case METH_NOARGS:
12277         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
12278             size = PyTuple_GET_SIZE(arg);
12279             if (likely(size == 0))
12280                 return (*meth)(self, NULL);
12281             PyErr_Format(PyExc_TypeError,
12282                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
12283                 f->m_ml->ml_name, size);
12284             return NULL;
12285         }
12286         break;
12287     case METH_O:
12288         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
12289             size = PyTuple_GET_SIZE(arg);
12290             if (likely(size == 1)) {
12291                 PyObject *result, *arg0;
12292                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12293                 arg0 = PyTuple_GET_ITEM(arg, 0);
12294                 #else
12295                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
12296                 #endif
12297                 result = (*meth)(self, arg0);
12298                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
12299                 Py_DECREF(arg0);
12300                 #endif
12301                 return result;
12302             }
12303             PyErr_Format(PyExc_TypeError,
12304                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
12305                 f->m_ml->ml_name, size);
12306             return NULL;
12307         }
12308         break;
12309     default:
12310         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
12311                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
12312                         "longer supported!");
12313         return NULL;
12314     }
12315     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
12316                  f->m_ml->ml_name);
12317     return NULL;
12318 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)12319 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
12320     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
12321 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)12322 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
12323     PyObject *result;
12324     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
12325     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
12326         Py_ssize_t argc;
12327         PyObject *new_args;
12328         PyObject *self;
12329         argc = PyTuple_GET_SIZE(args);
12330         new_args = PyTuple_GetSlice(args, 1, argc);
12331         if (unlikely(!new_args))
12332             return NULL;
12333         self = PyTuple_GetItem(args, 0);
12334         if (unlikely(!self)) {
12335             Py_DECREF(new_args);
12336             return NULL;
12337         }
12338         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
12339         Py_DECREF(new_args);
12340     } else {
12341         result = __Pyx_CyFunction_Call(func, args, kw);
12342     }
12343     return result;
12344 }
12345 static PyTypeObject __pyx_CyFunctionType_type = {
12346     PyVarObject_HEAD_INIT(0, 0)
12347     "cython_function_or_method",
12348     sizeof(__pyx_CyFunctionObject),
12349     0,
12350     (destructor) __Pyx_CyFunction_dealloc,
12351     0,
12352     0,
12353     0,
12354 #if PY_MAJOR_VERSION < 3
12355     0,
12356 #else
12357     0,
12358 #endif
12359     (reprfunc) __Pyx_CyFunction_repr,
12360     0,
12361     0,
12362     0,
12363     0,
12364     __Pyx_CyFunction_CallAsMethod,
12365     0,
12366     0,
12367     0,
12368     0,
12369     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
12370     0,
12371     (traverseproc) __Pyx_CyFunction_traverse,
12372     (inquiry) __Pyx_CyFunction_clear,
12373     0,
12374 #if PY_VERSION_HEX < 0x030500A0
12375     offsetof(__pyx_CyFunctionObject, func_weakreflist),
12376 #else
12377     offsetof(PyCFunctionObject, m_weakreflist),
12378 #endif
12379     0,
12380     0,
12381     __pyx_CyFunction_methods,
12382     __pyx_CyFunction_members,
12383     __pyx_CyFunction_getsets,
12384     0,
12385     0,
12386     __Pyx_CyFunction_descr_get,
12387     0,
12388     offsetof(__pyx_CyFunctionObject, func_dict),
12389     0,
12390     0,
12391     0,
12392     0,
12393     0,
12394     0,
12395     0,
12396     0,
12397     0,
12398     0,
12399     0,
12400     0,
12401 #if PY_VERSION_HEX >= 0x030400a1
12402     0,
12403 #endif
12404 #if PY_VERSION_HEX >= 0x030800b1
12405     0,
12406 #endif
12407 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
12408     0,
12409 #endif
12410 };
__pyx_CyFunction_init(void)12411 static int __pyx_CyFunction_init(void) {
12412     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
12413     if (unlikely(__pyx_CyFunctionType == NULL)) {
12414         return -1;
12415     }
12416     return 0;
12417 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)12418 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
12419     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
12420     m->defaults = PyObject_Malloc(size);
12421     if (unlikely(!m->defaults))
12422         return PyErr_NoMemory();
12423     memset(m->defaults, 0, size);
12424     m->defaults_pyobjects = pyobjects;
12425     m->defaults_size = size;
12426     return m->defaults;
12427 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)12428 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
12429     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
12430     m->defaults_tuple = tuple;
12431     Py_INCREF(tuple);
12432 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)12433 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
12434     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
12435     m->defaults_kwdict = dict;
12436     Py_INCREF(dict);
12437 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)12438 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
12439     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
12440     m->func_annotations = dict;
12441     Py_INCREF(dict);
12442 }
12443 
12444 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)12445 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
12446                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
12447     PyObject *op = __Pyx_CyFunction_Init(
12448         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
12449         ml, flags, qualname, closure, module, globals, code
12450     );
12451     if (likely(op)) {
12452         PyObject_GC_Track(op);
12453     }
12454     return op;
12455 }
12456 
12457 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)12458 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
12459     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
12460     for (i=0; i < nbases; i++) {
12461         PyTypeObject *tmptype;
12462         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
12463         tmptype = Py_TYPE(tmp);
12464 #if PY_MAJOR_VERSION < 3
12465         if (tmptype == &PyClass_Type)
12466             continue;
12467 #endif
12468         if (!metaclass) {
12469             metaclass = tmptype;
12470             continue;
12471         }
12472         if (PyType_IsSubtype(metaclass, tmptype))
12473             continue;
12474         if (PyType_IsSubtype(tmptype, metaclass)) {
12475             metaclass = tmptype;
12476             continue;
12477         }
12478         PyErr_SetString(PyExc_TypeError,
12479                         "metaclass conflict: "
12480                         "the metaclass of a derived class "
12481                         "must be a (non-strict) subclass "
12482                         "of the metaclasses of all its bases");
12483         return NULL;
12484     }
12485     if (!metaclass) {
12486 #if PY_MAJOR_VERSION < 3
12487         metaclass = &PyClass_Type;
12488 #else
12489         metaclass = &PyType_Type;
12490 #endif
12491     }
12492     Py_INCREF((PyObject*) metaclass);
12493     return (PyObject*) metaclass;
12494 }
12495 
12496 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)12497 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
12498                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
12499     PyObject *ns;
12500     if (metaclass) {
12501         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
12502         if (prep) {
12503             PyObject *pargs = PyTuple_Pack(2, name, bases);
12504             if (unlikely(!pargs)) {
12505                 Py_DECREF(prep);
12506                 return NULL;
12507             }
12508             ns = PyObject_Call(prep, pargs, mkw);
12509             Py_DECREF(prep);
12510             Py_DECREF(pargs);
12511         } else {
12512             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
12513                 return NULL;
12514             PyErr_Clear();
12515             ns = PyDict_New();
12516         }
12517     } else {
12518         ns = PyDict_New();
12519     }
12520     if (unlikely(!ns))
12521         return NULL;
12522     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
12523     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
12524     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
12525     return ns;
12526 bad:
12527     Py_DECREF(ns);
12528     return NULL;
12529 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)12530 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
12531                                       PyObject *dict, PyObject *mkw,
12532                                       int calculate_metaclass, int allow_py2_metaclass) {
12533     PyObject *result, *margs;
12534     PyObject *owned_metaclass = NULL;
12535     if (allow_py2_metaclass) {
12536         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
12537         if (owned_metaclass) {
12538             metaclass = owned_metaclass;
12539         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
12540             PyErr_Clear();
12541         } else {
12542             return NULL;
12543         }
12544     }
12545     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
12546         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
12547         Py_XDECREF(owned_metaclass);
12548         if (unlikely(!metaclass))
12549             return NULL;
12550         owned_metaclass = metaclass;
12551     }
12552     margs = PyTuple_Pack(3, name, bases, dict);
12553     if (unlikely(!margs)) {
12554         result = NULL;
12555     } else {
12556         result = PyObject_Call(metaclass, margs, mkw);
12557         Py_DECREF(margs);
12558     }
12559     Py_XDECREF(owned_metaclass);
12560     return result;
12561 }
12562 
12563 /* CLineInTraceback */
12564 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)12565 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
12566     PyObject *use_cline;
12567     PyObject *ptype, *pvalue, *ptraceback;
12568 #if CYTHON_COMPILING_IN_CPYTHON
12569     PyObject **cython_runtime_dict;
12570 #endif
12571     if (unlikely(!__pyx_cython_runtime)) {
12572         return c_line;
12573     }
12574     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
12575 #if CYTHON_COMPILING_IN_CPYTHON
12576     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
12577     if (likely(cython_runtime_dict)) {
12578         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
12579             use_cline, *cython_runtime_dict,
12580             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
12581     } else
12582 #endif
12583     {
12584       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
12585       if (use_cline_obj) {
12586         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
12587         Py_DECREF(use_cline_obj);
12588       } else {
12589         PyErr_Clear();
12590         use_cline = NULL;
12591       }
12592     }
12593     if (!use_cline) {
12594         c_line = 0;
12595         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
12596     }
12597     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
12598         c_line = 0;
12599     }
12600     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
12601     return c_line;
12602 }
12603 #endif
12604 
12605 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)12606 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
12607     int start = 0, mid = 0, end = count - 1;
12608     if (end >= 0 && code_line > entries[end].code_line) {
12609         return count;
12610     }
12611     while (start < end) {
12612         mid = start + (end - start) / 2;
12613         if (code_line < entries[mid].code_line) {
12614             end = mid;
12615         } else if (code_line > entries[mid].code_line) {
12616              start = mid + 1;
12617         } else {
12618             return mid;
12619         }
12620     }
12621     if (code_line <= entries[mid].code_line) {
12622         return mid;
12623     } else {
12624         return mid + 1;
12625     }
12626 }
__pyx_find_code_object(int code_line)12627 static PyCodeObject *__pyx_find_code_object(int code_line) {
12628     PyCodeObject* code_object;
12629     int pos;
12630     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
12631         return NULL;
12632     }
12633     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
12634     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
12635         return NULL;
12636     }
12637     code_object = __pyx_code_cache.entries[pos].code_object;
12638     Py_INCREF(code_object);
12639     return code_object;
12640 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)12641 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
12642     int pos, i;
12643     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
12644     if (unlikely(!code_line)) {
12645         return;
12646     }
12647     if (unlikely(!entries)) {
12648         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
12649         if (likely(entries)) {
12650             __pyx_code_cache.entries = entries;
12651             __pyx_code_cache.max_count = 64;
12652             __pyx_code_cache.count = 1;
12653             entries[0].code_line = code_line;
12654             entries[0].code_object = code_object;
12655             Py_INCREF(code_object);
12656         }
12657         return;
12658     }
12659     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
12660     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
12661         PyCodeObject* tmp = entries[pos].code_object;
12662         entries[pos].code_object = code_object;
12663         Py_DECREF(tmp);
12664         return;
12665     }
12666     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
12667         int new_max = __pyx_code_cache.max_count + 64;
12668         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
12669             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
12670         if (unlikely(!entries)) {
12671             return;
12672         }
12673         __pyx_code_cache.entries = entries;
12674         __pyx_code_cache.max_count = new_max;
12675     }
12676     for (i=__pyx_code_cache.count; i>pos; i--) {
12677         entries[i] = entries[i-1];
12678     }
12679     entries[pos].code_line = code_line;
12680     entries[pos].code_object = code_object;
12681     __pyx_code_cache.count++;
12682     Py_INCREF(code_object);
12683 }
12684 
12685 /* AddTraceback */
12686 #include "compile.h"
12687 #include "frameobject.h"
12688 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)12689 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
12690             const char *funcname, int c_line,
12691             int py_line, const char *filename) {
12692     PyCodeObject *py_code = 0;
12693     PyObject *py_srcfile = 0;
12694     PyObject *py_funcname = 0;
12695     #if PY_MAJOR_VERSION < 3
12696     py_srcfile = PyString_FromString(filename);
12697     #else
12698     py_srcfile = PyUnicode_FromString(filename);
12699     #endif
12700     if (!py_srcfile) goto bad;
12701     if (c_line) {
12702         #if PY_MAJOR_VERSION < 3
12703         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
12704         #else
12705         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
12706         #endif
12707     }
12708     else {
12709         #if PY_MAJOR_VERSION < 3
12710         py_funcname = PyString_FromString(funcname);
12711         #else
12712         py_funcname = PyUnicode_FromString(funcname);
12713         #endif
12714     }
12715     if (!py_funcname) goto bad;
12716     py_code = __Pyx_PyCode_New(
12717         0,
12718         0,
12719         0,
12720         0,
12721         0,
12722         __pyx_empty_bytes, /*PyObject *code,*/
12723         __pyx_empty_tuple, /*PyObject *consts,*/
12724         __pyx_empty_tuple, /*PyObject *names,*/
12725         __pyx_empty_tuple, /*PyObject *varnames,*/
12726         __pyx_empty_tuple, /*PyObject *freevars,*/
12727         __pyx_empty_tuple, /*PyObject *cellvars,*/
12728         py_srcfile,   /*PyObject *filename,*/
12729         py_funcname,  /*PyObject *name,*/
12730         py_line,
12731         __pyx_empty_bytes  /*PyObject *lnotab*/
12732     );
12733     Py_DECREF(py_srcfile);
12734     Py_DECREF(py_funcname);
12735     return py_code;
12736 bad:
12737     Py_XDECREF(py_srcfile);
12738     Py_XDECREF(py_funcname);
12739     return NULL;
12740 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)12741 static void __Pyx_AddTraceback(const char *funcname, int c_line,
12742                                int py_line, const char *filename) {
12743     PyCodeObject *py_code = 0;
12744     PyFrameObject *py_frame = 0;
12745     PyThreadState *tstate = __Pyx_PyThreadState_Current;
12746     if (c_line) {
12747         c_line = __Pyx_CLineForTraceback(tstate, c_line);
12748     }
12749     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
12750     if (!py_code) {
12751         py_code = __Pyx_CreateCodeObjectForTraceback(
12752             funcname, c_line, py_line, filename);
12753         if (!py_code) goto bad;
12754         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
12755     }
12756     py_frame = PyFrame_New(
12757         tstate,            /*PyThreadState *tstate,*/
12758         py_code,           /*PyCodeObject *code,*/
12759         __pyx_d,    /*PyObject *globals,*/
12760         0                  /*PyObject *locals*/
12761     );
12762     if (!py_frame) goto bad;
12763     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
12764     PyTraceBack_Here(py_frame);
12765 bad:
12766     Py_XDECREF(py_code);
12767     Py_XDECREF(py_frame);
12768 }
12769 
__pyx_convert__to_py___pyx_t_7cartopy_5trace_Point(__pyx_t_7cartopy_5trace_Point s)12770 static PyObject* __pyx_convert__to_py___pyx_t_7cartopy_5trace_Point(__pyx_t_7cartopy_5trace_Point s) {
12771   PyObject* res;
12772   PyObject* member;
12773   res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
12774   member = PyFloat_FromDouble(s.x); if (unlikely(!member)) goto bad;
12775   if (unlikely(PyDict_SetItem(res, __pyx_n_s_x, member) < 0)) goto bad;
12776   Py_DECREF(member);
12777   member = PyFloat_FromDouble(s.y); if (unlikely(!member)) goto bad;
12778   if (unlikely(PyDict_SetItem(res, __pyx_n_s_y, member) < 0)) goto bad;
12779   Py_DECREF(member);
12780   return res;
12781   bad:
12782   Py_XDECREF(member);
12783   Py_DECREF(res);
12784   return NULL;
12785 }
12786 /* CIntFromPyVerify */
12787 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
12788     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
12789 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
12790     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
12791 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
12792     {\
12793         func_type value = func_value;\
12794         if (sizeof(target_type) < sizeof(func_type)) {\
12795             if (unlikely(value != (func_type) (target_type) value)) {\
12796                 func_type zero = 0;\
12797                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
12798                     return (target_type) -1;\
12799                 if (is_unsigned && unlikely(value < zero))\
12800                     goto raise_neg_overflow;\
12801                 else\
12802                     goto raise_overflow;\
12803             }\
12804         }\
12805         return (target_type) value;\
12806     }
12807 
12808 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)12809 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
12810 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
12811 #pragma GCC diagnostic push
12812 #pragma GCC diagnostic ignored "-Wconversion"
12813 #endif
12814     const long neg_one = (long) -1, const_zero = (long) 0;
12815 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
12816 #pragma GCC diagnostic pop
12817 #endif
12818     const int is_unsigned = neg_one > const_zero;
12819 #if PY_MAJOR_VERSION < 3
12820     if (likely(PyInt_Check(x))) {
12821         if (sizeof(long) < sizeof(long)) {
12822             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
12823         } else {
12824             long val = PyInt_AS_LONG(x);
12825             if (is_unsigned && unlikely(val < 0)) {
12826                 goto raise_neg_overflow;
12827             }
12828             return (long) val;
12829         }
12830     } else
12831 #endif
12832     if (likely(PyLong_Check(x))) {
12833         if (is_unsigned) {
12834 #if CYTHON_USE_PYLONG_INTERNALS
12835             const digit* digits = ((PyLongObject*)x)->ob_digit;
12836             switch (Py_SIZE(x)) {
12837                 case  0: return (long) 0;
12838                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
12839                 case 2:
12840                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
12841                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
12842                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12843                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
12844                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
12845                         }
12846                     }
12847                     break;
12848                 case 3:
12849                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
12850                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
12851                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12852                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
12853                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
12854                         }
12855                     }
12856                     break;
12857                 case 4:
12858                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
12859                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
12860                             __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])))
12861                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
12862                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
12863                         }
12864                     }
12865                     break;
12866             }
12867 #endif
12868 #if CYTHON_COMPILING_IN_CPYTHON
12869             if (unlikely(Py_SIZE(x) < 0)) {
12870                 goto raise_neg_overflow;
12871             }
12872 #else
12873             {
12874                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
12875                 if (unlikely(result < 0))
12876                     return (long) -1;
12877                 if (unlikely(result == 1))
12878                     goto raise_neg_overflow;
12879             }
12880 #endif
12881             if (sizeof(long) <= sizeof(unsigned long)) {
12882                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
12883 #ifdef HAVE_LONG_LONG
12884             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
12885                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
12886 #endif
12887             }
12888         } else {
12889 #if CYTHON_USE_PYLONG_INTERNALS
12890             const digit* digits = ((PyLongObject*)x)->ob_digit;
12891             switch (Py_SIZE(x)) {
12892                 case  0: return (long) 0;
12893                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
12894                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
12895                 case -2:
12896                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
12897                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
12898                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12899                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12900                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12901                         }
12902                     }
12903                     break;
12904                 case 2:
12905                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
12906                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
12907                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12908                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12909                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12910                         }
12911                     }
12912                     break;
12913                 case -3:
12914                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12915                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
12916                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12917                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12918                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12919                         }
12920                     }
12921                     break;
12922                 case 3:
12923                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
12924                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
12925                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
12926                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12927                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12928                         }
12929                     }
12930                     break;
12931                 case -4:
12932                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12933                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
12934                             __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])))
12935                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12936                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12937                         }
12938                     }
12939                     break;
12940                 case 4:
12941                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
12942                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
12943                             __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])))
12944                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12945                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
12946                         }
12947                     }
12948                     break;
12949             }
12950 #endif
12951             if (sizeof(long) <= sizeof(long)) {
12952                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
12953 #ifdef HAVE_LONG_LONG
12954             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
12955                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
12956 #endif
12957             }
12958         }
12959         {
12960 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
12961             PyErr_SetString(PyExc_RuntimeError,
12962                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
12963 #else
12964             long val;
12965             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
12966  #if PY_MAJOR_VERSION < 3
12967             if (likely(v) && !PyLong_Check(v)) {
12968                 PyObject *tmp = v;
12969                 v = PyNumber_Long(tmp);
12970                 Py_DECREF(tmp);
12971             }
12972  #endif
12973             if (likely(v)) {
12974                 int one = 1; int is_little = (int)*(unsigned char *)&one;
12975                 unsigned char *bytes = (unsigned char *)&val;
12976                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
12977                                               bytes, sizeof(val),
12978                                               is_little, !is_unsigned);
12979                 Py_DECREF(v);
12980                 if (likely(!ret))
12981                     return val;
12982             }
12983 #endif
12984             return (long) -1;
12985         }
12986     } else {
12987         long val;
12988         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
12989         if (!tmp) return (long) -1;
12990         val = __Pyx_PyInt_As_long(tmp);
12991         Py_DECREF(tmp);
12992         return val;
12993     }
12994 raise_overflow:
12995     PyErr_SetString(PyExc_OverflowError,
12996         "value too large to convert to long");
12997     return (long) -1;
12998 raise_neg_overflow:
12999     PyErr_SetString(PyExc_OverflowError,
13000         "can't convert negative value to long");
13001     return (long) -1;
13002 }
13003 
13004 /* CIntFromPy */
__Pyx_PyInt_As_size_t(PyObject * x)13005 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
13006 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13007 #pragma GCC diagnostic push
13008 #pragma GCC diagnostic ignored "-Wconversion"
13009 #endif
13010     const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
13011 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13012 #pragma GCC diagnostic pop
13013 #endif
13014     const int is_unsigned = neg_one > const_zero;
13015 #if PY_MAJOR_VERSION < 3
13016     if (likely(PyInt_Check(x))) {
13017         if (sizeof(size_t) < sizeof(long)) {
13018             __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
13019         } else {
13020             long val = PyInt_AS_LONG(x);
13021             if (is_unsigned && unlikely(val < 0)) {
13022                 goto raise_neg_overflow;
13023             }
13024             return (size_t) val;
13025         }
13026     } else
13027 #endif
13028     if (likely(PyLong_Check(x))) {
13029         if (is_unsigned) {
13030 #if CYTHON_USE_PYLONG_INTERNALS
13031             const digit* digits = ((PyLongObject*)x)->ob_digit;
13032             switch (Py_SIZE(x)) {
13033                 case  0: return (size_t) 0;
13034                 case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
13035                 case 2:
13036                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
13037                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13038                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13039                         } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
13040                             return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
13041                         }
13042                     }
13043                     break;
13044                 case 3:
13045                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
13046                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13047                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13048                         } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
13049                             return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
13050                         }
13051                     }
13052                     break;
13053                 case 4:
13054                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
13055                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13056                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13057                         } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
13058                             return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
13059                         }
13060                     }
13061                     break;
13062             }
13063 #endif
13064 #if CYTHON_COMPILING_IN_CPYTHON
13065             if (unlikely(Py_SIZE(x) < 0)) {
13066                 goto raise_neg_overflow;
13067             }
13068 #else
13069             {
13070                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13071                 if (unlikely(result < 0))
13072                     return (size_t) -1;
13073                 if (unlikely(result == 1))
13074                     goto raise_neg_overflow;
13075             }
13076 #endif
13077             if (sizeof(size_t) <= sizeof(unsigned long)) {
13078                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
13079 #ifdef HAVE_LONG_LONG
13080             } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
13081                 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13082 #endif
13083             }
13084         } else {
13085 #if CYTHON_USE_PYLONG_INTERNALS
13086             const digit* digits = ((PyLongObject*)x)->ob_digit;
13087             switch (Py_SIZE(x)) {
13088                 case  0: return (size_t) 0;
13089                 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
13090                 case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
13091                 case -2:
13092                     if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
13093                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13094                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13095                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
13096                             return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13097                         }
13098                     }
13099                     break;
13100                 case 2:
13101                     if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
13102                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13103                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13104                         } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
13105                             return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13106                         }
13107                     }
13108                     break;
13109                 case -3:
13110                     if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
13111                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13112                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13113                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
13114                             return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13115                         }
13116                     }
13117                     break;
13118                 case 3:
13119                     if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
13120                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13121                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13122                         } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
13123                             return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13124                         }
13125                     }
13126                     break;
13127                 case -4:
13128                     if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
13129                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13130                             __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13131                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
13132                             return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13133                         }
13134                     }
13135                     break;
13136                 case 4:
13137                     if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
13138                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13139                             __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13140                         } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
13141                             return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
13142                         }
13143                     }
13144                     break;
13145             }
13146 #endif
13147             if (sizeof(size_t) <= sizeof(long)) {
13148                 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
13149 #ifdef HAVE_LONG_LONG
13150             } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
13151                 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
13152 #endif
13153             }
13154         }
13155         {
13156 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13157             PyErr_SetString(PyExc_RuntimeError,
13158                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13159 #else
13160             size_t val;
13161             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13162  #if PY_MAJOR_VERSION < 3
13163             if (likely(v) && !PyLong_Check(v)) {
13164                 PyObject *tmp = v;
13165                 v = PyNumber_Long(tmp);
13166                 Py_DECREF(tmp);
13167             }
13168  #endif
13169             if (likely(v)) {
13170                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13171                 unsigned char *bytes = (unsigned char *)&val;
13172                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13173                                               bytes, sizeof(val),
13174                                               is_little, !is_unsigned);
13175                 Py_DECREF(v);
13176                 if (likely(!ret))
13177                     return val;
13178             }
13179 #endif
13180             return (size_t) -1;
13181         }
13182     } else {
13183         size_t val;
13184         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13185         if (!tmp) return (size_t) -1;
13186         val = __Pyx_PyInt_As_size_t(tmp);
13187         Py_DECREF(tmp);
13188         return val;
13189     }
13190 raise_overflow:
13191     PyErr_SetString(PyExc_OverflowError,
13192         "value too large to convert to size_t");
13193     return (size_t) -1;
13194 raise_neg_overflow:
13195     PyErr_SetString(PyExc_OverflowError,
13196         "can't convert negative value to size_t");
13197     return (size_t) -1;
13198 }
13199 
13200 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)13201 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
13202 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13203 #pragma GCC diagnostic push
13204 #pragma GCC diagnostic ignored "-Wconversion"
13205 #endif
13206     const int neg_one = (int) -1, const_zero = (int) 0;
13207 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13208 #pragma GCC diagnostic pop
13209 #endif
13210     const int is_unsigned = neg_one > const_zero;
13211 #if PY_MAJOR_VERSION < 3
13212     if (likely(PyInt_Check(x))) {
13213         if (sizeof(int) < sizeof(long)) {
13214             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
13215         } else {
13216             long val = PyInt_AS_LONG(x);
13217             if (is_unsigned && unlikely(val < 0)) {
13218                 goto raise_neg_overflow;
13219             }
13220             return (int) val;
13221         }
13222     } else
13223 #endif
13224     if (likely(PyLong_Check(x))) {
13225         if (is_unsigned) {
13226 #if CYTHON_USE_PYLONG_INTERNALS
13227             const digit* digits = ((PyLongObject*)x)->ob_digit;
13228             switch (Py_SIZE(x)) {
13229                 case  0: return (int) 0;
13230                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
13231                 case 2:
13232                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13233                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13234                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13235                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
13236                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13237                         }
13238                     }
13239                     break;
13240                 case 3:
13241                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13242                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13243                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13244                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
13245                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13246                         }
13247                     }
13248                     break;
13249                 case 4:
13250                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13251                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13252                             __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])))
13253                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
13254                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
13255                         }
13256                     }
13257                     break;
13258             }
13259 #endif
13260 #if CYTHON_COMPILING_IN_CPYTHON
13261             if (unlikely(Py_SIZE(x) < 0)) {
13262                 goto raise_neg_overflow;
13263             }
13264 #else
13265             {
13266                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13267                 if (unlikely(result < 0))
13268                     return (int) -1;
13269                 if (unlikely(result == 1))
13270                     goto raise_neg_overflow;
13271             }
13272 #endif
13273             if (sizeof(int) <= sizeof(unsigned long)) {
13274                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
13275 #ifdef HAVE_LONG_LONG
13276             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13277                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13278 #endif
13279             }
13280         } else {
13281 #if CYTHON_USE_PYLONG_INTERNALS
13282             const digit* digits = ((PyLongObject*)x)->ob_digit;
13283             switch (Py_SIZE(x)) {
13284                 case  0: return (int) 0;
13285                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
13286                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
13287                 case -2:
13288                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
13289                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13290                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13291                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13292                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13293                         }
13294                     }
13295                     break;
13296                 case 2:
13297                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
13298                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13299                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13300                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13301                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13302                         }
13303                     }
13304                     break;
13305                 case -3:
13306                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
13307                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13308                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13309                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13310                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13311                         }
13312                     }
13313                     break;
13314                 case 3:
13315                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
13316                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13317                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13318                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13319                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13320                         }
13321                     }
13322                     break;
13323                 case -4:
13324                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
13325                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13326                             __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])))
13327                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13328                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13329                         }
13330                     }
13331                     break;
13332                 case 4:
13333                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
13334                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13335                             __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])))
13336                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
13337                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
13338                         }
13339                     }
13340                     break;
13341             }
13342 #endif
13343             if (sizeof(int) <= sizeof(long)) {
13344                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
13345 #ifdef HAVE_LONG_LONG
13346             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13347                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
13348 #endif
13349             }
13350         }
13351         {
13352 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13353             PyErr_SetString(PyExc_RuntimeError,
13354                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13355 #else
13356             int val;
13357             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13358  #if PY_MAJOR_VERSION < 3
13359             if (likely(v) && !PyLong_Check(v)) {
13360                 PyObject *tmp = v;
13361                 v = PyNumber_Long(tmp);
13362                 Py_DECREF(tmp);
13363             }
13364  #endif
13365             if (likely(v)) {
13366                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13367                 unsigned char *bytes = (unsigned char *)&val;
13368                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13369                                               bytes, sizeof(val),
13370                                               is_little, !is_unsigned);
13371                 Py_DECREF(v);
13372                 if (likely(!ret))
13373                     return val;
13374             }
13375 #endif
13376             return (int) -1;
13377         }
13378     } else {
13379         int val;
13380         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13381         if (!tmp) return (int) -1;
13382         val = __Pyx_PyInt_As_int(tmp);
13383         Py_DECREF(tmp);
13384         return val;
13385     }
13386 raise_overflow:
13387     PyErr_SetString(PyExc_OverflowError,
13388         "value too large to convert to int");
13389     return (int) -1;
13390 raise_neg_overflow:
13391     PyErr_SetString(PyExc_OverflowError,
13392         "can't convert negative value to int");
13393     return (int) -1;
13394 }
13395 
13396 /* CIntToPy */
__Pyx_PyInt_From_int(int value)13397 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
13398 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13399 #pragma GCC diagnostic push
13400 #pragma GCC diagnostic ignored "-Wconversion"
13401 #endif
13402     const int neg_one = (int) -1, const_zero = (int) 0;
13403 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13404 #pragma GCC diagnostic pop
13405 #endif
13406     const int is_unsigned = neg_one > const_zero;
13407     if (is_unsigned) {
13408         if (sizeof(int) < sizeof(long)) {
13409             return PyInt_FromLong((long) value);
13410         } else if (sizeof(int) <= sizeof(unsigned long)) {
13411             return PyLong_FromUnsignedLong((unsigned long) value);
13412 #ifdef HAVE_LONG_LONG
13413         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13414             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13415 #endif
13416         }
13417     } else {
13418         if (sizeof(int) <= sizeof(long)) {
13419             return PyInt_FromLong((long) value);
13420 #ifdef HAVE_LONG_LONG
13421         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13422             return PyLong_FromLongLong((PY_LONG_LONG) value);
13423 #endif
13424         }
13425     }
13426     {
13427         int one = 1; int little = (int)*(unsigned char *)&one;
13428         unsigned char *bytes = (unsigned char *)&value;
13429         return _PyLong_FromByteArray(bytes, sizeof(int),
13430                                      little, !is_unsigned);
13431     }
13432 }
13433 
13434 /* CIntFromPy */
__Pyx_PyInt_As_unsigned_int(PyObject * x)13435 static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
13436 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13437 #pragma GCC diagnostic push
13438 #pragma GCC diagnostic ignored "-Wconversion"
13439 #endif
13440     const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
13441 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13442 #pragma GCC diagnostic pop
13443 #endif
13444     const int is_unsigned = neg_one > const_zero;
13445 #if PY_MAJOR_VERSION < 3
13446     if (likely(PyInt_Check(x))) {
13447         if (sizeof(unsigned int) < sizeof(long)) {
13448             __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
13449         } else {
13450             long val = PyInt_AS_LONG(x);
13451             if (is_unsigned && unlikely(val < 0)) {
13452                 goto raise_neg_overflow;
13453             }
13454             return (unsigned int) val;
13455         }
13456     } else
13457 #endif
13458     if (likely(PyLong_Check(x))) {
13459         if (is_unsigned) {
13460 #if CYTHON_USE_PYLONG_INTERNALS
13461             const digit* digits = ((PyLongObject*)x)->ob_digit;
13462             switch (Py_SIZE(x)) {
13463                 case  0: return (unsigned int) 0;
13464                 case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
13465                 case 2:
13466                     if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
13467                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13468                             __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13469                         } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
13470                             return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
13471                         }
13472                     }
13473                     break;
13474                 case 3:
13475                     if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
13476                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13477                             __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13478                         } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
13479                             return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
13480                         }
13481                     }
13482                     break;
13483                 case 4:
13484                     if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
13485                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13486                             __PYX_VERIFY_RETURN_INT(unsigned 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])))
13487                         } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
13488                             return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
13489                         }
13490                     }
13491                     break;
13492             }
13493 #endif
13494 #if CYTHON_COMPILING_IN_CPYTHON
13495             if (unlikely(Py_SIZE(x) < 0)) {
13496                 goto raise_neg_overflow;
13497             }
13498 #else
13499             {
13500                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
13501                 if (unlikely(result < 0))
13502                     return (unsigned int) -1;
13503                 if (unlikely(result == 1))
13504                     goto raise_neg_overflow;
13505             }
13506 #endif
13507             if (sizeof(unsigned int) <= sizeof(unsigned long)) {
13508                 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
13509 #ifdef HAVE_LONG_LONG
13510             } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
13511                 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
13512 #endif
13513             }
13514         } else {
13515 #if CYTHON_USE_PYLONG_INTERNALS
13516             const digit* digits = ((PyLongObject*)x)->ob_digit;
13517             switch (Py_SIZE(x)) {
13518                 case  0: return (unsigned int) 0;
13519                 case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
13520                 case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +digits[0])
13521                 case -2:
13522                     if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
13523                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13524                             __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13525                         } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
13526                             return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13527                         }
13528                     }
13529                     break;
13530                 case 2:
13531                     if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
13532                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
13533                             __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13534                         } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
13535                             return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13536                         }
13537                     }
13538                     break;
13539                 case -3:
13540                     if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
13541                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13542                             __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13543                         } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
13544                             return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13545                         }
13546                     }
13547                     break;
13548                 case 3:
13549                     if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
13550                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
13551                             __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
13552                         } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
13553                             return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13554                         }
13555                     }
13556                     break;
13557                 case -4:
13558                     if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
13559                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13560                             __PYX_VERIFY_RETURN_INT(unsigned 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])))
13561                         } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
13562                             return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13563                         }
13564                     }
13565                     break;
13566                 case 4:
13567                     if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
13568                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
13569                             __PYX_VERIFY_RETURN_INT(unsigned 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])))
13570                         } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
13571                             return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
13572                         }
13573                     }
13574                     break;
13575             }
13576 #endif
13577             if (sizeof(unsigned int) <= sizeof(long)) {
13578                 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
13579 #ifdef HAVE_LONG_LONG
13580             } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
13581                 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
13582 #endif
13583             }
13584         }
13585         {
13586 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
13587             PyErr_SetString(PyExc_RuntimeError,
13588                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
13589 #else
13590             unsigned int val;
13591             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
13592  #if PY_MAJOR_VERSION < 3
13593             if (likely(v) && !PyLong_Check(v)) {
13594                 PyObject *tmp = v;
13595                 v = PyNumber_Long(tmp);
13596                 Py_DECREF(tmp);
13597             }
13598  #endif
13599             if (likely(v)) {
13600                 int one = 1; int is_little = (int)*(unsigned char *)&one;
13601                 unsigned char *bytes = (unsigned char *)&val;
13602                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13603                                               bytes, sizeof(val),
13604                                               is_little, !is_unsigned);
13605                 Py_DECREF(v);
13606                 if (likely(!ret))
13607                     return val;
13608             }
13609 #endif
13610             return (unsigned int) -1;
13611         }
13612     } else {
13613         unsigned int val;
13614         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
13615         if (!tmp) return (unsigned int) -1;
13616         val = __Pyx_PyInt_As_unsigned_int(tmp);
13617         Py_DECREF(tmp);
13618         return val;
13619     }
13620 raise_overflow:
13621     PyErr_SetString(PyExc_OverflowError,
13622         "value too large to convert to unsigned int");
13623     return (unsigned int) -1;
13624 raise_neg_overflow:
13625     PyErr_SetString(PyExc_OverflowError,
13626         "can't convert negative value to unsigned int");
13627     return (unsigned int) -1;
13628 }
13629 
13630 /* CIntToPy */
__Pyx_PyInt_From_unsigned_int(unsigned int value)13631 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
13632 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13633 #pragma GCC diagnostic push
13634 #pragma GCC diagnostic ignored "-Wconversion"
13635 #endif
13636     const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
13637 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13638 #pragma GCC diagnostic pop
13639 #endif
13640     const int is_unsigned = neg_one > const_zero;
13641     if (is_unsigned) {
13642         if (sizeof(unsigned int) < sizeof(long)) {
13643             return PyInt_FromLong((long) value);
13644         } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
13645             return PyLong_FromUnsignedLong((unsigned long) value);
13646 #ifdef HAVE_LONG_LONG
13647         } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
13648             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13649 #endif
13650         }
13651     } else {
13652         if (sizeof(unsigned int) <= sizeof(long)) {
13653             return PyInt_FromLong((long) value);
13654 #ifdef HAVE_LONG_LONG
13655         } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
13656             return PyLong_FromLongLong((PY_LONG_LONG) value);
13657 #endif
13658         }
13659     }
13660     {
13661         int one = 1; int little = (int)*(unsigned char *)&one;
13662         unsigned char *bytes = (unsigned char *)&value;
13663         return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
13664                                      little, !is_unsigned);
13665     }
13666 }
13667 
13668 /* CIntToPy */
__Pyx_PyInt_From_long(long value)13669 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
13670 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13671 #pragma GCC diagnostic push
13672 #pragma GCC diagnostic ignored "-Wconversion"
13673 #endif
13674     const long neg_one = (long) -1, const_zero = (long) 0;
13675 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
13676 #pragma GCC diagnostic pop
13677 #endif
13678     const int is_unsigned = neg_one > const_zero;
13679     if (is_unsigned) {
13680         if (sizeof(long) < sizeof(long)) {
13681             return PyInt_FromLong((long) value);
13682         } else if (sizeof(long) <= sizeof(unsigned long)) {
13683             return PyLong_FromUnsignedLong((unsigned long) value);
13684 #ifdef HAVE_LONG_LONG
13685         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
13686             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13687 #endif
13688         }
13689     } else {
13690         if (sizeof(long) <= sizeof(long)) {
13691             return PyInt_FromLong((long) value);
13692 #ifdef HAVE_LONG_LONG
13693         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
13694             return PyLong_FromLongLong((PY_LONG_LONG) value);
13695 #endif
13696         }
13697     }
13698     {
13699         int one = 1; int little = (int)*(unsigned char *)&one;
13700         unsigned char *bytes = (unsigned char *)&value;
13701         return _PyLong_FromByteArray(bytes, sizeof(long),
13702                                      little, !is_unsigned);
13703     }
13704 }
13705 
13706 /* FastTypeChecks */
13707 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)13708 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
13709     while (a) {
13710         a = a->tp_base;
13711         if (a == b)
13712             return 1;
13713     }
13714     return b == &PyBaseObject_Type;
13715 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)13716 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
13717     PyObject *mro;
13718     if (a == b) return 1;
13719     mro = a->tp_mro;
13720     if (likely(mro)) {
13721         Py_ssize_t i, n;
13722         n = PyTuple_GET_SIZE(mro);
13723         for (i = 0; i < n; i++) {
13724             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
13725                 return 1;
13726         }
13727         return 0;
13728     }
13729     return __Pyx_InBases(a, b);
13730 }
13731 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)13732 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
13733     PyObject *exception, *value, *tb;
13734     int res;
13735     __Pyx_PyThreadState_declare
13736     __Pyx_PyThreadState_assign
13737     __Pyx_ErrFetch(&exception, &value, &tb);
13738     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
13739     if (unlikely(res == -1)) {
13740         PyErr_WriteUnraisable(err);
13741         res = 0;
13742     }
13743     if (!res) {
13744         res = PyObject_IsSubclass(err, exc_type2);
13745         if (unlikely(res == -1)) {
13746             PyErr_WriteUnraisable(err);
13747             res = 0;
13748         }
13749     }
13750     __Pyx_ErrRestore(exception, value, tb);
13751     return res;
13752 }
13753 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)13754 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
13755     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
13756     if (!res) {
13757         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
13758     }
13759     return res;
13760 }
13761 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)13762 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
13763     Py_ssize_t i, n;
13764     assert(PyExceptionClass_Check(exc_type));
13765     n = PyTuple_GET_SIZE(tuple);
13766 #if PY_MAJOR_VERSION >= 3
13767     for (i=0; i<n; i++) {
13768         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
13769     }
13770 #endif
13771     for (i=0; i<n; i++) {
13772         PyObject *t = PyTuple_GET_ITEM(tuple, i);
13773         #if PY_MAJOR_VERSION < 3
13774         if (likely(exc_type == t)) return 1;
13775         #endif
13776         if (likely(PyExceptionClass_Check(t))) {
13777             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
13778         } else {
13779         }
13780     }
13781     return 0;
13782 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)13783 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
13784     if (likely(err == exc_type)) return 1;
13785     if (likely(PyExceptionClass_Check(err))) {
13786         if (likely(PyExceptionClass_Check(exc_type))) {
13787             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
13788         } else if (likely(PyTuple_Check(exc_type))) {
13789             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
13790         } else {
13791         }
13792     }
13793     return PyErr_GivenExceptionMatches(err, exc_type);
13794 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)13795 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
13796     assert(PyExceptionClass_Check(exc_type1));
13797     assert(PyExceptionClass_Check(exc_type2));
13798     if (likely(err == exc_type1 || err == exc_type2)) return 1;
13799     if (likely(PyExceptionClass_Check(err))) {
13800         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
13801     }
13802     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
13803 }
13804 #endif
13805 
13806 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)13807 static int __Pyx_check_binary_version(void) {
13808     char ctversion[4], rtversion[4];
13809     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
13810     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
13811     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
13812         char message[200];
13813         PyOS_snprintf(message, sizeof(message),
13814                       "compiletime version %s of module '%.100s' "
13815                       "does not match runtime version %s",
13816                       ctversion, __Pyx_MODULE_NAME, rtversion);
13817         return PyErr_WarnEx(NULL, message, 1);
13818     }
13819     return 0;
13820 }
13821 
13822 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)13823 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
13824     while (t->p) {
13825         #if PY_MAJOR_VERSION < 3
13826         if (t->is_unicode) {
13827             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
13828         } else if (t->intern) {
13829             *t->p = PyString_InternFromString(t->s);
13830         } else {
13831             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
13832         }
13833         #else
13834         if (t->is_unicode | t->is_str) {
13835             if (t->intern) {
13836                 *t->p = PyUnicode_InternFromString(t->s);
13837             } else if (t->encoding) {
13838                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
13839             } else {
13840                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
13841             }
13842         } else {
13843             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
13844         }
13845         #endif
13846         if (!*t->p)
13847             return -1;
13848         if (PyObject_Hash(*t->p) == -1)
13849             return -1;
13850         ++t;
13851     }
13852     return 0;
13853 }
13854 
__Pyx_PyUnicode_FromString(const char * c_str)13855 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
13856     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
13857 }
__Pyx_PyObject_AsString(PyObject * o)13858 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
13859     Py_ssize_t ignore;
13860     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
13861 }
13862 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
13863 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)13864 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
13865     char* defenc_c;
13866     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
13867     if (!defenc) return NULL;
13868     defenc_c = PyBytes_AS_STRING(defenc);
13869 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
13870     {
13871         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
13872         char* c;
13873         for (c = defenc_c; c < end; c++) {
13874             if ((unsigned char) (*c) >= 128) {
13875                 PyUnicode_AsASCIIString(o);
13876                 return NULL;
13877             }
13878         }
13879     }
13880 #endif
13881     *length = PyBytes_GET_SIZE(defenc);
13882     return defenc_c;
13883 }
13884 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)13885 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
13886     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
13887 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
13888     if (likely(PyUnicode_IS_ASCII(o))) {
13889         *length = PyUnicode_GET_LENGTH(o);
13890         return PyUnicode_AsUTF8(o);
13891     } else {
13892         PyUnicode_AsASCIIString(o);
13893         return NULL;
13894     }
13895 #else
13896     return PyUnicode_AsUTF8AndSize(o, length);
13897 #endif
13898 }
13899 #endif
13900 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)13901 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
13902 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
13903     if (
13904 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
13905             __Pyx_sys_getdefaultencoding_not_ascii &&
13906 #endif
13907             PyUnicode_Check(o)) {
13908         return __Pyx_PyUnicode_AsStringAndSize(o, length);
13909     } else
13910 #endif
13911 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
13912     if (PyByteArray_Check(o)) {
13913         *length = PyByteArray_GET_SIZE(o);
13914         return PyByteArray_AS_STRING(o);
13915     } else
13916 #endif
13917     {
13918         char* result;
13919         int r = PyBytes_AsStringAndSize(o, &result, length);
13920         if (unlikely(r < 0)) {
13921             return NULL;
13922         } else {
13923             return result;
13924         }
13925     }
13926 }
__Pyx_PyObject_IsTrue(PyObject * x)13927 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
13928    int is_true = x == Py_True;
13929    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
13930    else return PyObject_IsTrue(x);
13931 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)13932 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
13933     int retval;
13934     if (unlikely(!x)) return -1;
13935     retval = __Pyx_PyObject_IsTrue(x);
13936     Py_DECREF(x);
13937     return retval;
13938 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)13939 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
13940 #if PY_MAJOR_VERSION >= 3
13941     if (PyLong_Check(result)) {
13942         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
13943                 "__int__ returned non-int (type %.200s).  "
13944                 "The ability to return an instance of a strict subclass of int "
13945                 "is deprecated, and may be removed in a future version of Python.",
13946                 Py_TYPE(result)->tp_name)) {
13947             Py_DECREF(result);
13948             return NULL;
13949         }
13950         return result;
13951     }
13952 #endif
13953     PyErr_Format(PyExc_TypeError,
13954                  "__%.4s__ returned non-%.4s (type %.200s)",
13955                  type_name, type_name, Py_TYPE(result)->tp_name);
13956     Py_DECREF(result);
13957     return NULL;
13958 }
__Pyx_PyNumber_IntOrLong(PyObject * x)13959 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
13960 #if CYTHON_USE_TYPE_SLOTS
13961   PyNumberMethods *m;
13962 #endif
13963   const char *name = NULL;
13964   PyObject *res = NULL;
13965 #if PY_MAJOR_VERSION < 3
13966   if (likely(PyInt_Check(x) || PyLong_Check(x)))
13967 #else
13968   if (likely(PyLong_Check(x)))
13969 #endif
13970     return __Pyx_NewRef(x);
13971 #if CYTHON_USE_TYPE_SLOTS
13972   m = Py_TYPE(x)->tp_as_number;
13973   #if PY_MAJOR_VERSION < 3
13974   if (m && m->nb_int) {
13975     name = "int";
13976     res = m->nb_int(x);
13977   }
13978   else if (m && m->nb_long) {
13979     name = "long";
13980     res = m->nb_long(x);
13981   }
13982   #else
13983   if (likely(m && m->nb_int)) {
13984     name = "int";
13985     res = m->nb_int(x);
13986   }
13987   #endif
13988 #else
13989   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
13990     res = PyNumber_Int(x);
13991   }
13992 #endif
13993   if (likely(res)) {
13994 #if PY_MAJOR_VERSION < 3
13995     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
13996 #else
13997     if (unlikely(!PyLong_CheckExact(res))) {
13998 #endif
13999         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
14000     }
14001   }
14002   else if (!PyErr_Occurred()) {
14003     PyErr_SetString(PyExc_TypeError,
14004                     "an integer is required");
14005   }
14006   return res;
14007 }
14008 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14009   Py_ssize_t ival;
14010   PyObject *x;
14011 #if PY_MAJOR_VERSION < 3
14012   if (likely(PyInt_CheckExact(b))) {
14013     if (sizeof(Py_ssize_t) >= sizeof(long))
14014         return PyInt_AS_LONG(b);
14015     else
14016         return PyInt_AsSsize_t(b);
14017   }
14018 #endif
14019   if (likely(PyLong_CheckExact(b))) {
14020     #if CYTHON_USE_PYLONG_INTERNALS
14021     const digit* digits = ((PyLongObject*)b)->ob_digit;
14022     const Py_ssize_t size = Py_SIZE(b);
14023     if (likely(__Pyx_sst_abs(size) <= 1)) {
14024         ival = likely(size) ? digits[0] : 0;
14025         if (size == -1) ival = -ival;
14026         return ival;
14027     } else {
14028       switch (size) {
14029          case 2:
14030            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14031              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14032            }
14033            break;
14034          case -2:
14035            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
14036              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14037            }
14038            break;
14039          case 3:
14040            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14041              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14042            }
14043            break;
14044          case -3:
14045            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
14046              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14047            }
14048            break;
14049          case 4:
14050            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14051              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]));
14052            }
14053            break;
14054          case -4:
14055            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
14056              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]));
14057            }
14058            break;
14059       }
14060     }
14061     #endif
14062     return PyLong_AsSsize_t(b);
14063   }
14064   x = PyNumber_Index(b);
14065   if (!x) return -1;
14066   ival = PyInt_AsSsize_t(x);
14067   Py_DECREF(x);
14068   return ival;
14069 }
14070 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
14071   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
14072 }
14073 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14074     return PyInt_FromSize_t(ival);
14075 }
14076 
14077 
14078 #endif /* Py_PYTHON_H */
14079