1 /* Generated by Cython 0.29.21 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "extra_compile_args": [
7 "-Wno-unused-parameter",
8 "-Wno-unused-function"
9 ],
10 "include_dirs": [
11 "/home/sean/.virtualenvs/dev-rasterio/lib/python3.7/site-packages/numpy/core/include",
12 "/home/sean/local/include"
13 ],
14 "libraries": [
15 "gdal"
16 ],
17 "library_dirs": [
18 "/home/sean/local/lib"
19 ],
20 "name": "rasterio._example",
21 "sources": [
22 "rasterio/_example.pyx"
23 ]
24 },
25 "module_name": "rasterio._example"
26 }
27 END: Cython Metadata */
28
29 #define PY_SSIZE_T_CLEAN
30 #include "Python.h"
31 #ifndef Py_PYTHON_H
32 #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34 #error Cython requires Python 2.6+ or Python 3.3+.
35 #else
36 #define CYTHON_ABI "0_29_21"
37 #define CYTHON_HEX_VERSION 0x001D15F0
38 #define CYTHON_FUTURE_DIVISION 0
39 #include <stddef.h>
40 #ifndef offsetof
41 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
42 #endif
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
44 #ifndef __stdcall
45 #define __stdcall
46 #endif
47 #ifndef __cdecl
48 #define __cdecl
49 #endif
50 #ifndef __fastcall
51 #define __fastcall
52 #endif
53 #endif
54 #ifndef DL_IMPORT
55 #define DL_IMPORT(t) t
56 #endif
57 #ifndef DL_EXPORT
58 #define DL_EXPORT(t) t
59 #endif
60 #define __PYX_COMMA ,
61 #ifndef HAVE_LONG_LONG
62 #if PY_VERSION_HEX >= 0x02070000
63 #define HAVE_LONG_LONG
64 #endif
65 #endif
66 #ifndef PY_LONG_LONG
67 #define PY_LONG_LONG LONG_LONG
68 #endif
69 #ifndef Py_HUGE_VAL
70 #define Py_HUGE_VAL HUGE_VAL
71 #endif
72 #ifdef PYPY_VERSION
73 #define CYTHON_COMPILING_IN_PYPY 1
74 #define CYTHON_COMPILING_IN_PYSTON 0
75 #define CYTHON_COMPILING_IN_CPYTHON 0
76 #undef CYTHON_USE_TYPE_SLOTS
77 #define CYTHON_USE_TYPE_SLOTS 0
78 #undef CYTHON_USE_PYTYPE_LOOKUP
79 #define CYTHON_USE_PYTYPE_LOOKUP 0
80 #if PY_VERSION_HEX < 0x03050000
81 #undef CYTHON_USE_ASYNC_SLOTS
82 #define CYTHON_USE_ASYNC_SLOTS 0
83 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84 #define CYTHON_USE_ASYNC_SLOTS 1
85 #endif
86 #undef CYTHON_USE_PYLIST_INTERNALS
87 #define CYTHON_USE_PYLIST_INTERNALS 0
88 #undef CYTHON_USE_UNICODE_INTERNALS
89 #define CYTHON_USE_UNICODE_INTERNALS 0
90 #undef CYTHON_USE_UNICODE_WRITER
91 #define CYTHON_USE_UNICODE_WRITER 0
92 #undef CYTHON_USE_PYLONG_INTERNALS
93 #define CYTHON_USE_PYLONG_INTERNALS 0
94 #undef CYTHON_AVOID_BORROWED_REFS
95 #define CYTHON_AVOID_BORROWED_REFS 1
96 #undef CYTHON_ASSUME_SAFE_MACROS
97 #define CYTHON_ASSUME_SAFE_MACROS 0
98 #undef CYTHON_UNPACK_METHODS
99 #define CYTHON_UNPACK_METHODS 0
100 #undef CYTHON_FAST_THREAD_STATE
101 #define CYTHON_FAST_THREAD_STATE 0
102 #undef CYTHON_FAST_PYCALL
103 #define CYTHON_FAST_PYCALL 0
104 #undef CYTHON_PEP489_MULTI_PHASE_INIT
105 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106 #undef CYTHON_USE_TP_FINALIZE
107 #define CYTHON_USE_TP_FINALIZE 0
108 #undef CYTHON_USE_DICT_VERSIONS
109 #define CYTHON_USE_DICT_VERSIONS 0
110 #undef CYTHON_USE_EXC_INFO_STACK
111 #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113 #define CYTHON_COMPILING_IN_PYPY 0
114 #define CYTHON_COMPILING_IN_PYSTON 1
115 #define CYTHON_COMPILING_IN_CPYTHON 0
116 #ifndef CYTHON_USE_TYPE_SLOTS
117 #define CYTHON_USE_TYPE_SLOTS 1
118 #endif
119 #undef CYTHON_USE_PYTYPE_LOOKUP
120 #define CYTHON_USE_PYTYPE_LOOKUP 0
121 #undef CYTHON_USE_ASYNC_SLOTS
122 #define CYTHON_USE_ASYNC_SLOTS 0
123 #undef CYTHON_USE_PYLIST_INTERNALS
124 #define CYTHON_USE_PYLIST_INTERNALS 0
125 #ifndef CYTHON_USE_UNICODE_INTERNALS
126 #define CYTHON_USE_UNICODE_INTERNALS 1
127 #endif
128 #undef CYTHON_USE_UNICODE_WRITER
129 #define CYTHON_USE_UNICODE_WRITER 0
130 #undef CYTHON_USE_PYLONG_INTERNALS
131 #define CYTHON_USE_PYLONG_INTERNALS 0
132 #ifndef CYTHON_AVOID_BORROWED_REFS
133 #define CYTHON_AVOID_BORROWED_REFS 0
134 #endif
135 #ifndef CYTHON_ASSUME_SAFE_MACROS
136 #define CYTHON_ASSUME_SAFE_MACROS 1
137 #endif
138 #ifndef CYTHON_UNPACK_METHODS
139 #define CYTHON_UNPACK_METHODS 1
140 #endif
141 #undef CYTHON_FAST_THREAD_STATE
142 #define CYTHON_FAST_THREAD_STATE 0
143 #undef CYTHON_FAST_PYCALL
144 #define CYTHON_FAST_PYCALL 0
145 #undef CYTHON_PEP489_MULTI_PHASE_INIT
146 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147 #undef CYTHON_USE_TP_FINALIZE
148 #define CYTHON_USE_TP_FINALIZE 0
149 #undef CYTHON_USE_DICT_VERSIONS
150 #define CYTHON_USE_DICT_VERSIONS 0
151 #undef CYTHON_USE_EXC_INFO_STACK
152 #define CYTHON_USE_EXC_INFO_STACK 0
153 #else
154 #define CYTHON_COMPILING_IN_PYPY 0
155 #define CYTHON_COMPILING_IN_PYSTON 0
156 #define CYTHON_COMPILING_IN_CPYTHON 1
157 #ifndef CYTHON_USE_TYPE_SLOTS
158 #define CYTHON_USE_TYPE_SLOTS 1
159 #endif
160 #if PY_VERSION_HEX < 0x02070000
161 #undef CYTHON_USE_PYTYPE_LOOKUP
162 #define CYTHON_USE_PYTYPE_LOOKUP 0
163 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164 #define CYTHON_USE_PYTYPE_LOOKUP 1
165 #endif
166 #if PY_MAJOR_VERSION < 3
167 #undef CYTHON_USE_ASYNC_SLOTS
168 #define CYTHON_USE_ASYNC_SLOTS 0
169 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170 #define CYTHON_USE_ASYNC_SLOTS 1
171 #endif
172 #if PY_VERSION_HEX < 0x02070000
173 #undef CYTHON_USE_PYLONG_INTERNALS
174 #define CYTHON_USE_PYLONG_INTERNALS 0
175 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176 #define CYTHON_USE_PYLONG_INTERNALS 1
177 #endif
178 #ifndef CYTHON_USE_PYLIST_INTERNALS
179 #define CYTHON_USE_PYLIST_INTERNALS 1
180 #endif
181 #ifndef CYTHON_USE_UNICODE_INTERNALS
182 #define CYTHON_USE_UNICODE_INTERNALS 1
183 #endif
184 #if PY_VERSION_HEX < 0x030300F0
185 #undef CYTHON_USE_UNICODE_WRITER
186 #define CYTHON_USE_UNICODE_WRITER 0
187 #elif !defined(CYTHON_USE_UNICODE_WRITER)
188 #define CYTHON_USE_UNICODE_WRITER 1
189 #endif
190 #ifndef CYTHON_AVOID_BORROWED_REFS
191 #define CYTHON_AVOID_BORROWED_REFS 0
192 #endif
193 #ifndef CYTHON_ASSUME_SAFE_MACROS
194 #define CYTHON_ASSUME_SAFE_MACROS 1
195 #endif
196 #ifndef CYTHON_UNPACK_METHODS
197 #define CYTHON_UNPACK_METHODS 1
198 #endif
199 #ifndef CYTHON_FAST_THREAD_STATE
200 #define CYTHON_FAST_THREAD_STATE 1
201 #endif
202 #ifndef CYTHON_FAST_PYCALL
203 #define CYTHON_FAST_PYCALL 1
204 #endif
205 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
207 #endif
208 #ifndef CYTHON_USE_TP_FINALIZE
209 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
210 #endif
211 #ifndef CYTHON_USE_DICT_VERSIONS
212 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
213 #endif
214 #ifndef CYTHON_USE_EXC_INFO_STACK
215 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
216 #endif
217 #endif
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
220 #endif
221 #if CYTHON_USE_PYLONG_INTERNALS
222 #include "longintrepr.h"
223 #undef SHIFT
224 #undef BASE
225 #undef MASK
226 #ifdef SIZEOF_VOID_P
227 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
228 #endif
229 #endif
230 #ifndef __has_attribute
231 #define __has_attribute(x) 0
232 #endif
233 #ifndef __has_cpp_attribute
234 #define __has_cpp_attribute(x) 0
235 #endif
236 #ifndef CYTHON_RESTRICT
237 #if defined(__GNUC__)
238 #define CYTHON_RESTRICT __restrict__
239 #elif defined(_MSC_VER) && _MSC_VER >= 1400
240 #define CYTHON_RESTRICT __restrict
241 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242 #define CYTHON_RESTRICT restrict
243 #else
244 #define CYTHON_RESTRICT
245 #endif
246 #endif
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 # define CYTHON_UNUSED __attribute__ ((__unused__))
251 # else
252 # define CYTHON_UNUSED
253 # endif
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 # define CYTHON_UNUSED __attribute__ ((__unused__))
256 # else
257 # define CYTHON_UNUSED
258 # endif
259 #endif
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)262 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
263 # else
264 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
265 # endif
266 #endif
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 # define CYTHON_NCP_UNUSED
270 # else
271 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
272 # endif
273 #endif
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
275 #ifdef _MSC_VER
276 #ifndef _MSC_STDINT_H_
277 #if _MSC_VER < 1300
278 typedef unsigned char uint8_t;
279 typedef unsigned int uint32_t;
280 #else
281 typedef unsigned __int8 uint8_t;
282 typedef unsigned __int32 uint32_t;
283 #endif
284 #endif
285 #else
286 #include <stdint.h>
287 #endif
288 #ifndef CYTHON_FALLTHROUGH
289 #if defined(__cplusplus) && __cplusplus >= 201103L
290 #if __has_cpp_attribute(fallthrough)
291 #define CYTHON_FALLTHROUGH [[fallthrough]]
292 #elif __has_cpp_attribute(clang::fallthrough)
293 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294 #elif __has_cpp_attribute(gnu::fallthrough)
295 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
296 #endif
297 #endif
298 #ifndef CYTHON_FALLTHROUGH
299 #if __has_attribute(fallthrough)
300 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
301 #else
302 #define CYTHON_FALLTHROUGH
303 #endif
304 #endif
305 #if defined(__clang__ ) && defined(__apple_build_version__)
306 #if __apple_build_version__ < 7000000
307 #undef CYTHON_FALLTHROUGH
308 #define CYTHON_FALLTHROUGH
309 #endif
310 #endif
311 #endif
312
313 #ifndef CYTHON_INLINE
314 #if defined(__clang__)
315 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
316 #elif defined(__GNUC__)
317 #define CYTHON_INLINE __inline__
318 #elif defined(_MSC_VER)
319 #define CYTHON_INLINE __inline
320 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
321 #define CYTHON_INLINE inline
322 #else
323 #define CYTHON_INLINE
324 #endif
325 #endif
326
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328 #define Py_OptimizeFlag 0
329 #endif
330 #define __PYX_BUILD_PY_SSIZE_T "n"
331 #define CYTHON_FORMAT_SSIZE_T "z"
332 #if PY_MAJOR_VERSION < 3
333 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
334 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
335 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
336 #define __Pyx_DefaultClassType PyClass_Type
337 #else
338 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
339 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
340 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
342 #else
343 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
345 #endif
346 #define __Pyx_DefaultClassType PyType_Type
347 #endif
348 #ifndef Py_TPFLAGS_CHECKTYPES
349 #define Py_TPFLAGS_CHECKTYPES 0
350 #endif
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352 #define Py_TPFLAGS_HAVE_INDEX 0
353 #endif
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
356 #endif
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358 #define Py_TPFLAGS_HAVE_FINALIZE 0
359 #endif
360 #ifndef METH_STACKLESS
361 #define METH_STACKLESS 0
362 #endif
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364 #ifndef METH_FASTCALL
365 #define METH_FASTCALL 0x80
366 #endif
367 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
368 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
369 Py_ssize_t nargs, PyObject *kwnames);
370 #else
371 #define __Pyx_PyCFunctionFast _PyCFunctionFast
372 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
373 #endif
374 #if CYTHON_FAST_PYCCALL
375 #define __Pyx_PyFastCFunction_Check(func)\
376 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
377 #else
378 #define __Pyx_PyFastCFunction_Check(func) 0
379 #endif
380 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
381 #define PyObject_Malloc(s) PyMem_Malloc(s)
382 #define PyObject_Free(p) PyMem_Free(p)
383 #define PyObject_Realloc(p) PyMem_Realloc(p)
384 #endif
385 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
386 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
387 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
388 #define PyMem_RawFree(p) PyMem_Free(p)
389 #endif
390 #if CYTHON_COMPILING_IN_PYSTON
391 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
392 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
393 #else
394 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
395 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
396 #endif
397 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
398 #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #elif PY_VERSION_HEX >= 0x03060000
400 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
401 #elif PY_VERSION_HEX >= 0x03000000
402 #define __Pyx_PyThreadState_Current PyThreadState_GET()
403 #else
404 #define __Pyx_PyThreadState_Current _PyThreadState_Current
405 #endif
406 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
407 #include "pythread.h"
408 #define Py_tss_NEEDS_INIT 0
409 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)410 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
411 *key = PyThread_create_key();
412 return 0;
413 }
PyThread_tss_alloc(void)414 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
415 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
416 *key = Py_tss_NEEDS_INIT;
417 return key;
418 }
PyThread_tss_free(Py_tss_t * key)419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
420 PyObject_Free(key);
421 }
PyThread_tss_is_created(Py_tss_t * key)422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423 return *key != Py_tss_NEEDS_INIT;
424 }
PyThread_tss_delete(Py_tss_t * key)425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426 PyThread_delete_key(*key);
427 *key = Py_tss_NEEDS_INIT;
428 }
PyThread_tss_set(Py_tss_t * key,void * value)429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430 return PyThread_set_key_value(*key, value);
431 }
PyThread_tss_get(Py_tss_t * key)432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433 return PyThread_get_key_value(*key);
434 }
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
438 #else
439 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
440 #endif
441 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
442 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
443 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
444 #else
445 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
446 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
447 #endif
448 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
449 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
450 #else
451 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
452 #endif
453 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
454 #define CYTHON_PEP393_ENABLED 1
455 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
456 0 : _PyUnicode_Ready((PyObject *)(op)))
457 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
458 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
459 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
460 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
461 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
462 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
463 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
464 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
465 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
466 #else
467 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
468 #endif
469 #else
470 #define CYTHON_PEP393_ENABLED 0
471 #define PyUnicode_1BYTE_KIND 1
472 #define PyUnicode_2BYTE_KIND 2
473 #define PyUnicode_4BYTE_KIND 4
474 #define __Pyx_PyUnicode_READY(op) (0)
475 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
476 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
477 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
478 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
479 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
480 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
481 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
482 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
483 #endif
484 #if CYTHON_COMPILING_IN_PYPY
485 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
486 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
487 #else
488 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
489 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
490 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
491 #endif
492 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
493 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
494 #endif
495 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
496 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
497 #endif
498 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
499 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
500 #endif
501 #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))
502 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
503 #if PY_MAJOR_VERSION >= 3
504 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
505 #else
506 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
507 #endif
508 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
509 #define PyObject_ASCII(o) PyObject_Repr(o)
510 #endif
511 #if PY_MAJOR_VERSION >= 3
512 #define PyBaseString_Type PyUnicode_Type
513 #define PyStringObject PyUnicodeObject
514 #define PyString_Type PyUnicode_Type
515 #define PyString_Check PyUnicode_Check
516 #define PyString_CheckExact PyUnicode_CheckExact
517 #ifndef PyObject_Unicode
518 #define PyObject_Unicode PyObject_Str
519 #endif
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
523 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
524 #else
525 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
526 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
527 #endif
528 #ifndef PySet_CheckExact
529 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
530 #endif
531 #if PY_VERSION_HEX >= 0x030900A4
532 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
533 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
534 #else
535 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
536 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
537 #endif
538 #if CYTHON_ASSUME_SAFE_MACROS
539 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
540 #else
541 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
542 #endif
543 #if PY_MAJOR_VERSION >= 3
544 #define PyIntObject PyLongObject
545 #define PyInt_Type PyLong_Type
546 #define PyInt_Check(op) PyLong_Check(op)
547 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
548 #define PyInt_FromString PyLong_FromString
549 #define PyInt_FromUnicode PyLong_FromUnicode
550 #define PyInt_FromLong PyLong_FromLong
551 #define PyInt_FromSize_t PyLong_FromSize_t
552 #define PyInt_FromSsize_t PyLong_FromSsize_t
553 #define PyInt_AsLong PyLong_AsLong
554 #define PyInt_AS_LONG PyLong_AS_LONG
555 #define PyInt_AsSsize_t PyLong_AsSsize_t
556 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
557 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
558 #define PyNumber_Int PyNumber_Long
559 #endif
560 #if PY_MAJOR_VERSION >= 3
561 #define PyBoolObject PyLongObject
562 #endif
563 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
564 #ifndef PyUnicode_InternFromString
565 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
566 #endif
567 #endif
568 #if PY_VERSION_HEX < 0x030200A4
569 typedef long Py_hash_t;
570 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
571 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
572 #else
573 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
574 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
575 #endif
576 #if PY_MAJOR_VERSION >= 3
577 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
578 #else
579 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
580 #endif
581 #if CYTHON_USE_ASYNC_SLOTS
582 #if PY_VERSION_HEX >= 0x030500B1
583 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
584 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
585 #else
586 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
587 #endif
588 #else
589 #define __Pyx_PyType_AsAsync(obj) NULL
590 #endif
591 #ifndef __Pyx_PyAsyncMethodsStruct
592 typedef struct {
593 unaryfunc am_await;
594 unaryfunc am_aiter;
595 unaryfunc am_anext;
596 } __Pyx_PyAsyncMethodsStruct;
597 #endif
598
599 #if defined(WIN32) || defined(MS_WINDOWS)
600 #define _USE_MATH_DEFINES
601 #endif
602 #include <math.h>
603 #ifdef NAN
604 #define __PYX_NAN() ((float) NAN)
605 #else
__PYX_NAN()606 static CYTHON_INLINE float __PYX_NAN() {
607 float value;
608 memset(&value, 0xFF, sizeof(value));
609 return value;
610 }
611 #endif
612 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
613 #define __Pyx_truncl trunc
614 #else
615 #define __Pyx_truncl truncl
616 #endif
617
618 #define __PYX_MARK_ERR_POS(f_index, lineno) \
619 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
620 #define __PYX_ERR(f_index, lineno, Ln_error) \
621 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
622
623 #ifndef __PYX_EXTERN_C
624 #ifdef __cplusplus
625 #define __PYX_EXTERN_C extern "C"
626 #else
627 #define __PYX_EXTERN_C extern
628 #endif
629 #endif
630
631 #define __PYX_HAVE__rasterio___example
632 #define __PYX_HAVE_API__rasterio___example
633 /* Early includes */
634 #include "pythread.h"
635 #include <string.h>
636 #include <stdlib.h>
637 #include <stdio.h>
638 #include "pystate.h"
639 #ifdef _OPENMP
640 #include <omp.h>
641 #endif /* _OPENMP */
642
643 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
644 #define CYTHON_WITHOUT_ASSERTIONS
645 #endif
646
647 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
648 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
649
650 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
651 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
652 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
653 #define __PYX_DEFAULT_STRING_ENCODING ""
654 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
655 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
656 #define __Pyx_uchar_cast(c) ((unsigned char)c)
657 #define __Pyx_long_cast(x) ((long)x)
658 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
659 (sizeof(type) < sizeof(Py_ssize_t)) ||\
660 (sizeof(type) > sizeof(Py_ssize_t) &&\
661 likely(v < (type)PY_SSIZE_T_MAX ||\
662 v == (type)PY_SSIZE_T_MAX) &&\
663 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
664 v == (type)PY_SSIZE_T_MIN))) ||\
665 (sizeof(type) == sizeof(Py_ssize_t) &&\
666 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
667 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)668 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
669 return (size_t) i < (size_t) limit;
670 }
671 #if defined (__cplusplus) && __cplusplus >= 201103L
672 #include <cstdlib>
673 #define __Pyx_sst_abs(value) std::abs(value)
674 #elif SIZEOF_INT >= SIZEOF_SIZE_T
675 #define __Pyx_sst_abs(value) abs(value)
676 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
677 #define __Pyx_sst_abs(value) labs(value)
678 #elif defined (_MSC_VER)
679 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
680 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
681 #define __Pyx_sst_abs(value) llabs(value)
682 #elif defined (__GNUC__)
683 #define __Pyx_sst_abs(value) __builtin_llabs(value)
684 #else
685 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
686 #endif
687 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
688 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
689 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
690 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
691 #define __Pyx_PyBytes_FromString PyBytes_FromString
692 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
693 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
694 #if PY_MAJOR_VERSION < 3
695 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
696 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
697 #else
698 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
699 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
700 #endif
701 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
702 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
703 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
704 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
705 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
706 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
707 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
708 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
709 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
710 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
711 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
712 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
713 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
714 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
715 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
716 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)717 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
718 const Py_UNICODE *u_end = u;
719 while (*u_end++) ;
720 return (size_t)(u_end - u - 1);
721 }
722 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
723 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
724 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
725 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
726 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
727 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
728 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
729 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
730 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
731 #define __Pyx_PySequence_Tuple(obj)\
732 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
733 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
734 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
735 #if CYTHON_ASSUME_SAFE_MACROS
736 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
737 #else
738 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
739 #endif
740 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
741 #if PY_MAJOR_VERSION >= 3
742 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
743 #else
744 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
745 #endif
746 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
747 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
748 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)749 static int __Pyx_init_sys_getdefaultencoding_params(void) {
750 PyObject* sys;
751 PyObject* default_encoding = NULL;
752 PyObject* ascii_chars_u = NULL;
753 PyObject* ascii_chars_b = NULL;
754 const char* default_encoding_c;
755 sys = PyImport_ImportModule("sys");
756 if (!sys) goto bad;
757 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
758 Py_DECREF(sys);
759 if (!default_encoding) goto bad;
760 default_encoding_c = PyBytes_AsString(default_encoding);
761 if (!default_encoding_c) goto bad;
762 if (strcmp(default_encoding_c, "ascii") == 0) {
763 __Pyx_sys_getdefaultencoding_not_ascii = 0;
764 } else {
765 char ascii_chars[128];
766 int c;
767 for (c = 0; c < 128; c++) {
768 ascii_chars[c] = c;
769 }
770 __Pyx_sys_getdefaultencoding_not_ascii = 1;
771 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
772 if (!ascii_chars_u) goto bad;
773 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
774 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
775 PyErr_Format(
776 PyExc_ValueError,
777 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
778 default_encoding_c);
779 goto bad;
780 }
781 Py_DECREF(ascii_chars_u);
782 Py_DECREF(ascii_chars_b);
783 }
784 Py_DECREF(default_encoding);
785 return 0;
786 bad:
787 Py_XDECREF(default_encoding);
788 Py_XDECREF(ascii_chars_u);
789 Py_XDECREF(ascii_chars_b);
790 return -1;
791 }
792 #endif
793 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
794 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
795 #else
796 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
797 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
798 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)799 static int __Pyx_init_sys_getdefaultencoding_params(void) {
800 PyObject* sys;
801 PyObject* default_encoding = NULL;
802 char* default_encoding_c;
803 sys = PyImport_ImportModule("sys");
804 if (!sys) goto bad;
805 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
806 Py_DECREF(sys);
807 if (!default_encoding) goto bad;
808 default_encoding_c = PyBytes_AsString(default_encoding);
809 if (!default_encoding_c) goto bad;
810 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
811 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
812 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
813 Py_DECREF(default_encoding);
814 return 0;
815 bad:
816 Py_XDECREF(default_encoding);
817 return -1;
818 }
819 #endif
820 #endif
821
822
823 /* Test for GCC > 2.95 */
824 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
825 #define likely(x) __builtin_expect(!!(x), 1)
826 #define unlikely(x) __builtin_expect(!!(x), 0)
827 #else /* !__GNUC__ or GCC < 2.95 */
828 #define likely(x) (x)
829 #define unlikely(x) (x)
830 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)831 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
832
833 static PyObject *__pyx_m = NULL;
834 static PyObject *__pyx_d;
835 static PyObject *__pyx_b;
836 static PyObject *__pyx_cython_runtime = NULL;
837 static PyObject *__pyx_empty_tuple;
838 static PyObject *__pyx_empty_bytes;
839 static PyObject *__pyx_empty_unicode;
840 static int __pyx_lineno;
841 static int __pyx_clineno = 0;
842 static const char * __pyx_cfilenm= __FILE__;
843 static const char *__pyx_filename;
844
845
846 static const char *__pyx_f[] = {
847 "rasterio/_example.pyx",
848 "stringsource",
849 };
850 /* NoFastGil.proto */
851 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
852 #define __Pyx_PyGILState_Release PyGILState_Release
853 #define __Pyx_FastGIL_Remember()
854 #define __Pyx_FastGIL_Forget()
855 #define __Pyx_FastGilFuncInit()
856
857 /* MemviewSliceStruct.proto */
858 struct __pyx_memoryview_obj;
859 typedef struct {
860 struct __pyx_memoryview_obj *memview;
861 char *data;
862 Py_ssize_t shape[8];
863 Py_ssize_t strides[8];
864 Py_ssize_t suboffsets[8];
865 } __Pyx_memviewslice;
866 #define __Pyx_MemoryView_Len(m) (m.shape[0])
867
868 /* Atomics.proto */
869 #include <pythread.h>
870 #ifndef CYTHON_ATOMICS
871 #define CYTHON_ATOMICS 1
872 #endif
873 #define __pyx_atomic_int_type int
874 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
875 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
876 !defined(__i386__)
877 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
878 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
879 #ifdef __PYX_DEBUG_ATOMICS
880 #warning "Using GNU atomics"
881 #endif
882 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
883 #include <Windows.h>
884 #undef __pyx_atomic_int_type
885 #define __pyx_atomic_int_type LONG
886 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
887 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
888 #ifdef __PYX_DEBUG_ATOMICS
889 #pragma message ("Using MSVC atomics")
890 #endif
891 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
892 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
893 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
894 #ifdef __PYX_DEBUG_ATOMICS
895 #warning "Using Intel atomics"
896 #endif
897 #else
898 #undef CYTHON_ATOMICS
899 #define CYTHON_ATOMICS 0
900 #ifdef __PYX_DEBUG_ATOMICS
901 #warning "Not using atomics"
902 #endif
903 #endif
904 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
905 #if CYTHON_ATOMICS
906 #define __pyx_add_acquisition_count(memview)\
907 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
908 #define __pyx_sub_acquisition_count(memview)\
909 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
910 #else
911 #define __pyx_add_acquisition_count(memview)\
912 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
913 #define __pyx_sub_acquisition_count(memview)\
914 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
915 #endif
916
917 /* ForceInitThreads.proto */
918 #ifndef __PYX_FORCE_INIT_THREADS
919 #define __PYX_FORCE_INIT_THREADS 0
920 #endif
921
922 /* BufferFormatStructs.proto */
923 #define IS_UNSIGNED(type) (((type) -1) > 0)
924 struct __Pyx_StructField_;
925 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
926 typedef struct {
927 const char* name;
928 struct __Pyx_StructField_* fields;
929 size_t size;
930 size_t arraysize[8];
931 int ndim;
932 char typegroup;
933 char is_unsigned;
934 int flags;
935 } __Pyx_TypeInfo;
936 typedef struct __Pyx_StructField_ {
937 __Pyx_TypeInfo* type;
938 const char* name;
939 size_t offset;
940 } __Pyx_StructField;
941 typedef struct {
942 __Pyx_StructField* field;
943 size_t parent_offset;
944 } __Pyx_BufFmt_StackElem;
945 typedef struct {
946 __Pyx_StructField root;
947 __Pyx_BufFmt_StackElem* head;
948 size_t fmt_offset;
949 size_t new_count, enc_count;
950 size_t struct_alignment;
951 int is_complex;
952 char enc_type;
953 char new_packmode;
954 char enc_packmode;
955 char is_valid_array;
956 } __Pyx_BufFmt_Context;
957
958
959 /*--- Type declarations ---*/
960 struct __pyx_array_obj;
961 struct __pyx_MemviewEnum_obj;
962 struct __pyx_memoryview_obj;
963 struct __pyx_memoryviewslice_obj;
964
965 /* "View.MemoryView":105
966 *
967 * @cname("__pyx_array")
968 * cdef class array: # <<<<<<<<<<<<<<
969 *
970 * cdef:
971 */
972 struct __pyx_array_obj {
973 PyObject_HEAD
974 struct __pyx_vtabstruct_array *__pyx_vtab;
975 char *data;
976 Py_ssize_t len;
977 char *format;
978 int ndim;
979 Py_ssize_t *_shape;
980 Py_ssize_t *_strides;
981 Py_ssize_t itemsize;
982 PyObject *mode;
983 PyObject *_format;
984 void (*callback_free_data)(void *);
985 int free_data;
986 int dtype_is_object;
987 };
988
989
990 /* "View.MemoryView":279
991 *
992 * @cname('__pyx_MemviewEnum')
993 * cdef class Enum(object): # <<<<<<<<<<<<<<
994 * cdef object name
995 * def __init__(self, name):
996 */
997 struct __pyx_MemviewEnum_obj {
998 PyObject_HEAD
999 PyObject *name;
1000 };
1001
1002
1003 /* "View.MemoryView":330
1004 *
1005 * @cname('__pyx_memoryview')
1006 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1007 *
1008 * cdef object obj
1009 */
1010 struct __pyx_memoryview_obj {
1011 PyObject_HEAD
1012 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1013 PyObject *obj;
1014 PyObject *_size;
1015 PyObject *_array_interface;
1016 PyThread_type_lock lock;
1017 __pyx_atomic_int acquisition_count[2];
1018 __pyx_atomic_int *acquisition_count_aligned_p;
1019 Py_buffer view;
1020 int flags;
1021 int dtype_is_object;
1022 __Pyx_TypeInfo *typeinfo;
1023 };
1024
1025
1026 /* "View.MemoryView":965
1027 *
1028 * @cname('__pyx_memoryviewslice')
1029 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1030 * "Internal class for passing memoryview slices to Python"
1031 *
1032 */
1033 struct __pyx_memoryviewslice_obj {
1034 struct __pyx_memoryview_obj __pyx_base;
1035 __Pyx_memviewslice from_slice;
1036 PyObject *from_object;
1037 PyObject *(*to_object_func)(char *);
1038 int (*to_dtype_func)(char *, PyObject *);
1039 };
1040
1041
1042
1043 /* "View.MemoryView":105
1044 *
1045 * @cname("__pyx_array")
1046 * cdef class array: # <<<<<<<<<<<<<<
1047 *
1048 * cdef:
1049 */
1050
1051 struct __pyx_vtabstruct_array {
1052 PyObject *(*get_memview)(struct __pyx_array_obj *);
1053 };
1054 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1055
1056
1057 /* "View.MemoryView":330
1058 *
1059 * @cname('__pyx_memoryview')
1060 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1061 *
1062 * cdef object obj
1063 */
1064
1065 struct __pyx_vtabstruct_memoryview {
1066 char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1067 PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1068 PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1069 PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1070 PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1071 PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1072 PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1073 };
1074 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1075
1076
1077 /* "View.MemoryView":965
1078 *
1079 * @cname('__pyx_memoryviewslice')
1080 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1081 * "Internal class for passing memoryview slices to Python"
1082 *
1083 */
1084
1085 struct __pyx_vtabstruct__memoryviewslice {
1086 struct __pyx_vtabstruct_memoryview __pyx_base;
1087 };
1088 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1089
1090 /* --- Runtime support code (head) --- */
1091 /* Refnanny.proto */
1092 #ifndef CYTHON_REFNANNY
1093 #define CYTHON_REFNANNY 0
1094 #endif
1095 #if CYTHON_REFNANNY
1096 typedef struct {
1097 void (*INCREF)(void*, PyObject*, int);
1098 void (*DECREF)(void*, PyObject*, int);
1099 void (*GOTREF)(void*, PyObject*, int);
1100 void (*GIVEREF)(void*, PyObject*, int);
1101 void* (*SetupContext)(const char*, int, const char*);
1102 void (*FinishContext)(void**);
1103 } __Pyx_RefNannyAPIStruct;
1104 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1105 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1106 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1107 #ifdef WITH_THREAD
1108 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1109 if (acquire_gil) {\
1110 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1111 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1112 PyGILState_Release(__pyx_gilstate_save);\
1113 } else {\
1114 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1115 }
1116 #else
1117 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1118 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1119 #endif
1120 #define __Pyx_RefNannyFinishContext()\
1121 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1122 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1123 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1124 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1125 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1126 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1127 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1128 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1129 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1130 #else
1131 #define __Pyx_RefNannyDeclarations
1132 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1133 #define __Pyx_RefNannyFinishContext()
1134 #define __Pyx_INCREF(r) Py_INCREF(r)
1135 #define __Pyx_DECREF(r) Py_DECREF(r)
1136 #define __Pyx_GOTREF(r)
1137 #define __Pyx_GIVEREF(r)
1138 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1139 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1140 #define __Pyx_XGOTREF(r)
1141 #define __Pyx_XGIVEREF(r)
1142 #endif
1143 #define __Pyx_XDECREF_SET(r, v) do {\
1144 PyObject *tmp = (PyObject *) r;\
1145 r = v; __Pyx_XDECREF(tmp);\
1146 } while (0)
1147 #define __Pyx_DECREF_SET(r, v) do {\
1148 PyObject *tmp = (PyObject *) r;\
1149 r = v; __Pyx_DECREF(tmp);\
1150 } while (0)
1151 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1152 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1153
1154 /* PyObjectGetAttrStr.proto */
1155 #if CYTHON_USE_TYPE_SLOTS
1156 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1157 #else
1158 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1159 #endif
1160
1161 /* GetBuiltinName.proto */
1162 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1163
1164 /* PyDictVersioning.proto */
1165 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1166 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1167 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1168 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1169 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1170 (cache_var) = (value);
1171 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1172 static PY_UINT64_T __pyx_dict_version = 0;\
1173 static PyObject *__pyx_dict_cached_value = NULL;\
1174 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1175 (VAR) = __pyx_dict_cached_value;\
1176 } else {\
1177 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1178 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1179 }\
1180 }
1181 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1182 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1183 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1184 #else
1185 #define __PYX_GET_DICT_VERSION(dict) (0)
1186 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1187 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1188 #endif
1189
1190 /* GetModuleGlobalName.proto */
1191 #if CYTHON_USE_DICT_VERSIONS
1192 #define __Pyx_GetModuleGlobalName(var, name) {\
1193 static PY_UINT64_T __pyx_dict_version = 0;\
1194 static PyObject *__pyx_dict_cached_value = NULL;\
1195 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1196 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1197 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1198 }
1199 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1200 PY_UINT64_T __pyx_dict_version;\
1201 PyObject *__pyx_dict_cached_value;\
1202 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1203 }
1204 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1205 #else
1206 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1207 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1208 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1209 #endif
1210
1211 /* PyObjectCall.proto */
1212 #if CYTHON_COMPILING_IN_CPYTHON
1213 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1214 #else
1215 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1216 #endif
1217
1218 /* MemviewSliceInit.proto */
1219 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1220 #define __Pyx_MEMVIEW_DIRECT 1
1221 #define __Pyx_MEMVIEW_PTR 2
1222 #define __Pyx_MEMVIEW_FULL 4
1223 #define __Pyx_MEMVIEW_CONTIG 8
1224 #define __Pyx_MEMVIEW_STRIDED 16
1225 #define __Pyx_MEMVIEW_FOLLOW 32
1226 #define __Pyx_IS_C_CONTIG 1
1227 #define __Pyx_IS_F_CONTIG 2
1228 static int __Pyx_init_memviewslice(
1229 struct __pyx_memoryview_obj *memview,
1230 int ndim,
1231 __Pyx_memviewslice *memviewslice,
1232 int memview_is_new_reference);
1233 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1234 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1235 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1236 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1237 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1238 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1239 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1240 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1241 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1242 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1243
1244 /* RaiseArgTupleInvalid.proto */
1245 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1246 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1247
1248 /* RaiseDoubleKeywords.proto */
1249 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1250
1251 /* ParseKeywords.proto */
1252 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1253 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1254 const char* function_name);
1255
1256 /* ArgTypeTest.proto */
1257 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1258 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1259 __Pyx__ArgTypeTest(obj, type, name, exact))
1260 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1261
1262 /* PyThreadStateGet.proto */
1263 #if CYTHON_FAST_THREAD_STATE
1264 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1265 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1266 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1267 #else
1268 #define __Pyx_PyThreadState_declare
1269 #define __Pyx_PyThreadState_assign
1270 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1271 #endif
1272
1273 /* PyErrFetchRestore.proto */
1274 #if CYTHON_FAST_THREAD_STATE
1275 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1276 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1277 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1278 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1279 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1280 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1281 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1282 #if CYTHON_COMPILING_IN_CPYTHON
1283 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1284 #else
1285 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1286 #endif
1287 #else
1288 #define __Pyx_PyErr_Clear() PyErr_Clear()
1289 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1290 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1291 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1292 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1293 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1294 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1295 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1296 #endif
1297
1298 /* RaiseException.proto */
1299 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1300
1301 /* PyCFunctionFastCall.proto */
1302 #if CYTHON_FAST_PYCCALL
1303 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1304 #else
1305 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1306 #endif
1307
1308 /* PyFunctionFastCall.proto */
1309 #if CYTHON_FAST_PYCALL
1310 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1311 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1312 #if 1 || PY_VERSION_HEX < 0x030600B1
1313 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1314 #else
1315 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1316 #endif
1317 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1318 (sizeof(char [1 - 2*!(cond)]) - 1)
1319 #ifndef Py_MEMBER_SIZE
1320 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1321 #endif
1322 static size_t __pyx_pyframe_localsplus_offset = 0;
1323 #include "frameobject.h"
1324 #define __Pxy_PyFrame_Initialize_Offsets()\
1325 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1326 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1327 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1328 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1329 #endif
1330
1331 /* PyObjectCall2Args.proto */
1332 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1333
1334 /* PyObjectCallMethO.proto */
1335 #if CYTHON_COMPILING_IN_CPYTHON
1336 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1337 #endif
1338
1339 /* PyObjectCallOneArg.proto */
1340 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1341
1342 /* IncludeStringH.proto */
1343 #include <string.h>
1344
1345 /* BytesEquals.proto */
1346 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1347
1348 /* UnicodeEquals.proto */
1349 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1350
1351 /* StrEquals.proto */
1352 #if PY_MAJOR_VERSION >= 3
1353 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1354 #else
1355 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1356 #endif
1357
1358 /* None.proto */
1359 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1360
1361 /* UnaryNegOverflows.proto */
1362 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1363 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1364
1365 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1366 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1367 /* GetAttr.proto */
1368 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1369
1370 /* GetItemInt.proto */
1371 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1372 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1373 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1374 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1375 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1376 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1377 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1378 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1379 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1380 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1381 int wraparound, int boundscheck);
1382 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1383 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1384 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1385 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1386 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1387 int wraparound, int boundscheck);
1388 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1389 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1390 int is_list, int wraparound, int boundscheck);
1391
1392 /* ObjectGetItem.proto */
1393 #if CYTHON_USE_TYPE_SLOTS
1394 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1395 #else
1396 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1397 #endif
1398
1399 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1400 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1401 int byteorder = 0;
1402 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1403 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1404 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1405 int byteorder = -1;
1406 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1407 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1408 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1409 int byteorder = 1;
1410 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1411 }
1412
1413 /* decode_c_string.proto */
1414 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1415 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1416 const char* encoding, const char* errors,
1417 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1418
1419 /* PyErrExceptionMatches.proto */
1420 #if CYTHON_FAST_THREAD_STATE
1421 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1422 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1423 #else
1424 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1425 #endif
1426
1427 /* GetAttr3.proto */
1428 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1429
1430 /* RaiseTooManyValuesToUnpack.proto */
1431 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1432
1433 /* RaiseNeedMoreValuesToUnpack.proto */
1434 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1435
1436 /* RaiseNoneIterError.proto */
1437 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1438
1439 /* ExtTypeTest.proto */
1440 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1441
1442 /* GetTopmostException.proto */
1443 #if CYTHON_USE_EXC_INFO_STACK
1444 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1445 #endif
1446
1447 /* SaveResetException.proto */
1448 #if CYTHON_FAST_THREAD_STATE
1449 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1450 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1451 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1452 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1453 #else
1454 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1455 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1456 #endif
1457
1458 /* GetException.proto */
1459 #if CYTHON_FAST_THREAD_STATE
1460 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1461 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1462 #else
1463 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1464 #endif
1465
1466 /* SwapException.proto */
1467 #if CYTHON_FAST_THREAD_STATE
1468 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1469 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1470 #else
1471 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1472 #endif
1473
1474 /* Import.proto */
1475 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1476
1477 /* FastTypeChecks.proto */
1478 #if CYTHON_COMPILING_IN_CPYTHON
1479 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1480 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1481 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1482 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1483 #else
1484 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1485 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1486 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1487 #endif
1488 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1489
1490 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1491 /* ListCompAppend.proto */
1492 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1493 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1494 PyListObject* L = (PyListObject*) list;
1495 Py_ssize_t len = Py_SIZE(list);
1496 if (likely(L->allocated > len)) {
1497 Py_INCREF(x);
1498 PyList_SET_ITEM(list, len, x);
1499 __Pyx_SET_SIZE(list, len + 1);
1500 return 0;
1501 }
1502 return PyList_Append(list, x);
1503 }
1504 #else
1505 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1506 #endif
1507
1508 /* PyIntBinop.proto */
1509 #if !CYTHON_COMPILING_IN_PYPY
1510 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1511 #else
1512 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1513 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1514 #endif
1515
1516 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1517 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1518 #if CYTHON_COMPILING_IN_CPYTHON
1519 PyObject* none = _PyList_Extend((PyListObject*)L, v);
1520 if (unlikely(!none))
1521 return -1;
1522 Py_DECREF(none);
1523 return 0;
1524 #else
1525 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1526 #endif
1527 }
1528
1529 /* ListAppend.proto */
1530 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1531 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1532 PyListObject* L = (PyListObject*) list;
1533 Py_ssize_t len = Py_SIZE(list);
1534 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1535 Py_INCREF(x);
1536 PyList_SET_ITEM(list, len, x);
1537 __Pyx_SET_SIZE(list, len + 1);
1538 return 0;
1539 }
1540 return PyList_Append(list, x);
1541 }
1542 #else
1543 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1544 #endif
1545
1546 /* None.proto */
1547 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1548
1549 /* None.proto */
1550 static CYTHON_INLINE long __Pyx_div_long(long, long);
1551
1552 /* ImportFrom.proto */
1553 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1554
1555 /* HasAttr.proto */
1556 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1557
1558 /* PyObject_GenericGetAttrNoDict.proto */
1559 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1560 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1561 #else
1562 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1563 #endif
1564
1565 /* PyObject_GenericGetAttr.proto */
1566 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1567 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1568 #else
1569 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1570 #endif
1571
1572 /* SetVTable.proto */
1573 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1574
1575 /* PyObjectGetAttrStrNoError.proto */
1576 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1577
1578 /* SetupReduce.proto */
1579 static int __Pyx_setup_reduce(PyObject* type_obj);
1580
1581 /* CLineInTraceback.proto */
1582 #ifdef CYTHON_CLINE_IN_TRACEBACK
1583 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1584 #else
1585 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1586 #endif
1587
1588 /* CodeObjectCache.proto */
1589 typedef struct {
1590 PyCodeObject* code_object;
1591 int code_line;
1592 } __Pyx_CodeObjectCacheEntry;
1593 struct __Pyx_CodeObjectCache {
1594 int count;
1595 int max_count;
1596 __Pyx_CodeObjectCacheEntry* entries;
1597 };
1598 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1599 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1600 static PyCodeObject *__pyx_find_code_object(int code_line);
1601 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1602
1603 /* AddTraceback.proto */
1604 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1605 int py_line, const char *filename);
1606
1607 #if PY_MAJOR_VERSION < 3
1608 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1609 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1610 #else
1611 #define __Pyx_GetBuffer PyObject_GetBuffer
1612 #define __Pyx_ReleaseBuffer PyBuffer_Release
1613 #endif
1614
1615
1616 /* BufferStructDeclare.proto */
1617 typedef struct {
1618 Py_ssize_t shape, strides, suboffsets;
1619 } __Pyx_Buf_DimInfo;
1620 typedef struct {
1621 size_t refcount;
1622 Py_buffer pybuffer;
1623 } __Pyx_Buffer;
1624 typedef struct {
1625 __Pyx_Buffer *rcbuffer;
1626 char *data;
1627 __Pyx_Buf_DimInfo diminfo[8];
1628 } __Pyx_LocalBuf_ND;
1629
1630 /* MemviewSliceIsContig.proto */
1631 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
1632
1633 /* OverlappingSlices.proto */
1634 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1635 __Pyx_memviewslice *slice2,
1636 int ndim, size_t itemsize);
1637
1638 /* Capsule.proto */
1639 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
1640
1641 /* IsLittleEndian.proto */
1642 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1643
1644 /* BufferFormatCheck.proto */
1645 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1646 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1647 __Pyx_BufFmt_StackElem* stack,
1648 __Pyx_TypeInfo* type);
1649
1650 /* TypeInfoCompare.proto */
1651 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
1652
1653 /* MemviewSliceValidateAndInit.proto */
1654 static int __Pyx_ValidateAndInit_memviewslice(
1655 int *axes_specs,
1656 int c_or_f_flag,
1657 int buf_flags,
1658 int ndim,
1659 __Pyx_TypeInfo *dtype,
1660 __Pyx_BufFmt_StackElem stack[],
1661 __Pyx_memviewslice *memviewslice,
1662 PyObject *original_obj);
1663
1664 /* ObjectToMemviewSlice.proto */
1665 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(PyObject *, int writable_flag);
1666
1667 /* CIntToPy.proto */
1668 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1669
1670 /* MemviewSliceCopyTemplate.proto */
1671 static __Pyx_memviewslice
1672 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
1673 const char *mode, int ndim,
1674 size_t sizeof_dtype, int contig_flag,
1675 int dtype_is_object);
1676
1677 /* CIntFromPy.proto */
1678 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1679
1680 /* CIntFromPy.proto */
1681 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1682
1683 /* CIntToPy.proto */
1684 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1685
1686 /* CIntFromPy.proto */
1687 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
1688
1689 /* CheckBinaryVersion.proto */
1690 static int __Pyx_check_binary_version(void);
1691
1692 /* InitStrings.proto */
1693 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1694
1695 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
1696 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
1697 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
1698 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
1699 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*/
1700 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
1701 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
1702 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
1703 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
1704 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
1705
1706 /* Module declarations from 'rasterio._example' */
1707 static PyTypeObject *__pyx_array_type = 0;
1708 static PyTypeObject *__pyx_MemviewEnum_type = 0;
1709 static PyTypeObject *__pyx_memoryview_type = 0;
1710 static PyTypeObject *__pyx_memoryviewslice_type = 0;
1711 static PyObject *generic = 0;
1712 static PyObject *strided = 0;
1713 static PyObject *indirect = 0;
1714 static PyObject *contiguous = 0;
1715 static PyObject *indirect_contiguous = 0;
1716 static int __pyx_memoryview_thread_locks_used;
1717 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
1718 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
1719 static void *__pyx_align_pointer(void *, size_t); /*proto*/
1720 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
1721 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
1722 static PyObject *_unellipsify(PyObject *, int); /*proto*/
1723 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
1724 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
1725 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*/
1726 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
1727 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
1728 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
1729 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
1730 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
1731 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
1732 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
1733 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
1734 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
1735 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
1736 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
1737 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
1738 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
1739 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
1740 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
1741 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
1742 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
1743 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
1744 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
1745 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
1746 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
1747 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
1748 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
1749 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
1750 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
1751 static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char = { "unsigned char", NULL, sizeof(unsigned char), { 0 }, 0, IS_UNSIGNED(unsigned char) ? 'U' : 'I', IS_UNSIGNED(unsigned char), 0 };
1752 #define __Pyx_MODULE_NAME "rasterio._example"
1753 extern int __pyx_module_is_main_rasterio___example;
1754 int __pyx_module_is_main_rasterio___example = 0;
1755
1756 /* Implementation of 'rasterio._example' */
1757 static PyObject *__pyx_builtin_range;
1758 static PyObject *__pyx_builtin_ValueError;
1759 static PyObject *__pyx_builtin_MemoryError;
1760 static PyObject *__pyx_builtin_enumerate;
1761 static PyObject *__pyx_builtin_TypeError;
1762 static PyObject *__pyx_builtin_Ellipsis;
1763 static PyObject *__pyx_builtin_id;
1764 static PyObject *__pyx_builtin_IndexError;
1765 static const char __pyx_k_I[] = "I";
1766 static const char __pyx_k_J[] = "J";
1767 static const char __pyx_k_K[] = "K";
1768 static const char __pyx_k_O[] = "O";
1769 static const char __pyx_k_c[] = "c";
1770 static const char __pyx_k_i[] = "i";
1771 static const char __pyx_k_j[] = "j";
1772 static const char __pyx_k_k[] = "k";
1773 static const char __pyx_k_l[] = "l";
1774 static const char __pyx_k_id[] = "id";
1775 static const char __pyx_k_np[] = "np";
1776 static const char __pyx_k_new[] = "__new__";
1777 static const char __pyx_k_obj[] = "obj";
1778 static const char __pyx_k_val[] = "val";
1779 static const char __pyx_k_base[] = "base";
1780 static const char __pyx_k_dict[] = "__dict__";
1781 static const char __pyx_k_main[] = "__main__";
1782 static const char __pyx_k_mode[] = "mode";
1783 static const char __pyx_k_name[] = "name";
1784 static const char __pyx_k_ndim[] = "ndim";
1785 static const char __pyx_k_pack[] = "pack";
1786 static const char __pyx_k_size[] = "size";
1787 static const char __pyx_k_step[] = "step";
1788 static const char __pyx_k_stop[] = "stop";
1789 static const char __pyx_k_test[] = "__test__";
1790 static const char __pyx_k_ASCII[] = "ASCII";
1791 static const char __pyx_k_class[] = "__class__";
1792 static const char __pyx_k_dtype[] = "dtype";
1793 static const char __pyx_k_empty[] = "empty";
1794 static const char __pyx_k_error[] = "error";
1795 static const char __pyx_k_flags[] = "flags";
1796 static const char __pyx_k_input[] = "input";
1797 static const char __pyx_k_numpy[] = "numpy";
1798 static const char __pyx_k_range[] = "range";
1799 static const char __pyx_k_shape[] = "shape";
1800 static const char __pyx_k_start[] = "start";
1801 static const char __pyx_k_uint8[] = "uint8";
1802 static const char __pyx_k_encode[] = "encode";
1803 static const char __pyx_k_format[] = "format";
1804 static const char __pyx_k_import[] = "__import__";
1805 static const char __pyx_k_name_2[] = "__name__";
1806 static const char __pyx_k_output[] = "output";
1807 static const char __pyx_k_pickle[] = "pickle";
1808 static const char __pyx_k_reduce[] = "__reduce__";
1809 static const char __pyx_k_struct[] = "struct";
1810 static const char __pyx_k_unpack[] = "unpack";
1811 static const char __pyx_k_update[] = "update";
1812 static const char __pyx_k_compute[] = "compute";
1813 static const char __pyx_k_fortran[] = "fortran";
1814 static const char __pyx_k_memview[] = "memview";
1815 static const char __pyx_k_Ellipsis[] = "Ellipsis";
1816 static const char __pyx_k_getstate[] = "__getstate__";
1817 static const char __pyx_k_itemsize[] = "itemsize";
1818 static const char __pyx_k_pyx_type[] = "__pyx_type";
1819 static const char __pyx_k_setstate[] = "__setstate__";
1820 static const char __pyx_k_TypeError[] = "TypeError";
1821 static const char __pyx_k_enumerate[] = "enumerate";
1822 static const char __pyx_k_pyx_state[] = "__pyx_state";
1823 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1824 static const char __pyx_k_IndexError[] = "IndexError";
1825 static const char __pyx_k_ValueError[] = "ValueError";
1826 static const char __pyx_k_pyx_result[] = "__pyx_result";
1827 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1828 static const char __pyx_k_MemoryError[] = "MemoryError";
1829 static const char __pyx_k_PickleError[] = "PickleError";
1830 static const char __pyx_k_output_view[] = "output_view";
1831 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1832 static const char __pyx_k_stringsource[] = "stringsource";
1833 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
1834 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1835 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
1836 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
1837 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
1838 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1839 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1840 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
1841 static const char __pyx_k_rasterio__example[] = "rasterio._example";
1842 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1843 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
1844 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
1845 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
1846 static const char __pyx_k_rasterio__example_pyx[] = "rasterio/_example.pyx";
1847 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
1848 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
1849 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
1850 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
1851 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
1852 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
1853 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
1854 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
1855 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
1856 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
1857 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
1858 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
1859 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
1860 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
1861 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
1862 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
1863 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
1864 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
1865 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
1866 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1867 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
1868 static PyObject *__pyx_n_s_ASCII;
1869 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
1870 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
1871 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
1872 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
1873 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
1874 static PyObject *__pyx_n_s_Ellipsis;
1875 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
1876 static PyObject *__pyx_n_s_I;
1877 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
1878 static PyObject *__pyx_n_s_IndexError;
1879 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
1880 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
1881 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
1882 static PyObject *__pyx_n_s_J;
1883 static PyObject *__pyx_n_s_K;
1884 static PyObject *__pyx_n_s_MemoryError;
1885 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
1886 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
1887 static PyObject *__pyx_n_b_O;
1888 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
1889 static PyObject *__pyx_n_s_PickleError;
1890 static PyObject *__pyx_n_s_TypeError;
1891 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
1892 static PyObject *__pyx_n_s_ValueError;
1893 static PyObject *__pyx_n_s_View_MemoryView;
1894 static PyObject *__pyx_n_s_allocate_buffer;
1895 static PyObject *__pyx_n_s_base;
1896 static PyObject *__pyx_n_s_c;
1897 static PyObject *__pyx_n_u_c;
1898 static PyObject *__pyx_n_s_class;
1899 static PyObject *__pyx_n_s_cline_in_traceback;
1900 static PyObject *__pyx_n_s_compute;
1901 static PyObject *__pyx_kp_s_contiguous_and_direct;
1902 static PyObject *__pyx_kp_s_contiguous_and_indirect;
1903 static PyObject *__pyx_n_s_dict;
1904 static PyObject *__pyx_n_s_dtype;
1905 static PyObject *__pyx_n_s_dtype_is_object;
1906 static PyObject *__pyx_n_s_empty;
1907 static PyObject *__pyx_n_s_encode;
1908 static PyObject *__pyx_n_s_enumerate;
1909 static PyObject *__pyx_n_s_error;
1910 static PyObject *__pyx_n_s_flags;
1911 static PyObject *__pyx_n_s_format;
1912 static PyObject *__pyx_n_s_fortran;
1913 static PyObject *__pyx_n_u_fortran;
1914 static PyObject *__pyx_n_s_getstate;
1915 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
1916 static PyObject *__pyx_n_s_i;
1917 static PyObject *__pyx_n_s_id;
1918 static PyObject *__pyx_n_s_import;
1919 static PyObject *__pyx_n_s_input;
1920 static PyObject *__pyx_n_s_itemsize;
1921 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
1922 static PyObject *__pyx_n_s_j;
1923 static PyObject *__pyx_n_s_k;
1924 static PyObject *__pyx_n_s_l;
1925 static PyObject *__pyx_n_s_main;
1926 static PyObject *__pyx_n_s_memview;
1927 static PyObject *__pyx_n_s_mode;
1928 static PyObject *__pyx_n_s_name;
1929 static PyObject *__pyx_n_s_name_2;
1930 static PyObject *__pyx_n_s_ndim;
1931 static PyObject *__pyx_n_s_new;
1932 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1933 static PyObject *__pyx_n_s_np;
1934 static PyObject *__pyx_n_s_numpy;
1935 static PyObject *__pyx_n_s_obj;
1936 static PyObject *__pyx_n_s_output;
1937 static PyObject *__pyx_n_s_output_view;
1938 static PyObject *__pyx_n_s_pack;
1939 static PyObject *__pyx_n_s_pickle;
1940 static PyObject *__pyx_n_s_pyx_PickleError;
1941 static PyObject *__pyx_n_s_pyx_checksum;
1942 static PyObject *__pyx_n_s_pyx_getbuffer;
1943 static PyObject *__pyx_n_s_pyx_result;
1944 static PyObject *__pyx_n_s_pyx_state;
1945 static PyObject *__pyx_n_s_pyx_type;
1946 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
1947 static PyObject *__pyx_n_s_pyx_vtable;
1948 static PyObject *__pyx_n_s_range;
1949 static PyObject *__pyx_n_s_rasterio__example;
1950 static PyObject *__pyx_kp_s_rasterio__example_pyx;
1951 static PyObject *__pyx_n_s_reduce;
1952 static PyObject *__pyx_n_s_reduce_cython;
1953 static PyObject *__pyx_n_s_reduce_ex;
1954 static PyObject *__pyx_n_s_setstate;
1955 static PyObject *__pyx_n_s_setstate_cython;
1956 static PyObject *__pyx_n_s_shape;
1957 static PyObject *__pyx_n_s_size;
1958 static PyObject *__pyx_n_s_start;
1959 static PyObject *__pyx_n_s_step;
1960 static PyObject *__pyx_n_s_stop;
1961 static PyObject *__pyx_kp_s_strided_and_direct;
1962 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
1963 static PyObject *__pyx_kp_s_strided_and_indirect;
1964 static PyObject *__pyx_kp_s_stringsource;
1965 static PyObject *__pyx_n_s_struct;
1966 static PyObject *__pyx_n_s_test;
1967 static PyObject *__pyx_n_s_uint8;
1968 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
1969 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
1970 static PyObject *__pyx_n_s_unpack;
1971 static PyObject *__pyx_n_s_update;
1972 static PyObject *__pyx_n_s_val;
1973 static PyObject *__pyx_pf_8rasterio_8_example_compute(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_input); /* proto */
1974 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 */
1975 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 */
1976 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
1977 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
1978 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
1979 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
1980 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
1981 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 */
1982 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
1983 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 */
1984 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
1985 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
1986 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
1987 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1988 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 */
1989 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1990 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
1991 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 */
1992 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 */
1993 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1994 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1995 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1996 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1997 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1998 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
1999 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2000 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2001 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2002 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2003 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2004 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2005 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2006 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2007 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2008 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2009 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2010 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 */
2011 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2012 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2013 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2014 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 */
2015 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 */
2016 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2017 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2018 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2019 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2020 static PyObject *__pyx_int_0;
2021 static PyObject *__pyx_int_1;
2022 static PyObject *__pyx_int_184977713;
2023 static PyObject *__pyx_int_neg_1;
2024 static PyObject *__pyx_tuple_;
2025 static PyObject *__pyx_tuple__2;
2026 static PyObject *__pyx_tuple__3;
2027 static PyObject *__pyx_tuple__4;
2028 static PyObject *__pyx_tuple__5;
2029 static PyObject *__pyx_tuple__6;
2030 static PyObject *__pyx_tuple__7;
2031 static PyObject *__pyx_tuple__8;
2032 static PyObject *__pyx_tuple__9;
2033 static PyObject *__pyx_slice__15;
2034 static PyObject *__pyx_tuple__10;
2035 static PyObject *__pyx_tuple__11;
2036 static PyObject *__pyx_tuple__12;
2037 static PyObject *__pyx_tuple__13;
2038 static PyObject *__pyx_tuple__14;
2039 static PyObject *__pyx_tuple__16;
2040 static PyObject *__pyx_tuple__17;
2041 static PyObject *__pyx_tuple__18;
2042 static PyObject *__pyx_tuple__19;
2043 static PyObject *__pyx_tuple__21;
2044 static PyObject *__pyx_tuple__22;
2045 static PyObject *__pyx_tuple__23;
2046 static PyObject *__pyx_tuple__24;
2047 static PyObject *__pyx_tuple__25;
2048 static PyObject *__pyx_tuple__26;
2049 static PyObject *__pyx_codeobj__20;
2050 static PyObject *__pyx_codeobj__27;
2051 /* Late includes */
2052
2053 /* "rasterio/_example.pyx":6
2054 *
2055 *
2056 * def compute(unsigned char[:, :, :] input): # <<<<<<<<<<<<<<
2057 * """reverses bands inefficiently
2058 *
2059 */
2060
2061 /* Python wrapper */
2062 static PyObject *__pyx_pw_8rasterio_8_example_1compute(PyObject *__pyx_self, PyObject *__pyx_arg_input); /*proto*/
2063 static char __pyx_doc_8rasterio_8_example_compute[] = "reverses bands inefficiently\n\n Given input and output uint8 arrays, fakes an CPU-intensive\n computation.\n ";
2064 static PyMethodDef __pyx_mdef_8rasterio_8_example_1compute = {"compute", (PyCFunction)__pyx_pw_8rasterio_8_example_1compute, METH_O, __pyx_doc_8rasterio_8_example_compute};
__pyx_pw_8rasterio_8_example_1compute(PyObject * __pyx_self,PyObject * __pyx_arg_input)2065 static PyObject *__pyx_pw_8rasterio_8_example_1compute(PyObject *__pyx_self, PyObject *__pyx_arg_input) {
2066 __Pyx_memviewslice __pyx_v_input = { 0, 0, { 0 }, { 0 }, { 0 } };
2067 int __pyx_lineno = 0;
2068 const char *__pyx_filename = NULL;
2069 int __pyx_clineno = 0;
2070 PyObject *__pyx_r = 0;
2071 __Pyx_RefNannyDeclarations
2072 __Pyx_RefNannySetupContext("compute (wrapper)", 0);
2073 assert(__pyx_arg_input); {
2074 __pyx_v_input = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_arg_input, PyBUF_WRITABLE); if (unlikely(!__pyx_v_input.memview)) __PYX_ERR(0, 6, __pyx_L3_error)
2075 }
2076 goto __pyx_L4_argument_unpacking_done;
2077 __pyx_L3_error:;
2078 __Pyx_AddTraceback("rasterio._example.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079 __Pyx_RefNannyFinishContext();
2080 return NULL;
2081 __pyx_L4_argument_unpacking_done:;
2082 __pyx_r = __pyx_pf_8rasterio_8_example_compute(__pyx_self, __pyx_v_input);
2083
2084 /* function exit code */
2085 __Pyx_RefNannyFinishContext();
2086 return __pyx_r;
2087 }
2088
__pyx_pf_8rasterio_8_example_compute(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_input)2089 static PyObject *__pyx_pf_8rasterio_8_example_compute(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_input) {
2090 int __pyx_v_I;
2091 int __pyx_v_J;
2092 int __pyx_v_K;
2093 int __pyx_v_i;
2094 int __pyx_v_j;
2095 int __pyx_v_k;
2096 CYTHON_UNUSED int __pyx_v_l;
2097 double __pyx_v_val;
2098 PyObject *__pyx_v_output = NULL;
2099 __Pyx_memviewslice __pyx_v_output_view = { 0, 0, { 0 }, { 0 }, { 0 } };
2100 PyObject *__pyx_r = NULL;
2101 __Pyx_RefNannyDeclarations
2102 PyObject *__pyx_t_1 = NULL;
2103 PyObject *__pyx_t_2 = NULL;
2104 PyObject *__pyx_t_3 = NULL;
2105 PyObject *__pyx_t_4 = NULL;
2106 PyObject *__pyx_t_5 = NULL;
2107 __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
2108 int __pyx_t_7;
2109 int __pyx_t_8;
2110 int __pyx_t_9;
2111 int __pyx_t_10;
2112 int __pyx_t_11;
2113 int __pyx_t_12;
2114 int __pyx_t_13;
2115 int __pyx_t_14;
2116 int __pyx_t_15;
2117 Py_ssize_t __pyx_t_16;
2118 Py_ssize_t __pyx_t_17;
2119 Py_ssize_t __pyx_t_18;
2120 int __pyx_t_19;
2121 int __pyx_lineno = 0;
2122 const char *__pyx_filename = NULL;
2123 int __pyx_clineno = 0;
2124 __Pyx_RefNannySetupContext("compute", 0);
2125
2126 /* "rasterio/_example.pyx":15
2127 * cdef int i, j, k, l
2128 * cdef double val
2129 * I = input.shape[0] # <<<<<<<<<<<<<<
2130 * J = input.shape[1]
2131 * K = input.shape[2]
2132 */
2133 __pyx_v_I = (__pyx_v_input.shape[0]);
2134
2135 /* "rasterio/_example.pyx":16
2136 * cdef double val
2137 * I = input.shape[0]
2138 * J = input.shape[1] # <<<<<<<<<<<<<<
2139 * K = input.shape[2]
2140 * output = np.empty((I, J, K), dtype='uint8')
2141 */
2142 __pyx_v_J = (__pyx_v_input.shape[1]);
2143
2144 /* "rasterio/_example.pyx":17
2145 * I = input.shape[0]
2146 * J = input.shape[1]
2147 * K = input.shape[2] # <<<<<<<<<<<<<<
2148 * output = np.empty((I, J, K), dtype='uint8')
2149 * cdef unsigned char[:, :, :] output_view = output
2150 */
2151 __pyx_v_K = (__pyx_v_input.shape[2]);
2152
2153 /* "rasterio/_example.pyx":18
2154 * J = input.shape[1]
2155 * K = input.shape[2]
2156 * output = np.empty((I, J, K), dtype='uint8') # <<<<<<<<<<<<<<
2157 * cdef unsigned char[:, :, :] output_view = output
2158 * with nogil:
2159 */
2160 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
2161 __Pyx_GOTREF(__pyx_t_1);
2162 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
2163 __Pyx_GOTREF(__pyx_t_2);
2164 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2165 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
2166 __Pyx_GOTREF(__pyx_t_1);
2167 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
2168 __Pyx_GOTREF(__pyx_t_3);
2169 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_K); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
2170 __Pyx_GOTREF(__pyx_t_4);
2171 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error)
2172 __Pyx_GOTREF(__pyx_t_5);
2173 __Pyx_GIVEREF(__pyx_t_1);
2174 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
2175 __Pyx_GIVEREF(__pyx_t_3);
2176 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2177 __Pyx_GIVEREF(__pyx_t_4);
2178 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2179 __pyx_t_1 = 0;
2180 __pyx_t_3 = 0;
2181 __pyx_t_4 = 0;
2182 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
2183 __Pyx_GOTREF(__pyx_t_4);
2184 __Pyx_GIVEREF(__pyx_t_5);
2185 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
2186 __pyx_t_5 = 0;
2187 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error)
2188 __Pyx_GOTREF(__pyx_t_5);
2189 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_uint8) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
2190 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)
2191 __Pyx_GOTREF(__pyx_t_3);
2192 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2193 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2194 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2195 __pyx_v_output = __pyx_t_3;
2196 __pyx_t_3 = 0;
2197
2198 /* "rasterio/_example.pyx":19
2199 * K = input.shape[2]
2200 * output = np.empty((I, J, K), dtype='uint8')
2201 * cdef unsigned char[:, :, :] output_view = output # <<<<<<<<<<<<<<
2202 * with nogil:
2203 * for i in range(I):
2204 */
2205 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_output, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 19, __pyx_L1_error)
2206 __pyx_v_output_view = __pyx_t_6;
2207 __pyx_t_6.memview = NULL;
2208 __pyx_t_6.data = NULL;
2209
2210 /* "rasterio/_example.pyx":20
2211 * output = np.empty((I, J, K), dtype='uint8')
2212 * cdef unsigned char[:, :, :] output_view = output
2213 * with nogil: # <<<<<<<<<<<<<<
2214 * for i in range(I):
2215 * for j in range(J):
2216 */
2217 {
2218 #ifdef WITH_THREAD
2219 PyThreadState *_save;
2220 Py_UNBLOCK_THREADS
2221 __Pyx_FastGIL_Remember();
2222 #endif
2223 /*try:*/ {
2224
2225 /* "rasterio/_example.pyx":21
2226 * cdef unsigned char[:, :, :] output_view = output
2227 * with nogil:
2228 * for i in range(I): # <<<<<<<<<<<<<<
2229 * for j in range(J):
2230 * for k in range(K):
2231 */
2232 __pyx_t_7 = __pyx_v_I;
2233 __pyx_t_8 = __pyx_t_7;
2234 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
2235 __pyx_v_i = __pyx_t_9;
2236
2237 /* "rasterio/_example.pyx":22
2238 * with nogil:
2239 * for i in range(I):
2240 * for j in range(J): # <<<<<<<<<<<<<<
2241 * for k in range(K):
2242 * val = <double>input[i, j, k]
2243 */
2244 __pyx_t_10 = __pyx_v_J;
2245 __pyx_t_11 = __pyx_t_10;
2246 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
2247 __pyx_v_j = __pyx_t_12;
2248
2249 /* "rasterio/_example.pyx":23
2250 * for i in range(I):
2251 * for j in range(J):
2252 * for k in range(K): # <<<<<<<<<<<<<<
2253 * val = <double>input[i, j, k]
2254 * for l in range(2000):
2255 */
2256 __pyx_t_13 = __pyx_v_K;
2257 __pyx_t_14 = __pyx_t_13;
2258 for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
2259 __pyx_v_k = __pyx_t_15;
2260
2261 /* "rasterio/_example.pyx":24
2262 * for j in range(J):
2263 * for k in range(K):
2264 * val = <double>input[i, j, k] # <<<<<<<<<<<<<<
2265 * for l in range(2000):
2266 * val += 1.0
2267 */
2268 __pyx_t_16 = __pyx_v_i;
2269 __pyx_t_17 = __pyx_v_j;
2270 __pyx_t_18 = __pyx_v_k;
2271 if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_input.shape[0];
2272 if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_input.shape[1];
2273 if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_input.shape[2];
2274 __pyx_v_val = ((double)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input.data + __pyx_t_16 * __pyx_v_input.strides[0]) ) + __pyx_t_17 * __pyx_v_input.strides[1]) ) + __pyx_t_18 * __pyx_v_input.strides[2]) ))));
2275
2276 /* "rasterio/_example.pyx":25
2277 * for k in range(K):
2278 * val = <double>input[i, j, k]
2279 * for l in range(2000): # <<<<<<<<<<<<<<
2280 * val += 1.0
2281 * val -= 2000.0
2282 */
2283 for (__pyx_t_19 = 0; __pyx_t_19 < 0x7D0; __pyx_t_19+=1) {
2284 __pyx_v_l = __pyx_t_19;
2285
2286 /* "rasterio/_example.pyx":26
2287 * val = <double>input[i, j, k]
2288 * for l in range(2000):
2289 * val += 1.0 # <<<<<<<<<<<<<<
2290 * val -= 2000.0
2291 * output_view[~i, j, k] = <unsigned char>val
2292 */
2293 __pyx_v_val = (__pyx_v_val + 1.0);
2294 }
2295
2296 /* "rasterio/_example.pyx":27
2297 * for l in range(2000):
2298 * val += 1.0
2299 * val -= 2000.0 # <<<<<<<<<<<<<<
2300 * output_view[~i, j, k] = <unsigned char>val
2301 * return output
2302 */
2303 __pyx_v_val = (__pyx_v_val - 2000.0);
2304
2305 /* "rasterio/_example.pyx":28
2306 * val += 1.0
2307 * val -= 2000.0
2308 * output_view[~i, j, k] = <unsigned char>val # <<<<<<<<<<<<<<
2309 * return output
2310 */
2311 __pyx_t_18 = (~__pyx_v_i);
2312 __pyx_t_17 = __pyx_v_j;
2313 __pyx_t_16 = __pyx_v_k;
2314 if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_output_view.shape[0];
2315 if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_output_view.shape[1];
2316 if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_output_view.shape[2];
2317 *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_view.data + __pyx_t_18 * __pyx_v_output_view.strides[0]) ) + __pyx_t_17 * __pyx_v_output_view.strides[1]) ) + __pyx_t_16 * __pyx_v_output_view.strides[2]) )) = ((unsigned char)__pyx_v_val);
2318 }
2319 }
2320 }
2321 }
2322
2323 /* "rasterio/_example.pyx":20
2324 * output = np.empty((I, J, K), dtype='uint8')
2325 * cdef unsigned char[:, :, :] output_view = output
2326 * with nogil: # <<<<<<<<<<<<<<
2327 * for i in range(I):
2328 * for j in range(J):
2329 */
2330 /*finally:*/ {
2331 /*normal exit:*/{
2332 #ifdef WITH_THREAD
2333 __Pyx_FastGIL_Forget();
2334 Py_BLOCK_THREADS
2335 #endif
2336 goto __pyx_L5;
2337 }
2338 __pyx_L5:;
2339 }
2340 }
2341
2342 /* "rasterio/_example.pyx":29
2343 * val -= 2000.0
2344 * output_view[~i, j, k] = <unsigned char>val
2345 * return output # <<<<<<<<<<<<<<
2346 */
2347 __Pyx_XDECREF(__pyx_r);
2348 __Pyx_INCREF(__pyx_v_output);
2349 __pyx_r = __pyx_v_output;
2350 goto __pyx_L0;
2351
2352 /* "rasterio/_example.pyx":6
2353 *
2354 *
2355 * def compute(unsigned char[:, :, :] input): # <<<<<<<<<<<<<<
2356 * """reverses bands inefficiently
2357 *
2358 */
2359
2360 /* function exit code */
2361 __pyx_L1_error:;
2362 __Pyx_XDECREF(__pyx_t_1);
2363 __Pyx_XDECREF(__pyx_t_2);
2364 __Pyx_XDECREF(__pyx_t_3);
2365 __Pyx_XDECREF(__pyx_t_4);
2366 __Pyx_XDECREF(__pyx_t_5);
2367 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
2368 __Pyx_AddTraceback("rasterio._example.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
2369 __pyx_r = NULL;
2370 __pyx_L0:;
2371 __PYX_XDEC_MEMVIEW(&__pyx_v_input, 1);
2372 __Pyx_XDECREF(__pyx_v_output);
2373 __PYX_XDEC_MEMVIEW(&__pyx_v_output_view, 1);
2374 __Pyx_XGIVEREF(__pyx_r);
2375 __Pyx_RefNannyFinishContext();
2376 return __pyx_r;
2377 }
2378
2379 /* "View.MemoryView":122
2380 * cdef bint dtype_is_object
2381 *
2382 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
2383 * mode="c", bint allocate_buffer=True):
2384 *
2385 */
2386
2387 /* Python wrapper */
2388 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)2389 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2390 PyObject *__pyx_v_shape = 0;
2391 Py_ssize_t __pyx_v_itemsize;
2392 PyObject *__pyx_v_format = 0;
2393 PyObject *__pyx_v_mode = 0;
2394 int __pyx_v_allocate_buffer;
2395 int __pyx_lineno = 0;
2396 const char *__pyx_filename = NULL;
2397 int __pyx_clineno = 0;
2398 int __pyx_r;
2399 __Pyx_RefNannyDeclarations
2400 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2401 {
2402 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};
2403 PyObject* values[5] = {0,0,0,0,0};
2404 values[3] = ((PyObject *)__pyx_n_s_c);
2405 if (unlikely(__pyx_kwds)) {
2406 Py_ssize_t kw_args;
2407 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2408 switch (pos_args) {
2409 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2410 CYTHON_FALLTHROUGH;
2411 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2412 CYTHON_FALLTHROUGH;
2413 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2414 CYTHON_FALLTHROUGH;
2415 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2416 CYTHON_FALLTHROUGH;
2417 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2418 CYTHON_FALLTHROUGH;
2419 case 0: break;
2420 default: goto __pyx_L5_argtuple_error;
2421 }
2422 kw_args = PyDict_Size(__pyx_kwds);
2423 switch (pos_args) {
2424 case 0:
2425 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
2426 else goto __pyx_L5_argtuple_error;
2427 CYTHON_FALLTHROUGH;
2428 case 1:
2429 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
2430 else {
2431 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
2432 }
2433 CYTHON_FALLTHROUGH;
2434 case 2:
2435 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
2436 else {
2437 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
2438 }
2439 CYTHON_FALLTHROUGH;
2440 case 3:
2441 if (kw_args > 0) {
2442 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
2443 if (value) { values[3] = value; kw_args--; }
2444 }
2445 CYTHON_FALLTHROUGH;
2446 case 4:
2447 if (kw_args > 0) {
2448 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
2449 if (value) { values[4] = value; kw_args--; }
2450 }
2451 }
2452 if (unlikely(kw_args > 0)) {
2453 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
2454 }
2455 } else {
2456 switch (PyTuple_GET_SIZE(__pyx_args)) {
2457 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2458 CYTHON_FALLTHROUGH;
2459 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2460 CYTHON_FALLTHROUGH;
2461 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2462 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2463 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2464 break;
2465 default: goto __pyx_L5_argtuple_error;
2466 }
2467 }
2468 __pyx_v_shape = ((PyObject*)values[0]);
2469 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
2470 __pyx_v_format = values[2];
2471 __pyx_v_mode = values[3];
2472 if (values[4]) {
2473 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
2474 } else {
2475
2476 /* "View.MemoryView":123
2477 *
2478 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
2479 * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
2480 *
2481 * cdef int idx
2482 */
2483 __pyx_v_allocate_buffer = ((int)1);
2484 }
2485 }
2486 goto __pyx_L4_argument_unpacking_done;
2487 __pyx_L5_argtuple_error:;
2488 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
2489 __pyx_L3_error:;
2490 __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2491 __Pyx_RefNannyFinishContext();
2492 return -1;
2493 __pyx_L4_argument_unpacking_done:;
2494 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
2495 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
2496 PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
2497 }
2498 __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);
2499
2500 /* "View.MemoryView":122
2501 * cdef bint dtype_is_object
2502 *
2503 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
2504 * mode="c", bint allocate_buffer=True):
2505 *
2506 */
2507
2508 /* function exit code */
2509 goto __pyx_L0;
2510 __pyx_L1_error:;
2511 __pyx_r = -1;
2512 __pyx_L0:;
2513 __Pyx_RefNannyFinishContext();
2514 return __pyx_r;
2515 }
2516
__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)2517 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) {
2518 int __pyx_v_idx;
2519 Py_ssize_t __pyx_v_i;
2520 Py_ssize_t __pyx_v_dim;
2521 PyObject **__pyx_v_p;
2522 char __pyx_v_order;
2523 int __pyx_r;
2524 __Pyx_RefNannyDeclarations
2525 Py_ssize_t __pyx_t_1;
2526 int __pyx_t_2;
2527 PyObject *__pyx_t_3 = NULL;
2528 int __pyx_t_4;
2529 PyObject *__pyx_t_5 = NULL;
2530 PyObject *__pyx_t_6 = NULL;
2531 char *__pyx_t_7;
2532 int __pyx_t_8;
2533 Py_ssize_t __pyx_t_9;
2534 PyObject *__pyx_t_10 = NULL;
2535 Py_ssize_t __pyx_t_11;
2536 int __pyx_lineno = 0;
2537 const char *__pyx_filename = NULL;
2538 int __pyx_clineno = 0;
2539 __Pyx_RefNannySetupContext("__cinit__", 0);
2540 __Pyx_INCREF(__pyx_v_format);
2541
2542 /* "View.MemoryView":129
2543 * cdef PyObject **p
2544 *
2545 * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
2546 * self.itemsize = itemsize
2547 *
2548 */
2549 if (unlikely(__pyx_v_shape == Py_None)) {
2550 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
2551 __PYX_ERR(1, 129, __pyx_L1_error)
2552 }
2553 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
2554 __pyx_v_self->ndim = ((int)__pyx_t_1);
2555
2556 /* "View.MemoryView":130
2557 *
2558 * self.ndim = <int> len(shape)
2559 * self.itemsize = itemsize # <<<<<<<<<<<<<<
2560 *
2561 * if not self.ndim:
2562 */
2563 __pyx_v_self->itemsize = __pyx_v_itemsize;
2564
2565 /* "View.MemoryView":132
2566 * self.itemsize = itemsize
2567 *
2568 * if not self.ndim: # <<<<<<<<<<<<<<
2569 * raise ValueError("Empty shape tuple for cython.array")
2570 *
2571 */
2572 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
2573 if (unlikely(__pyx_t_2)) {
2574
2575 /* "View.MemoryView":133
2576 *
2577 * if not self.ndim:
2578 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
2579 *
2580 * if itemsize <= 0:
2581 */
2582 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
2583 __Pyx_GOTREF(__pyx_t_3);
2584 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2585 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2586 __PYX_ERR(1, 133, __pyx_L1_error)
2587
2588 /* "View.MemoryView":132
2589 * self.itemsize = itemsize
2590 *
2591 * if not self.ndim: # <<<<<<<<<<<<<<
2592 * raise ValueError("Empty shape tuple for cython.array")
2593 *
2594 */
2595 }
2596
2597 /* "View.MemoryView":135
2598 * raise ValueError("Empty shape tuple for cython.array")
2599 *
2600 * if itemsize <= 0: # <<<<<<<<<<<<<<
2601 * raise ValueError("itemsize <= 0 for cython.array")
2602 *
2603 */
2604 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
2605 if (unlikely(__pyx_t_2)) {
2606
2607 /* "View.MemoryView":136
2608 *
2609 * if itemsize <= 0:
2610 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
2611 *
2612 * if not isinstance(format, bytes):
2613 */
2614 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
2615 __Pyx_GOTREF(__pyx_t_3);
2616 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2617 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2618 __PYX_ERR(1, 136, __pyx_L1_error)
2619
2620 /* "View.MemoryView":135
2621 * raise ValueError("Empty shape tuple for cython.array")
2622 *
2623 * if itemsize <= 0: # <<<<<<<<<<<<<<
2624 * raise ValueError("itemsize <= 0 for cython.array")
2625 *
2626 */
2627 }
2628
2629 /* "View.MemoryView":138
2630 * raise ValueError("itemsize <= 0 for cython.array")
2631 *
2632 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
2633 * format = format.encode('ASCII')
2634 * self._format = format # keep a reference to the byte string
2635 */
2636 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
2637 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
2638 if (__pyx_t_4) {
2639
2640 /* "View.MemoryView":139
2641 *
2642 * if not isinstance(format, bytes):
2643 * format = format.encode('ASCII') # <<<<<<<<<<<<<<
2644 * self._format = format # keep a reference to the byte string
2645 * self.format = self._format
2646 */
2647 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
2648 __Pyx_GOTREF(__pyx_t_5);
2649 __pyx_t_6 = NULL;
2650 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2651 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
2652 if (likely(__pyx_t_6)) {
2653 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2654 __Pyx_INCREF(__pyx_t_6);
2655 __Pyx_INCREF(function);
2656 __Pyx_DECREF_SET(__pyx_t_5, function);
2657 }
2658 }
2659 __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);
2660 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2661 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
2662 __Pyx_GOTREF(__pyx_t_3);
2663 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2664 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
2665 __pyx_t_3 = 0;
2666
2667 /* "View.MemoryView":138
2668 * raise ValueError("itemsize <= 0 for cython.array")
2669 *
2670 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
2671 * format = format.encode('ASCII')
2672 * self._format = format # keep a reference to the byte string
2673 */
2674 }
2675
2676 /* "View.MemoryView":140
2677 * if not isinstance(format, bytes):
2678 * format = format.encode('ASCII')
2679 * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
2680 * self.format = self._format
2681 *
2682 */
2683 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(1, 140, __pyx_L1_error)
2684 __pyx_t_3 = __pyx_v_format;
2685 __Pyx_INCREF(__pyx_t_3);
2686 __Pyx_GIVEREF(__pyx_t_3);
2687 __Pyx_GOTREF(__pyx_v_self->_format);
2688 __Pyx_DECREF(__pyx_v_self->_format);
2689 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
2690 __pyx_t_3 = 0;
2691
2692 /* "View.MemoryView":141
2693 * format = format.encode('ASCII')
2694 * self._format = format # keep a reference to the byte string
2695 * self.format = self._format # <<<<<<<<<<<<<<
2696 *
2697 *
2698 */
2699 if (unlikely(__pyx_v_self->_format == Py_None)) {
2700 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
2701 __PYX_ERR(1, 141, __pyx_L1_error)
2702 }
2703 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
2704 __pyx_v_self->format = __pyx_t_7;
2705
2706 /* "View.MemoryView":144
2707 *
2708 *
2709 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
2710 * self._strides = self._shape + self.ndim
2711 *
2712 */
2713 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
2714
2715 /* "View.MemoryView":145
2716 *
2717 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
2718 * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
2719 *
2720 * if not self._shape:
2721 */
2722 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
2723
2724 /* "View.MemoryView":147
2725 * self._strides = self._shape + self.ndim
2726 *
2727 * if not self._shape: # <<<<<<<<<<<<<<
2728 * raise MemoryError("unable to allocate shape and strides.")
2729 *
2730 */
2731 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
2732 if (unlikely(__pyx_t_4)) {
2733
2734 /* "View.MemoryView":148
2735 *
2736 * if not self._shape:
2737 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
2738 *
2739 *
2740 */
2741 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
2742 __Pyx_GOTREF(__pyx_t_3);
2743 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2744 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2745 __PYX_ERR(1, 148, __pyx_L1_error)
2746
2747 /* "View.MemoryView":147
2748 * self._strides = self._shape + self.ndim
2749 *
2750 * if not self._shape: # <<<<<<<<<<<<<<
2751 * raise MemoryError("unable to allocate shape and strides.")
2752 *
2753 */
2754 }
2755
2756 /* "View.MemoryView":151
2757 *
2758 *
2759 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
2760 * if dim <= 0:
2761 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
2762 */
2763 __pyx_t_8 = 0;
2764 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
2765 for (;;) {
2766 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
2767 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2768 __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(1, 151, __pyx_L1_error)
2769 #else
2770 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
2771 __Pyx_GOTREF(__pyx_t_5);
2772 #endif
2773 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
2774 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2775 __pyx_v_dim = __pyx_t_9;
2776 __pyx_v_idx = __pyx_t_8;
2777 __pyx_t_8 = (__pyx_t_8 + 1);
2778
2779 /* "View.MemoryView":152
2780 *
2781 * for idx, dim in enumerate(shape):
2782 * if dim <= 0: # <<<<<<<<<<<<<<
2783 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
2784 * self._shape[idx] = dim
2785 */
2786 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
2787 if (unlikely(__pyx_t_4)) {
2788
2789 /* "View.MemoryView":153
2790 * for idx, dim in enumerate(shape):
2791 * if dim <= 0:
2792 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
2793 * self._shape[idx] = dim
2794 *
2795 */
2796 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
2797 __Pyx_GOTREF(__pyx_t_5);
2798 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
2799 __Pyx_GOTREF(__pyx_t_6);
2800 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
2801 __Pyx_GOTREF(__pyx_t_10);
2802 __Pyx_GIVEREF(__pyx_t_5);
2803 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
2804 __Pyx_GIVEREF(__pyx_t_6);
2805 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
2806 __pyx_t_5 = 0;
2807 __pyx_t_6 = 0;
2808 __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(1, 153, __pyx_L1_error)
2809 __Pyx_GOTREF(__pyx_t_6);
2810 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2811 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
2812 __Pyx_GOTREF(__pyx_t_10);
2813 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2814 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
2815 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2816 __PYX_ERR(1, 153, __pyx_L1_error)
2817
2818 /* "View.MemoryView":152
2819 *
2820 * for idx, dim in enumerate(shape):
2821 * if dim <= 0: # <<<<<<<<<<<<<<
2822 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
2823 * self._shape[idx] = dim
2824 */
2825 }
2826
2827 /* "View.MemoryView":154
2828 * if dim <= 0:
2829 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
2830 * self._shape[idx] = dim # <<<<<<<<<<<<<<
2831 *
2832 * cdef char order
2833 */
2834 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
2835
2836 /* "View.MemoryView":151
2837 *
2838 *
2839 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
2840 * if dim <= 0:
2841 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
2842 */
2843 }
2844 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2845
2846 /* "View.MemoryView":157
2847 *
2848 * cdef char order
2849 * if mode == 'fortran': # <<<<<<<<<<<<<<
2850 * order = b'F'
2851 * self.mode = u'fortran'
2852 */
2853 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
2854 if (__pyx_t_4) {
2855
2856 /* "View.MemoryView":158
2857 * cdef char order
2858 * if mode == 'fortran':
2859 * order = b'F' # <<<<<<<<<<<<<<
2860 * self.mode = u'fortran'
2861 * elif mode == 'c':
2862 */
2863 __pyx_v_order = 'F';
2864
2865 /* "View.MemoryView":159
2866 * if mode == 'fortran':
2867 * order = b'F'
2868 * self.mode = u'fortran' # <<<<<<<<<<<<<<
2869 * elif mode == 'c':
2870 * order = b'C'
2871 */
2872 __Pyx_INCREF(__pyx_n_u_fortran);
2873 __Pyx_GIVEREF(__pyx_n_u_fortran);
2874 __Pyx_GOTREF(__pyx_v_self->mode);
2875 __Pyx_DECREF(__pyx_v_self->mode);
2876 __pyx_v_self->mode = __pyx_n_u_fortran;
2877
2878 /* "View.MemoryView":157
2879 *
2880 * cdef char order
2881 * if mode == 'fortran': # <<<<<<<<<<<<<<
2882 * order = b'F'
2883 * self.mode = u'fortran'
2884 */
2885 goto __pyx_L10;
2886 }
2887
2888 /* "View.MemoryView":160
2889 * order = b'F'
2890 * self.mode = u'fortran'
2891 * elif mode == 'c': # <<<<<<<<<<<<<<
2892 * order = b'C'
2893 * self.mode = u'c'
2894 */
2895 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
2896 if (likely(__pyx_t_4)) {
2897
2898 /* "View.MemoryView":161
2899 * self.mode = u'fortran'
2900 * elif mode == 'c':
2901 * order = b'C' # <<<<<<<<<<<<<<
2902 * self.mode = u'c'
2903 * else:
2904 */
2905 __pyx_v_order = 'C';
2906
2907 /* "View.MemoryView":162
2908 * elif mode == 'c':
2909 * order = b'C'
2910 * self.mode = u'c' # <<<<<<<<<<<<<<
2911 * else:
2912 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
2913 */
2914 __Pyx_INCREF(__pyx_n_u_c);
2915 __Pyx_GIVEREF(__pyx_n_u_c);
2916 __Pyx_GOTREF(__pyx_v_self->mode);
2917 __Pyx_DECREF(__pyx_v_self->mode);
2918 __pyx_v_self->mode = __pyx_n_u_c;
2919
2920 /* "View.MemoryView":160
2921 * order = b'F'
2922 * self.mode = u'fortran'
2923 * elif mode == 'c': # <<<<<<<<<<<<<<
2924 * order = b'C'
2925 * self.mode = u'c'
2926 */
2927 goto __pyx_L10;
2928 }
2929
2930 /* "View.MemoryView":164
2931 * self.mode = u'c'
2932 * else:
2933 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
2934 *
2935 * self.len = fill_contig_strides_array(self._shape, self._strides,
2936 */
2937 /*else*/ {
2938 __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(1, 164, __pyx_L1_error)
2939 __Pyx_GOTREF(__pyx_t_3);
2940 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
2941 __Pyx_GOTREF(__pyx_t_10);
2942 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2943 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
2944 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2945 __PYX_ERR(1, 164, __pyx_L1_error)
2946 }
2947 __pyx_L10:;
2948
2949 /* "View.MemoryView":166
2950 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
2951 *
2952 * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
2953 * itemsize, self.ndim, order)
2954 *
2955 */
2956 __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);
2957
2958 /* "View.MemoryView":169
2959 * itemsize, self.ndim, order)
2960 *
2961 * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
2962 * self.dtype_is_object = format == b'O'
2963 * if allocate_buffer:
2964 */
2965 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
2966
2967 /* "View.MemoryView":170
2968 *
2969 * self.free_data = allocate_buffer
2970 * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
2971 * if allocate_buffer:
2972 *
2973 */
2974 __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(1, 170, __pyx_L1_error)
2975 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
2976 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2977 __pyx_v_self->dtype_is_object = __pyx_t_4;
2978
2979 /* "View.MemoryView":171
2980 * self.free_data = allocate_buffer
2981 * self.dtype_is_object = format == b'O'
2982 * if allocate_buffer: # <<<<<<<<<<<<<<
2983 *
2984 *
2985 */
2986 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
2987 if (__pyx_t_4) {
2988
2989 /* "View.MemoryView":174
2990 *
2991 *
2992 * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
2993 * if not self.data:
2994 * raise MemoryError("unable to allocate array data.")
2995 */
2996 __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
2997
2998 /* "View.MemoryView":175
2999 *
3000 * self.data = <char *>malloc(self.len)
3001 * if not self.data: # <<<<<<<<<<<<<<
3002 * raise MemoryError("unable to allocate array data.")
3003 *
3004 */
3005 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
3006 if (unlikely(__pyx_t_4)) {
3007
3008 /* "View.MemoryView":176
3009 * self.data = <char *>malloc(self.len)
3010 * if not self.data:
3011 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
3012 *
3013 * if self.dtype_is_object:
3014 */
3015 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
3016 __Pyx_GOTREF(__pyx_t_10);
3017 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
3018 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3019 __PYX_ERR(1, 176, __pyx_L1_error)
3020
3021 /* "View.MemoryView":175
3022 *
3023 * self.data = <char *>malloc(self.len)
3024 * if not self.data: # <<<<<<<<<<<<<<
3025 * raise MemoryError("unable to allocate array data.")
3026 *
3027 */
3028 }
3029
3030 /* "View.MemoryView":178
3031 * raise MemoryError("unable to allocate array data.")
3032 *
3033 * if self.dtype_is_object: # <<<<<<<<<<<<<<
3034 * p = <PyObject **> self.data
3035 * for i in range(self.len / itemsize):
3036 */
3037 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
3038 if (__pyx_t_4) {
3039
3040 /* "View.MemoryView":179
3041 *
3042 * if self.dtype_is_object:
3043 * p = <PyObject **> self.data # <<<<<<<<<<<<<<
3044 * for i in range(self.len / itemsize):
3045 * p[i] = Py_None
3046 */
3047 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
3048
3049 /* "View.MemoryView":180
3050 * if self.dtype_is_object:
3051 * p = <PyObject **> self.data
3052 * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
3053 * p[i] = Py_None
3054 * Py_INCREF(Py_None)
3055 */
3056 if (unlikely(__pyx_v_itemsize == 0)) {
3057 PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3058 __PYX_ERR(1, 180, __pyx_L1_error)
3059 }
3060 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))) {
3061 PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
3062 __PYX_ERR(1, 180, __pyx_L1_error)
3063 }
3064 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
3065 __pyx_t_9 = __pyx_t_1;
3066 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
3067 __pyx_v_i = __pyx_t_11;
3068
3069 /* "View.MemoryView":181
3070 * p = <PyObject **> self.data
3071 * for i in range(self.len / itemsize):
3072 * p[i] = Py_None # <<<<<<<<<<<<<<
3073 * Py_INCREF(Py_None)
3074 *
3075 */
3076 (__pyx_v_p[__pyx_v_i]) = Py_None;
3077
3078 /* "View.MemoryView":182
3079 * for i in range(self.len / itemsize):
3080 * p[i] = Py_None
3081 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
3082 *
3083 * @cname('getbuffer')
3084 */
3085 Py_INCREF(Py_None);
3086 }
3087
3088 /* "View.MemoryView":178
3089 * raise MemoryError("unable to allocate array data.")
3090 *
3091 * if self.dtype_is_object: # <<<<<<<<<<<<<<
3092 * p = <PyObject **> self.data
3093 * for i in range(self.len / itemsize):
3094 */
3095 }
3096
3097 /* "View.MemoryView":171
3098 * self.free_data = allocate_buffer
3099 * self.dtype_is_object = format == b'O'
3100 * if allocate_buffer: # <<<<<<<<<<<<<<
3101 *
3102 *
3103 */
3104 }
3105
3106 /* "View.MemoryView":122
3107 * cdef bint dtype_is_object
3108 *
3109 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
3110 * mode="c", bint allocate_buffer=True):
3111 *
3112 */
3113
3114 /* function exit code */
3115 __pyx_r = 0;
3116 goto __pyx_L0;
3117 __pyx_L1_error:;
3118 __Pyx_XDECREF(__pyx_t_3);
3119 __Pyx_XDECREF(__pyx_t_5);
3120 __Pyx_XDECREF(__pyx_t_6);
3121 __Pyx_XDECREF(__pyx_t_10);
3122 __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3123 __pyx_r = -1;
3124 __pyx_L0:;
3125 __Pyx_XDECREF(__pyx_v_format);
3126 __Pyx_RefNannyFinishContext();
3127 return __pyx_r;
3128 }
3129
3130 /* "View.MemoryView":185
3131 *
3132 * @cname('getbuffer')
3133 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
3134 * cdef int bufmode = -1
3135 * if self.mode == u"c":
3136 */
3137
3138 /* Python wrapper */
3139 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)3140 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
3141 int __pyx_r;
3142 __Pyx_RefNannyDeclarations
3143 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
3144 __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));
3145
3146 /* function exit code */
3147 __Pyx_RefNannyFinishContext();
3148 return __pyx_r;
3149 }
3150
__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)3151 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) {
3152 int __pyx_v_bufmode;
3153 int __pyx_r;
3154 __Pyx_RefNannyDeclarations
3155 int __pyx_t_1;
3156 int __pyx_t_2;
3157 PyObject *__pyx_t_3 = NULL;
3158 char *__pyx_t_4;
3159 Py_ssize_t __pyx_t_5;
3160 int __pyx_t_6;
3161 Py_ssize_t *__pyx_t_7;
3162 int __pyx_lineno = 0;
3163 const char *__pyx_filename = NULL;
3164 int __pyx_clineno = 0;
3165 if (__pyx_v_info == NULL) {
3166 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
3167 return -1;
3168 }
3169 __Pyx_RefNannySetupContext("__getbuffer__", 0);
3170 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
3171 __Pyx_GIVEREF(__pyx_v_info->obj);
3172
3173 /* "View.MemoryView":186
3174 * @cname('getbuffer')
3175 * def __getbuffer__(self, Py_buffer *info, int flags):
3176 * cdef int bufmode = -1 # <<<<<<<<<<<<<<
3177 * if self.mode == u"c":
3178 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3179 */
3180 __pyx_v_bufmode = -1;
3181
3182 /* "View.MemoryView":187
3183 * def __getbuffer__(self, Py_buffer *info, int flags):
3184 * cdef int bufmode = -1
3185 * if self.mode == u"c": # <<<<<<<<<<<<<<
3186 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3187 * elif self.mode == u"fortran":
3188 */
3189 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
3190 __pyx_t_2 = (__pyx_t_1 != 0);
3191 if (__pyx_t_2) {
3192
3193 /* "View.MemoryView":188
3194 * cdef int bufmode = -1
3195 * if self.mode == u"c":
3196 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
3197 * elif self.mode == u"fortran":
3198 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3199 */
3200 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
3201
3202 /* "View.MemoryView":187
3203 * def __getbuffer__(self, Py_buffer *info, int flags):
3204 * cdef int bufmode = -1
3205 * if self.mode == u"c": # <<<<<<<<<<<<<<
3206 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3207 * elif self.mode == u"fortran":
3208 */
3209 goto __pyx_L3;
3210 }
3211
3212 /* "View.MemoryView":189
3213 * if self.mode == u"c":
3214 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3215 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
3216 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3217 * if not (flags & bufmode):
3218 */
3219 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
3220 __pyx_t_1 = (__pyx_t_2 != 0);
3221 if (__pyx_t_1) {
3222
3223 /* "View.MemoryView":190
3224 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3225 * elif self.mode == u"fortran":
3226 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
3227 * if not (flags & bufmode):
3228 * raise ValueError("Can only create a buffer that is contiguous in memory.")
3229 */
3230 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
3231
3232 /* "View.MemoryView":189
3233 * if self.mode == u"c":
3234 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3235 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
3236 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3237 * if not (flags & bufmode):
3238 */
3239 }
3240 __pyx_L3:;
3241
3242 /* "View.MemoryView":191
3243 * elif self.mode == u"fortran":
3244 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3245 * if not (flags & bufmode): # <<<<<<<<<<<<<<
3246 * raise ValueError("Can only create a buffer that is contiguous in memory.")
3247 * info.buf = self.data
3248 */
3249 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
3250 if (unlikely(__pyx_t_1)) {
3251
3252 /* "View.MemoryView":192
3253 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3254 * if not (flags & bufmode):
3255 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
3256 * info.buf = self.data
3257 * info.len = self.len
3258 */
3259 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
3260 __Pyx_GOTREF(__pyx_t_3);
3261 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3262 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3263 __PYX_ERR(1, 192, __pyx_L1_error)
3264
3265 /* "View.MemoryView":191
3266 * elif self.mode == u"fortran":
3267 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
3268 * if not (flags & bufmode): # <<<<<<<<<<<<<<
3269 * raise ValueError("Can only create a buffer that is contiguous in memory.")
3270 * info.buf = self.data
3271 */
3272 }
3273
3274 /* "View.MemoryView":193
3275 * if not (flags & bufmode):
3276 * raise ValueError("Can only create a buffer that is contiguous in memory.")
3277 * info.buf = self.data # <<<<<<<<<<<<<<
3278 * info.len = self.len
3279 * info.ndim = self.ndim
3280 */
3281 __pyx_t_4 = __pyx_v_self->data;
3282 __pyx_v_info->buf = __pyx_t_4;
3283
3284 /* "View.MemoryView":194
3285 * raise ValueError("Can only create a buffer that is contiguous in memory.")
3286 * info.buf = self.data
3287 * info.len = self.len # <<<<<<<<<<<<<<
3288 * info.ndim = self.ndim
3289 * info.shape = self._shape
3290 */
3291 __pyx_t_5 = __pyx_v_self->len;
3292 __pyx_v_info->len = __pyx_t_5;
3293
3294 /* "View.MemoryView":195
3295 * info.buf = self.data
3296 * info.len = self.len
3297 * info.ndim = self.ndim # <<<<<<<<<<<<<<
3298 * info.shape = self._shape
3299 * info.strides = self._strides
3300 */
3301 __pyx_t_6 = __pyx_v_self->ndim;
3302 __pyx_v_info->ndim = __pyx_t_6;
3303
3304 /* "View.MemoryView":196
3305 * info.len = self.len
3306 * info.ndim = self.ndim
3307 * info.shape = self._shape # <<<<<<<<<<<<<<
3308 * info.strides = self._strides
3309 * info.suboffsets = NULL
3310 */
3311 __pyx_t_7 = __pyx_v_self->_shape;
3312 __pyx_v_info->shape = __pyx_t_7;
3313
3314 /* "View.MemoryView":197
3315 * info.ndim = self.ndim
3316 * info.shape = self._shape
3317 * info.strides = self._strides # <<<<<<<<<<<<<<
3318 * info.suboffsets = NULL
3319 * info.itemsize = self.itemsize
3320 */
3321 __pyx_t_7 = __pyx_v_self->_strides;
3322 __pyx_v_info->strides = __pyx_t_7;
3323
3324 /* "View.MemoryView":198
3325 * info.shape = self._shape
3326 * info.strides = self._strides
3327 * info.suboffsets = NULL # <<<<<<<<<<<<<<
3328 * info.itemsize = self.itemsize
3329 * info.readonly = 0
3330 */
3331 __pyx_v_info->suboffsets = NULL;
3332
3333 /* "View.MemoryView":199
3334 * info.strides = self._strides
3335 * info.suboffsets = NULL
3336 * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
3337 * info.readonly = 0
3338 *
3339 */
3340 __pyx_t_5 = __pyx_v_self->itemsize;
3341 __pyx_v_info->itemsize = __pyx_t_5;
3342
3343 /* "View.MemoryView":200
3344 * info.suboffsets = NULL
3345 * info.itemsize = self.itemsize
3346 * info.readonly = 0 # <<<<<<<<<<<<<<
3347 *
3348 * if flags & PyBUF_FORMAT:
3349 */
3350 __pyx_v_info->readonly = 0;
3351
3352 /* "View.MemoryView":202
3353 * info.readonly = 0
3354 *
3355 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
3356 * info.format = self.format
3357 * else:
3358 */
3359 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
3360 if (__pyx_t_1) {
3361
3362 /* "View.MemoryView":203
3363 *
3364 * if flags & PyBUF_FORMAT:
3365 * info.format = self.format # <<<<<<<<<<<<<<
3366 * else:
3367 * info.format = NULL
3368 */
3369 __pyx_t_4 = __pyx_v_self->format;
3370 __pyx_v_info->format = __pyx_t_4;
3371
3372 /* "View.MemoryView":202
3373 * info.readonly = 0
3374 *
3375 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
3376 * info.format = self.format
3377 * else:
3378 */
3379 goto __pyx_L5;
3380 }
3381
3382 /* "View.MemoryView":205
3383 * info.format = self.format
3384 * else:
3385 * info.format = NULL # <<<<<<<<<<<<<<
3386 *
3387 * info.obj = self
3388 */
3389 /*else*/ {
3390 __pyx_v_info->format = NULL;
3391 }
3392 __pyx_L5:;
3393
3394 /* "View.MemoryView":207
3395 * info.format = NULL
3396 *
3397 * info.obj = self # <<<<<<<<<<<<<<
3398 *
3399 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
3400 */
3401 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3402 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3403 __Pyx_GOTREF(__pyx_v_info->obj);
3404 __Pyx_DECREF(__pyx_v_info->obj);
3405 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
3406
3407 /* "View.MemoryView":185
3408 *
3409 * @cname('getbuffer')
3410 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
3411 * cdef int bufmode = -1
3412 * if self.mode == u"c":
3413 */
3414
3415 /* function exit code */
3416 __pyx_r = 0;
3417 goto __pyx_L0;
3418 __pyx_L1_error:;
3419 __Pyx_XDECREF(__pyx_t_3);
3420 __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3421 __pyx_r = -1;
3422 if (__pyx_v_info->obj != NULL) {
3423 __Pyx_GOTREF(__pyx_v_info->obj);
3424 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
3425 }
3426 goto __pyx_L2;
3427 __pyx_L0:;
3428 if (__pyx_v_info->obj == Py_None) {
3429 __Pyx_GOTREF(__pyx_v_info->obj);
3430 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
3431 }
3432 __pyx_L2:;
3433 __Pyx_RefNannyFinishContext();
3434 return __pyx_r;
3435 }
3436
3437 /* "View.MemoryView":211
3438 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
3439 *
3440 * def __dealloc__(array self): # <<<<<<<<<<<<<<
3441 * if self.callback_free_data != NULL:
3442 * self.callback_free_data(self.data)
3443 */
3444
3445 /* Python wrapper */
3446 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)3447 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
3448 __Pyx_RefNannyDeclarations
3449 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
3450 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
3451
3452 /* function exit code */
3453 __Pyx_RefNannyFinishContext();
3454 }
3455
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)3456 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
3457 __Pyx_RefNannyDeclarations
3458 int __pyx_t_1;
3459 __Pyx_RefNannySetupContext("__dealloc__", 0);
3460
3461 /* "View.MemoryView":212
3462 *
3463 * def __dealloc__(array self):
3464 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
3465 * self.callback_free_data(self.data)
3466 * elif self.free_data:
3467 */
3468 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
3469 if (__pyx_t_1) {
3470
3471 /* "View.MemoryView":213
3472 * def __dealloc__(array self):
3473 * if self.callback_free_data != NULL:
3474 * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
3475 * elif self.free_data:
3476 * if self.dtype_is_object:
3477 */
3478 __pyx_v_self->callback_free_data(__pyx_v_self->data);
3479
3480 /* "View.MemoryView":212
3481 *
3482 * def __dealloc__(array self):
3483 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
3484 * self.callback_free_data(self.data)
3485 * elif self.free_data:
3486 */
3487 goto __pyx_L3;
3488 }
3489
3490 /* "View.MemoryView":214
3491 * if self.callback_free_data != NULL:
3492 * self.callback_free_data(self.data)
3493 * elif self.free_data: # <<<<<<<<<<<<<<
3494 * if self.dtype_is_object:
3495 * refcount_objects_in_slice(self.data, self._shape,
3496 */
3497 __pyx_t_1 = (__pyx_v_self->free_data != 0);
3498 if (__pyx_t_1) {
3499
3500 /* "View.MemoryView":215
3501 * self.callback_free_data(self.data)
3502 * elif self.free_data:
3503 * if self.dtype_is_object: # <<<<<<<<<<<<<<
3504 * refcount_objects_in_slice(self.data, self._shape,
3505 * self._strides, self.ndim, False)
3506 */
3507 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
3508 if (__pyx_t_1) {
3509
3510 /* "View.MemoryView":216
3511 * elif self.free_data:
3512 * if self.dtype_is_object:
3513 * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
3514 * self._strides, self.ndim, False)
3515 * free(self.data)
3516 */
3517 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
3518
3519 /* "View.MemoryView":215
3520 * self.callback_free_data(self.data)
3521 * elif self.free_data:
3522 * if self.dtype_is_object: # <<<<<<<<<<<<<<
3523 * refcount_objects_in_slice(self.data, self._shape,
3524 * self._strides, self.ndim, False)
3525 */
3526 }
3527
3528 /* "View.MemoryView":218
3529 * refcount_objects_in_slice(self.data, self._shape,
3530 * self._strides, self.ndim, False)
3531 * free(self.data) # <<<<<<<<<<<<<<
3532 * PyObject_Free(self._shape)
3533 *
3534 */
3535 free(__pyx_v_self->data);
3536
3537 /* "View.MemoryView":214
3538 * if self.callback_free_data != NULL:
3539 * self.callback_free_data(self.data)
3540 * elif self.free_data: # <<<<<<<<<<<<<<
3541 * if self.dtype_is_object:
3542 * refcount_objects_in_slice(self.data, self._shape,
3543 */
3544 }
3545 __pyx_L3:;
3546
3547 /* "View.MemoryView":219
3548 * self._strides, self.ndim, False)
3549 * free(self.data)
3550 * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
3551 *
3552 * @property
3553 */
3554 PyObject_Free(__pyx_v_self->_shape);
3555
3556 /* "View.MemoryView":211
3557 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
3558 *
3559 * def __dealloc__(array self): # <<<<<<<<<<<<<<
3560 * if self.callback_free_data != NULL:
3561 * self.callback_free_data(self.data)
3562 */
3563
3564 /* function exit code */
3565 __Pyx_RefNannyFinishContext();
3566 }
3567
3568 /* "View.MemoryView":222
3569 *
3570 * @property
3571 * def memview(self): # <<<<<<<<<<<<<<
3572 * return self.get_memview()
3573 *
3574 */
3575
3576 /* Python wrapper */
3577 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)3578 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
3579 PyObject *__pyx_r = 0;
3580 __Pyx_RefNannyDeclarations
3581 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3582 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
3583
3584 /* function exit code */
3585 __Pyx_RefNannyFinishContext();
3586 return __pyx_r;
3587 }
3588
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)3589 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
3590 PyObject *__pyx_r = NULL;
3591 __Pyx_RefNannyDeclarations
3592 PyObject *__pyx_t_1 = NULL;
3593 int __pyx_lineno = 0;
3594 const char *__pyx_filename = NULL;
3595 int __pyx_clineno = 0;
3596 __Pyx_RefNannySetupContext("__get__", 0);
3597
3598 /* "View.MemoryView":223
3599 * @property
3600 * def memview(self):
3601 * return self.get_memview() # <<<<<<<<<<<<<<
3602 *
3603 * @cname('get_memview')
3604 */
3605 __Pyx_XDECREF(__pyx_r);
3606 __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
3607 __Pyx_GOTREF(__pyx_t_1);
3608 __pyx_r = __pyx_t_1;
3609 __pyx_t_1 = 0;
3610 goto __pyx_L0;
3611
3612 /* "View.MemoryView":222
3613 *
3614 * @property
3615 * def memview(self): # <<<<<<<<<<<<<<
3616 * return self.get_memview()
3617 *
3618 */
3619
3620 /* function exit code */
3621 __pyx_L1_error:;
3622 __Pyx_XDECREF(__pyx_t_1);
3623 __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3624 __pyx_r = NULL;
3625 __pyx_L0:;
3626 __Pyx_XGIVEREF(__pyx_r);
3627 __Pyx_RefNannyFinishContext();
3628 return __pyx_r;
3629 }
3630
3631 /* "View.MemoryView":226
3632 *
3633 * @cname('get_memview')
3634 * cdef get_memview(self): # <<<<<<<<<<<<<<
3635 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
3636 * return memoryview(self, flags, self.dtype_is_object)
3637 */
3638
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)3639 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
3640 int __pyx_v_flags;
3641 PyObject *__pyx_r = NULL;
3642 __Pyx_RefNannyDeclarations
3643 PyObject *__pyx_t_1 = NULL;
3644 PyObject *__pyx_t_2 = NULL;
3645 PyObject *__pyx_t_3 = NULL;
3646 int __pyx_lineno = 0;
3647 const char *__pyx_filename = NULL;
3648 int __pyx_clineno = 0;
3649 __Pyx_RefNannySetupContext("get_memview", 0);
3650
3651 /* "View.MemoryView":227
3652 * @cname('get_memview')
3653 * cdef get_memview(self):
3654 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
3655 * return memoryview(self, flags, self.dtype_is_object)
3656 *
3657 */
3658 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
3659
3660 /* "View.MemoryView":228
3661 * cdef get_memview(self):
3662 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
3663 * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
3664 *
3665 * def __len__(self):
3666 */
3667 __Pyx_XDECREF(__pyx_r);
3668 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
3669 __Pyx_GOTREF(__pyx_t_1);
3670 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
3671 __Pyx_GOTREF(__pyx_t_2);
3672 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
3673 __Pyx_GOTREF(__pyx_t_3);
3674 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3675 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3676 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
3677 __Pyx_GIVEREF(__pyx_t_1);
3678 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
3679 __Pyx_GIVEREF(__pyx_t_2);
3680 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
3681 __pyx_t_1 = 0;
3682 __pyx_t_2 = 0;
3683 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
3684 __Pyx_GOTREF(__pyx_t_2);
3685 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3686 __pyx_r = __pyx_t_2;
3687 __pyx_t_2 = 0;
3688 goto __pyx_L0;
3689
3690 /* "View.MemoryView":226
3691 *
3692 * @cname('get_memview')
3693 * cdef get_memview(self): # <<<<<<<<<<<<<<
3694 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
3695 * return memoryview(self, flags, self.dtype_is_object)
3696 */
3697
3698 /* function exit code */
3699 __pyx_L1_error:;
3700 __Pyx_XDECREF(__pyx_t_1);
3701 __Pyx_XDECREF(__pyx_t_2);
3702 __Pyx_XDECREF(__pyx_t_3);
3703 __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
3704 __pyx_r = 0;
3705 __pyx_L0:;
3706 __Pyx_XGIVEREF(__pyx_r);
3707 __Pyx_RefNannyFinishContext();
3708 return __pyx_r;
3709 }
3710
3711 /* "View.MemoryView":230
3712 * return memoryview(self, flags, self.dtype_is_object)
3713 *
3714 * def __len__(self): # <<<<<<<<<<<<<<
3715 * return self._shape[0]
3716 *
3717 */
3718
3719 /* Python wrapper */
3720 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)3721 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
3722 Py_ssize_t __pyx_r;
3723 __Pyx_RefNannyDeclarations
3724 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
3725 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
3726
3727 /* function exit code */
3728 __Pyx_RefNannyFinishContext();
3729 return __pyx_r;
3730 }
3731
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)3732 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
3733 Py_ssize_t __pyx_r;
3734 __Pyx_RefNannyDeclarations
3735 __Pyx_RefNannySetupContext("__len__", 0);
3736
3737 /* "View.MemoryView":231
3738 *
3739 * def __len__(self):
3740 * return self._shape[0] # <<<<<<<<<<<<<<
3741 *
3742 * def __getattr__(self, attr):
3743 */
3744 __pyx_r = (__pyx_v_self->_shape[0]);
3745 goto __pyx_L0;
3746
3747 /* "View.MemoryView":230
3748 * return memoryview(self, flags, self.dtype_is_object)
3749 *
3750 * def __len__(self): # <<<<<<<<<<<<<<
3751 * return self._shape[0]
3752 *
3753 */
3754
3755 /* function exit code */
3756 __pyx_L0:;
3757 __Pyx_RefNannyFinishContext();
3758 return __pyx_r;
3759 }
3760
3761 /* "View.MemoryView":233
3762 * return self._shape[0]
3763 *
3764 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
3765 * return getattr(self.memview, attr)
3766 *
3767 */
3768
3769 /* Python wrapper */
3770 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)3771 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
3772 PyObject *__pyx_r = 0;
3773 __Pyx_RefNannyDeclarations
3774 __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
3775 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
3776
3777 /* function exit code */
3778 __Pyx_RefNannyFinishContext();
3779 return __pyx_r;
3780 }
3781
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)3782 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
3783 PyObject *__pyx_r = NULL;
3784 __Pyx_RefNannyDeclarations
3785 PyObject *__pyx_t_1 = NULL;
3786 PyObject *__pyx_t_2 = NULL;
3787 int __pyx_lineno = 0;
3788 const char *__pyx_filename = NULL;
3789 int __pyx_clineno = 0;
3790 __Pyx_RefNannySetupContext("__getattr__", 0);
3791
3792 /* "View.MemoryView":234
3793 *
3794 * def __getattr__(self, attr):
3795 * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
3796 *
3797 * def __getitem__(self, item):
3798 */
3799 __Pyx_XDECREF(__pyx_r);
3800 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
3801 __Pyx_GOTREF(__pyx_t_1);
3802 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
3803 __Pyx_GOTREF(__pyx_t_2);
3804 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3805 __pyx_r = __pyx_t_2;
3806 __pyx_t_2 = 0;
3807 goto __pyx_L0;
3808
3809 /* "View.MemoryView":233
3810 * return self._shape[0]
3811 *
3812 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
3813 * return getattr(self.memview, attr)
3814 *
3815 */
3816
3817 /* function exit code */
3818 __pyx_L1_error:;
3819 __Pyx_XDECREF(__pyx_t_1);
3820 __Pyx_XDECREF(__pyx_t_2);
3821 __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3822 __pyx_r = NULL;
3823 __pyx_L0:;
3824 __Pyx_XGIVEREF(__pyx_r);
3825 __Pyx_RefNannyFinishContext();
3826 return __pyx_r;
3827 }
3828
3829 /* "View.MemoryView":236
3830 * return getattr(self.memview, attr)
3831 *
3832 * def __getitem__(self, item): # <<<<<<<<<<<<<<
3833 * return self.memview[item]
3834 *
3835 */
3836
3837 /* Python wrapper */
3838 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)3839 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
3840 PyObject *__pyx_r = 0;
3841 __Pyx_RefNannyDeclarations
3842 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
3843 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
3844
3845 /* function exit code */
3846 __Pyx_RefNannyFinishContext();
3847 return __pyx_r;
3848 }
3849
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)3850 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
3851 PyObject *__pyx_r = NULL;
3852 __Pyx_RefNannyDeclarations
3853 PyObject *__pyx_t_1 = NULL;
3854 PyObject *__pyx_t_2 = NULL;
3855 int __pyx_lineno = 0;
3856 const char *__pyx_filename = NULL;
3857 int __pyx_clineno = 0;
3858 __Pyx_RefNannySetupContext("__getitem__", 0);
3859
3860 /* "View.MemoryView":237
3861 *
3862 * def __getitem__(self, item):
3863 * return self.memview[item] # <<<<<<<<<<<<<<
3864 *
3865 * def __setitem__(self, item, value):
3866 */
3867 __Pyx_XDECREF(__pyx_r);
3868 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
3869 __Pyx_GOTREF(__pyx_t_1);
3870 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
3871 __Pyx_GOTREF(__pyx_t_2);
3872 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3873 __pyx_r = __pyx_t_2;
3874 __pyx_t_2 = 0;
3875 goto __pyx_L0;
3876
3877 /* "View.MemoryView":236
3878 * return getattr(self.memview, attr)
3879 *
3880 * def __getitem__(self, item): # <<<<<<<<<<<<<<
3881 * return self.memview[item]
3882 *
3883 */
3884
3885 /* function exit code */
3886 __pyx_L1_error:;
3887 __Pyx_XDECREF(__pyx_t_1);
3888 __Pyx_XDECREF(__pyx_t_2);
3889 __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3890 __pyx_r = NULL;
3891 __pyx_L0:;
3892 __Pyx_XGIVEREF(__pyx_r);
3893 __Pyx_RefNannyFinishContext();
3894 return __pyx_r;
3895 }
3896
3897 /* "View.MemoryView":239
3898 * return self.memview[item]
3899 *
3900 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
3901 * self.memview[item] = value
3902 *
3903 */
3904
3905 /* Python wrapper */
3906 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)3907 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
3908 int __pyx_r;
3909 __Pyx_RefNannyDeclarations
3910 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
3911 __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));
3912
3913 /* function exit code */
3914 __Pyx_RefNannyFinishContext();
3915 return __pyx_r;
3916 }
3917
__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)3918 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) {
3919 int __pyx_r;
3920 __Pyx_RefNannyDeclarations
3921 PyObject *__pyx_t_1 = NULL;
3922 int __pyx_lineno = 0;
3923 const char *__pyx_filename = NULL;
3924 int __pyx_clineno = 0;
3925 __Pyx_RefNannySetupContext("__setitem__", 0);
3926
3927 /* "View.MemoryView":240
3928 *
3929 * def __setitem__(self, item, value):
3930 * self.memview[item] = value # <<<<<<<<<<<<<<
3931 *
3932 *
3933 */
3934 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
3935 __Pyx_GOTREF(__pyx_t_1);
3936 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
3937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3938
3939 /* "View.MemoryView":239
3940 * return self.memview[item]
3941 *
3942 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
3943 * self.memview[item] = value
3944 *
3945 */
3946
3947 /* function exit code */
3948 __pyx_r = 0;
3949 goto __pyx_L0;
3950 __pyx_L1_error:;
3951 __Pyx_XDECREF(__pyx_t_1);
3952 __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3953 __pyx_r = -1;
3954 __pyx_L0:;
3955 __Pyx_RefNannyFinishContext();
3956 return __pyx_r;
3957 }
3958
3959 /* "(tree fragment)":1
3960 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3961 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3962 * def __setstate_cython__(self, __pyx_state):
3963 */
3964
3965 /* Python wrapper */
3966 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)3967 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3968 PyObject *__pyx_r = 0;
3969 __Pyx_RefNannyDeclarations
3970 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3971 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
3972
3973 /* function exit code */
3974 __Pyx_RefNannyFinishContext();
3975 return __pyx_r;
3976 }
3977
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)3978 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
3979 PyObject *__pyx_r = NULL;
3980 __Pyx_RefNannyDeclarations
3981 PyObject *__pyx_t_1 = NULL;
3982 int __pyx_lineno = 0;
3983 const char *__pyx_filename = NULL;
3984 int __pyx_clineno = 0;
3985 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3986
3987 /* "(tree fragment)":2
3988 * def __reduce_cython__(self):
3989 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
3990 * def __setstate_cython__(self, __pyx_state):
3991 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3992 */
3993 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3994 __Pyx_GOTREF(__pyx_t_1);
3995 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3996 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3997 __PYX_ERR(1, 2, __pyx_L1_error)
3998
3999 /* "(tree fragment)":1
4000 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4001 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4002 * def __setstate_cython__(self, __pyx_state):
4003 */
4004
4005 /* function exit code */
4006 __pyx_L1_error:;
4007 __Pyx_XDECREF(__pyx_t_1);
4008 __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4009 __pyx_r = NULL;
4010 __Pyx_XGIVEREF(__pyx_r);
4011 __Pyx_RefNannyFinishContext();
4012 return __pyx_r;
4013 }
4014
4015 /* "(tree fragment)":3
4016 * def __reduce_cython__(self):
4017 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4018 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4019 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4020 */
4021
4022 /* Python wrapper */
4023 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)4024 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4025 PyObject *__pyx_r = 0;
4026 __Pyx_RefNannyDeclarations
4027 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4028 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4029
4030 /* function exit code */
4031 __Pyx_RefNannyFinishContext();
4032 return __pyx_r;
4033 }
4034
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)4035 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) {
4036 PyObject *__pyx_r = NULL;
4037 __Pyx_RefNannyDeclarations
4038 PyObject *__pyx_t_1 = NULL;
4039 int __pyx_lineno = 0;
4040 const char *__pyx_filename = NULL;
4041 int __pyx_clineno = 0;
4042 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4043
4044 /* "(tree fragment)":4
4045 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4046 * def __setstate_cython__(self, __pyx_state):
4047 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
4048 */
4049 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4050 __Pyx_GOTREF(__pyx_t_1);
4051 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4052 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4053 __PYX_ERR(1, 4, __pyx_L1_error)
4054
4055 /* "(tree fragment)":3
4056 * def __reduce_cython__(self):
4057 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4058 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4059 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4060 */
4061
4062 /* function exit code */
4063 __pyx_L1_error:;
4064 __Pyx_XDECREF(__pyx_t_1);
4065 __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4066 __pyx_r = NULL;
4067 __Pyx_XGIVEREF(__pyx_r);
4068 __Pyx_RefNannyFinishContext();
4069 return __pyx_r;
4070 }
4071
4072 /* "View.MemoryView":244
4073 *
4074 * @cname("__pyx_array_new")
4075 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
4076 * char *mode, char *buf):
4077 * cdef array result
4078 */
4079
__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)4080 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) {
4081 struct __pyx_array_obj *__pyx_v_result = 0;
4082 struct __pyx_array_obj *__pyx_r = NULL;
4083 __Pyx_RefNannyDeclarations
4084 int __pyx_t_1;
4085 PyObject *__pyx_t_2 = NULL;
4086 PyObject *__pyx_t_3 = NULL;
4087 PyObject *__pyx_t_4 = NULL;
4088 PyObject *__pyx_t_5 = NULL;
4089 int __pyx_lineno = 0;
4090 const char *__pyx_filename = NULL;
4091 int __pyx_clineno = 0;
4092 __Pyx_RefNannySetupContext("array_cwrapper", 0);
4093
4094 /* "View.MemoryView":248
4095 * cdef array result
4096 *
4097 * if buf == NULL: # <<<<<<<<<<<<<<
4098 * result = array(shape, itemsize, format, mode.decode('ASCII'))
4099 * else:
4100 */
4101 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
4102 if (__pyx_t_1) {
4103
4104 /* "View.MemoryView":249
4105 *
4106 * if buf == NULL:
4107 * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
4108 * else:
4109 * result = array(shape, itemsize, format, mode.decode('ASCII'),
4110 */
4111 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
4112 __Pyx_GOTREF(__pyx_t_2);
4113 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
4114 __Pyx_GOTREF(__pyx_t_3);
4115 __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(1, 249, __pyx_L1_error)
4116 __Pyx_GOTREF(__pyx_t_4);
4117 __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
4118 __Pyx_GOTREF(__pyx_t_5);
4119 __Pyx_INCREF(__pyx_v_shape);
4120 __Pyx_GIVEREF(__pyx_v_shape);
4121 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
4122 __Pyx_GIVEREF(__pyx_t_2);
4123 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
4124 __Pyx_GIVEREF(__pyx_t_3);
4125 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
4126 __Pyx_GIVEREF(__pyx_t_4);
4127 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
4128 __pyx_t_2 = 0;
4129 __pyx_t_3 = 0;
4130 __pyx_t_4 = 0;
4131 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
4132 __Pyx_GOTREF(__pyx_t_4);
4133 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4134 __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
4135 __pyx_t_4 = 0;
4136
4137 /* "View.MemoryView":248
4138 * cdef array result
4139 *
4140 * if buf == NULL: # <<<<<<<<<<<<<<
4141 * result = array(shape, itemsize, format, mode.decode('ASCII'))
4142 * else:
4143 */
4144 goto __pyx_L3;
4145 }
4146
4147 /* "View.MemoryView":251
4148 * result = array(shape, itemsize, format, mode.decode('ASCII'))
4149 * else:
4150 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
4151 * allocate_buffer=False)
4152 * result.data = buf
4153 */
4154 /*else*/ {
4155 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
4156 __Pyx_GOTREF(__pyx_t_4);
4157 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
4158 __Pyx_GOTREF(__pyx_t_5);
4159 __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(1, 251, __pyx_L1_error)
4160 __Pyx_GOTREF(__pyx_t_3);
4161 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
4162 __Pyx_GOTREF(__pyx_t_2);
4163 __Pyx_INCREF(__pyx_v_shape);
4164 __Pyx_GIVEREF(__pyx_v_shape);
4165 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
4166 __Pyx_GIVEREF(__pyx_t_4);
4167 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
4168 __Pyx_GIVEREF(__pyx_t_5);
4169 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
4170 __Pyx_GIVEREF(__pyx_t_3);
4171 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
4172 __pyx_t_4 = 0;
4173 __pyx_t_5 = 0;
4174 __pyx_t_3 = 0;
4175
4176 /* "View.MemoryView":252
4177 * else:
4178 * result = array(shape, itemsize, format, mode.decode('ASCII'),
4179 * allocate_buffer=False) # <<<<<<<<<<<<<<
4180 * result.data = buf
4181 *
4182 */
4183 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
4184 __Pyx_GOTREF(__pyx_t_3);
4185 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
4186
4187 /* "View.MemoryView":251
4188 * result = array(shape, itemsize, format, mode.decode('ASCII'))
4189 * else:
4190 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
4191 * allocate_buffer=False)
4192 * result.data = buf
4193 */
4194 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
4195 __Pyx_GOTREF(__pyx_t_5);
4196 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4197 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4198 __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
4199 __pyx_t_5 = 0;
4200
4201 /* "View.MemoryView":253
4202 * result = array(shape, itemsize, format, mode.decode('ASCII'),
4203 * allocate_buffer=False)
4204 * result.data = buf # <<<<<<<<<<<<<<
4205 *
4206 * return result
4207 */
4208 __pyx_v_result->data = __pyx_v_buf;
4209 }
4210 __pyx_L3:;
4211
4212 /* "View.MemoryView":255
4213 * result.data = buf
4214 *
4215 * return result # <<<<<<<<<<<<<<
4216 *
4217 *
4218 */
4219 __Pyx_XDECREF(((PyObject *)__pyx_r));
4220 __Pyx_INCREF(((PyObject *)__pyx_v_result));
4221 __pyx_r = __pyx_v_result;
4222 goto __pyx_L0;
4223
4224 /* "View.MemoryView":244
4225 *
4226 * @cname("__pyx_array_new")
4227 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
4228 * char *mode, char *buf):
4229 * cdef array result
4230 */
4231
4232 /* function exit code */
4233 __pyx_L1_error:;
4234 __Pyx_XDECREF(__pyx_t_2);
4235 __Pyx_XDECREF(__pyx_t_3);
4236 __Pyx_XDECREF(__pyx_t_4);
4237 __Pyx_XDECREF(__pyx_t_5);
4238 __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
4239 __pyx_r = 0;
4240 __pyx_L0:;
4241 __Pyx_XDECREF((PyObject *)__pyx_v_result);
4242 __Pyx_XGIVEREF((PyObject *)__pyx_r);
4243 __Pyx_RefNannyFinishContext();
4244 return __pyx_r;
4245 }
4246
4247 /* "View.MemoryView":281
4248 * cdef class Enum(object):
4249 * cdef object name
4250 * def __init__(self, name): # <<<<<<<<<<<<<<
4251 * self.name = name
4252 * def __repr__(self):
4253 */
4254
4255 /* Python wrapper */
4256 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)4257 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4258 PyObject *__pyx_v_name = 0;
4259 int __pyx_lineno = 0;
4260 const char *__pyx_filename = NULL;
4261 int __pyx_clineno = 0;
4262 int __pyx_r;
4263 __Pyx_RefNannyDeclarations
4264 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4265 {
4266 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
4267 PyObject* values[1] = {0};
4268 if (unlikely(__pyx_kwds)) {
4269 Py_ssize_t kw_args;
4270 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4271 switch (pos_args) {
4272 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4273 CYTHON_FALLTHROUGH;
4274 case 0: break;
4275 default: goto __pyx_L5_argtuple_error;
4276 }
4277 kw_args = PyDict_Size(__pyx_kwds);
4278 switch (pos_args) {
4279 case 0:
4280 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
4281 else goto __pyx_L5_argtuple_error;
4282 }
4283 if (unlikely(kw_args > 0)) {
4284 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
4285 }
4286 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4287 goto __pyx_L5_argtuple_error;
4288 } else {
4289 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4290 }
4291 __pyx_v_name = values[0];
4292 }
4293 goto __pyx_L4_argument_unpacking_done;
4294 __pyx_L5_argtuple_error:;
4295 __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
4296 __pyx_L3_error:;
4297 __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4298 __Pyx_RefNannyFinishContext();
4299 return -1;
4300 __pyx_L4_argument_unpacking_done:;
4301 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
4302
4303 /* function exit code */
4304 __Pyx_RefNannyFinishContext();
4305 return __pyx_r;
4306 }
4307
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)4308 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
4309 int __pyx_r;
4310 __Pyx_RefNannyDeclarations
4311 __Pyx_RefNannySetupContext("__init__", 0);
4312
4313 /* "View.MemoryView":282
4314 * cdef object name
4315 * def __init__(self, name):
4316 * self.name = name # <<<<<<<<<<<<<<
4317 * def __repr__(self):
4318 * return self.name
4319 */
4320 __Pyx_INCREF(__pyx_v_name);
4321 __Pyx_GIVEREF(__pyx_v_name);
4322 __Pyx_GOTREF(__pyx_v_self->name);
4323 __Pyx_DECREF(__pyx_v_self->name);
4324 __pyx_v_self->name = __pyx_v_name;
4325
4326 /* "View.MemoryView":281
4327 * cdef class Enum(object):
4328 * cdef object name
4329 * def __init__(self, name): # <<<<<<<<<<<<<<
4330 * self.name = name
4331 * def __repr__(self):
4332 */
4333
4334 /* function exit code */
4335 __pyx_r = 0;
4336 __Pyx_RefNannyFinishContext();
4337 return __pyx_r;
4338 }
4339
4340 /* "View.MemoryView":283
4341 * def __init__(self, name):
4342 * self.name = name
4343 * def __repr__(self): # <<<<<<<<<<<<<<
4344 * return self.name
4345 *
4346 */
4347
4348 /* Python wrapper */
4349 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)4350 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
4351 PyObject *__pyx_r = 0;
4352 __Pyx_RefNannyDeclarations
4353 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
4354 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
4355
4356 /* function exit code */
4357 __Pyx_RefNannyFinishContext();
4358 return __pyx_r;
4359 }
4360
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)4361 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
4362 PyObject *__pyx_r = NULL;
4363 __Pyx_RefNannyDeclarations
4364 __Pyx_RefNannySetupContext("__repr__", 0);
4365
4366 /* "View.MemoryView":284
4367 * self.name = name
4368 * def __repr__(self):
4369 * return self.name # <<<<<<<<<<<<<<
4370 *
4371 * cdef generic = Enum("<strided and direct or indirect>")
4372 */
4373 __Pyx_XDECREF(__pyx_r);
4374 __Pyx_INCREF(__pyx_v_self->name);
4375 __pyx_r = __pyx_v_self->name;
4376 goto __pyx_L0;
4377
4378 /* "View.MemoryView":283
4379 * def __init__(self, name):
4380 * self.name = name
4381 * def __repr__(self): # <<<<<<<<<<<<<<
4382 * return self.name
4383 *
4384 */
4385
4386 /* function exit code */
4387 __pyx_L0:;
4388 __Pyx_XGIVEREF(__pyx_r);
4389 __Pyx_RefNannyFinishContext();
4390 return __pyx_r;
4391 }
4392
4393 /* "(tree fragment)":1
4394 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4395 * cdef tuple state
4396 * cdef object _dict
4397 */
4398
4399 /* Python wrapper */
4400 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)4401 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4402 PyObject *__pyx_r = 0;
4403 __Pyx_RefNannyDeclarations
4404 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4405 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
4406
4407 /* function exit code */
4408 __Pyx_RefNannyFinishContext();
4409 return __pyx_r;
4410 }
4411
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)4412 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
4413 PyObject *__pyx_v_state = 0;
4414 PyObject *__pyx_v__dict = 0;
4415 int __pyx_v_use_setstate;
4416 PyObject *__pyx_r = NULL;
4417 __Pyx_RefNannyDeclarations
4418 PyObject *__pyx_t_1 = NULL;
4419 int __pyx_t_2;
4420 int __pyx_t_3;
4421 PyObject *__pyx_t_4 = NULL;
4422 PyObject *__pyx_t_5 = NULL;
4423 int __pyx_lineno = 0;
4424 const char *__pyx_filename = NULL;
4425 int __pyx_clineno = 0;
4426 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4427
4428 /* "(tree fragment)":5
4429 * cdef object _dict
4430 * cdef bint use_setstate
4431 * state = (self.name,) # <<<<<<<<<<<<<<
4432 * _dict = getattr(self, '__dict__', None)
4433 * if _dict is not None:
4434 */
4435 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
4436 __Pyx_GOTREF(__pyx_t_1);
4437 __Pyx_INCREF(__pyx_v_self->name);
4438 __Pyx_GIVEREF(__pyx_v_self->name);
4439 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
4440 __pyx_v_state = ((PyObject*)__pyx_t_1);
4441 __pyx_t_1 = 0;
4442
4443 /* "(tree fragment)":6
4444 * cdef bint use_setstate
4445 * state = (self.name,)
4446 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
4447 * if _dict is not None:
4448 * state += (_dict,)
4449 */
4450 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
4451 __Pyx_GOTREF(__pyx_t_1);
4452 __pyx_v__dict = __pyx_t_1;
4453 __pyx_t_1 = 0;
4454
4455 /* "(tree fragment)":7
4456 * state = (self.name,)
4457 * _dict = getattr(self, '__dict__', None)
4458 * if _dict is not None: # <<<<<<<<<<<<<<
4459 * state += (_dict,)
4460 * use_setstate = True
4461 */
4462 __pyx_t_2 = (__pyx_v__dict != Py_None);
4463 __pyx_t_3 = (__pyx_t_2 != 0);
4464 if (__pyx_t_3) {
4465
4466 /* "(tree fragment)":8
4467 * _dict = getattr(self, '__dict__', None)
4468 * if _dict is not None:
4469 * state += (_dict,) # <<<<<<<<<<<<<<
4470 * use_setstate = True
4471 * else:
4472 */
4473 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
4474 __Pyx_GOTREF(__pyx_t_1);
4475 __Pyx_INCREF(__pyx_v__dict);
4476 __Pyx_GIVEREF(__pyx_v__dict);
4477 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
4478 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
4479 __Pyx_GOTREF(__pyx_t_4);
4480 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4481 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
4482 __pyx_t_4 = 0;
4483
4484 /* "(tree fragment)":9
4485 * if _dict is not None:
4486 * state += (_dict,)
4487 * use_setstate = True # <<<<<<<<<<<<<<
4488 * else:
4489 * use_setstate = self.name is not None
4490 */
4491 __pyx_v_use_setstate = 1;
4492
4493 /* "(tree fragment)":7
4494 * state = (self.name,)
4495 * _dict = getattr(self, '__dict__', None)
4496 * if _dict is not None: # <<<<<<<<<<<<<<
4497 * state += (_dict,)
4498 * use_setstate = True
4499 */
4500 goto __pyx_L3;
4501 }
4502
4503 /* "(tree fragment)":11
4504 * use_setstate = True
4505 * else:
4506 * use_setstate = self.name is not None # <<<<<<<<<<<<<<
4507 * if use_setstate:
4508 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
4509 */
4510 /*else*/ {
4511 __pyx_t_3 = (__pyx_v_self->name != Py_None);
4512 __pyx_v_use_setstate = __pyx_t_3;
4513 }
4514 __pyx_L3:;
4515
4516 /* "(tree fragment)":12
4517 * else:
4518 * use_setstate = self.name is not None
4519 * if use_setstate: # <<<<<<<<<<<<<<
4520 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
4521 * else:
4522 */
4523 __pyx_t_3 = (__pyx_v_use_setstate != 0);
4524 if (__pyx_t_3) {
4525
4526 /* "(tree fragment)":13
4527 * use_setstate = self.name is not None
4528 * if use_setstate:
4529 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
4530 * else:
4531 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
4532 */
4533 __Pyx_XDECREF(__pyx_r);
4534 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
4535 __Pyx_GOTREF(__pyx_t_4);
4536 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
4537 __Pyx_GOTREF(__pyx_t_1);
4538 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4539 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4540 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4541 __Pyx_INCREF(__pyx_int_184977713);
4542 __Pyx_GIVEREF(__pyx_int_184977713);
4543 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
4544 __Pyx_INCREF(Py_None);
4545 __Pyx_GIVEREF(Py_None);
4546 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
4547 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
4548 __Pyx_GOTREF(__pyx_t_5);
4549 __Pyx_GIVEREF(__pyx_t_4);
4550 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
4551 __Pyx_GIVEREF(__pyx_t_1);
4552 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
4553 __Pyx_INCREF(__pyx_v_state);
4554 __Pyx_GIVEREF(__pyx_v_state);
4555 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
4556 __pyx_t_4 = 0;
4557 __pyx_t_1 = 0;
4558 __pyx_r = __pyx_t_5;
4559 __pyx_t_5 = 0;
4560 goto __pyx_L0;
4561
4562 /* "(tree fragment)":12
4563 * else:
4564 * use_setstate = self.name is not None
4565 * if use_setstate: # <<<<<<<<<<<<<<
4566 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
4567 * else:
4568 */
4569 }
4570
4571 /* "(tree fragment)":15
4572 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
4573 * else:
4574 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
4575 * def __setstate_cython__(self, __pyx_state):
4576 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
4577 */
4578 /*else*/ {
4579 __Pyx_XDECREF(__pyx_r);
4580 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
4581 __Pyx_GOTREF(__pyx_t_5);
4582 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
4583 __Pyx_GOTREF(__pyx_t_1);
4584 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4585 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4586 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4587 __Pyx_INCREF(__pyx_int_184977713);
4588 __Pyx_GIVEREF(__pyx_int_184977713);
4589 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
4590 __Pyx_INCREF(__pyx_v_state);
4591 __Pyx_GIVEREF(__pyx_v_state);
4592 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
4593 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
4594 __Pyx_GOTREF(__pyx_t_4);
4595 __Pyx_GIVEREF(__pyx_t_5);
4596 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
4597 __Pyx_GIVEREF(__pyx_t_1);
4598 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
4599 __pyx_t_5 = 0;
4600 __pyx_t_1 = 0;
4601 __pyx_r = __pyx_t_4;
4602 __pyx_t_4 = 0;
4603 goto __pyx_L0;
4604 }
4605
4606 /* "(tree fragment)":1
4607 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4608 * cdef tuple state
4609 * cdef object _dict
4610 */
4611
4612 /* function exit code */
4613 __pyx_L1_error:;
4614 __Pyx_XDECREF(__pyx_t_1);
4615 __Pyx_XDECREF(__pyx_t_4);
4616 __Pyx_XDECREF(__pyx_t_5);
4617 __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4618 __pyx_r = NULL;
4619 __pyx_L0:;
4620 __Pyx_XDECREF(__pyx_v_state);
4621 __Pyx_XDECREF(__pyx_v__dict);
4622 __Pyx_XGIVEREF(__pyx_r);
4623 __Pyx_RefNannyFinishContext();
4624 return __pyx_r;
4625 }
4626
4627 /* "(tree fragment)":16
4628 * else:
4629 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
4630 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4631 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
4632 */
4633
4634 /* Python wrapper */
4635 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)4636 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4637 PyObject *__pyx_r = 0;
4638 __Pyx_RefNannyDeclarations
4639 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4640 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4641
4642 /* function exit code */
4643 __Pyx_RefNannyFinishContext();
4644 return __pyx_r;
4645 }
4646
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)4647 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4648 PyObject *__pyx_r = NULL;
4649 __Pyx_RefNannyDeclarations
4650 PyObject *__pyx_t_1 = NULL;
4651 int __pyx_lineno = 0;
4652 const char *__pyx_filename = NULL;
4653 int __pyx_clineno = 0;
4654 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4655
4656 /* "(tree fragment)":17
4657 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
4658 * def __setstate_cython__(self, __pyx_state):
4659 * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
4660 */
4661 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
4662 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
4663 __Pyx_GOTREF(__pyx_t_1);
4664 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4665
4666 /* "(tree fragment)":16
4667 * else:
4668 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
4669 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4670 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
4671 */
4672
4673 /* function exit code */
4674 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4675 goto __pyx_L0;
4676 __pyx_L1_error:;
4677 __Pyx_XDECREF(__pyx_t_1);
4678 __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4679 __pyx_r = NULL;
4680 __pyx_L0:;
4681 __Pyx_XGIVEREF(__pyx_r);
4682 __Pyx_RefNannyFinishContext();
4683 return __pyx_r;
4684 }
4685
4686 /* "View.MemoryView":298
4687 *
4688 * @cname('__pyx_align_pointer')
4689 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
4690 * "Align pointer memory on a given boundary"
4691 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
4692 */
4693
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)4694 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
4695 Py_intptr_t __pyx_v_aligned_p;
4696 size_t __pyx_v_offset;
4697 void *__pyx_r;
4698 int __pyx_t_1;
4699
4700 /* "View.MemoryView":300
4701 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
4702 * "Align pointer memory on a given boundary"
4703 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
4704 * cdef size_t offset
4705 *
4706 */
4707 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
4708
4709 /* "View.MemoryView":304
4710 *
4711 * with cython.cdivision(True):
4712 * offset = aligned_p % alignment # <<<<<<<<<<<<<<
4713 *
4714 * if offset > 0:
4715 */
4716 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
4717
4718 /* "View.MemoryView":306
4719 * offset = aligned_p % alignment
4720 *
4721 * if offset > 0: # <<<<<<<<<<<<<<
4722 * aligned_p += alignment - offset
4723 *
4724 */
4725 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
4726 if (__pyx_t_1) {
4727
4728 /* "View.MemoryView":307
4729 *
4730 * if offset > 0:
4731 * aligned_p += alignment - offset # <<<<<<<<<<<<<<
4732 *
4733 * return <void *> aligned_p
4734 */
4735 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
4736
4737 /* "View.MemoryView":306
4738 * offset = aligned_p % alignment
4739 *
4740 * if offset > 0: # <<<<<<<<<<<<<<
4741 * aligned_p += alignment - offset
4742 *
4743 */
4744 }
4745
4746 /* "View.MemoryView":309
4747 * aligned_p += alignment - offset
4748 *
4749 * return <void *> aligned_p # <<<<<<<<<<<<<<
4750 *
4751 *
4752 */
4753 __pyx_r = ((void *)__pyx_v_aligned_p);
4754 goto __pyx_L0;
4755
4756 /* "View.MemoryView":298
4757 *
4758 * @cname('__pyx_align_pointer')
4759 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
4760 * "Align pointer memory on a given boundary"
4761 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
4762 */
4763
4764 /* function exit code */
4765 __pyx_L0:;
4766 return __pyx_r;
4767 }
4768
4769 /* "View.MemoryView":345
4770 * cdef __Pyx_TypeInfo *typeinfo
4771 *
4772 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
4773 * self.obj = obj
4774 * self.flags = flags
4775 */
4776
4777 /* Python wrapper */
4778 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)4779 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4780 PyObject *__pyx_v_obj = 0;
4781 int __pyx_v_flags;
4782 int __pyx_v_dtype_is_object;
4783 int __pyx_lineno = 0;
4784 const char *__pyx_filename = NULL;
4785 int __pyx_clineno = 0;
4786 int __pyx_r;
4787 __Pyx_RefNannyDeclarations
4788 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
4789 {
4790 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
4791 PyObject* values[3] = {0,0,0};
4792 if (unlikely(__pyx_kwds)) {
4793 Py_ssize_t kw_args;
4794 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4795 switch (pos_args) {
4796 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4797 CYTHON_FALLTHROUGH;
4798 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4799 CYTHON_FALLTHROUGH;
4800 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4801 CYTHON_FALLTHROUGH;
4802 case 0: break;
4803 default: goto __pyx_L5_argtuple_error;
4804 }
4805 kw_args = PyDict_Size(__pyx_kwds);
4806 switch (pos_args) {
4807 case 0:
4808 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
4809 else goto __pyx_L5_argtuple_error;
4810 CYTHON_FALLTHROUGH;
4811 case 1:
4812 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
4813 else {
4814 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
4815 }
4816 CYTHON_FALLTHROUGH;
4817 case 2:
4818 if (kw_args > 0) {
4819 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
4820 if (value) { values[2] = value; kw_args--; }
4821 }
4822 }
4823 if (unlikely(kw_args > 0)) {
4824 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
4825 }
4826 } else {
4827 switch (PyTuple_GET_SIZE(__pyx_args)) {
4828 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4829 CYTHON_FALLTHROUGH;
4830 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4831 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4832 break;
4833 default: goto __pyx_L5_argtuple_error;
4834 }
4835 }
4836 __pyx_v_obj = values[0];
4837 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
4838 if (values[2]) {
4839 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
4840 } else {
4841 __pyx_v_dtype_is_object = ((int)0);
4842 }
4843 }
4844 goto __pyx_L4_argument_unpacking_done;
4845 __pyx_L5_argtuple_error:;
4846 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
4847 __pyx_L3_error:;
4848 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4849 __Pyx_RefNannyFinishContext();
4850 return -1;
4851 __pyx_L4_argument_unpacking_done:;
4852 __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);
4853
4854 /* function exit code */
4855 __Pyx_RefNannyFinishContext();
4856 return __pyx_r;
4857 }
4858
__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)4859 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) {
4860 int __pyx_r;
4861 __Pyx_RefNannyDeclarations
4862 int __pyx_t_1;
4863 int __pyx_t_2;
4864 int __pyx_t_3;
4865 int __pyx_t_4;
4866 int __pyx_lineno = 0;
4867 const char *__pyx_filename = NULL;
4868 int __pyx_clineno = 0;
4869 __Pyx_RefNannySetupContext("__cinit__", 0);
4870
4871 /* "View.MemoryView":346
4872 *
4873 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
4874 * self.obj = obj # <<<<<<<<<<<<<<
4875 * self.flags = flags
4876 * if type(self) is memoryview or obj is not None:
4877 */
4878 __Pyx_INCREF(__pyx_v_obj);
4879 __Pyx_GIVEREF(__pyx_v_obj);
4880 __Pyx_GOTREF(__pyx_v_self->obj);
4881 __Pyx_DECREF(__pyx_v_self->obj);
4882 __pyx_v_self->obj = __pyx_v_obj;
4883
4884 /* "View.MemoryView":347
4885 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
4886 * self.obj = obj
4887 * self.flags = flags # <<<<<<<<<<<<<<
4888 * if type(self) is memoryview or obj is not None:
4889 * __Pyx_GetBuffer(obj, &self.view, flags)
4890 */
4891 __pyx_v_self->flags = __pyx_v_flags;
4892
4893 /* "View.MemoryView":348
4894 * self.obj = obj
4895 * self.flags = flags
4896 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
4897 * __Pyx_GetBuffer(obj, &self.view, flags)
4898 * if <PyObject *> self.view.obj == NULL:
4899 */
4900 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
4901 __pyx_t_3 = (__pyx_t_2 != 0);
4902 if (!__pyx_t_3) {
4903 } else {
4904 __pyx_t_1 = __pyx_t_3;
4905 goto __pyx_L4_bool_binop_done;
4906 }
4907 __pyx_t_3 = (__pyx_v_obj != Py_None);
4908 __pyx_t_2 = (__pyx_t_3 != 0);
4909 __pyx_t_1 = __pyx_t_2;
4910 __pyx_L4_bool_binop_done:;
4911 if (__pyx_t_1) {
4912
4913 /* "View.MemoryView":349
4914 * self.flags = flags
4915 * if type(self) is memoryview or obj is not None:
4916 * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
4917 * if <PyObject *> self.view.obj == NULL:
4918 * (<__pyx_buffer *> &self.view).obj = Py_None
4919 */
4920 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
4921
4922 /* "View.MemoryView":350
4923 * if type(self) is memoryview or obj is not None:
4924 * __Pyx_GetBuffer(obj, &self.view, flags)
4925 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
4926 * (<__pyx_buffer *> &self.view).obj = Py_None
4927 * Py_INCREF(Py_None)
4928 */
4929 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
4930 if (__pyx_t_1) {
4931
4932 /* "View.MemoryView":351
4933 * __Pyx_GetBuffer(obj, &self.view, flags)
4934 * if <PyObject *> self.view.obj == NULL:
4935 * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
4936 * Py_INCREF(Py_None)
4937 *
4938 */
4939 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
4940
4941 /* "View.MemoryView":352
4942 * if <PyObject *> self.view.obj == NULL:
4943 * (<__pyx_buffer *> &self.view).obj = Py_None
4944 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
4945 *
4946 * global __pyx_memoryview_thread_locks_used
4947 */
4948 Py_INCREF(Py_None);
4949
4950 /* "View.MemoryView":350
4951 * if type(self) is memoryview or obj is not None:
4952 * __Pyx_GetBuffer(obj, &self.view, flags)
4953 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
4954 * (<__pyx_buffer *> &self.view).obj = Py_None
4955 * Py_INCREF(Py_None)
4956 */
4957 }
4958
4959 /* "View.MemoryView":348
4960 * self.obj = obj
4961 * self.flags = flags
4962 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
4963 * __Pyx_GetBuffer(obj, &self.view, flags)
4964 * if <PyObject *> self.view.obj == NULL:
4965 */
4966 }
4967
4968 /* "View.MemoryView":355
4969 *
4970 * global __pyx_memoryview_thread_locks_used
4971 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
4972 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
4973 * __pyx_memoryview_thread_locks_used += 1
4974 */
4975 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
4976 if (__pyx_t_1) {
4977
4978 /* "View.MemoryView":356
4979 * global __pyx_memoryview_thread_locks_used
4980 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
4981 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
4982 * __pyx_memoryview_thread_locks_used += 1
4983 * if self.lock is NULL:
4984 */
4985 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
4986
4987 /* "View.MemoryView":357
4988 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
4989 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
4990 * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
4991 * if self.lock is NULL:
4992 * self.lock = PyThread_allocate_lock()
4993 */
4994 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
4995
4996 /* "View.MemoryView":355
4997 *
4998 * global __pyx_memoryview_thread_locks_used
4999 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
5000 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
5001 * __pyx_memoryview_thread_locks_used += 1
5002 */
5003 }
5004
5005 /* "View.MemoryView":358
5006 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
5007 * __pyx_memoryview_thread_locks_used += 1
5008 * if self.lock is NULL: # <<<<<<<<<<<<<<
5009 * self.lock = PyThread_allocate_lock()
5010 * if self.lock is NULL:
5011 */
5012 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
5013 if (__pyx_t_1) {
5014
5015 /* "View.MemoryView":359
5016 * __pyx_memoryview_thread_locks_used += 1
5017 * if self.lock is NULL:
5018 * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
5019 * if self.lock is NULL:
5020 * raise MemoryError
5021 */
5022 __pyx_v_self->lock = PyThread_allocate_lock();
5023
5024 /* "View.MemoryView":360
5025 * if self.lock is NULL:
5026 * self.lock = PyThread_allocate_lock()
5027 * if self.lock is NULL: # <<<<<<<<<<<<<<
5028 * raise MemoryError
5029 *
5030 */
5031 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
5032 if (unlikely(__pyx_t_1)) {
5033
5034 /* "View.MemoryView":361
5035 * self.lock = PyThread_allocate_lock()
5036 * if self.lock is NULL:
5037 * raise MemoryError # <<<<<<<<<<<<<<
5038 *
5039 * if flags & PyBUF_FORMAT:
5040 */
5041 PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
5042
5043 /* "View.MemoryView":360
5044 * if self.lock is NULL:
5045 * self.lock = PyThread_allocate_lock()
5046 * if self.lock is NULL: # <<<<<<<<<<<<<<
5047 * raise MemoryError
5048 *
5049 */
5050 }
5051
5052 /* "View.MemoryView":358
5053 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
5054 * __pyx_memoryview_thread_locks_used += 1
5055 * if self.lock is NULL: # <<<<<<<<<<<<<<
5056 * self.lock = PyThread_allocate_lock()
5057 * if self.lock is NULL:
5058 */
5059 }
5060
5061 /* "View.MemoryView":363
5062 * raise MemoryError
5063 *
5064 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
5065 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
5066 * else:
5067 */
5068 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
5069 if (__pyx_t_1) {
5070
5071 /* "View.MemoryView":364
5072 *
5073 * if flags & PyBUF_FORMAT:
5074 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
5075 * else:
5076 * self.dtype_is_object = dtype_is_object
5077 */
5078 __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
5079 if (__pyx_t_2) {
5080 } else {
5081 __pyx_t_1 = __pyx_t_2;
5082 goto __pyx_L11_bool_binop_done;
5083 }
5084 __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
5085 __pyx_t_1 = __pyx_t_2;
5086 __pyx_L11_bool_binop_done:;
5087 __pyx_v_self->dtype_is_object = __pyx_t_1;
5088
5089 /* "View.MemoryView":363
5090 * raise MemoryError
5091 *
5092 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
5093 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
5094 * else:
5095 */
5096 goto __pyx_L10;
5097 }
5098
5099 /* "View.MemoryView":366
5100 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
5101 * else:
5102 * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
5103 *
5104 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
5105 */
5106 /*else*/ {
5107 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
5108 }
5109 __pyx_L10:;
5110
5111 /* "View.MemoryView":368
5112 * self.dtype_is_object = dtype_is_object
5113 *
5114 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
5115 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
5116 * self.typeinfo = NULL
5117 */
5118 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
5119
5120 /* "View.MemoryView":370
5121 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
5122 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
5123 * self.typeinfo = NULL # <<<<<<<<<<<<<<
5124 *
5125 * def __dealloc__(memoryview self):
5126 */
5127 __pyx_v_self->typeinfo = NULL;
5128
5129 /* "View.MemoryView":345
5130 * cdef __Pyx_TypeInfo *typeinfo
5131 *
5132 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
5133 * self.obj = obj
5134 * self.flags = flags
5135 */
5136
5137 /* function exit code */
5138 __pyx_r = 0;
5139 goto __pyx_L0;
5140 __pyx_L1_error:;
5141 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5142 __pyx_r = -1;
5143 __pyx_L0:;
5144 __Pyx_RefNannyFinishContext();
5145 return __pyx_r;
5146 }
5147
5148 /* "View.MemoryView":372
5149 * self.typeinfo = NULL
5150 *
5151 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
5152 * if self.obj is not None:
5153 * __Pyx_ReleaseBuffer(&self.view)
5154 */
5155
5156 /* Python wrapper */
5157 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)5158 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
5159 __Pyx_RefNannyDeclarations
5160 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5161 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
5162
5163 /* function exit code */
5164 __Pyx_RefNannyFinishContext();
5165 }
5166
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)5167 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
5168 int __pyx_v_i;
5169 __Pyx_RefNannyDeclarations
5170 int __pyx_t_1;
5171 int __pyx_t_2;
5172 int __pyx_t_3;
5173 int __pyx_t_4;
5174 int __pyx_t_5;
5175 PyThread_type_lock __pyx_t_6;
5176 PyThread_type_lock __pyx_t_7;
5177 __Pyx_RefNannySetupContext("__dealloc__", 0);
5178
5179 /* "View.MemoryView":373
5180 *
5181 * def __dealloc__(memoryview self):
5182 * if self.obj is not None: # <<<<<<<<<<<<<<
5183 * __Pyx_ReleaseBuffer(&self.view)
5184 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
5185 */
5186 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
5187 __pyx_t_2 = (__pyx_t_1 != 0);
5188 if (__pyx_t_2) {
5189
5190 /* "View.MemoryView":374
5191 * def __dealloc__(memoryview self):
5192 * if self.obj is not None:
5193 * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
5194 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
5195 *
5196 */
5197 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
5198
5199 /* "View.MemoryView":373
5200 *
5201 * def __dealloc__(memoryview self):
5202 * if self.obj is not None: # <<<<<<<<<<<<<<
5203 * __Pyx_ReleaseBuffer(&self.view)
5204 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
5205 */
5206 goto __pyx_L3;
5207 }
5208
5209 /* "View.MemoryView":375
5210 * if self.obj is not None:
5211 * __Pyx_ReleaseBuffer(&self.view)
5212 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
5213 *
5214 * (<__pyx_buffer *> &self.view).obj = NULL
5215 */
5216 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
5217 if (__pyx_t_2) {
5218
5219 /* "View.MemoryView":377
5220 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
5221 *
5222 * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
5223 * Py_DECREF(Py_None)
5224 *
5225 */
5226 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
5227
5228 /* "View.MemoryView":378
5229 *
5230 * (<__pyx_buffer *> &self.view).obj = NULL
5231 * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
5232 *
5233 * cdef int i
5234 */
5235 Py_DECREF(Py_None);
5236
5237 /* "View.MemoryView":375
5238 * if self.obj is not None:
5239 * __Pyx_ReleaseBuffer(&self.view)
5240 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
5241 *
5242 * (<__pyx_buffer *> &self.view).obj = NULL
5243 */
5244 }
5245 __pyx_L3:;
5246
5247 /* "View.MemoryView":382
5248 * cdef int i
5249 * global __pyx_memoryview_thread_locks_used
5250 * if self.lock != NULL: # <<<<<<<<<<<<<<
5251 * for i in range(__pyx_memoryview_thread_locks_used):
5252 * if __pyx_memoryview_thread_locks[i] is self.lock:
5253 */
5254 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
5255 if (__pyx_t_2) {
5256
5257 /* "View.MemoryView":383
5258 * global __pyx_memoryview_thread_locks_used
5259 * if self.lock != NULL:
5260 * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
5261 * if __pyx_memoryview_thread_locks[i] is self.lock:
5262 * __pyx_memoryview_thread_locks_used -= 1
5263 */
5264 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
5265 __pyx_t_4 = __pyx_t_3;
5266 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
5267 __pyx_v_i = __pyx_t_5;
5268
5269 /* "View.MemoryView":384
5270 * if self.lock != NULL:
5271 * for i in range(__pyx_memoryview_thread_locks_used):
5272 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
5273 * __pyx_memoryview_thread_locks_used -= 1
5274 * if i != __pyx_memoryview_thread_locks_used:
5275 */
5276 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
5277 if (__pyx_t_2) {
5278
5279 /* "View.MemoryView":385
5280 * for i in range(__pyx_memoryview_thread_locks_used):
5281 * if __pyx_memoryview_thread_locks[i] is self.lock:
5282 * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
5283 * if i != __pyx_memoryview_thread_locks_used:
5284 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
5285 */
5286 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
5287
5288 /* "View.MemoryView":386
5289 * if __pyx_memoryview_thread_locks[i] is self.lock:
5290 * __pyx_memoryview_thread_locks_used -= 1
5291 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
5292 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
5293 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
5294 */
5295 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
5296 if (__pyx_t_2) {
5297
5298 /* "View.MemoryView":388
5299 * if i != __pyx_memoryview_thread_locks_used:
5300 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
5301 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
5302 * break
5303 * else:
5304 */
5305 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
5306 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
5307
5308 /* "View.MemoryView":387
5309 * __pyx_memoryview_thread_locks_used -= 1
5310 * if i != __pyx_memoryview_thread_locks_used:
5311 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
5312 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
5313 * break
5314 */
5315 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
5316 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
5317
5318 /* "View.MemoryView":386
5319 * if __pyx_memoryview_thread_locks[i] is self.lock:
5320 * __pyx_memoryview_thread_locks_used -= 1
5321 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
5322 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
5323 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
5324 */
5325 }
5326
5327 /* "View.MemoryView":389
5328 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
5329 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
5330 * break # <<<<<<<<<<<<<<
5331 * else:
5332 * PyThread_free_lock(self.lock)
5333 */
5334 goto __pyx_L6_break;
5335
5336 /* "View.MemoryView":384
5337 * if self.lock != NULL:
5338 * for i in range(__pyx_memoryview_thread_locks_used):
5339 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
5340 * __pyx_memoryview_thread_locks_used -= 1
5341 * if i != __pyx_memoryview_thread_locks_used:
5342 */
5343 }
5344 }
5345 /*else*/ {
5346
5347 /* "View.MemoryView":391
5348 * break
5349 * else:
5350 * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
5351 *
5352 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
5353 */
5354 PyThread_free_lock(__pyx_v_self->lock);
5355 }
5356 __pyx_L6_break:;
5357
5358 /* "View.MemoryView":382
5359 * cdef int i
5360 * global __pyx_memoryview_thread_locks_used
5361 * if self.lock != NULL: # <<<<<<<<<<<<<<
5362 * for i in range(__pyx_memoryview_thread_locks_used):
5363 * if __pyx_memoryview_thread_locks[i] is self.lock:
5364 */
5365 }
5366
5367 /* "View.MemoryView":372
5368 * self.typeinfo = NULL
5369 *
5370 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
5371 * if self.obj is not None:
5372 * __Pyx_ReleaseBuffer(&self.view)
5373 */
5374
5375 /* function exit code */
5376 __Pyx_RefNannyFinishContext();
5377 }
5378
5379 /* "View.MemoryView":393
5380 * PyThread_free_lock(self.lock)
5381 *
5382 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
5383 * cdef Py_ssize_t dim
5384 * cdef char *itemp = <char *> self.view.buf
5385 */
5386
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)5387 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
5388 Py_ssize_t __pyx_v_dim;
5389 char *__pyx_v_itemp;
5390 PyObject *__pyx_v_idx = NULL;
5391 char *__pyx_r;
5392 __Pyx_RefNannyDeclarations
5393 Py_ssize_t __pyx_t_1;
5394 PyObject *__pyx_t_2 = NULL;
5395 Py_ssize_t __pyx_t_3;
5396 PyObject *(*__pyx_t_4)(PyObject *);
5397 PyObject *__pyx_t_5 = NULL;
5398 Py_ssize_t __pyx_t_6;
5399 char *__pyx_t_7;
5400 int __pyx_lineno = 0;
5401 const char *__pyx_filename = NULL;
5402 int __pyx_clineno = 0;
5403 __Pyx_RefNannySetupContext("get_item_pointer", 0);
5404
5405 /* "View.MemoryView":395
5406 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
5407 * cdef Py_ssize_t dim
5408 * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
5409 *
5410 * for dim, idx in enumerate(index):
5411 */
5412 __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
5413
5414 /* "View.MemoryView":397
5415 * cdef char *itemp = <char *> self.view.buf
5416 *
5417 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
5418 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
5419 *
5420 */
5421 __pyx_t_1 = 0;
5422 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
5423 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
5424 __pyx_t_4 = NULL;
5425 } else {
5426 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
5427 __Pyx_GOTREF(__pyx_t_2);
5428 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
5429 }
5430 for (;;) {
5431 if (likely(!__pyx_t_4)) {
5432 if (likely(PyList_CheckExact(__pyx_t_2))) {
5433 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
5434 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5435 __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(1, 397, __pyx_L1_error)
5436 #else
5437 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
5438 __Pyx_GOTREF(__pyx_t_5);
5439 #endif
5440 } else {
5441 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
5442 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5443 __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(1, 397, __pyx_L1_error)
5444 #else
5445 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
5446 __Pyx_GOTREF(__pyx_t_5);
5447 #endif
5448 }
5449 } else {
5450 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
5451 if (unlikely(!__pyx_t_5)) {
5452 PyObject* exc_type = PyErr_Occurred();
5453 if (exc_type) {
5454 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5455 else __PYX_ERR(1, 397, __pyx_L1_error)
5456 }
5457 break;
5458 }
5459 __Pyx_GOTREF(__pyx_t_5);
5460 }
5461 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
5462 __pyx_t_5 = 0;
5463 __pyx_v_dim = __pyx_t_1;
5464 __pyx_t_1 = (__pyx_t_1 + 1);
5465
5466 /* "View.MemoryView":398
5467 *
5468 * for dim, idx in enumerate(index):
5469 * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
5470 *
5471 * return itemp
5472 */
5473 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
5474 __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(1, 398, __pyx_L1_error)
5475 __pyx_v_itemp = __pyx_t_7;
5476
5477 /* "View.MemoryView":397
5478 * cdef char *itemp = <char *> self.view.buf
5479 *
5480 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
5481 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
5482 *
5483 */
5484 }
5485 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5486
5487 /* "View.MemoryView":400
5488 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
5489 *
5490 * return itemp # <<<<<<<<<<<<<<
5491 *
5492 *
5493 */
5494 __pyx_r = __pyx_v_itemp;
5495 goto __pyx_L0;
5496
5497 /* "View.MemoryView":393
5498 * PyThread_free_lock(self.lock)
5499 *
5500 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
5501 * cdef Py_ssize_t dim
5502 * cdef char *itemp = <char *> self.view.buf
5503 */
5504
5505 /* function exit code */
5506 __pyx_L1_error:;
5507 __Pyx_XDECREF(__pyx_t_2);
5508 __Pyx_XDECREF(__pyx_t_5);
5509 __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
5510 __pyx_r = NULL;
5511 __pyx_L0:;
5512 __Pyx_XDECREF(__pyx_v_idx);
5513 __Pyx_RefNannyFinishContext();
5514 return __pyx_r;
5515 }
5516
5517 /* "View.MemoryView":403
5518 *
5519 *
5520 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
5521 * if index is Ellipsis:
5522 * return self
5523 */
5524
5525 /* Python wrapper */
5526 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)5527 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
5528 PyObject *__pyx_r = 0;
5529 __Pyx_RefNannyDeclarations
5530 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
5531 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
5532
5533 /* function exit code */
5534 __Pyx_RefNannyFinishContext();
5535 return __pyx_r;
5536 }
5537
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)5538 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
5539 PyObject *__pyx_v_have_slices = NULL;
5540 PyObject *__pyx_v_indices = NULL;
5541 char *__pyx_v_itemp;
5542 PyObject *__pyx_r = NULL;
5543 __Pyx_RefNannyDeclarations
5544 int __pyx_t_1;
5545 int __pyx_t_2;
5546 PyObject *__pyx_t_3 = NULL;
5547 PyObject *__pyx_t_4 = NULL;
5548 PyObject *__pyx_t_5 = NULL;
5549 char *__pyx_t_6;
5550 int __pyx_lineno = 0;
5551 const char *__pyx_filename = NULL;
5552 int __pyx_clineno = 0;
5553 __Pyx_RefNannySetupContext("__getitem__", 0);
5554
5555 /* "View.MemoryView":404
5556 *
5557 * def __getitem__(memoryview self, object index):
5558 * if index is Ellipsis: # <<<<<<<<<<<<<<
5559 * return self
5560 *
5561 */
5562 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
5563 __pyx_t_2 = (__pyx_t_1 != 0);
5564 if (__pyx_t_2) {
5565
5566 /* "View.MemoryView":405
5567 * def __getitem__(memoryview self, object index):
5568 * if index is Ellipsis:
5569 * return self # <<<<<<<<<<<<<<
5570 *
5571 * have_slices, indices = _unellipsify(index, self.view.ndim)
5572 */
5573 __Pyx_XDECREF(__pyx_r);
5574 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5575 __pyx_r = ((PyObject *)__pyx_v_self);
5576 goto __pyx_L0;
5577
5578 /* "View.MemoryView":404
5579 *
5580 * def __getitem__(memoryview self, object index):
5581 * if index is Ellipsis: # <<<<<<<<<<<<<<
5582 * return self
5583 *
5584 */
5585 }
5586
5587 /* "View.MemoryView":407
5588 * return self
5589 *
5590 * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
5591 *
5592 * cdef char *itemp
5593 */
5594 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
5595 __Pyx_GOTREF(__pyx_t_3);
5596 if (likely(__pyx_t_3 != Py_None)) {
5597 PyObject* sequence = __pyx_t_3;
5598 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5599 if (unlikely(size != 2)) {
5600 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5601 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5602 __PYX_ERR(1, 407, __pyx_L1_error)
5603 }
5604 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5605 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
5606 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
5607 __Pyx_INCREF(__pyx_t_4);
5608 __Pyx_INCREF(__pyx_t_5);
5609 #else
5610 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
5611 __Pyx_GOTREF(__pyx_t_4);
5612 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
5613 __Pyx_GOTREF(__pyx_t_5);
5614 #endif
5615 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5616 } else {
5617 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
5618 }
5619 __pyx_v_have_slices = __pyx_t_4;
5620 __pyx_t_4 = 0;
5621 __pyx_v_indices = __pyx_t_5;
5622 __pyx_t_5 = 0;
5623
5624 /* "View.MemoryView":410
5625 *
5626 * cdef char *itemp
5627 * if have_slices: # <<<<<<<<<<<<<<
5628 * return memview_slice(self, indices)
5629 * else:
5630 */
5631 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
5632 if (__pyx_t_2) {
5633
5634 /* "View.MemoryView":411
5635 * cdef char *itemp
5636 * if have_slices:
5637 * return memview_slice(self, indices) # <<<<<<<<<<<<<<
5638 * else:
5639 * itemp = self.get_item_pointer(indices)
5640 */
5641 __Pyx_XDECREF(__pyx_r);
5642 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
5643 __Pyx_GOTREF(__pyx_t_3);
5644 __pyx_r = __pyx_t_3;
5645 __pyx_t_3 = 0;
5646 goto __pyx_L0;
5647
5648 /* "View.MemoryView":410
5649 *
5650 * cdef char *itemp
5651 * if have_slices: # <<<<<<<<<<<<<<
5652 * return memview_slice(self, indices)
5653 * else:
5654 */
5655 }
5656
5657 /* "View.MemoryView":413
5658 * return memview_slice(self, indices)
5659 * else:
5660 * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
5661 * return self.convert_item_to_object(itemp)
5662 *
5663 */
5664 /*else*/ {
5665 __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(1, 413, __pyx_L1_error)
5666 __pyx_v_itemp = __pyx_t_6;
5667
5668 /* "View.MemoryView":414
5669 * else:
5670 * itemp = self.get_item_pointer(indices)
5671 * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
5672 *
5673 * def __setitem__(memoryview self, object index, object value):
5674 */
5675 __Pyx_XDECREF(__pyx_r);
5676 __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(1, 414, __pyx_L1_error)
5677 __Pyx_GOTREF(__pyx_t_3);
5678 __pyx_r = __pyx_t_3;
5679 __pyx_t_3 = 0;
5680 goto __pyx_L0;
5681 }
5682
5683 /* "View.MemoryView":403
5684 *
5685 *
5686 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
5687 * if index is Ellipsis:
5688 * return self
5689 */
5690
5691 /* function exit code */
5692 __pyx_L1_error:;
5693 __Pyx_XDECREF(__pyx_t_3);
5694 __Pyx_XDECREF(__pyx_t_4);
5695 __Pyx_XDECREF(__pyx_t_5);
5696 __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5697 __pyx_r = NULL;
5698 __pyx_L0:;
5699 __Pyx_XDECREF(__pyx_v_have_slices);
5700 __Pyx_XDECREF(__pyx_v_indices);
5701 __Pyx_XGIVEREF(__pyx_r);
5702 __Pyx_RefNannyFinishContext();
5703 return __pyx_r;
5704 }
5705
5706 /* "View.MemoryView":416
5707 * return self.convert_item_to_object(itemp)
5708 *
5709 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
5710 * if self.view.readonly:
5711 * raise TypeError("Cannot assign to read-only memoryview")
5712 */
5713
5714 /* Python wrapper */
5715 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)5716 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
5717 int __pyx_r;
5718 __Pyx_RefNannyDeclarations
5719 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
5720 __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));
5721
5722 /* function exit code */
5723 __Pyx_RefNannyFinishContext();
5724 return __pyx_r;
5725 }
5726
__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)5727 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) {
5728 PyObject *__pyx_v_have_slices = NULL;
5729 PyObject *__pyx_v_obj = NULL;
5730 int __pyx_r;
5731 __Pyx_RefNannyDeclarations
5732 int __pyx_t_1;
5733 PyObject *__pyx_t_2 = NULL;
5734 PyObject *__pyx_t_3 = NULL;
5735 PyObject *__pyx_t_4 = NULL;
5736 int __pyx_lineno = 0;
5737 const char *__pyx_filename = NULL;
5738 int __pyx_clineno = 0;
5739 __Pyx_RefNannySetupContext("__setitem__", 0);
5740 __Pyx_INCREF(__pyx_v_index);
5741
5742 /* "View.MemoryView":417
5743 *
5744 * def __setitem__(memoryview self, object index, object value):
5745 * if self.view.readonly: # <<<<<<<<<<<<<<
5746 * raise TypeError("Cannot assign to read-only memoryview")
5747 *
5748 */
5749 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
5750 if (unlikely(__pyx_t_1)) {
5751
5752 /* "View.MemoryView":418
5753 * def __setitem__(memoryview self, object index, object value):
5754 * if self.view.readonly:
5755 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
5756 *
5757 * have_slices, index = _unellipsify(index, self.view.ndim)
5758 */
5759 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
5760 __Pyx_GOTREF(__pyx_t_2);
5761 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5762 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5763 __PYX_ERR(1, 418, __pyx_L1_error)
5764
5765 /* "View.MemoryView":417
5766 *
5767 * def __setitem__(memoryview self, object index, object value):
5768 * if self.view.readonly: # <<<<<<<<<<<<<<
5769 * raise TypeError("Cannot assign to read-only memoryview")
5770 *
5771 */
5772 }
5773
5774 /* "View.MemoryView":420
5775 * raise TypeError("Cannot assign to read-only memoryview")
5776 *
5777 * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
5778 *
5779 * if have_slices:
5780 */
5781 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
5782 __Pyx_GOTREF(__pyx_t_2);
5783 if (likely(__pyx_t_2 != Py_None)) {
5784 PyObject* sequence = __pyx_t_2;
5785 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5786 if (unlikely(size != 2)) {
5787 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5788 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5789 __PYX_ERR(1, 420, __pyx_L1_error)
5790 }
5791 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5792 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
5793 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
5794 __Pyx_INCREF(__pyx_t_3);
5795 __Pyx_INCREF(__pyx_t_4);
5796 #else
5797 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
5798 __Pyx_GOTREF(__pyx_t_3);
5799 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
5800 __Pyx_GOTREF(__pyx_t_4);
5801 #endif
5802 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5803 } else {
5804 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
5805 }
5806 __pyx_v_have_slices = __pyx_t_3;
5807 __pyx_t_3 = 0;
5808 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
5809 __pyx_t_4 = 0;
5810
5811 /* "View.MemoryView":422
5812 * have_slices, index = _unellipsify(index, self.view.ndim)
5813 *
5814 * if have_slices: # <<<<<<<<<<<<<<
5815 * obj = self.is_slice(value)
5816 * if obj:
5817 */
5818 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
5819 if (__pyx_t_1) {
5820
5821 /* "View.MemoryView":423
5822 *
5823 * if have_slices:
5824 * obj = self.is_slice(value) # <<<<<<<<<<<<<<
5825 * if obj:
5826 * self.setitem_slice_assignment(self[index], obj)
5827 */
5828 __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(1, 423, __pyx_L1_error)
5829 __Pyx_GOTREF(__pyx_t_2);
5830 __pyx_v_obj = __pyx_t_2;
5831 __pyx_t_2 = 0;
5832
5833 /* "View.MemoryView":424
5834 * if have_slices:
5835 * obj = self.is_slice(value)
5836 * if obj: # <<<<<<<<<<<<<<
5837 * self.setitem_slice_assignment(self[index], obj)
5838 * else:
5839 */
5840 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
5841 if (__pyx_t_1) {
5842
5843 /* "View.MemoryView":425
5844 * obj = self.is_slice(value)
5845 * if obj:
5846 * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
5847 * else:
5848 * self.setitem_slice_assign_scalar(self[index], value)
5849 */
5850 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
5851 __Pyx_GOTREF(__pyx_t_2);
5852 __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(1, 425, __pyx_L1_error)
5853 __Pyx_GOTREF(__pyx_t_4);
5854 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5855 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5856
5857 /* "View.MemoryView":424
5858 * if have_slices:
5859 * obj = self.is_slice(value)
5860 * if obj: # <<<<<<<<<<<<<<
5861 * self.setitem_slice_assignment(self[index], obj)
5862 * else:
5863 */
5864 goto __pyx_L5;
5865 }
5866
5867 /* "View.MemoryView":427
5868 * self.setitem_slice_assignment(self[index], obj)
5869 * else:
5870 * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
5871 * else:
5872 * self.setitem_indexed(index, value)
5873 */
5874 /*else*/ {
5875 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
5876 __Pyx_GOTREF(__pyx_t_4);
5877 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
5878 __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(1, 427, __pyx_L1_error)
5879 __Pyx_GOTREF(__pyx_t_2);
5880 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5881 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5882 }
5883 __pyx_L5:;
5884
5885 /* "View.MemoryView":422
5886 * have_slices, index = _unellipsify(index, self.view.ndim)
5887 *
5888 * if have_slices: # <<<<<<<<<<<<<<
5889 * obj = self.is_slice(value)
5890 * if obj:
5891 */
5892 goto __pyx_L4;
5893 }
5894
5895 /* "View.MemoryView":429
5896 * self.setitem_slice_assign_scalar(self[index], value)
5897 * else:
5898 * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
5899 *
5900 * cdef is_slice(self, obj):
5901 */
5902 /*else*/ {
5903 __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(1, 429, __pyx_L1_error)
5904 __Pyx_GOTREF(__pyx_t_2);
5905 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5906 }
5907 __pyx_L4:;
5908
5909 /* "View.MemoryView":416
5910 * return self.convert_item_to_object(itemp)
5911 *
5912 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
5913 * if self.view.readonly:
5914 * raise TypeError("Cannot assign to read-only memoryview")
5915 */
5916
5917 /* function exit code */
5918 __pyx_r = 0;
5919 goto __pyx_L0;
5920 __pyx_L1_error:;
5921 __Pyx_XDECREF(__pyx_t_2);
5922 __Pyx_XDECREF(__pyx_t_3);
5923 __Pyx_XDECREF(__pyx_t_4);
5924 __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5925 __pyx_r = -1;
5926 __pyx_L0:;
5927 __Pyx_XDECREF(__pyx_v_have_slices);
5928 __Pyx_XDECREF(__pyx_v_obj);
5929 __Pyx_XDECREF(__pyx_v_index);
5930 __Pyx_RefNannyFinishContext();
5931 return __pyx_r;
5932 }
5933
5934 /* "View.MemoryView":431
5935 * self.setitem_indexed(index, value)
5936 *
5937 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
5938 * if not isinstance(obj, memoryview):
5939 * try:
5940 */
5941
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)5942 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
5943 PyObject *__pyx_r = NULL;
5944 __Pyx_RefNannyDeclarations
5945 int __pyx_t_1;
5946 int __pyx_t_2;
5947 PyObject *__pyx_t_3 = NULL;
5948 PyObject *__pyx_t_4 = NULL;
5949 PyObject *__pyx_t_5 = NULL;
5950 PyObject *__pyx_t_6 = NULL;
5951 PyObject *__pyx_t_7 = NULL;
5952 PyObject *__pyx_t_8 = NULL;
5953 int __pyx_t_9;
5954 int __pyx_lineno = 0;
5955 const char *__pyx_filename = NULL;
5956 int __pyx_clineno = 0;
5957 __Pyx_RefNannySetupContext("is_slice", 0);
5958 __Pyx_INCREF(__pyx_v_obj);
5959
5960 /* "View.MemoryView":432
5961 *
5962 * cdef is_slice(self, obj):
5963 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
5964 * try:
5965 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
5966 */
5967 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
5968 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
5969 if (__pyx_t_2) {
5970
5971 /* "View.MemoryView":433
5972 * cdef is_slice(self, obj):
5973 * if not isinstance(obj, memoryview):
5974 * try: # <<<<<<<<<<<<<<
5975 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
5976 * self.dtype_is_object)
5977 */
5978 {
5979 __Pyx_PyThreadState_declare
5980 __Pyx_PyThreadState_assign
5981 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
5982 __Pyx_XGOTREF(__pyx_t_3);
5983 __Pyx_XGOTREF(__pyx_t_4);
5984 __Pyx_XGOTREF(__pyx_t_5);
5985 /*try:*/ {
5986
5987 /* "View.MemoryView":434
5988 * if not isinstance(obj, memoryview):
5989 * try:
5990 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
5991 * self.dtype_is_object)
5992 * except TypeError:
5993 */
5994 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
5995 __Pyx_GOTREF(__pyx_t_6);
5996
5997 /* "View.MemoryView":435
5998 * try:
5999 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
6000 * self.dtype_is_object) # <<<<<<<<<<<<<<
6001 * except TypeError:
6002 * return None
6003 */
6004 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
6005 __Pyx_GOTREF(__pyx_t_7);
6006
6007 /* "View.MemoryView":434
6008 * if not isinstance(obj, memoryview):
6009 * try:
6010 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
6011 * self.dtype_is_object)
6012 * except TypeError:
6013 */
6014 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
6015 __Pyx_GOTREF(__pyx_t_8);
6016 __Pyx_INCREF(__pyx_v_obj);
6017 __Pyx_GIVEREF(__pyx_v_obj);
6018 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
6019 __Pyx_GIVEREF(__pyx_t_6);
6020 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
6021 __Pyx_GIVEREF(__pyx_t_7);
6022 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
6023 __pyx_t_6 = 0;
6024 __pyx_t_7 = 0;
6025 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
6026 __Pyx_GOTREF(__pyx_t_7);
6027 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6028 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
6029 __pyx_t_7 = 0;
6030
6031 /* "View.MemoryView":433
6032 * cdef is_slice(self, obj):
6033 * if not isinstance(obj, memoryview):
6034 * try: # <<<<<<<<<<<<<<
6035 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
6036 * self.dtype_is_object)
6037 */
6038 }
6039 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6040 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6041 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6042 goto __pyx_L9_try_end;
6043 __pyx_L4_error:;
6044 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6045 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6046 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6047
6048 /* "View.MemoryView":436
6049 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
6050 * self.dtype_is_object)
6051 * except TypeError: # <<<<<<<<<<<<<<
6052 * return None
6053 *
6054 */
6055 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
6056 if (__pyx_t_9) {
6057 __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
6058 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
6059 __Pyx_GOTREF(__pyx_t_7);
6060 __Pyx_GOTREF(__pyx_t_8);
6061 __Pyx_GOTREF(__pyx_t_6);
6062
6063 /* "View.MemoryView":437
6064 * self.dtype_is_object)
6065 * except TypeError:
6066 * return None # <<<<<<<<<<<<<<
6067 *
6068 * return obj
6069 */
6070 __Pyx_XDECREF(__pyx_r);
6071 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6072 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6073 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6074 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6075 goto __pyx_L7_except_return;
6076 }
6077 goto __pyx_L6_except_error;
6078 __pyx_L6_except_error:;
6079
6080 /* "View.MemoryView":433
6081 * cdef is_slice(self, obj):
6082 * if not isinstance(obj, memoryview):
6083 * try: # <<<<<<<<<<<<<<
6084 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
6085 * self.dtype_is_object)
6086 */
6087 __Pyx_XGIVEREF(__pyx_t_3);
6088 __Pyx_XGIVEREF(__pyx_t_4);
6089 __Pyx_XGIVEREF(__pyx_t_5);
6090 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
6091 goto __pyx_L1_error;
6092 __pyx_L7_except_return:;
6093 __Pyx_XGIVEREF(__pyx_t_3);
6094 __Pyx_XGIVEREF(__pyx_t_4);
6095 __Pyx_XGIVEREF(__pyx_t_5);
6096 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
6097 goto __pyx_L0;
6098 __pyx_L9_try_end:;
6099 }
6100
6101 /* "View.MemoryView":432
6102 *
6103 * cdef is_slice(self, obj):
6104 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
6105 * try:
6106 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
6107 */
6108 }
6109
6110 /* "View.MemoryView":439
6111 * return None
6112 *
6113 * return obj # <<<<<<<<<<<<<<
6114 *
6115 * cdef setitem_slice_assignment(self, dst, src):
6116 */
6117 __Pyx_XDECREF(__pyx_r);
6118 __Pyx_INCREF(__pyx_v_obj);
6119 __pyx_r = __pyx_v_obj;
6120 goto __pyx_L0;
6121
6122 /* "View.MemoryView":431
6123 * self.setitem_indexed(index, value)
6124 *
6125 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
6126 * if not isinstance(obj, memoryview):
6127 * try:
6128 */
6129
6130 /* function exit code */
6131 __pyx_L1_error:;
6132 __Pyx_XDECREF(__pyx_t_6);
6133 __Pyx_XDECREF(__pyx_t_7);
6134 __Pyx_XDECREF(__pyx_t_8);
6135 __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
6136 __pyx_r = 0;
6137 __pyx_L0:;
6138 __Pyx_XDECREF(__pyx_v_obj);
6139 __Pyx_XGIVEREF(__pyx_r);
6140 __Pyx_RefNannyFinishContext();
6141 return __pyx_r;
6142 }
6143
6144 /* "View.MemoryView":441
6145 * return obj
6146 *
6147 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
6148 * cdef __Pyx_memviewslice dst_slice
6149 * cdef __Pyx_memviewslice src_slice
6150 */
6151
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)6152 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
6153 __Pyx_memviewslice __pyx_v_dst_slice;
6154 __Pyx_memviewslice __pyx_v_src_slice;
6155 PyObject *__pyx_r = NULL;
6156 __Pyx_RefNannyDeclarations
6157 __Pyx_memviewslice *__pyx_t_1;
6158 __Pyx_memviewslice *__pyx_t_2;
6159 PyObject *__pyx_t_3 = NULL;
6160 int __pyx_t_4;
6161 int __pyx_t_5;
6162 int __pyx_t_6;
6163 int __pyx_lineno = 0;
6164 const char *__pyx_filename = NULL;
6165 int __pyx_clineno = 0;
6166 __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
6167
6168 /* "View.MemoryView":445
6169 * cdef __Pyx_memviewslice src_slice
6170 *
6171 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
6172 * get_slice_from_memview(dst, &dst_slice)[0],
6173 * src.ndim, dst.ndim, self.dtype_is_object)
6174 */
6175 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
6176 __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(1, 445, __pyx_L1_error)
6177
6178 /* "View.MemoryView":446
6179 *
6180 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
6181 * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
6182 * src.ndim, dst.ndim, self.dtype_is_object)
6183 *
6184 */
6185 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
6186 __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(1, 446, __pyx_L1_error)
6187
6188 /* "View.MemoryView":447
6189 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
6190 * get_slice_from_memview(dst, &dst_slice)[0],
6191 * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
6192 *
6193 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
6194 */
6195 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
6196 __Pyx_GOTREF(__pyx_t_3);
6197 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
6198 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6199 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
6200 __Pyx_GOTREF(__pyx_t_3);
6201 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
6202 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6203
6204 /* "View.MemoryView":445
6205 * cdef __Pyx_memviewslice src_slice
6206 *
6207 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
6208 * get_slice_from_memview(dst, &dst_slice)[0],
6209 * src.ndim, dst.ndim, self.dtype_is_object)
6210 */
6211 __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(1, 445, __pyx_L1_error)
6212
6213 /* "View.MemoryView":441
6214 * return obj
6215 *
6216 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
6217 * cdef __Pyx_memviewslice dst_slice
6218 * cdef __Pyx_memviewslice src_slice
6219 */
6220
6221 /* function exit code */
6222 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6223 goto __pyx_L0;
6224 __pyx_L1_error:;
6225 __Pyx_XDECREF(__pyx_t_3);
6226 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
6227 __pyx_r = 0;
6228 __pyx_L0:;
6229 __Pyx_XGIVEREF(__pyx_r);
6230 __Pyx_RefNannyFinishContext();
6231 return __pyx_r;
6232 }
6233
6234 /* "View.MemoryView":449
6235 * src.ndim, dst.ndim, self.dtype_is_object)
6236 *
6237 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
6238 * cdef int array[128]
6239 * cdef void *tmp = NULL
6240 */
6241
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)6242 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) {
6243 int __pyx_v_array[0x80];
6244 void *__pyx_v_tmp;
6245 void *__pyx_v_item;
6246 __Pyx_memviewslice *__pyx_v_dst_slice;
6247 __Pyx_memviewslice __pyx_v_tmp_slice;
6248 PyObject *__pyx_r = NULL;
6249 __Pyx_RefNannyDeclarations
6250 __Pyx_memviewslice *__pyx_t_1;
6251 int __pyx_t_2;
6252 PyObject *__pyx_t_3 = NULL;
6253 int __pyx_t_4;
6254 int __pyx_t_5;
6255 char const *__pyx_t_6;
6256 PyObject *__pyx_t_7 = NULL;
6257 PyObject *__pyx_t_8 = NULL;
6258 PyObject *__pyx_t_9 = NULL;
6259 PyObject *__pyx_t_10 = NULL;
6260 PyObject *__pyx_t_11 = NULL;
6261 PyObject *__pyx_t_12 = NULL;
6262 int __pyx_lineno = 0;
6263 const char *__pyx_filename = NULL;
6264 int __pyx_clineno = 0;
6265 __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
6266
6267 /* "View.MemoryView":451
6268 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
6269 * cdef int array[128]
6270 * cdef void *tmp = NULL # <<<<<<<<<<<<<<
6271 * cdef void *item
6272 *
6273 */
6274 __pyx_v_tmp = NULL;
6275
6276 /* "View.MemoryView":456
6277 * cdef __Pyx_memviewslice *dst_slice
6278 * cdef __Pyx_memviewslice tmp_slice
6279 * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
6280 *
6281 * if <size_t>self.view.itemsize > sizeof(array):
6282 */
6283 __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(1, 456, __pyx_L1_error)
6284 __pyx_v_dst_slice = __pyx_t_1;
6285
6286 /* "View.MemoryView":458
6287 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
6288 *
6289 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
6290 * tmp = PyMem_Malloc(self.view.itemsize)
6291 * if tmp == NULL:
6292 */
6293 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
6294 if (__pyx_t_2) {
6295
6296 /* "View.MemoryView":459
6297 *
6298 * if <size_t>self.view.itemsize > sizeof(array):
6299 * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
6300 * if tmp == NULL:
6301 * raise MemoryError
6302 */
6303 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
6304
6305 /* "View.MemoryView":460
6306 * if <size_t>self.view.itemsize > sizeof(array):
6307 * tmp = PyMem_Malloc(self.view.itemsize)
6308 * if tmp == NULL: # <<<<<<<<<<<<<<
6309 * raise MemoryError
6310 * item = tmp
6311 */
6312 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
6313 if (unlikely(__pyx_t_2)) {
6314
6315 /* "View.MemoryView":461
6316 * tmp = PyMem_Malloc(self.view.itemsize)
6317 * if tmp == NULL:
6318 * raise MemoryError # <<<<<<<<<<<<<<
6319 * item = tmp
6320 * else:
6321 */
6322 PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
6323
6324 /* "View.MemoryView":460
6325 * if <size_t>self.view.itemsize > sizeof(array):
6326 * tmp = PyMem_Malloc(self.view.itemsize)
6327 * if tmp == NULL: # <<<<<<<<<<<<<<
6328 * raise MemoryError
6329 * item = tmp
6330 */
6331 }
6332
6333 /* "View.MemoryView":462
6334 * if tmp == NULL:
6335 * raise MemoryError
6336 * item = tmp # <<<<<<<<<<<<<<
6337 * else:
6338 * item = <void *> array
6339 */
6340 __pyx_v_item = __pyx_v_tmp;
6341
6342 /* "View.MemoryView":458
6343 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
6344 *
6345 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
6346 * tmp = PyMem_Malloc(self.view.itemsize)
6347 * if tmp == NULL:
6348 */
6349 goto __pyx_L3;
6350 }
6351
6352 /* "View.MemoryView":464
6353 * item = tmp
6354 * else:
6355 * item = <void *> array # <<<<<<<<<<<<<<
6356 *
6357 * try:
6358 */
6359 /*else*/ {
6360 __pyx_v_item = ((void *)__pyx_v_array);
6361 }
6362 __pyx_L3:;
6363
6364 /* "View.MemoryView":466
6365 * item = <void *> array
6366 *
6367 * try: # <<<<<<<<<<<<<<
6368 * if self.dtype_is_object:
6369 * (<PyObject **> item)[0] = <PyObject *> value
6370 */
6371 /*try:*/ {
6372
6373 /* "View.MemoryView":467
6374 *
6375 * try:
6376 * if self.dtype_is_object: # <<<<<<<<<<<<<<
6377 * (<PyObject **> item)[0] = <PyObject *> value
6378 * else:
6379 */
6380 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
6381 if (__pyx_t_2) {
6382
6383 /* "View.MemoryView":468
6384 * try:
6385 * if self.dtype_is_object:
6386 * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
6387 * else:
6388 * self.assign_item_from_object(<char *> item, value)
6389 */
6390 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
6391
6392 /* "View.MemoryView":467
6393 *
6394 * try:
6395 * if self.dtype_is_object: # <<<<<<<<<<<<<<
6396 * (<PyObject **> item)[0] = <PyObject *> value
6397 * else:
6398 */
6399 goto __pyx_L8;
6400 }
6401
6402 /* "View.MemoryView":470
6403 * (<PyObject **> item)[0] = <PyObject *> value
6404 * else:
6405 * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
6406 *
6407 *
6408 */
6409 /*else*/ {
6410 __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(1, 470, __pyx_L6_error)
6411 __Pyx_GOTREF(__pyx_t_3);
6412 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6413 }
6414 __pyx_L8:;
6415
6416 /* "View.MemoryView":474
6417 *
6418 *
6419 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
6420 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
6421 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
6422 */
6423 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
6424 if (__pyx_t_2) {
6425
6426 /* "View.MemoryView":475
6427 *
6428 * if self.view.suboffsets != NULL:
6429 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
6430 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
6431 * item, self.dtype_is_object)
6432 */
6433 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
6434 __Pyx_GOTREF(__pyx_t_3);
6435 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6436
6437 /* "View.MemoryView":474
6438 *
6439 *
6440 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
6441 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
6442 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
6443 */
6444 }
6445
6446 /* "View.MemoryView":476
6447 * if self.view.suboffsets != NULL:
6448 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
6449 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
6450 * item, self.dtype_is_object)
6451 * finally:
6452 */
6453 __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);
6454 }
6455
6456 /* "View.MemoryView":479
6457 * item, self.dtype_is_object)
6458 * finally:
6459 * PyMem_Free(tmp) # <<<<<<<<<<<<<<
6460 *
6461 * cdef setitem_indexed(self, index, value):
6462 */
6463 /*finally:*/ {
6464 /*normal exit:*/{
6465 PyMem_Free(__pyx_v_tmp);
6466 goto __pyx_L7;
6467 }
6468 __pyx_L6_error:;
6469 /*exception exit:*/{
6470 __Pyx_PyThreadState_declare
6471 __Pyx_PyThreadState_assign
6472 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
6473 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6474 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
6475 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);
6476 __Pyx_XGOTREF(__pyx_t_7);
6477 __Pyx_XGOTREF(__pyx_t_8);
6478 __Pyx_XGOTREF(__pyx_t_9);
6479 __Pyx_XGOTREF(__pyx_t_10);
6480 __Pyx_XGOTREF(__pyx_t_11);
6481 __Pyx_XGOTREF(__pyx_t_12);
6482 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
6483 {
6484 PyMem_Free(__pyx_v_tmp);
6485 }
6486 if (PY_MAJOR_VERSION >= 3) {
6487 __Pyx_XGIVEREF(__pyx_t_10);
6488 __Pyx_XGIVEREF(__pyx_t_11);
6489 __Pyx_XGIVEREF(__pyx_t_12);
6490 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
6491 }
6492 __Pyx_XGIVEREF(__pyx_t_7);
6493 __Pyx_XGIVEREF(__pyx_t_8);
6494 __Pyx_XGIVEREF(__pyx_t_9);
6495 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
6496 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
6497 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
6498 goto __pyx_L1_error;
6499 }
6500 __pyx_L7:;
6501 }
6502
6503 /* "View.MemoryView":449
6504 * src.ndim, dst.ndim, self.dtype_is_object)
6505 *
6506 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
6507 * cdef int array[128]
6508 * cdef void *tmp = NULL
6509 */
6510
6511 /* function exit code */
6512 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6513 goto __pyx_L0;
6514 __pyx_L1_error:;
6515 __Pyx_XDECREF(__pyx_t_3);
6516 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
6517 __pyx_r = 0;
6518 __pyx_L0:;
6519 __Pyx_XGIVEREF(__pyx_r);
6520 __Pyx_RefNannyFinishContext();
6521 return __pyx_r;
6522 }
6523
6524 /* "View.MemoryView":481
6525 * PyMem_Free(tmp)
6526 *
6527 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
6528 * cdef char *itemp = self.get_item_pointer(index)
6529 * self.assign_item_from_object(itemp, value)
6530 */
6531
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)6532 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
6533 char *__pyx_v_itemp;
6534 PyObject *__pyx_r = NULL;
6535 __Pyx_RefNannyDeclarations
6536 char *__pyx_t_1;
6537 PyObject *__pyx_t_2 = NULL;
6538 int __pyx_lineno = 0;
6539 const char *__pyx_filename = NULL;
6540 int __pyx_clineno = 0;
6541 __Pyx_RefNannySetupContext("setitem_indexed", 0);
6542
6543 /* "View.MemoryView":482
6544 *
6545 * cdef setitem_indexed(self, index, value):
6546 * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
6547 * self.assign_item_from_object(itemp, value)
6548 *
6549 */
6550 __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(1, 482, __pyx_L1_error)
6551 __pyx_v_itemp = __pyx_t_1;
6552
6553 /* "View.MemoryView":483
6554 * cdef setitem_indexed(self, index, value):
6555 * cdef char *itemp = self.get_item_pointer(index)
6556 * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
6557 *
6558 * cdef convert_item_to_object(self, char *itemp):
6559 */
6560 __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(1, 483, __pyx_L1_error)
6561 __Pyx_GOTREF(__pyx_t_2);
6562 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6563
6564 /* "View.MemoryView":481
6565 * PyMem_Free(tmp)
6566 *
6567 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
6568 * cdef char *itemp = self.get_item_pointer(index)
6569 * self.assign_item_from_object(itemp, value)
6570 */
6571
6572 /* function exit code */
6573 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6574 goto __pyx_L0;
6575 __pyx_L1_error:;
6576 __Pyx_XDECREF(__pyx_t_2);
6577 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
6578 __pyx_r = 0;
6579 __pyx_L0:;
6580 __Pyx_XGIVEREF(__pyx_r);
6581 __Pyx_RefNannyFinishContext();
6582 return __pyx_r;
6583 }
6584
6585 /* "View.MemoryView":485
6586 * self.assign_item_from_object(itemp, value)
6587 *
6588 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
6589 * """Only used if instantiated manually by the user, or if Cython doesn't
6590 * know how to convert the type"""
6591 */
6592
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)6593 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
6594 PyObject *__pyx_v_struct = NULL;
6595 PyObject *__pyx_v_bytesitem = 0;
6596 PyObject *__pyx_v_result = NULL;
6597 PyObject *__pyx_r = NULL;
6598 __Pyx_RefNannyDeclarations
6599 PyObject *__pyx_t_1 = NULL;
6600 PyObject *__pyx_t_2 = NULL;
6601 PyObject *__pyx_t_3 = NULL;
6602 PyObject *__pyx_t_4 = NULL;
6603 PyObject *__pyx_t_5 = NULL;
6604 PyObject *__pyx_t_6 = NULL;
6605 PyObject *__pyx_t_7 = NULL;
6606 int __pyx_t_8;
6607 PyObject *__pyx_t_9 = NULL;
6608 size_t __pyx_t_10;
6609 int __pyx_t_11;
6610 int __pyx_lineno = 0;
6611 const char *__pyx_filename = NULL;
6612 int __pyx_clineno = 0;
6613 __Pyx_RefNannySetupContext("convert_item_to_object", 0);
6614
6615 /* "View.MemoryView":488
6616 * """Only used if instantiated manually by the user, or if Cython doesn't
6617 * know how to convert the type"""
6618 * import struct # <<<<<<<<<<<<<<
6619 * cdef bytes bytesitem
6620 *
6621 */
6622 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
6623 __Pyx_GOTREF(__pyx_t_1);
6624 __pyx_v_struct = __pyx_t_1;
6625 __pyx_t_1 = 0;
6626
6627 /* "View.MemoryView":491
6628 * cdef bytes bytesitem
6629 *
6630 * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
6631 * try:
6632 * result = struct.unpack(self.view.format, bytesitem)
6633 */
6634 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
6635 __Pyx_GOTREF(__pyx_t_1);
6636 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
6637 __pyx_t_1 = 0;
6638
6639 /* "View.MemoryView":492
6640 *
6641 * bytesitem = itemp[:self.view.itemsize]
6642 * try: # <<<<<<<<<<<<<<
6643 * result = struct.unpack(self.view.format, bytesitem)
6644 * except struct.error:
6645 */
6646 {
6647 __Pyx_PyThreadState_declare
6648 __Pyx_PyThreadState_assign
6649 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
6650 __Pyx_XGOTREF(__pyx_t_2);
6651 __Pyx_XGOTREF(__pyx_t_3);
6652 __Pyx_XGOTREF(__pyx_t_4);
6653 /*try:*/ {
6654
6655 /* "View.MemoryView":493
6656 * bytesitem = itemp[:self.view.itemsize]
6657 * try:
6658 * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
6659 * except struct.error:
6660 * raise ValueError("Unable to convert item to object")
6661 */
6662 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
6663 __Pyx_GOTREF(__pyx_t_5);
6664 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
6665 __Pyx_GOTREF(__pyx_t_6);
6666 __pyx_t_7 = NULL;
6667 __pyx_t_8 = 0;
6668 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6669 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
6670 if (likely(__pyx_t_7)) {
6671 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6672 __Pyx_INCREF(__pyx_t_7);
6673 __Pyx_INCREF(function);
6674 __Pyx_DECREF_SET(__pyx_t_5, function);
6675 __pyx_t_8 = 1;
6676 }
6677 }
6678 #if CYTHON_FAST_PYCALL
6679 if (PyFunction_Check(__pyx_t_5)) {
6680 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
6681 __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(1, 493, __pyx_L3_error)
6682 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6683 __Pyx_GOTREF(__pyx_t_1);
6684 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6685 } else
6686 #endif
6687 #if CYTHON_FAST_PYCCALL
6688 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6689 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
6690 __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(1, 493, __pyx_L3_error)
6691 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6692 __Pyx_GOTREF(__pyx_t_1);
6693 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6694 } else
6695 #endif
6696 {
6697 __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
6698 __Pyx_GOTREF(__pyx_t_9);
6699 if (__pyx_t_7) {
6700 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
6701 }
6702 __Pyx_GIVEREF(__pyx_t_6);
6703 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
6704 __Pyx_INCREF(__pyx_v_bytesitem);
6705 __Pyx_GIVEREF(__pyx_v_bytesitem);
6706 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
6707 __pyx_t_6 = 0;
6708 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
6709 __Pyx_GOTREF(__pyx_t_1);
6710 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6711 }
6712 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6713 __pyx_v_result = __pyx_t_1;
6714 __pyx_t_1 = 0;
6715
6716 /* "View.MemoryView":492
6717 *
6718 * bytesitem = itemp[:self.view.itemsize]
6719 * try: # <<<<<<<<<<<<<<
6720 * result = struct.unpack(self.view.format, bytesitem)
6721 * except struct.error:
6722 */
6723 }
6724
6725 /* "View.MemoryView":497
6726 * raise ValueError("Unable to convert item to object")
6727 * else:
6728 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
6729 * return result[0]
6730 * return result
6731 */
6732 /*else:*/ {
6733 __pyx_t_10 = strlen(__pyx_v_self->view.format);
6734 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
6735 if (__pyx_t_11) {
6736
6737 /* "View.MemoryView":498
6738 * else:
6739 * if len(self.view.format) == 1:
6740 * return result[0] # <<<<<<<<<<<<<<
6741 * return result
6742 *
6743 */
6744 __Pyx_XDECREF(__pyx_r);
6745 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
6746 __Pyx_GOTREF(__pyx_t_1);
6747 __pyx_r = __pyx_t_1;
6748 __pyx_t_1 = 0;
6749 goto __pyx_L6_except_return;
6750
6751 /* "View.MemoryView":497
6752 * raise ValueError("Unable to convert item to object")
6753 * else:
6754 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
6755 * return result[0]
6756 * return result
6757 */
6758 }
6759
6760 /* "View.MemoryView":499
6761 * if len(self.view.format) == 1:
6762 * return result[0]
6763 * return result # <<<<<<<<<<<<<<
6764 *
6765 * cdef assign_item_from_object(self, char *itemp, object value):
6766 */
6767 __Pyx_XDECREF(__pyx_r);
6768 __Pyx_INCREF(__pyx_v_result);
6769 __pyx_r = __pyx_v_result;
6770 goto __pyx_L6_except_return;
6771 }
6772 __pyx_L3_error:;
6773 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6774 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6775 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6776 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6777 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6778
6779 /* "View.MemoryView":494
6780 * try:
6781 * result = struct.unpack(self.view.format, bytesitem)
6782 * except struct.error: # <<<<<<<<<<<<<<
6783 * raise ValueError("Unable to convert item to object")
6784 * else:
6785 */
6786 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
6787 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
6788 __Pyx_GOTREF(__pyx_t_6);
6789 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
6790 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6791 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
6792 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
6793 if (__pyx_t_8) {
6794 __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
6795 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
6796 __Pyx_GOTREF(__pyx_t_9);
6797 __Pyx_GOTREF(__pyx_t_5);
6798 __Pyx_GOTREF(__pyx_t_1);
6799
6800 /* "View.MemoryView":495
6801 * result = struct.unpack(self.view.format, bytesitem)
6802 * except struct.error:
6803 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
6804 * else:
6805 * if len(self.view.format) == 1:
6806 */
6807 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
6808 __Pyx_GOTREF(__pyx_t_6);
6809 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
6810 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6811 __PYX_ERR(1, 495, __pyx_L5_except_error)
6812 }
6813 goto __pyx_L5_except_error;
6814 __pyx_L5_except_error:;
6815
6816 /* "View.MemoryView":492
6817 *
6818 * bytesitem = itemp[:self.view.itemsize]
6819 * try: # <<<<<<<<<<<<<<
6820 * result = struct.unpack(self.view.format, bytesitem)
6821 * except struct.error:
6822 */
6823 __Pyx_XGIVEREF(__pyx_t_2);
6824 __Pyx_XGIVEREF(__pyx_t_3);
6825 __Pyx_XGIVEREF(__pyx_t_4);
6826 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
6827 goto __pyx_L1_error;
6828 __pyx_L6_except_return:;
6829 __Pyx_XGIVEREF(__pyx_t_2);
6830 __Pyx_XGIVEREF(__pyx_t_3);
6831 __Pyx_XGIVEREF(__pyx_t_4);
6832 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
6833 goto __pyx_L0;
6834 }
6835
6836 /* "View.MemoryView":485
6837 * self.assign_item_from_object(itemp, value)
6838 *
6839 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
6840 * """Only used if instantiated manually by the user, or if Cython doesn't
6841 * know how to convert the type"""
6842 */
6843
6844 /* function exit code */
6845 __pyx_L1_error:;
6846 __Pyx_XDECREF(__pyx_t_1);
6847 __Pyx_XDECREF(__pyx_t_5);
6848 __Pyx_XDECREF(__pyx_t_6);
6849 __Pyx_XDECREF(__pyx_t_7);
6850 __Pyx_XDECREF(__pyx_t_9);
6851 __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
6852 __pyx_r = 0;
6853 __pyx_L0:;
6854 __Pyx_XDECREF(__pyx_v_struct);
6855 __Pyx_XDECREF(__pyx_v_bytesitem);
6856 __Pyx_XDECREF(__pyx_v_result);
6857 __Pyx_XGIVEREF(__pyx_r);
6858 __Pyx_RefNannyFinishContext();
6859 return __pyx_r;
6860 }
6861
6862 /* "View.MemoryView":501
6863 * return result
6864 *
6865 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
6866 * """Only used if instantiated manually by the user, or if Cython doesn't
6867 * know how to convert the type"""
6868 */
6869
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)6870 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
6871 PyObject *__pyx_v_struct = NULL;
6872 char __pyx_v_c;
6873 PyObject *__pyx_v_bytesvalue = 0;
6874 Py_ssize_t __pyx_v_i;
6875 PyObject *__pyx_r = NULL;
6876 __Pyx_RefNannyDeclarations
6877 PyObject *__pyx_t_1 = NULL;
6878 int __pyx_t_2;
6879 int __pyx_t_3;
6880 PyObject *__pyx_t_4 = NULL;
6881 PyObject *__pyx_t_5 = NULL;
6882 PyObject *__pyx_t_6 = NULL;
6883 int __pyx_t_7;
6884 PyObject *__pyx_t_8 = NULL;
6885 Py_ssize_t __pyx_t_9;
6886 PyObject *__pyx_t_10 = NULL;
6887 char *__pyx_t_11;
6888 char *__pyx_t_12;
6889 char *__pyx_t_13;
6890 char *__pyx_t_14;
6891 int __pyx_lineno = 0;
6892 const char *__pyx_filename = NULL;
6893 int __pyx_clineno = 0;
6894 __Pyx_RefNannySetupContext("assign_item_from_object", 0);
6895
6896 /* "View.MemoryView":504
6897 * """Only used if instantiated manually by the user, or if Cython doesn't
6898 * know how to convert the type"""
6899 * import struct # <<<<<<<<<<<<<<
6900 * cdef char c
6901 * cdef bytes bytesvalue
6902 */
6903 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
6904 __Pyx_GOTREF(__pyx_t_1);
6905 __pyx_v_struct = __pyx_t_1;
6906 __pyx_t_1 = 0;
6907
6908 /* "View.MemoryView":509
6909 * cdef Py_ssize_t i
6910 *
6911 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
6912 * bytesvalue = struct.pack(self.view.format, *value)
6913 * else:
6914 */
6915 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
6916 __pyx_t_3 = (__pyx_t_2 != 0);
6917 if (__pyx_t_3) {
6918
6919 /* "View.MemoryView":510
6920 *
6921 * if isinstance(value, tuple):
6922 * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
6923 * else:
6924 * bytesvalue = struct.pack(self.view.format, value)
6925 */
6926 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
6927 __Pyx_GOTREF(__pyx_t_1);
6928 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
6929 __Pyx_GOTREF(__pyx_t_4);
6930 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
6931 __Pyx_GOTREF(__pyx_t_5);
6932 __Pyx_GIVEREF(__pyx_t_4);
6933 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
6934 __pyx_t_4 = 0;
6935 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
6936 __Pyx_GOTREF(__pyx_t_4);
6937 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
6938 __Pyx_GOTREF(__pyx_t_6);
6939 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6940 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6941 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
6942 __Pyx_GOTREF(__pyx_t_4);
6943 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6944 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6945 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(1, 510, __pyx_L1_error)
6946 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
6947 __pyx_t_4 = 0;
6948
6949 /* "View.MemoryView":509
6950 * cdef Py_ssize_t i
6951 *
6952 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
6953 * bytesvalue = struct.pack(self.view.format, *value)
6954 * else:
6955 */
6956 goto __pyx_L3;
6957 }
6958
6959 /* "View.MemoryView":512
6960 * bytesvalue = struct.pack(self.view.format, *value)
6961 * else:
6962 * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
6963 *
6964 * for i, c in enumerate(bytesvalue):
6965 */
6966 /*else*/ {
6967 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
6968 __Pyx_GOTREF(__pyx_t_6);
6969 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
6970 __Pyx_GOTREF(__pyx_t_1);
6971 __pyx_t_5 = NULL;
6972 __pyx_t_7 = 0;
6973 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
6974 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
6975 if (likely(__pyx_t_5)) {
6976 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6977 __Pyx_INCREF(__pyx_t_5);
6978 __Pyx_INCREF(function);
6979 __Pyx_DECREF_SET(__pyx_t_6, function);
6980 __pyx_t_7 = 1;
6981 }
6982 }
6983 #if CYTHON_FAST_PYCALL
6984 if (PyFunction_Check(__pyx_t_6)) {
6985 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
6986 __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(1, 512, __pyx_L1_error)
6987 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6988 __Pyx_GOTREF(__pyx_t_4);
6989 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6990 } else
6991 #endif
6992 #if CYTHON_FAST_PYCCALL
6993 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
6994 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
6995 __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(1, 512, __pyx_L1_error)
6996 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6997 __Pyx_GOTREF(__pyx_t_4);
6998 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6999 } else
7000 #endif
7001 {
7002 __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
7003 __Pyx_GOTREF(__pyx_t_8);
7004 if (__pyx_t_5) {
7005 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
7006 }
7007 __Pyx_GIVEREF(__pyx_t_1);
7008 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
7009 __Pyx_INCREF(__pyx_v_value);
7010 __Pyx_GIVEREF(__pyx_v_value);
7011 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
7012 __pyx_t_1 = 0;
7013 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
7014 __Pyx_GOTREF(__pyx_t_4);
7015 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7016 }
7017 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7018 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(1, 512, __pyx_L1_error)
7019 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
7020 __pyx_t_4 = 0;
7021 }
7022 __pyx_L3:;
7023
7024 /* "View.MemoryView":514
7025 * bytesvalue = struct.pack(self.view.format, value)
7026 *
7027 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
7028 * itemp[i] = c
7029 *
7030 */
7031 __pyx_t_9 = 0;
7032 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
7033 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
7034 __PYX_ERR(1, 514, __pyx_L1_error)
7035 }
7036 __Pyx_INCREF(__pyx_v_bytesvalue);
7037 __pyx_t_10 = __pyx_v_bytesvalue;
7038 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
7039 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
7040 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
7041 __pyx_t_11 = __pyx_t_14;
7042 __pyx_v_c = (__pyx_t_11[0]);
7043
7044 /* "View.MemoryView":515
7045 *
7046 * for i, c in enumerate(bytesvalue):
7047 * itemp[i] = c # <<<<<<<<<<<<<<
7048 *
7049 * @cname('getbuffer')
7050 */
7051 __pyx_v_i = __pyx_t_9;
7052
7053 /* "View.MemoryView":514
7054 * bytesvalue = struct.pack(self.view.format, value)
7055 *
7056 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
7057 * itemp[i] = c
7058 *
7059 */
7060 __pyx_t_9 = (__pyx_t_9 + 1);
7061
7062 /* "View.MemoryView":515
7063 *
7064 * for i, c in enumerate(bytesvalue):
7065 * itemp[i] = c # <<<<<<<<<<<<<<
7066 *
7067 * @cname('getbuffer')
7068 */
7069 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
7070 }
7071 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7072
7073 /* "View.MemoryView":501
7074 * return result
7075 *
7076 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
7077 * """Only used if instantiated manually by the user, or if Cython doesn't
7078 * know how to convert the type"""
7079 */
7080
7081 /* function exit code */
7082 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7083 goto __pyx_L0;
7084 __pyx_L1_error:;
7085 __Pyx_XDECREF(__pyx_t_1);
7086 __Pyx_XDECREF(__pyx_t_4);
7087 __Pyx_XDECREF(__pyx_t_5);
7088 __Pyx_XDECREF(__pyx_t_6);
7089 __Pyx_XDECREF(__pyx_t_8);
7090 __Pyx_XDECREF(__pyx_t_10);
7091 __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
7092 __pyx_r = 0;
7093 __pyx_L0:;
7094 __Pyx_XDECREF(__pyx_v_struct);
7095 __Pyx_XDECREF(__pyx_v_bytesvalue);
7096 __Pyx_XGIVEREF(__pyx_r);
7097 __Pyx_RefNannyFinishContext();
7098 return __pyx_r;
7099 }
7100
7101 /* "View.MemoryView":518
7102 *
7103 * @cname('getbuffer')
7104 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
7105 * if flags & PyBUF_WRITABLE and self.view.readonly:
7106 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7107 */
7108
7109 /* Python wrapper */
7110 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)7111 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7112 int __pyx_r;
7113 __Pyx_RefNannyDeclarations
7114 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
7115 __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));
7116
7117 /* function exit code */
7118 __Pyx_RefNannyFinishContext();
7119 return __pyx_r;
7120 }
7121
__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)7122 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) {
7123 int __pyx_r;
7124 __Pyx_RefNannyDeclarations
7125 int __pyx_t_1;
7126 int __pyx_t_2;
7127 PyObject *__pyx_t_3 = NULL;
7128 Py_ssize_t *__pyx_t_4;
7129 char *__pyx_t_5;
7130 void *__pyx_t_6;
7131 int __pyx_t_7;
7132 Py_ssize_t __pyx_t_8;
7133 int __pyx_lineno = 0;
7134 const char *__pyx_filename = NULL;
7135 int __pyx_clineno = 0;
7136 if (__pyx_v_info == NULL) {
7137 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
7138 return -1;
7139 }
7140 __Pyx_RefNannySetupContext("__getbuffer__", 0);
7141 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7142 __Pyx_GIVEREF(__pyx_v_info->obj);
7143
7144 /* "View.MemoryView":519
7145 * @cname('getbuffer')
7146 * def __getbuffer__(self, Py_buffer *info, int flags):
7147 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
7148 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7149 *
7150 */
7151 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
7152 if (__pyx_t_2) {
7153 } else {
7154 __pyx_t_1 = __pyx_t_2;
7155 goto __pyx_L4_bool_binop_done;
7156 }
7157 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
7158 __pyx_t_1 = __pyx_t_2;
7159 __pyx_L4_bool_binop_done:;
7160 if (unlikely(__pyx_t_1)) {
7161
7162 /* "View.MemoryView":520
7163 * def __getbuffer__(self, Py_buffer *info, int flags):
7164 * if flags & PyBUF_WRITABLE and self.view.readonly:
7165 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
7166 *
7167 * if flags & PyBUF_ND:
7168 */
7169 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
7170 __Pyx_GOTREF(__pyx_t_3);
7171 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7172 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7173 __PYX_ERR(1, 520, __pyx_L1_error)
7174
7175 /* "View.MemoryView":519
7176 * @cname('getbuffer')
7177 * def __getbuffer__(self, Py_buffer *info, int flags):
7178 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
7179 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7180 *
7181 */
7182 }
7183
7184 /* "View.MemoryView":522
7185 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7186 *
7187 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
7188 * info.shape = self.view.shape
7189 * else:
7190 */
7191 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
7192 if (__pyx_t_1) {
7193
7194 /* "View.MemoryView":523
7195 *
7196 * if flags & PyBUF_ND:
7197 * info.shape = self.view.shape # <<<<<<<<<<<<<<
7198 * else:
7199 * info.shape = NULL
7200 */
7201 __pyx_t_4 = __pyx_v_self->view.shape;
7202 __pyx_v_info->shape = __pyx_t_4;
7203
7204 /* "View.MemoryView":522
7205 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7206 *
7207 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
7208 * info.shape = self.view.shape
7209 * else:
7210 */
7211 goto __pyx_L6;
7212 }
7213
7214 /* "View.MemoryView":525
7215 * info.shape = self.view.shape
7216 * else:
7217 * info.shape = NULL # <<<<<<<<<<<<<<
7218 *
7219 * if flags & PyBUF_STRIDES:
7220 */
7221 /*else*/ {
7222 __pyx_v_info->shape = NULL;
7223 }
7224 __pyx_L6:;
7225
7226 /* "View.MemoryView":527
7227 * info.shape = NULL
7228 *
7229 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
7230 * info.strides = self.view.strides
7231 * else:
7232 */
7233 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
7234 if (__pyx_t_1) {
7235
7236 /* "View.MemoryView":528
7237 *
7238 * if flags & PyBUF_STRIDES:
7239 * info.strides = self.view.strides # <<<<<<<<<<<<<<
7240 * else:
7241 * info.strides = NULL
7242 */
7243 __pyx_t_4 = __pyx_v_self->view.strides;
7244 __pyx_v_info->strides = __pyx_t_4;
7245
7246 /* "View.MemoryView":527
7247 * info.shape = NULL
7248 *
7249 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
7250 * info.strides = self.view.strides
7251 * else:
7252 */
7253 goto __pyx_L7;
7254 }
7255
7256 /* "View.MemoryView":530
7257 * info.strides = self.view.strides
7258 * else:
7259 * info.strides = NULL # <<<<<<<<<<<<<<
7260 *
7261 * if flags & PyBUF_INDIRECT:
7262 */
7263 /*else*/ {
7264 __pyx_v_info->strides = NULL;
7265 }
7266 __pyx_L7:;
7267
7268 /* "View.MemoryView":532
7269 * info.strides = NULL
7270 *
7271 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
7272 * info.suboffsets = self.view.suboffsets
7273 * else:
7274 */
7275 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
7276 if (__pyx_t_1) {
7277
7278 /* "View.MemoryView":533
7279 *
7280 * if flags & PyBUF_INDIRECT:
7281 * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
7282 * else:
7283 * info.suboffsets = NULL
7284 */
7285 __pyx_t_4 = __pyx_v_self->view.suboffsets;
7286 __pyx_v_info->suboffsets = __pyx_t_4;
7287
7288 /* "View.MemoryView":532
7289 * info.strides = NULL
7290 *
7291 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
7292 * info.suboffsets = self.view.suboffsets
7293 * else:
7294 */
7295 goto __pyx_L8;
7296 }
7297
7298 /* "View.MemoryView":535
7299 * info.suboffsets = self.view.suboffsets
7300 * else:
7301 * info.suboffsets = NULL # <<<<<<<<<<<<<<
7302 *
7303 * if flags & PyBUF_FORMAT:
7304 */
7305 /*else*/ {
7306 __pyx_v_info->suboffsets = NULL;
7307 }
7308 __pyx_L8:;
7309
7310 /* "View.MemoryView":537
7311 * info.suboffsets = NULL
7312 *
7313 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
7314 * info.format = self.view.format
7315 * else:
7316 */
7317 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7318 if (__pyx_t_1) {
7319
7320 /* "View.MemoryView":538
7321 *
7322 * if flags & PyBUF_FORMAT:
7323 * info.format = self.view.format # <<<<<<<<<<<<<<
7324 * else:
7325 * info.format = NULL
7326 */
7327 __pyx_t_5 = __pyx_v_self->view.format;
7328 __pyx_v_info->format = __pyx_t_5;
7329
7330 /* "View.MemoryView":537
7331 * info.suboffsets = NULL
7332 *
7333 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
7334 * info.format = self.view.format
7335 * else:
7336 */
7337 goto __pyx_L9;
7338 }
7339
7340 /* "View.MemoryView":540
7341 * info.format = self.view.format
7342 * else:
7343 * info.format = NULL # <<<<<<<<<<<<<<
7344 *
7345 * info.buf = self.view.buf
7346 */
7347 /*else*/ {
7348 __pyx_v_info->format = NULL;
7349 }
7350 __pyx_L9:;
7351
7352 /* "View.MemoryView":542
7353 * info.format = NULL
7354 *
7355 * info.buf = self.view.buf # <<<<<<<<<<<<<<
7356 * info.ndim = self.view.ndim
7357 * info.itemsize = self.view.itemsize
7358 */
7359 __pyx_t_6 = __pyx_v_self->view.buf;
7360 __pyx_v_info->buf = __pyx_t_6;
7361
7362 /* "View.MemoryView":543
7363 *
7364 * info.buf = self.view.buf
7365 * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
7366 * info.itemsize = self.view.itemsize
7367 * info.len = self.view.len
7368 */
7369 __pyx_t_7 = __pyx_v_self->view.ndim;
7370 __pyx_v_info->ndim = __pyx_t_7;
7371
7372 /* "View.MemoryView":544
7373 * info.buf = self.view.buf
7374 * info.ndim = self.view.ndim
7375 * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
7376 * info.len = self.view.len
7377 * info.readonly = self.view.readonly
7378 */
7379 __pyx_t_8 = __pyx_v_self->view.itemsize;
7380 __pyx_v_info->itemsize = __pyx_t_8;
7381
7382 /* "View.MemoryView":545
7383 * info.ndim = self.view.ndim
7384 * info.itemsize = self.view.itemsize
7385 * info.len = self.view.len # <<<<<<<<<<<<<<
7386 * info.readonly = self.view.readonly
7387 * info.obj = self
7388 */
7389 __pyx_t_8 = __pyx_v_self->view.len;
7390 __pyx_v_info->len = __pyx_t_8;
7391
7392 /* "View.MemoryView":546
7393 * info.itemsize = self.view.itemsize
7394 * info.len = self.view.len
7395 * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
7396 * info.obj = self
7397 *
7398 */
7399 __pyx_t_1 = __pyx_v_self->view.readonly;
7400 __pyx_v_info->readonly = __pyx_t_1;
7401
7402 /* "View.MemoryView":547
7403 * info.len = self.view.len
7404 * info.readonly = self.view.readonly
7405 * info.obj = self # <<<<<<<<<<<<<<
7406 *
7407 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
7408 */
7409 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7410 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7411 __Pyx_GOTREF(__pyx_v_info->obj);
7412 __Pyx_DECREF(__pyx_v_info->obj);
7413 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7414
7415 /* "View.MemoryView":518
7416 *
7417 * @cname('getbuffer')
7418 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
7419 * if flags & PyBUF_WRITABLE and self.view.readonly:
7420 * raise ValueError("Cannot create writable memory view from read-only memoryview")
7421 */
7422
7423 /* function exit code */
7424 __pyx_r = 0;
7425 goto __pyx_L0;
7426 __pyx_L1_error:;
7427 __Pyx_XDECREF(__pyx_t_3);
7428 __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7429 __pyx_r = -1;
7430 if (__pyx_v_info->obj != NULL) {
7431 __Pyx_GOTREF(__pyx_v_info->obj);
7432 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7433 }
7434 goto __pyx_L2;
7435 __pyx_L0:;
7436 if (__pyx_v_info->obj == Py_None) {
7437 __Pyx_GOTREF(__pyx_v_info->obj);
7438 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7439 }
7440 __pyx_L2:;
7441 __Pyx_RefNannyFinishContext();
7442 return __pyx_r;
7443 }
7444
7445 /* "View.MemoryView":553
7446 *
7447 * @property
7448 * def T(self): # <<<<<<<<<<<<<<
7449 * cdef _memoryviewslice result = memoryview_copy(self)
7450 * transpose_memslice(&result.from_slice)
7451 */
7452
7453 /* Python wrapper */
7454 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)7455 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
7456 PyObject *__pyx_r = 0;
7457 __Pyx_RefNannyDeclarations
7458 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7459 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7460
7461 /* function exit code */
7462 __Pyx_RefNannyFinishContext();
7463 return __pyx_r;
7464 }
7465
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)7466 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7467 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
7468 PyObject *__pyx_r = NULL;
7469 __Pyx_RefNannyDeclarations
7470 PyObject *__pyx_t_1 = NULL;
7471 int __pyx_t_2;
7472 int __pyx_lineno = 0;
7473 const char *__pyx_filename = NULL;
7474 int __pyx_clineno = 0;
7475 __Pyx_RefNannySetupContext("__get__", 0);
7476
7477 /* "View.MemoryView":554
7478 * @property
7479 * def T(self):
7480 * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
7481 * transpose_memslice(&result.from_slice)
7482 * return result
7483 */
7484 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
7485 __Pyx_GOTREF(__pyx_t_1);
7486 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
7487 __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
7488 __pyx_t_1 = 0;
7489
7490 /* "View.MemoryView":555
7491 * def T(self):
7492 * cdef _memoryviewslice result = memoryview_copy(self)
7493 * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
7494 * return result
7495 *
7496 */
7497 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
7498
7499 /* "View.MemoryView":556
7500 * cdef _memoryviewslice result = memoryview_copy(self)
7501 * transpose_memslice(&result.from_slice)
7502 * return result # <<<<<<<<<<<<<<
7503 *
7504 * @property
7505 */
7506 __Pyx_XDECREF(__pyx_r);
7507 __Pyx_INCREF(((PyObject *)__pyx_v_result));
7508 __pyx_r = ((PyObject *)__pyx_v_result);
7509 goto __pyx_L0;
7510
7511 /* "View.MemoryView":553
7512 *
7513 * @property
7514 * def T(self): # <<<<<<<<<<<<<<
7515 * cdef _memoryviewslice result = memoryview_copy(self)
7516 * transpose_memslice(&result.from_slice)
7517 */
7518
7519 /* function exit code */
7520 __pyx_L1_error:;
7521 __Pyx_XDECREF(__pyx_t_1);
7522 __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7523 __pyx_r = NULL;
7524 __pyx_L0:;
7525 __Pyx_XDECREF((PyObject *)__pyx_v_result);
7526 __Pyx_XGIVEREF(__pyx_r);
7527 __Pyx_RefNannyFinishContext();
7528 return __pyx_r;
7529 }
7530
7531 /* "View.MemoryView":559
7532 *
7533 * @property
7534 * def base(self): # <<<<<<<<<<<<<<
7535 * return self.obj
7536 *
7537 */
7538
7539 /* Python wrapper */
7540 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)7541 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
7542 PyObject *__pyx_r = 0;
7543 __Pyx_RefNannyDeclarations
7544 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7545 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7546
7547 /* function exit code */
7548 __Pyx_RefNannyFinishContext();
7549 return __pyx_r;
7550 }
7551
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)7552 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7553 PyObject *__pyx_r = NULL;
7554 __Pyx_RefNannyDeclarations
7555 __Pyx_RefNannySetupContext("__get__", 0);
7556
7557 /* "View.MemoryView":560
7558 * @property
7559 * def base(self):
7560 * return self.obj # <<<<<<<<<<<<<<
7561 *
7562 * @property
7563 */
7564 __Pyx_XDECREF(__pyx_r);
7565 __Pyx_INCREF(__pyx_v_self->obj);
7566 __pyx_r = __pyx_v_self->obj;
7567 goto __pyx_L0;
7568
7569 /* "View.MemoryView":559
7570 *
7571 * @property
7572 * def base(self): # <<<<<<<<<<<<<<
7573 * return self.obj
7574 *
7575 */
7576
7577 /* function exit code */
7578 __pyx_L0:;
7579 __Pyx_XGIVEREF(__pyx_r);
7580 __Pyx_RefNannyFinishContext();
7581 return __pyx_r;
7582 }
7583
7584 /* "View.MemoryView":563
7585 *
7586 * @property
7587 * def shape(self): # <<<<<<<<<<<<<<
7588 * return tuple([length for length in self.view.shape[:self.view.ndim]])
7589 *
7590 */
7591
7592 /* Python wrapper */
7593 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)7594 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
7595 PyObject *__pyx_r = 0;
7596 __Pyx_RefNannyDeclarations
7597 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7598 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7599
7600 /* function exit code */
7601 __Pyx_RefNannyFinishContext();
7602 return __pyx_r;
7603 }
7604
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)7605 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7606 Py_ssize_t __pyx_v_length;
7607 PyObject *__pyx_r = NULL;
7608 __Pyx_RefNannyDeclarations
7609 PyObject *__pyx_t_1 = NULL;
7610 Py_ssize_t *__pyx_t_2;
7611 Py_ssize_t *__pyx_t_3;
7612 Py_ssize_t *__pyx_t_4;
7613 PyObject *__pyx_t_5 = NULL;
7614 int __pyx_lineno = 0;
7615 const char *__pyx_filename = NULL;
7616 int __pyx_clineno = 0;
7617 __Pyx_RefNannySetupContext("__get__", 0);
7618
7619 /* "View.MemoryView":564
7620 * @property
7621 * def shape(self):
7622 * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
7623 *
7624 * @property
7625 */
7626 __Pyx_XDECREF(__pyx_r);
7627 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
7628 __Pyx_GOTREF(__pyx_t_1);
7629 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
7630 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
7631 __pyx_t_2 = __pyx_t_4;
7632 __pyx_v_length = (__pyx_t_2[0]);
7633 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
7634 __Pyx_GOTREF(__pyx_t_5);
7635 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
7636 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7637 }
7638 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
7639 __Pyx_GOTREF(__pyx_t_5);
7640 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7641 __pyx_r = __pyx_t_5;
7642 __pyx_t_5 = 0;
7643 goto __pyx_L0;
7644
7645 /* "View.MemoryView":563
7646 *
7647 * @property
7648 * def shape(self): # <<<<<<<<<<<<<<
7649 * return tuple([length for length in self.view.shape[:self.view.ndim]])
7650 *
7651 */
7652
7653 /* function exit code */
7654 __pyx_L1_error:;
7655 __Pyx_XDECREF(__pyx_t_1);
7656 __Pyx_XDECREF(__pyx_t_5);
7657 __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7658 __pyx_r = NULL;
7659 __pyx_L0:;
7660 __Pyx_XGIVEREF(__pyx_r);
7661 __Pyx_RefNannyFinishContext();
7662 return __pyx_r;
7663 }
7664
7665 /* "View.MemoryView":567
7666 *
7667 * @property
7668 * def strides(self): # <<<<<<<<<<<<<<
7669 * if self.view.strides == NULL:
7670 *
7671 */
7672
7673 /* Python wrapper */
7674 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)7675 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
7676 PyObject *__pyx_r = 0;
7677 __Pyx_RefNannyDeclarations
7678 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7679 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7680
7681 /* function exit code */
7682 __Pyx_RefNannyFinishContext();
7683 return __pyx_r;
7684 }
7685
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)7686 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7687 Py_ssize_t __pyx_v_stride;
7688 PyObject *__pyx_r = NULL;
7689 __Pyx_RefNannyDeclarations
7690 int __pyx_t_1;
7691 PyObject *__pyx_t_2 = NULL;
7692 Py_ssize_t *__pyx_t_3;
7693 Py_ssize_t *__pyx_t_4;
7694 Py_ssize_t *__pyx_t_5;
7695 PyObject *__pyx_t_6 = NULL;
7696 int __pyx_lineno = 0;
7697 const char *__pyx_filename = NULL;
7698 int __pyx_clineno = 0;
7699 __Pyx_RefNannySetupContext("__get__", 0);
7700
7701 /* "View.MemoryView":568
7702 * @property
7703 * def strides(self):
7704 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
7705 *
7706 * raise ValueError("Buffer view does not expose strides")
7707 */
7708 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
7709 if (unlikely(__pyx_t_1)) {
7710
7711 /* "View.MemoryView":570
7712 * if self.view.strides == NULL:
7713 *
7714 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
7715 *
7716 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
7717 */
7718 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
7719 __Pyx_GOTREF(__pyx_t_2);
7720 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7721 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7722 __PYX_ERR(1, 570, __pyx_L1_error)
7723
7724 /* "View.MemoryView":568
7725 * @property
7726 * def strides(self):
7727 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
7728 *
7729 * raise ValueError("Buffer view does not expose strides")
7730 */
7731 }
7732
7733 /* "View.MemoryView":572
7734 * raise ValueError("Buffer view does not expose strides")
7735 *
7736 * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
7737 *
7738 * @property
7739 */
7740 __Pyx_XDECREF(__pyx_r);
7741 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
7742 __Pyx_GOTREF(__pyx_t_2);
7743 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
7744 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
7745 __pyx_t_3 = __pyx_t_5;
7746 __pyx_v_stride = (__pyx_t_3[0]);
7747 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
7748 __Pyx_GOTREF(__pyx_t_6);
7749 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
7750 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7751 }
7752 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
7753 __Pyx_GOTREF(__pyx_t_6);
7754 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7755 __pyx_r = __pyx_t_6;
7756 __pyx_t_6 = 0;
7757 goto __pyx_L0;
7758
7759 /* "View.MemoryView":567
7760 *
7761 * @property
7762 * def strides(self): # <<<<<<<<<<<<<<
7763 * if self.view.strides == NULL:
7764 *
7765 */
7766
7767 /* function exit code */
7768 __pyx_L1_error:;
7769 __Pyx_XDECREF(__pyx_t_2);
7770 __Pyx_XDECREF(__pyx_t_6);
7771 __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7772 __pyx_r = NULL;
7773 __pyx_L0:;
7774 __Pyx_XGIVEREF(__pyx_r);
7775 __Pyx_RefNannyFinishContext();
7776 return __pyx_r;
7777 }
7778
7779 /* "View.MemoryView":575
7780 *
7781 * @property
7782 * def suboffsets(self): # <<<<<<<<<<<<<<
7783 * if self.view.suboffsets == NULL:
7784 * return (-1,) * self.view.ndim
7785 */
7786
7787 /* Python wrapper */
7788 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)7789 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
7790 PyObject *__pyx_r = 0;
7791 __Pyx_RefNannyDeclarations
7792 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7793 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7794
7795 /* function exit code */
7796 __Pyx_RefNannyFinishContext();
7797 return __pyx_r;
7798 }
7799
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)7800 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7801 Py_ssize_t __pyx_v_suboffset;
7802 PyObject *__pyx_r = NULL;
7803 __Pyx_RefNannyDeclarations
7804 int __pyx_t_1;
7805 PyObject *__pyx_t_2 = NULL;
7806 PyObject *__pyx_t_3 = NULL;
7807 Py_ssize_t *__pyx_t_4;
7808 Py_ssize_t *__pyx_t_5;
7809 Py_ssize_t *__pyx_t_6;
7810 int __pyx_lineno = 0;
7811 const char *__pyx_filename = NULL;
7812 int __pyx_clineno = 0;
7813 __Pyx_RefNannySetupContext("__get__", 0);
7814
7815 /* "View.MemoryView":576
7816 * @property
7817 * def suboffsets(self):
7818 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
7819 * return (-1,) * self.view.ndim
7820 *
7821 */
7822 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
7823 if (__pyx_t_1) {
7824
7825 /* "View.MemoryView":577
7826 * def suboffsets(self):
7827 * if self.view.suboffsets == NULL:
7828 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
7829 *
7830 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
7831 */
7832 __Pyx_XDECREF(__pyx_r);
7833 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
7834 __Pyx_GOTREF(__pyx_t_2);
7835 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__12, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
7836 __Pyx_GOTREF(__pyx_t_3);
7837 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7838 __pyx_r = __pyx_t_3;
7839 __pyx_t_3 = 0;
7840 goto __pyx_L0;
7841
7842 /* "View.MemoryView":576
7843 * @property
7844 * def suboffsets(self):
7845 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
7846 * return (-1,) * self.view.ndim
7847 *
7848 */
7849 }
7850
7851 /* "View.MemoryView":579
7852 * return (-1,) * self.view.ndim
7853 *
7854 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
7855 *
7856 * @property
7857 */
7858 __Pyx_XDECREF(__pyx_r);
7859 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
7860 __Pyx_GOTREF(__pyx_t_3);
7861 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
7862 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
7863 __pyx_t_4 = __pyx_t_6;
7864 __pyx_v_suboffset = (__pyx_t_4[0]);
7865 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
7866 __Pyx_GOTREF(__pyx_t_2);
7867 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
7868 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7869 }
7870 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
7871 __Pyx_GOTREF(__pyx_t_2);
7872 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7873 __pyx_r = __pyx_t_2;
7874 __pyx_t_2 = 0;
7875 goto __pyx_L0;
7876
7877 /* "View.MemoryView":575
7878 *
7879 * @property
7880 * def suboffsets(self): # <<<<<<<<<<<<<<
7881 * if self.view.suboffsets == NULL:
7882 * return (-1,) * self.view.ndim
7883 */
7884
7885 /* function exit code */
7886 __pyx_L1_error:;
7887 __Pyx_XDECREF(__pyx_t_2);
7888 __Pyx_XDECREF(__pyx_t_3);
7889 __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7890 __pyx_r = NULL;
7891 __pyx_L0:;
7892 __Pyx_XGIVEREF(__pyx_r);
7893 __Pyx_RefNannyFinishContext();
7894 return __pyx_r;
7895 }
7896
7897 /* "View.MemoryView":582
7898 *
7899 * @property
7900 * def ndim(self): # <<<<<<<<<<<<<<
7901 * return self.view.ndim
7902 *
7903 */
7904
7905 /* Python wrapper */
7906 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)7907 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
7908 PyObject *__pyx_r = 0;
7909 __Pyx_RefNannyDeclarations
7910 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7911 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7912
7913 /* function exit code */
7914 __Pyx_RefNannyFinishContext();
7915 return __pyx_r;
7916 }
7917
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)7918 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7919 PyObject *__pyx_r = NULL;
7920 __Pyx_RefNannyDeclarations
7921 PyObject *__pyx_t_1 = NULL;
7922 int __pyx_lineno = 0;
7923 const char *__pyx_filename = NULL;
7924 int __pyx_clineno = 0;
7925 __Pyx_RefNannySetupContext("__get__", 0);
7926
7927 /* "View.MemoryView":583
7928 * @property
7929 * def ndim(self):
7930 * return self.view.ndim # <<<<<<<<<<<<<<
7931 *
7932 * @property
7933 */
7934 __Pyx_XDECREF(__pyx_r);
7935 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
7936 __Pyx_GOTREF(__pyx_t_1);
7937 __pyx_r = __pyx_t_1;
7938 __pyx_t_1 = 0;
7939 goto __pyx_L0;
7940
7941 /* "View.MemoryView":582
7942 *
7943 * @property
7944 * def ndim(self): # <<<<<<<<<<<<<<
7945 * return self.view.ndim
7946 *
7947 */
7948
7949 /* function exit code */
7950 __pyx_L1_error:;
7951 __Pyx_XDECREF(__pyx_t_1);
7952 __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7953 __pyx_r = NULL;
7954 __pyx_L0:;
7955 __Pyx_XGIVEREF(__pyx_r);
7956 __Pyx_RefNannyFinishContext();
7957 return __pyx_r;
7958 }
7959
7960 /* "View.MemoryView":586
7961 *
7962 * @property
7963 * def itemsize(self): # <<<<<<<<<<<<<<
7964 * return self.view.itemsize
7965 *
7966 */
7967
7968 /* Python wrapper */
7969 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)7970 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
7971 PyObject *__pyx_r = 0;
7972 __Pyx_RefNannyDeclarations
7973 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7974 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
7975
7976 /* function exit code */
7977 __Pyx_RefNannyFinishContext();
7978 return __pyx_r;
7979 }
7980
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)7981 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
7982 PyObject *__pyx_r = NULL;
7983 __Pyx_RefNannyDeclarations
7984 PyObject *__pyx_t_1 = NULL;
7985 int __pyx_lineno = 0;
7986 const char *__pyx_filename = NULL;
7987 int __pyx_clineno = 0;
7988 __Pyx_RefNannySetupContext("__get__", 0);
7989
7990 /* "View.MemoryView":587
7991 * @property
7992 * def itemsize(self):
7993 * return self.view.itemsize # <<<<<<<<<<<<<<
7994 *
7995 * @property
7996 */
7997 __Pyx_XDECREF(__pyx_r);
7998 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
7999 __Pyx_GOTREF(__pyx_t_1);
8000 __pyx_r = __pyx_t_1;
8001 __pyx_t_1 = 0;
8002 goto __pyx_L0;
8003
8004 /* "View.MemoryView":586
8005 *
8006 * @property
8007 * def itemsize(self): # <<<<<<<<<<<<<<
8008 * return self.view.itemsize
8009 *
8010 */
8011
8012 /* function exit code */
8013 __pyx_L1_error:;
8014 __Pyx_XDECREF(__pyx_t_1);
8015 __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8016 __pyx_r = NULL;
8017 __pyx_L0:;
8018 __Pyx_XGIVEREF(__pyx_r);
8019 __Pyx_RefNannyFinishContext();
8020 return __pyx_r;
8021 }
8022
8023 /* "View.MemoryView":590
8024 *
8025 * @property
8026 * def nbytes(self): # <<<<<<<<<<<<<<
8027 * return self.size * self.view.itemsize
8028 *
8029 */
8030
8031 /* Python wrapper */
8032 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)8033 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
8034 PyObject *__pyx_r = 0;
8035 __Pyx_RefNannyDeclarations
8036 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8037 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8038
8039 /* function exit code */
8040 __Pyx_RefNannyFinishContext();
8041 return __pyx_r;
8042 }
8043
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)8044 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
8045 PyObject *__pyx_r = NULL;
8046 __Pyx_RefNannyDeclarations
8047 PyObject *__pyx_t_1 = NULL;
8048 PyObject *__pyx_t_2 = NULL;
8049 PyObject *__pyx_t_3 = NULL;
8050 int __pyx_lineno = 0;
8051 const char *__pyx_filename = NULL;
8052 int __pyx_clineno = 0;
8053 __Pyx_RefNannySetupContext("__get__", 0);
8054
8055 /* "View.MemoryView":591
8056 * @property
8057 * def nbytes(self):
8058 * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
8059 *
8060 * @property
8061 */
8062 __Pyx_XDECREF(__pyx_r);
8063 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
8064 __Pyx_GOTREF(__pyx_t_1);
8065 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
8066 __Pyx_GOTREF(__pyx_t_2);
8067 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
8068 __Pyx_GOTREF(__pyx_t_3);
8069 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8070 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8071 __pyx_r = __pyx_t_3;
8072 __pyx_t_3 = 0;
8073 goto __pyx_L0;
8074
8075 /* "View.MemoryView":590
8076 *
8077 * @property
8078 * def nbytes(self): # <<<<<<<<<<<<<<
8079 * return self.size * self.view.itemsize
8080 *
8081 */
8082
8083 /* function exit code */
8084 __pyx_L1_error:;
8085 __Pyx_XDECREF(__pyx_t_1);
8086 __Pyx_XDECREF(__pyx_t_2);
8087 __Pyx_XDECREF(__pyx_t_3);
8088 __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8089 __pyx_r = NULL;
8090 __pyx_L0:;
8091 __Pyx_XGIVEREF(__pyx_r);
8092 __Pyx_RefNannyFinishContext();
8093 return __pyx_r;
8094 }
8095
8096 /* "View.MemoryView":594
8097 *
8098 * @property
8099 * def size(self): # <<<<<<<<<<<<<<
8100 * if self._size is None:
8101 * result = 1
8102 */
8103
8104 /* Python wrapper */
8105 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)8106 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
8107 PyObject *__pyx_r = 0;
8108 __Pyx_RefNannyDeclarations
8109 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8110 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8111
8112 /* function exit code */
8113 __Pyx_RefNannyFinishContext();
8114 return __pyx_r;
8115 }
8116
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)8117 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
8118 PyObject *__pyx_v_result = NULL;
8119 PyObject *__pyx_v_length = NULL;
8120 PyObject *__pyx_r = NULL;
8121 __Pyx_RefNannyDeclarations
8122 int __pyx_t_1;
8123 int __pyx_t_2;
8124 Py_ssize_t *__pyx_t_3;
8125 Py_ssize_t *__pyx_t_4;
8126 Py_ssize_t *__pyx_t_5;
8127 PyObject *__pyx_t_6 = NULL;
8128 int __pyx_lineno = 0;
8129 const char *__pyx_filename = NULL;
8130 int __pyx_clineno = 0;
8131 __Pyx_RefNannySetupContext("__get__", 0);
8132
8133 /* "View.MemoryView":595
8134 * @property
8135 * def size(self):
8136 * if self._size is None: # <<<<<<<<<<<<<<
8137 * result = 1
8138 *
8139 */
8140 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
8141 __pyx_t_2 = (__pyx_t_1 != 0);
8142 if (__pyx_t_2) {
8143
8144 /* "View.MemoryView":596
8145 * def size(self):
8146 * if self._size is None:
8147 * result = 1 # <<<<<<<<<<<<<<
8148 *
8149 * for length in self.view.shape[:self.view.ndim]:
8150 */
8151 __Pyx_INCREF(__pyx_int_1);
8152 __pyx_v_result = __pyx_int_1;
8153
8154 /* "View.MemoryView":598
8155 * result = 1
8156 *
8157 * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
8158 * result *= length
8159 *
8160 */
8161 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
8162 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
8163 __pyx_t_3 = __pyx_t_5;
8164 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
8165 __Pyx_GOTREF(__pyx_t_6);
8166 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
8167 __pyx_t_6 = 0;
8168
8169 /* "View.MemoryView":599
8170 *
8171 * for length in self.view.shape[:self.view.ndim]:
8172 * result *= length # <<<<<<<<<<<<<<
8173 *
8174 * self._size = result
8175 */
8176 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
8177 __Pyx_GOTREF(__pyx_t_6);
8178 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
8179 __pyx_t_6 = 0;
8180 }
8181
8182 /* "View.MemoryView":601
8183 * result *= length
8184 *
8185 * self._size = result # <<<<<<<<<<<<<<
8186 *
8187 * return self._size
8188 */
8189 __Pyx_INCREF(__pyx_v_result);
8190 __Pyx_GIVEREF(__pyx_v_result);
8191 __Pyx_GOTREF(__pyx_v_self->_size);
8192 __Pyx_DECREF(__pyx_v_self->_size);
8193 __pyx_v_self->_size = __pyx_v_result;
8194
8195 /* "View.MemoryView":595
8196 * @property
8197 * def size(self):
8198 * if self._size is None: # <<<<<<<<<<<<<<
8199 * result = 1
8200 *
8201 */
8202 }
8203
8204 /* "View.MemoryView":603
8205 * self._size = result
8206 *
8207 * return self._size # <<<<<<<<<<<<<<
8208 *
8209 * def __len__(self):
8210 */
8211 __Pyx_XDECREF(__pyx_r);
8212 __Pyx_INCREF(__pyx_v_self->_size);
8213 __pyx_r = __pyx_v_self->_size;
8214 goto __pyx_L0;
8215
8216 /* "View.MemoryView":594
8217 *
8218 * @property
8219 * def size(self): # <<<<<<<<<<<<<<
8220 * if self._size is None:
8221 * result = 1
8222 */
8223
8224 /* function exit code */
8225 __pyx_L1_error:;
8226 __Pyx_XDECREF(__pyx_t_6);
8227 __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8228 __pyx_r = NULL;
8229 __pyx_L0:;
8230 __Pyx_XDECREF(__pyx_v_result);
8231 __Pyx_XDECREF(__pyx_v_length);
8232 __Pyx_XGIVEREF(__pyx_r);
8233 __Pyx_RefNannyFinishContext();
8234 return __pyx_r;
8235 }
8236
8237 /* "View.MemoryView":605
8238 * return self._size
8239 *
8240 * def __len__(self): # <<<<<<<<<<<<<<
8241 * if self.view.ndim >= 1:
8242 * return self.view.shape[0]
8243 */
8244
8245 /* Python wrapper */
8246 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)8247 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
8248 Py_ssize_t __pyx_r;
8249 __Pyx_RefNannyDeclarations
8250 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8251 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8252
8253 /* function exit code */
8254 __Pyx_RefNannyFinishContext();
8255 return __pyx_r;
8256 }
8257
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)8258 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
8259 Py_ssize_t __pyx_r;
8260 __Pyx_RefNannyDeclarations
8261 int __pyx_t_1;
8262 __Pyx_RefNannySetupContext("__len__", 0);
8263
8264 /* "View.MemoryView":606
8265 *
8266 * def __len__(self):
8267 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
8268 * return self.view.shape[0]
8269 *
8270 */
8271 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
8272 if (__pyx_t_1) {
8273
8274 /* "View.MemoryView":607
8275 * def __len__(self):
8276 * if self.view.ndim >= 1:
8277 * return self.view.shape[0] # <<<<<<<<<<<<<<
8278 *
8279 * return 0
8280 */
8281 __pyx_r = (__pyx_v_self->view.shape[0]);
8282 goto __pyx_L0;
8283
8284 /* "View.MemoryView":606
8285 *
8286 * def __len__(self):
8287 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
8288 * return self.view.shape[0]
8289 *
8290 */
8291 }
8292
8293 /* "View.MemoryView":609
8294 * return self.view.shape[0]
8295 *
8296 * return 0 # <<<<<<<<<<<<<<
8297 *
8298 * def __repr__(self):
8299 */
8300 __pyx_r = 0;
8301 goto __pyx_L0;
8302
8303 /* "View.MemoryView":605
8304 * return self._size
8305 *
8306 * def __len__(self): # <<<<<<<<<<<<<<
8307 * if self.view.ndim >= 1:
8308 * return self.view.shape[0]
8309 */
8310
8311 /* function exit code */
8312 __pyx_L0:;
8313 __Pyx_RefNannyFinishContext();
8314 return __pyx_r;
8315 }
8316
8317 /* "View.MemoryView":611
8318 * return 0
8319 *
8320 * def __repr__(self): # <<<<<<<<<<<<<<
8321 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
8322 * id(self))
8323 */
8324
8325 /* Python wrapper */
8326 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)8327 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
8328 PyObject *__pyx_r = 0;
8329 __Pyx_RefNannyDeclarations
8330 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
8331 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8332
8333 /* function exit code */
8334 __Pyx_RefNannyFinishContext();
8335 return __pyx_r;
8336 }
8337
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)8338 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
8339 PyObject *__pyx_r = NULL;
8340 __Pyx_RefNannyDeclarations
8341 PyObject *__pyx_t_1 = NULL;
8342 PyObject *__pyx_t_2 = NULL;
8343 PyObject *__pyx_t_3 = NULL;
8344 int __pyx_lineno = 0;
8345 const char *__pyx_filename = NULL;
8346 int __pyx_clineno = 0;
8347 __Pyx_RefNannySetupContext("__repr__", 0);
8348
8349 /* "View.MemoryView":612
8350 *
8351 * def __repr__(self):
8352 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
8353 * id(self))
8354 *
8355 */
8356 __Pyx_XDECREF(__pyx_r);
8357 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
8358 __Pyx_GOTREF(__pyx_t_1);
8359 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
8360 __Pyx_GOTREF(__pyx_t_2);
8361 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8362 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
8363 __Pyx_GOTREF(__pyx_t_1);
8364 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8365
8366 /* "View.MemoryView":613
8367 * def __repr__(self):
8368 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
8369 * id(self)) # <<<<<<<<<<<<<<
8370 *
8371 * def __str__(self):
8372 */
8373 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
8374 __Pyx_GOTREF(__pyx_t_2);
8375
8376 /* "View.MemoryView":612
8377 *
8378 * def __repr__(self):
8379 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
8380 * id(self))
8381 *
8382 */
8383 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
8384 __Pyx_GOTREF(__pyx_t_3);
8385 __Pyx_GIVEREF(__pyx_t_1);
8386 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
8387 __Pyx_GIVEREF(__pyx_t_2);
8388 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
8389 __pyx_t_1 = 0;
8390 __pyx_t_2 = 0;
8391 __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(1, 612, __pyx_L1_error)
8392 __Pyx_GOTREF(__pyx_t_2);
8393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8394 __pyx_r = __pyx_t_2;
8395 __pyx_t_2 = 0;
8396 goto __pyx_L0;
8397
8398 /* "View.MemoryView":611
8399 * return 0
8400 *
8401 * def __repr__(self): # <<<<<<<<<<<<<<
8402 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
8403 * id(self))
8404 */
8405
8406 /* function exit code */
8407 __pyx_L1_error:;
8408 __Pyx_XDECREF(__pyx_t_1);
8409 __Pyx_XDECREF(__pyx_t_2);
8410 __Pyx_XDECREF(__pyx_t_3);
8411 __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8412 __pyx_r = NULL;
8413 __pyx_L0:;
8414 __Pyx_XGIVEREF(__pyx_r);
8415 __Pyx_RefNannyFinishContext();
8416 return __pyx_r;
8417 }
8418
8419 /* "View.MemoryView":615
8420 * id(self))
8421 *
8422 * def __str__(self): # <<<<<<<<<<<<<<
8423 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
8424 *
8425 */
8426
8427 /* Python wrapper */
8428 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)8429 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
8430 PyObject *__pyx_r = 0;
8431 __Pyx_RefNannyDeclarations
8432 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
8433 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8434
8435 /* function exit code */
8436 __Pyx_RefNannyFinishContext();
8437 return __pyx_r;
8438 }
8439
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)8440 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
8441 PyObject *__pyx_r = NULL;
8442 __Pyx_RefNannyDeclarations
8443 PyObject *__pyx_t_1 = NULL;
8444 PyObject *__pyx_t_2 = NULL;
8445 int __pyx_lineno = 0;
8446 const char *__pyx_filename = NULL;
8447 int __pyx_clineno = 0;
8448 __Pyx_RefNannySetupContext("__str__", 0);
8449
8450 /* "View.MemoryView":616
8451 *
8452 * def __str__(self):
8453 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
8454 *
8455 *
8456 */
8457 __Pyx_XDECREF(__pyx_r);
8458 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
8459 __Pyx_GOTREF(__pyx_t_1);
8460 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
8461 __Pyx_GOTREF(__pyx_t_2);
8462 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8463 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
8464 __Pyx_GOTREF(__pyx_t_1);
8465 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8466 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
8467 __Pyx_GOTREF(__pyx_t_2);
8468 __Pyx_GIVEREF(__pyx_t_1);
8469 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
8470 __pyx_t_1 = 0;
8471 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
8472 __Pyx_GOTREF(__pyx_t_1);
8473 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8474 __pyx_r = __pyx_t_1;
8475 __pyx_t_1 = 0;
8476 goto __pyx_L0;
8477
8478 /* "View.MemoryView":615
8479 * id(self))
8480 *
8481 * def __str__(self): # <<<<<<<<<<<<<<
8482 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
8483 *
8484 */
8485
8486 /* function exit code */
8487 __pyx_L1_error:;
8488 __Pyx_XDECREF(__pyx_t_1);
8489 __Pyx_XDECREF(__pyx_t_2);
8490 __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8491 __pyx_r = NULL;
8492 __pyx_L0:;
8493 __Pyx_XGIVEREF(__pyx_r);
8494 __Pyx_RefNannyFinishContext();
8495 return __pyx_r;
8496 }
8497
8498 /* "View.MemoryView":619
8499 *
8500 *
8501 * def is_c_contig(self): # <<<<<<<<<<<<<<
8502 * cdef __Pyx_memviewslice *mslice
8503 * cdef __Pyx_memviewslice tmp
8504 */
8505
8506 /* Python wrapper */
8507 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)8508 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8509 PyObject *__pyx_r = 0;
8510 __Pyx_RefNannyDeclarations
8511 __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
8512 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
8513
8514 /* function exit code */
8515 __Pyx_RefNannyFinishContext();
8516 return __pyx_r;
8517 }
8518
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)8519 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
8520 __Pyx_memviewslice *__pyx_v_mslice;
8521 __Pyx_memviewslice __pyx_v_tmp;
8522 PyObject *__pyx_r = NULL;
8523 __Pyx_RefNannyDeclarations
8524 __Pyx_memviewslice *__pyx_t_1;
8525 PyObject *__pyx_t_2 = NULL;
8526 int __pyx_lineno = 0;
8527 const char *__pyx_filename = NULL;
8528 int __pyx_clineno = 0;
8529 __Pyx_RefNannySetupContext("is_c_contig", 0);
8530
8531 /* "View.MemoryView":622
8532 * cdef __Pyx_memviewslice *mslice
8533 * cdef __Pyx_memviewslice tmp
8534 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
8535 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
8536 *
8537 */
8538 __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(1, 622, __pyx_L1_error)
8539 __pyx_v_mslice = __pyx_t_1;
8540
8541 /* "View.MemoryView":623
8542 * cdef __Pyx_memviewslice tmp
8543 * mslice = get_slice_from_memview(self, &tmp)
8544 * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
8545 *
8546 * def is_f_contig(self):
8547 */
8548 __Pyx_XDECREF(__pyx_r);
8549 __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(1, 623, __pyx_L1_error)
8550 __Pyx_GOTREF(__pyx_t_2);
8551 __pyx_r = __pyx_t_2;
8552 __pyx_t_2 = 0;
8553 goto __pyx_L0;
8554
8555 /* "View.MemoryView":619
8556 *
8557 *
8558 * def is_c_contig(self): # <<<<<<<<<<<<<<
8559 * cdef __Pyx_memviewslice *mslice
8560 * cdef __Pyx_memviewslice tmp
8561 */
8562
8563 /* function exit code */
8564 __pyx_L1_error:;
8565 __Pyx_XDECREF(__pyx_t_2);
8566 __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
8567 __pyx_r = NULL;
8568 __pyx_L0:;
8569 __Pyx_XGIVEREF(__pyx_r);
8570 __Pyx_RefNannyFinishContext();
8571 return __pyx_r;
8572 }
8573
8574 /* "View.MemoryView":625
8575 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
8576 *
8577 * def is_f_contig(self): # <<<<<<<<<<<<<<
8578 * cdef __Pyx_memviewslice *mslice
8579 * cdef __Pyx_memviewslice tmp
8580 */
8581
8582 /* Python wrapper */
8583 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)8584 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8585 PyObject *__pyx_r = 0;
8586 __Pyx_RefNannyDeclarations
8587 __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
8588 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
8589
8590 /* function exit code */
8591 __Pyx_RefNannyFinishContext();
8592 return __pyx_r;
8593 }
8594
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)8595 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
8596 __Pyx_memviewslice *__pyx_v_mslice;
8597 __Pyx_memviewslice __pyx_v_tmp;
8598 PyObject *__pyx_r = NULL;
8599 __Pyx_RefNannyDeclarations
8600 __Pyx_memviewslice *__pyx_t_1;
8601 PyObject *__pyx_t_2 = NULL;
8602 int __pyx_lineno = 0;
8603 const char *__pyx_filename = NULL;
8604 int __pyx_clineno = 0;
8605 __Pyx_RefNannySetupContext("is_f_contig", 0);
8606
8607 /* "View.MemoryView":628
8608 * cdef __Pyx_memviewslice *mslice
8609 * cdef __Pyx_memviewslice tmp
8610 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
8611 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
8612 *
8613 */
8614 __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(1, 628, __pyx_L1_error)
8615 __pyx_v_mslice = __pyx_t_1;
8616
8617 /* "View.MemoryView":629
8618 * cdef __Pyx_memviewslice tmp
8619 * mslice = get_slice_from_memview(self, &tmp)
8620 * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
8621 *
8622 * def copy(self):
8623 */
8624 __Pyx_XDECREF(__pyx_r);
8625 __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(1, 629, __pyx_L1_error)
8626 __Pyx_GOTREF(__pyx_t_2);
8627 __pyx_r = __pyx_t_2;
8628 __pyx_t_2 = 0;
8629 goto __pyx_L0;
8630
8631 /* "View.MemoryView":625
8632 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
8633 *
8634 * def is_f_contig(self): # <<<<<<<<<<<<<<
8635 * cdef __Pyx_memviewslice *mslice
8636 * cdef __Pyx_memviewslice tmp
8637 */
8638
8639 /* function exit code */
8640 __pyx_L1_error:;
8641 __Pyx_XDECREF(__pyx_t_2);
8642 __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
8643 __pyx_r = NULL;
8644 __pyx_L0:;
8645 __Pyx_XGIVEREF(__pyx_r);
8646 __Pyx_RefNannyFinishContext();
8647 return __pyx_r;
8648 }
8649
8650 /* "View.MemoryView":631
8651 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
8652 *
8653 * def copy(self): # <<<<<<<<<<<<<<
8654 * cdef __Pyx_memviewslice mslice
8655 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
8656 */
8657
8658 /* Python wrapper */
8659 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)8660 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8661 PyObject *__pyx_r = 0;
8662 __Pyx_RefNannyDeclarations
8663 __Pyx_RefNannySetupContext("copy (wrapper)", 0);
8664 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
8665
8666 /* function exit code */
8667 __Pyx_RefNannyFinishContext();
8668 return __pyx_r;
8669 }
8670
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)8671 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
8672 __Pyx_memviewslice __pyx_v_mslice;
8673 int __pyx_v_flags;
8674 PyObject *__pyx_r = NULL;
8675 __Pyx_RefNannyDeclarations
8676 __Pyx_memviewslice __pyx_t_1;
8677 PyObject *__pyx_t_2 = NULL;
8678 int __pyx_lineno = 0;
8679 const char *__pyx_filename = NULL;
8680 int __pyx_clineno = 0;
8681 __Pyx_RefNannySetupContext("copy", 0);
8682
8683 /* "View.MemoryView":633
8684 * def copy(self):
8685 * cdef __Pyx_memviewslice mslice
8686 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
8687 *
8688 * slice_copy(self, &mslice)
8689 */
8690 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
8691
8692 /* "View.MemoryView":635
8693 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
8694 *
8695 * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
8696 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
8697 * self.view.itemsize,
8698 */
8699 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
8700
8701 /* "View.MemoryView":636
8702 *
8703 * slice_copy(self, &mslice)
8704 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
8705 * self.view.itemsize,
8706 * flags|PyBUF_C_CONTIGUOUS,
8707 */
8708 __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(1, 636, __pyx_L1_error)
8709 __pyx_v_mslice = __pyx_t_1;
8710
8711 /* "View.MemoryView":641
8712 * self.dtype_is_object)
8713 *
8714 * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
8715 *
8716 * def copy_fortran(self):
8717 */
8718 __Pyx_XDECREF(__pyx_r);
8719 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
8720 __Pyx_GOTREF(__pyx_t_2);
8721 __pyx_r = __pyx_t_2;
8722 __pyx_t_2 = 0;
8723 goto __pyx_L0;
8724
8725 /* "View.MemoryView":631
8726 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
8727 *
8728 * def copy(self): # <<<<<<<<<<<<<<
8729 * cdef __Pyx_memviewslice mslice
8730 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
8731 */
8732
8733 /* function exit code */
8734 __pyx_L1_error:;
8735 __Pyx_XDECREF(__pyx_t_2);
8736 __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
8737 __pyx_r = NULL;
8738 __pyx_L0:;
8739 __Pyx_XGIVEREF(__pyx_r);
8740 __Pyx_RefNannyFinishContext();
8741 return __pyx_r;
8742 }
8743
8744 /* "View.MemoryView":643
8745 * return memoryview_copy_from_slice(self, &mslice)
8746 *
8747 * def copy_fortran(self): # <<<<<<<<<<<<<<
8748 * cdef __Pyx_memviewslice src, dst
8749 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
8750 */
8751
8752 /* Python wrapper */
8753 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)8754 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8755 PyObject *__pyx_r = 0;
8756 __Pyx_RefNannyDeclarations
8757 __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
8758 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
8759
8760 /* function exit code */
8761 __Pyx_RefNannyFinishContext();
8762 return __pyx_r;
8763 }
8764
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)8765 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
8766 __Pyx_memviewslice __pyx_v_src;
8767 __Pyx_memviewslice __pyx_v_dst;
8768 int __pyx_v_flags;
8769 PyObject *__pyx_r = NULL;
8770 __Pyx_RefNannyDeclarations
8771 __Pyx_memviewslice __pyx_t_1;
8772 PyObject *__pyx_t_2 = NULL;
8773 int __pyx_lineno = 0;
8774 const char *__pyx_filename = NULL;
8775 int __pyx_clineno = 0;
8776 __Pyx_RefNannySetupContext("copy_fortran", 0);
8777
8778 /* "View.MemoryView":645
8779 * def copy_fortran(self):
8780 * cdef __Pyx_memviewslice src, dst
8781 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
8782 *
8783 * slice_copy(self, &src)
8784 */
8785 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
8786
8787 /* "View.MemoryView":647
8788 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
8789 *
8790 * slice_copy(self, &src) # <<<<<<<<<<<<<<
8791 * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
8792 * self.view.itemsize,
8793 */
8794 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
8795
8796 /* "View.MemoryView":648
8797 *
8798 * slice_copy(self, &src)
8799 * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
8800 * self.view.itemsize,
8801 * flags|PyBUF_F_CONTIGUOUS,
8802 */
8803 __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(1, 648, __pyx_L1_error)
8804 __pyx_v_dst = __pyx_t_1;
8805
8806 /* "View.MemoryView":653
8807 * self.dtype_is_object)
8808 *
8809 * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
8810 *
8811 *
8812 */
8813 __Pyx_XDECREF(__pyx_r);
8814 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
8815 __Pyx_GOTREF(__pyx_t_2);
8816 __pyx_r = __pyx_t_2;
8817 __pyx_t_2 = 0;
8818 goto __pyx_L0;
8819
8820 /* "View.MemoryView":643
8821 * return memoryview_copy_from_slice(self, &mslice)
8822 *
8823 * def copy_fortran(self): # <<<<<<<<<<<<<<
8824 * cdef __Pyx_memviewslice src, dst
8825 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
8826 */
8827
8828 /* function exit code */
8829 __pyx_L1_error:;
8830 __Pyx_XDECREF(__pyx_t_2);
8831 __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
8832 __pyx_r = NULL;
8833 __pyx_L0:;
8834 __Pyx_XGIVEREF(__pyx_r);
8835 __Pyx_RefNannyFinishContext();
8836 return __pyx_r;
8837 }
8838
8839 /* "(tree fragment)":1
8840 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8841 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8842 * def __setstate_cython__(self, __pyx_state):
8843 */
8844
8845 /* Python wrapper */
8846 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)8847 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8848 PyObject *__pyx_r = 0;
8849 __Pyx_RefNannyDeclarations
8850 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8851 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8852
8853 /* function exit code */
8854 __Pyx_RefNannyFinishContext();
8855 return __pyx_r;
8856 }
8857
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)8858 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
8859 PyObject *__pyx_r = NULL;
8860 __Pyx_RefNannyDeclarations
8861 PyObject *__pyx_t_1 = NULL;
8862 int __pyx_lineno = 0;
8863 const char *__pyx_filename = NULL;
8864 int __pyx_clineno = 0;
8865 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8866
8867 /* "(tree fragment)":2
8868 * def __reduce_cython__(self):
8869 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8870 * def __setstate_cython__(self, __pyx_state):
8871 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8872 */
8873 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8874 __Pyx_GOTREF(__pyx_t_1);
8875 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8876 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8877 __PYX_ERR(1, 2, __pyx_L1_error)
8878
8879 /* "(tree fragment)":1
8880 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8881 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8882 * def __setstate_cython__(self, __pyx_state):
8883 */
8884
8885 /* function exit code */
8886 __pyx_L1_error:;
8887 __Pyx_XDECREF(__pyx_t_1);
8888 __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8889 __pyx_r = NULL;
8890 __Pyx_XGIVEREF(__pyx_r);
8891 __Pyx_RefNannyFinishContext();
8892 return __pyx_r;
8893 }
8894
8895 /* "(tree fragment)":3
8896 * def __reduce_cython__(self):
8897 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8898 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8899 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8900 */
8901
8902 /* Python wrapper */
8903 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)8904 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8905 PyObject *__pyx_r = 0;
8906 __Pyx_RefNannyDeclarations
8907 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8908 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8909
8910 /* function exit code */
8911 __Pyx_RefNannyFinishContext();
8912 return __pyx_r;
8913 }
8914
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8915 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) {
8916 PyObject *__pyx_r = NULL;
8917 __Pyx_RefNannyDeclarations
8918 PyObject *__pyx_t_1 = NULL;
8919 int __pyx_lineno = 0;
8920 const char *__pyx_filename = NULL;
8921 int __pyx_clineno = 0;
8922 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8923
8924 /* "(tree fragment)":4
8925 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8926 * def __setstate_cython__(self, __pyx_state):
8927 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8928 */
8929 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8930 __Pyx_GOTREF(__pyx_t_1);
8931 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8932 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8933 __PYX_ERR(1, 4, __pyx_L1_error)
8934
8935 /* "(tree fragment)":3
8936 * def __reduce_cython__(self):
8937 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8938 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8939 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8940 */
8941
8942 /* function exit code */
8943 __pyx_L1_error:;
8944 __Pyx_XDECREF(__pyx_t_1);
8945 __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8946 __pyx_r = NULL;
8947 __Pyx_XGIVEREF(__pyx_r);
8948 __Pyx_RefNannyFinishContext();
8949 return __pyx_r;
8950 }
8951
8952 /* "View.MemoryView":657
8953 *
8954 * @cname('__pyx_memoryview_new')
8955 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
8956 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
8957 * result.typeinfo = typeinfo
8958 */
8959
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)8960 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
8961 struct __pyx_memoryview_obj *__pyx_v_result = 0;
8962 PyObject *__pyx_r = NULL;
8963 __Pyx_RefNannyDeclarations
8964 PyObject *__pyx_t_1 = NULL;
8965 PyObject *__pyx_t_2 = NULL;
8966 PyObject *__pyx_t_3 = NULL;
8967 int __pyx_lineno = 0;
8968 const char *__pyx_filename = NULL;
8969 int __pyx_clineno = 0;
8970 __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
8971
8972 /* "View.MemoryView":658
8973 * @cname('__pyx_memoryview_new')
8974 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
8975 * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
8976 * result.typeinfo = typeinfo
8977 * return result
8978 */
8979 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
8980 __Pyx_GOTREF(__pyx_t_1);
8981 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
8982 __Pyx_GOTREF(__pyx_t_2);
8983 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
8984 __Pyx_GOTREF(__pyx_t_3);
8985 __Pyx_INCREF(__pyx_v_o);
8986 __Pyx_GIVEREF(__pyx_v_o);
8987 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
8988 __Pyx_GIVEREF(__pyx_t_1);
8989 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8990 __Pyx_GIVEREF(__pyx_t_2);
8991 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8992 __pyx_t_1 = 0;
8993 __pyx_t_2 = 0;
8994 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
8995 __Pyx_GOTREF(__pyx_t_2);
8996 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8997 __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
8998 __pyx_t_2 = 0;
8999
9000 /* "View.MemoryView":659
9001 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
9002 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
9003 * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
9004 * return result
9005 *
9006 */
9007 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
9008
9009 /* "View.MemoryView":660
9010 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
9011 * result.typeinfo = typeinfo
9012 * return result # <<<<<<<<<<<<<<
9013 *
9014 * @cname('__pyx_memoryview_check')
9015 */
9016 __Pyx_XDECREF(__pyx_r);
9017 __Pyx_INCREF(((PyObject *)__pyx_v_result));
9018 __pyx_r = ((PyObject *)__pyx_v_result);
9019 goto __pyx_L0;
9020
9021 /* "View.MemoryView":657
9022 *
9023 * @cname('__pyx_memoryview_new')
9024 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
9025 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
9026 * result.typeinfo = typeinfo
9027 */
9028
9029 /* function exit code */
9030 __pyx_L1_error:;
9031 __Pyx_XDECREF(__pyx_t_1);
9032 __Pyx_XDECREF(__pyx_t_2);
9033 __Pyx_XDECREF(__pyx_t_3);
9034 __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
9035 __pyx_r = 0;
9036 __pyx_L0:;
9037 __Pyx_XDECREF((PyObject *)__pyx_v_result);
9038 __Pyx_XGIVEREF(__pyx_r);
9039 __Pyx_RefNannyFinishContext();
9040 return __pyx_r;
9041 }
9042
9043 /* "View.MemoryView":663
9044 *
9045 * @cname('__pyx_memoryview_check')
9046 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
9047 * return isinstance(o, memoryview)
9048 *
9049 */
9050
__pyx_memoryview_check(PyObject * __pyx_v_o)9051 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
9052 int __pyx_r;
9053 __Pyx_RefNannyDeclarations
9054 int __pyx_t_1;
9055 __Pyx_RefNannySetupContext("memoryview_check", 0);
9056
9057 /* "View.MemoryView":664
9058 * @cname('__pyx_memoryview_check')
9059 * cdef inline bint memoryview_check(object o):
9060 * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
9061 *
9062 * cdef tuple _unellipsify(object index, int ndim):
9063 */
9064 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
9065 __pyx_r = __pyx_t_1;
9066 goto __pyx_L0;
9067
9068 /* "View.MemoryView":663
9069 *
9070 * @cname('__pyx_memoryview_check')
9071 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
9072 * return isinstance(o, memoryview)
9073 *
9074 */
9075
9076 /* function exit code */
9077 __pyx_L0:;
9078 __Pyx_RefNannyFinishContext();
9079 return __pyx_r;
9080 }
9081
9082 /* "View.MemoryView":666
9083 * return isinstance(o, memoryview)
9084 *
9085 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
9086 * """
9087 * Replace all ellipses with full slices and fill incomplete indices with
9088 */
9089
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)9090 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
9091 PyObject *__pyx_v_tup = NULL;
9092 PyObject *__pyx_v_result = NULL;
9093 int __pyx_v_have_slices;
9094 int __pyx_v_seen_ellipsis;
9095 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
9096 PyObject *__pyx_v_item = NULL;
9097 Py_ssize_t __pyx_v_nslices;
9098 PyObject *__pyx_r = NULL;
9099 __Pyx_RefNannyDeclarations
9100 int __pyx_t_1;
9101 int __pyx_t_2;
9102 PyObject *__pyx_t_3 = NULL;
9103 PyObject *__pyx_t_4 = NULL;
9104 Py_ssize_t __pyx_t_5;
9105 PyObject *(*__pyx_t_6)(PyObject *);
9106 PyObject *__pyx_t_7 = NULL;
9107 Py_ssize_t __pyx_t_8;
9108 int __pyx_t_9;
9109 int __pyx_t_10;
9110 PyObject *__pyx_t_11 = NULL;
9111 int __pyx_lineno = 0;
9112 const char *__pyx_filename = NULL;
9113 int __pyx_clineno = 0;
9114 __Pyx_RefNannySetupContext("_unellipsify", 0);
9115
9116 /* "View.MemoryView":671
9117 * full slices.
9118 * """
9119 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
9120 * tup = (index,)
9121 * else:
9122 */
9123 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
9124 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
9125 if (__pyx_t_2) {
9126
9127 /* "View.MemoryView":672
9128 * """
9129 * if not isinstance(index, tuple):
9130 * tup = (index,) # <<<<<<<<<<<<<<
9131 * else:
9132 * tup = index
9133 */
9134 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
9135 __Pyx_GOTREF(__pyx_t_3);
9136 __Pyx_INCREF(__pyx_v_index);
9137 __Pyx_GIVEREF(__pyx_v_index);
9138 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
9139 __pyx_v_tup = __pyx_t_3;
9140 __pyx_t_3 = 0;
9141
9142 /* "View.MemoryView":671
9143 * full slices.
9144 * """
9145 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
9146 * tup = (index,)
9147 * else:
9148 */
9149 goto __pyx_L3;
9150 }
9151
9152 /* "View.MemoryView":674
9153 * tup = (index,)
9154 * else:
9155 * tup = index # <<<<<<<<<<<<<<
9156 *
9157 * result = []
9158 */
9159 /*else*/ {
9160 __Pyx_INCREF(__pyx_v_index);
9161 __pyx_v_tup = __pyx_v_index;
9162 }
9163 __pyx_L3:;
9164
9165 /* "View.MemoryView":676
9166 * tup = index
9167 *
9168 * result = [] # <<<<<<<<<<<<<<
9169 * have_slices = False
9170 * seen_ellipsis = False
9171 */
9172 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
9173 __Pyx_GOTREF(__pyx_t_3);
9174 __pyx_v_result = ((PyObject*)__pyx_t_3);
9175 __pyx_t_3 = 0;
9176
9177 /* "View.MemoryView":677
9178 *
9179 * result = []
9180 * have_slices = False # <<<<<<<<<<<<<<
9181 * seen_ellipsis = False
9182 * for idx, item in enumerate(tup):
9183 */
9184 __pyx_v_have_slices = 0;
9185
9186 /* "View.MemoryView":678
9187 * result = []
9188 * have_slices = False
9189 * seen_ellipsis = False # <<<<<<<<<<<<<<
9190 * for idx, item in enumerate(tup):
9191 * if item is Ellipsis:
9192 */
9193 __pyx_v_seen_ellipsis = 0;
9194
9195 /* "View.MemoryView":679
9196 * have_slices = False
9197 * seen_ellipsis = False
9198 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
9199 * if item is Ellipsis:
9200 * if not seen_ellipsis:
9201 */
9202 __Pyx_INCREF(__pyx_int_0);
9203 __pyx_t_3 = __pyx_int_0;
9204 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
9205 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
9206 __pyx_t_6 = NULL;
9207 } else {
9208 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
9209 __Pyx_GOTREF(__pyx_t_4);
9210 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
9211 }
9212 for (;;) {
9213 if (likely(!__pyx_t_6)) {
9214 if (likely(PyList_CheckExact(__pyx_t_4))) {
9215 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
9216 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9217 __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(1, 679, __pyx_L1_error)
9218 #else
9219 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
9220 __Pyx_GOTREF(__pyx_t_7);
9221 #endif
9222 } else {
9223 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
9224 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9225 __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(1, 679, __pyx_L1_error)
9226 #else
9227 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
9228 __Pyx_GOTREF(__pyx_t_7);
9229 #endif
9230 }
9231 } else {
9232 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
9233 if (unlikely(!__pyx_t_7)) {
9234 PyObject* exc_type = PyErr_Occurred();
9235 if (exc_type) {
9236 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9237 else __PYX_ERR(1, 679, __pyx_L1_error)
9238 }
9239 break;
9240 }
9241 __Pyx_GOTREF(__pyx_t_7);
9242 }
9243 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
9244 __pyx_t_7 = 0;
9245 __Pyx_INCREF(__pyx_t_3);
9246 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
9247 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
9248 __Pyx_GOTREF(__pyx_t_7);
9249 __Pyx_DECREF(__pyx_t_3);
9250 __pyx_t_3 = __pyx_t_7;
9251 __pyx_t_7 = 0;
9252
9253 /* "View.MemoryView":680
9254 * seen_ellipsis = False
9255 * for idx, item in enumerate(tup):
9256 * if item is Ellipsis: # <<<<<<<<<<<<<<
9257 * if not seen_ellipsis:
9258 * result.extend([slice(None)] * (ndim - len(tup) + 1))
9259 */
9260 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
9261 __pyx_t_1 = (__pyx_t_2 != 0);
9262 if (__pyx_t_1) {
9263
9264 /* "View.MemoryView":681
9265 * for idx, item in enumerate(tup):
9266 * if item is Ellipsis:
9267 * if not seen_ellipsis: # <<<<<<<<<<<<<<
9268 * result.extend([slice(None)] * (ndim - len(tup) + 1))
9269 * seen_ellipsis = True
9270 */
9271 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
9272 if (__pyx_t_1) {
9273
9274 /* "View.MemoryView":682
9275 * if item is Ellipsis:
9276 * if not seen_ellipsis:
9277 * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
9278 * seen_ellipsis = True
9279 * else:
9280 */
9281 __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
9282 __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(1, 682, __pyx_L1_error)
9283 __Pyx_GOTREF(__pyx_t_7);
9284 { Py_ssize_t __pyx_temp;
9285 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
9286 __Pyx_INCREF(__pyx_slice__15);
9287 __Pyx_GIVEREF(__pyx_slice__15);
9288 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__15);
9289 }
9290 }
9291 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
9292 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9293
9294 /* "View.MemoryView":683
9295 * if not seen_ellipsis:
9296 * result.extend([slice(None)] * (ndim - len(tup) + 1))
9297 * seen_ellipsis = True # <<<<<<<<<<<<<<
9298 * else:
9299 * result.append(slice(None))
9300 */
9301 __pyx_v_seen_ellipsis = 1;
9302
9303 /* "View.MemoryView":681
9304 * for idx, item in enumerate(tup):
9305 * if item is Ellipsis:
9306 * if not seen_ellipsis: # <<<<<<<<<<<<<<
9307 * result.extend([slice(None)] * (ndim - len(tup) + 1))
9308 * seen_ellipsis = True
9309 */
9310 goto __pyx_L7;
9311 }
9312
9313 /* "View.MemoryView":685
9314 * seen_ellipsis = True
9315 * else:
9316 * result.append(slice(None)) # <<<<<<<<<<<<<<
9317 * have_slices = True
9318 * else:
9319 */
9320 /*else*/ {
9321 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__15); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
9322 }
9323 __pyx_L7:;
9324
9325 /* "View.MemoryView":686
9326 * else:
9327 * result.append(slice(None))
9328 * have_slices = True # <<<<<<<<<<<<<<
9329 * else:
9330 * if not isinstance(item, slice) and not PyIndex_Check(item):
9331 */
9332 __pyx_v_have_slices = 1;
9333
9334 /* "View.MemoryView":680
9335 * seen_ellipsis = False
9336 * for idx, item in enumerate(tup):
9337 * if item is Ellipsis: # <<<<<<<<<<<<<<
9338 * if not seen_ellipsis:
9339 * result.extend([slice(None)] * (ndim - len(tup) + 1))
9340 */
9341 goto __pyx_L6;
9342 }
9343
9344 /* "View.MemoryView":688
9345 * have_slices = True
9346 * else:
9347 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
9348 * raise TypeError("Cannot index with type '%s'" % type(item))
9349 *
9350 */
9351 /*else*/ {
9352 __pyx_t_2 = PySlice_Check(__pyx_v_item);
9353 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
9354 if (__pyx_t_10) {
9355 } else {
9356 __pyx_t_1 = __pyx_t_10;
9357 goto __pyx_L9_bool_binop_done;
9358 }
9359 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
9360 __pyx_t_1 = __pyx_t_10;
9361 __pyx_L9_bool_binop_done:;
9362 if (unlikely(__pyx_t_1)) {
9363
9364 /* "View.MemoryView":689
9365 * else:
9366 * if not isinstance(item, slice) and not PyIndex_Check(item):
9367 * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
9368 *
9369 * have_slices = have_slices or isinstance(item, slice)
9370 */
9371 __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(1, 689, __pyx_L1_error)
9372 __Pyx_GOTREF(__pyx_t_7);
9373 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
9374 __Pyx_GOTREF(__pyx_t_11);
9375 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9376 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
9377 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
9378 __PYX_ERR(1, 689, __pyx_L1_error)
9379
9380 /* "View.MemoryView":688
9381 * have_slices = True
9382 * else:
9383 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
9384 * raise TypeError("Cannot index with type '%s'" % type(item))
9385 *
9386 */
9387 }
9388
9389 /* "View.MemoryView":691
9390 * raise TypeError("Cannot index with type '%s'" % type(item))
9391 *
9392 * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
9393 * result.append(item)
9394 *
9395 */
9396 __pyx_t_10 = (__pyx_v_have_slices != 0);
9397 if (!__pyx_t_10) {
9398 } else {
9399 __pyx_t_1 = __pyx_t_10;
9400 goto __pyx_L11_bool_binop_done;
9401 }
9402 __pyx_t_10 = PySlice_Check(__pyx_v_item);
9403 __pyx_t_2 = (__pyx_t_10 != 0);
9404 __pyx_t_1 = __pyx_t_2;
9405 __pyx_L11_bool_binop_done:;
9406 __pyx_v_have_slices = __pyx_t_1;
9407
9408 /* "View.MemoryView":692
9409 *
9410 * have_slices = have_slices or isinstance(item, slice)
9411 * result.append(item) # <<<<<<<<<<<<<<
9412 *
9413 * nslices = ndim - len(result)
9414 */
9415 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
9416 }
9417 __pyx_L6:;
9418
9419 /* "View.MemoryView":679
9420 * have_slices = False
9421 * seen_ellipsis = False
9422 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
9423 * if item is Ellipsis:
9424 * if not seen_ellipsis:
9425 */
9426 }
9427 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9428 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9429
9430 /* "View.MemoryView":694
9431 * result.append(item)
9432 *
9433 * nslices = ndim - len(result) # <<<<<<<<<<<<<<
9434 * if nslices:
9435 * result.extend([slice(None)] * nslices)
9436 */
9437 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
9438 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
9439
9440 /* "View.MemoryView":695
9441 *
9442 * nslices = ndim - len(result)
9443 * if nslices: # <<<<<<<<<<<<<<
9444 * result.extend([slice(None)] * nslices)
9445 *
9446 */
9447 __pyx_t_1 = (__pyx_v_nslices != 0);
9448 if (__pyx_t_1) {
9449
9450 /* "View.MemoryView":696
9451 * nslices = ndim - len(result)
9452 * if nslices:
9453 * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
9454 *
9455 * return have_slices or nslices, tuple(result)
9456 */
9457 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
9458 __Pyx_GOTREF(__pyx_t_3);
9459 { Py_ssize_t __pyx_temp;
9460 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
9461 __Pyx_INCREF(__pyx_slice__15);
9462 __Pyx_GIVEREF(__pyx_slice__15);
9463 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__15);
9464 }
9465 }
9466 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
9467 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9468
9469 /* "View.MemoryView":695
9470 *
9471 * nslices = ndim - len(result)
9472 * if nslices: # <<<<<<<<<<<<<<
9473 * result.extend([slice(None)] * nslices)
9474 *
9475 */
9476 }
9477
9478 /* "View.MemoryView":698
9479 * result.extend([slice(None)] * nslices)
9480 *
9481 * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
9482 *
9483 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
9484 */
9485 __Pyx_XDECREF(__pyx_r);
9486 if (!__pyx_v_have_slices) {
9487 } else {
9488 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
9489 __Pyx_GOTREF(__pyx_t_4);
9490 __pyx_t_3 = __pyx_t_4;
9491 __pyx_t_4 = 0;
9492 goto __pyx_L14_bool_binop_done;
9493 }
9494 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
9495 __Pyx_GOTREF(__pyx_t_4);
9496 __pyx_t_3 = __pyx_t_4;
9497 __pyx_t_4 = 0;
9498 __pyx_L14_bool_binop_done:;
9499 __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
9500 __Pyx_GOTREF(__pyx_t_4);
9501 __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
9502 __Pyx_GOTREF(__pyx_t_11);
9503 __Pyx_GIVEREF(__pyx_t_3);
9504 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
9505 __Pyx_GIVEREF(__pyx_t_4);
9506 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
9507 __pyx_t_3 = 0;
9508 __pyx_t_4 = 0;
9509 __pyx_r = ((PyObject*)__pyx_t_11);
9510 __pyx_t_11 = 0;
9511 goto __pyx_L0;
9512
9513 /* "View.MemoryView":666
9514 * return isinstance(o, memoryview)
9515 *
9516 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
9517 * """
9518 * Replace all ellipses with full slices and fill incomplete indices with
9519 */
9520
9521 /* function exit code */
9522 __pyx_L1_error:;
9523 __Pyx_XDECREF(__pyx_t_3);
9524 __Pyx_XDECREF(__pyx_t_4);
9525 __Pyx_XDECREF(__pyx_t_7);
9526 __Pyx_XDECREF(__pyx_t_11);
9527 __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
9528 __pyx_r = 0;
9529 __pyx_L0:;
9530 __Pyx_XDECREF(__pyx_v_tup);
9531 __Pyx_XDECREF(__pyx_v_result);
9532 __Pyx_XDECREF(__pyx_v_idx);
9533 __Pyx_XDECREF(__pyx_v_item);
9534 __Pyx_XGIVEREF(__pyx_r);
9535 __Pyx_RefNannyFinishContext();
9536 return __pyx_r;
9537 }
9538
9539 /* "View.MemoryView":700
9540 * return have_slices or nslices, tuple(result)
9541 *
9542 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
9543 * for suboffset in suboffsets[:ndim]:
9544 * if suboffset >= 0:
9545 */
9546
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)9547 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
9548 Py_ssize_t __pyx_v_suboffset;
9549 PyObject *__pyx_r = NULL;
9550 __Pyx_RefNannyDeclarations
9551 Py_ssize_t *__pyx_t_1;
9552 Py_ssize_t *__pyx_t_2;
9553 Py_ssize_t *__pyx_t_3;
9554 int __pyx_t_4;
9555 PyObject *__pyx_t_5 = NULL;
9556 int __pyx_lineno = 0;
9557 const char *__pyx_filename = NULL;
9558 int __pyx_clineno = 0;
9559 __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
9560
9561 /* "View.MemoryView":701
9562 *
9563 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
9564 * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
9565 * if suboffset >= 0:
9566 * raise ValueError("Indirect dimensions not supported")
9567 */
9568 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
9569 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
9570 __pyx_t_1 = __pyx_t_3;
9571 __pyx_v_suboffset = (__pyx_t_1[0]);
9572
9573 /* "View.MemoryView":702
9574 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
9575 * for suboffset in suboffsets[:ndim]:
9576 * if suboffset >= 0: # <<<<<<<<<<<<<<
9577 * raise ValueError("Indirect dimensions not supported")
9578 *
9579 */
9580 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
9581 if (unlikely(__pyx_t_4)) {
9582
9583 /* "View.MemoryView":703
9584 * for suboffset in suboffsets[:ndim]:
9585 * if suboffset >= 0:
9586 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
9587 *
9588 *
9589 */
9590 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
9591 __Pyx_GOTREF(__pyx_t_5);
9592 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
9593 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9594 __PYX_ERR(1, 703, __pyx_L1_error)
9595
9596 /* "View.MemoryView":702
9597 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
9598 * for suboffset in suboffsets[:ndim]:
9599 * if suboffset >= 0: # <<<<<<<<<<<<<<
9600 * raise ValueError("Indirect dimensions not supported")
9601 *
9602 */
9603 }
9604 }
9605
9606 /* "View.MemoryView":700
9607 * return have_slices or nslices, tuple(result)
9608 *
9609 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
9610 * for suboffset in suboffsets[:ndim]:
9611 * if suboffset >= 0:
9612 */
9613
9614 /* function exit code */
9615 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9616 goto __pyx_L0;
9617 __pyx_L1_error:;
9618 __Pyx_XDECREF(__pyx_t_5);
9619 __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
9620 __pyx_r = 0;
9621 __pyx_L0:;
9622 __Pyx_XGIVEREF(__pyx_r);
9623 __Pyx_RefNannyFinishContext();
9624 return __pyx_r;
9625 }
9626
9627 /* "View.MemoryView":710
9628 *
9629 * @cname('__pyx_memview_slice')
9630 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
9631 * cdef int new_ndim = 0, suboffset_dim = -1, dim
9632 * cdef bint negative_step
9633 */
9634
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)9635 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
9636 int __pyx_v_new_ndim;
9637 int __pyx_v_suboffset_dim;
9638 int __pyx_v_dim;
9639 __Pyx_memviewslice __pyx_v_src;
9640 __Pyx_memviewslice __pyx_v_dst;
9641 __Pyx_memviewslice *__pyx_v_p_src;
9642 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
9643 __Pyx_memviewslice *__pyx_v_p_dst;
9644 int *__pyx_v_p_suboffset_dim;
9645 Py_ssize_t __pyx_v_start;
9646 Py_ssize_t __pyx_v_stop;
9647 Py_ssize_t __pyx_v_step;
9648 int __pyx_v_have_start;
9649 int __pyx_v_have_stop;
9650 int __pyx_v_have_step;
9651 PyObject *__pyx_v_index = NULL;
9652 struct __pyx_memoryview_obj *__pyx_r = NULL;
9653 __Pyx_RefNannyDeclarations
9654 int __pyx_t_1;
9655 int __pyx_t_2;
9656 PyObject *__pyx_t_3 = NULL;
9657 struct __pyx_memoryview_obj *__pyx_t_4;
9658 char *__pyx_t_5;
9659 int __pyx_t_6;
9660 Py_ssize_t __pyx_t_7;
9661 PyObject *(*__pyx_t_8)(PyObject *);
9662 PyObject *__pyx_t_9 = NULL;
9663 Py_ssize_t __pyx_t_10;
9664 int __pyx_t_11;
9665 Py_ssize_t __pyx_t_12;
9666 int __pyx_lineno = 0;
9667 const char *__pyx_filename = NULL;
9668 int __pyx_clineno = 0;
9669 __Pyx_RefNannySetupContext("memview_slice", 0);
9670
9671 /* "View.MemoryView":711
9672 * @cname('__pyx_memview_slice')
9673 * cdef memoryview memview_slice(memoryview memview, object indices):
9674 * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
9675 * cdef bint negative_step
9676 * cdef __Pyx_memviewslice src, dst
9677 */
9678 __pyx_v_new_ndim = 0;
9679 __pyx_v_suboffset_dim = -1;
9680
9681 /* "View.MemoryView":718
9682 *
9683 *
9684 * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
9685 *
9686 * cdef _memoryviewslice memviewsliceobj
9687 */
9688 (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
9689
9690 /* "View.MemoryView":722
9691 * cdef _memoryviewslice memviewsliceobj
9692 *
9693 * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
9694 *
9695 * if isinstance(memview, _memoryviewslice):
9696 */
9697 #ifndef CYTHON_WITHOUT_ASSERTIONS
9698 if (unlikely(!Py_OptimizeFlag)) {
9699 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
9700 PyErr_SetNone(PyExc_AssertionError);
9701 __PYX_ERR(1, 722, __pyx_L1_error)
9702 }
9703 }
9704 #endif
9705
9706 /* "View.MemoryView":724
9707 * assert memview.view.ndim > 0
9708 *
9709 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
9710 * memviewsliceobj = memview
9711 * p_src = &memviewsliceobj.from_slice
9712 */
9713 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
9714 __pyx_t_2 = (__pyx_t_1 != 0);
9715 if (__pyx_t_2) {
9716
9717 /* "View.MemoryView":725
9718 *
9719 * if isinstance(memview, _memoryviewslice):
9720 * memviewsliceobj = memview # <<<<<<<<<<<<<<
9721 * p_src = &memviewsliceobj.from_slice
9722 * else:
9723 */
9724 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
9725 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
9726 __Pyx_INCREF(__pyx_t_3);
9727 __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
9728 __pyx_t_3 = 0;
9729
9730 /* "View.MemoryView":726
9731 * if isinstance(memview, _memoryviewslice):
9732 * memviewsliceobj = memview
9733 * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
9734 * else:
9735 * slice_copy(memview, &src)
9736 */
9737 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
9738
9739 /* "View.MemoryView":724
9740 * assert memview.view.ndim > 0
9741 *
9742 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
9743 * memviewsliceobj = memview
9744 * p_src = &memviewsliceobj.from_slice
9745 */
9746 goto __pyx_L3;
9747 }
9748
9749 /* "View.MemoryView":728
9750 * p_src = &memviewsliceobj.from_slice
9751 * else:
9752 * slice_copy(memview, &src) # <<<<<<<<<<<<<<
9753 * p_src = &src
9754 *
9755 */
9756 /*else*/ {
9757 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
9758
9759 /* "View.MemoryView":729
9760 * else:
9761 * slice_copy(memview, &src)
9762 * p_src = &src # <<<<<<<<<<<<<<
9763 *
9764 *
9765 */
9766 __pyx_v_p_src = (&__pyx_v_src);
9767 }
9768 __pyx_L3:;
9769
9770 /* "View.MemoryView":735
9771 *
9772 *
9773 * dst.memview = p_src.memview # <<<<<<<<<<<<<<
9774 * dst.data = p_src.data
9775 *
9776 */
9777 __pyx_t_4 = __pyx_v_p_src->memview;
9778 __pyx_v_dst.memview = __pyx_t_4;
9779
9780 /* "View.MemoryView":736
9781 *
9782 * dst.memview = p_src.memview
9783 * dst.data = p_src.data # <<<<<<<<<<<<<<
9784 *
9785 *
9786 */
9787 __pyx_t_5 = __pyx_v_p_src->data;
9788 __pyx_v_dst.data = __pyx_t_5;
9789
9790 /* "View.MemoryView":741
9791 *
9792 *
9793 * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
9794 * cdef int *p_suboffset_dim = &suboffset_dim
9795 * cdef Py_ssize_t start, stop, step
9796 */
9797 __pyx_v_p_dst = (&__pyx_v_dst);
9798
9799 /* "View.MemoryView":742
9800 *
9801 * cdef __Pyx_memviewslice *p_dst = &dst
9802 * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
9803 * cdef Py_ssize_t start, stop, step
9804 * cdef bint have_start, have_stop, have_step
9805 */
9806 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
9807
9808 /* "View.MemoryView":746
9809 * cdef bint have_start, have_stop, have_step
9810 *
9811 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
9812 * if PyIndex_Check(index):
9813 * slice_memviewslice(
9814 */
9815 __pyx_t_6 = 0;
9816 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
9817 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
9818 __pyx_t_8 = NULL;
9819 } else {
9820 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
9821 __Pyx_GOTREF(__pyx_t_3);
9822 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
9823 }
9824 for (;;) {
9825 if (likely(!__pyx_t_8)) {
9826 if (likely(PyList_CheckExact(__pyx_t_3))) {
9827 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
9828 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9829 __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(1, 746, __pyx_L1_error)
9830 #else
9831 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
9832 __Pyx_GOTREF(__pyx_t_9);
9833 #endif
9834 } else {
9835 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
9836 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9837 __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(1, 746, __pyx_L1_error)
9838 #else
9839 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
9840 __Pyx_GOTREF(__pyx_t_9);
9841 #endif
9842 }
9843 } else {
9844 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
9845 if (unlikely(!__pyx_t_9)) {
9846 PyObject* exc_type = PyErr_Occurred();
9847 if (exc_type) {
9848 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9849 else __PYX_ERR(1, 746, __pyx_L1_error)
9850 }
9851 break;
9852 }
9853 __Pyx_GOTREF(__pyx_t_9);
9854 }
9855 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
9856 __pyx_t_9 = 0;
9857 __pyx_v_dim = __pyx_t_6;
9858 __pyx_t_6 = (__pyx_t_6 + 1);
9859
9860 /* "View.MemoryView":747
9861 *
9862 * for dim, index in enumerate(indices):
9863 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
9864 * slice_memviewslice(
9865 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
9866 */
9867 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
9868 if (__pyx_t_2) {
9869
9870 /* "View.MemoryView":751
9871 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
9872 * dim, new_ndim, p_suboffset_dim,
9873 * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
9874 * 0, 0, 0, # have_{start,stop,step}
9875 * False)
9876 */
9877 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
9878
9879 /* "View.MemoryView":748
9880 * for dim, index in enumerate(indices):
9881 * if PyIndex_Check(index):
9882 * slice_memviewslice( # <<<<<<<<<<<<<<
9883 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
9884 * dim, new_ndim, p_suboffset_dim,
9885 */
9886 __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(1, 748, __pyx_L1_error)
9887
9888 /* "View.MemoryView":747
9889 *
9890 * for dim, index in enumerate(indices):
9891 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
9892 * slice_memviewslice(
9893 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
9894 */
9895 goto __pyx_L6;
9896 }
9897
9898 /* "View.MemoryView":754
9899 * 0, 0, 0, # have_{start,stop,step}
9900 * False)
9901 * elif index is None: # <<<<<<<<<<<<<<
9902 * p_dst.shape[new_ndim] = 1
9903 * p_dst.strides[new_ndim] = 0
9904 */
9905 __pyx_t_2 = (__pyx_v_index == Py_None);
9906 __pyx_t_1 = (__pyx_t_2 != 0);
9907 if (__pyx_t_1) {
9908
9909 /* "View.MemoryView":755
9910 * False)
9911 * elif index is None:
9912 * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
9913 * p_dst.strides[new_ndim] = 0
9914 * p_dst.suboffsets[new_ndim] = -1
9915 */
9916 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
9917
9918 /* "View.MemoryView":756
9919 * elif index is None:
9920 * p_dst.shape[new_ndim] = 1
9921 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
9922 * p_dst.suboffsets[new_ndim] = -1
9923 * new_ndim += 1
9924 */
9925 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
9926
9927 /* "View.MemoryView":757
9928 * p_dst.shape[new_ndim] = 1
9929 * p_dst.strides[new_ndim] = 0
9930 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
9931 * new_ndim += 1
9932 * else:
9933 */
9934 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
9935
9936 /* "View.MemoryView":758
9937 * p_dst.strides[new_ndim] = 0
9938 * p_dst.suboffsets[new_ndim] = -1
9939 * new_ndim += 1 # <<<<<<<<<<<<<<
9940 * else:
9941 * start = index.start or 0
9942 */
9943 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
9944
9945 /* "View.MemoryView":754
9946 * 0, 0, 0, # have_{start,stop,step}
9947 * False)
9948 * elif index is None: # <<<<<<<<<<<<<<
9949 * p_dst.shape[new_ndim] = 1
9950 * p_dst.strides[new_ndim] = 0
9951 */
9952 goto __pyx_L6;
9953 }
9954
9955 /* "View.MemoryView":760
9956 * new_ndim += 1
9957 * else:
9958 * start = index.start or 0 # <<<<<<<<<<<<<<
9959 * stop = index.stop or 0
9960 * step = index.step or 0
9961 */
9962 /*else*/ {
9963 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
9964 __Pyx_GOTREF(__pyx_t_9);
9965 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
9966 if (!__pyx_t_1) {
9967 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9968 } else {
9969 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
9970 __pyx_t_10 = __pyx_t_12;
9971 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9972 goto __pyx_L7_bool_binop_done;
9973 }
9974 __pyx_t_10 = 0;
9975 __pyx_L7_bool_binop_done:;
9976 __pyx_v_start = __pyx_t_10;
9977
9978 /* "View.MemoryView":761
9979 * else:
9980 * start = index.start or 0
9981 * stop = index.stop or 0 # <<<<<<<<<<<<<<
9982 * step = index.step or 0
9983 *
9984 */
9985 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
9986 __Pyx_GOTREF(__pyx_t_9);
9987 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
9988 if (!__pyx_t_1) {
9989 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9990 } else {
9991 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
9992 __pyx_t_10 = __pyx_t_12;
9993 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9994 goto __pyx_L9_bool_binop_done;
9995 }
9996 __pyx_t_10 = 0;
9997 __pyx_L9_bool_binop_done:;
9998 __pyx_v_stop = __pyx_t_10;
9999
10000 /* "View.MemoryView":762
10001 * start = index.start or 0
10002 * stop = index.stop or 0
10003 * step = index.step or 0 # <<<<<<<<<<<<<<
10004 *
10005 * have_start = index.start is not None
10006 */
10007 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
10008 __Pyx_GOTREF(__pyx_t_9);
10009 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
10010 if (!__pyx_t_1) {
10011 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10012 } else {
10013 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
10014 __pyx_t_10 = __pyx_t_12;
10015 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10016 goto __pyx_L11_bool_binop_done;
10017 }
10018 __pyx_t_10 = 0;
10019 __pyx_L11_bool_binop_done:;
10020 __pyx_v_step = __pyx_t_10;
10021
10022 /* "View.MemoryView":764
10023 * step = index.step or 0
10024 *
10025 * have_start = index.start is not None # <<<<<<<<<<<<<<
10026 * have_stop = index.stop is not None
10027 * have_step = index.step is not None
10028 */
10029 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
10030 __Pyx_GOTREF(__pyx_t_9);
10031 __pyx_t_1 = (__pyx_t_9 != Py_None);
10032 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10033 __pyx_v_have_start = __pyx_t_1;
10034
10035 /* "View.MemoryView":765
10036 *
10037 * have_start = index.start is not None
10038 * have_stop = index.stop is not None # <<<<<<<<<<<<<<
10039 * have_step = index.step is not None
10040 *
10041 */
10042 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
10043 __Pyx_GOTREF(__pyx_t_9);
10044 __pyx_t_1 = (__pyx_t_9 != Py_None);
10045 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10046 __pyx_v_have_stop = __pyx_t_1;
10047
10048 /* "View.MemoryView":766
10049 * have_start = index.start is not None
10050 * have_stop = index.stop is not None
10051 * have_step = index.step is not None # <<<<<<<<<<<<<<
10052 *
10053 * slice_memviewslice(
10054 */
10055 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
10056 __Pyx_GOTREF(__pyx_t_9);
10057 __pyx_t_1 = (__pyx_t_9 != Py_None);
10058 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10059 __pyx_v_have_step = __pyx_t_1;
10060
10061 /* "View.MemoryView":768
10062 * have_step = index.step is not None
10063 *
10064 * slice_memviewslice( # <<<<<<<<<<<<<<
10065 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
10066 * dim, new_ndim, p_suboffset_dim,
10067 */
10068 __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(1, 768, __pyx_L1_error)
10069
10070 /* "View.MemoryView":774
10071 * have_start, have_stop, have_step,
10072 * True)
10073 * new_ndim += 1 # <<<<<<<<<<<<<<
10074 *
10075 * if isinstance(memview, _memoryviewslice):
10076 */
10077 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
10078 }
10079 __pyx_L6:;
10080
10081 /* "View.MemoryView":746
10082 * cdef bint have_start, have_stop, have_step
10083 *
10084 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
10085 * if PyIndex_Check(index):
10086 * slice_memviewslice(
10087 */
10088 }
10089 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10090
10091 /* "View.MemoryView":776
10092 * new_ndim += 1
10093 *
10094 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
10095 * return memoryview_fromslice(dst, new_ndim,
10096 * memviewsliceobj.to_object_func,
10097 */
10098 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
10099 __pyx_t_2 = (__pyx_t_1 != 0);
10100 if (__pyx_t_2) {
10101
10102 /* "View.MemoryView":777
10103 *
10104 * if isinstance(memview, _memoryviewslice):
10105 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
10106 * memviewsliceobj.to_object_func,
10107 * memviewsliceobj.to_dtype_func,
10108 */
10109 __Pyx_XDECREF(((PyObject *)__pyx_r));
10110
10111 /* "View.MemoryView":778
10112 * if isinstance(memview, _memoryviewslice):
10113 * return memoryview_fromslice(dst, new_ndim,
10114 * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
10115 * memviewsliceobj.to_dtype_func,
10116 * memview.dtype_is_object)
10117 */
10118 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
10119
10120 /* "View.MemoryView":779
10121 * return memoryview_fromslice(dst, new_ndim,
10122 * memviewsliceobj.to_object_func,
10123 * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
10124 * memview.dtype_is_object)
10125 * else:
10126 */
10127 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
10128
10129 /* "View.MemoryView":777
10130 *
10131 * if isinstance(memview, _memoryviewslice):
10132 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
10133 * memviewsliceobj.to_object_func,
10134 * memviewsliceobj.to_dtype_func,
10135 */
10136 __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(1, 777, __pyx_L1_error)
10137 __Pyx_GOTREF(__pyx_t_3);
10138 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
10139 __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
10140 __pyx_t_3 = 0;
10141 goto __pyx_L0;
10142
10143 /* "View.MemoryView":776
10144 * new_ndim += 1
10145 *
10146 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
10147 * return memoryview_fromslice(dst, new_ndim,
10148 * memviewsliceobj.to_object_func,
10149 */
10150 }
10151
10152 /* "View.MemoryView":782
10153 * memview.dtype_is_object)
10154 * else:
10155 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
10156 * memview.dtype_is_object)
10157 *
10158 */
10159 /*else*/ {
10160 __Pyx_XDECREF(((PyObject *)__pyx_r));
10161
10162 /* "View.MemoryView":783
10163 * else:
10164 * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
10165 * memview.dtype_is_object) # <<<<<<<<<<<<<<
10166 *
10167 *
10168 */
10169 __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(1, 782, __pyx_L1_error)
10170 __Pyx_GOTREF(__pyx_t_3);
10171
10172 /* "View.MemoryView":782
10173 * memview.dtype_is_object)
10174 * else:
10175 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
10176 * memview.dtype_is_object)
10177 *
10178 */
10179 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
10180 __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
10181 __pyx_t_3 = 0;
10182 goto __pyx_L0;
10183 }
10184
10185 /* "View.MemoryView":710
10186 *
10187 * @cname('__pyx_memview_slice')
10188 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
10189 * cdef int new_ndim = 0, suboffset_dim = -1, dim
10190 * cdef bint negative_step
10191 */
10192
10193 /* function exit code */
10194 __pyx_L1_error:;
10195 __Pyx_XDECREF(__pyx_t_3);
10196 __Pyx_XDECREF(__pyx_t_9);
10197 __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10198 __pyx_r = 0;
10199 __pyx_L0:;
10200 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
10201 __Pyx_XDECREF(__pyx_v_index);
10202 __Pyx_XGIVEREF((PyObject *)__pyx_r);
10203 __Pyx_RefNannyFinishContext();
10204 return __pyx_r;
10205 }
10206
10207 /* "View.MemoryView":807
10208 *
10209 * @cname('__pyx_memoryview_slice_memviewslice')
10210 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
10211 * __Pyx_memviewslice *dst,
10212 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
10213 */
10214
__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)10215 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) {
10216 Py_ssize_t __pyx_v_new_shape;
10217 int __pyx_v_negative_step;
10218 int __pyx_r;
10219 int __pyx_t_1;
10220 int __pyx_t_2;
10221 int __pyx_t_3;
10222 int __pyx_lineno = 0;
10223 const char *__pyx_filename = NULL;
10224 int __pyx_clineno = 0;
10225
10226 /* "View.MemoryView":827
10227 * cdef bint negative_step
10228 *
10229 * if not is_slice: # <<<<<<<<<<<<<<
10230 *
10231 * if start < 0:
10232 */
10233 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
10234 if (__pyx_t_1) {
10235
10236 /* "View.MemoryView":829
10237 * if not is_slice:
10238 *
10239 * if start < 0: # <<<<<<<<<<<<<<
10240 * start += shape
10241 * if not 0 <= start < shape:
10242 */
10243 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
10244 if (__pyx_t_1) {
10245
10246 /* "View.MemoryView":830
10247 *
10248 * if start < 0:
10249 * start += shape # <<<<<<<<<<<<<<
10250 * if not 0 <= start < shape:
10251 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
10252 */
10253 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
10254
10255 /* "View.MemoryView":829
10256 * if not is_slice:
10257 *
10258 * if start < 0: # <<<<<<<<<<<<<<
10259 * start += shape
10260 * if not 0 <= start < shape:
10261 */
10262 }
10263
10264 /* "View.MemoryView":831
10265 * if start < 0:
10266 * start += shape
10267 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
10268 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
10269 * else:
10270 */
10271 __pyx_t_1 = (0 <= __pyx_v_start);
10272 if (__pyx_t_1) {
10273 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
10274 }
10275 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10276 if (__pyx_t_2) {
10277
10278 /* "View.MemoryView":832
10279 * start += shape
10280 * if not 0 <= start < shape:
10281 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
10282 * else:
10283 *
10284 */
10285 __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(1, 832, __pyx_L1_error)
10286
10287 /* "View.MemoryView":831
10288 * if start < 0:
10289 * start += shape
10290 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
10291 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
10292 * else:
10293 */
10294 }
10295
10296 /* "View.MemoryView":827
10297 * cdef bint negative_step
10298 *
10299 * if not is_slice: # <<<<<<<<<<<<<<
10300 *
10301 * if start < 0:
10302 */
10303 goto __pyx_L3;
10304 }
10305
10306 /* "View.MemoryView":835
10307 * else:
10308 *
10309 * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
10310 *
10311 * if have_step and step == 0:
10312 */
10313 /*else*/ {
10314 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
10315 if (__pyx_t_1) {
10316 } else {
10317 __pyx_t_2 = __pyx_t_1;
10318 goto __pyx_L6_bool_binop_done;
10319 }
10320 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
10321 __pyx_t_2 = __pyx_t_1;
10322 __pyx_L6_bool_binop_done:;
10323 __pyx_v_negative_step = __pyx_t_2;
10324
10325 /* "View.MemoryView":837
10326 * negative_step = have_step != 0 and step < 0
10327 *
10328 * if have_step and step == 0: # <<<<<<<<<<<<<<
10329 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
10330 *
10331 */
10332 __pyx_t_1 = (__pyx_v_have_step != 0);
10333 if (__pyx_t_1) {
10334 } else {
10335 __pyx_t_2 = __pyx_t_1;
10336 goto __pyx_L9_bool_binop_done;
10337 }
10338 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
10339 __pyx_t_2 = __pyx_t_1;
10340 __pyx_L9_bool_binop_done:;
10341 if (__pyx_t_2) {
10342
10343 /* "View.MemoryView":838
10344 *
10345 * if have_step and step == 0:
10346 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
10347 *
10348 *
10349 */
10350 __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(1, 838, __pyx_L1_error)
10351
10352 /* "View.MemoryView":837
10353 * negative_step = have_step != 0 and step < 0
10354 *
10355 * if have_step and step == 0: # <<<<<<<<<<<<<<
10356 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
10357 *
10358 */
10359 }
10360
10361 /* "View.MemoryView":841
10362 *
10363 *
10364 * if have_start: # <<<<<<<<<<<<<<
10365 * if start < 0:
10366 * start += shape
10367 */
10368 __pyx_t_2 = (__pyx_v_have_start != 0);
10369 if (__pyx_t_2) {
10370
10371 /* "View.MemoryView":842
10372 *
10373 * if have_start:
10374 * if start < 0: # <<<<<<<<<<<<<<
10375 * start += shape
10376 * if start < 0:
10377 */
10378 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
10379 if (__pyx_t_2) {
10380
10381 /* "View.MemoryView":843
10382 * if have_start:
10383 * if start < 0:
10384 * start += shape # <<<<<<<<<<<<<<
10385 * if start < 0:
10386 * start = 0
10387 */
10388 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
10389
10390 /* "View.MemoryView":844
10391 * if start < 0:
10392 * start += shape
10393 * if start < 0: # <<<<<<<<<<<<<<
10394 * start = 0
10395 * elif start >= shape:
10396 */
10397 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
10398 if (__pyx_t_2) {
10399
10400 /* "View.MemoryView":845
10401 * start += shape
10402 * if start < 0:
10403 * start = 0 # <<<<<<<<<<<<<<
10404 * elif start >= shape:
10405 * if negative_step:
10406 */
10407 __pyx_v_start = 0;
10408
10409 /* "View.MemoryView":844
10410 * if start < 0:
10411 * start += shape
10412 * if start < 0: # <<<<<<<<<<<<<<
10413 * start = 0
10414 * elif start >= shape:
10415 */
10416 }
10417
10418 /* "View.MemoryView":842
10419 *
10420 * if have_start:
10421 * if start < 0: # <<<<<<<<<<<<<<
10422 * start += shape
10423 * if start < 0:
10424 */
10425 goto __pyx_L12;
10426 }
10427
10428 /* "View.MemoryView":846
10429 * if start < 0:
10430 * start = 0
10431 * elif start >= shape: # <<<<<<<<<<<<<<
10432 * if negative_step:
10433 * start = shape - 1
10434 */
10435 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
10436 if (__pyx_t_2) {
10437
10438 /* "View.MemoryView":847
10439 * start = 0
10440 * elif start >= shape:
10441 * if negative_step: # <<<<<<<<<<<<<<
10442 * start = shape - 1
10443 * else:
10444 */
10445 __pyx_t_2 = (__pyx_v_negative_step != 0);
10446 if (__pyx_t_2) {
10447
10448 /* "View.MemoryView":848
10449 * elif start >= shape:
10450 * if negative_step:
10451 * start = shape - 1 # <<<<<<<<<<<<<<
10452 * else:
10453 * start = shape
10454 */
10455 __pyx_v_start = (__pyx_v_shape - 1);
10456
10457 /* "View.MemoryView":847
10458 * start = 0
10459 * elif start >= shape:
10460 * if negative_step: # <<<<<<<<<<<<<<
10461 * start = shape - 1
10462 * else:
10463 */
10464 goto __pyx_L14;
10465 }
10466
10467 /* "View.MemoryView":850
10468 * start = shape - 1
10469 * else:
10470 * start = shape # <<<<<<<<<<<<<<
10471 * else:
10472 * if negative_step:
10473 */
10474 /*else*/ {
10475 __pyx_v_start = __pyx_v_shape;
10476 }
10477 __pyx_L14:;
10478
10479 /* "View.MemoryView":846
10480 * if start < 0:
10481 * start = 0
10482 * elif start >= shape: # <<<<<<<<<<<<<<
10483 * if negative_step:
10484 * start = shape - 1
10485 */
10486 }
10487 __pyx_L12:;
10488
10489 /* "View.MemoryView":841
10490 *
10491 *
10492 * if have_start: # <<<<<<<<<<<<<<
10493 * if start < 0:
10494 * start += shape
10495 */
10496 goto __pyx_L11;
10497 }
10498
10499 /* "View.MemoryView":852
10500 * start = shape
10501 * else:
10502 * if negative_step: # <<<<<<<<<<<<<<
10503 * start = shape - 1
10504 * else:
10505 */
10506 /*else*/ {
10507 __pyx_t_2 = (__pyx_v_negative_step != 0);
10508 if (__pyx_t_2) {
10509
10510 /* "View.MemoryView":853
10511 * else:
10512 * if negative_step:
10513 * start = shape - 1 # <<<<<<<<<<<<<<
10514 * else:
10515 * start = 0
10516 */
10517 __pyx_v_start = (__pyx_v_shape - 1);
10518
10519 /* "View.MemoryView":852
10520 * start = shape
10521 * else:
10522 * if negative_step: # <<<<<<<<<<<<<<
10523 * start = shape - 1
10524 * else:
10525 */
10526 goto __pyx_L15;
10527 }
10528
10529 /* "View.MemoryView":855
10530 * start = shape - 1
10531 * else:
10532 * start = 0 # <<<<<<<<<<<<<<
10533 *
10534 * if have_stop:
10535 */
10536 /*else*/ {
10537 __pyx_v_start = 0;
10538 }
10539 __pyx_L15:;
10540 }
10541 __pyx_L11:;
10542
10543 /* "View.MemoryView":857
10544 * start = 0
10545 *
10546 * if have_stop: # <<<<<<<<<<<<<<
10547 * if stop < 0:
10548 * stop += shape
10549 */
10550 __pyx_t_2 = (__pyx_v_have_stop != 0);
10551 if (__pyx_t_2) {
10552
10553 /* "View.MemoryView":858
10554 *
10555 * if have_stop:
10556 * if stop < 0: # <<<<<<<<<<<<<<
10557 * stop += shape
10558 * if stop < 0:
10559 */
10560 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
10561 if (__pyx_t_2) {
10562
10563 /* "View.MemoryView":859
10564 * if have_stop:
10565 * if stop < 0:
10566 * stop += shape # <<<<<<<<<<<<<<
10567 * if stop < 0:
10568 * stop = 0
10569 */
10570 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
10571
10572 /* "View.MemoryView":860
10573 * if stop < 0:
10574 * stop += shape
10575 * if stop < 0: # <<<<<<<<<<<<<<
10576 * stop = 0
10577 * elif stop > shape:
10578 */
10579 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
10580 if (__pyx_t_2) {
10581
10582 /* "View.MemoryView":861
10583 * stop += shape
10584 * if stop < 0:
10585 * stop = 0 # <<<<<<<<<<<<<<
10586 * elif stop > shape:
10587 * stop = shape
10588 */
10589 __pyx_v_stop = 0;
10590
10591 /* "View.MemoryView":860
10592 * if stop < 0:
10593 * stop += shape
10594 * if stop < 0: # <<<<<<<<<<<<<<
10595 * stop = 0
10596 * elif stop > shape:
10597 */
10598 }
10599
10600 /* "View.MemoryView":858
10601 *
10602 * if have_stop:
10603 * if stop < 0: # <<<<<<<<<<<<<<
10604 * stop += shape
10605 * if stop < 0:
10606 */
10607 goto __pyx_L17;
10608 }
10609
10610 /* "View.MemoryView":862
10611 * if stop < 0:
10612 * stop = 0
10613 * elif stop > shape: # <<<<<<<<<<<<<<
10614 * stop = shape
10615 * else:
10616 */
10617 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
10618 if (__pyx_t_2) {
10619
10620 /* "View.MemoryView":863
10621 * stop = 0
10622 * elif stop > shape:
10623 * stop = shape # <<<<<<<<<<<<<<
10624 * else:
10625 * if negative_step:
10626 */
10627 __pyx_v_stop = __pyx_v_shape;
10628
10629 /* "View.MemoryView":862
10630 * if stop < 0:
10631 * stop = 0
10632 * elif stop > shape: # <<<<<<<<<<<<<<
10633 * stop = shape
10634 * else:
10635 */
10636 }
10637 __pyx_L17:;
10638
10639 /* "View.MemoryView":857
10640 * start = 0
10641 *
10642 * if have_stop: # <<<<<<<<<<<<<<
10643 * if stop < 0:
10644 * stop += shape
10645 */
10646 goto __pyx_L16;
10647 }
10648
10649 /* "View.MemoryView":865
10650 * stop = shape
10651 * else:
10652 * if negative_step: # <<<<<<<<<<<<<<
10653 * stop = -1
10654 * else:
10655 */
10656 /*else*/ {
10657 __pyx_t_2 = (__pyx_v_negative_step != 0);
10658 if (__pyx_t_2) {
10659
10660 /* "View.MemoryView":866
10661 * else:
10662 * if negative_step:
10663 * stop = -1 # <<<<<<<<<<<<<<
10664 * else:
10665 * stop = shape
10666 */
10667 __pyx_v_stop = -1L;
10668
10669 /* "View.MemoryView":865
10670 * stop = shape
10671 * else:
10672 * if negative_step: # <<<<<<<<<<<<<<
10673 * stop = -1
10674 * else:
10675 */
10676 goto __pyx_L19;
10677 }
10678
10679 /* "View.MemoryView":868
10680 * stop = -1
10681 * else:
10682 * stop = shape # <<<<<<<<<<<<<<
10683 *
10684 * if not have_step:
10685 */
10686 /*else*/ {
10687 __pyx_v_stop = __pyx_v_shape;
10688 }
10689 __pyx_L19:;
10690 }
10691 __pyx_L16:;
10692
10693 /* "View.MemoryView":870
10694 * stop = shape
10695 *
10696 * if not have_step: # <<<<<<<<<<<<<<
10697 * step = 1
10698 *
10699 */
10700 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
10701 if (__pyx_t_2) {
10702
10703 /* "View.MemoryView":871
10704 *
10705 * if not have_step:
10706 * step = 1 # <<<<<<<<<<<<<<
10707 *
10708 *
10709 */
10710 __pyx_v_step = 1;
10711
10712 /* "View.MemoryView":870
10713 * stop = shape
10714 *
10715 * if not have_step: # <<<<<<<<<<<<<<
10716 * step = 1
10717 *
10718 */
10719 }
10720
10721 /* "View.MemoryView":875
10722 *
10723 * with cython.cdivision(True):
10724 * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
10725 *
10726 * if (stop - start) - step * new_shape:
10727 */
10728 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
10729
10730 /* "View.MemoryView":877
10731 * new_shape = (stop - start) // step
10732 *
10733 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
10734 * new_shape += 1
10735 *
10736 */
10737 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
10738 if (__pyx_t_2) {
10739
10740 /* "View.MemoryView":878
10741 *
10742 * if (stop - start) - step * new_shape:
10743 * new_shape += 1 # <<<<<<<<<<<<<<
10744 *
10745 * if new_shape < 0:
10746 */
10747 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
10748
10749 /* "View.MemoryView":877
10750 * new_shape = (stop - start) // step
10751 *
10752 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
10753 * new_shape += 1
10754 *
10755 */
10756 }
10757
10758 /* "View.MemoryView":880
10759 * new_shape += 1
10760 *
10761 * if new_shape < 0: # <<<<<<<<<<<<<<
10762 * new_shape = 0
10763 *
10764 */
10765 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
10766 if (__pyx_t_2) {
10767
10768 /* "View.MemoryView":881
10769 *
10770 * if new_shape < 0:
10771 * new_shape = 0 # <<<<<<<<<<<<<<
10772 *
10773 *
10774 */
10775 __pyx_v_new_shape = 0;
10776
10777 /* "View.MemoryView":880
10778 * new_shape += 1
10779 *
10780 * if new_shape < 0: # <<<<<<<<<<<<<<
10781 * new_shape = 0
10782 *
10783 */
10784 }
10785
10786 /* "View.MemoryView":884
10787 *
10788 *
10789 * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
10790 * dst.shape[new_ndim] = new_shape
10791 * dst.suboffsets[new_ndim] = suboffset
10792 */
10793 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
10794
10795 /* "View.MemoryView":885
10796 *
10797 * dst.strides[new_ndim] = stride * step
10798 * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
10799 * dst.suboffsets[new_ndim] = suboffset
10800 *
10801 */
10802 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
10803
10804 /* "View.MemoryView":886
10805 * dst.strides[new_ndim] = stride * step
10806 * dst.shape[new_ndim] = new_shape
10807 * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
10808 *
10809 *
10810 */
10811 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
10812 }
10813 __pyx_L3:;
10814
10815 /* "View.MemoryView":889
10816 *
10817 *
10818 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
10819 * dst.data += start * stride
10820 * else:
10821 */
10822 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
10823 if (__pyx_t_2) {
10824
10825 /* "View.MemoryView":890
10826 *
10827 * if suboffset_dim[0] < 0:
10828 * dst.data += start * stride # <<<<<<<<<<<<<<
10829 * else:
10830 * dst.suboffsets[suboffset_dim[0]] += start * stride
10831 */
10832 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
10833
10834 /* "View.MemoryView":889
10835 *
10836 *
10837 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
10838 * dst.data += start * stride
10839 * else:
10840 */
10841 goto __pyx_L23;
10842 }
10843
10844 /* "View.MemoryView":892
10845 * dst.data += start * stride
10846 * else:
10847 * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
10848 *
10849 * if suboffset >= 0:
10850 */
10851 /*else*/ {
10852 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
10853 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
10854 }
10855 __pyx_L23:;
10856
10857 /* "View.MemoryView":894
10858 * dst.suboffsets[suboffset_dim[0]] += start * stride
10859 *
10860 * if suboffset >= 0: # <<<<<<<<<<<<<<
10861 * if not is_slice:
10862 * if new_ndim == 0:
10863 */
10864 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
10865 if (__pyx_t_2) {
10866
10867 /* "View.MemoryView":895
10868 *
10869 * if suboffset >= 0:
10870 * if not is_slice: # <<<<<<<<<<<<<<
10871 * if new_ndim == 0:
10872 * dst.data = (<char **> dst.data)[0] + suboffset
10873 */
10874 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
10875 if (__pyx_t_2) {
10876
10877 /* "View.MemoryView":896
10878 * if suboffset >= 0:
10879 * if not is_slice:
10880 * if new_ndim == 0: # <<<<<<<<<<<<<<
10881 * dst.data = (<char **> dst.data)[0] + suboffset
10882 * else:
10883 */
10884 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
10885 if (__pyx_t_2) {
10886
10887 /* "View.MemoryView":897
10888 * if not is_slice:
10889 * if new_ndim == 0:
10890 * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
10891 * else:
10892 * _err_dim(IndexError, "All dimensions preceding dimension %d "
10893 */
10894 __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
10895
10896 /* "View.MemoryView":896
10897 * if suboffset >= 0:
10898 * if not is_slice:
10899 * if new_ndim == 0: # <<<<<<<<<<<<<<
10900 * dst.data = (<char **> dst.data)[0] + suboffset
10901 * else:
10902 */
10903 goto __pyx_L26;
10904 }
10905
10906 /* "View.MemoryView":899
10907 * dst.data = (<char **> dst.data)[0] + suboffset
10908 * else:
10909 * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
10910 * "must be indexed and not sliced", dim)
10911 * else:
10912 */
10913 /*else*/ {
10914
10915 /* "View.MemoryView":900
10916 * else:
10917 * _err_dim(IndexError, "All dimensions preceding dimension %d "
10918 * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
10919 * else:
10920 * suboffset_dim[0] = new_ndim
10921 */
10922 __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(1, 899, __pyx_L1_error)
10923 }
10924 __pyx_L26:;
10925
10926 /* "View.MemoryView":895
10927 *
10928 * if suboffset >= 0:
10929 * if not is_slice: # <<<<<<<<<<<<<<
10930 * if new_ndim == 0:
10931 * dst.data = (<char **> dst.data)[0] + suboffset
10932 */
10933 goto __pyx_L25;
10934 }
10935
10936 /* "View.MemoryView":902
10937 * "must be indexed and not sliced", dim)
10938 * else:
10939 * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
10940 *
10941 * return 0
10942 */
10943 /*else*/ {
10944 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
10945 }
10946 __pyx_L25:;
10947
10948 /* "View.MemoryView":894
10949 * dst.suboffsets[suboffset_dim[0]] += start * stride
10950 *
10951 * if suboffset >= 0: # <<<<<<<<<<<<<<
10952 * if not is_slice:
10953 * if new_ndim == 0:
10954 */
10955 }
10956
10957 /* "View.MemoryView":904
10958 * suboffset_dim[0] = new_ndim
10959 *
10960 * return 0 # <<<<<<<<<<<<<<
10961 *
10962 *
10963 */
10964 __pyx_r = 0;
10965 goto __pyx_L0;
10966
10967 /* "View.MemoryView":807
10968 *
10969 * @cname('__pyx_memoryview_slice_memviewslice')
10970 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
10971 * __Pyx_memviewslice *dst,
10972 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
10973 */
10974
10975 /* function exit code */
10976 __pyx_L1_error:;
10977 {
10978 #ifdef WITH_THREAD
10979 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
10980 #endif
10981 __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10982 #ifdef WITH_THREAD
10983 __Pyx_PyGILState_Release(__pyx_gilstate_save);
10984 #endif
10985 }
10986 __pyx_r = -1;
10987 __pyx_L0:;
10988 return __pyx_r;
10989 }
10990
10991 /* "View.MemoryView":910
10992 *
10993 * @cname('__pyx_pybuffer_index')
10994 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
10995 * Py_ssize_t dim) except NULL:
10996 * cdef Py_ssize_t shape, stride, suboffset = -1
10997 */
10998
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)10999 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) {
11000 Py_ssize_t __pyx_v_shape;
11001 Py_ssize_t __pyx_v_stride;
11002 Py_ssize_t __pyx_v_suboffset;
11003 Py_ssize_t __pyx_v_itemsize;
11004 char *__pyx_v_resultp;
11005 char *__pyx_r;
11006 __Pyx_RefNannyDeclarations
11007 Py_ssize_t __pyx_t_1;
11008 int __pyx_t_2;
11009 PyObject *__pyx_t_3 = NULL;
11010 PyObject *__pyx_t_4 = NULL;
11011 int __pyx_lineno = 0;
11012 const char *__pyx_filename = NULL;
11013 int __pyx_clineno = 0;
11014 __Pyx_RefNannySetupContext("pybuffer_index", 0);
11015
11016 /* "View.MemoryView":912
11017 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
11018 * Py_ssize_t dim) except NULL:
11019 * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
11020 * cdef Py_ssize_t itemsize = view.itemsize
11021 * cdef char *resultp
11022 */
11023 __pyx_v_suboffset = -1L;
11024
11025 /* "View.MemoryView":913
11026 * Py_ssize_t dim) except NULL:
11027 * cdef Py_ssize_t shape, stride, suboffset = -1
11028 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
11029 * cdef char *resultp
11030 *
11031 */
11032 __pyx_t_1 = __pyx_v_view->itemsize;
11033 __pyx_v_itemsize = __pyx_t_1;
11034
11035 /* "View.MemoryView":916
11036 * cdef char *resultp
11037 *
11038 * if view.ndim == 0: # <<<<<<<<<<<<<<
11039 * shape = view.len / itemsize
11040 * stride = itemsize
11041 */
11042 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
11043 if (__pyx_t_2) {
11044
11045 /* "View.MemoryView":917
11046 *
11047 * if view.ndim == 0:
11048 * shape = view.len / itemsize # <<<<<<<<<<<<<<
11049 * stride = itemsize
11050 * else:
11051 */
11052 if (unlikely(__pyx_v_itemsize == 0)) {
11053 PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
11054 __PYX_ERR(1, 917, __pyx_L1_error)
11055 }
11056 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))) {
11057 PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
11058 __PYX_ERR(1, 917, __pyx_L1_error)
11059 }
11060 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
11061
11062 /* "View.MemoryView":918
11063 * if view.ndim == 0:
11064 * shape = view.len / itemsize
11065 * stride = itemsize # <<<<<<<<<<<<<<
11066 * else:
11067 * shape = view.shape[dim]
11068 */
11069 __pyx_v_stride = __pyx_v_itemsize;
11070
11071 /* "View.MemoryView":916
11072 * cdef char *resultp
11073 *
11074 * if view.ndim == 0: # <<<<<<<<<<<<<<
11075 * shape = view.len / itemsize
11076 * stride = itemsize
11077 */
11078 goto __pyx_L3;
11079 }
11080
11081 /* "View.MemoryView":920
11082 * stride = itemsize
11083 * else:
11084 * shape = view.shape[dim] # <<<<<<<<<<<<<<
11085 * stride = view.strides[dim]
11086 * if view.suboffsets != NULL:
11087 */
11088 /*else*/ {
11089 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
11090
11091 /* "View.MemoryView":921
11092 * else:
11093 * shape = view.shape[dim]
11094 * stride = view.strides[dim] # <<<<<<<<<<<<<<
11095 * if view.suboffsets != NULL:
11096 * suboffset = view.suboffsets[dim]
11097 */
11098 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
11099
11100 /* "View.MemoryView":922
11101 * shape = view.shape[dim]
11102 * stride = view.strides[dim]
11103 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
11104 * suboffset = view.suboffsets[dim]
11105 *
11106 */
11107 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
11108 if (__pyx_t_2) {
11109
11110 /* "View.MemoryView":923
11111 * stride = view.strides[dim]
11112 * if view.suboffsets != NULL:
11113 * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
11114 *
11115 * if index < 0:
11116 */
11117 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
11118
11119 /* "View.MemoryView":922
11120 * shape = view.shape[dim]
11121 * stride = view.strides[dim]
11122 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
11123 * suboffset = view.suboffsets[dim]
11124 *
11125 */
11126 }
11127 }
11128 __pyx_L3:;
11129
11130 /* "View.MemoryView":925
11131 * suboffset = view.suboffsets[dim]
11132 *
11133 * if index < 0: # <<<<<<<<<<<<<<
11134 * index += view.shape[dim]
11135 * if index < 0:
11136 */
11137 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
11138 if (__pyx_t_2) {
11139
11140 /* "View.MemoryView":926
11141 *
11142 * if index < 0:
11143 * index += view.shape[dim] # <<<<<<<<<<<<<<
11144 * if index < 0:
11145 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11146 */
11147 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
11148
11149 /* "View.MemoryView":927
11150 * if index < 0:
11151 * index += view.shape[dim]
11152 * if index < 0: # <<<<<<<<<<<<<<
11153 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11154 *
11155 */
11156 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
11157 if (unlikely(__pyx_t_2)) {
11158
11159 /* "View.MemoryView":928
11160 * index += view.shape[dim]
11161 * if index < 0:
11162 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
11163 *
11164 * if index >= shape:
11165 */
11166 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
11167 __Pyx_GOTREF(__pyx_t_3);
11168 __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(1, 928, __pyx_L1_error)
11169 __Pyx_GOTREF(__pyx_t_4);
11170 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11171 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
11172 __Pyx_GOTREF(__pyx_t_3);
11173 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11174 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11175 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11176 __PYX_ERR(1, 928, __pyx_L1_error)
11177
11178 /* "View.MemoryView":927
11179 * if index < 0:
11180 * index += view.shape[dim]
11181 * if index < 0: # <<<<<<<<<<<<<<
11182 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11183 *
11184 */
11185 }
11186
11187 /* "View.MemoryView":925
11188 * suboffset = view.suboffsets[dim]
11189 *
11190 * if index < 0: # <<<<<<<<<<<<<<
11191 * index += view.shape[dim]
11192 * if index < 0:
11193 */
11194 }
11195
11196 /* "View.MemoryView":930
11197 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11198 *
11199 * if index >= shape: # <<<<<<<<<<<<<<
11200 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11201 *
11202 */
11203 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
11204 if (unlikely(__pyx_t_2)) {
11205
11206 /* "View.MemoryView":931
11207 *
11208 * if index >= shape:
11209 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
11210 *
11211 * resultp = bufp + index * stride
11212 */
11213 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
11214 __Pyx_GOTREF(__pyx_t_3);
11215 __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(1, 931, __pyx_L1_error)
11216 __Pyx_GOTREF(__pyx_t_4);
11217 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11218 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
11219 __Pyx_GOTREF(__pyx_t_3);
11220 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11221 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11222 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11223 __PYX_ERR(1, 931, __pyx_L1_error)
11224
11225 /* "View.MemoryView":930
11226 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11227 *
11228 * if index >= shape: # <<<<<<<<<<<<<<
11229 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11230 *
11231 */
11232 }
11233
11234 /* "View.MemoryView":933
11235 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
11236 *
11237 * resultp = bufp + index * stride # <<<<<<<<<<<<<<
11238 * if suboffset >= 0:
11239 * resultp = (<char **> resultp)[0] + suboffset
11240 */
11241 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
11242
11243 /* "View.MemoryView":934
11244 *
11245 * resultp = bufp + index * stride
11246 * if suboffset >= 0: # <<<<<<<<<<<<<<
11247 * resultp = (<char **> resultp)[0] + suboffset
11248 *
11249 */
11250 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
11251 if (__pyx_t_2) {
11252
11253 /* "View.MemoryView":935
11254 * resultp = bufp + index * stride
11255 * if suboffset >= 0:
11256 * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
11257 *
11258 * return resultp
11259 */
11260 __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
11261
11262 /* "View.MemoryView":934
11263 *
11264 * resultp = bufp + index * stride
11265 * if suboffset >= 0: # <<<<<<<<<<<<<<
11266 * resultp = (<char **> resultp)[0] + suboffset
11267 *
11268 */
11269 }
11270
11271 /* "View.MemoryView":937
11272 * resultp = (<char **> resultp)[0] + suboffset
11273 *
11274 * return resultp # <<<<<<<<<<<<<<
11275 *
11276 *
11277 */
11278 __pyx_r = __pyx_v_resultp;
11279 goto __pyx_L0;
11280
11281 /* "View.MemoryView":910
11282 *
11283 * @cname('__pyx_pybuffer_index')
11284 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
11285 * Py_ssize_t dim) except NULL:
11286 * cdef Py_ssize_t shape, stride, suboffset = -1
11287 */
11288
11289 /* function exit code */
11290 __pyx_L1_error:;
11291 __Pyx_XDECREF(__pyx_t_3);
11292 __Pyx_XDECREF(__pyx_t_4);
11293 __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
11294 __pyx_r = NULL;
11295 __pyx_L0:;
11296 __Pyx_RefNannyFinishContext();
11297 return __pyx_r;
11298 }
11299
11300 /* "View.MemoryView":943
11301 *
11302 * @cname('__pyx_memslice_transpose')
11303 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
11304 * cdef int ndim = memslice.memview.view.ndim
11305 *
11306 */
11307
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)11308 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
11309 int __pyx_v_ndim;
11310 Py_ssize_t *__pyx_v_shape;
11311 Py_ssize_t *__pyx_v_strides;
11312 int __pyx_v_i;
11313 int __pyx_v_j;
11314 int __pyx_r;
11315 int __pyx_t_1;
11316 Py_ssize_t *__pyx_t_2;
11317 long __pyx_t_3;
11318 long __pyx_t_4;
11319 Py_ssize_t __pyx_t_5;
11320 Py_ssize_t __pyx_t_6;
11321 int __pyx_t_7;
11322 int __pyx_t_8;
11323 int __pyx_t_9;
11324 int __pyx_lineno = 0;
11325 const char *__pyx_filename = NULL;
11326 int __pyx_clineno = 0;
11327
11328 /* "View.MemoryView":944
11329 * @cname('__pyx_memslice_transpose')
11330 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
11331 * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
11332 *
11333 * cdef Py_ssize_t *shape = memslice.shape
11334 */
11335 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
11336 __pyx_v_ndim = __pyx_t_1;
11337
11338 /* "View.MemoryView":946
11339 * cdef int ndim = memslice.memview.view.ndim
11340 *
11341 * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
11342 * cdef Py_ssize_t *strides = memslice.strides
11343 *
11344 */
11345 __pyx_t_2 = __pyx_v_memslice->shape;
11346 __pyx_v_shape = __pyx_t_2;
11347
11348 /* "View.MemoryView":947
11349 *
11350 * cdef Py_ssize_t *shape = memslice.shape
11351 * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
11352 *
11353 *
11354 */
11355 __pyx_t_2 = __pyx_v_memslice->strides;
11356 __pyx_v_strides = __pyx_t_2;
11357
11358 /* "View.MemoryView":951
11359 *
11360 * cdef int i, j
11361 * for i in range(ndim / 2): # <<<<<<<<<<<<<<
11362 * j = ndim - 1 - i
11363 * strides[i], strides[j] = strides[j], strides[i]
11364 */
11365 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
11366 __pyx_t_4 = __pyx_t_3;
11367 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
11368 __pyx_v_i = __pyx_t_1;
11369
11370 /* "View.MemoryView":952
11371 * cdef int i, j
11372 * for i in range(ndim / 2):
11373 * j = ndim - 1 - i # <<<<<<<<<<<<<<
11374 * strides[i], strides[j] = strides[j], strides[i]
11375 * shape[i], shape[j] = shape[j], shape[i]
11376 */
11377 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
11378
11379 /* "View.MemoryView":953
11380 * for i in range(ndim / 2):
11381 * j = ndim - 1 - i
11382 * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
11383 * shape[i], shape[j] = shape[j], shape[i]
11384 *
11385 */
11386 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
11387 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
11388 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
11389 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
11390
11391 /* "View.MemoryView":954
11392 * j = ndim - 1 - i
11393 * strides[i], strides[j] = strides[j], strides[i]
11394 * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
11395 *
11396 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
11397 */
11398 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
11399 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
11400 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
11401 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
11402
11403 /* "View.MemoryView":956
11404 * shape[i], shape[j] = shape[j], shape[i]
11405 *
11406 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
11407 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
11408 *
11409 */
11410 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
11411 if (!__pyx_t_8) {
11412 } else {
11413 __pyx_t_7 = __pyx_t_8;
11414 goto __pyx_L6_bool_binop_done;
11415 }
11416 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
11417 __pyx_t_7 = __pyx_t_8;
11418 __pyx_L6_bool_binop_done:;
11419 if (__pyx_t_7) {
11420
11421 /* "View.MemoryView":957
11422 *
11423 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
11424 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
11425 *
11426 * return 1
11427 */
11428 __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(1, 957, __pyx_L1_error)
11429
11430 /* "View.MemoryView":956
11431 * shape[i], shape[j] = shape[j], shape[i]
11432 *
11433 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
11434 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
11435 *
11436 */
11437 }
11438 }
11439
11440 /* "View.MemoryView":959
11441 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
11442 *
11443 * return 1 # <<<<<<<<<<<<<<
11444 *
11445 *
11446 */
11447 __pyx_r = 1;
11448 goto __pyx_L0;
11449
11450 /* "View.MemoryView":943
11451 *
11452 * @cname('__pyx_memslice_transpose')
11453 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
11454 * cdef int ndim = memslice.memview.view.ndim
11455 *
11456 */
11457
11458 /* function exit code */
11459 __pyx_L1_error:;
11460 {
11461 #ifdef WITH_THREAD
11462 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
11463 #endif
11464 __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11465 #ifdef WITH_THREAD
11466 __Pyx_PyGILState_Release(__pyx_gilstate_save);
11467 #endif
11468 }
11469 __pyx_r = 0;
11470 __pyx_L0:;
11471 return __pyx_r;
11472 }
11473
11474 /* "View.MemoryView":976
11475 * cdef int (*to_dtype_func)(char *, object) except 0
11476 *
11477 * def __dealloc__(self): # <<<<<<<<<<<<<<
11478 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
11479 *
11480 */
11481
11482 /* Python wrapper */
11483 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)11484 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
11485 __Pyx_RefNannyDeclarations
11486 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
11487 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
11488
11489 /* function exit code */
11490 __Pyx_RefNannyFinishContext();
11491 }
11492
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)11493 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
11494 __Pyx_RefNannyDeclarations
11495 __Pyx_RefNannySetupContext("__dealloc__", 0);
11496
11497 /* "View.MemoryView":977
11498 *
11499 * def __dealloc__(self):
11500 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
11501 *
11502 * cdef convert_item_to_object(self, char *itemp):
11503 */
11504 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
11505
11506 /* "View.MemoryView":976
11507 * cdef int (*to_dtype_func)(char *, object) except 0
11508 *
11509 * def __dealloc__(self): # <<<<<<<<<<<<<<
11510 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
11511 *
11512 */
11513
11514 /* function exit code */
11515 __Pyx_RefNannyFinishContext();
11516 }
11517
11518 /* "View.MemoryView":979
11519 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
11520 *
11521 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
11522 * if self.to_object_func != NULL:
11523 * return self.to_object_func(itemp)
11524 */
11525
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)11526 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
11527 PyObject *__pyx_r = NULL;
11528 __Pyx_RefNannyDeclarations
11529 int __pyx_t_1;
11530 PyObject *__pyx_t_2 = NULL;
11531 int __pyx_lineno = 0;
11532 const char *__pyx_filename = NULL;
11533 int __pyx_clineno = 0;
11534 __Pyx_RefNannySetupContext("convert_item_to_object", 0);
11535
11536 /* "View.MemoryView":980
11537 *
11538 * cdef convert_item_to_object(self, char *itemp):
11539 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
11540 * return self.to_object_func(itemp)
11541 * else:
11542 */
11543 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
11544 if (__pyx_t_1) {
11545
11546 /* "View.MemoryView":981
11547 * cdef convert_item_to_object(self, char *itemp):
11548 * if self.to_object_func != NULL:
11549 * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
11550 * else:
11551 * return memoryview.convert_item_to_object(self, itemp)
11552 */
11553 __Pyx_XDECREF(__pyx_r);
11554 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
11555 __Pyx_GOTREF(__pyx_t_2);
11556 __pyx_r = __pyx_t_2;
11557 __pyx_t_2 = 0;
11558 goto __pyx_L0;
11559
11560 /* "View.MemoryView":980
11561 *
11562 * cdef convert_item_to_object(self, char *itemp):
11563 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
11564 * return self.to_object_func(itemp)
11565 * else:
11566 */
11567 }
11568
11569 /* "View.MemoryView":983
11570 * return self.to_object_func(itemp)
11571 * else:
11572 * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
11573 *
11574 * cdef assign_item_from_object(self, char *itemp, object value):
11575 */
11576 /*else*/ {
11577 __Pyx_XDECREF(__pyx_r);
11578 __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(1, 983, __pyx_L1_error)
11579 __Pyx_GOTREF(__pyx_t_2);
11580 __pyx_r = __pyx_t_2;
11581 __pyx_t_2 = 0;
11582 goto __pyx_L0;
11583 }
11584
11585 /* "View.MemoryView":979
11586 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
11587 *
11588 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
11589 * if self.to_object_func != NULL:
11590 * return self.to_object_func(itemp)
11591 */
11592
11593 /* function exit code */
11594 __pyx_L1_error:;
11595 __Pyx_XDECREF(__pyx_t_2);
11596 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11597 __pyx_r = 0;
11598 __pyx_L0:;
11599 __Pyx_XGIVEREF(__pyx_r);
11600 __Pyx_RefNannyFinishContext();
11601 return __pyx_r;
11602 }
11603
11604 /* "View.MemoryView":985
11605 * return memoryview.convert_item_to_object(self, itemp)
11606 *
11607 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
11608 * if self.to_dtype_func != NULL:
11609 * self.to_dtype_func(itemp, value)
11610 */
11611
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)11612 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11613 PyObject *__pyx_r = NULL;
11614 __Pyx_RefNannyDeclarations
11615 int __pyx_t_1;
11616 int __pyx_t_2;
11617 PyObject *__pyx_t_3 = NULL;
11618 int __pyx_lineno = 0;
11619 const char *__pyx_filename = NULL;
11620 int __pyx_clineno = 0;
11621 __Pyx_RefNannySetupContext("assign_item_from_object", 0);
11622
11623 /* "View.MemoryView":986
11624 *
11625 * cdef assign_item_from_object(self, char *itemp, object value):
11626 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
11627 * self.to_dtype_func(itemp, value)
11628 * else:
11629 */
11630 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
11631 if (__pyx_t_1) {
11632
11633 /* "View.MemoryView":987
11634 * cdef assign_item_from_object(self, char *itemp, object value):
11635 * if self.to_dtype_func != NULL:
11636 * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
11637 * else:
11638 * memoryview.assign_item_from_object(self, itemp, value)
11639 */
11640 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
11641
11642 /* "View.MemoryView":986
11643 *
11644 * cdef assign_item_from_object(self, char *itemp, object value):
11645 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
11646 * self.to_dtype_func(itemp, value)
11647 * else:
11648 */
11649 goto __pyx_L3;
11650 }
11651
11652 /* "View.MemoryView":989
11653 * self.to_dtype_func(itemp, value)
11654 * else:
11655 * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
11656 *
11657 * @property
11658 */
11659 /*else*/ {
11660 __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(1, 989, __pyx_L1_error)
11661 __Pyx_GOTREF(__pyx_t_3);
11662 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11663 }
11664 __pyx_L3:;
11665
11666 /* "View.MemoryView":985
11667 * return memoryview.convert_item_to_object(self, itemp)
11668 *
11669 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
11670 * if self.to_dtype_func != NULL:
11671 * self.to_dtype_func(itemp, value)
11672 */
11673
11674 /* function exit code */
11675 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11676 goto __pyx_L0;
11677 __pyx_L1_error:;
11678 __Pyx_XDECREF(__pyx_t_3);
11679 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11680 __pyx_r = 0;
11681 __pyx_L0:;
11682 __Pyx_XGIVEREF(__pyx_r);
11683 __Pyx_RefNannyFinishContext();
11684 return __pyx_r;
11685 }
11686
11687 /* "View.MemoryView":992
11688 *
11689 * @property
11690 * def base(self): # <<<<<<<<<<<<<<
11691 * return self.from_object
11692 *
11693 */
11694
11695 /* Python wrapper */
11696 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)11697 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
11698 PyObject *__pyx_r = 0;
11699 __Pyx_RefNannyDeclarations
11700 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11701 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
11702
11703 /* function exit code */
11704 __Pyx_RefNannyFinishContext();
11705 return __pyx_r;
11706 }
11707
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)11708 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
11709 PyObject *__pyx_r = NULL;
11710 __Pyx_RefNannyDeclarations
11711 __Pyx_RefNannySetupContext("__get__", 0);
11712
11713 /* "View.MemoryView":993
11714 * @property
11715 * def base(self):
11716 * return self.from_object # <<<<<<<<<<<<<<
11717 *
11718 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
11719 */
11720 __Pyx_XDECREF(__pyx_r);
11721 __Pyx_INCREF(__pyx_v_self->from_object);
11722 __pyx_r = __pyx_v_self->from_object;
11723 goto __pyx_L0;
11724
11725 /* "View.MemoryView":992
11726 *
11727 * @property
11728 * def base(self): # <<<<<<<<<<<<<<
11729 * return self.from_object
11730 *
11731 */
11732
11733 /* function exit code */
11734 __pyx_L0:;
11735 __Pyx_XGIVEREF(__pyx_r);
11736 __Pyx_RefNannyFinishContext();
11737 return __pyx_r;
11738 }
11739
11740 /* "(tree fragment)":1
11741 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11742 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11743 * def __setstate_cython__(self, __pyx_state):
11744 */
11745
11746 /* Python wrapper */
11747 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)11748 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11749 PyObject *__pyx_r = 0;
11750 __Pyx_RefNannyDeclarations
11751 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11752 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
11753
11754 /* function exit code */
11755 __Pyx_RefNannyFinishContext();
11756 return __pyx_r;
11757 }
11758
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)11759 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
11760 PyObject *__pyx_r = NULL;
11761 __Pyx_RefNannyDeclarations
11762 PyObject *__pyx_t_1 = NULL;
11763 int __pyx_lineno = 0;
11764 const char *__pyx_filename = NULL;
11765 int __pyx_clineno = 0;
11766 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11767
11768 /* "(tree fragment)":2
11769 * def __reduce_cython__(self):
11770 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11771 * def __setstate_cython__(self, __pyx_state):
11772 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11773 */
11774 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
11775 __Pyx_GOTREF(__pyx_t_1);
11776 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11778 __PYX_ERR(1, 2, __pyx_L1_error)
11779
11780 /* "(tree fragment)":1
11781 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11782 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11783 * def __setstate_cython__(self, __pyx_state):
11784 */
11785
11786 /* function exit code */
11787 __pyx_L1_error:;
11788 __Pyx_XDECREF(__pyx_t_1);
11789 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11790 __pyx_r = NULL;
11791 __Pyx_XGIVEREF(__pyx_r);
11792 __Pyx_RefNannyFinishContext();
11793 return __pyx_r;
11794 }
11795
11796 /* "(tree fragment)":3
11797 * def __reduce_cython__(self):
11798 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11799 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11800 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11801 */
11802
11803 /* Python wrapper */
11804 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)11805 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11806 PyObject *__pyx_r = 0;
11807 __Pyx_RefNannyDeclarations
11808 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11809 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11810
11811 /* function exit code */
11812 __Pyx_RefNannyFinishContext();
11813 return __pyx_r;
11814 }
11815
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)11816 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) {
11817 PyObject *__pyx_r = NULL;
11818 __Pyx_RefNannyDeclarations
11819 PyObject *__pyx_t_1 = NULL;
11820 int __pyx_lineno = 0;
11821 const char *__pyx_filename = NULL;
11822 int __pyx_clineno = 0;
11823 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11824
11825 /* "(tree fragment)":4
11826 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11827 * def __setstate_cython__(self, __pyx_state):
11828 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11829 */
11830 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
11831 __Pyx_GOTREF(__pyx_t_1);
11832 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11833 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11834 __PYX_ERR(1, 4, __pyx_L1_error)
11835
11836 /* "(tree fragment)":3
11837 * def __reduce_cython__(self):
11838 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11839 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11840 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11841 */
11842
11843 /* function exit code */
11844 __pyx_L1_error:;
11845 __Pyx_XDECREF(__pyx_t_1);
11846 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11847 __pyx_r = NULL;
11848 __Pyx_XGIVEREF(__pyx_r);
11849 __Pyx_RefNannyFinishContext();
11850 return __pyx_r;
11851 }
11852
11853 /* "View.MemoryView":999
11854 *
11855 * @cname('__pyx_memoryview_fromslice')
11856 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
11857 * int ndim,
11858 * object (*to_object_func)(char *),
11859 */
11860
__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)11861 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) {
11862 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
11863 Py_ssize_t __pyx_v_suboffset;
11864 PyObject *__pyx_v_length = NULL;
11865 PyObject *__pyx_r = NULL;
11866 __Pyx_RefNannyDeclarations
11867 int __pyx_t_1;
11868 PyObject *__pyx_t_2 = NULL;
11869 PyObject *__pyx_t_3 = NULL;
11870 __Pyx_TypeInfo *__pyx_t_4;
11871 Py_buffer __pyx_t_5;
11872 Py_ssize_t *__pyx_t_6;
11873 Py_ssize_t *__pyx_t_7;
11874 Py_ssize_t *__pyx_t_8;
11875 Py_ssize_t __pyx_t_9;
11876 int __pyx_lineno = 0;
11877 const char *__pyx_filename = NULL;
11878 int __pyx_clineno = 0;
11879 __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
11880
11881 /* "View.MemoryView":1007
11882 * cdef _memoryviewslice result
11883 *
11884 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
11885 * return None
11886 *
11887 */
11888 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
11889 if (__pyx_t_1) {
11890
11891 /* "View.MemoryView":1008
11892 *
11893 * if <PyObject *> memviewslice.memview == Py_None:
11894 * return None # <<<<<<<<<<<<<<
11895 *
11896 *
11897 */
11898 __Pyx_XDECREF(__pyx_r);
11899 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11900 goto __pyx_L0;
11901
11902 /* "View.MemoryView":1007
11903 * cdef _memoryviewslice result
11904 *
11905 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
11906 * return None
11907 *
11908 */
11909 }
11910
11911 /* "View.MemoryView":1013
11912 *
11913 *
11914 * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
11915 *
11916 * result.from_slice = memviewslice
11917 */
11918 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
11919 __Pyx_GOTREF(__pyx_t_2);
11920 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
11921 __Pyx_GOTREF(__pyx_t_3);
11922 __Pyx_INCREF(Py_None);
11923 __Pyx_GIVEREF(Py_None);
11924 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
11925 __Pyx_INCREF(__pyx_int_0);
11926 __Pyx_GIVEREF(__pyx_int_0);
11927 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
11928 __Pyx_GIVEREF(__pyx_t_2);
11929 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11930 __pyx_t_2 = 0;
11931 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
11932 __Pyx_GOTREF(__pyx_t_2);
11933 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11934 __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
11935 __pyx_t_2 = 0;
11936
11937 /* "View.MemoryView":1015
11938 * result = _memoryviewslice(None, 0, dtype_is_object)
11939 *
11940 * result.from_slice = memviewslice # <<<<<<<<<<<<<<
11941 * __PYX_INC_MEMVIEW(&memviewslice, 1)
11942 *
11943 */
11944 __pyx_v_result->from_slice = __pyx_v_memviewslice;
11945
11946 /* "View.MemoryView":1016
11947 *
11948 * result.from_slice = memviewslice
11949 * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
11950 *
11951 * result.from_object = (<memoryview> memviewslice.memview).base
11952 */
11953 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
11954
11955 /* "View.MemoryView":1018
11956 * __PYX_INC_MEMVIEW(&memviewslice, 1)
11957 *
11958 * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
11959 * result.typeinfo = memviewslice.memview.typeinfo
11960 *
11961 */
11962 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
11963 __Pyx_GOTREF(__pyx_t_2);
11964 __Pyx_GIVEREF(__pyx_t_2);
11965 __Pyx_GOTREF(__pyx_v_result->from_object);
11966 __Pyx_DECREF(__pyx_v_result->from_object);
11967 __pyx_v_result->from_object = __pyx_t_2;
11968 __pyx_t_2 = 0;
11969
11970 /* "View.MemoryView":1019
11971 *
11972 * result.from_object = (<memoryview> memviewslice.memview).base
11973 * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
11974 *
11975 * result.view = memviewslice.memview.view
11976 */
11977 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
11978 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
11979
11980 /* "View.MemoryView":1021
11981 * result.typeinfo = memviewslice.memview.typeinfo
11982 *
11983 * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
11984 * result.view.buf = <void *> memviewslice.data
11985 * result.view.ndim = ndim
11986 */
11987 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
11988 __pyx_v_result->__pyx_base.view = __pyx_t_5;
11989
11990 /* "View.MemoryView":1022
11991 *
11992 * result.view = memviewslice.memview.view
11993 * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
11994 * result.view.ndim = ndim
11995 * (<__pyx_buffer *> &result.view).obj = Py_None
11996 */
11997 __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
11998
11999 /* "View.MemoryView":1023
12000 * result.view = memviewslice.memview.view
12001 * result.view.buf = <void *> memviewslice.data
12002 * result.view.ndim = ndim # <<<<<<<<<<<<<<
12003 * (<__pyx_buffer *> &result.view).obj = Py_None
12004 * Py_INCREF(Py_None)
12005 */
12006 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
12007
12008 /* "View.MemoryView":1024
12009 * result.view.buf = <void *> memviewslice.data
12010 * result.view.ndim = ndim
12011 * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
12012 * Py_INCREF(Py_None)
12013 *
12014 */
12015 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
12016
12017 /* "View.MemoryView":1025
12018 * result.view.ndim = ndim
12019 * (<__pyx_buffer *> &result.view).obj = Py_None
12020 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
12021 *
12022 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
12023 */
12024 Py_INCREF(Py_None);
12025
12026 /* "View.MemoryView":1027
12027 * Py_INCREF(Py_None)
12028 *
12029 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
12030 * result.flags = PyBUF_RECORDS
12031 * else:
12032 */
12033 __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
12034 if (__pyx_t_1) {
12035
12036 /* "View.MemoryView":1028
12037 *
12038 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
12039 * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
12040 * else:
12041 * result.flags = PyBUF_RECORDS_RO
12042 */
12043 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
12044
12045 /* "View.MemoryView":1027
12046 * Py_INCREF(Py_None)
12047 *
12048 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
12049 * result.flags = PyBUF_RECORDS
12050 * else:
12051 */
12052 goto __pyx_L4;
12053 }
12054
12055 /* "View.MemoryView":1030
12056 * result.flags = PyBUF_RECORDS
12057 * else:
12058 * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
12059 *
12060 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
12061 */
12062 /*else*/ {
12063 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
12064 }
12065 __pyx_L4:;
12066
12067 /* "View.MemoryView":1032
12068 * result.flags = PyBUF_RECORDS_RO
12069 *
12070 * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
12071 * result.view.strides = <Py_ssize_t *> result.from_slice.strides
12072 *
12073 */
12074 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
12075
12076 /* "View.MemoryView":1033
12077 *
12078 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
12079 * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
12080 *
12081 *
12082 */
12083 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
12084
12085 /* "View.MemoryView":1036
12086 *
12087 *
12088 * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
12089 * for suboffset in result.from_slice.suboffsets[:ndim]:
12090 * if suboffset >= 0:
12091 */
12092 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
12093
12094 /* "View.MemoryView":1037
12095 *
12096 * result.view.suboffsets = NULL
12097 * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
12098 * if suboffset >= 0:
12099 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
12100 */
12101 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
12102 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
12103 __pyx_t_6 = __pyx_t_8;
12104 __pyx_v_suboffset = (__pyx_t_6[0]);
12105
12106 /* "View.MemoryView":1038
12107 * result.view.suboffsets = NULL
12108 * for suboffset in result.from_slice.suboffsets[:ndim]:
12109 * if suboffset >= 0: # <<<<<<<<<<<<<<
12110 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
12111 * break
12112 */
12113 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
12114 if (__pyx_t_1) {
12115
12116 /* "View.MemoryView":1039
12117 * for suboffset in result.from_slice.suboffsets[:ndim]:
12118 * if suboffset >= 0:
12119 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
12120 * break
12121 *
12122 */
12123 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
12124
12125 /* "View.MemoryView":1040
12126 * if suboffset >= 0:
12127 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
12128 * break # <<<<<<<<<<<<<<
12129 *
12130 * result.view.len = result.view.itemsize
12131 */
12132 goto __pyx_L6_break;
12133
12134 /* "View.MemoryView":1038
12135 * result.view.suboffsets = NULL
12136 * for suboffset in result.from_slice.suboffsets[:ndim]:
12137 * if suboffset >= 0: # <<<<<<<<<<<<<<
12138 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
12139 * break
12140 */
12141 }
12142 }
12143 __pyx_L6_break:;
12144
12145 /* "View.MemoryView":1042
12146 * break
12147 *
12148 * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
12149 * for length in result.view.shape[:ndim]:
12150 * result.view.len *= length
12151 */
12152 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
12153 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
12154
12155 /* "View.MemoryView":1043
12156 *
12157 * result.view.len = result.view.itemsize
12158 * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
12159 * result.view.len *= length
12160 *
12161 */
12162 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
12163 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
12164 __pyx_t_6 = __pyx_t_8;
12165 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
12166 __Pyx_GOTREF(__pyx_t_2);
12167 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
12168 __pyx_t_2 = 0;
12169
12170 /* "View.MemoryView":1044
12171 * result.view.len = result.view.itemsize
12172 * for length in result.view.shape[:ndim]:
12173 * result.view.len *= length # <<<<<<<<<<<<<<
12174 *
12175 * result.to_object_func = to_object_func
12176 */
12177 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
12178 __Pyx_GOTREF(__pyx_t_2);
12179 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
12180 __Pyx_GOTREF(__pyx_t_3);
12181 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12182 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
12183 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12184 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
12185 }
12186
12187 /* "View.MemoryView":1046
12188 * result.view.len *= length
12189 *
12190 * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
12191 * result.to_dtype_func = to_dtype_func
12192 *
12193 */
12194 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
12195
12196 /* "View.MemoryView":1047
12197 *
12198 * result.to_object_func = to_object_func
12199 * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
12200 *
12201 * return result
12202 */
12203 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
12204
12205 /* "View.MemoryView":1049
12206 * result.to_dtype_func = to_dtype_func
12207 *
12208 * return result # <<<<<<<<<<<<<<
12209 *
12210 * @cname('__pyx_memoryview_get_slice_from_memoryview')
12211 */
12212 __Pyx_XDECREF(__pyx_r);
12213 __Pyx_INCREF(((PyObject *)__pyx_v_result));
12214 __pyx_r = ((PyObject *)__pyx_v_result);
12215 goto __pyx_L0;
12216
12217 /* "View.MemoryView":999
12218 *
12219 * @cname('__pyx_memoryview_fromslice')
12220 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
12221 * int ndim,
12222 * object (*to_object_func)(char *),
12223 */
12224
12225 /* function exit code */
12226 __pyx_L1_error:;
12227 __Pyx_XDECREF(__pyx_t_2);
12228 __Pyx_XDECREF(__pyx_t_3);
12229 __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12230 __pyx_r = 0;
12231 __pyx_L0:;
12232 __Pyx_XDECREF((PyObject *)__pyx_v_result);
12233 __Pyx_XDECREF(__pyx_v_length);
12234 __Pyx_XGIVEREF(__pyx_r);
12235 __Pyx_RefNannyFinishContext();
12236 return __pyx_r;
12237 }
12238
12239 /* "View.MemoryView":1052
12240 *
12241 * @cname('__pyx_memoryview_get_slice_from_memoryview')
12242 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
12243 * __Pyx_memviewslice *mslice) except NULL:
12244 * cdef _memoryviewslice obj
12245 */
12246
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)12247 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
12248 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
12249 __Pyx_memviewslice *__pyx_r;
12250 __Pyx_RefNannyDeclarations
12251 int __pyx_t_1;
12252 int __pyx_t_2;
12253 PyObject *__pyx_t_3 = NULL;
12254 int __pyx_lineno = 0;
12255 const char *__pyx_filename = NULL;
12256 int __pyx_clineno = 0;
12257 __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
12258
12259 /* "View.MemoryView":1055
12260 * __Pyx_memviewslice *mslice) except NULL:
12261 * cdef _memoryviewslice obj
12262 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12263 * obj = memview
12264 * return &obj.from_slice
12265 */
12266 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12267 __pyx_t_2 = (__pyx_t_1 != 0);
12268 if (__pyx_t_2) {
12269
12270 /* "View.MemoryView":1056
12271 * cdef _memoryviewslice obj
12272 * if isinstance(memview, _memoryviewslice):
12273 * obj = memview # <<<<<<<<<<<<<<
12274 * return &obj.from_slice
12275 * else:
12276 */
12277 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
12278 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
12279 __Pyx_INCREF(__pyx_t_3);
12280 __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
12281 __pyx_t_3 = 0;
12282
12283 /* "View.MemoryView":1057
12284 * if isinstance(memview, _memoryviewslice):
12285 * obj = memview
12286 * return &obj.from_slice # <<<<<<<<<<<<<<
12287 * else:
12288 * slice_copy(memview, mslice)
12289 */
12290 __pyx_r = (&__pyx_v_obj->from_slice);
12291 goto __pyx_L0;
12292
12293 /* "View.MemoryView":1055
12294 * __Pyx_memviewslice *mslice) except NULL:
12295 * cdef _memoryviewslice obj
12296 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12297 * obj = memview
12298 * return &obj.from_slice
12299 */
12300 }
12301
12302 /* "View.MemoryView":1059
12303 * return &obj.from_slice
12304 * else:
12305 * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
12306 * return mslice
12307 *
12308 */
12309 /*else*/ {
12310 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
12311
12312 /* "View.MemoryView":1060
12313 * else:
12314 * slice_copy(memview, mslice)
12315 * return mslice # <<<<<<<<<<<<<<
12316 *
12317 * @cname('__pyx_memoryview_slice_copy')
12318 */
12319 __pyx_r = __pyx_v_mslice;
12320 goto __pyx_L0;
12321 }
12322
12323 /* "View.MemoryView":1052
12324 *
12325 * @cname('__pyx_memoryview_get_slice_from_memoryview')
12326 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
12327 * __Pyx_memviewslice *mslice) except NULL:
12328 * cdef _memoryviewslice obj
12329 */
12330
12331 /* function exit code */
12332 __pyx_L1_error:;
12333 __Pyx_XDECREF(__pyx_t_3);
12334 __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
12335 __pyx_r = NULL;
12336 __pyx_L0:;
12337 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
12338 __Pyx_RefNannyFinishContext();
12339 return __pyx_r;
12340 }
12341
12342 /* "View.MemoryView":1063
12343 *
12344 * @cname('__pyx_memoryview_slice_copy')
12345 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
12346 * cdef int dim
12347 * cdef (Py_ssize_t*) shape, strides, suboffsets
12348 */
12349
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)12350 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
12351 int __pyx_v_dim;
12352 Py_ssize_t *__pyx_v_shape;
12353 Py_ssize_t *__pyx_v_strides;
12354 Py_ssize_t *__pyx_v_suboffsets;
12355 __Pyx_RefNannyDeclarations
12356 Py_ssize_t *__pyx_t_1;
12357 int __pyx_t_2;
12358 int __pyx_t_3;
12359 int __pyx_t_4;
12360 Py_ssize_t __pyx_t_5;
12361 __Pyx_RefNannySetupContext("slice_copy", 0);
12362
12363 /* "View.MemoryView":1067
12364 * cdef (Py_ssize_t*) shape, strides, suboffsets
12365 *
12366 * shape = memview.view.shape # <<<<<<<<<<<<<<
12367 * strides = memview.view.strides
12368 * suboffsets = memview.view.suboffsets
12369 */
12370 __pyx_t_1 = __pyx_v_memview->view.shape;
12371 __pyx_v_shape = __pyx_t_1;
12372
12373 /* "View.MemoryView":1068
12374 *
12375 * shape = memview.view.shape
12376 * strides = memview.view.strides # <<<<<<<<<<<<<<
12377 * suboffsets = memview.view.suboffsets
12378 *
12379 */
12380 __pyx_t_1 = __pyx_v_memview->view.strides;
12381 __pyx_v_strides = __pyx_t_1;
12382
12383 /* "View.MemoryView":1069
12384 * shape = memview.view.shape
12385 * strides = memview.view.strides
12386 * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
12387 *
12388 * dst.memview = <__pyx_memoryview *> memview
12389 */
12390 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
12391 __pyx_v_suboffsets = __pyx_t_1;
12392
12393 /* "View.MemoryView":1071
12394 * suboffsets = memview.view.suboffsets
12395 *
12396 * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
12397 * dst.data = <char *> memview.view.buf
12398 *
12399 */
12400 __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
12401
12402 /* "View.MemoryView":1072
12403 *
12404 * dst.memview = <__pyx_memoryview *> memview
12405 * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
12406 *
12407 * for dim in range(memview.view.ndim):
12408 */
12409 __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
12410
12411 /* "View.MemoryView":1074
12412 * dst.data = <char *> memview.view.buf
12413 *
12414 * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
12415 * dst.shape[dim] = shape[dim]
12416 * dst.strides[dim] = strides[dim]
12417 */
12418 __pyx_t_2 = __pyx_v_memview->view.ndim;
12419 __pyx_t_3 = __pyx_t_2;
12420 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
12421 __pyx_v_dim = __pyx_t_4;
12422
12423 /* "View.MemoryView":1075
12424 *
12425 * for dim in range(memview.view.ndim):
12426 * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
12427 * dst.strides[dim] = strides[dim]
12428 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
12429 */
12430 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
12431
12432 /* "View.MemoryView":1076
12433 * for dim in range(memview.view.ndim):
12434 * dst.shape[dim] = shape[dim]
12435 * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
12436 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
12437 *
12438 */
12439 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
12440
12441 /* "View.MemoryView":1077
12442 * dst.shape[dim] = shape[dim]
12443 * dst.strides[dim] = strides[dim]
12444 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
12445 *
12446 * @cname('__pyx_memoryview_copy_object')
12447 */
12448 if ((__pyx_v_suboffsets != 0)) {
12449 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
12450 } else {
12451 __pyx_t_5 = -1L;
12452 }
12453 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
12454 }
12455
12456 /* "View.MemoryView":1063
12457 *
12458 * @cname('__pyx_memoryview_slice_copy')
12459 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
12460 * cdef int dim
12461 * cdef (Py_ssize_t*) shape, strides, suboffsets
12462 */
12463
12464 /* function exit code */
12465 __Pyx_RefNannyFinishContext();
12466 }
12467
12468 /* "View.MemoryView":1080
12469 *
12470 * @cname('__pyx_memoryview_copy_object')
12471 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
12472 * "Create a new memoryview object"
12473 * cdef __Pyx_memviewslice memviewslice
12474 */
12475
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)12476 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
12477 __Pyx_memviewslice __pyx_v_memviewslice;
12478 PyObject *__pyx_r = NULL;
12479 __Pyx_RefNannyDeclarations
12480 PyObject *__pyx_t_1 = NULL;
12481 int __pyx_lineno = 0;
12482 const char *__pyx_filename = NULL;
12483 int __pyx_clineno = 0;
12484 __Pyx_RefNannySetupContext("memoryview_copy", 0);
12485
12486 /* "View.MemoryView":1083
12487 * "Create a new memoryview object"
12488 * cdef __Pyx_memviewslice memviewslice
12489 * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
12490 * return memoryview_copy_from_slice(memview, &memviewslice)
12491 *
12492 */
12493 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
12494
12495 /* "View.MemoryView":1084
12496 * cdef __Pyx_memviewslice memviewslice
12497 * slice_copy(memview, &memviewslice)
12498 * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
12499 *
12500 * @cname('__pyx_memoryview_copy_object_from_slice')
12501 */
12502 __Pyx_XDECREF(__pyx_r);
12503 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
12504 __Pyx_GOTREF(__pyx_t_1);
12505 __pyx_r = __pyx_t_1;
12506 __pyx_t_1 = 0;
12507 goto __pyx_L0;
12508
12509 /* "View.MemoryView":1080
12510 *
12511 * @cname('__pyx_memoryview_copy_object')
12512 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
12513 * "Create a new memoryview object"
12514 * cdef __Pyx_memviewslice memviewslice
12515 */
12516
12517 /* function exit code */
12518 __pyx_L1_error:;
12519 __Pyx_XDECREF(__pyx_t_1);
12520 __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
12521 __pyx_r = 0;
12522 __pyx_L0:;
12523 __Pyx_XGIVEREF(__pyx_r);
12524 __Pyx_RefNannyFinishContext();
12525 return __pyx_r;
12526 }
12527
12528 /* "View.MemoryView":1087
12529 *
12530 * @cname('__pyx_memoryview_copy_object_from_slice')
12531 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
12532 * """
12533 * Create a new memoryview object from a given memoryview object and slice.
12534 */
12535
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)12536 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
12537 PyObject *(*__pyx_v_to_object_func)(char *);
12538 int (*__pyx_v_to_dtype_func)(char *, PyObject *);
12539 PyObject *__pyx_r = NULL;
12540 __Pyx_RefNannyDeclarations
12541 int __pyx_t_1;
12542 int __pyx_t_2;
12543 PyObject *(*__pyx_t_3)(char *);
12544 int (*__pyx_t_4)(char *, PyObject *);
12545 PyObject *__pyx_t_5 = NULL;
12546 int __pyx_lineno = 0;
12547 const char *__pyx_filename = NULL;
12548 int __pyx_clineno = 0;
12549 __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
12550
12551 /* "View.MemoryView":1094
12552 * cdef int (*to_dtype_func)(char *, object) except 0
12553 *
12554 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12555 * to_object_func = (<_memoryviewslice> memview).to_object_func
12556 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
12557 */
12558 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12559 __pyx_t_2 = (__pyx_t_1 != 0);
12560 if (__pyx_t_2) {
12561
12562 /* "View.MemoryView":1095
12563 *
12564 * if isinstance(memview, _memoryviewslice):
12565 * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
12566 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
12567 * else:
12568 */
12569 __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
12570 __pyx_v_to_object_func = __pyx_t_3;
12571
12572 /* "View.MemoryView":1096
12573 * if isinstance(memview, _memoryviewslice):
12574 * to_object_func = (<_memoryviewslice> memview).to_object_func
12575 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
12576 * else:
12577 * to_object_func = NULL
12578 */
12579 __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
12580 __pyx_v_to_dtype_func = __pyx_t_4;
12581
12582 /* "View.MemoryView":1094
12583 * cdef int (*to_dtype_func)(char *, object) except 0
12584 *
12585 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12586 * to_object_func = (<_memoryviewslice> memview).to_object_func
12587 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
12588 */
12589 goto __pyx_L3;
12590 }
12591
12592 /* "View.MemoryView":1098
12593 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
12594 * else:
12595 * to_object_func = NULL # <<<<<<<<<<<<<<
12596 * to_dtype_func = NULL
12597 *
12598 */
12599 /*else*/ {
12600 __pyx_v_to_object_func = NULL;
12601
12602 /* "View.MemoryView":1099
12603 * else:
12604 * to_object_func = NULL
12605 * to_dtype_func = NULL # <<<<<<<<<<<<<<
12606 *
12607 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
12608 */
12609 __pyx_v_to_dtype_func = NULL;
12610 }
12611 __pyx_L3:;
12612
12613 /* "View.MemoryView":1101
12614 * to_dtype_func = NULL
12615 *
12616 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
12617 * to_object_func, to_dtype_func,
12618 * memview.dtype_is_object)
12619 */
12620 __Pyx_XDECREF(__pyx_r);
12621
12622 /* "View.MemoryView":1103
12623 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
12624 * to_object_func, to_dtype_func,
12625 * memview.dtype_is_object) # <<<<<<<<<<<<<<
12626 *
12627 *
12628 */
12629 __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(1, 1101, __pyx_L1_error)
12630 __Pyx_GOTREF(__pyx_t_5);
12631 __pyx_r = __pyx_t_5;
12632 __pyx_t_5 = 0;
12633 goto __pyx_L0;
12634
12635 /* "View.MemoryView":1087
12636 *
12637 * @cname('__pyx_memoryview_copy_object_from_slice')
12638 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
12639 * """
12640 * Create a new memoryview object from a given memoryview object and slice.
12641 */
12642
12643 /* function exit code */
12644 __pyx_L1_error:;
12645 __Pyx_XDECREF(__pyx_t_5);
12646 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12647 __pyx_r = 0;
12648 __pyx_L0:;
12649 __Pyx_XGIVEREF(__pyx_r);
12650 __Pyx_RefNannyFinishContext();
12651 return __pyx_r;
12652 }
12653
12654 /* "View.MemoryView":1109
12655 *
12656 *
12657 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
12658 * if arg < 0:
12659 * return -arg
12660 */
12661
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)12662 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
12663 Py_ssize_t __pyx_r;
12664 int __pyx_t_1;
12665
12666 /* "View.MemoryView":1110
12667 *
12668 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
12669 * if arg < 0: # <<<<<<<<<<<<<<
12670 * return -arg
12671 * else:
12672 */
12673 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
12674 if (__pyx_t_1) {
12675
12676 /* "View.MemoryView":1111
12677 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
12678 * if arg < 0:
12679 * return -arg # <<<<<<<<<<<<<<
12680 * else:
12681 * return arg
12682 */
12683 __pyx_r = (-__pyx_v_arg);
12684 goto __pyx_L0;
12685
12686 /* "View.MemoryView":1110
12687 *
12688 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
12689 * if arg < 0: # <<<<<<<<<<<<<<
12690 * return -arg
12691 * else:
12692 */
12693 }
12694
12695 /* "View.MemoryView":1113
12696 * return -arg
12697 * else:
12698 * return arg # <<<<<<<<<<<<<<
12699 *
12700 * @cname('__pyx_get_best_slice_order')
12701 */
12702 /*else*/ {
12703 __pyx_r = __pyx_v_arg;
12704 goto __pyx_L0;
12705 }
12706
12707 /* "View.MemoryView":1109
12708 *
12709 *
12710 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
12711 * if arg < 0:
12712 * return -arg
12713 */
12714
12715 /* function exit code */
12716 __pyx_L0:;
12717 return __pyx_r;
12718 }
12719
12720 /* "View.MemoryView":1116
12721 *
12722 * @cname('__pyx_get_best_slice_order')
12723 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
12724 * """
12725 * Figure out the best memory access order for a given slice.
12726 */
12727
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)12728 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
12729 int __pyx_v_i;
12730 Py_ssize_t __pyx_v_c_stride;
12731 Py_ssize_t __pyx_v_f_stride;
12732 char __pyx_r;
12733 int __pyx_t_1;
12734 int __pyx_t_2;
12735 int __pyx_t_3;
12736 int __pyx_t_4;
12737
12738 /* "View.MemoryView":1121
12739 * """
12740 * cdef int i
12741 * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
12742 * cdef Py_ssize_t f_stride = 0
12743 *
12744 */
12745 __pyx_v_c_stride = 0;
12746
12747 /* "View.MemoryView":1122
12748 * cdef int i
12749 * cdef Py_ssize_t c_stride = 0
12750 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
12751 *
12752 * for i in range(ndim - 1, -1, -1):
12753 */
12754 __pyx_v_f_stride = 0;
12755
12756 /* "View.MemoryView":1124
12757 * cdef Py_ssize_t f_stride = 0
12758 *
12759 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
12760 * if mslice.shape[i] > 1:
12761 * c_stride = mslice.strides[i]
12762 */
12763 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
12764 __pyx_v_i = __pyx_t_1;
12765
12766 /* "View.MemoryView":1125
12767 *
12768 * for i in range(ndim - 1, -1, -1):
12769 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
12770 * c_stride = mslice.strides[i]
12771 * break
12772 */
12773 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
12774 if (__pyx_t_2) {
12775
12776 /* "View.MemoryView":1126
12777 * for i in range(ndim - 1, -1, -1):
12778 * if mslice.shape[i] > 1:
12779 * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
12780 * break
12781 *
12782 */
12783 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
12784
12785 /* "View.MemoryView":1127
12786 * if mslice.shape[i] > 1:
12787 * c_stride = mslice.strides[i]
12788 * break # <<<<<<<<<<<<<<
12789 *
12790 * for i in range(ndim):
12791 */
12792 goto __pyx_L4_break;
12793
12794 /* "View.MemoryView":1125
12795 *
12796 * for i in range(ndim - 1, -1, -1):
12797 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
12798 * c_stride = mslice.strides[i]
12799 * break
12800 */
12801 }
12802 }
12803 __pyx_L4_break:;
12804
12805 /* "View.MemoryView":1129
12806 * break
12807 *
12808 * for i in range(ndim): # <<<<<<<<<<<<<<
12809 * if mslice.shape[i] > 1:
12810 * f_stride = mslice.strides[i]
12811 */
12812 __pyx_t_1 = __pyx_v_ndim;
12813 __pyx_t_3 = __pyx_t_1;
12814 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
12815 __pyx_v_i = __pyx_t_4;
12816
12817 /* "View.MemoryView":1130
12818 *
12819 * for i in range(ndim):
12820 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
12821 * f_stride = mslice.strides[i]
12822 * break
12823 */
12824 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
12825 if (__pyx_t_2) {
12826
12827 /* "View.MemoryView":1131
12828 * for i in range(ndim):
12829 * if mslice.shape[i] > 1:
12830 * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
12831 * break
12832 *
12833 */
12834 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
12835
12836 /* "View.MemoryView":1132
12837 * if mslice.shape[i] > 1:
12838 * f_stride = mslice.strides[i]
12839 * break # <<<<<<<<<<<<<<
12840 *
12841 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
12842 */
12843 goto __pyx_L7_break;
12844
12845 /* "View.MemoryView":1130
12846 *
12847 * for i in range(ndim):
12848 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
12849 * f_stride = mslice.strides[i]
12850 * break
12851 */
12852 }
12853 }
12854 __pyx_L7_break:;
12855
12856 /* "View.MemoryView":1134
12857 * break
12858 *
12859 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
12860 * return 'C'
12861 * else:
12862 */
12863 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
12864 if (__pyx_t_2) {
12865
12866 /* "View.MemoryView":1135
12867 *
12868 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
12869 * return 'C' # <<<<<<<<<<<<<<
12870 * else:
12871 * return 'F'
12872 */
12873 __pyx_r = 'C';
12874 goto __pyx_L0;
12875
12876 /* "View.MemoryView":1134
12877 * break
12878 *
12879 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
12880 * return 'C'
12881 * else:
12882 */
12883 }
12884
12885 /* "View.MemoryView":1137
12886 * return 'C'
12887 * else:
12888 * return 'F' # <<<<<<<<<<<<<<
12889 *
12890 * @cython.cdivision(True)
12891 */
12892 /*else*/ {
12893 __pyx_r = 'F';
12894 goto __pyx_L0;
12895 }
12896
12897 /* "View.MemoryView":1116
12898 *
12899 * @cname('__pyx_get_best_slice_order')
12900 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
12901 * """
12902 * Figure out the best memory access order for a given slice.
12903 */
12904
12905 /* function exit code */
12906 __pyx_L0:;
12907 return __pyx_r;
12908 }
12909
12910 /* "View.MemoryView":1140
12911 *
12912 * @cython.cdivision(True)
12913 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
12914 * char *dst_data, Py_ssize_t *dst_strides,
12915 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
12916 */
12917
_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)12918 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) {
12919 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
12920 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
12921 Py_ssize_t __pyx_v_dst_extent;
12922 Py_ssize_t __pyx_v_src_stride;
12923 Py_ssize_t __pyx_v_dst_stride;
12924 int __pyx_t_1;
12925 int __pyx_t_2;
12926 int __pyx_t_3;
12927 Py_ssize_t __pyx_t_4;
12928 Py_ssize_t __pyx_t_5;
12929 Py_ssize_t __pyx_t_6;
12930
12931 /* "View.MemoryView":1147
12932 *
12933 * cdef Py_ssize_t i
12934 * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
12935 * cdef Py_ssize_t dst_extent = dst_shape[0]
12936 * cdef Py_ssize_t src_stride = src_strides[0]
12937 */
12938 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
12939
12940 /* "View.MemoryView":1148
12941 * cdef Py_ssize_t i
12942 * cdef Py_ssize_t src_extent = src_shape[0]
12943 * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
12944 * cdef Py_ssize_t src_stride = src_strides[0]
12945 * cdef Py_ssize_t dst_stride = dst_strides[0]
12946 */
12947 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
12948
12949 /* "View.MemoryView":1149
12950 * cdef Py_ssize_t src_extent = src_shape[0]
12951 * cdef Py_ssize_t dst_extent = dst_shape[0]
12952 * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
12953 * cdef Py_ssize_t dst_stride = dst_strides[0]
12954 *
12955 */
12956 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
12957
12958 /* "View.MemoryView":1150
12959 * cdef Py_ssize_t dst_extent = dst_shape[0]
12960 * cdef Py_ssize_t src_stride = src_strides[0]
12961 * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
12962 *
12963 * if ndim == 1:
12964 */
12965 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
12966
12967 /* "View.MemoryView":1152
12968 * cdef Py_ssize_t dst_stride = dst_strides[0]
12969 *
12970 * if ndim == 1: # <<<<<<<<<<<<<<
12971 * if (src_stride > 0 and dst_stride > 0 and
12972 * <size_t> src_stride == itemsize == <size_t> dst_stride):
12973 */
12974 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
12975 if (__pyx_t_1) {
12976
12977 /* "View.MemoryView":1153
12978 *
12979 * if ndim == 1:
12980 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
12981 * <size_t> src_stride == itemsize == <size_t> dst_stride):
12982 * memcpy(dst_data, src_data, itemsize * dst_extent)
12983 */
12984 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
12985 if (__pyx_t_2) {
12986 } else {
12987 __pyx_t_1 = __pyx_t_2;
12988 goto __pyx_L5_bool_binop_done;
12989 }
12990 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
12991 if (__pyx_t_2) {
12992 } else {
12993 __pyx_t_1 = __pyx_t_2;
12994 goto __pyx_L5_bool_binop_done;
12995 }
12996
12997 /* "View.MemoryView":1154
12998 * if ndim == 1:
12999 * if (src_stride > 0 and dst_stride > 0 and
13000 * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
13001 * memcpy(dst_data, src_data, itemsize * dst_extent)
13002 * else:
13003 */
13004 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
13005 if (__pyx_t_2) {
13006 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
13007 }
13008 __pyx_t_3 = (__pyx_t_2 != 0);
13009 __pyx_t_1 = __pyx_t_3;
13010 __pyx_L5_bool_binop_done:;
13011
13012 /* "View.MemoryView":1153
13013 *
13014 * if ndim == 1:
13015 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
13016 * <size_t> src_stride == itemsize == <size_t> dst_stride):
13017 * memcpy(dst_data, src_data, itemsize * dst_extent)
13018 */
13019 if (__pyx_t_1) {
13020
13021 /* "View.MemoryView":1155
13022 * if (src_stride > 0 and dst_stride > 0 and
13023 * <size_t> src_stride == itemsize == <size_t> dst_stride):
13024 * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
13025 * else:
13026 * for i in range(dst_extent):
13027 */
13028 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
13029
13030 /* "View.MemoryView":1153
13031 *
13032 * if ndim == 1:
13033 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
13034 * <size_t> src_stride == itemsize == <size_t> dst_stride):
13035 * memcpy(dst_data, src_data, itemsize * dst_extent)
13036 */
13037 goto __pyx_L4;
13038 }
13039
13040 /* "View.MemoryView":1157
13041 * memcpy(dst_data, src_data, itemsize * dst_extent)
13042 * else:
13043 * for i in range(dst_extent): # <<<<<<<<<<<<<<
13044 * memcpy(dst_data, src_data, itemsize)
13045 * src_data += src_stride
13046 */
13047 /*else*/ {
13048 __pyx_t_4 = __pyx_v_dst_extent;
13049 __pyx_t_5 = __pyx_t_4;
13050 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13051 __pyx_v_i = __pyx_t_6;
13052
13053 /* "View.MemoryView":1158
13054 * else:
13055 * for i in range(dst_extent):
13056 * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
13057 * src_data += src_stride
13058 * dst_data += dst_stride
13059 */
13060 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
13061
13062 /* "View.MemoryView":1159
13063 * for i in range(dst_extent):
13064 * memcpy(dst_data, src_data, itemsize)
13065 * src_data += src_stride # <<<<<<<<<<<<<<
13066 * dst_data += dst_stride
13067 * else:
13068 */
13069 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
13070
13071 /* "View.MemoryView":1160
13072 * memcpy(dst_data, src_data, itemsize)
13073 * src_data += src_stride
13074 * dst_data += dst_stride # <<<<<<<<<<<<<<
13075 * else:
13076 * for i in range(dst_extent):
13077 */
13078 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
13079 }
13080 }
13081 __pyx_L4:;
13082
13083 /* "View.MemoryView":1152
13084 * cdef Py_ssize_t dst_stride = dst_strides[0]
13085 *
13086 * if ndim == 1: # <<<<<<<<<<<<<<
13087 * if (src_stride > 0 and dst_stride > 0 and
13088 * <size_t> src_stride == itemsize == <size_t> dst_stride):
13089 */
13090 goto __pyx_L3;
13091 }
13092
13093 /* "View.MemoryView":1162
13094 * dst_data += dst_stride
13095 * else:
13096 * for i in range(dst_extent): # <<<<<<<<<<<<<<
13097 * _copy_strided_to_strided(src_data, src_strides + 1,
13098 * dst_data, dst_strides + 1,
13099 */
13100 /*else*/ {
13101 __pyx_t_4 = __pyx_v_dst_extent;
13102 __pyx_t_5 = __pyx_t_4;
13103 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13104 __pyx_v_i = __pyx_t_6;
13105
13106 /* "View.MemoryView":1163
13107 * else:
13108 * for i in range(dst_extent):
13109 * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
13110 * dst_data, dst_strides + 1,
13111 * src_shape + 1, dst_shape + 1,
13112 */
13113 _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);
13114
13115 /* "View.MemoryView":1167
13116 * src_shape + 1, dst_shape + 1,
13117 * ndim - 1, itemsize)
13118 * src_data += src_stride # <<<<<<<<<<<<<<
13119 * dst_data += dst_stride
13120 *
13121 */
13122 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
13123
13124 /* "View.MemoryView":1168
13125 * ndim - 1, itemsize)
13126 * src_data += src_stride
13127 * dst_data += dst_stride # <<<<<<<<<<<<<<
13128 *
13129 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
13130 */
13131 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
13132 }
13133 }
13134 __pyx_L3:;
13135
13136 /* "View.MemoryView":1140
13137 *
13138 * @cython.cdivision(True)
13139 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
13140 * char *dst_data, Py_ssize_t *dst_strides,
13141 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
13142 */
13143
13144 /* function exit code */
13145 }
13146
13147 /* "View.MemoryView":1170
13148 * dst_data += dst_stride
13149 *
13150 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
13151 * __Pyx_memviewslice *dst,
13152 * int ndim, size_t itemsize) nogil:
13153 */
13154
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)13155 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) {
13156
13157 /* "View.MemoryView":1173
13158 * __Pyx_memviewslice *dst,
13159 * int ndim, size_t itemsize) nogil:
13160 * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
13161 * src.shape, dst.shape, ndim, itemsize)
13162 *
13163 */
13164 _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);
13165
13166 /* "View.MemoryView":1170
13167 * dst_data += dst_stride
13168 *
13169 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
13170 * __Pyx_memviewslice *dst,
13171 * int ndim, size_t itemsize) nogil:
13172 */
13173
13174 /* function exit code */
13175 }
13176
13177 /* "View.MemoryView":1177
13178 *
13179 * @cname('__pyx_memoryview_slice_get_size')
13180 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
13181 * "Return the size of the memory occupied by the slice in number of bytes"
13182 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
13183 */
13184
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)13185 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
13186 Py_ssize_t __pyx_v_shape;
13187 Py_ssize_t __pyx_v_size;
13188 Py_ssize_t __pyx_r;
13189 Py_ssize_t __pyx_t_1;
13190 Py_ssize_t *__pyx_t_2;
13191 Py_ssize_t *__pyx_t_3;
13192 Py_ssize_t *__pyx_t_4;
13193
13194 /* "View.MemoryView":1179
13195 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
13196 * "Return the size of the memory occupied by the slice in number of bytes"
13197 * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
13198 *
13199 * for shape in src.shape[:ndim]:
13200 */
13201 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
13202 __pyx_v_size = __pyx_t_1;
13203
13204 /* "View.MemoryView":1181
13205 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
13206 *
13207 * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
13208 * size *= shape
13209 *
13210 */
13211 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
13212 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
13213 __pyx_t_2 = __pyx_t_4;
13214 __pyx_v_shape = (__pyx_t_2[0]);
13215
13216 /* "View.MemoryView":1182
13217 *
13218 * for shape in src.shape[:ndim]:
13219 * size *= shape # <<<<<<<<<<<<<<
13220 *
13221 * return size
13222 */
13223 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
13224 }
13225
13226 /* "View.MemoryView":1184
13227 * size *= shape
13228 *
13229 * return size # <<<<<<<<<<<<<<
13230 *
13231 * @cname('__pyx_fill_contig_strides_array')
13232 */
13233 __pyx_r = __pyx_v_size;
13234 goto __pyx_L0;
13235
13236 /* "View.MemoryView":1177
13237 *
13238 * @cname('__pyx_memoryview_slice_get_size')
13239 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
13240 * "Return the size of the memory occupied by the slice in number of bytes"
13241 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
13242 */
13243
13244 /* function exit code */
13245 __pyx_L0:;
13246 return __pyx_r;
13247 }
13248
13249 /* "View.MemoryView":1187
13250 *
13251 * @cname('__pyx_fill_contig_strides_array')
13252 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
13253 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
13254 * int ndim, char order) nogil:
13255 */
13256
__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)13257 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) {
13258 int __pyx_v_idx;
13259 Py_ssize_t __pyx_r;
13260 int __pyx_t_1;
13261 int __pyx_t_2;
13262 int __pyx_t_3;
13263 int __pyx_t_4;
13264
13265 /* "View.MemoryView":1196
13266 * cdef int idx
13267 *
13268 * if order == 'F': # <<<<<<<<<<<<<<
13269 * for idx in range(ndim):
13270 * strides[idx] = stride
13271 */
13272 __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
13273 if (__pyx_t_1) {
13274
13275 /* "View.MemoryView":1197
13276 *
13277 * if order == 'F':
13278 * for idx in range(ndim): # <<<<<<<<<<<<<<
13279 * strides[idx] = stride
13280 * stride *= shape[idx]
13281 */
13282 __pyx_t_2 = __pyx_v_ndim;
13283 __pyx_t_3 = __pyx_t_2;
13284 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
13285 __pyx_v_idx = __pyx_t_4;
13286
13287 /* "View.MemoryView":1198
13288 * if order == 'F':
13289 * for idx in range(ndim):
13290 * strides[idx] = stride # <<<<<<<<<<<<<<
13291 * stride *= shape[idx]
13292 * else:
13293 */
13294 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
13295
13296 /* "View.MemoryView":1199
13297 * for idx in range(ndim):
13298 * strides[idx] = stride
13299 * stride *= shape[idx] # <<<<<<<<<<<<<<
13300 * else:
13301 * for idx in range(ndim - 1, -1, -1):
13302 */
13303 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
13304 }
13305
13306 /* "View.MemoryView":1196
13307 * cdef int idx
13308 *
13309 * if order == 'F': # <<<<<<<<<<<<<<
13310 * for idx in range(ndim):
13311 * strides[idx] = stride
13312 */
13313 goto __pyx_L3;
13314 }
13315
13316 /* "View.MemoryView":1201
13317 * stride *= shape[idx]
13318 * else:
13319 * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
13320 * strides[idx] = stride
13321 * stride *= shape[idx]
13322 */
13323 /*else*/ {
13324 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
13325 __pyx_v_idx = __pyx_t_2;
13326
13327 /* "View.MemoryView":1202
13328 * else:
13329 * for idx in range(ndim - 1, -1, -1):
13330 * strides[idx] = stride # <<<<<<<<<<<<<<
13331 * stride *= shape[idx]
13332 *
13333 */
13334 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
13335
13336 /* "View.MemoryView":1203
13337 * for idx in range(ndim - 1, -1, -1):
13338 * strides[idx] = stride
13339 * stride *= shape[idx] # <<<<<<<<<<<<<<
13340 *
13341 * return stride
13342 */
13343 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
13344 }
13345 }
13346 __pyx_L3:;
13347
13348 /* "View.MemoryView":1205
13349 * stride *= shape[idx]
13350 *
13351 * return stride # <<<<<<<<<<<<<<
13352 *
13353 * @cname('__pyx_memoryview_copy_data_to_temp')
13354 */
13355 __pyx_r = __pyx_v_stride;
13356 goto __pyx_L0;
13357
13358 /* "View.MemoryView":1187
13359 *
13360 * @cname('__pyx_fill_contig_strides_array')
13361 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
13362 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
13363 * int ndim, char order) nogil:
13364 */
13365
13366 /* function exit code */
13367 __pyx_L0:;
13368 return __pyx_r;
13369 }
13370
13371 /* "View.MemoryView":1208
13372 *
13373 * @cname('__pyx_memoryview_copy_data_to_temp')
13374 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
13375 * __Pyx_memviewslice *tmpslice,
13376 * char order,
13377 */
13378
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)13379 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) {
13380 int __pyx_v_i;
13381 void *__pyx_v_result;
13382 size_t __pyx_v_itemsize;
13383 size_t __pyx_v_size;
13384 void *__pyx_r;
13385 Py_ssize_t __pyx_t_1;
13386 int __pyx_t_2;
13387 int __pyx_t_3;
13388 struct __pyx_memoryview_obj *__pyx_t_4;
13389 int __pyx_t_5;
13390 int __pyx_t_6;
13391 int __pyx_lineno = 0;
13392 const char *__pyx_filename = NULL;
13393 int __pyx_clineno = 0;
13394
13395 /* "View.MemoryView":1219
13396 * cdef void *result
13397 *
13398 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
13399 * cdef size_t size = slice_get_size(src, ndim)
13400 *
13401 */
13402 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
13403 __pyx_v_itemsize = __pyx_t_1;
13404
13405 /* "View.MemoryView":1220
13406 *
13407 * cdef size_t itemsize = src.memview.view.itemsize
13408 * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
13409 *
13410 * result = malloc(size)
13411 */
13412 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
13413
13414 /* "View.MemoryView":1222
13415 * cdef size_t size = slice_get_size(src, ndim)
13416 *
13417 * result = malloc(size) # <<<<<<<<<<<<<<
13418 * if not result:
13419 * _err(MemoryError, NULL)
13420 */
13421 __pyx_v_result = malloc(__pyx_v_size);
13422
13423 /* "View.MemoryView":1223
13424 *
13425 * result = malloc(size)
13426 * if not result: # <<<<<<<<<<<<<<
13427 * _err(MemoryError, NULL)
13428 *
13429 */
13430 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
13431 if (__pyx_t_2) {
13432
13433 /* "View.MemoryView":1224
13434 * result = malloc(size)
13435 * if not result:
13436 * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
13437 *
13438 *
13439 */
13440 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
13441
13442 /* "View.MemoryView":1223
13443 *
13444 * result = malloc(size)
13445 * if not result: # <<<<<<<<<<<<<<
13446 * _err(MemoryError, NULL)
13447 *
13448 */
13449 }
13450
13451 /* "View.MemoryView":1227
13452 *
13453 *
13454 * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
13455 * tmpslice.memview = src.memview
13456 * for i in range(ndim):
13457 */
13458 __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
13459
13460 /* "View.MemoryView":1228
13461 *
13462 * tmpslice.data = <char *> result
13463 * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
13464 * for i in range(ndim):
13465 * tmpslice.shape[i] = src.shape[i]
13466 */
13467 __pyx_t_4 = __pyx_v_src->memview;
13468 __pyx_v_tmpslice->memview = __pyx_t_4;
13469
13470 /* "View.MemoryView":1229
13471 * tmpslice.data = <char *> result
13472 * tmpslice.memview = src.memview
13473 * for i in range(ndim): # <<<<<<<<<<<<<<
13474 * tmpslice.shape[i] = src.shape[i]
13475 * tmpslice.suboffsets[i] = -1
13476 */
13477 __pyx_t_3 = __pyx_v_ndim;
13478 __pyx_t_5 = __pyx_t_3;
13479 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13480 __pyx_v_i = __pyx_t_6;
13481
13482 /* "View.MemoryView":1230
13483 * tmpslice.memview = src.memview
13484 * for i in range(ndim):
13485 * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
13486 * tmpslice.suboffsets[i] = -1
13487 *
13488 */
13489 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
13490
13491 /* "View.MemoryView":1231
13492 * for i in range(ndim):
13493 * tmpslice.shape[i] = src.shape[i]
13494 * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
13495 *
13496 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
13497 */
13498 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
13499 }
13500
13501 /* "View.MemoryView":1233
13502 * tmpslice.suboffsets[i] = -1
13503 *
13504 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
13505 * ndim, order)
13506 *
13507 */
13508 (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));
13509
13510 /* "View.MemoryView":1237
13511 *
13512 *
13513 * for i in range(ndim): # <<<<<<<<<<<<<<
13514 * if tmpslice.shape[i] == 1:
13515 * tmpslice.strides[i] = 0
13516 */
13517 __pyx_t_3 = __pyx_v_ndim;
13518 __pyx_t_5 = __pyx_t_3;
13519 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13520 __pyx_v_i = __pyx_t_6;
13521
13522 /* "View.MemoryView":1238
13523 *
13524 * for i in range(ndim):
13525 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
13526 * tmpslice.strides[i] = 0
13527 *
13528 */
13529 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
13530 if (__pyx_t_2) {
13531
13532 /* "View.MemoryView":1239
13533 * for i in range(ndim):
13534 * if tmpslice.shape[i] == 1:
13535 * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
13536 *
13537 * if slice_is_contig(src[0], order, ndim):
13538 */
13539 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
13540
13541 /* "View.MemoryView":1238
13542 *
13543 * for i in range(ndim):
13544 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
13545 * tmpslice.strides[i] = 0
13546 *
13547 */
13548 }
13549 }
13550
13551 /* "View.MemoryView":1241
13552 * tmpslice.strides[i] = 0
13553 *
13554 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
13555 * memcpy(result, src.data, size)
13556 * else:
13557 */
13558 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
13559 if (__pyx_t_2) {
13560
13561 /* "View.MemoryView":1242
13562 *
13563 * if slice_is_contig(src[0], order, ndim):
13564 * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
13565 * else:
13566 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
13567 */
13568 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
13569
13570 /* "View.MemoryView":1241
13571 * tmpslice.strides[i] = 0
13572 *
13573 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
13574 * memcpy(result, src.data, size)
13575 * else:
13576 */
13577 goto __pyx_L9;
13578 }
13579
13580 /* "View.MemoryView":1244
13581 * memcpy(result, src.data, size)
13582 * else:
13583 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
13584 *
13585 * return result
13586 */
13587 /*else*/ {
13588 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
13589 }
13590 __pyx_L9:;
13591
13592 /* "View.MemoryView":1246
13593 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
13594 *
13595 * return result # <<<<<<<<<<<<<<
13596 *
13597 *
13598 */
13599 __pyx_r = __pyx_v_result;
13600 goto __pyx_L0;
13601
13602 /* "View.MemoryView":1208
13603 *
13604 * @cname('__pyx_memoryview_copy_data_to_temp')
13605 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
13606 * __Pyx_memviewslice *tmpslice,
13607 * char order,
13608 */
13609
13610 /* function exit code */
13611 __pyx_L1_error:;
13612 {
13613 #ifdef WITH_THREAD
13614 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13615 #endif
13616 __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
13617 #ifdef WITH_THREAD
13618 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13619 #endif
13620 }
13621 __pyx_r = NULL;
13622 __pyx_L0:;
13623 return __pyx_r;
13624 }
13625
13626 /* "View.MemoryView":1251
13627 *
13628 * @cname('__pyx_memoryview_err_extents')
13629 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
13630 * Py_ssize_t extent2) except -1 with gil:
13631 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
13632 */
13633
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)13634 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
13635 int __pyx_r;
13636 __Pyx_RefNannyDeclarations
13637 PyObject *__pyx_t_1 = NULL;
13638 PyObject *__pyx_t_2 = NULL;
13639 PyObject *__pyx_t_3 = NULL;
13640 PyObject *__pyx_t_4 = NULL;
13641 int __pyx_lineno = 0;
13642 const char *__pyx_filename = NULL;
13643 int __pyx_clineno = 0;
13644 #ifdef WITH_THREAD
13645 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13646 #endif
13647 __Pyx_RefNannySetupContext("_err_extents", 0);
13648
13649 /* "View.MemoryView":1254
13650 * Py_ssize_t extent2) except -1 with gil:
13651 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
13652 * (i, extent1, extent2)) # <<<<<<<<<<<<<<
13653 *
13654 * @cname('__pyx_memoryview_err_dim')
13655 */
13656 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
13657 __Pyx_GOTREF(__pyx_t_1);
13658 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
13659 __Pyx_GOTREF(__pyx_t_2);
13660 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
13661 __Pyx_GOTREF(__pyx_t_3);
13662 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
13663 __Pyx_GOTREF(__pyx_t_4);
13664 __Pyx_GIVEREF(__pyx_t_1);
13665 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
13666 __Pyx_GIVEREF(__pyx_t_2);
13667 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
13668 __Pyx_GIVEREF(__pyx_t_3);
13669 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
13670 __pyx_t_1 = 0;
13671 __pyx_t_2 = 0;
13672 __pyx_t_3 = 0;
13673
13674 /* "View.MemoryView":1253
13675 * cdef int _err_extents(int i, Py_ssize_t extent1,
13676 * Py_ssize_t extent2) except -1 with gil:
13677 * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
13678 * (i, extent1, extent2))
13679 *
13680 */
13681 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
13682 __Pyx_GOTREF(__pyx_t_3);
13683 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13684 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
13685 __Pyx_GOTREF(__pyx_t_4);
13686 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13687 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
13688 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13689 __PYX_ERR(1, 1253, __pyx_L1_error)
13690
13691 /* "View.MemoryView":1251
13692 *
13693 * @cname('__pyx_memoryview_err_extents')
13694 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
13695 * Py_ssize_t extent2) except -1 with gil:
13696 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
13697 */
13698
13699 /* function exit code */
13700 __pyx_L1_error:;
13701 __Pyx_XDECREF(__pyx_t_1);
13702 __Pyx_XDECREF(__pyx_t_2);
13703 __Pyx_XDECREF(__pyx_t_3);
13704 __Pyx_XDECREF(__pyx_t_4);
13705 __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
13706 __pyx_r = -1;
13707 __Pyx_RefNannyFinishContext();
13708 #ifdef WITH_THREAD
13709 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13710 #endif
13711 return __pyx_r;
13712 }
13713
13714 /* "View.MemoryView":1257
13715 *
13716 * @cname('__pyx_memoryview_err_dim')
13717 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
13718 * raise error(msg.decode('ascii') % dim)
13719 *
13720 */
13721
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)13722 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
13723 int __pyx_r;
13724 __Pyx_RefNannyDeclarations
13725 PyObject *__pyx_t_1 = NULL;
13726 PyObject *__pyx_t_2 = NULL;
13727 PyObject *__pyx_t_3 = NULL;
13728 PyObject *__pyx_t_4 = NULL;
13729 int __pyx_lineno = 0;
13730 const char *__pyx_filename = NULL;
13731 int __pyx_clineno = 0;
13732 #ifdef WITH_THREAD
13733 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13734 #endif
13735 __Pyx_RefNannySetupContext("_err_dim", 0);
13736 __Pyx_INCREF(__pyx_v_error);
13737
13738 /* "View.MemoryView":1258
13739 * @cname('__pyx_memoryview_err_dim')
13740 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
13741 * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
13742 *
13743 * @cname('__pyx_memoryview_err')
13744 */
13745 __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(1, 1258, __pyx_L1_error)
13746 __Pyx_GOTREF(__pyx_t_2);
13747 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
13748 __Pyx_GOTREF(__pyx_t_3);
13749 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
13750 __Pyx_GOTREF(__pyx_t_4);
13751 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13752 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13753 __Pyx_INCREF(__pyx_v_error);
13754 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
13755 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
13756 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
13757 if (likely(__pyx_t_2)) {
13758 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13759 __Pyx_INCREF(__pyx_t_2);
13760 __Pyx_INCREF(function);
13761 __Pyx_DECREF_SET(__pyx_t_3, function);
13762 }
13763 }
13764 __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);
13765 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13766 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13767 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
13768 __Pyx_GOTREF(__pyx_t_1);
13769 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13770 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13771 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13772 __PYX_ERR(1, 1258, __pyx_L1_error)
13773
13774 /* "View.MemoryView":1257
13775 *
13776 * @cname('__pyx_memoryview_err_dim')
13777 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
13778 * raise error(msg.decode('ascii') % dim)
13779 *
13780 */
13781
13782 /* function exit code */
13783 __pyx_L1_error:;
13784 __Pyx_XDECREF(__pyx_t_1);
13785 __Pyx_XDECREF(__pyx_t_2);
13786 __Pyx_XDECREF(__pyx_t_3);
13787 __Pyx_XDECREF(__pyx_t_4);
13788 __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
13789 __pyx_r = -1;
13790 __Pyx_XDECREF(__pyx_v_error);
13791 __Pyx_RefNannyFinishContext();
13792 #ifdef WITH_THREAD
13793 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13794 #endif
13795 return __pyx_r;
13796 }
13797
13798 /* "View.MemoryView":1261
13799 *
13800 * @cname('__pyx_memoryview_err')
13801 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
13802 * if msg != NULL:
13803 * raise error(msg.decode('ascii'))
13804 */
13805
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)13806 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
13807 int __pyx_r;
13808 __Pyx_RefNannyDeclarations
13809 int __pyx_t_1;
13810 PyObject *__pyx_t_2 = NULL;
13811 PyObject *__pyx_t_3 = NULL;
13812 PyObject *__pyx_t_4 = NULL;
13813 PyObject *__pyx_t_5 = NULL;
13814 int __pyx_lineno = 0;
13815 const char *__pyx_filename = NULL;
13816 int __pyx_clineno = 0;
13817 #ifdef WITH_THREAD
13818 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13819 #endif
13820 __Pyx_RefNannySetupContext("_err", 0);
13821 __Pyx_INCREF(__pyx_v_error);
13822
13823 /* "View.MemoryView":1262
13824 * @cname('__pyx_memoryview_err')
13825 * cdef int _err(object error, char *msg) except -1 with gil:
13826 * if msg != NULL: # <<<<<<<<<<<<<<
13827 * raise error(msg.decode('ascii'))
13828 * else:
13829 */
13830 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
13831 if (unlikely(__pyx_t_1)) {
13832
13833 /* "View.MemoryView":1263
13834 * cdef int _err(object error, char *msg) except -1 with gil:
13835 * if msg != NULL:
13836 * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
13837 * else:
13838 * raise error
13839 */
13840 __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(1, 1263, __pyx_L1_error)
13841 __Pyx_GOTREF(__pyx_t_3);
13842 __Pyx_INCREF(__pyx_v_error);
13843 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
13844 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
13845 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
13846 if (likely(__pyx_t_5)) {
13847 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13848 __Pyx_INCREF(__pyx_t_5);
13849 __Pyx_INCREF(function);
13850 __Pyx_DECREF_SET(__pyx_t_4, function);
13851 }
13852 }
13853 __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);
13854 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13855 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13856 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
13857 __Pyx_GOTREF(__pyx_t_2);
13858 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13859 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13860 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13861 __PYX_ERR(1, 1263, __pyx_L1_error)
13862
13863 /* "View.MemoryView":1262
13864 * @cname('__pyx_memoryview_err')
13865 * cdef int _err(object error, char *msg) except -1 with gil:
13866 * if msg != NULL: # <<<<<<<<<<<<<<
13867 * raise error(msg.decode('ascii'))
13868 * else:
13869 */
13870 }
13871
13872 /* "View.MemoryView":1265
13873 * raise error(msg.decode('ascii'))
13874 * else:
13875 * raise error # <<<<<<<<<<<<<<
13876 *
13877 * @cname('__pyx_memoryview_copy_contents')
13878 */
13879 /*else*/ {
13880 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
13881 __PYX_ERR(1, 1265, __pyx_L1_error)
13882 }
13883
13884 /* "View.MemoryView":1261
13885 *
13886 * @cname('__pyx_memoryview_err')
13887 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
13888 * if msg != NULL:
13889 * raise error(msg.decode('ascii'))
13890 */
13891
13892 /* function exit code */
13893 __pyx_L1_error:;
13894 __Pyx_XDECREF(__pyx_t_2);
13895 __Pyx_XDECREF(__pyx_t_3);
13896 __Pyx_XDECREF(__pyx_t_4);
13897 __Pyx_XDECREF(__pyx_t_5);
13898 __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
13899 __pyx_r = -1;
13900 __Pyx_XDECREF(__pyx_v_error);
13901 __Pyx_RefNannyFinishContext();
13902 #ifdef WITH_THREAD
13903 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13904 #endif
13905 return __pyx_r;
13906 }
13907
13908 /* "View.MemoryView":1268
13909 *
13910 * @cname('__pyx_memoryview_copy_contents')
13911 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
13912 * __Pyx_memviewslice dst,
13913 * int src_ndim, int dst_ndim,
13914 */
13915
__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)13916 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) {
13917 void *__pyx_v_tmpdata;
13918 size_t __pyx_v_itemsize;
13919 int __pyx_v_i;
13920 char __pyx_v_order;
13921 int __pyx_v_broadcasting;
13922 int __pyx_v_direct_copy;
13923 __Pyx_memviewslice __pyx_v_tmp;
13924 int __pyx_v_ndim;
13925 int __pyx_r;
13926 Py_ssize_t __pyx_t_1;
13927 int __pyx_t_2;
13928 int __pyx_t_3;
13929 int __pyx_t_4;
13930 int __pyx_t_5;
13931 int __pyx_t_6;
13932 void *__pyx_t_7;
13933 int __pyx_t_8;
13934 int __pyx_lineno = 0;
13935 const char *__pyx_filename = NULL;
13936 int __pyx_clineno = 0;
13937
13938 /* "View.MemoryView":1276
13939 * Check for overlapping memory and verify the shapes.
13940 * """
13941 * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
13942 * cdef size_t itemsize = src.memview.view.itemsize
13943 * cdef int i
13944 */
13945 __pyx_v_tmpdata = NULL;
13946
13947 /* "View.MemoryView":1277
13948 * """
13949 * cdef void *tmpdata = NULL
13950 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
13951 * cdef int i
13952 * cdef char order = get_best_order(&src, src_ndim)
13953 */
13954 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
13955 __pyx_v_itemsize = __pyx_t_1;
13956
13957 /* "View.MemoryView":1279
13958 * cdef size_t itemsize = src.memview.view.itemsize
13959 * cdef int i
13960 * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
13961 * cdef bint broadcasting = False
13962 * cdef bint direct_copy = False
13963 */
13964 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
13965
13966 /* "View.MemoryView":1280
13967 * cdef int i
13968 * cdef char order = get_best_order(&src, src_ndim)
13969 * cdef bint broadcasting = False # <<<<<<<<<<<<<<
13970 * cdef bint direct_copy = False
13971 * cdef __Pyx_memviewslice tmp
13972 */
13973 __pyx_v_broadcasting = 0;
13974
13975 /* "View.MemoryView":1281
13976 * cdef char order = get_best_order(&src, src_ndim)
13977 * cdef bint broadcasting = False
13978 * cdef bint direct_copy = False # <<<<<<<<<<<<<<
13979 * cdef __Pyx_memviewslice tmp
13980 *
13981 */
13982 __pyx_v_direct_copy = 0;
13983
13984 /* "View.MemoryView":1284
13985 * cdef __Pyx_memviewslice tmp
13986 *
13987 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
13988 * broadcast_leading(&src, src_ndim, dst_ndim)
13989 * elif dst_ndim < src_ndim:
13990 */
13991 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
13992 if (__pyx_t_2) {
13993
13994 /* "View.MemoryView":1285
13995 *
13996 * if src_ndim < dst_ndim:
13997 * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
13998 * elif dst_ndim < src_ndim:
13999 * broadcast_leading(&dst, dst_ndim, src_ndim)
14000 */
14001 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
14002
14003 /* "View.MemoryView":1284
14004 * cdef __Pyx_memviewslice tmp
14005 *
14006 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
14007 * broadcast_leading(&src, src_ndim, dst_ndim)
14008 * elif dst_ndim < src_ndim:
14009 */
14010 goto __pyx_L3;
14011 }
14012
14013 /* "View.MemoryView":1286
14014 * if src_ndim < dst_ndim:
14015 * broadcast_leading(&src, src_ndim, dst_ndim)
14016 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
14017 * broadcast_leading(&dst, dst_ndim, src_ndim)
14018 *
14019 */
14020 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
14021 if (__pyx_t_2) {
14022
14023 /* "View.MemoryView":1287
14024 * broadcast_leading(&src, src_ndim, dst_ndim)
14025 * elif dst_ndim < src_ndim:
14026 * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
14027 *
14028 * cdef int ndim = max(src_ndim, dst_ndim)
14029 */
14030 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
14031
14032 /* "View.MemoryView":1286
14033 * if src_ndim < dst_ndim:
14034 * broadcast_leading(&src, src_ndim, dst_ndim)
14035 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
14036 * broadcast_leading(&dst, dst_ndim, src_ndim)
14037 *
14038 */
14039 }
14040 __pyx_L3:;
14041
14042 /* "View.MemoryView":1289
14043 * broadcast_leading(&dst, dst_ndim, src_ndim)
14044 *
14045 * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
14046 *
14047 * for i in range(ndim):
14048 */
14049 __pyx_t_3 = __pyx_v_dst_ndim;
14050 __pyx_t_4 = __pyx_v_src_ndim;
14051 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
14052 __pyx_t_5 = __pyx_t_3;
14053 } else {
14054 __pyx_t_5 = __pyx_t_4;
14055 }
14056 __pyx_v_ndim = __pyx_t_5;
14057
14058 /* "View.MemoryView":1291
14059 * cdef int ndim = max(src_ndim, dst_ndim)
14060 *
14061 * for i in range(ndim): # <<<<<<<<<<<<<<
14062 * if src.shape[i] != dst.shape[i]:
14063 * if src.shape[i] == 1:
14064 */
14065 __pyx_t_5 = __pyx_v_ndim;
14066 __pyx_t_3 = __pyx_t_5;
14067 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14068 __pyx_v_i = __pyx_t_4;
14069
14070 /* "View.MemoryView":1292
14071 *
14072 * for i in range(ndim):
14073 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
14074 * if src.shape[i] == 1:
14075 * broadcasting = True
14076 */
14077 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
14078 if (__pyx_t_2) {
14079
14080 /* "View.MemoryView":1293
14081 * for i in range(ndim):
14082 * if src.shape[i] != dst.shape[i]:
14083 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
14084 * broadcasting = True
14085 * src.strides[i] = 0
14086 */
14087 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
14088 if (__pyx_t_2) {
14089
14090 /* "View.MemoryView":1294
14091 * if src.shape[i] != dst.shape[i]:
14092 * if src.shape[i] == 1:
14093 * broadcasting = True # <<<<<<<<<<<<<<
14094 * src.strides[i] = 0
14095 * else:
14096 */
14097 __pyx_v_broadcasting = 1;
14098
14099 /* "View.MemoryView":1295
14100 * if src.shape[i] == 1:
14101 * broadcasting = True
14102 * src.strides[i] = 0 # <<<<<<<<<<<<<<
14103 * else:
14104 * _err_extents(i, dst.shape[i], src.shape[i])
14105 */
14106 (__pyx_v_src.strides[__pyx_v_i]) = 0;
14107
14108 /* "View.MemoryView":1293
14109 * for i in range(ndim):
14110 * if src.shape[i] != dst.shape[i]:
14111 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
14112 * broadcasting = True
14113 * src.strides[i] = 0
14114 */
14115 goto __pyx_L7;
14116 }
14117
14118 /* "View.MemoryView":1297
14119 * src.strides[i] = 0
14120 * else:
14121 * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
14122 *
14123 * if src.suboffsets[i] >= 0:
14124 */
14125 /*else*/ {
14126 __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(1, 1297, __pyx_L1_error)
14127 }
14128 __pyx_L7:;
14129
14130 /* "View.MemoryView":1292
14131 *
14132 * for i in range(ndim):
14133 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
14134 * if src.shape[i] == 1:
14135 * broadcasting = True
14136 */
14137 }
14138
14139 /* "View.MemoryView":1299
14140 * _err_extents(i, dst.shape[i], src.shape[i])
14141 *
14142 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
14143 * _err_dim(ValueError, "Dimension %d is not direct", i)
14144 *
14145 */
14146 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
14147 if (__pyx_t_2) {
14148
14149 /* "View.MemoryView":1300
14150 *
14151 * if src.suboffsets[i] >= 0:
14152 * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
14153 *
14154 * if slices_overlap(&src, &dst, ndim, itemsize):
14155 */
14156 __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(1, 1300, __pyx_L1_error)
14157
14158 /* "View.MemoryView":1299
14159 * _err_extents(i, dst.shape[i], src.shape[i])
14160 *
14161 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
14162 * _err_dim(ValueError, "Dimension %d is not direct", i)
14163 *
14164 */
14165 }
14166 }
14167
14168 /* "View.MemoryView":1302
14169 * _err_dim(ValueError, "Dimension %d is not direct", i)
14170 *
14171 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
14172 *
14173 * if not slice_is_contig(src, order, ndim):
14174 */
14175 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
14176 if (__pyx_t_2) {
14177
14178 /* "View.MemoryView":1304
14179 * if slices_overlap(&src, &dst, ndim, itemsize):
14180 *
14181 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
14182 * order = get_best_order(&dst, ndim)
14183 *
14184 */
14185 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
14186 if (__pyx_t_2) {
14187
14188 /* "View.MemoryView":1305
14189 *
14190 * if not slice_is_contig(src, order, ndim):
14191 * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
14192 *
14193 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
14194 */
14195 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
14196
14197 /* "View.MemoryView":1304
14198 * if slices_overlap(&src, &dst, ndim, itemsize):
14199 *
14200 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
14201 * order = get_best_order(&dst, ndim)
14202 *
14203 */
14204 }
14205
14206 /* "View.MemoryView":1307
14207 * order = get_best_order(&dst, ndim)
14208 *
14209 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
14210 * src = tmp
14211 *
14212 */
14213 __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(1, 1307, __pyx_L1_error)
14214 __pyx_v_tmpdata = __pyx_t_7;
14215
14216 /* "View.MemoryView":1308
14217 *
14218 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
14219 * src = tmp # <<<<<<<<<<<<<<
14220 *
14221 * if not broadcasting:
14222 */
14223 __pyx_v_src = __pyx_v_tmp;
14224
14225 /* "View.MemoryView":1302
14226 * _err_dim(ValueError, "Dimension %d is not direct", i)
14227 *
14228 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
14229 *
14230 * if not slice_is_contig(src, order, ndim):
14231 */
14232 }
14233
14234 /* "View.MemoryView":1310
14235 * src = tmp
14236 *
14237 * if not broadcasting: # <<<<<<<<<<<<<<
14238 *
14239 *
14240 */
14241 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
14242 if (__pyx_t_2) {
14243
14244 /* "View.MemoryView":1313
14245 *
14246 *
14247 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
14248 * direct_copy = slice_is_contig(dst, 'C', ndim)
14249 * elif slice_is_contig(src, 'F', ndim):
14250 */
14251 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
14252 if (__pyx_t_2) {
14253
14254 /* "View.MemoryView":1314
14255 *
14256 * if slice_is_contig(src, 'C', ndim):
14257 * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
14258 * elif slice_is_contig(src, 'F', ndim):
14259 * direct_copy = slice_is_contig(dst, 'F', ndim)
14260 */
14261 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
14262
14263 /* "View.MemoryView":1313
14264 *
14265 *
14266 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
14267 * direct_copy = slice_is_contig(dst, 'C', ndim)
14268 * elif slice_is_contig(src, 'F', ndim):
14269 */
14270 goto __pyx_L12;
14271 }
14272
14273 /* "View.MemoryView":1315
14274 * if slice_is_contig(src, 'C', ndim):
14275 * direct_copy = slice_is_contig(dst, 'C', ndim)
14276 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
14277 * direct_copy = slice_is_contig(dst, 'F', ndim)
14278 *
14279 */
14280 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
14281 if (__pyx_t_2) {
14282
14283 /* "View.MemoryView":1316
14284 * direct_copy = slice_is_contig(dst, 'C', ndim)
14285 * elif slice_is_contig(src, 'F', ndim):
14286 * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
14287 *
14288 * if direct_copy:
14289 */
14290 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
14291
14292 /* "View.MemoryView":1315
14293 * if slice_is_contig(src, 'C', ndim):
14294 * direct_copy = slice_is_contig(dst, 'C', ndim)
14295 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
14296 * direct_copy = slice_is_contig(dst, 'F', ndim)
14297 *
14298 */
14299 }
14300 __pyx_L12:;
14301
14302 /* "View.MemoryView":1318
14303 * direct_copy = slice_is_contig(dst, 'F', ndim)
14304 *
14305 * if direct_copy: # <<<<<<<<<<<<<<
14306 *
14307 * refcount_copying(&dst, dtype_is_object, ndim, False)
14308 */
14309 __pyx_t_2 = (__pyx_v_direct_copy != 0);
14310 if (__pyx_t_2) {
14311
14312 /* "View.MemoryView":1320
14313 * if direct_copy:
14314 *
14315 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
14316 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
14317 * refcount_copying(&dst, dtype_is_object, ndim, True)
14318 */
14319 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
14320
14321 /* "View.MemoryView":1321
14322 *
14323 * refcount_copying(&dst, dtype_is_object, ndim, False)
14324 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
14325 * refcount_copying(&dst, dtype_is_object, ndim, True)
14326 * free(tmpdata)
14327 */
14328 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
14329
14330 /* "View.MemoryView":1322
14331 * refcount_copying(&dst, dtype_is_object, ndim, False)
14332 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
14333 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
14334 * free(tmpdata)
14335 * return 0
14336 */
14337 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
14338
14339 /* "View.MemoryView":1323
14340 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
14341 * refcount_copying(&dst, dtype_is_object, ndim, True)
14342 * free(tmpdata) # <<<<<<<<<<<<<<
14343 * return 0
14344 *
14345 */
14346 free(__pyx_v_tmpdata);
14347
14348 /* "View.MemoryView":1324
14349 * refcount_copying(&dst, dtype_is_object, ndim, True)
14350 * free(tmpdata)
14351 * return 0 # <<<<<<<<<<<<<<
14352 *
14353 * if order == 'F' == get_best_order(&dst, ndim):
14354 */
14355 __pyx_r = 0;
14356 goto __pyx_L0;
14357
14358 /* "View.MemoryView":1318
14359 * direct_copy = slice_is_contig(dst, 'F', ndim)
14360 *
14361 * if direct_copy: # <<<<<<<<<<<<<<
14362 *
14363 * refcount_copying(&dst, dtype_is_object, ndim, False)
14364 */
14365 }
14366
14367 /* "View.MemoryView":1310
14368 * src = tmp
14369 *
14370 * if not broadcasting: # <<<<<<<<<<<<<<
14371 *
14372 *
14373 */
14374 }
14375
14376 /* "View.MemoryView":1326
14377 * return 0
14378 *
14379 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
14380 *
14381 *
14382 */
14383 __pyx_t_2 = (__pyx_v_order == 'F');
14384 if (__pyx_t_2) {
14385 __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
14386 }
14387 __pyx_t_8 = (__pyx_t_2 != 0);
14388 if (__pyx_t_8) {
14389
14390 /* "View.MemoryView":1329
14391 *
14392 *
14393 * transpose_memslice(&src) # <<<<<<<<<<<<<<
14394 * transpose_memslice(&dst)
14395 *
14396 */
14397 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
14398
14399 /* "View.MemoryView":1330
14400 *
14401 * transpose_memslice(&src)
14402 * transpose_memslice(&dst) # <<<<<<<<<<<<<<
14403 *
14404 * refcount_copying(&dst, dtype_is_object, ndim, False)
14405 */
14406 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
14407
14408 /* "View.MemoryView":1326
14409 * return 0
14410 *
14411 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
14412 *
14413 *
14414 */
14415 }
14416
14417 /* "View.MemoryView":1332
14418 * transpose_memslice(&dst)
14419 *
14420 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
14421 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
14422 * refcount_copying(&dst, dtype_is_object, ndim, True)
14423 */
14424 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
14425
14426 /* "View.MemoryView":1333
14427 *
14428 * refcount_copying(&dst, dtype_is_object, ndim, False)
14429 * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
14430 * refcount_copying(&dst, dtype_is_object, ndim, True)
14431 *
14432 */
14433 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
14434
14435 /* "View.MemoryView":1334
14436 * refcount_copying(&dst, dtype_is_object, ndim, False)
14437 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
14438 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
14439 *
14440 * free(tmpdata)
14441 */
14442 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
14443
14444 /* "View.MemoryView":1336
14445 * refcount_copying(&dst, dtype_is_object, ndim, True)
14446 *
14447 * free(tmpdata) # <<<<<<<<<<<<<<
14448 * return 0
14449 *
14450 */
14451 free(__pyx_v_tmpdata);
14452
14453 /* "View.MemoryView":1337
14454 *
14455 * free(tmpdata)
14456 * return 0 # <<<<<<<<<<<<<<
14457 *
14458 * @cname('__pyx_memoryview_broadcast_leading')
14459 */
14460 __pyx_r = 0;
14461 goto __pyx_L0;
14462
14463 /* "View.MemoryView":1268
14464 *
14465 * @cname('__pyx_memoryview_copy_contents')
14466 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
14467 * __Pyx_memviewslice dst,
14468 * int src_ndim, int dst_ndim,
14469 */
14470
14471 /* function exit code */
14472 __pyx_L1_error:;
14473 {
14474 #ifdef WITH_THREAD
14475 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14476 #endif
14477 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
14478 #ifdef WITH_THREAD
14479 __Pyx_PyGILState_Release(__pyx_gilstate_save);
14480 #endif
14481 }
14482 __pyx_r = -1;
14483 __pyx_L0:;
14484 return __pyx_r;
14485 }
14486
14487 /* "View.MemoryView":1340
14488 *
14489 * @cname('__pyx_memoryview_broadcast_leading')
14490 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
14491 * int ndim,
14492 * int ndim_other) nogil:
14493 */
14494
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)14495 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
14496 int __pyx_v_i;
14497 int __pyx_v_offset;
14498 int __pyx_t_1;
14499 int __pyx_t_2;
14500 int __pyx_t_3;
14501
14502 /* "View.MemoryView":1344
14503 * int ndim_other) nogil:
14504 * cdef int i
14505 * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
14506 *
14507 * for i in range(ndim - 1, -1, -1):
14508 */
14509 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
14510
14511 /* "View.MemoryView":1346
14512 * cdef int offset = ndim_other - ndim
14513 *
14514 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
14515 * mslice.shape[i + offset] = mslice.shape[i]
14516 * mslice.strides[i + offset] = mslice.strides[i]
14517 */
14518 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
14519 __pyx_v_i = __pyx_t_1;
14520
14521 /* "View.MemoryView":1347
14522 *
14523 * for i in range(ndim - 1, -1, -1):
14524 * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
14525 * mslice.strides[i + offset] = mslice.strides[i]
14526 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
14527 */
14528 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
14529
14530 /* "View.MemoryView":1348
14531 * for i in range(ndim - 1, -1, -1):
14532 * mslice.shape[i + offset] = mslice.shape[i]
14533 * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
14534 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
14535 *
14536 */
14537 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
14538
14539 /* "View.MemoryView":1349
14540 * mslice.shape[i + offset] = mslice.shape[i]
14541 * mslice.strides[i + offset] = mslice.strides[i]
14542 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
14543 *
14544 * for i in range(offset):
14545 */
14546 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
14547 }
14548
14549 /* "View.MemoryView":1351
14550 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
14551 *
14552 * for i in range(offset): # <<<<<<<<<<<<<<
14553 * mslice.shape[i] = 1
14554 * mslice.strides[i] = mslice.strides[0]
14555 */
14556 __pyx_t_1 = __pyx_v_offset;
14557 __pyx_t_2 = __pyx_t_1;
14558 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14559 __pyx_v_i = __pyx_t_3;
14560
14561 /* "View.MemoryView":1352
14562 *
14563 * for i in range(offset):
14564 * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
14565 * mslice.strides[i] = mslice.strides[0]
14566 * mslice.suboffsets[i] = -1
14567 */
14568 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
14569
14570 /* "View.MemoryView":1353
14571 * for i in range(offset):
14572 * mslice.shape[i] = 1
14573 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
14574 * mslice.suboffsets[i] = -1
14575 *
14576 */
14577 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
14578
14579 /* "View.MemoryView":1354
14580 * mslice.shape[i] = 1
14581 * mslice.strides[i] = mslice.strides[0]
14582 * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
14583 *
14584 *
14585 */
14586 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
14587 }
14588
14589 /* "View.MemoryView":1340
14590 *
14591 * @cname('__pyx_memoryview_broadcast_leading')
14592 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
14593 * int ndim,
14594 * int ndim_other) nogil:
14595 */
14596
14597 /* function exit code */
14598 }
14599
14600 /* "View.MemoryView":1362
14601 *
14602 * @cname('__pyx_memoryview_refcount_copying')
14603 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
14604 * int ndim, bint inc) nogil:
14605 *
14606 */
14607
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)14608 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) {
14609 int __pyx_t_1;
14610
14611 /* "View.MemoryView":1366
14612 *
14613 *
14614 * if dtype_is_object: # <<<<<<<<<<<<<<
14615 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
14616 * dst.strides, ndim, inc)
14617 */
14618 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
14619 if (__pyx_t_1) {
14620
14621 /* "View.MemoryView":1367
14622 *
14623 * if dtype_is_object:
14624 * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
14625 * dst.strides, ndim, inc)
14626 *
14627 */
14628 __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);
14629
14630 /* "View.MemoryView":1366
14631 *
14632 *
14633 * if dtype_is_object: # <<<<<<<<<<<<<<
14634 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
14635 * dst.strides, ndim, inc)
14636 */
14637 }
14638
14639 /* "View.MemoryView":1362
14640 *
14641 * @cname('__pyx_memoryview_refcount_copying')
14642 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
14643 * int ndim, bint inc) nogil:
14644 *
14645 */
14646
14647 /* function exit code */
14648 }
14649
14650 /* "View.MemoryView":1371
14651 *
14652 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
14653 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14654 * Py_ssize_t *strides, int ndim,
14655 * bint inc) with gil:
14656 */
14657
__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)14658 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) {
14659 __Pyx_RefNannyDeclarations
14660 #ifdef WITH_THREAD
14661 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14662 #endif
14663 __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
14664
14665 /* "View.MemoryView":1374
14666 * Py_ssize_t *strides, int ndim,
14667 * bint inc) with gil:
14668 * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
14669 *
14670 * @cname('__pyx_memoryview_refcount_objects_in_slice')
14671 */
14672 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
14673
14674 /* "View.MemoryView":1371
14675 *
14676 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
14677 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14678 * Py_ssize_t *strides, int ndim,
14679 * bint inc) with gil:
14680 */
14681
14682 /* function exit code */
14683 __Pyx_RefNannyFinishContext();
14684 #ifdef WITH_THREAD
14685 __Pyx_PyGILState_Release(__pyx_gilstate_save);
14686 #endif
14687 }
14688
14689 /* "View.MemoryView":1377
14690 *
14691 * @cname('__pyx_memoryview_refcount_objects_in_slice')
14692 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14693 * Py_ssize_t *strides, int ndim, bint inc):
14694 * cdef Py_ssize_t i
14695 */
14696
__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)14697 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) {
14698 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
14699 __Pyx_RefNannyDeclarations
14700 Py_ssize_t __pyx_t_1;
14701 Py_ssize_t __pyx_t_2;
14702 Py_ssize_t __pyx_t_3;
14703 int __pyx_t_4;
14704 __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
14705
14706 /* "View.MemoryView":1381
14707 * cdef Py_ssize_t i
14708 *
14709 * for i in range(shape[0]): # <<<<<<<<<<<<<<
14710 * if ndim == 1:
14711 * if inc:
14712 */
14713 __pyx_t_1 = (__pyx_v_shape[0]);
14714 __pyx_t_2 = __pyx_t_1;
14715 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14716 __pyx_v_i = __pyx_t_3;
14717
14718 /* "View.MemoryView":1382
14719 *
14720 * for i in range(shape[0]):
14721 * if ndim == 1: # <<<<<<<<<<<<<<
14722 * if inc:
14723 * Py_INCREF((<PyObject **> data)[0])
14724 */
14725 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
14726 if (__pyx_t_4) {
14727
14728 /* "View.MemoryView":1383
14729 * for i in range(shape[0]):
14730 * if ndim == 1:
14731 * if inc: # <<<<<<<<<<<<<<
14732 * Py_INCREF((<PyObject **> data)[0])
14733 * else:
14734 */
14735 __pyx_t_4 = (__pyx_v_inc != 0);
14736 if (__pyx_t_4) {
14737
14738 /* "View.MemoryView":1384
14739 * if ndim == 1:
14740 * if inc:
14741 * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
14742 * else:
14743 * Py_DECREF((<PyObject **> data)[0])
14744 */
14745 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
14746
14747 /* "View.MemoryView":1383
14748 * for i in range(shape[0]):
14749 * if ndim == 1:
14750 * if inc: # <<<<<<<<<<<<<<
14751 * Py_INCREF((<PyObject **> data)[0])
14752 * else:
14753 */
14754 goto __pyx_L6;
14755 }
14756
14757 /* "View.MemoryView":1386
14758 * Py_INCREF((<PyObject **> data)[0])
14759 * else:
14760 * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
14761 * else:
14762 * refcount_objects_in_slice(data, shape + 1, strides + 1,
14763 */
14764 /*else*/ {
14765 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
14766 }
14767 __pyx_L6:;
14768
14769 /* "View.MemoryView":1382
14770 *
14771 * for i in range(shape[0]):
14772 * if ndim == 1: # <<<<<<<<<<<<<<
14773 * if inc:
14774 * Py_INCREF((<PyObject **> data)[0])
14775 */
14776 goto __pyx_L5;
14777 }
14778
14779 /* "View.MemoryView":1388
14780 * Py_DECREF((<PyObject **> data)[0])
14781 * else:
14782 * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
14783 * ndim - 1, inc)
14784 *
14785 */
14786 /*else*/ {
14787
14788 /* "View.MemoryView":1389
14789 * else:
14790 * refcount_objects_in_slice(data, shape + 1, strides + 1,
14791 * ndim - 1, inc) # <<<<<<<<<<<<<<
14792 *
14793 * data += strides[0]
14794 */
14795 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
14796 }
14797 __pyx_L5:;
14798
14799 /* "View.MemoryView":1391
14800 * ndim - 1, inc)
14801 *
14802 * data += strides[0] # <<<<<<<<<<<<<<
14803 *
14804 *
14805 */
14806 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
14807 }
14808
14809 /* "View.MemoryView":1377
14810 *
14811 * @cname('__pyx_memoryview_refcount_objects_in_slice')
14812 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14813 * Py_ssize_t *strides, int ndim, bint inc):
14814 * cdef Py_ssize_t i
14815 */
14816
14817 /* function exit code */
14818 __Pyx_RefNannyFinishContext();
14819 }
14820
14821 /* "View.MemoryView":1397
14822 *
14823 * @cname('__pyx_memoryview_slice_assign_scalar')
14824 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
14825 * size_t itemsize, void *item,
14826 * bint dtype_is_object) nogil:
14827 */
14828
__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)14829 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) {
14830
14831 /* "View.MemoryView":1400
14832 * size_t itemsize, void *item,
14833 * bint dtype_is_object) nogil:
14834 * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
14835 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
14836 * itemsize, item)
14837 */
14838 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
14839
14840 /* "View.MemoryView":1401
14841 * bint dtype_is_object) nogil:
14842 * refcount_copying(dst, dtype_is_object, ndim, False)
14843 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
14844 * itemsize, item)
14845 * refcount_copying(dst, dtype_is_object, ndim, True)
14846 */
14847 __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);
14848
14849 /* "View.MemoryView":1403
14850 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
14851 * itemsize, item)
14852 * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
14853 *
14854 *
14855 */
14856 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
14857
14858 /* "View.MemoryView":1397
14859 *
14860 * @cname('__pyx_memoryview_slice_assign_scalar')
14861 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
14862 * size_t itemsize, void *item,
14863 * bint dtype_is_object) nogil:
14864 */
14865
14866 /* function exit code */
14867 }
14868
14869 /* "View.MemoryView":1407
14870 *
14871 * @cname('__pyx_memoryview__slice_assign_scalar')
14872 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14873 * Py_ssize_t *strides, int ndim,
14874 * size_t itemsize, void *item) nogil:
14875 */
14876
__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)14877 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) {
14878 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
14879 Py_ssize_t __pyx_v_stride;
14880 Py_ssize_t __pyx_v_extent;
14881 int __pyx_t_1;
14882 Py_ssize_t __pyx_t_2;
14883 Py_ssize_t __pyx_t_3;
14884 Py_ssize_t __pyx_t_4;
14885
14886 /* "View.MemoryView":1411
14887 * size_t itemsize, void *item) nogil:
14888 * cdef Py_ssize_t i
14889 * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
14890 * cdef Py_ssize_t extent = shape[0]
14891 *
14892 */
14893 __pyx_v_stride = (__pyx_v_strides[0]);
14894
14895 /* "View.MemoryView":1412
14896 * cdef Py_ssize_t i
14897 * cdef Py_ssize_t stride = strides[0]
14898 * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
14899 *
14900 * if ndim == 1:
14901 */
14902 __pyx_v_extent = (__pyx_v_shape[0]);
14903
14904 /* "View.MemoryView":1414
14905 * cdef Py_ssize_t extent = shape[0]
14906 *
14907 * if ndim == 1: # <<<<<<<<<<<<<<
14908 * for i in range(extent):
14909 * memcpy(data, item, itemsize)
14910 */
14911 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
14912 if (__pyx_t_1) {
14913
14914 /* "View.MemoryView":1415
14915 *
14916 * if ndim == 1:
14917 * for i in range(extent): # <<<<<<<<<<<<<<
14918 * memcpy(data, item, itemsize)
14919 * data += stride
14920 */
14921 __pyx_t_2 = __pyx_v_extent;
14922 __pyx_t_3 = __pyx_t_2;
14923 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14924 __pyx_v_i = __pyx_t_4;
14925
14926 /* "View.MemoryView":1416
14927 * if ndim == 1:
14928 * for i in range(extent):
14929 * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
14930 * data += stride
14931 * else:
14932 */
14933 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
14934
14935 /* "View.MemoryView":1417
14936 * for i in range(extent):
14937 * memcpy(data, item, itemsize)
14938 * data += stride # <<<<<<<<<<<<<<
14939 * else:
14940 * for i in range(extent):
14941 */
14942 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
14943 }
14944
14945 /* "View.MemoryView":1414
14946 * cdef Py_ssize_t extent = shape[0]
14947 *
14948 * if ndim == 1: # <<<<<<<<<<<<<<
14949 * for i in range(extent):
14950 * memcpy(data, item, itemsize)
14951 */
14952 goto __pyx_L3;
14953 }
14954
14955 /* "View.MemoryView":1419
14956 * data += stride
14957 * else:
14958 * for i in range(extent): # <<<<<<<<<<<<<<
14959 * _slice_assign_scalar(data, shape + 1, strides + 1,
14960 * ndim - 1, itemsize, item)
14961 */
14962 /*else*/ {
14963 __pyx_t_2 = __pyx_v_extent;
14964 __pyx_t_3 = __pyx_t_2;
14965 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14966 __pyx_v_i = __pyx_t_4;
14967
14968 /* "View.MemoryView":1420
14969 * else:
14970 * for i in range(extent):
14971 * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
14972 * ndim - 1, itemsize, item)
14973 * data += stride
14974 */
14975 __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);
14976
14977 /* "View.MemoryView":1422
14978 * _slice_assign_scalar(data, shape + 1, strides + 1,
14979 * ndim - 1, itemsize, item)
14980 * data += stride # <<<<<<<<<<<<<<
14981 *
14982 *
14983 */
14984 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
14985 }
14986 }
14987 __pyx_L3:;
14988
14989 /* "View.MemoryView":1407
14990 *
14991 * @cname('__pyx_memoryview__slice_assign_scalar')
14992 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
14993 * Py_ssize_t *strides, int ndim,
14994 * size_t itemsize, void *item) nogil:
14995 */
14996
14997 /* function exit code */
14998 }
14999
15000 /* "(tree fragment)":1
15001 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
15002 * cdef object __pyx_PickleError
15003 * cdef object __pyx_result
15004 */
15005
15006 /* Python wrapper */
15007 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15008 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)15009 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15010 PyObject *__pyx_v___pyx_type = 0;
15011 long __pyx_v___pyx_checksum;
15012 PyObject *__pyx_v___pyx_state = 0;
15013 int __pyx_lineno = 0;
15014 const char *__pyx_filename = NULL;
15015 int __pyx_clineno = 0;
15016 PyObject *__pyx_r = 0;
15017 __Pyx_RefNannyDeclarations
15018 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
15019 {
15020 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
15021 PyObject* values[3] = {0,0,0};
15022 if (unlikely(__pyx_kwds)) {
15023 Py_ssize_t kw_args;
15024 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15025 switch (pos_args) {
15026 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15027 CYTHON_FALLTHROUGH;
15028 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15029 CYTHON_FALLTHROUGH;
15030 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15031 CYTHON_FALLTHROUGH;
15032 case 0: break;
15033 default: goto __pyx_L5_argtuple_error;
15034 }
15035 kw_args = PyDict_Size(__pyx_kwds);
15036 switch (pos_args) {
15037 case 0:
15038 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
15039 else goto __pyx_L5_argtuple_error;
15040 CYTHON_FALLTHROUGH;
15041 case 1:
15042 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
15043 else {
15044 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
15045 }
15046 CYTHON_FALLTHROUGH;
15047 case 2:
15048 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
15049 else {
15050 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
15051 }
15052 }
15053 if (unlikely(kw_args > 0)) {
15054 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
15055 }
15056 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
15057 goto __pyx_L5_argtuple_error;
15058 } else {
15059 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15060 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15061 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15062 }
15063 __pyx_v___pyx_type = values[0];
15064 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
15065 __pyx_v___pyx_state = values[2];
15066 }
15067 goto __pyx_L4_argument_unpacking_done;
15068 __pyx_L5_argtuple_error:;
15069 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
15070 __pyx_L3_error:;
15071 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
15072 __Pyx_RefNannyFinishContext();
15073 return NULL;
15074 __pyx_L4_argument_unpacking_done:;
15075 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
15076
15077 /* function exit code */
15078 __Pyx_RefNannyFinishContext();
15079 return __pyx_r;
15080 }
15081
__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)15082 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) {
15083 PyObject *__pyx_v___pyx_PickleError = 0;
15084 PyObject *__pyx_v___pyx_result = 0;
15085 PyObject *__pyx_r = NULL;
15086 __Pyx_RefNannyDeclarations
15087 int __pyx_t_1;
15088 PyObject *__pyx_t_2 = NULL;
15089 PyObject *__pyx_t_3 = NULL;
15090 PyObject *__pyx_t_4 = NULL;
15091 PyObject *__pyx_t_5 = NULL;
15092 int __pyx_t_6;
15093 int __pyx_lineno = 0;
15094 const char *__pyx_filename = NULL;
15095 int __pyx_clineno = 0;
15096 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
15097
15098 /* "(tree fragment)":4
15099 * cdef object __pyx_PickleError
15100 * cdef object __pyx_result
15101 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
15102 * from pickle import PickleError as __pyx_PickleError
15103 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15104 */
15105 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
15106 if (__pyx_t_1) {
15107
15108 /* "(tree fragment)":5
15109 * cdef object __pyx_result
15110 * if __pyx_checksum != 0xb068931:
15111 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
15112 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15113 * __pyx_result = Enum.__new__(__pyx_type)
15114 */
15115 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
15116 __Pyx_GOTREF(__pyx_t_2);
15117 __Pyx_INCREF(__pyx_n_s_PickleError);
15118 __Pyx_GIVEREF(__pyx_n_s_PickleError);
15119 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
15120 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
15121 __Pyx_GOTREF(__pyx_t_3);
15122 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15123 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
15124 __Pyx_GOTREF(__pyx_t_2);
15125 __Pyx_INCREF(__pyx_t_2);
15126 __pyx_v___pyx_PickleError = __pyx_t_2;
15127 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15128 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15129
15130 /* "(tree fragment)":6
15131 * if __pyx_checksum != 0xb068931:
15132 * from pickle import PickleError as __pyx_PickleError
15133 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
15134 * __pyx_result = Enum.__new__(__pyx_type)
15135 * if __pyx_state is not None:
15136 */
15137 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
15138 __Pyx_GOTREF(__pyx_t_2);
15139 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
15140 __Pyx_GOTREF(__pyx_t_4);
15141 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15142 __Pyx_INCREF(__pyx_v___pyx_PickleError);
15143 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
15144 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
15145 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
15146 if (likely(__pyx_t_5)) {
15147 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15148 __Pyx_INCREF(__pyx_t_5);
15149 __Pyx_INCREF(function);
15150 __Pyx_DECREF_SET(__pyx_t_2, function);
15151 }
15152 }
15153 __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);
15154 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15155 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15156 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
15157 __Pyx_GOTREF(__pyx_t_3);
15158 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15159 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15160 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15161 __PYX_ERR(1, 6, __pyx_L1_error)
15162
15163 /* "(tree fragment)":4
15164 * cdef object __pyx_PickleError
15165 * cdef object __pyx_result
15166 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
15167 * from pickle import PickleError as __pyx_PickleError
15168 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15169 */
15170 }
15171
15172 /* "(tree fragment)":7
15173 * from pickle import PickleError as __pyx_PickleError
15174 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15175 * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
15176 * if __pyx_state is not None:
15177 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15178 */
15179 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
15180 __Pyx_GOTREF(__pyx_t_2);
15181 __pyx_t_4 = NULL;
15182 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
15183 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
15184 if (likely(__pyx_t_4)) {
15185 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15186 __Pyx_INCREF(__pyx_t_4);
15187 __Pyx_INCREF(function);
15188 __Pyx_DECREF_SET(__pyx_t_2, function);
15189 }
15190 }
15191 __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);
15192 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15193 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
15194 __Pyx_GOTREF(__pyx_t_3);
15195 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15196 __pyx_v___pyx_result = __pyx_t_3;
15197 __pyx_t_3 = 0;
15198
15199 /* "(tree fragment)":8
15200 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15201 * __pyx_result = Enum.__new__(__pyx_type)
15202 * if __pyx_state is not None: # <<<<<<<<<<<<<<
15203 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15204 * return __pyx_result
15205 */
15206 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
15207 __pyx_t_6 = (__pyx_t_1 != 0);
15208 if (__pyx_t_6) {
15209
15210 /* "(tree fragment)":9
15211 * __pyx_result = Enum.__new__(__pyx_type)
15212 * if __pyx_state is not None:
15213 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
15214 * return __pyx_result
15215 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
15216 */
15217 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
15218 __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(1, 9, __pyx_L1_error)
15219 __Pyx_GOTREF(__pyx_t_3);
15220 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15221
15222 /* "(tree fragment)":8
15223 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
15224 * __pyx_result = Enum.__new__(__pyx_type)
15225 * if __pyx_state is not None: # <<<<<<<<<<<<<<
15226 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15227 * return __pyx_result
15228 */
15229 }
15230
15231 /* "(tree fragment)":10
15232 * if __pyx_state is not None:
15233 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15234 * return __pyx_result # <<<<<<<<<<<<<<
15235 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
15236 * __pyx_result.name = __pyx_state[0]
15237 */
15238 __Pyx_XDECREF(__pyx_r);
15239 __Pyx_INCREF(__pyx_v___pyx_result);
15240 __pyx_r = __pyx_v___pyx_result;
15241 goto __pyx_L0;
15242
15243 /* "(tree fragment)":1
15244 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
15245 * cdef object __pyx_PickleError
15246 * cdef object __pyx_result
15247 */
15248
15249 /* function exit code */
15250 __pyx_L1_error:;
15251 __Pyx_XDECREF(__pyx_t_2);
15252 __Pyx_XDECREF(__pyx_t_3);
15253 __Pyx_XDECREF(__pyx_t_4);
15254 __Pyx_XDECREF(__pyx_t_5);
15255 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
15256 __pyx_r = NULL;
15257 __pyx_L0:;
15258 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
15259 __Pyx_XDECREF(__pyx_v___pyx_result);
15260 __Pyx_XGIVEREF(__pyx_r);
15261 __Pyx_RefNannyFinishContext();
15262 return __pyx_r;
15263 }
15264
15265 /* "(tree fragment)":11
15266 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15267 * return __pyx_result
15268 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
15269 * __pyx_result.name = __pyx_state[0]
15270 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
15271 */
15272
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)15273 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
15274 PyObject *__pyx_r = NULL;
15275 __Pyx_RefNannyDeclarations
15276 PyObject *__pyx_t_1 = NULL;
15277 int __pyx_t_2;
15278 Py_ssize_t __pyx_t_3;
15279 int __pyx_t_4;
15280 int __pyx_t_5;
15281 PyObject *__pyx_t_6 = NULL;
15282 PyObject *__pyx_t_7 = NULL;
15283 PyObject *__pyx_t_8 = NULL;
15284 int __pyx_lineno = 0;
15285 const char *__pyx_filename = NULL;
15286 int __pyx_clineno = 0;
15287 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
15288
15289 /* "(tree fragment)":12
15290 * return __pyx_result
15291 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
15292 * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
15293 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
15294 * __pyx_result.__dict__.update(__pyx_state[1])
15295 */
15296 if (unlikely(__pyx_v___pyx_state == Py_None)) {
15297 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15298 __PYX_ERR(1, 12, __pyx_L1_error)
15299 }
15300 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
15301 __Pyx_GOTREF(__pyx_t_1);
15302 __Pyx_GIVEREF(__pyx_t_1);
15303 __Pyx_GOTREF(__pyx_v___pyx_result->name);
15304 __Pyx_DECREF(__pyx_v___pyx_result->name);
15305 __pyx_v___pyx_result->name = __pyx_t_1;
15306 __pyx_t_1 = 0;
15307
15308 /* "(tree fragment)":13
15309 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
15310 * __pyx_result.name = __pyx_state[0]
15311 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
15312 * __pyx_result.__dict__.update(__pyx_state[1])
15313 */
15314 if (unlikely(__pyx_v___pyx_state == Py_None)) {
15315 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
15316 __PYX_ERR(1, 13, __pyx_L1_error)
15317 }
15318 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
15319 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
15320 if (__pyx_t_4) {
15321 } else {
15322 __pyx_t_2 = __pyx_t_4;
15323 goto __pyx_L4_bool_binop_done;
15324 }
15325 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
15326 __pyx_t_5 = (__pyx_t_4 != 0);
15327 __pyx_t_2 = __pyx_t_5;
15328 __pyx_L4_bool_binop_done:;
15329 if (__pyx_t_2) {
15330
15331 /* "(tree fragment)":14
15332 * __pyx_result.name = __pyx_state[0]
15333 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
15334 * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
15335 */
15336 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
15337 __Pyx_GOTREF(__pyx_t_6);
15338 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
15339 __Pyx_GOTREF(__pyx_t_7);
15340 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15341 if (unlikely(__pyx_v___pyx_state == Py_None)) {
15342 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15343 __PYX_ERR(1, 14, __pyx_L1_error)
15344 }
15345 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
15346 __Pyx_GOTREF(__pyx_t_6);
15347 __pyx_t_8 = NULL;
15348 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
15349 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
15350 if (likely(__pyx_t_8)) {
15351 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
15352 __Pyx_INCREF(__pyx_t_8);
15353 __Pyx_INCREF(function);
15354 __Pyx_DECREF_SET(__pyx_t_7, function);
15355 }
15356 }
15357 __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);
15358 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
15359 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15360 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
15361 __Pyx_GOTREF(__pyx_t_1);
15362 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15363 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15364
15365 /* "(tree fragment)":13
15366 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
15367 * __pyx_result.name = __pyx_state[0]
15368 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
15369 * __pyx_result.__dict__.update(__pyx_state[1])
15370 */
15371 }
15372
15373 /* "(tree fragment)":11
15374 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
15375 * return __pyx_result
15376 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
15377 * __pyx_result.name = __pyx_state[0]
15378 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
15379 */
15380
15381 /* function exit code */
15382 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15383 goto __pyx_L0;
15384 __pyx_L1_error:;
15385 __Pyx_XDECREF(__pyx_t_1);
15386 __Pyx_XDECREF(__pyx_t_6);
15387 __Pyx_XDECREF(__pyx_t_7);
15388 __Pyx_XDECREF(__pyx_t_8);
15389 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
15390 __pyx_r = 0;
15391 __pyx_L0:;
15392 __Pyx_XGIVEREF(__pyx_r);
15393 __Pyx_RefNannyFinishContext();
15394 return __pyx_r;
15395 }
15396 static struct __pyx_vtabstruct_array __pyx_vtable_array;
15397
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)15398 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
15399 struct __pyx_array_obj *p;
15400 PyObject *o;
15401 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
15402 o = (*t->tp_alloc)(t, 0);
15403 } else {
15404 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
15405 }
15406 if (unlikely(!o)) return 0;
15407 p = ((struct __pyx_array_obj *)o);
15408 p->__pyx_vtab = __pyx_vtabptr_array;
15409 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
15410 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
15411 if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
15412 return o;
15413 bad:
15414 Py_DECREF(o); o = 0;
15415 return NULL;
15416 }
15417
__pyx_tp_dealloc_array(PyObject * o)15418 static void __pyx_tp_dealloc_array(PyObject *o) {
15419 struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
15420 #if CYTHON_USE_TP_FINALIZE
15421 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))) {
15422 if (PyObject_CallFinalizerFromDealloc(o)) return;
15423 }
15424 #endif
15425 {
15426 PyObject *etype, *eval, *etb;
15427 PyErr_Fetch(&etype, &eval, &etb);
15428 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
15429 __pyx_array___dealloc__(o);
15430 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
15431 PyErr_Restore(etype, eval, etb);
15432 }
15433 Py_CLEAR(p->mode);
15434 Py_CLEAR(p->_format);
15435 (*Py_TYPE(o)->tp_free)(o);
15436 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)15437 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
15438 PyObject *r;
15439 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
15440 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
15441 Py_DECREF(x);
15442 return r;
15443 }
15444
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)15445 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
15446 if (v) {
15447 return __pyx_array___setitem__(o, i, v);
15448 }
15449 else {
15450 PyErr_Format(PyExc_NotImplementedError,
15451 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
15452 return -1;
15453 }
15454 }
15455
__pyx_tp_getattro_array(PyObject * o,PyObject * n)15456 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
15457 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
15458 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
15459 PyErr_Clear();
15460 v = __pyx_array___getattr__(o, n);
15461 }
15462 return v;
15463 }
15464
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)15465 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
15466 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
15467 }
15468
15469 static PyMethodDef __pyx_methods_array[] = {
15470 {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
15471 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
15472 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
15473 {0, 0, 0, 0}
15474 };
15475
15476 static struct PyGetSetDef __pyx_getsets_array[] = {
15477 {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
15478 {0, 0, 0, 0, 0}
15479 };
15480
15481 static PySequenceMethods __pyx_tp_as_sequence_array = {
15482 __pyx_array___len__, /*sq_length*/
15483 0, /*sq_concat*/
15484 0, /*sq_repeat*/
15485 __pyx_sq_item_array, /*sq_item*/
15486 0, /*sq_slice*/
15487 0, /*sq_ass_item*/
15488 0, /*sq_ass_slice*/
15489 0, /*sq_contains*/
15490 0, /*sq_inplace_concat*/
15491 0, /*sq_inplace_repeat*/
15492 };
15493
15494 static PyMappingMethods __pyx_tp_as_mapping_array = {
15495 __pyx_array___len__, /*mp_length*/
15496 __pyx_array___getitem__, /*mp_subscript*/
15497 __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
15498 };
15499
15500 static PyBufferProcs __pyx_tp_as_buffer_array = {
15501 #if PY_MAJOR_VERSION < 3
15502 0, /*bf_getreadbuffer*/
15503 #endif
15504 #if PY_MAJOR_VERSION < 3
15505 0, /*bf_getwritebuffer*/
15506 #endif
15507 #if PY_MAJOR_VERSION < 3
15508 0, /*bf_getsegcount*/
15509 #endif
15510 #if PY_MAJOR_VERSION < 3
15511 0, /*bf_getcharbuffer*/
15512 #endif
15513 __pyx_array_getbuffer, /*bf_getbuffer*/
15514 0, /*bf_releasebuffer*/
15515 };
15516
15517 static PyTypeObject __pyx_type___pyx_array = {
15518 PyVarObject_HEAD_INIT(0, 0)
15519 "rasterio._example.array", /*tp_name*/
15520 sizeof(struct __pyx_array_obj), /*tp_basicsize*/
15521 0, /*tp_itemsize*/
15522 __pyx_tp_dealloc_array, /*tp_dealloc*/
15523 #if PY_VERSION_HEX < 0x030800b4
15524 0, /*tp_print*/
15525 #endif
15526 #if PY_VERSION_HEX >= 0x030800b4
15527 0, /*tp_vectorcall_offset*/
15528 #endif
15529 0, /*tp_getattr*/
15530 0, /*tp_setattr*/
15531 #if PY_MAJOR_VERSION < 3
15532 0, /*tp_compare*/
15533 #endif
15534 #if PY_MAJOR_VERSION >= 3
15535 0, /*tp_as_async*/
15536 #endif
15537 0, /*tp_repr*/
15538 0, /*tp_as_number*/
15539 &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
15540 &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
15541 0, /*tp_hash*/
15542 0, /*tp_call*/
15543 0, /*tp_str*/
15544 __pyx_tp_getattro_array, /*tp_getattro*/
15545 0, /*tp_setattro*/
15546 &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
15547 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
15548 0, /*tp_doc*/
15549 0, /*tp_traverse*/
15550 0, /*tp_clear*/
15551 0, /*tp_richcompare*/
15552 0, /*tp_weaklistoffset*/
15553 0, /*tp_iter*/
15554 0, /*tp_iternext*/
15555 __pyx_methods_array, /*tp_methods*/
15556 0, /*tp_members*/
15557 __pyx_getsets_array, /*tp_getset*/
15558 0, /*tp_base*/
15559 0, /*tp_dict*/
15560 0, /*tp_descr_get*/
15561 0, /*tp_descr_set*/
15562 0, /*tp_dictoffset*/
15563 0, /*tp_init*/
15564 0, /*tp_alloc*/
15565 __pyx_tp_new_array, /*tp_new*/
15566 0, /*tp_free*/
15567 0, /*tp_is_gc*/
15568 0, /*tp_bases*/
15569 0, /*tp_mro*/
15570 0, /*tp_cache*/
15571 0, /*tp_subclasses*/
15572 0, /*tp_weaklist*/
15573 0, /*tp_del*/
15574 0, /*tp_version_tag*/
15575 #if PY_VERSION_HEX >= 0x030400a1
15576 0, /*tp_finalize*/
15577 #endif
15578 #if PY_VERSION_HEX >= 0x030800b1
15579 0, /*tp_vectorcall*/
15580 #endif
15581 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15582 0, /*tp_print*/
15583 #endif
15584 };
15585
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)15586 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
15587 struct __pyx_MemviewEnum_obj *p;
15588 PyObject *o;
15589 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
15590 o = (*t->tp_alloc)(t, 0);
15591 } else {
15592 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
15593 }
15594 if (unlikely(!o)) return 0;
15595 p = ((struct __pyx_MemviewEnum_obj *)o);
15596 p->name = Py_None; Py_INCREF(Py_None);
15597 return o;
15598 }
15599
__pyx_tp_dealloc_Enum(PyObject * o)15600 static void __pyx_tp_dealloc_Enum(PyObject *o) {
15601 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
15602 #if CYTHON_USE_TP_FINALIZE
15603 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
15604 if (PyObject_CallFinalizerFromDealloc(o)) return;
15605 }
15606 #endif
15607 PyObject_GC_UnTrack(o);
15608 Py_CLEAR(p->name);
15609 (*Py_TYPE(o)->tp_free)(o);
15610 }
15611
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)15612 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
15613 int e;
15614 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
15615 if (p->name) {
15616 e = (*v)(p->name, a); if (e) return e;
15617 }
15618 return 0;
15619 }
15620
__pyx_tp_clear_Enum(PyObject * o)15621 static int __pyx_tp_clear_Enum(PyObject *o) {
15622 PyObject* tmp;
15623 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
15624 tmp = ((PyObject*)p->name);
15625 p->name = Py_None; Py_INCREF(Py_None);
15626 Py_XDECREF(tmp);
15627 return 0;
15628 }
15629
15630 static PyMethodDef __pyx_methods_Enum[] = {
15631 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
15632 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
15633 {0, 0, 0, 0}
15634 };
15635
15636 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
15637 PyVarObject_HEAD_INIT(0, 0)
15638 "rasterio._example.Enum", /*tp_name*/
15639 sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
15640 0, /*tp_itemsize*/
15641 __pyx_tp_dealloc_Enum, /*tp_dealloc*/
15642 #if PY_VERSION_HEX < 0x030800b4
15643 0, /*tp_print*/
15644 #endif
15645 #if PY_VERSION_HEX >= 0x030800b4
15646 0, /*tp_vectorcall_offset*/
15647 #endif
15648 0, /*tp_getattr*/
15649 0, /*tp_setattr*/
15650 #if PY_MAJOR_VERSION < 3
15651 0, /*tp_compare*/
15652 #endif
15653 #if PY_MAJOR_VERSION >= 3
15654 0, /*tp_as_async*/
15655 #endif
15656 __pyx_MemviewEnum___repr__, /*tp_repr*/
15657 0, /*tp_as_number*/
15658 0, /*tp_as_sequence*/
15659 0, /*tp_as_mapping*/
15660 0, /*tp_hash*/
15661 0, /*tp_call*/
15662 0, /*tp_str*/
15663 0, /*tp_getattro*/
15664 0, /*tp_setattro*/
15665 0, /*tp_as_buffer*/
15666 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
15667 0, /*tp_doc*/
15668 __pyx_tp_traverse_Enum, /*tp_traverse*/
15669 __pyx_tp_clear_Enum, /*tp_clear*/
15670 0, /*tp_richcompare*/
15671 0, /*tp_weaklistoffset*/
15672 0, /*tp_iter*/
15673 0, /*tp_iternext*/
15674 __pyx_methods_Enum, /*tp_methods*/
15675 0, /*tp_members*/
15676 0, /*tp_getset*/
15677 0, /*tp_base*/
15678 0, /*tp_dict*/
15679 0, /*tp_descr_get*/
15680 0, /*tp_descr_set*/
15681 0, /*tp_dictoffset*/
15682 __pyx_MemviewEnum___init__, /*tp_init*/
15683 0, /*tp_alloc*/
15684 __pyx_tp_new_Enum, /*tp_new*/
15685 0, /*tp_free*/
15686 0, /*tp_is_gc*/
15687 0, /*tp_bases*/
15688 0, /*tp_mro*/
15689 0, /*tp_cache*/
15690 0, /*tp_subclasses*/
15691 0, /*tp_weaklist*/
15692 0, /*tp_del*/
15693 0, /*tp_version_tag*/
15694 #if PY_VERSION_HEX >= 0x030400a1
15695 0, /*tp_finalize*/
15696 #endif
15697 #if PY_VERSION_HEX >= 0x030800b1
15698 0, /*tp_vectorcall*/
15699 #endif
15700 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15701 0, /*tp_print*/
15702 #endif
15703 };
15704 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
15705
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)15706 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
15707 struct __pyx_memoryview_obj *p;
15708 PyObject *o;
15709 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
15710 o = (*t->tp_alloc)(t, 0);
15711 } else {
15712 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
15713 }
15714 if (unlikely(!o)) return 0;
15715 p = ((struct __pyx_memoryview_obj *)o);
15716 p->__pyx_vtab = __pyx_vtabptr_memoryview;
15717 p->obj = Py_None; Py_INCREF(Py_None);
15718 p->_size = Py_None; Py_INCREF(Py_None);
15719 p->_array_interface = Py_None; Py_INCREF(Py_None);
15720 p->view.obj = NULL;
15721 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
15722 return o;
15723 bad:
15724 Py_DECREF(o); o = 0;
15725 return NULL;
15726 }
15727
__pyx_tp_dealloc_memoryview(PyObject * o)15728 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
15729 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
15730 #if CYTHON_USE_TP_FINALIZE
15731 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
15732 if (PyObject_CallFinalizerFromDealloc(o)) return;
15733 }
15734 #endif
15735 PyObject_GC_UnTrack(o);
15736 {
15737 PyObject *etype, *eval, *etb;
15738 PyErr_Fetch(&etype, &eval, &etb);
15739 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
15740 __pyx_memoryview___dealloc__(o);
15741 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
15742 PyErr_Restore(etype, eval, etb);
15743 }
15744 Py_CLEAR(p->obj);
15745 Py_CLEAR(p->_size);
15746 Py_CLEAR(p->_array_interface);
15747 (*Py_TYPE(o)->tp_free)(o);
15748 }
15749
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)15750 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
15751 int e;
15752 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
15753 if (p->obj) {
15754 e = (*v)(p->obj, a); if (e) return e;
15755 }
15756 if (p->_size) {
15757 e = (*v)(p->_size, a); if (e) return e;
15758 }
15759 if (p->_array_interface) {
15760 e = (*v)(p->_array_interface, a); if (e) return e;
15761 }
15762 if (p->view.obj) {
15763 e = (*v)(p->view.obj, a); if (e) return e;
15764 }
15765 return 0;
15766 }
15767
__pyx_tp_clear_memoryview(PyObject * o)15768 static int __pyx_tp_clear_memoryview(PyObject *o) {
15769 PyObject* tmp;
15770 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
15771 tmp = ((PyObject*)p->obj);
15772 p->obj = Py_None; Py_INCREF(Py_None);
15773 Py_XDECREF(tmp);
15774 tmp = ((PyObject*)p->_size);
15775 p->_size = Py_None; Py_INCREF(Py_None);
15776 Py_XDECREF(tmp);
15777 tmp = ((PyObject*)p->_array_interface);
15778 p->_array_interface = Py_None; Py_INCREF(Py_None);
15779 Py_XDECREF(tmp);
15780 Py_CLEAR(p->view.obj);
15781 return 0;
15782 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)15783 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
15784 PyObject *r;
15785 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
15786 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
15787 Py_DECREF(x);
15788 return r;
15789 }
15790
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)15791 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
15792 if (v) {
15793 return __pyx_memoryview___setitem__(o, i, v);
15794 }
15795 else {
15796 PyErr_Format(PyExc_NotImplementedError,
15797 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
15798 return -1;
15799 }
15800 }
15801
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)15802 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
15803 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
15804 }
15805
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)15806 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
15807 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
15808 }
15809
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)15810 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
15811 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
15812 }
15813
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)15814 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
15815 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
15816 }
15817
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)15818 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
15819 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
15820 }
15821
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)15822 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
15823 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
15824 }
15825
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)15826 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
15827 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
15828 }
15829
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)15830 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
15831 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
15832 }
15833
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)15834 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
15835 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
15836 }
15837
15838 static PyMethodDef __pyx_methods_memoryview[] = {
15839 {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
15840 {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
15841 {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
15842 {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
15843 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
15844 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
15845 {0, 0, 0, 0}
15846 };
15847
15848 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
15849 {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
15850 {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
15851 {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
15852 {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
15853 {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
15854 {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
15855 {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
15856 {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
15857 {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
15858 {0, 0, 0, 0, 0}
15859 };
15860
15861 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
15862 __pyx_memoryview___len__, /*sq_length*/
15863 0, /*sq_concat*/
15864 0, /*sq_repeat*/
15865 __pyx_sq_item_memoryview, /*sq_item*/
15866 0, /*sq_slice*/
15867 0, /*sq_ass_item*/
15868 0, /*sq_ass_slice*/
15869 0, /*sq_contains*/
15870 0, /*sq_inplace_concat*/
15871 0, /*sq_inplace_repeat*/
15872 };
15873
15874 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
15875 __pyx_memoryview___len__, /*mp_length*/
15876 __pyx_memoryview___getitem__, /*mp_subscript*/
15877 __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
15878 };
15879
15880 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
15881 #if PY_MAJOR_VERSION < 3
15882 0, /*bf_getreadbuffer*/
15883 #endif
15884 #if PY_MAJOR_VERSION < 3
15885 0, /*bf_getwritebuffer*/
15886 #endif
15887 #if PY_MAJOR_VERSION < 3
15888 0, /*bf_getsegcount*/
15889 #endif
15890 #if PY_MAJOR_VERSION < 3
15891 0, /*bf_getcharbuffer*/
15892 #endif
15893 __pyx_memoryview_getbuffer, /*bf_getbuffer*/
15894 0, /*bf_releasebuffer*/
15895 };
15896
15897 static PyTypeObject __pyx_type___pyx_memoryview = {
15898 PyVarObject_HEAD_INIT(0, 0)
15899 "rasterio._example.memoryview", /*tp_name*/
15900 sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
15901 0, /*tp_itemsize*/
15902 __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
15903 #if PY_VERSION_HEX < 0x030800b4
15904 0, /*tp_print*/
15905 #endif
15906 #if PY_VERSION_HEX >= 0x030800b4
15907 0, /*tp_vectorcall_offset*/
15908 #endif
15909 0, /*tp_getattr*/
15910 0, /*tp_setattr*/
15911 #if PY_MAJOR_VERSION < 3
15912 0, /*tp_compare*/
15913 #endif
15914 #if PY_MAJOR_VERSION >= 3
15915 0, /*tp_as_async*/
15916 #endif
15917 __pyx_memoryview___repr__, /*tp_repr*/
15918 0, /*tp_as_number*/
15919 &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
15920 &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
15921 0, /*tp_hash*/
15922 0, /*tp_call*/
15923 __pyx_memoryview___str__, /*tp_str*/
15924 0, /*tp_getattro*/
15925 0, /*tp_setattro*/
15926 &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
15927 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
15928 0, /*tp_doc*/
15929 __pyx_tp_traverse_memoryview, /*tp_traverse*/
15930 __pyx_tp_clear_memoryview, /*tp_clear*/
15931 0, /*tp_richcompare*/
15932 0, /*tp_weaklistoffset*/
15933 0, /*tp_iter*/
15934 0, /*tp_iternext*/
15935 __pyx_methods_memoryview, /*tp_methods*/
15936 0, /*tp_members*/
15937 __pyx_getsets_memoryview, /*tp_getset*/
15938 0, /*tp_base*/
15939 0, /*tp_dict*/
15940 0, /*tp_descr_get*/
15941 0, /*tp_descr_set*/
15942 0, /*tp_dictoffset*/
15943 0, /*tp_init*/
15944 0, /*tp_alloc*/
15945 __pyx_tp_new_memoryview, /*tp_new*/
15946 0, /*tp_free*/
15947 0, /*tp_is_gc*/
15948 0, /*tp_bases*/
15949 0, /*tp_mro*/
15950 0, /*tp_cache*/
15951 0, /*tp_subclasses*/
15952 0, /*tp_weaklist*/
15953 0, /*tp_del*/
15954 0, /*tp_version_tag*/
15955 #if PY_VERSION_HEX >= 0x030400a1
15956 0, /*tp_finalize*/
15957 #endif
15958 #if PY_VERSION_HEX >= 0x030800b1
15959 0, /*tp_vectorcall*/
15960 #endif
15961 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
15962 0, /*tp_print*/
15963 #endif
15964 };
15965 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
15966
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)15967 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
15968 struct __pyx_memoryviewslice_obj *p;
15969 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
15970 if (unlikely(!o)) return 0;
15971 p = ((struct __pyx_memoryviewslice_obj *)o);
15972 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
15973 p->from_object = Py_None; Py_INCREF(Py_None);
15974 p->from_slice.memview = NULL;
15975 return o;
15976 }
15977
__pyx_tp_dealloc__memoryviewslice(PyObject * o)15978 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
15979 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
15980 #if CYTHON_USE_TP_FINALIZE
15981 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
15982 if (PyObject_CallFinalizerFromDealloc(o)) return;
15983 }
15984 #endif
15985 PyObject_GC_UnTrack(o);
15986 {
15987 PyObject *etype, *eval, *etb;
15988 PyErr_Fetch(&etype, &eval, &etb);
15989 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
15990 __pyx_memoryviewslice___dealloc__(o);
15991 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
15992 PyErr_Restore(etype, eval, etb);
15993 }
15994 Py_CLEAR(p->from_object);
15995 PyObject_GC_Track(o);
15996 __pyx_tp_dealloc_memoryview(o);
15997 }
15998
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)15999 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
16000 int e;
16001 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
16002 e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
16003 if (p->from_object) {
16004 e = (*v)(p->from_object, a); if (e) return e;
16005 }
16006 return 0;
16007 }
16008
__pyx_tp_clear__memoryviewslice(PyObject * o)16009 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
16010 PyObject* tmp;
16011 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
16012 __pyx_tp_clear_memoryview(o);
16013 tmp = ((PyObject*)p->from_object);
16014 p->from_object = Py_None; Py_INCREF(Py_None);
16015 Py_XDECREF(tmp);
16016 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
16017 return 0;
16018 }
16019
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)16020 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
16021 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
16022 }
16023
16024 static PyMethodDef __pyx_methods__memoryviewslice[] = {
16025 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
16026 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
16027 {0, 0, 0, 0}
16028 };
16029
16030 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
16031 {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
16032 {0, 0, 0, 0, 0}
16033 };
16034
16035 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
16036 PyVarObject_HEAD_INIT(0, 0)
16037 "rasterio._example._memoryviewslice", /*tp_name*/
16038 sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
16039 0, /*tp_itemsize*/
16040 __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
16041 #if PY_VERSION_HEX < 0x030800b4
16042 0, /*tp_print*/
16043 #endif
16044 #if PY_VERSION_HEX >= 0x030800b4
16045 0, /*tp_vectorcall_offset*/
16046 #endif
16047 0, /*tp_getattr*/
16048 0, /*tp_setattr*/
16049 #if PY_MAJOR_VERSION < 3
16050 0, /*tp_compare*/
16051 #endif
16052 #if PY_MAJOR_VERSION >= 3
16053 0, /*tp_as_async*/
16054 #endif
16055 #if CYTHON_COMPILING_IN_PYPY
16056 __pyx_memoryview___repr__, /*tp_repr*/
16057 #else
16058 0, /*tp_repr*/
16059 #endif
16060 0, /*tp_as_number*/
16061 0, /*tp_as_sequence*/
16062 0, /*tp_as_mapping*/
16063 0, /*tp_hash*/
16064 0, /*tp_call*/
16065 #if CYTHON_COMPILING_IN_PYPY
16066 __pyx_memoryview___str__, /*tp_str*/
16067 #else
16068 0, /*tp_str*/
16069 #endif
16070 0, /*tp_getattro*/
16071 0, /*tp_setattro*/
16072 0, /*tp_as_buffer*/
16073 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16074 "Internal class for passing memoryview slices to Python", /*tp_doc*/
16075 __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
16076 __pyx_tp_clear__memoryviewslice, /*tp_clear*/
16077 0, /*tp_richcompare*/
16078 0, /*tp_weaklistoffset*/
16079 0, /*tp_iter*/
16080 0, /*tp_iternext*/
16081 __pyx_methods__memoryviewslice, /*tp_methods*/
16082 0, /*tp_members*/
16083 __pyx_getsets__memoryviewslice, /*tp_getset*/
16084 0, /*tp_base*/
16085 0, /*tp_dict*/
16086 0, /*tp_descr_get*/
16087 0, /*tp_descr_set*/
16088 0, /*tp_dictoffset*/
16089 0, /*tp_init*/
16090 0, /*tp_alloc*/
16091 __pyx_tp_new__memoryviewslice, /*tp_new*/
16092 0, /*tp_free*/
16093 0, /*tp_is_gc*/
16094 0, /*tp_bases*/
16095 0, /*tp_mro*/
16096 0, /*tp_cache*/
16097 0, /*tp_subclasses*/
16098 0, /*tp_weaklist*/
16099 0, /*tp_del*/
16100 0, /*tp_version_tag*/
16101 #if PY_VERSION_HEX >= 0x030400a1
16102 0, /*tp_finalize*/
16103 #endif
16104 #if PY_VERSION_HEX >= 0x030800b1
16105 0, /*tp_vectorcall*/
16106 #endif
16107 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16108 0, /*tp_print*/
16109 #endif
16110 };
16111
16112 static PyMethodDef __pyx_methods[] = {
16113 {0, 0, 0, 0}
16114 };
16115
16116 #if PY_MAJOR_VERSION >= 3
16117 #if CYTHON_PEP489_MULTI_PHASE_INIT
16118 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
16119 static int __pyx_pymod_exec__example(PyObject* module); /*proto*/
16120 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
16121 {Py_mod_create, (void*)__pyx_pymod_create},
16122 {Py_mod_exec, (void*)__pyx_pymod_exec__example},
16123 {0, NULL}
16124 };
16125 #endif
16126
16127 static struct PyModuleDef __pyx_moduledef = {
16128 PyModuleDef_HEAD_INIT,
16129 "_example",
16130 0, /* m_doc */
16131 #if CYTHON_PEP489_MULTI_PHASE_INIT
16132 0, /* m_size */
16133 #else
16134 -1, /* m_size */
16135 #endif
16136 __pyx_methods /* m_methods */,
16137 #if CYTHON_PEP489_MULTI_PHASE_INIT
16138 __pyx_moduledef_slots, /* m_slots */
16139 #else
16140 NULL, /* m_reload */
16141 #endif
16142 NULL, /* m_traverse */
16143 NULL, /* m_clear */
16144 NULL /* m_free */
16145 };
16146 #endif
16147 #ifndef CYTHON_SMALL_CODE
16148 #if defined(__clang__)
16149 #define CYTHON_SMALL_CODE
16150 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
16151 #define CYTHON_SMALL_CODE __attribute__((cold))
16152 #else
16153 #define CYTHON_SMALL_CODE
16154 #endif
16155 #endif
16156
16157 static __Pyx_StringTabEntry __pyx_string_tab[] = {
16158 {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
16159 {&__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},
16160 {&__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},
16161 {&__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},
16162 {&__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},
16163 {&__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},
16164 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
16165 {&__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},
16166 {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
16167 {&__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},
16168 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
16169 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
16170 {&__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},
16171 {&__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},
16172 {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
16173 {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1},
16174 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
16175 {&__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},
16176 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
16177 {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
16178 {&__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},
16179 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
16180 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
16181 {&__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},
16182 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
16183 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
16184 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
16185 {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
16186 {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
16187 {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
16188 {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
16189 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
16190 {&__pyx_n_s_compute, __pyx_k_compute, sizeof(__pyx_k_compute), 0, 0, 1, 1},
16191 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
16192 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
16193 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
16194 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
16195 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
16196 {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
16197 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
16198 {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
16199 {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
16200 {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
16201 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
16202 {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
16203 {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
16204 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
16205 {&__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},
16206 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
16207 {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
16208 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
16209 {&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
16210 {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
16211 {&__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},
16212 {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
16213 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
16214 {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
16215 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
16216 {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
16217 {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
16218 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
16219 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
16220 {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
16221 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
16222 {&__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},
16223 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
16224 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
16225 {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
16226 {&__pyx_n_s_output, __pyx_k_output, sizeof(__pyx_k_output), 0, 0, 1, 1},
16227 {&__pyx_n_s_output_view, __pyx_k_output_view, sizeof(__pyx_k_output_view), 0, 0, 1, 1},
16228 {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
16229 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
16230 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
16231 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
16232 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
16233 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
16234 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
16235 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
16236 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
16237 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
16238 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
16239 {&__pyx_n_s_rasterio__example, __pyx_k_rasterio__example, sizeof(__pyx_k_rasterio__example), 0, 0, 1, 1},
16240 {&__pyx_kp_s_rasterio__example_pyx, __pyx_k_rasterio__example_pyx, sizeof(__pyx_k_rasterio__example_pyx), 0, 0, 1, 0},
16241 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
16242 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
16243 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
16244 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
16245 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
16246 {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
16247 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
16248 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
16249 {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
16250 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
16251 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
16252 {&__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},
16253 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
16254 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
16255 {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
16256 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
16257 {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
16258 {&__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},
16259 {&__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},
16260 {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
16261 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
16262 {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
16263 {0, 0, 0, 0, 0, 0, 0}
16264 };
__Pyx_InitCachedBuiltins(void)16265 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
16266 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 21, __pyx_L1_error)
16267 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
16268 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
16269 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
16270 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
16271 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
16272 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
16273 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
16274 return 0;
16275 __pyx_L1_error:;
16276 return -1;
16277 }
16278
__Pyx_InitCachedConstants(void)16279 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
16280 __Pyx_RefNannyDeclarations
16281 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
16282
16283 /* "View.MemoryView":133
16284 *
16285 * if not self.ndim:
16286 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
16287 *
16288 * if itemsize <= 0:
16289 */
16290 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 133, __pyx_L1_error)
16291 __Pyx_GOTREF(__pyx_tuple_);
16292 __Pyx_GIVEREF(__pyx_tuple_);
16293
16294 /* "View.MemoryView":136
16295 *
16296 * if itemsize <= 0:
16297 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
16298 *
16299 * if not isinstance(format, bytes):
16300 */
16301 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 136, __pyx_L1_error)
16302 __Pyx_GOTREF(__pyx_tuple__2);
16303 __Pyx_GIVEREF(__pyx_tuple__2);
16304
16305 /* "View.MemoryView":148
16306 *
16307 * if not self._shape:
16308 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
16309 *
16310 *
16311 */
16312 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 148, __pyx_L1_error)
16313 __Pyx_GOTREF(__pyx_tuple__3);
16314 __Pyx_GIVEREF(__pyx_tuple__3);
16315
16316 /* "View.MemoryView":176
16317 * self.data = <char *>malloc(self.len)
16318 * if not self.data:
16319 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
16320 *
16321 * if self.dtype_is_object:
16322 */
16323 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 176, __pyx_L1_error)
16324 __Pyx_GOTREF(__pyx_tuple__4);
16325 __Pyx_GIVEREF(__pyx_tuple__4);
16326
16327 /* "View.MemoryView":192
16328 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
16329 * if not (flags & bufmode):
16330 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
16331 * info.buf = self.data
16332 * info.len = self.len
16333 */
16334 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 192, __pyx_L1_error)
16335 __Pyx_GOTREF(__pyx_tuple__5);
16336 __Pyx_GIVEREF(__pyx_tuple__5);
16337
16338 /* "(tree fragment)":2
16339 * def __reduce_cython__(self):
16340 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16341 * def __setstate_cython__(self, __pyx_state):
16342 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16343 */
16344 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 2, __pyx_L1_error)
16345 __Pyx_GOTREF(__pyx_tuple__6);
16346 __Pyx_GIVEREF(__pyx_tuple__6);
16347
16348 /* "(tree fragment)":4
16349 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16350 * def __setstate_cython__(self, __pyx_state):
16351 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16352 */
16353 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 4, __pyx_L1_error)
16354 __Pyx_GOTREF(__pyx_tuple__7);
16355 __Pyx_GIVEREF(__pyx_tuple__7);
16356
16357 /* "View.MemoryView":418
16358 * def __setitem__(memoryview self, object index, object value):
16359 * if self.view.readonly:
16360 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
16361 *
16362 * have_slices, index = _unellipsify(index, self.view.ndim)
16363 */
16364 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 418, __pyx_L1_error)
16365 __Pyx_GOTREF(__pyx_tuple__8);
16366 __Pyx_GIVEREF(__pyx_tuple__8);
16367
16368 /* "View.MemoryView":495
16369 * result = struct.unpack(self.view.format, bytesitem)
16370 * except struct.error:
16371 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
16372 * else:
16373 * if len(self.view.format) == 1:
16374 */
16375 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 495, __pyx_L1_error)
16376 __Pyx_GOTREF(__pyx_tuple__9);
16377 __Pyx_GIVEREF(__pyx_tuple__9);
16378
16379 /* "View.MemoryView":520
16380 * def __getbuffer__(self, Py_buffer *info, int flags):
16381 * if flags & PyBUF_WRITABLE and self.view.readonly:
16382 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
16383 *
16384 * if flags & PyBUF_ND:
16385 */
16386 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 520, __pyx_L1_error)
16387 __Pyx_GOTREF(__pyx_tuple__10);
16388 __Pyx_GIVEREF(__pyx_tuple__10);
16389
16390 /* "View.MemoryView":570
16391 * if self.view.strides == NULL:
16392 *
16393 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
16394 *
16395 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
16396 */
16397 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 570, __pyx_L1_error)
16398 __Pyx_GOTREF(__pyx_tuple__11);
16399 __Pyx_GIVEREF(__pyx_tuple__11);
16400
16401 /* "View.MemoryView":577
16402 * def suboffsets(self):
16403 * if self.view.suboffsets == NULL:
16404 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
16405 *
16406 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
16407 */
16408 __pyx_tuple__12 = PyTuple_New(1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 577, __pyx_L1_error)
16409 __Pyx_GOTREF(__pyx_tuple__12);
16410 __Pyx_INCREF(__pyx_int_neg_1);
16411 __Pyx_GIVEREF(__pyx_int_neg_1);
16412 PyTuple_SET_ITEM(__pyx_tuple__12, 0, __pyx_int_neg_1);
16413 __Pyx_GIVEREF(__pyx_tuple__12);
16414
16415 /* "(tree fragment)":2
16416 * def __reduce_cython__(self):
16417 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16418 * def __setstate_cython__(self, __pyx_state):
16419 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16420 */
16421 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
16422 __Pyx_GOTREF(__pyx_tuple__13);
16423 __Pyx_GIVEREF(__pyx_tuple__13);
16424
16425 /* "(tree fragment)":4
16426 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16427 * def __setstate_cython__(self, __pyx_state):
16428 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16429 */
16430 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
16431 __Pyx_GOTREF(__pyx_tuple__14);
16432 __Pyx_GIVEREF(__pyx_tuple__14);
16433
16434 /* "View.MemoryView":682
16435 * if item is Ellipsis:
16436 * if not seen_ellipsis:
16437 * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
16438 * seen_ellipsis = True
16439 * else:
16440 */
16441 __pyx_slice__15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(1, 682, __pyx_L1_error)
16442 __Pyx_GOTREF(__pyx_slice__15);
16443 __Pyx_GIVEREF(__pyx_slice__15);
16444
16445 /* "View.MemoryView":703
16446 * for suboffset in suboffsets[:ndim]:
16447 * if suboffset >= 0:
16448 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
16449 *
16450 *
16451 */
16452 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 703, __pyx_L1_error)
16453 __Pyx_GOTREF(__pyx_tuple__16);
16454 __Pyx_GIVEREF(__pyx_tuple__16);
16455
16456 /* "(tree fragment)":2
16457 * def __reduce_cython__(self):
16458 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16459 * def __setstate_cython__(self, __pyx_state):
16460 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16461 */
16462 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 2, __pyx_L1_error)
16463 __Pyx_GOTREF(__pyx_tuple__17);
16464 __Pyx_GIVEREF(__pyx_tuple__17);
16465
16466 /* "(tree fragment)":4
16467 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16468 * def __setstate_cython__(self, __pyx_state):
16469 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16470 */
16471 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error)
16472 __Pyx_GOTREF(__pyx_tuple__18);
16473 __Pyx_GIVEREF(__pyx_tuple__18);
16474
16475 /* "rasterio/_example.pyx":6
16476 *
16477 *
16478 * def compute(unsigned char[:, :, :] input): # <<<<<<<<<<<<<<
16479 * """reverses bands inefficiently
16480 *
16481 */
16482 __pyx_tuple__19 = PyTuple_Pack(12, __pyx_n_s_input, __pyx_n_s_input, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_K, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_val, __pyx_n_s_output, __pyx_n_s_output_view); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 6, __pyx_L1_error)
16483 __Pyx_GOTREF(__pyx_tuple__19);
16484 __Pyx_GIVEREF(__pyx_tuple__19);
16485 __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_rasterio__example_pyx, __pyx_n_s_compute, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 6, __pyx_L1_error)
16486
16487 /* "View.MemoryView":286
16488 * return self.name
16489 *
16490 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
16491 * cdef strided = Enum("<strided and direct>") # default
16492 * cdef indirect = Enum("<strided and indirect>")
16493 */
16494 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 286, __pyx_L1_error)
16495 __Pyx_GOTREF(__pyx_tuple__21);
16496 __Pyx_GIVEREF(__pyx_tuple__21);
16497
16498 /* "View.MemoryView":287
16499 *
16500 * cdef generic = Enum("<strided and direct or indirect>")
16501 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
16502 * cdef indirect = Enum("<strided and indirect>")
16503 *
16504 */
16505 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 287, __pyx_L1_error)
16506 __Pyx_GOTREF(__pyx_tuple__22);
16507 __Pyx_GIVEREF(__pyx_tuple__22);
16508
16509 /* "View.MemoryView":288
16510 * cdef generic = Enum("<strided and direct or indirect>")
16511 * cdef strided = Enum("<strided and direct>") # default
16512 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
16513 *
16514 *
16515 */
16516 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 288, __pyx_L1_error)
16517 __Pyx_GOTREF(__pyx_tuple__23);
16518 __Pyx_GIVEREF(__pyx_tuple__23);
16519
16520 /* "View.MemoryView":291
16521 *
16522 *
16523 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
16524 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
16525 *
16526 */
16527 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 291, __pyx_L1_error)
16528 __Pyx_GOTREF(__pyx_tuple__24);
16529 __Pyx_GIVEREF(__pyx_tuple__24);
16530
16531 /* "View.MemoryView":292
16532 *
16533 * cdef contiguous = Enum("<contiguous and direct>")
16534 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
16535 *
16536 *
16537 */
16538 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 292, __pyx_L1_error)
16539 __Pyx_GOTREF(__pyx_tuple__25);
16540 __Pyx_GIVEREF(__pyx_tuple__25);
16541
16542 /* "(tree fragment)":1
16543 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
16544 * cdef object __pyx_PickleError
16545 * cdef object __pyx_result
16546 */
16547 __pyx_tuple__26 = 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__26)) __PYX_ERR(1, 1, __pyx_L1_error)
16548 __Pyx_GOTREF(__pyx_tuple__26);
16549 __Pyx_GIVEREF(__pyx_tuple__26);
16550 __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(1, 1, __pyx_L1_error)
16551 __Pyx_RefNannyFinishContext();
16552 return 0;
16553 __pyx_L1_error:;
16554 __Pyx_RefNannyFinishContext();
16555 return -1;
16556 }
16557
__Pyx_InitGlobals(void)16558 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
16559 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
16560 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
16561 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
16562 __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
16563 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
16564 return 0;
16565 __pyx_L1_error:;
16566 return -1;
16567 }
16568
16569 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
16570 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
16571 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
16572 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
16573 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
16574 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
16575 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
16576
__Pyx_modinit_global_init_code(void)16577 static int __Pyx_modinit_global_init_code(void) {
16578 __Pyx_RefNannyDeclarations
16579 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
16580 /*--- Global init code ---*/
16581 generic = Py_None; Py_INCREF(Py_None);
16582 strided = Py_None; Py_INCREF(Py_None);
16583 indirect = Py_None; Py_INCREF(Py_None);
16584 contiguous = Py_None; Py_INCREF(Py_None);
16585 indirect_contiguous = Py_None; Py_INCREF(Py_None);
16586 __Pyx_RefNannyFinishContext();
16587 return 0;
16588 }
16589
__Pyx_modinit_variable_export_code(void)16590 static int __Pyx_modinit_variable_export_code(void) {
16591 __Pyx_RefNannyDeclarations
16592 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
16593 /*--- Variable export code ---*/
16594 __Pyx_RefNannyFinishContext();
16595 return 0;
16596 }
16597
__Pyx_modinit_function_export_code(void)16598 static int __Pyx_modinit_function_export_code(void) {
16599 __Pyx_RefNannyDeclarations
16600 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
16601 /*--- Function export code ---*/
16602 __Pyx_RefNannyFinishContext();
16603 return 0;
16604 }
16605
__Pyx_modinit_type_init_code(void)16606 static int __Pyx_modinit_type_init_code(void) {
16607 __Pyx_RefNannyDeclarations
16608 int __pyx_lineno = 0;
16609 const char *__pyx_filename = NULL;
16610 int __pyx_clineno = 0;
16611 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
16612 /*--- Type init code ---*/
16613 __pyx_vtabptr_array = &__pyx_vtable_array;
16614 __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
16615 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
16616 #if PY_VERSION_HEX < 0x030800B1
16617 __pyx_type___pyx_array.tp_print = 0;
16618 #endif
16619 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
16620 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
16621 __pyx_array_type = &__pyx_type___pyx_array;
16622 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
16623 #if PY_VERSION_HEX < 0x030800B1
16624 __pyx_type___pyx_MemviewEnum.tp_print = 0;
16625 #endif
16626 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
16627 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
16628 }
16629 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
16630 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
16631 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
16632 __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
16633 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
16634 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
16635 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
16636 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
16637 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
16638 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
16639 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
16640 #if PY_VERSION_HEX < 0x030800B1
16641 __pyx_type___pyx_memoryview.tp_print = 0;
16642 #endif
16643 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
16644 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
16645 }
16646 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
16647 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
16648 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
16649 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
16650 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
16651 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
16652 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
16653 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
16654 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
16655 #if PY_VERSION_HEX < 0x030800B1
16656 __pyx_type___pyx_memoryviewslice.tp_print = 0;
16657 #endif
16658 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
16659 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
16660 }
16661 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
16662 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
16663 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
16664 __Pyx_RefNannyFinishContext();
16665 return 0;
16666 __pyx_L1_error:;
16667 __Pyx_RefNannyFinishContext();
16668 return -1;
16669 }
16670
__Pyx_modinit_type_import_code(void)16671 static int __Pyx_modinit_type_import_code(void) {
16672 __Pyx_RefNannyDeclarations
16673 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
16674 /*--- Type import code ---*/
16675 __Pyx_RefNannyFinishContext();
16676 return 0;
16677 }
16678
__Pyx_modinit_variable_import_code(void)16679 static int __Pyx_modinit_variable_import_code(void) {
16680 __Pyx_RefNannyDeclarations
16681 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
16682 /*--- Variable import code ---*/
16683 __Pyx_RefNannyFinishContext();
16684 return 0;
16685 }
16686
__Pyx_modinit_function_import_code(void)16687 static int __Pyx_modinit_function_import_code(void) {
16688 __Pyx_RefNannyDeclarations
16689 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
16690 /*--- Function import code ---*/
16691 __Pyx_RefNannyFinishContext();
16692 return 0;
16693 }
16694
16695
16696 #ifndef CYTHON_NO_PYINIT_EXPORT
16697 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
16698 #elif PY_MAJOR_VERSION < 3
16699 #ifdef __cplusplus
16700 #define __Pyx_PyMODINIT_FUNC extern "C" void
16701 #else
16702 #define __Pyx_PyMODINIT_FUNC void
16703 #endif
16704 #else
16705 #ifdef __cplusplus
16706 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
16707 #else
16708 #define __Pyx_PyMODINIT_FUNC PyObject *
16709 #endif
16710 #endif
16711
16712
16713 #if PY_MAJOR_VERSION < 3
16714 __Pyx_PyMODINIT_FUNC init_example(void) CYTHON_SMALL_CODE; /*proto*/
init_example(void)16715 __Pyx_PyMODINIT_FUNC init_example(void)
16716 #else
16717 __Pyx_PyMODINIT_FUNC PyInit__example(void) CYTHON_SMALL_CODE; /*proto*/
16718 __Pyx_PyMODINIT_FUNC PyInit__example(void)
16719 #if CYTHON_PEP489_MULTI_PHASE_INIT
16720 {
16721 return PyModuleDef_Init(&__pyx_moduledef);
16722 }
16723 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
16724 #if PY_VERSION_HEX >= 0x030700A1
16725 static PY_INT64_T main_interpreter_id = -1;
16726 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
16727 if (main_interpreter_id == -1) {
16728 main_interpreter_id = current_id;
16729 return (unlikely(current_id == -1)) ? -1 : 0;
16730 } else if (unlikely(main_interpreter_id != current_id))
16731 #else
16732 static PyInterpreterState *main_interpreter = NULL;
16733 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
16734 if (!main_interpreter) {
16735 main_interpreter = current_interpreter;
16736 } else if (unlikely(main_interpreter != current_interpreter))
16737 #endif
16738 {
16739 PyErr_SetString(
16740 PyExc_ImportError,
16741 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
16742 return -1;
16743 }
16744 return 0;
16745 }
16746 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) {
16747 PyObject *value = PyObject_GetAttrString(spec, from_name);
16748 int result = 0;
16749 if (likely(value)) {
16750 if (allow_none || value != Py_None) {
16751 result = PyDict_SetItemString(moddict, to_name, value);
16752 }
16753 Py_DECREF(value);
16754 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
16755 PyErr_Clear();
16756 } else {
16757 result = -1;
16758 }
16759 return result;
16760 }
16761 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
16762 PyObject *module = NULL, *moddict, *modname;
16763 if (__Pyx_check_single_interpreter())
16764 return NULL;
16765 if (__pyx_m)
16766 return __Pyx_NewRef(__pyx_m);
16767 modname = PyObject_GetAttrString(spec, "name");
16768 if (unlikely(!modname)) goto bad;
16769 module = PyModule_NewObject(modname);
16770 Py_DECREF(modname);
16771 if (unlikely(!module)) goto bad;
16772 moddict = PyModule_GetDict(module);
16773 if (unlikely(!moddict)) goto bad;
16774 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
16775 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
16776 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
16777 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
16778 return module;
16779 bad:
16780 Py_XDECREF(module);
16781 return NULL;
16782 }
16783
16784
16785 static CYTHON_SMALL_CODE int __pyx_pymod_exec__example(PyObject *__pyx_pyinit_module)
16786 #endif
16787 #endif
16788 {
16789 PyObject *__pyx_t_1 = NULL;
16790 static PyThread_type_lock __pyx_t_2[8];
16791 int __pyx_lineno = 0;
16792 const char *__pyx_filename = NULL;
16793 int __pyx_clineno = 0;
16794 __Pyx_RefNannyDeclarations
16795 #if CYTHON_PEP489_MULTI_PHASE_INIT
16796 if (__pyx_m) {
16797 if (__pyx_m == __pyx_pyinit_module) return 0;
16798 PyErr_SetString(PyExc_RuntimeError, "Module '_example' has already been imported. Re-initialisation is not supported.");
16799 return -1;
16800 }
16801 #elif PY_MAJOR_VERSION >= 3
16802 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
16803 #endif
16804 #if CYTHON_REFNANNY
16805 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
16806 if (!__Pyx_RefNanny) {
16807 PyErr_Clear();
16808 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
16809 if (!__Pyx_RefNanny)
16810 Py_FatalError("failed to import 'refnanny' module");
16811 }
16812 #endif
16813 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__example(void)", 0);
16814 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16815 #ifdef __Pxy_PyFrame_Initialize_Offsets
16816 __Pxy_PyFrame_Initialize_Offsets();
16817 #endif
16818 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
16819 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
16820 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
16821 #ifdef __Pyx_CyFunction_USED
16822 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16823 #endif
16824 #ifdef __Pyx_FusedFunction_USED
16825 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16826 #endif
16827 #ifdef __Pyx_Coroutine_USED
16828 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16829 #endif
16830 #ifdef __Pyx_Generator_USED
16831 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16832 #endif
16833 #ifdef __Pyx_AsyncGen_USED
16834 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16835 #endif
16836 #ifdef __Pyx_StopAsyncIteration_USED
16837 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16838 #endif
16839 /*--- Library function declarations ---*/
16840 /*--- Threads initialization code ---*/
16841 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
16842 #ifdef WITH_THREAD /* Python build with threading support? */
16843 PyEval_InitThreads();
16844 #endif
16845 #endif
16846 /*--- Module creation code ---*/
16847 #if CYTHON_PEP489_MULTI_PHASE_INIT
16848 __pyx_m = __pyx_pyinit_module;
16849 Py_INCREF(__pyx_m);
16850 #else
16851 #if PY_MAJOR_VERSION < 3
16852 __pyx_m = Py_InitModule4("_example", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
16853 #else
16854 __pyx_m = PyModule_Create(&__pyx_moduledef);
16855 #endif
16856 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
16857 #endif
16858 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
16859 Py_INCREF(__pyx_d);
16860 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
16861 Py_INCREF(__pyx_b);
16862 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
16863 Py_INCREF(__pyx_cython_runtime);
16864 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
16865 /*--- Initialize various global constants etc. ---*/
16866 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16867 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
16868 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16869 #endif
16870 if (__pyx_module_is_main_rasterio___example) {
16871 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16872 }
16873 #if PY_MAJOR_VERSION >= 3
16874 {
16875 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
16876 if (!PyDict_GetItemString(modules, "rasterio._example")) {
16877 if (unlikely(PyDict_SetItemString(modules, "rasterio._example", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
16878 }
16879 }
16880 #endif
16881 /*--- Builtin init code ---*/
16882 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16883 /*--- Constants init code ---*/
16884 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16885 /*--- Global type/function init code ---*/
16886 (void)__Pyx_modinit_global_init_code();
16887 (void)__Pyx_modinit_variable_export_code();
16888 (void)__Pyx_modinit_function_export_code();
16889 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
16890 (void)__Pyx_modinit_type_import_code();
16891 (void)__Pyx_modinit_variable_import_code();
16892 (void)__Pyx_modinit_function_import_code();
16893 /*--- Execution code ---*/
16894 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
16895 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16896 #endif
16897
16898 /* "rasterio/_example.pyx":3
16899 * # cython: boundscheck=False
16900 *
16901 * import numpy as np # <<<<<<<<<<<<<<
16902 *
16903 *
16904 */
16905 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
16906 __Pyx_GOTREF(__pyx_t_1);
16907 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
16908 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16909
16910 /* "rasterio/_example.pyx":6
16911 *
16912 *
16913 * def compute(unsigned char[:, :, :] input): # <<<<<<<<<<<<<<
16914 * """reverses bands inefficiently
16915 *
16916 */
16917 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8rasterio_8_example_1compute, NULL, __pyx_n_s_rasterio__example); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
16918 __Pyx_GOTREF(__pyx_t_1);
16919 if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
16920 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16921
16922 /* "rasterio/_example.pyx":1
16923 * # cython: boundscheck=False # <<<<<<<<<<<<<<
16924 *
16925 * import numpy as np
16926 */
16927 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
16928 __Pyx_GOTREF(__pyx_t_1);
16929 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
16930 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16931
16932 /* "View.MemoryView":209
16933 * info.obj = self
16934 *
16935 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
16936 *
16937 * def __dealloc__(array self):
16938 */
16939 __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
16940 __Pyx_GOTREF(__pyx_t_1);
16941 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
16942 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16943 PyType_Modified(__pyx_array_type);
16944
16945 /* "View.MemoryView":286
16946 * return self.name
16947 *
16948 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
16949 * cdef strided = Enum("<strided and direct>") # default
16950 * cdef indirect = Enum("<strided and indirect>")
16951 */
16952 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
16953 __Pyx_GOTREF(__pyx_t_1);
16954 __Pyx_XGOTREF(generic);
16955 __Pyx_DECREF_SET(generic, __pyx_t_1);
16956 __Pyx_GIVEREF(__pyx_t_1);
16957 __pyx_t_1 = 0;
16958
16959 /* "View.MemoryView":287
16960 *
16961 * cdef generic = Enum("<strided and direct or indirect>")
16962 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
16963 * cdef indirect = Enum("<strided and indirect>")
16964 *
16965 */
16966 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
16967 __Pyx_GOTREF(__pyx_t_1);
16968 __Pyx_XGOTREF(strided);
16969 __Pyx_DECREF_SET(strided, __pyx_t_1);
16970 __Pyx_GIVEREF(__pyx_t_1);
16971 __pyx_t_1 = 0;
16972
16973 /* "View.MemoryView":288
16974 * cdef generic = Enum("<strided and direct or indirect>")
16975 * cdef strided = Enum("<strided and direct>") # default
16976 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
16977 *
16978 *
16979 */
16980 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
16981 __Pyx_GOTREF(__pyx_t_1);
16982 __Pyx_XGOTREF(indirect);
16983 __Pyx_DECREF_SET(indirect, __pyx_t_1);
16984 __Pyx_GIVEREF(__pyx_t_1);
16985 __pyx_t_1 = 0;
16986
16987 /* "View.MemoryView":291
16988 *
16989 *
16990 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
16991 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
16992 *
16993 */
16994 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
16995 __Pyx_GOTREF(__pyx_t_1);
16996 __Pyx_XGOTREF(contiguous);
16997 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
16998 __Pyx_GIVEREF(__pyx_t_1);
16999 __pyx_t_1 = 0;
17000
17001 /* "View.MemoryView":292
17002 *
17003 * cdef contiguous = Enum("<contiguous and direct>")
17004 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
17005 *
17006 *
17007 */
17008 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
17009 __Pyx_GOTREF(__pyx_t_1);
17010 __Pyx_XGOTREF(indirect_contiguous);
17011 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
17012 __Pyx_GIVEREF(__pyx_t_1);
17013 __pyx_t_1 = 0;
17014
17015 /* "View.MemoryView":316
17016 *
17017 * DEF THREAD_LOCKS_PREALLOCATED = 8
17018 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
17019 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
17020 * PyThread_allocate_lock(),
17021 */
17022 __pyx_memoryview_thread_locks_used = 0;
17023
17024 /* "View.MemoryView":317
17025 * DEF THREAD_LOCKS_PREALLOCATED = 8
17026 * cdef int __pyx_memoryview_thread_locks_used = 0
17027 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
17028 * PyThread_allocate_lock(),
17029 * PyThread_allocate_lock(),
17030 */
17031 __pyx_t_2[0] = PyThread_allocate_lock();
17032 __pyx_t_2[1] = PyThread_allocate_lock();
17033 __pyx_t_2[2] = PyThread_allocate_lock();
17034 __pyx_t_2[3] = PyThread_allocate_lock();
17035 __pyx_t_2[4] = PyThread_allocate_lock();
17036 __pyx_t_2[5] = PyThread_allocate_lock();
17037 __pyx_t_2[6] = PyThread_allocate_lock();
17038 __pyx_t_2[7] = PyThread_allocate_lock();
17039 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
17040
17041 /* "View.MemoryView":549
17042 * info.obj = self
17043 *
17044 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
17045 *
17046 *
17047 */
17048 __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
17049 __Pyx_GOTREF(__pyx_t_1);
17050 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
17051 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17052 PyType_Modified(__pyx_memoryview_type);
17053
17054 /* "View.MemoryView":995
17055 * return self.from_object
17056 *
17057 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
17058 *
17059 *
17060 */
17061 __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
17062 __Pyx_GOTREF(__pyx_t_1);
17063 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
17064 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17065 PyType_Modified(__pyx_memoryviewslice_type);
17066
17067 /* "(tree fragment)":1
17068 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
17069 * cdef object __pyx_PickleError
17070 * cdef object __pyx_result
17071 */
17072 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
17073 __Pyx_GOTREF(__pyx_t_1);
17074 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
17075 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17076
17077 /* "(tree fragment)":11
17078 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
17079 * return __pyx_result
17080 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
17081 * __pyx_result.name = __pyx_state[0]
17082 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
17083 */
17084
17085 /*--- Wrapped vars code ---*/
17086
17087 goto __pyx_L0;
17088 __pyx_L1_error:;
17089 __Pyx_XDECREF(__pyx_t_1);
17090 if (__pyx_m) {
17091 if (__pyx_d) {
17092 __Pyx_AddTraceback("init rasterio._example", __pyx_clineno, __pyx_lineno, __pyx_filename);
17093 }
17094 Py_CLEAR(__pyx_m);
17095 } else if (!PyErr_Occurred()) {
17096 PyErr_SetString(PyExc_ImportError, "init rasterio._example");
17097 }
17098 __pyx_L0:;
17099 __Pyx_RefNannyFinishContext();
17100 #if CYTHON_PEP489_MULTI_PHASE_INIT
17101 return (__pyx_m != NULL) ? 0 : -1;
17102 #elif PY_MAJOR_VERSION >= 3
17103 return __pyx_m;
17104 #else
17105 return;
17106 #endif
17107 }
17108
17109 /* --- Runtime support code --- */
17110 /* Refnanny */
17111 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)17112 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
17113 PyObject *m = NULL, *p = NULL;
17114 void *r = NULL;
17115 m = PyImport_ImportModule(modname);
17116 if (!m) goto end;
17117 p = PyObject_GetAttrString(m, "RefNannyAPI");
17118 if (!p) goto end;
17119 r = PyLong_AsVoidPtr(p);
17120 end:
17121 Py_XDECREF(p);
17122 Py_XDECREF(m);
17123 return (__Pyx_RefNannyAPIStruct *)r;
17124 }
17125 #endif
17126
17127 /* PyObjectGetAttrStr */
17128 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)17129 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
17130 PyTypeObject* tp = Py_TYPE(obj);
17131 if (likely(tp->tp_getattro))
17132 return tp->tp_getattro(obj, attr_name);
17133 #if PY_MAJOR_VERSION < 3
17134 if (likely(tp->tp_getattr))
17135 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
17136 #endif
17137 return PyObject_GetAttr(obj, attr_name);
17138 }
17139 #endif
17140
17141 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)17142 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
17143 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
17144 if (unlikely(!result)) {
17145 PyErr_Format(PyExc_NameError,
17146 #if PY_MAJOR_VERSION >= 3
17147 "name '%U' is not defined", name);
17148 #else
17149 "name '%.200s' is not defined", PyString_AS_STRING(name));
17150 #endif
17151 }
17152 return result;
17153 }
17154
17155 /* PyDictVersioning */
17156 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)17157 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
17158 PyObject *dict = Py_TYPE(obj)->tp_dict;
17159 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
17160 }
__Pyx_get_object_dict_version(PyObject * obj)17161 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
17162 PyObject **dictptr = NULL;
17163 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
17164 if (offset) {
17165 #if CYTHON_COMPILING_IN_CPYTHON
17166 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
17167 #else
17168 dictptr = _PyObject_GetDictPtr(obj);
17169 #endif
17170 }
17171 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
17172 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)17173 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
17174 PyObject *dict = Py_TYPE(obj)->tp_dict;
17175 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
17176 return 0;
17177 return obj_dict_version == __Pyx_get_object_dict_version(obj);
17178 }
17179 #endif
17180
17181 /* GetModuleGlobalName */
17182 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)17183 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
17184 #else
17185 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
17186 #endif
17187 {
17188 PyObject *result;
17189 #if !CYTHON_AVOID_BORROWED_REFS
17190 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
17191 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
17192 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17193 if (likely(result)) {
17194 return __Pyx_NewRef(result);
17195 } else if (unlikely(PyErr_Occurred())) {
17196 return NULL;
17197 }
17198 #else
17199 result = PyDict_GetItem(__pyx_d, name);
17200 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17201 if (likely(result)) {
17202 return __Pyx_NewRef(result);
17203 }
17204 #endif
17205 #else
17206 result = PyObject_GetItem(__pyx_d, name);
17207 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17208 if (likely(result)) {
17209 return __Pyx_NewRef(result);
17210 }
17211 PyErr_Clear();
17212 #endif
17213 return __Pyx_GetBuiltinName(name);
17214 }
17215
17216 /* PyObjectCall */
17217 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)17218 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
17219 PyObject *result;
17220 ternaryfunc call = func->ob_type->tp_call;
17221 if (unlikely(!call))
17222 return PyObject_Call(func, arg, kw);
17223 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
17224 return NULL;
17225 result = (*call)(func, arg, kw);
17226 Py_LeaveRecursiveCall();
17227 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
17228 PyErr_SetString(
17229 PyExc_SystemError,
17230 "NULL result without error in PyObject_Call");
17231 }
17232 return result;
17233 }
17234 #endif
17235
17236 /* MemviewSliceInit */
17237 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)17238 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
17239 int ndim,
17240 __Pyx_memviewslice *memviewslice,
17241 int memview_is_new_reference)
17242 {
17243 __Pyx_RefNannyDeclarations
17244 int i, retval=-1;
17245 Py_buffer *buf = &memview->view;
17246 __Pyx_RefNannySetupContext("init_memviewslice", 0);
17247 if (unlikely(memviewslice->memview || memviewslice->data)) {
17248 PyErr_SetString(PyExc_ValueError,
17249 "memviewslice is already initialized!");
17250 goto fail;
17251 }
17252 if (buf->strides) {
17253 for (i = 0; i < ndim; i++) {
17254 memviewslice->strides[i] = buf->strides[i];
17255 }
17256 } else {
17257 Py_ssize_t stride = buf->itemsize;
17258 for (i = ndim - 1; i >= 0; i--) {
17259 memviewslice->strides[i] = stride;
17260 stride *= buf->shape[i];
17261 }
17262 }
17263 for (i = 0; i < ndim; i++) {
17264 memviewslice->shape[i] = buf->shape[i];
17265 if (buf->suboffsets) {
17266 memviewslice->suboffsets[i] = buf->suboffsets[i];
17267 } else {
17268 memviewslice->suboffsets[i] = -1;
17269 }
17270 }
17271 memviewslice->memview = memview;
17272 memviewslice->data = (char *)buf->buf;
17273 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
17274 Py_INCREF(memview);
17275 }
17276 retval = 0;
17277 goto no_fail;
17278 fail:
17279 memviewslice->memview = 0;
17280 memviewslice->data = 0;
17281 retval = -1;
17282 no_fail:
17283 __Pyx_RefNannyFinishContext();
17284 return retval;
17285 }
17286 #ifndef Py_NO_RETURN
17287 #define Py_NO_RETURN
17288 #endif
__pyx_fatalerror(const char * fmt,...)17289 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
17290 va_list vargs;
17291 char msg[200];
17292 #ifdef HAVE_STDARG_PROTOTYPES
17293 va_start(vargs, fmt);
17294 #else
17295 va_start(vargs);
17296 #endif
17297 vsnprintf(msg, 200, fmt, vargs);
17298 va_end(vargs);
17299 Py_FatalError(msg);
17300 }
17301 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)17302 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
17303 PyThread_type_lock lock)
17304 {
17305 int result;
17306 PyThread_acquire_lock(lock, 1);
17307 result = (*acquisition_count)++;
17308 PyThread_release_lock(lock);
17309 return result;
17310 }
17311 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)17312 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
17313 PyThread_type_lock lock)
17314 {
17315 int result;
17316 PyThread_acquire_lock(lock, 1);
17317 result = (*acquisition_count)--;
17318 PyThread_release_lock(lock);
17319 return result;
17320 }
17321 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)17322 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
17323 {
17324 int first_time;
17325 struct __pyx_memoryview_obj *memview = memslice->memview;
17326 if (unlikely(!memview || (PyObject *) memview == Py_None))
17327 return;
17328 if (unlikely(__pyx_get_slice_count(memview) < 0))
17329 __pyx_fatalerror("Acquisition count is %d (line %d)",
17330 __pyx_get_slice_count(memview), lineno);
17331 first_time = __pyx_add_acquisition_count(memview) == 0;
17332 if (unlikely(first_time)) {
17333 if (have_gil) {
17334 Py_INCREF((PyObject *) memview);
17335 } else {
17336 PyGILState_STATE _gilstate = PyGILState_Ensure();
17337 Py_INCREF((PyObject *) memview);
17338 PyGILState_Release(_gilstate);
17339 }
17340 }
17341 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)17342 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
17343 int have_gil, int lineno) {
17344 int last_time;
17345 struct __pyx_memoryview_obj *memview = memslice->memview;
17346 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
17347 memslice->memview = NULL;
17348 return;
17349 }
17350 if (unlikely(__pyx_get_slice_count(memview) <= 0))
17351 __pyx_fatalerror("Acquisition count is %d (line %d)",
17352 __pyx_get_slice_count(memview), lineno);
17353 last_time = __pyx_sub_acquisition_count(memview) == 1;
17354 memslice->data = NULL;
17355 if (unlikely(last_time)) {
17356 if (have_gil) {
17357 Py_CLEAR(memslice->memview);
17358 } else {
17359 PyGILState_STATE _gilstate = PyGILState_Ensure();
17360 Py_CLEAR(memslice->memview);
17361 PyGILState_Release(_gilstate);
17362 }
17363 } else {
17364 memslice->memview = NULL;
17365 }
17366 }
17367
17368 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)17369 static void __Pyx_RaiseArgtupleInvalid(
17370 const char* func_name,
17371 int exact,
17372 Py_ssize_t num_min,
17373 Py_ssize_t num_max,
17374 Py_ssize_t num_found)
17375 {
17376 Py_ssize_t num_expected;
17377 const char *more_or_less;
17378 if (num_found < num_min) {
17379 num_expected = num_min;
17380 more_or_less = "at least";
17381 } else {
17382 num_expected = num_max;
17383 more_or_less = "at most";
17384 }
17385 if (exact) {
17386 more_or_less = "exactly";
17387 }
17388 PyErr_Format(PyExc_TypeError,
17389 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
17390 func_name, more_or_less, num_expected,
17391 (num_expected == 1) ? "" : "s", num_found);
17392 }
17393
17394 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)17395 static void __Pyx_RaiseDoubleKeywordsError(
17396 const char* func_name,
17397 PyObject* kw_name)
17398 {
17399 PyErr_Format(PyExc_TypeError,
17400 #if PY_MAJOR_VERSION >= 3
17401 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
17402 #else
17403 "%s() got multiple values for keyword argument '%s'", func_name,
17404 PyString_AsString(kw_name));
17405 #endif
17406 }
17407
17408 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)17409 static int __Pyx_ParseOptionalKeywords(
17410 PyObject *kwds,
17411 PyObject **argnames[],
17412 PyObject *kwds2,
17413 PyObject *values[],
17414 Py_ssize_t num_pos_args,
17415 const char* function_name)
17416 {
17417 PyObject *key = 0, *value = 0;
17418 Py_ssize_t pos = 0;
17419 PyObject*** name;
17420 PyObject*** first_kw_arg = argnames + num_pos_args;
17421 while (PyDict_Next(kwds, &pos, &key, &value)) {
17422 name = first_kw_arg;
17423 while (*name && (**name != key)) name++;
17424 if (*name) {
17425 values[name-argnames] = value;
17426 continue;
17427 }
17428 name = first_kw_arg;
17429 #if PY_MAJOR_VERSION < 3
17430 if (likely(PyString_Check(key))) {
17431 while (*name) {
17432 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
17433 && _PyString_Eq(**name, key)) {
17434 values[name-argnames] = value;
17435 break;
17436 }
17437 name++;
17438 }
17439 if (*name) continue;
17440 else {
17441 PyObject*** argname = argnames;
17442 while (argname != first_kw_arg) {
17443 if ((**argname == key) || (
17444 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
17445 && _PyString_Eq(**argname, key))) {
17446 goto arg_passed_twice;
17447 }
17448 argname++;
17449 }
17450 }
17451 } else
17452 #endif
17453 if (likely(PyUnicode_Check(key))) {
17454 while (*name) {
17455 int cmp = (**name == key) ? 0 :
17456 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
17457 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
17458 #endif
17459 PyUnicode_Compare(**name, key);
17460 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
17461 if (cmp == 0) {
17462 values[name-argnames] = value;
17463 break;
17464 }
17465 name++;
17466 }
17467 if (*name) continue;
17468 else {
17469 PyObject*** argname = argnames;
17470 while (argname != first_kw_arg) {
17471 int cmp = (**argname == key) ? 0 :
17472 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
17473 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
17474 #endif
17475 PyUnicode_Compare(**argname, key);
17476 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
17477 if (cmp == 0) goto arg_passed_twice;
17478 argname++;
17479 }
17480 }
17481 } else
17482 goto invalid_keyword_type;
17483 if (kwds2) {
17484 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
17485 } else {
17486 goto invalid_keyword;
17487 }
17488 }
17489 return 0;
17490 arg_passed_twice:
17491 __Pyx_RaiseDoubleKeywordsError(function_name, key);
17492 goto bad;
17493 invalid_keyword_type:
17494 PyErr_Format(PyExc_TypeError,
17495 "%.200s() keywords must be strings", function_name);
17496 goto bad;
17497 invalid_keyword:
17498 PyErr_Format(PyExc_TypeError,
17499 #if PY_MAJOR_VERSION < 3
17500 "%.200s() got an unexpected keyword argument '%.200s'",
17501 function_name, PyString_AsString(key));
17502 #else
17503 "%s() got an unexpected keyword argument '%U'",
17504 function_name, key);
17505 #endif
17506 bad:
17507 return -1;
17508 }
17509
17510 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)17511 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
17512 {
17513 if (unlikely(!type)) {
17514 PyErr_SetString(PyExc_SystemError, "Missing type object");
17515 return 0;
17516 }
17517 else if (exact) {
17518 #if PY_MAJOR_VERSION == 2
17519 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
17520 #endif
17521 }
17522 else {
17523 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
17524 }
17525 PyErr_Format(PyExc_TypeError,
17526 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
17527 name, type->tp_name, Py_TYPE(obj)->tp_name);
17528 return 0;
17529 }
17530
17531 /* PyErrFetchRestore */
17532 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)17533 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
17534 PyObject *tmp_type, *tmp_value, *tmp_tb;
17535 tmp_type = tstate->curexc_type;
17536 tmp_value = tstate->curexc_value;
17537 tmp_tb = tstate->curexc_traceback;
17538 tstate->curexc_type = type;
17539 tstate->curexc_value = value;
17540 tstate->curexc_traceback = tb;
17541 Py_XDECREF(tmp_type);
17542 Py_XDECREF(tmp_value);
17543 Py_XDECREF(tmp_tb);
17544 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)17545 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
17546 *type = tstate->curexc_type;
17547 *value = tstate->curexc_value;
17548 *tb = tstate->curexc_traceback;
17549 tstate->curexc_type = 0;
17550 tstate->curexc_value = 0;
17551 tstate->curexc_traceback = 0;
17552 }
17553 #endif
17554
17555 /* RaiseException */
17556 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)17557 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
17558 CYTHON_UNUSED PyObject *cause) {
17559 __Pyx_PyThreadState_declare
17560 Py_XINCREF(type);
17561 if (!value || value == Py_None)
17562 value = NULL;
17563 else
17564 Py_INCREF(value);
17565 if (!tb || tb == Py_None)
17566 tb = NULL;
17567 else {
17568 Py_INCREF(tb);
17569 if (!PyTraceBack_Check(tb)) {
17570 PyErr_SetString(PyExc_TypeError,
17571 "raise: arg 3 must be a traceback or None");
17572 goto raise_error;
17573 }
17574 }
17575 if (PyType_Check(type)) {
17576 #if CYTHON_COMPILING_IN_PYPY
17577 if (!value) {
17578 Py_INCREF(Py_None);
17579 value = Py_None;
17580 }
17581 #endif
17582 PyErr_NormalizeException(&type, &value, &tb);
17583 } else {
17584 if (value) {
17585 PyErr_SetString(PyExc_TypeError,
17586 "instance exception may not have a separate value");
17587 goto raise_error;
17588 }
17589 value = type;
17590 type = (PyObject*) Py_TYPE(type);
17591 Py_INCREF(type);
17592 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
17593 PyErr_SetString(PyExc_TypeError,
17594 "raise: exception class must be a subclass of BaseException");
17595 goto raise_error;
17596 }
17597 }
17598 __Pyx_PyThreadState_assign
17599 __Pyx_ErrRestore(type, value, tb);
17600 return;
17601 raise_error:
17602 Py_XDECREF(value);
17603 Py_XDECREF(type);
17604 Py_XDECREF(tb);
17605 return;
17606 }
17607 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)17608 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
17609 PyObject* owned_instance = NULL;
17610 if (tb == Py_None) {
17611 tb = 0;
17612 } else if (tb && !PyTraceBack_Check(tb)) {
17613 PyErr_SetString(PyExc_TypeError,
17614 "raise: arg 3 must be a traceback or None");
17615 goto bad;
17616 }
17617 if (value == Py_None)
17618 value = 0;
17619 if (PyExceptionInstance_Check(type)) {
17620 if (value) {
17621 PyErr_SetString(PyExc_TypeError,
17622 "instance exception may not have a separate value");
17623 goto bad;
17624 }
17625 value = type;
17626 type = (PyObject*) Py_TYPE(value);
17627 } else if (PyExceptionClass_Check(type)) {
17628 PyObject *instance_class = NULL;
17629 if (value && PyExceptionInstance_Check(value)) {
17630 instance_class = (PyObject*) Py_TYPE(value);
17631 if (instance_class != type) {
17632 int is_subclass = PyObject_IsSubclass(instance_class, type);
17633 if (!is_subclass) {
17634 instance_class = NULL;
17635 } else if (unlikely(is_subclass == -1)) {
17636 goto bad;
17637 } else {
17638 type = instance_class;
17639 }
17640 }
17641 }
17642 if (!instance_class) {
17643 PyObject *args;
17644 if (!value)
17645 args = PyTuple_New(0);
17646 else if (PyTuple_Check(value)) {
17647 Py_INCREF(value);
17648 args = value;
17649 } else
17650 args = PyTuple_Pack(1, value);
17651 if (!args)
17652 goto bad;
17653 owned_instance = PyObject_Call(type, args, NULL);
17654 Py_DECREF(args);
17655 if (!owned_instance)
17656 goto bad;
17657 value = owned_instance;
17658 if (!PyExceptionInstance_Check(value)) {
17659 PyErr_Format(PyExc_TypeError,
17660 "calling %R should have returned an instance of "
17661 "BaseException, not %R",
17662 type, Py_TYPE(value));
17663 goto bad;
17664 }
17665 }
17666 } else {
17667 PyErr_SetString(PyExc_TypeError,
17668 "raise: exception class must be a subclass of BaseException");
17669 goto bad;
17670 }
17671 if (cause) {
17672 PyObject *fixed_cause;
17673 if (cause == Py_None) {
17674 fixed_cause = NULL;
17675 } else if (PyExceptionClass_Check(cause)) {
17676 fixed_cause = PyObject_CallObject(cause, NULL);
17677 if (fixed_cause == NULL)
17678 goto bad;
17679 } else if (PyExceptionInstance_Check(cause)) {
17680 fixed_cause = cause;
17681 Py_INCREF(fixed_cause);
17682 } else {
17683 PyErr_SetString(PyExc_TypeError,
17684 "exception causes must derive from "
17685 "BaseException");
17686 goto bad;
17687 }
17688 PyException_SetCause(value, fixed_cause);
17689 }
17690 PyErr_SetObject(type, value);
17691 if (tb) {
17692 #if CYTHON_COMPILING_IN_PYPY
17693 PyObject *tmp_type, *tmp_value, *tmp_tb;
17694 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
17695 Py_INCREF(tb);
17696 PyErr_Restore(tmp_type, tmp_value, tb);
17697 Py_XDECREF(tmp_tb);
17698 #else
17699 PyThreadState *tstate = __Pyx_PyThreadState_Current;
17700 PyObject* tmp_tb = tstate->curexc_traceback;
17701 if (tb != tmp_tb) {
17702 Py_INCREF(tb);
17703 tstate->curexc_traceback = tb;
17704 Py_XDECREF(tmp_tb);
17705 }
17706 #endif
17707 }
17708 bad:
17709 Py_XDECREF(owned_instance);
17710 return;
17711 }
17712 #endif
17713
17714 /* PyCFunctionFastCall */
17715 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)17716 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
17717 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
17718 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
17719 PyObject *self = PyCFunction_GET_SELF(func);
17720 int flags = PyCFunction_GET_FLAGS(func);
17721 assert(PyCFunction_Check(func));
17722 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
17723 assert(nargs >= 0);
17724 assert(nargs == 0 || args != NULL);
17725 /* _PyCFunction_FastCallDict() must not be called with an exception set,
17726 because it may clear it (directly or indirectly) and so the
17727 caller loses its exception */
17728 assert(!PyErr_Occurred());
17729 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
17730 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
17731 } else {
17732 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
17733 }
17734 }
17735 #endif
17736
17737 /* PyFunctionFastCall */
17738 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)17739 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
17740 PyObject *globals) {
17741 PyFrameObject *f;
17742 PyThreadState *tstate = __Pyx_PyThreadState_Current;
17743 PyObject **fastlocals;
17744 Py_ssize_t i;
17745 PyObject *result;
17746 assert(globals != NULL);
17747 /* XXX Perhaps we should create a specialized
17748 PyFrame_New() that doesn't take locals, but does
17749 take builtins without sanity checking them.
17750 */
17751 assert(tstate != NULL);
17752 f = PyFrame_New(tstate, co, globals, NULL);
17753 if (f == NULL) {
17754 return NULL;
17755 }
17756 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
17757 for (i = 0; i < na; i++) {
17758 Py_INCREF(*args);
17759 fastlocals[i] = *args++;
17760 }
17761 result = PyEval_EvalFrameEx(f,0);
17762 ++tstate->recursion_depth;
17763 Py_DECREF(f);
17764 --tstate->recursion_depth;
17765 return result;
17766 }
17767 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)17768 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
17769 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
17770 PyObject *globals = PyFunction_GET_GLOBALS(func);
17771 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
17772 PyObject *closure;
17773 #if PY_MAJOR_VERSION >= 3
17774 PyObject *kwdefs;
17775 #endif
17776 PyObject *kwtuple, **k;
17777 PyObject **d;
17778 Py_ssize_t nd;
17779 Py_ssize_t nk;
17780 PyObject *result;
17781 assert(kwargs == NULL || PyDict_Check(kwargs));
17782 nk = kwargs ? PyDict_Size(kwargs) : 0;
17783 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
17784 return NULL;
17785 }
17786 if (
17787 #if PY_MAJOR_VERSION >= 3
17788 co->co_kwonlyargcount == 0 &&
17789 #endif
17790 likely(kwargs == NULL || nk == 0) &&
17791 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
17792 if (argdefs == NULL && co->co_argcount == nargs) {
17793 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
17794 goto done;
17795 }
17796 else if (nargs == 0 && argdefs != NULL
17797 && co->co_argcount == Py_SIZE(argdefs)) {
17798 /* function called with no arguments, but all parameters have
17799 a default value: use default values as arguments .*/
17800 args = &PyTuple_GET_ITEM(argdefs, 0);
17801 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
17802 goto done;
17803 }
17804 }
17805 if (kwargs != NULL) {
17806 Py_ssize_t pos, i;
17807 kwtuple = PyTuple_New(2 * nk);
17808 if (kwtuple == NULL) {
17809 result = NULL;
17810 goto done;
17811 }
17812 k = &PyTuple_GET_ITEM(kwtuple, 0);
17813 pos = i = 0;
17814 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
17815 Py_INCREF(k[i]);
17816 Py_INCREF(k[i+1]);
17817 i += 2;
17818 }
17819 nk = i / 2;
17820 }
17821 else {
17822 kwtuple = NULL;
17823 k = NULL;
17824 }
17825 closure = PyFunction_GET_CLOSURE(func);
17826 #if PY_MAJOR_VERSION >= 3
17827 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
17828 #endif
17829 if (argdefs != NULL) {
17830 d = &PyTuple_GET_ITEM(argdefs, 0);
17831 nd = Py_SIZE(argdefs);
17832 }
17833 else {
17834 d = NULL;
17835 nd = 0;
17836 }
17837 #if PY_MAJOR_VERSION >= 3
17838 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
17839 args, (int)nargs,
17840 k, (int)nk,
17841 d, (int)nd, kwdefs, closure);
17842 #else
17843 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
17844 args, (int)nargs,
17845 k, (int)nk,
17846 d, (int)nd, closure);
17847 #endif
17848 Py_XDECREF(kwtuple);
17849 done:
17850 Py_LeaveRecursiveCall();
17851 return result;
17852 }
17853 #endif
17854 #endif
17855
17856 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)17857 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
17858 PyObject *args, *result = NULL;
17859 #if CYTHON_FAST_PYCALL
17860 if (PyFunction_Check(function)) {
17861 PyObject *args[2] = {arg1, arg2};
17862 return __Pyx_PyFunction_FastCall(function, args, 2);
17863 }
17864 #endif
17865 #if CYTHON_FAST_PYCCALL
17866 if (__Pyx_PyFastCFunction_Check(function)) {
17867 PyObject *args[2] = {arg1, arg2};
17868 return __Pyx_PyCFunction_FastCall(function, args, 2);
17869 }
17870 #endif
17871 args = PyTuple_New(2);
17872 if (unlikely(!args)) goto done;
17873 Py_INCREF(arg1);
17874 PyTuple_SET_ITEM(args, 0, arg1);
17875 Py_INCREF(arg2);
17876 PyTuple_SET_ITEM(args, 1, arg2);
17877 Py_INCREF(function);
17878 result = __Pyx_PyObject_Call(function, args, NULL);
17879 Py_DECREF(args);
17880 Py_DECREF(function);
17881 done:
17882 return result;
17883 }
17884
17885 /* PyObjectCallMethO */
17886 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)17887 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
17888 PyObject *self, *result;
17889 PyCFunction cfunc;
17890 cfunc = PyCFunction_GET_FUNCTION(func);
17891 self = PyCFunction_GET_SELF(func);
17892 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
17893 return NULL;
17894 result = cfunc(self, arg);
17895 Py_LeaveRecursiveCall();
17896 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
17897 PyErr_SetString(
17898 PyExc_SystemError,
17899 "NULL result without error in PyObject_Call");
17900 }
17901 return result;
17902 }
17903 #endif
17904
17905 /* PyObjectCallOneArg */
17906 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)17907 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
17908 PyObject *result;
17909 PyObject *args = PyTuple_New(1);
17910 if (unlikely(!args)) return NULL;
17911 Py_INCREF(arg);
17912 PyTuple_SET_ITEM(args, 0, arg);
17913 result = __Pyx_PyObject_Call(func, args, NULL);
17914 Py_DECREF(args);
17915 return result;
17916 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)17917 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
17918 #if CYTHON_FAST_PYCALL
17919 if (PyFunction_Check(func)) {
17920 return __Pyx_PyFunction_FastCall(func, &arg, 1);
17921 }
17922 #endif
17923 if (likely(PyCFunction_Check(func))) {
17924 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
17925 return __Pyx_PyObject_CallMethO(func, arg);
17926 #if CYTHON_FAST_PYCCALL
17927 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
17928 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
17929 #endif
17930 }
17931 }
17932 return __Pyx__PyObject_CallOneArg(func, arg);
17933 }
17934 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)17935 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
17936 PyObject *result;
17937 PyObject *args = PyTuple_Pack(1, arg);
17938 if (unlikely(!args)) return NULL;
17939 result = __Pyx_PyObject_Call(func, args, NULL);
17940 Py_DECREF(args);
17941 return result;
17942 }
17943 #endif
17944
17945 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)17946 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
17947 #if CYTHON_COMPILING_IN_PYPY
17948 return PyObject_RichCompareBool(s1, s2, equals);
17949 #else
17950 if (s1 == s2) {
17951 return (equals == Py_EQ);
17952 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
17953 const char *ps1, *ps2;
17954 Py_ssize_t length = PyBytes_GET_SIZE(s1);
17955 if (length != PyBytes_GET_SIZE(s2))
17956 return (equals == Py_NE);
17957 ps1 = PyBytes_AS_STRING(s1);
17958 ps2 = PyBytes_AS_STRING(s2);
17959 if (ps1[0] != ps2[0]) {
17960 return (equals == Py_NE);
17961 } else if (length == 1) {
17962 return (equals == Py_EQ);
17963 } else {
17964 int result;
17965 #if CYTHON_USE_UNICODE_INTERNALS
17966 Py_hash_t hash1, hash2;
17967 hash1 = ((PyBytesObject*)s1)->ob_shash;
17968 hash2 = ((PyBytesObject*)s2)->ob_shash;
17969 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
17970 return (equals == Py_NE);
17971 }
17972 #endif
17973 result = memcmp(ps1, ps2, (size_t)length);
17974 return (equals == Py_EQ) ? (result == 0) : (result != 0);
17975 }
17976 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
17977 return (equals == Py_NE);
17978 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
17979 return (equals == Py_NE);
17980 } else {
17981 int result;
17982 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
17983 if (!py_result)
17984 return -1;
17985 result = __Pyx_PyObject_IsTrue(py_result);
17986 Py_DECREF(py_result);
17987 return result;
17988 }
17989 #endif
17990 }
17991
17992 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)17993 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
17994 #if CYTHON_COMPILING_IN_PYPY
17995 return PyObject_RichCompareBool(s1, s2, equals);
17996 #else
17997 #if PY_MAJOR_VERSION < 3
17998 PyObject* owned_ref = NULL;
17999 #endif
18000 int s1_is_unicode, s2_is_unicode;
18001 if (s1 == s2) {
18002 goto return_eq;
18003 }
18004 s1_is_unicode = PyUnicode_CheckExact(s1);
18005 s2_is_unicode = PyUnicode_CheckExact(s2);
18006 #if PY_MAJOR_VERSION < 3
18007 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
18008 owned_ref = PyUnicode_FromObject(s2);
18009 if (unlikely(!owned_ref))
18010 return -1;
18011 s2 = owned_ref;
18012 s2_is_unicode = 1;
18013 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
18014 owned_ref = PyUnicode_FromObject(s1);
18015 if (unlikely(!owned_ref))
18016 return -1;
18017 s1 = owned_ref;
18018 s1_is_unicode = 1;
18019 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
18020 return __Pyx_PyBytes_Equals(s1, s2, equals);
18021 }
18022 #endif
18023 if (s1_is_unicode & s2_is_unicode) {
18024 Py_ssize_t length;
18025 int kind;
18026 void *data1, *data2;
18027 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
18028 return -1;
18029 length = __Pyx_PyUnicode_GET_LENGTH(s1);
18030 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
18031 goto return_ne;
18032 }
18033 #if CYTHON_USE_UNICODE_INTERNALS
18034 {
18035 Py_hash_t hash1, hash2;
18036 #if CYTHON_PEP393_ENABLED
18037 hash1 = ((PyASCIIObject*)s1)->hash;
18038 hash2 = ((PyASCIIObject*)s2)->hash;
18039 #else
18040 hash1 = ((PyUnicodeObject*)s1)->hash;
18041 hash2 = ((PyUnicodeObject*)s2)->hash;
18042 #endif
18043 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
18044 goto return_ne;
18045 }
18046 }
18047 #endif
18048 kind = __Pyx_PyUnicode_KIND(s1);
18049 if (kind != __Pyx_PyUnicode_KIND(s2)) {
18050 goto return_ne;
18051 }
18052 data1 = __Pyx_PyUnicode_DATA(s1);
18053 data2 = __Pyx_PyUnicode_DATA(s2);
18054 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
18055 goto return_ne;
18056 } else if (length == 1) {
18057 goto return_eq;
18058 } else {
18059 int result = memcmp(data1, data2, (size_t)(length * kind));
18060 #if PY_MAJOR_VERSION < 3
18061 Py_XDECREF(owned_ref);
18062 #endif
18063 return (equals == Py_EQ) ? (result == 0) : (result != 0);
18064 }
18065 } else if ((s1 == Py_None) & s2_is_unicode) {
18066 goto return_ne;
18067 } else if ((s2 == Py_None) & s1_is_unicode) {
18068 goto return_ne;
18069 } else {
18070 int result;
18071 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
18072 #if PY_MAJOR_VERSION < 3
18073 Py_XDECREF(owned_ref);
18074 #endif
18075 if (!py_result)
18076 return -1;
18077 result = __Pyx_PyObject_IsTrue(py_result);
18078 Py_DECREF(py_result);
18079 return result;
18080 }
18081 return_eq:
18082 #if PY_MAJOR_VERSION < 3
18083 Py_XDECREF(owned_ref);
18084 #endif
18085 return (equals == Py_EQ);
18086 return_ne:
18087 #if PY_MAJOR_VERSION < 3
18088 Py_XDECREF(owned_ref);
18089 #endif
18090 return (equals == Py_NE);
18091 #endif
18092 }
18093
18094 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)18095 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
18096 Py_ssize_t q = a / b;
18097 Py_ssize_t r = a - q*b;
18098 q -= ((r != 0) & ((r ^ b) < 0));
18099 return q;
18100 }
18101
18102 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)18103 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
18104 #if CYTHON_USE_TYPE_SLOTS
18105 #if PY_MAJOR_VERSION >= 3
18106 if (likely(PyUnicode_Check(n)))
18107 #else
18108 if (likely(PyString_Check(n)))
18109 #endif
18110 return __Pyx_PyObject_GetAttrStr(o, n);
18111 #endif
18112 return PyObject_GetAttr(o, n);
18113 }
18114
18115 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)18116 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
18117 PyObject *r;
18118 if (!j) return NULL;
18119 r = PyObject_GetItem(o, j);
18120 Py_DECREF(j);
18121 return r;
18122 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)18123 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
18124 CYTHON_NCP_UNUSED int wraparound,
18125 CYTHON_NCP_UNUSED int boundscheck) {
18126 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18127 Py_ssize_t wrapped_i = i;
18128 if (wraparound & unlikely(i < 0)) {
18129 wrapped_i += PyList_GET_SIZE(o);
18130 }
18131 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
18132 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
18133 Py_INCREF(r);
18134 return r;
18135 }
18136 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
18137 #else
18138 return PySequence_GetItem(o, i);
18139 #endif
18140 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)18141 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
18142 CYTHON_NCP_UNUSED int wraparound,
18143 CYTHON_NCP_UNUSED int boundscheck) {
18144 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18145 Py_ssize_t wrapped_i = i;
18146 if (wraparound & unlikely(i < 0)) {
18147 wrapped_i += PyTuple_GET_SIZE(o);
18148 }
18149 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
18150 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
18151 Py_INCREF(r);
18152 return r;
18153 }
18154 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
18155 #else
18156 return PySequence_GetItem(o, i);
18157 #endif
18158 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)18159 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
18160 CYTHON_NCP_UNUSED int wraparound,
18161 CYTHON_NCP_UNUSED int boundscheck) {
18162 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
18163 if (is_list || PyList_CheckExact(o)) {
18164 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
18165 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
18166 PyObject *r = PyList_GET_ITEM(o, n);
18167 Py_INCREF(r);
18168 return r;
18169 }
18170 }
18171 else if (PyTuple_CheckExact(o)) {
18172 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
18173 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
18174 PyObject *r = PyTuple_GET_ITEM(o, n);
18175 Py_INCREF(r);
18176 return r;
18177 }
18178 } else {
18179 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
18180 if (likely(m && m->sq_item)) {
18181 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
18182 Py_ssize_t l = m->sq_length(o);
18183 if (likely(l >= 0)) {
18184 i += l;
18185 } else {
18186 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
18187 return NULL;
18188 PyErr_Clear();
18189 }
18190 }
18191 return m->sq_item(o, i);
18192 }
18193 }
18194 #else
18195 if (is_list || PySequence_Check(o)) {
18196 return PySequence_GetItem(o, i);
18197 }
18198 #endif
18199 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
18200 }
18201
18202 /* ObjectGetItem */
18203 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)18204 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
18205 PyObject *runerr;
18206 Py_ssize_t key_value;
18207 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
18208 if (unlikely(!(m && m->sq_item))) {
18209 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
18210 return NULL;
18211 }
18212 key_value = __Pyx_PyIndex_AsSsize_t(index);
18213 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
18214 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
18215 }
18216 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
18217 PyErr_Clear();
18218 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
18219 }
18220 return NULL;
18221 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)18222 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
18223 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
18224 if (likely(m && m->mp_subscript)) {
18225 return m->mp_subscript(obj, key);
18226 }
18227 return __Pyx_PyObject_GetIndex(obj, key);
18228 }
18229 #endif
18230
18231 /* 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))18232 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
18233 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
18234 const char* encoding, const char* errors,
18235 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
18236 Py_ssize_t length;
18237 if (unlikely((start < 0) | (stop < 0))) {
18238 size_t slen = strlen(cstring);
18239 if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
18240 PyErr_SetString(PyExc_OverflowError,
18241 "c-string too long to convert to Python");
18242 return NULL;
18243 }
18244 length = (Py_ssize_t) slen;
18245 if (start < 0) {
18246 start += length;
18247 if (start < 0)
18248 start = 0;
18249 }
18250 if (stop < 0)
18251 stop += length;
18252 }
18253 if (unlikely(stop <= start))
18254 return __Pyx_NewRef(__pyx_empty_unicode);
18255 length = stop - start;
18256 cstring += start;
18257 if (decode_func) {
18258 return decode_func(cstring, length, errors);
18259 } else {
18260 return PyUnicode_Decode(cstring, length, encoding, errors);
18261 }
18262 }
18263
18264 /* PyErrExceptionMatches */
18265 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)18266 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
18267 Py_ssize_t i, n;
18268 n = PyTuple_GET_SIZE(tuple);
18269 #if PY_MAJOR_VERSION >= 3
18270 for (i=0; i<n; i++) {
18271 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
18272 }
18273 #endif
18274 for (i=0; i<n; i++) {
18275 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
18276 }
18277 return 0;
18278 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)18279 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
18280 PyObject *exc_type = tstate->curexc_type;
18281 if (exc_type == err) return 1;
18282 if (unlikely(!exc_type)) return 0;
18283 if (unlikely(PyTuple_Check(err)))
18284 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
18285 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
18286 }
18287 #endif
18288
18289 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)18290 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
18291 __Pyx_PyThreadState_declare
18292 __Pyx_PyThreadState_assign
18293 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
18294 return NULL;
18295 __Pyx_PyErr_Clear();
18296 Py_INCREF(d);
18297 return d;
18298 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)18299 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
18300 PyObject *r = __Pyx_GetAttr(o, n);
18301 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
18302 }
18303
18304 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)18305 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
18306 PyErr_Format(PyExc_ValueError,
18307 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
18308 }
18309
18310 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)18311 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
18312 PyErr_Format(PyExc_ValueError,
18313 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
18314 index, (index == 1) ? "" : "s");
18315 }
18316
18317 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)18318 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
18319 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
18320 }
18321
18322 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)18323 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
18324 if (unlikely(!type)) {
18325 PyErr_SetString(PyExc_SystemError, "Missing type object");
18326 return 0;
18327 }
18328 if (likely(__Pyx_TypeCheck(obj, type)))
18329 return 1;
18330 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
18331 Py_TYPE(obj)->tp_name, type->tp_name);
18332 return 0;
18333 }
18334
18335 /* GetTopmostException */
18336 #if CYTHON_USE_EXC_INFO_STACK
18337 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)18338 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
18339 {
18340 _PyErr_StackItem *exc_info = tstate->exc_info;
18341 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
18342 exc_info->previous_item != NULL)
18343 {
18344 exc_info = exc_info->previous_item;
18345 }
18346 return exc_info;
18347 }
18348 #endif
18349
18350 /* SaveResetException */
18351 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18352 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
18353 #if CYTHON_USE_EXC_INFO_STACK
18354 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
18355 *type = exc_info->exc_type;
18356 *value = exc_info->exc_value;
18357 *tb = exc_info->exc_traceback;
18358 #else
18359 *type = tstate->exc_type;
18360 *value = tstate->exc_value;
18361 *tb = tstate->exc_traceback;
18362 #endif
18363 Py_XINCREF(*type);
18364 Py_XINCREF(*value);
18365 Py_XINCREF(*tb);
18366 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)18367 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
18368 PyObject *tmp_type, *tmp_value, *tmp_tb;
18369 #if CYTHON_USE_EXC_INFO_STACK
18370 _PyErr_StackItem *exc_info = tstate->exc_info;
18371 tmp_type = exc_info->exc_type;
18372 tmp_value = exc_info->exc_value;
18373 tmp_tb = exc_info->exc_traceback;
18374 exc_info->exc_type = type;
18375 exc_info->exc_value = value;
18376 exc_info->exc_traceback = tb;
18377 #else
18378 tmp_type = tstate->exc_type;
18379 tmp_value = tstate->exc_value;
18380 tmp_tb = tstate->exc_traceback;
18381 tstate->exc_type = type;
18382 tstate->exc_value = value;
18383 tstate->exc_traceback = tb;
18384 #endif
18385 Py_XDECREF(tmp_type);
18386 Py_XDECREF(tmp_value);
18387 Py_XDECREF(tmp_tb);
18388 }
18389 #endif
18390
18391 /* GetException */
18392 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18393 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
18394 #else
18395 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
18396 #endif
18397 {
18398 PyObject *local_type, *local_value, *local_tb;
18399 #if CYTHON_FAST_THREAD_STATE
18400 PyObject *tmp_type, *tmp_value, *tmp_tb;
18401 local_type = tstate->curexc_type;
18402 local_value = tstate->curexc_value;
18403 local_tb = tstate->curexc_traceback;
18404 tstate->curexc_type = 0;
18405 tstate->curexc_value = 0;
18406 tstate->curexc_traceback = 0;
18407 #else
18408 PyErr_Fetch(&local_type, &local_value, &local_tb);
18409 #endif
18410 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
18411 #if CYTHON_FAST_THREAD_STATE
18412 if (unlikely(tstate->curexc_type))
18413 #else
18414 if (unlikely(PyErr_Occurred()))
18415 #endif
18416 goto bad;
18417 #if PY_MAJOR_VERSION >= 3
18418 if (local_tb) {
18419 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
18420 goto bad;
18421 }
18422 #endif
18423 Py_XINCREF(local_tb);
18424 Py_XINCREF(local_type);
18425 Py_XINCREF(local_value);
18426 *type = local_type;
18427 *value = local_value;
18428 *tb = local_tb;
18429 #if CYTHON_FAST_THREAD_STATE
18430 #if CYTHON_USE_EXC_INFO_STACK
18431 {
18432 _PyErr_StackItem *exc_info = tstate->exc_info;
18433 tmp_type = exc_info->exc_type;
18434 tmp_value = exc_info->exc_value;
18435 tmp_tb = exc_info->exc_traceback;
18436 exc_info->exc_type = local_type;
18437 exc_info->exc_value = local_value;
18438 exc_info->exc_traceback = local_tb;
18439 }
18440 #else
18441 tmp_type = tstate->exc_type;
18442 tmp_value = tstate->exc_value;
18443 tmp_tb = tstate->exc_traceback;
18444 tstate->exc_type = local_type;
18445 tstate->exc_value = local_value;
18446 tstate->exc_traceback = local_tb;
18447 #endif
18448 Py_XDECREF(tmp_type);
18449 Py_XDECREF(tmp_value);
18450 Py_XDECREF(tmp_tb);
18451 #else
18452 PyErr_SetExcInfo(local_type, local_value, local_tb);
18453 #endif
18454 return 0;
18455 bad:
18456 *type = 0;
18457 *value = 0;
18458 *tb = 0;
18459 Py_XDECREF(local_type);
18460 Py_XDECREF(local_value);
18461 Py_XDECREF(local_tb);
18462 return -1;
18463 }
18464
18465 /* SwapException */
18466 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)18467 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
18468 PyObject *tmp_type, *tmp_value, *tmp_tb;
18469 #if CYTHON_USE_EXC_INFO_STACK
18470 _PyErr_StackItem *exc_info = tstate->exc_info;
18471 tmp_type = exc_info->exc_type;
18472 tmp_value = exc_info->exc_value;
18473 tmp_tb = exc_info->exc_traceback;
18474 exc_info->exc_type = *type;
18475 exc_info->exc_value = *value;
18476 exc_info->exc_traceback = *tb;
18477 #else
18478 tmp_type = tstate->exc_type;
18479 tmp_value = tstate->exc_value;
18480 tmp_tb = tstate->exc_traceback;
18481 tstate->exc_type = *type;
18482 tstate->exc_value = *value;
18483 tstate->exc_traceback = *tb;
18484 #endif
18485 *type = tmp_type;
18486 *value = tmp_value;
18487 *tb = tmp_tb;
18488 }
18489 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)18490 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
18491 PyObject *tmp_type, *tmp_value, *tmp_tb;
18492 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
18493 PyErr_SetExcInfo(*type, *value, *tb);
18494 *type = tmp_type;
18495 *value = tmp_value;
18496 *tb = tmp_tb;
18497 }
18498 #endif
18499
18500 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)18501 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
18502 PyObject *empty_list = 0;
18503 PyObject *module = 0;
18504 PyObject *global_dict = 0;
18505 PyObject *empty_dict = 0;
18506 PyObject *list;
18507 #if PY_MAJOR_VERSION < 3
18508 PyObject *py_import;
18509 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
18510 if (!py_import)
18511 goto bad;
18512 #endif
18513 if (from_list)
18514 list = from_list;
18515 else {
18516 empty_list = PyList_New(0);
18517 if (!empty_list)
18518 goto bad;
18519 list = empty_list;
18520 }
18521 global_dict = PyModule_GetDict(__pyx_m);
18522 if (!global_dict)
18523 goto bad;
18524 empty_dict = PyDict_New();
18525 if (!empty_dict)
18526 goto bad;
18527 {
18528 #if PY_MAJOR_VERSION >= 3
18529 if (level == -1) {
18530 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
18531 module = PyImport_ImportModuleLevelObject(
18532 name, global_dict, empty_dict, list, 1);
18533 if (!module) {
18534 if (!PyErr_ExceptionMatches(PyExc_ImportError))
18535 goto bad;
18536 PyErr_Clear();
18537 }
18538 }
18539 level = 0;
18540 }
18541 #endif
18542 if (!module) {
18543 #if PY_MAJOR_VERSION < 3
18544 PyObject *py_level = PyInt_FromLong(level);
18545 if (!py_level)
18546 goto bad;
18547 module = PyObject_CallFunctionObjArgs(py_import,
18548 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
18549 Py_DECREF(py_level);
18550 #else
18551 module = PyImport_ImportModuleLevelObject(
18552 name, global_dict, empty_dict, list, level);
18553 #endif
18554 }
18555 }
18556 bad:
18557 #if PY_MAJOR_VERSION < 3
18558 Py_XDECREF(py_import);
18559 #endif
18560 Py_XDECREF(empty_list);
18561 Py_XDECREF(empty_dict);
18562 return module;
18563 }
18564
18565 /* FastTypeChecks */
18566 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)18567 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
18568 while (a) {
18569 a = a->tp_base;
18570 if (a == b)
18571 return 1;
18572 }
18573 return b == &PyBaseObject_Type;
18574 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)18575 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
18576 PyObject *mro;
18577 if (a == b) return 1;
18578 mro = a->tp_mro;
18579 if (likely(mro)) {
18580 Py_ssize_t i, n;
18581 n = PyTuple_GET_SIZE(mro);
18582 for (i = 0; i < n; i++) {
18583 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
18584 return 1;
18585 }
18586 return 0;
18587 }
18588 return __Pyx_InBases(a, b);
18589 }
18590 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)18591 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
18592 PyObject *exception, *value, *tb;
18593 int res;
18594 __Pyx_PyThreadState_declare
18595 __Pyx_PyThreadState_assign
18596 __Pyx_ErrFetch(&exception, &value, &tb);
18597 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
18598 if (unlikely(res == -1)) {
18599 PyErr_WriteUnraisable(err);
18600 res = 0;
18601 }
18602 if (!res) {
18603 res = PyObject_IsSubclass(err, exc_type2);
18604 if (unlikely(res == -1)) {
18605 PyErr_WriteUnraisable(err);
18606 res = 0;
18607 }
18608 }
18609 __Pyx_ErrRestore(exception, value, tb);
18610 return res;
18611 }
18612 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)18613 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
18614 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
18615 if (!res) {
18616 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
18617 }
18618 return res;
18619 }
18620 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)18621 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
18622 Py_ssize_t i, n;
18623 assert(PyExceptionClass_Check(exc_type));
18624 n = PyTuple_GET_SIZE(tuple);
18625 #if PY_MAJOR_VERSION >= 3
18626 for (i=0; i<n; i++) {
18627 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
18628 }
18629 #endif
18630 for (i=0; i<n; i++) {
18631 PyObject *t = PyTuple_GET_ITEM(tuple, i);
18632 #if PY_MAJOR_VERSION < 3
18633 if (likely(exc_type == t)) return 1;
18634 #endif
18635 if (likely(PyExceptionClass_Check(t))) {
18636 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
18637 } else {
18638 }
18639 }
18640 return 0;
18641 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)18642 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
18643 if (likely(err == exc_type)) return 1;
18644 if (likely(PyExceptionClass_Check(err))) {
18645 if (likely(PyExceptionClass_Check(exc_type))) {
18646 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
18647 } else if (likely(PyTuple_Check(exc_type))) {
18648 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
18649 } else {
18650 }
18651 }
18652 return PyErr_GivenExceptionMatches(err, exc_type);
18653 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)18654 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
18655 assert(PyExceptionClass_Check(exc_type1));
18656 assert(PyExceptionClass_Check(exc_type2));
18657 if (likely(err == exc_type1 || err == exc_type2)) return 1;
18658 if (likely(PyExceptionClass_Check(err))) {
18659 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
18660 }
18661 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
18662 }
18663 #endif
18664
18665 /* PyIntBinop */
18666 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)18667 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
18668 (void)inplace;
18669 (void)zerodivision_check;
18670 #if PY_MAJOR_VERSION < 3
18671 if (likely(PyInt_CheckExact(op1))) {
18672 const long b = intval;
18673 long x;
18674 long a = PyInt_AS_LONG(op1);
18675 x = (long)((unsigned long)a + b);
18676 if (likely((x^a) >= 0 || (x^b) >= 0))
18677 return PyInt_FromLong(x);
18678 return PyLong_Type.tp_as_number->nb_add(op1, op2);
18679 }
18680 #endif
18681 #if CYTHON_USE_PYLONG_INTERNALS
18682 if (likely(PyLong_CheckExact(op1))) {
18683 const long b = intval;
18684 long a, x;
18685 #ifdef HAVE_LONG_LONG
18686 const PY_LONG_LONG llb = intval;
18687 PY_LONG_LONG lla, llx;
18688 #endif
18689 const digit* digits = ((PyLongObject*)op1)->ob_digit;
18690 const Py_ssize_t size = Py_SIZE(op1);
18691 if (likely(__Pyx_sst_abs(size) <= 1)) {
18692 a = likely(size) ? digits[0] : 0;
18693 if (size == -1) a = -a;
18694 } else {
18695 switch (size) {
18696 case -2:
18697 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
18698 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18699 break;
18700 #ifdef HAVE_LONG_LONG
18701 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
18702 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
18703 goto long_long;
18704 #endif
18705 }
18706 CYTHON_FALLTHROUGH;
18707 case 2:
18708 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
18709 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18710 break;
18711 #ifdef HAVE_LONG_LONG
18712 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
18713 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
18714 goto long_long;
18715 #endif
18716 }
18717 CYTHON_FALLTHROUGH;
18718 case -3:
18719 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
18720 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18721 break;
18722 #ifdef HAVE_LONG_LONG
18723 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
18724 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]));
18725 goto long_long;
18726 #endif
18727 }
18728 CYTHON_FALLTHROUGH;
18729 case 3:
18730 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
18731 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18732 break;
18733 #ifdef HAVE_LONG_LONG
18734 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
18735 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]));
18736 goto long_long;
18737 #endif
18738 }
18739 CYTHON_FALLTHROUGH;
18740 case -4:
18741 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
18742 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18743 break;
18744 #ifdef HAVE_LONG_LONG
18745 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
18746 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]));
18747 goto long_long;
18748 #endif
18749 }
18750 CYTHON_FALLTHROUGH;
18751 case 4:
18752 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
18753 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18754 break;
18755 #ifdef HAVE_LONG_LONG
18756 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
18757 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]));
18758 goto long_long;
18759 #endif
18760 }
18761 CYTHON_FALLTHROUGH;
18762 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
18763 }
18764 }
18765 x = a + b;
18766 return PyLong_FromLong(x);
18767 #ifdef HAVE_LONG_LONG
18768 long_long:
18769 llx = lla + llb;
18770 return PyLong_FromLongLong(llx);
18771 #endif
18772
18773
18774 }
18775 #endif
18776 if (PyFloat_CheckExact(op1)) {
18777 const long b = intval;
18778 double a = PyFloat_AS_DOUBLE(op1);
18779 double result;
18780 PyFPE_START_PROTECT("add", return NULL)
18781 result = ((double)a) + (double)b;
18782 PyFPE_END_PROTECT(result)
18783 return PyFloat_FromDouble(result);
18784 }
18785 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
18786 }
18787 #endif
18788
18789 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)18790 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
18791 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
18792 }
18793
18794 /* None */
__Pyx_div_long(long a,long b)18795 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
18796 long q = a / b;
18797 long r = a - q*b;
18798 q -= ((r != 0) & ((r ^ b) < 0));
18799 return q;
18800 }
18801
18802 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)18803 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
18804 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
18805 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
18806 PyErr_Format(PyExc_ImportError,
18807 #if PY_MAJOR_VERSION < 3
18808 "cannot import name %.230s", PyString_AS_STRING(name));
18809 #else
18810 "cannot import name %S", name);
18811 #endif
18812 }
18813 return value;
18814 }
18815
18816 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)18817 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
18818 PyObject *r;
18819 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
18820 PyErr_SetString(PyExc_TypeError,
18821 "hasattr(): attribute name must be string");
18822 return -1;
18823 }
18824 r = __Pyx_GetAttr(o, n);
18825 if (unlikely(!r)) {
18826 PyErr_Clear();
18827 return 0;
18828 } else {
18829 Py_DECREF(r);
18830 return 1;
18831 }
18832 }
18833
18834 /* PyObject_GenericGetAttrNoDict */
18835 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)18836 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
18837 PyErr_Format(PyExc_AttributeError,
18838 #if PY_MAJOR_VERSION >= 3
18839 "'%.50s' object has no attribute '%U'",
18840 tp->tp_name, attr_name);
18841 #else
18842 "'%.50s' object has no attribute '%.400s'",
18843 tp->tp_name, PyString_AS_STRING(attr_name));
18844 #endif
18845 return NULL;
18846 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)18847 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
18848 PyObject *descr;
18849 PyTypeObject *tp = Py_TYPE(obj);
18850 if (unlikely(!PyString_Check(attr_name))) {
18851 return PyObject_GenericGetAttr(obj, attr_name);
18852 }
18853 assert(!tp->tp_dictoffset);
18854 descr = _PyType_Lookup(tp, attr_name);
18855 if (unlikely(!descr)) {
18856 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
18857 }
18858 Py_INCREF(descr);
18859 #if PY_MAJOR_VERSION < 3
18860 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
18861 #endif
18862 {
18863 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
18864 if (unlikely(f)) {
18865 PyObject *res = f(descr, obj, (PyObject *)tp);
18866 Py_DECREF(descr);
18867 return res;
18868 }
18869 }
18870 return descr;
18871 }
18872 #endif
18873
18874 /* PyObject_GenericGetAttr */
18875 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)18876 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
18877 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
18878 return PyObject_GenericGetAttr(obj, attr_name);
18879 }
18880 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
18881 }
18882 #endif
18883
18884 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)18885 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
18886 #if PY_VERSION_HEX >= 0x02070000
18887 PyObject *ob = PyCapsule_New(vtable, 0, 0);
18888 #else
18889 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
18890 #endif
18891 if (!ob)
18892 goto bad;
18893 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
18894 goto bad;
18895 Py_DECREF(ob);
18896 return 0;
18897 bad:
18898 Py_XDECREF(ob);
18899 return -1;
18900 }
18901
18902 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)18903 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
18904 __Pyx_PyThreadState_declare
18905 __Pyx_PyThreadState_assign
18906 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
18907 __Pyx_PyErr_Clear();
18908 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)18909 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
18910 PyObject *result;
18911 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
18912 PyTypeObject* tp = Py_TYPE(obj);
18913 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
18914 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
18915 }
18916 #endif
18917 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
18918 if (unlikely(!result)) {
18919 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
18920 }
18921 return result;
18922 }
18923
18924 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)18925 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
18926 int ret;
18927 PyObject *name_attr;
18928 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
18929 if (likely(name_attr)) {
18930 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
18931 } else {
18932 ret = -1;
18933 }
18934 if (unlikely(ret < 0)) {
18935 PyErr_Clear();
18936 ret = 0;
18937 }
18938 Py_XDECREF(name_attr);
18939 return ret;
18940 }
__Pyx_setup_reduce(PyObject * type_obj)18941 static int __Pyx_setup_reduce(PyObject* type_obj) {
18942 int ret = 0;
18943 PyObject *object_reduce = NULL;
18944 PyObject *object_reduce_ex = NULL;
18945 PyObject *reduce = NULL;
18946 PyObject *reduce_ex = NULL;
18947 PyObject *reduce_cython = NULL;
18948 PyObject *setstate = NULL;
18949 PyObject *setstate_cython = NULL;
18950 #if CYTHON_USE_PYTYPE_LOOKUP
18951 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
18952 #else
18953 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
18954 #endif
18955 #if CYTHON_USE_PYTYPE_LOOKUP
18956 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
18957 #else
18958 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
18959 #endif
18960 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
18961 if (reduce_ex == object_reduce_ex) {
18962 #if CYTHON_USE_PYTYPE_LOOKUP
18963 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
18964 #else
18965 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
18966 #endif
18967 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
18968 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
18969 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
18970 if (likely(reduce_cython)) {
18971 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
18972 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
18973 } else if (reduce == object_reduce || PyErr_Occurred()) {
18974 goto __PYX_BAD;
18975 }
18976 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
18977 if (!setstate) PyErr_Clear();
18978 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
18979 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
18980 if (likely(setstate_cython)) {
18981 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
18982 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
18983 } else if (!setstate || PyErr_Occurred()) {
18984 goto __PYX_BAD;
18985 }
18986 }
18987 PyType_Modified((PyTypeObject*)type_obj);
18988 }
18989 }
18990 goto __PYX_GOOD;
18991 __PYX_BAD:
18992 if (!PyErr_Occurred())
18993 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
18994 ret = -1;
18995 __PYX_GOOD:
18996 #if !CYTHON_USE_PYTYPE_LOOKUP
18997 Py_XDECREF(object_reduce);
18998 Py_XDECREF(object_reduce_ex);
18999 #endif
19000 Py_XDECREF(reduce);
19001 Py_XDECREF(reduce_ex);
19002 Py_XDECREF(reduce_cython);
19003 Py_XDECREF(setstate);
19004 Py_XDECREF(setstate_cython);
19005 return ret;
19006 }
19007
19008 /* CLineInTraceback */
19009 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)19010 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
19011 PyObject *use_cline;
19012 PyObject *ptype, *pvalue, *ptraceback;
19013 #if CYTHON_COMPILING_IN_CPYTHON
19014 PyObject **cython_runtime_dict;
19015 #endif
19016 if (unlikely(!__pyx_cython_runtime)) {
19017 return c_line;
19018 }
19019 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
19020 #if CYTHON_COMPILING_IN_CPYTHON
19021 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
19022 if (likely(cython_runtime_dict)) {
19023 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
19024 use_cline, *cython_runtime_dict,
19025 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
19026 } else
19027 #endif
19028 {
19029 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
19030 if (use_cline_obj) {
19031 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
19032 Py_DECREF(use_cline_obj);
19033 } else {
19034 PyErr_Clear();
19035 use_cline = NULL;
19036 }
19037 }
19038 if (!use_cline) {
19039 c_line = 0;
19040 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
19041 }
19042 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
19043 c_line = 0;
19044 }
19045 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
19046 return c_line;
19047 }
19048 #endif
19049
19050 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)19051 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
19052 int start = 0, mid = 0, end = count - 1;
19053 if (end >= 0 && code_line > entries[end].code_line) {
19054 return count;
19055 }
19056 while (start < end) {
19057 mid = start + (end - start) / 2;
19058 if (code_line < entries[mid].code_line) {
19059 end = mid;
19060 } else if (code_line > entries[mid].code_line) {
19061 start = mid + 1;
19062 } else {
19063 return mid;
19064 }
19065 }
19066 if (code_line <= entries[mid].code_line) {
19067 return mid;
19068 } else {
19069 return mid + 1;
19070 }
19071 }
__pyx_find_code_object(int code_line)19072 static PyCodeObject *__pyx_find_code_object(int code_line) {
19073 PyCodeObject* code_object;
19074 int pos;
19075 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
19076 return NULL;
19077 }
19078 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
19079 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
19080 return NULL;
19081 }
19082 code_object = __pyx_code_cache.entries[pos].code_object;
19083 Py_INCREF(code_object);
19084 return code_object;
19085 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)19086 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
19087 int pos, i;
19088 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
19089 if (unlikely(!code_line)) {
19090 return;
19091 }
19092 if (unlikely(!entries)) {
19093 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
19094 if (likely(entries)) {
19095 __pyx_code_cache.entries = entries;
19096 __pyx_code_cache.max_count = 64;
19097 __pyx_code_cache.count = 1;
19098 entries[0].code_line = code_line;
19099 entries[0].code_object = code_object;
19100 Py_INCREF(code_object);
19101 }
19102 return;
19103 }
19104 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
19105 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
19106 PyCodeObject* tmp = entries[pos].code_object;
19107 entries[pos].code_object = code_object;
19108 Py_DECREF(tmp);
19109 return;
19110 }
19111 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
19112 int new_max = __pyx_code_cache.max_count + 64;
19113 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
19114 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
19115 if (unlikely(!entries)) {
19116 return;
19117 }
19118 __pyx_code_cache.entries = entries;
19119 __pyx_code_cache.max_count = new_max;
19120 }
19121 for (i=__pyx_code_cache.count; i>pos; i--) {
19122 entries[i] = entries[i-1];
19123 }
19124 entries[pos].code_line = code_line;
19125 entries[pos].code_object = code_object;
19126 __pyx_code_cache.count++;
19127 Py_INCREF(code_object);
19128 }
19129
19130 /* AddTraceback */
19131 #include "compile.h"
19132 #include "frameobject.h"
19133 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)19134 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
19135 const char *funcname, int c_line,
19136 int py_line, const char *filename) {
19137 PyCodeObject *py_code = 0;
19138 PyObject *py_srcfile = 0;
19139 PyObject *py_funcname = 0;
19140 #if PY_MAJOR_VERSION < 3
19141 py_srcfile = PyString_FromString(filename);
19142 #else
19143 py_srcfile = PyUnicode_FromString(filename);
19144 #endif
19145 if (!py_srcfile) goto bad;
19146 if (c_line) {
19147 #if PY_MAJOR_VERSION < 3
19148 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
19149 #else
19150 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
19151 #endif
19152 }
19153 else {
19154 #if PY_MAJOR_VERSION < 3
19155 py_funcname = PyString_FromString(funcname);
19156 #else
19157 py_funcname = PyUnicode_FromString(funcname);
19158 #endif
19159 }
19160 if (!py_funcname) goto bad;
19161 py_code = __Pyx_PyCode_New(
19162 0,
19163 0,
19164 0,
19165 0,
19166 0,
19167 __pyx_empty_bytes, /*PyObject *code,*/
19168 __pyx_empty_tuple, /*PyObject *consts,*/
19169 __pyx_empty_tuple, /*PyObject *names,*/
19170 __pyx_empty_tuple, /*PyObject *varnames,*/
19171 __pyx_empty_tuple, /*PyObject *freevars,*/
19172 __pyx_empty_tuple, /*PyObject *cellvars,*/
19173 py_srcfile, /*PyObject *filename,*/
19174 py_funcname, /*PyObject *name,*/
19175 py_line,
19176 __pyx_empty_bytes /*PyObject *lnotab*/
19177 );
19178 Py_DECREF(py_srcfile);
19179 Py_DECREF(py_funcname);
19180 return py_code;
19181 bad:
19182 Py_XDECREF(py_srcfile);
19183 Py_XDECREF(py_funcname);
19184 return NULL;
19185 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)19186 static void __Pyx_AddTraceback(const char *funcname, int c_line,
19187 int py_line, const char *filename) {
19188 PyCodeObject *py_code = 0;
19189 PyFrameObject *py_frame = 0;
19190 PyThreadState *tstate = __Pyx_PyThreadState_Current;
19191 if (c_line) {
19192 c_line = __Pyx_CLineForTraceback(tstate, c_line);
19193 }
19194 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
19195 if (!py_code) {
19196 py_code = __Pyx_CreateCodeObjectForTraceback(
19197 funcname, c_line, py_line, filename);
19198 if (!py_code) goto bad;
19199 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
19200 }
19201 py_frame = PyFrame_New(
19202 tstate, /*PyThreadState *tstate,*/
19203 py_code, /*PyCodeObject *code,*/
19204 __pyx_d, /*PyObject *globals,*/
19205 0 /*PyObject *locals*/
19206 );
19207 if (!py_frame) goto bad;
19208 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
19209 PyTraceBack_Here(py_frame);
19210 bad:
19211 Py_XDECREF(py_code);
19212 Py_XDECREF(py_frame);
19213 }
19214
19215 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)19216 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
19217 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
19218 if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
19219 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
19220 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
19221 return -1;
19222 }
__Pyx_ReleaseBuffer(Py_buffer * view)19223 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
19224 PyObject *obj = view->obj;
19225 if (!obj) return;
19226 if (PyObject_CheckBuffer(obj)) {
19227 PyBuffer_Release(view);
19228 return;
19229 }
19230 if ((0)) {}
19231 view->obj = NULL;
19232 Py_DECREF(obj);
19233 }
19234 #endif
19235
19236
19237 /* MemviewSliceIsContig */
19238 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)19239 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
19240 {
19241 int i, index, step, start;
19242 Py_ssize_t itemsize = mvs.memview->view.itemsize;
19243 if (order == 'F') {
19244 step = 1;
19245 start = 0;
19246 } else {
19247 step = -1;
19248 start = ndim - 1;
19249 }
19250 for (i = 0; i < ndim; i++) {
19251 index = start + step * i;
19252 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
19253 return 0;
19254 itemsize *= mvs.shape[index];
19255 }
19256 return 1;
19257 }
19258
19259 /* OverlappingSlices */
19260 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)19261 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
19262 void **out_start, void **out_end,
19263 int ndim, size_t itemsize)
19264 {
19265 char *start, *end;
19266 int i;
19267 start = end = slice->data;
19268 for (i = 0; i < ndim; i++) {
19269 Py_ssize_t stride = slice->strides[i];
19270 Py_ssize_t extent = slice->shape[i];
19271 if (extent == 0) {
19272 *out_start = *out_end = start;
19273 return;
19274 } else {
19275 if (stride > 0)
19276 end += stride * (extent - 1);
19277 else
19278 start += stride * (extent - 1);
19279 }
19280 }
19281 *out_start = start;
19282 *out_end = end + itemsize;
19283 }
19284 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)19285 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
19286 __Pyx_memviewslice *slice2,
19287 int ndim, size_t itemsize)
19288 {
19289 void *start1, *end1, *start2, *end2;
19290 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
19291 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
19292 return (start1 < end2) && (start2 < end1);
19293 }
19294
19295 /* Capsule */
19296 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)19297 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
19298 {
19299 PyObject *cobj;
19300 #if PY_VERSION_HEX >= 0x02070000
19301 cobj = PyCapsule_New(p, sig, NULL);
19302 #else
19303 cobj = PyCObject_FromVoidPtr(p, NULL);
19304 #endif
19305 return cobj;
19306 }
19307
19308 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)19309 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
19310 {
19311 union {
19312 uint32_t u32;
19313 uint8_t u8[4];
19314 } S;
19315 S.u32 = 0x01020304;
19316 return S.u8[0] == 4;
19317 }
19318
19319 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)19320 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
19321 __Pyx_BufFmt_StackElem* stack,
19322 __Pyx_TypeInfo* type) {
19323 stack[0].field = &ctx->root;
19324 stack[0].parent_offset = 0;
19325 ctx->root.type = type;
19326 ctx->root.name = "buffer dtype";
19327 ctx->root.offset = 0;
19328 ctx->head = stack;
19329 ctx->head->field = &ctx->root;
19330 ctx->fmt_offset = 0;
19331 ctx->head->parent_offset = 0;
19332 ctx->new_packmode = '@';
19333 ctx->enc_packmode = '@';
19334 ctx->new_count = 1;
19335 ctx->enc_count = 0;
19336 ctx->enc_type = 0;
19337 ctx->is_complex = 0;
19338 ctx->is_valid_array = 0;
19339 ctx->struct_alignment = 0;
19340 while (type->typegroup == 'S') {
19341 ++ctx->head;
19342 ctx->head->field = type->fields;
19343 ctx->head->parent_offset = 0;
19344 type = type->fields->type;
19345 }
19346 }
__Pyx_BufFmt_ParseNumber(const char ** ts)19347 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
19348 int count;
19349 const char* t = *ts;
19350 if (*t < '0' || *t > '9') {
19351 return -1;
19352 } else {
19353 count = *t++ - '0';
19354 while (*t >= '0' && *t <= '9') {
19355 count *= 10;
19356 count += *t++ - '0';
19357 }
19358 }
19359 *ts = t;
19360 return count;
19361 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)19362 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
19363 int number = __Pyx_BufFmt_ParseNumber(ts);
19364 if (number == -1)
19365 PyErr_Format(PyExc_ValueError,\
19366 "Does not understand character buffer dtype format string ('%c')", **ts);
19367 return number;
19368 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)19369 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
19370 PyErr_Format(PyExc_ValueError,
19371 "Unexpected format string character: '%c'", ch);
19372 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)19373 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
19374 switch (ch) {
19375 case '?': return "'bool'";
19376 case 'c': return "'char'";
19377 case 'b': return "'signed char'";
19378 case 'B': return "'unsigned char'";
19379 case 'h': return "'short'";
19380 case 'H': return "'unsigned short'";
19381 case 'i': return "'int'";
19382 case 'I': return "'unsigned int'";
19383 case 'l': return "'long'";
19384 case 'L': return "'unsigned long'";
19385 case 'q': return "'long long'";
19386 case 'Q': return "'unsigned long long'";
19387 case 'f': return (is_complex ? "'complex float'" : "'float'");
19388 case 'd': return (is_complex ? "'complex double'" : "'double'");
19389 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
19390 case 'T': return "a struct";
19391 case 'O': return "Python object";
19392 case 'P': return "a pointer";
19393 case 's': case 'p': return "a string";
19394 case 0: return "end";
19395 default: return "unparseable format string";
19396 }
19397 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)19398 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
19399 switch (ch) {
19400 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
19401 case 'h': case 'H': return 2;
19402 case 'i': case 'I': case 'l': case 'L': return 4;
19403 case 'q': case 'Q': return 8;
19404 case 'f': return (is_complex ? 8 : 4);
19405 case 'd': return (is_complex ? 16 : 8);
19406 case 'g': {
19407 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
19408 return 0;
19409 }
19410 case 'O': case 'P': return sizeof(void*);
19411 default:
19412 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
19413 return 0;
19414 }
19415 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)19416 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
19417 switch (ch) {
19418 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
19419 case 'h': case 'H': return sizeof(short);
19420 case 'i': case 'I': return sizeof(int);
19421 case 'l': case 'L': return sizeof(long);
19422 #ifdef HAVE_LONG_LONG
19423 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
19424 #endif
19425 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
19426 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
19427 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
19428 case 'O': case 'P': return sizeof(void*);
19429 default: {
19430 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
19431 return 0;
19432 }
19433 }
19434 }
19435 typedef struct { char c; short x; } __Pyx_st_short;
19436 typedef struct { char c; int x; } __Pyx_st_int;
19437 typedef struct { char c; long x; } __Pyx_st_long;
19438 typedef struct { char c; float x; } __Pyx_st_float;
19439 typedef struct { char c; double x; } __Pyx_st_double;
19440 typedef struct { char c; long double x; } __Pyx_st_longdouble;
19441 typedef struct { char c; void *x; } __Pyx_st_void_p;
19442 #ifdef HAVE_LONG_LONG
19443 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
19444 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)19445 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
19446 switch (ch) {
19447 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
19448 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
19449 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
19450 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
19451 #ifdef HAVE_LONG_LONG
19452 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
19453 #endif
19454 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
19455 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
19456 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
19457 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
19458 default:
19459 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
19460 return 0;
19461 }
19462 }
19463 /* These are for computing the padding at the end of the struct to align
19464 on the first member of the struct. This will probably the same as above,
19465 but we don't have any guarantees.
19466 */
19467 typedef struct { short x; char c; } __Pyx_pad_short;
19468 typedef struct { int x; char c; } __Pyx_pad_int;
19469 typedef struct { long x; char c; } __Pyx_pad_long;
19470 typedef struct { float x; char c; } __Pyx_pad_float;
19471 typedef struct { double x; char c; } __Pyx_pad_double;
19472 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
19473 typedef struct { void *x; char c; } __Pyx_pad_void_p;
19474 #ifdef HAVE_LONG_LONG
19475 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
19476 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)19477 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
19478 switch (ch) {
19479 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
19480 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
19481 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
19482 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
19483 #ifdef HAVE_LONG_LONG
19484 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
19485 #endif
19486 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
19487 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
19488 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
19489 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
19490 default:
19491 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
19492 return 0;
19493 }
19494 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)19495 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
19496 switch (ch) {
19497 case 'c':
19498 return 'H';
19499 case 'b': case 'h': case 'i':
19500 case 'l': case 'q': case 's': case 'p':
19501 return 'I';
19502 case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
19503 return 'U';
19504 case 'f': case 'd': case 'g':
19505 return (is_complex ? 'C' : 'R');
19506 case 'O':
19507 return 'O';
19508 case 'P':
19509 return 'P';
19510 default: {
19511 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
19512 return 0;
19513 }
19514 }
19515 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)19516 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
19517 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
19518 const char* expected;
19519 const char* quote;
19520 if (ctx->head == NULL) {
19521 expected = "end";
19522 quote = "";
19523 } else {
19524 expected = ctx->head->field->type->name;
19525 quote = "'";
19526 }
19527 PyErr_Format(PyExc_ValueError,
19528 "Buffer dtype mismatch, expected %s%s%s but got %s",
19529 quote, expected, quote,
19530 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
19531 } else {
19532 __Pyx_StructField* field = ctx->head->field;
19533 __Pyx_StructField* parent = (ctx->head - 1)->field;
19534 PyErr_Format(PyExc_ValueError,
19535 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
19536 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
19537 parent->type->name, field->name);
19538 }
19539 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)19540 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
19541 char group;
19542 size_t size, offset, arraysize = 1;
19543 if (ctx->enc_type == 0) return 0;
19544 if (ctx->head->field->type->arraysize[0]) {
19545 int i, ndim = 0;
19546 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
19547 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
19548 ndim = 1;
19549 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
19550 PyErr_Format(PyExc_ValueError,
19551 "Expected a dimension of size %zu, got %zu",
19552 ctx->head->field->type->arraysize[0], ctx->enc_count);
19553 return -1;
19554 }
19555 }
19556 if (!ctx->is_valid_array) {
19557 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
19558 ctx->head->field->type->ndim, ndim);
19559 return -1;
19560 }
19561 for (i = 0; i < ctx->head->field->type->ndim; i++) {
19562 arraysize *= ctx->head->field->type->arraysize[i];
19563 }
19564 ctx->is_valid_array = 0;
19565 ctx->enc_count = 1;
19566 }
19567 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
19568 do {
19569 __Pyx_StructField* field = ctx->head->field;
19570 __Pyx_TypeInfo* type = field->type;
19571 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
19572 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
19573 } else {
19574 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
19575 }
19576 if (ctx->enc_packmode == '@') {
19577 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
19578 size_t align_mod_offset;
19579 if (align_at == 0) return -1;
19580 align_mod_offset = ctx->fmt_offset % align_at;
19581 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
19582 if (ctx->struct_alignment == 0)
19583 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
19584 ctx->is_complex);
19585 }
19586 if (type->size != size || type->typegroup != group) {
19587 if (type->typegroup == 'C' && type->fields != NULL) {
19588 size_t parent_offset = ctx->head->parent_offset + field->offset;
19589 ++ctx->head;
19590 ctx->head->field = type->fields;
19591 ctx->head->parent_offset = parent_offset;
19592 continue;
19593 }
19594 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
19595 } else {
19596 __Pyx_BufFmt_RaiseExpected(ctx);
19597 return -1;
19598 }
19599 }
19600 offset = ctx->head->parent_offset + field->offset;
19601 if (ctx->fmt_offset != offset) {
19602 PyErr_Format(PyExc_ValueError,
19603 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
19604 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
19605 return -1;
19606 }
19607 ctx->fmt_offset += size;
19608 if (arraysize)
19609 ctx->fmt_offset += (arraysize - 1) * size;
19610 --ctx->enc_count;
19611 while (1) {
19612 if (field == &ctx->root) {
19613 ctx->head = NULL;
19614 if (ctx->enc_count != 0) {
19615 __Pyx_BufFmt_RaiseExpected(ctx);
19616 return -1;
19617 }
19618 break;
19619 }
19620 ctx->head->field = ++field;
19621 if (field->type == NULL) {
19622 --ctx->head;
19623 field = ctx->head->field;
19624 continue;
19625 } else if (field->type->typegroup == 'S') {
19626 size_t parent_offset = ctx->head->parent_offset + field->offset;
19627 if (field->type->fields->type == NULL) continue;
19628 field = field->type->fields;
19629 ++ctx->head;
19630 ctx->head->field = field;
19631 ctx->head->parent_offset = parent_offset;
19632 break;
19633 } else {
19634 break;
19635 }
19636 }
19637 } while (ctx->enc_count);
19638 ctx->enc_type = 0;
19639 ctx->is_complex = 0;
19640 return 0;
19641 }
19642 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)19643 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
19644 {
19645 const char *ts = *tsp;
19646 int i = 0, number, ndim;
19647 ++ts;
19648 if (ctx->new_count != 1) {
19649 PyErr_SetString(PyExc_ValueError,
19650 "Cannot handle repeated arrays in format string");
19651 return NULL;
19652 }
19653 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19654 ndim = ctx->head->field->type->ndim;
19655 while (*ts && *ts != ')') {
19656 switch (*ts) {
19657 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
19658 default: break;
19659 }
19660 number = __Pyx_BufFmt_ExpectNumber(&ts);
19661 if (number == -1) return NULL;
19662 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
19663 return PyErr_Format(PyExc_ValueError,
19664 "Expected a dimension of size %zu, got %d",
19665 ctx->head->field->type->arraysize[i], number);
19666 if (*ts != ',' && *ts != ')')
19667 return PyErr_Format(PyExc_ValueError,
19668 "Expected a comma in format string, got '%c'", *ts);
19669 if (*ts == ',') ts++;
19670 i++;
19671 }
19672 if (i != ndim)
19673 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
19674 ctx->head->field->type->ndim, i);
19675 if (!*ts) {
19676 PyErr_SetString(PyExc_ValueError,
19677 "Unexpected end of format string, expected ')'");
19678 return NULL;
19679 }
19680 ctx->is_valid_array = 1;
19681 ctx->new_count = 1;
19682 *tsp = ++ts;
19683 return Py_None;
19684 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)19685 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
19686 int got_Z = 0;
19687 while (1) {
19688 switch(*ts) {
19689 case 0:
19690 if (ctx->enc_type != 0 && ctx->head == NULL) {
19691 __Pyx_BufFmt_RaiseExpected(ctx);
19692 return NULL;
19693 }
19694 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19695 if (ctx->head != NULL) {
19696 __Pyx_BufFmt_RaiseExpected(ctx);
19697 return NULL;
19698 }
19699 return ts;
19700 case ' ':
19701 case '\r':
19702 case '\n':
19703 ++ts;
19704 break;
19705 case '<':
19706 if (!__Pyx_Is_Little_Endian()) {
19707 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
19708 return NULL;
19709 }
19710 ctx->new_packmode = '=';
19711 ++ts;
19712 break;
19713 case '>':
19714 case '!':
19715 if (__Pyx_Is_Little_Endian()) {
19716 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
19717 return NULL;
19718 }
19719 ctx->new_packmode = '=';
19720 ++ts;
19721 break;
19722 case '=':
19723 case '@':
19724 case '^':
19725 ctx->new_packmode = *ts++;
19726 break;
19727 case 'T':
19728 {
19729 const char* ts_after_sub;
19730 size_t i, struct_count = ctx->new_count;
19731 size_t struct_alignment = ctx->struct_alignment;
19732 ctx->new_count = 1;
19733 ++ts;
19734 if (*ts != '{') {
19735 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
19736 return NULL;
19737 }
19738 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19739 ctx->enc_type = 0;
19740 ctx->enc_count = 0;
19741 ctx->struct_alignment = 0;
19742 ++ts;
19743 ts_after_sub = ts;
19744 for (i = 0; i != struct_count; ++i) {
19745 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
19746 if (!ts_after_sub) return NULL;
19747 }
19748 ts = ts_after_sub;
19749 if (struct_alignment) ctx->struct_alignment = struct_alignment;
19750 }
19751 break;
19752 case '}':
19753 {
19754 size_t alignment = ctx->struct_alignment;
19755 ++ts;
19756 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19757 ctx->enc_type = 0;
19758 if (alignment && ctx->fmt_offset % alignment) {
19759 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
19760 }
19761 }
19762 return ts;
19763 case 'x':
19764 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19765 ctx->fmt_offset += ctx->new_count;
19766 ctx->new_count = 1;
19767 ctx->enc_count = 0;
19768 ctx->enc_type = 0;
19769 ctx->enc_packmode = ctx->new_packmode;
19770 ++ts;
19771 break;
19772 case 'Z':
19773 got_Z = 1;
19774 ++ts;
19775 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
19776 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
19777 return NULL;
19778 }
19779 CYTHON_FALLTHROUGH;
19780 case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
19781 case 'l': case 'L': case 'q': case 'Q':
19782 case 'f': case 'd': case 'g':
19783 case 'O': case 'p':
19784 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
19785 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
19786 ctx->enc_count += ctx->new_count;
19787 ctx->new_count = 1;
19788 got_Z = 0;
19789 ++ts;
19790 break;
19791 }
19792 CYTHON_FALLTHROUGH;
19793 case 's':
19794 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
19795 ctx->enc_count = ctx->new_count;
19796 ctx->enc_packmode = ctx->new_packmode;
19797 ctx->enc_type = *ts;
19798 ctx->is_complex = got_Z;
19799 ++ts;
19800 ctx->new_count = 1;
19801 got_Z = 0;
19802 break;
19803 case ':':
19804 ++ts;
19805 while(*ts != ':') ++ts;
19806 ++ts;
19807 break;
19808 case '(':
19809 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
19810 break;
19811 default:
19812 {
19813 int number = __Pyx_BufFmt_ExpectNumber(&ts);
19814 if (number == -1) return NULL;
19815 ctx->new_count = (size_t)number;
19816 }
19817 }
19818 }
19819 }
19820
19821 /* TypeInfoCompare */
19822 static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)19823 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
19824 {
19825 int i;
19826 if (!a || !b)
19827 return 0;
19828 if (a == b)
19829 return 1;
19830 if (a->size != b->size || a->typegroup != b->typegroup ||
19831 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
19832 if (a->typegroup == 'H' || b->typegroup == 'H') {
19833 return a->size == b->size;
19834 } else {
19835 return 0;
19836 }
19837 }
19838 if (a->ndim) {
19839 for (i = 0; i < a->ndim; i++)
19840 if (a->arraysize[i] != b->arraysize[i])
19841 return 0;
19842 }
19843 if (a->typegroup == 'S') {
19844 if (a->flags != b->flags)
19845 return 0;
19846 if (a->fields || b->fields) {
19847 if (!(a->fields && b->fields))
19848 return 0;
19849 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
19850 __Pyx_StructField *field_a = a->fields + i;
19851 __Pyx_StructField *field_b = b->fields + i;
19852 if (field_a->offset != field_b->offset ||
19853 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
19854 return 0;
19855 }
19856 return !a->fields[i].type && !b->fields[i].type;
19857 }
19858 }
19859 return 1;
19860 }
19861
19862 /* MemviewSliceValidateAndInit */
19863 static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)19864 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
19865 {
19866 if (buf->shape[dim] <= 1)
19867 return 1;
19868 if (buf->strides) {
19869 if (spec & __Pyx_MEMVIEW_CONTIG) {
19870 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
19871 if (unlikely(buf->strides[dim] != sizeof(void *))) {
19872 PyErr_Format(PyExc_ValueError,
19873 "Buffer is not indirectly contiguous "
19874 "in dimension %d.", dim);
19875 goto fail;
19876 }
19877 } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
19878 PyErr_SetString(PyExc_ValueError,
19879 "Buffer and memoryview are not contiguous "
19880 "in the same dimension.");
19881 goto fail;
19882 }
19883 }
19884 if (spec & __Pyx_MEMVIEW_FOLLOW) {
19885 Py_ssize_t stride = buf->strides[dim];
19886 if (stride < 0)
19887 stride = -stride;
19888 if (unlikely(stride < buf->itemsize)) {
19889 PyErr_SetString(PyExc_ValueError,
19890 "Buffer and memoryview are not contiguous "
19891 "in the same dimension.");
19892 goto fail;
19893 }
19894 }
19895 } else {
19896 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
19897 PyErr_Format(PyExc_ValueError,
19898 "C-contiguous buffer is not contiguous in "
19899 "dimension %d", dim);
19900 goto fail;
19901 } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
19902 PyErr_Format(PyExc_ValueError,
19903 "C-contiguous buffer is not indirect in "
19904 "dimension %d", dim);
19905 goto fail;
19906 } else if (unlikely(buf->suboffsets)) {
19907 PyErr_SetString(PyExc_ValueError,
19908 "Buffer exposes suboffsets but no strides");
19909 goto fail;
19910 }
19911 }
19912 return 1;
19913 fail:
19914 return 0;
19915 }
19916 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)19917 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
19918 {
19919 if (spec & __Pyx_MEMVIEW_DIRECT) {
19920 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
19921 PyErr_Format(PyExc_ValueError,
19922 "Buffer not compatible with direct access "
19923 "in dimension %d.", dim);
19924 goto fail;
19925 }
19926 }
19927 if (spec & __Pyx_MEMVIEW_PTR) {
19928 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
19929 PyErr_Format(PyExc_ValueError,
19930 "Buffer is not indirectly accessible "
19931 "in dimension %d.", dim);
19932 goto fail;
19933 }
19934 }
19935 return 1;
19936 fail:
19937 return 0;
19938 }
19939 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)19940 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
19941 {
19942 int i;
19943 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
19944 Py_ssize_t stride = 1;
19945 for (i = 0; i < ndim; i++) {
19946 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
19947 PyErr_SetString(PyExc_ValueError,
19948 "Buffer not fortran contiguous.");
19949 goto fail;
19950 }
19951 stride = stride * buf->shape[i];
19952 }
19953 } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
19954 Py_ssize_t stride = 1;
19955 for (i = ndim - 1; i >- 1; i--) {
19956 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
19957 PyErr_SetString(PyExc_ValueError,
19958 "Buffer not C contiguous.");
19959 goto fail;
19960 }
19961 stride = stride * buf->shape[i];
19962 }
19963 }
19964 return 1;
19965 fail:
19966 return 0;
19967 }
__Pyx_ValidateAndInit_memviewslice(int * axes_specs,int c_or_f_flag,int buf_flags,int ndim,__Pyx_TypeInfo * dtype,__Pyx_BufFmt_StackElem stack[],__Pyx_memviewslice * memviewslice,PyObject * original_obj)19968 static int __Pyx_ValidateAndInit_memviewslice(
19969 int *axes_specs,
19970 int c_or_f_flag,
19971 int buf_flags,
19972 int ndim,
19973 __Pyx_TypeInfo *dtype,
19974 __Pyx_BufFmt_StackElem stack[],
19975 __Pyx_memviewslice *memviewslice,
19976 PyObject *original_obj)
19977 {
19978 struct __pyx_memoryview_obj *memview, *new_memview;
19979 __Pyx_RefNannyDeclarations
19980 Py_buffer *buf;
19981 int i, spec = 0, retval = -1;
19982 __Pyx_BufFmt_Context ctx;
19983 int from_memoryview = __pyx_memoryview_check(original_obj);
19984 __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
19985 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
19986 original_obj)->typeinfo)) {
19987 memview = (struct __pyx_memoryview_obj *) original_obj;
19988 new_memview = NULL;
19989 } else {
19990 memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
19991 original_obj, buf_flags, 0, dtype);
19992 new_memview = memview;
19993 if (unlikely(!memview))
19994 goto fail;
19995 }
19996 buf = &memview->view;
19997 if (unlikely(buf->ndim != ndim)) {
19998 PyErr_Format(PyExc_ValueError,
19999 "Buffer has wrong number of dimensions (expected %d, got %d)",
20000 ndim, buf->ndim);
20001 goto fail;
20002 }
20003 if (new_memview) {
20004 __Pyx_BufFmt_Init(&ctx, stack, dtype);
20005 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
20006 }
20007 if (unlikely((unsigned) buf->itemsize != dtype->size)) {
20008 PyErr_Format(PyExc_ValueError,
20009 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
20010 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
20011 buf->itemsize,
20012 (buf->itemsize > 1) ? "s" : "",
20013 dtype->name,
20014 dtype->size,
20015 (dtype->size > 1) ? "s" : "");
20016 goto fail;
20017 }
20018 if (buf->len > 0) {
20019 for (i = 0; i < ndim; i++) {
20020 spec = axes_specs[i];
20021 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
20022 goto fail;
20023 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
20024 goto fail;
20025 }
20026 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
20027 goto fail;
20028 }
20029 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
20030 new_memview != NULL) == -1)) {
20031 goto fail;
20032 }
20033 retval = 0;
20034 goto no_fail;
20035 fail:
20036 Py_XDECREF(new_memview);
20037 retval = -1;
20038 no_fail:
20039 __Pyx_RefNannyFinishContext();
20040 return retval;
20041 }
20042
20043 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(PyObject * obj,int writable_flag)20044 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(PyObject *obj, int writable_flag) {
20045 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
20046 __Pyx_BufFmt_StackElem stack[1];
20047 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
20048 int retcode;
20049 if (obj == Py_None) {
20050 result.memview = (struct __pyx_memoryview_obj *) Py_None;
20051 return result;
20052 }
20053 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
20054 PyBUF_RECORDS_RO | writable_flag, 3,
20055 &__Pyx_TypeInfo_unsigned_char, stack,
20056 &result, obj);
20057 if (unlikely(retcode == -1))
20058 goto __pyx_fail;
20059 return result;
20060 __pyx_fail:
20061 result.memview = NULL;
20062 result.data = NULL;
20063 return result;
20064 }
20065
20066 /* CIntToPy */
__Pyx_PyInt_From_int(int value)20067 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
20068 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
20069 const int is_unsigned = neg_one > const_zero;
20070 if (is_unsigned) {
20071 if (sizeof(int) < sizeof(long)) {
20072 return PyInt_FromLong((long) value);
20073 } else if (sizeof(int) <= sizeof(unsigned long)) {
20074 return PyLong_FromUnsignedLong((unsigned long) value);
20075 #ifdef HAVE_LONG_LONG
20076 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
20077 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
20078 #endif
20079 }
20080 } else {
20081 if (sizeof(int) <= sizeof(long)) {
20082 return PyInt_FromLong((long) value);
20083 #ifdef HAVE_LONG_LONG
20084 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
20085 return PyLong_FromLongLong((PY_LONG_LONG) value);
20086 #endif
20087 }
20088 }
20089 {
20090 int one = 1; int little = (int)*(unsigned char *)&one;
20091 unsigned char *bytes = (unsigned char *)&value;
20092 return _PyLong_FromByteArray(bytes, sizeof(int),
20093 little, !is_unsigned);
20094 }
20095 }
20096
20097 /* CIntFromPyVerify */
20098 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
20099 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
20100 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
20101 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
20102 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
20103 {\
20104 func_type value = func_value;\
20105 if (sizeof(target_type) < sizeof(func_type)) {\
20106 if (unlikely(value != (func_type) (target_type) value)) {\
20107 func_type zero = 0;\
20108 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
20109 return (target_type) -1;\
20110 if (is_unsigned && unlikely(value < zero))\
20111 goto raise_neg_overflow;\
20112 else\
20113 goto raise_overflow;\
20114 }\
20115 }\
20116 return (target_type) value;\
20117 }
20118
20119 /* MemviewSliceCopyTemplate */
20120 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)20121 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
20122 const char *mode, int ndim,
20123 size_t sizeof_dtype, int contig_flag,
20124 int dtype_is_object)
20125 {
20126 __Pyx_RefNannyDeclarations
20127 int i;
20128 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
20129 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
20130 Py_buffer *buf = &from_memview->view;
20131 PyObject *shape_tuple = NULL;
20132 PyObject *temp_int = NULL;
20133 struct __pyx_array_obj *array_obj = NULL;
20134 struct __pyx_memoryview_obj *memview_obj = NULL;
20135 __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
20136 for (i = 0; i < ndim; i++) {
20137 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
20138 PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
20139 "indirect dimensions (axis %d)", i);
20140 goto fail;
20141 }
20142 }
20143 shape_tuple = PyTuple_New(ndim);
20144 if (unlikely(!shape_tuple)) {
20145 goto fail;
20146 }
20147 __Pyx_GOTREF(shape_tuple);
20148 for(i = 0; i < ndim; i++) {
20149 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
20150 if(unlikely(!temp_int)) {
20151 goto fail;
20152 } else {
20153 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
20154 temp_int = NULL;
20155 }
20156 }
20157 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
20158 if (unlikely(!array_obj)) {
20159 goto fail;
20160 }
20161 __Pyx_GOTREF(array_obj);
20162 memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
20163 (PyObject *) array_obj, contig_flag,
20164 dtype_is_object,
20165 from_mvs->memview->typeinfo);
20166 if (unlikely(!memview_obj))
20167 goto fail;
20168 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
20169 goto fail;
20170 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
20171 dtype_is_object) < 0))
20172 goto fail;
20173 goto no_fail;
20174 fail:
20175 __Pyx_XDECREF(new_mvs.memview);
20176 new_mvs.memview = NULL;
20177 new_mvs.data = NULL;
20178 no_fail:
20179 __Pyx_XDECREF(shape_tuple);
20180 __Pyx_XDECREF(temp_int);
20181 __Pyx_XDECREF(array_obj);
20182 __Pyx_RefNannyFinishContext();
20183 return new_mvs;
20184 }
20185
20186 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)20187 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
20188 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
20189 const int is_unsigned = neg_one > const_zero;
20190 #if PY_MAJOR_VERSION < 3
20191 if (likely(PyInt_Check(x))) {
20192 if (sizeof(int) < sizeof(long)) {
20193 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
20194 } else {
20195 long val = PyInt_AS_LONG(x);
20196 if (is_unsigned && unlikely(val < 0)) {
20197 goto raise_neg_overflow;
20198 }
20199 return (int) val;
20200 }
20201 } else
20202 #endif
20203 if (likely(PyLong_Check(x))) {
20204 if (is_unsigned) {
20205 #if CYTHON_USE_PYLONG_INTERNALS
20206 const digit* digits = ((PyLongObject*)x)->ob_digit;
20207 switch (Py_SIZE(x)) {
20208 case 0: return (int) 0;
20209 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
20210 case 2:
20211 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
20212 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20213 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20214 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
20215 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
20216 }
20217 }
20218 break;
20219 case 3:
20220 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
20221 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20222 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20223 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
20224 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
20225 }
20226 }
20227 break;
20228 case 4:
20229 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
20230 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20231 __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])))
20232 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
20233 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
20234 }
20235 }
20236 break;
20237 }
20238 #endif
20239 #if CYTHON_COMPILING_IN_CPYTHON
20240 if (unlikely(Py_SIZE(x) < 0)) {
20241 goto raise_neg_overflow;
20242 }
20243 #else
20244 {
20245 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
20246 if (unlikely(result < 0))
20247 return (int) -1;
20248 if (unlikely(result == 1))
20249 goto raise_neg_overflow;
20250 }
20251 #endif
20252 if (sizeof(int) <= sizeof(unsigned long)) {
20253 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
20254 #ifdef HAVE_LONG_LONG
20255 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
20256 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
20257 #endif
20258 }
20259 } else {
20260 #if CYTHON_USE_PYLONG_INTERNALS
20261 const digit* digits = ((PyLongObject*)x)->ob_digit;
20262 switch (Py_SIZE(x)) {
20263 case 0: return (int) 0;
20264 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
20265 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
20266 case -2:
20267 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
20268 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20269 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20270 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
20271 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20272 }
20273 }
20274 break;
20275 case 2:
20276 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
20277 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20278 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20279 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
20280 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20281 }
20282 }
20283 break;
20284 case -3:
20285 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
20286 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20287 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20288 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
20289 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20290 }
20291 }
20292 break;
20293 case 3:
20294 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
20295 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20296 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20297 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
20298 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20299 }
20300 }
20301 break;
20302 case -4:
20303 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
20304 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20305 __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])))
20306 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
20307 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20308 }
20309 }
20310 break;
20311 case 4:
20312 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
20313 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20314 __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])))
20315 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
20316 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
20317 }
20318 }
20319 break;
20320 }
20321 #endif
20322 if (sizeof(int) <= sizeof(long)) {
20323 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
20324 #ifdef HAVE_LONG_LONG
20325 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
20326 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
20327 #endif
20328 }
20329 }
20330 {
20331 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
20332 PyErr_SetString(PyExc_RuntimeError,
20333 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
20334 #else
20335 int val;
20336 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
20337 #if PY_MAJOR_VERSION < 3
20338 if (likely(v) && !PyLong_Check(v)) {
20339 PyObject *tmp = v;
20340 v = PyNumber_Long(tmp);
20341 Py_DECREF(tmp);
20342 }
20343 #endif
20344 if (likely(v)) {
20345 int one = 1; int is_little = (int)*(unsigned char *)&one;
20346 unsigned char *bytes = (unsigned char *)&val;
20347 int ret = _PyLong_AsByteArray((PyLongObject *)v,
20348 bytes, sizeof(val),
20349 is_little, !is_unsigned);
20350 Py_DECREF(v);
20351 if (likely(!ret))
20352 return val;
20353 }
20354 #endif
20355 return (int) -1;
20356 }
20357 } else {
20358 int val;
20359 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
20360 if (!tmp) return (int) -1;
20361 val = __Pyx_PyInt_As_int(tmp);
20362 Py_DECREF(tmp);
20363 return val;
20364 }
20365 raise_overflow:
20366 PyErr_SetString(PyExc_OverflowError,
20367 "value too large to convert to int");
20368 return (int) -1;
20369 raise_neg_overflow:
20370 PyErr_SetString(PyExc_OverflowError,
20371 "can't convert negative value to int");
20372 return (int) -1;
20373 }
20374
20375 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)20376 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
20377 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
20378 const int is_unsigned = neg_one > const_zero;
20379 #if PY_MAJOR_VERSION < 3
20380 if (likely(PyInt_Check(x))) {
20381 if (sizeof(long) < sizeof(long)) {
20382 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
20383 } else {
20384 long val = PyInt_AS_LONG(x);
20385 if (is_unsigned && unlikely(val < 0)) {
20386 goto raise_neg_overflow;
20387 }
20388 return (long) val;
20389 }
20390 } else
20391 #endif
20392 if (likely(PyLong_Check(x))) {
20393 if (is_unsigned) {
20394 #if CYTHON_USE_PYLONG_INTERNALS
20395 const digit* digits = ((PyLongObject*)x)->ob_digit;
20396 switch (Py_SIZE(x)) {
20397 case 0: return (long) 0;
20398 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
20399 case 2:
20400 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
20401 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20402 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20403 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
20404 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
20405 }
20406 }
20407 break;
20408 case 3:
20409 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
20410 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20411 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20412 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
20413 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
20414 }
20415 }
20416 break;
20417 case 4:
20418 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
20419 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20420 __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])))
20421 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
20422 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
20423 }
20424 }
20425 break;
20426 }
20427 #endif
20428 #if CYTHON_COMPILING_IN_CPYTHON
20429 if (unlikely(Py_SIZE(x) < 0)) {
20430 goto raise_neg_overflow;
20431 }
20432 #else
20433 {
20434 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
20435 if (unlikely(result < 0))
20436 return (long) -1;
20437 if (unlikely(result == 1))
20438 goto raise_neg_overflow;
20439 }
20440 #endif
20441 if (sizeof(long) <= sizeof(unsigned long)) {
20442 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
20443 #ifdef HAVE_LONG_LONG
20444 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
20445 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
20446 #endif
20447 }
20448 } else {
20449 #if CYTHON_USE_PYLONG_INTERNALS
20450 const digit* digits = ((PyLongObject*)x)->ob_digit;
20451 switch (Py_SIZE(x)) {
20452 case 0: return (long) 0;
20453 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
20454 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
20455 case -2:
20456 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
20457 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20458 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20459 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
20460 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20461 }
20462 }
20463 break;
20464 case 2:
20465 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
20466 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20467 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20468 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
20469 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20470 }
20471 }
20472 break;
20473 case -3:
20474 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
20475 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20476 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20477 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
20478 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20479 }
20480 }
20481 break;
20482 case 3:
20483 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
20484 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20485 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20486 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
20487 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20488 }
20489 }
20490 break;
20491 case -4:
20492 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
20493 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20494 __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])))
20495 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
20496 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20497 }
20498 }
20499 break;
20500 case 4:
20501 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
20502 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20503 __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])))
20504 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
20505 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
20506 }
20507 }
20508 break;
20509 }
20510 #endif
20511 if (sizeof(long) <= sizeof(long)) {
20512 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
20513 #ifdef HAVE_LONG_LONG
20514 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
20515 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
20516 #endif
20517 }
20518 }
20519 {
20520 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
20521 PyErr_SetString(PyExc_RuntimeError,
20522 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
20523 #else
20524 long val;
20525 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
20526 #if PY_MAJOR_VERSION < 3
20527 if (likely(v) && !PyLong_Check(v)) {
20528 PyObject *tmp = v;
20529 v = PyNumber_Long(tmp);
20530 Py_DECREF(tmp);
20531 }
20532 #endif
20533 if (likely(v)) {
20534 int one = 1; int is_little = (int)*(unsigned char *)&one;
20535 unsigned char *bytes = (unsigned char *)&val;
20536 int ret = _PyLong_AsByteArray((PyLongObject *)v,
20537 bytes, sizeof(val),
20538 is_little, !is_unsigned);
20539 Py_DECREF(v);
20540 if (likely(!ret))
20541 return val;
20542 }
20543 #endif
20544 return (long) -1;
20545 }
20546 } else {
20547 long val;
20548 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
20549 if (!tmp) return (long) -1;
20550 val = __Pyx_PyInt_As_long(tmp);
20551 Py_DECREF(tmp);
20552 return val;
20553 }
20554 raise_overflow:
20555 PyErr_SetString(PyExc_OverflowError,
20556 "value too large to convert to long");
20557 return (long) -1;
20558 raise_neg_overflow:
20559 PyErr_SetString(PyExc_OverflowError,
20560 "can't convert negative value to long");
20561 return (long) -1;
20562 }
20563
20564 /* CIntToPy */
__Pyx_PyInt_From_long(long value)20565 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
20566 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
20567 const int is_unsigned = neg_one > const_zero;
20568 if (is_unsigned) {
20569 if (sizeof(long) < sizeof(long)) {
20570 return PyInt_FromLong((long) value);
20571 } else if (sizeof(long) <= sizeof(unsigned long)) {
20572 return PyLong_FromUnsignedLong((unsigned long) value);
20573 #ifdef HAVE_LONG_LONG
20574 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
20575 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
20576 #endif
20577 }
20578 } else {
20579 if (sizeof(long) <= sizeof(long)) {
20580 return PyInt_FromLong((long) value);
20581 #ifdef HAVE_LONG_LONG
20582 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
20583 return PyLong_FromLongLong((PY_LONG_LONG) value);
20584 #endif
20585 }
20586 }
20587 {
20588 int one = 1; int little = (int)*(unsigned char *)&one;
20589 unsigned char *bytes = (unsigned char *)&value;
20590 return _PyLong_FromByteArray(bytes, sizeof(long),
20591 little, !is_unsigned);
20592 }
20593 }
20594
20595 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)20596 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
20597 const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
20598 const int is_unsigned = neg_one > const_zero;
20599 #if PY_MAJOR_VERSION < 3
20600 if (likely(PyInt_Check(x))) {
20601 if (sizeof(char) < sizeof(long)) {
20602 __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
20603 } else {
20604 long val = PyInt_AS_LONG(x);
20605 if (is_unsigned && unlikely(val < 0)) {
20606 goto raise_neg_overflow;
20607 }
20608 return (char) val;
20609 }
20610 } else
20611 #endif
20612 if (likely(PyLong_Check(x))) {
20613 if (is_unsigned) {
20614 #if CYTHON_USE_PYLONG_INTERNALS
20615 const digit* digits = ((PyLongObject*)x)->ob_digit;
20616 switch (Py_SIZE(x)) {
20617 case 0: return (char) 0;
20618 case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
20619 case 2:
20620 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
20621 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20622 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20623 } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
20624 return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
20625 }
20626 }
20627 break;
20628 case 3:
20629 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
20630 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20631 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20632 } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
20633 return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
20634 }
20635 }
20636 break;
20637 case 4:
20638 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
20639 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20640 __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])))
20641 } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
20642 return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
20643 }
20644 }
20645 break;
20646 }
20647 #endif
20648 #if CYTHON_COMPILING_IN_CPYTHON
20649 if (unlikely(Py_SIZE(x) < 0)) {
20650 goto raise_neg_overflow;
20651 }
20652 #else
20653 {
20654 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
20655 if (unlikely(result < 0))
20656 return (char) -1;
20657 if (unlikely(result == 1))
20658 goto raise_neg_overflow;
20659 }
20660 #endif
20661 if (sizeof(char) <= sizeof(unsigned long)) {
20662 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
20663 #ifdef HAVE_LONG_LONG
20664 } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
20665 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
20666 #endif
20667 }
20668 } else {
20669 #if CYTHON_USE_PYLONG_INTERNALS
20670 const digit* digits = ((PyLongObject*)x)->ob_digit;
20671 switch (Py_SIZE(x)) {
20672 case 0: return (char) 0;
20673 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
20674 case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
20675 case -2:
20676 if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
20677 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20678 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20679 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
20680 return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20681 }
20682 }
20683 break;
20684 case 2:
20685 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
20686 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
20687 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20688 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
20689 return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20690 }
20691 }
20692 break;
20693 case -3:
20694 if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
20695 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20696 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20697 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
20698 return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20699 }
20700 }
20701 break;
20702 case 3:
20703 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
20704 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
20705 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
20706 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
20707 return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20708 }
20709 }
20710 break;
20711 case -4:
20712 if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
20713 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20714 __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])))
20715 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
20716 return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20717 }
20718 }
20719 break;
20720 case 4:
20721 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
20722 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
20723 __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])))
20724 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
20725 return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
20726 }
20727 }
20728 break;
20729 }
20730 #endif
20731 if (sizeof(char) <= sizeof(long)) {
20732 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
20733 #ifdef HAVE_LONG_LONG
20734 } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
20735 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
20736 #endif
20737 }
20738 }
20739 {
20740 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
20741 PyErr_SetString(PyExc_RuntimeError,
20742 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
20743 #else
20744 char val;
20745 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
20746 #if PY_MAJOR_VERSION < 3
20747 if (likely(v) && !PyLong_Check(v)) {
20748 PyObject *tmp = v;
20749 v = PyNumber_Long(tmp);
20750 Py_DECREF(tmp);
20751 }
20752 #endif
20753 if (likely(v)) {
20754 int one = 1; int is_little = (int)*(unsigned char *)&one;
20755 unsigned char *bytes = (unsigned char *)&val;
20756 int ret = _PyLong_AsByteArray((PyLongObject *)v,
20757 bytes, sizeof(val),
20758 is_little, !is_unsigned);
20759 Py_DECREF(v);
20760 if (likely(!ret))
20761 return val;
20762 }
20763 #endif
20764 return (char) -1;
20765 }
20766 } else {
20767 char val;
20768 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
20769 if (!tmp) return (char) -1;
20770 val = __Pyx_PyInt_As_char(tmp);
20771 Py_DECREF(tmp);
20772 return val;
20773 }
20774 raise_overflow:
20775 PyErr_SetString(PyExc_OverflowError,
20776 "value too large to convert to char");
20777 return (char) -1;
20778 raise_neg_overflow:
20779 PyErr_SetString(PyExc_OverflowError,
20780 "can't convert negative value to char");
20781 return (char) -1;
20782 }
20783
20784 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)20785 static int __Pyx_check_binary_version(void) {
20786 char ctversion[4], rtversion[4];
20787 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
20788 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
20789 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
20790 char message[200];
20791 PyOS_snprintf(message, sizeof(message),
20792 "compiletime version %s of module '%.100s' "
20793 "does not match runtime version %s",
20794 ctversion, __Pyx_MODULE_NAME, rtversion);
20795 return PyErr_WarnEx(NULL, message, 1);
20796 }
20797 return 0;
20798 }
20799
20800 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)20801 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
20802 while (t->p) {
20803 #if PY_MAJOR_VERSION < 3
20804 if (t->is_unicode) {
20805 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
20806 } else if (t->intern) {
20807 *t->p = PyString_InternFromString(t->s);
20808 } else {
20809 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
20810 }
20811 #else
20812 if (t->is_unicode | t->is_str) {
20813 if (t->intern) {
20814 *t->p = PyUnicode_InternFromString(t->s);
20815 } else if (t->encoding) {
20816 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
20817 } else {
20818 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
20819 }
20820 } else {
20821 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
20822 }
20823 #endif
20824 if (!*t->p)
20825 return -1;
20826 if (PyObject_Hash(*t->p) == -1)
20827 return -1;
20828 ++t;
20829 }
20830 return 0;
20831 }
20832
__Pyx_PyUnicode_FromString(const char * c_str)20833 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
20834 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
20835 }
__Pyx_PyObject_AsString(PyObject * o)20836 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
20837 Py_ssize_t ignore;
20838 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
20839 }
20840 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
20841 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)20842 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
20843 char* defenc_c;
20844 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
20845 if (!defenc) return NULL;
20846 defenc_c = PyBytes_AS_STRING(defenc);
20847 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
20848 {
20849 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
20850 char* c;
20851 for (c = defenc_c; c < end; c++) {
20852 if ((unsigned char) (*c) >= 128) {
20853 PyUnicode_AsASCIIString(o);
20854 return NULL;
20855 }
20856 }
20857 }
20858 #endif
20859 *length = PyBytes_GET_SIZE(defenc);
20860 return defenc_c;
20861 }
20862 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)20863 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
20864 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
20865 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
20866 if (likely(PyUnicode_IS_ASCII(o))) {
20867 *length = PyUnicode_GET_LENGTH(o);
20868 return PyUnicode_AsUTF8(o);
20869 } else {
20870 PyUnicode_AsASCIIString(o);
20871 return NULL;
20872 }
20873 #else
20874 return PyUnicode_AsUTF8AndSize(o, length);
20875 #endif
20876 }
20877 #endif
20878 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)20879 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
20880 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
20881 if (
20882 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
20883 __Pyx_sys_getdefaultencoding_not_ascii &&
20884 #endif
20885 PyUnicode_Check(o)) {
20886 return __Pyx_PyUnicode_AsStringAndSize(o, length);
20887 } else
20888 #endif
20889 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
20890 if (PyByteArray_Check(o)) {
20891 *length = PyByteArray_GET_SIZE(o);
20892 return PyByteArray_AS_STRING(o);
20893 } else
20894 #endif
20895 {
20896 char* result;
20897 int r = PyBytes_AsStringAndSize(o, &result, length);
20898 if (unlikely(r < 0)) {
20899 return NULL;
20900 } else {
20901 return result;
20902 }
20903 }
20904 }
__Pyx_PyObject_IsTrue(PyObject * x)20905 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
20906 int is_true = x == Py_True;
20907 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
20908 else return PyObject_IsTrue(x);
20909 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)20910 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
20911 int retval;
20912 if (unlikely(!x)) return -1;
20913 retval = __Pyx_PyObject_IsTrue(x);
20914 Py_DECREF(x);
20915 return retval;
20916 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)20917 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
20918 #if PY_MAJOR_VERSION >= 3
20919 if (PyLong_Check(result)) {
20920 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
20921 "__int__ returned non-int (type %.200s). "
20922 "The ability to return an instance of a strict subclass of int "
20923 "is deprecated, and may be removed in a future version of Python.",
20924 Py_TYPE(result)->tp_name)) {
20925 Py_DECREF(result);
20926 return NULL;
20927 }
20928 return result;
20929 }
20930 #endif
20931 PyErr_Format(PyExc_TypeError,
20932 "__%.4s__ returned non-%.4s (type %.200s)",
20933 type_name, type_name, Py_TYPE(result)->tp_name);
20934 Py_DECREF(result);
20935 return NULL;
20936 }
__Pyx_PyNumber_IntOrLong(PyObject * x)20937 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
20938 #if CYTHON_USE_TYPE_SLOTS
20939 PyNumberMethods *m;
20940 #endif
20941 const char *name = NULL;
20942 PyObject *res = NULL;
20943 #if PY_MAJOR_VERSION < 3
20944 if (likely(PyInt_Check(x) || PyLong_Check(x)))
20945 #else
20946 if (likely(PyLong_Check(x)))
20947 #endif
20948 return __Pyx_NewRef(x);
20949 #if CYTHON_USE_TYPE_SLOTS
20950 m = Py_TYPE(x)->tp_as_number;
20951 #if PY_MAJOR_VERSION < 3
20952 if (m && m->nb_int) {
20953 name = "int";
20954 res = m->nb_int(x);
20955 }
20956 else if (m && m->nb_long) {
20957 name = "long";
20958 res = m->nb_long(x);
20959 }
20960 #else
20961 if (likely(m && m->nb_int)) {
20962 name = "int";
20963 res = m->nb_int(x);
20964 }
20965 #endif
20966 #else
20967 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
20968 res = PyNumber_Int(x);
20969 }
20970 #endif
20971 if (likely(res)) {
20972 #if PY_MAJOR_VERSION < 3
20973 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
20974 #else
20975 if (unlikely(!PyLong_CheckExact(res))) {
20976 #endif
20977 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
20978 }
20979 }
20980 else if (!PyErr_Occurred()) {
20981 PyErr_SetString(PyExc_TypeError,
20982 "an integer is required");
20983 }
20984 return res;
20985 }
20986 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
20987 Py_ssize_t ival;
20988 PyObject *x;
20989 #if PY_MAJOR_VERSION < 3
20990 if (likely(PyInt_CheckExact(b))) {
20991 if (sizeof(Py_ssize_t) >= sizeof(long))
20992 return PyInt_AS_LONG(b);
20993 else
20994 return PyInt_AsSsize_t(b);
20995 }
20996 #endif
20997 if (likely(PyLong_CheckExact(b))) {
20998 #if CYTHON_USE_PYLONG_INTERNALS
20999 const digit* digits = ((PyLongObject*)b)->ob_digit;
21000 const Py_ssize_t size = Py_SIZE(b);
21001 if (likely(__Pyx_sst_abs(size) <= 1)) {
21002 ival = likely(size) ? digits[0] : 0;
21003 if (size == -1) ival = -ival;
21004 return ival;
21005 } else {
21006 switch (size) {
21007 case 2:
21008 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
21009 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
21010 }
21011 break;
21012 case -2:
21013 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
21014 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
21015 }
21016 break;
21017 case 3:
21018 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
21019 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
21020 }
21021 break;
21022 case -3:
21023 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
21024 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
21025 }
21026 break;
21027 case 4:
21028 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
21029 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]));
21030 }
21031 break;
21032 case -4:
21033 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
21034 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]));
21035 }
21036 break;
21037 }
21038 }
21039 #endif
21040 return PyLong_AsSsize_t(b);
21041 }
21042 x = PyNumber_Index(b);
21043 if (!x) return -1;
21044 ival = PyInt_AsSsize_t(x);
21045 Py_DECREF(x);
21046 return ival;
21047 }
21048 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
21049 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
21050 }
21051 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
21052 return PyInt_FromSize_t(ival);
21053 }
21054
21055
21056 #endif /* Py_PYTHON_H */
21057