1 /* Generated by Cython 0.29.21 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6     #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8     #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_21"
11 #define CYTHON_HEX_VERSION 0x001D15F0
12 #define CYTHON_FUTURE_DIVISION 1
13 #include <stddef.h>
14 #ifndef offsetof
15   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18   #ifndef __stdcall
19     #define __stdcall
20   #endif
21   #ifndef __cdecl
22     #define __cdecl
23   #endif
24   #ifndef __fastcall
25     #define __fastcall
26   #endif
27 #endif
28 #ifndef DL_IMPORT
29   #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32   #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36   #if PY_VERSION_HEX >= 0x02070000
37     #define HAVE_LONG_LONG
38   #endif
39 #endif
40 #ifndef PY_LONG_LONG
41   #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44   #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47   #define CYTHON_COMPILING_IN_PYPY 1
48   #define CYTHON_COMPILING_IN_PYSTON 0
49   #define CYTHON_COMPILING_IN_CPYTHON 0
50   #undef CYTHON_USE_TYPE_SLOTS
51   #define CYTHON_USE_TYPE_SLOTS 0
52   #undef CYTHON_USE_PYTYPE_LOOKUP
53   #define CYTHON_USE_PYTYPE_LOOKUP 0
54   #if PY_VERSION_HEX < 0x03050000
55     #undef CYTHON_USE_ASYNC_SLOTS
56     #define CYTHON_USE_ASYNC_SLOTS 0
57   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58     #define CYTHON_USE_ASYNC_SLOTS 1
59   #endif
60   #undef CYTHON_USE_PYLIST_INTERNALS
61   #define CYTHON_USE_PYLIST_INTERNALS 0
62   #undef CYTHON_USE_UNICODE_INTERNALS
63   #define CYTHON_USE_UNICODE_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_WRITER
65   #define CYTHON_USE_UNICODE_WRITER 0
66   #undef CYTHON_USE_PYLONG_INTERNALS
67   #define CYTHON_USE_PYLONG_INTERNALS 0
68   #undef CYTHON_AVOID_BORROWED_REFS
69   #define CYTHON_AVOID_BORROWED_REFS 1
70   #undef CYTHON_ASSUME_SAFE_MACROS
71   #define CYTHON_ASSUME_SAFE_MACROS 0
72   #undef CYTHON_UNPACK_METHODS
73   #define CYTHON_UNPACK_METHODS 0
74   #undef CYTHON_FAST_THREAD_STATE
75   #define CYTHON_FAST_THREAD_STATE 0
76   #undef CYTHON_FAST_PYCALL
77   #define CYTHON_FAST_PYCALL 0
78   #undef CYTHON_PEP489_MULTI_PHASE_INIT
79   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80   #undef CYTHON_USE_TP_FINALIZE
81   #define CYTHON_USE_TP_FINALIZE 0
82   #undef CYTHON_USE_DICT_VERSIONS
83   #define CYTHON_USE_DICT_VERSIONS 0
84   #undef CYTHON_USE_EXC_INFO_STACK
85   #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87   #define CYTHON_COMPILING_IN_PYPY 0
88   #define CYTHON_COMPILING_IN_PYSTON 1
89   #define CYTHON_COMPILING_IN_CPYTHON 0
90   #ifndef CYTHON_USE_TYPE_SLOTS
91     #define CYTHON_USE_TYPE_SLOTS 1
92   #endif
93   #undef CYTHON_USE_PYTYPE_LOOKUP
94   #define CYTHON_USE_PYTYPE_LOOKUP 0
95   #undef CYTHON_USE_ASYNC_SLOTS
96   #define CYTHON_USE_ASYNC_SLOTS 0
97   #undef CYTHON_USE_PYLIST_INTERNALS
98   #define CYTHON_USE_PYLIST_INTERNALS 0
99   #ifndef CYTHON_USE_UNICODE_INTERNALS
100     #define CYTHON_USE_UNICODE_INTERNALS 1
101   #endif
102   #undef CYTHON_USE_UNICODE_WRITER
103   #define CYTHON_USE_UNICODE_WRITER 0
104   #undef CYTHON_USE_PYLONG_INTERNALS
105   #define CYTHON_USE_PYLONG_INTERNALS 0
106   #ifndef CYTHON_AVOID_BORROWED_REFS
107     #define CYTHON_AVOID_BORROWED_REFS 0
108   #endif
109   #ifndef CYTHON_ASSUME_SAFE_MACROS
110     #define CYTHON_ASSUME_SAFE_MACROS 1
111   #endif
112   #ifndef CYTHON_UNPACK_METHODS
113     #define CYTHON_UNPACK_METHODS 1
114   #endif
115   #undef CYTHON_FAST_THREAD_STATE
116   #define CYTHON_FAST_THREAD_STATE 0
117   #undef CYTHON_FAST_PYCALL
118   #define CYTHON_FAST_PYCALL 0
119   #undef CYTHON_PEP489_MULTI_PHASE_INIT
120   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121   #undef CYTHON_USE_TP_FINALIZE
122   #define CYTHON_USE_TP_FINALIZE 0
123   #undef CYTHON_USE_DICT_VERSIONS
124   #define CYTHON_USE_DICT_VERSIONS 0
125   #undef CYTHON_USE_EXC_INFO_STACK
126   #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128   #define CYTHON_COMPILING_IN_PYPY 0
129   #define CYTHON_COMPILING_IN_PYSTON 0
130   #define CYTHON_COMPILING_IN_CPYTHON 1
131   #ifndef CYTHON_USE_TYPE_SLOTS
132     #define CYTHON_USE_TYPE_SLOTS 1
133   #endif
134   #if PY_VERSION_HEX < 0x02070000
135     #undef CYTHON_USE_PYTYPE_LOOKUP
136     #define CYTHON_USE_PYTYPE_LOOKUP 0
137   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138     #define CYTHON_USE_PYTYPE_LOOKUP 1
139   #endif
140   #if PY_MAJOR_VERSION < 3
141     #undef CYTHON_USE_ASYNC_SLOTS
142     #define CYTHON_USE_ASYNC_SLOTS 0
143   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144     #define CYTHON_USE_ASYNC_SLOTS 1
145   #endif
146   #if PY_VERSION_HEX < 0x02070000
147     #undef CYTHON_USE_PYLONG_INTERNALS
148     #define CYTHON_USE_PYLONG_INTERNALS 0
149   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150     #define CYTHON_USE_PYLONG_INTERNALS 1
151   #endif
152   #ifndef CYTHON_USE_PYLIST_INTERNALS
153     #define CYTHON_USE_PYLIST_INTERNALS 1
154   #endif
155   #ifndef CYTHON_USE_UNICODE_INTERNALS
156     #define CYTHON_USE_UNICODE_INTERNALS 1
157   #endif
158   #if PY_VERSION_HEX < 0x030300F0
159     #undef CYTHON_USE_UNICODE_WRITER
160     #define CYTHON_USE_UNICODE_WRITER 0
161   #elif !defined(CYTHON_USE_UNICODE_WRITER)
162     #define CYTHON_USE_UNICODE_WRITER 1
163   #endif
164   #ifndef CYTHON_AVOID_BORROWED_REFS
165     #define CYTHON_AVOID_BORROWED_REFS 0
166   #endif
167   #ifndef CYTHON_ASSUME_SAFE_MACROS
168     #define CYTHON_ASSUME_SAFE_MACROS 1
169   #endif
170   #ifndef CYTHON_UNPACK_METHODS
171     #define CYTHON_UNPACK_METHODS 1
172   #endif
173   #ifndef CYTHON_FAST_THREAD_STATE
174     #define CYTHON_FAST_THREAD_STATE 1
175   #endif
176   #ifndef CYTHON_FAST_PYCALL
177     #define CYTHON_FAST_PYCALL 1
178   #endif
179   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181   #endif
182   #ifndef CYTHON_USE_TP_FINALIZE
183     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184   #endif
185   #ifndef CYTHON_USE_DICT_VERSIONS
186     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187   #endif
188   #ifndef CYTHON_USE_EXC_INFO_STACK
189     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190   #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196   #include "longintrepr.h"
197   #undef SHIFT
198   #undef BASE
199   #undef MASK
200   #ifdef SIZEOF_VOID_P
201     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202   #endif
203 #endif
204 #ifndef __has_attribute
205   #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208   #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211   #if defined(__GNUC__)
212     #define CYTHON_RESTRICT __restrict__
213   #elif defined(_MSC_VER) && _MSC_VER >= 1400
214     #define CYTHON_RESTRICT __restrict
215   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216     #define CYTHON_RESTRICT restrict
217   #else
218     #define CYTHON_RESTRICT
219   #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 #     define CYTHON_UNUSED __attribute__ ((__unused__))
225 #   else
226 #     define CYTHON_UNUSED
227 #   endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 #   define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 #   define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)236      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 #  else
238 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 #  endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 #  define CYTHON_NCP_UNUSED
244 # else
245 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250     #ifndef _MSC_STDINT_H_
251         #if _MSC_VER < 1300
252            typedef unsigned char     uint8_t;
253            typedef unsigned int      uint32_t;
254         #else
255            typedef unsigned __int8   uint8_t;
256            typedef unsigned __int32  uint32_t;
257         #endif
258     #endif
259 #else
260    #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263   #if defined(__cplusplus) && __cplusplus >= 201103L
264     #if __has_cpp_attribute(fallthrough)
265       #define CYTHON_FALLTHROUGH [[fallthrough]]
266     #elif __has_cpp_attribute(clang::fallthrough)
267       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268     #elif __has_cpp_attribute(gnu::fallthrough)
269       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270     #endif
271   #endif
272   #ifndef CYTHON_FALLTHROUGH
273     #if __has_attribute(fallthrough)
274       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275     #else
276       #define CYTHON_FALLTHROUGH
277     #endif
278   #endif
279   #if defined(__clang__ ) && defined(__apple_build_version__)
280     #if __apple_build_version__ < 7000000
281       #undef  CYTHON_FALLTHROUGH
282       #define CYTHON_FALLTHROUGH
283     #endif
284   #endif
285 #endif
286 
287 #ifndef CYTHON_INLINE
288   #if defined(__clang__)
289     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290   #elif defined(__GNUC__)
291     #define CYTHON_INLINE __inline__
292   #elif defined(_MSC_VER)
293     #define CYTHON_INLINE __inline
294   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295     #define CYTHON_INLINE inline
296   #else
297     #define CYTHON_INLINE
298   #endif
299 #endif
300 
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302   #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310   #define __Pyx_DefaultClassType PyClass_Type
311 #else
312   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320   #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323   #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326   #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332   #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335   #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338   #ifndef METH_FASTCALL
339      #define METH_FASTCALL 0x80
340   #endif
341   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343                                                           Py_ssize_t nargs, PyObject *kwnames);
344 #else
345   #define __Pyx_PyCFunctionFast _PyCFunctionFast
346   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355   #define PyObject_Malloc(s)   PyMem_Malloc(s)
356   #define PyObject_Free(p)     PyMem_Free(p)
357   #define PyObject_Realloc(p)  PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
361   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
362   #define PyMem_RawFree(p)             PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
366   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
369   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372   #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376   #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378   #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385   *key = PyThread_create_key();
386   return 0;
387 }
PyThread_tss_alloc(void)388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390   *key = Py_tss_NEEDS_INIT;
391   return key;
392 }
PyThread_tss_free(Py_tss_t * key)393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394   PyObject_Free(key);
395 }
PyThread_tss_is_created(Py_tss_t * key)396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397   return *key != Py_tss_NEEDS_INIT;
398 }
PyThread_tss_delete(Py_tss_t * key)399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400   PyThread_delete_key(*key);
401   *key = Py_tss_NEEDS_INIT;
402 }
PyThread_tss_set(Py_tss_t * key,void * value)403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404   return PyThread_set_key_value(*key, value);
405 }
PyThread_tss_get(Py_tss_t * key)406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407   return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
417   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
418 #else
419   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
420   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428   #define CYTHON_PEP393_ENABLED 1
429   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
430                                               0 : _PyUnicode_Ready((PyObject *)(op)))
431   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
432   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
434   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
435   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
436   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
437   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
438   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
439   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
440   #else
441   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
442   #endif
443 #else
444   #define CYTHON_PEP393_ENABLED 0
445   #define PyUnicode_1BYTE_KIND  1
446   #define PyUnicode_2BYTE_KIND  2
447   #define PyUnicode_4BYTE_KIND  4
448   #define __Pyx_PyUnicode_READY(op)       (0)
449   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
450   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
451   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
452   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
453   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
454   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
455   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
456   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
457 #endif
458 #if CYTHON_COMPILING_IN_PYPY
459   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
460   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
461 #else
462   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
463   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
464       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
465 #endif
466 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
467   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
468 #endif
469 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
470   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
471 #endif
472 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
473   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
474 #endif
475 #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))
476 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
477 #if PY_MAJOR_VERSION >= 3
478   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
479 #else
480   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
481 #endif
482 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
483   #define PyObject_ASCII(o)            PyObject_Repr(o)
484 #endif
485 #if PY_MAJOR_VERSION >= 3
486   #define PyBaseString_Type            PyUnicode_Type
487   #define PyStringObject               PyUnicodeObject
488   #define PyString_Type                PyUnicode_Type
489   #define PyString_Check               PyUnicode_Check
490   #define PyString_CheckExact          PyUnicode_CheckExact
491 #ifndef PyObject_Unicode
492   #define PyObject_Unicode             PyObject_Str
493 #endif
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
497   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
498 #else
499   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
500   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
501 #endif
502 #ifndef PySet_CheckExact
503   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
504 #endif
505 #if PY_VERSION_HEX >= 0x030900A4
506   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
507   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
508 #else
509   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
510   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
511 #endif
512 #if CYTHON_ASSUME_SAFE_MACROS
513   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
514 #else
515   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
516 #endif
517 #if PY_MAJOR_VERSION >= 3
518   #define PyIntObject                  PyLongObject
519   #define PyInt_Type                   PyLong_Type
520   #define PyInt_Check(op)              PyLong_Check(op)
521   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
522   #define PyInt_FromString             PyLong_FromString
523   #define PyInt_FromUnicode            PyLong_FromUnicode
524   #define PyInt_FromLong               PyLong_FromLong
525   #define PyInt_FromSize_t             PyLong_FromSize_t
526   #define PyInt_FromSsize_t            PyLong_FromSsize_t
527   #define PyInt_AsLong                 PyLong_AsLong
528   #define PyInt_AS_LONG                PyLong_AS_LONG
529   #define PyInt_AsSsize_t              PyLong_AsSsize_t
530   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
531   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
532   #define PyNumber_Int                 PyNumber_Long
533 #endif
534 #if PY_MAJOR_VERSION >= 3
535   #define PyBoolObject                 PyLongObject
536 #endif
537 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
538   #ifndef PyUnicode_InternFromString
539     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
540   #endif
541 #endif
542 #if PY_VERSION_HEX < 0x030200A4
543   typedef long Py_hash_t;
544   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
545   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
546 #else
547   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
548   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
549 #endif
550 #if PY_MAJOR_VERSION >= 3
551   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
552 #else
553   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
554 #endif
555 #if CYTHON_USE_ASYNC_SLOTS
556   #if PY_VERSION_HEX >= 0x030500B1
557     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
558     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
559   #else
560     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
561   #endif
562 #else
563   #define __Pyx_PyType_AsAsync(obj) NULL
564 #endif
565 #ifndef __Pyx_PyAsyncMethodsStruct
566     typedef struct {
567         unaryfunc am_await;
568         unaryfunc am_aiter;
569         unaryfunc am_anext;
570     } __Pyx_PyAsyncMethodsStruct;
571 #endif
572 
573 #if defined(WIN32) || defined(MS_WINDOWS)
574   #define _USE_MATH_DEFINES
575 #endif
576 #include <math.h>
577 #ifdef NAN
578 #define __PYX_NAN() ((float) NAN)
579 #else
__PYX_NAN()580 static CYTHON_INLINE float __PYX_NAN() {
581   float value;
582   memset(&value, 0xFF, sizeof(value));
583   return value;
584 }
585 #endif
586 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
587 #define __Pyx_truncl trunc
588 #else
589 #define __Pyx_truncl truncl
590 #endif
591 
592 #define __PYX_MARK_ERR_POS(f_index, lineno) \
593     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
594 #define __PYX_ERR(f_index, lineno, Ln_error) \
595     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
596 
597 #ifndef __PYX_EXTERN_C
598   #ifdef __cplusplus
599     #define __PYX_EXTERN_C extern "C"
600   #else
601     #define __PYX_EXTERN_C extern
602   #endif
603 #endif
604 
605 #define __PYX_HAVE__rasterio___shim
606 #define __PYX_HAVE_API__rasterio___shim
607 /* Early includes */
608 #include <string.h>
609 #include <stdio.h>
610 #include "cpl_conv.h"
611 #include "cpl_error.h"
612 #include "cpl_string.h"
613 #include "sys/stat.h"
614 #include "cpl_vsi.h"
615 #include "ogr_srs_api.h"
616 #include "gdal.h"
617 #include "ogr_api.h"
618 #include "gdalwarper.h"
619 #include "gdal_alg.h"
620 #include "ogr_core.h"
621 #include "numpy/arrayobject.h"
622 #include "numpy/ndarrayobject.h"
623 #include "numpy/ndarraytypes.h"
624 #include "numpy/arrayscalars.h"
625 #include "numpy/ufuncobject.h"
626 
627     /* NumPy API declarations from "numpy/__init__.pxd" */
628 
629 #include "pythread.h"
630 #include <stdlib.h>
631 #include "pystate.h"
632 #ifdef _OPENMP
633 #include <omp.h>
634 #endif /* _OPENMP */
635 
636 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
637 #define CYTHON_WITHOUT_ASSERTIONS
638 #endif
639 
640 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
641                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
642 
643 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
644 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
645 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
646 #define __PYX_DEFAULT_STRING_ENCODING ""
647 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
648 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
649 #define __Pyx_uchar_cast(c) ((unsigned char)c)
650 #define __Pyx_long_cast(x) ((long)x)
651 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
652     (sizeof(type) < sizeof(Py_ssize_t))  ||\
653     (sizeof(type) > sizeof(Py_ssize_t) &&\
654           likely(v < (type)PY_SSIZE_T_MAX ||\
655                  v == (type)PY_SSIZE_T_MAX)  &&\
656           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
657                                 v == (type)PY_SSIZE_T_MIN)))  ||\
658     (sizeof(type) == sizeof(Py_ssize_t) &&\
659           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
660                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)661 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
662     return (size_t) i < (size_t) limit;
663 }
664 #if defined (__cplusplus) && __cplusplus >= 201103L
665     #include <cstdlib>
666     #define __Pyx_sst_abs(value) std::abs(value)
667 #elif SIZEOF_INT >= SIZEOF_SIZE_T
668     #define __Pyx_sst_abs(value) abs(value)
669 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
670     #define __Pyx_sst_abs(value) labs(value)
671 #elif defined (_MSC_VER)
672     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
673 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
674     #define __Pyx_sst_abs(value) llabs(value)
675 #elif defined (__GNUC__)
676     #define __Pyx_sst_abs(value) __builtin_llabs(value)
677 #else
678     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
679 #endif
680 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
681 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
682 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
683 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
684 #define __Pyx_PyBytes_FromString        PyBytes_FromString
685 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
686 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
687 #if PY_MAJOR_VERSION < 3
688     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
689     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
690 #else
691     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
692     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
693 #endif
694 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
695 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
696 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
697 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
698 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
699 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
700 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
701 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
702 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
703 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
704 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
705 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
706 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
707 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
708 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
709 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)710 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
711     const Py_UNICODE *u_end = u;
712     while (*u_end++) ;
713     return (size_t)(u_end - u - 1);
714 }
715 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
716 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
717 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
718 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
719 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
720 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
721 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
722 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
723 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
724 #define __Pyx_PySequence_Tuple(obj)\
725     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
726 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
727 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
728 #if CYTHON_ASSUME_SAFE_MACROS
729 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
730 #else
731 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
732 #endif
733 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
734 #if PY_MAJOR_VERSION >= 3
735 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
736 #else
737 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
738 #endif
739 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
740 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
741 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)742 static int __Pyx_init_sys_getdefaultencoding_params(void) {
743     PyObject* sys;
744     PyObject* default_encoding = NULL;
745     PyObject* ascii_chars_u = NULL;
746     PyObject* ascii_chars_b = NULL;
747     const char* default_encoding_c;
748     sys = PyImport_ImportModule("sys");
749     if (!sys) goto bad;
750     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
751     Py_DECREF(sys);
752     if (!default_encoding) goto bad;
753     default_encoding_c = PyBytes_AsString(default_encoding);
754     if (!default_encoding_c) goto bad;
755     if (strcmp(default_encoding_c, "ascii") == 0) {
756         __Pyx_sys_getdefaultencoding_not_ascii = 0;
757     } else {
758         char ascii_chars[128];
759         int c;
760         for (c = 0; c < 128; c++) {
761             ascii_chars[c] = c;
762         }
763         __Pyx_sys_getdefaultencoding_not_ascii = 1;
764         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
765         if (!ascii_chars_u) goto bad;
766         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
767         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
768             PyErr_Format(
769                 PyExc_ValueError,
770                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
771                 default_encoding_c);
772             goto bad;
773         }
774         Py_DECREF(ascii_chars_u);
775         Py_DECREF(ascii_chars_b);
776     }
777     Py_DECREF(default_encoding);
778     return 0;
779 bad:
780     Py_XDECREF(default_encoding);
781     Py_XDECREF(ascii_chars_u);
782     Py_XDECREF(ascii_chars_b);
783     return -1;
784 }
785 #endif
786 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
787 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
788 #else
789 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
790 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
791 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)792 static int __Pyx_init_sys_getdefaultencoding_params(void) {
793     PyObject* sys;
794     PyObject* default_encoding = NULL;
795     char* default_encoding_c;
796     sys = PyImport_ImportModule("sys");
797     if (!sys) goto bad;
798     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
799     Py_DECREF(sys);
800     if (!default_encoding) goto bad;
801     default_encoding_c = PyBytes_AsString(default_encoding);
802     if (!default_encoding_c) goto bad;
803     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
804     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
805     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
806     Py_DECREF(default_encoding);
807     return 0;
808 bad:
809     Py_XDECREF(default_encoding);
810     return -1;
811 }
812 #endif
813 #endif
814 
815 
816 /* Test for GCC > 2.95 */
817 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
818   #define likely(x)   __builtin_expect(!!(x), 1)
819   #define unlikely(x) __builtin_expect(!!(x), 0)
820 #else /* !__GNUC__ or GCC < 2.95 */
821   #define likely(x)   (x)
822   #define unlikely(x) (x)
823 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)824 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
825 
826 static PyObject *__pyx_m = NULL;
827 static PyObject *__pyx_d;
828 static PyObject *__pyx_b;
829 static PyObject *__pyx_cython_runtime = NULL;
830 static PyObject *__pyx_empty_tuple;
831 static PyObject *__pyx_empty_bytes;
832 static PyObject *__pyx_empty_unicode;
833 static int __pyx_lineno;
834 static int __pyx_clineno = 0;
835 static const char * __pyx_cfilenm= __FILE__;
836 static const char *__pyx_filename;
837 
838 /* Header.proto */
839 #if !defined(CYTHON_CCOMPLEX)
840   #if defined(__cplusplus)
841     #define CYTHON_CCOMPLEX 1
842   #elif defined(_Complex_I)
843     #define CYTHON_CCOMPLEX 1
844   #else
845     #define CYTHON_CCOMPLEX 0
846   #endif
847 #endif
848 #if CYTHON_CCOMPLEX
849   #ifdef __cplusplus
850     #include <complex>
851   #else
852     #include <complex.h>
853   #endif
854 #endif
855 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
856   #undef _Complex_I
857   #define _Complex_I 1.0fj
858 #endif
859 
860 
861 static const char *__pyx_f[] = {
862   "rasterio/_shim.pyx",
863   "__init__.pxd",
864   "stringsource",
865   "type.pxd",
866 };
867 /* NoFastGil.proto */
868 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
869 #define __Pyx_PyGILState_Release PyGILState_Release
870 #define __Pyx_FastGIL_Remember()
871 #define __Pyx_FastGIL_Forget()
872 #define __Pyx_FastGilFuncInit()
873 
874 /* ForceInitThreads.proto */
875 #ifndef __PYX_FORCE_INIT_THREADS
876   #define __PYX_FORCE_INIT_THREADS 0
877 #endif
878 
879 /* BufferFormatStructs.proto */
880 #define IS_UNSIGNED(type) (((type) -1) > 0)
881 struct __Pyx_StructField_;
882 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
883 typedef struct {
884   const char* name;
885   struct __Pyx_StructField_* fields;
886   size_t size;
887   size_t arraysize[8];
888   int ndim;
889   char typegroup;
890   char is_unsigned;
891   int flags;
892 } __Pyx_TypeInfo;
893 typedef struct __Pyx_StructField_ {
894   __Pyx_TypeInfo* type;
895   const char* name;
896   size_t offset;
897 } __Pyx_StructField;
898 typedef struct {
899   __Pyx_StructField* field;
900   size_t parent_offset;
901 } __Pyx_BufFmt_StackElem;
902 typedef struct {
903   __Pyx_StructField root;
904   __Pyx_BufFmt_StackElem* head;
905   size_t fmt_offset;
906   size_t new_count, enc_count;
907   size_t struct_alignment;
908   int is_complex;
909   char enc_type;
910   char new_packmode;
911   char enc_packmode;
912   char is_valid_array;
913 } __Pyx_BufFmt_Context;
914 
915 /* Atomics.proto */
916 #include <pythread.h>
917 #ifndef CYTHON_ATOMICS
918     #define CYTHON_ATOMICS 1
919 #endif
920 #define __pyx_atomic_int_type int
921 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
922                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
923                     !defined(__i386__)
924     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
925     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
926     #ifdef __PYX_DEBUG_ATOMICS
927         #warning "Using GNU atomics"
928     #endif
929 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
930     #include <Windows.h>
931     #undef __pyx_atomic_int_type
932     #define __pyx_atomic_int_type LONG
933     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
934     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
935     #ifdef __PYX_DEBUG_ATOMICS
936         #pragma message ("Using MSVC atomics")
937     #endif
938 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
939     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
940     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
941     #ifdef __PYX_DEBUG_ATOMICS
942         #warning "Using Intel atomics"
943     #endif
944 #else
945     #undef CYTHON_ATOMICS
946     #define CYTHON_ATOMICS 0
947     #ifdef __PYX_DEBUG_ATOMICS
948         #warning "Not using atomics"
949     #endif
950 #endif
951 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
952 #if CYTHON_ATOMICS
953     #define __pyx_add_acquisition_count(memview)\
954              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
955     #define __pyx_sub_acquisition_count(memview)\
956             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
957 #else
958     #define __pyx_add_acquisition_count(memview)\
959             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
960     #define __pyx_sub_acquisition_count(memview)\
961             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
962 #endif
963 
964 /* MemviewSliceStruct.proto */
965 struct __pyx_memoryview_obj;
966 typedef struct {
967   struct __pyx_memoryview_obj *memview;
968   char *data;
969   Py_ssize_t shape[8];
970   Py_ssize_t strides[8];
971   Py_ssize_t suboffsets[8];
972 } __Pyx_memviewslice;
973 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
974 
975 
976 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":690
977  * # in Cython to enable them only on the right systems.
978  *
979  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
980  * ctypedef npy_int16      int16_t
981  * ctypedef npy_int32      int32_t
982  */
983 typedef npy_int8 __pyx_t_5numpy_int8_t;
984 
985 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":691
986  *
987  * ctypedef npy_int8       int8_t
988  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
989  * ctypedef npy_int32      int32_t
990  * ctypedef npy_int64      int64_t
991  */
992 typedef npy_int16 __pyx_t_5numpy_int16_t;
993 
994 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":692
995  * ctypedef npy_int8       int8_t
996  * ctypedef npy_int16      int16_t
997  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
998  * ctypedef npy_int64      int64_t
999  * #ctypedef npy_int96      int96_t
1000  */
1001 typedef npy_int32 __pyx_t_5numpy_int32_t;
1002 
1003 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":693
1004  * ctypedef npy_int16      int16_t
1005  * ctypedef npy_int32      int32_t
1006  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1007  * #ctypedef npy_int96      int96_t
1008  * #ctypedef npy_int128     int128_t
1009  */
1010 typedef npy_int64 __pyx_t_5numpy_int64_t;
1011 
1012 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":697
1013  * #ctypedef npy_int128     int128_t
1014  *
1015  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1016  * ctypedef npy_uint16     uint16_t
1017  * ctypedef npy_uint32     uint32_t
1018  */
1019 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1020 
1021 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":698
1022  *
1023  * ctypedef npy_uint8      uint8_t
1024  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1025  * ctypedef npy_uint32     uint32_t
1026  * ctypedef npy_uint64     uint64_t
1027  */
1028 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1029 
1030 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":699
1031  * ctypedef npy_uint8      uint8_t
1032  * ctypedef npy_uint16     uint16_t
1033  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1034  * ctypedef npy_uint64     uint64_t
1035  * #ctypedef npy_uint96     uint96_t
1036  */
1037 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1038 
1039 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":700
1040  * ctypedef npy_uint16     uint16_t
1041  * ctypedef npy_uint32     uint32_t
1042  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1043  * #ctypedef npy_uint96     uint96_t
1044  * #ctypedef npy_uint128    uint128_t
1045  */
1046 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1047 
1048 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":704
1049  * #ctypedef npy_uint128    uint128_t
1050  *
1051  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1052  * ctypedef npy_float64    float64_t
1053  * #ctypedef npy_float80    float80_t
1054  */
1055 typedef npy_float32 __pyx_t_5numpy_float32_t;
1056 
1057 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":705
1058  *
1059  * ctypedef npy_float32    float32_t
1060  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1061  * #ctypedef npy_float80    float80_t
1062  * #ctypedef npy_float128   float128_t
1063  */
1064 typedef npy_float64 __pyx_t_5numpy_float64_t;
1065 
1066 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":714
1067  * # The int types are mapped a bit surprising --
1068  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1069  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1070  * ctypedef npy_longlong   long_t
1071  * ctypedef npy_longlong   longlong_t
1072  */
1073 typedef npy_long __pyx_t_5numpy_int_t;
1074 
1075 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":715
1076  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1077  * ctypedef npy_long       int_t
1078  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1079  * ctypedef npy_longlong   longlong_t
1080  *
1081  */
1082 typedef npy_longlong __pyx_t_5numpy_long_t;
1083 
1084 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":716
1085  * ctypedef npy_long       int_t
1086  * ctypedef npy_longlong   long_t
1087  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1088  *
1089  * ctypedef npy_ulong      uint_t
1090  */
1091 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1092 
1093 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":718
1094  * ctypedef npy_longlong   longlong_t
1095  *
1096  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1097  * ctypedef npy_ulonglong  ulong_t
1098  * ctypedef npy_ulonglong  ulonglong_t
1099  */
1100 typedef npy_ulong __pyx_t_5numpy_uint_t;
1101 
1102 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":719
1103  *
1104  * ctypedef npy_ulong      uint_t
1105  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1106  * ctypedef npy_ulonglong  ulonglong_t
1107  *
1108  */
1109 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1110 
1111 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":720
1112  * ctypedef npy_ulong      uint_t
1113  * ctypedef npy_ulonglong  ulong_t
1114  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1115  *
1116  * ctypedef npy_intp       intp_t
1117  */
1118 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1119 
1120 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":722
1121  * ctypedef npy_ulonglong  ulonglong_t
1122  *
1123  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1124  * ctypedef npy_uintp      uintp_t
1125  *
1126  */
1127 typedef npy_intp __pyx_t_5numpy_intp_t;
1128 
1129 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":723
1130  *
1131  * ctypedef npy_intp       intp_t
1132  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1133  *
1134  * ctypedef npy_double     float_t
1135  */
1136 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1137 
1138 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":725
1139  * ctypedef npy_uintp      uintp_t
1140  *
1141  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1142  * ctypedef npy_double     double_t
1143  * ctypedef npy_longdouble longdouble_t
1144  */
1145 typedef npy_double __pyx_t_5numpy_float_t;
1146 
1147 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":726
1148  *
1149  * ctypedef npy_double     float_t
1150  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1151  * ctypedef npy_longdouble longdouble_t
1152  *
1153  */
1154 typedef npy_double __pyx_t_5numpy_double_t;
1155 
1156 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":727
1157  * ctypedef npy_double     float_t
1158  * ctypedef npy_double     double_t
1159  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1160  *
1161  * ctypedef npy_cfloat      cfloat_t
1162  */
1163 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1164 /* Declarations.proto */
1165 #if CYTHON_CCOMPLEX
1166   #ifdef __cplusplus
1167     typedef ::std::complex< float > __pyx_t_float_complex;
1168   #else
1169     typedef float _Complex __pyx_t_float_complex;
1170   #endif
1171 #else
1172     typedef struct { float real, imag; } __pyx_t_float_complex;
1173 #endif
1174 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1175 
1176 /* Declarations.proto */
1177 #if CYTHON_CCOMPLEX
1178   #ifdef __cplusplus
1179     typedef ::std::complex< double > __pyx_t_double_complex;
1180   #else
1181     typedef double _Complex __pyx_t_double_complex;
1182   #endif
1183 #else
1184     typedef struct { double real, imag; } __pyx_t_double_complex;
1185 #endif
1186 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1187 
1188 
1189 /*--- Type declarations ---*/
1190 struct __pyx_array_obj;
1191 struct __pyx_MemviewEnum_obj;
1192 struct __pyx_memoryview_obj;
1193 struct __pyx_memoryviewslice_obj;
1194 
1195 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":729
1196  * ctypedef npy_longdouble longdouble_t
1197  *
1198  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1199  * ctypedef npy_cdouble     cdouble_t
1200  * ctypedef npy_clongdouble clongdouble_t
1201  */
1202 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1203 
1204 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":730
1205  *
1206  * ctypedef npy_cfloat      cfloat_t
1207  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1208  * ctypedef npy_clongdouble clongdouble_t
1209  *
1210  */
1211 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1212 
1213 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":731
1214  * ctypedef npy_cfloat      cfloat_t
1215  * ctypedef npy_cdouble     cdouble_t
1216  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1217  *
1218  * ctypedef npy_cdouble     complex_t
1219  */
1220 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1221 
1222 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":733
1223  * ctypedef npy_clongdouble clongdouble_t
1224  *
1225  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1226  *
1227  * cdef inline object PyArray_MultiIterNew1(a):
1228  */
1229 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1230 struct __pyx_opt_args_8rasterio_5_shim_io_band;
1231 struct __pyx_opt_args_8rasterio_5_shim_io_multi_band;
1232 struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask;
1233 
1234 /* "rasterio/_shim.pxd":7
1235  * cdef GDALDatasetH open_dataset(object filename, int mode, object allowed_drivers, object open_options, object siblings) except NULL
1236  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3
1237  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1             # <<<<<<<<<<<<<<
1238  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1239  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1240  */
1241 struct __pyx_opt_args_8rasterio_5_shim_io_band {
1242   int __pyx_n;
1243   int resampling;
1244 };
1245 
1246 /* "rasterio/_shim.pxd":8
1247  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3
1248  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1
1249  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1             # <<<<<<<<<<<<<<
1250  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1251  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs)
1252  */
1253 struct __pyx_opt_args_8rasterio_5_shim_io_multi_band {
1254   int __pyx_n;
1255   int resampling;
1256 };
1257 
1258 /* "rasterio/_shim.pxd":9
1259  * cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1
1260  * cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1
1261  * cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1             # <<<<<<<<<<<<<<
1262  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs)
1263  * cdef void osr_set_traditional_axis_mapping_strategy(OGRSpatialReferenceH hSrs)
1264  */
1265 struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask {
1266   int __pyx_n;
1267   int resampling;
1268 };
1269 
1270 /* "View.MemoryView":105
1271  *
1272  * @cname("__pyx_array")
1273  * cdef class array:             # <<<<<<<<<<<<<<
1274  *
1275  *     cdef:
1276  */
1277 struct __pyx_array_obj {
1278   PyObject_HEAD
1279   struct __pyx_vtabstruct_array *__pyx_vtab;
1280   char *data;
1281   Py_ssize_t len;
1282   char *format;
1283   int ndim;
1284   Py_ssize_t *_shape;
1285   Py_ssize_t *_strides;
1286   Py_ssize_t itemsize;
1287   PyObject *mode;
1288   PyObject *_format;
1289   void (*callback_free_data)(void *);
1290   int free_data;
1291   int dtype_is_object;
1292 };
1293 
1294 
1295 /* "View.MemoryView":279
1296  *
1297  * @cname('__pyx_MemviewEnum')
1298  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1299  *     cdef object name
1300  *     def __init__(self, name):
1301  */
1302 struct __pyx_MemviewEnum_obj {
1303   PyObject_HEAD
1304   PyObject *name;
1305 };
1306 
1307 
1308 /* "View.MemoryView":330
1309  *
1310  * @cname('__pyx_memoryview')
1311  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1312  *
1313  *     cdef object obj
1314  */
1315 struct __pyx_memoryview_obj {
1316   PyObject_HEAD
1317   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1318   PyObject *obj;
1319   PyObject *_size;
1320   PyObject *_array_interface;
1321   PyThread_type_lock lock;
1322   __pyx_atomic_int acquisition_count[2];
1323   __pyx_atomic_int *acquisition_count_aligned_p;
1324   Py_buffer view;
1325   int flags;
1326   int dtype_is_object;
1327   __Pyx_TypeInfo *typeinfo;
1328 };
1329 
1330 
1331 /* "View.MemoryView":965
1332  *
1333  * @cname('__pyx_memoryviewslice')
1334  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1335  *     "Internal class for passing memoryview slices to Python"
1336  *
1337  */
1338 struct __pyx_memoryviewslice_obj {
1339   struct __pyx_memoryview_obj __pyx_base;
1340   __Pyx_memviewslice from_slice;
1341   PyObject *from_object;
1342   PyObject *(*to_object_func)(char *);
1343   int (*to_dtype_func)(char *, PyObject *);
1344 };
1345 
1346 
1347 
1348 /* "View.MemoryView":105
1349  *
1350  * @cname("__pyx_array")
1351  * cdef class array:             # <<<<<<<<<<<<<<
1352  *
1353  *     cdef:
1354  */
1355 
1356 struct __pyx_vtabstruct_array {
1357   PyObject *(*get_memview)(struct __pyx_array_obj *);
1358 };
1359 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1360 
1361 
1362 /* "View.MemoryView":330
1363  *
1364  * @cname('__pyx_memoryview')
1365  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1366  *
1367  *     cdef object obj
1368  */
1369 
1370 struct __pyx_vtabstruct_memoryview {
1371   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1372   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1373   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1374   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1375   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1376   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1377   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1378 };
1379 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1380 
1381 
1382 /* "View.MemoryView":965
1383  *
1384  * @cname('__pyx_memoryviewslice')
1385  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1386  *     "Internal class for passing memoryview slices to Python"
1387  *
1388  */
1389 
1390 struct __pyx_vtabstruct__memoryviewslice {
1391   struct __pyx_vtabstruct_memoryview __pyx_base;
1392 };
1393 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1394 
1395 /* --- Runtime support code (head) --- */
1396 /* Refnanny.proto */
1397 #ifndef CYTHON_REFNANNY
1398   #define CYTHON_REFNANNY 0
1399 #endif
1400 #if CYTHON_REFNANNY
1401   typedef struct {
1402     void (*INCREF)(void*, PyObject*, int);
1403     void (*DECREF)(void*, PyObject*, int);
1404     void (*GOTREF)(void*, PyObject*, int);
1405     void (*GIVEREF)(void*, PyObject*, int);
1406     void* (*SetupContext)(const char*, int, const char*);
1407     void (*FinishContext)(void**);
1408   } __Pyx_RefNannyAPIStruct;
1409   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1410   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1411   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1412 #ifdef WITH_THREAD
1413   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1414           if (acquire_gil) {\
1415               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1416               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1417               PyGILState_Release(__pyx_gilstate_save);\
1418           } else {\
1419               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1420           }
1421 #else
1422   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1423           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1424 #endif
1425   #define __Pyx_RefNannyFinishContext()\
1426           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1427   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1428   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1429   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1430   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1431   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1432   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1433   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1434   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1435 #else
1436   #define __Pyx_RefNannyDeclarations
1437   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1438   #define __Pyx_RefNannyFinishContext()
1439   #define __Pyx_INCREF(r) Py_INCREF(r)
1440   #define __Pyx_DECREF(r) Py_DECREF(r)
1441   #define __Pyx_GOTREF(r)
1442   #define __Pyx_GIVEREF(r)
1443   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1444   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1445   #define __Pyx_XGOTREF(r)
1446   #define __Pyx_XGIVEREF(r)
1447 #endif
1448 #define __Pyx_XDECREF_SET(r, v) do {\
1449         PyObject *tmp = (PyObject *) r;\
1450         r = v; __Pyx_XDECREF(tmp);\
1451     } while (0)
1452 #define __Pyx_DECREF_SET(r, v) do {\
1453         PyObject *tmp = (PyObject *) r;\
1454         r = v; __Pyx_DECREF(tmp);\
1455     } while (0)
1456 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1457 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1458 
1459 /* PyObjectGetAttrStr.proto */
1460 #if CYTHON_USE_TYPE_SLOTS
1461 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1462 #else
1463 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1464 #endif
1465 
1466 /* GetBuiltinName.proto */
1467 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1468 
1469 /* PyCFunctionFastCall.proto */
1470 #if CYTHON_FAST_PYCCALL
1471 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1472 #else
1473 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1474 #endif
1475 
1476 /* PyFunctionFastCall.proto */
1477 #if CYTHON_FAST_PYCALL
1478 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1479     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1480 #if 1 || PY_VERSION_HEX < 0x030600B1
1481 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1482 #else
1483 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1484 #endif
1485 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1486     (sizeof(char [1 - 2*!(cond)]) - 1)
1487 #ifndef Py_MEMBER_SIZE
1488 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1489 #endif
1490   static size_t __pyx_pyframe_localsplus_offset = 0;
1491   #include "frameobject.h"
1492   #define __Pxy_PyFrame_Initialize_Offsets()\
1493     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1494      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1495   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1496     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1497 #endif
1498 
1499 /* PyObjectCall.proto */
1500 #if CYTHON_COMPILING_IN_CPYTHON
1501 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1502 #else
1503 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1504 #endif
1505 
1506 /* PyObjectCall2Args.proto */
1507 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1508 
1509 /* PyObjectCallMethO.proto */
1510 #if CYTHON_COMPILING_IN_CPYTHON
1511 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1512 #endif
1513 
1514 /* PyObjectCallOneArg.proto */
1515 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1516 
1517 /* PyThreadStateGet.proto */
1518 #if CYTHON_FAST_THREAD_STATE
1519 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1520 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1521 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1522 #else
1523 #define __Pyx_PyThreadState_declare
1524 #define __Pyx_PyThreadState_assign
1525 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1526 #endif
1527 
1528 /* PyErrFetchRestore.proto */
1529 #if CYTHON_FAST_THREAD_STATE
1530 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1531 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1532 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1533 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1534 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1535 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1536 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1537 #if CYTHON_COMPILING_IN_CPYTHON
1538 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1539 #else
1540 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1541 #endif
1542 #else
1543 #define __Pyx_PyErr_Clear() PyErr_Clear()
1544 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1545 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1546 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1547 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1548 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1549 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1550 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1551 #endif
1552 
1553 /* RaiseException.proto */
1554 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1555 
1556 /* ExtTypeTest.proto */
1557 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1558 
1559 /* GetItemInt.proto */
1560 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1561     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1562     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1563     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1564                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1565 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1566     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1567     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1568     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1569 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1570                                                               int wraparound, int boundscheck);
1571 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1572     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1573     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1574     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1575 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1576                                                               int wraparound, int boundscheck);
1577 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1578 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1579                                                      int is_list, int wraparound, int boundscheck);
1580 
1581 /* PyDictVersioning.proto */
1582 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1583 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1584 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1585 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1586     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1587     (cache_var) = (value);
1588 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1589     static PY_UINT64_T __pyx_dict_version = 0;\
1590     static PyObject *__pyx_dict_cached_value = NULL;\
1591     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1592         (VAR) = __pyx_dict_cached_value;\
1593     } else {\
1594         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1595         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1596     }\
1597 }
1598 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1599 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1600 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1601 #else
1602 #define __PYX_GET_DICT_VERSION(dict)  (0)
1603 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1604 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1605 #endif
1606 
1607 /* GetModuleGlobalName.proto */
1608 #if CYTHON_USE_DICT_VERSIONS
1609 #define __Pyx_GetModuleGlobalName(var, name)  {\
1610     static PY_UINT64_T __pyx_dict_version = 0;\
1611     static PyObject *__pyx_dict_cached_value = NULL;\
1612     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1613         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1614         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1615 }
1616 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1617     PY_UINT64_T __pyx_dict_version;\
1618     PyObject *__pyx_dict_cached_value;\
1619     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1620 }
1621 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1622 #else
1623 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1624 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1625 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1626 #endif
1627 
1628 /* ObjectGetItem.proto */
1629 #if CYTHON_USE_TYPE_SLOTS
1630 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1631 #else
1632 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1633 #endif
1634 
1635 /* BufferIndexError.proto */
1636 static void __Pyx_RaiseBufferIndexError(int axis);
1637 
1638 /* GetException.proto */
1639 #if CYTHON_FAST_THREAD_STATE
1640 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1641 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1642 #else
1643 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1644 #endif
1645 
1646 /* SwapException.proto */
1647 #if CYTHON_FAST_THREAD_STATE
1648 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1649 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1650 #else
1651 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1652 #endif
1653 
1654 /* GetTopmostException.proto */
1655 #if CYTHON_USE_EXC_INFO_STACK
1656 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1657 #endif
1658 
1659 /* SaveResetException.proto */
1660 #if CYTHON_FAST_THREAD_STATE
1661 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1662 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1663 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1664 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1665 #else
1666 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1667 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1668 #endif
1669 
1670 /* WriteUnraisableException.proto */
1671 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1672                                   int lineno, const char *filename,
1673                                   int full_traceback, int nogil);
1674 
1675 /* PyErrExceptionMatches.proto */
1676 #if CYTHON_FAST_THREAD_STATE
1677 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1678 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1679 #else
1680 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1681 #endif
1682 
1683 /* RaiseArgTupleInvalid.proto */
1684 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1685     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1686 
1687 /* RaiseDoubleKeywords.proto */
1688 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1689 
1690 /* ParseKeywords.proto */
1691 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1692     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1693     const char* function_name);
1694 
1695 /* ArgTypeTest.proto */
1696 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1697     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1698         __Pyx__ArgTypeTest(obj, type, name, exact))
1699 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1700 
1701 /* IncludeStringH.proto */
1702 #include <string.h>
1703 
1704 /* BytesEquals.proto */
1705 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1706 
1707 /* UnicodeEquals.proto */
1708 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1709 
1710 /* StrEquals.proto */
1711 #if PY_MAJOR_VERSION >= 3
1712 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1713 #else
1714 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1715 #endif
1716 
1717 /* None.proto */
1718 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1719 
1720 /* UnaryNegOverflows.proto */
1721 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1722         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1723 
1724 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1725 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1726 /* GetAttr.proto */
1727 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1728 
1729 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1730 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1731     int byteorder = 0;
1732     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1733 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1734 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1735     int byteorder = -1;
1736     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1737 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1738 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1739     int byteorder = 1;
1740     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1741 }
1742 
1743 /* decode_c_string.proto */
1744 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1745          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1746          const char* encoding, const char* errors,
1747          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1748 
1749 /* GetAttr3.proto */
1750 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1751 
1752 /* RaiseTooManyValuesToUnpack.proto */
1753 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1754 
1755 /* RaiseNeedMoreValuesToUnpack.proto */
1756 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1757 
1758 /* RaiseNoneIterError.proto */
1759 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1760 
1761 /* Import.proto */
1762 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1763 
1764 /* FastTypeChecks.proto */
1765 #if CYTHON_COMPILING_IN_CPYTHON
1766 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1767 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1768 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1769 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1770 #else
1771 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1772 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1773 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1774 #endif
1775 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1776 
1777 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1778 /* ListCompAppend.proto */
1779 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1780 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1781     PyListObject* L = (PyListObject*) list;
1782     Py_ssize_t len = Py_SIZE(list);
1783     if (likely(L->allocated > len)) {
1784         Py_INCREF(x);
1785         PyList_SET_ITEM(list, len, x);
1786         __Pyx_SET_SIZE(list, len + 1);
1787         return 0;
1788     }
1789     return PyList_Append(list, x);
1790 }
1791 #else
1792 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1793 #endif
1794 
1795 /* PyIntBinop.proto */
1796 #if !CYTHON_COMPILING_IN_PYPY
1797 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1798 #else
1799 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1800     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1801 #endif
1802 
1803 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1804 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1805 #if CYTHON_COMPILING_IN_CPYTHON
1806     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1807     if (unlikely(!none))
1808         return -1;
1809     Py_DECREF(none);
1810     return 0;
1811 #else
1812     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1813 #endif
1814 }
1815 
1816 /* ListAppend.proto */
1817 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1818 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1819     PyListObject* L = (PyListObject*) list;
1820     Py_ssize_t len = Py_SIZE(list);
1821     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1822         Py_INCREF(x);
1823         PyList_SET_ITEM(list, len, x);
1824         __Pyx_SET_SIZE(list, len + 1);
1825         return 0;
1826     }
1827     return PyList_Append(list, x);
1828 }
1829 #else
1830 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1831 #endif
1832 
1833 /* None.proto */
1834 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1835 
1836 /* None.proto */
1837 static CYTHON_INLINE long __Pyx_div_long(long, long);
1838 
1839 /* ImportFrom.proto */
1840 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1841 
1842 /* HasAttr.proto */
1843 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1844 
1845 /* PyObject_GenericGetAttrNoDict.proto */
1846 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1847 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1848 #else
1849 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1850 #endif
1851 
1852 /* PyObject_GenericGetAttr.proto */
1853 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1854 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1855 #else
1856 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1857 #endif
1858 
1859 /* SetVTable.proto */
1860 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1861 
1862 /* PyObjectGetAttrStrNoError.proto */
1863 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1864 
1865 /* SetupReduce.proto */
1866 static int __Pyx_setup_reduce(PyObject* type_obj);
1867 
1868 /* TypeImport.proto */
1869 #ifndef __PYX_HAVE_RT_ImportType_proto
1870 #define __PYX_HAVE_RT_ImportType_proto
1871 enum __Pyx_ImportType_CheckSize {
1872    __Pyx_ImportType_CheckSize_Error = 0,
1873    __Pyx_ImportType_CheckSize_Warn = 1,
1874    __Pyx_ImportType_CheckSize_Ignore = 2
1875 };
1876 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1877 #endif
1878 
1879 /* CLineInTraceback.proto */
1880 #ifdef CYTHON_CLINE_IN_TRACEBACK
1881 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1882 #else
1883 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1884 #endif
1885 
1886 /* CodeObjectCache.proto */
1887 typedef struct {
1888     PyCodeObject* code_object;
1889     int code_line;
1890 } __Pyx_CodeObjectCacheEntry;
1891 struct __Pyx_CodeObjectCache {
1892     int count;
1893     int max_count;
1894     __Pyx_CodeObjectCacheEntry* entries;
1895 };
1896 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1897 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1898 static PyCodeObject *__pyx_find_code_object(int code_line);
1899 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1900 
1901 /* AddTraceback.proto */
1902 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1903                                int py_line, const char *filename);
1904 
1905 #if PY_MAJOR_VERSION < 3
1906     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1907     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1908 #else
1909     #define __Pyx_GetBuffer PyObject_GetBuffer
1910     #define __Pyx_ReleaseBuffer PyBuffer_Release
1911 #endif
1912 
1913 
1914 /* BufferStructDeclare.proto */
1915 typedef struct {
1916   Py_ssize_t shape, strides, suboffsets;
1917 } __Pyx_Buf_DimInfo;
1918 typedef struct {
1919   size_t refcount;
1920   Py_buffer pybuffer;
1921 } __Pyx_Buffer;
1922 typedef struct {
1923   __Pyx_Buffer *rcbuffer;
1924   char *data;
1925   __Pyx_Buf_DimInfo diminfo[8];
1926 } __Pyx_LocalBuf_ND;
1927 
1928 /* MemviewSliceIsContig.proto */
1929 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
1930 
1931 /* OverlappingSlices.proto */
1932 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1933                                 __Pyx_memviewslice *slice2,
1934                                 int ndim, size_t itemsize);
1935 
1936 /* Capsule.proto */
1937 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
1938 
1939 /* CIntToPy.proto */
1940 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1941 
1942 /* MemviewDtypeToObject.proto */
1943 static CYTHON_INLINE PyObject *__pyx_memview_get_Py_ssize_t(const char *itemp);
1944 static CYTHON_INLINE int __pyx_memview_set_Py_ssize_t(const char *itemp, PyObject *obj);
1945 
1946 /* CIntToPy.proto */
1947 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1948 
1949 /* RealImag.proto */
1950 #if CYTHON_CCOMPLEX
1951   #ifdef __cplusplus
1952     #define __Pyx_CREAL(z) ((z).real())
1953     #define __Pyx_CIMAG(z) ((z).imag())
1954   #else
1955     #define __Pyx_CREAL(z) (__real__(z))
1956     #define __Pyx_CIMAG(z) (__imag__(z))
1957   #endif
1958 #else
1959     #define __Pyx_CREAL(z) ((z).real)
1960     #define __Pyx_CIMAG(z) ((z).imag)
1961 #endif
1962 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1963         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1964     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1965     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1966 #else
1967     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1968     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1969 #endif
1970 
1971 /* Arithmetic.proto */
1972 #if CYTHON_CCOMPLEX
1973     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
1974     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
1975     #define __Pyx_c_diff_float(a, b) ((a)-(b))
1976     #define __Pyx_c_prod_float(a, b) ((a)*(b))
1977     #define __Pyx_c_quot_float(a, b) ((a)/(b))
1978     #define __Pyx_c_neg_float(a)     (-(a))
1979   #ifdef __cplusplus
1980     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1981     #define __Pyx_c_conj_float(z)    (::std::conj(z))
1982     #if 1
1983         #define __Pyx_c_abs_float(z)     (::std::abs(z))
1984         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
1985     #endif
1986   #else
1987     #define __Pyx_c_is_zero_float(z) ((z)==0)
1988     #define __Pyx_c_conj_float(z)    (conjf(z))
1989     #if 1
1990         #define __Pyx_c_abs_float(z)     (cabsf(z))
1991         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
1992     #endif
1993  #endif
1994 #else
1995     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1996     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1997     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1998     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1999     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2000     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2001     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2002     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2003     #if 1
2004         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2005         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2006     #endif
2007 #endif
2008 
2009 /* Arithmetic.proto */
2010 #if CYTHON_CCOMPLEX
2011     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2012     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2013     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2014     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2015     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2016     #define __Pyx_c_neg_double(a)     (-(a))
2017   #ifdef __cplusplus
2018     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2019     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2020     #if 1
2021         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2022         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2023     #endif
2024   #else
2025     #define __Pyx_c_is_zero_double(z) ((z)==0)
2026     #define __Pyx_c_conj_double(z)    (conj(z))
2027     #if 1
2028         #define __Pyx_c_abs_double(z)     (cabs(z))
2029         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2030     #endif
2031  #endif
2032 #else
2033     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2034     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2035     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2036     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2037     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2038     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2039     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2040     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2041     #if 1
2042         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2043         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2044     #endif
2045 #endif
2046 
2047 /* MemviewSliceCopyTemplate.proto */
2048 static __Pyx_memviewslice
2049 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2050                                  const char *mode, int ndim,
2051                                  size_t sizeof_dtype, int contig_flag,
2052                                  int dtype_is_object);
2053 
2054 /* MemviewSliceInit.proto */
2055 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
2056 #define __Pyx_MEMVIEW_DIRECT   1
2057 #define __Pyx_MEMVIEW_PTR      2
2058 #define __Pyx_MEMVIEW_FULL     4
2059 #define __Pyx_MEMVIEW_CONTIG   8
2060 #define __Pyx_MEMVIEW_STRIDED  16
2061 #define __Pyx_MEMVIEW_FOLLOW   32
2062 #define __Pyx_IS_C_CONTIG 1
2063 #define __Pyx_IS_F_CONTIG 2
2064 static int __Pyx_init_memviewslice(
2065                 struct __pyx_memoryview_obj *memview,
2066                 int ndim,
2067                 __Pyx_memviewslice *memviewslice,
2068                 int memview_is_new_reference);
2069 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
2070     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2071 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
2072     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2073 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
2074 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
2075 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
2076 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
2077 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
2078 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
2079 
2080 /* CIntFromPy.proto */
2081 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2082 
2083 /* CIntFromPy.proto */
2084 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2085 
2086 /* CIntFromPy.proto */
2087 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2088 
2089 /* CheckBinaryVersion.proto */
2090 static int __Pyx_check_binary_version(void);
2091 
2092 /* FunctionExport.proto */
2093 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2094 
2095 /* FunctionImport.proto */
2096 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2097 
2098 /* InitStrings.proto */
2099 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2100 
2101 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2102 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2103 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2104 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2105 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2106 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2107 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2108 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2109 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2110 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2111 
2112 /* Module declarations from 'libc.string' */
2113 
2114 /* Module declarations from 'libc.stdio' */
2115 
2116 /* Module declarations from 'cpython.buffer' */
2117 
2118 /* Module declarations from '__builtin__' */
2119 
2120 /* Module declarations from 'cpython.type' */
2121 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2122 
2123 /* Module declarations from 'cpython' */
2124 
2125 /* Module declarations from 'cpython.object' */
2126 
2127 /* Module declarations from 'cpython.ref' */
2128 
2129 /* Module declarations from 'cpython.mem' */
2130 
2131 /* Module declarations from 'numpy' */
2132 
2133 /* Module declarations from 'numpy' */
2134 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2135 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2136 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2137 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2138 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2139 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2140 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2141 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2142 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2143 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2144 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2145 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2146 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2147 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2148 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2149 
2150 /* Module declarations from 'rasterio._err' */
2151 static int (*__pyx_f_8rasterio_4_err_exc_wrap_int)(int); /*proto*/
2152 static void *(*__pyx_f_8rasterio_4_err_exc_wrap_pointer)(void *); /*proto*/
2153 
2154 /* Module declarations from 'rasterio._shim' */
2155 static PyTypeObject *__pyx_array_type = 0;
2156 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2157 static PyTypeObject *__pyx_memoryview_type = 0;
2158 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2159 static PyObject *generic = 0;
2160 static PyObject *strided = 0;
2161 static PyObject *indirect = 0;
2162 static PyObject *contiguous = 0;
2163 static PyObject *indirect_contiguous = 0;
2164 static int __pyx_memoryview_thread_locks_used;
2165 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2166 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2167 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2168 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2169 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2170 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2171 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2172 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2173 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2174 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2175 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2176 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2177 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2178 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2179 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2180 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2181 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2182 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2183 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2184 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2185 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2186 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2187 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2188 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2189 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2190 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2191 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2192 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2193 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2194 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2195 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2196 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2197 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2198 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2199 #define __Pyx_MODULE_NAME "rasterio._shim"
2200 extern int __pyx_module_is_main_rasterio___shim;
2201 int __pyx_module_is_main_rasterio___shim = 0;
2202 
2203 /* Implementation of 'rasterio._shim' */
2204 static PyObject *__pyx_builtin_NotImplementedError;
2205 static PyObject *__pyx_builtin_range;
2206 static PyObject *__pyx_builtin_ValueError;
2207 static PyObject *__pyx_builtin_ImportError;
2208 static PyObject *__pyx_builtin_MemoryError;
2209 static PyObject *__pyx_builtin_enumerate;
2210 static PyObject *__pyx_builtin_TypeError;
2211 static PyObject *__pyx_builtin_Ellipsis;
2212 static PyObject *__pyx_builtin_id;
2213 static PyObject *__pyx_builtin_IndexError;
2214 static const char __pyx_k_O[] = "O";
2215 static const char __pyx_k_c[] = "c";
2216 static const char __pyx_k_id[] = "id";
2217 static const char __pyx_k_os[] = "os";
2218 static const char __pyx_k_new[] = "__new__";
2219 static const char __pyx_k_obj[] = "obj";
2220 static const char __pyx_k_base[] = "base";
2221 static const char __pyx_k_dict[] = "__dict__";
2222 static const char __pyx_k_main[] = "__main__";
2223 static const char __pyx_k_mode[] = "mode";
2224 static const char __pyx_k_name[] = "name";
2225 static const char __pyx_k_ndim[] = "ndim";
2226 static const char __pyx_k_pack[] = "pack";
2227 static const char __pyx_k_size[] = "size";
2228 static const char __pyx_k_step[] = "step";
2229 static const char __pyx_k_stop[] = "stop";
2230 static const char __pyx_k_test[] = "__test__";
2231 static const char __pyx_k_ASCII[] = "ASCII";
2232 static const char __pyx_k_class[] = "__class__";
2233 static const char __pyx_k_dtype[] = "dtype";
2234 static const char __pyx_k_error[] = "error";
2235 static const char __pyx_k_flags[] = "flags";
2236 static const char __pyx_k_range[] = "range";
2237 static const char __pyx_k_shape[] = "shape";
2238 static const char __pyx_k_start[] = "start";
2239 static const char __pyx_k_utf_8[] = "utf-8";
2240 static const char __pyx_k_dtypes[] = "dtypes";
2241 static const char __pyx_k_encode[] = "encode";
2242 static const char __pyx_k_format[] = "format";
2243 static const char __pyx_k_import[] = "__import__";
2244 static const char __pyx_k_name_2[] = "__name__";
2245 static const char __pyx_k_pickle[] = "pickle";
2246 static const char __pyx_k_reduce[] = "__reduce__";
2247 static const char __pyx_k_struct[] = "struct";
2248 static const char __pyx_k_unpack[] = "unpack";
2249 static const char __pyx_k_update[] = "update";
2250 static const char __pyx_k_environ[] = "environ";
2251 static const char __pyx_k_fortran[] = "fortran";
2252 static const char __pyx_k_memview[] = "memview";
2253 static const char __pyx_k_strides[] = "strides";
2254 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2255 static const char __pyx_k_PROJ_LIB[] = "PROJ_LIB";
2256 static const char __pyx_k_getstate[] = "__getstate__";
2257 static const char __pyx_k_itemsize[] = "itemsize";
2258 static const char __pyx_k_pyx_type[] = "__pyx_type";
2259 static const char __pyx_k_rasterio[] = "rasterio";
2260 static const char __pyx_k_setstate[] = "__setstate__";
2261 static const char __pyx_k_NULL_data[] = "NULL data";
2262 static const char __pyx_k_Null_band[] = "Null band";
2263 static const char __pyx_k_TypeError[] = "TypeError";
2264 static const char __pyx_k_dtype_rev[] = "dtype_rev";
2265 static const char __pyx_k_enumerate[] = "enumerate";
2266 static const char __pyx_k_pyx_state[] = "__pyx_state";
2267 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2268 static const char __pyx_k_IndexError[] = "IndexError";
2269 static const char __pyx_k_Resampling[] = "Resampling";
2270 static const char __pyx_k_ValueError[] = "ValueError";
2271 static const char __pyx_k_pyx_result[] = "__pyx_result";
2272 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2273 static const char __pyx_k_ImportError[] = "ImportError";
2274 static const char __pyx_k_MemoryError[] = "MemoryError";
2275 static const char __pyx_k_PickleError[] = "PickleError";
2276 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2277 static const char __pyx_k_stringsource[] = "stringsource";
2278 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2279 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2280 static const char __pyx_k_Null_mask_band[] = "Null mask band";
2281 static const char __pyx_k_rasterio_enums[] = "rasterio.enums";
2282 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2283 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2284 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2285 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2286 static const char __pyx_k_rasterio_errors[] = "rasterio.errors";
2287 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2288 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2289 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2290 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2291 static const char __pyx_k_DatasetIOShapeError[] = "DatasetIOShapeError";
2292 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
2293 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2294 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2295 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2296 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2297 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2298 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2299 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2300 static const char __pyx_k_Rasterio_shim_for_GDAL_1_x[] = "Rasterio shim for GDAL 1.x";
2301 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2302 static const char __pyx_k_GDALOptionNotImplementedError[] = "GDALOptionNotImplementedError";
2303 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2304 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2305 static const char __pyx_k_Dataset_indexes_and_destination[] = "Dataset indexes and destination buffer are mismatched";
2306 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2307 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2308 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2309 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2310 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2311 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2312 static const char __pyx_k_GDAL_versions_2_1_do_not_support[] = "GDAL versions < 2.1 do not support nodata deletion";
2313 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2314 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2315 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2316 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2317 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2318 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2319 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2320 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2321 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2322 static PyObject *__pyx_n_s_ASCII;
2323 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2324 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2325 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2326 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2327 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2328 static PyObject *__pyx_n_s_DatasetIOShapeError;
2329 static PyObject *__pyx_kp_u_Dataset_indexes_and_destination;
2330 static PyObject *__pyx_n_s_Ellipsis;
2331 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2332 static PyObject *__pyx_n_s_GDALOptionNotImplementedError;
2333 static PyObject *__pyx_kp_u_GDAL_versions_2_1_do_not_support;
2334 static PyObject *__pyx_n_s_ImportError;
2335 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2336 static PyObject *__pyx_n_s_IndexError;
2337 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2338 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2339 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2340 static PyObject *__pyx_n_s_MemoryError;
2341 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2342 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2343 static PyObject *__pyx_kp_u_NULL_data;
2344 static PyObject *__pyx_n_s_NotImplementedError;
2345 static PyObject *__pyx_kp_u_Null_band;
2346 static PyObject *__pyx_kp_u_Null_mask_band;
2347 static PyObject *__pyx_n_b_O;
2348 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2349 static PyObject *__pyx_n_u_PROJ_LIB;
2350 static PyObject *__pyx_n_s_PickleError;
2351 static PyObject *__pyx_n_s_Resampling;
2352 static PyObject *__pyx_n_s_TypeError;
2353 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2354 static PyObject *__pyx_n_s_ValueError;
2355 static PyObject *__pyx_n_s_View_MemoryView;
2356 static PyObject *__pyx_n_s_allocate_buffer;
2357 static PyObject *__pyx_n_s_base;
2358 static PyObject *__pyx_n_s_c;
2359 static PyObject *__pyx_n_u_c;
2360 static PyObject *__pyx_n_s_class;
2361 static PyObject *__pyx_n_s_cline_in_traceback;
2362 static PyObject *__pyx_kp_s_contiguous_and_direct;
2363 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2364 static PyObject *__pyx_n_s_dict;
2365 static PyObject *__pyx_n_s_dtype;
2366 static PyObject *__pyx_n_s_dtype_is_object;
2367 static PyObject *__pyx_n_s_dtype_rev;
2368 static PyObject *__pyx_n_s_dtypes;
2369 static PyObject *__pyx_n_s_encode;
2370 static PyObject *__pyx_n_s_enumerate;
2371 static PyObject *__pyx_n_s_environ;
2372 static PyObject *__pyx_n_s_error;
2373 static PyObject *__pyx_n_s_flags;
2374 static PyObject *__pyx_n_s_format;
2375 static PyObject *__pyx_n_s_fortran;
2376 static PyObject *__pyx_n_u_fortran;
2377 static PyObject *__pyx_n_s_getstate;
2378 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2379 static PyObject *__pyx_n_s_id;
2380 static PyObject *__pyx_n_s_import;
2381 static PyObject *__pyx_n_s_itemsize;
2382 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2383 static PyObject *__pyx_n_s_main;
2384 static PyObject *__pyx_n_s_memview;
2385 static PyObject *__pyx_n_s_mode;
2386 static PyObject *__pyx_n_s_name;
2387 static PyObject *__pyx_n_s_name_2;
2388 static PyObject *__pyx_n_s_ndim;
2389 static PyObject *__pyx_n_s_new;
2390 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2391 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2392 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2393 static PyObject *__pyx_n_s_obj;
2394 static PyObject *__pyx_n_s_os;
2395 static PyObject *__pyx_n_s_pack;
2396 static PyObject *__pyx_n_s_pickle;
2397 static PyObject *__pyx_n_s_pyx_PickleError;
2398 static PyObject *__pyx_n_s_pyx_checksum;
2399 static PyObject *__pyx_n_s_pyx_getbuffer;
2400 static PyObject *__pyx_n_s_pyx_result;
2401 static PyObject *__pyx_n_s_pyx_state;
2402 static PyObject *__pyx_n_s_pyx_type;
2403 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2404 static PyObject *__pyx_n_s_pyx_vtable;
2405 static PyObject *__pyx_n_s_range;
2406 static PyObject *__pyx_n_s_rasterio;
2407 static PyObject *__pyx_n_s_rasterio_enums;
2408 static PyObject *__pyx_n_s_rasterio_errors;
2409 static PyObject *__pyx_n_s_reduce;
2410 static PyObject *__pyx_n_s_reduce_cython;
2411 static PyObject *__pyx_n_s_reduce_ex;
2412 static PyObject *__pyx_n_s_setstate;
2413 static PyObject *__pyx_n_s_setstate_cython;
2414 static PyObject *__pyx_n_s_shape;
2415 static PyObject *__pyx_n_s_size;
2416 static PyObject *__pyx_n_s_start;
2417 static PyObject *__pyx_n_s_step;
2418 static PyObject *__pyx_n_s_stop;
2419 static PyObject *__pyx_kp_s_strided_and_direct;
2420 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2421 static PyObject *__pyx_kp_s_strided_and_indirect;
2422 static PyObject *__pyx_n_s_strides;
2423 static PyObject *__pyx_kp_s_stringsource;
2424 static PyObject *__pyx_n_s_struct;
2425 static PyObject *__pyx_n_s_test;
2426 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2427 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2428 static PyObject *__pyx_n_s_unpack;
2429 static PyObject *__pyx_n_s_update;
2430 static PyObject *__pyx_kp_u_utf_8;
2431 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
2432 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2433 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2434 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2435 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2436 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2437 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2438 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
2439 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2440 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2441 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2442 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2443 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2444 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2445 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
2446 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2447 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2448 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
2449 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2450 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2451 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2452 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2453 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2454 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2455 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2456 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2457 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2458 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2459 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2460 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2461 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2462 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2463 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2464 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2465 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2466 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2467 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2468 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2469 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2470 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2471 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2472 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2473 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2474 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2475 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2476 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2477 static PyObject *__pyx_int_0;
2478 static PyObject *__pyx_int_1;
2479 static PyObject *__pyx_int_184977713;
2480 static PyObject *__pyx_int_neg_1;
2481 static PyObject *__pyx_tuple_;
2482 static PyObject *__pyx_tuple__2;
2483 static PyObject *__pyx_tuple__3;
2484 static PyObject *__pyx_tuple__4;
2485 static PyObject *__pyx_tuple__5;
2486 static PyObject *__pyx_tuple__6;
2487 static PyObject *__pyx_tuple__7;
2488 static PyObject *__pyx_tuple__8;
2489 static PyObject *__pyx_tuple__9;
2490 static PyObject *__pyx_slice__21;
2491 static PyObject *__pyx_tuple__10;
2492 static PyObject *__pyx_tuple__11;
2493 static PyObject *__pyx_tuple__12;
2494 static PyObject *__pyx_tuple__13;
2495 static PyObject *__pyx_tuple__14;
2496 static PyObject *__pyx_tuple__15;
2497 static PyObject *__pyx_tuple__16;
2498 static PyObject *__pyx_tuple__17;
2499 static PyObject *__pyx_tuple__18;
2500 static PyObject *__pyx_tuple__19;
2501 static PyObject *__pyx_tuple__20;
2502 static PyObject *__pyx_tuple__22;
2503 static PyObject *__pyx_tuple__23;
2504 static PyObject *__pyx_tuple__24;
2505 static PyObject *__pyx_tuple__25;
2506 static PyObject *__pyx_tuple__26;
2507 static PyObject *__pyx_tuple__27;
2508 static PyObject *__pyx_tuple__28;
2509 static PyObject *__pyx_tuple__29;
2510 static PyObject *__pyx_tuple__30;
2511 static PyObject *__pyx_codeobj__31;
2512 /* Late includes */
2513 
2514 /* "rasterio/_shim.pyx":22
2515  *
2516  *
2517  * cdef GDALDatasetH open_dataset(             # <<<<<<<<<<<<<<
2518  *         object filename, int flags, object allowed_drivers,
2519  *         object open_options, object siblings) except NULL:
2520  */
2521 
__pyx_f_8rasterio_5_shim_open_dataset(PyObject * __pyx_v_filename,int __pyx_v_flags,CYTHON_UNUSED PyObject * __pyx_v_allowed_drivers,CYTHON_UNUSED PyObject * __pyx_v_open_options,CYTHON_UNUSED PyObject * __pyx_v_siblings)2522 static GDALDatasetH __pyx_f_8rasterio_5_shim_open_dataset(PyObject *__pyx_v_filename, int __pyx_v_flags, CYTHON_UNUSED PyObject *__pyx_v_allowed_drivers, CYTHON_UNUSED PyObject *__pyx_v_open_options, CYTHON_UNUSED PyObject *__pyx_v_siblings) {
2523   char const *__pyx_v_fname;
2524   GDALDatasetH __pyx_v_hds;
2525   GDALDatasetH __pyx_r;
2526   __Pyx_RefNannyDeclarations
2527   PyObject *__pyx_t_1 = NULL;
2528   PyObject *__pyx_t_2 = NULL;
2529   PyObject *__pyx_t_3 = NULL;
2530   char const *__pyx_t_4;
2531   int __pyx_t_5;
2532   void *__pyx_t_6;
2533   int __pyx_lineno = 0;
2534   const char *__pyx_filename = NULL;
2535   int __pyx_clineno = 0;
2536   __Pyx_RefNannySetupContext("open_dataset", 0);
2537   __Pyx_INCREF(__pyx_v_filename);
2538 
2539   /* "rasterio/_shim.pyx":27
2540  *     """Open a dataset and return a handle"""
2541  *
2542  *     cdef const char *fname = NULL             # <<<<<<<<<<<<<<
2543  *     cdef GDALDatasetH hds = NULL
2544  *
2545  */
2546   __pyx_v_fname = NULL;
2547 
2548   /* "rasterio/_shim.pyx":28
2549  *
2550  *     cdef const char *fname = NULL
2551  *     cdef GDALDatasetH hds = NULL             # <<<<<<<<<<<<<<
2552  *
2553  *     filename = filename.encode('utf-8')
2554  */
2555   __pyx_v_hds = NULL;
2556 
2557   /* "rasterio/_shim.pyx":30
2558  *     cdef GDALDatasetH hds = NULL
2559  *
2560  *     filename = filename.encode('utf-8')             # <<<<<<<<<<<<<<
2561  *     fname = filename
2562  *
2563  */
2564   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
2565   __Pyx_GOTREF(__pyx_t_2);
2566   __pyx_t_3 = NULL;
2567   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2568     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2569     if (likely(__pyx_t_3)) {
2570       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2571       __Pyx_INCREF(__pyx_t_3);
2572       __Pyx_INCREF(function);
2573       __Pyx_DECREF_SET(__pyx_t_2, function);
2574     }
2575   }
2576   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_utf_8);
2577   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2578   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
2579   __Pyx_GOTREF(__pyx_t_1);
2580   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2581   __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
2582   __pyx_t_1 = 0;
2583 
2584   /* "rasterio/_shim.pyx":31
2585  *
2586  *     filename = filename.encode('utf-8')
2587  *     fname = filename             # <<<<<<<<<<<<<<
2588  *
2589  *     # Note well: driver choice, open options, and sibling files
2590  */
2591   __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L1_error)
2592   __pyx_v_fname = __pyx_t_4;
2593 
2594   /* "rasterio/_shim.pyx":36
2595  *     # are not supported by GDAL versions < 2.0.
2596  *
2597  *     if flags & 0x20:             # <<<<<<<<<<<<<<
2598  *         with nogil:
2599  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2600  */
2601   __pyx_t_5 = ((__pyx_v_flags & 0x20) != 0);
2602   if (__pyx_t_5) {
2603 
2604     /* "rasterio/_shim.pyx":37
2605  *
2606  *     if flags & 0x20:
2607  *         with nogil:             # <<<<<<<<<<<<<<
2608  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2609  *     else:
2610  */
2611     {
2612         #ifdef WITH_THREAD
2613         PyThreadState *_save;
2614         Py_UNBLOCK_THREADS
2615         __Pyx_FastGIL_Remember();
2616         #endif
2617         /*try:*/ {
2618 
2619           /* "rasterio/_shim.pyx":38
2620  *     if flags & 0x20:
2621  *         with nogil:
2622  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))             # <<<<<<<<<<<<<<
2623  *     else:
2624  *         with nogil:
2625  */
2626           __pyx_v_hds = GDALOpenShared(__pyx_v_fname, ((GDALAccess)(__pyx_v_flags & 0x01)));
2627         }
2628 
2629         /* "rasterio/_shim.pyx":37
2630  *
2631  *     if flags & 0x20:
2632  *         with nogil:             # <<<<<<<<<<<<<<
2633  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2634  *     else:
2635  */
2636         /*finally:*/ {
2637           /*normal exit:*/{
2638             #ifdef WITH_THREAD
2639             __Pyx_FastGIL_Forget();
2640             Py_BLOCK_THREADS
2641             #endif
2642             goto __pyx_L6;
2643           }
2644           __pyx_L6:;
2645         }
2646     }
2647 
2648     /* "rasterio/_shim.pyx":36
2649  *     # are not supported by GDAL versions < 2.0.
2650  *
2651  *     if flags & 0x20:             # <<<<<<<<<<<<<<
2652  *         with nogil:
2653  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2654  */
2655     goto __pyx_L3;
2656   }
2657 
2658   /* "rasterio/_shim.pyx":40
2659  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2660  *     else:
2661  *         with nogil:             # <<<<<<<<<<<<<<
2662  *             hds = GDALOpen(fname, <GDALAccess>(flags & 0x01))
2663  *
2664  */
2665   /*else*/ {
2666     {
2667         #ifdef WITH_THREAD
2668         PyThreadState *_save;
2669         Py_UNBLOCK_THREADS
2670         __Pyx_FastGIL_Remember();
2671         #endif
2672         /*try:*/ {
2673 
2674           /* "rasterio/_shim.pyx":41
2675  *     else:
2676  *         with nogil:
2677  *             hds = GDALOpen(fname, <GDALAccess>(flags & 0x01))             # <<<<<<<<<<<<<<
2678  *
2679  *     return exc_wrap_pointer(hds)
2680  */
2681           __pyx_v_hds = GDALOpen(__pyx_v_fname, ((GDALAccess)(__pyx_v_flags & 0x01)));
2682         }
2683 
2684         /* "rasterio/_shim.pyx":40
2685  *             hds = GDALOpenShared(fname, <GDALAccess>(flags & 0x01))
2686  *     else:
2687  *         with nogil:             # <<<<<<<<<<<<<<
2688  *             hds = GDALOpen(fname, <GDALAccess>(flags & 0x01))
2689  *
2690  */
2691         /*finally:*/ {
2692           /*normal exit:*/{
2693             #ifdef WITH_THREAD
2694             __Pyx_FastGIL_Forget();
2695             Py_BLOCK_THREADS
2696             #endif
2697             goto __pyx_L9;
2698           }
2699           __pyx_L9:;
2700         }
2701     }
2702   }
2703   __pyx_L3:;
2704 
2705   /* "rasterio/_shim.pyx":43
2706  *             hds = GDALOpen(fname, <GDALAccess>(flags & 0x01))
2707  *
2708  *     return exc_wrap_pointer(hds)             # <<<<<<<<<<<<<<
2709  *
2710  *
2711  */
2712   __pyx_t_6 = __pyx_f_8rasterio_4_err_exc_wrap_pointer(__pyx_v_hds); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(0, 43, __pyx_L1_error)
2713   __pyx_r = __pyx_t_6;
2714   goto __pyx_L0;
2715 
2716   /* "rasterio/_shim.pyx":22
2717  *
2718  *
2719  * cdef GDALDatasetH open_dataset(             # <<<<<<<<<<<<<<
2720  *         object filename, int flags, object allowed_drivers,
2721  *         object open_options, object siblings) except NULL:
2722  */
2723 
2724   /* function exit code */
2725   __pyx_L1_error:;
2726   __Pyx_XDECREF(__pyx_t_1);
2727   __Pyx_XDECREF(__pyx_t_2);
2728   __Pyx_XDECREF(__pyx_t_3);
2729   __Pyx_AddTraceback("rasterio._shim.open_dataset", __pyx_clineno, __pyx_lineno, __pyx_filename);
2730   __pyx_r = NULL;
2731   __pyx_L0:;
2732   __Pyx_XDECREF(__pyx_v_filename);
2733   __Pyx_RefNannyFinishContext();
2734   return __pyx_r;
2735 }
2736 
2737 /* "rasterio/_shim.pyx":46
2738  *
2739  *
2740  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3:             # <<<<<<<<<<<<<<
2741  *     raise NotImplementedError(
2742  *         "GDAL versions < 2.1 do not support nodata deletion")
2743  */
2744 
__pyx_f_8rasterio_5_shim_delete_nodata_value(CYTHON_UNUSED GDALRasterBandH __pyx_v_hBand)2745 static int __pyx_f_8rasterio_5_shim_delete_nodata_value(CYTHON_UNUSED GDALRasterBandH __pyx_v_hBand) {
2746   int __pyx_r;
2747   __Pyx_RefNannyDeclarations
2748   PyObject *__pyx_t_1 = NULL;
2749   int __pyx_lineno = 0;
2750   const char *__pyx_filename = NULL;
2751   int __pyx_clineno = 0;
2752   __Pyx_RefNannySetupContext("delete_nodata_value", 0);
2753 
2754   /* "rasterio/_shim.pyx":47
2755  *
2756  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3:
2757  *     raise NotImplementedError(             # <<<<<<<<<<<<<<
2758  *         "GDAL versions < 2.1 do not support nodata deletion")
2759  *
2760  */
2761   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
2762   __Pyx_GOTREF(__pyx_t_1);
2763   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2764   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2765   __PYX_ERR(0, 47, __pyx_L1_error)
2766 
2767   /* "rasterio/_shim.pyx":46
2768  *
2769  *
2770  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3:             # <<<<<<<<<<<<<<
2771  *     raise NotImplementedError(
2772  *         "GDAL versions < 2.1 do not support nodata deletion")
2773  */
2774 
2775   /* function exit code */
2776   __pyx_L1_error:;
2777   __Pyx_XDECREF(__pyx_t_1);
2778   __Pyx_AddTraceback("rasterio._shim.delete_nodata_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
2779   __pyx_r = 3;
2780   __Pyx_RefNannyFinishContext();
2781   return __pyx_r;
2782 }
2783 
2784 /* "rasterio/_shim.pyx":51
2785  *
2786  *
2787  * cdef int io_band(             # <<<<<<<<<<<<<<
2788  *         GDALRasterBandH band, int mode, double x0, double y0,
2789  *         double width, double height, object data, int resampling=0) except -1:
2790  */
2791 
__pyx_f_8rasterio_5_shim_io_band(GDALRasterBandH __pyx_v_band,int __pyx_v_mode,double __pyx_v_x0,double __pyx_v_y0,double __pyx_v_width,double __pyx_v_height,PyObject * __pyx_v_data,struct __pyx_opt_args_8rasterio_5_shim_io_band * __pyx_optional_args)2792 static int __pyx_f_8rasterio_5_shim_io_band(GDALRasterBandH __pyx_v_band, int __pyx_v_mode, double __pyx_v_x0, double __pyx_v_y0, double __pyx_v_width, double __pyx_v_height, PyObject *__pyx_v_data, struct __pyx_opt_args_8rasterio_5_shim_io_band *__pyx_optional_args) {
2793   void *__pyx_v_buf;
2794   int __pyx_v_bufxsize;
2795   int __pyx_v_bufysize;
2796   int __pyx_v_buftype;
2797   int __pyx_v_bufpixelspace;
2798   int __pyx_v_buflinespace;
2799   int __pyx_v_xoff;
2800   int __pyx_v_yoff;
2801   int __pyx_v_xsize;
2802   int __pyx_v_ysize;
2803   int __pyx_v_retval;
2804   int __pyx_r;
2805   __Pyx_RefNannyDeclarations
2806   PyObject *__pyx_t_1 = NULL;
2807   PyObject *__pyx_t_2 = NULL;
2808   int __pyx_t_3;
2809   PyObject *__pyx_t_4 = NULL;
2810   int __pyx_lineno = 0;
2811   const char *__pyx_filename = NULL;
2812   int __pyx_clineno = 0;
2813   __Pyx_RefNannySetupContext("io_band", 0);
2814   if (__pyx_optional_args) {
2815   }
2816 
2817   /* "rasterio/_shim.pyx":66
2818  *     # GDAL handles all the buffering indexing, so a typed memoryview,
2819  *     # as in previous versions, isn't needed.
2820  *     cdef void *buf = <void *>np.PyArray_DATA(data)             # <<<<<<<<<<<<<<
2821  *     cdef int bufxsize = data.shape[1]
2822  *     cdef int bufysize = data.shape[0]
2823  */
2824   if (!(likely(((__pyx_v_data) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_data, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 66, __pyx_L1_error)
2825   __pyx_v_buf = ((void *)PyArray_DATA(((PyArrayObject *)__pyx_v_data)));
2826 
2827   /* "rasterio/_shim.pyx":67
2828  *     # as in previous versions, isn't needed.
2829  *     cdef void *buf = <void *>np.PyArray_DATA(data)
2830  *     cdef int bufxsize = data.shape[1]             # <<<<<<<<<<<<<<
2831  *     cdef int bufysize = data.shape[0]
2832  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
2833  */
2834   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
2835   __Pyx_GOTREF(__pyx_t_1);
2836   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
2837   __Pyx_GOTREF(__pyx_t_2);
2838   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2839   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error)
2840   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2841   __pyx_v_bufxsize = __pyx_t_3;
2842 
2843   /* "rasterio/_shim.pyx":68
2844  *     cdef void *buf = <void *>np.PyArray_DATA(data)
2845  *     cdef int bufxsize = data.shape[1]
2846  *     cdef int bufysize = data.shape[0]             # <<<<<<<<<<<<<<
2847  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
2848  *     cdef int bufpixelspace = data.strides[1]
2849  */
2850   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
2851   __Pyx_GOTREF(__pyx_t_2);
2852   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
2853   __Pyx_GOTREF(__pyx_t_1);
2854   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2855   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L1_error)
2856   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2857   __pyx_v_bufysize = __pyx_t_3;
2858 
2859   /* "rasterio/_shim.pyx":69
2860  *     cdef int bufxsize = data.shape[1]
2861  *     cdef int bufysize = data.shape[0]
2862  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]             # <<<<<<<<<<<<<<
2863  *     cdef int bufpixelspace = data.strides[1]
2864  *     cdef int buflinespace = data.strides[0]
2865  */
2866   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2867   __Pyx_GOTREF(__pyx_t_1);
2868   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dtype_rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
2869   __Pyx_GOTREF(__pyx_t_2);
2870   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2871   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2872   __Pyx_GOTREF(__pyx_t_1);
2873   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error)
2874   __Pyx_GOTREF(__pyx_t_4);
2875   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2876   __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2877   __Pyx_GOTREF(__pyx_t_1);
2878   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2879   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2880   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
2881   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2882   __pyx_v_buftype = __pyx_t_3;
2883 
2884   /* "rasterio/_shim.pyx":70
2885  *     cdef int bufysize = data.shape[0]
2886  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
2887  *     cdef int bufpixelspace = data.strides[1]             # <<<<<<<<<<<<<<
2888  *     cdef int buflinespace = data.strides[0]
2889  *
2890  */
2891   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2892   __Pyx_GOTREF(__pyx_t_1);
2893   __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
2894   __Pyx_GOTREF(__pyx_t_4);
2895   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2896   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L1_error)
2897   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2898   __pyx_v_bufpixelspace = __pyx_t_3;
2899 
2900   /* "rasterio/_shim.pyx":71
2901  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
2902  *     cdef int bufpixelspace = data.strides[1]
2903  *     cdef int buflinespace = data.strides[0]             # <<<<<<<<<<<<<<
2904  *
2905  *     cdef int xoff = <int>x0
2906  */
2907   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
2908   __Pyx_GOTREF(__pyx_t_4);
2909   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2910   __Pyx_GOTREF(__pyx_t_1);
2911   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2912   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error)
2913   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2914   __pyx_v_buflinespace = __pyx_t_3;
2915 
2916   /* "rasterio/_shim.pyx":73
2917  *     cdef int buflinespace = data.strides[0]
2918  *
2919  *     cdef int xoff = <int>x0             # <<<<<<<<<<<<<<
2920  *     cdef int yoff = <int>y0
2921  *     cdef int xsize = <int>width
2922  */
2923   __pyx_v_xoff = ((int)__pyx_v_x0);
2924 
2925   /* "rasterio/_shim.pyx":74
2926  *
2927  *     cdef int xoff = <int>x0
2928  *     cdef int yoff = <int>y0             # <<<<<<<<<<<<<<
2929  *     cdef int xsize = <int>width
2930  *     cdef int ysize = <int>height
2931  */
2932   __pyx_v_yoff = ((int)__pyx_v_y0);
2933 
2934   /* "rasterio/_shim.pyx":75
2935  *     cdef int xoff = <int>x0
2936  *     cdef int yoff = <int>y0
2937  *     cdef int xsize = <int>width             # <<<<<<<<<<<<<<
2938  *     cdef int ysize = <int>height
2939  *     cdef int retval = 3
2940  */
2941   __pyx_v_xsize = ((int)__pyx_v_width);
2942 
2943   /* "rasterio/_shim.pyx":76
2944  *     cdef int yoff = <int>y0
2945  *     cdef int xsize = <int>width
2946  *     cdef int ysize = <int>height             # <<<<<<<<<<<<<<
2947  *     cdef int retval = 3
2948  *
2949  */
2950   __pyx_v_ysize = ((int)__pyx_v_height);
2951 
2952   /* "rasterio/_shim.pyx":77
2953  *     cdef int xsize = <int>width
2954  *     cdef int ysize = <int>height
2955  *     cdef int retval = 3             # <<<<<<<<<<<<<<
2956  *
2957  *     with nogil:
2958  */
2959   __pyx_v_retval = 3;
2960 
2961   /* "rasterio/_shim.pyx":79
2962  *     cdef int retval = 3
2963  *
2964  *     with nogil:             # <<<<<<<<<<<<<<
2965  *         retval = GDALRasterIO(
2966  *             band, mode, xoff, yoff, xsize, ysize, buf, bufxsize, bufysize,
2967  */
2968   {
2969       #ifdef WITH_THREAD
2970       PyThreadState *_save;
2971       Py_UNBLOCK_THREADS
2972       __Pyx_FastGIL_Remember();
2973       #endif
2974       /*try:*/ {
2975 
2976         /* "rasterio/_shim.pyx":80
2977  *
2978  *     with nogil:
2979  *         retval = GDALRasterIO(             # <<<<<<<<<<<<<<
2980  *             band, mode, xoff, yoff, xsize, ysize, buf, bufxsize, bufysize,
2981  *             buftype, bufpixelspace, buflinespace)
2982  */
2983         __pyx_v_retval = GDALRasterIO(__pyx_v_band, __pyx_v_mode, __pyx_v_xoff, __pyx_v_yoff, __pyx_v_xsize, __pyx_v_ysize, __pyx_v_buf, __pyx_v_bufxsize, __pyx_v_bufysize, __pyx_v_buftype, __pyx_v_bufpixelspace, __pyx_v_buflinespace);
2984       }
2985 
2986       /* "rasterio/_shim.pyx":79
2987  *     cdef int retval = 3
2988  *
2989  *     with nogil:             # <<<<<<<<<<<<<<
2990  *         retval = GDALRasterIO(
2991  *             band, mode, xoff, yoff, xsize, ysize, buf, bufxsize, bufysize,
2992  */
2993       /*finally:*/ {
2994         /*normal exit:*/{
2995           #ifdef WITH_THREAD
2996           __Pyx_FastGIL_Forget();
2997           Py_BLOCK_THREADS
2998           #endif
2999           goto __pyx_L5;
3000         }
3001         __pyx_L5:;
3002       }
3003   }
3004 
3005   /* "rasterio/_shim.pyx":84
3006  *             buftype, bufpixelspace, buflinespace)
3007  *
3008  *     return exc_wrap_int(retval)             # <<<<<<<<<<<<<<
3009  *
3010  *
3011  */
3012   __pyx_t_3 = __pyx_f_8rasterio_4_err_exc_wrap_int(__pyx_v_retval); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error)
3013   __pyx_r = __pyx_t_3;
3014   goto __pyx_L0;
3015 
3016   /* "rasterio/_shim.pyx":51
3017  *
3018  *
3019  * cdef int io_band(             # <<<<<<<<<<<<<<
3020  *         GDALRasterBandH band, int mode, double x0, double y0,
3021  *         double width, double height, object data, int resampling=0) except -1:
3022  */
3023 
3024   /* function exit code */
3025   __pyx_L1_error:;
3026   __Pyx_XDECREF(__pyx_t_1);
3027   __Pyx_XDECREF(__pyx_t_2);
3028   __Pyx_XDECREF(__pyx_t_4);
3029   __Pyx_AddTraceback("rasterio._shim.io_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
3030   __pyx_r = -1;
3031   __pyx_L0:;
3032   __Pyx_RefNannyFinishContext();
3033   return __pyx_r;
3034 }
3035 
3036 /* "rasterio/_shim.pyx":87
3037  *
3038  *
3039  * cdef int io_multi_band(             # <<<<<<<<<<<<<<
3040  *         GDALDatasetH hds, int mode, double x0, double y0, double width,
3041  *         double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1:
3042  */
3043 
__pyx_f_8rasterio_5_shim_io_multi_band(GDALDatasetH __pyx_v_hds,int __pyx_v_mode,double __pyx_v_x0,double __pyx_v_y0,double __pyx_v_width,double __pyx_v_height,PyObject * __pyx_v_data,__Pyx_memviewslice __pyx_v_indexes,struct __pyx_opt_args_8rasterio_5_shim_io_multi_band * __pyx_optional_args)3044 static int __pyx_f_8rasterio_5_shim_io_multi_band(GDALDatasetH __pyx_v_hds, int __pyx_v_mode, double __pyx_v_x0, double __pyx_v_y0, double __pyx_v_width, double __pyx_v_height, PyObject *__pyx_v_data, __Pyx_memviewslice __pyx_v_indexes, struct __pyx_opt_args_8rasterio_5_shim_io_multi_band *__pyx_optional_args) {
3045   int __pyx_v_i;
3046   int __pyx_v_retval;
3047   int *__pyx_v_bandmap;
3048   void *__pyx_v_buf;
3049   int __pyx_v_bufxsize;
3050   int __pyx_v_bufysize;
3051   int __pyx_v_buftype;
3052   int __pyx_v_bufpixelspace;
3053   int __pyx_v_buflinespace;
3054   int __pyx_v_bufbandspace;
3055   int __pyx_v_count;
3056   int __pyx_v_xoff;
3057   int __pyx_v_yoff;
3058   int __pyx_v_xsize;
3059   int __pyx_v_ysize;
3060   int __pyx_r;
3061   __Pyx_RefNannyDeclarations
3062   PyObject *__pyx_t_1 = NULL;
3063   PyObject *__pyx_t_2 = NULL;
3064   int __pyx_t_3;
3065   PyObject *__pyx_t_4 = NULL;
3066   size_t __pyx_t_5;
3067   int __pyx_t_6;
3068   int __pyx_t_7;
3069   int __pyx_t_8;
3070   Py_ssize_t __pyx_t_9;
3071   int __pyx_t_10;
3072   char const *__pyx_t_11;
3073   PyObject *__pyx_t_12 = NULL;
3074   PyObject *__pyx_t_13 = NULL;
3075   PyObject *__pyx_t_14 = NULL;
3076   PyObject *__pyx_t_15 = NULL;
3077   PyObject *__pyx_t_16 = NULL;
3078   PyObject *__pyx_t_17 = NULL;
3079   int __pyx_lineno = 0;
3080   const char *__pyx_filename = NULL;
3081   int __pyx_clineno = 0;
3082   __Pyx_RefNannySetupContext("io_multi_band", 0);
3083   if (__pyx_optional_args) {
3084   }
3085 
3086   /* "rasterio/_shim.pyx":100
3087  *     the layout of ndarray views.
3088  *     """
3089  *     cdef int i = 0             # <<<<<<<<<<<<<<
3090  *     cdef int retval = 3
3091  *     cdef int *bandmap = NULL
3092  */
3093   __pyx_v_i = 0;
3094 
3095   /* "rasterio/_shim.pyx":101
3096  *     """
3097  *     cdef int i = 0
3098  *     cdef int retval = 3             # <<<<<<<<<<<<<<
3099  *     cdef int *bandmap = NULL
3100  *     cdef void *buf = <void *>np.PyArray_DATA(data)
3101  */
3102   __pyx_v_retval = 3;
3103 
3104   /* "rasterio/_shim.pyx":102
3105  *     cdef int i = 0
3106  *     cdef int retval = 3
3107  *     cdef int *bandmap = NULL             # <<<<<<<<<<<<<<
3108  *     cdef void *buf = <void *>np.PyArray_DATA(data)
3109  *     cdef int bufxsize = data.shape[2]
3110  */
3111   __pyx_v_bandmap = NULL;
3112 
3113   /* "rasterio/_shim.pyx":103
3114  *     cdef int retval = 3
3115  *     cdef int *bandmap = NULL
3116  *     cdef void *buf = <void *>np.PyArray_DATA(data)             # <<<<<<<<<<<<<<
3117  *     cdef int bufxsize = data.shape[2]
3118  *     cdef int bufysize = data.shape[1]
3119  */
3120   if (!(likely(((__pyx_v_data) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_data, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 103, __pyx_L1_error)
3121   __pyx_v_buf = ((void *)PyArray_DATA(((PyArrayObject *)__pyx_v_data)));
3122 
3123   /* "rasterio/_shim.pyx":104
3124  *     cdef int *bandmap = NULL
3125  *     cdef void *buf = <void *>np.PyArray_DATA(data)
3126  *     cdef int bufxsize = data.shape[2]             # <<<<<<<<<<<<<<
3127  *     cdef int bufysize = data.shape[1]
3128  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3129  */
3130   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
3131   __Pyx_GOTREF(__pyx_t_1);
3132   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
3133   __Pyx_GOTREF(__pyx_t_2);
3134   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3135   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
3136   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3137   __pyx_v_bufxsize = __pyx_t_3;
3138 
3139   /* "rasterio/_shim.pyx":105
3140  *     cdef void *buf = <void *>np.PyArray_DATA(data)
3141  *     cdef int bufxsize = data.shape[2]
3142  *     cdef int bufysize = data.shape[1]             # <<<<<<<<<<<<<<
3143  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3144  *     cdef int bufpixelspace = data.strides[2]
3145  */
3146   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
3147   __Pyx_GOTREF(__pyx_t_2);
3148   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
3149   __Pyx_GOTREF(__pyx_t_1);
3150   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3151   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error)
3152   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3153   __pyx_v_bufysize = __pyx_t_3;
3154 
3155   /* "rasterio/_shim.pyx":106
3156  *     cdef int bufxsize = data.shape[2]
3157  *     cdef int bufysize = data.shape[1]
3158  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]             # <<<<<<<<<<<<<<
3159  *     cdef int bufpixelspace = data.strides[2]
3160  *     cdef int buflinespace = data.strides[1]
3161  */
3162   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
3163   __Pyx_GOTREF(__pyx_t_1);
3164   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dtype_rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
3165   __Pyx_GOTREF(__pyx_t_2);
3166   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3167   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
3168   __Pyx_GOTREF(__pyx_t_1);
3169   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
3170   __Pyx_GOTREF(__pyx_t_4);
3171   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3172   __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
3173   __Pyx_GOTREF(__pyx_t_1);
3174   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3175   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3176   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
3177   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3178   __pyx_v_buftype = __pyx_t_3;
3179 
3180   /* "rasterio/_shim.pyx":107
3181  *     cdef int bufysize = data.shape[1]
3182  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3183  *     cdef int bufpixelspace = data.strides[2]             # <<<<<<<<<<<<<<
3184  *     cdef int buflinespace = data.strides[1]
3185  *     cdef int bufbandspace = data.strides[0]
3186  */
3187   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
3188   __Pyx_GOTREF(__pyx_t_1);
3189   __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
3190   __Pyx_GOTREF(__pyx_t_4);
3191   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3192   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
3193   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3194   __pyx_v_bufpixelspace = __pyx_t_3;
3195 
3196   /* "rasterio/_shim.pyx":108
3197  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3198  *     cdef int bufpixelspace = data.strides[2]
3199  *     cdef int buflinespace = data.strides[1]             # <<<<<<<<<<<<<<
3200  *     cdef int bufbandspace = data.strides[0]
3201  *     cdef int count = len(indexes)
3202  */
3203   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
3204   __Pyx_GOTREF(__pyx_t_4);
3205   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
3206   __Pyx_GOTREF(__pyx_t_1);
3207   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3208   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
3209   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3210   __pyx_v_buflinespace = __pyx_t_3;
3211 
3212   /* "rasterio/_shim.pyx":109
3213  *     cdef int bufpixelspace = data.strides[2]
3214  *     cdef int buflinespace = data.strides[1]
3215  *     cdef int bufbandspace = data.strides[0]             # <<<<<<<<<<<<<<
3216  *     cdef int count = len(indexes)
3217  *
3218  */
3219   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
3220   __Pyx_GOTREF(__pyx_t_1);
3221   __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
3222   __Pyx_GOTREF(__pyx_t_4);
3223   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3224   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error)
3225   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3226   __pyx_v_bufbandspace = __pyx_t_3;
3227 
3228   /* "rasterio/_shim.pyx":110
3229  *     cdef int buflinespace = data.strides[1]
3230  *     cdef int bufbandspace = data.strides[0]
3231  *     cdef int count = len(indexes)             # <<<<<<<<<<<<<<
3232  *
3233  *     cdef int xoff = <int>x0
3234  */
3235   __pyx_t_5 = __Pyx_MemoryView_Len(__pyx_v_indexes);
3236   __pyx_v_count = __pyx_t_5;
3237 
3238   /* "rasterio/_shim.pyx":112
3239  *     cdef int count = len(indexes)
3240  *
3241  *     cdef int xoff = <int>x0             # <<<<<<<<<<<<<<
3242  *     cdef int yoff = <int>y0
3243  *     cdef int xsize = <int>width
3244  */
3245   __pyx_v_xoff = ((int)__pyx_v_x0);
3246 
3247   /* "rasterio/_shim.pyx":113
3248  *
3249  *     cdef int xoff = <int>x0
3250  *     cdef int yoff = <int>y0             # <<<<<<<<<<<<<<
3251  *     cdef int xsize = <int>width
3252  *     cdef int ysize = <int>height
3253  */
3254   __pyx_v_yoff = ((int)__pyx_v_y0);
3255 
3256   /* "rasterio/_shim.pyx":114
3257  *     cdef int xoff = <int>x0
3258  *     cdef int yoff = <int>y0
3259  *     cdef int xsize = <int>width             # <<<<<<<<<<<<<<
3260  *     cdef int ysize = <int>height
3261  *
3262  */
3263   __pyx_v_xsize = ((int)__pyx_v_width);
3264 
3265   /* "rasterio/_shim.pyx":115
3266  *     cdef int yoff = <int>y0
3267  *     cdef int xsize = <int>width
3268  *     cdef int ysize = <int>height             # <<<<<<<<<<<<<<
3269  *
3270  *     if len(indexes) != data.shape[0]:
3271  */
3272   __pyx_v_ysize = ((int)__pyx_v_height);
3273 
3274   /* "rasterio/_shim.pyx":117
3275  *     cdef int ysize = <int>height
3276  *
3277  *     if len(indexes) != data.shape[0]:             # <<<<<<<<<<<<<<
3278  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3279  *
3280  */
3281   __pyx_t_5 = __Pyx_MemoryView_Len(__pyx_v_indexes);
3282   __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
3283   __Pyx_GOTREF(__pyx_t_4);
3284   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
3285   __Pyx_GOTREF(__pyx_t_1);
3286   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
3287   __Pyx_GOTREF(__pyx_t_2);
3288   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3289   __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
3290   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3291   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3292   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 117, __pyx_L1_error)
3293   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3294   if (unlikely(__pyx_t_6)) {
3295 
3296     /* "rasterio/_shim.pyx":118
3297  *
3298  *     if len(indexes) != data.shape[0]:
3299  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")             # <<<<<<<<<<<<<<
3300  *
3301  *     bandmap = <int *>CPLMalloc(count*sizeof(int))
3302  */
3303     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetIOShapeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
3304     __Pyx_GOTREF(__pyx_t_2);
3305     __pyx_t_4 = NULL;
3306     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3307       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
3308       if (likely(__pyx_t_4)) {
3309         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3310         __Pyx_INCREF(__pyx_t_4);
3311         __Pyx_INCREF(function);
3312         __Pyx_DECREF_SET(__pyx_t_2, function);
3313       }
3314     }
3315     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_u_Dataset_indexes_and_destination) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Dataset_indexes_and_destination);
3316     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3317     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
3318     __Pyx_GOTREF(__pyx_t_1);
3319     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3320     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3321     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3322     __PYX_ERR(0, 118, __pyx_L1_error)
3323 
3324     /* "rasterio/_shim.pyx":117
3325  *     cdef int ysize = <int>height
3326  *
3327  *     if len(indexes) != data.shape[0]:             # <<<<<<<<<<<<<<
3328  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3329  *
3330  */
3331   }
3332 
3333   /* "rasterio/_shim.pyx":120
3334  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3335  *
3336  *     bandmap = <int *>CPLMalloc(count*sizeof(int))             # <<<<<<<<<<<<<<
3337  *     for i in range(count):
3338  *         bandmap[i] = <int>indexes[i]
3339  */
3340   __pyx_v_bandmap = ((int *)CPLMalloc((__pyx_v_count * (sizeof(int)))));
3341 
3342   /* "rasterio/_shim.pyx":121
3343  *
3344  *     bandmap = <int *>CPLMalloc(count*sizeof(int))
3345  *     for i in range(count):             # <<<<<<<<<<<<<<
3346  *         bandmap[i] = <int>indexes[i]
3347  *
3348  */
3349   __pyx_t_3 = __pyx_v_count;
3350   __pyx_t_7 = __pyx_t_3;
3351   for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
3352     __pyx_v_i = __pyx_t_8;
3353 
3354     /* "rasterio/_shim.pyx":122
3355  *     bandmap = <int *>CPLMalloc(count*sizeof(int))
3356  *     for i in range(count):
3357  *         bandmap[i] = <int>indexes[i]             # <<<<<<<<<<<<<<
3358  *
3359  *     try:
3360  */
3361     __pyx_t_9 = __pyx_v_i;
3362     __pyx_t_10 = -1;
3363     if (__pyx_t_9 < 0) {
3364       __pyx_t_9 += __pyx_v_indexes.shape[0];
3365       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
3366     } else if (unlikely(__pyx_t_9 >= __pyx_v_indexes.shape[0])) __pyx_t_10 = 0;
3367     if (unlikely(__pyx_t_10 != -1)) {
3368       __Pyx_RaiseBufferIndexError(__pyx_t_10);
3369       __PYX_ERR(0, 122, __pyx_L1_error)
3370     }
3371     (__pyx_v_bandmap[__pyx_v_i]) = ((int)(*((Py_ssize_t *) ( /* dim=0 */ (__pyx_v_indexes.data + __pyx_t_9 * __pyx_v_indexes.strides[0]) ))));
3372   }
3373 
3374   /* "rasterio/_shim.pyx":124
3375  *         bandmap[i] = <int>indexes[i]
3376  *
3377  *     try:             # <<<<<<<<<<<<<<
3378  *         with nogil:
3379  *             retval = GDALDatasetRasterIO(
3380  */
3381   /*try:*/ {
3382 
3383     /* "rasterio/_shim.pyx":125
3384  *
3385  *     try:
3386  *         with nogil:             # <<<<<<<<<<<<<<
3387  *             retval = GDALDatasetRasterIO(
3388  *                 hds, mode, xoff, yoff, xsize, ysize, buf,
3389  */
3390     {
3391         #ifdef WITH_THREAD
3392         PyThreadState *_save;
3393         Py_UNBLOCK_THREADS
3394         __Pyx_FastGIL_Remember();
3395         #endif
3396         /*try:*/ {
3397 
3398           /* "rasterio/_shim.pyx":126
3399  *     try:
3400  *         with nogil:
3401  *             retval = GDALDatasetRasterIO(             # <<<<<<<<<<<<<<
3402  *                 hds, mode, xoff, yoff, xsize, ysize, buf,
3403  *                 bufxsize, bufysize, buftype, count, bandmap,
3404  */
3405           __pyx_v_retval = GDALDatasetRasterIO(__pyx_v_hds, __pyx_v_mode, __pyx_v_xoff, __pyx_v_yoff, __pyx_v_xsize, __pyx_v_ysize, __pyx_v_buf, __pyx_v_bufxsize, __pyx_v_bufysize, __pyx_v_buftype, __pyx_v_count, __pyx_v_bandmap, __pyx_v_bufpixelspace, __pyx_v_buflinespace, __pyx_v_bufbandspace);
3406         }
3407 
3408         /* "rasterio/_shim.pyx":125
3409  *
3410  *     try:
3411  *         with nogil:             # <<<<<<<<<<<<<<
3412  *             retval = GDALDatasetRasterIO(
3413  *                 hds, mode, xoff, yoff, xsize, ysize, buf,
3414  */
3415         /*finally:*/ {
3416           /*normal exit:*/{
3417             #ifdef WITH_THREAD
3418             __Pyx_FastGIL_Forget();
3419             Py_BLOCK_THREADS
3420             #endif
3421             goto __pyx_L11;
3422           }
3423           __pyx_L11:;
3424         }
3425     }
3426 
3427     /* "rasterio/_shim.pyx":131
3428  *                 bufpixelspace, buflinespace, bufbandspace)
3429  *
3430  *         return exc_wrap_int(retval)             # <<<<<<<<<<<<<<
3431  *
3432  *     finally:
3433  */
3434     __pyx_t_3 = __pyx_f_8rasterio_4_err_exc_wrap_int(__pyx_v_retval); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 131, __pyx_L7_error)
3435     __pyx_r = __pyx_t_3;
3436     goto __pyx_L6_return;
3437   }
3438 
3439   /* "rasterio/_shim.pyx":134
3440  *
3441  *     finally:
3442  *         CPLFree(bandmap)             # <<<<<<<<<<<<<<
3443  *
3444  *
3445  */
3446   /*finally:*/ {
3447     __pyx_L7_error:;
3448     /*exception exit:*/{
3449       __Pyx_PyThreadState_declare
3450       __Pyx_PyThreadState_assign
3451       __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
3452       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3453       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3454       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3455       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
3456       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
3457       __Pyx_XGOTREF(__pyx_t_12);
3458       __Pyx_XGOTREF(__pyx_t_13);
3459       __Pyx_XGOTREF(__pyx_t_14);
3460       __Pyx_XGOTREF(__pyx_t_15);
3461       __Pyx_XGOTREF(__pyx_t_16);
3462       __Pyx_XGOTREF(__pyx_t_17);
3463       __pyx_t_3 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
3464       {
3465         CPLFree(__pyx_v_bandmap);
3466       }
3467       if (PY_MAJOR_VERSION >= 3) {
3468         __Pyx_XGIVEREF(__pyx_t_15);
3469         __Pyx_XGIVEREF(__pyx_t_16);
3470         __Pyx_XGIVEREF(__pyx_t_17);
3471         __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
3472       }
3473       __Pyx_XGIVEREF(__pyx_t_12);
3474       __Pyx_XGIVEREF(__pyx_t_13);
3475       __Pyx_XGIVEREF(__pyx_t_14);
3476       __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
3477       __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
3478       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_11;
3479       goto __pyx_L1_error;
3480     }
3481     __pyx_L6_return: {
3482       __pyx_t_7 = __pyx_r;
3483       CPLFree(__pyx_v_bandmap);
3484       __pyx_r = __pyx_t_7;
3485       goto __pyx_L0;
3486     }
3487   }
3488 
3489   /* "rasterio/_shim.pyx":87
3490  *
3491  *
3492  * cdef int io_multi_band(             # <<<<<<<<<<<<<<
3493  *         GDALDatasetH hds, int mode, double x0, double y0, double width,
3494  *         double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1:
3495  */
3496 
3497   /* function exit code */
3498   __pyx_L1_error:;
3499   __Pyx_XDECREF(__pyx_t_1);
3500   __Pyx_XDECREF(__pyx_t_2);
3501   __Pyx_XDECREF(__pyx_t_4);
3502   __Pyx_AddTraceback("rasterio._shim.io_multi_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
3503   __pyx_r = -1;
3504   __pyx_L0:;
3505   __Pyx_RefNannyFinishContext();
3506   return __pyx_r;
3507 }
3508 
3509 /* "rasterio/_shim.pyx":137
3510  *
3511  *
3512  * cdef int io_multi_mask(             # <<<<<<<<<<<<<<
3513  *         GDALDatasetH hds, int mode, double x0, double y0, double width,
3514  *         double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1:
3515  */
3516 
__pyx_f_8rasterio_5_shim_io_multi_mask(GDALDatasetH __pyx_v_hds,int __pyx_v_mode,double __pyx_v_x0,double __pyx_v_y0,double __pyx_v_width,double __pyx_v_height,PyObject * __pyx_v_data,__Pyx_memviewslice __pyx_v_indexes,struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask * __pyx_optional_args)3517 static int __pyx_f_8rasterio_5_shim_io_multi_mask(GDALDatasetH __pyx_v_hds, int __pyx_v_mode, double __pyx_v_x0, double __pyx_v_y0, double __pyx_v_width, double __pyx_v_height, PyObject *__pyx_v_data, __Pyx_memviewslice __pyx_v_indexes, struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask *__pyx_optional_args) {
3518   int __pyx_v_i;
3519   int __pyx_v_j;
3520   int __pyx_v_retval;
3521   GDALRasterBandH __pyx_v_band;
3522   GDALRasterBandH __pyx_v_hmask;
3523   void *__pyx_v_buf;
3524   int __pyx_v_bufxsize;
3525   int __pyx_v_bufysize;
3526   CYTHON_UNUSED int __pyx_v_buftype;
3527   int __pyx_v_bufpixelspace;
3528   int __pyx_v_buflinespace;
3529   int __pyx_v_count;
3530   int __pyx_v_xoff;
3531   int __pyx_v_yoff;
3532   int __pyx_v_xsize;
3533   int __pyx_v_ysize;
3534   int __pyx_r;
3535   __Pyx_RefNannyDeclarations
3536   PyObject *__pyx_t_1 = NULL;
3537   PyObject *__pyx_t_2 = NULL;
3538   int __pyx_t_3;
3539   PyObject *__pyx_t_4 = NULL;
3540   size_t __pyx_t_5;
3541   int __pyx_t_6;
3542   int __pyx_t_7;
3543   int __pyx_t_8;
3544   Py_ssize_t __pyx_t_9;
3545   int __pyx_t_10;
3546   int __pyx_lineno = 0;
3547   const char *__pyx_filename = NULL;
3548   int __pyx_clineno = 0;
3549   __Pyx_RefNannySetupContext("io_multi_mask", 0);
3550   if (__pyx_optional_args) {
3551   }
3552 
3553   /* "rasterio/_shim.pyx":150
3554  *     the layout of ndarray views.
3555  *     """
3556  *     cdef int i = 0             # <<<<<<<<<<<<<<
3557  *     cdef int j = 0
3558  *     cdef int retval = 3
3559  */
3560   __pyx_v_i = 0;
3561 
3562   /* "rasterio/_shim.pyx":151
3563  *     """
3564  *     cdef int i = 0
3565  *     cdef int j = 0             # <<<<<<<<<<<<<<
3566  *     cdef int retval = 3
3567  *     cdef GDALRasterBandH band = NULL
3568  */
3569   __pyx_v_j = 0;
3570 
3571   /* "rasterio/_shim.pyx":152
3572  *     cdef int i = 0
3573  *     cdef int j = 0
3574  *     cdef int retval = 3             # <<<<<<<<<<<<<<
3575  *     cdef GDALRasterBandH band = NULL
3576  *     cdef GDALRasterBandH hmask = NULL
3577  */
3578   __pyx_v_retval = 3;
3579 
3580   /* "rasterio/_shim.pyx":153
3581  *     cdef int j = 0
3582  *     cdef int retval = 3
3583  *     cdef GDALRasterBandH band = NULL             # <<<<<<<<<<<<<<
3584  *     cdef GDALRasterBandH hmask = NULL
3585  *     cdef void *buf = NULL
3586  */
3587   __pyx_v_band = NULL;
3588 
3589   /* "rasterio/_shim.pyx":154
3590  *     cdef int retval = 3
3591  *     cdef GDALRasterBandH band = NULL
3592  *     cdef GDALRasterBandH hmask = NULL             # <<<<<<<<<<<<<<
3593  *     cdef void *buf = NULL
3594  *     cdef int bufxsize = data.shape[2]
3595  */
3596   __pyx_v_hmask = NULL;
3597 
3598   /* "rasterio/_shim.pyx":155
3599  *     cdef GDALRasterBandH band = NULL
3600  *     cdef GDALRasterBandH hmask = NULL
3601  *     cdef void *buf = NULL             # <<<<<<<<<<<<<<
3602  *     cdef int bufxsize = data.shape[2]
3603  *     cdef int bufysize = data.shape[1]
3604  */
3605   __pyx_v_buf = NULL;
3606 
3607   /* "rasterio/_shim.pyx":156
3608  *     cdef GDALRasterBandH hmask = NULL
3609  *     cdef void *buf = NULL
3610  *     cdef int bufxsize = data.shape[2]             # <<<<<<<<<<<<<<
3611  *     cdef int bufysize = data.shape[1]
3612  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3613  */
3614   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3615   __Pyx_GOTREF(__pyx_t_1);
3616   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
3617   __Pyx_GOTREF(__pyx_t_2);
3618   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3619   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
3620   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3621   __pyx_v_bufxsize = __pyx_t_3;
3622 
3623   /* "rasterio/_shim.pyx":157
3624  *     cdef void *buf = NULL
3625  *     cdef int bufxsize = data.shape[2]
3626  *     cdef int bufysize = data.shape[1]             # <<<<<<<<<<<<<<
3627  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3628  *     cdef int bufpixelspace = data.strides[2]
3629  */
3630   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
3631   __Pyx_GOTREF(__pyx_t_2);
3632   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
3633   __Pyx_GOTREF(__pyx_t_1);
3634   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3635   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
3636   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3637   __pyx_v_bufysize = __pyx_t_3;
3638 
3639   /* "rasterio/_shim.pyx":158
3640  *     cdef int bufxsize = data.shape[2]
3641  *     cdef int bufysize = data.shape[1]
3642  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]             # <<<<<<<<<<<<<<
3643  *     cdef int bufpixelspace = data.strides[2]
3644  *     cdef int buflinespace = data.strides[1]
3645  */
3646   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
3647   __Pyx_GOTREF(__pyx_t_1);
3648   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dtype_rev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
3649   __Pyx_GOTREF(__pyx_t_2);
3650   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3651   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
3652   __Pyx_GOTREF(__pyx_t_1);
3653   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error)
3654   __Pyx_GOTREF(__pyx_t_4);
3655   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3656   __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
3657   __Pyx_GOTREF(__pyx_t_1);
3658   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3659   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3660   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error)
3661   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3662   __pyx_v_buftype = __pyx_t_3;
3663 
3664   /* "rasterio/_shim.pyx":159
3665  *     cdef int bufysize = data.shape[1]
3666  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3667  *     cdef int bufpixelspace = data.strides[2]             # <<<<<<<<<<<<<<
3668  *     cdef int buflinespace = data.strides[1]
3669  *     cdef int count = len(indexes)
3670  */
3671   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
3672   __Pyx_GOTREF(__pyx_t_1);
3673   __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error)
3674   __Pyx_GOTREF(__pyx_t_4);
3675   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3676   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error)
3677   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3678   __pyx_v_bufpixelspace = __pyx_t_3;
3679 
3680   /* "rasterio/_shim.pyx":160
3681  *     cdef int buftype = dtypes.dtype_rev[data.dtype.name]
3682  *     cdef int bufpixelspace = data.strides[2]
3683  *     cdef int buflinespace = data.strides[1]             # <<<<<<<<<<<<<<
3684  *     cdef int count = len(indexes)
3685  *
3686  */
3687   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_strides); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error)
3688   __Pyx_GOTREF(__pyx_t_4);
3689   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3690   __Pyx_GOTREF(__pyx_t_1);
3691   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3692   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
3693   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3694   __pyx_v_buflinespace = __pyx_t_3;
3695 
3696   /* "rasterio/_shim.pyx":161
3697  *     cdef int bufpixelspace = data.strides[2]
3698  *     cdef int buflinespace = data.strides[1]
3699  *     cdef int count = len(indexes)             # <<<<<<<<<<<<<<
3700  *
3701  *     cdef int xoff = <int>x0
3702  */
3703   __pyx_t_5 = __Pyx_MemoryView_Len(__pyx_v_indexes);
3704   __pyx_v_count = __pyx_t_5;
3705 
3706   /* "rasterio/_shim.pyx":163
3707  *     cdef int count = len(indexes)
3708  *
3709  *     cdef int xoff = <int>x0             # <<<<<<<<<<<<<<
3710  *     cdef int yoff = <int>y0
3711  *     cdef int xsize = <int>width
3712  */
3713   __pyx_v_xoff = ((int)__pyx_v_x0);
3714 
3715   /* "rasterio/_shim.pyx":164
3716  *
3717  *     cdef int xoff = <int>x0
3718  *     cdef int yoff = <int>y0             # <<<<<<<<<<<<<<
3719  *     cdef int xsize = <int>width
3720  *     cdef int ysize = <int>height
3721  */
3722   __pyx_v_yoff = ((int)__pyx_v_y0);
3723 
3724   /* "rasterio/_shim.pyx":165
3725  *     cdef int xoff = <int>x0
3726  *     cdef int yoff = <int>y0
3727  *     cdef int xsize = <int>width             # <<<<<<<<<<<<<<
3728  *     cdef int ysize = <int>height
3729  *
3730  */
3731   __pyx_v_xsize = ((int)__pyx_v_width);
3732 
3733   /* "rasterio/_shim.pyx":166
3734  *     cdef int yoff = <int>y0
3735  *     cdef int xsize = <int>width
3736  *     cdef int ysize = <int>height             # <<<<<<<<<<<<<<
3737  *
3738  *     if len(indexes) != data.shape[0]:
3739  */
3740   __pyx_v_ysize = ((int)__pyx_v_height);
3741 
3742   /* "rasterio/_shim.pyx":168
3743  *     cdef int ysize = <int>height
3744  *
3745  *     if len(indexes) != data.shape[0]:             # <<<<<<<<<<<<<<
3746  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3747  *
3748  */
3749   __pyx_t_5 = __Pyx_MemoryView_Len(__pyx_v_indexes);
3750   __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
3751   __Pyx_GOTREF(__pyx_t_1);
3752   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error)
3753   __Pyx_GOTREF(__pyx_t_4);
3754   __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
3755   __Pyx_GOTREF(__pyx_t_2);
3756   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3757   __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error)
3758   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3759   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3760   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
3761   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3762   if (unlikely(__pyx_t_6)) {
3763 
3764     /* "rasterio/_shim.pyx":169
3765  *
3766  *     if len(indexes) != data.shape[0]:
3767  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")             # <<<<<<<<<<<<<<
3768  *
3769  *     for i in range(count):
3770  */
3771     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DatasetIOShapeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
3772     __Pyx_GOTREF(__pyx_t_2);
3773     __pyx_t_1 = NULL;
3774     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3775       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3776       if (likely(__pyx_t_1)) {
3777         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3778         __Pyx_INCREF(__pyx_t_1);
3779         __Pyx_INCREF(function);
3780         __Pyx_DECREF_SET(__pyx_t_2, function);
3781       }
3782     }
3783     __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_u_Dataset_indexes_and_destination) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Dataset_indexes_and_destination);
3784     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3785     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L1_error)
3786     __Pyx_GOTREF(__pyx_t_4);
3787     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3788     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3789     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3790     __PYX_ERR(0, 169, __pyx_L1_error)
3791 
3792     /* "rasterio/_shim.pyx":168
3793  *     cdef int ysize = <int>height
3794  *
3795  *     if len(indexes) != data.shape[0]:             # <<<<<<<<<<<<<<
3796  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3797  *
3798  */
3799   }
3800 
3801   /* "rasterio/_shim.pyx":171
3802  *         raise DatasetIOShapeError("Dataset indexes and destination buffer are mismatched")
3803  *
3804  *     for i in range(count):             # <<<<<<<<<<<<<<
3805  *         j = <int>indexes[i]
3806  *         band = GDALGetRasterBand(hds, j)
3807  */
3808   __pyx_t_3 = __pyx_v_count;
3809   __pyx_t_7 = __pyx_t_3;
3810   for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
3811     __pyx_v_i = __pyx_t_8;
3812 
3813     /* "rasterio/_shim.pyx":172
3814  *
3815  *     for i in range(count):
3816  *         j = <int>indexes[i]             # <<<<<<<<<<<<<<
3817  *         band = GDALGetRasterBand(hds, j)
3818  *         if band == NULL:
3819  */
3820     __pyx_t_9 = __pyx_v_i;
3821     __pyx_t_10 = -1;
3822     if (__pyx_t_9 < 0) {
3823       __pyx_t_9 += __pyx_v_indexes.shape[0];
3824       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
3825     } else if (unlikely(__pyx_t_9 >= __pyx_v_indexes.shape[0])) __pyx_t_10 = 0;
3826     if (unlikely(__pyx_t_10 != -1)) {
3827       __Pyx_RaiseBufferIndexError(__pyx_t_10);
3828       __PYX_ERR(0, 172, __pyx_L1_error)
3829     }
3830     __pyx_v_j = ((int)(*((Py_ssize_t *) ( /* dim=0 */ (__pyx_v_indexes.data + __pyx_t_9 * __pyx_v_indexes.strides[0]) ))));
3831 
3832     /* "rasterio/_shim.pyx":173
3833  *     for i in range(count):
3834  *         j = <int>indexes[i]
3835  *         band = GDALGetRasterBand(hds, j)             # <<<<<<<<<<<<<<
3836  *         if band == NULL:
3837  *             raise ValueError("Null band")
3838  */
3839     __pyx_v_band = GDALGetRasterBand(__pyx_v_hds, __pyx_v_j);
3840 
3841     /* "rasterio/_shim.pyx":174
3842  *         j = <int>indexes[i]
3843  *         band = GDALGetRasterBand(hds, j)
3844  *         if band == NULL:             # <<<<<<<<<<<<<<
3845  *             raise ValueError("Null band")
3846  *         hmask = GDALGetMaskBand(band)
3847  */
3848     __pyx_t_6 = ((__pyx_v_band == NULL) != 0);
3849     if (unlikely(__pyx_t_6)) {
3850 
3851       /* "rasterio/_shim.pyx":175
3852  *         band = GDALGetRasterBand(hds, j)
3853  *         if band == NULL:
3854  *             raise ValueError("Null band")             # <<<<<<<<<<<<<<
3855  *         hmask = GDALGetMaskBand(band)
3856  *         if hmask == NULL:
3857  */
3858       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error)
3859       __Pyx_GOTREF(__pyx_t_4);
3860       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3861       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3862       __PYX_ERR(0, 175, __pyx_L1_error)
3863 
3864       /* "rasterio/_shim.pyx":174
3865  *         j = <int>indexes[i]
3866  *         band = GDALGetRasterBand(hds, j)
3867  *         if band == NULL:             # <<<<<<<<<<<<<<
3868  *             raise ValueError("Null band")
3869  *         hmask = GDALGetMaskBand(band)
3870  */
3871     }
3872 
3873     /* "rasterio/_shim.pyx":176
3874  *         if band == NULL:
3875  *             raise ValueError("Null band")
3876  *         hmask = GDALGetMaskBand(band)             # <<<<<<<<<<<<<<
3877  *         if hmask == NULL:
3878  *             raise ValueError("Null mask band")
3879  */
3880     __pyx_v_hmask = GDALGetMaskBand(__pyx_v_band);
3881 
3882     /* "rasterio/_shim.pyx":177
3883  *             raise ValueError("Null band")
3884  *         hmask = GDALGetMaskBand(band)
3885  *         if hmask == NULL:             # <<<<<<<<<<<<<<
3886  *             raise ValueError("Null mask band")
3887  *         buf = <void *>np.PyArray_DATA(data[i])
3888  */
3889     __pyx_t_6 = ((__pyx_v_hmask == NULL) != 0);
3890     if (unlikely(__pyx_t_6)) {
3891 
3892       /* "rasterio/_shim.pyx":178
3893  *         hmask = GDALGetMaskBand(band)
3894  *         if hmask == NULL:
3895  *             raise ValueError("Null mask band")             # <<<<<<<<<<<<<<
3896  *         buf = <void *>np.PyArray_DATA(data[i])
3897  *         if buf == NULL:
3898  */
3899       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
3900       __Pyx_GOTREF(__pyx_t_4);
3901       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3902       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3903       __PYX_ERR(0, 178, __pyx_L1_error)
3904 
3905       /* "rasterio/_shim.pyx":177
3906  *             raise ValueError("Null band")
3907  *         hmask = GDALGetMaskBand(band)
3908  *         if hmask == NULL:             # <<<<<<<<<<<<<<
3909  *             raise ValueError("Null mask band")
3910  *         buf = <void *>np.PyArray_DATA(data[i])
3911  */
3912     }
3913 
3914     /* "rasterio/_shim.pyx":179
3915  *         if hmask == NULL:
3916  *             raise ValueError("Null mask band")
3917  *         buf = <void *>np.PyArray_DATA(data[i])             # <<<<<<<<<<<<<<
3918  *         if buf == NULL:
3919  *             raise ValueError("NULL data")
3920  */
3921     __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)
3922     __Pyx_GOTREF(__pyx_t_4);
3923     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 179, __pyx_L1_error)
3924     __pyx_v_buf = ((void *)PyArray_DATA(((PyArrayObject *)__pyx_t_4)));
3925     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3926 
3927     /* "rasterio/_shim.pyx":180
3928  *             raise ValueError("Null mask band")
3929  *         buf = <void *>np.PyArray_DATA(data[i])
3930  *         if buf == NULL:             # <<<<<<<<<<<<<<
3931  *             raise ValueError("NULL data")
3932  *         with nogil:
3933  */
3934     __pyx_t_6 = ((__pyx_v_buf == NULL) != 0);
3935     if (unlikely(__pyx_t_6)) {
3936 
3937       /* "rasterio/_shim.pyx":181
3938  *         buf = <void *>np.PyArray_DATA(data[i])
3939  *         if buf == NULL:
3940  *             raise ValueError("NULL data")             # <<<<<<<<<<<<<<
3941  *         with nogil:
3942  *             retval = GDALRasterIO(
3943  */
3944       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
3945       __Pyx_GOTREF(__pyx_t_4);
3946       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3947       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3948       __PYX_ERR(0, 181, __pyx_L1_error)
3949 
3950       /* "rasterio/_shim.pyx":180
3951  *             raise ValueError("Null mask band")
3952  *         buf = <void *>np.PyArray_DATA(data[i])
3953  *         if buf == NULL:             # <<<<<<<<<<<<<<
3954  *             raise ValueError("NULL data")
3955  *         with nogil:
3956  */
3957     }
3958 
3959     /* "rasterio/_shim.pyx":182
3960  *         if buf == NULL:
3961  *             raise ValueError("NULL data")
3962  *         with nogil:             # <<<<<<<<<<<<<<
3963  *             retval = GDALRasterIO(
3964  *                 hmask, mode, xoff, yoff, xsize, ysize, buf, bufxsize,
3965  */
3966     {
3967         #ifdef WITH_THREAD
3968         PyThreadState *_save;
3969         Py_UNBLOCK_THREADS
3970         __Pyx_FastGIL_Remember();
3971         #endif
3972         /*try:*/ {
3973 
3974           /* "rasterio/_shim.pyx":183
3975  *             raise ValueError("NULL data")
3976  *         with nogil:
3977  *             retval = GDALRasterIO(             # <<<<<<<<<<<<<<
3978  *                 hmask, mode, xoff, yoff, xsize, ysize, buf, bufxsize,
3979  *                 bufysize, 1, bufpixelspace, buflinespace)
3980  */
3981           __pyx_v_retval = GDALRasterIO(__pyx_v_hmask, __pyx_v_mode, __pyx_v_xoff, __pyx_v_yoff, __pyx_v_xsize, __pyx_v_ysize, __pyx_v_buf, __pyx_v_bufxsize, __pyx_v_bufysize, 1, __pyx_v_bufpixelspace, __pyx_v_buflinespace);
3982 
3983           /* "rasterio/_shim.pyx":186
3984  *                 hmask, mode, xoff, yoff, xsize, ysize, buf, bufxsize,
3985  *                 bufysize, 1, bufpixelspace, buflinespace)
3986  *             if retval:             # <<<<<<<<<<<<<<
3987  *                 break
3988  *
3989  */
3990           __pyx_t_6 = (__pyx_v_retval != 0);
3991           if (__pyx_t_6) {
3992 
3993             /* "rasterio/_shim.pyx":187
3994  *                 bufysize, 1, bufpixelspace, buflinespace)
3995  *             if retval:
3996  *                 break             # <<<<<<<<<<<<<<
3997  *
3998  *     return exc_wrap_int(retval)
3999  */
4000             goto __pyx_L10_break;
4001 
4002             /* "rasterio/_shim.pyx":186
4003  *                 hmask, mode, xoff, yoff, xsize, ysize, buf, bufxsize,
4004  *                 bufysize, 1, bufpixelspace, buflinespace)
4005  *             if retval:             # <<<<<<<<<<<<<<
4006  *                 break
4007  *
4008  */
4009           }
4010         }
4011 
4012         /* "rasterio/_shim.pyx":182
4013  *         if buf == NULL:
4014  *             raise ValueError("NULL data")
4015  *         with nogil:             # <<<<<<<<<<<<<<
4016  *             retval = GDALRasterIO(
4017  *                 hmask, mode, xoff, yoff, xsize, ysize, buf, bufxsize,
4018  */
4019         /*finally:*/ {
4020           /*normal exit:*/{
4021             #ifdef WITH_THREAD
4022             __Pyx_FastGIL_Forget();
4023             Py_BLOCK_THREADS
4024             #endif
4025             goto __pyx_L13;
4026           }
4027           __pyx_L10_break: {
4028             #ifdef WITH_THREAD
4029             __Pyx_FastGIL_Forget();
4030             Py_BLOCK_THREADS
4031             #endif
4032             goto __pyx_L5_break;
4033           }
4034           __pyx_L13:;
4035         }
4036     }
4037   }
4038   __pyx_L5_break:;
4039 
4040   /* "rasterio/_shim.pyx":189
4041  *                 break
4042  *
4043  *     return exc_wrap_int(retval)             # <<<<<<<<<<<<<<
4044  *
4045  *
4046  */
4047   __pyx_t_3 = __pyx_f_8rasterio_4_err_exc_wrap_int(__pyx_v_retval); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 189, __pyx_L1_error)
4048   __pyx_r = __pyx_t_3;
4049   goto __pyx_L0;
4050 
4051   /* "rasterio/_shim.pyx":137
4052  *
4053  *
4054  * cdef int io_multi_mask(             # <<<<<<<<<<<<<<
4055  *         GDALDatasetH hds, int mode, double x0, double y0, double width,
4056  *         double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1:
4057  */
4058 
4059   /* function exit code */
4060   __pyx_L1_error:;
4061   __Pyx_XDECREF(__pyx_t_1);
4062   __Pyx_XDECREF(__pyx_t_2);
4063   __Pyx_XDECREF(__pyx_t_4);
4064   __Pyx_AddTraceback("rasterio._shim.io_multi_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
4065   __pyx_r = -1;
4066   __pyx_L0:;
4067   __Pyx_RefNannyFinishContext();
4068   return __pyx_r;
4069 }
4070 
4071 /* "rasterio/_shim.pyx":192
4072  *
4073  *
4074  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs):             # <<<<<<<<<<<<<<
4075  *     return ''
4076  *
4077  */
4078 
__pyx_f_8rasterio_5_shim_osr_get_name(CYTHON_UNUSED OGRSpatialReferenceH __pyx_v_hSrs)4079 static char const *__pyx_f_8rasterio_5_shim_osr_get_name(CYTHON_UNUSED OGRSpatialReferenceH __pyx_v_hSrs) {
4080   char const *__pyx_r;
4081   __Pyx_RefNannyDeclarations
4082   __Pyx_RefNannySetupContext("osr_get_name", 0);
4083 
4084   /* "rasterio/_shim.pyx":193
4085  *
4086  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs):
4087  *     return ''             # <<<<<<<<<<<<<<
4088  *
4089  *
4090  */
4091   __pyx_r = ((char const *)"");
4092   goto __pyx_L0;
4093 
4094   /* "rasterio/_shim.pyx":192
4095  *
4096  *
4097  * cdef const char* osr_get_name(OGRSpatialReferenceH hSrs):             # <<<<<<<<<<<<<<
4098  *     return ''
4099  *
4100  */
4101 
4102   /* function exit code */
4103   __pyx_L0:;
4104   __Pyx_RefNannyFinishContext();
4105   return __pyx_r;
4106 }
4107 
4108 /* "rasterio/_shim.pyx":196
4109  *
4110  *
4111  * cdef void osr_set_traditional_axis_mapping_strategy(OGRSpatialReferenceH hSrs):             # <<<<<<<<<<<<<<
4112  *     pass
4113  *
4114  */
4115 
__pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy(CYTHON_UNUSED OGRSpatialReferenceH __pyx_v_hSrs)4116 static void __pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy(CYTHON_UNUSED OGRSpatialReferenceH __pyx_v_hSrs) {
4117   __Pyx_RefNannyDeclarations
4118   __Pyx_RefNannySetupContext("osr_set_traditional_axis_mapping_strategy", 0);
4119 
4120   /* function exit code */
4121   __Pyx_RefNannyFinishContext();
4122 }
4123 
4124 /* "rasterio/_shim.pyx":200
4125  *
4126  *
4127  * cdef void set_proj_search_path(object path):             # <<<<<<<<<<<<<<
4128  *     os.environ["PROJ_LIB"] = path
4129  */
4130 
__pyx_f_8rasterio_5_shim_set_proj_search_path(PyObject * __pyx_v_path)4131 static void __pyx_f_8rasterio_5_shim_set_proj_search_path(PyObject *__pyx_v_path) {
4132   __Pyx_RefNannyDeclarations
4133   PyObject *__pyx_t_1 = NULL;
4134   PyObject *__pyx_t_2 = NULL;
4135   int __pyx_lineno = 0;
4136   const char *__pyx_filename = NULL;
4137   int __pyx_clineno = 0;
4138   __Pyx_RefNannySetupContext("set_proj_search_path", 0);
4139 
4140   /* "rasterio/_shim.pyx":201
4141  *
4142  * cdef void set_proj_search_path(object path):
4143  *     os.environ["PROJ_LIB"] = path             # <<<<<<<<<<<<<<
4144  */
4145   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
4146   __Pyx_GOTREF(__pyx_t_1);
4147   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_environ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
4148   __Pyx_GOTREF(__pyx_t_2);
4149   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4150   if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_PROJ_LIB, __pyx_v_path) < 0)) __PYX_ERR(0, 201, __pyx_L1_error)
4151   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4152 
4153   /* "rasterio/_shim.pyx":200
4154  *
4155  *
4156  * cdef void set_proj_search_path(object path):             # <<<<<<<<<<<<<<
4157  *     os.environ["PROJ_LIB"] = path
4158  */
4159 
4160   /* function exit code */
4161   goto __pyx_L0;
4162   __pyx_L1_error:;
4163   __Pyx_XDECREF(__pyx_t_1);
4164   __Pyx_XDECREF(__pyx_t_2);
4165   __Pyx_WriteUnraisable("rasterio._shim.set_proj_search_path", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4166   __pyx_L0:;
4167   __Pyx_RefNannyFinishContext();
4168 }
4169 
4170 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":735
4171  * ctypedef npy_cdouble     complex_t
4172  *
4173  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
4174  *     return PyArray_MultiIterNew(1, <void*>a)
4175  *
4176  */
4177 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)4178 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
4179   PyObject *__pyx_r = NULL;
4180   __Pyx_RefNannyDeclarations
4181   PyObject *__pyx_t_1 = NULL;
4182   int __pyx_lineno = 0;
4183   const char *__pyx_filename = NULL;
4184   int __pyx_clineno = 0;
4185   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
4186 
4187   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":736
4188  *
4189  * cdef inline object PyArray_MultiIterNew1(a):
4190  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
4191  *
4192  * cdef inline object PyArray_MultiIterNew2(a, b):
4193  */
4194   __Pyx_XDECREF(__pyx_r);
4195   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
4196   __Pyx_GOTREF(__pyx_t_1);
4197   __pyx_r = __pyx_t_1;
4198   __pyx_t_1 = 0;
4199   goto __pyx_L0;
4200 
4201   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":735
4202  * ctypedef npy_cdouble     complex_t
4203  *
4204  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
4205  *     return PyArray_MultiIterNew(1, <void*>a)
4206  *
4207  */
4208 
4209   /* function exit code */
4210   __pyx_L1_error:;
4211   __Pyx_XDECREF(__pyx_t_1);
4212   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4213   __pyx_r = 0;
4214   __pyx_L0:;
4215   __Pyx_XGIVEREF(__pyx_r);
4216   __Pyx_RefNannyFinishContext();
4217   return __pyx_r;
4218 }
4219 
4220 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":738
4221  *     return PyArray_MultiIterNew(1, <void*>a)
4222  *
4223  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
4224  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4225  *
4226  */
4227 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)4228 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
4229   PyObject *__pyx_r = NULL;
4230   __Pyx_RefNannyDeclarations
4231   PyObject *__pyx_t_1 = NULL;
4232   int __pyx_lineno = 0;
4233   const char *__pyx_filename = NULL;
4234   int __pyx_clineno = 0;
4235   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
4236 
4237   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":739
4238  *
4239  * cdef inline object PyArray_MultiIterNew2(a, b):
4240  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
4241  *
4242  * cdef inline object PyArray_MultiIterNew3(a, b, c):
4243  */
4244   __Pyx_XDECREF(__pyx_r);
4245   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
4246   __Pyx_GOTREF(__pyx_t_1);
4247   __pyx_r = __pyx_t_1;
4248   __pyx_t_1 = 0;
4249   goto __pyx_L0;
4250 
4251   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":738
4252  *     return PyArray_MultiIterNew(1, <void*>a)
4253  *
4254  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
4255  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4256  *
4257  */
4258 
4259   /* function exit code */
4260   __pyx_L1_error:;
4261   __Pyx_XDECREF(__pyx_t_1);
4262   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
4263   __pyx_r = 0;
4264   __pyx_L0:;
4265   __Pyx_XGIVEREF(__pyx_r);
4266   __Pyx_RefNannyFinishContext();
4267   return __pyx_r;
4268 }
4269 
4270 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":741
4271  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4272  *
4273  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
4274  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4275  *
4276  */
4277 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)4278 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
4279   PyObject *__pyx_r = NULL;
4280   __Pyx_RefNannyDeclarations
4281   PyObject *__pyx_t_1 = NULL;
4282   int __pyx_lineno = 0;
4283   const char *__pyx_filename = NULL;
4284   int __pyx_clineno = 0;
4285   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
4286 
4287   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":742
4288  *
4289  * cdef inline object PyArray_MultiIterNew3(a, b, c):
4290  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
4291  *
4292  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4293  */
4294   __Pyx_XDECREF(__pyx_r);
4295   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
4296   __Pyx_GOTREF(__pyx_t_1);
4297   __pyx_r = __pyx_t_1;
4298   __pyx_t_1 = 0;
4299   goto __pyx_L0;
4300 
4301   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":741
4302  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4303  *
4304  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
4305  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4306  *
4307  */
4308 
4309   /* function exit code */
4310   __pyx_L1_error:;
4311   __Pyx_XDECREF(__pyx_t_1);
4312   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4313   __pyx_r = 0;
4314   __pyx_L0:;
4315   __Pyx_XGIVEREF(__pyx_r);
4316   __Pyx_RefNannyFinishContext();
4317   return __pyx_r;
4318 }
4319 
4320 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":744
4321  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4322  *
4323  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
4324  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4325  *
4326  */
4327 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)4328 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
4329   PyObject *__pyx_r = NULL;
4330   __Pyx_RefNannyDeclarations
4331   PyObject *__pyx_t_1 = NULL;
4332   int __pyx_lineno = 0;
4333   const char *__pyx_filename = NULL;
4334   int __pyx_clineno = 0;
4335   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
4336 
4337   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":745
4338  *
4339  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4340  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
4341  *
4342  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4343  */
4344   __Pyx_XDECREF(__pyx_r);
4345   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
4346   __Pyx_GOTREF(__pyx_t_1);
4347   __pyx_r = __pyx_t_1;
4348   __pyx_t_1 = 0;
4349   goto __pyx_L0;
4350 
4351   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":744
4352  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4353  *
4354  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
4355  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4356  *
4357  */
4358 
4359   /* function exit code */
4360   __pyx_L1_error:;
4361   __Pyx_XDECREF(__pyx_t_1);
4362   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4363   __pyx_r = 0;
4364   __pyx_L0:;
4365   __Pyx_XGIVEREF(__pyx_r);
4366   __Pyx_RefNannyFinishContext();
4367   return __pyx_r;
4368 }
4369 
4370 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":747
4371  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4372  *
4373  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
4374  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4375  *
4376  */
4377 
__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d,PyObject * __pyx_v_e)4378 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
4379   PyObject *__pyx_r = NULL;
4380   __Pyx_RefNannyDeclarations
4381   PyObject *__pyx_t_1 = NULL;
4382   int __pyx_lineno = 0;
4383   const char *__pyx_filename = NULL;
4384   int __pyx_clineno = 0;
4385   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
4386 
4387   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":748
4388  *
4389  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4390  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
4391  *
4392  * cdef inline tuple PyDataType_SHAPE(dtype d):
4393  */
4394   __Pyx_XDECREF(__pyx_r);
4395   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
4396   __Pyx_GOTREF(__pyx_t_1);
4397   __pyx_r = __pyx_t_1;
4398   __pyx_t_1 = 0;
4399   goto __pyx_L0;
4400 
4401   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":747
4402  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4403  *
4404  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
4405  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4406  *
4407  */
4408 
4409   /* function exit code */
4410   __pyx_L1_error:;
4411   __Pyx_XDECREF(__pyx_t_1);
4412   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4413   __pyx_r = 0;
4414   __pyx_L0:;
4415   __Pyx_XGIVEREF(__pyx_r);
4416   __Pyx_RefNannyFinishContext();
4417   return __pyx_r;
4418 }
4419 
4420 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":750
4421  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4422  *
4423  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
4424  *     if PyDataType_HASSUBARRAY(d):
4425  *         return <tuple>d.subarray.shape
4426  */
4427 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)4428 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4429   PyObject *__pyx_r = NULL;
4430   __Pyx_RefNannyDeclarations
4431   int __pyx_t_1;
4432   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
4433 
4434   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":751
4435  *
4436  * cdef inline tuple PyDataType_SHAPE(dtype d):
4437  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
4438  *         return <tuple>d.subarray.shape
4439  *     else:
4440  */
4441   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4442   if (__pyx_t_1) {
4443 
4444     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":752
4445  * cdef inline tuple PyDataType_SHAPE(dtype d):
4446  *     if PyDataType_HASSUBARRAY(d):
4447  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
4448  *     else:
4449  *         return ()
4450  */
4451     __Pyx_XDECREF(__pyx_r);
4452     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4453     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4454     goto __pyx_L0;
4455 
4456     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":751
4457  *
4458  * cdef inline tuple PyDataType_SHAPE(dtype d):
4459  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
4460  *         return <tuple>d.subarray.shape
4461  *     else:
4462  */
4463   }
4464 
4465   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":754
4466  *         return <tuple>d.subarray.shape
4467  *     else:
4468  *         return ()             # <<<<<<<<<<<<<<
4469  *
4470  *
4471  */
4472   /*else*/ {
4473     __Pyx_XDECREF(__pyx_r);
4474     __Pyx_INCREF(__pyx_empty_tuple);
4475     __pyx_r = __pyx_empty_tuple;
4476     goto __pyx_L0;
4477   }
4478 
4479   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":750
4480  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4481  *
4482  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
4483  *     if PyDataType_HASSUBARRAY(d):
4484  *         return <tuple>d.subarray.shape
4485  */
4486 
4487   /* function exit code */
4488   __pyx_L0:;
4489   __Pyx_XGIVEREF(__pyx_r);
4490   __Pyx_RefNannyFinishContext();
4491   return __pyx_r;
4492 }
4493 
4494 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":931
4495  *     int _import_umath() except -1
4496  *
4497  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
4498  *     Py_INCREF(base) # important to do this before stealing the reference below!
4499  *     PyArray_SetBaseObject(arr, base)
4500  */
4501 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)4502 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
4503   __Pyx_RefNannyDeclarations
4504   __Pyx_RefNannySetupContext("set_array_base", 0);
4505 
4506   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":932
4507  *
4508  * cdef inline void set_array_base(ndarray arr, object base):
4509  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
4510  *     PyArray_SetBaseObject(arr, base)
4511  *
4512  */
4513   Py_INCREF(__pyx_v_base);
4514 
4515   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":933
4516  * cdef inline void set_array_base(ndarray arr, object base):
4517  *     Py_INCREF(base) # important to do this before stealing the reference below!
4518  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
4519  *
4520  * cdef inline object get_array_base(ndarray arr):
4521  */
4522   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4523 
4524   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":931
4525  *     int _import_umath() except -1
4526  *
4527  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
4528  *     Py_INCREF(base) # important to do this before stealing the reference below!
4529  *     PyArray_SetBaseObject(arr, base)
4530  */
4531 
4532   /* function exit code */
4533   __Pyx_RefNannyFinishContext();
4534 }
4535 
4536 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":935
4537  *     PyArray_SetBaseObject(arr, base)
4538  *
4539  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
4540  *     base = PyArray_BASE(arr)
4541  *     if base is NULL:
4542  */
4543 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)4544 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4545   PyObject *__pyx_v_base;
4546   PyObject *__pyx_r = NULL;
4547   __Pyx_RefNannyDeclarations
4548   int __pyx_t_1;
4549   __Pyx_RefNannySetupContext("get_array_base", 0);
4550 
4551   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":936
4552  *
4553  * cdef inline object get_array_base(ndarray arr):
4554  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
4555  *     if base is NULL:
4556  *         return None
4557  */
4558   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
4559 
4560   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":937
4561  * cdef inline object get_array_base(ndarray arr):
4562  *     base = PyArray_BASE(arr)
4563  *     if base is NULL:             # <<<<<<<<<<<<<<
4564  *         return None
4565  *     return <object>base
4566  */
4567   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4568   if (__pyx_t_1) {
4569 
4570     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":938
4571  *     base = PyArray_BASE(arr)
4572  *     if base is NULL:
4573  *         return None             # <<<<<<<<<<<<<<
4574  *     return <object>base
4575  *
4576  */
4577     __Pyx_XDECREF(__pyx_r);
4578     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4579     goto __pyx_L0;
4580 
4581     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":937
4582  * cdef inline object get_array_base(ndarray arr):
4583  *     base = PyArray_BASE(arr)
4584  *     if base is NULL:             # <<<<<<<<<<<<<<
4585  *         return None
4586  *     return <object>base
4587  */
4588   }
4589 
4590   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":939
4591  *     if base is NULL:
4592  *         return None
4593  *     return <object>base             # <<<<<<<<<<<<<<
4594  *
4595  * # Versions of the import_* functions which are more suitable for
4596  */
4597   __Pyx_XDECREF(__pyx_r);
4598   __Pyx_INCREF(((PyObject *)__pyx_v_base));
4599   __pyx_r = ((PyObject *)__pyx_v_base);
4600   goto __pyx_L0;
4601 
4602   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":935
4603  *     PyArray_SetBaseObject(arr, base)
4604  *
4605  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
4606  *     base = PyArray_BASE(arr)
4607  *     if base is NULL:
4608  */
4609 
4610   /* function exit code */
4611   __pyx_L0:;
4612   __Pyx_XGIVEREF(__pyx_r);
4613   __Pyx_RefNannyFinishContext();
4614   return __pyx_r;
4615 }
4616 
4617 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":943
4618  * # Versions of the import_* functions which are more suitable for
4619  * # Cython code.
4620  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
4621  *     try:
4622  *         __pyx_import_array()
4623  */
4624 
__pyx_f_5numpy_import_array(void)4625 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
4626   int __pyx_r;
4627   __Pyx_RefNannyDeclarations
4628   PyObject *__pyx_t_1 = NULL;
4629   PyObject *__pyx_t_2 = NULL;
4630   PyObject *__pyx_t_3 = NULL;
4631   int __pyx_t_4;
4632   PyObject *__pyx_t_5 = NULL;
4633   PyObject *__pyx_t_6 = NULL;
4634   PyObject *__pyx_t_7 = NULL;
4635   PyObject *__pyx_t_8 = NULL;
4636   int __pyx_lineno = 0;
4637   const char *__pyx_filename = NULL;
4638   int __pyx_clineno = 0;
4639   __Pyx_RefNannySetupContext("import_array", 0);
4640 
4641   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":944
4642  * # Cython code.
4643  * cdef inline int import_array() except -1:
4644  *     try:             # <<<<<<<<<<<<<<
4645  *         __pyx_import_array()
4646  *     except Exception:
4647  */
4648   {
4649     __Pyx_PyThreadState_declare
4650     __Pyx_PyThreadState_assign
4651     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4652     __Pyx_XGOTREF(__pyx_t_1);
4653     __Pyx_XGOTREF(__pyx_t_2);
4654     __Pyx_XGOTREF(__pyx_t_3);
4655     /*try:*/ {
4656 
4657       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":945
4658  * cdef inline int import_array() except -1:
4659  *     try:
4660  *         __pyx_import_array()             # <<<<<<<<<<<<<<
4661  *     except Exception:
4662  *         raise ImportError("numpy.core.multiarray failed to import")
4663  */
4664       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 945, __pyx_L3_error)
4665 
4666       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":944
4667  * # Cython code.
4668  * cdef inline int import_array() except -1:
4669  *     try:             # <<<<<<<<<<<<<<
4670  *         __pyx_import_array()
4671  *     except Exception:
4672  */
4673     }
4674     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4675     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4676     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4677     goto __pyx_L8_try_end;
4678     __pyx_L3_error:;
4679 
4680     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":946
4681  *     try:
4682  *         __pyx_import_array()
4683  *     except Exception:             # <<<<<<<<<<<<<<
4684  *         raise ImportError("numpy.core.multiarray failed to import")
4685  *
4686  */
4687     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4688     if (__pyx_t_4) {
4689       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4690       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 946, __pyx_L5_except_error)
4691       __Pyx_GOTREF(__pyx_t_5);
4692       __Pyx_GOTREF(__pyx_t_6);
4693       __Pyx_GOTREF(__pyx_t_7);
4694 
4695       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":947
4696  *         __pyx_import_array()
4697  *     except Exception:
4698  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
4699  *
4700  * cdef inline int import_umath() except -1:
4701  */
4702       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 947, __pyx_L5_except_error)
4703       __Pyx_GOTREF(__pyx_t_8);
4704       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4705       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4706       __PYX_ERR(1, 947, __pyx_L5_except_error)
4707     }
4708     goto __pyx_L5_except_error;
4709     __pyx_L5_except_error:;
4710 
4711     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":944
4712  * # Cython code.
4713  * cdef inline int import_array() except -1:
4714  *     try:             # <<<<<<<<<<<<<<
4715  *         __pyx_import_array()
4716  *     except Exception:
4717  */
4718     __Pyx_XGIVEREF(__pyx_t_1);
4719     __Pyx_XGIVEREF(__pyx_t_2);
4720     __Pyx_XGIVEREF(__pyx_t_3);
4721     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4722     goto __pyx_L1_error;
4723     __pyx_L8_try_end:;
4724   }
4725 
4726   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":943
4727  * # Versions of the import_* functions which are more suitable for
4728  * # Cython code.
4729  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
4730  *     try:
4731  *         __pyx_import_array()
4732  */
4733 
4734   /* function exit code */
4735   __pyx_r = 0;
4736   goto __pyx_L0;
4737   __pyx_L1_error:;
4738   __Pyx_XDECREF(__pyx_t_5);
4739   __Pyx_XDECREF(__pyx_t_6);
4740   __Pyx_XDECREF(__pyx_t_7);
4741   __Pyx_XDECREF(__pyx_t_8);
4742   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4743   __pyx_r = -1;
4744   __pyx_L0:;
4745   __Pyx_RefNannyFinishContext();
4746   return __pyx_r;
4747 }
4748 
4749 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":949
4750  *         raise ImportError("numpy.core.multiarray failed to import")
4751  *
4752  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
4753  *     try:
4754  *         _import_umath()
4755  */
4756 
__pyx_f_5numpy_import_umath(void)4757 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
4758   int __pyx_r;
4759   __Pyx_RefNannyDeclarations
4760   PyObject *__pyx_t_1 = NULL;
4761   PyObject *__pyx_t_2 = NULL;
4762   PyObject *__pyx_t_3 = NULL;
4763   int __pyx_t_4;
4764   PyObject *__pyx_t_5 = NULL;
4765   PyObject *__pyx_t_6 = NULL;
4766   PyObject *__pyx_t_7 = NULL;
4767   PyObject *__pyx_t_8 = NULL;
4768   int __pyx_lineno = 0;
4769   const char *__pyx_filename = NULL;
4770   int __pyx_clineno = 0;
4771   __Pyx_RefNannySetupContext("import_umath", 0);
4772 
4773   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":950
4774  *
4775  * cdef inline int import_umath() except -1:
4776  *     try:             # <<<<<<<<<<<<<<
4777  *         _import_umath()
4778  *     except Exception:
4779  */
4780   {
4781     __Pyx_PyThreadState_declare
4782     __Pyx_PyThreadState_assign
4783     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4784     __Pyx_XGOTREF(__pyx_t_1);
4785     __Pyx_XGOTREF(__pyx_t_2);
4786     __Pyx_XGOTREF(__pyx_t_3);
4787     /*try:*/ {
4788 
4789       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":951
4790  * cdef inline int import_umath() except -1:
4791  *     try:
4792  *         _import_umath()             # <<<<<<<<<<<<<<
4793  *     except Exception:
4794  *         raise ImportError("numpy.core.umath failed to import")
4795  */
4796       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 951, __pyx_L3_error)
4797 
4798       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":950
4799  *
4800  * cdef inline int import_umath() except -1:
4801  *     try:             # <<<<<<<<<<<<<<
4802  *         _import_umath()
4803  *     except Exception:
4804  */
4805     }
4806     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4807     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4808     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4809     goto __pyx_L8_try_end;
4810     __pyx_L3_error:;
4811 
4812     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":952
4813  *     try:
4814  *         _import_umath()
4815  *     except Exception:             # <<<<<<<<<<<<<<
4816  *         raise ImportError("numpy.core.umath failed to import")
4817  *
4818  */
4819     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4820     if (__pyx_t_4) {
4821       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4822       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 952, __pyx_L5_except_error)
4823       __Pyx_GOTREF(__pyx_t_5);
4824       __Pyx_GOTREF(__pyx_t_6);
4825       __Pyx_GOTREF(__pyx_t_7);
4826 
4827       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":953
4828  *         _import_umath()
4829  *     except Exception:
4830  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
4831  *
4832  * cdef inline int import_ufunc() except -1:
4833  */
4834       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 953, __pyx_L5_except_error)
4835       __Pyx_GOTREF(__pyx_t_8);
4836       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4837       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4838       __PYX_ERR(1, 953, __pyx_L5_except_error)
4839     }
4840     goto __pyx_L5_except_error;
4841     __pyx_L5_except_error:;
4842 
4843     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":950
4844  *
4845  * cdef inline int import_umath() except -1:
4846  *     try:             # <<<<<<<<<<<<<<
4847  *         _import_umath()
4848  *     except Exception:
4849  */
4850     __Pyx_XGIVEREF(__pyx_t_1);
4851     __Pyx_XGIVEREF(__pyx_t_2);
4852     __Pyx_XGIVEREF(__pyx_t_3);
4853     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4854     goto __pyx_L1_error;
4855     __pyx_L8_try_end:;
4856   }
4857 
4858   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":949
4859  *         raise ImportError("numpy.core.multiarray failed to import")
4860  *
4861  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
4862  *     try:
4863  *         _import_umath()
4864  */
4865 
4866   /* function exit code */
4867   __pyx_r = 0;
4868   goto __pyx_L0;
4869   __pyx_L1_error:;
4870   __Pyx_XDECREF(__pyx_t_5);
4871   __Pyx_XDECREF(__pyx_t_6);
4872   __Pyx_XDECREF(__pyx_t_7);
4873   __Pyx_XDECREF(__pyx_t_8);
4874   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4875   __pyx_r = -1;
4876   __pyx_L0:;
4877   __Pyx_RefNannyFinishContext();
4878   return __pyx_r;
4879 }
4880 
4881 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":955
4882  *         raise ImportError("numpy.core.umath failed to import")
4883  *
4884  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
4885  *     try:
4886  *         _import_umath()
4887  */
4888 
__pyx_f_5numpy_import_ufunc(void)4889 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
4890   int __pyx_r;
4891   __Pyx_RefNannyDeclarations
4892   PyObject *__pyx_t_1 = NULL;
4893   PyObject *__pyx_t_2 = NULL;
4894   PyObject *__pyx_t_3 = NULL;
4895   int __pyx_t_4;
4896   PyObject *__pyx_t_5 = NULL;
4897   PyObject *__pyx_t_6 = NULL;
4898   PyObject *__pyx_t_7 = NULL;
4899   PyObject *__pyx_t_8 = NULL;
4900   int __pyx_lineno = 0;
4901   const char *__pyx_filename = NULL;
4902   int __pyx_clineno = 0;
4903   __Pyx_RefNannySetupContext("import_ufunc", 0);
4904 
4905   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":956
4906  *
4907  * cdef inline int import_ufunc() except -1:
4908  *     try:             # <<<<<<<<<<<<<<
4909  *         _import_umath()
4910  *     except Exception:
4911  */
4912   {
4913     __Pyx_PyThreadState_declare
4914     __Pyx_PyThreadState_assign
4915     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4916     __Pyx_XGOTREF(__pyx_t_1);
4917     __Pyx_XGOTREF(__pyx_t_2);
4918     __Pyx_XGOTREF(__pyx_t_3);
4919     /*try:*/ {
4920 
4921       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":957
4922  * cdef inline int import_ufunc() except -1:
4923  *     try:
4924  *         _import_umath()             # <<<<<<<<<<<<<<
4925  *     except Exception:
4926  *         raise ImportError("numpy.core.umath failed to import")
4927  */
4928       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L3_error)
4929 
4930       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":956
4931  *
4932  * cdef inline int import_ufunc() except -1:
4933  *     try:             # <<<<<<<<<<<<<<
4934  *         _import_umath()
4935  *     except Exception:
4936  */
4937     }
4938     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4939     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4940     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4941     goto __pyx_L8_try_end;
4942     __pyx_L3_error:;
4943 
4944     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":958
4945  *     try:
4946  *         _import_umath()
4947  *     except Exception:             # <<<<<<<<<<<<<<
4948  *         raise ImportError("numpy.core.umath failed to import")
4949  *
4950  */
4951     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4952     if (__pyx_t_4) {
4953       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4954       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 958, __pyx_L5_except_error)
4955       __Pyx_GOTREF(__pyx_t_5);
4956       __Pyx_GOTREF(__pyx_t_6);
4957       __Pyx_GOTREF(__pyx_t_7);
4958 
4959       /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":959
4960  *         _import_umath()
4961  *     except Exception:
4962  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
4963  *
4964  * cdef extern from *:
4965  */
4966       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 959, __pyx_L5_except_error)
4967       __Pyx_GOTREF(__pyx_t_8);
4968       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4969       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4970       __PYX_ERR(1, 959, __pyx_L5_except_error)
4971     }
4972     goto __pyx_L5_except_error;
4973     __pyx_L5_except_error:;
4974 
4975     /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":956
4976  *
4977  * cdef inline int import_ufunc() except -1:
4978  *     try:             # <<<<<<<<<<<<<<
4979  *         _import_umath()
4980  *     except Exception:
4981  */
4982     __Pyx_XGIVEREF(__pyx_t_1);
4983     __Pyx_XGIVEREF(__pyx_t_2);
4984     __Pyx_XGIVEREF(__pyx_t_3);
4985     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4986     goto __pyx_L1_error;
4987     __pyx_L8_try_end:;
4988   }
4989 
4990   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":955
4991  *         raise ImportError("numpy.core.umath failed to import")
4992  *
4993  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
4994  *     try:
4995  *         _import_umath()
4996  */
4997 
4998   /* function exit code */
4999   __pyx_r = 0;
5000   goto __pyx_L0;
5001   __pyx_L1_error:;
5002   __Pyx_XDECREF(__pyx_t_5);
5003   __Pyx_XDECREF(__pyx_t_6);
5004   __Pyx_XDECREF(__pyx_t_7);
5005   __Pyx_XDECREF(__pyx_t_8);
5006   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5007   __pyx_r = -1;
5008   __pyx_L0:;
5009   __Pyx_RefNannyFinishContext();
5010   return __pyx_r;
5011 }
5012 
5013 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":969
5014  *
5015  *
5016  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
5017  *     """
5018  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
5019  */
5020 
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)5021 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
5022   int __pyx_r;
5023   __Pyx_RefNannyDeclarations
5024   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
5025 
5026   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":981
5027  *     bool
5028  *     """
5029  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
5030  *
5031  *
5032  */
5033   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
5034   goto __pyx_L0;
5035 
5036   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":969
5037  *
5038  *
5039  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
5040  *     """
5041  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
5042  */
5043 
5044   /* function exit code */
5045   __pyx_L0:;
5046   __Pyx_RefNannyFinishContext();
5047   return __pyx_r;
5048 }
5049 
5050 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":984
5051  *
5052  *
5053  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
5054  *     """
5055  *     Cython equivalent of `isinstance(obj, np.datetime64)`
5056  */
5057 
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)5058 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
5059   int __pyx_r;
5060   __Pyx_RefNannyDeclarations
5061   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
5062 
5063   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":996
5064  *     bool
5065  *     """
5066  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
5067  *
5068  *
5069  */
5070   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
5071   goto __pyx_L0;
5072 
5073   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":984
5074  *
5075  *
5076  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
5077  *     """
5078  *     Cython equivalent of `isinstance(obj, np.datetime64)`
5079  */
5080 
5081   /* function exit code */
5082   __pyx_L0:;
5083   __Pyx_RefNannyFinishContext();
5084   return __pyx_r;
5085 }
5086 
5087 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":999
5088  *
5089  *
5090  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
5091  *     """
5092  *     returns the int64 value underlying scalar numpy datetime64 object
5093  */
5094 
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)5095 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
5096   npy_datetime __pyx_r;
5097 
5098   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1006
5099  *     also needed.  That can be found using `get_datetime64_unit`.
5100  *     """
5101  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
5102  *
5103  *
5104  */
5105   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
5106   goto __pyx_L0;
5107 
5108   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":999
5109  *
5110  *
5111  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
5112  *     """
5113  *     returns the int64 value underlying scalar numpy datetime64 object
5114  */
5115 
5116   /* function exit code */
5117   __pyx_L0:;
5118   return __pyx_r;
5119 }
5120 
5121 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1009
5122  *
5123  *
5124  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
5125  *     """
5126  *     returns the int64 value underlying scalar numpy timedelta64 object
5127  */
5128 
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)5129 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
5130   npy_timedelta __pyx_r;
5131 
5132   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1013
5133  *     returns the int64 value underlying scalar numpy timedelta64 object
5134  *     """
5135  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
5136  *
5137  *
5138  */
5139   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
5140   goto __pyx_L0;
5141 
5142   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1009
5143  *
5144  *
5145  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
5146  *     """
5147  *     returns the int64 value underlying scalar numpy timedelta64 object
5148  */
5149 
5150   /* function exit code */
5151   __pyx_L0:;
5152   return __pyx_r;
5153 }
5154 
5155 /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1016
5156  *
5157  *
5158  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
5159  *     """
5160  *     returns the unit part of the dtype for a numpy datetime64 object.
5161  */
5162 
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)5163 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
5164   NPY_DATETIMEUNIT __pyx_r;
5165 
5166   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1020
5167  *     returns the unit part of the dtype for a numpy datetime64 object.
5168  *     """
5169  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
5170  */
5171   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
5172   goto __pyx_L0;
5173 
5174   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":1016
5175  *
5176  *
5177  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
5178  *     """
5179  *     returns the unit part of the dtype for a numpy datetime64 object.
5180  */
5181 
5182   /* function exit code */
5183   __pyx_L0:;
5184   return __pyx_r;
5185 }
5186 
5187 /* "View.MemoryView":122
5188  *         cdef bint dtype_is_object
5189  *
5190  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
5191  *                   mode="c", bint allocate_buffer=True):
5192  *
5193  */
5194 
5195 /* Python wrapper */
5196 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5197 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5198   PyObject *__pyx_v_shape = 0;
5199   Py_ssize_t __pyx_v_itemsize;
5200   PyObject *__pyx_v_format = 0;
5201   PyObject *__pyx_v_mode = 0;
5202   int __pyx_v_allocate_buffer;
5203   int __pyx_lineno = 0;
5204   const char *__pyx_filename = NULL;
5205   int __pyx_clineno = 0;
5206   int __pyx_r;
5207   __Pyx_RefNannyDeclarations
5208   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5209   {
5210     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
5211     PyObject* values[5] = {0,0,0,0,0};
5212     values[3] = ((PyObject *)__pyx_n_s_c);
5213     if (unlikely(__pyx_kwds)) {
5214       Py_ssize_t kw_args;
5215       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5216       switch (pos_args) {
5217         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5218         CYTHON_FALLTHROUGH;
5219         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5220         CYTHON_FALLTHROUGH;
5221         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5222         CYTHON_FALLTHROUGH;
5223         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5224         CYTHON_FALLTHROUGH;
5225         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5226         CYTHON_FALLTHROUGH;
5227         case  0: break;
5228         default: goto __pyx_L5_argtuple_error;
5229       }
5230       kw_args = PyDict_Size(__pyx_kwds);
5231       switch (pos_args) {
5232         case  0:
5233         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
5234         else goto __pyx_L5_argtuple_error;
5235         CYTHON_FALLTHROUGH;
5236         case  1:
5237         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
5238         else {
5239           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
5240         }
5241         CYTHON_FALLTHROUGH;
5242         case  2:
5243         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
5244         else {
5245           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
5246         }
5247         CYTHON_FALLTHROUGH;
5248         case  3:
5249         if (kw_args > 0) {
5250           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
5251           if (value) { values[3] = value; kw_args--; }
5252         }
5253         CYTHON_FALLTHROUGH;
5254         case  4:
5255         if (kw_args > 0) {
5256           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
5257           if (value) { values[4] = value; kw_args--; }
5258         }
5259       }
5260       if (unlikely(kw_args > 0)) {
5261         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
5262       }
5263     } else {
5264       switch (PyTuple_GET_SIZE(__pyx_args)) {
5265         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5266         CYTHON_FALLTHROUGH;
5267         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5268         CYTHON_FALLTHROUGH;
5269         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5270         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5271         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5272         break;
5273         default: goto __pyx_L5_argtuple_error;
5274       }
5275     }
5276     __pyx_v_shape = ((PyObject*)values[0]);
5277     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
5278     __pyx_v_format = values[2];
5279     __pyx_v_mode = values[3];
5280     if (values[4]) {
5281       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
5282     } else {
5283 
5284       /* "View.MemoryView":123
5285  *
5286  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
5287  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
5288  *
5289  *         cdef int idx
5290  */
5291       __pyx_v_allocate_buffer = ((int)1);
5292     }
5293   }
5294   goto __pyx_L4_argument_unpacking_done;
5295   __pyx_L5_argtuple_error:;
5296   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
5297   __pyx_L3_error:;
5298   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5299   __Pyx_RefNannyFinishContext();
5300   return -1;
5301   __pyx_L4_argument_unpacking_done:;
5302   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
5303   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
5304     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
5305   }
5306   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
5307 
5308   /* "View.MemoryView":122
5309  *         cdef bint dtype_is_object
5310  *
5311  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
5312  *                   mode="c", bint allocate_buffer=True):
5313  *
5314  */
5315 
5316   /* function exit code */
5317   goto __pyx_L0;
5318   __pyx_L1_error:;
5319   __pyx_r = -1;
5320   __pyx_L0:;
5321   __Pyx_RefNannyFinishContext();
5322   return __pyx_r;
5323 }
5324 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,PyObject * __pyx_v_format,PyObject * __pyx_v_mode,int __pyx_v_allocate_buffer)5325 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
5326   int __pyx_v_idx;
5327   Py_ssize_t __pyx_v_i;
5328   Py_ssize_t __pyx_v_dim;
5329   PyObject **__pyx_v_p;
5330   char __pyx_v_order;
5331   int __pyx_r;
5332   __Pyx_RefNannyDeclarations
5333   Py_ssize_t __pyx_t_1;
5334   int __pyx_t_2;
5335   PyObject *__pyx_t_3 = NULL;
5336   int __pyx_t_4;
5337   PyObject *__pyx_t_5 = NULL;
5338   PyObject *__pyx_t_6 = NULL;
5339   char *__pyx_t_7;
5340   int __pyx_t_8;
5341   Py_ssize_t __pyx_t_9;
5342   PyObject *__pyx_t_10 = NULL;
5343   Py_ssize_t __pyx_t_11;
5344   int __pyx_lineno = 0;
5345   const char *__pyx_filename = NULL;
5346   int __pyx_clineno = 0;
5347   __Pyx_RefNannySetupContext("__cinit__", 0);
5348   __Pyx_INCREF(__pyx_v_format);
5349 
5350   /* "View.MemoryView":129
5351  *         cdef PyObject **p
5352  *
5353  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
5354  *         self.itemsize = itemsize
5355  *
5356  */
5357   if (unlikely(__pyx_v_shape == Py_None)) {
5358     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
5359     __PYX_ERR(2, 129, __pyx_L1_error)
5360   }
5361   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
5362   __pyx_v_self->ndim = ((int)__pyx_t_1);
5363 
5364   /* "View.MemoryView":130
5365  *
5366  *         self.ndim = <int> len(shape)
5367  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
5368  *
5369  *         if not self.ndim:
5370  */
5371   __pyx_v_self->itemsize = __pyx_v_itemsize;
5372 
5373   /* "View.MemoryView":132
5374  *         self.itemsize = itemsize
5375  *
5376  *         if not self.ndim:             # <<<<<<<<<<<<<<
5377  *             raise ValueError("Empty shape tuple for cython.array")
5378  *
5379  */
5380   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
5381   if (unlikely(__pyx_t_2)) {
5382 
5383     /* "View.MemoryView":133
5384  *
5385  *         if not self.ndim:
5386  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
5387  *
5388  *         if itemsize <= 0:
5389  */
5390     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
5391     __Pyx_GOTREF(__pyx_t_3);
5392     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5393     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5394     __PYX_ERR(2, 133, __pyx_L1_error)
5395 
5396     /* "View.MemoryView":132
5397  *         self.itemsize = itemsize
5398  *
5399  *         if not self.ndim:             # <<<<<<<<<<<<<<
5400  *             raise ValueError("Empty shape tuple for cython.array")
5401  *
5402  */
5403   }
5404 
5405   /* "View.MemoryView":135
5406  *             raise ValueError("Empty shape tuple for cython.array")
5407  *
5408  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
5409  *             raise ValueError("itemsize <= 0 for cython.array")
5410  *
5411  */
5412   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
5413   if (unlikely(__pyx_t_2)) {
5414 
5415     /* "View.MemoryView":136
5416  *
5417  *         if itemsize <= 0:
5418  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
5419  *
5420  *         if not isinstance(format, bytes):
5421  */
5422     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
5423     __Pyx_GOTREF(__pyx_t_3);
5424     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5425     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5426     __PYX_ERR(2, 136, __pyx_L1_error)
5427 
5428     /* "View.MemoryView":135
5429  *             raise ValueError("Empty shape tuple for cython.array")
5430  *
5431  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
5432  *             raise ValueError("itemsize <= 0 for cython.array")
5433  *
5434  */
5435   }
5436 
5437   /* "View.MemoryView":138
5438  *             raise ValueError("itemsize <= 0 for cython.array")
5439  *
5440  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
5441  *             format = format.encode('ASCII')
5442  *         self._format = format  # keep a reference to the byte string
5443  */
5444   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
5445   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
5446   if (__pyx_t_4) {
5447 
5448     /* "View.MemoryView":139
5449  *
5450  *         if not isinstance(format, bytes):
5451  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
5452  *         self._format = format  # keep a reference to the byte string
5453  *         self.format = self._format
5454  */
5455     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
5456     __Pyx_GOTREF(__pyx_t_5);
5457     __pyx_t_6 = NULL;
5458     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5459       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5460       if (likely(__pyx_t_6)) {
5461         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5462         __Pyx_INCREF(__pyx_t_6);
5463         __Pyx_INCREF(function);
5464         __Pyx_DECREF_SET(__pyx_t_5, function);
5465       }
5466     }
5467     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
5468     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5469     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
5470     __Pyx_GOTREF(__pyx_t_3);
5471     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5472     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
5473     __pyx_t_3 = 0;
5474 
5475     /* "View.MemoryView":138
5476  *             raise ValueError("itemsize <= 0 for cython.array")
5477  *
5478  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
5479  *             format = format.encode('ASCII')
5480  *         self._format = format  # keep a reference to the byte string
5481  */
5482   }
5483 
5484   /* "View.MemoryView":140
5485  *         if not isinstance(format, bytes):
5486  *             format = format.encode('ASCII')
5487  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
5488  *         self.format = self._format
5489  *
5490  */
5491   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
5492   __pyx_t_3 = __pyx_v_format;
5493   __Pyx_INCREF(__pyx_t_3);
5494   __Pyx_GIVEREF(__pyx_t_3);
5495   __Pyx_GOTREF(__pyx_v_self->_format);
5496   __Pyx_DECREF(__pyx_v_self->_format);
5497   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
5498   __pyx_t_3 = 0;
5499 
5500   /* "View.MemoryView":141
5501  *             format = format.encode('ASCII')
5502  *         self._format = format  # keep a reference to the byte string
5503  *         self.format = self._format             # <<<<<<<<<<<<<<
5504  *
5505  *
5506  */
5507   if (unlikely(__pyx_v_self->_format == Py_None)) {
5508     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
5509     __PYX_ERR(2, 141, __pyx_L1_error)
5510   }
5511   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
5512   __pyx_v_self->format = __pyx_t_7;
5513 
5514   /* "View.MemoryView":144
5515  *
5516  *
5517  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
5518  *         self._strides = self._shape + self.ndim
5519  *
5520  */
5521   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
5522 
5523   /* "View.MemoryView":145
5524  *
5525  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
5526  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
5527  *
5528  *         if not self._shape:
5529  */
5530   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
5531 
5532   /* "View.MemoryView":147
5533  *         self._strides = self._shape + self.ndim
5534  *
5535  *         if not self._shape:             # <<<<<<<<<<<<<<
5536  *             raise MemoryError("unable to allocate shape and strides.")
5537  *
5538  */
5539   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
5540   if (unlikely(__pyx_t_4)) {
5541 
5542     /* "View.MemoryView":148
5543  *
5544  *         if not self._shape:
5545  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
5546  *
5547  *
5548  */
5549     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
5550     __Pyx_GOTREF(__pyx_t_3);
5551     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5552     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5553     __PYX_ERR(2, 148, __pyx_L1_error)
5554 
5555     /* "View.MemoryView":147
5556  *         self._strides = self._shape + self.ndim
5557  *
5558  *         if not self._shape:             # <<<<<<<<<<<<<<
5559  *             raise MemoryError("unable to allocate shape and strides.")
5560  *
5561  */
5562   }
5563 
5564   /* "View.MemoryView":151
5565  *
5566  *
5567  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
5568  *             if dim <= 0:
5569  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5570  */
5571   __pyx_t_8 = 0;
5572   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5573   for (;;) {
5574     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
5575     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5576     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
5577     #else
5578     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
5579     __Pyx_GOTREF(__pyx_t_5);
5580     #endif
5581     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
5582     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5583     __pyx_v_dim = __pyx_t_9;
5584     __pyx_v_idx = __pyx_t_8;
5585     __pyx_t_8 = (__pyx_t_8 + 1);
5586 
5587     /* "View.MemoryView":152
5588  *
5589  *         for idx, dim in enumerate(shape):
5590  *             if dim <= 0:             # <<<<<<<<<<<<<<
5591  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5592  *             self._shape[idx] = dim
5593  */
5594     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
5595     if (unlikely(__pyx_t_4)) {
5596 
5597       /* "View.MemoryView":153
5598  *         for idx, dim in enumerate(shape):
5599  *             if dim <= 0:
5600  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
5601  *             self._shape[idx] = dim
5602  *
5603  */
5604       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
5605       __Pyx_GOTREF(__pyx_t_5);
5606       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
5607       __Pyx_GOTREF(__pyx_t_6);
5608       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
5609       __Pyx_GOTREF(__pyx_t_10);
5610       __Pyx_GIVEREF(__pyx_t_5);
5611       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
5612       __Pyx_GIVEREF(__pyx_t_6);
5613       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
5614       __pyx_t_5 = 0;
5615       __pyx_t_6 = 0;
5616       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
5617       __Pyx_GOTREF(__pyx_t_6);
5618       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5619       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
5620       __Pyx_GOTREF(__pyx_t_10);
5621       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5622       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5623       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5624       __PYX_ERR(2, 153, __pyx_L1_error)
5625 
5626       /* "View.MemoryView":152
5627  *
5628  *         for idx, dim in enumerate(shape):
5629  *             if dim <= 0:             # <<<<<<<<<<<<<<
5630  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5631  *             self._shape[idx] = dim
5632  */
5633     }
5634 
5635     /* "View.MemoryView":154
5636  *             if dim <= 0:
5637  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5638  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
5639  *
5640  *         cdef char order
5641  */
5642     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
5643 
5644     /* "View.MemoryView":151
5645  *
5646  *
5647  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
5648  *             if dim <= 0:
5649  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5650  */
5651   }
5652   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5653 
5654   /* "View.MemoryView":157
5655  *
5656  *         cdef char order
5657  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
5658  *             order = b'F'
5659  *             self.mode = u'fortran'
5660  */
5661   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
5662   if (__pyx_t_4) {
5663 
5664     /* "View.MemoryView":158
5665  *         cdef char order
5666  *         if mode == 'fortran':
5667  *             order = b'F'             # <<<<<<<<<<<<<<
5668  *             self.mode = u'fortran'
5669  *         elif mode == 'c':
5670  */
5671     __pyx_v_order = 'F';
5672 
5673     /* "View.MemoryView":159
5674  *         if mode == 'fortran':
5675  *             order = b'F'
5676  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
5677  *         elif mode == 'c':
5678  *             order = b'C'
5679  */
5680     __Pyx_INCREF(__pyx_n_u_fortran);
5681     __Pyx_GIVEREF(__pyx_n_u_fortran);
5682     __Pyx_GOTREF(__pyx_v_self->mode);
5683     __Pyx_DECREF(__pyx_v_self->mode);
5684     __pyx_v_self->mode = __pyx_n_u_fortran;
5685 
5686     /* "View.MemoryView":157
5687  *
5688  *         cdef char order
5689  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
5690  *             order = b'F'
5691  *             self.mode = u'fortran'
5692  */
5693     goto __pyx_L10;
5694   }
5695 
5696   /* "View.MemoryView":160
5697  *             order = b'F'
5698  *             self.mode = u'fortran'
5699  *         elif mode == 'c':             # <<<<<<<<<<<<<<
5700  *             order = b'C'
5701  *             self.mode = u'c'
5702  */
5703   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
5704   if (likely(__pyx_t_4)) {
5705 
5706     /* "View.MemoryView":161
5707  *             self.mode = u'fortran'
5708  *         elif mode == 'c':
5709  *             order = b'C'             # <<<<<<<<<<<<<<
5710  *             self.mode = u'c'
5711  *         else:
5712  */
5713     __pyx_v_order = 'C';
5714 
5715     /* "View.MemoryView":162
5716  *         elif mode == 'c':
5717  *             order = b'C'
5718  *             self.mode = u'c'             # <<<<<<<<<<<<<<
5719  *         else:
5720  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
5721  */
5722     __Pyx_INCREF(__pyx_n_u_c);
5723     __Pyx_GIVEREF(__pyx_n_u_c);
5724     __Pyx_GOTREF(__pyx_v_self->mode);
5725     __Pyx_DECREF(__pyx_v_self->mode);
5726     __pyx_v_self->mode = __pyx_n_u_c;
5727 
5728     /* "View.MemoryView":160
5729  *             order = b'F'
5730  *             self.mode = u'fortran'
5731  *         elif mode == 'c':             # <<<<<<<<<<<<<<
5732  *             order = b'C'
5733  *             self.mode = u'c'
5734  */
5735     goto __pyx_L10;
5736   }
5737 
5738   /* "View.MemoryView":164
5739  *             self.mode = u'c'
5740  *         else:
5741  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
5742  *
5743  *         self.len = fill_contig_strides_array(self._shape, self._strides,
5744  */
5745   /*else*/ {
5746     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
5747     __Pyx_GOTREF(__pyx_t_3);
5748     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
5749     __Pyx_GOTREF(__pyx_t_10);
5750     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5751     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5752     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5753     __PYX_ERR(2, 164, __pyx_L1_error)
5754   }
5755   __pyx_L10:;
5756 
5757   /* "View.MemoryView":166
5758  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
5759  *
5760  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
5761  *                                              itemsize, self.ndim, order)
5762  *
5763  */
5764   __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
5765 
5766   /* "View.MemoryView":169
5767  *                                              itemsize, self.ndim, order)
5768  *
5769  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
5770  *         self.dtype_is_object = format == b'O'
5771  *         if allocate_buffer:
5772  */
5773   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
5774 
5775   /* "View.MemoryView":170
5776  *
5777  *         self.free_data = allocate_buffer
5778  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
5779  *         if allocate_buffer:
5780  *
5781  */
5782   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
5783   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
5784   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5785   __pyx_v_self->dtype_is_object = __pyx_t_4;
5786 
5787   /* "View.MemoryView":171
5788  *         self.free_data = allocate_buffer
5789  *         self.dtype_is_object = format == b'O'
5790  *         if allocate_buffer:             # <<<<<<<<<<<<<<
5791  *
5792  *
5793  */
5794   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
5795   if (__pyx_t_4) {
5796 
5797     /* "View.MemoryView":174
5798  *
5799  *
5800  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
5801  *             if not self.data:
5802  *                 raise MemoryError("unable to allocate array data.")
5803  */
5804     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
5805 
5806     /* "View.MemoryView":175
5807  *
5808  *             self.data = <char *>malloc(self.len)
5809  *             if not self.data:             # <<<<<<<<<<<<<<
5810  *                 raise MemoryError("unable to allocate array data.")
5811  *
5812  */
5813     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
5814     if (unlikely(__pyx_t_4)) {
5815 
5816       /* "View.MemoryView":176
5817  *             self.data = <char *>malloc(self.len)
5818  *             if not self.data:
5819  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
5820  *
5821  *             if self.dtype_is_object:
5822  */
5823       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
5824       __Pyx_GOTREF(__pyx_t_10);
5825       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5826       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5827       __PYX_ERR(2, 176, __pyx_L1_error)
5828 
5829       /* "View.MemoryView":175
5830  *
5831  *             self.data = <char *>malloc(self.len)
5832  *             if not self.data:             # <<<<<<<<<<<<<<
5833  *                 raise MemoryError("unable to allocate array data.")
5834  *
5835  */
5836     }
5837 
5838     /* "View.MemoryView":178
5839  *                 raise MemoryError("unable to allocate array data.")
5840  *
5841  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
5842  *                 p = <PyObject **> self.data
5843  *                 for i in range(self.len / itemsize):
5844  */
5845     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
5846     if (__pyx_t_4) {
5847 
5848       /* "View.MemoryView":179
5849  *
5850  *             if self.dtype_is_object:
5851  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
5852  *                 for i in range(self.len / itemsize):
5853  *                     p[i] = Py_None
5854  */
5855       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
5856 
5857       /* "View.MemoryView":180
5858  *             if self.dtype_is_object:
5859  *                 p = <PyObject **> self.data
5860  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
5861  *                     p[i] = Py_None
5862  *                     Py_INCREF(Py_None)
5863  */
5864       if (unlikely(__pyx_v_itemsize == 0)) {
5865         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
5866         __PYX_ERR(2, 180, __pyx_L1_error)
5867       }
5868       else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
5869         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
5870         __PYX_ERR(2, 180, __pyx_L1_error)
5871       }
5872       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
5873       __pyx_t_9 = __pyx_t_1;
5874       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
5875         __pyx_v_i = __pyx_t_11;
5876 
5877         /* "View.MemoryView":181
5878  *                 p = <PyObject **> self.data
5879  *                 for i in range(self.len / itemsize):
5880  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
5881  *                     Py_INCREF(Py_None)
5882  *
5883  */
5884         (__pyx_v_p[__pyx_v_i]) = Py_None;
5885 
5886         /* "View.MemoryView":182
5887  *                 for i in range(self.len / itemsize):
5888  *                     p[i] = Py_None
5889  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
5890  *
5891  *     @cname('getbuffer')
5892  */
5893         Py_INCREF(Py_None);
5894       }
5895 
5896       /* "View.MemoryView":178
5897  *                 raise MemoryError("unable to allocate array data.")
5898  *
5899  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
5900  *                 p = <PyObject **> self.data
5901  *                 for i in range(self.len / itemsize):
5902  */
5903     }
5904 
5905     /* "View.MemoryView":171
5906  *         self.free_data = allocate_buffer
5907  *         self.dtype_is_object = format == b'O'
5908  *         if allocate_buffer:             # <<<<<<<<<<<<<<
5909  *
5910  *
5911  */
5912   }
5913 
5914   /* "View.MemoryView":122
5915  *         cdef bint dtype_is_object
5916  *
5917  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
5918  *                   mode="c", bint allocate_buffer=True):
5919  *
5920  */
5921 
5922   /* function exit code */
5923   __pyx_r = 0;
5924   goto __pyx_L0;
5925   __pyx_L1_error:;
5926   __Pyx_XDECREF(__pyx_t_3);
5927   __Pyx_XDECREF(__pyx_t_5);
5928   __Pyx_XDECREF(__pyx_t_6);
5929   __Pyx_XDECREF(__pyx_t_10);
5930   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5931   __pyx_r = -1;
5932   __pyx_L0:;
5933   __Pyx_XDECREF(__pyx_v_format);
5934   __Pyx_RefNannyFinishContext();
5935   return __pyx_r;
5936 }
5937 
5938 /* "View.MemoryView":185
5939  *
5940  *     @cname('getbuffer')
5941  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
5942  *         cdef int bufmode = -1
5943  *         if self.mode == u"c":
5944  */
5945 
5946 /* Python wrapper */
5947 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)5948 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5949   int __pyx_r;
5950   __Pyx_RefNannyDeclarations
5951   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
5952   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
5953 
5954   /* function exit code */
5955   __Pyx_RefNannyFinishContext();
5956   return __pyx_r;
5957 }
5958 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)5959 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5960   int __pyx_v_bufmode;
5961   int __pyx_r;
5962   __Pyx_RefNannyDeclarations
5963   int __pyx_t_1;
5964   int __pyx_t_2;
5965   PyObject *__pyx_t_3 = NULL;
5966   char *__pyx_t_4;
5967   Py_ssize_t __pyx_t_5;
5968   int __pyx_t_6;
5969   Py_ssize_t *__pyx_t_7;
5970   int __pyx_lineno = 0;
5971   const char *__pyx_filename = NULL;
5972   int __pyx_clineno = 0;
5973   if (__pyx_v_info == NULL) {
5974     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
5975     return -1;
5976   }
5977   __Pyx_RefNannySetupContext("__getbuffer__", 0);
5978   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5979   __Pyx_GIVEREF(__pyx_v_info->obj);
5980 
5981   /* "View.MemoryView":186
5982  *     @cname('getbuffer')
5983  *     def __getbuffer__(self, Py_buffer *info, int flags):
5984  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
5985  *         if self.mode == u"c":
5986  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
5987  */
5988   __pyx_v_bufmode = -1;
5989 
5990   /* "View.MemoryView":187
5991  *     def __getbuffer__(self, Py_buffer *info, int flags):
5992  *         cdef int bufmode = -1
5993  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
5994  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
5995  *         elif self.mode == u"fortran":
5996  */
5997   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
5998   __pyx_t_2 = (__pyx_t_1 != 0);
5999   if (__pyx_t_2) {
6000 
6001     /* "View.MemoryView":188
6002  *         cdef int bufmode = -1
6003  *         if self.mode == u"c":
6004  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
6005  *         elif self.mode == u"fortran":
6006  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6007  */
6008     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6009 
6010     /* "View.MemoryView":187
6011  *     def __getbuffer__(self, Py_buffer *info, int flags):
6012  *         cdef int bufmode = -1
6013  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
6014  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6015  *         elif self.mode == u"fortran":
6016  */
6017     goto __pyx_L3;
6018   }
6019 
6020   /* "View.MemoryView":189
6021  *         if self.mode == u"c":
6022  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6023  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
6024  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6025  *         if not (flags & bufmode):
6026  */
6027   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
6028   __pyx_t_1 = (__pyx_t_2 != 0);
6029   if (__pyx_t_1) {
6030 
6031     /* "View.MemoryView":190
6032  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6033  *         elif self.mode == u"fortran":
6034  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
6035  *         if not (flags & bufmode):
6036  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6037  */
6038     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6039 
6040     /* "View.MemoryView":189
6041  *         if self.mode == u"c":
6042  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6043  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
6044  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6045  *         if not (flags & bufmode):
6046  */
6047   }
6048   __pyx_L3:;
6049 
6050   /* "View.MemoryView":191
6051  *         elif self.mode == u"fortran":
6052  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6053  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
6054  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6055  *         info.buf = self.data
6056  */
6057   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
6058   if (unlikely(__pyx_t_1)) {
6059 
6060     /* "View.MemoryView":192
6061  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6062  *         if not (flags & bufmode):
6063  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
6064  *         info.buf = self.data
6065  *         info.len = self.len
6066  */
6067     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
6068     __Pyx_GOTREF(__pyx_t_3);
6069     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6070     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6071     __PYX_ERR(2, 192, __pyx_L1_error)
6072 
6073     /* "View.MemoryView":191
6074  *         elif self.mode == u"fortran":
6075  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6076  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
6077  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6078  *         info.buf = self.data
6079  */
6080   }
6081 
6082   /* "View.MemoryView":193
6083  *         if not (flags & bufmode):
6084  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6085  *         info.buf = self.data             # <<<<<<<<<<<<<<
6086  *         info.len = self.len
6087  *         info.ndim = self.ndim
6088  */
6089   __pyx_t_4 = __pyx_v_self->data;
6090   __pyx_v_info->buf = __pyx_t_4;
6091 
6092   /* "View.MemoryView":194
6093  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6094  *         info.buf = self.data
6095  *         info.len = self.len             # <<<<<<<<<<<<<<
6096  *         info.ndim = self.ndim
6097  *         info.shape = self._shape
6098  */
6099   __pyx_t_5 = __pyx_v_self->len;
6100   __pyx_v_info->len = __pyx_t_5;
6101 
6102   /* "View.MemoryView":195
6103  *         info.buf = self.data
6104  *         info.len = self.len
6105  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
6106  *         info.shape = self._shape
6107  *         info.strides = self._strides
6108  */
6109   __pyx_t_6 = __pyx_v_self->ndim;
6110   __pyx_v_info->ndim = __pyx_t_6;
6111 
6112   /* "View.MemoryView":196
6113  *         info.len = self.len
6114  *         info.ndim = self.ndim
6115  *         info.shape = self._shape             # <<<<<<<<<<<<<<
6116  *         info.strides = self._strides
6117  *         info.suboffsets = NULL
6118  */
6119   __pyx_t_7 = __pyx_v_self->_shape;
6120   __pyx_v_info->shape = __pyx_t_7;
6121 
6122   /* "View.MemoryView":197
6123  *         info.ndim = self.ndim
6124  *         info.shape = self._shape
6125  *         info.strides = self._strides             # <<<<<<<<<<<<<<
6126  *         info.suboffsets = NULL
6127  *         info.itemsize = self.itemsize
6128  */
6129   __pyx_t_7 = __pyx_v_self->_strides;
6130   __pyx_v_info->strides = __pyx_t_7;
6131 
6132   /* "View.MemoryView":198
6133  *         info.shape = self._shape
6134  *         info.strides = self._strides
6135  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
6136  *         info.itemsize = self.itemsize
6137  *         info.readonly = 0
6138  */
6139   __pyx_v_info->suboffsets = NULL;
6140 
6141   /* "View.MemoryView":199
6142  *         info.strides = self._strides
6143  *         info.suboffsets = NULL
6144  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
6145  *         info.readonly = 0
6146  *
6147  */
6148   __pyx_t_5 = __pyx_v_self->itemsize;
6149   __pyx_v_info->itemsize = __pyx_t_5;
6150 
6151   /* "View.MemoryView":200
6152  *         info.suboffsets = NULL
6153  *         info.itemsize = self.itemsize
6154  *         info.readonly = 0             # <<<<<<<<<<<<<<
6155  *
6156  *         if flags & PyBUF_FORMAT:
6157  */
6158   __pyx_v_info->readonly = 0;
6159 
6160   /* "View.MemoryView":202
6161  *         info.readonly = 0
6162  *
6163  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
6164  *             info.format = self.format
6165  *         else:
6166  */
6167   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
6168   if (__pyx_t_1) {
6169 
6170     /* "View.MemoryView":203
6171  *
6172  *         if flags & PyBUF_FORMAT:
6173  *             info.format = self.format             # <<<<<<<<<<<<<<
6174  *         else:
6175  *             info.format = NULL
6176  */
6177     __pyx_t_4 = __pyx_v_self->format;
6178     __pyx_v_info->format = __pyx_t_4;
6179 
6180     /* "View.MemoryView":202
6181  *         info.readonly = 0
6182  *
6183  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
6184  *             info.format = self.format
6185  *         else:
6186  */
6187     goto __pyx_L5;
6188   }
6189 
6190   /* "View.MemoryView":205
6191  *             info.format = self.format
6192  *         else:
6193  *             info.format = NULL             # <<<<<<<<<<<<<<
6194  *
6195  *         info.obj = self
6196  */
6197   /*else*/ {
6198     __pyx_v_info->format = NULL;
6199   }
6200   __pyx_L5:;
6201 
6202   /* "View.MemoryView":207
6203  *             info.format = NULL
6204  *
6205  *         info.obj = self             # <<<<<<<<<<<<<<
6206  *
6207  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6208  */
6209   __Pyx_INCREF(((PyObject *)__pyx_v_self));
6210   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6211   __Pyx_GOTREF(__pyx_v_info->obj);
6212   __Pyx_DECREF(__pyx_v_info->obj);
6213   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
6214 
6215   /* "View.MemoryView":185
6216  *
6217  *     @cname('getbuffer')
6218  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
6219  *         cdef int bufmode = -1
6220  *         if self.mode == u"c":
6221  */
6222 
6223   /* function exit code */
6224   __pyx_r = 0;
6225   goto __pyx_L0;
6226   __pyx_L1_error:;
6227   __Pyx_XDECREF(__pyx_t_3);
6228   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6229   __pyx_r = -1;
6230   if (__pyx_v_info->obj != NULL) {
6231     __Pyx_GOTREF(__pyx_v_info->obj);
6232     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6233   }
6234   goto __pyx_L2;
6235   __pyx_L0:;
6236   if (__pyx_v_info->obj == Py_None) {
6237     __Pyx_GOTREF(__pyx_v_info->obj);
6238     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6239   }
6240   __pyx_L2:;
6241   __Pyx_RefNannyFinishContext();
6242   return __pyx_r;
6243 }
6244 
6245 /* "View.MemoryView":211
6246  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6247  *
6248  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
6249  *         if self.callback_free_data != NULL:
6250  *             self.callback_free_data(self.data)
6251  */
6252 
6253 /* Python wrapper */
6254 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)6255 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
6256   __Pyx_RefNannyDeclarations
6257   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
6258   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
6259 
6260   /* function exit code */
6261   __Pyx_RefNannyFinishContext();
6262 }
6263 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)6264 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
6265   __Pyx_RefNannyDeclarations
6266   int __pyx_t_1;
6267   __Pyx_RefNannySetupContext("__dealloc__", 0);
6268 
6269   /* "View.MemoryView":212
6270  *
6271  *     def __dealloc__(array self):
6272  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
6273  *             self.callback_free_data(self.data)
6274  *         elif self.free_data:
6275  */
6276   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
6277   if (__pyx_t_1) {
6278 
6279     /* "View.MemoryView":213
6280  *     def __dealloc__(array self):
6281  *         if self.callback_free_data != NULL:
6282  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
6283  *         elif self.free_data:
6284  *             if self.dtype_is_object:
6285  */
6286     __pyx_v_self->callback_free_data(__pyx_v_self->data);
6287 
6288     /* "View.MemoryView":212
6289  *
6290  *     def __dealloc__(array self):
6291  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
6292  *             self.callback_free_data(self.data)
6293  *         elif self.free_data:
6294  */
6295     goto __pyx_L3;
6296   }
6297 
6298   /* "View.MemoryView":214
6299  *         if self.callback_free_data != NULL:
6300  *             self.callback_free_data(self.data)
6301  *         elif self.free_data:             # <<<<<<<<<<<<<<
6302  *             if self.dtype_is_object:
6303  *                 refcount_objects_in_slice(self.data, self._shape,
6304  */
6305   __pyx_t_1 = (__pyx_v_self->free_data != 0);
6306   if (__pyx_t_1) {
6307 
6308     /* "View.MemoryView":215
6309  *             self.callback_free_data(self.data)
6310  *         elif self.free_data:
6311  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
6312  *                 refcount_objects_in_slice(self.data, self._shape,
6313  *                                           self._strides, self.ndim, False)
6314  */
6315     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
6316     if (__pyx_t_1) {
6317 
6318       /* "View.MemoryView":216
6319  *         elif self.free_data:
6320  *             if self.dtype_is_object:
6321  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
6322  *                                           self._strides, self.ndim, False)
6323  *             free(self.data)
6324  */
6325       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
6326 
6327       /* "View.MemoryView":215
6328  *             self.callback_free_data(self.data)
6329  *         elif self.free_data:
6330  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
6331  *                 refcount_objects_in_slice(self.data, self._shape,
6332  *                                           self._strides, self.ndim, False)
6333  */
6334     }
6335 
6336     /* "View.MemoryView":218
6337  *                 refcount_objects_in_slice(self.data, self._shape,
6338  *                                           self._strides, self.ndim, False)
6339  *             free(self.data)             # <<<<<<<<<<<<<<
6340  *         PyObject_Free(self._shape)
6341  *
6342  */
6343     free(__pyx_v_self->data);
6344 
6345     /* "View.MemoryView":214
6346  *         if self.callback_free_data != NULL:
6347  *             self.callback_free_data(self.data)
6348  *         elif self.free_data:             # <<<<<<<<<<<<<<
6349  *             if self.dtype_is_object:
6350  *                 refcount_objects_in_slice(self.data, self._shape,
6351  */
6352   }
6353   __pyx_L3:;
6354 
6355   /* "View.MemoryView":219
6356  *                                           self._strides, self.ndim, False)
6357  *             free(self.data)
6358  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
6359  *
6360  *     @property
6361  */
6362   PyObject_Free(__pyx_v_self->_shape);
6363 
6364   /* "View.MemoryView":211
6365  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6366  *
6367  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
6368  *         if self.callback_free_data != NULL:
6369  *             self.callback_free_data(self.data)
6370  */
6371 
6372   /* function exit code */
6373   __Pyx_RefNannyFinishContext();
6374 }
6375 
6376 /* "View.MemoryView":222
6377  *
6378  *     @property
6379  *     def memview(self):             # <<<<<<<<<<<<<<
6380  *         return self.get_memview()
6381  *
6382  */
6383 
6384 /* Python wrapper */
6385 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)6386 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
6387   PyObject *__pyx_r = 0;
6388   __Pyx_RefNannyDeclarations
6389   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6390   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
6391 
6392   /* function exit code */
6393   __Pyx_RefNannyFinishContext();
6394   return __pyx_r;
6395 }
6396 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)6397 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
6398   PyObject *__pyx_r = NULL;
6399   __Pyx_RefNannyDeclarations
6400   PyObject *__pyx_t_1 = NULL;
6401   int __pyx_lineno = 0;
6402   const char *__pyx_filename = NULL;
6403   int __pyx_clineno = 0;
6404   __Pyx_RefNannySetupContext("__get__", 0);
6405 
6406   /* "View.MemoryView":223
6407  *     @property
6408  *     def memview(self):
6409  *         return self.get_memview()             # <<<<<<<<<<<<<<
6410  *
6411  *     @cname('get_memview')
6412  */
6413   __Pyx_XDECREF(__pyx_r);
6414   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
6415   __Pyx_GOTREF(__pyx_t_1);
6416   __pyx_r = __pyx_t_1;
6417   __pyx_t_1 = 0;
6418   goto __pyx_L0;
6419 
6420   /* "View.MemoryView":222
6421  *
6422  *     @property
6423  *     def memview(self):             # <<<<<<<<<<<<<<
6424  *         return self.get_memview()
6425  *
6426  */
6427 
6428   /* function exit code */
6429   __pyx_L1_error:;
6430   __Pyx_XDECREF(__pyx_t_1);
6431   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6432   __pyx_r = NULL;
6433   __pyx_L0:;
6434   __Pyx_XGIVEREF(__pyx_r);
6435   __Pyx_RefNannyFinishContext();
6436   return __pyx_r;
6437 }
6438 
6439 /* "View.MemoryView":226
6440  *
6441  *     @cname('get_memview')
6442  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
6443  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6444  *         return  memoryview(self, flags, self.dtype_is_object)
6445  */
6446 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)6447 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
6448   int __pyx_v_flags;
6449   PyObject *__pyx_r = NULL;
6450   __Pyx_RefNannyDeclarations
6451   PyObject *__pyx_t_1 = NULL;
6452   PyObject *__pyx_t_2 = NULL;
6453   PyObject *__pyx_t_3 = NULL;
6454   int __pyx_lineno = 0;
6455   const char *__pyx_filename = NULL;
6456   int __pyx_clineno = 0;
6457   __Pyx_RefNannySetupContext("get_memview", 0);
6458 
6459   /* "View.MemoryView":227
6460  *     @cname('get_memview')
6461  *     cdef get_memview(self):
6462  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
6463  *         return  memoryview(self, flags, self.dtype_is_object)
6464  *
6465  */
6466   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
6467 
6468   /* "View.MemoryView":228
6469  *     cdef get_memview(self):
6470  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6471  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
6472  *
6473  *     def __len__(self):
6474  */
6475   __Pyx_XDECREF(__pyx_r);
6476   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
6477   __Pyx_GOTREF(__pyx_t_1);
6478   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
6479   __Pyx_GOTREF(__pyx_t_2);
6480   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
6481   __Pyx_GOTREF(__pyx_t_3);
6482   __Pyx_INCREF(((PyObject *)__pyx_v_self));
6483   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6484   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
6485   __Pyx_GIVEREF(__pyx_t_1);
6486   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
6487   __Pyx_GIVEREF(__pyx_t_2);
6488   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
6489   __pyx_t_1 = 0;
6490   __pyx_t_2 = 0;
6491   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
6492   __Pyx_GOTREF(__pyx_t_2);
6493   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6494   __pyx_r = __pyx_t_2;
6495   __pyx_t_2 = 0;
6496   goto __pyx_L0;
6497 
6498   /* "View.MemoryView":226
6499  *
6500  *     @cname('get_memview')
6501  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
6502  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6503  *         return  memoryview(self, flags, self.dtype_is_object)
6504  */
6505 
6506   /* function exit code */
6507   __pyx_L1_error:;
6508   __Pyx_XDECREF(__pyx_t_1);
6509   __Pyx_XDECREF(__pyx_t_2);
6510   __Pyx_XDECREF(__pyx_t_3);
6511   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
6512   __pyx_r = 0;
6513   __pyx_L0:;
6514   __Pyx_XGIVEREF(__pyx_r);
6515   __Pyx_RefNannyFinishContext();
6516   return __pyx_r;
6517 }
6518 
6519 /* "View.MemoryView":230
6520  *         return  memoryview(self, flags, self.dtype_is_object)
6521  *
6522  *     def __len__(self):             # <<<<<<<<<<<<<<
6523  *         return self._shape[0]
6524  *
6525  */
6526 
6527 /* Python wrapper */
6528 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)6529 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
6530   Py_ssize_t __pyx_r;
6531   __Pyx_RefNannyDeclarations
6532   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
6533   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
6534 
6535   /* function exit code */
6536   __Pyx_RefNannyFinishContext();
6537   return __pyx_r;
6538 }
6539 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)6540 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
6541   Py_ssize_t __pyx_r;
6542   __Pyx_RefNannyDeclarations
6543   __Pyx_RefNannySetupContext("__len__", 0);
6544 
6545   /* "View.MemoryView":231
6546  *
6547  *     def __len__(self):
6548  *         return self._shape[0]             # <<<<<<<<<<<<<<
6549  *
6550  *     def __getattr__(self, attr):
6551  */
6552   __pyx_r = (__pyx_v_self->_shape[0]);
6553   goto __pyx_L0;
6554 
6555   /* "View.MemoryView":230
6556  *         return  memoryview(self, flags, self.dtype_is_object)
6557  *
6558  *     def __len__(self):             # <<<<<<<<<<<<<<
6559  *         return self._shape[0]
6560  *
6561  */
6562 
6563   /* function exit code */
6564   __pyx_L0:;
6565   __Pyx_RefNannyFinishContext();
6566   return __pyx_r;
6567 }
6568 
6569 /* "View.MemoryView":233
6570  *         return self._shape[0]
6571  *
6572  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
6573  *         return getattr(self.memview, attr)
6574  *
6575  */
6576 
6577 /* Python wrapper */
6578 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)6579 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
6580   PyObject *__pyx_r = 0;
6581   __Pyx_RefNannyDeclarations
6582   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
6583   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
6584 
6585   /* function exit code */
6586   __Pyx_RefNannyFinishContext();
6587   return __pyx_r;
6588 }
6589 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)6590 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
6591   PyObject *__pyx_r = NULL;
6592   __Pyx_RefNannyDeclarations
6593   PyObject *__pyx_t_1 = NULL;
6594   PyObject *__pyx_t_2 = NULL;
6595   int __pyx_lineno = 0;
6596   const char *__pyx_filename = NULL;
6597   int __pyx_clineno = 0;
6598   __Pyx_RefNannySetupContext("__getattr__", 0);
6599 
6600   /* "View.MemoryView":234
6601  *
6602  *     def __getattr__(self, attr):
6603  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
6604  *
6605  *     def __getitem__(self, item):
6606  */
6607   __Pyx_XDECREF(__pyx_r);
6608   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
6609   __Pyx_GOTREF(__pyx_t_1);
6610   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
6611   __Pyx_GOTREF(__pyx_t_2);
6612   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6613   __pyx_r = __pyx_t_2;
6614   __pyx_t_2 = 0;
6615   goto __pyx_L0;
6616 
6617   /* "View.MemoryView":233
6618  *         return self._shape[0]
6619  *
6620  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
6621  *         return getattr(self.memview, attr)
6622  *
6623  */
6624 
6625   /* function exit code */
6626   __pyx_L1_error:;
6627   __Pyx_XDECREF(__pyx_t_1);
6628   __Pyx_XDECREF(__pyx_t_2);
6629   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6630   __pyx_r = NULL;
6631   __pyx_L0:;
6632   __Pyx_XGIVEREF(__pyx_r);
6633   __Pyx_RefNannyFinishContext();
6634   return __pyx_r;
6635 }
6636 
6637 /* "View.MemoryView":236
6638  *         return getattr(self.memview, attr)
6639  *
6640  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
6641  *         return self.memview[item]
6642  *
6643  */
6644 
6645 /* Python wrapper */
6646 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)6647 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
6648   PyObject *__pyx_r = 0;
6649   __Pyx_RefNannyDeclarations
6650   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
6651   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
6652 
6653   /* function exit code */
6654   __Pyx_RefNannyFinishContext();
6655   return __pyx_r;
6656 }
6657 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)6658 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
6659   PyObject *__pyx_r = NULL;
6660   __Pyx_RefNannyDeclarations
6661   PyObject *__pyx_t_1 = NULL;
6662   PyObject *__pyx_t_2 = NULL;
6663   int __pyx_lineno = 0;
6664   const char *__pyx_filename = NULL;
6665   int __pyx_clineno = 0;
6666   __Pyx_RefNannySetupContext("__getitem__", 0);
6667 
6668   /* "View.MemoryView":237
6669  *
6670  *     def __getitem__(self, item):
6671  *         return self.memview[item]             # <<<<<<<<<<<<<<
6672  *
6673  *     def __setitem__(self, item, value):
6674  */
6675   __Pyx_XDECREF(__pyx_r);
6676   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
6677   __Pyx_GOTREF(__pyx_t_1);
6678   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
6679   __Pyx_GOTREF(__pyx_t_2);
6680   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6681   __pyx_r = __pyx_t_2;
6682   __pyx_t_2 = 0;
6683   goto __pyx_L0;
6684 
6685   /* "View.MemoryView":236
6686  *         return getattr(self.memview, attr)
6687  *
6688  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
6689  *         return self.memview[item]
6690  *
6691  */
6692 
6693   /* function exit code */
6694   __pyx_L1_error:;
6695   __Pyx_XDECREF(__pyx_t_1);
6696   __Pyx_XDECREF(__pyx_t_2);
6697   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6698   __pyx_r = NULL;
6699   __pyx_L0:;
6700   __Pyx_XGIVEREF(__pyx_r);
6701   __Pyx_RefNannyFinishContext();
6702   return __pyx_r;
6703 }
6704 
6705 /* "View.MemoryView":239
6706  *         return self.memview[item]
6707  *
6708  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
6709  *         self.memview[item] = value
6710  *
6711  */
6712 
6713 /* Python wrapper */
6714 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)6715 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6716   int __pyx_r;
6717   __Pyx_RefNannyDeclarations
6718   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
6719   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
6720 
6721   /* function exit code */
6722   __Pyx_RefNannyFinishContext();
6723   return __pyx_r;
6724 }
6725 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)6726 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6727   int __pyx_r;
6728   __Pyx_RefNannyDeclarations
6729   PyObject *__pyx_t_1 = NULL;
6730   int __pyx_lineno = 0;
6731   const char *__pyx_filename = NULL;
6732   int __pyx_clineno = 0;
6733   __Pyx_RefNannySetupContext("__setitem__", 0);
6734 
6735   /* "View.MemoryView":240
6736  *
6737  *     def __setitem__(self, item, value):
6738  *         self.memview[item] = value             # <<<<<<<<<<<<<<
6739  *
6740  *
6741  */
6742   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
6743   __Pyx_GOTREF(__pyx_t_1);
6744   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
6745   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6746 
6747   /* "View.MemoryView":239
6748  *         return self.memview[item]
6749  *
6750  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
6751  *         self.memview[item] = value
6752  *
6753  */
6754 
6755   /* function exit code */
6756   __pyx_r = 0;
6757   goto __pyx_L0;
6758   __pyx_L1_error:;
6759   __Pyx_XDECREF(__pyx_t_1);
6760   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6761   __pyx_r = -1;
6762   __pyx_L0:;
6763   __Pyx_RefNannyFinishContext();
6764   return __pyx_r;
6765 }
6766 
6767 /* "(tree fragment)":1
6768  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6769  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6770  * def __setstate_cython__(self, __pyx_state):
6771  */
6772 
6773 /* Python wrapper */
6774 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6775 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6776   PyObject *__pyx_r = 0;
6777   __Pyx_RefNannyDeclarations
6778   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
6779   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
6780 
6781   /* function exit code */
6782   __Pyx_RefNannyFinishContext();
6783   return __pyx_r;
6784 }
6785 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)6786 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
6787   PyObject *__pyx_r = NULL;
6788   __Pyx_RefNannyDeclarations
6789   PyObject *__pyx_t_1 = NULL;
6790   int __pyx_lineno = 0;
6791   const char *__pyx_filename = NULL;
6792   int __pyx_clineno = 0;
6793   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
6794 
6795   /* "(tree fragment)":2
6796  * def __reduce_cython__(self):
6797  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6798  * def __setstate_cython__(self, __pyx_state):
6799  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6800  */
6801   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
6802   __Pyx_GOTREF(__pyx_t_1);
6803   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6804   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6805   __PYX_ERR(2, 2, __pyx_L1_error)
6806 
6807   /* "(tree fragment)":1
6808  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6809  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6810  * def __setstate_cython__(self, __pyx_state):
6811  */
6812 
6813   /* function exit code */
6814   __pyx_L1_error:;
6815   __Pyx_XDECREF(__pyx_t_1);
6816   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6817   __pyx_r = NULL;
6818   __Pyx_XGIVEREF(__pyx_r);
6819   __Pyx_RefNannyFinishContext();
6820   return __pyx_r;
6821 }
6822 
6823 /* "(tree fragment)":3
6824  * def __reduce_cython__(self):
6825  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6826  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6827  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6828  */
6829 
6830 /* Python wrapper */
6831 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)6832 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6833   PyObject *__pyx_r = 0;
6834   __Pyx_RefNannyDeclarations
6835   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
6836   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6837 
6838   /* function exit code */
6839   __Pyx_RefNannyFinishContext();
6840   return __pyx_r;
6841 }
6842 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)6843 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
6844   PyObject *__pyx_r = NULL;
6845   __Pyx_RefNannyDeclarations
6846   PyObject *__pyx_t_1 = NULL;
6847   int __pyx_lineno = 0;
6848   const char *__pyx_filename = NULL;
6849   int __pyx_clineno = 0;
6850   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6851 
6852   /* "(tree fragment)":4
6853  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6854  * def __setstate_cython__(self, __pyx_state):
6855  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6856  */
6857   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
6858   __Pyx_GOTREF(__pyx_t_1);
6859   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6860   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6861   __PYX_ERR(2, 4, __pyx_L1_error)
6862 
6863   /* "(tree fragment)":3
6864  * def __reduce_cython__(self):
6865  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6866  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6867  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6868  */
6869 
6870   /* function exit code */
6871   __pyx_L1_error:;
6872   __Pyx_XDECREF(__pyx_t_1);
6873   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6874   __pyx_r = NULL;
6875   __Pyx_XGIVEREF(__pyx_r);
6876   __Pyx_RefNannyFinishContext();
6877   return __pyx_r;
6878 }
6879 
6880 /* "View.MemoryView":244
6881  *
6882  * @cname("__pyx_array_new")
6883  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
6884  *                           char *mode, char *buf):
6885  *     cdef array result
6886  */
6887 
__pyx_array_new(PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,char * __pyx_v_format,char * __pyx_v_mode,char * __pyx_v_buf)6888 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
6889   struct __pyx_array_obj *__pyx_v_result = 0;
6890   struct __pyx_array_obj *__pyx_r = NULL;
6891   __Pyx_RefNannyDeclarations
6892   int __pyx_t_1;
6893   PyObject *__pyx_t_2 = NULL;
6894   PyObject *__pyx_t_3 = NULL;
6895   PyObject *__pyx_t_4 = NULL;
6896   PyObject *__pyx_t_5 = NULL;
6897   int __pyx_lineno = 0;
6898   const char *__pyx_filename = NULL;
6899   int __pyx_clineno = 0;
6900   __Pyx_RefNannySetupContext("array_cwrapper", 0);
6901 
6902   /* "View.MemoryView":248
6903  *     cdef array result
6904  *
6905  *     if buf == NULL:             # <<<<<<<<<<<<<<
6906  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
6907  *     else:
6908  */
6909   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
6910   if (__pyx_t_1) {
6911 
6912     /* "View.MemoryView":249
6913  *
6914  *     if buf == NULL:
6915  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
6916  *     else:
6917  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
6918  */
6919     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
6920     __Pyx_GOTREF(__pyx_t_2);
6921     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
6922     __Pyx_GOTREF(__pyx_t_3);
6923     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
6924     __Pyx_GOTREF(__pyx_t_4);
6925     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
6926     __Pyx_GOTREF(__pyx_t_5);
6927     __Pyx_INCREF(__pyx_v_shape);
6928     __Pyx_GIVEREF(__pyx_v_shape);
6929     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
6930     __Pyx_GIVEREF(__pyx_t_2);
6931     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
6932     __Pyx_GIVEREF(__pyx_t_3);
6933     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
6934     __Pyx_GIVEREF(__pyx_t_4);
6935     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
6936     __pyx_t_2 = 0;
6937     __pyx_t_3 = 0;
6938     __pyx_t_4 = 0;
6939     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
6940     __Pyx_GOTREF(__pyx_t_4);
6941     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6942     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
6943     __pyx_t_4 = 0;
6944 
6945     /* "View.MemoryView":248
6946  *     cdef array result
6947  *
6948  *     if buf == NULL:             # <<<<<<<<<<<<<<
6949  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
6950  *     else:
6951  */
6952     goto __pyx_L3;
6953   }
6954 
6955   /* "View.MemoryView":251
6956  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
6957  *     else:
6958  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
6959  *                        allocate_buffer=False)
6960  *         result.data = buf
6961  */
6962   /*else*/ {
6963     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
6964     __Pyx_GOTREF(__pyx_t_4);
6965     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
6966     __Pyx_GOTREF(__pyx_t_5);
6967     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
6968     __Pyx_GOTREF(__pyx_t_3);
6969     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
6970     __Pyx_GOTREF(__pyx_t_2);
6971     __Pyx_INCREF(__pyx_v_shape);
6972     __Pyx_GIVEREF(__pyx_v_shape);
6973     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
6974     __Pyx_GIVEREF(__pyx_t_4);
6975     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
6976     __Pyx_GIVEREF(__pyx_t_5);
6977     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
6978     __Pyx_GIVEREF(__pyx_t_3);
6979     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
6980     __pyx_t_4 = 0;
6981     __pyx_t_5 = 0;
6982     __pyx_t_3 = 0;
6983 
6984     /* "View.MemoryView":252
6985  *     else:
6986  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
6987  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
6988  *         result.data = buf
6989  *
6990  */
6991     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
6992     __Pyx_GOTREF(__pyx_t_3);
6993     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
6994 
6995     /* "View.MemoryView":251
6996  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
6997  *     else:
6998  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
6999  *                        allocate_buffer=False)
7000  *         result.data = buf
7001  */
7002     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
7003     __Pyx_GOTREF(__pyx_t_5);
7004     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7005     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7006     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
7007     __pyx_t_5 = 0;
7008 
7009     /* "View.MemoryView":253
7010  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
7011  *                        allocate_buffer=False)
7012  *         result.data = buf             # <<<<<<<<<<<<<<
7013  *
7014  *     return result
7015  */
7016     __pyx_v_result->data = __pyx_v_buf;
7017   }
7018   __pyx_L3:;
7019 
7020   /* "View.MemoryView":255
7021  *         result.data = buf
7022  *
7023  *     return result             # <<<<<<<<<<<<<<
7024  *
7025  *
7026  */
7027   __Pyx_XDECREF(((PyObject *)__pyx_r));
7028   __Pyx_INCREF(((PyObject *)__pyx_v_result));
7029   __pyx_r = __pyx_v_result;
7030   goto __pyx_L0;
7031 
7032   /* "View.MemoryView":244
7033  *
7034  * @cname("__pyx_array_new")
7035  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
7036  *                           char *mode, char *buf):
7037  *     cdef array result
7038  */
7039 
7040   /* function exit code */
7041   __pyx_L1_error:;
7042   __Pyx_XDECREF(__pyx_t_2);
7043   __Pyx_XDECREF(__pyx_t_3);
7044   __Pyx_XDECREF(__pyx_t_4);
7045   __Pyx_XDECREF(__pyx_t_5);
7046   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
7047   __pyx_r = 0;
7048   __pyx_L0:;
7049   __Pyx_XDECREF((PyObject *)__pyx_v_result);
7050   __Pyx_XGIVEREF((PyObject *)__pyx_r);
7051   __Pyx_RefNannyFinishContext();
7052   return __pyx_r;
7053 }
7054 
7055 /* "View.MemoryView":281
7056  * cdef class Enum(object):
7057  *     cdef object name
7058  *     def __init__(self, name):             # <<<<<<<<<<<<<<
7059  *         self.name = name
7060  *     def __repr__(self):
7061  */
7062 
7063 /* Python wrapper */
7064 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7065 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7066   PyObject *__pyx_v_name = 0;
7067   int __pyx_lineno = 0;
7068   const char *__pyx_filename = NULL;
7069   int __pyx_clineno = 0;
7070   int __pyx_r;
7071   __Pyx_RefNannyDeclarations
7072   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
7073   {
7074     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
7075     PyObject* values[1] = {0};
7076     if (unlikely(__pyx_kwds)) {
7077       Py_ssize_t kw_args;
7078       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7079       switch (pos_args) {
7080         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7081         CYTHON_FALLTHROUGH;
7082         case  0: break;
7083         default: goto __pyx_L5_argtuple_error;
7084       }
7085       kw_args = PyDict_Size(__pyx_kwds);
7086       switch (pos_args) {
7087         case  0:
7088         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
7089         else goto __pyx_L5_argtuple_error;
7090       }
7091       if (unlikely(kw_args > 0)) {
7092         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
7093       }
7094     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
7095       goto __pyx_L5_argtuple_error;
7096     } else {
7097       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7098     }
7099     __pyx_v_name = values[0];
7100   }
7101   goto __pyx_L4_argument_unpacking_done;
7102   __pyx_L5_argtuple_error:;
7103   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
7104   __pyx_L3_error:;
7105   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7106   __Pyx_RefNannyFinishContext();
7107   return -1;
7108   __pyx_L4_argument_unpacking_done:;
7109   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
7110 
7111   /* function exit code */
7112   __Pyx_RefNannyFinishContext();
7113   return __pyx_r;
7114 }
7115 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)7116 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
7117   int __pyx_r;
7118   __Pyx_RefNannyDeclarations
7119   __Pyx_RefNannySetupContext("__init__", 0);
7120 
7121   /* "View.MemoryView":282
7122  *     cdef object name
7123  *     def __init__(self, name):
7124  *         self.name = name             # <<<<<<<<<<<<<<
7125  *     def __repr__(self):
7126  *         return self.name
7127  */
7128   __Pyx_INCREF(__pyx_v_name);
7129   __Pyx_GIVEREF(__pyx_v_name);
7130   __Pyx_GOTREF(__pyx_v_self->name);
7131   __Pyx_DECREF(__pyx_v_self->name);
7132   __pyx_v_self->name = __pyx_v_name;
7133 
7134   /* "View.MemoryView":281
7135  * cdef class Enum(object):
7136  *     cdef object name
7137  *     def __init__(self, name):             # <<<<<<<<<<<<<<
7138  *         self.name = name
7139  *     def __repr__(self):
7140  */
7141 
7142   /* function exit code */
7143   __pyx_r = 0;
7144   __Pyx_RefNannyFinishContext();
7145   return __pyx_r;
7146 }
7147 
7148 /* "View.MemoryView":283
7149  *     def __init__(self, name):
7150  *         self.name = name
7151  *     def __repr__(self):             # <<<<<<<<<<<<<<
7152  *         return self.name
7153  *
7154  */
7155 
7156 /* Python wrapper */
7157 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)7158 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
7159   PyObject *__pyx_r = 0;
7160   __Pyx_RefNannyDeclarations
7161   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
7162   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7163 
7164   /* function exit code */
7165   __Pyx_RefNannyFinishContext();
7166   return __pyx_r;
7167 }
7168 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)7169 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7170   PyObject *__pyx_r = NULL;
7171   __Pyx_RefNannyDeclarations
7172   __Pyx_RefNannySetupContext("__repr__", 0);
7173 
7174   /* "View.MemoryView":284
7175  *         self.name = name
7176  *     def __repr__(self):
7177  *         return self.name             # <<<<<<<<<<<<<<
7178  *
7179  * cdef generic = Enum("<strided and direct or indirect>")
7180  */
7181   __Pyx_XDECREF(__pyx_r);
7182   __Pyx_INCREF(__pyx_v_self->name);
7183   __pyx_r = __pyx_v_self->name;
7184   goto __pyx_L0;
7185 
7186   /* "View.MemoryView":283
7187  *     def __init__(self, name):
7188  *         self.name = name
7189  *     def __repr__(self):             # <<<<<<<<<<<<<<
7190  *         return self.name
7191  *
7192  */
7193 
7194   /* function exit code */
7195   __pyx_L0:;
7196   __Pyx_XGIVEREF(__pyx_r);
7197   __Pyx_RefNannyFinishContext();
7198   return __pyx_r;
7199 }
7200 
7201 /* "(tree fragment)":1
7202  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7203  *     cdef tuple state
7204  *     cdef object _dict
7205  */
7206 
7207 /* Python wrapper */
7208 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7209 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7210   PyObject *__pyx_r = 0;
7211   __Pyx_RefNannyDeclarations
7212   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
7213   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7214 
7215   /* function exit code */
7216   __Pyx_RefNannyFinishContext();
7217   return __pyx_r;
7218 }
7219 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)7220 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7221   PyObject *__pyx_v_state = 0;
7222   PyObject *__pyx_v__dict = 0;
7223   int __pyx_v_use_setstate;
7224   PyObject *__pyx_r = NULL;
7225   __Pyx_RefNannyDeclarations
7226   PyObject *__pyx_t_1 = NULL;
7227   int __pyx_t_2;
7228   int __pyx_t_3;
7229   PyObject *__pyx_t_4 = NULL;
7230   PyObject *__pyx_t_5 = NULL;
7231   int __pyx_lineno = 0;
7232   const char *__pyx_filename = NULL;
7233   int __pyx_clineno = 0;
7234   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
7235 
7236   /* "(tree fragment)":5
7237  *     cdef object _dict
7238  *     cdef bint use_setstate
7239  *     state = (self.name,)             # <<<<<<<<<<<<<<
7240  *     _dict = getattr(self, '__dict__', None)
7241  *     if _dict is not None:
7242  */
7243   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
7244   __Pyx_GOTREF(__pyx_t_1);
7245   __Pyx_INCREF(__pyx_v_self->name);
7246   __Pyx_GIVEREF(__pyx_v_self->name);
7247   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
7248   __pyx_v_state = ((PyObject*)__pyx_t_1);
7249   __pyx_t_1 = 0;
7250 
7251   /* "(tree fragment)":6
7252  *     cdef bint use_setstate
7253  *     state = (self.name,)
7254  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
7255  *     if _dict is not None:
7256  *         state += (_dict,)
7257  */
7258   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
7259   __Pyx_GOTREF(__pyx_t_1);
7260   __pyx_v__dict = __pyx_t_1;
7261   __pyx_t_1 = 0;
7262 
7263   /* "(tree fragment)":7
7264  *     state = (self.name,)
7265  *     _dict = getattr(self, '__dict__', None)
7266  *     if _dict is not None:             # <<<<<<<<<<<<<<
7267  *         state += (_dict,)
7268  *         use_setstate = True
7269  */
7270   __pyx_t_2 = (__pyx_v__dict != Py_None);
7271   __pyx_t_3 = (__pyx_t_2 != 0);
7272   if (__pyx_t_3) {
7273 
7274     /* "(tree fragment)":8
7275  *     _dict = getattr(self, '__dict__', None)
7276  *     if _dict is not None:
7277  *         state += (_dict,)             # <<<<<<<<<<<<<<
7278  *         use_setstate = True
7279  *     else:
7280  */
7281     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
7282     __Pyx_GOTREF(__pyx_t_1);
7283     __Pyx_INCREF(__pyx_v__dict);
7284     __Pyx_GIVEREF(__pyx_v__dict);
7285     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
7286     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
7287     __Pyx_GOTREF(__pyx_t_4);
7288     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7289     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
7290     __pyx_t_4 = 0;
7291 
7292     /* "(tree fragment)":9
7293  *     if _dict is not None:
7294  *         state += (_dict,)
7295  *         use_setstate = True             # <<<<<<<<<<<<<<
7296  *     else:
7297  *         use_setstate = self.name is not None
7298  */
7299     __pyx_v_use_setstate = 1;
7300 
7301     /* "(tree fragment)":7
7302  *     state = (self.name,)
7303  *     _dict = getattr(self, '__dict__', None)
7304  *     if _dict is not None:             # <<<<<<<<<<<<<<
7305  *         state += (_dict,)
7306  *         use_setstate = True
7307  */
7308     goto __pyx_L3;
7309   }
7310 
7311   /* "(tree fragment)":11
7312  *         use_setstate = True
7313  *     else:
7314  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
7315  *     if use_setstate:
7316  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7317  */
7318   /*else*/ {
7319     __pyx_t_3 = (__pyx_v_self->name != Py_None);
7320     __pyx_v_use_setstate = __pyx_t_3;
7321   }
7322   __pyx_L3:;
7323 
7324   /* "(tree fragment)":12
7325  *     else:
7326  *         use_setstate = self.name is not None
7327  *     if use_setstate:             # <<<<<<<<<<<<<<
7328  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7329  *     else:
7330  */
7331   __pyx_t_3 = (__pyx_v_use_setstate != 0);
7332   if (__pyx_t_3) {
7333 
7334     /* "(tree fragment)":13
7335  *         use_setstate = self.name is not None
7336  *     if use_setstate:
7337  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
7338  *     else:
7339  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7340  */
7341     __Pyx_XDECREF(__pyx_r);
7342     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
7343     __Pyx_GOTREF(__pyx_t_4);
7344     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
7345     __Pyx_GOTREF(__pyx_t_1);
7346     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7347     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7348     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7349     __Pyx_INCREF(__pyx_int_184977713);
7350     __Pyx_GIVEREF(__pyx_int_184977713);
7351     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7352     __Pyx_INCREF(Py_None);
7353     __Pyx_GIVEREF(Py_None);
7354     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
7355     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
7356     __Pyx_GOTREF(__pyx_t_5);
7357     __Pyx_GIVEREF(__pyx_t_4);
7358     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
7359     __Pyx_GIVEREF(__pyx_t_1);
7360     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
7361     __Pyx_INCREF(__pyx_v_state);
7362     __Pyx_GIVEREF(__pyx_v_state);
7363     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
7364     __pyx_t_4 = 0;
7365     __pyx_t_1 = 0;
7366     __pyx_r = __pyx_t_5;
7367     __pyx_t_5 = 0;
7368     goto __pyx_L0;
7369 
7370     /* "(tree fragment)":12
7371  *     else:
7372  *         use_setstate = self.name is not None
7373  *     if use_setstate:             # <<<<<<<<<<<<<<
7374  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7375  *     else:
7376  */
7377   }
7378 
7379   /* "(tree fragment)":15
7380  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7381  *     else:
7382  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
7383  * def __setstate_cython__(self, __pyx_state):
7384  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
7385  */
7386   /*else*/ {
7387     __Pyx_XDECREF(__pyx_r);
7388     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
7389     __Pyx_GOTREF(__pyx_t_5);
7390     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
7391     __Pyx_GOTREF(__pyx_t_1);
7392     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7393     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7394     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7395     __Pyx_INCREF(__pyx_int_184977713);
7396     __Pyx_GIVEREF(__pyx_int_184977713);
7397     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7398     __Pyx_INCREF(__pyx_v_state);
7399     __Pyx_GIVEREF(__pyx_v_state);
7400     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
7401     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
7402     __Pyx_GOTREF(__pyx_t_4);
7403     __Pyx_GIVEREF(__pyx_t_5);
7404     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
7405     __Pyx_GIVEREF(__pyx_t_1);
7406     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
7407     __pyx_t_5 = 0;
7408     __pyx_t_1 = 0;
7409     __pyx_r = __pyx_t_4;
7410     __pyx_t_4 = 0;
7411     goto __pyx_L0;
7412   }
7413 
7414   /* "(tree fragment)":1
7415  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7416  *     cdef tuple state
7417  *     cdef object _dict
7418  */
7419 
7420   /* function exit code */
7421   __pyx_L1_error:;
7422   __Pyx_XDECREF(__pyx_t_1);
7423   __Pyx_XDECREF(__pyx_t_4);
7424   __Pyx_XDECREF(__pyx_t_5);
7425   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7426   __pyx_r = NULL;
7427   __pyx_L0:;
7428   __Pyx_XDECREF(__pyx_v_state);
7429   __Pyx_XDECREF(__pyx_v__dict);
7430   __Pyx_XGIVEREF(__pyx_r);
7431   __Pyx_RefNannyFinishContext();
7432   return __pyx_r;
7433 }
7434 
7435 /* "(tree fragment)":16
7436  *     else:
7437  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7438  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7439  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
7440  */
7441 
7442 /* Python wrapper */
7443 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)7444 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7445   PyObject *__pyx_r = 0;
7446   __Pyx_RefNannyDeclarations
7447   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
7448   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7449 
7450   /* function exit code */
7451   __Pyx_RefNannyFinishContext();
7452   return __pyx_r;
7453 }
7454 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)7455 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7456   PyObject *__pyx_r = NULL;
7457   __Pyx_RefNannyDeclarations
7458   PyObject *__pyx_t_1 = NULL;
7459   int __pyx_lineno = 0;
7460   const char *__pyx_filename = NULL;
7461   int __pyx_clineno = 0;
7462   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
7463 
7464   /* "(tree fragment)":17
7465  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7466  * def __setstate_cython__(self, __pyx_state):
7467  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
7468  */
7469   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(2, 17, __pyx_L1_error)
7470   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
7471   __Pyx_GOTREF(__pyx_t_1);
7472   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7473 
7474   /* "(tree fragment)":16
7475  *     else:
7476  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7477  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7478  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
7479  */
7480 
7481   /* function exit code */
7482   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7483   goto __pyx_L0;
7484   __pyx_L1_error:;
7485   __Pyx_XDECREF(__pyx_t_1);
7486   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7487   __pyx_r = NULL;
7488   __pyx_L0:;
7489   __Pyx_XGIVEREF(__pyx_r);
7490   __Pyx_RefNannyFinishContext();
7491   return __pyx_r;
7492 }
7493 
7494 /* "View.MemoryView":298
7495  *
7496  * @cname('__pyx_align_pointer')
7497  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
7498  *     "Align pointer memory on a given boundary"
7499  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
7500  */
7501 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)7502 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
7503   Py_intptr_t __pyx_v_aligned_p;
7504   size_t __pyx_v_offset;
7505   void *__pyx_r;
7506   int __pyx_t_1;
7507 
7508   /* "View.MemoryView":300
7509  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
7510  *     "Align pointer memory on a given boundary"
7511  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
7512  *     cdef size_t offset
7513  *
7514  */
7515   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
7516 
7517   /* "View.MemoryView":304
7518  *
7519  *     with cython.cdivision(True):
7520  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
7521  *
7522  *     if offset > 0:
7523  */
7524   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
7525 
7526   /* "View.MemoryView":306
7527  *         offset = aligned_p % alignment
7528  *
7529  *     if offset > 0:             # <<<<<<<<<<<<<<
7530  *         aligned_p += alignment - offset
7531  *
7532  */
7533   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
7534   if (__pyx_t_1) {
7535 
7536     /* "View.MemoryView":307
7537  *
7538  *     if offset > 0:
7539  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
7540  *
7541  *     return <void *> aligned_p
7542  */
7543     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
7544 
7545     /* "View.MemoryView":306
7546  *         offset = aligned_p % alignment
7547  *
7548  *     if offset > 0:             # <<<<<<<<<<<<<<
7549  *         aligned_p += alignment - offset
7550  *
7551  */
7552   }
7553 
7554   /* "View.MemoryView":309
7555  *         aligned_p += alignment - offset
7556  *
7557  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
7558  *
7559  *
7560  */
7561   __pyx_r = ((void *)__pyx_v_aligned_p);
7562   goto __pyx_L0;
7563 
7564   /* "View.MemoryView":298
7565  *
7566  * @cname('__pyx_align_pointer')
7567  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
7568  *     "Align pointer memory on a given boundary"
7569  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
7570  */
7571 
7572   /* function exit code */
7573   __pyx_L0:;
7574   return __pyx_r;
7575 }
7576 
7577 /* "View.MemoryView":345
7578  *     cdef __Pyx_TypeInfo *typeinfo
7579  *
7580  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
7581  *         self.obj = obj
7582  *         self.flags = flags
7583  */
7584 
7585 /* Python wrapper */
7586 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7587 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7588   PyObject *__pyx_v_obj = 0;
7589   int __pyx_v_flags;
7590   int __pyx_v_dtype_is_object;
7591   int __pyx_lineno = 0;
7592   const char *__pyx_filename = NULL;
7593   int __pyx_clineno = 0;
7594   int __pyx_r;
7595   __Pyx_RefNannyDeclarations
7596   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7597   {
7598     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
7599     PyObject* values[3] = {0,0,0};
7600     if (unlikely(__pyx_kwds)) {
7601       Py_ssize_t kw_args;
7602       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7603       switch (pos_args) {
7604         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7605         CYTHON_FALLTHROUGH;
7606         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7607         CYTHON_FALLTHROUGH;
7608         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7609         CYTHON_FALLTHROUGH;
7610         case  0: break;
7611         default: goto __pyx_L5_argtuple_error;
7612       }
7613       kw_args = PyDict_Size(__pyx_kwds);
7614       switch (pos_args) {
7615         case  0:
7616         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
7617         else goto __pyx_L5_argtuple_error;
7618         CYTHON_FALLTHROUGH;
7619         case  1:
7620         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
7621         else {
7622           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
7623         }
7624         CYTHON_FALLTHROUGH;
7625         case  2:
7626         if (kw_args > 0) {
7627           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
7628           if (value) { values[2] = value; kw_args--; }
7629         }
7630       }
7631       if (unlikely(kw_args > 0)) {
7632         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
7633       }
7634     } else {
7635       switch (PyTuple_GET_SIZE(__pyx_args)) {
7636         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7637         CYTHON_FALLTHROUGH;
7638         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7639         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7640         break;
7641         default: goto __pyx_L5_argtuple_error;
7642       }
7643     }
7644     __pyx_v_obj = values[0];
7645     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
7646     if (values[2]) {
7647       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
7648     } else {
7649       __pyx_v_dtype_is_object = ((int)0);
7650     }
7651   }
7652   goto __pyx_L4_argument_unpacking_done;
7653   __pyx_L5_argtuple_error:;
7654   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
7655   __pyx_L3_error:;
7656   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7657   __Pyx_RefNannyFinishContext();
7658   return -1;
7659   __pyx_L4_argument_unpacking_done:;
7660   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
7661 
7662   /* function exit code */
7663   __Pyx_RefNannyFinishContext();
7664   return __pyx_r;
7665 }
7666 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj,int __pyx_v_flags,int __pyx_v_dtype_is_object)7667 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
7668   int __pyx_r;
7669   __Pyx_RefNannyDeclarations
7670   int __pyx_t_1;
7671   int __pyx_t_2;
7672   int __pyx_t_3;
7673   int __pyx_t_4;
7674   int __pyx_lineno = 0;
7675   const char *__pyx_filename = NULL;
7676   int __pyx_clineno = 0;
7677   __Pyx_RefNannySetupContext("__cinit__", 0);
7678 
7679   /* "View.MemoryView":346
7680  *
7681  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
7682  *         self.obj = obj             # <<<<<<<<<<<<<<
7683  *         self.flags = flags
7684  *         if type(self) is memoryview or obj is not None:
7685  */
7686   __Pyx_INCREF(__pyx_v_obj);
7687   __Pyx_GIVEREF(__pyx_v_obj);
7688   __Pyx_GOTREF(__pyx_v_self->obj);
7689   __Pyx_DECREF(__pyx_v_self->obj);
7690   __pyx_v_self->obj = __pyx_v_obj;
7691 
7692   /* "View.MemoryView":347
7693  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
7694  *         self.obj = obj
7695  *         self.flags = flags             # <<<<<<<<<<<<<<
7696  *         if type(self) is memoryview or obj is not None:
7697  *             __Pyx_GetBuffer(obj, &self.view, flags)
7698  */
7699   __pyx_v_self->flags = __pyx_v_flags;
7700 
7701   /* "View.MemoryView":348
7702  *         self.obj = obj
7703  *         self.flags = flags
7704  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
7705  *             __Pyx_GetBuffer(obj, &self.view, flags)
7706  *             if <PyObject *> self.view.obj == NULL:
7707  */
7708   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
7709   __pyx_t_3 = (__pyx_t_2 != 0);
7710   if (!__pyx_t_3) {
7711   } else {
7712     __pyx_t_1 = __pyx_t_3;
7713     goto __pyx_L4_bool_binop_done;
7714   }
7715   __pyx_t_3 = (__pyx_v_obj != Py_None);
7716   __pyx_t_2 = (__pyx_t_3 != 0);
7717   __pyx_t_1 = __pyx_t_2;
7718   __pyx_L4_bool_binop_done:;
7719   if (__pyx_t_1) {
7720 
7721     /* "View.MemoryView":349
7722  *         self.flags = flags
7723  *         if type(self) is memoryview or obj is not None:
7724  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
7725  *             if <PyObject *> self.view.obj == NULL:
7726  *                 (<__pyx_buffer *> &self.view).obj = Py_None
7727  */
7728     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
7729 
7730     /* "View.MemoryView":350
7731  *         if type(self) is memoryview or obj is not None:
7732  *             __Pyx_GetBuffer(obj, &self.view, flags)
7733  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
7734  *                 (<__pyx_buffer *> &self.view).obj = Py_None
7735  *                 Py_INCREF(Py_None)
7736  */
7737     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
7738     if (__pyx_t_1) {
7739 
7740       /* "View.MemoryView":351
7741  *             __Pyx_GetBuffer(obj, &self.view, flags)
7742  *             if <PyObject *> self.view.obj == NULL:
7743  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
7744  *                 Py_INCREF(Py_None)
7745  *
7746  */
7747       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
7748 
7749       /* "View.MemoryView":352
7750  *             if <PyObject *> self.view.obj == NULL:
7751  *                 (<__pyx_buffer *> &self.view).obj = Py_None
7752  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
7753  *
7754  *         global __pyx_memoryview_thread_locks_used
7755  */
7756       Py_INCREF(Py_None);
7757 
7758       /* "View.MemoryView":350
7759  *         if type(self) is memoryview or obj is not None:
7760  *             __Pyx_GetBuffer(obj, &self.view, flags)
7761  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
7762  *                 (<__pyx_buffer *> &self.view).obj = Py_None
7763  *                 Py_INCREF(Py_None)
7764  */
7765     }
7766 
7767     /* "View.MemoryView":348
7768  *         self.obj = obj
7769  *         self.flags = flags
7770  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
7771  *             __Pyx_GetBuffer(obj, &self.view, flags)
7772  *             if <PyObject *> self.view.obj == NULL:
7773  */
7774   }
7775 
7776   /* "View.MemoryView":355
7777  *
7778  *         global __pyx_memoryview_thread_locks_used
7779  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
7780  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7781  *             __pyx_memoryview_thread_locks_used += 1
7782  */
7783   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
7784   if (__pyx_t_1) {
7785 
7786     /* "View.MemoryView":356
7787  *         global __pyx_memoryview_thread_locks_used
7788  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
7789  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
7790  *             __pyx_memoryview_thread_locks_used += 1
7791  *         if self.lock is NULL:
7792  */
7793     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
7794 
7795     /* "View.MemoryView":357
7796  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
7797  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7798  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
7799  *         if self.lock is NULL:
7800  *             self.lock = PyThread_allocate_lock()
7801  */
7802     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
7803 
7804     /* "View.MemoryView":355
7805  *
7806  *         global __pyx_memoryview_thread_locks_used
7807  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
7808  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7809  *             __pyx_memoryview_thread_locks_used += 1
7810  */
7811   }
7812 
7813   /* "View.MemoryView":358
7814  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7815  *             __pyx_memoryview_thread_locks_used += 1
7816  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
7817  *             self.lock = PyThread_allocate_lock()
7818  *             if self.lock is NULL:
7819  */
7820   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7821   if (__pyx_t_1) {
7822 
7823     /* "View.MemoryView":359
7824  *             __pyx_memoryview_thread_locks_used += 1
7825  *         if self.lock is NULL:
7826  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
7827  *             if self.lock is NULL:
7828  *                 raise MemoryError
7829  */
7830     __pyx_v_self->lock = PyThread_allocate_lock();
7831 
7832     /* "View.MemoryView":360
7833  *         if self.lock is NULL:
7834  *             self.lock = PyThread_allocate_lock()
7835  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
7836  *                 raise MemoryError
7837  *
7838  */
7839     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7840     if (unlikely(__pyx_t_1)) {
7841 
7842       /* "View.MemoryView":361
7843  *             self.lock = PyThread_allocate_lock()
7844  *             if self.lock is NULL:
7845  *                 raise MemoryError             # <<<<<<<<<<<<<<
7846  *
7847  *         if flags & PyBUF_FORMAT:
7848  */
7849       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
7850 
7851       /* "View.MemoryView":360
7852  *         if self.lock is NULL:
7853  *             self.lock = PyThread_allocate_lock()
7854  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
7855  *                 raise MemoryError
7856  *
7857  */
7858     }
7859 
7860     /* "View.MemoryView":358
7861  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7862  *             __pyx_memoryview_thread_locks_used += 1
7863  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
7864  *             self.lock = PyThread_allocate_lock()
7865  *             if self.lock is NULL:
7866  */
7867   }
7868 
7869   /* "View.MemoryView":363
7870  *                 raise MemoryError
7871  *
7872  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7873  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
7874  *         else:
7875  */
7876   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7877   if (__pyx_t_1) {
7878 
7879     /* "View.MemoryView":364
7880  *
7881  *         if flags & PyBUF_FORMAT:
7882  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
7883  *         else:
7884  *             self.dtype_is_object = dtype_is_object
7885  */
7886     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
7887     if (__pyx_t_2) {
7888     } else {
7889       __pyx_t_1 = __pyx_t_2;
7890       goto __pyx_L11_bool_binop_done;
7891     }
7892     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
7893     __pyx_t_1 = __pyx_t_2;
7894     __pyx_L11_bool_binop_done:;
7895     __pyx_v_self->dtype_is_object = __pyx_t_1;
7896 
7897     /* "View.MemoryView":363
7898  *                 raise MemoryError
7899  *
7900  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7901  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
7902  *         else:
7903  */
7904     goto __pyx_L10;
7905   }
7906 
7907   /* "View.MemoryView":366
7908  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
7909  *         else:
7910  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
7911  *
7912  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
7913  */
7914   /*else*/ {
7915     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
7916   }
7917   __pyx_L10:;
7918 
7919   /* "View.MemoryView":368
7920  *             self.dtype_is_object = dtype_is_object
7921  *
7922  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
7923  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
7924  *         self.typeinfo = NULL
7925  */
7926   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
7927 
7928   /* "View.MemoryView":370
7929  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
7930  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
7931  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
7932  *
7933  *     def __dealloc__(memoryview self):
7934  */
7935   __pyx_v_self->typeinfo = NULL;
7936 
7937   /* "View.MemoryView":345
7938  *     cdef __Pyx_TypeInfo *typeinfo
7939  *
7940  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
7941  *         self.obj = obj
7942  *         self.flags = flags
7943  */
7944 
7945   /* function exit code */
7946   __pyx_r = 0;
7947   goto __pyx_L0;
7948   __pyx_L1_error:;
7949   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7950   __pyx_r = -1;
7951   __pyx_L0:;
7952   __Pyx_RefNannyFinishContext();
7953   return __pyx_r;
7954 }
7955 
7956 /* "View.MemoryView":372
7957  *         self.typeinfo = NULL
7958  *
7959  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
7960  *         if self.obj is not None:
7961  *             __Pyx_ReleaseBuffer(&self.view)
7962  */
7963 
7964 /* Python wrapper */
7965 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)7966 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
7967   __Pyx_RefNannyDeclarations
7968   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7969   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7970 
7971   /* function exit code */
7972   __Pyx_RefNannyFinishContext();
7973 }
7974 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)7975 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
7976   int __pyx_v_i;
7977   __Pyx_RefNannyDeclarations
7978   int __pyx_t_1;
7979   int __pyx_t_2;
7980   int __pyx_t_3;
7981   int __pyx_t_4;
7982   int __pyx_t_5;
7983   PyThread_type_lock __pyx_t_6;
7984   PyThread_type_lock __pyx_t_7;
7985   __Pyx_RefNannySetupContext("__dealloc__", 0);
7986 
7987   /* "View.MemoryView":373
7988  *
7989  *     def __dealloc__(memoryview self):
7990  *         if self.obj is not None:             # <<<<<<<<<<<<<<
7991  *             __Pyx_ReleaseBuffer(&self.view)
7992  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
7993  */
7994   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
7995   __pyx_t_2 = (__pyx_t_1 != 0);
7996   if (__pyx_t_2) {
7997 
7998     /* "View.MemoryView":374
7999  *     def __dealloc__(memoryview self):
8000  *         if self.obj is not None:
8001  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
8002  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8003  *
8004  */
8005     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
8006 
8007     /* "View.MemoryView":373
8008  *
8009  *     def __dealloc__(memoryview self):
8010  *         if self.obj is not None:             # <<<<<<<<<<<<<<
8011  *             __Pyx_ReleaseBuffer(&self.view)
8012  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8013  */
8014     goto __pyx_L3;
8015   }
8016 
8017   /* "View.MemoryView":375
8018  *         if self.obj is not None:
8019  *             __Pyx_ReleaseBuffer(&self.view)
8020  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
8021  *
8022  *             (<__pyx_buffer *> &self.view).obj = NULL
8023  */
8024   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
8025   if (__pyx_t_2) {
8026 
8027     /* "View.MemoryView":377
8028  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8029  *
8030  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
8031  *             Py_DECREF(Py_None)
8032  *
8033  */
8034     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
8035 
8036     /* "View.MemoryView":378
8037  *
8038  *             (<__pyx_buffer *> &self.view).obj = NULL
8039  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
8040  *
8041  *         cdef int i
8042  */
8043     Py_DECREF(Py_None);
8044 
8045     /* "View.MemoryView":375
8046  *         if self.obj is not None:
8047  *             __Pyx_ReleaseBuffer(&self.view)
8048  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
8049  *
8050  *             (<__pyx_buffer *> &self.view).obj = NULL
8051  */
8052   }
8053   __pyx_L3:;
8054 
8055   /* "View.MemoryView":382
8056  *         cdef int i
8057  *         global __pyx_memoryview_thread_locks_used
8058  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
8059  *             for i in range(__pyx_memoryview_thread_locks_used):
8060  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8061  */
8062   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
8063   if (__pyx_t_2) {
8064 
8065     /* "View.MemoryView":383
8066  *         global __pyx_memoryview_thread_locks_used
8067  *         if self.lock != NULL:
8068  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
8069  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8070  *                     __pyx_memoryview_thread_locks_used -= 1
8071  */
8072     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
8073     __pyx_t_4 = __pyx_t_3;
8074     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
8075       __pyx_v_i = __pyx_t_5;
8076 
8077       /* "View.MemoryView":384
8078  *         if self.lock != NULL:
8079  *             for i in range(__pyx_memoryview_thread_locks_used):
8080  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
8081  *                     __pyx_memoryview_thread_locks_used -= 1
8082  *                     if i != __pyx_memoryview_thread_locks_used:
8083  */
8084       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
8085       if (__pyx_t_2) {
8086 
8087         /* "View.MemoryView":385
8088  *             for i in range(__pyx_memoryview_thread_locks_used):
8089  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8090  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
8091  *                     if i != __pyx_memoryview_thread_locks_used:
8092  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8093  */
8094         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
8095 
8096         /* "View.MemoryView":386
8097  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8098  *                     __pyx_memoryview_thread_locks_used -= 1
8099  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
8100  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8101  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8102  */
8103         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
8104         if (__pyx_t_2) {
8105 
8106           /* "View.MemoryView":388
8107  *                     if i != __pyx_memoryview_thread_locks_used:
8108  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8109  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
8110  *                     break
8111  *             else:
8112  */
8113           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8114           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
8115 
8116           /* "View.MemoryView":387
8117  *                     __pyx_memoryview_thread_locks_used -= 1
8118  *                     if i != __pyx_memoryview_thread_locks_used:
8119  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
8120  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8121  *                     break
8122  */
8123           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
8124           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
8125 
8126           /* "View.MemoryView":386
8127  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8128  *                     __pyx_memoryview_thread_locks_used -= 1
8129  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
8130  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8131  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8132  */
8133         }
8134 
8135         /* "View.MemoryView":389
8136  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8137  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8138  *                     break             # <<<<<<<<<<<<<<
8139  *             else:
8140  *                 PyThread_free_lock(self.lock)
8141  */
8142         goto __pyx_L6_break;
8143 
8144         /* "View.MemoryView":384
8145  *         if self.lock != NULL:
8146  *             for i in range(__pyx_memoryview_thread_locks_used):
8147  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
8148  *                     __pyx_memoryview_thread_locks_used -= 1
8149  *                     if i != __pyx_memoryview_thread_locks_used:
8150  */
8151       }
8152     }
8153     /*else*/ {
8154 
8155       /* "View.MemoryView":391
8156  *                     break
8157  *             else:
8158  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
8159  *
8160  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
8161  */
8162       PyThread_free_lock(__pyx_v_self->lock);
8163     }
8164     __pyx_L6_break:;
8165 
8166     /* "View.MemoryView":382
8167  *         cdef int i
8168  *         global __pyx_memoryview_thread_locks_used
8169  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
8170  *             for i in range(__pyx_memoryview_thread_locks_used):
8171  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8172  */
8173   }
8174 
8175   /* "View.MemoryView":372
8176  *         self.typeinfo = NULL
8177  *
8178  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
8179  *         if self.obj is not None:
8180  *             __Pyx_ReleaseBuffer(&self.view)
8181  */
8182 
8183   /* function exit code */
8184   __Pyx_RefNannyFinishContext();
8185 }
8186 
8187 /* "View.MemoryView":393
8188  *                 PyThread_free_lock(self.lock)
8189  *
8190  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
8191  *         cdef Py_ssize_t dim
8192  *         cdef char *itemp = <char *> self.view.buf
8193  */
8194 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)8195 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8196   Py_ssize_t __pyx_v_dim;
8197   char *__pyx_v_itemp;
8198   PyObject *__pyx_v_idx = NULL;
8199   char *__pyx_r;
8200   __Pyx_RefNannyDeclarations
8201   Py_ssize_t __pyx_t_1;
8202   PyObject *__pyx_t_2 = NULL;
8203   Py_ssize_t __pyx_t_3;
8204   PyObject *(*__pyx_t_4)(PyObject *);
8205   PyObject *__pyx_t_5 = NULL;
8206   Py_ssize_t __pyx_t_6;
8207   char *__pyx_t_7;
8208   int __pyx_lineno = 0;
8209   const char *__pyx_filename = NULL;
8210   int __pyx_clineno = 0;
8211   __Pyx_RefNannySetupContext("get_item_pointer", 0);
8212 
8213   /* "View.MemoryView":395
8214  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
8215  *         cdef Py_ssize_t dim
8216  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
8217  *
8218  *         for dim, idx in enumerate(index):
8219  */
8220   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
8221 
8222   /* "View.MemoryView":397
8223  *         cdef char *itemp = <char *> self.view.buf
8224  *
8225  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
8226  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8227  *
8228  */
8229   __pyx_t_1 = 0;
8230   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
8231     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
8232     __pyx_t_4 = NULL;
8233   } else {
8234     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
8235     __Pyx_GOTREF(__pyx_t_2);
8236     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
8237   }
8238   for (;;) {
8239     if (likely(!__pyx_t_4)) {
8240       if (likely(PyList_CheckExact(__pyx_t_2))) {
8241         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
8242         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8243         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
8244         #else
8245         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
8246         __Pyx_GOTREF(__pyx_t_5);
8247         #endif
8248       } else {
8249         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
8250         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8251         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
8252         #else
8253         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
8254         __Pyx_GOTREF(__pyx_t_5);
8255         #endif
8256       }
8257     } else {
8258       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
8259       if (unlikely(!__pyx_t_5)) {
8260         PyObject* exc_type = PyErr_Occurred();
8261         if (exc_type) {
8262           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8263           else __PYX_ERR(2, 397, __pyx_L1_error)
8264         }
8265         break;
8266       }
8267       __Pyx_GOTREF(__pyx_t_5);
8268     }
8269     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
8270     __pyx_t_5 = 0;
8271     __pyx_v_dim = __pyx_t_1;
8272     __pyx_t_1 = (__pyx_t_1 + 1);
8273 
8274     /* "View.MemoryView":398
8275  *
8276  *         for dim, idx in enumerate(index):
8277  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
8278  *
8279  *         return itemp
8280  */
8281     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
8282     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
8283     __pyx_v_itemp = __pyx_t_7;
8284 
8285     /* "View.MemoryView":397
8286  *         cdef char *itemp = <char *> self.view.buf
8287  *
8288  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
8289  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8290  *
8291  */
8292   }
8293   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8294 
8295   /* "View.MemoryView":400
8296  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8297  *
8298  *         return itemp             # <<<<<<<<<<<<<<
8299  *
8300  *
8301  */
8302   __pyx_r = __pyx_v_itemp;
8303   goto __pyx_L0;
8304 
8305   /* "View.MemoryView":393
8306  *                 PyThread_free_lock(self.lock)
8307  *
8308  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
8309  *         cdef Py_ssize_t dim
8310  *         cdef char *itemp = <char *> self.view.buf
8311  */
8312 
8313   /* function exit code */
8314   __pyx_L1_error:;
8315   __Pyx_XDECREF(__pyx_t_2);
8316   __Pyx_XDECREF(__pyx_t_5);
8317   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8318   __pyx_r = NULL;
8319   __pyx_L0:;
8320   __Pyx_XDECREF(__pyx_v_idx);
8321   __Pyx_RefNannyFinishContext();
8322   return __pyx_r;
8323 }
8324 
8325 /* "View.MemoryView":403
8326  *
8327  *
8328  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
8329  *         if index is Ellipsis:
8330  *             return self
8331  */
8332 
8333 /* Python wrapper */
8334 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)8335 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
8336   PyObject *__pyx_r = 0;
8337   __Pyx_RefNannyDeclarations
8338   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
8339   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
8340 
8341   /* function exit code */
8342   __Pyx_RefNannyFinishContext();
8343   return __pyx_r;
8344 }
8345 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)8346 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8347   PyObject *__pyx_v_have_slices = NULL;
8348   PyObject *__pyx_v_indices = NULL;
8349   char *__pyx_v_itemp;
8350   PyObject *__pyx_r = NULL;
8351   __Pyx_RefNannyDeclarations
8352   int __pyx_t_1;
8353   int __pyx_t_2;
8354   PyObject *__pyx_t_3 = NULL;
8355   PyObject *__pyx_t_4 = NULL;
8356   PyObject *__pyx_t_5 = NULL;
8357   char *__pyx_t_6;
8358   int __pyx_lineno = 0;
8359   const char *__pyx_filename = NULL;
8360   int __pyx_clineno = 0;
8361   __Pyx_RefNannySetupContext("__getitem__", 0);
8362 
8363   /* "View.MemoryView":404
8364  *
8365  *     def __getitem__(memoryview self, object index):
8366  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
8367  *             return self
8368  *
8369  */
8370   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
8371   __pyx_t_2 = (__pyx_t_1 != 0);
8372   if (__pyx_t_2) {
8373 
8374     /* "View.MemoryView":405
8375  *     def __getitem__(memoryview self, object index):
8376  *         if index is Ellipsis:
8377  *             return self             # <<<<<<<<<<<<<<
8378  *
8379  *         have_slices, indices = _unellipsify(index, self.view.ndim)
8380  */
8381     __Pyx_XDECREF(__pyx_r);
8382     __Pyx_INCREF(((PyObject *)__pyx_v_self));
8383     __pyx_r = ((PyObject *)__pyx_v_self);
8384     goto __pyx_L0;
8385 
8386     /* "View.MemoryView":404
8387  *
8388  *     def __getitem__(memoryview self, object index):
8389  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
8390  *             return self
8391  *
8392  */
8393   }
8394 
8395   /* "View.MemoryView":407
8396  *             return self
8397  *
8398  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
8399  *
8400  *         cdef char *itemp
8401  */
8402   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
8403   __Pyx_GOTREF(__pyx_t_3);
8404   if (likely(__pyx_t_3 != Py_None)) {
8405     PyObject* sequence = __pyx_t_3;
8406     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8407     if (unlikely(size != 2)) {
8408       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8409       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8410       __PYX_ERR(2, 407, __pyx_L1_error)
8411     }
8412     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8413     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
8414     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
8415     __Pyx_INCREF(__pyx_t_4);
8416     __Pyx_INCREF(__pyx_t_5);
8417     #else
8418     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
8419     __Pyx_GOTREF(__pyx_t_4);
8420     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
8421     __Pyx_GOTREF(__pyx_t_5);
8422     #endif
8423     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8424   } else {
8425     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
8426   }
8427   __pyx_v_have_slices = __pyx_t_4;
8428   __pyx_t_4 = 0;
8429   __pyx_v_indices = __pyx_t_5;
8430   __pyx_t_5 = 0;
8431 
8432   /* "View.MemoryView":410
8433  *
8434  *         cdef char *itemp
8435  *         if have_slices:             # <<<<<<<<<<<<<<
8436  *             return memview_slice(self, indices)
8437  *         else:
8438  */
8439   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
8440   if (__pyx_t_2) {
8441 
8442     /* "View.MemoryView":411
8443  *         cdef char *itemp
8444  *         if have_slices:
8445  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
8446  *         else:
8447  *             itemp = self.get_item_pointer(indices)
8448  */
8449     __Pyx_XDECREF(__pyx_r);
8450     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
8451     __Pyx_GOTREF(__pyx_t_3);
8452     __pyx_r = __pyx_t_3;
8453     __pyx_t_3 = 0;
8454     goto __pyx_L0;
8455 
8456     /* "View.MemoryView":410
8457  *
8458  *         cdef char *itemp
8459  *         if have_slices:             # <<<<<<<<<<<<<<
8460  *             return memview_slice(self, indices)
8461  *         else:
8462  */
8463   }
8464 
8465   /* "View.MemoryView":413
8466  *             return memview_slice(self, indices)
8467  *         else:
8468  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
8469  *             return self.convert_item_to_object(itemp)
8470  *
8471  */
8472   /*else*/ {
8473     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
8474     __pyx_v_itemp = __pyx_t_6;
8475 
8476     /* "View.MemoryView":414
8477  *         else:
8478  *             itemp = self.get_item_pointer(indices)
8479  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
8480  *
8481  *     def __setitem__(memoryview self, object index, object value):
8482  */
8483     __Pyx_XDECREF(__pyx_r);
8484     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
8485     __Pyx_GOTREF(__pyx_t_3);
8486     __pyx_r = __pyx_t_3;
8487     __pyx_t_3 = 0;
8488     goto __pyx_L0;
8489   }
8490 
8491   /* "View.MemoryView":403
8492  *
8493  *
8494  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
8495  *         if index is Ellipsis:
8496  *             return self
8497  */
8498 
8499   /* function exit code */
8500   __pyx_L1_error:;
8501   __Pyx_XDECREF(__pyx_t_3);
8502   __Pyx_XDECREF(__pyx_t_4);
8503   __Pyx_XDECREF(__pyx_t_5);
8504   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8505   __pyx_r = NULL;
8506   __pyx_L0:;
8507   __Pyx_XDECREF(__pyx_v_have_slices);
8508   __Pyx_XDECREF(__pyx_v_indices);
8509   __Pyx_XGIVEREF(__pyx_r);
8510   __Pyx_RefNannyFinishContext();
8511   return __pyx_r;
8512 }
8513 
8514 /* "View.MemoryView":416
8515  *             return self.convert_item_to_object(itemp)
8516  *
8517  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
8518  *         if self.view.readonly:
8519  *             raise TypeError("Cannot assign to read-only memoryview")
8520  */
8521 
8522 /* Python wrapper */
8523 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)8524 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8525   int __pyx_r;
8526   __Pyx_RefNannyDeclarations
8527   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
8528   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
8529 
8530   /* function exit code */
8531   __Pyx_RefNannyFinishContext();
8532   return __pyx_r;
8533 }
8534 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)8535 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8536   PyObject *__pyx_v_have_slices = NULL;
8537   PyObject *__pyx_v_obj = NULL;
8538   int __pyx_r;
8539   __Pyx_RefNannyDeclarations
8540   int __pyx_t_1;
8541   PyObject *__pyx_t_2 = NULL;
8542   PyObject *__pyx_t_3 = NULL;
8543   PyObject *__pyx_t_4 = NULL;
8544   int __pyx_lineno = 0;
8545   const char *__pyx_filename = NULL;
8546   int __pyx_clineno = 0;
8547   __Pyx_RefNannySetupContext("__setitem__", 0);
8548   __Pyx_INCREF(__pyx_v_index);
8549 
8550   /* "View.MemoryView":417
8551  *
8552  *     def __setitem__(memoryview self, object index, object value):
8553  *         if self.view.readonly:             # <<<<<<<<<<<<<<
8554  *             raise TypeError("Cannot assign to read-only memoryview")
8555  *
8556  */
8557   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
8558   if (unlikely(__pyx_t_1)) {
8559 
8560     /* "View.MemoryView":418
8561  *     def __setitem__(memoryview self, object index, object value):
8562  *         if self.view.readonly:
8563  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
8564  *
8565  *         have_slices, index = _unellipsify(index, self.view.ndim)
8566  */
8567     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
8568     __Pyx_GOTREF(__pyx_t_2);
8569     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8570     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8571     __PYX_ERR(2, 418, __pyx_L1_error)
8572 
8573     /* "View.MemoryView":417
8574  *
8575  *     def __setitem__(memoryview self, object index, object value):
8576  *         if self.view.readonly:             # <<<<<<<<<<<<<<
8577  *             raise TypeError("Cannot assign to read-only memoryview")
8578  *
8579  */
8580   }
8581 
8582   /* "View.MemoryView":420
8583  *             raise TypeError("Cannot assign to read-only memoryview")
8584  *
8585  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
8586  *
8587  *         if have_slices:
8588  */
8589   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
8590   __Pyx_GOTREF(__pyx_t_2);
8591   if (likely(__pyx_t_2 != Py_None)) {
8592     PyObject* sequence = __pyx_t_2;
8593     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8594     if (unlikely(size != 2)) {
8595       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8596       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8597       __PYX_ERR(2, 420, __pyx_L1_error)
8598     }
8599     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8600     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
8601     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
8602     __Pyx_INCREF(__pyx_t_3);
8603     __Pyx_INCREF(__pyx_t_4);
8604     #else
8605     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
8606     __Pyx_GOTREF(__pyx_t_3);
8607     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
8608     __Pyx_GOTREF(__pyx_t_4);
8609     #endif
8610     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8611   } else {
8612     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
8613   }
8614   __pyx_v_have_slices = __pyx_t_3;
8615   __pyx_t_3 = 0;
8616   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
8617   __pyx_t_4 = 0;
8618 
8619   /* "View.MemoryView":422
8620  *         have_slices, index = _unellipsify(index, self.view.ndim)
8621  *
8622  *         if have_slices:             # <<<<<<<<<<<<<<
8623  *             obj = self.is_slice(value)
8624  *             if obj:
8625  */
8626   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
8627   if (__pyx_t_1) {
8628 
8629     /* "View.MemoryView":423
8630  *
8631  *         if have_slices:
8632  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
8633  *             if obj:
8634  *                 self.setitem_slice_assignment(self[index], obj)
8635  */
8636     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
8637     __Pyx_GOTREF(__pyx_t_2);
8638     __pyx_v_obj = __pyx_t_2;
8639     __pyx_t_2 = 0;
8640 
8641     /* "View.MemoryView":424
8642  *         if have_slices:
8643  *             obj = self.is_slice(value)
8644  *             if obj:             # <<<<<<<<<<<<<<
8645  *                 self.setitem_slice_assignment(self[index], obj)
8646  *             else:
8647  */
8648     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
8649     if (__pyx_t_1) {
8650 
8651       /* "View.MemoryView":425
8652  *             obj = self.is_slice(value)
8653  *             if obj:
8654  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
8655  *             else:
8656  *                 self.setitem_slice_assign_scalar(self[index], value)
8657  */
8658       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
8659       __Pyx_GOTREF(__pyx_t_2);
8660       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
8661       __Pyx_GOTREF(__pyx_t_4);
8662       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8663       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8664 
8665       /* "View.MemoryView":424
8666  *         if have_slices:
8667  *             obj = self.is_slice(value)
8668  *             if obj:             # <<<<<<<<<<<<<<
8669  *                 self.setitem_slice_assignment(self[index], obj)
8670  *             else:
8671  */
8672       goto __pyx_L5;
8673     }
8674 
8675     /* "View.MemoryView":427
8676  *                 self.setitem_slice_assignment(self[index], obj)
8677  *             else:
8678  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
8679  *         else:
8680  *             self.setitem_indexed(index, value)
8681  */
8682     /*else*/ {
8683       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
8684       __Pyx_GOTREF(__pyx_t_4);
8685       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
8686       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
8687       __Pyx_GOTREF(__pyx_t_2);
8688       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8689       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8690     }
8691     __pyx_L5:;
8692 
8693     /* "View.MemoryView":422
8694  *         have_slices, index = _unellipsify(index, self.view.ndim)
8695  *
8696  *         if have_slices:             # <<<<<<<<<<<<<<
8697  *             obj = self.is_slice(value)
8698  *             if obj:
8699  */
8700     goto __pyx_L4;
8701   }
8702 
8703   /* "View.MemoryView":429
8704  *                 self.setitem_slice_assign_scalar(self[index], value)
8705  *         else:
8706  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
8707  *
8708  *     cdef is_slice(self, obj):
8709  */
8710   /*else*/ {
8711     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
8712     __Pyx_GOTREF(__pyx_t_2);
8713     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8714   }
8715   __pyx_L4:;
8716 
8717   /* "View.MemoryView":416
8718  *             return self.convert_item_to_object(itemp)
8719  *
8720  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
8721  *         if self.view.readonly:
8722  *             raise TypeError("Cannot assign to read-only memoryview")
8723  */
8724 
8725   /* function exit code */
8726   __pyx_r = 0;
8727   goto __pyx_L0;
8728   __pyx_L1_error:;
8729   __Pyx_XDECREF(__pyx_t_2);
8730   __Pyx_XDECREF(__pyx_t_3);
8731   __Pyx_XDECREF(__pyx_t_4);
8732   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8733   __pyx_r = -1;
8734   __pyx_L0:;
8735   __Pyx_XDECREF(__pyx_v_have_slices);
8736   __Pyx_XDECREF(__pyx_v_obj);
8737   __Pyx_XDECREF(__pyx_v_index);
8738   __Pyx_RefNannyFinishContext();
8739   return __pyx_r;
8740 }
8741 
8742 /* "View.MemoryView":431
8743  *             self.setitem_indexed(index, value)
8744  *
8745  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
8746  *         if not isinstance(obj, memoryview):
8747  *             try:
8748  */
8749 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)8750 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
8751   PyObject *__pyx_r = NULL;
8752   __Pyx_RefNannyDeclarations
8753   int __pyx_t_1;
8754   int __pyx_t_2;
8755   PyObject *__pyx_t_3 = NULL;
8756   PyObject *__pyx_t_4 = NULL;
8757   PyObject *__pyx_t_5 = NULL;
8758   PyObject *__pyx_t_6 = NULL;
8759   PyObject *__pyx_t_7 = NULL;
8760   PyObject *__pyx_t_8 = NULL;
8761   int __pyx_t_9;
8762   int __pyx_lineno = 0;
8763   const char *__pyx_filename = NULL;
8764   int __pyx_clineno = 0;
8765   __Pyx_RefNannySetupContext("is_slice", 0);
8766   __Pyx_INCREF(__pyx_v_obj);
8767 
8768   /* "View.MemoryView":432
8769  *
8770  *     cdef is_slice(self, obj):
8771  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
8772  *             try:
8773  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8774  */
8775   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
8776   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
8777   if (__pyx_t_2) {
8778 
8779     /* "View.MemoryView":433
8780  *     cdef is_slice(self, obj):
8781  *         if not isinstance(obj, memoryview):
8782  *             try:             # <<<<<<<<<<<<<<
8783  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8784  *                                  self.dtype_is_object)
8785  */
8786     {
8787       __Pyx_PyThreadState_declare
8788       __Pyx_PyThreadState_assign
8789       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
8790       __Pyx_XGOTREF(__pyx_t_3);
8791       __Pyx_XGOTREF(__pyx_t_4);
8792       __Pyx_XGOTREF(__pyx_t_5);
8793       /*try:*/ {
8794 
8795         /* "View.MemoryView":434
8796  *         if not isinstance(obj, memoryview):
8797  *             try:
8798  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
8799  *                                  self.dtype_is_object)
8800  *             except TypeError:
8801  */
8802         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
8803         __Pyx_GOTREF(__pyx_t_6);
8804 
8805         /* "View.MemoryView":435
8806  *             try:
8807  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8808  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
8809  *             except TypeError:
8810  *                 return None
8811  */
8812         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
8813         __Pyx_GOTREF(__pyx_t_7);
8814 
8815         /* "View.MemoryView":434
8816  *         if not isinstance(obj, memoryview):
8817  *             try:
8818  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
8819  *                                  self.dtype_is_object)
8820  *             except TypeError:
8821  */
8822         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
8823         __Pyx_GOTREF(__pyx_t_8);
8824         __Pyx_INCREF(__pyx_v_obj);
8825         __Pyx_GIVEREF(__pyx_v_obj);
8826         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
8827         __Pyx_GIVEREF(__pyx_t_6);
8828         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
8829         __Pyx_GIVEREF(__pyx_t_7);
8830         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
8831         __pyx_t_6 = 0;
8832         __pyx_t_7 = 0;
8833         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
8834         __Pyx_GOTREF(__pyx_t_7);
8835         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8836         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
8837         __pyx_t_7 = 0;
8838 
8839         /* "View.MemoryView":433
8840  *     cdef is_slice(self, obj):
8841  *         if not isinstance(obj, memoryview):
8842  *             try:             # <<<<<<<<<<<<<<
8843  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8844  *                                  self.dtype_is_object)
8845  */
8846       }
8847       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8848       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8849       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8850       goto __pyx_L9_try_end;
8851       __pyx_L4_error:;
8852       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8853       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8854       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8855 
8856       /* "View.MemoryView":436
8857  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8858  *                                  self.dtype_is_object)
8859  *             except TypeError:             # <<<<<<<<<<<<<<
8860  *                 return None
8861  *
8862  */
8863       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
8864       if (__pyx_t_9) {
8865         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
8866         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
8867         __Pyx_GOTREF(__pyx_t_7);
8868         __Pyx_GOTREF(__pyx_t_8);
8869         __Pyx_GOTREF(__pyx_t_6);
8870 
8871         /* "View.MemoryView":437
8872  *                                  self.dtype_is_object)
8873  *             except TypeError:
8874  *                 return None             # <<<<<<<<<<<<<<
8875  *
8876  *         return obj
8877  */
8878         __Pyx_XDECREF(__pyx_r);
8879         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8880         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8881         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8882         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8883         goto __pyx_L7_except_return;
8884       }
8885       goto __pyx_L6_except_error;
8886       __pyx_L6_except_error:;
8887 
8888       /* "View.MemoryView":433
8889  *     cdef is_slice(self, obj):
8890  *         if not isinstance(obj, memoryview):
8891  *             try:             # <<<<<<<<<<<<<<
8892  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8893  *                                  self.dtype_is_object)
8894  */
8895       __Pyx_XGIVEREF(__pyx_t_3);
8896       __Pyx_XGIVEREF(__pyx_t_4);
8897       __Pyx_XGIVEREF(__pyx_t_5);
8898       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
8899       goto __pyx_L1_error;
8900       __pyx_L7_except_return:;
8901       __Pyx_XGIVEREF(__pyx_t_3);
8902       __Pyx_XGIVEREF(__pyx_t_4);
8903       __Pyx_XGIVEREF(__pyx_t_5);
8904       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
8905       goto __pyx_L0;
8906       __pyx_L9_try_end:;
8907     }
8908 
8909     /* "View.MemoryView":432
8910  *
8911  *     cdef is_slice(self, obj):
8912  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
8913  *             try:
8914  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8915  */
8916   }
8917 
8918   /* "View.MemoryView":439
8919  *                 return None
8920  *
8921  *         return obj             # <<<<<<<<<<<<<<
8922  *
8923  *     cdef setitem_slice_assignment(self, dst, src):
8924  */
8925   __Pyx_XDECREF(__pyx_r);
8926   __Pyx_INCREF(__pyx_v_obj);
8927   __pyx_r = __pyx_v_obj;
8928   goto __pyx_L0;
8929 
8930   /* "View.MemoryView":431
8931  *             self.setitem_indexed(index, value)
8932  *
8933  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
8934  *         if not isinstance(obj, memoryview):
8935  *             try:
8936  */
8937 
8938   /* function exit code */
8939   __pyx_L1_error:;
8940   __Pyx_XDECREF(__pyx_t_6);
8941   __Pyx_XDECREF(__pyx_t_7);
8942   __Pyx_XDECREF(__pyx_t_8);
8943   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
8944   __pyx_r = 0;
8945   __pyx_L0:;
8946   __Pyx_XDECREF(__pyx_v_obj);
8947   __Pyx_XGIVEREF(__pyx_r);
8948   __Pyx_RefNannyFinishContext();
8949   return __pyx_r;
8950 }
8951 
8952 /* "View.MemoryView":441
8953  *         return obj
8954  *
8955  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
8956  *         cdef __Pyx_memviewslice dst_slice
8957  *         cdef __Pyx_memviewslice src_slice
8958  */
8959 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)8960 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
8961   __Pyx_memviewslice __pyx_v_dst_slice;
8962   __Pyx_memviewslice __pyx_v_src_slice;
8963   PyObject *__pyx_r = NULL;
8964   __Pyx_RefNannyDeclarations
8965   __Pyx_memviewslice *__pyx_t_1;
8966   __Pyx_memviewslice *__pyx_t_2;
8967   PyObject *__pyx_t_3 = NULL;
8968   int __pyx_t_4;
8969   int __pyx_t_5;
8970   int __pyx_t_6;
8971   int __pyx_lineno = 0;
8972   const char *__pyx_filename = NULL;
8973   int __pyx_clineno = 0;
8974   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
8975 
8976   /* "View.MemoryView":445
8977  *         cdef __Pyx_memviewslice src_slice
8978  *
8979  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
8980  *                                  get_slice_from_memview(dst, &dst_slice)[0],
8981  *                                  src.ndim, dst.ndim, self.dtype_is_object)
8982  */
8983   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
8984   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
8985 
8986   /* "View.MemoryView":446
8987  *
8988  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
8989  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
8990  *                                  src.ndim, dst.ndim, self.dtype_is_object)
8991  *
8992  */
8993   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
8994   __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
8995 
8996   /* "View.MemoryView":447
8997  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
8998  *                                  get_slice_from_memview(dst, &dst_slice)[0],
8999  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
9000  *
9001  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9002  */
9003   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9004   __Pyx_GOTREF(__pyx_t_3);
9005   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9006   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9007   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9008   __Pyx_GOTREF(__pyx_t_3);
9009   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9010   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9011 
9012   /* "View.MemoryView":445
9013  *         cdef __Pyx_memviewslice src_slice
9014  *
9015  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
9016  *                                  get_slice_from_memview(dst, &dst_slice)[0],
9017  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9018  */
9019   __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
9020 
9021   /* "View.MemoryView":441
9022  *         return obj
9023  *
9024  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
9025  *         cdef __Pyx_memviewslice dst_slice
9026  *         cdef __Pyx_memviewslice src_slice
9027  */
9028 
9029   /* function exit code */
9030   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9031   goto __pyx_L0;
9032   __pyx_L1_error:;
9033   __Pyx_XDECREF(__pyx_t_3);
9034   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
9035   __pyx_r = 0;
9036   __pyx_L0:;
9037   __Pyx_XGIVEREF(__pyx_r);
9038   __Pyx_RefNannyFinishContext();
9039   return __pyx_r;
9040 }
9041 
9042 /* "View.MemoryView":449
9043  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9044  *
9045  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
9046  *         cdef int array[128]
9047  *         cdef void *tmp = NULL
9048  */
9049 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)9050 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
9051   int __pyx_v_array[0x80];
9052   void *__pyx_v_tmp;
9053   void *__pyx_v_item;
9054   __Pyx_memviewslice *__pyx_v_dst_slice;
9055   __Pyx_memviewslice __pyx_v_tmp_slice;
9056   PyObject *__pyx_r = NULL;
9057   __Pyx_RefNannyDeclarations
9058   __Pyx_memviewslice *__pyx_t_1;
9059   int __pyx_t_2;
9060   PyObject *__pyx_t_3 = NULL;
9061   int __pyx_t_4;
9062   int __pyx_t_5;
9063   char const *__pyx_t_6;
9064   PyObject *__pyx_t_7 = NULL;
9065   PyObject *__pyx_t_8 = NULL;
9066   PyObject *__pyx_t_9 = NULL;
9067   PyObject *__pyx_t_10 = NULL;
9068   PyObject *__pyx_t_11 = NULL;
9069   PyObject *__pyx_t_12 = NULL;
9070   int __pyx_lineno = 0;
9071   const char *__pyx_filename = NULL;
9072   int __pyx_clineno = 0;
9073   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
9074 
9075   /* "View.MemoryView":451
9076  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9077  *         cdef int array[128]
9078  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
9079  *         cdef void *item
9080  *
9081  */
9082   __pyx_v_tmp = NULL;
9083 
9084   /* "View.MemoryView":456
9085  *         cdef __Pyx_memviewslice *dst_slice
9086  *         cdef __Pyx_memviewslice tmp_slice
9087  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
9088  *
9089  *         if <size_t>self.view.itemsize > sizeof(array):
9090  */
9091   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
9092   __pyx_v_dst_slice = __pyx_t_1;
9093 
9094   /* "View.MemoryView":458
9095  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
9096  *
9097  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
9098  *             tmp = PyMem_Malloc(self.view.itemsize)
9099  *             if tmp == NULL:
9100  */
9101   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
9102   if (__pyx_t_2) {
9103 
9104     /* "View.MemoryView":459
9105  *
9106  *         if <size_t>self.view.itemsize > sizeof(array):
9107  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
9108  *             if tmp == NULL:
9109  *                 raise MemoryError
9110  */
9111     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
9112 
9113     /* "View.MemoryView":460
9114  *         if <size_t>self.view.itemsize > sizeof(array):
9115  *             tmp = PyMem_Malloc(self.view.itemsize)
9116  *             if tmp == NULL:             # <<<<<<<<<<<<<<
9117  *                 raise MemoryError
9118  *             item = tmp
9119  */
9120     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
9121     if (unlikely(__pyx_t_2)) {
9122 
9123       /* "View.MemoryView":461
9124  *             tmp = PyMem_Malloc(self.view.itemsize)
9125  *             if tmp == NULL:
9126  *                 raise MemoryError             # <<<<<<<<<<<<<<
9127  *             item = tmp
9128  *         else:
9129  */
9130       PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
9131 
9132       /* "View.MemoryView":460
9133  *         if <size_t>self.view.itemsize > sizeof(array):
9134  *             tmp = PyMem_Malloc(self.view.itemsize)
9135  *             if tmp == NULL:             # <<<<<<<<<<<<<<
9136  *                 raise MemoryError
9137  *             item = tmp
9138  */
9139     }
9140 
9141     /* "View.MemoryView":462
9142  *             if tmp == NULL:
9143  *                 raise MemoryError
9144  *             item = tmp             # <<<<<<<<<<<<<<
9145  *         else:
9146  *             item = <void *> array
9147  */
9148     __pyx_v_item = __pyx_v_tmp;
9149 
9150     /* "View.MemoryView":458
9151  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
9152  *
9153  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
9154  *             tmp = PyMem_Malloc(self.view.itemsize)
9155  *             if tmp == NULL:
9156  */
9157     goto __pyx_L3;
9158   }
9159 
9160   /* "View.MemoryView":464
9161  *             item = tmp
9162  *         else:
9163  *             item = <void *> array             # <<<<<<<<<<<<<<
9164  *
9165  *         try:
9166  */
9167   /*else*/ {
9168     __pyx_v_item = ((void *)__pyx_v_array);
9169   }
9170   __pyx_L3:;
9171 
9172   /* "View.MemoryView":466
9173  *             item = <void *> array
9174  *
9175  *         try:             # <<<<<<<<<<<<<<
9176  *             if self.dtype_is_object:
9177  *                 (<PyObject **> item)[0] = <PyObject *> value
9178  */
9179   /*try:*/ {
9180 
9181     /* "View.MemoryView":467
9182  *
9183  *         try:
9184  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9185  *                 (<PyObject **> item)[0] = <PyObject *> value
9186  *             else:
9187  */
9188     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
9189     if (__pyx_t_2) {
9190 
9191       /* "View.MemoryView":468
9192  *         try:
9193  *             if self.dtype_is_object:
9194  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
9195  *             else:
9196  *                 self.assign_item_from_object(<char *> item, value)
9197  */
9198       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
9199 
9200       /* "View.MemoryView":467
9201  *
9202  *         try:
9203  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9204  *                 (<PyObject **> item)[0] = <PyObject *> value
9205  *             else:
9206  */
9207       goto __pyx_L8;
9208     }
9209 
9210     /* "View.MemoryView":470
9211  *                 (<PyObject **> item)[0] = <PyObject *> value
9212  *             else:
9213  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
9214  *
9215  *
9216  */
9217     /*else*/ {
9218       __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
9219       __Pyx_GOTREF(__pyx_t_3);
9220       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9221     }
9222     __pyx_L8:;
9223 
9224     /* "View.MemoryView":474
9225  *
9226  *
9227  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
9228  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9229  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9230  */
9231     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
9232     if (__pyx_t_2) {
9233 
9234       /* "View.MemoryView":475
9235  *
9236  *             if self.view.suboffsets != NULL:
9237  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
9238  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9239  *                                 item, self.dtype_is_object)
9240  */
9241       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
9242       __Pyx_GOTREF(__pyx_t_3);
9243       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9244 
9245       /* "View.MemoryView":474
9246  *
9247  *
9248  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
9249  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9250  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9251  */
9252     }
9253 
9254     /* "View.MemoryView":476
9255  *             if self.view.suboffsets != NULL:
9256  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9257  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
9258  *                                 item, self.dtype_is_object)
9259  *         finally:
9260  */
9261     __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
9262   }
9263 
9264   /* "View.MemoryView":479
9265  *                                 item, self.dtype_is_object)
9266  *         finally:
9267  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
9268  *
9269  *     cdef setitem_indexed(self, index, value):
9270  */
9271   /*finally:*/ {
9272     /*normal exit:*/{
9273       PyMem_Free(__pyx_v_tmp);
9274       goto __pyx_L7;
9275     }
9276     __pyx_L6_error:;
9277     /*exception exit:*/{
9278       __Pyx_PyThreadState_declare
9279       __Pyx_PyThreadState_assign
9280       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9281       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9282       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
9283       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
9284       __Pyx_XGOTREF(__pyx_t_7);
9285       __Pyx_XGOTREF(__pyx_t_8);
9286       __Pyx_XGOTREF(__pyx_t_9);
9287       __Pyx_XGOTREF(__pyx_t_10);
9288       __Pyx_XGOTREF(__pyx_t_11);
9289       __Pyx_XGOTREF(__pyx_t_12);
9290       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
9291       {
9292         PyMem_Free(__pyx_v_tmp);
9293       }
9294       if (PY_MAJOR_VERSION >= 3) {
9295         __Pyx_XGIVEREF(__pyx_t_10);
9296         __Pyx_XGIVEREF(__pyx_t_11);
9297         __Pyx_XGIVEREF(__pyx_t_12);
9298         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
9299       }
9300       __Pyx_XGIVEREF(__pyx_t_7);
9301       __Pyx_XGIVEREF(__pyx_t_8);
9302       __Pyx_XGIVEREF(__pyx_t_9);
9303       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
9304       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9305       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
9306       goto __pyx_L1_error;
9307     }
9308     __pyx_L7:;
9309   }
9310 
9311   /* "View.MemoryView":449
9312  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9313  *
9314  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
9315  *         cdef int array[128]
9316  *         cdef void *tmp = NULL
9317  */
9318 
9319   /* function exit code */
9320   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9321   goto __pyx_L0;
9322   __pyx_L1_error:;
9323   __Pyx_XDECREF(__pyx_t_3);
9324   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
9325   __pyx_r = 0;
9326   __pyx_L0:;
9327   __Pyx_XGIVEREF(__pyx_r);
9328   __Pyx_RefNannyFinishContext();
9329   return __pyx_r;
9330 }
9331 
9332 /* "View.MemoryView":481
9333  *             PyMem_Free(tmp)
9334  *
9335  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
9336  *         cdef char *itemp = self.get_item_pointer(index)
9337  *         self.assign_item_from_object(itemp, value)
9338  */
9339 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)9340 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9341   char *__pyx_v_itemp;
9342   PyObject *__pyx_r = NULL;
9343   __Pyx_RefNannyDeclarations
9344   char *__pyx_t_1;
9345   PyObject *__pyx_t_2 = NULL;
9346   int __pyx_lineno = 0;
9347   const char *__pyx_filename = NULL;
9348   int __pyx_clineno = 0;
9349   __Pyx_RefNannySetupContext("setitem_indexed", 0);
9350 
9351   /* "View.MemoryView":482
9352  *
9353  *     cdef setitem_indexed(self, index, value):
9354  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
9355  *         self.assign_item_from_object(itemp, value)
9356  *
9357  */
9358   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
9359   __pyx_v_itemp = __pyx_t_1;
9360 
9361   /* "View.MemoryView":483
9362  *     cdef setitem_indexed(self, index, value):
9363  *         cdef char *itemp = self.get_item_pointer(index)
9364  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
9365  *
9366  *     cdef convert_item_to_object(self, char *itemp):
9367  */
9368   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
9369   __Pyx_GOTREF(__pyx_t_2);
9370   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9371 
9372   /* "View.MemoryView":481
9373  *             PyMem_Free(tmp)
9374  *
9375  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
9376  *         cdef char *itemp = self.get_item_pointer(index)
9377  *         self.assign_item_from_object(itemp, value)
9378  */
9379 
9380   /* function exit code */
9381   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9382   goto __pyx_L0;
9383   __pyx_L1_error:;
9384   __Pyx_XDECREF(__pyx_t_2);
9385   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
9386   __pyx_r = 0;
9387   __pyx_L0:;
9388   __Pyx_XGIVEREF(__pyx_r);
9389   __Pyx_RefNannyFinishContext();
9390   return __pyx_r;
9391 }
9392 
9393 /* "View.MemoryView":485
9394  *         self.assign_item_from_object(itemp, value)
9395  *
9396  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
9397  *         """Only used if instantiated manually by the user, or if Cython doesn't
9398  *         know how to convert the type"""
9399  */
9400 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)9401 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
9402   PyObject *__pyx_v_struct = NULL;
9403   PyObject *__pyx_v_bytesitem = 0;
9404   PyObject *__pyx_v_result = NULL;
9405   PyObject *__pyx_r = NULL;
9406   __Pyx_RefNannyDeclarations
9407   PyObject *__pyx_t_1 = NULL;
9408   PyObject *__pyx_t_2 = NULL;
9409   PyObject *__pyx_t_3 = NULL;
9410   PyObject *__pyx_t_4 = NULL;
9411   PyObject *__pyx_t_5 = NULL;
9412   PyObject *__pyx_t_6 = NULL;
9413   PyObject *__pyx_t_7 = NULL;
9414   int __pyx_t_8;
9415   PyObject *__pyx_t_9 = NULL;
9416   size_t __pyx_t_10;
9417   int __pyx_t_11;
9418   int __pyx_lineno = 0;
9419   const char *__pyx_filename = NULL;
9420   int __pyx_clineno = 0;
9421   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
9422 
9423   /* "View.MemoryView":488
9424  *         """Only used if instantiated manually by the user, or if Cython doesn't
9425  *         know how to convert the type"""
9426  *         import struct             # <<<<<<<<<<<<<<
9427  *         cdef bytes bytesitem
9428  *
9429  */
9430   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
9431   __Pyx_GOTREF(__pyx_t_1);
9432   __pyx_v_struct = __pyx_t_1;
9433   __pyx_t_1 = 0;
9434 
9435   /* "View.MemoryView":491
9436  *         cdef bytes bytesitem
9437  *
9438  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
9439  *         try:
9440  *             result = struct.unpack(self.view.format, bytesitem)
9441  */
9442   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
9443   __Pyx_GOTREF(__pyx_t_1);
9444   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
9445   __pyx_t_1 = 0;
9446 
9447   /* "View.MemoryView":492
9448  *
9449  *         bytesitem = itemp[:self.view.itemsize]
9450  *         try:             # <<<<<<<<<<<<<<
9451  *             result = struct.unpack(self.view.format, bytesitem)
9452  *         except struct.error:
9453  */
9454   {
9455     __Pyx_PyThreadState_declare
9456     __Pyx_PyThreadState_assign
9457     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
9458     __Pyx_XGOTREF(__pyx_t_2);
9459     __Pyx_XGOTREF(__pyx_t_3);
9460     __Pyx_XGOTREF(__pyx_t_4);
9461     /*try:*/ {
9462 
9463       /* "View.MemoryView":493
9464  *         bytesitem = itemp[:self.view.itemsize]
9465  *         try:
9466  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
9467  *         except struct.error:
9468  *             raise ValueError("Unable to convert item to object")
9469  */
9470       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
9471       __Pyx_GOTREF(__pyx_t_5);
9472       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
9473       __Pyx_GOTREF(__pyx_t_6);
9474       __pyx_t_7 = NULL;
9475       __pyx_t_8 = 0;
9476       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9477         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9478         if (likely(__pyx_t_7)) {
9479           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9480           __Pyx_INCREF(__pyx_t_7);
9481           __Pyx_INCREF(function);
9482           __Pyx_DECREF_SET(__pyx_t_5, function);
9483           __pyx_t_8 = 1;
9484         }
9485       }
9486       #if CYTHON_FAST_PYCALL
9487       if (PyFunction_Check(__pyx_t_5)) {
9488         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9489         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
9490         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9491         __Pyx_GOTREF(__pyx_t_1);
9492         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9493       } else
9494       #endif
9495       #if CYTHON_FAST_PYCCALL
9496       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9497         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9498         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
9499         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9500         __Pyx_GOTREF(__pyx_t_1);
9501         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9502       } else
9503       #endif
9504       {
9505         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
9506         __Pyx_GOTREF(__pyx_t_9);
9507         if (__pyx_t_7) {
9508           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
9509         }
9510         __Pyx_GIVEREF(__pyx_t_6);
9511         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
9512         __Pyx_INCREF(__pyx_v_bytesitem);
9513         __Pyx_GIVEREF(__pyx_v_bytesitem);
9514         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
9515         __pyx_t_6 = 0;
9516         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
9517         __Pyx_GOTREF(__pyx_t_1);
9518         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9519       }
9520       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9521       __pyx_v_result = __pyx_t_1;
9522       __pyx_t_1 = 0;
9523 
9524       /* "View.MemoryView":492
9525  *
9526  *         bytesitem = itemp[:self.view.itemsize]
9527  *         try:             # <<<<<<<<<<<<<<
9528  *             result = struct.unpack(self.view.format, bytesitem)
9529  *         except struct.error:
9530  */
9531     }
9532 
9533     /* "View.MemoryView":497
9534  *             raise ValueError("Unable to convert item to object")
9535  *         else:
9536  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
9537  *                 return result[0]
9538  *             return result
9539  */
9540     /*else:*/ {
9541       __pyx_t_10 = strlen(__pyx_v_self->view.format);
9542       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
9543       if (__pyx_t_11) {
9544 
9545         /* "View.MemoryView":498
9546  *         else:
9547  *             if len(self.view.format) == 1:
9548  *                 return result[0]             # <<<<<<<<<<<<<<
9549  *             return result
9550  *
9551  */
9552         __Pyx_XDECREF(__pyx_r);
9553         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
9554         __Pyx_GOTREF(__pyx_t_1);
9555         __pyx_r = __pyx_t_1;
9556         __pyx_t_1 = 0;
9557         goto __pyx_L6_except_return;
9558 
9559         /* "View.MemoryView":497
9560  *             raise ValueError("Unable to convert item to object")
9561  *         else:
9562  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
9563  *                 return result[0]
9564  *             return result
9565  */
9566       }
9567 
9568       /* "View.MemoryView":499
9569  *             if len(self.view.format) == 1:
9570  *                 return result[0]
9571  *             return result             # <<<<<<<<<<<<<<
9572  *
9573  *     cdef assign_item_from_object(self, char *itemp, object value):
9574  */
9575       __Pyx_XDECREF(__pyx_r);
9576       __Pyx_INCREF(__pyx_v_result);
9577       __pyx_r = __pyx_v_result;
9578       goto __pyx_L6_except_return;
9579     }
9580     __pyx_L3_error:;
9581     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9582     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9583     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9584     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9585     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9586 
9587     /* "View.MemoryView":494
9588  *         try:
9589  *             result = struct.unpack(self.view.format, bytesitem)
9590  *         except struct.error:             # <<<<<<<<<<<<<<
9591  *             raise ValueError("Unable to convert item to object")
9592  *         else:
9593  */
9594     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
9595     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
9596     __Pyx_GOTREF(__pyx_t_6);
9597     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
9598     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9599     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
9600     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
9601     if (__pyx_t_8) {
9602       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9603       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
9604       __Pyx_GOTREF(__pyx_t_9);
9605       __Pyx_GOTREF(__pyx_t_5);
9606       __Pyx_GOTREF(__pyx_t_1);
9607 
9608       /* "View.MemoryView":495
9609  *             result = struct.unpack(self.view.format, bytesitem)
9610  *         except struct.error:
9611  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
9612  *         else:
9613  *             if len(self.view.format) == 1:
9614  */
9615       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
9616       __Pyx_GOTREF(__pyx_t_6);
9617       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
9618       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9619       __PYX_ERR(2, 495, __pyx_L5_except_error)
9620     }
9621     goto __pyx_L5_except_error;
9622     __pyx_L5_except_error:;
9623 
9624     /* "View.MemoryView":492
9625  *
9626  *         bytesitem = itemp[:self.view.itemsize]
9627  *         try:             # <<<<<<<<<<<<<<
9628  *             result = struct.unpack(self.view.format, bytesitem)
9629  *         except struct.error:
9630  */
9631     __Pyx_XGIVEREF(__pyx_t_2);
9632     __Pyx_XGIVEREF(__pyx_t_3);
9633     __Pyx_XGIVEREF(__pyx_t_4);
9634     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9635     goto __pyx_L1_error;
9636     __pyx_L6_except_return:;
9637     __Pyx_XGIVEREF(__pyx_t_2);
9638     __Pyx_XGIVEREF(__pyx_t_3);
9639     __Pyx_XGIVEREF(__pyx_t_4);
9640     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9641     goto __pyx_L0;
9642   }
9643 
9644   /* "View.MemoryView":485
9645  *         self.assign_item_from_object(itemp, value)
9646  *
9647  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
9648  *         """Only used if instantiated manually by the user, or if Cython doesn't
9649  *         know how to convert the type"""
9650  */
9651 
9652   /* function exit code */
9653   __pyx_L1_error:;
9654   __Pyx_XDECREF(__pyx_t_1);
9655   __Pyx_XDECREF(__pyx_t_5);
9656   __Pyx_XDECREF(__pyx_t_6);
9657   __Pyx_XDECREF(__pyx_t_7);
9658   __Pyx_XDECREF(__pyx_t_9);
9659   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9660   __pyx_r = 0;
9661   __pyx_L0:;
9662   __Pyx_XDECREF(__pyx_v_struct);
9663   __Pyx_XDECREF(__pyx_v_bytesitem);
9664   __Pyx_XDECREF(__pyx_v_result);
9665   __Pyx_XGIVEREF(__pyx_r);
9666   __Pyx_RefNannyFinishContext();
9667   return __pyx_r;
9668 }
9669 
9670 /* "View.MemoryView":501
9671  *             return result
9672  *
9673  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
9674  *         """Only used if instantiated manually by the user, or if Cython doesn't
9675  *         know how to convert the type"""
9676  */
9677 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)9678 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
9679   PyObject *__pyx_v_struct = NULL;
9680   char __pyx_v_c;
9681   PyObject *__pyx_v_bytesvalue = 0;
9682   Py_ssize_t __pyx_v_i;
9683   PyObject *__pyx_r = NULL;
9684   __Pyx_RefNannyDeclarations
9685   PyObject *__pyx_t_1 = NULL;
9686   int __pyx_t_2;
9687   int __pyx_t_3;
9688   PyObject *__pyx_t_4 = NULL;
9689   PyObject *__pyx_t_5 = NULL;
9690   PyObject *__pyx_t_6 = NULL;
9691   int __pyx_t_7;
9692   PyObject *__pyx_t_8 = NULL;
9693   Py_ssize_t __pyx_t_9;
9694   PyObject *__pyx_t_10 = NULL;
9695   char *__pyx_t_11;
9696   char *__pyx_t_12;
9697   char *__pyx_t_13;
9698   char *__pyx_t_14;
9699   int __pyx_lineno = 0;
9700   const char *__pyx_filename = NULL;
9701   int __pyx_clineno = 0;
9702   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
9703 
9704   /* "View.MemoryView":504
9705  *         """Only used if instantiated manually by the user, or if Cython doesn't
9706  *         know how to convert the type"""
9707  *         import struct             # <<<<<<<<<<<<<<
9708  *         cdef char c
9709  *         cdef bytes bytesvalue
9710  */
9711   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
9712   __Pyx_GOTREF(__pyx_t_1);
9713   __pyx_v_struct = __pyx_t_1;
9714   __pyx_t_1 = 0;
9715 
9716   /* "View.MemoryView":509
9717  *         cdef Py_ssize_t i
9718  *
9719  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
9720  *             bytesvalue = struct.pack(self.view.format, *value)
9721  *         else:
9722  */
9723   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
9724   __pyx_t_3 = (__pyx_t_2 != 0);
9725   if (__pyx_t_3) {
9726 
9727     /* "View.MemoryView":510
9728  *
9729  *         if isinstance(value, tuple):
9730  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
9731  *         else:
9732  *             bytesvalue = struct.pack(self.view.format, value)
9733  */
9734     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
9735     __Pyx_GOTREF(__pyx_t_1);
9736     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
9737     __Pyx_GOTREF(__pyx_t_4);
9738     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
9739     __Pyx_GOTREF(__pyx_t_5);
9740     __Pyx_GIVEREF(__pyx_t_4);
9741     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9742     __pyx_t_4 = 0;
9743     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
9744     __Pyx_GOTREF(__pyx_t_4);
9745     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
9746     __Pyx_GOTREF(__pyx_t_6);
9747     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9748     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9749     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
9750     __Pyx_GOTREF(__pyx_t_4);
9751     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9752     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9753     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
9754     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9755     __pyx_t_4 = 0;
9756 
9757     /* "View.MemoryView":509
9758  *         cdef Py_ssize_t i
9759  *
9760  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
9761  *             bytesvalue = struct.pack(self.view.format, *value)
9762  *         else:
9763  */
9764     goto __pyx_L3;
9765   }
9766 
9767   /* "View.MemoryView":512
9768  *             bytesvalue = struct.pack(self.view.format, *value)
9769  *         else:
9770  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
9771  *
9772  *         for i, c in enumerate(bytesvalue):
9773  */
9774   /*else*/ {
9775     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
9776     __Pyx_GOTREF(__pyx_t_6);
9777     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
9778     __Pyx_GOTREF(__pyx_t_1);
9779     __pyx_t_5 = NULL;
9780     __pyx_t_7 = 0;
9781     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9782       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9783       if (likely(__pyx_t_5)) {
9784         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9785         __Pyx_INCREF(__pyx_t_5);
9786         __Pyx_INCREF(function);
9787         __Pyx_DECREF_SET(__pyx_t_6, function);
9788         __pyx_t_7 = 1;
9789       }
9790     }
9791     #if CYTHON_FAST_PYCALL
9792     if (PyFunction_Check(__pyx_t_6)) {
9793       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9794       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
9795       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9796       __Pyx_GOTREF(__pyx_t_4);
9797       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9798     } else
9799     #endif
9800     #if CYTHON_FAST_PYCCALL
9801     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9802       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9803       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
9804       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9805       __Pyx_GOTREF(__pyx_t_4);
9806       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9807     } else
9808     #endif
9809     {
9810       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
9811       __Pyx_GOTREF(__pyx_t_8);
9812       if (__pyx_t_5) {
9813         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9814       }
9815       __Pyx_GIVEREF(__pyx_t_1);
9816       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
9817       __Pyx_INCREF(__pyx_v_value);
9818       __Pyx_GIVEREF(__pyx_v_value);
9819       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
9820       __pyx_t_1 = 0;
9821       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
9822       __Pyx_GOTREF(__pyx_t_4);
9823       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9824     }
9825     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9826     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
9827     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9828     __pyx_t_4 = 0;
9829   }
9830   __pyx_L3:;
9831 
9832   /* "View.MemoryView":514
9833  *             bytesvalue = struct.pack(self.view.format, value)
9834  *
9835  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
9836  *             itemp[i] = c
9837  *
9838  */
9839   __pyx_t_9 = 0;
9840   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
9841     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
9842     __PYX_ERR(2, 514, __pyx_L1_error)
9843   }
9844   __Pyx_INCREF(__pyx_v_bytesvalue);
9845   __pyx_t_10 = __pyx_v_bytesvalue;
9846   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
9847   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
9848   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
9849     __pyx_t_11 = __pyx_t_14;
9850     __pyx_v_c = (__pyx_t_11[0]);
9851 
9852     /* "View.MemoryView":515
9853  *
9854  *         for i, c in enumerate(bytesvalue):
9855  *             itemp[i] = c             # <<<<<<<<<<<<<<
9856  *
9857  *     @cname('getbuffer')
9858  */
9859     __pyx_v_i = __pyx_t_9;
9860 
9861     /* "View.MemoryView":514
9862  *             bytesvalue = struct.pack(self.view.format, value)
9863  *
9864  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
9865  *             itemp[i] = c
9866  *
9867  */
9868     __pyx_t_9 = (__pyx_t_9 + 1);
9869 
9870     /* "View.MemoryView":515
9871  *
9872  *         for i, c in enumerate(bytesvalue):
9873  *             itemp[i] = c             # <<<<<<<<<<<<<<
9874  *
9875  *     @cname('getbuffer')
9876  */
9877     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
9878   }
9879   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9880 
9881   /* "View.MemoryView":501
9882  *             return result
9883  *
9884  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
9885  *         """Only used if instantiated manually by the user, or if Cython doesn't
9886  *         know how to convert the type"""
9887  */
9888 
9889   /* function exit code */
9890   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9891   goto __pyx_L0;
9892   __pyx_L1_error:;
9893   __Pyx_XDECREF(__pyx_t_1);
9894   __Pyx_XDECREF(__pyx_t_4);
9895   __Pyx_XDECREF(__pyx_t_5);
9896   __Pyx_XDECREF(__pyx_t_6);
9897   __Pyx_XDECREF(__pyx_t_8);
9898   __Pyx_XDECREF(__pyx_t_10);
9899   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9900   __pyx_r = 0;
9901   __pyx_L0:;
9902   __Pyx_XDECREF(__pyx_v_struct);
9903   __Pyx_XDECREF(__pyx_v_bytesvalue);
9904   __Pyx_XGIVEREF(__pyx_r);
9905   __Pyx_RefNannyFinishContext();
9906   return __pyx_r;
9907 }
9908 
9909 /* "View.MemoryView":518
9910  *
9911  *     @cname('getbuffer')
9912  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
9913  *         if flags & PyBUF_WRITABLE and self.view.readonly:
9914  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
9915  */
9916 
9917 /* Python wrapper */
9918 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)9919 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
9920   int __pyx_r;
9921   __Pyx_RefNannyDeclarations
9922   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
9923   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
9924 
9925   /* function exit code */
9926   __Pyx_RefNannyFinishContext();
9927   return __pyx_r;
9928 }
9929 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)9930 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
9931   int __pyx_r;
9932   __Pyx_RefNannyDeclarations
9933   int __pyx_t_1;
9934   int __pyx_t_2;
9935   PyObject *__pyx_t_3 = NULL;
9936   Py_ssize_t *__pyx_t_4;
9937   char *__pyx_t_5;
9938   void *__pyx_t_6;
9939   int __pyx_t_7;
9940   Py_ssize_t __pyx_t_8;
9941   int __pyx_lineno = 0;
9942   const char *__pyx_filename = NULL;
9943   int __pyx_clineno = 0;
9944   if (__pyx_v_info == NULL) {
9945     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
9946     return -1;
9947   }
9948   __Pyx_RefNannySetupContext("__getbuffer__", 0);
9949   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
9950   __Pyx_GIVEREF(__pyx_v_info->obj);
9951 
9952   /* "View.MemoryView":519
9953  *     @cname('getbuffer')
9954  *     def __getbuffer__(self, Py_buffer *info, int flags):
9955  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
9956  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
9957  *
9958  */
9959   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
9960   if (__pyx_t_2) {
9961   } else {
9962     __pyx_t_1 = __pyx_t_2;
9963     goto __pyx_L4_bool_binop_done;
9964   }
9965   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
9966   __pyx_t_1 = __pyx_t_2;
9967   __pyx_L4_bool_binop_done:;
9968   if (unlikely(__pyx_t_1)) {
9969 
9970     /* "View.MemoryView":520
9971  *     def __getbuffer__(self, Py_buffer *info, int flags):
9972  *         if flags & PyBUF_WRITABLE and self.view.readonly:
9973  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
9974  *
9975  *         if flags & PyBUF_ND:
9976  */
9977     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
9978     __Pyx_GOTREF(__pyx_t_3);
9979     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9980     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9981     __PYX_ERR(2, 520, __pyx_L1_error)
9982 
9983     /* "View.MemoryView":519
9984  *     @cname('getbuffer')
9985  *     def __getbuffer__(self, Py_buffer *info, int flags):
9986  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
9987  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
9988  *
9989  */
9990   }
9991 
9992   /* "View.MemoryView":522
9993  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
9994  *
9995  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
9996  *             info.shape = self.view.shape
9997  *         else:
9998  */
9999   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
10000   if (__pyx_t_1) {
10001 
10002     /* "View.MemoryView":523
10003  *
10004  *         if flags & PyBUF_ND:
10005  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
10006  *         else:
10007  *             info.shape = NULL
10008  */
10009     __pyx_t_4 = __pyx_v_self->view.shape;
10010     __pyx_v_info->shape = __pyx_t_4;
10011 
10012     /* "View.MemoryView":522
10013  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10014  *
10015  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
10016  *             info.shape = self.view.shape
10017  *         else:
10018  */
10019     goto __pyx_L6;
10020   }
10021 
10022   /* "View.MemoryView":525
10023  *             info.shape = self.view.shape
10024  *         else:
10025  *             info.shape = NULL             # <<<<<<<<<<<<<<
10026  *
10027  *         if flags & PyBUF_STRIDES:
10028  */
10029   /*else*/ {
10030     __pyx_v_info->shape = NULL;
10031   }
10032   __pyx_L6:;
10033 
10034   /* "View.MemoryView":527
10035  *             info.shape = NULL
10036  *
10037  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
10038  *             info.strides = self.view.strides
10039  *         else:
10040  */
10041   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
10042   if (__pyx_t_1) {
10043 
10044     /* "View.MemoryView":528
10045  *
10046  *         if flags & PyBUF_STRIDES:
10047  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
10048  *         else:
10049  *             info.strides = NULL
10050  */
10051     __pyx_t_4 = __pyx_v_self->view.strides;
10052     __pyx_v_info->strides = __pyx_t_4;
10053 
10054     /* "View.MemoryView":527
10055  *             info.shape = NULL
10056  *
10057  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
10058  *             info.strides = self.view.strides
10059  *         else:
10060  */
10061     goto __pyx_L7;
10062   }
10063 
10064   /* "View.MemoryView":530
10065  *             info.strides = self.view.strides
10066  *         else:
10067  *             info.strides = NULL             # <<<<<<<<<<<<<<
10068  *
10069  *         if flags & PyBUF_INDIRECT:
10070  */
10071   /*else*/ {
10072     __pyx_v_info->strides = NULL;
10073   }
10074   __pyx_L7:;
10075 
10076   /* "View.MemoryView":532
10077  *             info.strides = NULL
10078  *
10079  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
10080  *             info.suboffsets = self.view.suboffsets
10081  *         else:
10082  */
10083   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
10084   if (__pyx_t_1) {
10085 
10086     /* "View.MemoryView":533
10087  *
10088  *         if flags & PyBUF_INDIRECT:
10089  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
10090  *         else:
10091  *             info.suboffsets = NULL
10092  */
10093     __pyx_t_4 = __pyx_v_self->view.suboffsets;
10094     __pyx_v_info->suboffsets = __pyx_t_4;
10095 
10096     /* "View.MemoryView":532
10097  *             info.strides = NULL
10098  *
10099  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
10100  *             info.suboffsets = self.view.suboffsets
10101  *         else:
10102  */
10103     goto __pyx_L8;
10104   }
10105 
10106   /* "View.MemoryView":535
10107  *             info.suboffsets = self.view.suboffsets
10108  *         else:
10109  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
10110  *
10111  *         if flags & PyBUF_FORMAT:
10112  */
10113   /*else*/ {
10114     __pyx_v_info->suboffsets = NULL;
10115   }
10116   __pyx_L8:;
10117 
10118   /* "View.MemoryView":537
10119  *             info.suboffsets = NULL
10120  *
10121  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10122  *             info.format = self.view.format
10123  *         else:
10124  */
10125   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10126   if (__pyx_t_1) {
10127 
10128     /* "View.MemoryView":538
10129  *
10130  *         if flags & PyBUF_FORMAT:
10131  *             info.format = self.view.format             # <<<<<<<<<<<<<<
10132  *         else:
10133  *             info.format = NULL
10134  */
10135     __pyx_t_5 = __pyx_v_self->view.format;
10136     __pyx_v_info->format = __pyx_t_5;
10137 
10138     /* "View.MemoryView":537
10139  *             info.suboffsets = NULL
10140  *
10141  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10142  *             info.format = self.view.format
10143  *         else:
10144  */
10145     goto __pyx_L9;
10146   }
10147 
10148   /* "View.MemoryView":540
10149  *             info.format = self.view.format
10150  *         else:
10151  *             info.format = NULL             # <<<<<<<<<<<<<<
10152  *
10153  *         info.buf = self.view.buf
10154  */
10155   /*else*/ {
10156     __pyx_v_info->format = NULL;
10157   }
10158   __pyx_L9:;
10159 
10160   /* "View.MemoryView":542
10161  *             info.format = NULL
10162  *
10163  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
10164  *         info.ndim = self.view.ndim
10165  *         info.itemsize = self.view.itemsize
10166  */
10167   __pyx_t_6 = __pyx_v_self->view.buf;
10168   __pyx_v_info->buf = __pyx_t_6;
10169 
10170   /* "View.MemoryView":543
10171  *
10172  *         info.buf = self.view.buf
10173  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
10174  *         info.itemsize = self.view.itemsize
10175  *         info.len = self.view.len
10176  */
10177   __pyx_t_7 = __pyx_v_self->view.ndim;
10178   __pyx_v_info->ndim = __pyx_t_7;
10179 
10180   /* "View.MemoryView":544
10181  *         info.buf = self.view.buf
10182  *         info.ndim = self.view.ndim
10183  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
10184  *         info.len = self.view.len
10185  *         info.readonly = self.view.readonly
10186  */
10187   __pyx_t_8 = __pyx_v_self->view.itemsize;
10188   __pyx_v_info->itemsize = __pyx_t_8;
10189 
10190   /* "View.MemoryView":545
10191  *         info.ndim = self.view.ndim
10192  *         info.itemsize = self.view.itemsize
10193  *         info.len = self.view.len             # <<<<<<<<<<<<<<
10194  *         info.readonly = self.view.readonly
10195  *         info.obj = self
10196  */
10197   __pyx_t_8 = __pyx_v_self->view.len;
10198   __pyx_v_info->len = __pyx_t_8;
10199 
10200   /* "View.MemoryView":546
10201  *         info.itemsize = self.view.itemsize
10202  *         info.len = self.view.len
10203  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
10204  *         info.obj = self
10205  *
10206  */
10207   __pyx_t_1 = __pyx_v_self->view.readonly;
10208   __pyx_v_info->readonly = __pyx_t_1;
10209 
10210   /* "View.MemoryView":547
10211  *         info.len = self.view.len
10212  *         info.readonly = self.view.readonly
10213  *         info.obj = self             # <<<<<<<<<<<<<<
10214  *
10215  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
10216  */
10217   __Pyx_INCREF(((PyObject *)__pyx_v_self));
10218   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10219   __Pyx_GOTREF(__pyx_v_info->obj);
10220   __Pyx_DECREF(__pyx_v_info->obj);
10221   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
10222 
10223   /* "View.MemoryView":518
10224  *
10225  *     @cname('getbuffer')
10226  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
10227  *         if flags & PyBUF_WRITABLE and self.view.readonly:
10228  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10229  */
10230 
10231   /* function exit code */
10232   __pyx_r = 0;
10233   goto __pyx_L0;
10234   __pyx_L1_error:;
10235   __Pyx_XDECREF(__pyx_t_3);
10236   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10237   __pyx_r = -1;
10238   if (__pyx_v_info->obj != NULL) {
10239     __Pyx_GOTREF(__pyx_v_info->obj);
10240     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10241   }
10242   goto __pyx_L2;
10243   __pyx_L0:;
10244   if (__pyx_v_info->obj == Py_None) {
10245     __Pyx_GOTREF(__pyx_v_info->obj);
10246     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10247   }
10248   __pyx_L2:;
10249   __Pyx_RefNannyFinishContext();
10250   return __pyx_r;
10251 }
10252 
10253 /* "View.MemoryView":553
10254  *
10255  *     @property
10256  *     def T(self):             # <<<<<<<<<<<<<<
10257  *         cdef _memoryviewslice result = memoryview_copy(self)
10258  *         transpose_memslice(&result.from_slice)
10259  */
10260 
10261 /* Python wrapper */
10262 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)10263 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
10264   PyObject *__pyx_r = 0;
10265   __Pyx_RefNannyDeclarations
10266   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10267   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10268 
10269   /* function exit code */
10270   __Pyx_RefNannyFinishContext();
10271   return __pyx_r;
10272 }
10273 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)10274 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10275   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
10276   PyObject *__pyx_r = NULL;
10277   __Pyx_RefNannyDeclarations
10278   PyObject *__pyx_t_1 = NULL;
10279   int __pyx_t_2;
10280   int __pyx_lineno = 0;
10281   const char *__pyx_filename = NULL;
10282   int __pyx_clineno = 0;
10283   __Pyx_RefNannySetupContext("__get__", 0);
10284 
10285   /* "View.MemoryView":554
10286  *     @property
10287  *     def T(self):
10288  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
10289  *         transpose_memslice(&result.from_slice)
10290  *         return result
10291  */
10292   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
10293   __Pyx_GOTREF(__pyx_t_1);
10294   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
10295   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
10296   __pyx_t_1 = 0;
10297 
10298   /* "View.MemoryView":555
10299  *     def T(self):
10300  *         cdef _memoryviewslice result = memoryview_copy(self)
10301  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
10302  *         return result
10303  *
10304  */
10305   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
10306 
10307   /* "View.MemoryView":556
10308  *         cdef _memoryviewslice result = memoryview_copy(self)
10309  *         transpose_memslice(&result.from_slice)
10310  *         return result             # <<<<<<<<<<<<<<
10311  *
10312  *     @property
10313  */
10314   __Pyx_XDECREF(__pyx_r);
10315   __Pyx_INCREF(((PyObject *)__pyx_v_result));
10316   __pyx_r = ((PyObject *)__pyx_v_result);
10317   goto __pyx_L0;
10318 
10319   /* "View.MemoryView":553
10320  *
10321  *     @property
10322  *     def T(self):             # <<<<<<<<<<<<<<
10323  *         cdef _memoryviewslice result = memoryview_copy(self)
10324  *         transpose_memslice(&result.from_slice)
10325  */
10326 
10327   /* function exit code */
10328   __pyx_L1_error:;
10329   __Pyx_XDECREF(__pyx_t_1);
10330   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10331   __pyx_r = NULL;
10332   __pyx_L0:;
10333   __Pyx_XDECREF((PyObject *)__pyx_v_result);
10334   __Pyx_XGIVEREF(__pyx_r);
10335   __Pyx_RefNannyFinishContext();
10336   return __pyx_r;
10337 }
10338 
10339 /* "View.MemoryView":559
10340  *
10341  *     @property
10342  *     def base(self):             # <<<<<<<<<<<<<<
10343  *         return self.obj
10344  *
10345  */
10346 
10347 /* Python wrapper */
10348 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)10349 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
10350   PyObject *__pyx_r = 0;
10351   __Pyx_RefNannyDeclarations
10352   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10353   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10354 
10355   /* function exit code */
10356   __Pyx_RefNannyFinishContext();
10357   return __pyx_r;
10358 }
10359 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)10360 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10361   PyObject *__pyx_r = NULL;
10362   __Pyx_RefNannyDeclarations
10363   __Pyx_RefNannySetupContext("__get__", 0);
10364 
10365   /* "View.MemoryView":560
10366  *     @property
10367  *     def base(self):
10368  *         return self.obj             # <<<<<<<<<<<<<<
10369  *
10370  *     @property
10371  */
10372   __Pyx_XDECREF(__pyx_r);
10373   __Pyx_INCREF(__pyx_v_self->obj);
10374   __pyx_r = __pyx_v_self->obj;
10375   goto __pyx_L0;
10376 
10377   /* "View.MemoryView":559
10378  *
10379  *     @property
10380  *     def base(self):             # <<<<<<<<<<<<<<
10381  *         return self.obj
10382  *
10383  */
10384 
10385   /* function exit code */
10386   __pyx_L0:;
10387   __Pyx_XGIVEREF(__pyx_r);
10388   __Pyx_RefNannyFinishContext();
10389   return __pyx_r;
10390 }
10391 
10392 /* "View.MemoryView":563
10393  *
10394  *     @property
10395  *     def shape(self):             # <<<<<<<<<<<<<<
10396  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
10397  *
10398  */
10399 
10400 /* Python wrapper */
10401 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)10402 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
10403   PyObject *__pyx_r = 0;
10404   __Pyx_RefNannyDeclarations
10405   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10406   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10407 
10408   /* function exit code */
10409   __Pyx_RefNannyFinishContext();
10410   return __pyx_r;
10411 }
10412 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)10413 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10414   Py_ssize_t __pyx_v_length;
10415   PyObject *__pyx_r = NULL;
10416   __Pyx_RefNannyDeclarations
10417   PyObject *__pyx_t_1 = NULL;
10418   Py_ssize_t *__pyx_t_2;
10419   Py_ssize_t *__pyx_t_3;
10420   Py_ssize_t *__pyx_t_4;
10421   PyObject *__pyx_t_5 = NULL;
10422   int __pyx_lineno = 0;
10423   const char *__pyx_filename = NULL;
10424   int __pyx_clineno = 0;
10425   __Pyx_RefNannySetupContext("__get__", 0);
10426 
10427   /* "View.MemoryView":564
10428  *     @property
10429  *     def shape(self):
10430  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
10431  *
10432  *     @property
10433  */
10434   __Pyx_XDECREF(__pyx_r);
10435   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
10436   __Pyx_GOTREF(__pyx_t_1);
10437   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
10438   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
10439     __pyx_t_2 = __pyx_t_4;
10440     __pyx_v_length = (__pyx_t_2[0]);
10441     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
10442     __Pyx_GOTREF(__pyx_t_5);
10443     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
10444     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10445   }
10446   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
10447   __Pyx_GOTREF(__pyx_t_5);
10448   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10449   __pyx_r = __pyx_t_5;
10450   __pyx_t_5 = 0;
10451   goto __pyx_L0;
10452 
10453   /* "View.MemoryView":563
10454  *
10455  *     @property
10456  *     def shape(self):             # <<<<<<<<<<<<<<
10457  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
10458  *
10459  */
10460 
10461   /* function exit code */
10462   __pyx_L1_error:;
10463   __Pyx_XDECREF(__pyx_t_1);
10464   __Pyx_XDECREF(__pyx_t_5);
10465   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10466   __pyx_r = NULL;
10467   __pyx_L0:;
10468   __Pyx_XGIVEREF(__pyx_r);
10469   __Pyx_RefNannyFinishContext();
10470   return __pyx_r;
10471 }
10472 
10473 /* "View.MemoryView":567
10474  *
10475  *     @property
10476  *     def strides(self):             # <<<<<<<<<<<<<<
10477  *         if self.view.strides == NULL:
10478  *
10479  */
10480 
10481 /* Python wrapper */
10482 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)10483 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
10484   PyObject *__pyx_r = 0;
10485   __Pyx_RefNannyDeclarations
10486   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10487   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10488 
10489   /* function exit code */
10490   __Pyx_RefNannyFinishContext();
10491   return __pyx_r;
10492 }
10493 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)10494 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10495   Py_ssize_t __pyx_v_stride;
10496   PyObject *__pyx_r = NULL;
10497   __Pyx_RefNannyDeclarations
10498   int __pyx_t_1;
10499   PyObject *__pyx_t_2 = NULL;
10500   Py_ssize_t *__pyx_t_3;
10501   Py_ssize_t *__pyx_t_4;
10502   Py_ssize_t *__pyx_t_5;
10503   PyObject *__pyx_t_6 = NULL;
10504   int __pyx_lineno = 0;
10505   const char *__pyx_filename = NULL;
10506   int __pyx_clineno = 0;
10507   __Pyx_RefNannySetupContext("__get__", 0);
10508 
10509   /* "View.MemoryView":568
10510  *     @property
10511  *     def strides(self):
10512  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
10513  *
10514  *             raise ValueError("Buffer view does not expose strides")
10515  */
10516   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
10517   if (unlikely(__pyx_t_1)) {
10518 
10519     /* "View.MemoryView":570
10520  *         if self.view.strides == NULL:
10521  *
10522  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
10523  *
10524  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
10525  */
10526     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
10527     __Pyx_GOTREF(__pyx_t_2);
10528     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10529     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10530     __PYX_ERR(2, 570, __pyx_L1_error)
10531 
10532     /* "View.MemoryView":568
10533  *     @property
10534  *     def strides(self):
10535  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
10536  *
10537  *             raise ValueError("Buffer view does not expose strides")
10538  */
10539   }
10540 
10541   /* "View.MemoryView":572
10542  *             raise ValueError("Buffer view does not expose strides")
10543  *
10544  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
10545  *
10546  *     @property
10547  */
10548   __Pyx_XDECREF(__pyx_r);
10549   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
10550   __Pyx_GOTREF(__pyx_t_2);
10551   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
10552   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
10553     __pyx_t_3 = __pyx_t_5;
10554     __pyx_v_stride = (__pyx_t_3[0]);
10555     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
10556     __Pyx_GOTREF(__pyx_t_6);
10557     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
10558     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10559   }
10560   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
10561   __Pyx_GOTREF(__pyx_t_6);
10562   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10563   __pyx_r = __pyx_t_6;
10564   __pyx_t_6 = 0;
10565   goto __pyx_L0;
10566 
10567   /* "View.MemoryView":567
10568  *
10569  *     @property
10570  *     def strides(self):             # <<<<<<<<<<<<<<
10571  *         if self.view.strides == NULL:
10572  *
10573  */
10574 
10575   /* function exit code */
10576   __pyx_L1_error:;
10577   __Pyx_XDECREF(__pyx_t_2);
10578   __Pyx_XDECREF(__pyx_t_6);
10579   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10580   __pyx_r = NULL;
10581   __pyx_L0:;
10582   __Pyx_XGIVEREF(__pyx_r);
10583   __Pyx_RefNannyFinishContext();
10584   return __pyx_r;
10585 }
10586 
10587 /* "View.MemoryView":575
10588  *
10589  *     @property
10590  *     def suboffsets(self):             # <<<<<<<<<<<<<<
10591  *         if self.view.suboffsets == NULL:
10592  *             return (-1,) * self.view.ndim
10593  */
10594 
10595 /* Python wrapper */
10596 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)10597 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
10598   PyObject *__pyx_r = 0;
10599   __Pyx_RefNannyDeclarations
10600   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10601   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10602 
10603   /* function exit code */
10604   __Pyx_RefNannyFinishContext();
10605   return __pyx_r;
10606 }
10607 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)10608 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10609   Py_ssize_t __pyx_v_suboffset;
10610   PyObject *__pyx_r = NULL;
10611   __Pyx_RefNannyDeclarations
10612   int __pyx_t_1;
10613   PyObject *__pyx_t_2 = NULL;
10614   PyObject *__pyx_t_3 = NULL;
10615   Py_ssize_t *__pyx_t_4;
10616   Py_ssize_t *__pyx_t_5;
10617   Py_ssize_t *__pyx_t_6;
10618   int __pyx_lineno = 0;
10619   const char *__pyx_filename = NULL;
10620   int __pyx_clineno = 0;
10621   __Pyx_RefNannySetupContext("__get__", 0);
10622 
10623   /* "View.MemoryView":576
10624  *     @property
10625  *     def suboffsets(self):
10626  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
10627  *             return (-1,) * self.view.ndim
10628  *
10629  */
10630   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
10631   if (__pyx_t_1) {
10632 
10633     /* "View.MemoryView":577
10634  *     def suboffsets(self):
10635  *         if self.view.suboffsets == NULL:
10636  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
10637  *
10638  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
10639  */
10640     __Pyx_XDECREF(__pyx_r);
10641     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
10642     __Pyx_GOTREF(__pyx_t_2);
10643     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__18, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
10644     __Pyx_GOTREF(__pyx_t_3);
10645     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10646     __pyx_r = __pyx_t_3;
10647     __pyx_t_3 = 0;
10648     goto __pyx_L0;
10649 
10650     /* "View.MemoryView":576
10651  *     @property
10652  *     def suboffsets(self):
10653  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
10654  *             return (-1,) * self.view.ndim
10655  *
10656  */
10657   }
10658 
10659   /* "View.MemoryView":579
10660  *             return (-1,) * self.view.ndim
10661  *
10662  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
10663  *
10664  *     @property
10665  */
10666   __Pyx_XDECREF(__pyx_r);
10667   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
10668   __Pyx_GOTREF(__pyx_t_3);
10669   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
10670   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
10671     __pyx_t_4 = __pyx_t_6;
10672     __pyx_v_suboffset = (__pyx_t_4[0]);
10673     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
10674     __Pyx_GOTREF(__pyx_t_2);
10675     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
10676     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10677   }
10678   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
10679   __Pyx_GOTREF(__pyx_t_2);
10680   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10681   __pyx_r = __pyx_t_2;
10682   __pyx_t_2 = 0;
10683   goto __pyx_L0;
10684 
10685   /* "View.MemoryView":575
10686  *
10687  *     @property
10688  *     def suboffsets(self):             # <<<<<<<<<<<<<<
10689  *         if self.view.suboffsets == NULL:
10690  *             return (-1,) * self.view.ndim
10691  */
10692 
10693   /* function exit code */
10694   __pyx_L1_error:;
10695   __Pyx_XDECREF(__pyx_t_2);
10696   __Pyx_XDECREF(__pyx_t_3);
10697   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10698   __pyx_r = NULL;
10699   __pyx_L0:;
10700   __Pyx_XGIVEREF(__pyx_r);
10701   __Pyx_RefNannyFinishContext();
10702   return __pyx_r;
10703 }
10704 
10705 /* "View.MemoryView":582
10706  *
10707  *     @property
10708  *     def ndim(self):             # <<<<<<<<<<<<<<
10709  *         return self.view.ndim
10710  *
10711  */
10712 
10713 /* Python wrapper */
10714 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)10715 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
10716   PyObject *__pyx_r = 0;
10717   __Pyx_RefNannyDeclarations
10718   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10719   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10720 
10721   /* function exit code */
10722   __Pyx_RefNannyFinishContext();
10723   return __pyx_r;
10724 }
10725 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)10726 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10727   PyObject *__pyx_r = NULL;
10728   __Pyx_RefNannyDeclarations
10729   PyObject *__pyx_t_1 = NULL;
10730   int __pyx_lineno = 0;
10731   const char *__pyx_filename = NULL;
10732   int __pyx_clineno = 0;
10733   __Pyx_RefNannySetupContext("__get__", 0);
10734 
10735   /* "View.MemoryView":583
10736  *     @property
10737  *     def ndim(self):
10738  *         return self.view.ndim             # <<<<<<<<<<<<<<
10739  *
10740  *     @property
10741  */
10742   __Pyx_XDECREF(__pyx_r);
10743   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
10744   __Pyx_GOTREF(__pyx_t_1);
10745   __pyx_r = __pyx_t_1;
10746   __pyx_t_1 = 0;
10747   goto __pyx_L0;
10748 
10749   /* "View.MemoryView":582
10750  *
10751  *     @property
10752  *     def ndim(self):             # <<<<<<<<<<<<<<
10753  *         return self.view.ndim
10754  *
10755  */
10756 
10757   /* function exit code */
10758   __pyx_L1_error:;
10759   __Pyx_XDECREF(__pyx_t_1);
10760   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10761   __pyx_r = NULL;
10762   __pyx_L0:;
10763   __Pyx_XGIVEREF(__pyx_r);
10764   __Pyx_RefNannyFinishContext();
10765   return __pyx_r;
10766 }
10767 
10768 /* "View.MemoryView":586
10769  *
10770  *     @property
10771  *     def itemsize(self):             # <<<<<<<<<<<<<<
10772  *         return self.view.itemsize
10773  *
10774  */
10775 
10776 /* Python wrapper */
10777 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)10778 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
10779   PyObject *__pyx_r = 0;
10780   __Pyx_RefNannyDeclarations
10781   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10782   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10783 
10784   /* function exit code */
10785   __Pyx_RefNannyFinishContext();
10786   return __pyx_r;
10787 }
10788 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)10789 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10790   PyObject *__pyx_r = NULL;
10791   __Pyx_RefNannyDeclarations
10792   PyObject *__pyx_t_1 = NULL;
10793   int __pyx_lineno = 0;
10794   const char *__pyx_filename = NULL;
10795   int __pyx_clineno = 0;
10796   __Pyx_RefNannySetupContext("__get__", 0);
10797 
10798   /* "View.MemoryView":587
10799  *     @property
10800  *     def itemsize(self):
10801  *         return self.view.itemsize             # <<<<<<<<<<<<<<
10802  *
10803  *     @property
10804  */
10805   __Pyx_XDECREF(__pyx_r);
10806   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
10807   __Pyx_GOTREF(__pyx_t_1);
10808   __pyx_r = __pyx_t_1;
10809   __pyx_t_1 = 0;
10810   goto __pyx_L0;
10811 
10812   /* "View.MemoryView":586
10813  *
10814  *     @property
10815  *     def itemsize(self):             # <<<<<<<<<<<<<<
10816  *         return self.view.itemsize
10817  *
10818  */
10819 
10820   /* function exit code */
10821   __pyx_L1_error:;
10822   __Pyx_XDECREF(__pyx_t_1);
10823   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10824   __pyx_r = NULL;
10825   __pyx_L0:;
10826   __Pyx_XGIVEREF(__pyx_r);
10827   __Pyx_RefNannyFinishContext();
10828   return __pyx_r;
10829 }
10830 
10831 /* "View.MemoryView":590
10832  *
10833  *     @property
10834  *     def nbytes(self):             # <<<<<<<<<<<<<<
10835  *         return self.size * self.view.itemsize
10836  *
10837  */
10838 
10839 /* Python wrapper */
10840 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)10841 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
10842   PyObject *__pyx_r = 0;
10843   __Pyx_RefNannyDeclarations
10844   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10845   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10846 
10847   /* function exit code */
10848   __Pyx_RefNannyFinishContext();
10849   return __pyx_r;
10850 }
10851 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)10852 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10853   PyObject *__pyx_r = NULL;
10854   __Pyx_RefNannyDeclarations
10855   PyObject *__pyx_t_1 = NULL;
10856   PyObject *__pyx_t_2 = NULL;
10857   PyObject *__pyx_t_3 = NULL;
10858   int __pyx_lineno = 0;
10859   const char *__pyx_filename = NULL;
10860   int __pyx_clineno = 0;
10861   __Pyx_RefNannySetupContext("__get__", 0);
10862 
10863   /* "View.MemoryView":591
10864  *     @property
10865  *     def nbytes(self):
10866  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
10867  *
10868  *     @property
10869  */
10870   __Pyx_XDECREF(__pyx_r);
10871   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
10872   __Pyx_GOTREF(__pyx_t_1);
10873   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
10874   __Pyx_GOTREF(__pyx_t_2);
10875   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
10876   __Pyx_GOTREF(__pyx_t_3);
10877   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10878   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10879   __pyx_r = __pyx_t_3;
10880   __pyx_t_3 = 0;
10881   goto __pyx_L0;
10882 
10883   /* "View.MemoryView":590
10884  *
10885  *     @property
10886  *     def nbytes(self):             # <<<<<<<<<<<<<<
10887  *         return self.size * self.view.itemsize
10888  *
10889  */
10890 
10891   /* function exit code */
10892   __pyx_L1_error:;
10893   __Pyx_XDECREF(__pyx_t_1);
10894   __Pyx_XDECREF(__pyx_t_2);
10895   __Pyx_XDECREF(__pyx_t_3);
10896   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10897   __pyx_r = NULL;
10898   __pyx_L0:;
10899   __Pyx_XGIVEREF(__pyx_r);
10900   __Pyx_RefNannyFinishContext();
10901   return __pyx_r;
10902 }
10903 
10904 /* "View.MemoryView":594
10905  *
10906  *     @property
10907  *     def size(self):             # <<<<<<<<<<<<<<
10908  *         if self._size is None:
10909  *             result = 1
10910  */
10911 
10912 /* Python wrapper */
10913 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)10914 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
10915   PyObject *__pyx_r = 0;
10916   __Pyx_RefNannyDeclarations
10917   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10918   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10919 
10920   /* function exit code */
10921   __Pyx_RefNannyFinishContext();
10922   return __pyx_r;
10923 }
10924 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)10925 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10926   PyObject *__pyx_v_result = NULL;
10927   PyObject *__pyx_v_length = NULL;
10928   PyObject *__pyx_r = NULL;
10929   __Pyx_RefNannyDeclarations
10930   int __pyx_t_1;
10931   int __pyx_t_2;
10932   Py_ssize_t *__pyx_t_3;
10933   Py_ssize_t *__pyx_t_4;
10934   Py_ssize_t *__pyx_t_5;
10935   PyObject *__pyx_t_6 = NULL;
10936   int __pyx_lineno = 0;
10937   const char *__pyx_filename = NULL;
10938   int __pyx_clineno = 0;
10939   __Pyx_RefNannySetupContext("__get__", 0);
10940 
10941   /* "View.MemoryView":595
10942  *     @property
10943  *     def size(self):
10944  *         if self._size is None:             # <<<<<<<<<<<<<<
10945  *             result = 1
10946  *
10947  */
10948   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
10949   __pyx_t_2 = (__pyx_t_1 != 0);
10950   if (__pyx_t_2) {
10951 
10952     /* "View.MemoryView":596
10953  *     def size(self):
10954  *         if self._size is None:
10955  *             result = 1             # <<<<<<<<<<<<<<
10956  *
10957  *             for length in self.view.shape[:self.view.ndim]:
10958  */
10959     __Pyx_INCREF(__pyx_int_1);
10960     __pyx_v_result = __pyx_int_1;
10961 
10962     /* "View.MemoryView":598
10963  *             result = 1
10964  *
10965  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
10966  *                 result *= length
10967  *
10968  */
10969     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
10970     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
10971       __pyx_t_3 = __pyx_t_5;
10972       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
10973       __Pyx_GOTREF(__pyx_t_6);
10974       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
10975       __pyx_t_6 = 0;
10976 
10977       /* "View.MemoryView":599
10978  *
10979  *             for length in self.view.shape[:self.view.ndim]:
10980  *                 result *= length             # <<<<<<<<<<<<<<
10981  *
10982  *             self._size = result
10983  */
10984       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
10985       __Pyx_GOTREF(__pyx_t_6);
10986       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
10987       __pyx_t_6 = 0;
10988     }
10989 
10990     /* "View.MemoryView":601
10991  *                 result *= length
10992  *
10993  *             self._size = result             # <<<<<<<<<<<<<<
10994  *
10995  *         return self._size
10996  */
10997     __Pyx_INCREF(__pyx_v_result);
10998     __Pyx_GIVEREF(__pyx_v_result);
10999     __Pyx_GOTREF(__pyx_v_self->_size);
11000     __Pyx_DECREF(__pyx_v_self->_size);
11001     __pyx_v_self->_size = __pyx_v_result;
11002 
11003     /* "View.MemoryView":595
11004  *     @property
11005  *     def size(self):
11006  *         if self._size is None:             # <<<<<<<<<<<<<<
11007  *             result = 1
11008  *
11009  */
11010   }
11011 
11012   /* "View.MemoryView":603
11013  *             self._size = result
11014  *
11015  *         return self._size             # <<<<<<<<<<<<<<
11016  *
11017  *     def __len__(self):
11018  */
11019   __Pyx_XDECREF(__pyx_r);
11020   __Pyx_INCREF(__pyx_v_self->_size);
11021   __pyx_r = __pyx_v_self->_size;
11022   goto __pyx_L0;
11023 
11024   /* "View.MemoryView":594
11025  *
11026  *     @property
11027  *     def size(self):             # <<<<<<<<<<<<<<
11028  *         if self._size is None:
11029  *             result = 1
11030  */
11031 
11032   /* function exit code */
11033   __pyx_L1_error:;
11034   __Pyx_XDECREF(__pyx_t_6);
11035   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11036   __pyx_r = NULL;
11037   __pyx_L0:;
11038   __Pyx_XDECREF(__pyx_v_result);
11039   __Pyx_XDECREF(__pyx_v_length);
11040   __Pyx_XGIVEREF(__pyx_r);
11041   __Pyx_RefNannyFinishContext();
11042   return __pyx_r;
11043 }
11044 
11045 /* "View.MemoryView":605
11046  *         return self._size
11047  *
11048  *     def __len__(self):             # <<<<<<<<<<<<<<
11049  *         if self.view.ndim >= 1:
11050  *             return self.view.shape[0]
11051  */
11052 
11053 /* Python wrapper */
11054 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)11055 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
11056   Py_ssize_t __pyx_r;
11057   __Pyx_RefNannyDeclarations
11058   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
11059   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11060 
11061   /* function exit code */
11062   __Pyx_RefNannyFinishContext();
11063   return __pyx_r;
11064 }
11065 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)11066 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
11067   Py_ssize_t __pyx_r;
11068   __Pyx_RefNannyDeclarations
11069   int __pyx_t_1;
11070   __Pyx_RefNannySetupContext("__len__", 0);
11071 
11072   /* "View.MemoryView":606
11073  *
11074  *     def __len__(self):
11075  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
11076  *             return self.view.shape[0]
11077  *
11078  */
11079   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
11080   if (__pyx_t_1) {
11081 
11082     /* "View.MemoryView":607
11083  *     def __len__(self):
11084  *         if self.view.ndim >= 1:
11085  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
11086  *
11087  *         return 0
11088  */
11089     __pyx_r = (__pyx_v_self->view.shape[0]);
11090     goto __pyx_L0;
11091 
11092     /* "View.MemoryView":606
11093  *
11094  *     def __len__(self):
11095  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
11096  *             return self.view.shape[0]
11097  *
11098  */
11099   }
11100 
11101   /* "View.MemoryView":609
11102  *             return self.view.shape[0]
11103  *
11104  *         return 0             # <<<<<<<<<<<<<<
11105  *
11106  *     def __repr__(self):
11107  */
11108   __pyx_r = 0;
11109   goto __pyx_L0;
11110 
11111   /* "View.MemoryView":605
11112  *         return self._size
11113  *
11114  *     def __len__(self):             # <<<<<<<<<<<<<<
11115  *         if self.view.ndim >= 1:
11116  *             return self.view.shape[0]
11117  */
11118 
11119   /* function exit code */
11120   __pyx_L0:;
11121   __Pyx_RefNannyFinishContext();
11122   return __pyx_r;
11123 }
11124 
11125 /* "View.MemoryView":611
11126  *         return 0
11127  *
11128  *     def __repr__(self):             # <<<<<<<<<<<<<<
11129  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11130  *                                                id(self))
11131  */
11132 
11133 /* Python wrapper */
11134 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)11135 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
11136   PyObject *__pyx_r = 0;
11137   __Pyx_RefNannyDeclarations
11138   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
11139   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11140 
11141   /* function exit code */
11142   __Pyx_RefNannyFinishContext();
11143   return __pyx_r;
11144 }
11145 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)11146 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
11147   PyObject *__pyx_r = NULL;
11148   __Pyx_RefNannyDeclarations
11149   PyObject *__pyx_t_1 = NULL;
11150   PyObject *__pyx_t_2 = NULL;
11151   PyObject *__pyx_t_3 = NULL;
11152   int __pyx_lineno = 0;
11153   const char *__pyx_filename = NULL;
11154   int __pyx_clineno = 0;
11155   __Pyx_RefNannySetupContext("__repr__", 0);
11156 
11157   /* "View.MemoryView":612
11158  *
11159  *     def __repr__(self):
11160  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
11161  *                                                id(self))
11162  *
11163  */
11164   __Pyx_XDECREF(__pyx_r);
11165   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
11166   __Pyx_GOTREF(__pyx_t_1);
11167   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
11168   __Pyx_GOTREF(__pyx_t_2);
11169   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11170   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
11171   __Pyx_GOTREF(__pyx_t_1);
11172   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11173 
11174   /* "View.MemoryView":613
11175  *     def __repr__(self):
11176  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11177  *                                                id(self))             # <<<<<<<<<<<<<<
11178  *
11179  *     def __str__(self):
11180  */
11181   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
11182   __Pyx_GOTREF(__pyx_t_2);
11183 
11184   /* "View.MemoryView":612
11185  *
11186  *     def __repr__(self):
11187  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
11188  *                                                id(self))
11189  *
11190  */
11191   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
11192   __Pyx_GOTREF(__pyx_t_3);
11193   __Pyx_GIVEREF(__pyx_t_1);
11194   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
11195   __Pyx_GIVEREF(__pyx_t_2);
11196   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
11197   __pyx_t_1 = 0;
11198   __pyx_t_2 = 0;
11199   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
11200   __Pyx_GOTREF(__pyx_t_2);
11201   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11202   __pyx_r = __pyx_t_2;
11203   __pyx_t_2 = 0;
11204   goto __pyx_L0;
11205 
11206   /* "View.MemoryView":611
11207  *         return 0
11208  *
11209  *     def __repr__(self):             # <<<<<<<<<<<<<<
11210  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11211  *                                                id(self))
11212  */
11213 
11214   /* function exit code */
11215   __pyx_L1_error:;
11216   __Pyx_XDECREF(__pyx_t_1);
11217   __Pyx_XDECREF(__pyx_t_2);
11218   __Pyx_XDECREF(__pyx_t_3);
11219   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11220   __pyx_r = NULL;
11221   __pyx_L0:;
11222   __Pyx_XGIVEREF(__pyx_r);
11223   __Pyx_RefNannyFinishContext();
11224   return __pyx_r;
11225 }
11226 
11227 /* "View.MemoryView":615
11228  *                                                id(self))
11229  *
11230  *     def __str__(self):             # <<<<<<<<<<<<<<
11231  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11232  *
11233  */
11234 
11235 /* Python wrapper */
11236 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)11237 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
11238   PyObject *__pyx_r = 0;
11239   __Pyx_RefNannyDeclarations
11240   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
11241   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11242 
11243   /* function exit code */
11244   __Pyx_RefNannyFinishContext();
11245   return __pyx_r;
11246 }
11247 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)11248 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
11249   PyObject *__pyx_r = NULL;
11250   __Pyx_RefNannyDeclarations
11251   PyObject *__pyx_t_1 = NULL;
11252   PyObject *__pyx_t_2 = NULL;
11253   int __pyx_lineno = 0;
11254   const char *__pyx_filename = NULL;
11255   int __pyx_clineno = 0;
11256   __Pyx_RefNannySetupContext("__str__", 0);
11257 
11258   /* "View.MemoryView":616
11259  *
11260  *     def __str__(self):
11261  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
11262  *
11263  *
11264  */
11265   __Pyx_XDECREF(__pyx_r);
11266   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11267   __Pyx_GOTREF(__pyx_t_1);
11268   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
11269   __Pyx_GOTREF(__pyx_t_2);
11270   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11271   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11272   __Pyx_GOTREF(__pyx_t_1);
11273   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11274   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
11275   __Pyx_GOTREF(__pyx_t_2);
11276   __Pyx_GIVEREF(__pyx_t_1);
11277   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
11278   __pyx_t_1 = 0;
11279   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11280   __Pyx_GOTREF(__pyx_t_1);
11281   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11282   __pyx_r = __pyx_t_1;
11283   __pyx_t_1 = 0;
11284   goto __pyx_L0;
11285 
11286   /* "View.MemoryView":615
11287  *                                                id(self))
11288  *
11289  *     def __str__(self):             # <<<<<<<<<<<<<<
11290  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11291  *
11292  */
11293 
11294   /* function exit code */
11295   __pyx_L1_error:;
11296   __Pyx_XDECREF(__pyx_t_1);
11297   __Pyx_XDECREF(__pyx_t_2);
11298   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11299   __pyx_r = NULL;
11300   __pyx_L0:;
11301   __Pyx_XGIVEREF(__pyx_r);
11302   __Pyx_RefNannyFinishContext();
11303   return __pyx_r;
11304 }
11305 
11306 /* "View.MemoryView":619
11307  *
11308  *
11309  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
11310  *         cdef __Pyx_memviewslice *mslice
11311  *         cdef __Pyx_memviewslice tmp
11312  */
11313 
11314 /* Python wrapper */
11315 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11316 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11317   PyObject *__pyx_r = 0;
11318   __Pyx_RefNannyDeclarations
11319   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
11320   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
11321 
11322   /* function exit code */
11323   __Pyx_RefNannyFinishContext();
11324   return __pyx_r;
11325 }
11326 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)11327 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
11328   __Pyx_memviewslice *__pyx_v_mslice;
11329   __Pyx_memviewslice __pyx_v_tmp;
11330   PyObject *__pyx_r = NULL;
11331   __Pyx_RefNannyDeclarations
11332   __Pyx_memviewslice *__pyx_t_1;
11333   PyObject *__pyx_t_2 = NULL;
11334   int __pyx_lineno = 0;
11335   const char *__pyx_filename = NULL;
11336   int __pyx_clineno = 0;
11337   __Pyx_RefNannySetupContext("is_c_contig", 0);
11338 
11339   /* "View.MemoryView":622
11340  *         cdef __Pyx_memviewslice *mslice
11341  *         cdef __Pyx_memviewslice tmp
11342  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
11343  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
11344  *
11345  */
11346   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
11347   __pyx_v_mslice = __pyx_t_1;
11348 
11349   /* "View.MemoryView":623
11350  *         cdef __Pyx_memviewslice tmp
11351  *         mslice = get_slice_from_memview(self, &tmp)
11352  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
11353  *
11354  *     def is_f_contig(self):
11355  */
11356   __Pyx_XDECREF(__pyx_r);
11357   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
11358   __Pyx_GOTREF(__pyx_t_2);
11359   __pyx_r = __pyx_t_2;
11360   __pyx_t_2 = 0;
11361   goto __pyx_L0;
11362 
11363   /* "View.MemoryView":619
11364  *
11365  *
11366  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
11367  *         cdef __Pyx_memviewslice *mslice
11368  *         cdef __Pyx_memviewslice tmp
11369  */
11370 
11371   /* function exit code */
11372   __pyx_L1_error:;
11373   __Pyx_XDECREF(__pyx_t_2);
11374   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11375   __pyx_r = NULL;
11376   __pyx_L0:;
11377   __Pyx_XGIVEREF(__pyx_r);
11378   __Pyx_RefNannyFinishContext();
11379   return __pyx_r;
11380 }
11381 
11382 /* "View.MemoryView":625
11383  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
11384  *
11385  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
11386  *         cdef __Pyx_memviewslice *mslice
11387  *         cdef __Pyx_memviewslice tmp
11388  */
11389 
11390 /* Python wrapper */
11391 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11392 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11393   PyObject *__pyx_r = 0;
11394   __Pyx_RefNannyDeclarations
11395   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
11396   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
11397 
11398   /* function exit code */
11399   __Pyx_RefNannyFinishContext();
11400   return __pyx_r;
11401 }
11402 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)11403 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
11404   __Pyx_memviewslice *__pyx_v_mslice;
11405   __Pyx_memviewslice __pyx_v_tmp;
11406   PyObject *__pyx_r = NULL;
11407   __Pyx_RefNannyDeclarations
11408   __Pyx_memviewslice *__pyx_t_1;
11409   PyObject *__pyx_t_2 = NULL;
11410   int __pyx_lineno = 0;
11411   const char *__pyx_filename = NULL;
11412   int __pyx_clineno = 0;
11413   __Pyx_RefNannySetupContext("is_f_contig", 0);
11414 
11415   /* "View.MemoryView":628
11416  *         cdef __Pyx_memviewslice *mslice
11417  *         cdef __Pyx_memviewslice tmp
11418  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
11419  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
11420  *
11421  */
11422   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
11423   __pyx_v_mslice = __pyx_t_1;
11424 
11425   /* "View.MemoryView":629
11426  *         cdef __Pyx_memviewslice tmp
11427  *         mslice = get_slice_from_memview(self, &tmp)
11428  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
11429  *
11430  *     def copy(self):
11431  */
11432   __Pyx_XDECREF(__pyx_r);
11433   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
11434   __Pyx_GOTREF(__pyx_t_2);
11435   __pyx_r = __pyx_t_2;
11436   __pyx_t_2 = 0;
11437   goto __pyx_L0;
11438 
11439   /* "View.MemoryView":625
11440  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
11441  *
11442  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
11443  *         cdef __Pyx_memviewslice *mslice
11444  *         cdef __Pyx_memviewslice tmp
11445  */
11446 
11447   /* function exit code */
11448   __pyx_L1_error:;
11449   __Pyx_XDECREF(__pyx_t_2);
11450   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11451   __pyx_r = NULL;
11452   __pyx_L0:;
11453   __Pyx_XGIVEREF(__pyx_r);
11454   __Pyx_RefNannyFinishContext();
11455   return __pyx_r;
11456 }
11457 
11458 /* "View.MemoryView":631
11459  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
11460  *
11461  *     def copy(self):             # <<<<<<<<<<<<<<
11462  *         cdef __Pyx_memviewslice mslice
11463  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11464  */
11465 
11466 /* Python wrapper */
11467 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11468 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11469   PyObject *__pyx_r = 0;
11470   __Pyx_RefNannyDeclarations
11471   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
11472   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
11473 
11474   /* function exit code */
11475   __Pyx_RefNannyFinishContext();
11476   return __pyx_r;
11477 }
11478 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)11479 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
11480   __Pyx_memviewslice __pyx_v_mslice;
11481   int __pyx_v_flags;
11482   PyObject *__pyx_r = NULL;
11483   __Pyx_RefNannyDeclarations
11484   __Pyx_memviewslice __pyx_t_1;
11485   PyObject *__pyx_t_2 = NULL;
11486   int __pyx_lineno = 0;
11487   const char *__pyx_filename = NULL;
11488   int __pyx_clineno = 0;
11489   __Pyx_RefNannySetupContext("copy", 0);
11490 
11491   /* "View.MemoryView":633
11492  *     def copy(self):
11493  *         cdef __Pyx_memviewslice mslice
11494  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
11495  *
11496  *         slice_copy(self, &mslice)
11497  */
11498   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
11499 
11500   /* "View.MemoryView":635
11501  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11502  *
11503  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
11504  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
11505  *                                    self.view.itemsize,
11506  */
11507   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
11508 
11509   /* "View.MemoryView":636
11510  *
11511  *         slice_copy(self, &mslice)
11512  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
11513  *                                    self.view.itemsize,
11514  *                                    flags|PyBUF_C_CONTIGUOUS,
11515  */
11516   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
11517   __pyx_v_mslice = __pyx_t_1;
11518 
11519   /* "View.MemoryView":641
11520  *                                    self.dtype_is_object)
11521  *
11522  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
11523  *
11524  *     def copy_fortran(self):
11525  */
11526   __Pyx_XDECREF(__pyx_r);
11527   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
11528   __Pyx_GOTREF(__pyx_t_2);
11529   __pyx_r = __pyx_t_2;
11530   __pyx_t_2 = 0;
11531   goto __pyx_L0;
11532 
11533   /* "View.MemoryView":631
11534  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
11535  *
11536  *     def copy(self):             # <<<<<<<<<<<<<<
11537  *         cdef __Pyx_memviewslice mslice
11538  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11539  */
11540 
11541   /* function exit code */
11542   __pyx_L1_error:;
11543   __Pyx_XDECREF(__pyx_t_2);
11544   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
11545   __pyx_r = NULL;
11546   __pyx_L0:;
11547   __Pyx_XGIVEREF(__pyx_r);
11548   __Pyx_RefNannyFinishContext();
11549   return __pyx_r;
11550 }
11551 
11552 /* "View.MemoryView":643
11553  *         return memoryview_copy_from_slice(self, &mslice)
11554  *
11555  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
11556  *         cdef __Pyx_memviewslice src, dst
11557  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11558  */
11559 
11560 /* Python wrapper */
11561 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11562 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11563   PyObject *__pyx_r = 0;
11564   __Pyx_RefNannyDeclarations
11565   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
11566   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
11567 
11568   /* function exit code */
11569   __Pyx_RefNannyFinishContext();
11570   return __pyx_r;
11571 }
11572 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)11573 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
11574   __Pyx_memviewslice __pyx_v_src;
11575   __Pyx_memviewslice __pyx_v_dst;
11576   int __pyx_v_flags;
11577   PyObject *__pyx_r = NULL;
11578   __Pyx_RefNannyDeclarations
11579   __Pyx_memviewslice __pyx_t_1;
11580   PyObject *__pyx_t_2 = NULL;
11581   int __pyx_lineno = 0;
11582   const char *__pyx_filename = NULL;
11583   int __pyx_clineno = 0;
11584   __Pyx_RefNannySetupContext("copy_fortran", 0);
11585 
11586   /* "View.MemoryView":645
11587  *     def copy_fortran(self):
11588  *         cdef __Pyx_memviewslice src, dst
11589  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
11590  *
11591  *         slice_copy(self, &src)
11592  */
11593   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
11594 
11595   /* "View.MemoryView":647
11596  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11597  *
11598  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
11599  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
11600  *                                 self.view.itemsize,
11601  */
11602   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
11603 
11604   /* "View.MemoryView":648
11605  *
11606  *         slice_copy(self, &src)
11607  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
11608  *                                 self.view.itemsize,
11609  *                                 flags|PyBUF_F_CONTIGUOUS,
11610  */
11611   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
11612   __pyx_v_dst = __pyx_t_1;
11613 
11614   /* "View.MemoryView":653
11615  *                                 self.dtype_is_object)
11616  *
11617  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
11618  *
11619  *
11620  */
11621   __Pyx_XDECREF(__pyx_r);
11622   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
11623   __Pyx_GOTREF(__pyx_t_2);
11624   __pyx_r = __pyx_t_2;
11625   __pyx_t_2 = 0;
11626   goto __pyx_L0;
11627 
11628   /* "View.MemoryView":643
11629  *         return memoryview_copy_from_slice(self, &mslice)
11630  *
11631  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
11632  *         cdef __Pyx_memviewslice src, dst
11633  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11634  */
11635 
11636   /* function exit code */
11637   __pyx_L1_error:;
11638   __Pyx_XDECREF(__pyx_t_2);
11639   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
11640   __pyx_r = NULL;
11641   __pyx_L0:;
11642   __Pyx_XGIVEREF(__pyx_r);
11643   __Pyx_RefNannyFinishContext();
11644   return __pyx_r;
11645 }
11646 
11647 /* "(tree fragment)":1
11648  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11649  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11650  * def __setstate_cython__(self, __pyx_state):
11651  */
11652 
11653 /* Python wrapper */
11654 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11655 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11656   PyObject *__pyx_r = 0;
11657   __Pyx_RefNannyDeclarations
11658   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11659   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11660 
11661   /* function exit code */
11662   __Pyx_RefNannyFinishContext();
11663   return __pyx_r;
11664 }
11665 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)11666 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
11667   PyObject *__pyx_r = NULL;
11668   __Pyx_RefNannyDeclarations
11669   PyObject *__pyx_t_1 = NULL;
11670   int __pyx_lineno = 0;
11671   const char *__pyx_filename = NULL;
11672   int __pyx_clineno = 0;
11673   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11674 
11675   /* "(tree fragment)":2
11676  * def __reduce_cython__(self):
11677  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11678  * def __setstate_cython__(self, __pyx_state):
11679  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11680  */
11681   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
11682   __Pyx_GOTREF(__pyx_t_1);
11683   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11684   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11685   __PYX_ERR(2, 2, __pyx_L1_error)
11686 
11687   /* "(tree fragment)":1
11688  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11689  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11690  * def __setstate_cython__(self, __pyx_state):
11691  */
11692 
11693   /* function exit code */
11694   __pyx_L1_error:;
11695   __Pyx_XDECREF(__pyx_t_1);
11696   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11697   __pyx_r = NULL;
11698   __Pyx_XGIVEREF(__pyx_r);
11699   __Pyx_RefNannyFinishContext();
11700   return __pyx_r;
11701 }
11702 
11703 /* "(tree fragment)":3
11704  * def __reduce_cython__(self):
11705  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11706  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11707  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11708  */
11709 
11710 /* Python wrapper */
11711 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)11712 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11713   PyObject *__pyx_r = 0;
11714   __Pyx_RefNannyDeclarations
11715   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11716   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11717 
11718   /* function exit code */
11719   __Pyx_RefNannyFinishContext();
11720   return __pyx_r;
11721 }
11722 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)11723 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11724   PyObject *__pyx_r = NULL;
11725   __Pyx_RefNannyDeclarations
11726   PyObject *__pyx_t_1 = NULL;
11727   int __pyx_lineno = 0;
11728   const char *__pyx_filename = NULL;
11729   int __pyx_clineno = 0;
11730   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11731 
11732   /* "(tree fragment)":4
11733  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11734  * def __setstate_cython__(self, __pyx_state):
11735  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11736  */
11737   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
11738   __Pyx_GOTREF(__pyx_t_1);
11739   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11740   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11741   __PYX_ERR(2, 4, __pyx_L1_error)
11742 
11743   /* "(tree fragment)":3
11744  * def __reduce_cython__(self):
11745  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11746  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11747  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11748  */
11749 
11750   /* function exit code */
11751   __pyx_L1_error:;
11752   __Pyx_XDECREF(__pyx_t_1);
11753   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11754   __pyx_r = NULL;
11755   __Pyx_XGIVEREF(__pyx_r);
11756   __Pyx_RefNannyFinishContext();
11757   return __pyx_r;
11758 }
11759 
11760 /* "View.MemoryView":657
11761  *
11762  * @cname('__pyx_memoryview_new')
11763  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
11764  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
11765  *     result.typeinfo = typeinfo
11766  */
11767 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)11768 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
11769   struct __pyx_memoryview_obj *__pyx_v_result = 0;
11770   PyObject *__pyx_r = NULL;
11771   __Pyx_RefNannyDeclarations
11772   PyObject *__pyx_t_1 = NULL;
11773   PyObject *__pyx_t_2 = NULL;
11774   PyObject *__pyx_t_3 = NULL;
11775   int __pyx_lineno = 0;
11776   const char *__pyx_filename = NULL;
11777   int __pyx_clineno = 0;
11778   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
11779 
11780   /* "View.MemoryView":658
11781  * @cname('__pyx_memoryview_new')
11782  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
11783  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
11784  *     result.typeinfo = typeinfo
11785  *     return result
11786  */
11787   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
11788   __Pyx_GOTREF(__pyx_t_1);
11789   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
11790   __Pyx_GOTREF(__pyx_t_2);
11791   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
11792   __Pyx_GOTREF(__pyx_t_3);
11793   __Pyx_INCREF(__pyx_v_o);
11794   __Pyx_GIVEREF(__pyx_v_o);
11795   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
11796   __Pyx_GIVEREF(__pyx_t_1);
11797   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
11798   __Pyx_GIVEREF(__pyx_t_2);
11799   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11800   __pyx_t_1 = 0;
11801   __pyx_t_2 = 0;
11802   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
11803   __Pyx_GOTREF(__pyx_t_2);
11804   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11805   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
11806   __pyx_t_2 = 0;
11807 
11808   /* "View.MemoryView":659
11809  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
11810  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
11811  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
11812  *     return result
11813  *
11814  */
11815   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
11816 
11817   /* "View.MemoryView":660
11818  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
11819  *     result.typeinfo = typeinfo
11820  *     return result             # <<<<<<<<<<<<<<
11821  *
11822  * @cname('__pyx_memoryview_check')
11823  */
11824   __Pyx_XDECREF(__pyx_r);
11825   __Pyx_INCREF(((PyObject *)__pyx_v_result));
11826   __pyx_r = ((PyObject *)__pyx_v_result);
11827   goto __pyx_L0;
11828 
11829   /* "View.MemoryView":657
11830  *
11831  * @cname('__pyx_memoryview_new')
11832  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
11833  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
11834  *     result.typeinfo = typeinfo
11835  */
11836 
11837   /* function exit code */
11838   __pyx_L1_error:;
11839   __Pyx_XDECREF(__pyx_t_1);
11840   __Pyx_XDECREF(__pyx_t_2);
11841   __Pyx_XDECREF(__pyx_t_3);
11842   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11843   __pyx_r = 0;
11844   __pyx_L0:;
11845   __Pyx_XDECREF((PyObject *)__pyx_v_result);
11846   __Pyx_XGIVEREF(__pyx_r);
11847   __Pyx_RefNannyFinishContext();
11848   return __pyx_r;
11849 }
11850 
11851 /* "View.MemoryView":663
11852  *
11853  * @cname('__pyx_memoryview_check')
11854  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
11855  *     return isinstance(o, memoryview)
11856  *
11857  */
11858 
__pyx_memoryview_check(PyObject * __pyx_v_o)11859 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
11860   int __pyx_r;
11861   __Pyx_RefNannyDeclarations
11862   int __pyx_t_1;
11863   __Pyx_RefNannySetupContext("memoryview_check", 0);
11864 
11865   /* "View.MemoryView":664
11866  * @cname('__pyx_memoryview_check')
11867  * cdef inline bint memoryview_check(object o):
11868  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
11869  *
11870  * cdef tuple _unellipsify(object index, int ndim):
11871  */
11872   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
11873   __pyx_r = __pyx_t_1;
11874   goto __pyx_L0;
11875 
11876   /* "View.MemoryView":663
11877  *
11878  * @cname('__pyx_memoryview_check')
11879  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
11880  *     return isinstance(o, memoryview)
11881  *
11882  */
11883 
11884   /* function exit code */
11885   __pyx_L0:;
11886   __Pyx_RefNannyFinishContext();
11887   return __pyx_r;
11888 }
11889 
11890 /* "View.MemoryView":666
11891  *     return isinstance(o, memoryview)
11892  *
11893  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
11894  *     """
11895  *     Replace all ellipses with full slices and fill incomplete indices with
11896  */
11897 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)11898 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
11899   PyObject *__pyx_v_tup = NULL;
11900   PyObject *__pyx_v_result = NULL;
11901   int __pyx_v_have_slices;
11902   int __pyx_v_seen_ellipsis;
11903   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
11904   PyObject *__pyx_v_item = NULL;
11905   Py_ssize_t __pyx_v_nslices;
11906   PyObject *__pyx_r = NULL;
11907   __Pyx_RefNannyDeclarations
11908   int __pyx_t_1;
11909   int __pyx_t_2;
11910   PyObject *__pyx_t_3 = NULL;
11911   PyObject *__pyx_t_4 = NULL;
11912   Py_ssize_t __pyx_t_5;
11913   PyObject *(*__pyx_t_6)(PyObject *);
11914   PyObject *__pyx_t_7 = NULL;
11915   Py_ssize_t __pyx_t_8;
11916   int __pyx_t_9;
11917   int __pyx_t_10;
11918   PyObject *__pyx_t_11 = NULL;
11919   int __pyx_lineno = 0;
11920   const char *__pyx_filename = NULL;
11921   int __pyx_clineno = 0;
11922   __Pyx_RefNannySetupContext("_unellipsify", 0);
11923 
11924   /* "View.MemoryView":671
11925  *     full slices.
11926  *     """
11927  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
11928  *         tup = (index,)
11929  *     else:
11930  */
11931   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
11932   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11933   if (__pyx_t_2) {
11934 
11935     /* "View.MemoryView":672
11936  *     """
11937  *     if not isinstance(index, tuple):
11938  *         tup = (index,)             # <<<<<<<<<<<<<<
11939  *     else:
11940  *         tup = index
11941  */
11942     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
11943     __Pyx_GOTREF(__pyx_t_3);
11944     __Pyx_INCREF(__pyx_v_index);
11945     __Pyx_GIVEREF(__pyx_v_index);
11946     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
11947     __pyx_v_tup = __pyx_t_3;
11948     __pyx_t_3 = 0;
11949 
11950     /* "View.MemoryView":671
11951  *     full slices.
11952  *     """
11953  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
11954  *         tup = (index,)
11955  *     else:
11956  */
11957     goto __pyx_L3;
11958   }
11959 
11960   /* "View.MemoryView":674
11961  *         tup = (index,)
11962  *     else:
11963  *         tup = index             # <<<<<<<<<<<<<<
11964  *
11965  *     result = []
11966  */
11967   /*else*/ {
11968     __Pyx_INCREF(__pyx_v_index);
11969     __pyx_v_tup = __pyx_v_index;
11970   }
11971   __pyx_L3:;
11972 
11973   /* "View.MemoryView":676
11974  *         tup = index
11975  *
11976  *     result = []             # <<<<<<<<<<<<<<
11977  *     have_slices = False
11978  *     seen_ellipsis = False
11979  */
11980   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
11981   __Pyx_GOTREF(__pyx_t_3);
11982   __pyx_v_result = ((PyObject*)__pyx_t_3);
11983   __pyx_t_3 = 0;
11984 
11985   /* "View.MemoryView":677
11986  *
11987  *     result = []
11988  *     have_slices = False             # <<<<<<<<<<<<<<
11989  *     seen_ellipsis = False
11990  *     for idx, item in enumerate(tup):
11991  */
11992   __pyx_v_have_slices = 0;
11993 
11994   /* "View.MemoryView":678
11995  *     result = []
11996  *     have_slices = False
11997  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
11998  *     for idx, item in enumerate(tup):
11999  *         if item is Ellipsis:
12000  */
12001   __pyx_v_seen_ellipsis = 0;
12002 
12003   /* "View.MemoryView":679
12004  *     have_slices = False
12005  *     seen_ellipsis = False
12006  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
12007  *         if item is Ellipsis:
12008  *             if not seen_ellipsis:
12009  */
12010   __Pyx_INCREF(__pyx_int_0);
12011   __pyx_t_3 = __pyx_int_0;
12012   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
12013     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
12014     __pyx_t_6 = NULL;
12015   } else {
12016     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
12017     __Pyx_GOTREF(__pyx_t_4);
12018     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
12019   }
12020   for (;;) {
12021     if (likely(!__pyx_t_6)) {
12022       if (likely(PyList_CheckExact(__pyx_t_4))) {
12023         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
12024         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12025         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
12026         #else
12027         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12028         __Pyx_GOTREF(__pyx_t_7);
12029         #endif
12030       } else {
12031         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
12032         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12033         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
12034         #else
12035         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12036         __Pyx_GOTREF(__pyx_t_7);
12037         #endif
12038       }
12039     } else {
12040       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
12041       if (unlikely(!__pyx_t_7)) {
12042         PyObject* exc_type = PyErr_Occurred();
12043         if (exc_type) {
12044           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12045           else __PYX_ERR(2, 679, __pyx_L1_error)
12046         }
12047         break;
12048       }
12049       __Pyx_GOTREF(__pyx_t_7);
12050     }
12051     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
12052     __pyx_t_7 = 0;
12053     __Pyx_INCREF(__pyx_t_3);
12054     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
12055     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12056     __Pyx_GOTREF(__pyx_t_7);
12057     __Pyx_DECREF(__pyx_t_3);
12058     __pyx_t_3 = __pyx_t_7;
12059     __pyx_t_7 = 0;
12060 
12061     /* "View.MemoryView":680
12062  *     seen_ellipsis = False
12063  *     for idx, item in enumerate(tup):
12064  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
12065  *             if not seen_ellipsis:
12066  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12067  */
12068     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
12069     __pyx_t_1 = (__pyx_t_2 != 0);
12070     if (__pyx_t_1) {
12071 
12072       /* "View.MemoryView":681
12073  *     for idx, item in enumerate(tup):
12074  *         if item is Ellipsis:
12075  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
12076  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12077  *                 seen_ellipsis = True
12078  */
12079       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
12080       if (__pyx_t_1) {
12081 
12082         /* "View.MemoryView":682
12083  *         if item is Ellipsis:
12084  *             if not seen_ellipsis:
12085  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
12086  *                 seen_ellipsis = True
12087  *             else:
12088  */
12089         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
12090         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
12091         __Pyx_GOTREF(__pyx_t_7);
12092         { Py_ssize_t __pyx_temp;
12093           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
12094             __Pyx_INCREF(__pyx_slice__21);
12095             __Pyx_GIVEREF(__pyx_slice__21);
12096             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__21);
12097           }
12098         }
12099         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
12100         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12101 
12102         /* "View.MemoryView":683
12103  *             if not seen_ellipsis:
12104  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12105  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
12106  *             else:
12107  *                 result.append(slice(None))
12108  */
12109         __pyx_v_seen_ellipsis = 1;
12110 
12111         /* "View.MemoryView":681
12112  *     for idx, item in enumerate(tup):
12113  *         if item is Ellipsis:
12114  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
12115  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12116  *                 seen_ellipsis = True
12117  */
12118         goto __pyx_L7;
12119       }
12120 
12121       /* "View.MemoryView":685
12122  *                 seen_ellipsis = True
12123  *             else:
12124  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
12125  *             have_slices = True
12126  *         else:
12127  */
12128       /*else*/ {
12129         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__21); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
12130       }
12131       __pyx_L7:;
12132 
12133       /* "View.MemoryView":686
12134  *             else:
12135  *                 result.append(slice(None))
12136  *             have_slices = True             # <<<<<<<<<<<<<<
12137  *         else:
12138  *             if not isinstance(item, slice) and not PyIndex_Check(item):
12139  */
12140       __pyx_v_have_slices = 1;
12141 
12142       /* "View.MemoryView":680
12143  *     seen_ellipsis = False
12144  *     for idx, item in enumerate(tup):
12145  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
12146  *             if not seen_ellipsis:
12147  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12148  */
12149       goto __pyx_L6;
12150     }
12151 
12152     /* "View.MemoryView":688
12153  *             have_slices = True
12154  *         else:
12155  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
12156  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12157  *
12158  */
12159     /*else*/ {
12160       __pyx_t_2 = PySlice_Check(__pyx_v_item);
12161       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
12162       if (__pyx_t_10) {
12163       } else {
12164         __pyx_t_1 = __pyx_t_10;
12165         goto __pyx_L9_bool_binop_done;
12166       }
12167       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
12168       __pyx_t_1 = __pyx_t_10;
12169       __pyx_L9_bool_binop_done:;
12170       if (unlikely(__pyx_t_1)) {
12171 
12172         /* "View.MemoryView":689
12173  *         else:
12174  *             if not isinstance(item, slice) and not PyIndex_Check(item):
12175  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
12176  *
12177  *             have_slices = have_slices or isinstance(item, slice)
12178  */
12179         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
12180         __Pyx_GOTREF(__pyx_t_7);
12181         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
12182         __Pyx_GOTREF(__pyx_t_11);
12183         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12184         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
12185         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12186         __PYX_ERR(2, 689, __pyx_L1_error)
12187 
12188         /* "View.MemoryView":688
12189  *             have_slices = True
12190  *         else:
12191  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
12192  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12193  *
12194  */
12195       }
12196 
12197       /* "View.MemoryView":691
12198  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12199  *
12200  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
12201  *             result.append(item)
12202  *
12203  */
12204       __pyx_t_10 = (__pyx_v_have_slices != 0);
12205       if (!__pyx_t_10) {
12206       } else {
12207         __pyx_t_1 = __pyx_t_10;
12208         goto __pyx_L11_bool_binop_done;
12209       }
12210       __pyx_t_10 = PySlice_Check(__pyx_v_item);
12211       __pyx_t_2 = (__pyx_t_10 != 0);
12212       __pyx_t_1 = __pyx_t_2;
12213       __pyx_L11_bool_binop_done:;
12214       __pyx_v_have_slices = __pyx_t_1;
12215 
12216       /* "View.MemoryView":692
12217  *
12218  *             have_slices = have_slices or isinstance(item, slice)
12219  *             result.append(item)             # <<<<<<<<<<<<<<
12220  *
12221  *     nslices = ndim - len(result)
12222  */
12223       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
12224     }
12225     __pyx_L6:;
12226 
12227     /* "View.MemoryView":679
12228  *     have_slices = False
12229  *     seen_ellipsis = False
12230  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
12231  *         if item is Ellipsis:
12232  *             if not seen_ellipsis:
12233  */
12234   }
12235   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12236   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12237 
12238   /* "View.MemoryView":694
12239  *             result.append(item)
12240  *
12241  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
12242  *     if nslices:
12243  *         result.extend([slice(None)] * nslices)
12244  */
12245   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
12246   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
12247 
12248   /* "View.MemoryView":695
12249  *
12250  *     nslices = ndim - len(result)
12251  *     if nslices:             # <<<<<<<<<<<<<<
12252  *         result.extend([slice(None)] * nslices)
12253  *
12254  */
12255   __pyx_t_1 = (__pyx_v_nslices != 0);
12256   if (__pyx_t_1) {
12257 
12258     /* "View.MemoryView":696
12259  *     nslices = ndim - len(result)
12260  *     if nslices:
12261  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
12262  *
12263  *     return have_slices or nslices, tuple(result)
12264  */
12265     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
12266     __Pyx_GOTREF(__pyx_t_3);
12267     { Py_ssize_t __pyx_temp;
12268       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
12269         __Pyx_INCREF(__pyx_slice__21);
12270         __Pyx_GIVEREF(__pyx_slice__21);
12271         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__21);
12272       }
12273     }
12274     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
12275     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12276 
12277     /* "View.MemoryView":695
12278  *
12279  *     nslices = ndim - len(result)
12280  *     if nslices:             # <<<<<<<<<<<<<<
12281  *         result.extend([slice(None)] * nslices)
12282  *
12283  */
12284   }
12285 
12286   /* "View.MemoryView":698
12287  *         result.extend([slice(None)] * nslices)
12288  *
12289  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
12290  *
12291  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12292  */
12293   __Pyx_XDECREF(__pyx_r);
12294   if (!__pyx_v_have_slices) {
12295   } else {
12296     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12297     __Pyx_GOTREF(__pyx_t_4);
12298     __pyx_t_3 = __pyx_t_4;
12299     __pyx_t_4 = 0;
12300     goto __pyx_L14_bool_binop_done;
12301   }
12302   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12303   __Pyx_GOTREF(__pyx_t_4);
12304   __pyx_t_3 = __pyx_t_4;
12305   __pyx_t_4 = 0;
12306   __pyx_L14_bool_binop_done:;
12307   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12308   __Pyx_GOTREF(__pyx_t_4);
12309   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
12310   __Pyx_GOTREF(__pyx_t_11);
12311   __Pyx_GIVEREF(__pyx_t_3);
12312   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
12313   __Pyx_GIVEREF(__pyx_t_4);
12314   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
12315   __pyx_t_3 = 0;
12316   __pyx_t_4 = 0;
12317   __pyx_r = ((PyObject*)__pyx_t_11);
12318   __pyx_t_11 = 0;
12319   goto __pyx_L0;
12320 
12321   /* "View.MemoryView":666
12322  *     return isinstance(o, memoryview)
12323  *
12324  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
12325  *     """
12326  *     Replace all ellipses with full slices and fill incomplete indices with
12327  */
12328 
12329   /* function exit code */
12330   __pyx_L1_error:;
12331   __Pyx_XDECREF(__pyx_t_3);
12332   __Pyx_XDECREF(__pyx_t_4);
12333   __Pyx_XDECREF(__pyx_t_7);
12334   __Pyx_XDECREF(__pyx_t_11);
12335   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
12336   __pyx_r = 0;
12337   __pyx_L0:;
12338   __Pyx_XDECREF(__pyx_v_tup);
12339   __Pyx_XDECREF(__pyx_v_result);
12340   __Pyx_XDECREF(__pyx_v_idx);
12341   __Pyx_XDECREF(__pyx_v_item);
12342   __Pyx_XGIVEREF(__pyx_r);
12343   __Pyx_RefNannyFinishContext();
12344   return __pyx_r;
12345 }
12346 
12347 /* "View.MemoryView":700
12348  *     return have_slices or nslices, tuple(result)
12349  *
12350  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
12351  *     for suboffset in suboffsets[:ndim]:
12352  *         if suboffset >= 0:
12353  */
12354 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)12355 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
12356   Py_ssize_t __pyx_v_suboffset;
12357   PyObject *__pyx_r = NULL;
12358   __Pyx_RefNannyDeclarations
12359   Py_ssize_t *__pyx_t_1;
12360   Py_ssize_t *__pyx_t_2;
12361   Py_ssize_t *__pyx_t_3;
12362   int __pyx_t_4;
12363   PyObject *__pyx_t_5 = NULL;
12364   int __pyx_lineno = 0;
12365   const char *__pyx_filename = NULL;
12366   int __pyx_clineno = 0;
12367   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
12368 
12369   /* "View.MemoryView":701
12370  *
12371  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12372  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
12373  *         if suboffset >= 0:
12374  *             raise ValueError("Indirect dimensions not supported")
12375  */
12376   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
12377   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
12378     __pyx_t_1 = __pyx_t_3;
12379     __pyx_v_suboffset = (__pyx_t_1[0]);
12380 
12381     /* "View.MemoryView":702
12382  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12383  *     for suboffset in suboffsets[:ndim]:
12384  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
12385  *             raise ValueError("Indirect dimensions not supported")
12386  *
12387  */
12388     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
12389     if (unlikely(__pyx_t_4)) {
12390 
12391       /* "View.MemoryView":703
12392  *     for suboffset in suboffsets[:ndim]:
12393  *         if suboffset >= 0:
12394  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
12395  *
12396  *
12397  */
12398       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
12399       __Pyx_GOTREF(__pyx_t_5);
12400       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
12401       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12402       __PYX_ERR(2, 703, __pyx_L1_error)
12403 
12404       /* "View.MemoryView":702
12405  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12406  *     for suboffset in suboffsets[:ndim]:
12407  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
12408  *             raise ValueError("Indirect dimensions not supported")
12409  *
12410  */
12411     }
12412   }
12413 
12414   /* "View.MemoryView":700
12415  *     return have_slices or nslices, tuple(result)
12416  *
12417  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
12418  *     for suboffset in suboffsets[:ndim]:
12419  *         if suboffset >= 0:
12420  */
12421 
12422   /* function exit code */
12423   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12424   goto __pyx_L0;
12425   __pyx_L1_error:;
12426   __Pyx_XDECREF(__pyx_t_5);
12427   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
12428   __pyx_r = 0;
12429   __pyx_L0:;
12430   __Pyx_XGIVEREF(__pyx_r);
12431   __Pyx_RefNannyFinishContext();
12432   return __pyx_r;
12433 }
12434 
12435 /* "View.MemoryView":710
12436  *
12437  * @cname('__pyx_memview_slice')
12438  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
12439  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
12440  *     cdef bint negative_step
12441  */
12442 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)12443 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
12444   int __pyx_v_new_ndim;
12445   int __pyx_v_suboffset_dim;
12446   int __pyx_v_dim;
12447   __Pyx_memviewslice __pyx_v_src;
12448   __Pyx_memviewslice __pyx_v_dst;
12449   __Pyx_memviewslice *__pyx_v_p_src;
12450   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
12451   __Pyx_memviewslice *__pyx_v_p_dst;
12452   int *__pyx_v_p_suboffset_dim;
12453   Py_ssize_t __pyx_v_start;
12454   Py_ssize_t __pyx_v_stop;
12455   Py_ssize_t __pyx_v_step;
12456   int __pyx_v_have_start;
12457   int __pyx_v_have_stop;
12458   int __pyx_v_have_step;
12459   PyObject *__pyx_v_index = NULL;
12460   struct __pyx_memoryview_obj *__pyx_r = NULL;
12461   __Pyx_RefNannyDeclarations
12462   int __pyx_t_1;
12463   int __pyx_t_2;
12464   PyObject *__pyx_t_3 = NULL;
12465   struct __pyx_memoryview_obj *__pyx_t_4;
12466   char *__pyx_t_5;
12467   int __pyx_t_6;
12468   Py_ssize_t __pyx_t_7;
12469   PyObject *(*__pyx_t_8)(PyObject *);
12470   PyObject *__pyx_t_9 = NULL;
12471   Py_ssize_t __pyx_t_10;
12472   int __pyx_t_11;
12473   Py_ssize_t __pyx_t_12;
12474   int __pyx_lineno = 0;
12475   const char *__pyx_filename = NULL;
12476   int __pyx_clineno = 0;
12477   __Pyx_RefNannySetupContext("memview_slice", 0);
12478 
12479   /* "View.MemoryView":711
12480  * @cname('__pyx_memview_slice')
12481  * cdef memoryview memview_slice(memoryview memview, object indices):
12482  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
12483  *     cdef bint negative_step
12484  *     cdef __Pyx_memviewslice src, dst
12485  */
12486   __pyx_v_new_ndim = 0;
12487   __pyx_v_suboffset_dim = -1;
12488 
12489   /* "View.MemoryView":718
12490  *
12491  *
12492  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
12493  *
12494  *     cdef _memoryviewslice memviewsliceobj
12495  */
12496   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
12497 
12498   /* "View.MemoryView":722
12499  *     cdef _memoryviewslice memviewsliceobj
12500  *
12501  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
12502  *
12503  *     if isinstance(memview, _memoryviewslice):
12504  */
12505   #ifndef CYTHON_WITHOUT_ASSERTIONS
12506   if (unlikely(!Py_OptimizeFlag)) {
12507     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
12508       PyErr_SetNone(PyExc_AssertionError);
12509       __PYX_ERR(2, 722, __pyx_L1_error)
12510     }
12511   }
12512   #endif
12513 
12514   /* "View.MemoryView":724
12515  *     assert memview.view.ndim > 0
12516  *
12517  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
12518  *         memviewsliceobj = memview
12519  *         p_src = &memviewsliceobj.from_slice
12520  */
12521   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12522   __pyx_t_2 = (__pyx_t_1 != 0);
12523   if (__pyx_t_2) {
12524 
12525     /* "View.MemoryView":725
12526  *
12527  *     if isinstance(memview, _memoryviewslice):
12528  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
12529  *         p_src = &memviewsliceobj.from_slice
12530  *     else:
12531  */
12532     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
12533     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
12534     __Pyx_INCREF(__pyx_t_3);
12535     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
12536     __pyx_t_3 = 0;
12537 
12538     /* "View.MemoryView":726
12539  *     if isinstance(memview, _memoryviewslice):
12540  *         memviewsliceobj = memview
12541  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
12542  *     else:
12543  *         slice_copy(memview, &src)
12544  */
12545     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
12546 
12547     /* "View.MemoryView":724
12548  *     assert memview.view.ndim > 0
12549  *
12550  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
12551  *         memviewsliceobj = memview
12552  *         p_src = &memviewsliceobj.from_slice
12553  */
12554     goto __pyx_L3;
12555   }
12556 
12557   /* "View.MemoryView":728
12558  *         p_src = &memviewsliceobj.from_slice
12559  *     else:
12560  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
12561  *         p_src = &src
12562  *
12563  */
12564   /*else*/ {
12565     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
12566 
12567     /* "View.MemoryView":729
12568  *     else:
12569  *         slice_copy(memview, &src)
12570  *         p_src = &src             # <<<<<<<<<<<<<<
12571  *
12572  *
12573  */
12574     __pyx_v_p_src = (&__pyx_v_src);
12575   }
12576   __pyx_L3:;
12577 
12578   /* "View.MemoryView":735
12579  *
12580  *
12581  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
12582  *     dst.data = p_src.data
12583  *
12584  */
12585   __pyx_t_4 = __pyx_v_p_src->memview;
12586   __pyx_v_dst.memview = __pyx_t_4;
12587 
12588   /* "View.MemoryView":736
12589  *
12590  *     dst.memview = p_src.memview
12591  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
12592  *
12593  *
12594  */
12595   __pyx_t_5 = __pyx_v_p_src->data;
12596   __pyx_v_dst.data = __pyx_t_5;
12597 
12598   /* "View.MemoryView":741
12599  *
12600  *
12601  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
12602  *     cdef int *p_suboffset_dim = &suboffset_dim
12603  *     cdef Py_ssize_t start, stop, step
12604  */
12605   __pyx_v_p_dst = (&__pyx_v_dst);
12606 
12607   /* "View.MemoryView":742
12608  *
12609  *     cdef __Pyx_memviewslice *p_dst = &dst
12610  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
12611  *     cdef Py_ssize_t start, stop, step
12612  *     cdef bint have_start, have_stop, have_step
12613  */
12614   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
12615 
12616   /* "View.MemoryView":746
12617  *     cdef bint have_start, have_stop, have_step
12618  *
12619  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
12620  *         if PyIndex_Check(index):
12621  *             slice_memviewslice(
12622  */
12623   __pyx_t_6 = 0;
12624   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
12625     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
12626     __pyx_t_8 = NULL;
12627   } else {
12628     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
12629     __Pyx_GOTREF(__pyx_t_3);
12630     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
12631   }
12632   for (;;) {
12633     if (likely(!__pyx_t_8)) {
12634       if (likely(PyList_CheckExact(__pyx_t_3))) {
12635         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
12636         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12637         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
12638         #else
12639         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
12640         __Pyx_GOTREF(__pyx_t_9);
12641         #endif
12642       } else {
12643         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
12644         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12645         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
12646         #else
12647         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
12648         __Pyx_GOTREF(__pyx_t_9);
12649         #endif
12650       }
12651     } else {
12652       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
12653       if (unlikely(!__pyx_t_9)) {
12654         PyObject* exc_type = PyErr_Occurred();
12655         if (exc_type) {
12656           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12657           else __PYX_ERR(2, 746, __pyx_L1_error)
12658         }
12659         break;
12660       }
12661       __Pyx_GOTREF(__pyx_t_9);
12662     }
12663     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
12664     __pyx_t_9 = 0;
12665     __pyx_v_dim = __pyx_t_6;
12666     __pyx_t_6 = (__pyx_t_6 + 1);
12667 
12668     /* "View.MemoryView":747
12669  *
12670  *     for dim, index in enumerate(indices):
12671  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
12672  *             slice_memviewslice(
12673  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12674  */
12675     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
12676     if (__pyx_t_2) {
12677 
12678       /* "View.MemoryView":751
12679  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12680  *                 dim, new_ndim, p_suboffset_dim,
12681  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
12682  *                 0, 0, 0, # have_{start,stop,step}
12683  *                 False)
12684  */
12685       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
12686 
12687       /* "View.MemoryView":748
12688  *     for dim, index in enumerate(indices):
12689  *         if PyIndex_Check(index):
12690  *             slice_memviewslice(             # <<<<<<<<<<<<<<
12691  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12692  *                 dim, new_ndim, p_suboffset_dim,
12693  */
12694       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
12695 
12696       /* "View.MemoryView":747
12697  *
12698  *     for dim, index in enumerate(indices):
12699  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
12700  *             slice_memviewslice(
12701  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12702  */
12703       goto __pyx_L6;
12704     }
12705 
12706     /* "View.MemoryView":754
12707  *                 0, 0, 0, # have_{start,stop,step}
12708  *                 False)
12709  *         elif index is None:             # <<<<<<<<<<<<<<
12710  *             p_dst.shape[new_ndim] = 1
12711  *             p_dst.strides[new_ndim] = 0
12712  */
12713     __pyx_t_2 = (__pyx_v_index == Py_None);
12714     __pyx_t_1 = (__pyx_t_2 != 0);
12715     if (__pyx_t_1) {
12716 
12717       /* "View.MemoryView":755
12718  *                 False)
12719  *         elif index is None:
12720  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
12721  *             p_dst.strides[new_ndim] = 0
12722  *             p_dst.suboffsets[new_ndim] = -1
12723  */
12724       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
12725 
12726       /* "View.MemoryView":756
12727  *         elif index is None:
12728  *             p_dst.shape[new_ndim] = 1
12729  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
12730  *             p_dst.suboffsets[new_ndim] = -1
12731  *             new_ndim += 1
12732  */
12733       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
12734 
12735       /* "View.MemoryView":757
12736  *             p_dst.shape[new_ndim] = 1
12737  *             p_dst.strides[new_ndim] = 0
12738  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
12739  *             new_ndim += 1
12740  *         else:
12741  */
12742       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
12743 
12744       /* "View.MemoryView":758
12745  *             p_dst.strides[new_ndim] = 0
12746  *             p_dst.suboffsets[new_ndim] = -1
12747  *             new_ndim += 1             # <<<<<<<<<<<<<<
12748  *         else:
12749  *             start = index.start or 0
12750  */
12751       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12752 
12753       /* "View.MemoryView":754
12754  *                 0, 0, 0, # have_{start,stop,step}
12755  *                 False)
12756  *         elif index is None:             # <<<<<<<<<<<<<<
12757  *             p_dst.shape[new_ndim] = 1
12758  *             p_dst.strides[new_ndim] = 0
12759  */
12760       goto __pyx_L6;
12761     }
12762 
12763     /* "View.MemoryView":760
12764  *             new_ndim += 1
12765  *         else:
12766  *             start = index.start or 0             # <<<<<<<<<<<<<<
12767  *             stop = index.stop or 0
12768  *             step = index.step or 0
12769  */
12770     /*else*/ {
12771       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
12772       __Pyx_GOTREF(__pyx_t_9);
12773       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
12774       if (!__pyx_t_1) {
12775         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12776       } else {
12777         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
12778         __pyx_t_10 = __pyx_t_12;
12779         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12780         goto __pyx_L7_bool_binop_done;
12781       }
12782       __pyx_t_10 = 0;
12783       __pyx_L7_bool_binop_done:;
12784       __pyx_v_start = __pyx_t_10;
12785 
12786       /* "View.MemoryView":761
12787  *         else:
12788  *             start = index.start or 0
12789  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
12790  *             step = index.step or 0
12791  *
12792  */
12793       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
12794       __Pyx_GOTREF(__pyx_t_9);
12795       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
12796       if (!__pyx_t_1) {
12797         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12798       } else {
12799         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
12800         __pyx_t_10 = __pyx_t_12;
12801         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12802         goto __pyx_L9_bool_binop_done;
12803       }
12804       __pyx_t_10 = 0;
12805       __pyx_L9_bool_binop_done:;
12806       __pyx_v_stop = __pyx_t_10;
12807 
12808       /* "View.MemoryView":762
12809  *             start = index.start or 0
12810  *             stop = index.stop or 0
12811  *             step = index.step or 0             # <<<<<<<<<<<<<<
12812  *
12813  *             have_start = index.start is not None
12814  */
12815       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
12816       __Pyx_GOTREF(__pyx_t_9);
12817       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
12818       if (!__pyx_t_1) {
12819         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12820       } else {
12821         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
12822         __pyx_t_10 = __pyx_t_12;
12823         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12824         goto __pyx_L11_bool_binop_done;
12825       }
12826       __pyx_t_10 = 0;
12827       __pyx_L11_bool_binop_done:;
12828       __pyx_v_step = __pyx_t_10;
12829 
12830       /* "View.MemoryView":764
12831  *             step = index.step or 0
12832  *
12833  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
12834  *             have_stop = index.stop is not None
12835  *             have_step = index.step is not None
12836  */
12837       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
12838       __Pyx_GOTREF(__pyx_t_9);
12839       __pyx_t_1 = (__pyx_t_9 != Py_None);
12840       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12841       __pyx_v_have_start = __pyx_t_1;
12842 
12843       /* "View.MemoryView":765
12844  *
12845  *             have_start = index.start is not None
12846  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
12847  *             have_step = index.step is not None
12848  *
12849  */
12850       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
12851       __Pyx_GOTREF(__pyx_t_9);
12852       __pyx_t_1 = (__pyx_t_9 != Py_None);
12853       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12854       __pyx_v_have_stop = __pyx_t_1;
12855 
12856       /* "View.MemoryView":766
12857  *             have_start = index.start is not None
12858  *             have_stop = index.stop is not None
12859  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
12860  *
12861  *             slice_memviewslice(
12862  */
12863       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
12864       __Pyx_GOTREF(__pyx_t_9);
12865       __pyx_t_1 = (__pyx_t_9 != Py_None);
12866       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12867       __pyx_v_have_step = __pyx_t_1;
12868 
12869       /* "View.MemoryView":768
12870  *             have_step = index.step is not None
12871  *
12872  *             slice_memviewslice(             # <<<<<<<<<<<<<<
12873  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12874  *                 dim, new_ndim, p_suboffset_dim,
12875  */
12876       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
12877 
12878       /* "View.MemoryView":774
12879  *                 have_start, have_stop, have_step,
12880  *                 True)
12881  *             new_ndim += 1             # <<<<<<<<<<<<<<
12882  *
12883  *     if isinstance(memview, _memoryviewslice):
12884  */
12885       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12886     }
12887     __pyx_L6:;
12888 
12889     /* "View.MemoryView":746
12890  *     cdef bint have_start, have_stop, have_step
12891  *
12892  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
12893  *         if PyIndex_Check(index):
12894  *             slice_memviewslice(
12895  */
12896   }
12897   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12898 
12899   /* "View.MemoryView":776
12900  *             new_ndim += 1
12901  *
12902  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
12903  *         return memoryview_fromslice(dst, new_ndim,
12904  *                                     memviewsliceobj.to_object_func,
12905  */
12906   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12907   __pyx_t_2 = (__pyx_t_1 != 0);
12908   if (__pyx_t_2) {
12909 
12910     /* "View.MemoryView":777
12911  *
12912  *     if isinstance(memview, _memoryviewslice):
12913  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
12914  *                                     memviewsliceobj.to_object_func,
12915  *                                     memviewsliceobj.to_dtype_func,
12916  */
12917     __Pyx_XDECREF(((PyObject *)__pyx_r));
12918 
12919     /* "View.MemoryView":778
12920  *     if isinstance(memview, _memoryviewslice):
12921  *         return memoryview_fromslice(dst, new_ndim,
12922  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
12923  *                                     memviewsliceobj.to_dtype_func,
12924  *                                     memview.dtype_is_object)
12925  */
12926     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
12927 
12928     /* "View.MemoryView":779
12929  *         return memoryview_fromslice(dst, new_ndim,
12930  *                                     memviewsliceobj.to_object_func,
12931  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
12932  *                                     memview.dtype_is_object)
12933  *     else:
12934  */
12935     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
12936 
12937     /* "View.MemoryView":777
12938  *
12939  *     if isinstance(memview, _memoryviewslice):
12940  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
12941  *                                     memviewsliceobj.to_object_func,
12942  *                                     memviewsliceobj.to_dtype_func,
12943  */
12944     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
12945     __Pyx_GOTREF(__pyx_t_3);
12946     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
12947     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
12948     __pyx_t_3 = 0;
12949     goto __pyx_L0;
12950 
12951     /* "View.MemoryView":776
12952  *             new_ndim += 1
12953  *
12954  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
12955  *         return memoryview_fromslice(dst, new_ndim,
12956  *                                     memviewsliceobj.to_object_func,
12957  */
12958   }
12959 
12960   /* "View.MemoryView":782
12961  *                                     memview.dtype_is_object)
12962  *     else:
12963  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
12964  *                                     memview.dtype_is_object)
12965  *
12966  */
12967   /*else*/ {
12968     __Pyx_XDECREF(((PyObject *)__pyx_r));
12969 
12970     /* "View.MemoryView":783
12971  *     else:
12972  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
12973  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
12974  *
12975  *
12976  */
12977     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
12978     __Pyx_GOTREF(__pyx_t_3);
12979 
12980     /* "View.MemoryView":782
12981  *                                     memview.dtype_is_object)
12982  *     else:
12983  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
12984  *                                     memview.dtype_is_object)
12985  *
12986  */
12987     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
12988     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
12989     __pyx_t_3 = 0;
12990     goto __pyx_L0;
12991   }
12992 
12993   /* "View.MemoryView":710
12994  *
12995  * @cname('__pyx_memview_slice')
12996  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
12997  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
12998  *     cdef bint negative_step
12999  */
13000 
13001   /* function exit code */
13002   __pyx_L1_error:;
13003   __Pyx_XDECREF(__pyx_t_3);
13004   __Pyx_XDECREF(__pyx_t_9);
13005   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13006   __pyx_r = 0;
13007   __pyx_L0:;
13008   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
13009   __Pyx_XDECREF(__pyx_v_index);
13010   __Pyx_XGIVEREF((PyObject *)__pyx_r);
13011   __Pyx_RefNannyFinishContext();
13012   return __pyx_r;
13013 }
13014 
13015 /* "View.MemoryView":807
13016  *
13017  * @cname('__pyx_memoryview_slice_memviewslice')
13018  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
13019  *         __Pyx_memviewslice *dst,
13020  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
13021  */
13022 
__pyx_memoryview_slice_memviewslice(__Pyx_memviewslice * __pyx_v_dst,Py_ssize_t __pyx_v_shape,Py_ssize_t __pyx_v_stride,Py_ssize_t __pyx_v_suboffset,int __pyx_v_dim,int __pyx_v_new_ndim,int * __pyx_v_suboffset_dim,Py_ssize_t __pyx_v_start,Py_ssize_t __pyx_v_stop,Py_ssize_t __pyx_v_step,int __pyx_v_have_start,int __pyx_v_have_stop,int __pyx_v_have_step,int __pyx_v_is_slice)13023 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
13024   Py_ssize_t __pyx_v_new_shape;
13025   int __pyx_v_negative_step;
13026   int __pyx_r;
13027   int __pyx_t_1;
13028   int __pyx_t_2;
13029   int __pyx_t_3;
13030   int __pyx_lineno = 0;
13031   const char *__pyx_filename = NULL;
13032   int __pyx_clineno = 0;
13033 
13034   /* "View.MemoryView":827
13035  *     cdef bint negative_step
13036  *
13037  *     if not is_slice:             # <<<<<<<<<<<<<<
13038  *
13039  *         if start < 0:
13040  */
13041   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
13042   if (__pyx_t_1) {
13043 
13044     /* "View.MemoryView":829
13045  *     if not is_slice:
13046  *
13047  *         if start < 0:             # <<<<<<<<<<<<<<
13048  *             start += shape
13049  *         if not 0 <= start < shape:
13050  */
13051     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
13052     if (__pyx_t_1) {
13053 
13054       /* "View.MemoryView":830
13055  *
13056  *         if start < 0:
13057  *             start += shape             # <<<<<<<<<<<<<<
13058  *         if not 0 <= start < shape:
13059  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13060  */
13061       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13062 
13063       /* "View.MemoryView":829
13064  *     if not is_slice:
13065  *
13066  *         if start < 0:             # <<<<<<<<<<<<<<
13067  *             start += shape
13068  *         if not 0 <= start < shape:
13069  */
13070     }
13071 
13072     /* "View.MemoryView":831
13073  *         if start < 0:
13074  *             start += shape
13075  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
13076  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13077  *     else:
13078  */
13079     __pyx_t_1 = (0 <= __pyx_v_start);
13080     if (__pyx_t_1) {
13081       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
13082     }
13083     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13084     if (__pyx_t_2) {
13085 
13086       /* "View.MemoryView":832
13087  *             start += shape
13088  *         if not 0 <= start < shape:
13089  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
13090  *     else:
13091  *
13092  */
13093       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
13094 
13095       /* "View.MemoryView":831
13096  *         if start < 0:
13097  *             start += shape
13098  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
13099  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13100  *     else:
13101  */
13102     }
13103 
13104     /* "View.MemoryView":827
13105  *     cdef bint negative_step
13106  *
13107  *     if not is_slice:             # <<<<<<<<<<<<<<
13108  *
13109  *         if start < 0:
13110  */
13111     goto __pyx_L3;
13112   }
13113 
13114   /* "View.MemoryView":835
13115  *     else:
13116  *
13117  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
13118  *
13119  *         if have_step and step == 0:
13120  */
13121   /*else*/ {
13122     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
13123     if (__pyx_t_1) {
13124     } else {
13125       __pyx_t_2 = __pyx_t_1;
13126       goto __pyx_L6_bool_binop_done;
13127     }
13128     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
13129     __pyx_t_2 = __pyx_t_1;
13130     __pyx_L6_bool_binop_done:;
13131     __pyx_v_negative_step = __pyx_t_2;
13132 
13133     /* "View.MemoryView":837
13134  *         negative_step = have_step != 0 and step < 0
13135  *
13136  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
13137  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13138  *
13139  */
13140     __pyx_t_1 = (__pyx_v_have_step != 0);
13141     if (__pyx_t_1) {
13142     } else {
13143       __pyx_t_2 = __pyx_t_1;
13144       goto __pyx_L9_bool_binop_done;
13145     }
13146     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
13147     __pyx_t_2 = __pyx_t_1;
13148     __pyx_L9_bool_binop_done:;
13149     if (__pyx_t_2) {
13150 
13151       /* "View.MemoryView":838
13152  *
13153  *         if have_step and step == 0:
13154  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
13155  *
13156  *
13157  */
13158       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
13159 
13160       /* "View.MemoryView":837
13161  *         negative_step = have_step != 0 and step < 0
13162  *
13163  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
13164  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13165  *
13166  */
13167     }
13168 
13169     /* "View.MemoryView":841
13170  *
13171  *
13172  *         if have_start:             # <<<<<<<<<<<<<<
13173  *             if start < 0:
13174  *                 start += shape
13175  */
13176     __pyx_t_2 = (__pyx_v_have_start != 0);
13177     if (__pyx_t_2) {
13178 
13179       /* "View.MemoryView":842
13180  *
13181  *         if have_start:
13182  *             if start < 0:             # <<<<<<<<<<<<<<
13183  *                 start += shape
13184  *                 if start < 0:
13185  */
13186       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13187       if (__pyx_t_2) {
13188 
13189         /* "View.MemoryView":843
13190  *         if have_start:
13191  *             if start < 0:
13192  *                 start += shape             # <<<<<<<<<<<<<<
13193  *                 if start < 0:
13194  *                     start = 0
13195  */
13196         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13197 
13198         /* "View.MemoryView":844
13199  *             if start < 0:
13200  *                 start += shape
13201  *                 if start < 0:             # <<<<<<<<<<<<<<
13202  *                     start = 0
13203  *             elif start >= shape:
13204  */
13205         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13206         if (__pyx_t_2) {
13207 
13208           /* "View.MemoryView":845
13209  *                 start += shape
13210  *                 if start < 0:
13211  *                     start = 0             # <<<<<<<<<<<<<<
13212  *             elif start >= shape:
13213  *                 if negative_step:
13214  */
13215           __pyx_v_start = 0;
13216 
13217           /* "View.MemoryView":844
13218  *             if start < 0:
13219  *                 start += shape
13220  *                 if start < 0:             # <<<<<<<<<<<<<<
13221  *                     start = 0
13222  *             elif start >= shape:
13223  */
13224         }
13225 
13226         /* "View.MemoryView":842
13227  *
13228  *         if have_start:
13229  *             if start < 0:             # <<<<<<<<<<<<<<
13230  *                 start += shape
13231  *                 if start < 0:
13232  */
13233         goto __pyx_L12;
13234       }
13235 
13236       /* "View.MemoryView":846
13237  *                 if start < 0:
13238  *                     start = 0
13239  *             elif start >= shape:             # <<<<<<<<<<<<<<
13240  *                 if negative_step:
13241  *                     start = shape - 1
13242  */
13243       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
13244       if (__pyx_t_2) {
13245 
13246         /* "View.MemoryView":847
13247  *                     start = 0
13248  *             elif start >= shape:
13249  *                 if negative_step:             # <<<<<<<<<<<<<<
13250  *                     start = shape - 1
13251  *                 else:
13252  */
13253         __pyx_t_2 = (__pyx_v_negative_step != 0);
13254         if (__pyx_t_2) {
13255 
13256           /* "View.MemoryView":848
13257  *             elif start >= shape:
13258  *                 if negative_step:
13259  *                     start = shape - 1             # <<<<<<<<<<<<<<
13260  *                 else:
13261  *                     start = shape
13262  */
13263           __pyx_v_start = (__pyx_v_shape - 1);
13264 
13265           /* "View.MemoryView":847
13266  *                     start = 0
13267  *             elif start >= shape:
13268  *                 if negative_step:             # <<<<<<<<<<<<<<
13269  *                     start = shape - 1
13270  *                 else:
13271  */
13272           goto __pyx_L14;
13273         }
13274 
13275         /* "View.MemoryView":850
13276  *                     start = shape - 1
13277  *                 else:
13278  *                     start = shape             # <<<<<<<<<<<<<<
13279  *         else:
13280  *             if negative_step:
13281  */
13282         /*else*/ {
13283           __pyx_v_start = __pyx_v_shape;
13284         }
13285         __pyx_L14:;
13286 
13287         /* "View.MemoryView":846
13288  *                 if start < 0:
13289  *                     start = 0
13290  *             elif start >= shape:             # <<<<<<<<<<<<<<
13291  *                 if negative_step:
13292  *                     start = shape - 1
13293  */
13294       }
13295       __pyx_L12:;
13296 
13297       /* "View.MemoryView":841
13298  *
13299  *
13300  *         if have_start:             # <<<<<<<<<<<<<<
13301  *             if start < 0:
13302  *                 start += shape
13303  */
13304       goto __pyx_L11;
13305     }
13306 
13307     /* "View.MemoryView":852
13308  *                     start = shape
13309  *         else:
13310  *             if negative_step:             # <<<<<<<<<<<<<<
13311  *                 start = shape - 1
13312  *             else:
13313  */
13314     /*else*/ {
13315       __pyx_t_2 = (__pyx_v_negative_step != 0);
13316       if (__pyx_t_2) {
13317 
13318         /* "View.MemoryView":853
13319  *         else:
13320  *             if negative_step:
13321  *                 start = shape - 1             # <<<<<<<<<<<<<<
13322  *             else:
13323  *                 start = 0
13324  */
13325         __pyx_v_start = (__pyx_v_shape - 1);
13326 
13327         /* "View.MemoryView":852
13328  *                     start = shape
13329  *         else:
13330  *             if negative_step:             # <<<<<<<<<<<<<<
13331  *                 start = shape - 1
13332  *             else:
13333  */
13334         goto __pyx_L15;
13335       }
13336 
13337       /* "View.MemoryView":855
13338  *                 start = shape - 1
13339  *             else:
13340  *                 start = 0             # <<<<<<<<<<<<<<
13341  *
13342  *         if have_stop:
13343  */
13344       /*else*/ {
13345         __pyx_v_start = 0;
13346       }
13347       __pyx_L15:;
13348     }
13349     __pyx_L11:;
13350 
13351     /* "View.MemoryView":857
13352  *                 start = 0
13353  *
13354  *         if have_stop:             # <<<<<<<<<<<<<<
13355  *             if stop < 0:
13356  *                 stop += shape
13357  */
13358     __pyx_t_2 = (__pyx_v_have_stop != 0);
13359     if (__pyx_t_2) {
13360 
13361       /* "View.MemoryView":858
13362  *
13363  *         if have_stop:
13364  *             if stop < 0:             # <<<<<<<<<<<<<<
13365  *                 stop += shape
13366  *                 if stop < 0:
13367  */
13368       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13369       if (__pyx_t_2) {
13370 
13371         /* "View.MemoryView":859
13372  *         if have_stop:
13373  *             if stop < 0:
13374  *                 stop += shape             # <<<<<<<<<<<<<<
13375  *                 if stop < 0:
13376  *                     stop = 0
13377  */
13378         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
13379 
13380         /* "View.MemoryView":860
13381  *             if stop < 0:
13382  *                 stop += shape
13383  *                 if stop < 0:             # <<<<<<<<<<<<<<
13384  *                     stop = 0
13385  *             elif stop > shape:
13386  */
13387         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13388         if (__pyx_t_2) {
13389 
13390           /* "View.MemoryView":861
13391  *                 stop += shape
13392  *                 if stop < 0:
13393  *                     stop = 0             # <<<<<<<<<<<<<<
13394  *             elif stop > shape:
13395  *                 stop = shape
13396  */
13397           __pyx_v_stop = 0;
13398 
13399           /* "View.MemoryView":860
13400  *             if stop < 0:
13401  *                 stop += shape
13402  *                 if stop < 0:             # <<<<<<<<<<<<<<
13403  *                     stop = 0
13404  *             elif stop > shape:
13405  */
13406         }
13407 
13408         /* "View.MemoryView":858
13409  *
13410  *         if have_stop:
13411  *             if stop < 0:             # <<<<<<<<<<<<<<
13412  *                 stop += shape
13413  *                 if stop < 0:
13414  */
13415         goto __pyx_L17;
13416       }
13417 
13418       /* "View.MemoryView":862
13419  *                 if stop < 0:
13420  *                     stop = 0
13421  *             elif stop > shape:             # <<<<<<<<<<<<<<
13422  *                 stop = shape
13423  *         else:
13424  */
13425       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
13426       if (__pyx_t_2) {
13427 
13428         /* "View.MemoryView":863
13429  *                     stop = 0
13430  *             elif stop > shape:
13431  *                 stop = shape             # <<<<<<<<<<<<<<
13432  *         else:
13433  *             if negative_step:
13434  */
13435         __pyx_v_stop = __pyx_v_shape;
13436 
13437         /* "View.MemoryView":862
13438  *                 if stop < 0:
13439  *                     stop = 0
13440  *             elif stop > shape:             # <<<<<<<<<<<<<<
13441  *                 stop = shape
13442  *         else:
13443  */
13444       }
13445       __pyx_L17:;
13446 
13447       /* "View.MemoryView":857
13448  *                 start = 0
13449  *
13450  *         if have_stop:             # <<<<<<<<<<<<<<
13451  *             if stop < 0:
13452  *                 stop += shape
13453  */
13454       goto __pyx_L16;
13455     }
13456 
13457     /* "View.MemoryView":865
13458  *                 stop = shape
13459  *         else:
13460  *             if negative_step:             # <<<<<<<<<<<<<<
13461  *                 stop = -1
13462  *             else:
13463  */
13464     /*else*/ {
13465       __pyx_t_2 = (__pyx_v_negative_step != 0);
13466       if (__pyx_t_2) {
13467 
13468         /* "View.MemoryView":866
13469  *         else:
13470  *             if negative_step:
13471  *                 stop = -1             # <<<<<<<<<<<<<<
13472  *             else:
13473  *                 stop = shape
13474  */
13475         __pyx_v_stop = -1L;
13476 
13477         /* "View.MemoryView":865
13478  *                 stop = shape
13479  *         else:
13480  *             if negative_step:             # <<<<<<<<<<<<<<
13481  *                 stop = -1
13482  *             else:
13483  */
13484         goto __pyx_L19;
13485       }
13486 
13487       /* "View.MemoryView":868
13488  *                 stop = -1
13489  *             else:
13490  *                 stop = shape             # <<<<<<<<<<<<<<
13491  *
13492  *         if not have_step:
13493  */
13494       /*else*/ {
13495         __pyx_v_stop = __pyx_v_shape;
13496       }
13497       __pyx_L19:;
13498     }
13499     __pyx_L16:;
13500 
13501     /* "View.MemoryView":870
13502  *                 stop = shape
13503  *
13504  *         if not have_step:             # <<<<<<<<<<<<<<
13505  *             step = 1
13506  *
13507  */
13508     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
13509     if (__pyx_t_2) {
13510 
13511       /* "View.MemoryView":871
13512  *
13513  *         if not have_step:
13514  *             step = 1             # <<<<<<<<<<<<<<
13515  *
13516  *
13517  */
13518       __pyx_v_step = 1;
13519 
13520       /* "View.MemoryView":870
13521  *                 stop = shape
13522  *
13523  *         if not have_step:             # <<<<<<<<<<<<<<
13524  *             step = 1
13525  *
13526  */
13527     }
13528 
13529     /* "View.MemoryView":875
13530  *
13531  *         with cython.cdivision(True):
13532  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
13533  *
13534  *             if (stop - start) - step * new_shape:
13535  */
13536     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
13537 
13538     /* "View.MemoryView":877
13539  *             new_shape = (stop - start) // step
13540  *
13541  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
13542  *                 new_shape += 1
13543  *
13544  */
13545     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
13546     if (__pyx_t_2) {
13547 
13548       /* "View.MemoryView":878
13549  *
13550  *             if (stop - start) - step * new_shape:
13551  *                 new_shape += 1             # <<<<<<<<<<<<<<
13552  *
13553  *         if new_shape < 0:
13554  */
13555       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
13556 
13557       /* "View.MemoryView":877
13558  *             new_shape = (stop - start) // step
13559  *
13560  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
13561  *                 new_shape += 1
13562  *
13563  */
13564     }
13565 
13566     /* "View.MemoryView":880
13567  *                 new_shape += 1
13568  *
13569  *         if new_shape < 0:             # <<<<<<<<<<<<<<
13570  *             new_shape = 0
13571  *
13572  */
13573     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
13574     if (__pyx_t_2) {
13575 
13576       /* "View.MemoryView":881
13577  *
13578  *         if new_shape < 0:
13579  *             new_shape = 0             # <<<<<<<<<<<<<<
13580  *
13581  *
13582  */
13583       __pyx_v_new_shape = 0;
13584 
13585       /* "View.MemoryView":880
13586  *                 new_shape += 1
13587  *
13588  *         if new_shape < 0:             # <<<<<<<<<<<<<<
13589  *             new_shape = 0
13590  *
13591  */
13592     }
13593 
13594     /* "View.MemoryView":884
13595  *
13596  *
13597  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
13598  *         dst.shape[new_ndim] = new_shape
13599  *         dst.suboffsets[new_ndim] = suboffset
13600  */
13601     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
13602 
13603     /* "View.MemoryView":885
13604  *
13605  *         dst.strides[new_ndim] = stride * step
13606  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
13607  *         dst.suboffsets[new_ndim] = suboffset
13608  *
13609  */
13610     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
13611 
13612     /* "View.MemoryView":886
13613  *         dst.strides[new_ndim] = stride * step
13614  *         dst.shape[new_ndim] = new_shape
13615  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
13616  *
13617  *
13618  */
13619     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
13620   }
13621   __pyx_L3:;
13622 
13623   /* "View.MemoryView":889
13624  *
13625  *
13626  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
13627  *         dst.data += start * stride
13628  *     else:
13629  */
13630   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
13631   if (__pyx_t_2) {
13632 
13633     /* "View.MemoryView":890
13634  *
13635  *     if suboffset_dim[0] < 0:
13636  *         dst.data += start * stride             # <<<<<<<<<<<<<<
13637  *     else:
13638  *         dst.suboffsets[suboffset_dim[0]] += start * stride
13639  */
13640     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
13641 
13642     /* "View.MemoryView":889
13643  *
13644  *
13645  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
13646  *         dst.data += start * stride
13647  *     else:
13648  */
13649     goto __pyx_L23;
13650   }
13651 
13652   /* "View.MemoryView":892
13653  *         dst.data += start * stride
13654  *     else:
13655  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
13656  *
13657  *     if suboffset >= 0:
13658  */
13659   /*else*/ {
13660     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
13661     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
13662   }
13663   __pyx_L23:;
13664 
13665   /* "View.MemoryView":894
13666  *         dst.suboffsets[suboffset_dim[0]] += start * stride
13667  *
13668  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
13669  *         if not is_slice:
13670  *             if new_ndim == 0:
13671  */
13672   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
13673   if (__pyx_t_2) {
13674 
13675     /* "View.MemoryView":895
13676  *
13677  *     if suboffset >= 0:
13678  *         if not is_slice:             # <<<<<<<<<<<<<<
13679  *             if new_ndim == 0:
13680  *                 dst.data = (<char **> dst.data)[0] + suboffset
13681  */
13682     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
13683     if (__pyx_t_2) {
13684 
13685       /* "View.MemoryView":896
13686  *     if suboffset >= 0:
13687  *         if not is_slice:
13688  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
13689  *                 dst.data = (<char **> dst.data)[0] + suboffset
13690  *             else:
13691  */
13692       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
13693       if (__pyx_t_2) {
13694 
13695         /* "View.MemoryView":897
13696  *         if not is_slice:
13697  *             if new_ndim == 0:
13698  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
13699  *             else:
13700  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
13701  */
13702         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
13703 
13704         /* "View.MemoryView":896
13705  *     if suboffset >= 0:
13706  *         if not is_slice:
13707  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
13708  *                 dst.data = (<char **> dst.data)[0] + suboffset
13709  *             else:
13710  */
13711         goto __pyx_L26;
13712       }
13713 
13714       /* "View.MemoryView":899
13715  *                 dst.data = (<char **> dst.data)[0] + suboffset
13716  *             else:
13717  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
13718  *                                      "must be indexed and not sliced", dim)
13719  *         else:
13720  */
13721       /*else*/ {
13722 
13723         /* "View.MemoryView":900
13724  *             else:
13725  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
13726  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
13727  *         else:
13728  *             suboffset_dim[0] = new_ndim
13729  */
13730         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
13731       }
13732       __pyx_L26:;
13733 
13734       /* "View.MemoryView":895
13735  *
13736  *     if suboffset >= 0:
13737  *         if not is_slice:             # <<<<<<<<<<<<<<
13738  *             if new_ndim == 0:
13739  *                 dst.data = (<char **> dst.data)[0] + suboffset
13740  */
13741       goto __pyx_L25;
13742     }
13743 
13744     /* "View.MemoryView":902
13745  *                                      "must be indexed and not sliced", dim)
13746  *         else:
13747  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
13748  *
13749  *     return 0
13750  */
13751     /*else*/ {
13752       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
13753     }
13754     __pyx_L25:;
13755 
13756     /* "View.MemoryView":894
13757  *         dst.suboffsets[suboffset_dim[0]] += start * stride
13758  *
13759  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
13760  *         if not is_slice:
13761  *             if new_ndim == 0:
13762  */
13763   }
13764 
13765   /* "View.MemoryView":904
13766  *             suboffset_dim[0] = new_ndim
13767  *
13768  *     return 0             # <<<<<<<<<<<<<<
13769  *
13770  *
13771  */
13772   __pyx_r = 0;
13773   goto __pyx_L0;
13774 
13775   /* "View.MemoryView":807
13776  *
13777  * @cname('__pyx_memoryview_slice_memviewslice')
13778  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
13779  *         __Pyx_memviewslice *dst,
13780  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
13781  */
13782 
13783   /* function exit code */
13784   __pyx_L1_error:;
13785   {
13786     #ifdef WITH_THREAD
13787     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13788     #endif
13789     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13790     #ifdef WITH_THREAD
13791     __Pyx_PyGILState_Release(__pyx_gilstate_save);
13792     #endif
13793   }
13794   __pyx_r = -1;
13795   __pyx_L0:;
13796   return __pyx_r;
13797 }
13798 
13799 /* "View.MemoryView":910
13800  *
13801  * @cname('__pyx_pybuffer_index')
13802  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
13803  *                           Py_ssize_t dim) except NULL:
13804  *     cdef Py_ssize_t shape, stride, suboffset = -1
13805  */
13806 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)13807 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
13808   Py_ssize_t __pyx_v_shape;
13809   Py_ssize_t __pyx_v_stride;
13810   Py_ssize_t __pyx_v_suboffset;
13811   Py_ssize_t __pyx_v_itemsize;
13812   char *__pyx_v_resultp;
13813   char *__pyx_r;
13814   __Pyx_RefNannyDeclarations
13815   Py_ssize_t __pyx_t_1;
13816   int __pyx_t_2;
13817   PyObject *__pyx_t_3 = NULL;
13818   PyObject *__pyx_t_4 = NULL;
13819   int __pyx_lineno = 0;
13820   const char *__pyx_filename = NULL;
13821   int __pyx_clineno = 0;
13822   __Pyx_RefNannySetupContext("pybuffer_index", 0);
13823 
13824   /* "View.MemoryView":912
13825  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
13826  *                           Py_ssize_t dim) except NULL:
13827  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
13828  *     cdef Py_ssize_t itemsize = view.itemsize
13829  *     cdef char *resultp
13830  */
13831   __pyx_v_suboffset = -1L;
13832 
13833   /* "View.MemoryView":913
13834  *                           Py_ssize_t dim) except NULL:
13835  *     cdef Py_ssize_t shape, stride, suboffset = -1
13836  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
13837  *     cdef char *resultp
13838  *
13839  */
13840   __pyx_t_1 = __pyx_v_view->itemsize;
13841   __pyx_v_itemsize = __pyx_t_1;
13842 
13843   /* "View.MemoryView":916
13844  *     cdef char *resultp
13845  *
13846  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
13847  *         shape = view.len / itemsize
13848  *         stride = itemsize
13849  */
13850   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
13851   if (__pyx_t_2) {
13852 
13853     /* "View.MemoryView":917
13854  *
13855  *     if view.ndim == 0:
13856  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
13857  *         stride = itemsize
13858  *     else:
13859  */
13860     if (unlikely(__pyx_v_itemsize == 0)) {
13861       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
13862       __PYX_ERR(2, 917, __pyx_L1_error)
13863     }
13864     else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
13865       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
13866       __PYX_ERR(2, 917, __pyx_L1_error)
13867     }
13868     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
13869 
13870     /* "View.MemoryView":918
13871  *     if view.ndim == 0:
13872  *         shape = view.len / itemsize
13873  *         stride = itemsize             # <<<<<<<<<<<<<<
13874  *     else:
13875  *         shape = view.shape[dim]
13876  */
13877     __pyx_v_stride = __pyx_v_itemsize;
13878 
13879     /* "View.MemoryView":916
13880  *     cdef char *resultp
13881  *
13882  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
13883  *         shape = view.len / itemsize
13884  *         stride = itemsize
13885  */
13886     goto __pyx_L3;
13887   }
13888 
13889   /* "View.MemoryView":920
13890  *         stride = itemsize
13891  *     else:
13892  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
13893  *         stride = view.strides[dim]
13894  *         if view.suboffsets != NULL:
13895  */
13896   /*else*/ {
13897     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
13898 
13899     /* "View.MemoryView":921
13900  *     else:
13901  *         shape = view.shape[dim]
13902  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
13903  *         if view.suboffsets != NULL:
13904  *             suboffset = view.suboffsets[dim]
13905  */
13906     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
13907 
13908     /* "View.MemoryView":922
13909  *         shape = view.shape[dim]
13910  *         stride = view.strides[dim]
13911  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
13912  *             suboffset = view.suboffsets[dim]
13913  *
13914  */
13915     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
13916     if (__pyx_t_2) {
13917 
13918       /* "View.MemoryView":923
13919  *         stride = view.strides[dim]
13920  *         if view.suboffsets != NULL:
13921  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
13922  *
13923  *     if index < 0:
13924  */
13925       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
13926 
13927       /* "View.MemoryView":922
13928  *         shape = view.shape[dim]
13929  *         stride = view.strides[dim]
13930  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
13931  *             suboffset = view.suboffsets[dim]
13932  *
13933  */
13934     }
13935   }
13936   __pyx_L3:;
13937 
13938   /* "View.MemoryView":925
13939  *             suboffset = view.suboffsets[dim]
13940  *
13941  *     if index < 0:             # <<<<<<<<<<<<<<
13942  *         index += view.shape[dim]
13943  *         if index < 0:
13944  */
13945   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
13946   if (__pyx_t_2) {
13947 
13948     /* "View.MemoryView":926
13949  *
13950  *     if index < 0:
13951  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
13952  *         if index < 0:
13953  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
13954  */
13955     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
13956 
13957     /* "View.MemoryView":927
13958  *     if index < 0:
13959  *         index += view.shape[dim]
13960  *         if index < 0:             # <<<<<<<<<<<<<<
13961  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
13962  *
13963  */
13964     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
13965     if (unlikely(__pyx_t_2)) {
13966 
13967       /* "View.MemoryView":928
13968  *         index += view.shape[dim]
13969  *         if index < 0:
13970  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
13971  *
13972  *     if index >= shape:
13973  */
13974       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
13975       __Pyx_GOTREF(__pyx_t_3);
13976       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
13977       __Pyx_GOTREF(__pyx_t_4);
13978       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13979       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
13980       __Pyx_GOTREF(__pyx_t_3);
13981       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13982       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13983       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13984       __PYX_ERR(2, 928, __pyx_L1_error)
13985 
13986       /* "View.MemoryView":927
13987  *     if index < 0:
13988  *         index += view.shape[dim]
13989  *         if index < 0:             # <<<<<<<<<<<<<<
13990  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
13991  *
13992  */
13993     }
13994 
13995     /* "View.MemoryView":925
13996  *             suboffset = view.suboffsets[dim]
13997  *
13998  *     if index < 0:             # <<<<<<<<<<<<<<
13999  *         index += view.shape[dim]
14000  *         if index < 0:
14001  */
14002   }
14003 
14004   /* "View.MemoryView":930
14005  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14006  *
14007  *     if index >= shape:             # <<<<<<<<<<<<<<
14008  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14009  *
14010  */
14011   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
14012   if (unlikely(__pyx_t_2)) {
14013 
14014     /* "View.MemoryView":931
14015  *
14016  *     if index >= shape:
14017  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
14018  *
14019  *     resultp = bufp + index * stride
14020  */
14021     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14022     __Pyx_GOTREF(__pyx_t_3);
14023     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
14024     __Pyx_GOTREF(__pyx_t_4);
14025     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14026     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14027     __Pyx_GOTREF(__pyx_t_3);
14028     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14029     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14030     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14031     __PYX_ERR(2, 931, __pyx_L1_error)
14032 
14033     /* "View.MemoryView":930
14034  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14035  *
14036  *     if index >= shape:             # <<<<<<<<<<<<<<
14037  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14038  *
14039  */
14040   }
14041 
14042   /* "View.MemoryView":933
14043  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14044  *
14045  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
14046  *     if suboffset >= 0:
14047  *         resultp = (<char **> resultp)[0] + suboffset
14048  */
14049   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
14050 
14051   /* "View.MemoryView":934
14052  *
14053  *     resultp = bufp + index * stride
14054  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14055  *         resultp = (<char **> resultp)[0] + suboffset
14056  *
14057  */
14058   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
14059   if (__pyx_t_2) {
14060 
14061     /* "View.MemoryView":935
14062  *     resultp = bufp + index * stride
14063  *     if suboffset >= 0:
14064  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
14065  *
14066  *     return resultp
14067  */
14068     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
14069 
14070     /* "View.MemoryView":934
14071  *
14072  *     resultp = bufp + index * stride
14073  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14074  *         resultp = (<char **> resultp)[0] + suboffset
14075  *
14076  */
14077   }
14078 
14079   /* "View.MemoryView":937
14080  *         resultp = (<char **> resultp)[0] + suboffset
14081  *
14082  *     return resultp             # <<<<<<<<<<<<<<
14083  *
14084  *
14085  */
14086   __pyx_r = __pyx_v_resultp;
14087   goto __pyx_L0;
14088 
14089   /* "View.MemoryView":910
14090  *
14091  * @cname('__pyx_pybuffer_index')
14092  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
14093  *                           Py_ssize_t dim) except NULL:
14094  *     cdef Py_ssize_t shape, stride, suboffset = -1
14095  */
14096 
14097   /* function exit code */
14098   __pyx_L1_error:;
14099   __Pyx_XDECREF(__pyx_t_3);
14100   __Pyx_XDECREF(__pyx_t_4);
14101   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
14102   __pyx_r = NULL;
14103   __pyx_L0:;
14104   __Pyx_RefNannyFinishContext();
14105   return __pyx_r;
14106 }
14107 
14108 /* "View.MemoryView":943
14109  *
14110  * @cname('__pyx_memslice_transpose')
14111  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
14112  *     cdef int ndim = memslice.memview.view.ndim
14113  *
14114  */
14115 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)14116 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
14117   int __pyx_v_ndim;
14118   Py_ssize_t *__pyx_v_shape;
14119   Py_ssize_t *__pyx_v_strides;
14120   int __pyx_v_i;
14121   int __pyx_v_j;
14122   int __pyx_r;
14123   int __pyx_t_1;
14124   Py_ssize_t *__pyx_t_2;
14125   long __pyx_t_3;
14126   long __pyx_t_4;
14127   Py_ssize_t __pyx_t_5;
14128   Py_ssize_t __pyx_t_6;
14129   int __pyx_t_7;
14130   int __pyx_t_8;
14131   int __pyx_t_9;
14132   int __pyx_lineno = 0;
14133   const char *__pyx_filename = NULL;
14134   int __pyx_clineno = 0;
14135 
14136   /* "View.MemoryView":944
14137  * @cname('__pyx_memslice_transpose')
14138  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
14139  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
14140  *
14141  *     cdef Py_ssize_t *shape = memslice.shape
14142  */
14143   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
14144   __pyx_v_ndim = __pyx_t_1;
14145 
14146   /* "View.MemoryView":946
14147  *     cdef int ndim = memslice.memview.view.ndim
14148  *
14149  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
14150  *     cdef Py_ssize_t *strides = memslice.strides
14151  *
14152  */
14153   __pyx_t_2 = __pyx_v_memslice->shape;
14154   __pyx_v_shape = __pyx_t_2;
14155 
14156   /* "View.MemoryView":947
14157  *
14158  *     cdef Py_ssize_t *shape = memslice.shape
14159  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
14160  *
14161  *
14162  */
14163   __pyx_t_2 = __pyx_v_memslice->strides;
14164   __pyx_v_strides = __pyx_t_2;
14165 
14166   /* "View.MemoryView":951
14167  *
14168  *     cdef int i, j
14169  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
14170  *         j = ndim - 1 - i
14171  *         strides[i], strides[j] = strides[j], strides[i]
14172  */
14173   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
14174   __pyx_t_4 = __pyx_t_3;
14175   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
14176     __pyx_v_i = __pyx_t_1;
14177 
14178     /* "View.MemoryView":952
14179  *     cdef int i, j
14180  *     for i in range(ndim / 2):
14181  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
14182  *         strides[i], strides[j] = strides[j], strides[i]
14183  *         shape[i], shape[j] = shape[j], shape[i]
14184  */
14185     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
14186 
14187     /* "View.MemoryView":953
14188  *     for i in range(ndim / 2):
14189  *         j = ndim - 1 - i
14190  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
14191  *         shape[i], shape[j] = shape[j], shape[i]
14192  *
14193  */
14194     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
14195     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
14196     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
14197     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
14198 
14199     /* "View.MemoryView":954
14200  *         j = ndim - 1 - i
14201  *         strides[i], strides[j] = strides[j], strides[i]
14202  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
14203  *
14204  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14205  */
14206     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
14207     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
14208     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
14209     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
14210 
14211     /* "View.MemoryView":956
14212  *         shape[i], shape[j] = shape[j], shape[i]
14213  *
14214  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
14215  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14216  *
14217  */
14218     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
14219     if (!__pyx_t_8) {
14220     } else {
14221       __pyx_t_7 = __pyx_t_8;
14222       goto __pyx_L6_bool_binop_done;
14223     }
14224     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
14225     __pyx_t_7 = __pyx_t_8;
14226     __pyx_L6_bool_binop_done:;
14227     if (__pyx_t_7) {
14228 
14229       /* "View.MemoryView":957
14230  *
14231  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14232  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
14233  *
14234  *     return 1
14235  */
14236       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
14237 
14238       /* "View.MemoryView":956
14239  *         shape[i], shape[j] = shape[j], shape[i]
14240  *
14241  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
14242  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14243  *
14244  */
14245     }
14246   }
14247 
14248   /* "View.MemoryView":959
14249  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14250  *
14251  *     return 1             # <<<<<<<<<<<<<<
14252  *
14253  *
14254  */
14255   __pyx_r = 1;
14256   goto __pyx_L0;
14257 
14258   /* "View.MemoryView":943
14259  *
14260  * @cname('__pyx_memslice_transpose')
14261  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
14262  *     cdef int ndim = memslice.memview.view.ndim
14263  *
14264  */
14265 
14266   /* function exit code */
14267   __pyx_L1_error:;
14268   {
14269     #ifdef WITH_THREAD
14270     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14271     #endif
14272     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14273     #ifdef WITH_THREAD
14274     __Pyx_PyGILState_Release(__pyx_gilstate_save);
14275     #endif
14276   }
14277   __pyx_r = 0;
14278   __pyx_L0:;
14279   return __pyx_r;
14280 }
14281 
14282 /* "View.MemoryView":976
14283  *     cdef int (*to_dtype_func)(char *, object) except 0
14284  *
14285  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14286  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14287  *
14288  */
14289 
14290 /* Python wrapper */
14291 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)14292 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
14293   __Pyx_RefNannyDeclarations
14294   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
14295   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14296 
14297   /* function exit code */
14298   __Pyx_RefNannyFinishContext();
14299 }
14300 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)14301 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14302   __Pyx_RefNannyDeclarations
14303   __Pyx_RefNannySetupContext("__dealloc__", 0);
14304 
14305   /* "View.MemoryView":977
14306  *
14307  *     def __dealloc__(self):
14308  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
14309  *
14310  *     cdef convert_item_to_object(self, char *itemp):
14311  */
14312   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
14313 
14314   /* "View.MemoryView":976
14315  *     cdef int (*to_dtype_func)(char *, object) except 0
14316  *
14317  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14318  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14319  *
14320  */
14321 
14322   /* function exit code */
14323   __Pyx_RefNannyFinishContext();
14324 }
14325 
14326 /* "View.MemoryView":979
14327  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14328  *
14329  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
14330  *         if self.to_object_func != NULL:
14331  *             return self.to_object_func(itemp)
14332  */
14333 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)14334 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
14335   PyObject *__pyx_r = NULL;
14336   __Pyx_RefNannyDeclarations
14337   int __pyx_t_1;
14338   PyObject *__pyx_t_2 = NULL;
14339   int __pyx_lineno = 0;
14340   const char *__pyx_filename = NULL;
14341   int __pyx_clineno = 0;
14342   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
14343 
14344   /* "View.MemoryView":980
14345  *
14346  *     cdef convert_item_to_object(self, char *itemp):
14347  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
14348  *             return self.to_object_func(itemp)
14349  *         else:
14350  */
14351   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
14352   if (__pyx_t_1) {
14353 
14354     /* "View.MemoryView":981
14355  *     cdef convert_item_to_object(self, char *itemp):
14356  *         if self.to_object_func != NULL:
14357  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
14358  *         else:
14359  *             return memoryview.convert_item_to_object(self, itemp)
14360  */
14361     __Pyx_XDECREF(__pyx_r);
14362     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
14363     __Pyx_GOTREF(__pyx_t_2);
14364     __pyx_r = __pyx_t_2;
14365     __pyx_t_2 = 0;
14366     goto __pyx_L0;
14367 
14368     /* "View.MemoryView":980
14369  *
14370  *     cdef convert_item_to_object(self, char *itemp):
14371  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
14372  *             return self.to_object_func(itemp)
14373  *         else:
14374  */
14375   }
14376 
14377   /* "View.MemoryView":983
14378  *             return self.to_object_func(itemp)
14379  *         else:
14380  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
14381  *
14382  *     cdef assign_item_from_object(self, char *itemp, object value):
14383  */
14384   /*else*/ {
14385     __Pyx_XDECREF(__pyx_r);
14386     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
14387     __Pyx_GOTREF(__pyx_t_2);
14388     __pyx_r = __pyx_t_2;
14389     __pyx_t_2 = 0;
14390     goto __pyx_L0;
14391   }
14392 
14393   /* "View.MemoryView":979
14394  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14395  *
14396  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
14397  *         if self.to_object_func != NULL:
14398  *             return self.to_object_func(itemp)
14399  */
14400 
14401   /* function exit code */
14402   __pyx_L1_error:;
14403   __Pyx_XDECREF(__pyx_t_2);
14404   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14405   __pyx_r = 0;
14406   __pyx_L0:;
14407   __Pyx_XGIVEREF(__pyx_r);
14408   __Pyx_RefNannyFinishContext();
14409   return __pyx_r;
14410 }
14411 
14412 /* "View.MemoryView":985
14413  *             return memoryview.convert_item_to_object(self, itemp)
14414  *
14415  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
14416  *         if self.to_dtype_func != NULL:
14417  *             self.to_dtype_func(itemp, value)
14418  */
14419 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)14420 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
14421   PyObject *__pyx_r = NULL;
14422   __Pyx_RefNannyDeclarations
14423   int __pyx_t_1;
14424   int __pyx_t_2;
14425   PyObject *__pyx_t_3 = NULL;
14426   int __pyx_lineno = 0;
14427   const char *__pyx_filename = NULL;
14428   int __pyx_clineno = 0;
14429   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
14430 
14431   /* "View.MemoryView":986
14432  *
14433  *     cdef assign_item_from_object(self, char *itemp, object value):
14434  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
14435  *             self.to_dtype_func(itemp, value)
14436  *         else:
14437  */
14438   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
14439   if (__pyx_t_1) {
14440 
14441     /* "View.MemoryView":987
14442  *     cdef assign_item_from_object(self, char *itemp, object value):
14443  *         if self.to_dtype_func != NULL:
14444  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
14445  *         else:
14446  *             memoryview.assign_item_from_object(self, itemp, value)
14447  */
14448     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
14449 
14450     /* "View.MemoryView":986
14451  *
14452  *     cdef assign_item_from_object(self, char *itemp, object value):
14453  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
14454  *             self.to_dtype_func(itemp, value)
14455  *         else:
14456  */
14457     goto __pyx_L3;
14458   }
14459 
14460   /* "View.MemoryView":989
14461  *             self.to_dtype_func(itemp, value)
14462  *         else:
14463  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
14464  *
14465  *     @property
14466  */
14467   /*else*/ {
14468     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
14469     __Pyx_GOTREF(__pyx_t_3);
14470     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14471   }
14472   __pyx_L3:;
14473 
14474   /* "View.MemoryView":985
14475  *             return memoryview.convert_item_to_object(self, itemp)
14476  *
14477  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
14478  *         if self.to_dtype_func != NULL:
14479  *             self.to_dtype_func(itemp, value)
14480  */
14481 
14482   /* function exit code */
14483   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14484   goto __pyx_L0;
14485   __pyx_L1_error:;
14486   __Pyx_XDECREF(__pyx_t_3);
14487   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14488   __pyx_r = 0;
14489   __pyx_L0:;
14490   __Pyx_XGIVEREF(__pyx_r);
14491   __Pyx_RefNannyFinishContext();
14492   return __pyx_r;
14493 }
14494 
14495 /* "View.MemoryView":992
14496  *
14497  *     @property
14498  *     def base(self):             # <<<<<<<<<<<<<<
14499  *         return self.from_object
14500  *
14501  */
14502 
14503 /* Python wrapper */
14504 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)14505 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
14506   PyObject *__pyx_r = 0;
14507   __Pyx_RefNannyDeclarations
14508   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14509   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14510 
14511   /* function exit code */
14512   __Pyx_RefNannyFinishContext();
14513   return __pyx_r;
14514 }
14515 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)14516 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14517   PyObject *__pyx_r = NULL;
14518   __Pyx_RefNannyDeclarations
14519   __Pyx_RefNannySetupContext("__get__", 0);
14520 
14521   /* "View.MemoryView":993
14522  *     @property
14523  *     def base(self):
14524  *         return self.from_object             # <<<<<<<<<<<<<<
14525  *
14526  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
14527  */
14528   __Pyx_XDECREF(__pyx_r);
14529   __Pyx_INCREF(__pyx_v_self->from_object);
14530   __pyx_r = __pyx_v_self->from_object;
14531   goto __pyx_L0;
14532 
14533   /* "View.MemoryView":992
14534  *
14535  *     @property
14536  *     def base(self):             # <<<<<<<<<<<<<<
14537  *         return self.from_object
14538  *
14539  */
14540 
14541   /* function exit code */
14542   __pyx_L0:;
14543   __Pyx_XGIVEREF(__pyx_r);
14544   __Pyx_RefNannyFinishContext();
14545   return __pyx_r;
14546 }
14547 
14548 /* "(tree fragment)":1
14549  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14550  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14551  * def __setstate_cython__(self, __pyx_state):
14552  */
14553 
14554 /* Python wrapper */
14555 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)14556 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14557   PyObject *__pyx_r = 0;
14558   __Pyx_RefNannyDeclarations
14559   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
14560   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14561 
14562   /* function exit code */
14563   __Pyx_RefNannyFinishContext();
14564   return __pyx_r;
14565 }
14566 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)14567 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14568   PyObject *__pyx_r = NULL;
14569   __Pyx_RefNannyDeclarations
14570   PyObject *__pyx_t_1 = NULL;
14571   int __pyx_lineno = 0;
14572   const char *__pyx_filename = NULL;
14573   int __pyx_clineno = 0;
14574   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
14575 
14576   /* "(tree fragment)":2
14577  * def __reduce_cython__(self):
14578  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
14579  * def __setstate_cython__(self, __pyx_state):
14580  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14581  */
14582   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
14583   __Pyx_GOTREF(__pyx_t_1);
14584   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14585   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14586   __PYX_ERR(2, 2, __pyx_L1_error)
14587 
14588   /* "(tree fragment)":1
14589  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14590  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14591  * def __setstate_cython__(self, __pyx_state):
14592  */
14593 
14594   /* function exit code */
14595   __pyx_L1_error:;
14596   __Pyx_XDECREF(__pyx_t_1);
14597   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14598   __pyx_r = NULL;
14599   __Pyx_XGIVEREF(__pyx_r);
14600   __Pyx_RefNannyFinishContext();
14601   return __pyx_r;
14602 }
14603 
14604 /* "(tree fragment)":3
14605  * def __reduce_cython__(self):
14606  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14607  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14608  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14609  */
14610 
14611 /* Python wrapper */
14612 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)14613 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14614   PyObject *__pyx_r = 0;
14615   __Pyx_RefNannyDeclarations
14616   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
14617   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14618 
14619   /* function exit code */
14620   __Pyx_RefNannyFinishContext();
14621   return __pyx_r;
14622 }
14623 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)14624 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14625   PyObject *__pyx_r = NULL;
14626   __Pyx_RefNannyDeclarations
14627   PyObject *__pyx_t_1 = NULL;
14628   int __pyx_lineno = 0;
14629   const char *__pyx_filename = NULL;
14630   int __pyx_clineno = 0;
14631   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
14632 
14633   /* "(tree fragment)":4
14634  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14635  * def __setstate_cython__(self, __pyx_state):
14636  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
14637  */
14638   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
14639   __Pyx_GOTREF(__pyx_t_1);
14640   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14641   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14642   __PYX_ERR(2, 4, __pyx_L1_error)
14643 
14644   /* "(tree fragment)":3
14645  * def __reduce_cython__(self):
14646  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14647  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14648  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14649  */
14650 
14651   /* function exit code */
14652   __pyx_L1_error:;
14653   __Pyx_XDECREF(__pyx_t_1);
14654   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14655   __pyx_r = NULL;
14656   __Pyx_XGIVEREF(__pyx_r);
14657   __Pyx_RefNannyFinishContext();
14658   return __pyx_r;
14659 }
14660 
14661 /* "View.MemoryView":999
14662  *
14663  * @cname('__pyx_memoryview_fromslice')
14664  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
14665  *                           int ndim,
14666  *                           object (*to_object_func)(char *),
14667  */
14668 
__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,int __pyx_v_ndim,PyObject * (* __pyx_v_to_object_func)(char *),int (* __pyx_v_to_dtype_func)(char *,PyObject *),int __pyx_v_dtype_is_object)14669 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
14670   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
14671   Py_ssize_t __pyx_v_suboffset;
14672   PyObject *__pyx_v_length = NULL;
14673   PyObject *__pyx_r = NULL;
14674   __Pyx_RefNannyDeclarations
14675   int __pyx_t_1;
14676   PyObject *__pyx_t_2 = NULL;
14677   PyObject *__pyx_t_3 = NULL;
14678   __Pyx_TypeInfo *__pyx_t_4;
14679   Py_buffer __pyx_t_5;
14680   Py_ssize_t *__pyx_t_6;
14681   Py_ssize_t *__pyx_t_7;
14682   Py_ssize_t *__pyx_t_8;
14683   Py_ssize_t __pyx_t_9;
14684   int __pyx_lineno = 0;
14685   const char *__pyx_filename = NULL;
14686   int __pyx_clineno = 0;
14687   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
14688 
14689   /* "View.MemoryView":1007
14690  *     cdef _memoryviewslice result
14691  *
14692  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
14693  *         return None
14694  *
14695  */
14696   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
14697   if (__pyx_t_1) {
14698 
14699     /* "View.MemoryView":1008
14700  *
14701  *     if <PyObject *> memviewslice.memview == Py_None:
14702  *         return None             # <<<<<<<<<<<<<<
14703  *
14704  *
14705  */
14706     __Pyx_XDECREF(__pyx_r);
14707     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14708     goto __pyx_L0;
14709 
14710     /* "View.MemoryView":1007
14711  *     cdef _memoryviewslice result
14712  *
14713  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
14714  *         return None
14715  *
14716  */
14717   }
14718 
14719   /* "View.MemoryView":1013
14720  *
14721  *
14722  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
14723  *
14724  *     result.from_slice = memviewslice
14725  */
14726   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
14727   __Pyx_GOTREF(__pyx_t_2);
14728   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
14729   __Pyx_GOTREF(__pyx_t_3);
14730   __Pyx_INCREF(Py_None);
14731   __Pyx_GIVEREF(Py_None);
14732   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
14733   __Pyx_INCREF(__pyx_int_0);
14734   __Pyx_GIVEREF(__pyx_int_0);
14735   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
14736   __Pyx_GIVEREF(__pyx_t_2);
14737   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14738   __pyx_t_2 = 0;
14739   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
14740   __Pyx_GOTREF(__pyx_t_2);
14741   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14742   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
14743   __pyx_t_2 = 0;
14744 
14745   /* "View.MemoryView":1015
14746  *     result = _memoryviewslice(None, 0, dtype_is_object)
14747  *
14748  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
14749  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
14750  *
14751  */
14752   __pyx_v_result->from_slice = __pyx_v_memviewslice;
14753 
14754   /* "View.MemoryView":1016
14755  *
14756  *     result.from_slice = memviewslice
14757  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
14758  *
14759  *     result.from_object = (<memoryview> memviewslice.memview).base
14760  */
14761   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
14762 
14763   /* "View.MemoryView":1018
14764  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
14765  *
14766  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
14767  *     result.typeinfo = memviewslice.memview.typeinfo
14768  *
14769  */
14770   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
14771   __Pyx_GOTREF(__pyx_t_2);
14772   __Pyx_GIVEREF(__pyx_t_2);
14773   __Pyx_GOTREF(__pyx_v_result->from_object);
14774   __Pyx_DECREF(__pyx_v_result->from_object);
14775   __pyx_v_result->from_object = __pyx_t_2;
14776   __pyx_t_2 = 0;
14777 
14778   /* "View.MemoryView":1019
14779  *
14780  *     result.from_object = (<memoryview> memviewslice.memview).base
14781  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
14782  *
14783  *     result.view = memviewslice.memview.view
14784  */
14785   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
14786   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
14787 
14788   /* "View.MemoryView":1021
14789  *     result.typeinfo = memviewslice.memview.typeinfo
14790  *
14791  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
14792  *     result.view.buf = <void *> memviewslice.data
14793  *     result.view.ndim = ndim
14794  */
14795   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
14796   __pyx_v_result->__pyx_base.view = __pyx_t_5;
14797 
14798   /* "View.MemoryView":1022
14799  *
14800  *     result.view = memviewslice.memview.view
14801  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
14802  *     result.view.ndim = ndim
14803  *     (<__pyx_buffer *> &result.view).obj = Py_None
14804  */
14805   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
14806 
14807   /* "View.MemoryView":1023
14808  *     result.view = memviewslice.memview.view
14809  *     result.view.buf = <void *> memviewslice.data
14810  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
14811  *     (<__pyx_buffer *> &result.view).obj = Py_None
14812  *     Py_INCREF(Py_None)
14813  */
14814   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
14815 
14816   /* "View.MemoryView":1024
14817  *     result.view.buf = <void *> memviewslice.data
14818  *     result.view.ndim = ndim
14819  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
14820  *     Py_INCREF(Py_None)
14821  *
14822  */
14823   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
14824 
14825   /* "View.MemoryView":1025
14826  *     result.view.ndim = ndim
14827  *     (<__pyx_buffer *> &result.view).obj = Py_None
14828  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
14829  *
14830  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
14831  */
14832   Py_INCREF(Py_None);
14833 
14834   /* "View.MemoryView":1027
14835  *     Py_INCREF(Py_None)
14836  *
14837  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
14838  *         result.flags = PyBUF_RECORDS
14839  *     else:
14840  */
14841   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
14842   if (__pyx_t_1) {
14843 
14844     /* "View.MemoryView":1028
14845  *
14846  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
14847  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
14848  *     else:
14849  *         result.flags = PyBUF_RECORDS_RO
14850  */
14851     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
14852 
14853     /* "View.MemoryView":1027
14854  *     Py_INCREF(Py_None)
14855  *
14856  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
14857  *         result.flags = PyBUF_RECORDS
14858  *     else:
14859  */
14860     goto __pyx_L4;
14861   }
14862 
14863   /* "View.MemoryView":1030
14864  *         result.flags = PyBUF_RECORDS
14865  *     else:
14866  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
14867  *
14868  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
14869  */
14870   /*else*/ {
14871     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
14872   }
14873   __pyx_L4:;
14874 
14875   /* "View.MemoryView":1032
14876  *         result.flags = PyBUF_RECORDS_RO
14877  *
14878  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
14879  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
14880  *
14881  */
14882   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
14883 
14884   /* "View.MemoryView":1033
14885  *
14886  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
14887  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
14888  *
14889  *
14890  */
14891   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
14892 
14893   /* "View.MemoryView":1036
14894  *
14895  *
14896  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
14897  *     for suboffset in result.from_slice.suboffsets[:ndim]:
14898  *         if suboffset >= 0:
14899  */
14900   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
14901 
14902   /* "View.MemoryView":1037
14903  *
14904  *     result.view.suboffsets = NULL
14905  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
14906  *         if suboffset >= 0:
14907  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
14908  */
14909   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
14910   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
14911     __pyx_t_6 = __pyx_t_8;
14912     __pyx_v_suboffset = (__pyx_t_6[0]);
14913 
14914     /* "View.MemoryView":1038
14915  *     result.view.suboffsets = NULL
14916  *     for suboffset in result.from_slice.suboffsets[:ndim]:
14917  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14918  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
14919  *             break
14920  */
14921     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
14922     if (__pyx_t_1) {
14923 
14924       /* "View.MemoryView":1039
14925  *     for suboffset in result.from_slice.suboffsets[:ndim]:
14926  *         if suboffset >= 0:
14927  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
14928  *             break
14929  *
14930  */
14931       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
14932 
14933       /* "View.MemoryView":1040
14934  *         if suboffset >= 0:
14935  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
14936  *             break             # <<<<<<<<<<<<<<
14937  *
14938  *     result.view.len = result.view.itemsize
14939  */
14940       goto __pyx_L6_break;
14941 
14942       /* "View.MemoryView":1038
14943  *     result.view.suboffsets = NULL
14944  *     for suboffset in result.from_slice.suboffsets[:ndim]:
14945  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14946  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
14947  *             break
14948  */
14949     }
14950   }
14951   __pyx_L6_break:;
14952 
14953   /* "View.MemoryView":1042
14954  *             break
14955  *
14956  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
14957  *     for length in result.view.shape[:ndim]:
14958  *         result.view.len *= length
14959  */
14960   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
14961   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
14962 
14963   /* "View.MemoryView":1043
14964  *
14965  *     result.view.len = result.view.itemsize
14966  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
14967  *         result.view.len *= length
14968  *
14969  */
14970   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
14971   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
14972     __pyx_t_6 = __pyx_t_8;
14973     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
14974     __Pyx_GOTREF(__pyx_t_2);
14975     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
14976     __pyx_t_2 = 0;
14977 
14978     /* "View.MemoryView":1044
14979  *     result.view.len = result.view.itemsize
14980  *     for length in result.view.shape[:ndim]:
14981  *         result.view.len *= length             # <<<<<<<<<<<<<<
14982  *
14983  *     result.to_object_func = to_object_func
14984  */
14985     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
14986     __Pyx_GOTREF(__pyx_t_2);
14987     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
14988     __Pyx_GOTREF(__pyx_t_3);
14989     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14990     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
14991     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14992     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
14993   }
14994 
14995   /* "View.MemoryView":1046
14996  *         result.view.len *= length
14997  *
14998  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
14999  *     result.to_dtype_func = to_dtype_func
15000  *
15001  */
15002   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
15003 
15004   /* "View.MemoryView":1047
15005  *
15006  *     result.to_object_func = to_object_func
15007  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
15008  *
15009  *     return result
15010  */
15011   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
15012 
15013   /* "View.MemoryView":1049
15014  *     result.to_dtype_func = to_dtype_func
15015  *
15016  *     return result             # <<<<<<<<<<<<<<
15017  *
15018  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15019  */
15020   __Pyx_XDECREF(__pyx_r);
15021   __Pyx_INCREF(((PyObject *)__pyx_v_result));
15022   __pyx_r = ((PyObject *)__pyx_v_result);
15023   goto __pyx_L0;
15024 
15025   /* "View.MemoryView":999
15026  *
15027  * @cname('__pyx_memoryview_fromslice')
15028  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
15029  *                           int ndim,
15030  *                           object (*to_object_func)(char *),
15031  */
15032 
15033   /* function exit code */
15034   __pyx_L1_error:;
15035   __Pyx_XDECREF(__pyx_t_2);
15036   __Pyx_XDECREF(__pyx_t_3);
15037   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15038   __pyx_r = 0;
15039   __pyx_L0:;
15040   __Pyx_XDECREF((PyObject *)__pyx_v_result);
15041   __Pyx_XDECREF(__pyx_v_length);
15042   __Pyx_XGIVEREF(__pyx_r);
15043   __Pyx_RefNannyFinishContext();
15044   return __pyx_r;
15045 }
15046 
15047 /* "View.MemoryView":1052
15048  *
15049  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15050  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
15051  *                                                    __Pyx_memviewslice *mslice) except NULL:
15052  *     cdef _memoryviewslice obj
15053  */
15054 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)15055 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
15056   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
15057   __Pyx_memviewslice *__pyx_r;
15058   __Pyx_RefNannyDeclarations
15059   int __pyx_t_1;
15060   int __pyx_t_2;
15061   PyObject *__pyx_t_3 = NULL;
15062   int __pyx_lineno = 0;
15063   const char *__pyx_filename = NULL;
15064   int __pyx_clineno = 0;
15065   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
15066 
15067   /* "View.MemoryView":1055
15068  *                                                    __Pyx_memviewslice *mslice) except NULL:
15069  *     cdef _memoryviewslice obj
15070  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15071  *         obj = memview
15072  *         return &obj.from_slice
15073  */
15074   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15075   __pyx_t_2 = (__pyx_t_1 != 0);
15076   if (__pyx_t_2) {
15077 
15078     /* "View.MemoryView":1056
15079  *     cdef _memoryviewslice obj
15080  *     if isinstance(memview, _memoryviewslice):
15081  *         obj = memview             # <<<<<<<<<<<<<<
15082  *         return &obj.from_slice
15083  *     else:
15084  */
15085     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
15086     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15087     __Pyx_INCREF(__pyx_t_3);
15088     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15089     __pyx_t_3 = 0;
15090 
15091     /* "View.MemoryView":1057
15092  *     if isinstance(memview, _memoryviewslice):
15093  *         obj = memview
15094  *         return &obj.from_slice             # <<<<<<<<<<<<<<
15095  *     else:
15096  *         slice_copy(memview, mslice)
15097  */
15098     __pyx_r = (&__pyx_v_obj->from_slice);
15099     goto __pyx_L0;
15100 
15101     /* "View.MemoryView":1055
15102  *                                                    __Pyx_memviewslice *mslice) except NULL:
15103  *     cdef _memoryviewslice obj
15104  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15105  *         obj = memview
15106  *         return &obj.from_slice
15107  */
15108   }
15109 
15110   /* "View.MemoryView":1059
15111  *         return &obj.from_slice
15112  *     else:
15113  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
15114  *         return mslice
15115  *
15116  */
15117   /*else*/ {
15118     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
15119 
15120     /* "View.MemoryView":1060
15121  *     else:
15122  *         slice_copy(memview, mslice)
15123  *         return mslice             # <<<<<<<<<<<<<<
15124  *
15125  * @cname('__pyx_memoryview_slice_copy')
15126  */
15127     __pyx_r = __pyx_v_mslice;
15128     goto __pyx_L0;
15129   }
15130 
15131   /* "View.MemoryView":1052
15132  *
15133  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15134  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
15135  *                                                    __Pyx_memviewslice *mslice) except NULL:
15136  *     cdef _memoryviewslice obj
15137  */
15138 
15139   /* function exit code */
15140   __pyx_L1_error:;
15141   __Pyx_XDECREF(__pyx_t_3);
15142   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
15143   __pyx_r = NULL;
15144   __pyx_L0:;
15145   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
15146   __Pyx_RefNannyFinishContext();
15147   return __pyx_r;
15148 }
15149 
15150 /* "View.MemoryView":1063
15151  *
15152  * @cname('__pyx_memoryview_slice_copy')
15153  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
15154  *     cdef int dim
15155  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15156  */
15157 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)15158 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
15159   int __pyx_v_dim;
15160   Py_ssize_t *__pyx_v_shape;
15161   Py_ssize_t *__pyx_v_strides;
15162   Py_ssize_t *__pyx_v_suboffsets;
15163   __Pyx_RefNannyDeclarations
15164   Py_ssize_t *__pyx_t_1;
15165   int __pyx_t_2;
15166   int __pyx_t_3;
15167   int __pyx_t_4;
15168   Py_ssize_t __pyx_t_5;
15169   __Pyx_RefNannySetupContext("slice_copy", 0);
15170 
15171   /* "View.MemoryView":1067
15172  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15173  *
15174  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
15175  *     strides = memview.view.strides
15176  *     suboffsets = memview.view.suboffsets
15177  */
15178   __pyx_t_1 = __pyx_v_memview->view.shape;
15179   __pyx_v_shape = __pyx_t_1;
15180 
15181   /* "View.MemoryView":1068
15182  *
15183  *     shape = memview.view.shape
15184  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
15185  *     suboffsets = memview.view.suboffsets
15186  *
15187  */
15188   __pyx_t_1 = __pyx_v_memview->view.strides;
15189   __pyx_v_strides = __pyx_t_1;
15190 
15191   /* "View.MemoryView":1069
15192  *     shape = memview.view.shape
15193  *     strides = memview.view.strides
15194  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
15195  *
15196  *     dst.memview = <__pyx_memoryview *> memview
15197  */
15198   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
15199   __pyx_v_suboffsets = __pyx_t_1;
15200 
15201   /* "View.MemoryView":1071
15202  *     suboffsets = memview.view.suboffsets
15203  *
15204  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
15205  *     dst.data = <char *> memview.view.buf
15206  *
15207  */
15208   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
15209 
15210   /* "View.MemoryView":1072
15211  *
15212  *     dst.memview = <__pyx_memoryview *> memview
15213  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
15214  *
15215  *     for dim in range(memview.view.ndim):
15216  */
15217   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
15218 
15219   /* "View.MemoryView":1074
15220  *     dst.data = <char *> memview.view.buf
15221  *
15222  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
15223  *         dst.shape[dim] = shape[dim]
15224  *         dst.strides[dim] = strides[dim]
15225  */
15226   __pyx_t_2 = __pyx_v_memview->view.ndim;
15227   __pyx_t_3 = __pyx_t_2;
15228   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15229     __pyx_v_dim = __pyx_t_4;
15230 
15231     /* "View.MemoryView":1075
15232  *
15233  *     for dim in range(memview.view.ndim):
15234  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
15235  *         dst.strides[dim] = strides[dim]
15236  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15237  */
15238     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
15239 
15240     /* "View.MemoryView":1076
15241  *     for dim in range(memview.view.ndim):
15242  *         dst.shape[dim] = shape[dim]
15243  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
15244  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15245  *
15246  */
15247     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
15248 
15249     /* "View.MemoryView":1077
15250  *         dst.shape[dim] = shape[dim]
15251  *         dst.strides[dim] = strides[dim]
15252  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
15253  *
15254  * @cname('__pyx_memoryview_copy_object')
15255  */
15256     if ((__pyx_v_suboffsets != 0)) {
15257       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
15258     } else {
15259       __pyx_t_5 = -1L;
15260     }
15261     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
15262   }
15263 
15264   /* "View.MemoryView":1063
15265  *
15266  * @cname('__pyx_memoryview_slice_copy')
15267  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
15268  *     cdef int dim
15269  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15270  */
15271 
15272   /* function exit code */
15273   __Pyx_RefNannyFinishContext();
15274 }
15275 
15276 /* "View.MemoryView":1080
15277  *
15278  * @cname('__pyx_memoryview_copy_object')
15279  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
15280  *     "Create a new memoryview object"
15281  *     cdef __Pyx_memviewslice memviewslice
15282  */
15283 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)15284 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
15285   __Pyx_memviewslice __pyx_v_memviewslice;
15286   PyObject *__pyx_r = NULL;
15287   __Pyx_RefNannyDeclarations
15288   PyObject *__pyx_t_1 = NULL;
15289   int __pyx_lineno = 0;
15290   const char *__pyx_filename = NULL;
15291   int __pyx_clineno = 0;
15292   __Pyx_RefNannySetupContext("memoryview_copy", 0);
15293 
15294   /* "View.MemoryView":1083
15295  *     "Create a new memoryview object"
15296  *     cdef __Pyx_memviewslice memviewslice
15297  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
15298  *     return memoryview_copy_from_slice(memview, &memviewslice)
15299  *
15300  */
15301   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
15302 
15303   /* "View.MemoryView":1084
15304  *     cdef __Pyx_memviewslice memviewslice
15305  *     slice_copy(memview, &memviewslice)
15306  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
15307  *
15308  * @cname('__pyx_memoryview_copy_object_from_slice')
15309  */
15310   __Pyx_XDECREF(__pyx_r);
15311   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
15312   __Pyx_GOTREF(__pyx_t_1);
15313   __pyx_r = __pyx_t_1;
15314   __pyx_t_1 = 0;
15315   goto __pyx_L0;
15316 
15317   /* "View.MemoryView":1080
15318  *
15319  * @cname('__pyx_memoryview_copy_object')
15320  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
15321  *     "Create a new memoryview object"
15322  *     cdef __Pyx_memviewslice memviewslice
15323  */
15324 
15325   /* function exit code */
15326   __pyx_L1_error:;
15327   __Pyx_XDECREF(__pyx_t_1);
15328   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15329   __pyx_r = 0;
15330   __pyx_L0:;
15331   __Pyx_XGIVEREF(__pyx_r);
15332   __Pyx_RefNannyFinishContext();
15333   return __pyx_r;
15334 }
15335 
15336 /* "View.MemoryView":1087
15337  *
15338  * @cname('__pyx_memoryview_copy_object_from_slice')
15339  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
15340  *     """
15341  *     Create a new memoryview object from a given memoryview object and slice.
15342  */
15343 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)15344 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
15345   PyObject *(*__pyx_v_to_object_func)(char *);
15346   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
15347   PyObject *__pyx_r = NULL;
15348   __Pyx_RefNannyDeclarations
15349   int __pyx_t_1;
15350   int __pyx_t_2;
15351   PyObject *(*__pyx_t_3)(char *);
15352   int (*__pyx_t_4)(char *, PyObject *);
15353   PyObject *__pyx_t_5 = NULL;
15354   int __pyx_lineno = 0;
15355   const char *__pyx_filename = NULL;
15356   int __pyx_clineno = 0;
15357   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
15358 
15359   /* "View.MemoryView":1094
15360  *     cdef int (*to_dtype_func)(char *, object) except 0
15361  *
15362  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15363  *         to_object_func = (<_memoryviewslice> memview).to_object_func
15364  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15365  */
15366   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15367   __pyx_t_2 = (__pyx_t_1 != 0);
15368   if (__pyx_t_2) {
15369 
15370     /* "View.MemoryView":1095
15371  *
15372  *     if isinstance(memview, _memoryviewslice):
15373  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
15374  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15375  *     else:
15376  */
15377     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
15378     __pyx_v_to_object_func = __pyx_t_3;
15379 
15380     /* "View.MemoryView":1096
15381  *     if isinstance(memview, _memoryviewslice):
15382  *         to_object_func = (<_memoryviewslice> memview).to_object_func
15383  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
15384  *     else:
15385  *         to_object_func = NULL
15386  */
15387     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
15388     __pyx_v_to_dtype_func = __pyx_t_4;
15389 
15390     /* "View.MemoryView":1094
15391  *     cdef int (*to_dtype_func)(char *, object) except 0
15392  *
15393  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15394  *         to_object_func = (<_memoryviewslice> memview).to_object_func
15395  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15396  */
15397     goto __pyx_L3;
15398   }
15399 
15400   /* "View.MemoryView":1098
15401  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15402  *     else:
15403  *         to_object_func = NULL             # <<<<<<<<<<<<<<
15404  *         to_dtype_func = NULL
15405  *
15406  */
15407   /*else*/ {
15408     __pyx_v_to_object_func = NULL;
15409 
15410     /* "View.MemoryView":1099
15411  *     else:
15412  *         to_object_func = NULL
15413  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
15414  *
15415  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
15416  */
15417     __pyx_v_to_dtype_func = NULL;
15418   }
15419   __pyx_L3:;
15420 
15421   /* "View.MemoryView":1101
15422  *         to_dtype_func = NULL
15423  *
15424  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
15425  *                                 to_object_func, to_dtype_func,
15426  *                                 memview.dtype_is_object)
15427  */
15428   __Pyx_XDECREF(__pyx_r);
15429 
15430   /* "View.MemoryView":1103
15431  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
15432  *                                 to_object_func, to_dtype_func,
15433  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
15434  *
15435  *
15436  */
15437   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
15438   __Pyx_GOTREF(__pyx_t_5);
15439   __pyx_r = __pyx_t_5;
15440   __pyx_t_5 = 0;
15441   goto __pyx_L0;
15442 
15443   /* "View.MemoryView":1087
15444  *
15445  * @cname('__pyx_memoryview_copy_object_from_slice')
15446  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
15447  *     """
15448  *     Create a new memoryview object from a given memoryview object and slice.
15449  */
15450 
15451   /* function exit code */
15452   __pyx_L1_error:;
15453   __Pyx_XDECREF(__pyx_t_5);
15454   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15455   __pyx_r = 0;
15456   __pyx_L0:;
15457   __Pyx_XGIVEREF(__pyx_r);
15458   __Pyx_RefNannyFinishContext();
15459   return __pyx_r;
15460 }
15461 
15462 /* "View.MemoryView":1109
15463  *
15464  *
15465  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
15466  *     if arg < 0:
15467  *         return -arg
15468  */
15469 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)15470 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
15471   Py_ssize_t __pyx_r;
15472   int __pyx_t_1;
15473 
15474   /* "View.MemoryView":1110
15475  *
15476  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15477  *     if arg < 0:             # <<<<<<<<<<<<<<
15478  *         return -arg
15479  *     else:
15480  */
15481   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
15482   if (__pyx_t_1) {
15483 
15484     /* "View.MemoryView":1111
15485  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15486  *     if arg < 0:
15487  *         return -arg             # <<<<<<<<<<<<<<
15488  *     else:
15489  *         return arg
15490  */
15491     __pyx_r = (-__pyx_v_arg);
15492     goto __pyx_L0;
15493 
15494     /* "View.MemoryView":1110
15495  *
15496  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15497  *     if arg < 0:             # <<<<<<<<<<<<<<
15498  *         return -arg
15499  *     else:
15500  */
15501   }
15502 
15503   /* "View.MemoryView":1113
15504  *         return -arg
15505  *     else:
15506  *         return arg             # <<<<<<<<<<<<<<
15507  *
15508  * @cname('__pyx_get_best_slice_order')
15509  */
15510   /*else*/ {
15511     __pyx_r = __pyx_v_arg;
15512     goto __pyx_L0;
15513   }
15514 
15515   /* "View.MemoryView":1109
15516  *
15517  *
15518  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
15519  *     if arg < 0:
15520  *         return -arg
15521  */
15522 
15523   /* function exit code */
15524   __pyx_L0:;
15525   return __pyx_r;
15526 }
15527 
15528 /* "View.MemoryView":1116
15529  *
15530  * @cname('__pyx_get_best_slice_order')
15531  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
15532  *     """
15533  *     Figure out the best memory access order for a given slice.
15534  */
15535 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)15536 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
15537   int __pyx_v_i;
15538   Py_ssize_t __pyx_v_c_stride;
15539   Py_ssize_t __pyx_v_f_stride;
15540   char __pyx_r;
15541   int __pyx_t_1;
15542   int __pyx_t_2;
15543   int __pyx_t_3;
15544   int __pyx_t_4;
15545 
15546   /* "View.MemoryView":1121
15547  *     """
15548  *     cdef int i
15549  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
15550  *     cdef Py_ssize_t f_stride = 0
15551  *
15552  */
15553   __pyx_v_c_stride = 0;
15554 
15555   /* "View.MemoryView":1122
15556  *     cdef int i
15557  *     cdef Py_ssize_t c_stride = 0
15558  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
15559  *
15560  *     for i in range(ndim - 1, -1, -1):
15561  */
15562   __pyx_v_f_stride = 0;
15563 
15564   /* "View.MemoryView":1124
15565  *     cdef Py_ssize_t f_stride = 0
15566  *
15567  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
15568  *         if mslice.shape[i] > 1:
15569  *             c_stride = mslice.strides[i]
15570  */
15571   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
15572     __pyx_v_i = __pyx_t_1;
15573 
15574     /* "View.MemoryView":1125
15575  *
15576  *     for i in range(ndim - 1, -1, -1):
15577  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
15578  *             c_stride = mslice.strides[i]
15579  *             break
15580  */
15581     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15582     if (__pyx_t_2) {
15583 
15584       /* "View.MemoryView":1126
15585  *     for i in range(ndim - 1, -1, -1):
15586  *         if mslice.shape[i] > 1:
15587  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
15588  *             break
15589  *
15590  */
15591       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15592 
15593       /* "View.MemoryView":1127
15594  *         if mslice.shape[i] > 1:
15595  *             c_stride = mslice.strides[i]
15596  *             break             # <<<<<<<<<<<<<<
15597  *
15598  *     for i in range(ndim):
15599  */
15600       goto __pyx_L4_break;
15601 
15602       /* "View.MemoryView":1125
15603  *
15604  *     for i in range(ndim - 1, -1, -1):
15605  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
15606  *             c_stride = mslice.strides[i]
15607  *             break
15608  */
15609     }
15610   }
15611   __pyx_L4_break:;
15612 
15613   /* "View.MemoryView":1129
15614  *             break
15615  *
15616  *     for i in range(ndim):             # <<<<<<<<<<<<<<
15617  *         if mslice.shape[i] > 1:
15618  *             f_stride = mslice.strides[i]
15619  */
15620   __pyx_t_1 = __pyx_v_ndim;
15621   __pyx_t_3 = __pyx_t_1;
15622   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15623     __pyx_v_i = __pyx_t_4;
15624 
15625     /* "View.MemoryView":1130
15626  *
15627  *     for i in range(ndim):
15628  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
15629  *             f_stride = mslice.strides[i]
15630  *             break
15631  */
15632     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15633     if (__pyx_t_2) {
15634 
15635       /* "View.MemoryView":1131
15636  *     for i in range(ndim):
15637  *         if mslice.shape[i] > 1:
15638  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
15639  *             break
15640  *
15641  */
15642       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15643 
15644       /* "View.MemoryView":1132
15645  *         if mslice.shape[i] > 1:
15646  *             f_stride = mslice.strides[i]
15647  *             break             # <<<<<<<<<<<<<<
15648  *
15649  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
15650  */
15651       goto __pyx_L7_break;
15652 
15653       /* "View.MemoryView":1130
15654  *
15655  *     for i in range(ndim):
15656  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
15657  *             f_stride = mslice.strides[i]
15658  *             break
15659  */
15660     }
15661   }
15662   __pyx_L7_break:;
15663 
15664   /* "View.MemoryView":1134
15665  *             break
15666  *
15667  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
15668  *         return 'C'
15669  *     else:
15670  */
15671   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
15672   if (__pyx_t_2) {
15673 
15674     /* "View.MemoryView":1135
15675  *
15676  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
15677  *         return 'C'             # <<<<<<<<<<<<<<
15678  *     else:
15679  *         return 'F'
15680  */
15681     __pyx_r = 'C';
15682     goto __pyx_L0;
15683 
15684     /* "View.MemoryView":1134
15685  *             break
15686  *
15687  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
15688  *         return 'C'
15689  *     else:
15690  */
15691   }
15692 
15693   /* "View.MemoryView":1137
15694  *         return 'C'
15695  *     else:
15696  *         return 'F'             # <<<<<<<<<<<<<<
15697  *
15698  * @cython.cdivision(True)
15699  */
15700   /*else*/ {
15701     __pyx_r = 'F';
15702     goto __pyx_L0;
15703   }
15704 
15705   /* "View.MemoryView":1116
15706  *
15707  * @cname('__pyx_get_best_slice_order')
15708  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
15709  *     """
15710  *     Figure out the best memory access order for a given slice.
15711  */
15712 
15713   /* function exit code */
15714   __pyx_L0:;
15715   return __pyx_r;
15716 }
15717 
15718 /* "View.MemoryView":1140
15719  *
15720  * @cython.cdivision(True)
15721  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
15722  *                                    char *dst_data, Py_ssize_t *dst_strides,
15723  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
15724  */
15725 
_copy_strided_to_strided(char * __pyx_v_src_data,Py_ssize_t * __pyx_v_src_strides,char * __pyx_v_dst_data,Py_ssize_t * __pyx_v_dst_strides,Py_ssize_t * __pyx_v_src_shape,Py_ssize_t * __pyx_v_dst_shape,int __pyx_v_ndim,size_t __pyx_v_itemsize)15726 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
15727   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
15728   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
15729   Py_ssize_t __pyx_v_dst_extent;
15730   Py_ssize_t __pyx_v_src_stride;
15731   Py_ssize_t __pyx_v_dst_stride;
15732   int __pyx_t_1;
15733   int __pyx_t_2;
15734   int __pyx_t_3;
15735   Py_ssize_t __pyx_t_4;
15736   Py_ssize_t __pyx_t_5;
15737   Py_ssize_t __pyx_t_6;
15738 
15739   /* "View.MemoryView":1147
15740  *
15741  *     cdef Py_ssize_t i
15742  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
15743  *     cdef Py_ssize_t dst_extent = dst_shape[0]
15744  *     cdef Py_ssize_t src_stride = src_strides[0]
15745  */
15746   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
15747 
15748   /* "View.MemoryView":1148
15749  *     cdef Py_ssize_t i
15750  *     cdef Py_ssize_t src_extent = src_shape[0]
15751  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
15752  *     cdef Py_ssize_t src_stride = src_strides[0]
15753  *     cdef Py_ssize_t dst_stride = dst_strides[0]
15754  */
15755   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
15756 
15757   /* "View.MemoryView":1149
15758  *     cdef Py_ssize_t src_extent = src_shape[0]
15759  *     cdef Py_ssize_t dst_extent = dst_shape[0]
15760  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
15761  *     cdef Py_ssize_t dst_stride = dst_strides[0]
15762  *
15763  */
15764   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
15765 
15766   /* "View.MemoryView":1150
15767  *     cdef Py_ssize_t dst_extent = dst_shape[0]
15768  *     cdef Py_ssize_t src_stride = src_strides[0]
15769  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
15770  *
15771  *     if ndim == 1:
15772  */
15773   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
15774 
15775   /* "View.MemoryView":1152
15776  *     cdef Py_ssize_t dst_stride = dst_strides[0]
15777  *
15778  *     if ndim == 1:             # <<<<<<<<<<<<<<
15779  *        if (src_stride > 0 and dst_stride > 0 and
15780  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15781  */
15782   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
15783   if (__pyx_t_1) {
15784 
15785     /* "View.MemoryView":1153
15786  *
15787  *     if ndim == 1:
15788  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
15789  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15790  *            memcpy(dst_data, src_data, itemsize * dst_extent)
15791  */
15792     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
15793     if (__pyx_t_2) {
15794     } else {
15795       __pyx_t_1 = __pyx_t_2;
15796       goto __pyx_L5_bool_binop_done;
15797     }
15798     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
15799     if (__pyx_t_2) {
15800     } else {
15801       __pyx_t_1 = __pyx_t_2;
15802       goto __pyx_L5_bool_binop_done;
15803     }
15804 
15805     /* "View.MemoryView":1154
15806  *     if ndim == 1:
15807  *        if (src_stride > 0 and dst_stride > 0 and
15808  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
15809  *            memcpy(dst_data, src_data, itemsize * dst_extent)
15810  *        else:
15811  */
15812     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
15813     if (__pyx_t_2) {
15814       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
15815     }
15816     __pyx_t_3 = (__pyx_t_2 != 0);
15817     __pyx_t_1 = __pyx_t_3;
15818     __pyx_L5_bool_binop_done:;
15819 
15820     /* "View.MemoryView":1153
15821  *
15822  *     if ndim == 1:
15823  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
15824  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15825  *            memcpy(dst_data, src_data, itemsize * dst_extent)
15826  */
15827     if (__pyx_t_1) {
15828 
15829       /* "View.MemoryView":1155
15830  *        if (src_stride > 0 and dst_stride > 0 and
15831  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15832  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
15833  *        else:
15834  *            for i in range(dst_extent):
15835  */
15836       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
15837 
15838       /* "View.MemoryView":1153
15839  *
15840  *     if ndim == 1:
15841  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
15842  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15843  *            memcpy(dst_data, src_data, itemsize * dst_extent)
15844  */
15845       goto __pyx_L4;
15846     }
15847 
15848     /* "View.MemoryView":1157
15849  *            memcpy(dst_data, src_data, itemsize * dst_extent)
15850  *        else:
15851  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
15852  *                memcpy(dst_data, src_data, itemsize)
15853  *                src_data += src_stride
15854  */
15855     /*else*/ {
15856       __pyx_t_4 = __pyx_v_dst_extent;
15857       __pyx_t_5 = __pyx_t_4;
15858       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15859         __pyx_v_i = __pyx_t_6;
15860 
15861         /* "View.MemoryView":1158
15862  *        else:
15863  *            for i in range(dst_extent):
15864  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
15865  *                src_data += src_stride
15866  *                dst_data += dst_stride
15867  */
15868         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
15869 
15870         /* "View.MemoryView":1159
15871  *            for i in range(dst_extent):
15872  *                memcpy(dst_data, src_data, itemsize)
15873  *                src_data += src_stride             # <<<<<<<<<<<<<<
15874  *                dst_data += dst_stride
15875  *     else:
15876  */
15877         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15878 
15879         /* "View.MemoryView":1160
15880  *                memcpy(dst_data, src_data, itemsize)
15881  *                src_data += src_stride
15882  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
15883  *     else:
15884  *         for i in range(dst_extent):
15885  */
15886         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
15887       }
15888     }
15889     __pyx_L4:;
15890 
15891     /* "View.MemoryView":1152
15892  *     cdef Py_ssize_t dst_stride = dst_strides[0]
15893  *
15894  *     if ndim == 1:             # <<<<<<<<<<<<<<
15895  *        if (src_stride > 0 and dst_stride > 0 and
15896  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
15897  */
15898     goto __pyx_L3;
15899   }
15900 
15901   /* "View.MemoryView":1162
15902  *                dst_data += dst_stride
15903  *     else:
15904  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
15905  *             _copy_strided_to_strided(src_data, src_strides + 1,
15906  *                                      dst_data, dst_strides + 1,
15907  */
15908   /*else*/ {
15909     __pyx_t_4 = __pyx_v_dst_extent;
15910     __pyx_t_5 = __pyx_t_4;
15911     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15912       __pyx_v_i = __pyx_t_6;
15913 
15914       /* "View.MemoryView":1163
15915  *     else:
15916  *         for i in range(dst_extent):
15917  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
15918  *                                      dst_data, dst_strides + 1,
15919  *                                      src_shape + 1, dst_shape + 1,
15920  */
15921       _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
15922 
15923       /* "View.MemoryView":1167
15924  *                                      src_shape + 1, dst_shape + 1,
15925  *                                      ndim - 1, itemsize)
15926  *             src_data += src_stride             # <<<<<<<<<<<<<<
15927  *             dst_data += dst_stride
15928  *
15929  */
15930       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15931 
15932       /* "View.MemoryView":1168
15933  *                                      ndim - 1, itemsize)
15934  *             src_data += src_stride
15935  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
15936  *
15937  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
15938  */
15939       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
15940     }
15941   }
15942   __pyx_L3:;
15943 
15944   /* "View.MemoryView":1140
15945  *
15946  * @cython.cdivision(True)
15947  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
15948  *                                    char *dst_data, Py_ssize_t *dst_strides,
15949  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
15950  */
15951 
15952   /* function exit code */
15953 }
15954 
15955 /* "View.MemoryView":1170
15956  *             dst_data += dst_stride
15957  *
15958  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
15959  *                                   __Pyx_memviewslice *dst,
15960  *                                   int ndim, size_t itemsize) nogil:
15961  */
15962 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)15963 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
15964 
15965   /* "View.MemoryView":1173
15966  *                                   __Pyx_memviewslice *dst,
15967  *                                   int ndim, size_t itemsize) nogil:
15968  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
15969  *                              src.shape, dst.shape, ndim, itemsize)
15970  *
15971  */
15972   _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
15973 
15974   /* "View.MemoryView":1170
15975  *             dst_data += dst_stride
15976  *
15977  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
15978  *                                   __Pyx_memviewslice *dst,
15979  *                                   int ndim, size_t itemsize) nogil:
15980  */
15981 
15982   /* function exit code */
15983 }
15984 
15985 /* "View.MemoryView":1177
15986  *
15987  * @cname('__pyx_memoryview_slice_get_size')
15988  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
15989  *     "Return the size of the memory occupied by the slice in number of bytes"
15990  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
15991  */
15992 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)15993 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
15994   Py_ssize_t __pyx_v_shape;
15995   Py_ssize_t __pyx_v_size;
15996   Py_ssize_t __pyx_r;
15997   Py_ssize_t __pyx_t_1;
15998   Py_ssize_t *__pyx_t_2;
15999   Py_ssize_t *__pyx_t_3;
16000   Py_ssize_t *__pyx_t_4;
16001 
16002   /* "View.MemoryView":1179
16003  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
16004  *     "Return the size of the memory occupied by the slice in number of bytes"
16005  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
16006  *
16007  *     for shape in src.shape[:ndim]:
16008  */
16009   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16010   __pyx_v_size = __pyx_t_1;
16011 
16012   /* "View.MemoryView":1181
16013  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
16014  *
16015  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
16016  *         size *= shape
16017  *
16018  */
16019   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
16020   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
16021     __pyx_t_2 = __pyx_t_4;
16022     __pyx_v_shape = (__pyx_t_2[0]);
16023 
16024     /* "View.MemoryView":1182
16025  *
16026  *     for shape in src.shape[:ndim]:
16027  *         size *= shape             # <<<<<<<<<<<<<<
16028  *
16029  *     return size
16030  */
16031     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
16032   }
16033 
16034   /* "View.MemoryView":1184
16035  *         size *= shape
16036  *
16037  *     return size             # <<<<<<<<<<<<<<
16038  *
16039  * @cname('__pyx_fill_contig_strides_array')
16040  */
16041   __pyx_r = __pyx_v_size;
16042   goto __pyx_L0;
16043 
16044   /* "View.MemoryView":1177
16045  *
16046  * @cname('__pyx_memoryview_slice_get_size')
16047  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
16048  *     "Return the size of the memory occupied by the slice in number of bytes"
16049  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
16050  */
16051 
16052   /* function exit code */
16053   __pyx_L0:;
16054   return __pyx_r;
16055 }
16056 
16057 /* "View.MemoryView":1187
16058  *
16059  * @cname('__pyx_fill_contig_strides_array')
16060  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
16061  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16062  *                 int ndim, char order) nogil:
16063  */
16064 
__pyx_fill_contig_strides_array(Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,Py_ssize_t __pyx_v_stride,int __pyx_v_ndim,char __pyx_v_order)16065 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
16066   int __pyx_v_idx;
16067   Py_ssize_t __pyx_r;
16068   int __pyx_t_1;
16069   int __pyx_t_2;
16070   int __pyx_t_3;
16071   int __pyx_t_4;
16072 
16073   /* "View.MemoryView":1196
16074  *     cdef int idx
16075  *
16076  *     if order == 'F':             # <<<<<<<<<<<<<<
16077  *         for idx in range(ndim):
16078  *             strides[idx] = stride
16079  */
16080   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
16081   if (__pyx_t_1) {
16082 
16083     /* "View.MemoryView":1197
16084  *
16085  *     if order == 'F':
16086  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
16087  *             strides[idx] = stride
16088  *             stride *= shape[idx]
16089  */
16090     __pyx_t_2 = __pyx_v_ndim;
16091     __pyx_t_3 = __pyx_t_2;
16092     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16093       __pyx_v_idx = __pyx_t_4;
16094 
16095       /* "View.MemoryView":1198
16096  *     if order == 'F':
16097  *         for idx in range(ndim):
16098  *             strides[idx] = stride             # <<<<<<<<<<<<<<
16099  *             stride *= shape[idx]
16100  *     else:
16101  */
16102       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16103 
16104       /* "View.MemoryView":1199
16105  *         for idx in range(ndim):
16106  *             strides[idx] = stride
16107  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
16108  *     else:
16109  *         for idx in range(ndim - 1, -1, -1):
16110  */
16111       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16112     }
16113 
16114     /* "View.MemoryView":1196
16115  *     cdef int idx
16116  *
16117  *     if order == 'F':             # <<<<<<<<<<<<<<
16118  *         for idx in range(ndim):
16119  *             strides[idx] = stride
16120  */
16121     goto __pyx_L3;
16122   }
16123 
16124   /* "View.MemoryView":1201
16125  *             stride *= shape[idx]
16126  *     else:
16127  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
16128  *             strides[idx] = stride
16129  *             stride *= shape[idx]
16130  */
16131   /*else*/ {
16132     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
16133       __pyx_v_idx = __pyx_t_2;
16134 
16135       /* "View.MemoryView":1202
16136  *     else:
16137  *         for idx in range(ndim - 1, -1, -1):
16138  *             strides[idx] = stride             # <<<<<<<<<<<<<<
16139  *             stride *= shape[idx]
16140  *
16141  */
16142       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16143 
16144       /* "View.MemoryView":1203
16145  *         for idx in range(ndim - 1, -1, -1):
16146  *             strides[idx] = stride
16147  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
16148  *
16149  *     return stride
16150  */
16151       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16152     }
16153   }
16154   __pyx_L3:;
16155 
16156   /* "View.MemoryView":1205
16157  *             stride *= shape[idx]
16158  *
16159  *     return stride             # <<<<<<<<<<<<<<
16160  *
16161  * @cname('__pyx_memoryview_copy_data_to_temp')
16162  */
16163   __pyx_r = __pyx_v_stride;
16164   goto __pyx_L0;
16165 
16166   /* "View.MemoryView":1187
16167  *
16168  * @cname('__pyx_fill_contig_strides_array')
16169  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
16170  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16171  *                 int ndim, char order) nogil:
16172  */
16173 
16174   /* function exit code */
16175   __pyx_L0:;
16176   return __pyx_r;
16177 }
16178 
16179 /* "View.MemoryView":1208
16180  *
16181  * @cname('__pyx_memoryview_copy_data_to_temp')
16182  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
16183  *                              __Pyx_memviewslice *tmpslice,
16184  *                              char order,
16185  */
16186 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)16187 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
16188   int __pyx_v_i;
16189   void *__pyx_v_result;
16190   size_t __pyx_v_itemsize;
16191   size_t __pyx_v_size;
16192   void *__pyx_r;
16193   Py_ssize_t __pyx_t_1;
16194   int __pyx_t_2;
16195   int __pyx_t_3;
16196   struct __pyx_memoryview_obj *__pyx_t_4;
16197   int __pyx_t_5;
16198   int __pyx_t_6;
16199   int __pyx_lineno = 0;
16200   const char *__pyx_filename = NULL;
16201   int __pyx_clineno = 0;
16202 
16203   /* "View.MemoryView":1219
16204  *     cdef void *result
16205  *
16206  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
16207  *     cdef size_t size = slice_get_size(src, ndim)
16208  *
16209  */
16210   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16211   __pyx_v_itemsize = __pyx_t_1;
16212 
16213   /* "View.MemoryView":1220
16214  *
16215  *     cdef size_t itemsize = src.memview.view.itemsize
16216  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
16217  *
16218  *     result = malloc(size)
16219  */
16220   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
16221 
16222   /* "View.MemoryView":1222
16223  *     cdef size_t size = slice_get_size(src, ndim)
16224  *
16225  *     result = malloc(size)             # <<<<<<<<<<<<<<
16226  *     if not result:
16227  *         _err(MemoryError, NULL)
16228  */
16229   __pyx_v_result = malloc(__pyx_v_size);
16230 
16231   /* "View.MemoryView":1223
16232  *
16233  *     result = malloc(size)
16234  *     if not result:             # <<<<<<<<<<<<<<
16235  *         _err(MemoryError, NULL)
16236  *
16237  */
16238   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
16239   if (__pyx_t_2) {
16240 
16241     /* "View.MemoryView":1224
16242  *     result = malloc(size)
16243  *     if not result:
16244  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
16245  *
16246  *
16247  */
16248     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
16249 
16250     /* "View.MemoryView":1223
16251  *
16252  *     result = malloc(size)
16253  *     if not result:             # <<<<<<<<<<<<<<
16254  *         _err(MemoryError, NULL)
16255  *
16256  */
16257   }
16258 
16259   /* "View.MemoryView":1227
16260  *
16261  *
16262  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
16263  *     tmpslice.memview = src.memview
16264  *     for i in range(ndim):
16265  */
16266   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
16267 
16268   /* "View.MemoryView":1228
16269  *
16270  *     tmpslice.data = <char *> result
16271  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
16272  *     for i in range(ndim):
16273  *         tmpslice.shape[i] = src.shape[i]
16274  */
16275   __pyx_t_4 = __pyx_v_src->memview;
16276   __pyx_v_tmpslice->memview = __pyx_t_4;
16277 
16278   /* "View.MemoryView":1229
16279  *     tmpslice.data = <char *> result
16280  *     tmpslice.memview = src.memview
16281  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16282  *         tmpslice.shape[i] = src.shape[i]
16283  *         tmpslice.suboffsets[i] = -1
16284  */
16285   __pyx_t_3 = __pyx_v_ndim;
16286   __pyx_t_5 = __pyx_t_3;
16287   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16288     __pyx_v_i = __pyx_t_6;
16289 
16290     /* "View.MemoryView":1230
16291  *     tmpslice.memview = src.memview
16292  *     for i in range(ndim):
16293  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
16294  *         tmpslice.suboffsets[i] = -1
16295  *
16296  */
16297     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
16298 
16299     /* "View.MemoryView":1231
16300  *     for i in range(ndim):
16301  *         tmpslice.shape[i] = src.shape[i]
16302  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
16303  *
16304  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
16305  */
16306     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
16307   }
16308 
16309   /* "View.MemoryView":1233
16310  *         tmpslice.suboffsets[i] = -1
16311  *
16312  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
16313  *                               ndim, order)
16314  *
16315  */
16316   (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
16317 
16318   /* "View.MemoryView":1237
16319  *
16320  *
16321  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16322  *         if tmpslice.shape[i] == 1:
16323  *             tmpslice.strides[i] = 0
16324  */
16325   __pyx_t_3 = __pyx_v_ndim;
16326   __pyx_t_5 = __pyx_t_3;
16327   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16328     __pyx_v_i = __pyx_t_6;
16329 
16330     /* "View.MemoryView":1238
16331  *
16332  *     for i in range(ndim):
16333  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
16334  *             tmpslice.strides[i] = 0
16335  *
16336  */
16337     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
16338     if (__pyx_t_2) {
16339 
16340       /* "View.MemoryView":1239
16341  *     for i in range(ndim):
16342  *         if tmpslice.shape[i] == 1:
16343  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
16344  *
16345  *     if slice_is_contig(src[0], order, ndim):
16346  */
16347       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
16348 
16349       /* "View.MemoryView":1238
16350  *
16351  *     for i in range(ndim):
16352  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
16353  *             tmpslice.strides[i] = 0
16354  *
16355  */
16356     }
16357   }
16358 
16359   /* "View.MemoryView":1241
16360  *             tmpslice.strides[i] = 0
16361  *
16362  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
16363  *         memcpy(result, src.data, size)
16364  *     else:
16365  */
16366   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
16367   if (__pyx_t_2) {
16368 
16369     /* "View.MemoryView":1242
16370  *
16371  *     if slice_is_contig(src[0], order, ndim):
16372  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
16373  *     else:
16374  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
16375  */
16376     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
16377 
16378     /* "View.MemoryView":1241
16379  *             tmpslice.strides[i] = 0
16380  *
16381  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
16382  *         memcpy(result, src.data, size)
16383  *     else:
16384  */
16385     goto __pyx_L9;
16386   }
16387 
16388   /* "View.MemoryView":1244
16389  *         memcpy(result, src.data, size)
16390  *     else:
16391  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
16392  *
16393  *     return result
16394  */
16395   /*else*/ {
16396     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
16397   }
16398   __pyx_L9:;
16399 
16400   /* "View.MemoryView":1246
16401  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
16402  *
16403  *     return result             # <<<<<<<<<<<<<<
16404  *
16405  *
16406  */
16407   __pyx_r = __pyx_v_result;
16408   goto __pyx_L0;
16409 
16410   /* "View.MemoryView":1208
16411  *
16412  * @cname('__pyx_memoryview_copy_data_to_temp')
16413  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
16414  *                              __Pyx_memviewslice *tmpslice,
16415  *                              char order,
16416  */
16417 
16418   /* function exit code */
16419   __pyx_L1_error:;
16420   {
16421     #ifdef WITH_THREAD
16422     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16423     #endif
16424     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
16425     #ifdef WITH_THREAD
16426     __Pyx_PyGILState_Release(__pyx_gilstate_save);
16427     #endif
16428   }
16429   __pyx_r = NULL;
16430   __pyx_L0:;
16431   return __pyx_r;
16432 }
16433 
16434 /* "View.MemoryView":1251
16435  *
16436  * @cname('__pyx_memoryview_err_extents')
16437  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
16438  *                              Py_ssize_t extent2) except -1 with gil:
16439  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16440  */
16441 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)16442 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
16443   int __pyx_r;
16444   __Pyx_RefNannyDeclarations
16445   PyObject *__pyx_t_1 = NULL;
16446   PyObject *__pyx_t_2 = NULL;
16447   PyObject *__pyx_t_3 = NULL;
16448   PyObject *__pyx_t_4 = NULL;
16449   int __pyx_lineno = 0;
16450   const char *__pyx_filename = NULL;
16451   int __pyx_clineno = 0;
16452   #ifdef WITH_THREAD
16453   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16454   #endif
16455   __Pyx_RefNannySetupContext("_err_extents", 0);
16456 
16457   /* "View.MemoryView":1254
16458  *                              Py_ssize_t extent2) except -1 with gil:
16459  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16460  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
16461  *
16462  * @cname('__pyx_memoryview_err_dim')
16463  */
16464   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
16465   __Pyx_GOTREF(__pyx_t_1);
16466   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
16467   __Pyx_GOTREF(__pyx_t_2);
16468   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
16469   __Pyx_GOTREF(__pyx_t_3);
16470   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
16471   __Pyx_GOTREF(__pyx_t_4);
16472   __Pyx_GIVEREF(__pyx_t_1);
16473   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
16474   __Pyx_GIVEREF(__pyx_t_2);
16475   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
16476   __Pyx_GIVEREF(__pyx_t_3);
16477   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
16478   __pyx_t_1 = 0;
16479   __pyx_t_2 = 0;
16480   __pyx_t_3 = 0;
16481 
16482   /* "View.MemoryView":1253
16483  * cdef int _err_extents(int i, Py_ssize_t extent1,
16484  *                              Py_ssize_t extent2) except -1 with gil:
16485  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
16486  *                                                         (i, extent1, extent2))
16487  *
16488  */
16489   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
16490   __Pyx_GOTREF(__pyx_t_3);
16491   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16492   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
16493   __Pyx_GOTREF(__pyx_t_4);
16494   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16495   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
16496   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16497   __PYX_ERR(2, 1253, __pyx_L1_error)
16498 
16499   /* "View.MemoryView":1251
16500  *
16501  * @cname('__pyx_memoryview_err_extents')
16502  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
16503  *                              Py_ssize_t extent2) except -1 with gil:
16504  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16505  */
16506 
16507   /* function exit code */
16508   __pyx_L1_error:;
16509   __Pyx_XDECREF(__pyx_t_1);
16510   __Pyx_XDECREF(__pyx_t_2);
16511   __Pyx_XDECREF(__pyx_t_3);
16512   __Pyx_XDECREF(__pyx_t_4);
16513   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
16514   __pyx_r = -1;
16515   __Pyx_RefNannyFinishContext();
16516   #ifdef WITH_THREAD
16517   __Pyx_PyGILState_Release(__pyx_gilstate_save);
16518   #endif
16519   return __pyx_r;
16520 }
16521 
16522 /* "View.MemoryView":1257
16523  *
16524  * @cname('__pyx_memoryview_err_dim')
16525  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
16526  *     raise error(msg.decode('ascii') % dim)
16527  *
16528  */
16529 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)16530 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
16531   int __pyx_r;
16532   __Pyx_RefNannyDeclarations
16533   PyObject *__pyx_t_1 = NULL;
16534   PyObject *__pyx_t_2 = NULL;
16535   PyObject *__pyx_t_3 = NULL;
16536   PyObject *__pyx_t_4 = NULL;
16537   int __pyx_lineno = 0;
16538   const char *__pyx_filename = NULL;
16539   int __pyx_clineno = 0;
16540   #ifdef WITH_THREAD
16541   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16542   #endif
16543   __Pyx_RefNannySetupContext("_err_dim", 0);
16544   __Pyx_INCREF(__pyx_v_error);
16545 
16546   /* "View.MemoryView":1258
16547  * @cname('__pyx_memoryview_err_dim')
16548  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
16549  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
16550  *
16551  * @cname('__pyx_memoryview_err')
16552  */
16553   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
16554   __Pyx_GOTREF(__pyx_t_2);
16555   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
16556   __Pyx_GOTREF(__pyx_t_3);
16557   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
16558   __Pyx_GOTREF(__pyx_t_4);
16559   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16560   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16561   __Pyx_INCREF(__pyx_v_error);
16562   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
16563   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16564     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
16565     if (likely(__pyx_t_2)) {
16566       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16567       __Pyx_INCREF(__pyx_t_2);
16568       __Pyx_INCREF(function);
16569       __Pyx_DECREF_SET(__pyx_t_3, function);
16570     }
16571   }
16572   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
16573   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16574   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16575   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
16576   __Pyx_GOTREF(__pyx_t_1);
16577   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16578   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16579   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16580   __PYX_ERR(2, 1258, __pyx_L1_error)
16581 
16582   /* "View.MemoryView":1257
16583  *
16584  * @cname('__pyx_memoryview_err_dim')
16585  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
16586  *     raise error(msg.decode('ascii') % dim)
16587  *
16588  */
16589 
16590   /* function exit code */
16591   __pyx_L1_error:;
16592   __Pyx_XDECREF(__pyx_t_1);
16593   __Pyx_XDECREF(__pyx_t_2);
16594   __Pyx_XDECREF(__pyx_t_3);
16595   __Pyx_XDECREF(__pyx_t_4);
16596   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
16597   __pyx_r = -1;
16598   __Pyx_XDECREF(__pyx_v_error);
16599   __Pyx_RefNannyFinishContext();
16600   #ifdef WITH_THREAD
16601   __Pyx_PyGILState_Release(__pyx_gilstate_save);
16602   #endif
16603   return __pyx_r;
16604 }
16605 
16606 /* "View.MemoryView":1261
16607  *
16608  * @cname('__pyx_memoryview_err')
16609  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
16610  *     if msg != NULL:
16611  *         raise error(msg.decode('ascii'))
16612  */
16613 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)16614 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
16615   int __pyx_r;
16616   __Pyx_RefNannyDeclarations
16617   int __pyx_t_1;
16618   PyObject *__pyx_t_2 = NULL;
16619   PyObject *__pyx_t_3 = NULL;
16620   PyObject *__pyx_t_4 = NULL;
16621   PyObject *__pyx_t_5 = NULL;
16622   int __pyx_lineno = 0;
16623   const char *__pyx_filename = NULL;
16624   int __pyx_clineno = 0;
16625   #ifdef WITH_THREAD
16626   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16627   #endif
16628   __Pyx_RefNannySetupContext("_err", 0);
16629   __Pyx_INCREF(__pyx_v_error);
16630 
16631   /* "View.MemoryView":1262
16632  * @cname('__pyx_memoryview_err')
16633  * cdef int _err(object error, char *msg) except -1 with gil:
16634  *     if msg != NULL:             # <<<<<<<<<<<<<<
16635  *         raise error(msg.decode('ascii'))
16636  *     else:
16637  */
16638   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
16639   if (unlikely(__pyx_t_1)) {
16640 
16641     /* "View.MemoryView":1263
16642  * cdef int _err(object error, char *msg) except -1 with gil:
16643  *     if msg != NULL:
16644  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
16645  *     else:
16646  *         raise error
16647  */
16648     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
16649     __Pyx_GOTREF(__pyx_t_3);
16650     __Pyx_INCREF(__pyx_v_error);
16651     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
16652     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16653       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16654       if (likely(__pyx_t_5)) {
16655         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16656         __Pyx_INCREF(__pyx_t_5);
16657         __Pyx_INCREF(function);
16658         __Pyx_DECREF_SET(__pyx_t_4, function);
16659       }
16660     }
16661     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
16662     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16663     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16664     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
16665     __Pyx_GOTREF(__pyx_t_2);
16666     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16667     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
16668     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16669     __PYX_ERR(2, 1263, __pyx_L1_error)
16670 
16671     /* "View.MemoryView":1262
16672  * @cname('__pyx_memoryview_err')
16673  * cdef int _err(object error, char *msg) except -1 with gil:
16674  *     if msg != NULL:             # <<<<<<<<<<<<<<
16675  *         raise error(msg.decode('ascii'))
16676  *     else:
16677  */
16678   }
16679 
16680   /* "View.MemoryView":1265
16681  *         raise error(msg.decode('ascii'))
16682  *     else:
16683  *         raise error             # <<<<<<<<<<<<<<
16684  *
16685  * @cname('__pyx_memoryview_copy_contents')
16686  */
16687   /*else*/ {
16688     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
16689     __PYX_ERR(2, 1265, __pyx_L1_error)
16690   }
16691 
16692   /* "View.MemoryView":1261
16693  *
16694  * @cname('__pyx_memoryview_err')
16695  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
16696  *     if msg != NULL:
16697  *         raise error(msg.decode('ascii'))
16698  */
16699 
16700   /* function exit code */
16701   __pyx_L1_error:;
16702   __Pyx_XDECREF(__pyx_t_2);
16703   __Pyx_XDECREF(__pyx_t_3);
16704   __Pyx_XDECREF(__pyx_t_4);
16705   __Pyx_XDECREF(__pyx_t_5);
16706   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
16707   __pyx_r = -1;
16708   __Pyx_XDECREF(__pyx_v_error);
16709   __Pyx_RefNannyFinishContext();
16710   #ifdef WITH_THREAD
16711   __Pyx_PyGILState_Release(__pyx_gilstate_save);
16712   #endif
16713   return __pyx_r;
16714 }
16715 
16716 /* "View.MemoryView":1268
16717  *
16718  * @cname('__pyx_memoryview_copy_contents')
16719  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
16720  *                                   __Pyx_memviewslice dst,
16721  *                                   int src_ndim, int dst_ndim,
16722  */
16723 
__pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src,__Pyx_memviewslice __pyx_v_dst,int __pyx_v_src_ndim,int __pyx_v_dst_ndim,int __pyx_v_dtype_is_object)16724 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
16725   void *__pyx_v_tmpdata;
16726   size_t __pyx_v_itemsize;
16727   int __pyx_v_i;
16728   char __pyx_v_order;
16729   int __pyx_v_broadcasting;
16730   int __pyx_v_direct_copy;
16731   __Pyx_memviewslice __pyx_v_tmp;
16732   int __pyx_v_ndim;
16733   int __pyx_r;
16734   Py_ssize_t __pyx_t_1;
16735   int __pyx_t_2;
16736   int __pyx_t_3;
16737   int __pyx_t_4;
16738   int __pyx_t_5;
16739   int __pyx_t_6;
16740   void *__pyx_t_7;
16741   int __pyx_t_8;
16742   int __pyx_lineno = 0;
16743   const char *__pyx_filename = NULL;
16744   int __pyx_clineno = 0;
16745 
16746   /* "View.MemoryView":1276
16747  *     Check for overlapping memory and verify the shapes.
16748  *     """
16749  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
16750  *     cdef size_t itemsize = src.memview.view.itemsize
16751  *     cdef int i
16752  */
16753   __pyx_v_tmpdata = NULL;
16754 
16755   /* "View.MemoryView":1277
16756  *     """
16757  *     cdef void *tmpdata = NULL
16758  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
16759  *     cdef int i
16760  *     cdef char order = get_best_order(&src, src_ndim)
16761  */
16762   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
16763   __pyx_v_itemsize = __pyx_t_1;
16764 
16765   /* "View.MemoryView":1279
16766  *     cdef size_t itemsize = src.memview.view.itemsize
16767  *     cdef int i
16768  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
16769  *     cdef bint broadcasting = False
16770  *     cdef bint direct_copy = False
16771  */
16772   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
16773 
16774   /* "View.MemoryView":1280
16775  *     cdef int i
16776  *     cdef char order = get_best_order(&src, src_ndim)
16777  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
16778  *     cdef bint direct_copy = False
16779  *     cdef __Pyx_memviewslice tmp
16780  */
16781   __pyx_v_broadcasting = 0;
16782 
16783   /* "View.MemoryView":1281
16784  *     cdef char order = get_best_order(&src, src_ndim)
16785  *     cdef bint broadcasting = False
16786  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
16787  *     cdef __Pyx_memviewslice tmp
16788  *
16789  */
16790   __pyx_v_direct_copy = 0;
16791 
16792   /* "View.MemoryView":1284
16793  *     cdef __Pyx_memviewslice tmp
16794  *
16795  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
16796  *         broadcast_leading(&src, src_ndim, dst_ndim)
16797  *     elif dst_ndim < src_ndim:
16798  */
16799   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
16800   if (__pyx_t_2) {
16801 
16802     /* "View.MemoryView":1285
16803  *
16804  *     if src_ndim < dst_ndim:
16805  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
16806  *     elif dst_ndim < src_ndim:
16807  *         broadcast_leading(&dst, dst_ndim, src_ndim)
16808  */
16809     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
16810 
16811     /* "View.MemoryView":1284
16812  *     cdef __Pyx_memviewslice tmp
16813  *
16814  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
16815  *         broadcast_leading(&src, src_ndim, dst_ndim)
16816  *     elif dst_ndim < src_ndim:
16817  */
16818     goto __pyx_L3;
16819   }
16820 
16821   /* "View.MemoryView":1286
16822  *     if src_ndim < dst_ndim:
16823  *         broadcast_leading(&src, src_ndim, dst_ndim)
16824  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
16825  *         broadcast_leading(&dst, dst_ndim, src_ndim)
16826  *
16827  */
16828   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
16829   if (__pyx_t_2) {
16830 
16831     /* "View.MemoryView":1287
16832  *         broadcast_leading(&src, src_ndim, dst_ndim)
16833  *     elif dst_ndim < src_ndim:
16834  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
16835  *
16836  *     cdef int ndim = max(src_ndim, dst_ndim)
16837  */
16838     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
16839 
16840     /* "View.MemoryView":1286
16841  *     if src_ndim < dst_ndim:
16842  *         broadcast_leading(&src, src_ndim, dst_ndim)
16843  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
16844  *         broadcast_leading(&dst, dst_ndim, src_ndim)
16845  *
16846  */
16847   }
16848   __pyx_L3:;
16849 
16850   /* "View.MemoryView":1289
16851  *         broadcast_leading(&dst, dst_ndim, src_ndim)
16852  *
16853  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
16854  *
16855  *     for i in range(ndim):
16856  */
16857   __pyx_t_3 = __pyx_v_dst_ndim;
16858   __pyx_t_4 = __pyx_v_src_ndim;
16859   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
16860     __pyx_t_5 = __pyx_t_3;
16861   } else {
16862     __pyx_t_5 = __pyx_t_4;
16863   }
16864   __pyx_v_ndim = __pyx_t_5;
16865 
16866   /* "View.MemoryView":1291
16867  *     cdef int ndim = max(src_ndim, dst_ndim)
16868  *
16869  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16870  *         if src.shape[i] != dst.shape[i]:
16871  *             if src.shape[i] == 1:
16872  */
16873   __pyx_t_5 = __pyx_v_ndim;
16874   __pyx_t_3 = __pyx_t_5;
16875   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16876     __pyx_v_i = __pyx_t_4;
16877 
16878     /* "View.MemoryView":1292
16879  *
16880  *     for i in range(ndim):
16881  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
16882  *             if src.shape[i] == 1:
16883  *                 broadcasting = True
16884  */
16885     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
16886     if (__pyx_t_2) {
16887 
16888       /* "View.MemoryView":1293
16889  *     for i in range(ndim):
16890  *         if src.shape[i] != dst.shape[i]:
16891  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
16892  *                 broadcasting = True
16893  *                 src.strides[i] = 0
16894  */
16895       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
16896       if (__pyx_t_2) {
16897 
16898         /* "View.MemoryView":1294
16899  *         if src.shape[i] != dst.shape[i]:
16900  *             if src.shape[i] == 1:
16901  *                 broadcasting = True             # <<<<<<<<<<<<<<
16902  *                 src.strides[i] = 0
16903  *             else:
16904  */
16905         __pyx_v_broadcasting = 1;
16906 
16907         /* "View.MemoryView":1295
16908  *             if src.shape[i] == 1:
16909  *                 broadcasting = True
16910  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
16911  *             else:
16912  *                 _err_extents(i, dst.shape[i], src.shape[i])
16913  */
16914         (__pyx_v_src.strides[__pyx_v_i]) = 0;
16915 
16916         /* "View.MemoryView":1293
16917  *     for i in range(ndim):
16918  *         if src.shape[i] != dst.shape[i]:
16919  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
16920  *                 broadcasting = True
16921  *                 src.strides[i] = 0
16922  */
16923         goto __pyx_L7;
16924       }
16925 
16926       /* "View.MemoryView":1297
16927  *                 src.strides[i] = 0
16928  *             else:
16929  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
16930  *
16931  *         if src.suboffsets[i] >= 0:
16932  */
16933       /*else*/ {
16934         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
16935       }
16936       __pyx_L7:;
16937 
16938       /* "View.MemoryView":1292
16939  *
16940  *     for i in range(ndim):
16941  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
16942  *             if src.shape[i] == 1:
16943  *                 broadcasting = True
16944  */
16945     }
16946 
16947     /* "View.MemoryView":1299
16948  *                 _err_extents(i, dst.shape[i], src.shape[i])
16949  *
16950  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
16951  *             _err_dim(ValueError, "Dimension %d is not direct", i)
16952  *
16953  */
16954     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
16955     if (__pyx_t_2) {
16956 
16957       /* "View.MemoryView":1300
16958  *
16959  *         if src.suboffsets[i] >= 0:
16960  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
16961  *
16962  *     if slices_overlap(&src, &dst, ndim, itemsize):
16963  */
16964       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
16965 
16966       /* "View.MemoryView":1299
16967  *                 _err_extents(i, dst.shape[i], src.shape[i])
16968  *
16969  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
16970  *             _err_dim(ValueError, "Dimension %d is not direct", i)
16971  *
16972  */
16973     }
16974   }
16975 
16976   /* "View.MemoryView":1302
16977  *             _err_dim(ValueError, "Dimension %d is not direct", i)
16978  *
16979  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
16980  *
16981  *         if not slice_is_contig(src, order, ndim):
16982  */
16983   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
16984   if (__pyx_t_2) {
16985 
16986     /* "View.MemoryView":1304
16987  *     if slices_overlap(&src, &dst, ndim, itemsize):
16988  *
16989  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
16990  *             order = get_best_order(&dst, ndim)
16991  *
16992  */
16993     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
16994     if (__pyx_t_2) {
16995 
16996       /* "View.MemoryView":1305
16997  *
16998  *         if not slice_is_contig(src, order, ndim):
16999  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
17000  *
17001  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17002  */
17003       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
17004 
17005       /* "View.MemoryView":1304
17006  *     if slices_overlap(&src, &dst, ndim, itemsize):
17007  *
17008  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
17009  *             order = get_best_order(&dst, ndim)
17010  *
17011  */
17012     }
17013 
17014     /* "View.MemoryView":1307
17015  *             order = get_best_order(&dst, ndim)
17016  *
17017  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
17018  *         src = tmp
17019  *
17020  */
17021     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
17022     __pyx_v_tmpdata = __pyx_t_7;
17023 
17024     /* "View.MemoryView":1308
17025  *
17026  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17027  *         src = tmp             # <<<<<<<<<<<<<<
17028  *
17029  *     if not broadcasting:
17030  */
17031     __pyx_v_src = __pyx_v_tmp;
17032 
17033     /* "View.MemoryView":1302
17034  *             _err_dim(ValueError, "Dimension %d is not direct", i)
17035  *
17036  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
17037  *
17038  *         if not slice_is_contig(src, order, ndim):
17039  */
17040   }
17041 
17042   /* "View.MemoryView":1310
17043  *         src = tmp
17044  *
17045  *     if not broadcasting:             # <<<<<<<<<<<<<<
17046  *
17047  *
17048  */
17049   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
17050   if (__pyx_t_2) {
17051 
17052     /* "View.MemoryView":1313
17053  *
17054  *
17055  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
17056  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17057  *         elif slice_is_contig(src, 'F', ndim):
17058  */
17059     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
17060     if (__pyx_t_2) {
17061 
17062       /* "View.MemoryView":1314
17063  *
17064  *         if slice_is_contig(src, 'C', ndim):
17065  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
17066  *         elif slice_is_contig(src, 'F', ndim):
17067  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17068  */
17069       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
17070 
17071       /* "View.MemoryView":1313
17072  *
17073  *
17074  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
17075  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17076  *         elif slice_is_contig(src, 'F', ndim):
17077  */
17078       goto __pyx_L12;
17079     }
17080 
17081     /* "View.MemoryView":1315
17082  *         if slice_is_contig(src, 'C', ndim):
17083  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17084  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
17085  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17086  *
17087  */
17088     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
17089     if (__pyx_t_2) {
17090 
17091       /* "View.MemoryView":1316
17092  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17093  *         elif slice_is_contig(src, 'F', ndim):
17094  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
17095  *
17096  *         if direct_copy:
17097  */
17098       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
17099 
17100       /* "View.MemoryView":1315
17101  *         if slice_is_contig(src, 'C', ndim):
17102  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17103  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
17104  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17105  *
17106  */
17107     }
17108     __pyx_L12:;
17109 
17110     /* "View.MemoryView":1318
17111  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17112  *
17113  *         if direct_copy:             # <<<<<<<<<<<<<<
17114  *
17115  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17116  */
17117     __pyx_t_2 = (__pyx_v_direct_copy != 0);
17118     if (__pyx_t_2) {
17119 
17120       /* "View.MemoryView":1320
17121  *         if direct_copy:
17122  *
17123  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
17124  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17125  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17126  */
17127       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17128 
17129       /* "View.MemoryView":1321
17130  *
17131  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17132  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
17133  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17134  *             free(tmpdata)
17135  */
17136       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
17137 
17138       /* "View.MemoryView":1322
17139  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17140  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17141  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
17142  *             free(tmpdata)
17143  *             return 0
17144  */
17145       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17146 
17147       /* "View.MemoryView":1323
17148  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17149  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17150  *             free(tmpdata)             # <<<<<<<<<<<<<<
17151  *             return 0
17152  *
17153  */
17154       free(__pyx_v_tmpdata);
17155 
17156       /* "View.MemoryView":1324
17157  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17158  *             free(tmpdata)
17159  *             return 0             # <<<<<<<<<<<<<<
17160  *
17161  *     if order == 'F' == get_best_order(&dst, ndim):
17162  */
17163       __pyx_r = 0;
17164       goto __pyx_L0;
17165 
17166       /* "View.MemoryView":1318
17167  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17168  *
17169  *         if direct_copy:             # <<<<<<<<<<<<<<
17170  *
17171  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17172  */
17173     }
17174 
17175     /* "View.MemoryView":1310
17176  *         src = tmp
17177  *
17178  *     if not broadcasting:             # <<<<<<<<<<<<<<
17179  *
17180  *
17181  */
17182   }
17183 
17184   /* "View.MemoryView":1326
17185  *             return 0
17186  *
17187  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
17188  *
17189  *
17190  */
17191   __pyx_t_2 = (__pyx_v_order == 'F');
17192   if (__pyx_t_2) {
17193     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
17194   }
17195   __pyx_t_8 = (__pyx_t_2 != 0);
17196   if (__pyx_t_8) {
17197 
17198     /* "View.MemoryView":1329
17199  *
17200  *
17201  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
17202  *         transpose_memslice(&dst)
17203  *
17204  */
17205     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
17206 
17207     /* "View.MemoryView":1330
17208  *
17209  *         transpose_memslice(&src)
17210  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
17211  *
17212  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17213  */
17214     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
17215 
17216     /* "View.MemoryView":1326
17217  *             return 0
17218  *
17219  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
17220  *
17221  *
17222  */
17223   }
17224 
17225   /* "View.MemoryView":1332
17226  *         transpose_memslice(&dst)
17227  *
17228  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
17229  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
17230  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17231  */
17232   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17233 
17234   /* "View.MemoryView":1333
17235  *
17236  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17237  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
17238  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17239  *
17240  */
17241   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
17242 
17243   /* "View.MemoryView":1334
17244  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17245  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
17246  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
17247  *
17248  *     free(tmpdata)
17249  */
17250   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17251 
17252   /* "View.MemoryView":1336
17253  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17254  *
17255  *     free(tmpdata)             # <<<<<<<<<<<<<<
17256  *     return 0
17257  *
17258  */
17259   free(__pyx_v_tmpdata);
17260 
17261   /* "View.MemoryView":1337
17262  *
17263  *     free(tmpdata)
17264  *     return 0             # <<<<<<<<<<<<<<
17265  *
17266  * @cname('__pyx_memoryview_broadcast_leading')
17267  */
17268   __pyx_r = 0;
17269   goto __pyx_L0;
17270 
17271   /* "View.MemoryView":1268
17272  *
17273  * @cname('__pyx_memoryview_copy_contents')
17274  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
17275  *                                   __Pyx_memviewslice dst,
17276  *                                   int src_ndim, int dst_ndim,
17277  */
17278 
17279   /* function exit code */
17280   __pyx_L1_error:;
17281   {
17282     #ifdef WITH_THREAD
17283     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17284     #endif
17285     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17286     #ifdef WITH_THREAD
17287     __Pyx_PyGILState_Release(__pyx_gilstate_save);
17288     #endif
17289   }
17290   __pyx_r = -1;
17291   __pyx_L0:;
17292   return __pyx_r;
17293 }
17294 
17295 /* "View.MemoryView":1340
17296  *
17297  * @cname('__pyx_memoryview_broadcast_leading')
17298  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
17299  *                             int ndim,
17300  *                             int ndim_other) nogil:
17301  */
17302 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)17303 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
17304   int __pyx_v_i;
17305   int __pyx_v_offset;
17306   int __pyx_t_1;
17307   int __pyx_t_2;
17308   int __pyx_t_3;
17309 
17310   /* "View.MemoryView":1344
17311  *                             int ndim_other) nogil:
17312  *     cdef int i
17313  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
17314  *
17315  *     for i in range(ndim - 1, -1, -1):
17316  */
17317   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
17318 
17319   /* "View.MemoryView":1346
17320  *     cdef int offset = ndim_other - ndim
17321  *
17322  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17323  *         mslice.shape[i + offset] = mslice.shape[i]
17324  *         mslice.strides[i + offset] = mslice.strides[i]
17325  */
17326   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17327     __pyx_v_i = __pyx_t_1;
17328 
17329     /* "View.MemoryView":1347
17330  *
17331  *     for i in range(ndim - 1, -1, -1):
17332  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
17333  *         mslice.strides[i + offset] = mslice.strides[i]
17334  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17335  */
17336     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
17337 
17338     /* "View.MemoryView":1348
17339  *     for i in range(ndim - 1, -1, -1):
17340  *         mslice.shape[i + offset] = mslice.shape[i]
17341  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
17342  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17343  *
17344  */
17345     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
17346 
17347     /* "View.MemoryView":1349
17348  *         mslice.shape[i + offset] = mslice.shape[i]
17349  *         mslice.strides[i + offset] = mslice.strides[i]
17350  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
17351  *
17352  *     for i in range(offset):
17353  */
17354     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
17355   }
17356 
17357   /* "View.MemoryView":1351
17358  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17359  *
17360  *     for i in range(offset):             # <<<<<<<<<<<<<<
17361  *         mslice.shape[i] = 1
17362  *         mslice.strides[i] = mslice.strides[0]
17363  */
17364   __pyx_t_1 = __pyx_v_offset;
17365   __pyx_t_2 = __pyx_t_1;
17366   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17367     __pyx_v_i = __pyx_t_3;
17368 
17369     /* "View.MemoryView":1352
17370  *
17371  *     for i in range(offset):
17372  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
17373  *         mslice.strides[i] = mslice.strides[0]
17374  *         mslice.suboffsets[i] = -1
17375  */
17376     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
17377 
17378     /* "View.MemoryView":1353
17379  *     for i in range(offset):
17380  *         mslice.shape[i] = 1
17381  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
17382  *         mslice.suboffsets[i] = -1
17383  *
17384  */
17385     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
17386 
17387     /* "View.MemoryView":1354
17388  *         mslice.shape[i] = 1
17389  *         mslice.strides[i] = mslice.strides[0]
17390  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
17391  *
17392  *
17393  */
17394     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
17395   }
17396 
17397   /* "View.MemoryView":1340
17398  *
17399  * @cname('__pyx_memoryview_broadcast_leading')
17400  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
17401  *                             int ndim,
17402  *                             int ndim_other) nogil:
17403  */
17404 
17405   /* function exit code */
17406 }
17407 
17408 /* "View.MemoryView":1362
17409  *
17410  * @cname('__pyx_memoryview_refcount_copying')
17411  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
17412  *                            int ndim, bint inc) nogil:
17413  *
17414  */
17415 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)17416 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
17417   int __pyx_t_1;
17418 
17419   /* "View.MemoryView":1366
17420  *
17421  *
17422  *     if dtype_is_object:             # <<<<<<<<<<<<<<
17423  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
17424  *                                            dst.strides, ndim, inc)
17425  */
17426   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
17427   if (__pyx_t_1) {
17428 
17429     /* "View.MemoryView":1367
17430  *
17431  *     if dtype_is_object:
17432  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
17433  *                                            dst.strides, ndim, inc)
17434  *
17435  */
17436     __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
17437 
17438     /* "View.MemoryView":1366
17439  *
17440  *
17441  *     if dtype_is_object:             # <<<<<<<<<<<<<<
17442  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
17443  *                                            dst.strides, ndim, inc)
17444  */
17445   }
17446 
17447   /* "View.MemoryView":1362
17448  *
17449  * @cname('__pyx_memoryview_refcount_copying')
17450  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
17451  *                            int ndim, bint inc) nogil:
17452  *
17453  */
17454 
17455   /* function exit code */
17456 }
17457 
17458 /* "View.MemoryView":1371
17459  *
17460  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
17461  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17462  *                                              Py_ssize_t *strides, int ndim,
17463  *                                              bint inc) with gil:
17464  */
17465 
__pyx_memoryview_refcount_objects_in_slice_with_gil(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)17466 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
17467   __Pyx_RefNannyDeclarations
17468   #ifdef WITH_THREAD
17469   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17470   #endif
17471   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
17472 
17473   /* "View.MemoryView":1374
17474  *                                              Py_ssize_t *strides, int ndim,
17475  *                                              bint inc) with gil:
17476  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
17477  *
17478  * @cname('__pyx_memoryview_refcount_objects_in_slice')
17479  */
17480   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
17481 
17482   /* "View.MemoryView":1371
17483  *
17484  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
17485  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17486  *                                              Py_ssize_t *strides, int ndim,
17487  *                                              bint inc) with gil:
17488  */
17489 
17490   /* function exit code */
17491   __Pyx_RefNannyFinishContext();
17492   #ifdef WITH_THREAD
17493   __Pyx_PyGILState_Release(__pyx_gilstate_save);
17494   #endif
17495 }
17496 
17497 /* "View.MemoryView":1377
17498  *
17499  * @cname('__pyx_memoryview_refcount_objects_in_slice')
17500  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17501  *                                     Py_ssize_t *strides, int ndim, bint inc):
17502  *     cdef Py_ssize_t i
17503  */
17504 
__pyx_memoryview_refcount_objects_in_slice(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)17505 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
17506   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17507   __Pyx_RefNannyDeclarations
17508   Py_ssize_t __pyx_t_1;
17509   Py_ssize_t __pyx_t_2;
17510   Py_ssize_t __pyx_t_3;
17511   int __pyx_t_4;
17512   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
17513 
17514   /* "View.MemoryView":1381
17515  *     cdef Py_ssize_t i
17516  *
17517  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
17518  *         if ndim == 1:
17519  *             if inc:
17520  */
17521   __pyx_t_1 = (__pyx_v_shape[0]);
17522   __pyx_t_2 = __pyx_t_1;
17523   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17524     __pyx_v_i = __pyx_t_3;
17525 
17526     /* "View.MemoryView":1382
17527  *
17528  *     for i in range(shape[0]):
17529  *         if ndim == 1:             # <<<<<<<<<<<<<<
17530  *             if inc:
17531  *                 Py_INCREF((<PyObject **> data)[0])
17532  */
17533     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
17534     if (__pyx_t_4) {
17535 
17536       /* "View.MemoryView":1383
17537  *     for i in range(shape[0]):
17538  *         if ndim == 1:
17539  *             if inc:             # <<<<<<<<<<<<<<
17540  *                 Py_INCREF((<PyObject **> data)[0])
17541  *             else:
17542  */
17543       __pyx_t_4 = (__pyx_v_inc != 0);
17544       if (__pyx_t_4) {
17545 
17546         /* "View.MemoryView":1384
17547  *         if ndim == 1:
17548  *             if inc:
17549  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
17550  *             else:
17551  *                 Py_DECREF((<PyObject **> data)[0])
17552  */
17553         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
17554 
17555         /* "View.MemoryView":1383
17556  *     for i in range(shape[0]):
17557  *         if ndim == 1:
17558  *             if inc:             # <<<<<<<<<<<<<<
17559  *                 Py_INCREF((<PyObject **> data)[0])
17560  *             else:
17561  */
17562         goto __pyx_L6;
17563       }
17564 
17565       /* "View.MemoryView":1386
17566  *                 Py_INCREF((<PyObject **> data)[0])
17567  *             else:
17568  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
17569  *         else:
17570  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
17571  */
17572       /*else*/ {
17573         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
17574       }
17575       __pyx_L6:;
17576 
17577       /* "View.MemoryView":1382
17578  *
17579  *     for i in range(shape[0]):
17580  *         if ndim == 1:             # <<<<<<<<<<<<<<
17581  *             if inc:
17582  *                 Py_INCREF((<PyObject **> data)[0])
17583  */
17584       goto __pyx_L5;
17585     }
17586 
17587     /* "View.MemoryView":1388
17588  *                 Py_DECREF((<PyObject **> data)[0])
17589  *         else:
17590  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
17591  *                                       ndim - 1, inc)
17592  *
17593  */
17594     /*else*/ {
17595 
17596       /* "View.MemoryView":1389
17597  *         else:
17598  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
17599  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
17600  *
17601  *         data += strides[0]
17602  */
17603       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
17604     }
17605     __pyx_L5:;
17606 
17607     /* "View.MemoryView":1391
17608  *                                       ndim - 1, inc)
17609  *
17610  *         data += strides[0]             # <<<<<<<<<<<<<<
17611  *
17612  *
17613  */
17614     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
17615   }
17616 
17617   /* "View.MemoryView":1377
17618  *
17619  * @cname('__pyx_memoryview_refcount_objects_in_slice')
17620  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17621  *                                     Py_ssize_t *strides, int ndim, bint inc):
17622  *     cdef Py_ssize_t i
17623  */
17624 
17625   /* function exit code */
17626   __Pyx_RefNannyFinishContext();
17627 }
17628 
17629 /* "View.MemoryView":1397
17630  *
17631  * @cname('__pyx_memoryview_slice_assign_scalar')
17632  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
17633  *                               size_t itemsize, void *item,
17634  *                               bint dtype_is_object) nogil:
17635  */
17636 
__pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item,int __pyx_v_dtype_is_object)17637 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
17638 
17639   /* "View.MemoryView":1400
17640  *                               size_t itemsize, void *item,
17641  *                               bint dtype_is_object) nogil:
17642  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
17643  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
17644  *                          itemsize, item)
17645  */
17646   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17647 
17648   /* "View.MemoryView":1401
17649  *                               bint dtype_is_object) nogil:
17650  *     refcount_copying(dst, dtype_is_object, ndim, False)
17651  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
17652  *                          itemsize, item)
17653  *     refcount_copying(dst, dtype_is_object, ndim, True)
17654  */
17655   __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
17656 
17657   /* "View.MemoryView":1403
17658  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
17659  *                          itemsize, item)
17660  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
17661  *
17662  *
17663  */
17664   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17665 
17666   /* "View.MemoryView":1397
17667  *
17668  * @cname('__pyx_memoryview_slice_assign_scalar')
17669  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
17670  *                               size_t itemsize, void *item,
17671  *                               bint dtype_is_object) nogil:
17672  */
17673 
17674   /* function exit code */
17675 }
17676 
17677 /* "View.MemoryView":1407
17678  *
17679  * @cname('__pyx_memoryview__slice_assign_scalar')
17680  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17681  *                               Py_ssize_t *strides, int ndim,
17682  *                               size_t itemsize, void *item) nogil:
17683  */
17684 
__pyx_memoryview__slice_assign_scalar(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item)17685 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
17686   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17687   Py_ssize_t __pyx_v_stride;
17688   Py_ssize_t __pyx_v_extent;
17689   int __pyx_t_1;
17690   Py_ssize_t __pyx_t_2;
17691   Py_ssize_t __pyx_t_3;
17692   Py_ssize_t __pyx_t_4;
17693 
17694   /* "View.MemoryView":1411
17695  *                               size_t itemsize, void *item) nogil:
17696  *     cdef Py_ssize_t i
17697  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
17698  *     cdef Py_ssize_t extent = shape[0]
17699  *
17700  */
17701   __pyx_v_stride = (__pyx_v_strides[0]);
17702 
17703   /* "View.MemoryView":1412
17704  *     cdef Py_ssize_t i
17705  *     cdef Py_ssize_t stride = strides[0]
17706  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
17707  *
17708  *     if ndim == 1:
17709  */
17710   __pyx_v_extent = (__pyx_v_shape[0]);
17711 
17712   /* "View.MemoryView":1414
17713  *     cdef Py_ssize_t extent = shape[0]
17714  *
17715  *     if ndim == 1:             # <<<<<<<<<<<<<<
17716  *         for i in range(extent):
17717  *             memcpy(data, item, itemsize)
17718  */
17719   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17720   if (__pyx_t_1) {
17721 
17722     /* "View.MemoryView":1415
17723  *
17724  *     if ndim == 1:
17725  *         for i in range(extent):             # <<<<<<<<<<<<<<
17726  *             memcpy(data, item, itemsize)
17727  *             data += stride
17728  */
17729     __pyx_t_2 = __pyx_v_extent;
17730     __pyx_t_3 = __pyx_t_2;
17731     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17732       __pyx_v_i = __pyx_t_4;
17733 
17734       /* "View.MemoryView":1416
17735  *     if ndim == 1:
17736  *         for i in range(extent):
17737  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
17738  *             data += stride
17739  *     else:
17740  */
17741       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
17742 
17743       /* "View.MemoryView":1417
17744  *         for i in range(extent):
17745  *             memcpy(data, item, itemsize)
17746  *             data += stride             # <<<<<<<<<<<<<<
17747  *     else:
17748  *         for i in range(extent):
17749  */
17750       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17751     }
17752 
17753     /* "View.MemoryView":1414
17754  *     cdef Py_ssize_t extent = shape[0]
17755  *
17756  *     if ndim == 1:             # <<<<<<<<<<<<<<
17757  *         for i in range(extent):
17758  *             memcpy(data, item, itemsize)
17759  */
17760     goto __pyx_L3;
17761   }
17762 
17763   /* "View.MemoryView":1419
17764  *             data += stride
17765  *     else:
17766  *         for i in range(extent):             # <<<<<<<<<<<<<<
17767  *             _slice_assign_scalar(data, shape + 1, strides + 1,
17768  *                                 ndim - 1, itemsize, item)
17769  */
17770   /*else*/ {
17771     __pyx_t_2 = __pyx_v_extent;
17772     __pyx_t_3 = __pyx_t_2;
17773     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17774       __pyx_v_i = __pyx_t_4;
17775 
17776       /* "View.MemoryView":1420
17777  *     else:
17778  *         for i in range(extent):
17779  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
17780  *                                 ndim - 1, itemsize, item)
17781  *             data += stride
17782  */
17783       __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
17784 
17785       /* "View.MemoryView":1422
17786  *             _slice_assign_scalar(data, shape + 1, strides + 1,
17787  *                                 ndim - 1, itemsize, item)
17788  *             data += stride             # <<<<<<<<<<<<<<
17789  *
17790  *
17791  */
17792       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17793     }
17794   }
17795   __pyx_L3:;
17796 
17797   /* "View.MemoryView":1407
17798  *
17799  * @cname('__pyx_memoryview__slice_assign_scalar')
17800  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
17801  *                               Py_ssize_t *strides, int ndim,
17802  *                               size_t itemsize, void *item) nogil:
17803  */
17804 
17805   /* function exit code */
17806 }
17807 
17808 /* "(tree fragment)":1
17809  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
17810  *     cdef object __pyx_PickleError
17811  *     cdef object __pyx_result
17812  */
17813 
17814 /* Python wrapper */
17815 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17816 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17817 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17818   PyObject *__pyx_v___pyx_type = 0;
17819   long __pyx_v___pyx_checksum;
17820   PyObject *__pyx_v___pyx_state = 0;
17821   int __pyx_lineno = 0;
17822   const char *__pyx_filename = NULL;
17823   int __pyx_clineno = 0;
17824   PyObject *__pyx_r = 0;
17825   __Pyx_RefNannyDeclarations
17826   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
17827   {
17828     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
17829     PyObject* values[3] = {0,0,0};
17830     if (unlikely(__pyx_kwds)) {
17831       Py_ssize_t kw_args;
17832       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17833       switch (pos_args) {
17834         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17835         CYTHON_FALLTHROUGH;
17836         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17837         CYTHON_FALLTHROUGH;
17838         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17839         CYTHON_FALLTHROUGH;
17840         case  0: break;
17841         default: goto __pyx_L5_argtuple_error;
17842       }
17843       kw_args = PyDict_Size(__pyx_kwds);
17844       switch (pos_args) {
17845         case  0:
17846         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
17847         else goto __pyx_L5_argtuple_error;
17848         CYTHON_FALLTHROUGH;
17849         case  1:
17850         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
17851         else {
17852           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
17853         }
17854         CYTHON_FALLTHROUGH;
17855         case  2:
17856         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
17857         else {
17858           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
17859         }
17860       }
17861       if (unlikely(kw_args > 0)) {
17862         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
17863       }
17864     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
17865       goto __pyx_L5_argtuple_error;
17866     } else {
17867       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17868       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17869       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17870     }
17871     __pyx_v___pyx_type = values[0];
17872     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
17873     __pyx_v___pyx_state = values[2];
17874   }
17875   goto __pyx_L4_argument_unpacking_done;
17876   __pyx_L5_argtuple_error:;
17877   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
17878   __pyx_L3_error:;
17879   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
17880   __Pyx_RefNannyFinishContext();
17881   return NULL;
17882   __pyx_L4_argument_unpacking_done:;
17883   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
17884 
17885   /* function exit code */
17886   __Pyx_RefNannyFinishContext();
17887   return __pyx_r;
17888 }
17889 
__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)17890 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
17891   PyObject *__pyx_v___pyx_PickleError = 0;
17892   PyObject *__pyx_v___pyx_result = 0;
17893   PyObject *__pyx_r = NULL;
17894   __Pyx_RefNannyDeclarations
17895   int __pyx_t_1;
17896   PyObject *__pyx_t_2 = NULL;
17897   PyObject *__pyx_t_3 = NULL;
17898   PyObject *__pyx_t_4 = NULL;
17899   PyObject *__pyx_t_5 = NULL;
17900   int __pyx_t_6;
17901   int __pyx_lineno = 0;
17902   const char *__pyx_filename = NULL;
17903   int __pyx_clineno = 0;
17904   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
17905 
17906   /* "(tree fragment)":4
17907  *     cdef object __pyx_PickleError
17908  *     cdef object __pyx_result
17909  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
17910  *         from pickle import PickleError as __pyx_PickleError
17911  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
17912  */
17913   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
17914   if (__pyx_t_1) {
17915 
17916     /* "(tree fragment)":5
17917  *     cdef object __pyx_result
17918  *     if __pyx_checksum != 0xb068931:
17919  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
17920  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
17921  *     __pyx_result = Enum.__new__(__pyx_type)
17922  */
17923     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
17924     __Pyx_GOTREF(__pyx_t_2);
17925     __Pyx_INCREF(__pyx_n_s_PickleError);
17926     __Pyx_GIVEREF(__pyx_n_s_PickleError);
17927     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
17928     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
17929     __Pyx_GOTREF(__pyx_t_3);
17930     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17931     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
17932     __Pyx_GOTREF(__pyx_t_2);
17933     __Pyx_INCREF(__pyx_t_2);
17934     __pyx_v___pyx_PickleError = __pyx_t_2;
17935     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17936     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17937 
17938     /* "(tree fragment)":6
17939  *     if __pyx_checksum != 0xb068931:
17940  *         from pickle import PickleError as __pyx_PickleError
17941  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
17942  *     __pyx_result = Enum.__new__(__pyx_type)
17943  *     if __pyx_state is not None:
17944  */
17945     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
17946     __Pyx_GOTREF(__pyx_t_2);
17947     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
17948     __Pyx_GOTREF(__pyx_t_4);
17949     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17950     __Pyx_INCREF(__pyx_v___pyx_PickleError);
17951     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
17952     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
17953       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
17954       if (likely(__pyx_t_5)) {
17955         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17956         __Pyx_INCREF(__pyx_t_5);
17957         __Pyx_INCREF(function);
17958         __Pyx_DECREF_SET(__pyx_t_2, function);
17959       }
17960     }
17961     __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);
17962     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17963     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17964     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
17965     __Pyx_GOTREF(__pyx_t_3);
17966     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17967     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17968     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17969     __PYX_ERR(2, 6, __pyx_L1_error)
17970 
17971     /* "(tree fragment)":4
17972  *     cdef object __pyx_PickleError
17973  *     cdef object __pyx_result
17974  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
17975  *         from pickle import PickleError as __pyx_PickleError
17976  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
17977  */
17978   }
17979 
17980   /* "(tree fragment)":7
17981  *         from pickle import PickleError as __pyx_PickleError
17982  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
17983  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
17984  *     if __pyx_state is not None:
17985  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
17986  */
17987   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
17988   __Pyx_GOTREF(__pyx_t_2);
17989   __pyx_t_4 = NULL;
17990   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
17991     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
17992     if (likely(__pyx_t_4)) {
17993       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17994       __Pyx_INCREF(__pyx_t_4);
17995       __Pyx_INCREF(function);
17996       __Pyx_DECREF_SET(__pyx_t_2, function);
17997     }
17998   }
17999   __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);
18000   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
18001   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
18002   __Pyx_GOTREF(__pyx_t_3);
18003   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18004   __pyx_v___pyx_result = __pyx_t_3;
18005   __pyx_t_3 = 0;
18006 
18007   /* "(tree fragment)":8
18008  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18009  *     __pyx_result = Enum.__new__(__pyx_type)
18010  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
18011  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18012  *     return __pyx_result
18013  */
18014   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
18015   __pyx_t_6 = (__pyx_t_1 != 0);
18016   if (__pyx_t_6) {
18017 
18018     /* "(tree fragment)":9
18019  *     __pyx_result = Enum.__new__(__pyx_type)
18020  *     if __pyx_state is not None:
18021  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
18022  *     return __pyx_result
18023  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18024  */
18025     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(2, 9, __pyx_L1_error)
18026     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
18027     __Pyx_GOTREF(__pyx_t_3);
18028     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18029 
18030     /* "(tree fragment)":8
18031  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18032  *     __pyx_result = Enum.__new__(__pyx_type)
18033  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
18034  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18035  *     return __pyx_result
18036  */
18037   }
18038 
18039   /* "(tree fragment)":10
18040  *     if __pyx_state is not None:
18041  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18042  *     return __pyx_result             # <<<<<<<<<<<<<<
18043  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18044  *     __pyx_result.name = __pyx_state[0]
18045  */
18046   __Pyx_XDECREF(__pyx_r);
18047   __Pyx_INCREF(__pyx_v___pyx_result);
18048   __pyx_r = __pyx_v___pyx_result;
18049   goto __pyx_L0;
18050 
18051   /* "(tree fragment)":1
18052  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
18053  *     cdef object __pyx_PickleError
18054  *     cdef object __pyx_result
18055  */
18056 
18057   /* function exit code */
18058   __pyx_L1_error:;
18059   __Pyx_XDECREF(__pyx_t_2);
18060   __Pyx_XDECREF(__pyx_t_3);
18061   __Pyx_XDECREF(__pyx_t_4);
18062   __Pyx_XDECREF(__pyx_t_5);
18063   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18064   __pyx_r = NULL;
18065   __pyx_L0:;
18066   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
18067   __Pyx_XDECREF(__pyx_v___pyx_result);
18068   __Pyx_XGIVEREF(__pyx_r);
18069   __Pyx_RefNannyFinishContext();
18070   return __pyx_r;
18071 }
18072 
18073 /* "(tree fragment)":11
18074  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18075  *     return __pyx_result
18076  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
18077  *     __pyx_result.name = __pyx_state[0]
18078  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18079  */
18080 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)18081 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
18082   PyObject *__pyx_r = NULL;
18083   __Pyx_RefNannyDeclarations
18084   PyObject *__pyx_t_1 = NULL;
18085   int __pyx_t_2;
18086   Py_ssize_t __pyx_t_3;
18087   int __pyx_t_4;
18088   int __pyx_t_5;
18089   PyObject *__pyx_t_6 = NULL;
18090   PyObject *__pyx_t_7 = NULL;
18091   PyObject *__pyx_t_8 = NULL;
18092   int __pyx_lineno = 0;
18093   const char *__pyx_filename = NULL;
18094   int __pyx_clineno = 0;
18095   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
18096 
18097   /* "(tree fragment)":12
18098  *     return __pyx_result
18099  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18100  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
18101  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18102  *         __pyx_result.__dict__.update(__pyx_state[1])
18103  */
18104   if (unlikely(__pyx_v___pyx_state == Py_None)) {
18105     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18106     __PYX_ERR(2, 12, __pyx_L1_error)
18107   }
18108   __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(2, 12, __pyx_L1_error)
18109   __Pyx_GOTREF(__pyx_t_1);
18110   __Pyx_GIVEREF(__pyx_t_1);
18111   __Pyx_GOTREF(__pyx_v___pyx_result->name);
18112   __Pyx_DECREF(__pyx_v___pyx_result->name);
18113   __pyx_v___pyx_result->name = __pyx_t_1;
18114   __pyx_t_1 = 0;
18115 
18116   /* "(tree fragment)":13
18117  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18118  *     __pyx_result.name = __pyx_state[0]
18119  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
18120  *         __pyx_result.__dict__.update(__pyx_state[1])
18121  */
18122   if (unlikely(__pyx_v___pyx_state == Py_None)) {
18123     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
18124     __PYX_ERR(2, 13, __pyx_L1_error)
18125   }
18126   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
18127   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
18128   if (__pyx_t_4) {
18129   } else {
18130     __pyx_t_2 = __pyx_t_4;
18131     goto __pyx_L4_bool_binop_done;
18132   }
18133   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
18134   __pyx_t_5 = (__pyx_t_4 != 0);
18135   __pyx_t_2 = __pyx_t_5;
18136   __pyx_L4_bool_binop_done:;
18137   if (__pyx_t_2) {
18138 
18139     /* "(tree fragment)":14
18140  *     __pyx_result.name = __pyx_state[0]
18141  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18142  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
18143  */
18144     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
18145     __Pyx_GOTREF(__pyx_t_6);
18146     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
18147     __Pyx_GOTREF(__pyx_t_7);
18148     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18149     if (unlikely(__pyx_v___pyx_state == Py_None)) {
18150       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18151       __PYX_ERR(2, 14, __pyx_L1_error)
18152     }
18153     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
18154     __Pyx_GOTREF(__pyx_t_6);
18155     __pyx_t_8 = NULL;
18156     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
18157       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
18158       if (likely(__pyx_t_8)) {
18159         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
18160         __Pyx_INCREF(__pyx_t_8);
18161         __Pyx_INCREF(function);
18162         __Pyx_DECREF_SET(__pyx_t_7, function);
18163       }
18164     }
18165     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
18166     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
18167     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18168     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
18169     __Pyx_GOTREF(__pyx_t_1);
18170     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18171     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18172 
18173     /* "(tree fragment)":13
18174  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18175  *     __pyx_result.name = __pyx_state[0]
18176  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
18177  *         __pyx_result.__dict__.update(__pyx_state[1])
18178  */
18179   }
18180 
18181   /* "(tree fragment)":11
18182  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18183  *     return __pyx_result
18184  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
18185  *     __pyx_result.name = __pyx_state[0]
18186  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18187  */
18188 
18189   /* function exit code */
18190   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18191   goto __pyx_L0;
18192   __pyx_L1_error:;
18193   __Pyx_XDECREF(__pyx_t_1);
18194   __Pyx_XDECREF(__pyx_t_6);
18195   __Pyx_XDECREF(__pyx_t_7);
18196   __Pyx_XDECREF(__pyx_t_8);
18197   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
18198   __pyx_r = 0;
18199   __pyx_L0:;
18200   __Pyx_XGIVEREF(__pyx_r);
18201   __Pyx_RefNannyFinishContext();
18202   return __pyx_r;
18203 }
18204 static struct __pyx_vtabstruct_array __pyx_vtable_array;
18205 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)18206 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
18207   struct __pyx_array_obj *p;
18208   PyObject *o;
18209   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18210     o = (*t->tp_alloc)(t, 0);
18211   } else {
18212     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18213   }
18214   if (unlikely(!o)) return 0;
18215   p = ((struct __pyx_array_obj *)o);
18216   p->__pyx_vtab = __pyx_vtabptr_array;
18217   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
18218   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
18219   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
18220   return o;
18221   bad:
18222   Py_DECREF(o); o = 0;
18223   return NULL;
18224 }
18225 
__pyx_tp_dealloc_array(PyObject * o)18226 static void __pyx_tp_dealloc_array(PyObject *o) {
18227   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
18228   #if CYTHON_USE_TP_FINALIZE
18229   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))) {
18230     if (PyObject_CallFinalizerFromDealloc(o)) return;
18231   }
18232   #endif
18233   {
18234     PyObject *etype, *eval, *etb;
18235     PyErr_Fetch(&etype, &eval, &etb);
18236     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18237     __pyx_array___dealloc__(o);
18238     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18239     PyErr_Restore(etype, eval, etb);
18240   }
18241   Py_CLEAR(p->mode);
18242   Py_CLEAR(p->_format);
18243   (*Py_TYPE(o)->tp_free)(o);
18244 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)18245 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
18246   PyObject *r;
18247   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
18248   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18249   Py_DECREF(x);
18250   return r;
18251 }
18252 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)18253 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
18254   if (v) {
18255     return __pyx_array___setitem__(o, i, v);
18256   }
18257   else {
18258     PyErr_Format(PyExc_NotImplementedError,
18259       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18260     return -1;
18261   }
18262 }
18263 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)18264 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
18265   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
18266   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
18267     PyErr_Clear();
18268     v = __pyx_array___getattr__(o, n);
18269   }
18270   return v;
18271 }
18272 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)18273 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
18274   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
18275 }
18276 
18277 static PyMethodDef __pyx_methods_array[] = {
18278   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
18279   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
18280   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
18281   {0, 0, 0, 0}
18282 };
18283 
18284 static struct PyGetSetDef __pyx_getsets_array[] = {
18285   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
18286   {0, 0, 0, 0, 0}
18287 };
18288 
18289 static PySequenceMethods __pyx_tp_as_sequence_array = {
18290   __pyx_array___len__, /*sq_length*/
18291   0, /*sq_concat*/
18292   0, /*sq_repeat*/
18293   __pyx_sq_item_array, /*sq_item*/
18294   0, /*sq_slice*/
18295   0, /*sq_ass_item*/
18296   0, /*sq_ass_slice*/
18297   0, /*sq_contains*/
18298   0, /*sq_inplace_concat*/
18299   0, /*sq_inplace_repeat*/
18300 };
18301 
18302 static PyMappingMethods __pyx_tp_as_mapping_array = {
18303   __pyx_array___len__, /*mp_length*/
18304   __pyx_array___getitem__, /*mp_subscript*/
18305   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
18306 };
18307 
18308 static PyBufferProcs __pyx_tp_as_buffer_array = {
18309   #if PY_MAJOR_VERSION < 3
18310   0, /*bf_getreadbuffer*/
18311   #endif
18312   #if PY_MAJOR_VERSION < 3
18313   0, /*bf_getwritebuffer*/
18314   #endif
18315   #if PY_MAJOR_VERSION < 3
18316   0, /*bf_getsegcount*/
18317   #endif
18318   #if PY_MAJOR_VERSION < 3
18319   0, /*bf_getcharbuffer*/
18320   #endif
18321   __pyx_array_getbuffer, /*bf_getbuffer*/
18322   0, /*bf_releasebuffer*/
18323 };
18324 
18325 static PyTypeObject __pyx_type___pyx_array = {
18326   PyVarObject_HEAD_INIT(0, 0)
18327   "rasterio._shim.array", /*tp_name*/
18328   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
18329   0, /*tp_itemsize*/
18330   __pyx_tp_dealloc_array, /*tp_dealloc*/
18331   #if PY_VERSION_HEX < 0x030800b4
18332   0, /*tp_print*/
18333   #endif
18334   #if PY_VERSION_HEX >= 0x030800b4
18335   0, /*tp_vectorcall_offset*/
18336   #endif
18337   0, /*tp_getattr*/
18338   0, /*tp_setattr*/
18339   #if PY_MAJOR_VERSION < 3
18340   0, /*tp_compare*/
18341   #endif
18342   #if PY_MAJOR_VERSION >= 3
18343   0, /*tp_as_async*/
18344   #endif
18345   0, /*tp_repr*/
18346   0, /*tp_as_number*/
18347   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
18348   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
18349   0, /*tp_hash*/
18350   0, /*tp_call*/
18351   0, /*tp_str*/
18352   __pyx_tp_getattro_array, /*tp_getattro*/
18353   0, /*tp_setattro*/
18354   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
18355   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
18356   0, /*tp_doc*/
18357   0, /*tp_traverse*/
18358   0, /*tp_clear*/
18359   0, /*tp_richcompare*/
18360   0, /*tp_weaklistoffset*/
18361   0, /*tp_iter*/
18362   0, /*tp_iternext*/
18363   __pyx_methods_array, /*tp_methods*/
18364   0, /*tp_members*/
18365   __pyx_getsets_array, /*tp_getset*/
18366   0, /*tp_base*/
18367   0, /*tp_dict*/
18368   0, /*tp_descr_get*/
18369   0, /*tp_descr_set*/
18370   0, /*tp_dictoffset*/
18371   0, /*tp_init*/
18372   0, /*tp_alloc*/
18373   __pyx_tp_new_array, /*tp_new*/
18374   0, /*tp_free*/
18375   0, /*tp_is_gc*/
18376   0, /*tp_bases*/
18377   0, /*tp_mro*/
18378   0, /*tp_cache*/
18379   0, /*tp_subclasses*/
18380   0, /*tp_weaklist*/
18381   0, /*tp_del*/
18382   0, /*tp_version_tag*/
18383   #if PY_VERSION_HEX >= 0x030400a1
18384   0, /*tp_finalize*/
18385   #endif
18386   #if PY_VERSION_HEX >= 0x030800b1
18387   0, /*tp_vectorcall*/
18388   #endif
18389   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18390   0, /*tp_print*/
18391   #endif
18392 };
18393 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)18394 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18395   struct __pyx_MemviewEnum_obj *p;
18396   PyObject *o;
18397   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18398     o = (*t->tp_alloc)(t, 0);
18399   } else {
18400     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18401   }
18402   if (unlikely(!o)) return 0;
18403   p = ((struct __pyx_MemviewEnum_obj *)o);
18404   p->name = Py_None; Py_INCREF(Py_None);
18405   return o;
18406 }
18407 
__pyx_tp_dealloc_Enum(PyObject * o)18408 static void __pyx_tp_dealloc_Enum(PyObject *o) {
18409   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
18410   #if CYTHON_USE_TP_FINALIZE
18411   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18412     if (PyObject_CallFinalizerFromDealloc(o)) return;
18413   }
18414   #endif
18415   PyObject_GC_UnTrack(o);
18416   Py_CLEAR(p->name);
18417   (*Py_TYPE(o)->tp_free)(o);
18418 }
18419 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)18420 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
18421   int e;
18422   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
18423   if (p->name) {
18424     e = (*v)(p->name, a); if (e) return e;
18425   }
18426   return 0;
18427 }
18428 
__pyx_tp_clear_Enum(PyObject * o)18429 static int __pyx_tp_clear_Enum(PyObject *o) {
18430   PyObject* tmp;
18431   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
18432   tmp = ((PyObject*)p->name);
18433   p->name = Py_None; Py_INCREF(Py_None);
18434   Py_XDECREF(tmp);
18435   return 0;
18436 }
18437 
18438 static PyMethodDef __pyx_methods_Enum[] = {
18439   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
18440   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
18441   {0, 0, 0, 0}
18442 };
18443 
18444 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
18445   PyVarObject_HEAD_INIT(0, 0)
18446   "rasterio._shim.Enum", /*tp_name*/
18447   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
18448   0, /*tp_itemsize*/
18449   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
18450   #if PY_VERSION_HEX < 0x030800b4
18451   0, /*tp_print*/
18452   #endif
18453   #if PY_VERSION_HEX >= 0x030800b4
18454   0, /*tp_vectorcall_offset*/
18455   #endif
18456   0, /*tp_getattr*/
18457   0, /*tp_setattr*/
18458   #if PY_MAJOR_VERSION < 3
18459   0, /*tp_compare*/
18460   #endif
18461   #if PY_MAJOR_VERSION >= 3
18462   0, /*tp_as_async*/
18463   #endif
18464   __pyx_MemviewEnum___repr__, /*tp_repr*/
18465   0, /*tp_as_number*/
18466   0, /*tp_as_sequence*/
18467   0, /*tp_as_mapping*/
18468   0, /*tp_hash*/
18469   0, /*tp_call*/
18470   0, /*tp_str*/
18471   0, /*tp_getattro*/
18472   0, /*tp_setattro*/
18473   0, /*tp_as_buffer*/
18474   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18475   0, /*tp_doc*/
18476   __pyx_tp_traverse_Enum, /*tp_traverse*/
18477   __pyx_tp_clear_Enum, /*tp_clear*/
18478   0, /*tp_richcompare*/
18479   0, /*tp_weaklistoffset*/
18480   0, /*tp_iter*/
18481   0, /*tp_iternext*/
18482   __pyx_methods_Enum, /*tp_methods*/
18483   0, /*tp_members*/
18484   0, /*tp_getset*/
18485   0, /*tp_base*/
18486   0, /*tp_dict*/
18487   0, /*tp_descr_get*/
18488   0, /*tp_descr_set*/
18489   0, /*tp_dictoffset*/
18490   __pyx_MemviewEnum___init__, /*tp_init*/
18491   0, /*tp_alloc*/
18492   __pyx_tp_new_Enum, /*tp_new*/
18493   0, /*tp_free*/
18494   0, /*tp_is_gc*/
18495   0, /*tp_bases*/
18496   0, /*tp_mro*/
18497   0, /*tp_cache*/
18498   0, /*tp_subclasses*/
18499   0, /*tp_weaklist*/
18500   0, /*tp_del*/
18501   0, /*tp_version_tag*/
18502   #if PY_VERSION_HEX >= 0x030400a1
18503   0, /*tp_finalize*/
18504   #endif
18505   #if PY_VERSION_HEX >= 0x030800b1
18506   0, /*tp_vectorcall*/
18507   #endif
18508   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18509   0, /*tp_print*/
18510   #endif
18511 };
18512 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
18513 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)18514 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
18515   struct __pyx_memoryview_obj *p;
18516   PyObject *o;
18517   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18518     o = (*t->tp_alloc)(t, 0);
18519   } else {
18520     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18521   }
18522   if (unlikely(!o)) return 0;
18523   p = ((struct __pyx_memoryview_obj *)o);
18524   p->__pyx_vtab = __pyx_vtabptr_memoryview;
18525   p->obj = Py_None; Py_INCREF(Py_None);
18526   p->_size = Py_None; Py_INCREF(Py_None);
18527   p->_array_interface = Py_None; Py_INCREF(Py_None);
18528   p->view.obj = NULL;
18529   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
18530   return o;
18531   bad:
18532   Py_DECREF(o); o = 0;
18533   return NULL;
18534 }
18535 
__pyx_tp_dealloc_memoryview(PyObject * o)18536 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
18537   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
18538   #if CYTHON_USE_TP_FINALIZE
18539   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18540     if (PyObject_CallFinalizerFromDealloc(o)) return;
18541   }
18542   #endif
18543   PyObject_GC_UnTrack(o);
18544   {
18545     PyObject *etype, *eval, *etb;
18546     PyErr_Fetch(&etype, &eval, &etb);
18547     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18548     __pyx_memoryview___dealloc__(o);
18549     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18550     PyErr_Restore(etype, eval, etb);
18551   }
18552   Py_CLEAR(p->obj);
18553   Py_CLEAR(p->_size);
18554   Py_CLEAR(p->_array_interface);
18555   (*Py_TYPE(o)->tp_free)(o);
18556 }
18557 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)18558 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
18559   int e;
18560   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
18561   if (p->obj) {
18562     e = (*v)(p->obj, a); if (e) return e;
18563   }
18564   if (p->_size) {
18565     e = (*v)(p->_size, a); if (e) return e;
18566   }
18567   if (p->_array_interface) {
18568     e = (*v)(p->_array_interface, a); if (e) return e;
18569   }
18570   if (p->view.obj) {
18571     e = (*v)(p->view.obj, a); if (e) return e;
18572   }
18573   return 0;
18574 }
18575 
__pyx_tp_clear_memoryview(PyObject * o)18576 static int __pyx_tp_clear_memoryview(PyObject *o) {
18577   PyObject* tmp;
18578   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
18579   tmp = ((PyObject*)p->obj);
18580   p->obj = Py_None; Py_INCREF(Py_None);
18581   Py_XDECREF(tmp);
18582   tmp = ((PyObject*)p->_size);
18583   p->_size = Py_None; Py_INCREF(Py_None);
18584   Py_XDECREF(tmp);
18585   tmp = ((PyObject*)p->_array_interface);
18586   p->_array_interface = Py_None; Py_INCREF(Py_None);
18587   Py_XDECREF(tmp);
18588   Py_CLEAR(p->view.obj);
18589   return 0;
18590 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)18591 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
18592   PyObject *r;
18593   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
18594   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18595   Py_DECREF(x);
18596   return r;
18597 }
18598 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)18599 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
18600   if (v) {
18601     return __pyx_memoryview___setitem__(o, i, v);
18602   }
18603   else {
18604     PyErr_Format(PyExc_NotImplementedError,
18605       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18606     return -1;
18607   }
18608 }
18609 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)18610 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
18611   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
18612 }
18613 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)18614 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
18615   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
18616 }
18617 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)18618 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
18619   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
18620 }
18621 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)18622 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
18623   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
18624 }
18625 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)18626 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
18627   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
18628 }
18629 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)18630 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
18631   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
18632 }
18633 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)18634 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
18635   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
18636 }
18637 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)18638 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
18639   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
18640 }
18641 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)18642 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
18643   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
18644 }
18645 
18646 static PyMethodDef __pyx_methods_memoryview[] = {
18647   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
18648   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
18649   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
18650   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
18651   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
18652   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
18653   {0, 0, 0, 0}
18654 };
18655 
18656 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
18657   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
18658   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
18659   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
18660   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
18661   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
18662   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
18663   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
18664   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
18665   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
18666   {0, 0, 0, 0, 0}
18667 };
18668 
18669 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
18670   __pyx_memoryview___len__, /*sq_length*/
18671   0, /*sq_concat*/
18672   0, /*sq_repeat*/
18673   __pyx_sq_item_memoryview, /*sq_item*/
18674   0, /*sq_slice*/
18675   0, /*sq_ass_item*/
18676   0, /*sq_ass_slice*/
18677   0, /*sq_contains*/
18678   0, /*sq_inplace_concat*/
18679   0, /*sq_inplace_repeat*/
18680 };
18681 
18682 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
18683   __pyx_memoryview___len__, /*mp_length*/
18684   __pyx_memoryview___getitem__, /*mp_subscript*/
18685   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
18686 };
18687 
18688 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
18689   #if PY_MAJOR_VERSION < 3
18690   0, /*bf_getreadbuffer*/
18691   #endif
18692   #if PY_MAJOR_VERSION < 3
18693   0, /*bf_getwritebuffer*/
18694   #endif
18695   #if PY_MAJOR_VERSION < 3
18696   0, /*bf_getsegcount*/
18697   #endif
18698   #if PY_MAJOR_VERSION < 3
18699   0, /*bf_getcharbuffer*/
18700   #endif
18701   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
18702   0, /*bf_releasebuffer*/
18703 };
18704 
18705 static PyTypeObject __pyx_type___pyx_memoryview = {
18706   PyVarObject_HEAD_INIT(0, 0)
18707   "rasterio._shim.memoryview", /*tp_name*/
18708   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
18709   0, /*tp_itemsize*/
18710   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
18711   #if PY_VERSION_HEX < 0x030800b4
18712   0, /*tp_print*/
18713   #endif
18714   #if PY_VERSION_HEX >= 0x030800b4
18715   0, /*tp_vectorcall_offset*/
18716   #endif
18717   0, /*tp_getattr*/
18718   0, /*tp_setattr*/
18719   #if PY_MAJOR_VERSION < 3
18720   0, /*tp_compare*/
18721   #endif
18722   #if PY_MAJOR_VERSION >= 3
18723   0, /*tp_as_async*/
18724   #endif
18725   __pyx_memoryview___repr__, /*tp_repr*/
18726   0, /*tp_as_number*/
18727   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
18728   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
18729   0, /*tp_hash*/
18730   0, /*tp_call*/
18731   __pyx_memoryview___str__, /*tp_str*/
18732   0, /*tp_getattro*/
18733   0, /*tp_setattro*/
18734   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
18735   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18736   0, /*tp_doc*/
18737   __pyx_tp_traverse_memoryview, /*tp_traverse*/
18738   __pyx_tp_clear_memoryview, /*tp_clear*/
18739   0, /*tp_richcompare*/
18740   0, /*tp_weaklistoffset*/
18741   0, /*tp_iter*/
18742   0, /*tp_iternext*/
18743   __pyx_methods_memoryview, /*tp_methods*/
18744   0, /*tp_members*/
18745   __pyx_getsets_memoryview, /*tp_getset*/
18746   0, /*tp_base*/
18747   0, /*tp_dict*/
18748   0, /*tp_descr_get*/
18749   0, /*tp_descr_set*/
18750   0, /*tp_dictoffset*/
18751   0, /*tp_init*/
18752   0, /*tp_alloc*/
18753   __pyx_tp_new_memoryview, /*tp_new*/
18754   0, /*tp_free*/
18755   0, /*tp_is_gc*/
18756   0, /*tp_bases*/
18757   0, /*tp_mro*/
18758   0, /*tp_cache*/
18759   0, /*tp_subclasses*/
18760   0, /*tp_weaklist*/
18761   0, /*tp_del*/
18762   0, /*tp_version_tag*/
18763   #if PY_VERSION_HEX >= 0x030400a1
18764   0, /*tp_finalize*/
18765   #endif
18766   #if PY_VERSION_HEX >= 0x030800b1
18767   0, /*tp_vectorcall*/
18768   #endif
18769   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18770   0, /*tp_print*/
18771   #endif
18772 };
18773 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
18774 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)18775 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
18776   struct __pyx_memoryviewslice_obj *p;
18777   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
18778   if (unlikely(!o)) return 0;
18779   p = ((struct __pyx_memoryviewslice_obj *)o);
18780   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
18781   p->from_object = Py_None; Py_INCREF(Py_None);
18782   p->from_slice.memview = NULL;
18783   return o;
18784 }
18785 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)18786 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
18787   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
18788   #if CYTHON_USE_TP_FINALIZE
18789   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18790     if (PyObject_CallFinalizerFromDealloc(o)) return;
18791   }
18792   #endif
18793   PyObject_GC_UnTrack(o);
18794   {
18795     PyObject *etype, *eval, *etb;
18796     PyErr_Fetch(&etype, &eval, &etb);
18797     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18798     __pyx_memoryviewslice___dealloc__(o);
18799     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18800     PyErr_Restore(etype, eval, etb);
18801   }
18802   Py_CLEAR(p->from_object);
18803   PyObject_GC_Track(o);
18804   __pyx_tp_dealloc_memoryview(o);
18805 }
18806 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)18807 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
18808   int e;
18809   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
18810   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
18811   if (p->from_object) {
18812     e = (*v)(p->from_object, a); if (e) return e;
18813   }
18814   return 0;
18815 }
18816 
__pyx_tp_clear__memoryviewslice(PyObject * o)18817 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
18818   PyObject* tmp;
18819   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
18820   __pyx_tp_clear_memoryview(o);
18821   tmp = ((PyObject*)p->from_object);
18822   p->from_object = Py_None; Py_INCREF(Py_None);
18823   Py_XDECREF(tmp);
18824   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
18825   return 0;
18826 }
18827 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)18828 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
18829   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
18830 }
18831 
18832 static PyMethodDef __pyx_methods__memoryviewslice[] = {
18833   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
18834   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
18835   {0, 0, 0, 0}
18836 };
18837 
18838 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
18839   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
18840   {0, 0, 0, 0, 0}
18841 };
18842 
18843 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
18844   PyVarObject_HEAD_INIT(0, 0)
18845   "rasterio._shim._memoryviewslice", /*tp_name*/
18846   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
18847   0, /*tp_itemsize*/
18848   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
18849   #if PY_VERSION_HEX < 0x030800b4
18850   0, /*tp_print*/
18851   #endif
18852   #if PY_VERSION_HEX >= 0x030800b4
18853   0, /*tp_vectorcall_offset*/
18854   #endif
18855   0, /*tp_getattr*/
18856   0, /*tp_setattr*/
18857   #if PY_MAJOR_VERSION < 3
18858   0, /*tp_compare*/
18859   #endif
18860   #if PY_MAJOR_VERSION >= 3
18861   0, /*tp_as_async*/
18862   #endif
18863   #if CYTHON_COMPILING_IN_PYPY
18864   __pyx_memoryview___repr__, /*tp_repr*/
18865   #else
18866   0, /*tp_repr*/
18867   #endif
18868   0, /*tp_as_number*/
18869   0, /*tp_as_sequence*/
18870   0, /*tp_as_mapping*/
18871   0, /*tp_hash*/
18872   0, /*tp_call*/
18873   #if CYTHON_COMPILING_IN_PYPY
18874   __pyx_memoryview___str__, /*tp_str*/
18875   #else
18876   0, /*tp_str*/
18877   #endif
18878   0, /*tp_getattro*/
18879   0, /*tp_setattro*/
18880   0, /*tp_as_buffer*/
18881   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18882   "Internal class for passing memoryview slices to Python", /*tp_doc*/
18883   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
18884   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
18885   0, /*tp_richcompare*/
18886   0, /*tp_weaklistoffset*/
18887   0, /*tp_iter*/
18888   0, /*tp_iternext*/
18889   __pyx_methods__memoryviewslice, /*tp_methods*/
18890   0, /*tp_members*/
18891   __pyx_getsets__memoryviewslice, /*tp_getset*/
18892   0, /*tp_base*/
18893   0, /*tp_dict*/
18894   0, /*tp_descr_get*/
18895   0, /*tp_descr_set*/
18896   0, /*tp_dictoffset*/
18897   0, /*tp_init*/
18898   0, /*tp_alloc*/
18899   __pyx_tp_new__memoryviewslice, /*tp_new*/
18900   0, /*tp_free*/
18901   0, /*tp_is_gc*/
18902   0, /*tp_bases*/
18903   0, /*tp_mro*/
18904   0, /*tp_cache*/
18905   0, /*tp_subclasses*/
18906   0, /*tp_weaklist*/
18907   0, /*tp_del*/
18908   0, /*tp_version_tag*/
18909   #if PY_VERSION_HEX >= 0x030400a1
18910   0, /*tp_finalize*/
18911   #endif
18912   #if PY_VERSION_HEX >= 0x030800b1
18913   0, /*tp_vectorcall*/
18914   #endif
18915   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18916   0, /*tp_print*/
18917   #endif
18918 };
18919 
18920 static PyMethodDef __pyx_methods[] = {
18921   {0, 0, 0, 0}
18922 };
18923 
18924 #if PY_MAJOR_VERSION >= 3
18925 #if CYTHON_PEP489_MULTI_PHASE_INIT
18926 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
18927 static int __pyx_pymod_exec__shim(PyObject* module); /*proto*/
18928 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
18929   {Py_mod_create, (void*)__pyx_pymod_create},
18930   {Py_mod_exec, (void*)__pyx_pymod_exec__shim},
18931   {0, NULL}
18932 };
18933 #endif
18934 
18935 static struct PyModuleDef __pyx_moduledef = {
18936     PyModuleDef_HEAD_INIT,
18937     "_shim",
18938     __pyx_k_Rasterio_shim_for_GDAL_1_x, /* m_doc */
18939   #if CYTHON_PEP489_MULTI_PHASE_INIT
18940     0, /* m_size */
18941   #else
18942     -1, /* m_size */
18943   #endif
18944     __pyx_methods /* m_methods */,
18945   #if CYTHON_PEP489_MULTI_PHASE_INIT
18946     __pyx_moduledef_slots, /* m_slots */
18947   #else
18948     NULL, /* m_reload */
18949   #endif
18950     NULL, /* m_traverse */
18951     NULL, /* m_clear */
18952     NULL /* m_free */
18953 };
18954 #endif
18955 #ifndef CYTHON_SMALL_CODE
18956 #if defined(__clang__)
18957     #define CYTHON_SMALL_CODE
18958 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
18959     #define CYTHON_SMALL_CODE __attribute__((cold))
18960 #else
18961     #define CYTHON_SMALL_CODE
18962 #endif
18963 #endif
18964 
18965 static __Pyx_StringTabEntry __pyx_string_tab[] = {
18966   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
18967   {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
18968   {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
18969   {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
18970   {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
18971   {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
18972   {&__pyx_n_s_DatasetIOShapeError, __pyx_k_DatasetIOShapeError, sizeof(__pyx_k_DatasetIOShapeError), 0, 0, 1, 1},
18973   {&__pyx_kp_u_Dataset_indexes_and_destination, __pyx_k_Dataset_indexes_and_destination, sizeof(__pyx_k_Dataset_indexes_and_destination), 0, 1, 0, 0},
18974   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
18975   {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
18976   {&__pyx_n_s_GDALOptionNotImplementedError, __pyx_k_GDALOptionNotImplementedError, sizeof(__pyx_k_GDALOptionNotImplementedError), 0, 0, 1, 1},
18977   {&__pyx_kp_u_GDAL_versions_2_1_do_not_support, __pyx_k_GDAL_versions_2_1_do_not_support, sizeof(__pyx_k_GDAL_versions_2_1_do_not_support), 0, 1, 0, 0},
18978   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
18979   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
18980   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
18981   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
18982   {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
18983   {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
18984   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
18985   {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
18986   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
18987   {&__pyx_kp_u_NULL_data, __pyx_k_NULL_data, sizeof(__pyx_k_NULL_data), 0, 1, 0, 0},
18988   {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
18989   {&__pyx_kp_u_Null_band, __pyx_k_Null_band, sizeof(__pyx_k_Null_band), 0, 1, 0, 0},
18990   {&__pyx_kp_u_Null_mask_band, __pyx_k_Null_mask_band, sizeof(__pyx_k_Null_mask_band), 0, 1, 0, 0},
18991   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
18992   {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
18993   {&__pyx_n_u_PROJ_LIB, __pyx_k_PROJ_LIB, sizeof(__pyx_k_PROJ_LIB), 0, 1, 0, 1},
18994   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
18995   {&__pyx_n_s_Resampling, __pyx_k_Resampling, sizeof(__pyx_k_Resampling), 0, 0, 1, 1},
18996   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
18997   {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
18998   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
18999   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
19000   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
19001   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
19002   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
19003   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
19004   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
19005   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
19006   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
19007   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
19008   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
19009   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
19010   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
19011   {&__pyx_n_s_dtype_rev, __pyx_k_dtype_rev, sizeof(__pyx_k_dtype_rev), 0, 0, 1, 1},
19012   {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1},
19013   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
19014   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
19015   {&__pyx_n_s_environ, __pyx_k_environ, sizeof(__pyx_k_environ), 0, 0, 1, 1},
19016   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
19017   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
19018   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
19019   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
19020   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
19021   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19022   {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
19023   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
19024   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
19025   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
19026   {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
19027   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
19028   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
19029   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
19030   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
19031   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
19032   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
19033   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
19034   {&__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},
19035   {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
19036   {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
19037   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
19038   {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
19039   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
19040   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
19041   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
19042   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
19043   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
19044   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
19045   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
19046   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
19047   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
19048   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
19049   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
19050   {&__pyx_n_s_rasterio, __pyx_k_rasterio, sizeof(__pyx_k_rasterio), 0, 0, 1, 1},
19051   {&__pyx_n_s_rasterio_enums, __pyx_k_rasterio_enums, sizeof(__pyx_k_rasterio_enums), 0, 0, 1, 1},
19052   {&__pyx_n_s_rasterio_errors, __pyx_k_rasterio_errors, sizeof(__pyx_k_rasterio_errors), 0, 0, 1, 1},
19053   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
19054   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
19055   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
19056   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
19057   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
19058   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
19059   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
19060   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
19061   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
19062   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
19063   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
19064   {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
19065   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
19066   {&__pyx_n_s_strides, __pyx_k_strides, sizeof(__pyx_k_strides), 0, 0, 1, 1},
19067   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
19068   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
19069   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
19070   {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
19071   {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
19072   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
19073   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
19074   {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
19075   {0, 0, 0, 0, 0, 0, 0}
19076 };
__Pyx_InitCachedBuiltins(void)19077 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
19078   __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 47, __pyx_L1_error)
19079   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 121, __pyx_L1_error)
19080   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 175, __pyx_L1_error)
19081   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 947, __pyx_L1_error)
19082   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
19083   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
19084   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
19085   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
19086   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
19087   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
19088   return 0;
19089   __pyx_L1_error:;
19090   return -1;
19091 }
19092 
__Pyx_InitCachedConstants(void)19093 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19094   __Pyx_RefNannyDeclarations
19095   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
19096 
19097   /* "rasterio/_shim.pyx":47
19098  *
19099  * cdef int delete_nodata_value(GDALRasterBandH hBand) except 3:
19100  *     raise NotImplementedError(             # <<<<<<<<<<<<<<
19101  *         "GDAL versions < 2.1 do not support nodata deletion")
19102  *
19103  */
19104   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_GDAL_versions_2_1_do_not_support); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 47, __pyx_L1_error)
19105   __Pyx_GOTREF(__pyx_tuple_);
19106   __Pyx_GIVEREF(__pyx_tuple_);
19107 
19108   /* "rasterio/_shim.pyx":175
19109  *         band = GDALGetRasterBand(hds, j)
19110  *         if band == NULL:
19111  *             raise ValueError("Null band")             # <<<<<<<<<<<<<<
19112  *         hmask = GDALGetMaskBand(band)
19113  *         if hmask == NULL:
19114  */
19115   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Null_band); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 175, __pyx_L1_error)
19116   __Pyx_GOTREF(__pyx_tuple__2);
19117   __Pyx_GIVEREF(__pyx_tuple__2);
19118 
19119   /* "rasterio/_shim.pyx":178
19120  *         hmask = GDALGetMaskBand(band)
19121  *         if hmask == NULL:
19122  *             raise ValueError("Null mask band")             # <<<<<<<<<<<<<<
19123  *         buf = <void *>np.PyArray_DATA(data[i])
19124  *         if buf == NULL:
19125  */
19126   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Null_mask_band); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 178, __pyx_L1_error)
19127   __Pyx_GOTREF(__pyx_tuple__3);
19128   __Pyx_GIVEREF(__pyx_tuple__3);
19129 
19130   /* "rasterio/_shim.pyx":181
19131  *         buf = <void *>np.PyArray_DATA(data[i])
19132  *         if buf == NULL:
19133  *             raise ValueError("NULL data")             # <<<<<<<<<<<<<<
19134  *         with nogil:
19135  *             retval = GDALRasterIO(
19136  */
19137   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_NULL_data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 181, __pyx_L1_error)
19138   __Pyx_GOTREF(__pyx_tuple__4);
19139   __Pyx_GIVEREF(__pyx_tuple__4);
19140 
19141   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":947
19142  *         __pyx_import_array()
19143  *     except Exception:
19144  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
19145  *
19146  * cdef inline int import_umath() except -1:
19147  */
19148   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 947, __pyx_L1_error)
19149   __Pyx_GOTREF(__pyx_tuple__5);
19150   __Pyx_GIVEREF(__pyx_tuple__5);
19151 
19152   /* "../../.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/__init__.pxd":953
19153  *         _import_umath()
19154  *     except Exception:
19155  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
19156  *
19157  * cdef inline int import_ufunc() except -1:
19158  */
19159   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 953, __pyx_L1_error)
19160   __Pyx_GOTREF(__pyx_tuple__6);
19161   __Pyx_GIVEREF(__pyx_tuple__6);
19162 
19163   /* "View.MemoryView":133
19164  *
19165  *         if not self.ndim:
19166  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
19167  *
19168  *         if itemsize <= 0:
19169  */
19170   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 133, __pyx_L1_error)
19171   __Pyx_GOTREF(__pyx_tuple__7);
19172   __Pyx_GIVEREF(__pyx_tuple__7);
19173 
19174   /* "View.MemoryView":136
19175  *
19176  *         if itemsize <= 0:
19177  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
19178  *
19179  *         if not isinstance(format, bytes):
19180  */
19181   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 136, __pyx_L1_error)
19182   __Pyx_GOTREF(__pyx_tuple__8);
19183   __Pyx_GIVEREF(__pyx_tuple__8);
19184 
19185   /* "View.MemoryView":148
19186  *
19187  *         if not self._shape:
19188  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
19189  *
19190  *
19191  */
19192   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 148, __pyx_L1_error)
19193   __Pyx_GOTREF(__pyx_tuple__9);
19194   __Pyx_GIVEREF(__pyx_tuple__9);
19195 
19196   /* "View.MemoryView":176
19197  *             self.data = <char *>malloc(self.len)
19198  *             if not self.data:
19199  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
19200  *
19201  *             if self.dtype_is_object:
19202  */
19203   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 176, __pyx_L1_error)
19204   __Pyx_GOTREF(__pyx_tuple__10);
19205   __Pyx_GIVEREF(__pyx_tuple__10);
19206 
19207   /* "View.MemoryView":192
19208  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
19209  *         if not (flags & bufmode):
19210  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
19211  *         info.buf = self.data
19212  *         info.len = self.len
19213  */
19214   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 192, __pyx_L1_error)
19215   __Pyx_GOTREF(__pyx_tuple__11);
19216   __Pyx_GIVEREF(__pyx_tuple__11);
19217 
19218   /* "(tree fragment)":2
19219  * def __reduce_cython__(self):
19220  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19221  * def __setstate_cython__(self, __pyx_state):
19222  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19223  */
19224   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 2, __pyx_L1_error)
19225   __Pyx_GOTREF(__pyx_tuple__12);
19226   __Pyx_GIVEREF(__pyx_tuple__12);
19227 
19228   /* "(tree fragment)":4
19229  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19230  * def __setstate_cython__(self, __pyx_state):
19231  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19232  */
19233   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 4, __pyx_L1_error)
19234   __Pyx_GOTREF(__pyx_tuple__13);
19235   __Pyx_GIVEREF(__pyx_tuple__13);
19236 
19237   /* "View.MemoryView":418
19238  *     def __setitem__(memoryview self, object index, object value):
19239  *         if self.view.readonly:
19240  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
19241  *
19242  *         have_slices, index = _unellipsify(index, self.view.ndim)
19243  */
19244   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 418, __pyx_L1_error)
19245   __Pyx_GOTREF(__pyx_tuple__14);
19246   __Pyx_GIVEREF(__pyx_tuple__14);
19247 
19248   /* "View.MemoryView":495
19249  *             result = struct.unpack(self.view.format, bytesitem)
19250  *         except struct.error:
19251  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
19252  *         else:
19253  *             if len(self.view.format) == 1:
19254  */
19255   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 495, __pyx_L1_error)
19256   __Pyx_GOTREF(__pyx_tuple__15);
19257   __Pyx_GIVEREF(__pyx_tuple__15);
19258 
19259   /* "View.MemoryView":520
19260  *     def __getbuffer__(self, Py_buffer *info, int flags):
19261  *         if flags & PyBUF_WRITABLE and self.view.readonly:
19262  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
19263  *
19264  *         if flags & PyBUF_ND:
19265  */
19266   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 520, __pyx_L1_error)
19267   __Pyx_GOTREF(__pyx_tuple__16);
19268   __Pyx_GIVEREF(__pyx_tuple__16);
19269 
19270   /* "View.MemoryView":570
19271  *         if self.view.strides == NULL:
19272  *
19273  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
19274  *
19275  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
19276  */
19277   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 570, __pyx_L1_error)
19278   __Pyx_GOTREF(__pyx_tuple__17);
19279   __Pyx_GIVEREF(__pyx_tuple__17);
19280 
19281   /* "View.MemoryView":577
19282  *     def suboffsets(self):
19283  *         if self.view.suboffsets == NULL:
19284  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
19285  *
19286  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
19287  */
19288   __pyx_tuple__18 = PyTuple_New(1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 577, __pyx_L1_error)
19289   __Pyx_GOTREF(__pyx_tuple__18);
19290   __Pyx_INCREF(__pyx_int_neg_1);
19291   __Pyx_GIVEREF(__pyx_int_neg_1);
19292   PyTuple_SET_ITEM(__pyx_tuple__18, 0, __pyx_int_neg_1);
19293   __Pyx_GIVEREF(__pyx_tuple__18);
19294 
19295   /* "(tree fragment)":2
19296  * def __reduce_cython__(self):
19297  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19298  * def __setstate_cython__(self, __pyx_state):
19299  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19300  */
19301   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
19302   __Pyx_GOTREF(__pyx_tuple__19);
19303   __Pyx_GIVEREF(__pyx_tuple__19);
19304 
19305   /* "(tree fragment)":4
19306  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19307  * def __setstate_cython__(self, __pyx_state):
19308  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19309  */
19310   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
19311   __Pyx_GOTREF(__pyx_tuple__20);
19312   __Pyx_GIVEREF(__pyx_tuple__20);
19313 
19314   /* "View.MemoryView":682
19315  *         if item is Ellipsis:
19316  *             if not seen_ellipsis:
19317  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
19318  *                 seen_ellipsis = True
19319  *             else:
19320  */
19321   __pyx_slice__21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__21)) __PYX_ERR(2, 682, __pyx_L1_error)
19322   __Pyx_GOTREF(__pyx_slice__21);
19323   __Pyx_GIVEREF(__pyx_slice__21);
19324 
19325   /* "View.MemoryView":703
19326  *     for suboffset in suboffsets[:ndim]:
19327  *         if suboffset >= 0:
19328  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
19329  *
19330  *
19331  */
19332   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 703, __pyx_L1_error)
19333   __Pyx_GOTREF(__pyx_tuple__22);
19334   __Pyx_GIVEREF(__pyx_tuple__22);
19335 
19336   /* "(tree fragment)":2
19337  * def __reduce_cython__(self):
19338  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19339  * def __setstate_cython__(self, __pyx_state):
19340  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19341  */
19342   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 2, __pyx_L1_error)
19343   __Pyx_GOTREF(__pyx_tuple__23);
19344   __Pyx_GIVEREF(__pyx_tuple__23);
19345 
19346   /* "(tree fragment)":4
19347  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19348  * def __setstate_cython__(self, __pyx_state):
19349  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19350  */
19351   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 4, __pyx_L1_error)
19352   __Pyx_GOTREF(__pyx_tuple__24);
19353   __Pyx_GIVEREF(__pyx_tuple__24);
19354 
19355   /* "View.MemoryView":286
19356  *         return self.name
19357  *
19358  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
19359  * cdef strided = Enum("<strided and direct>") # default
19360  * cdef indirect = Enum("<strided and indirect>")
19361  */
19362   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 286, __pyx_L1_error)
19363   __Pyx_GOTREF(__pyx_tuple__25);
19364   __Pyx_GIVEREF(__pyx_tuple__25);
19365 
19366   /* "View.MemoryView":287
19367  *
19368  * cdef generic = Enum("<strided and direct or indirect>")
19369  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
19370  * cdef indirect = Enum("<strided and indirect>")
19371  *
19372  */
19373   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 287, __pyx_L1_error)
19374   __Pyx_GOTREF(__pyx_tuple__26);
19375   __Pyx_GIVEREF(__pyx_tuple__26);
19376 
19377   /* "View.MemoryView":288
19378  * cdef generic = Enum("<strided and direct or indirect>")
19379  * cdef strided = Enum("<strided and direct>") # default
19380  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
19381  *
19382  *
19383  */
19384   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 288, __pyx_L1_error)
19385   __Pyx_GOTREF(__pyx_tuple__27);
19386   __Pyx_GIVEREF(__pyx_tuple__27);
19387 
19388   /* "View.MemoryView":291
19389  *
19390  *
19391  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
19392  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
19393  *
19394  */
19395   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 291, __pyx_L1_error)
19396   __Pyx_GOTREF(__pyx_tuple__28);
19397   __Pyx_GIVEREF(__pyx_tuple__28);
19398 
19399   /* "View.MemoryView":292
19400  *
19401  * cdef contiguous = Enum("<contiguous and direct>")
19402  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
19403  *
19404  *
19405  */
19406   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 292, __pyx_L1_error)
19407   __Pyx_GOTREF(__pyx_tuple__29);
19408   __Pyx_GIVEREF(__pyx_tuple__29);
19409 
19410   /* "(tree fragment)":1
19411  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19412  *     cdef object __pyx_PickleError
19413  *     cdef object __pyx_result
19414  */
19415   __pyx_tuple__30 = 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__30)) __PYX_ERR(2, 1, __pyx_L1_error)
19416   __Pyx_GOTREF(__pyx_tuple__30);
19417   __Pyx_GIVEREF(__pyx_tuple__30);
19418   __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(2, 1, __pyx_L1_error)
19419   __Pyx_RefNannyFinishContext();
19420   return 0;
19421   __pyx_L1_error:;
19422   __Pyx_RefNannyFinishContext();
19423   return -1;
19424 }
19425 
__Pyx_InitGlobals(void)19426 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
19427   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19428   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
19429   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19430   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
19431   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19432   return 0;
19433   __pyx_L1_error:;
19434   return -1;
19435 }
19436 
19437 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
19438 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
19439 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
19440 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
19441 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
19442 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
19443 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
19444 
__Pyx_modinit_global_init_code(void)19445 static int __Pyx_modinit_global_init_code(void) {
19446   __Pyx_RefNannyDeclarations
19447   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
19448   /*--- Global init code ---*/
19449   generic = Py_None; Py_INCREF(Py_None);
19450   strided = Py_None; Py_INCREF(Py_None);
19451   indirect = Py_None; Py_INCREF(Py_None);
19452   contiguous = Py_None; Py_INCREF(Py_None);
19453   indirect_contiguous = Py_None; Py_INCREF(Py_None);
19454   __Pyx_RefNannyFinishContext();
19455   return 0;
19456 }
19457 
__Pyx_modinit_variable_export_code(void)19458 static int __Pyx_modinit_variable_export_code(void) {
19459   __Pyx_RefNannyDeclarations
19460   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
19461   /*--- Variable export code ---*/
19462   __Pyx_RefNannyFinishContext();
19463   return 0;
19464 }
19465 
__Pyx_modinit_function_export_code(void)19466 static int __Pyx_modinit_function_export_code(void) {
19467   __Pyx_RefNannyDeclarations
19468   int __pyx_lineno = 0;
19469   const char *__pyx_filename = NULL;
19470   int __pyx_clineno = 0;
19471   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
19472   /*--- Function export code ---*/
19473   if (__Pyx_ExportFunction("open_dataset", (void (*)(void))__pyx_f_8rasterio_5_shim_open_dataset, "GDALDatasetH (PyObject *, int, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19474   if (__Pyx_ExportFunction("delete_nodata_value", (void (*)(void))__pyx_f_8rasterio_5_shim_delete_nodata_value, "int (GDALRasterBandH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19475   if (__Pyx_ExportFunction("io_band", (void (*)(void))__pyx_f_8rasterio_5_shim_io_band, "int (GDALRasterBandH, int, double, double, double, double, PyObject *, struct __pyx_opt_args_8rasterio_5_shim_io_band *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19476   if (__Pyx_ExportFunction("io_multi_band", (void (*)(void))__pyx_f_8rasterio_5_shim_io_multi_band, "int (GDALDatasetH, int, double, double, double, double, PyObject *, __Pyx_memviewslice, struct __pyx_opt_args_8rasterio_5_shim_io_multi_band *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19477   if (__Pyx_ExportFunction("io_multi_mask", (void (*)(void))__pyx_f_8rasterio_5_shim_io_multi_mask, "int (GDALDatasetH, int, double, double, double, double, PyObject *, __Pyx_memviewslice, struct __pyx_opt_args_8rasterio_5_shim_io_multi_mask *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19478   if (__Pyx_ExportFunction("osr_get_name", (void (*)(void))__pyx_f_8rasterio_5_shim_osr_get_name, "char const *(OGRSpatialReferenceH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19479   if (__Pyx_ExportFunction("osr_set_traditional_axis_mapping_strategy", (void (*)(void))__pyx_f_8rasterio_5_shim_osr_set_traditional_axis_mapping_strategy, "void (OGRSpatialReferenceH)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19480   if (__Pyx_ExportFunction("set_proj_search_path", (void (*)(void))__pyx_f_8rasterio_5_shim_set_proj_search_path, "void (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19481   __Pyx_RefNannyFinishContext();
19482   return 0;
19483   __pyx_L1_error:;
19484   __Pyx_RefNannyFinishContext();
19485   return -1;
19486 }
19487 
__Pyx_modinit_type_init_code(void)19488 static int __Pyx_modinit_type_init_code(void) {
19489   __Pyx_RefNannyDeclarations
19490   int __pyx_lineno = 0;
19491   const char *__pyx_filename = NULL;
19492   int __pyx_clineno = 0;
19493   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
19494   /*--- Type init code ---*/
19495   __pyx_vtabptr_array = &__pyx_vtable_array;
19496   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
19497   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19498   #if PY_VERSION_HEX < 0x030800B1
19499   __pyx_type___pyx_array.tp_print = 0;
19500   #endif
19501   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19502   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19503   __pyx_array_type = &__pyx_type___pyx_array;
19504   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
19505   #if PY_VERSION_HEX < 0x030800B1
19506   __pyx_type___pyx_MemviewEnum.tp_print = 0;
19507   #endif
19508   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
19509     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19510   }
19511   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
19512   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
19513   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
19514   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
19515   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
19516   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
19517   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
19518   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
19519   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
19520   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
19521   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19522   #if PY_VERSION_HEX < 0x030800B1
19523   __pyx_type___pyx_memoryview.tp_print = 0;
19524   #endif
19525   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
19526     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19527   }
19528   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19529   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19530   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
19531   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
19532   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
19533   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
19534   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
19535   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
19536   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19537   #if PY_VERSION_HEX < 0x030800B1
19538   __pyx_type___pyx_memoryviewslice.tp_print = 0;
19539   #endif
19540   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
19541     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19542   }
19543   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19544   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19545   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
19546   __Pyx_RefNannyFinishContext();
19547   return 0;
19548   __pyx_L1_error:;
19549   __Pyx_RefNannyFinishContext();
19550   return -1;
19551 }
19552 
__Pyx_modinit_type_import_code(void)19553 static int __Pyx_modinit_type_import_code(void) {
19554   __Pyx_RefNannyDeclarations
19555   PyObject *__pyx_t_1 = NULL;
19556   int __pyx_lineno = 0;
19557   const char *__pyx_filename = NULL;
19558   int __pyx_clineno = 0;
19559   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
19560   /*--- Type import code ---*/
19561   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
19562   __Pyx_GOTREF(__pyx_t_1);
19563   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
19564   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
19565   sizeof(PyTypeObject),
19566   #else
19567   sizeof(PyHeapTypeObject),
19568   #endif
19569   __Pyx_ImportType_CheckSize_Warn);
19570    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
19571   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19572   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
19573   __Pyx_GOTREF(__pyx_t_1);
19574   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
19575    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
19576   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
19577    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
19578   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
19579    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
19580   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
19581    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
19582   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19583    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
19584   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19585    if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
19586   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19587    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
19588   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19589    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
19590   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19591    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
19592   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19593    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
19594   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19595    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
19596   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19597    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
19598   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19599    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
19600   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19601    if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
19602   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
19603    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
19604   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19605   __Pyx_RefNannyFinishContext();
19606   return 0;
19607   __pyx_L1_error:;
19608   __Pyx_XDECREF(__pyx_t_1);
19609   __Pyx_RefNannyFinishContext();
19610   return -1;
19611 }
19612 
__Pyx_modinit_variable_import_code(void)19613 static int __Pyx_modinit_variable_import_code(void) {
19614   __Pyx_RefNannyDeclarations
19615   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
19616   /*--- Variable import code ---*/
19617   __Pyx_RefNannyFinishContext();
19618   return 0;
19619 }
19620 
__Pyx_modinit_function_import_code(void)19621 static int __Pyx_modinit_function_import_code(void) {
19622   __Pyx_RefNannyDeclarations
19623   PyObject *__pyx_t_1 = NULL;
19624   int __pyx_lineno = 0;
19625   const char *__pyx_filename = NULL;
19626   int __pyx_clineno = 0;
19627   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
19628   /*--- Function import code ---*/
19629   __pyx_t_1 = PyImport_ImportModule("rasterio._err"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
19630   __Pyx_GOTREF(__pyx_t_1);
19631   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_int", (void (**)(void))&__pyx_f_8rasterio_4_err_exc_wrap_int, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19632   if (__Pyx_ImportFunction(__pyx_t_1, "exc_wrap_pointer", (void (**)(void))&__pyx_f_8rasterio_4_err_exc_wrap_pointer, "void *(void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19633   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19634   __Pyx_RefNannyFinishContext();
19635   return 0;
19636   __pyx_L1_error:;
19637   __Pyx_XDECREF(__pyx_t_1);
19638   __Pyx_RefNannyFinishContext();
19639   return -1;
19640 }
19641 
19642 
19643 #ifndef CYTHON_NO_PYINIT_EXPORT
19644 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
19645 #elif PY_MAJOR_VERSION < 3
19646 #ifdef __cplusplus
19647 #define __Pyx_PyMODINIT_FUNC extern "C" void
19648 #else
19649 #define __Pyx_PyMODINIT_FUNC void
19650 #endif
19651 #else
19652 #ifdef __cplusplus
19653 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
19654 #else
19655 #define __Pyx_PyMODINIT_FUNC PyObject *
19656 #endif
19657 #endif
19658 
19659 
19660 #if PY_MAJOR_VERSION < 3
19661 __Pyx_PyMODINIT_FUNC init_shim(void) CYTHON_SMALL_CODE; /*proto*/
init_shim(void)19662 __Pyx_PyMODINIT_FUNC init_shim(void)
19663 #else
19664 __Pyx_PyMODINIT_FUNC PyInit__shim(void) CYTHON_SMALL_CODE; /*proto*/
19665 __Pyx_PyMODINIT_FUNC PyInit__shim(void)
19666 #if CYTHON_PEP489_MULTI_PHASE_INIT
19667 {
19668   return PyModuleDef_Init(&__pyx_moduledef);
19669 }
19670 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
19671     #if PY_VERSION_HEX >= 0x030700A1
19672     static PY_INT64_T main_interpreter_id = -1;
19673     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
19674     if (main_interpreter_id == -1) {
19675         main_interpreter_id = current_id;
19676         return (unlikely(current_id == -1)) ? -1 : 0;
19677     } else if (unlikely(main_interpreter_id != current_id))
19678     #else
19679     static PyInterpreterState *main_interpreter = NULL;
19680     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
19681     if (!main_interpreter) {
19682         main_interpreter = current_interpreter;
19683     } else if (unlikely(main_interpreter != current_interpreter))
19684     #endif
19685     {
19686         PyErr_SetString(
19687             PyExc_ImportError,
19688             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
19689         return -1;
19690     }
19691     return 0;
19692 }
19693 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) {
19694     PyObject *value = PyObject_GetAttrString(spec, from_name);
19695     int result = 0;
19696     if (likely(value)) {
19697         if (allow_none || value != Py_None) {
19698             result = PyDict_SetItemString(moddict, to_name, value);
19699         }
19700         Py_DECREF(value);
19701     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
19702         PyErr_Clear();
19703     } else {
19704         result = -1;
19705     }
19706     return result;
19707 }
19708 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
19709     PyObject *module = NULL, *moddict, *modname;
19710     if (__Pyx_check_single_interpreter())
19711         return NULL;
19712     if (__pyx_m)
19713         return __Pyx_NewRef(__pyx_m);
19714     modname = PyObject_GetAttrString(spec, "name");
19715     if (unlikely(!modname)) goto bad;
19716     module = PyModule_NewObject(modname);
19717     Py_DECREF(modname);
19718     if (unlikely(!module)) goto bad;
19719     moddict = PyModule_GetDict(module);
19720     if (unlikely(!moddict)) goto bad;
19721     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
19722     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
19723     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
19724     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
19725     return module;
19726 bad:
19727     Py_XDECREF(module);
19728     return NULL;
19729 }
19730 
19731 
19732 static CYTHON_SMALL_CODE int __pyx_pymod_exec__shim(PyObject *__pyx_pyinit_module)
19733 #endif
19734 #endif
19735 {
19736   PyObject *__pyx_t_1 = NULL;
19737   PyObject *__pyx_t_2 = NULL;
19738   static PyThread_type_lock __pyx_t_3[8];
19739   int __pyx_lineno = 0;
19740   const char *__pyx_filename = NULL;
19741   int __pyx_clineno = 0;
19742   __Pyx_RefNannyDeclarations
19743   #if CYTHON_PEP489_MULTI_PHASE_INIT
19744   if (__pyx_m) {
19745     if (__pyx_m == __pyx_pyinit_module) return 0;
19746     PyErr_SetString(PyExc_RuntimeError, "Module '_shim' has already been imported. Re-initialisation is not supported.");
19747     return -1;
19748   }
19749   #elif PY_MAJOR_VERSION >= 3
19750   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
19751   #endif
19752   #if CYTHON_REFNANNY
19753 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
19754 if (!__Pyx_RefNanny) {
19755   PyErr_Clear();
19756   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
19757   if (!__Pyx_RefNanny)
19758       Py_FatalError("failed to import 'refnanny' module");
19759 }
19760 #endif
19761   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__shim(void)", 0);
19762   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19763   #ifdef __Pxy_PyFrame_Initialize_Offsets
19764   __Pxy_PyFrame_Initialize_Offsets();
19765   #endif
19766   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
19767   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
19768   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
19769   #ifdef __Pyx_CyFunction_USED
19770   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19771   #endif
19772   #ifdef __Pyx_FusedFunction_USED
19773   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19774   #endif
19775   #ifdef __Pyx_Coroutine_USED
19776   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19777   #endif
19778   #ifdef __Pyx_Generator_USED
19779   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19780   #endif
19781   #ifdef __Pyx_AsyncGen_USED
19782   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19783   #endif
19784   #ifdef __Pyx_StopAsyncIteration_USED
19785   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19786   #endif
19787   /*--- Library function declarations ---*/
19788   /*--- Threads initialization code ---*/
19789   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
19790   #ifdef WITH_THREAD /* Python build with threading support? */
19791   PyEval_InitThreads();
19792   #endif
19793   #endif
19794   /*--- Module creation code ---*/
19795   #if CYTHON_PEP489_MULTI_PHASE_INIT
19796   __pyx_m = __pyx_pyinit_module;
19797   Py_INCREF(__pyx_m);
19798   #else
19799   #if PY_MAJOR_VERSION < 3
19800   __pyx_m = Py_InitModule4("_shim", __pyx_methods, __pyx_k_Rasterio_shim_for_GDAL_1_x, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
19801   #else
19802   __pyx_m = PyModule_Create(&__pyx_moduledef);
19803   #endif
19804   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
19805   #endif
19806   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
19807   Py_INCREF(__pyx_d);
19808   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
19809   Py_INCREF(__pyx_b);
19810   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
19811   Py_INCREF(__pyx_cython_runtime);
19812   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19813   /*--- Initialize various global constants etc. ---*/
19814   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19815   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
19816   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19817   #endif
19818   if (__pyx_module_is_main_rasterio___shim) {
19819     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19820   }
19821   #if PY_MAJOR_VERSION >= 3
19822   {
19823     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
19824     if (!PyDict_GetItemString(modules, "rasterio._shim")) {
19825       if (unlikely(PyDict_SetItemString(modules, "rasterio._shim", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19826     }
19827   }
19828   #endif
19829   /*--- Builtin init code ---*/
19830   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19831   /*--- Constants init code ---*/
19832   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19833   /*--- Global type/function init code ---*/
19834   (void)__Pyx_modinit_global_init_code();
19835   (void)__Pyx_modinit_variable_export_code();
19836   if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19837   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19838   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19839   (void)__Pyx_modinit_variable_import_code();
19840   if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19841   /*--- Execution code ---*/
19842   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
19843   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19844   #endif
19845 
19846   /* "rasterio/_shim.pyx":10
19847  * include "gdal.pxi"
19848  *
19849  * import os             # <<<<<<<<<<<<<<
19850  *
19851  * # Implementation specific to GDAL<2.0
19852  */
19853   __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
19854   __Pyx_GOTREF(__pyx_t_1);
19855   if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
19856   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19857 
19858   /* "rasterio/_shim.pyx":13
19859  *
19860  * # Implementation specific to GDAL<2.0
19861  * from rasterio import dtypes             # <<<<<<<<<<<<<<
19862  * from rasterio.enums import Resampling
19863  *
19864  */
19865   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
19866   __Pyx_GOTREF(__pyx_t_1);
19867   __Pyx_INCREF(__pyx_n_s_dtypes);
19868   __Pyx_GIVEREF(__pyx_n_s_dtypes);
19869   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dtypes);
19870   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
19871   __Pyx_GOTREF(__pyx_t_2);
19872   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19873   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
19874   __Pyx_GOTREF(__pyx_t_1);
19875   if (PyDict_SetItem(__pyx_d, __pyx_n_s_dtypes, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
19876   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19877   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19878 
19879   /* "rasterio/_shim.pyx":14
19880  * # Implementation specific to GDAL<2.0
19881  * from rasterio import dtypes
19882  * from rasterio.enums import Resampling             # <<<<<<<<<<<<<<
19883  *
19884  * cimport numpy as np
19885  */
19886   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
19887   __Pyx_GOTREF(__pyx_t_2);
19888   __Pyx_INCREF(__pyx_n_s_Resampling);
19889   __Pyx_GIVEREF(__pyx_n_s_Resampling);
19890   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Resampling);
19891   __pyx_t_1 = __Pyx_Import(__pyx_n_s_rasterio_enums, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
19892   __Pyx_GOTREF(__pyx_t_1);
19893   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19894   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Resampling); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
19895   __Pyx_GOTREF(__pyx_t_2);
19896   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Resampling, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
19897   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19898   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19899 
19900   /* "rasterio/_shim.pyx":19
19901  * from rasterio._err cimport exc_wrap_int, exc_wrap_pointer
19902  *
19903  * from rasterio.errors import GDALOptionNotImplementedError, DatasetIOShapeError             # <<<<<<<<<<<<<<
19904  *
19905  *
19906  */
19907   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
19908   __Pyx_GOTREF(__pyx_t_1);
19909   __Pyx_INCREF(__pyx_n_s_GDALOptionNotImplementedError);
19910   __Pyx_GIVEREF(__pyx_n_s_GDALOptionNotImplementedError);
19911   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_GDALOptionNotImplementedError);
19912   __Pyx_INCREF(__pyx_n_s_DatasetIOShapeError);
19913   __Pyx_GIVEREF(__pyx_n_s_DatasetIOShapeError);
19914   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_DatasetIOShapeError);
19915   __pyx_t_2 = __Pyx_Import(__pyx_n_s_rasterio_errors, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
19916   __Pyx_GOTREF(__pyx_t_2);
19917   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19918   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_GDALOptionNotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
19919   __Pyx_GOTREF(__pyx_t_1);
19920   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GDALOptionNotImplementedError, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
19921   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19922   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_DatasetIOShapeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
19923   __Pyx_GOTREF(__pyx_t_1);
19924   if (PyDict_SetItem(__pyx_d, __pyx_n_s_DatasetIOShapeError, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
19925   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19926   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19927 
19928   /* "rasterio/_shim.pyx":1
19929  * # cython: language_level=3             # <<<<<<<<<<<<<<
19930  *
19931  * """Rasterio shim for GDAL 1.x"""
19932  */
19933   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
19934   __Pyx_GOTREF(__pyx_t_2);
19935   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19936   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19937 
19938   /* "View.MemoryView":209
19939  *         info.obj = self
19940  *
19941  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
19942  *
19943  *     def __dealloc__(array self):
19944  */
19945   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 209, __pyx_L1_error)
19946   __Pyx_GOTREF(__pyx_t_2);
19947   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
19948   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19949   PyType_Modified(__pyx_array_type);
19950 
19951   /* "View.MemoryView":286
19952  *         return self.name
19953  *
19954  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
19955  * cdef strided = Enum("<strided and direct>") # default
19956  * cdef indirect = Enum("<strided and indirect>")
19957  */
19958   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 286, __pyx_L1_error)
19959   __Pyx_GOTREF(__pyx_t_2);
19960   __Pyx_XGOTREF(generic);
19961   __Pyx_DECREF_SET(generic, __pyx_t_2);
19962   __Pyx_GIVEREF(__pyx_t_2);
19963   __pyx_t_2 = 0;
19964 
19965   /* "View.MemoryView":287
19966  *
19967  * cdef generic = Enum("<strided and direct or indirect>")
19968  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
19969  * cdef indirect = Enum("<strided and indirect>")
19970  *
19971  */
19972   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error)
19973   __Pyx_GOTREF(__pyx_t_2);
19974   __Pyx_XGOTREF(strided);
19975   __Pyx_DECREF_SET(strided, __pyx_t_2);
19976   __Pyx_GIVEREF(__pyx_t_2);
19977   __pyx_t_2 = 0;
19978 
19979   /* "View.MemoryView":288
19980  * cdef generic = Enum("<strided and direct or indirect>")
19981  * cdef strided = Enum("<strided and direct>") # default
19982  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
19983  *
19984  *
19985  */
19986   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error)
19987   __Pyx_GOTREF(__pyx_t_2);
19988   __Pyx_XGOTREF(indirect);
19989   __Pyx_DECREF_SET(indirect, __pyx_t_2);
19990   __Pyx_GIVEREF(__pyx_t_2);
19991   __pyx_t_2 = 0;
19992 
19993   /* "View.MemoryView":291
19994  *
19995  *
19996  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
19997  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
19998  *
19999  */
20000   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 291, __pyx_L1_error)
20001   __Pyx_GOTREF(__pyx_t_2);
20002   __Pyx_XGOTREF(contiguous);
20003   __Pyx_DECREF_SET(contiguous, __pyx_t_2);
20004   __Pyx_GIVEREF(__pyx_t_2);
20005   __pyx_t_2 = 0;
20006 
20007   /* "View.MemoryView":292
20008  *
20009  * cdef contiguous = Enum("<contiguous and direct>")
20010  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
20011  *
20012  *
20013  */
20014   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error)
20015   __Pyx_GOTREF(__pyx_t_2);
20016   __Pyx_XGOTREF(indirect_contiguous);
20017   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
20018   __Pyx_GIVEREF(__pyx_t_2);
20019   __pyx_t_2 = 0;
20020 
20021   /* "View.MemoryView":316
20022  *
20023  * DEF THREAD_LOCKS_PREALLOCATED = 8
20024  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
20025  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
20026  *     PyThread_allocate_lock(),
20027  */
20028   __pyx_memoryview_thread_locks_used = 0;
20029 
20030   /* "View.MemoryView":317
20031  * DEF THREAD_LOCKS_PREALLOCATED = 8
20032  * cdef int __pyx_memoryview_thread_locks_used = 0
20033  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
20034  *     PyThread_allocate_lock(),
20035  *     PyThread_allocate_lock(),
20036  */
20037   __pyx_t_3[0] = PyThread_allocate_lock();
20038   __pyx_t_3[1] = PyThread_allocate_lock();
20039   __pyx_t_3[2] = PyThread_allocate_lock();
20040   __pyx_t_3[3] = PyThread_allocate_lock();
20041   __pyx_t_3[4] = PyThread_allocate_lock();
20042   __pyx_t_3[5] = PyThread_allocate_lock();
20043   __pyx_t_3[6] = PyThread_allocate_lock();
20044   __pyx_t_3[7] = PyThread_allocate_lock();
20045   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
20046 
20047   /* "View.MemoryView":549
20048  *         info.obj = self
20049  *
20050  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
20051  *
20052  *
20053  */
20054   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 549, __pyx_L1_error)
20055   __Pyx_GOTREF(__pyx_t_2);
20056   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
20057   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20058   PyType_Modified(__pyx_memoryview_type);
20059 
20060   /* "View.MemoryView":995
20061  *         return self.from_object
20062  *
20063  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
20064  *
20065  *
20066  */
20067   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 995, __pyx_L1_error)
20068   __Pyx_GOTREF(__pyx_t_2);
20069   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
20070   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20071   PyType_Modified(__pyx_memoryviewslice_type);
20072 
20073   /* "(tree fragment)":1
20074  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
20075  *     cdef object __pyx_PickleError
20076  *     cdef object __pyx_result
20077  */
20078   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
20079   __Pyx_GOTREF(__pyx_t_2);
20080   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
20081   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20082 
20083   /* "(tree fragment)":11
20084  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20085  *     return __pyx_result
20086  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
20087  *     __pyx_result.name = __pyx_state[0]
20088  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20089  */
20090 
20091   /*--- Wrapped vars code ---*/
20092 
20093   goto __pyx_L0;
20094   __pyx_L1_error:;
20095   __Pyx_XDECREF(__pyx_t_1);
20096   __Pyx_XDECREF(__pyx_t_2);
20097   if (__pyx_m) {
20098     if (__pyx_d) {
20099       __Pyx_AddTraceback("init rasterio._shim", __pyx_clineno, __pyx_lineno, __pyx_filename);
20100     }
20101     Py_CLEAR(__pyx_m);
20102   } else if (!PyErr_Occurred()) {
20103     PyErr_SetString(PyExc_ImportError, "init rasterio._shim");
20104   }
20105   __pyx_L0:;
20106   __Pyx_RefNannyFinishContext();
20107   #if CYTHON_PEP489_MULTI_PHASE_INIT
20108   return (__pyx_m != NULL) ? 0 : -1;
20109   #elif PY_MAJOR_VERSION >= 3
20110   return __pyx_m;
20111   #else
20112   return;
20113   #endif
20114 }
20115 
20116 /* --- Runtime support code --- */
20117 /* Refnanny */
20118 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)20119 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
20120     PyObject *m = NULL, *p = NULL;
20121     void *r = NULL;
20122     m = PyImport_ImportModule(modname);
20123     if (!m) goto end;
20124     p = PyObject_GetAttrString(m, "RefNannyAPI");
20125     if (!p) goto end;
20126     r = PyLong_AsVoidPtr(p);
20127 end:
20128     Py_XDECREF(p);
20129     Py_XDECREF(m);
20130     return (__Pyx_RefNannyAPIStruct *)r;
20131 }
20132 #endif
20133 
20134 /* PyObjectGetAttrStr */
20135 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)20136 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
20137     PyTypeObject* tp = Py_TYPE(obj);
20138     if (likely(tp->tp_getattro))
20139         return tp->tp_getattro(obj, attr_name);
20140 #if PY_MAJOR_VERSION < 3
20141     if (likely(tp->tp_getattr))
20142         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
20143 #endif
20144     return PyObject_GetAttr(obj, attr_name);
20145 }
20146 #endif
20147 
20148 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)20149 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
20150     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
20151     if (unlikely(!result)) {
20152         PyErr_Format(PyExc_NameError,
20153 #if PY_MAJOR_VERSION >= 3
20154             "name '%U' is not defined", name);
20155 #else
20156             "name '%.200s' is not defined", PyString_AS_STRING(name));
20157 #endif
20158     }
20159     return result;
20160 }
20161 
20162 /* PyCFunctionFastCall */
20163 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)20164 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
20165     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
20166     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
20167     PyObject *self = PyCFunction_GET_SELF(func);
20168     int flags = PyCFunction_GET_FLAGS(func);
20169     assert(PyCFunction_Check(func));
20170     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
20171     assert(nargs >= 0);
20172     assert(nargs == 0 || args != NULL);
20173     /* _PyCFunction_FastCallDict() must not be called with an exception set,
20174        because it may clear it (directly or indirectly) and so the
20175        caller loses its exception */
20176     assert(!PyErr_Occurred());
20177     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
20178         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
20179     } else {
20180         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
20181     }
20182 }
20183 #endif
20184 
20185 /* PyFunctionFastCall */
20186 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)20187 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
20188                                                PyObject *globals) {
20189     PyFrameObject *f;
20190     PyThreadState *tstate = __Pyx_PyThreadState_Current;
20191     PyObject **fastlocals;
20192     Py_ssize_t i;
20193     PyObject *result;
20194     assert(globals != NULL);
20195     /* XXX Perhaps we should create a specialized
20196        PyFrame_New() that doesn't take locals, but does
20197        take builtins without sanity checking them.
20198        */
20199     assert(tstate != NULL);
20200     f = PyFrame_New(tstate, co, globals, NULL);
20201     if (f == NULL) {
20202         return NULL;
20203     }
20204     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
20205     for (i = 0; i < na; i++) {
20206         Py_INCREF(*args);
20207         fastlocals[i] = *args++;
20208     }
20209     result = PyEval_EvalFrameEx(f,0);
20210     ++tstate->recursion_depth;
20211     Py_DECREF(f);
20212     --tstate->recursion_depth;
20213     return result;
20214 }
20215 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)20216 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
20217     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
20218     PyObject *globals = PyFunction_GET_GLOBALS(func);
20219     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
20220     PyObject *closure;
20221 #if PY_MAJOR_VERSION >= 3
20222     PyObject *kwdefs;
20223 #endif
20224     PyObject *kwtuple, **k;
20225     PyObject **d;
20226     Py_ssize_t nd;
20227     Py_ssize_t nk;
20228     PyObject *result;
20229     assert(kwargs == NULL || PyDict_Check(kwargs));
20230     nk = kwargs ? PyDict_Size(kwargs) : 0;
20231     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
20232         return NULL;
20233     }
20234     if (
20235 #if PY_MAJOR_VERSION >= 3
20236             co->co_kwonlyargcount == 0 &&
20237 #endif
20238             likely(kwargs == NULL || nk == 0) &&
20239             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
20240         if (argdefs == NULL && co->co_argcount == nargs) {
20241             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
20242             goto done;
20243         }
20244         else if (nargs == 0 && argdefs != NULL
20245                  && co->co_argcount == Py_SIZE(argdefs)) {
20246             /* function called with no arguments, but all parameters have
20247                a default value: use default values as arguments .*/
20248             args = &PyTuple_GET_ITEM(argdefs, 0);
20249             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
20250             goto done;
20251         }
20252     }
20253     if (kwargs != NULL) {
20254         Py_ssize_t pos, i;
20255         kwtuple = PyTuple_New(2 * nk);
20256         if (kwtuple == NULL) {
20257             result = NULL;
20258             goto done;
20259         }
20260         k = &PyTuple_GET_ITEM(kwtuple, 0);
20261         pos = i = 0;
20262         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
20263             Py_INCREF(k[i]);
20264             Py_INCREF(k[i+1]);
20265             i += 2;
20266         }
20267         nk = i / 2;
20268     }
20269     else {
20270         kwtuple = NULL;
20271         k = NULL;
20272     }
20273     closure = PyFunction_GET_CLOSURE(func);
20274 #if PY_MAJOR_VERSION >= 3
20275     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
20276 #endif
20277     if (argdefs != NULL) {
20278         d = &PyTuple_GET_ITEM(argdefs, 0);
20279         nd = Py_SIZE(argdefs);
20280     }
20281     else {
20282         d = NULL;
20283         nd = 0;
20284     }
20285 #if PY_MAJOR_VERSION >= 3
20286     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
20287                                args, (int)nargs,
20288                                k, (int)nk,
20289                                d, (int)nd, kwdefs, closure);
20290 #else
20291     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
20292                                args, (int)nargs,
20293                                k, (int)nk,
20294                                d, (int)nd, closure);
20295 #endif
20296     Py_XDECREF(kwtuple);
20297 done:
20298     Py_LeaveRecursiveCall();
20299     return result;
20300 }
20301 #endif
20302 #endif
20303 
20304 /* PyObjectCall */
20305 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)20306 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
20307     PyObject *result;
20308     ternaryfunc call = func->ob_type->tp_call;
20309     if (unlikely(!call))
20310         return PyObject_Call(func, arg, kw);
20311     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
20312         return NULL;
20313     result = (*call)(func, arg, kw);
20314     Py_LeaveRecursiveCall();
20315     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20316         PyErr_SetString(
20317             PyExc_SystemError,
20318             "NULL result without error in PyObject_Call");
20319     }
20320     return result;
20321 }
20322 #endif
20323 
20324 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)20325 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
20326     PyObject *args, *result = NULL;
20327     #if CYTHON_FAST_PYCALL
20328     if (PyFunction_Check(function)) {
20329         PyObject *args[2] = {arg1, arg2};
20330         return __Pyx_PyFunction_FastCall(function, args, 2);
20331     }
20332     #endif
20333     #if CYTHON_FAST_PYCCALL
20334     if (__Pyx_PyFastCFunction_Check(function)) {
20335         PyObject *args[2] = {arg1, arg2};
20336         return __Pyx_PyCFunction_FastCall(function, args, 2);
20337     }
20338     #endif
20339     args = PyTuple_New(2);
20340     if (unlikely(!args)) goto done;
20341     Py_INCREF(arg1);
20342     PyTuple_SET_ITEM(args, 0, arg1);
20343     Py_INCREF(arg2);
20344     PyTuple_SET_ITEM(args, 1, arg2);
20345     Py_INCREF(function);
20346     result = __Pyx_PyObject_Call(function, args, NULL);
20347     Py_DECREF(args);
20348     Py_DECREF(function);
20349 done:
20350     return result;
20351 }
20352 
20353 /* PyObjectCallMethO */
20354 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)20355 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
20356     PyObject *self, *result;
20357     PyCFunction cfunc;
20358     cfunc = PyCFunction_GET_FUNCTION(func);
20359     self = PyCFunction_GET_SELF(func);
20360     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
20361         return NULL;
20362     result = cfunc(self, arg);
20363     Py_LeaveRecursiveCall();
20364     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20365         PyErr_SetString(
20366             PyExc_SystemError,
20367             "NULL result without error in PyObject_Call");
20368     }
20369     return result;
20370 }
20371 #endif
20372 
20373 /* PyObjectCallOneArg */
20374 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)20375 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20376     PyObject *result;
20377     PyObject *args = PyTuple_New(1);
20378     if (unlikely(!args)) return NULL;
20379     Py_INCREF(arg);
20380     PyTuple_SET_ITEM(args, 0, arg);
20381     result = __Pyx_PyObject_Call(func, args, NULL);
20382     Py_DECREF(args);
20383     return result;
20384 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)20385 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20386 #if CYTHON_FAST_PYCALL
20387     if (PyFunction_Check(func)) {
20388         return __Pyx_PyFunction_FastCall(func, &arg, 1);
20389     }
20390 #endif
20391     if (likely(PyCFunction_Check(func))) {
20392         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
20393             return __Pyx_PyObject_CallMethO(func, arg);
20394 #if CYTHON_FAST_PYCCALL
20395         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
20396             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
20397 #endif
20398         }
20399     }
20400     return __Pyx__PyObject_CallOneArg(func, arg);
20401 }
20402 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)20403 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20404     PyObject *result;
20405     PyObject *args = PyTuple_Pack(1, arg);
20406     if (unlikely(!args)) return NULL;
20407     result = __Pyx_PyObject_Call(func, args, NULL);
20408     Py_DECREF(args);
20409     return result;
20410 }
20411 #endif
20412 
20413 /* PyErrFetchRestore */
20414 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)20415 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
20416     PyObject *tmp_type, *tmp_value, *tmp_tb;
20417     tmp_type = tstate->curexc_type;
20418     tmp_value = tstate->curexc_value;
20419     tmp_tb = tstate->curexc_traceback;
20420     tstate->curexc_type = type;
20421     tstate->curexc_value = value;
20422     tstate->curexc_traceback = tb;
20423     Py_XDECREF(tmp_type);
20424     Py_XDECREF(tmp_value);
20425     Py_XDECREF(tmp_tb);
20426 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)20427 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20428     *type = tstate->curexc_type;
20429     *value = tstate->curexc_value;
20430     *tb = tstate->curexc_traceback;
20431     tstate->curexc_type = 0;
20432     tstate->curexc_value = 0;
20433     tstate->curexc_traceback = 0;
20434 }
20435 #endif
20436 
20437 /* RaiseException */
20438 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)20439 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
20440                         CYTHON_UNUSED PyObject *cause) {
20441     __Pyx_PyThreadState_declare
20442     Py_XINCREF(type);
20443     if (!value || value == Py_None)
20444         value = NULL;
20445     else
20446         Py_INCREF(value);
20447     if (!tb || tb == Py_None)
20448         tb = NULL;
20449     else {
20450         Py_INCREF(tb);
20451         if (!PyTraceBack_Check(tb)) {
20452             PyErr_SetString(PyExc_TypeError,
20453                 "raise: arg 3 must be a traceback or None");
20454             goto raise_error;
20455         }
20456     }
20457     if (PyType_Check(type)) {
20458 #if CYTHON_COMPILING_IN_PYPY
20459         if (!value) {
20460             Py_INCREF(Py_None);
20461             value = Py_None;
20462         }
20463 #endif
20464         PyErr_NormalizeException(&type, &value, &tb);
20465     } else {
20466         if (value) {
20467             PyErr_SetString(PyExc_TypeError,
20468                 "instance exception may not have a separate value");
20469             goto raise_error;
20470         }
20471         value = type;
20472         type = (PyObject*) Py_TYPE(type);
20473         Py_INCREF(type);
20474         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
20475             PyErr_SetString(PyExc_TypeError,
20476                 "raise: exception class must be a subclass of BaseException");
20477             goto raise_error;
20478         }
20479     }
20480     __Pyx_PyThreadState_assign
20481     __Pyx_ErrRestore(type, value, tb);
20482     return;
20483 raise_error:
20484     Py_XDECREF(value);
20485     Py_XDECREF(type);
20486     Py_XDECREF(tb);
20487     return;
20488 }
20489 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)20490 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
20491     PyObject* owned_instance = NULL;
20492     if (tb == Py_None) {
20493         tb = 0;
20494     } else if (tb && !PyTraceBack_Check(tb)) {
20495         PyErr_SetString(PyExc_TypeError,
20496             "raise: arg 3 must be a traceback or None");
20497         goto bad;
20498     }
20499     if (value == Py_None)
20500         value = 0;
20501     if (PyExceptionInstance_Check(type)) {
20502         if (value) {
20503             PyErr_SetString(PyExc_TypeError,
20504                 "instance exception may not have a separate value");
20505             goto bad;
20506         }
20507         value = type;
20508         type = (PyObject*) Py_TYPE(value);
20509     } else if (PyExceptionClass_Check(type)) {
20510         PyObject *instance_class = NULL;
20511         if (value && PyExceptionInstance_Check(value)) {
20512             instance_class = (PyObject*) Py_TYPE(value);
20513             if (instance_class != type) {
20514                 int is_subclass = PyObject_IsSubclass(instance_class, type);
20515                 if (!is_subclass) {
20516                     instance_class = NULL;
20517                 } else if (unlikely(is_subclass == -1)) {
20518                     goto bad;
20519                 } else {
20520                     type = instance_class;
20521                 }
20522             }
20523         }
20524         if (!instance_class) {
20525             PyObject *args;
20526             if (!value)
20527                 args = PyTuple_New(0);
20528             else if (PyTuple_Check(value)) {
20529                 Py_INCREF(value);
20530                 args = value;
20531             } else
20532                 args = PyTuple_Pack(1, value);
20533             if (!args)
20534                 goto bad;
20535             owned_instance = PyObject_Call(type, args, NULL);
20536             Py_DECREF(args);
20537             if (!owned_instance)
20538                 goto bad;
20539             value = owned_instance;
20540             if (!PyExceptionInstance_Check(value)) {
20541                 PyErr_Format(PyExc_TypeError,
20542                              "calling %R should have returned an instance of "
20543                              "BaseException, not %R",
20544                              type, Py_TYPE(value));
20545                 goto bad;
20546             }
20547         }
20548     } else {
20549         PyErr_SetString(PyExc_TypeError,
20550             "raise: exception class must be a subclass of BaseException");
20551         goto bad;
20552     }
20553     if (cause) {
20554         PyObject *fixed_cause;
20555         if (cause == Py_None) {
20556             fixed_cause = NULL;
20557         } else if (PyExceptionClass_Check(cause)) {
20558             fixed_cause = PyObject_CallObject(cause, NULL);
20559             if (fixed_cause == NULL)
20560                 goto bad;
20561         } else if (PyExceptionInstance_Check(cause)) {
20562             fixed_cause = cause;
20563             Py_INCREF(fixed_cause);
20564         } else {
20565             PyErr_SetString(PyExc_TypeError,
20566                             "exception causes must derive from "
20567                             "BaseException");
20568             goto bad;
20569         }
20570         PyException_SetCause(value, fixed_cause);
20571     }
20572     PyErr_SetObject(type, value);
20573     if (tb) {
20574 #if CYTHON_COMPILING_IN_PYPY
20575         PyObject *tmp_type, *tmp_value, *tmp_tb;
20576         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
20577         Py_INCREF(tb);
20578         PyErr_Restore(tmp_type, tmp_value, tb);
20579         Py_XDECREF(tmp_tb);
20580 #else
20581         PyThreadState *tstate = __Pyx_PyThreadState_Current;
20582         PyObject* tmp_tb = tstate->curexc_traceback;
20583         if (tb != tmp_tb) {
20584             Py_INCREF(tb);
20585             tstate->curexc_traceback = tb;
20586             Py_XDECREF(tmp_tb);
20587         }
20588 #endif
20589     }
20590 bad:
20591     Py_XDECREF(owned_instance);
20592     return;
20593 }
20594 #endif
20595 
20596 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)20597 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
20598     if (unlikely(!type)) {
20599         PyErr_SetString(PyExc_SystemError, "Missing type object");
20600         return 0;
20601     }
20602     if (likely(__Pyx_TypeCheck(obj, type)))
20603         return 1;
20604     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
20605                  Py_TYPE(obj)->tp_name, type->tp_name);
20606     return 0;
20607 }
20608 
20609 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)20610 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
20611     PyObject *r;
20612     if (!j) return NULL;
20613     r = PyObject_GetItem(o, j);
20614     Py_DECREF(j);
20615     return r;
20616 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)20617 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
20618                                                               CYTHON_NCP_UNUSED int wraparound,
20619                                                               CYTHON_NCP_UNUSED int boundscheck) {
20620 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20621     Py_ssize_t wrapped_i = i;
20622     if (wraparound & unlikely(i < 0)) {
20623         wrapped_i += PyList_GET_SIZE(o);
20624     }
20625     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
20626         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
20627         Py_INCREF(r);
20628         return r;
20629     }
20630     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20631 #else
20632     return PySequence_GetItem(o, i);
20633 #endif
20634 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)20635 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
20636                                                               CYTHON_NCP_UNUSED int wraparound,
20637                                                               CYTHON_NCP_UNUSED int boundscheck) {
20638 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20639     Py_ssize_t wrapped_i = i;
20640     if (wraparound & unlikely(i < 0)) {
20641         wrapped_i += PyTuple_GET_SIZE(o);
20642     }
20643     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
20644         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
20645         Py_INCREF(r);
20646         return r;
20647     }
20648     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20649 #else
20650     return PySequence_GetItem(o, i);
20651 #endif
20652 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)20653 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
20654                                                      CYTHON_NCP_UNUSED int wraparound,
20655                                                      CYTHON_NCP_UNUSED int boundscheck) {
20656 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
20657     if (is_list || PyList_CheckExact(o)) {
20658         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
20659         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
20660             PyObject *r = PyList_GET_ITEM(o, n);
20661             Py_INCREF(r);
20662             return r;
20663         }
20664     }
20665     else if (PyTuple_CheckExact(o)) {
20666         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
20667         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
20668             PyObject *r = PyTuple_GET_ITEM(o, n);
20669             Py_INCREF(r);
20670             return r;
20671         }
20672     } else {
20673         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
20674         if (likely(m && m->sq_item)) {
20675             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
20676                 Py_ssize_t l = m->sq_length(o);
20677                 if (likely(l >= 0)) {
20678                     i += l;
20679                 } else {
20680                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
20681                         return NULL;
20682                     PyErr_Clear();
20683                 }
20684             }
20685             return m->sq_item(o, i);
20686         }
20687     }
20688 #else
20689     if (is_list || PySequence_Check(o)) {
20690         return PySequence_GetItem(o, i);
20691     }
20692 #endif
20693     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20694 }
20695 
20696 /* PyDictVersioning */
20697 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)20698 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
20699     PyObject *dict = Py_TYPE(obj)->tp_dict;
20700     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
20701 }
__Pyx_get_object_dict_version(PyObject * obj)20702 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
20703     PyObject **dictptr = NULL;
20704     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
20705     if (offset) {
20706 #if CYTHON_COMPILING_IN_CPYTHON
20707         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
20708 #else
20709         dictptr = _PyObject_GetDictPtr(obj);
20710 #endif
20711     }
20712     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
20713 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)20714 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
20715     PyObject *dict = Py_TYPE(obj)->tp_dict;
20716     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
20717         return 0;
20718     return obj_dict_version == __Pyx_get_object_dict_version(obj);
20719 }
20720 #endif
20721 
20722 /* GetModuleGlobalName */
20723 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)20724 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
20725 #else
20726 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
20727 #endif
20728 {
20729     PyObject *result;
20730 #if !CYTHON_AVOID_BORROWED_REFS
20731 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
20732     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
20733     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20734     if (likely(result)) {
20735         return __Pyx_NewRef(result);
20736     } else if (unlikely(PyErr_Occurred())) {
20737         return NULL;
20738     }
20739 #else
20740     result = PyDict_GetItem(__pyx_d, name);
20741     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20742     if (likely(result)) {
20743         return __Pyx_NewRef(result);
20744     }
20745 #endif
20746 #else
20747     result = PyObject_GetItem(__pyx_d, name);
20748     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20749     if (likely(result)) {
20750         return __Pyx_NewRef(result);
20751     }
20752     PyErr_Clear();
20753 #endif
20754     return __Pyx_GetBuiltinName(name);
20755 }
20756 
20757 /* ObjectGetItem */
20758 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)20759 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
20760     PyObject *runerr;
20761     Py_ssize_t key_value;
20762     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
20763     if (unlikely(!(m && m->sq_item))) {
20764         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
20765         return NULL;
20766     }
20767     key_value = __Pyx_PyIndex_AsSsize_t(index);
20768     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
20769         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
20770     }
20771     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
20772         PyErr_Clear();
20773         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
20774     }
20775     return NULL;
20776 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)20777 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
20778     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
20779     if (likely(m && m->mp_subscript)) {
20780         return m->mp_subscript(obj, key);
20781     }
20782     return __Pyx_PyObject_GetIndex(obj, key);
20783 }
20784 #endif
20785 
20786 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)20787 static void __Pyx_RaiseBufferIndexError(int axis) {
20788   PyErr_Format(PyExc_IndexError,
20789      "Out of bounds on buffer access (axis %d)", axis);
20790 }
20791 
20792 /* GetException */
20793 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)20794 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
20795 #else
20796 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
20797 #endif
20798 {
20799     PyObject *local_type, *local_value, *local_tb;
20800 #if CYTHON_FAST_THREAD_STATE
20801     PyObject *tmp_type, *tmp_value, *tmp_tb;
20802     local_type = tstate->curexc_type;
20803     local_value = tstate->curexc_value;
20804     local_tb = tstate->curexc_traceback;
20805     tstate->curexc_type = 0;
20806     tstate->curexc_value = 0;
20807     tstate->curexc_traceback = 0;
20808 #else
20809     PyErr_Fetch(&local_type, &local_value, &local_tb);
20810 #endif
20811     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
20812 #if CYTHON_FAST_THREAD_STATE
20813     if (unlikely(tstate->curexc_type))
20814 #else
20815     if (unlikely(PyErr_Occurred()))
20816 #endif
20817         goto bad;
20818     #if PY_MAJOR_VERSION >= 3
20819     if (local_tb) {
20820         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
20821             goto bad;
20822     }
20823     #endif
20824     Py_XINCREF(local_tb);
20825     Py_XINCREF(local_type);
20826     Py_XINCREF(local_value);
20827     *type = local_type;
20828     *value = local_value;
20829     *tb = local_tb;
20830 #if CYTHON_FAST_THREAD_STATE
20831     #if CYTHON_USE_EXC_INFO_STACK
20832     {
20833         _PyErr_StackItem *exc_info = tstate->exc_info;
20834         tmp_type = exc_info->exc_type;
20835         tmp_value = exc_info->exc_value;
20836         tmp_tb = exc_info->exc_traceback;
20837         exc_info->exc_type = local_type;
20838         exc_info->exc_value = local_value;
20839         exc_info->exc_traceback = local_tb;
20840     }
20841     #else
20842     tmp_type = tstate->exc_type;
20843     tmp_value = tstate->exc_value;
20844     tmp_tb = tstate->exc_traceback;
20845     tstate->exc_type = local_type;
20846     tstate->exc_value = local_value;
20847     tstate->exc_traceback = local_tb;
20848     #endif
20849     Py_XDECREF(tmp_type);
20850     Py_XDECREF(tmp_value);
20851     Py_XDECREF(tmp_tb);
20852 #else
20853     PyErr_SetExcInfo(local_type, local_value, local_tb);
20854 #endif
20855     return 0;
20856 bad:
20857     *type = 0;
20858     *value = 0;
20859     *tb = 0;
20860     Py_XDECREF(local_type);
20861     Py_XDECREF(local_value);
20862     Py_XDECREF(local_tb);
20863     return -1;
20864 }
20865 
20866 /* SwapException */
20867 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)20868 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20869     PyObject *tmp_type, *tmp_value, *tmp_tb;
20870     #if CYTHON_USE_EXC_INFO_STACK
20871     _PyErr_StackItem *exc_info = tstate->exc_info;
20872     tmp_type = exc_info->exc_type;
20873     tmp_value = exc_info->exc_value;
20874     tmp_tb = exc_info->exc_traceback;
20875     exc_info->exc_type = *type;
20876     exc_info->exc_value = *value;
20877     exc_info->exc_traceback = *tb;
20878     #else
20879     tmp_type = tstate->exc_type;
20880     tmp_value = tstate->exc_value;
20881     tmp_tb = tstate->exc_traceback;
20882     tstate->exc_type = *type;
20883     tstate->exc_value = *value;
20884     tstate->exc_traceback = *tb;
20885     #endif
20886     *type = tmp_type;
20887     *value = tmp_value;
20888     *tb = tmp_tb;
20889 }
20890 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)20891 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
20892     PyObject *tmp_type, *tmp_value, *tmp_tb;
20893     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
20894     PyErr_SetExcInfo(*type, *value, *tb);
20895     *type = tmp_type;
20896     *value = tmp_value;
20897     *tb = tmp_tb;
20898 }
20899 #endif
20900 
20901 /* GetTopmostException */
20902 #if CYTHON_USE_EXC_INFO_STACK
20903 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)20904 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
20905 {
20906     _PyErr_StackItem *exc_info = tstate->exc_info;
20907     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
20908            exc_info->previous_item != NULL)
20909     {
20910         exc_info = exc_info->previous_item;
20911     }
20912     return exc_info;
20913 }
20914 #endif
20915 
20916 /* SaveResetException */
20917 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)20918 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20919     #if CYTHON_USE_EXC_INFO_STACK
20920     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
20921     *type = exc_info->exc_type;
20922     *value = exc_info->exc_value;
20923     *tb = exc_info->exc_traceback;
20924     #else
20925     *type = tstate->exc_type;
20926     *value = tstate->exc_value;
20927     *tb = tstate->exc_traceback;
20928     #endif
20929     Py_XINCREF(*type);
20930     Py_XINCREF(*value);
20931     Py_XINCREF(*tb);
20932 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)20933 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
20934     PyObject *tmp_type, *tmp_value, *tmp_tb;
20935     #if CYTHON_USE_EXC_INFO_STACK
20936     _PyErr_StackItem *exc_info = tstate->exc_info;
20937     tmp_type = exc_info->exc_type;
20938     tmp_value = exc_info->exc_value;
20939     tmp_tb = exc_info->exc_traceback;
20940     exc_info->exc_type = type;
20941     exc_info->exc_value = value;
20942     exc_info->exc_traceback = tb;
20943     #else
20944     tmp_type = tstate->exc_type;
20945     tmp_value = tstate->exc_value;
20946     tmp_tb = tstate->exc_traceback;
20947     tstate->exc_type = type;
20948     tstate->exc_value = value;
20949     tstate->exc_traceback = tb;
20950     #endif
20951     Py_XDECREF(tmp_type);
20952     Py_XDECREF(tmp_value);
20953     Py_XDECREF(tmp_tb);
20954 }
20955 #endif
20956 
20957 /* 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)20958 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
20959                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
20960                                   int full_traceback, CYTHON_UNUSED int nogil) {
20961     PyObject *old_exc, *old_val, *old_tb;
20962     PyObject *ctx;
20963     __Pyx_PyThreadState_declare
20964 #ifdef WITH_THREAD
20965     PyGILState_STATE state;
20966     if (nogil)
20967         state = PyGILState_Ensure();
20968 #ifdef _MSC_VER
20969     else state = (PyGILState_STATE)-1;
20970 #endif
20971 #endif
20972     __Pyx_PyThreadState_assign
20973     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
20974     if (full_traceback) {
20975         Py_XINCREF(old_exc);
20976         Py_XINCREF(old_val);
20977         Py_XINCREF(old_tb);
20978         __Pyx_ErrRestore(old_exc, old_val, old_tb);
20979         PyErr_PrintEx(1);
20980     }
20981     #if PY_MAJOR_VERSION < 3
20982     ctx = PyString_FromString(name);
20983     #else
20984     ctx = PyUnicode_FromString(name);
20985     #endif
20986     __Pyx_ErrRestore(old_exc, old_val, old_tb);
20987     if (!ctx) {
20988         PyErr_WriteUnraisable(Py_None);
20989     } else {
20990         PyErr_WriteUnraisable(ctx);
20991         Py_DECREF(ctx);
20992     }
20993 #ifdef WITH_THREAD
20994     if (nogil)
20995         PyGILState_Release(state);
20996 #endif
20997 }
20998 
20999 /* PyErrExceptionMatches */
21000 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)21001 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21002     Py_ssize_t i, n;
21003     n = PyTuple_GET_SIZE(tuple);
21004 #if PY_MAJOR_VERSION >= 3
21005     for (i=0; i<n; i++) {
21006         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
21007     }
21008 #endif
21009     for (i=0; i<n; i++) {
21010         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
21011     }
21012     return 0;
21013 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)21014 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
21015     PyObject *exc_type = tstate->curexc_type;
21016     if (exc_type == err) return 1;
21017     if (unlikely(!exc_type)) return 0;
21018     if (unlikely(PyTuple_Check(err)))
21019         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
21020     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
21021 }
21022 #endif
21023 
21024 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)21025 static void __Pyx_RaiseArgtupleInvalid(
21026     const char* func_name,
21027     int exact,
21028     Py_ssize_t num_min,
21029     Py_ssize_t num_max,
21030     Py_ssize_t num_found)
21031 {
21032     Py_ssize_t num_expected;
21033     const char *more_or_less;
21034     if (num_found < num_min) {
21035         num_expected = num_min;
21036         more_or_less = "at least";
21037     } else {
21038         num_expected = num_max;
21039         more_or_less = "at most";
21040     }
21041     if (exact) {
21042         more_or_less = "exactly";
21043     }
21044     PyErr_Format(PyExc_TypeError,
21045                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
21046                  func_name, more_or_less, num_expected,
21047                  (num_expected == 1) ? "" : "s", num_found);
21048 }
21049 
21050 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)21051 static void __Pyx_RaiseDoubleKeywordsError(
21052     const char* func_name,
21053     PyObject* kw_name)
21054 {
21055     PyErr_Format(PyExc_TypeError,
21056         #if PY_MAJOR_VERSION >= 3
21057         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
21058         #else
21059         "%s() got multiple values for keyword argument '%s'", func_name,
21060         PyString_AsString(kw_name));
21061         #endif
21062 }
21063 
21064 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)21065 static int __Pyx_ParseOptionalKeywords(
21066     PyObject *kwds,
21067     PyObject **argnames[],
21068     PyObject *kwds2,
21069     PyObject *values[],
21070     Py_ssize_t num_pos_args,
21071     const char* function_name)
21072 {
21073     PyObject *key = 0, *value = 0;
21074     Py_ssize_t pos = 0;
21075     PyObject*** name;
21076     PyObject*** first_kw_arg = argnames + num_pos_args;
21077     while (PyDict_Next(kwds, &pos, &key, &value)) {
21078         name = first_kw_arg;
21079         while (*name && (**name != key)) name++;
21080         if (*name) {
21081             values[name-argnames] = value;
21082             continue;
21083         }
21084         name = first_kw_arg;
21085         #if PY_MAJOR_VERSION < 3
21086         if (likely(PyString_Check(key))) {
21087             while (*name) {
21088                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
21089                         && _PyString_Eq(**name, key)) {
21090                     values[name-argnames] = value;
21091                     break;
21092                 }
21093                 name++;
21094             }
21095             if (*name) continue;
21096             else {
21097                 PyObject*** argname = argnames;
21098                 while (argname != first_kw_arg) {
21099                     if ((**argname == key) || (
21100                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
21101                              && _PyString_Eq(**argname, key))) {
21102                         goto arg_passed_twice;
21103                     }
21104                     argname++;
21105                 }
21106             }
21107         } else
21108         #endif
21109         if (likely(PyUnicode_Check(key))) {
21110             while (*name) {
21111                 int cmp = (**name == key) ? 0 :
21112                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21113                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21114                 #endif
21115                     PyUnicode_Compare(**name, key);
21116                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21117                 if (cmp == 0) {
21118                     values[name-argnames] = value;
21119                     break;
21120                 }
21121                 name++;
21122             }
21123             if (*name) continue;
21124             else {
21125                 PyObject*** argname = argnames;
21126                 while (argname != first_kw_arg) {
21127                     int cmp = (**argname == key) ? 0 :
21128                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21129                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21130                     #endif
21131                         PyUnicode_Compare(**argname, key);
21132                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21133                     if (cmp == 0) goto arg_passed_twice;
21134                     argname++;
21135                 }
21136             }
21137         } else
21138             goto invalid_keyword_type;
21139         if (kwds2) {
21140             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
21141         } else {
21142             goto invalid_keyword;
21143         }
21144     }
21145     return 0;
21146 arg_passed_twice:
21147     __Pyx_RaiseDoubleKeywordsError(function_name, key);
21148     goto bad;
21149 invalid_keyword_type:
21150     PyErr_Format(PyExc_TypeError,
21151         "%.200s() keywords must be strings", function_name);
21152     goto bad;
21153 invalid_keyword:
21154     PyErr_Format(PyExc_TypeError,
21155     #if PY_MAJOR_VERSION < 3
21156         "%.200s() got an unexpected keyword argument '%.200s'",
21157         function_name, PyString_AsString(key));
21158     #else
21159         "%s() got an unexpected keyword argument '%U'",
21160         function_name, key);
21161     #endif
21162 bad:
21163     return -1;
21164 }
21165 
21166 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)21167 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
21168 {
21169     if (unlikely(!type)) {
21170         PyErr_SetString(PyExc_SystemError, "Missing type object");
21171         return 0;
21172     }
21173     else if (exact) {
21174         #if PY_MAJOR_VERSION == 2
21175         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
21176         #endif
21177     }
21178     else {
21179         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
21180     }
21181     PyErr_Format(PyExc_TypeError,
21182         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
21183         name, type->tp_name, Py_TYPE(obj)->tp_name);
21184     return 0;
21185 }
21186 
21187 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)21188 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
21189 #if CYTHON_COMPILING_IN_PYPY
21190     return PyObject_RichCompareBool(s1, s2, equals);
21191 #else
21192     if (s1 == s2) {
21193         return (equals == Py_EQ);
21194     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
21195         const char *ps1, *ps2;
21196         Py_ssize_t length = PyBytes_GET_SIZE(s1);
21197         if (length != PyBytes_GET_SIZE(s2))
21198             return (equals == Py_NE);
21199         ps1 = PyBytes_AS_STRING(s1);
21200         ps2 = PyBytes_AS_STRING(s2);
21201         if (ps1[0] != ps2[0]) {
21202             return (equals == Py_NE);
21203         } else if (length == 1) {
21204             return (equals == Py_EQ);
21205         } else {
21206             int result;
21207 #if CYTHON_USE_UNICODE_INTERNALS
21208             Py_hash_t hash1, hash2;
21209             hash1 = ((PyBytesObject*)s1)->ob_shash;
21210             hash2 = ((PyBytesObject*)s2)->ob_shash;
21211             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21212                 return (equals == Py_NE);
21213             }
21214 #endif
21215             result = memcmp(ps1, ps2, (size_t)length);
21216             return (equals == Py_EQ) ? (result == 0) : (result != 0);
21217         }
21218     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
21219         return (equals == Py_NE);
21220     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
21221         return (equals == Py_NE);
21222     } else {
21223         int result;
21224         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21225         if (!py_result)
21226             return -1;
21227         result = __Pyx_PyObject_IsTrue(py_result);
21228         Py_DECREF(py_result);
21229         return result;
21230     }
21231 #endif
21232 }
21233 
21234 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)21235 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
21236 #if CYTHON_COMPILING_IN_PYPY
21237     return PyObject_RichCompareBool(s1, s2, equals);
21238 #else
21239 #if PY_MAJOR_VERSION < 3
21240     PyObject* owned_ref = NULL;
21241 #endif
21242     int s1_is_unicode, s2_is_unicode;
21243     if (s1 == s2) {
21244         goto return_eq;
21245     }
21246     s1_is_unicode = PyUnicode_CheckExact(s1);
21247     s2_is_unicode = PyUnicode_CheckExact(s2);
21248 #if PY_MAJOR_VERSION < 3
21249     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
21250         owned_ref = PyUnicode_FromObject(s2);
21251         if (unlikely(!owned_ref))
21252             return -1;
21253         s2 = owned_ref;
21254         s2_is_unicode = 1;
21255     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
21256         owned_ref = PyUnicode_FromObject(s1);
21257         if (unlikely(!owned_ref))
21258             return -1;
21259         s1 = owned_ref;
21260         s1_is_unicode = 1;
21261     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
21262         return __Pyx_PyBytes_Equals(s1, s2, equals);
21263     }
21264 #endif
21265     if (s1_is_unicode & s2_is_unicode) {
21266         Py_ssize_t length;
21267         int kind;
21268         void *data1, *data2;
21269         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
21270             return -1;
21271         length = __Pyx_PyUnicode_GET_LENGTH(s1);
21272         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
21273             goto return_ne;
21274         }
21275 #if CYTHON_USE_UNICODE_INTERNALS
21276         {
21277             Py_hash_t hash1, hash2;
21278         #if CYTHON_PEP393_ENABLED
21279             hash1 = ((PyASCIIObject*)s1)->hash;
21280             hash2 = ((PyASCIIObject*)s2)->hash;
21281         #else
21282             hash1 = ((PyUnicodeObject*)s1)->hash;
21283             hash2 = ((PyUnicodeObject*)s2)->hash;
21284         #endif
21285             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21286                 goto return_ne;
21287             }
21288         }
21289 #endif
21290         kind = __Pyx_PyUnicode_KIND(s1);
21291         if (kind != __Pyx_PyUnicode_KIND(s2)) {
21292             goto return_ne;
21293         }
21294         data1 = __Pyx_PyUnicode_DATA(s1);
21295         data2 = __Pyx_PyUnicode_DATA(s2);
21296         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
21297             goto return_ne;
21298         } else if (length == 1) {
21299             goto return_eq;
21300         } else {
21301             int result = memcmp(data1, data2, (size_t)(length * kind));
21302             #if PY_MAJOR_VERSION < 3
21303             Py_XDECREF(owned_ref);
21304             #endif
21305             return (equals == Py_EQ) ? (result == 0) : (result != 0);
21306         }
21307     } else if ((s1 == Py_None) & s2_is_unicode) {
21308         goto return_ne;
21309     } else if ((s2 == Py_None) & s1_is_unicode) {
21310         goto return_ne;
21311     } else {
21312         int result;
21313         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21314         #if PY_MAJOR_VERSION < 3
21315         Py_XDECREF(owned_ref);
21316         #endif
21317         if (!py_result)
21318             return -1;
21319         result = __Pyx_PyObject_IsTrue(py_result);
21320         Py_DECREF(py_result);
21321         return result;
21322     }
21323 return_eq:
21324     #if PY_MAJOR_VERSION < 3
21325     Py_XDECREF(owned_ref);
21326     #endif
21327     return (equals == Py_EQ);
21328 return_ne:
21329     #if PY_MAJOR_VERSION < 3
21330     Py_XDECREF(owned_ref);
21331     #endif
21332     return (equals == Py_NE);
21333 #endif
21334 }
21335 
21336 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)21337 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
21338     Py_ssize_t q = a / b;
21339     Py_ssize_t r = a - q*b;
21340     q -= ((r != 0) & ((r ^ b) < 0));
21341     return q;
21342 }
21343 
21344 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)21345 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
21346 #if CYTHON_USE_TYPE_SLOTS
21347 #if PY_MAJOR_VERSION >= 3
21348     if (likely(PyUnicode_Check(n)))
21349 #else
21350     if (likely(PyString_Check(n)))
21351 #endif
21352         return __Pyx_PyObject_GetAttrStr(o, n);
21353 #endif
21354     return PyObject_GetAttr(o, n);
21355 }
21356 
21357 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))21358 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
21359          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
21360          const char* encoding, const char* errors,
21361          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
21362     Py_ssize_t length;
21363     if (unlikely((start < 0) | (stop < 0))) {
21364         size_t slen = strlen(cstring);
21365         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
21366             PyErr_SetString(PyExc_OverflowError,
21367                             "c-string too long to convert to Python");
21368             return NULL;
21369         }
21370         length = (Py_ssize_t) slen;
21371         if (start < 0) {
21372             start += length;
21373             if (start < 0)
21374                 start = 0;
21375         }
21376         if (stop < 0)
21377             stop += length;
21378     }
21379     if (unlikely(stop <= start))
21380         return __Pyx_NewRef(__pyx_empty_unicode);
21381     length = stop - start;
21382     cstring += start;
21383     if (decode_func) {
21384         return decode_func(cstring, length, errors);
21385     } else {
21386         return PyUnicode_Decode(cstring, length, encoding, errors);
21387     }
21388 }
21389 
21390 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)21391 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
21392     __Pyx_PyThreadState_declare
21393     __Pyx_PyThreadState_assign
21394     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21395         return NULL;
21396     __Pyx_PyErr_Clear();
21397     Py_INCREF(d);
21398     return d;
21399 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)21400 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
21401     PyObject *r = __Pyx_GetAttr(o, n);
21402     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
21403 }
21404 
21405 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)21406 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
21407     PyErr_Format(PyExc_ValueError,
21408                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
21409 }
21410 
21411 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)21412 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
21413     PyErr_Format(PyExc_ValueError,
21414                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
21415                  index, (index == 1) ? "" : "s");
21416 }
21417 
21418 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)21419 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
21420     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21421 }
21422 
21423 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)21424 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
21425     PyObject *empty_list = 0;
21426     PyObject *module = 0;
21427     PyObject *global_dict = 0;
21428     PyObject *empty_dict = 0;
21429     PyObject *list;
21430     #if PY_MAJOR_VERSION < 3
21431     PyObject *py_import;
21432     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
21433     if (!py_import)
21434         goto bad;
21435     #endif
21436     if (from_list)
21437         list = from_list;
21438     else {
21439         empty_list = PyList_New(0);
21440         if (!empty_list)
21441             goto bad;
21442         list = empty_list;
21443     }
21444     global_dict = PyModule_GetDict(__pyx_m);
21445     if (!global_dict)
21446         goto bad;
21447     empty_dict = PyDict_New();
21448     if (!empty_dict)
21449         goto bad;
21450     {
21451         #if PY_MAJOR_VERSION >= 3
21452         if (level == -1) {
21453             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
21454                 module = PyImport_ImportModuleLevelObject(
21455                     name, global_dict, empty_dict, list, 1);
21456                 if (!module) {
21457                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
21458                         goto bad;
21459                     PyErr_Clear();
21460                 }
21461             }
21462             level = 0;
21463         }
21464         #endif
21465         if (!module) {
21466             #if PY_MAJOR_VERSION < 3
21467             PyObject *py_level = PyInt_FromLong(level);
21468             if (!py_level)
21469                 goto bad;
21470             module = PyObject_CallFunctionObjArgs(py_import,
21471                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
21472             Py_DECREF(py_level);
21473             #else
21474             module = PyImport_ImportModuleLevelObject(
21475                 name, global_dict, empty_dict, list, level);
21476             #endif
21477         }
21478     }
21479 bad:
21480     #if PY_MAJOR_VERSION < 3
21481     Py_XDECREF(py_import);
21482     #endif
21483     Py_XDECREF(empty_list);
21484     Py_XDECREF(empty_dict);
21485     return module;
21486 }
21487 
21488 /* FastTypeChecks */
21489 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)21490 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
21491     while (a) {
21492         a = a->tp_base;
21493         if (a == b)
21494             return 1;
21495     }
21496     return b == &PyBaseObject_Type;
21497 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)21498 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
21499     PyObject *mro;
21500     if (a == b) return 1;
21501     mro = a->tp_mro;
21502     if (likely(mro)) {
21503         Py_ssize_t i, n;
21504         n = PyTuple_GET_SIZE(mro);
21505         for (i = 0; i < n; i++) {
21506             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
21507                 return 1;
21508         }
21509         return 0;
21510     }
21511     return __Pyx_InBases(a, b);
21512 }
21513 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)21514 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
21515     PyObject *exception, *value, *tb;
21516     int res;
21517     __Pyx_PyThreadState_declare
21518     __Pyx_PyThreadState_assign
21519     __Pyx_ErrFetch(&exception, &value, &tb);
21520     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
21521     if (unlikely(res == -1)) {
21522         PyErr_WriteUnraisable(err);
21523         res = 0;
21524     }
21525     if (!res) {
21526         res = PyObject_IsSubclass(err, exc_type2);
21527         if (unlikely(res == -1)) {
21528             PyErr_WriteUnraisable(err);
21529             res = 0;
21530         }
21531     }
21532     __Pyx_ErrRestore(exception, value, tb);
21533     return res;
21534 }
21535 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)21536 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
21537     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
21538     if (!res) {
21539         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
21540     }
21541     return res;
21542 }
21543 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)21544 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21545     Py_ssize_t i, n;
21546     assert(PyExceptionClass_Check(exc_type));
21547     n = PyTuple_GET_SIZE(tuple);
21548 #if PY_MAJOR_VERSION >= 3
21549     for (i=0; i<n; i++) {
21550         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
21551     }
21552 #endif
21553     for (i=0; i<n; i++) {
21554         PyObject *t = PyTuple_GET_ITEM(tuple, i);
21555         #if PY_MAJOR_VERSION < 3
21556         if (likely(exc_type == t)) return 1;
21557         #endif
21558         if (likely(PyExceptionClass_Check(t))) {
21559             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
21560         } else {
21561         }
21562     }
21563     return 0;
21564 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)21565 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
21566     if (likely(err == exc_type)) return 1;
21567     if (likely(PyExceptionClass_Check(err))) {
21568         if (likely(PyExceptionClass_Check(exc_type))) {
21569             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
21570         } else if (likely(PyTuple_Check(exc_type))) {
21571             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
21572         } else {
21573         }
21574     }
21575     return PyErr_GivenExceptionMatches(err, exc_type);
21576 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)21577 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
21578     assert(PyExceptionClass_Check(exc_type1));
21579     assert(PyExceptionClass_Check(exc_type2));
21580     if (likely(err == exc_type1 || err == exc_type2)) return 1;
21581     if (likely(PyExceptionClass_Check(err))) {
21582         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
21583     }
21584     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
21585 }
21586 #endif
21587 
21588 /* PyIntBinop */
21589 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)21590 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
21591     (void)inplace;
21592     (void)zerodivision_check;
21593     #if PY_MAJOR_VERSION < 3
21594     if (likely(PyInt_CheckExact(op1))) {
21595         const long b = intval;
21596         long x;
21597         long a = PyInt_AS_LONG(op1);
21598             x = (long)((unsigned long)a + b);
21599             if (likely((x^a) >= 0 || (x^b) >= 0))
21600                 return PyInt_FromLong(x);
21601             return PyLong_Type.tp_as_number->nb_add(op1, op2);
21602     }
21603     #endif
21604     #if CYTHON_USE_PYLONG_INTERNALS
21605     if (likely(PyLong_CheckExact(op1))) {
21606         const long b = intval;
21607         long a, x;
21608 #ifdef HAVE_LONG_LONG
21609         const PY_LONG_LONG llb = intval;
21610         PY_LONG_LONG lla, llx;
21611 #endif
21612         const digit* digits = ((PyLongObject*)op1)->ob_digit;
21613         const Py_ssize_t size = Py_SIZE(op1);
21614         if (likely(__Pyx_sst_abs(size) <= 1)) {
21615             a = likely(size) ? digits[0] : 0;
21616             if (size == -1) a = -a;
21617         } else {
21618             switch (size) {
21619                 case -2:
21620                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21621                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21622                         break;
21623 #ifdef HAVE_LONG_LONG
21624                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21625                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21626                         goto long_long;
21627 #endif
21628                     }
21629                     CYTHON_FALLTHROUGH;
21630                 case 2:
21631                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21632                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21633                         break;
21634 #ifdef HAVE_LONG_LONG
21635                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21636                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21637                         goto long_long;
21638 #endif
21639                     }
21640                     CYTHON_FALLTHROUGH;
21641                 case -3:
21642                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21643                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21644                         break;
21645 #ifdef HAVE_LONG_LONG
21646                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21647                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21648                         goto long_long;
21649 #endif
21650                     }
21651                     CYTHON_FALLTHROUGH;
21652                 case 3:
21653                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21654                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21655                         break;
21656 #ifdef HAVE_LONG_LONG
21657                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21658                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21659                         goto long_long;
21660 #endif
21661                     }
21662                     CYTHON_FALLTHROUGH;
21663                 case -4:
21664                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21665                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21666                         break;
21667 #ifdef HAVE_LONG_LONG
21668                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21669                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21670                         goto long_long;
21671 #endif
21672                     }
21673                     CYTHON_FALLTHROUGH;
21674                 case 4:
21675                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21676                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21677                         break;
21678 #ifdef HAVE_LONG_LONG
21679                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21680                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21681                         goto long_long;
21682 #endif
21683                     }
21684                     CYTHON_FALLTHROUGH;
21685                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
21686             }
21687         }
21688                 x = a + b;
21689             return PyLong_FromLong(x);
21690 #ifdef HAVE_LONG_LONG
21691         long_long:
21692                 llx = lla + llb;
21693             return PyLong_FromLongLong(llx);
21694 #endif
21695 
21696 
21697     }
21698     #endif
21699     if (PyFloat_CheckExact(op1)) {
21700         const long b = intval;
21701         double a = PyFloat_AS_DOUBLE(op1);
21702             double result;
21703             PyFPE_START_PROTECT("add", return NULL)
21704             result = ((double)a) + (double)b;
21705             PyFPE_END_PROTECT(result)
21706             return PyFloat_FromDouble(result);
21707     }
21708     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
21709 }
21710 #endif
21711 
21712 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)21713 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
21714     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
21715 }
21716 
21717 /* None */
__Pyx_div_long(long a,long b)21718 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
21719     long q = a / b;
21720     long r = a - q*b;
21721     q -= ((r != 0) & ((r ^ b) < 0));
21722     return q;
21723 }
21724 
21725 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)21726 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
21727     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
21728     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21729         PyErr_Format(PyExc_ImportError,
21730         #if PY_MAJOR_VERSION < 3
21731             "cannot import name %.230s", PyString_AS_STRING(name));
21732         #else
21733             "cannot import name %S", name);
21734         #endif
21735     }
21736     return value;
21737 }
21738 
21739 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)21740 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
21741     PyObject *r;
21742     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
21743         PyErr_SetString(PyExc_TypeError,
21744                         "hasattr(): attribute name must be string");
21745         return -1;
21746     }
21747     r = __Pyx_GetAttr(o, n);
21748     if (unlikely(!r)) {
21749         PyErr_Clear();
21750         return 0;
21751     } else {
21752         Py_DECREF(r);
21753         return 1;
21754     }
21755 }
21756 
21757 /* PyObject_GenericGetAttrNoDict */
21758 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)21759 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
21760     PyErr_Format(PyExc_AttributeError,
21761 #if PY_MAJOR_VERSION >= 3
21762                  "'%.50s' object has no attribute '%U'",
21763                  tp->tp_name, attr_name);
21764 #else
21765                  "'%.50s' object has no attribute '%.400s'",
21766                  tp->tp_name, PyString_AS_STRING(attr_name));
21767 #endif
21768     return NULL;
21769 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)21770 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
21771     PyObject *descr;
21772     PyTypeObject *tp = Py_TYPE(obj);
21773     if (unlikely(!PyString_Check(attr_name))) {
21774         return PyObject_GenericGetAttr(obj, attr_name);
21775     }
21776     assert(!tp->tp_dictoffset);
21777     descr = _PyType_Lookup(tp, attr_name);
21778     if (unlikely(!descr)) {
21779         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
21780     }
21781     Py_INCREF(descr);
21782     #if PY_MAJOR_VERSION < 3
21783     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
21784     #endif
21785     {
21786         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
21787         if (unlikely(f)) {
21788             PyObject *res = f(descr, obj, (PyObject *)tp);
21789             Py_DECREF(descr);
21790             return res;
21791         }
21792     }
21793     return descr;
21794 }
21795 #endif
21796 
21797 /* PyObject_GenericGetAttr */
21798 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)21799 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
21800     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
21801         return PyObject_GenericGetAttr(obj, attr_name);
21802     }
21803     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
21804 }
21805 #endif
21806 
21807 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)21808 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
21809 #if PY_VERSION_HEX >= 0x02070000
21810     PyObject *ob = PyCapsule_New(vtable, 0, 0);
21811 #else
21812     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
21813 #endif
21814     if (!ob)
21815         goto bad;
21816     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
21817         goto bad;
21818     Py_DECREF(ob);
21819     return 0;
21820 bad:
21821     Py_XDECREF(ob);
21822     return -1;
21823 }
21824 
21825 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)21826 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
21827     __Pyx_PyThreadState_declare
21828     __Pyx_PyThreadState_assign
21829     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21830         __Pyx_PyErr_Clear();
21831 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)21832 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
21833     PyObject *result;
21834 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
21835     PyTypeObject* tp = Py_TYPE(obj);
21836     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
21837         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
21838     }
21839 #endif
21840     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
21841     if (unlikely(!result)) {
21842         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
21843     }
21844     return result;
21845 }
21846 
21847 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)21848 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
21849   int ret;
21850   PyObject *name_attr;
21851   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
21852   if (likely(name_attr)) {
21853       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
21854   } else {
21855       ret = -1;
21856   }
21857   if (unlikely(ret < 0)) {
21858       PyErr_Clear();
21859       ret = 0;
21860   }
21861   Py_XDECREF(name_attr);
21862   return ret;
21863 }
__Pyx_setup_reduce(PyObject * type_obj)21864 static int __Pyx_setup_reduce(PyObject* type_obj) {
21865     int ret = 0;
21866     PyObject *object_reduce = NULL;
21867     PyObject *object_reduce_ex = NULL;
21868     PyObject *reduce = NULL;
21869     PyObject *reduce_ex = NULL;
21870     PyObject *reduce_cython = NULL;
21871     PyObject *setstate = NULL;
21872     PyObject *setstate_cython = NULL;
21873 #if CYTHON_USE_PYTYPE_LOOKUP
21874     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
21875 #else
21876     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
21877 #endif
21878 #if CYTHON_USE_PYTYPE_LOOKUP
21879     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
21880 #else
21881     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
21882 #endif
21883     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
21884     if (reduce_ex == object_reduce_ex) {
21885 #if CYTHON_USE_PYTYPE_LOOKUP
21886         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
21887 #else
21888         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
21889 #endif
21890         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
21891         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
21892             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
21893             if (likely(reduce_cython)) {
21894                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
21895                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
21896             } else if (reduce == object_reduce || PyErr_Occurred()) {
21897                 goto __PYX_BAD;
21898             }
21899             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
21900             if (!setstate) PyErr_Clear();
21901             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
21902                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
21903                 if (likely(setstate_cython)) {
21904                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
21905                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
21906                 } else if (!setstate || PyErr_Occurred()) {
21907                     goto __PYX_BAD;
21908                 }
21909             }
21910             PyType_Modified((PyTypeObject*)type_obj);
21911         }
21912     }
21913     goto __PYX_GOOD;
21914 __PYX_BAD:
21915     if (!PyErr_Occurred())
21916         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
21917     ret = -1;
21918 __PYX_GOOD:
21919 #if !CYTHON_USE_PYTYPE_LOOKUP
21920     Py_XDECREF(object_reduce);
21921     Py_XDECREF(object_reduce_ex);
21922 #endif
21923     Py_XDECREF(reduce);
21924     Py_XDECREF(reduce_ex);
21925     Py_XDECREF(reduce_cython);
21926     Py_XDECREF(setstate);
21927     Py_XDECREF(setstate_cython);
21928     return ret;
21929 }
21930 
21931 /* TypeImport */
21932 #ifndef __PYX_HAVE_RT_ImportType
21933 #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)21934 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
21935     size_t size, enum __Pyx_ImportType_CheckSize check_size)
21936 {
21937     PyObject *result = 0;
21938     char warning[200];
21939     Py_ssize_t basicsize;
21940 #ifdef Py_LIMITED_API
21941     PyObject *py_basicsize;
21942 #endif
21943     result = PyObject_GetAttrString(module, class_name);
21944     if (!result)
21945         goto bad;
21946     if (!PyType_Check(result)) {
21947         PyErr_Format(PyExc_TypeError,
21948             "%.200s.%.200s is not a type object",
21949             module_name, class_name);
21950         goto bad;
21951     }
21952 #ifndef Py_LIMITED_API
21953     basicsize = ((PyTypeObject *)result)->tp_basicsize;
21954 #else
21955     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
21956     if (!py_basicsize)
21957         goto bad;
21958     basicsize = PyLong_AsSsize_t(py_basicsize);
21959     Py_DECREF(py_basicsize);
21960     py_basicsize = 0;
21961     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
21962         goto bad;
21963 #endif
21964     if ((size_t)basicsize < size) {
21965         PyErr_Format(PyExc_ValueError,
21966             "%.200s.%.200s size changed, may indicate binary incompatibility. "
21967             "Expected %zd from C header, got %zd from PyObject",
21968             module_name, class_name, size, basicsize);
21969         goto bad;
21970     }
21971     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
21972         PyErr_Format(PyExc_ValueError,
21973             "%.200s.%.200s size changed, may indicate binary incompatibility. "
21974             "Expected %zd from C header, got %zd from PyObject",
21975             module_name, class_name, size, basicsize);
21976         goto bad;
21977     }
21978     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
21979         PyOS_snprintf(warning, sizeof(warning),
21980             "%s.%s size changed, may indicate binary incompatibility. "
21981             "Expected %zd from C header, got %zd from PyObject",
21982             module_name, class_name, size, basicsize);
21983         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
21984     }
21985     return (PyTypeObject *)result;
21986 bad:
21987     Py_XDECREF(result);
21988     return NULL;
21989 }
21990 #endif
21991 
21992 /* CLineInTraceback */
21993 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)21994 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
21995     PyObject *use_cline;
21996     PyObject *ptype, *pvalue, *ptraceback;
21997 #if CYTHON_COMPILING_IN_CPYTHON
21998     PyObject **cython_runtime_dict;
21999 #endif
22000     if (unlikely(!__pyx_cython_runtime)) {
22001         return c_line;
22002     }
22003     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
22004 #if CYTHON_COMPILING_IN_CPYTHON
22005     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
22006     if (likely(cython_runtime_dict)) {
22007         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
22008             use_cline, *cython_runtime_dict,
22009             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
22010     } else
22011 #endif
22012     {
22013       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
22014       if (use_cline_obj) {
22015         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
22016         Py_DECREF(use_cline_obj);
22017       } else {
22018         PyErr_Clear();
22019         use_cline = NULL;
22020       }
22021     }
22022     if (!use_cline) {
22023         c_line = 0;
22024         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
22025     }
22026     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
22027         c_line = 0;
22028     }
22029     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
22030     return c_line;
22031 }
22032 #endif
22033 
22034 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)22035 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
22036     int start = 0, mid = 0, end = count - 1;
22037     if (end >= 0 && code_line > entries[end].code_line) {
22038         return count;
22039     }
22040     while (start < end) {
22041         mid = start + (end - start) / 2;
22042         if (code_line < entries[mid].code_line) {
22043             end = mid;
22044         } else if (code_line > entries[mid].code_line) {
22045              start = mid + 1;
22046         } else {
22047             return mid;
22048         }
22049     }
22050     if (code_line <= entries[mid].code_line) {
22051         return mid;
22052     } else {
22053         return mid + 1;
22054     }
22055 }
__pyx_find_code_object(int code_line)22056 static PyCodeObject *__pyx_find_code_object(int code_line) {
22057     PyCodeObject* code_object;
22058     int pos;
22059     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
22060         return NULL;
22061     }
22062     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22063     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
22064         return NULL;
22065     }
22066     code_object = __pyx_code_cache.entries[pos].code_object;
22067     Py_INCREF(code_object);
22068     return code_object;
22069 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)22070 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
22071     int pos, i;
22072     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
22073     if (unlikely(!code_line)) {
22074         return;
22075     }
22076     if (unlikely(!entries)) {
22077         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
22078         if (likely(entries)) {
22079             __pyx_code_cache.entries = entries;
22080             __pyx_code_cache.max_count = 64;
22081             __pyx_code_cache.count = 1;
22082             entries[0].code_line = code_line;
22083             entries[0].code_object = code_object;
22084             Py_INCREF(code_object);
22085         }
22086         return;
22087     }
22088     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22089     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
22090         PyCodeObject* tmp = entries[pos].code_object;
22091         entries[pos].code_object = code_object;
22092         Py_DECREF(tmp);
22093         return;
22094     }
22095     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
22096         int new_max = __pyx_code_cache.max_count + 64;
22097         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
22098             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
22099         if (unlikely(!entries)) {
22100             return;
22101         }
22102         __pyx_code_cache.entries = entries;
22103         __pyx_code_cache.max_count = new_max;
22104     }
22105     for (i=__pyx_code_cache.count; i>pos; i--) {
22106         entries[i] = entries[i-1];
22107     }
22108     entries[pos].code_line = code_line;
22109     entries[pos].code_object = code_object;
22110     __pyx_code_cache.count++;
22111     Py_INCREF(code_object);
22112 }
22113 
22114 /* AddTraceback */
22115 #include "compile.h"
22116 #include "frameobject.h"
22117 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)22118 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
22119             const char *funcname, int c_line,
22120             int py_line, const char *filename) {
22121     PyCodeObject *py_code = 0;
22122     PyObject *py_srcfile = 0;
22123     PyObject *py_funcname = 0;
22124     #if PY_MAJOR_VERSION < 3
22125     py_srcfile = PyString_FromString(filename);
22126     #else
22127     py_srcfile = PyUnicode_FromString(filename);
22128     #endif
22129     if (!py_srcfile) goto bad;
22130     if (c_line) {
22131         #if PY_MAJOR_VERSION < 3
22132         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22133         #else
22134         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22135         #endif
22136     }
22137     else {
22138         #if PY_MAJOR_VERSION < 3
22139         py_funcname = PyString_FromString(funcname);
22140         #else
22141         py_funcname = PyUnicode_FromString(funcname);
22142         #endif
22143     }
22144     if (!py_funcname) goto bad;
22145     py_code = __Pyx_PyCode_New(
22146         0,
22147         0,
22148         0,
22149         0,
22150         0,
22151         __pyx_empty_bytes, /*PyObject *code,*/
22152         __pyx_empty_tuple, /*PyObject *consts,*/
22153         __pyx_empty_tuple, /*PyObject *names,*/
22154         __pyx_empty_tuple, /*PyObject *varnames,*/
22155         __pyx_empty_tuple, /*PyObject *freevars,*/
22156         __pyx_empty_tuple, /*PyObject *cellvars,*/
22157         py_srcfile,   /*PyObject *filename,*/
22158         py_funcname,  /*PyObject *name,*/
22159         py_line,
22160         __pyx_empty_bytes  /*PyObject *lnotab*/
22161     );
22162     Py_DECREF(py_srcfile);
22163     Py_DECREF(py_funcname);
22164     return py_code;
22165 bad:
22166     Py_XDECREF(py_srcfile);
22167     Py_XDECREF(py_funcname);
22168     return NULL;
22169 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)22170 static void __Pyx_AddTraceback(const char *funcname, int c_line,
22171                                int py_line, const char *filename) {
22172     PyCodeObject *py_code = 0;
22173     PyFrameObject *py_frame = 0;
22174     PyThreadState *tstate = __Pyx_PyThreadState_Current;
22175     if (c_line) {
22176         c_line = __Pyx_CLineForTraceback(tstate, c_line);
22177     }
22178     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
22179     if (!py_code) {
22180         py_code = __Pyx_CreateCodeObjectForTraceback(
22181             funcname, c_line, py_line, filename);
22182         if (!py_code) goto bad;
22183         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
22184     }
22185     py_frame = PyFrame_New(
22186         tstate,            /*PyThreadState *tstate,*/
22187         py_code,           /*PyCodeObject *code,*/
22188         __pyx_d,    /*PyObject *globals,*/
22189         0                  /*PyObject *locals*/
22190     );
22191     if (!py_frame) goto bad;
22192     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
22193     PyTraceBack_Here(py_frame);
22194 bad:
22195     Py_XDECREF(py_code);
22196     Py_XDECREF(py_frame);
22197 }
22198 
22199 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)22200 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
22201     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
22202         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
22203         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
22204     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
22205     return -1;
22206 }
__Pyx_ReleaseBuffer(Py_buffer * view)22207 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
22208     PyObject *obj = view->obj;
22209     if (!obj) return;
22210     if (PyObject_CheckBuffer(obj)) {
22211         PyBuffer_Release(view);
22212         return;
22213     }
22214     if ((0)) {}
22215     view->obj = NULL;
22216     Py_DECREF(obj);
22217 }
22218 #endif
22219 
22220 
22221 /* MemviewSliceIsContig */
22222 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)22223 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
22224 {
22225     int i, index, step, start;
22226     Py_ssize_t itemsize = mvs.memview->view.itemsize;
22227     if (order == 'F') {
22228         step = 1;
22229         start = 0;
22230     } else {
22231         step = -1;
22232         start = ndim - 1;
22233     }
22234     for (i = 0; i < ndim; i++) {
22235         index = start + step * i;
22236         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
22237             return 0;
22238         itemsize *= mvs.shape[index];
22239     }
22240     return 1;
22241 }
22242 
22243 /* OverlappingSlices */
22244 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)22245 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
22246                                void **out_start, void **out_end,
22247                                int ndim, size_t itemsize)
22248 {
22249     char *start, *end;
22250     int i;
22251     start = end = slice->data;
22252     for (i = 0; i < ndim; i++) {
22253         Py_ssize_t stride = slice->strides[i];
22254         Py_ssize_t extent = slice->shape[i];
22255         if (extent == 0) {
22256             *out_start = *out_end = start;
22257             return;
22258         } else {
22259             if (stride > 0)
22260                 end += stride * (extent - 1);
22261             else
22262                 start += stride * (extent - 1);
22263         }
22264     }
22265     *out_start = start;
22266     *out_end = end + itemsize;
22267 }
22268 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)22269 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
22270                      __Pyx_memviewslice *slice2,
22271                      int ndim, size_t itemsize)
22272 {
22273     void *start1, *end1, *start2, *end2;
22274     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
22275     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
22276     return (start1 < end2) && (start2 < end1);
22277 }
22278 
22279 /* Capsule */
22280 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)22281 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
22282 {
22283     PyObject *cobj;
22284 #if PY_VERSION_HEX >= 0x02070000
22285     cobj = PyCapsule_New(p, sig, NULL);
22286 #else
22287     cobj = PyCObject_FromVoidPtr(p, NULL);
22288 #endif
22289     return cobj;
22290 }
22291 
22292 /* CIntToPy */
__Pyx_PyInt_From_long(long value)22293 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
22294     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
22295     const int is_unsigned = neg_one > const_zero;
22296     if (is_unsigned) {
22297         if (sizeof(long) < sizeof(long)) {
22298             return PyInt_FromLong((long) value);
22299         } else if (sizeof(long) <= sizeof(unsigned long)) {
22300             return PyLong_FromUnsignedLong((unsigned long) value);
22301 #ifdef HAVE_LONG_LONG
22302         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
22303             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
22304 #endif
22305         }
22306     } else {
22307         if (sizeof(long) <= sizeof(long)) {
22308             return PyInt_FromLong((long) value);
22309 #ifdef HAVE_LONG_LONG
22310         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
22311             return PyLong_FromLongLong((PY_LONG_LONG) value);
22312 #endif
22313         }
22314     }
22315     {
22316         int one = 1; int little = (int)*(unsigned char *)&one;
22317         unsigned char *bytes = (unsigned char *)&value;
22318         return _PyLong_FromByteArray(bytes, sizeof(long),
22319                                      little, !is_unsigned);
22320     }
22321 }
22322 
22323 /* CIntFromPyVerify */
22324 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
22325     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
22326 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
22327     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
22328 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
22329     {\
22330         func_type value = func_value;\
22331         if (sizeof(target_type) < sizeof(func_type)) {\
22332             if (unlikely(value != (func_type) (target_type) value)) {\
22333                 func_type zero = 0;\
22334                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
22335                     return (target_type) -1;\
22336                 if (is_unsigned && unlikely(value < zero))\
22337                     goto raise_neg_overflow;\
22338                 else\
22339                     goto raise_overflow;\
22340             }\
22341         }\
22342         return (target_type) value;\
22343     }
22344 
22345 /* MemviewDtypeToObject */
__pyx_memview_get_Py_ssize_t(const char * itemp)22346 static CYTHON_INLINE PyObject *__pyx_memview_get_Py_ssize_t(const char *itemp) {
22347     return (PyObject *) PyInt_FromSsize_t(*(Py_ssize_t *) itemp);
22348 }
__pyx_memview_set_Py_ssize_t(const char * itemp,PyObject * obj)22349 static CYTHON_INLINE int __pyx_memview_set_Py_ssize_t(const char *itemp, PyObject *obj) {
22350     Py_ssize_t value = __Pyx_PyIndex_AsSsize_t(obj);
22351     if ((value == (Py_ssize_t)-1) && PyErr_Occurred())
22352         return 0;
22353     *(Py_ssize_t *) itemp = value;
22354     return 1;
22355 }
22356 
22357 /* CIntToPy */
__Pyx_PyInt_From_int(int value)22358 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
22359     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
22360     const int is_unsigned = neg_one > const_zero;
22361     if (is_unsigned) {
22362         if (sizeof(int) < sizeof(long)) {
22363             return PyInt_FromLong((long) value);
22364         } else if (sizeof(int) <= sizeof(unsigned long)) {
22365             return PyLong_FromUnsignedLong((unsigned long) value);
22366 #ifdef HAVE_LONG_LONG
22367         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
22368             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
22369 #endif
22370         }
22371     } else {
22372         if (sizeof(int) <= sizeof(long)) {
22373             return PyInt_FromLong((long) value);
22374 #ifdef HAVE_LONG_LONG
22375         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
22376             return PyLong_FromLongLong((PY_LONG_LONG) value);
22377 #endif
22378         }
22379     }
22380     {
22381         int one = 1; int little = (int)*(unsigned char *)&one;
22382         unsigned char *bytes = (unsigned char *)&value;
22383         return _PyLong_FromByteArray(bytes, sizeof(int),
22384                                      little, !is_unsigned);
22385     }
22386 }
22387 
22388 /* Declarations */
22389 #if CYTHON_CCOMPLEX
22390   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)22391     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
22392       return ::std::complex< float >(x, y);
22393     }
22394   #else
__pyx_t_float_complex_from_parts(float x,float y)22395     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
22396       return x + y*(__pyx_t_float_complex)_Complex_I;
22397     }
22398   #endif
22399 #else
__pyx_t_float_complex_from_parts(float x,float y)22400     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
22401       __pyx_t_float_complex z;
22402       z.real = x;
22403       z.imag = y;
22404       return z;
22405     }
22406 #endif
22407 
22408 /* Arithmetic */
22409 #if CYTHON_CCOMPLEX
22410 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22411     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22412        return (a.real == b.real) && (a.imag == b.imag);
22413     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22414     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22415         __pyx_t_float_complex z;
22416         z.real = a.real + b.real;
22417         z.imag = a.imag + b.imag;
22418         return z;
22419     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22420     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22421         __pyx_t_float_complex z;
22422         z.real = a.real - b.real;
22423         z.imag = a.imag - b.imag;
22424         return z;
22425     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22426     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22427         __pyx_t_float_complex z;
22428         z.real = a.real * b.real - a.imag * b.imag;
22429         z.imag = a.real * b.imag + a.imag * b.real;
22430         return z;
22431     }
22432     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22433     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22434         if (b.imag == 0) {
22435             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
22436         } else if (fabsf(b.real) >= fabsf(b.imag)) {
22437             if (b.real == 0 && b.imag == 0) {
22438                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
22439             } else {
22440                 float r = b.imag / b.real;
22441                 float s = (float)(1.0) / (b.real + b.imag * r);
22442                 return __pyx_t_float_complex_from_parts(
22443                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
22444             }
22445         } else {
22446             float r = b.real / b.imag;
22447             float s = (float)(1.0) / (b.imag + b.real * r);
22448             return __pyx_t_float_complex_from_parts(
22449                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
22450         }
22451     }
22452     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22453     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22454         if (b.imag == 0) {
22455             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
22456         } else {
22457             float denom = b.real * b.real + b.imag * b.imag;
22458             return __pyx_t_float_complex_from_parts(
22459                 (a.real * b.real + a.imag * b.imag) / denom,
22460                 (a.imag * b.real - a.real * b.imag) / denom);
22461         }
22462     }
22463     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)22464     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
22465         __pyx_t_float_complex z;
22466         z.real = -a.real;
22467         z.imag = -a.imag;
22468         return z;
22469     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)22470     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
22471        return (a.real == 0) && (a.imag == 0);
22472     }
__Pyx_c_conj_float(__pyx_t_float_complex a)22473     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
22474         __pyx_t_float_complex z;
22475         z.real =  a.real;
22476         z.imag = -a.imag;
22477         return z;
22478     }
22479     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)22480         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
22481           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
22482             return sqrtf(z.real*z.real + z.imag*z.imag);
22483           #else
22484             return hypotf(z.real, z.imag);
22485           #endif
22486         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)22487         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22488             __pyx_t_float_complex z;
22489             float r, lnr, theta, z_r, z_theta;
22490             if (b.imag == 0 && b.real == (int)b.real) {
22491                 if (b.real < 0) {
22492                     float denom = a.real * a.real + a.imag * a.imag;
22493                     a.real = a.real / denom;
22494                     a.imag = -a.imag / denom;
22495                     b.real = -b.real;
22496                 }
22497                 switch ((int)b.real) {
22498                     case 0:
22499                         z.real = 1;
22500                         z.imag = 0;
22501                         return z;
22502                     case 1:
22503                         return a;
22504                     case 2:
22505                         return __Pyx_c_prod_float(a, a);
22506                     case 3:
22507                         z = __Pyx_c_prod_float(a, a);
22508                         return __Pyx_c_prod_float(z, a);
22509                     case 4:
22510                         z = __Pyx_c_prod_float(a, a);
22511                         return __Pyx_c_prod_float(z, z);
22512                 }
22513             }
22514             if (a.imag == 0) {
22515                 if (a.real == 0) {
22516                     return a;
22517                 } else if (b.imag == 0) {
22518                     z.real = powf(a.real, b.real);
22519                     z.imag = 0;
22520                     return z;
22521                 } else if (a.real > 0) {
22522                     r = a.real;
22523                     theta = 0;
22524                 } else {
22525                     r = -a.real;
22526                     theta = atan2f(0.0, -1.0);
22527                 }
22528             } else {
22529                 r = __Pyx_c_abs_float(a);
22530                 theta = atan2f(a.imag, a.real);
22531             }
22532             lnr = logf(r);
22533             z_r = expf(lnr * b.real - theta * b.imag);
22534             z_theta = theta * b.real + lnr * b.imag;
22535             z.real = z_r * cosf(z_theta);
22536             z.imag = z_r * sinf(z_theta);
22537             return z;
22538         }
22539     #endif
22540 #endif
22541 
22542 /* Declarations */
22543 #if CYTHON_CCOMPLEX
22544   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)22545     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
22546       return ::std::complex< double >(x, y);
22547     }
22548   #else
__pyx_t_double_complex_from_parts(double x,double y)22549     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
22550       return x + y*(__pyx_t_double_complex)_Complex_I;
22551     }
22552   #endif
22553 #else
__pyx_t_double_complex_from_parts(double x,double y)22554     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
22555       __pyx_t_double_complex z;
22556       z.real = x;
22557       z.imag = y;
22558       return z;
22559     }
22560 #endif
22561 
22562 /* Arithmetic */
22563 #if CYTHON_CCOMPLEX
22564 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22565     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22566        return (a.real == b.real) && (a.imag == b.imag);
22567     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22568     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22569         __pyx_t_double_complex z;
22570         z.real = a.real + b.real;
22571         z.imag = a.imag + b.imag;
22572         return z;
22573     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22574     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22575         __pyx_t_double_complex z;
22576         z.real = a.real - b.real;
22577         z.imag = a.imag - b.imag;
22578         return z;
22579     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22580     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22581         __pyx_t_double_complex z;
22582         z.real = a.real * b.real - a.imag * b.imag;
22583         z.imag = a.real * b.imag + a.imag * b.real;
22584         return z;
22585     }
22586     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22587     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22588         if (b.imag == 0) {
22589             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
22590         } else if (fabs(b.real) >= fabs(b.imag)) {
22591             if (b.real == 0 && b.imag == 0) {
22592                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
22593             } else {
22594                 double r = b.imag / b.real;
22595                 double s = (double)(1.0) / (b.real + b.imag * r);
22596                 return __pyx_t_double_complex_from_parts(
22597                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
22598             }
22599         } else {
22600             double r = b.real / b.imag;
22601             double s = (double)(1.0) / (b.imag + b.real * r);
22602             return __pyx_t_double_complex_from_parts(
22603                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
22604         }
22605     }
22606     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22607     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22608         if (b.imag == 0) {
22609             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
22610         } else {
22611             double denom = b.real * b.real + b.imag * b.imag;
22612             return __pyx_t_double_complex_from_parts(
22613                 (a.real * b.real + a.imag * b.imag) / denom,
22614                 (a.imag * b.real - a.real * b.imag) / denom);
22615         }
22616     }
22617     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)22618     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
22619         __pyx_t_double_complex z;
22620         z.real = -a.real;
22621         z.imag = -a.imag;
22622         return z;
22623     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)22624     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
22625        return (a.real == 0) && (a.imag == 0);
22626     }
__Pyx_c_conj_double(__pyx_t_double_complex a)22627     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
22628         __pyx_t_double_complex z;
22629         z.real =  a.real;
22630         z.imag = -a.imag;
22631         return z;
22632     }
22633     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)22634         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
22635           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
22636             return sqrt(z.real*z.real + z.imag*z.imag);
22637           #else
22638             return hypot(z.real, z.imag);
22639           #endif
22640         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)22641         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22642             __pyx_t_double_complex z;
22643             double r, lnr, theta, z_r, z_theta;
22644             if (b.imag == 0 && b.real == (int)b.real) {
22645                 if (b.real < 0) {
22646                     double denom = a.real * a.real + a.imag * a.imag;
22647                     a.real = a.real / denom;
22648                     a.imag = -a.imag / denom;
22649                     b.real = -b.real;
22650                 }
22651                 switch ((int)b.real) {
22652                     case 0:
22653                         z.real = 1;
22654                         z.imag = 0;
22655                         return z;
22656                     case 1:
22657                         return a;
22658                     case 2:
22659                         return __Pyx_c_prod_double(a, a);
22660                     case 3:
22661                         z = __Pyx_c_prod_double(a, a);
22662                         return __Pyx_c_prod_double(z, a);
22663                     case 4:
22664                         z = __Pyx_c_prod_double(a, a);
22665                         return __Pyx_c_prod_double(z, z);
22666                 }
22667             }
22668             if (a.imag == 0) {
22669                 if (a.real == 0) {
22670                     return a;
22671                 } else if (b.imag == 0) {
22672                     z.real = pow(a.real, b.real);
22673                     z.imag = 0;
22674                     return z;
22675                 } else if (a.real > 0) {
22676                     r = a.real;
22677                     theta = 0;
22678                 } else {
22679                     r = -a.real;
22680                     theta = atan2(0.0, -1.0);
22681                 }
22682             } else {
22683                 r = __Pyx_c_abs_double(a);
22684                 theta = atan2(a.imag, a.real);
22685             }
22686             lnr = log(r);
22687             z_r = exp(lnr * b.real - theta * b.imag);
22688             z_theta = theta * b.real + lnr * b.imag;
22689             z.real = z_r * cos(z_theta);
22690             z.imag = z_r * sin(z_theta);
22691             return z;
22692         }
22693     #endif
22694 #endif
22695 
22696 /* MemviewSliceCopyTemplate */
22697 static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice * from_mvs,const char * mode,int ndim,size_t sizeof_dtype,int contig_flag,int dtype_is_object)22698 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
22699                                  const char *mode, int ndim,
22700                                  size_t sizeof_dtype, int contig_flag,
22701                                  int dtype_is_object)
22702 {
22703     __Pyx_RefNannyDeclarations
22704     int i;
22705     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
22706     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
22707     Py_buffer *buf = &from_memview->view;
22708     PyObject *shape_tuple = NULL;
22709     PyObject *temp_int = NULL;
22710     struct __pyx_array_obj *array_obj = NULL;
22711     struct __pyx_memoryview_obj *memview_obj = NULL;
22712     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
22713     for (i = 0; i < ndim; i++) {
22714         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
22715             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
22716                                            "indirect dimensions (axis %d)", i);
22717             goto fail;
22718         }
22719     }
22720     shape_tuple = PyTuple_New(ndim);
22721     if (unlikely(!shape_tuple)) {
22722         goto fail;
22723     }
22724     __Pyx_GOTREF(shape_tuple);
22725     for(i = 0; i < ndim; i++) {
22726         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
22727         if(unlikely(!temp_int)) {
22728             goto fail;
22729         } else {
22730             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
22731             temp_int = NULL;
22732         }
22733     }
22734     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
22735     if (unlikely(!array_obj)) {
22736         goto fail;
22737     }
22738     __Pyx_GOTREF(array_obj);
22739     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
22740                                     (PyObject *) array_obj, contig_flag,
22741                                     dtype_is_object,
22742                                     from_mvs->memview->typeinfo);
22743     if (unlikely(!memview_obj))
22744         goto fail;
22745     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
22746         goto fail;
22747     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
22748                                                 dtype_is_object) < 0))
22749         goto fail;
22750     goto no_fail;
22751 fail:
22752     __Pyx_XDECREF(new_mvs.memview);
22753     new_mvs.memview = NULL;
22754     new_mvs.data = NULL;
22755 no_fail:
22756     __Pyx_XDECREF(shape_tuple);
22757     __Pyx_XDECREF(temp_int);
22758     __Pyx_XDECREF(array_obj);
22759     __Pyx_RefNannyFinishContext();
22760     return new_mvs;
22761 }
22762 
22763 /* MemviewSliceInit */
22764 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)22765 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
22766                         int ndim,
22767                         __Pyx_memviewslice *memviewslice,
22768                         int memview_is_new_reference)
22769 {
22770     __Pyx_RefNannyDeclarations
22771     int i, retval=-1;
22772     Py_buffer *buf = &memview->view;
22773     __Pyx_RefNannySetupContext("init_memviewslice", 0);
22774     if (unlikely(memviewslice->memview || memviewslice->data)) {
22775         PyErr_SetString(PyExc_ValueError,
22776             "memviewslice is already initialized!");
22777         goto fail;
22778     }
22779     if (buf->strides) {
22780         for (i = 0; i < ndim; i++) {
22781             memviewslice->strides[i] = buf->strides[i];
22782         }
22783     } else {
22784         Py_ssize_t stride = buf->itemsize;
22785         for (i = ndim - 1; i >= 0; i--) {
22786             memviewslice->strides[i] = stride;
22787             stride *= buf->shape[i];
22788         }
22789     }
22790     for (i = 0; i < ndim; i++) {
22791         memviewslice->shape[i]   = buf->shape[i];
22792         if (buf->suboffsets) {
22793             memviewslice->suboffsets[i] = buf->suboffsets[i];
22794         } else {
22795             memviewslice->suboffsets[i] = -1;
22796         }
22797     }
22798     memviewslice->memview = memview;
22799     memviewslice->data = (char *)buf->buf;
22800     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22801         Py_INCREF(memview);
22802     }
22803     retval = 0;
22804     goto no_fail;
22805 fail:
22806     memviewslice->memview = 0;
22807     memviewslice->data = 0;
22808     retval = -1;
22809 no_fail:
22810     __Pyx_RefNannyFinishContext();
22811     return retval;
22812 }
22813 #ifndef Py_NO_RETURN
22814 #define Py_NO_RETURN
22815 #endif
__pyx_fatalerror(const char * fmt,...)22816 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
22817     va_list vargs;
22818     char msg[200];
22819 #ifdef HAVE_STDARG_PROTOTYPES
22820     va_start(vargs, fmt);
22821 #else
22822     va_start(vargs);
22823 #endif
22824     vsnprintf(msg, 200, fmt, vargs);
22825     va_end(vargs);
22826     Py_FatalError(msg);
22827 }
22828 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22829 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22830                                    PyThread_type_lock lock)
22831 {
22832     int result;
22833     PyThread_acquire_lock(lock, 1);
22834     result = (*acquisition_count)++;
22835     PyThread_release_lock(lock);
22836     return result;
22837 }
22838 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22839 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22840                                    PyThread_type_lock lock)
22841 {
22842     int result;
22843     PyThread_acquire_lock(lock, 1);
22844     result = (*acquisition_count)--;
22845     PyThread_release_lock(lock);
22846     return result;
22847 }
22848 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22849 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
22850 {
22851     int first_time;
22852     struct __pyx_memoryview_obj *memview = memslice->memview;
22853     if (unlikely(!memview || (PyObject *) memview == Py_None))
22854         return;
22855     if (unlikely(__pyx_get_slice_count(memview) < 0))
22856         __pyx_fatalerror("Acquisition count is %d (line %d)",
22857                          __pyx_get_slice_count(memview), lineno);
22858     first_time = __pyx_add_acquisition_count(memview) == 0;
22859     if (unlikely(first_time)) {
22860         if (have_gil) {
22861             Py_INCREF((PyObject *) memview);
22862         } else {
22863             PyGILState_STATE _gilstate = PyGILState_Ensure();
22864             Py_INCREF((PyObject *) memview);
22865             PyGILState_Release(_gilstate);
22866         }
22867     }
22868 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22869 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22870                                              int have_gil, int lineno) {
22871     int last_time;
22872     struct __pyx_memoryview_obj *memview = memslice->memview;
22873     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
22874         memslice->memview = NULL;
22875         return;
22876     }
22877     if (unlikely(__pyx_get_slice_count(memview) <= 0))
22878         __pyx_fatalerror("Acquisition count is %d (line %d)",
22879                          __pyx_get_slice_count(memview), lineno);
22880     last_time = __pyx_sub_acquisition_count(memview) == 1;
22881     memslice->data = NULL;
22882     if (unlikely(last_time)) {
22883         if (have_gil) {
22884             Py_CLEAR(memslice->memview);
22885         } else {
22886             PyGILState_STATE _gilstate = PyGILState_Ensure();
22887             Py_CLEAR(memslice->memview);
22888             PyGILState_Release(_gilstate);
22889         }
22890     } else {
22891         memslice->memview = NULL;
22892     }
22893 }
22894 
22895 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)22896 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
22897     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
22898     const int is_unsigned = neg_one > const_zero;
22899 #if PY_MAJOR_VERSION < 3
22900     if (likely(PyInt_Check(x))) {
22901         if (sizeof(int) < sizeof(long)) {
22902             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
22903         } else {
22904             long val = PyInt_AS_LONG(x);
22905             if (is_unsigned && unlikely(val < 0)) {
22906                 goto raise_neg_overflow;
22907             }
22908             return (int) val;
22909         }
22910     } else
22911 #endif
22912     if (likely(PyLong_Check(x))) {
22913         if (is_unsigned) {
22914 #if CYTHON_USE_PYLONG_INTERNALS
22915             const digit* digits = ((PyLongObject*)x)->ob_digit;
22916             switch (Py_SIZE(x)) {
22917                 case  0: return (int) 0;
22918                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
22919                 case 2:
22920                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
22921                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22922                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22923                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
22924                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
22925                         }
22926                     }
22927                     break;
22928                 case 3:
22929                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
22930                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22931                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22932                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
22933                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
22934                         }
22935                     }
22936                     break;
22937                 case 4:
22938                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
22939                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22940                             __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])))
22941                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
22942                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
22943                         }
22944                     }
22945                     break;
22946             }
22947 #endif
22948 #if CYTHON_COMPILING_IN_CPYTHON
22949             if (unlikely(Py_SIZE(x) < 0)) {
22950                 goto raise_neg_overflow;
22951             }
22952 #else
22953             {
22954                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22955                 if (unlikely(result < 0))
22956                     return (int) -1;
22957                 if (unlikely(result == 1))
22958                     goto raise_neg_overflow;
22959             }
22960 #endif
22961             if (sizeof(int) <= sizeof(unsigned long)) {
22962                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
22963 #ifdef HAVE_LONG_LONG
22964             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
22965                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22966 #endif
22967             }
22968         } else {
22969 #if CYTHON_USE_PYLONG_INTERNALS
22970             const digit* digits = ((PyLongObject*)x)->ob_digit;
22971             switch (Py_SIZE(x)) {
22972                 case  0: return (int) 0;
22973                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
22974                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
22975                 case -2:
22976                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
22977                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22978                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22979                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
22980                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
22981                         }
22982                     }
22983                     break;
22984                 case 2:
22985                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
22986                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22987                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22988                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
22989                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
22990                         }
22991                     }
22992                     break;
22993                 case -3:
22994                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
22995                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22996                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22997                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
22998                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
22999                         }
23000                     }
23001                     break;
23002                 case 3:
23003                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
23004                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23005                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23006                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
23007                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
23008                         }
23009                     }
23010                     break;
23011                 case -4:
23012                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
23013                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23014                             __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])))
23015                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
23016                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
23017                         }
23018                     }
23019                     break;
23020                 case 4:
23021                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
23022                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23023                             __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])))
23024                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
23025                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
23026                         }
23027                     }
23028                     break;
23029             }
23030 #endif
23031             if (sizeof(int) <= sizeof(long)) {
23032                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
23033 #ifdef HAVE_LONG_LONG
23034             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
23035                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
23036 #endif
23037             }
23038         }
23039         {
23040 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23041             PyErr_SetString(PyExc_RuntimeError,
23042                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23043 #else
23044             int val;
23045             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23046  #if PY_MAJOR_VERSION < 3
23047             if (likely(v) && !PyLong_Check(v)) {
23048                 PyObject *tmp = v;
23049                 v = PyNumber_Long(tmp);
23050                 Py_DECREF(tmp);
23051             }
23052  #endif
23053             if (likely(v)) {
23054                 int one = 1; int is_little = (int)*(unsigned char *)&one;
23055                 unsigned char *bytes = (unsigned char *)&val;
23056                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
23057                                               bytes, sizeof(val),
23058                                               is_little, !is_unsigned);
23059                 Py_DECREF(v);
23060                 if (likely(!ret))
23061                     return val;
23062             }
23063 #endif
23064             return (int) -1;
23065         }
23066     } else {
23067         int val;
23068         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23069         if (!tmp) return (int) -1;
23070         val = __Pyx_PyInt_As_int(tmp);
23071         Py_DECREF(tmp);
23072         return val;
23073     }
23074 raise_overflow:
23075     PyErr_SetString(PyExc_OverflowError,
23076         "value too large to convert to int");
23077     return (int) -1;
23078 raise_neg_overflow:
23079     PyErr_SetString(PyExc_OverflowError,
23080         "can't convert negative value to int");
23081     return (int) -1;
23082 }
23083 
23084 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)23085 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
23086     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
23087     const int is_unsigned = neg_one > const_zero;
23088 #if PY_MAJOR_VERSION < 3
23089     if (likely(PyInt_Check(x))) {
23090         if (sizeof(long) < sizeof(long)) {
23091             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
23092         } else {
23093             long val = PyInt_AS_LONG(x);
23094             if (is_unsigned && unlikely(val < 0)) {
23095                 goto raise_neg_overflow;
23096             }
23097             return (long) val;
23098         }
23099     } else
23100 #endif
23101     if (likely(PyLong_Check(x))) {
23102         if (is_unsigned) {
23103 #if CYTHON_USE_PYLONG_INTERNALS
23104             const digit* digits = ((PyLongObject*)x)->ob_digit;
23105             switch (Py_SIZE(x)) {
23106                 case  0: return (long) 0;
23107                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
23108                 case 2:
23109                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
23110                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23111                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23112                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
23113                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
23114                         }
23115                     }
23116                     break;
23117                 case 3:
23118                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
23119                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23120                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23121                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
23122                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
23123                         }
23124                     }
23125                     break;
23126                 case 4:
23127                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
23128                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23129                             __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])))
23130                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
23131                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
23132                         }
23133                     }
23134                     break;
23135             }
23136 #endif
23137 #if CYTHON_COMPILING_IN_CPYTHON
23138             if (unlikely(Py_SIZE(x) < 0)) {
23139                 goto raise_neg_overflow;
23140             }
23141 #else
23142             {
23143                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23144                 if (unlikely(result < 0))
23145                     return (long) -1;
23146                 if (unlikely(result == 1))
23147                     goto raise_neg_overflow;
23148             }
23149 #endif
23150             if (sizeof(long) <= sizeof(unsigned long)) {
23151                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
23152 #ifdef HAVE_LONG_LONG
23153             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
23154                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23155 #endif
23156             }
23157         } else {
23158 #if CYTHON_USE_PYLONG_INTERNALS
23159             const digit* digits = ((PyLongObject*)x)->ob_digit;
23160             switch (Py_SIZE(x)) {
23161                 case  0: return (long) 0;
23162                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
23163                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
23164                 case -2:
23165                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
23166                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23167                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23168                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23169                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23170                         }
23171                     }
23172                     break;
23173                 case 2:
23174                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
23175                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23176                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23177                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23178                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23179                         }
23180                     }
23181                     break;
23182                 case -3:
23183                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23184                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23185                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23186                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23187                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23188                         }
23189                     }
23190                     break;
23191                 case 3:
23192                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
23193                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23194                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23195                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23196                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23197                         }
23198                     }
23199                     break;
23200                 case -4:
23201                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23202                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23203                             __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])))
23204                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23205                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23206                         }
23207                     }
23208                     break;
23209                 case 4:
23210                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
23211                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23212                             __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])))
23213                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23214                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23215                         }
23216                     }
23217                     break;
23218             }
23219 #endif
23220             if (sizeof(long) <= sizeof(long)) {
23221                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
23222 #ifdef HAVE_LONG_LONG
23223             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
23224                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
23225 #endif
23226             }
23227         }
23228         {
23229 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23230             PyErr_SetString(PyExc_RuntimeError,
23231                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23232 #else
23233             long val;
23234             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23235  #if PY_MAJOR_VERSION < 3
23236             if (likely(v) && !PyLong_Check(v)) {
23237                 PyObject *tmp = v;
23238                 v = PyNumber_Long(tmp);
23239                 Py_DECREF(tmp);
23240             }
23241  #endif
23242             if (likely(v)) {
23243                 int one = 1; int is_little = (int)*(unsigned char *)&one;
23244                 unsigned char *bytes = (unsigned char *)&val;
23245                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
23246                                               bytes, sizeof(val),
23247                                               is_little, !is_unsigned);
23248                 Py_DECREF(v);
23249                 if (likely(!ret))
23250                     return val;
23251             }
23252 #endif
23253             return (long) -1;
23254         }
23255     } else {
23256         long val;
23257         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23258         if (!tmp) return (long) -1;
23259         val = __Pyx_PyInt_As_long(tmp);
23260         Py_DECREF(tmp);
23261         return val;
23262     }
23263 raise_overflow:
23264     PyErr_SetString(PyExc_OverflowError,
23265         "value too large to convert to long");
23266     return (long) -1;
23267 raise_neg_overflow:
23268     PyErr_SetString(PyExc_OverflowError,
23269         "can't convert negative value to long");
23270     return (long) -1;
23271 }
23272 
23273 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)23274 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
23275     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
23276     const int is_unsigned = neg_one > const_zero;
23277 #if PY_MAJOR_VERSION < 3
23278     if (likely(PyInt_Check(x))) {
23279         if (sizeof(char) < sizeof(long)) {
23280             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
23281         } else {
23282             long val = PyInt_AS_LONG(x);
23283             if (is_unsigned && unlikely(val < 0)) {
23284                 goto raise_neg_overflow;
23285             }
23286             return (char) val;
23287         }
23288     } else
23289 #endif
23290     if (likely(PyLong_Check(x))) {
23291         if (is_unsigned) {
23292 #if CYTHON_USE_PYLONG_INTERNALS
23293             const digit* digits = ((PyLongObject*)x)->ob_digit;
23294             switch (Py_SIZE(x)) {
23295                 case  0: return (char) 0;
23296                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
23297                 case 2:
23298                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
23299                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23300                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23301                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
23302                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
23303                         }
23304                     }
23305                     break;
23306                 case 3:
23307                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
23308                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23309                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23310                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
23311                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
23312                         }
23313                     }
23314                     break;
23315                 case 4:
23316                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
23317                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23318                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23319                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
23320                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
23321                         }
23322                     }
23323                     break;
23324             }
23325 #endif
23326 #if CYTHON_COMPILING_IN_CPYTHON
23327             if (unlikely(Py_SIZE(x) < 0)) {
23328                 goto raise_neg_overflow;
23329             }
23330 #else
23331             {
23332                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23333                 if (unlikely(result < 0))
23334                     return (char) -1;
23335                 if (unlikely(result == 1))
23336                     goto raise_neg_overflow;
23337             }
23338 #endif
23339             if (sizeof(char) <= sizeof(unsigned long)) {
23340                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
23341 #ifdef HAVE_LONG_LONG
23342             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
23343                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23344 #endif
23345             }
23346         } else {
23347 #if CYTHON_USE_PYLONG_INTERNALS
23348             const digit* digits = ((PyLongObject*)x)->ob_digit;
23349             switch (Py_SIZE(x)) {
23350                 case  0: return (char) 0;
23351                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
23352                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
23353                 case -2:
23354                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
23355                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23356                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23357                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
23358                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23359                         }
23360                     }
23361                     break;
23362                 case 2:
23363                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
23364                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
23365                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23366                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
23367                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23368                         }
23369                     }
23370                     break;
23371                 case -3:
23372                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
23373                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23374                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23375                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
23376                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23377                         }
23378                     }
23379                     break;
23380                 case 3:
23381                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
23382                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
23383                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23384                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
23385                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23386                         }
23387                     }
23388                     break;
23389                 case -4:
23390                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
23391                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23392                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23393                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
23394                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23395                         }
23396                     }
23397                     break;
23398                 case 4:
23399                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
23400                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
23401                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
23402                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
23403                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23404                         }
23405                     }
23406                     break;
23407             }
23408 #endif
23409             if (sizeof(char) <= sizeof(long)) {
23410                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
23411 #ifdef HAVE_LONG_LONG
23412             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
23413                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
23414 #endif
23415             }
23416         }
23417         {
23418 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23419             PyErr_SetString(PyExc_RuntimeError,
23420                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23421 #else
23422             char val;
23423             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23424  #if PY_MAJOR_VERSION < 3
23425             if (likely(v) && !PyLong_Check(v)) {
23426                 PyObject *tmp = v;
23427                 v = PyNumber_Long(tmp);
23428                 Py_DECREF(tmp);
23429             }
23430  #endif
23431             if (likely(v)) {
23432                 int one = 1; int is_little = (int)*(unsigned char *)&one;
23433                 unsigned char *bytes = (unsigned char *)&val;
23434                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
23435                                               bytes, sizeof(val),
23436                                               is_little, !is_unsigned);
23437                 Py_DECREF(v);
23438                 if (likely(!ret))
23439                     return val;
23440             }
23441 #endif
23442             return (char) -1;
23443         }
23444     } else {
23445         char val;
23446         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23447         if (!tmp) return (char) -1;
23448         val = __Pyx_PyInt_As_char(tmp);
23449         Py_DECREF(tmp);
23450         return val;
23451     }
23452 raise_overflow:
23453     PyErr_SetString(PyExc_OverflowError,
23454         "value too large to convert to char");
23455     return (char) -1;
23456 raise_neg_overflow:
23457     PyErr_SetString(PyExc_OverflowError,
23458         "can't convert negative value to char");
23459     return (char) -1;
23460 }
23461 
23462 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)23463 static int __Pyx_check_binary_version(void) {
23464     char ctversion[4], rtversion[4];
23465     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
23466     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
23467     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
23468         char message[200];
23469         PyOS_snprintf(message, sizeof(message),
23470                       "compiletime version %s of module '%.100s' "
23471                       "does not match runtime version %s",
23472                       ctversion, __Pyx_MODULE_NAME, rtversion);
23473         return PyErr_WarnEx(NULL, message, 1);
23474     }
23475     return 0;
23476 }
23477 
23478 /* FunctionExport */
__Pyx_ExportFunction(const char * name,void (* f)(void),const char * sig)23479 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
23480     PyObject *d = 0;
23481     PyObject *cobj = 0;
23482     union {
23483         void (*fp)(void);
23484         void *p;
23485     } tmp;
23486     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
23487     if (!d) {
23488         PyErr_Clear();
23489         d = PyDict_New();
23490         if (!d)
23491             goto bad;
23492         Py_INCREF(d);
23493         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
23494             goto bad;
23495     }
23496     tmp.fp = f;
23497 #if PY_VERSION_HEX >= 0x02070000
23498     cobj = PyCapsule_New(tmp.p, sig, 0);
23499 #else
23500     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
23501 #endif
23502     if (!cobj)
23503         goto bad;
23504     if (PyDict_SetItemString(d, name, cobj) < 0)
23505         goto bad;
23506     Py_DECREF(cobj);
23507     Py_DECREF(d);
23508     return 0;
23509 bad:
23510     Py_XDECREF(cobj);
23511     Py_XDECREF(d);
23512     return -1;
23513 }
23514 
23515 /* FunctionImport */
23516 #ifndef __PYX_HAVE_RT_ImportFunction
23517 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)23518 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
23519     PyObject *d = 0;
23520     PyObject *cobj = 0;
23521     union {
23522         void (*fp)(void);
23523         void *p;
23524     } tmp;
23525     d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
23526     if (!d)
23527         goto bad;
23528     cobj = PyDict_GetItemString(d, funcname);
23529     if (!cobj) {
23530         PyErr_Format(PyExc_ImportError,
23531             "%.200s does not export expected C function %.200s",
23532                 PyModule_GetName(module), funcname);
23533         goto bad;
23534     }
23535 #if PY_VERSION_HEX >= 0x02070000
23536     if (!PyCapsule_IsValid(cobj, sig)) {
23537         PyErr_Format(PyExc_TypeError,
23538             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
23539              PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
23540         goto bad;
23541     }
23542     tmp.p = PyCapsule_GetPointer(cobj, sig);
23543 #else
23544     {const char *desc, *s1, *s2;
23545     desc = (const char *)PyCObject_GetDesc(cobj);
23546     if (!desc)
23547         goto bad;
23548     s1 = desc; s2 = sig;
23549     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
23550     if (*s1 != *s2) {
23551         PyErr_Format(PyExc_TypeError,
23552             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
23553              PyModule_GetName(module), funcname, sig, desc);
23554         goto bad;
23555     }
23556     tmp.p = PyCObject_AsVoidPtr(cobj);}
23557 #endif
23558     *f = tmp.fp;
23559     if (!(*f))
23560         goto bad;
23561     Py_DECREF(d);
23562     return 0;
23563 bad:
23564     Py_XDECREF(d);
23565     return -1;
23566 }
23567 #endif
23568 
23569 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)23570 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
23571     while (t->p) {
23572         #if PY_MAJOR_VERSION < 3
23573         if (t->is_unicode) {
23574             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
23575         } else if (t->intern) {
23576             *t->p = PyString_InternFromString(t->s);
23577         } else {
23578             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
23579         }
23580         #else
23581         if (t->is_unicode | t->is_str) {
23582             if (t->intern) {
23583                 *t->p = PyUnicode_InternFromString(t->s);
23584             } else if (t->encoding) {
23585                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
23586             } else {
23587                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
23588             }
23589         } else {
23590             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
23591         }
23592         #endif
23593         if (!*t->p)
23594             return -1;
23595         if (PyObject_Hash(*t->p) == -1)
23596             return -1;
23597         ++t;
23598     }
23599     return 0;
23600 }
23601 
__Pyx_PyUnicode_FromString(const char * c_str)23602 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
23603     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
23604 }
__Pyx_PyObject_AsString(PyObject * o)23605 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
23606     Py_ssize_t ignore;
23607     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
23608 }
23609 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23610 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)23611 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23612     char* defenc_c;
23613     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
23614     if (!defenc) return NULL;
23615     defenc_c = PyBytes_AS_STRING(defenc);
23616 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23617     {
23618         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
23619         char* c;
23620         for (c = defenc_c; c < end; c++) {
23621             if ((unsigned char) (*c) >= 128) {
23622                 PyUnicode_AsASCIIString(o);
23623                 return NULL;
23624             }
23625         }
23626     }
23627 #endif
23628     *length = PyBytes_GET_SIZE(defenc);
23629     return defenc_c;
23630 }
23631 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)23632 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23633     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
23634 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23635     if (likely(PyUnicode_IS_ASCII(o))) {
23636         *length = PyUnicode_GET_LENGTH(o);
23637         return PyUnicode_AsUTF8(o);
23638     } else {
23639         PyUnicode_AsASCIIString(o);
23640         return NULL;
23641     }
23642 #else
23643     return PyUnicode_AsUTF8AndSize(o, length);
23644 #endif
23645 }
23646 #endif
23647 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)23648 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23649 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23650     if (
23651 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23652             __Pyx_sys_getdefaultencoding_not_ascii &&
23653 #endif
23654             PyUnicode_Check(o)) {
23655         return __Pyx_PyUnicode_AsStringAndSize(o, length);
23656     } else
23657 #endif
23658 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
23659     if (PyByteArray_Check(o)) {
23660         *length = PyByteArray_GET_SIZE(o);
23661         return PyByteArray_AS_STRING(o);
23662     } else
23663 #endif
23664     {
23665         char* result;
23666         int r = PyBytes_AsStringAndSize(o, &result, length);
23667         if (unlikely(r < 0)) {
23668             return NULL;
23669         } else {
23670             return result;
23671         }
23672     }
23673 }
__Pyx_PyObject_IsTrue(PyObject * x)23674 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
23675    int is_true = x == Py_True;
23676    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
23677    else return PyObject_IsTrue(x);
23678 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)23679 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
23680     int retval;
23681     if (unlikely(!x)) return -1;
23682     retval = __Pyx_PyObject_IsTrue(x);
23683     Py_DECREF(x);
23684     return retval;
23685 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)23686 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
23687 #if PY_MAJOR_VERSION >= 3
23688     if (PyLong_Check(result)) {
23689         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
23690                 "__int__ returned non-int (type %.200s).  "
23691                 "The ability to return an instance of a strict subclass of int "
23692                 "is deprecated, and may be removed in a future version of Python.",
23693                 Py_TYPE(result)->tp_name)) {
23694             Py_DECREF(result);
23695             return NULL;
23696         }
23697         return result;
23698     }
23699 #endif
23700     PyErr_Format(PyExc_TypeError,
23701                  "__%.4s__ returned non-%.4s (type %.200s)",
23702                  type_name, type_name, Py_TYPE(result)->tp_name);
23703     Py_DECREF(result);
23704     return NULL;
23705 }
__Pyx_PyNumber_IntOrLong(PyObject * x)23706 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
23707 #if CYTHON_USE_TYPE_SLOTS
23708   PyNumberMethods *m;
23709 #endif
23710   const char *name = NULL;
23711   PyObject *res = NULL;
23712 #if PY_MAJOR_VERSION < 3
23713   if (likely(PyInt_Check(x) || PyLong_Check(x)))
23714 #else
23715   if (likely(PyLong_Check(x)))
23716 #endif
23717     return __Pyx_NewRef(x);
23718 #if CYTHON_USE_TYPE_SLOTS
23719   m = Py_TYPE(x)->tp_as_number;
23720   #if PY_MAJOR_VERSION < 3
23721   if (m && m->nb_int) {
23722     name = "int";
23723     res = m->nb_int(x);
23724   }
23725   else if (m && m->nb_long) {
23726     name = "long";
23727     res = m->nb_long(x);
23728   }
23729   #else
23730   if (likely(m && m->nb_int)) {
23731     name = "int";
23732     res = m->nb_int(x);
23733   }
23734   #endif
23735 #else
23736   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
23737     res = PyNumber_Int(x);
23738   }
23739 #endif
23740   if (likely(res)) {
23741 #if PY_MAJOR_VERSION < 3
23742     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
23743 #else
23744     if (unlikely(!PyLong_CheckExact(res))) {
23745 #endif
23746         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
23747     }
23748   }
23749   else if (!PyErr_Occurred()) {
23750     PyErr_SetString(PyExc_TypeError,
23751                     "an integer is required");
23752   }
23753   return res;
23754 }
23755 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
23756   Py_ssize_t ival;
23757   PyObject *x;
23758 #if PY_MAJOR_VERSION < 3
23759   if (likely(PyInt_CheckExact(b))) {
23760     if (sizeof(Py_ssize_t) >= sizeof(long))
23761         return PyInt_AS_LONG(b);
23762     else
23763         return PyInt_AsSsize_t(b);
23764   }
23765 #endif
23766   if (likely(PyLong_CheckExact(b))) {
23767     #if CYTHON_USE_PYLONG_INTERNALS
23768     const digit* digits = ((PyLongObject*)b)->ob_digit;
23769     const Py_ssize_t size = Py_SIZE(b);
23770     if (likely(__Pyx_sst_abs(size) <= 1)) {
23771         ival = likely(size) ? digits[0] : 0;
23772         if (size == -1) ival = -ival;
23773         return ival;
23774     } else {
23775       switch (size) {
23776          case 2:
23777            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23778              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23779            }
23780            break;
23781          case -2:
23782            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23783              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23784            }
23785            break;
23786          case 3:
23787            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23788              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23789            }
23790            break;
23791          case -3:
23792            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23793              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23794            }
23795            break;
23796          case 4:
23797            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23798              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]));
23799            }
23800            break;
23801          case -4:
23802            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23803              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]));
23804            }
23805            break;
23806       }
23807     }
23808     #endif
23809     return PyLong_AsSsize_t(b);
23810   }
23811   x = PyNumber_Index(b);
23812   if (!x) return -1;
23813   ival = PyInt_AsSsize_t(x);
23814   Py_DECREF(x);
23815   return ival;
23816 }
23817 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
23818   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
23819 }
23820 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
23821     return PyInt_FromSize_t(ival);
23822 }
23823 
23824 
23825 #endif /* Py_PYTHON_H */
23826