SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sioninter.c
1 /* Generated by Cython 0.20.2 (Debian 0.20.2-1) on Tue Nov 18 16:44:23 2014 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #ifndef CYTHON_USE_PYLONG_INTERNALS
5 #ifdef PYLONG_BITS_IN_DIGIT
6 #define CYTHON_USE_PYLONG_INTERNALS 0
7 #else
8 #include "pyconfig.h"
9 #ifdef PYLONG_BITS_IN_DIGIT
10 #define CYTHON_USE_PYLONG_INTERNALS 1
11 #else
12 #define CYTHON_USE_PYLONG_INTERNALS 0
13 #endif
14 #endif
15 #endif
16 #include "Python.h"
17 #ifndef Py_PYTHON_H
18  #error Python headers needed to compile C extensions, please install development version of Python.
19 #elif PY_VERSION_HEX < 0x02040000
20  #error Cython requires Python 2.4+.
21 #else
22 #define CYTHON_ABI "0_20_2"
23 #include <stddef.h> /* For offsetof */
24 #ifndef offsetof
25 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
26 #endif
27 #if !defined(WIN32) && !defined(MS_WINDOWS)
28  #ifndef __stdcall
29  #define __stdcall
30  #endif
31  #ifndef __cdecl
32  #define __cdecl
33  #endif
34  #ifndef __fastcall
35  #define __fastcall
36  #endif
37 #endif
38 #ifndef DL_IMPORT
39  #define DL_IMPORT(t) t
40 #endif
41 #ifndef DL_EXPORT
42  #define DL_EXPORT(t) t
43 #endif
44 #ifndef PY_LONG_LONG
45  #define PY_LONG_LONG LONG_LONG
46 #endif
47 #ifndef Py_HUGE_VAL
48  #define Py_HUGE_VAL HUGE_VAL
49 #endif
50 #ifdef PYPY_VERSION
51 #define CYTHON_COMPILING_IN_PYPY 1
52 #define CYTHON_COMPILING_IN_CPYTHON 0
53 #else
54 #define CYTHON_COMPILING_IN_PYPY 0
55 #define CYTHON_COMPILING_IN_CPYTHON 1
56 #endif
57 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
58 #define Py_OptimizeFlag 0
59 #endif
60 #if PY_VERSION_HEX < 0x02050000
61  typedef int Py_ssize_t;
62  #define PY_SSIZE_T_MAX INT_MAX
63  #define PY_SSIZE_T_MIN INT_MIN
64  #define PY_FORMAT_SIZE_T ""
65  #define CYTHON_FORMAT_SSIZE_T ""
66  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
67  #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
68  #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
69  (PyErr_Format(PyExc_TypeError, \
70  "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
71  (PyObject*)0))
72  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
73  !PyComplex_Check(o))
74  #define PyIndex_Check __Pyx_PyIndex_Check
75  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
76  #define __PYX_BUILD_PY_SSIZE_T "i"
77 #else
78  #define __PYX_BUILD_PY_SSIZE_T "n"
79  #define CYTHON_FORMAT_SSIZE_T "z"
80  #define __Pyx_PyIndex_Check PyIndex_Check
81 #endif
82 #if PY_VERSION_HEX < 0x02060000
83  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
84  #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
85  #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
86  #define PyVarObject_HEAD_INIT(type, size) \
87  PyObject_HEAD_INIT(type) size,
88  #define PyType_Modified(t)
89  typedef struct {
90  void *buf;
91  PyObject *obj;
92  Py_ssize_t len;
93  Py_ssize_t itemsize;
94  int readonly;
95  int ndim;
96  char *format;
97  Py_ssize_t *shape;
98  Py_ssize_t *strides;
99  Py_ssize_t *suboffsets;
100  void *internal;
101  } Py_buffer;
102  #define PyBUF_SIMPLE 0
103  #define PyBUF_WRITABLE 0x0001
104  #define PyBUF_FORMAT 0x0004
105  #define PyBUF_ND 0x0008
106  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
107  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
108  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
109  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
110  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
111  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
112  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
113  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
114  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
115 #endif
116 #if PY_MAJOR_VERSION < 3
117  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
118  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
119  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
120  #define __Pyx_DefaultClassType PyClass_Type
121 #else
122  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
123  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
124  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
125  #define __Pyx_DefaultClassType PyType_Type
126 #endif
127 #if PY_VERSION_HEX < 0x02060000
128  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
129 #endif
130 #if PY_MAJOR_VERSION >= 3
131  #define Py_TPFLAGS_CHECKTYPES 0
132  #define Py_TPFLAGS_HAVE_INDEX 0
133 #endif
134 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
135  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
136 #endif
137 #if PY_VERSION_HEX < 0x02060000
138  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
139 #endif
140 #if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
141  #define Py_TPFLAGS_IS_ABSTRACT 0
142 #endif
143 #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
144  #define Py_TPFLAGS_HAVE_FINALIZE 0
145 #endif
146 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
147  #define CYTHON_PEP393_ENABLED 1
148  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
149  0 : _PyUnicode_Ready((PyObject *)(op)))
150  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
151  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
152  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
153  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
154  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
155 #else
156  #define CYTHON_PEP393_ENABLED 0
157  #define __Pyx_PyUnicode_READY(op) (0)
158  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
159  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
160  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
161  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
162  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
163 #endif
164 #if CYTHON_COMPILING_IN_PYPY
165  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
166  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
167 #else
168  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
169  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
170  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
171 #endif
172 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
173 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
174 #if PY_MAJOR_VERSION >= 3
175  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
176 #else
177  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
178 #endif
179 #if PY_MAJOR_VERSION >= 3
180  #define PyBaseString_Type PyUnicode_Type
181  #define PyStringObject PyUnicodeObject
182  #define PyString_Type PyUnicode_Type
183  #define PyString_Check PyUnicode_Check
184  #define PyString_CheckExact PyUnicode_CheckExact
185 #endif
186 #if PY_VERSION_HEX < 0x02060000
187  #define PyBytesObject PyStringObject
188  #define PyBytes_Type PyString_Type
189  #define PyBytes_Check PyString_Check
190  #define PyBytes_CheckExact PyString_CheckExact
191  #define PyBytes_FromString PyString_FromString
192  #define PyBytes_FromStringAndSize PyString_FromStringAndSize
193  #define PyBytes_FromFormat PyString_FromFormat
194  #define PyBytes_DecodeEscape PyString_DecodeEscape
195  #define PyBytes_AsString PyString_AsString
196  #define PyBytes_AsStringAndSize PyString_AsStringAndSize
197  #define PyBytes_Size PyString_Size
198  #define PyBytes_AS_STRING PyString_AS_STRING
199  #define PyBytes_GET_SIZE PyString_GET_SIZE
200  #define PyBytes_Repr PyString_Repr
201  #define PyBytes_Concat PyString_Concat
202  #define PyBytes_ConcatAndDel PyString_ConcatAndDel
203 #endif
204 #if PY_MAJOR_VERSION >= 3
205  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
206  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
207 #else
208  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
209  PyString_Check(obj) || PyUnicode_Check(obj))
210  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
211 #endif
212 #if PY_VERSION_HEX < 0x02060000
213  #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
214  #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
215 #endif
216 #ifndef PySet_CheckExact
217  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
218 #endif
219 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
220 #if PY_MAJOR_VERSION >= 3
221  #define PyIntObject PyLongObject
222  #define PyInt_Type PyLong_Type
223  #define PyInt_Check(op) PyLong_Check(op)
224  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
225  #define PyInt_FromString PyLong_FromString
226  #define PyInt_FromUnicode PyLong_FromUnicode
227  #define PyInt_FromLong PyLong_FromLong
228  #define PyInt_FromSize_t PyLong_FromSize_t
229  #define PyInt_FromSsize_t PyLong_FromSsize_t
230  #define PyInt_AsLong PyLong_AsLong
231  #define PyInt_AS_LONG PyLong_AS_LONG
232  #define PyInt_AsSsize_t PyLong_AsSsize_t
233  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
234  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
235  #define PyNumber_Int PyNumber_Long
236 #endif
237 #if PY_MAJOR_VERSION >= 3
238  #define PyBoolObject PyLongObject
239 #endif
240 #if PY_VERSION_HEX < 0x030200A4
241  typedef long Py_hash_t;
242  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
243  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
244 #else
245  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
246  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
247 #endif
248 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
249  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
250  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
251  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
252 #else
253  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
254  (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
255  (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
256  (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
257  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
258  (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
259  (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
260  (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
261  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
262  (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
263  (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
264  (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
265 #endif
266 #if PY_MAJOR_VERSION >= 3
267  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
268 #endif
269 #if PY_VERSION_HEX < 0x02050000
270  #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
271  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
272  #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
273 #else
274  #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
275  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
276  #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
277 #endif
278 #if PY_VERSION_HEX < 0x02050000
279  #define __Pyx_NAMESTR(n) ((char *)(n))
280  #define __Pyx_DOCSTR(n) ((char *)(n))
281 #else
282  #define __Pyx_NAMESTR(n) (n)
283  #define __Pyx_DOCSTR(n) (n)
284 #endif
285 #ifndef CYTHON_INLINE
286  #if defined(__GNUC__)
287  #define CYTHON_INLINE __inline__
288  #elif defined(_MSC_VER)
289  #define CYTHON_INLINE __inline
290  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
291  #define CYTHON_INLINE inline
292  #else
293  #define CYTHON_INLINE
294  #endif
295 #endif
296 #ifndef CYTHON_RESTRICT
297  #if defined(__GNUC__)
298  #define CYTHON_RESTRICT __restrict__
299  #elif defined(_MSC_VER) && _MSC_VER >= 1400
300  #define CYTHON_RESTRICT __restrict
301  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
302  #define CYTHON_RESTRICT restrict
303  #else
304  #define CYTHON_RESTRICT
305  #endif
306 #endif
307 #ifdef NAN
308 #define __PYX_NAN() ((float) NAN)
309 #else
310 static CYTHON_INLINE float __PYX_NAN() {
311  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
312  a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
313  a quiet NaN. */
314  float value;
315  memset(&value, 0xFF, sizeof(value));
316  return value;
317 }
318 #endif
319 #ifdef __cplusplus
320 template<typename T>
321 void __Pyx_call_destructor(T* x) {
322  x->~T();
323 }
324 #endif
325 
326 
327 #if PY_MAJOR_VERSION >= 3
328  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
329  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
330 #else
331  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
332  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
333 #endif
334 
335 #ifndef __PYX_EXTERN_C
336  #ifdef __cplusplus
337  #define __PYX_EXTERN_C extern "C"
338  #else
339  #define __PYX_EXTERN_C extern
340  #endif
341 #endif
342 
343 #if defined(WIN32) || defined(MS_WINDOWS)
344 #define _USE_MATH_DEFINES
345 #endif
346 #include <math.h>
347 #define __PYX_HAVE__sioninter
348 #define __PYX_HAVE_API__sioninter
349 #include "string.h"
350 #include "stdlib.h"
351 #include "stdio.h"
352 #include "pythread.h"
353 #include "stdint.h"
354 #include "mpi.h"
355 #include "sion.h"
356 #include "sion_mpi.h"
357 #ifdef _OPENMP
358 #include <omp.h>
359 #endif /* _OPENMP */
360 
361 #ifdef PYREX_WITHOUT_ASSERTIONS
362 #define CYTHON_WITHOUT_ASSERTIONS
363 #endif
364 
365 #ifndef CYTHON_UNUSED
366 # if defined(__GNUC__)
367 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
368 # define CYTHON_UNUSED __attribute__ ((__unused__))
369 # else
370 # define CYTHON_UNUSED
371 # endif
372 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
373 # define CYTHON_UNUSED __attribute__ ((__unused__))
374 # else
375 # define CYTHON_UNUSED
376 # endif
377 #endif
378 typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
379  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
380 
381 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
382 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
383 #define __PYX_DEFAULT_STRING_ENCODING ""
384 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
385 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
386 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
387  (sizeof(type) < sizeof(Py_ssize_t)) || \
388  (sizeof(type) > sizeof(Py_ssize_t) && \
389  likely(v < (type)PY_SSIZE_T_MAX || \
390  v == (type)PY_SSIZE_T_MAX) && \
391  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
392  v == (type)PY_SSIZE_T_MIN))) || \
393  (sizeof(type) == sizeof(Py_ssize_t) && \
394  (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
395  v == (type)PY_SSIZE_T_MAX))) )
396 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
397 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
398 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
399 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
400 #define __Pyx_PyBytes_FromString PyBytes_FromString
401 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
402 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
403 #if PY_MAJOR_VERSION < 3
404  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
405  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
406 #else
407  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
408  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
409 #endif
410 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
411 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
412 #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s)
413 #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s)
414 #define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s)
415 #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s)
416 #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
417 #if PY_MAJOR_VERSION < 3
418 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
419 {
420  const Py_UNICODE *u_end = u;
421  while (*u_end++) ;
422  return (size_t)(u_end - u - 1);
423 }
424 #else
425 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
426 #endif
427 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
428 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
429 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
430 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
431 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
432 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
433 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
434 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
435 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
436 #if CYTHON_COMPILING_IN_CPYTHON
437 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
438 #else
439 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
440 #endif
441 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
442 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
443 static int __Pyx_sys_getdefaultencoding_not_ascii;
444 static int __Pyx_init_sys_getdefaultencoding_params(void) {
445  PyObject* sys;
446  PyObject* default_encoding = NULL;
447  PyObject* ascii_chars_u = NULL;
448  PyObject* ascii_chars_b = NULL;
449  const char* default_encoding_c;
450  sys = PyImport_ImportModule("sys");
451  if (!sys) goto bad;
452  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
453  Py_DECREF(sys);
454  if (!default_encoding) goto bad;
455  default_encoding_c = PyBytes_AsString(default_encoding);
456  if (!default_encoding_c) goto bad;
457  if (strcmp(default_encoding_c, "ascii") == 0) {
458  __Pyx_sys_getdefaultencoding_not_ascii = 0;
459  } else {
460  char ascii_chars[128];
461  int c;
462  for (c = 0; c < 128; c++) {
463  ascii_chars[c] = c;
464  }
465  __Pyx_sys_getdefaultencoding_not_ascii = 1;
466  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
467  if (!ascii_chars_u) goto bad;
468  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
469  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
470  PyErr_Format(
471  PyExc_ValueError,
472  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
473  default_encoding_c);
474  goto bad;
475  }
476  Py_DECREF(ascii_chars_u);
477  Py_DECREF(ascii_chars_b);
478  }
479  Py_DECREF(default_encoding);
480  return 0;
481 bad:
482  Py_XDECREF(default_encoding);
483  Py_XDECREF(ascii_chars_u);
484  Py_XDECREF(ascii_chars_b);
485  return -1;
486 }
487 #endif
488 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
489 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
490 #else
491 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
492 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
493 static char* __PYX_DEFAULT_STRING_ENCODING;
494 static int __Pyx_init_sys_getdefaultencoding_params(void) {
495  PyObject* sys;
496  PyObject* default_encoding = NULL;
497  char* default_encoding_c;
498  sys = PyImport_ImportModule("sys");
499  if (!sys) goto bad;
500  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
501  Py_DECREF(sys);
502  if (!default_encoding) goto bad;
503  default_encoding_c = PyBytes_AsString(default_encoding);
504  if (!default_encoding_c) goto bad;
505  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
506  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
507  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
508  Py_DECREF(default_encoding);
509  return 0;
510 bad:
511  Py_XDECREF(default_encoding);
512  return -1;
513 }
514 #endif
515 #endif
516 
517 
518 /* Test for GCC > 2.95 */
519 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
520  #define likely(x) __builtin_expect(!!(x), 1)
521  #define unlikely(x) __builtin_expect(!!(x), 0)
522 #else /* !__GNUC__ or GCC < 2.95 */
523  #define likely(x) (x)
524  #define unlikely(x) (x)
525 #endif /* __GNUC__ */
526 
527 static PyObject *__pyx_m;
528 static PyObject *__pyx_d;
529 static PyObject *__pyx_b;
530 static PyObject *__pyx_empty_tuple;
531 static PyObject *__pyx_empty_bytes;
532 static int __pyx_lineno;
533 static int __pyx_clineno = 0;
534 static const char * __pyx_cfilenm= __FILE__;
535 static const char *__pyx_filename;
536 
537 
538 static const char *__pyx_f[] = {
539  "sioninter.pyx",
540  "array.pxd",
541  "type.pxd",
542  "bool.pxd",
543  "complex.pxd",
544 };
545 
546 /* "csioninter.pxd":4
547  * from libc.stdio cimport FILE
548  * from libc.stdint cimport uint64_t
549  * ctypedef long long sion_int64 # <<<<<<<<<<<<<<
550  * ctypedef int sion_int32
551  * from mpi4py.mpi_c cimport MPI_Comm
552  */
553 typedef PY_LONG_LONG __pyx_t_10csioninter_sion_int64;
554 
555 /* "csioninter.pxd":5
556  * from libc.stdint cimport uint64_t
557  * ctypedef long long sion_int64
558  * ctypedef int sion_int32 # <<<<<<<<<<<<<<
559  * from mpi4py.mpi_c cimport MPI_Comm
560  *
561  */
562 typedef int __pyx_t_10csioninter_sion_int32;
563 
564 /*--- Type declarations ---*/
565 #ifndef _ARRAYARRAY_H
566 struct arrayobject;
567 typedef struct arrayobject arrayobject;
568 #endif
569 struct __pyx_opt_args_9sioninter_sion_open;
570 struct __pyx_opt_args_9sioninter_sion_paropen_mpi;
571 struct __pyx_opt_args_9sioninter_sion_fread;
572 struct __pyx_opt_args_9sioninter_sion_fread_key;
573 struct __pyx_defaults;
574 typedef struct __pyx_defaults __pyx_defaults;
575 struct __pyx_defaults1;
576 typedef struct __pyx_defaults1 __pyx_defaults1;
577 struct __pyx_defaults2;
578 typedef struct __pyx_defaults2 __pyx_defaults2;
579 
580 /* "sioninter.pyx":107
581  *
582  *
583  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
584  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE,
585  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
586  */
587 struct __pyx_opt_args_9sioninter_sion_open {
588  int __pyx_n;
589  PyObject *ntasks;
590  PyObject *nfiles;
591  PyObject *chunksizes;
592  PyObject *fsblksize;
593  PyObject *globalranks;
594  PyObject *fileptr;
595 };
596 
597 /* "sioninter.pyx":144
598  *
599  *
600  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
601  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
602  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
603  */
604 struct __pyx_opt_args_9sioninter_sion_paropen_mpi {
605  int __pyx_n;
606  PyObject *nfiles;
607  PyObject *gComm;
608  PyObject *lComm;
609  PyObject *chunksize;
610  PyObject *fsblksize;
611  PyObject *globalrank;
612  PyObject *fileptr;
613 };
614 
615 /* "sioninter.pyx":191
616  *
617  *
618  * cdef sion_fread(sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
619  * """Read data from file."""
620  * cdef size_t _size = DEFAULT_SIZE
621  */
622 struct __pyx_opt_args_9sioninter_sion_fread {
623  int __pyx_n;
624  PyObject *nitems;
625 };
626 
627 /* "sioninter.pyx":227
628  *
629  *
630  * cpdef sion_fread_key(key, sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
631  * """Read value for corresponding key."""
632  * cdef size_t _size = DEFAULT_SIZE
633  */
634 struct __pyx_opt_args_9sioninter_sion_fread_key {
635  int __pyx_n;
636  PyObject *nitems;
637 };
638 struct __pyx_defaults {
639  PyObject *__pyx_arg_par_mode;
640 };
641 struct __pyx_defaults1 {
642  PyObject *__pyx_arg_nitems;
643 };
644 struct __pyx_defaults2 {
645  PyObject *__pyx_arg_nitems;
646 };
647 #ifndef CYTHON_REFNANNY
648  #define CYTHON_REFNANNY 0
649 #endif
650 #if CYTHON_REFNANNY
651  typedef struct {
652  void (*INCREF)(void*, PyObject*, int);
653  void (*DECREF)(void*, PyObject*, int);
654  void (*GOTREF)(void*, PyObject*, int);
655  void (*GIVEREF)(void*, PyObject*, int);
656  void* (*SetupContext)(const char*, int, const char*);
657  void (*FinishContext)(void**);
658  } __Pyx_RefNannyAPIStruct;
659  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
660  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
661  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
662 #ifdef WITH_THREAD
663  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
664  if (acquire_gil) { \
665  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
666  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
667  PyGILState_Release(__pyx_gilstate_save); \
668  } else { \
669  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
670  }
671 #else
672  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
673  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
674 #endif
675  #define __Pyx_RefNannyFinishContext() \
676  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
677  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
678  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
679  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
680  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
681  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
682  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
683  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
684  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
685 #else
686  #define __Pyx_RefNannyDeclarations
687  #define __Pyx_RefNannySetupContext(name, acquire_gil)
688  #define __Pyx_RefNannyFinishContext()
689  #define __Pyx_INCREF(r) Py_INCREF(r)
690  #define __Pyx_DECREF(r) Py_DECREF(r)
691  #define __Pyx_GOTREF(r)
692  #define __Pyx_GIVEREF(r)
693  #define __Pyx_XINCREF(r) Py_XINCREF(r)
694  #define __Pyx_XDECREF(r) Py_XDECREF(r)
695  #define __Pyx_XGOTREF(r)
696  #define __Pyx_XGIVEREF(r)
697 #endif /* CYTHON_REFNANNY */
698 #define __Pyx_XDECREF_SET(r, v) do { \
699  PyObject *tmp = (PyObject *) r; \
700  r = v; __Pyx_XDECREF(tmp); \
701  } while (0)
702 #define __Pyx_DECREF_SET(r, v) do { \
703  PyObject *tmp = (PyObject *) r; \
704  r = v; __Pyx_DECREF(tmp); \
705  } while (0)
706 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
707 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
708 
709 #if CYTHON_COMPILING_IN_CPYTHON
710 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
711  PyTypeObject* tp = Py_TYPE(obj);
712  if (likely(tp->tp_getattro))
713  return tp->tp_getattro(obj, attr_name);
714 #if PY_MAJOR_VERSION < 3
715  if (likely(tp->tp_getattr))
716  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
717 #endif
718  return PyObject_GetAttr(obj, attr_name);
719 }
720 #else
721 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
722 #endif
723 
724 static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
725 
726 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
727 
728 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
729  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
730  const char* function_name); /*proto*/
731 
732 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
733  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
734 
735 #if CYTHON_COMPILING_IN_CPYTHON
736 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
737 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
738  PyTypeObject* tp = Py_TYPE(obj);
739  if (likely(tp->tp_setattro))
740  return tp->tp_setattro(obj, attr_name, value);
741 #if PY_MAJOR_VERSION < 3
742  if (likely(tp->tp_setattr))
743  return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
744 #endif
745  return PyObject_SetAttr(obj, attr_name, value);
746 }
747 #else
748 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
749 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
750 #endif
751 
752 static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
753  int result = PySequence_Contains(seq, item);
754  return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
755 }
756 
757 #if CYTHON_COMPILING_IN_CPYTHON
758 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
759 #else
760 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
761 #endif
762 
763 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
764 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
765 
766 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
767 
768 #include <string.h>
769 
770 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
771 
772 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
773 
774 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
775 
776 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
777 
778 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
779 
780 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
781 
782 #define __Pyx_CyFunction_USED 1
783 #include <structmember.h>
784 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
785 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
786 #define __Pyx_CYFUNCTION_CCLASS 0x04
787 #define __Pyx_CyFunction_GetClosure(f) \
788  (((__pyx_CyFunctionObject *) (f))->func_closure)
789 #define __Pyx_CyFunction_GetClassObj(f) \
790  (((__pyx_CyFunctionObject *) (f))->func_classobj)
791 #define __Pyx_CyFunction_Defaults(type, f) \
792  ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
793 #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
794  ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
795 typedef struct {
796  PyCFunctionObject func;
797  PyObject *func_dict;
798  PyObject *func_weakreflist;
799  PyObject *func_name;
800  PyObject *func_qualname;
801  PyObject *func_doc;
802  PyObject *func_globals;
803  PyObject *func_code;
804  PyObject *func_closure;
805  PyObject *func_classobj; /* No-args super() class cell */
806  void *defaults;
807  int defaults_pyobjects;
808  int flags;
809  PyObject *defaults_tuple; /* Const defaults tuple */
810  PyObject *defaults_kwdict; /* Const kwonly defaults dict */
811  PyObject *(*defaults_getter)(PyObject *);
812  PyObject *func_annotations; /* function annotations dict */
813 } __pyx_CyFunctionObject;
814 static PyTypeObject *__pyx_CyFunctionType = 0;
815 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
816  __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
817 static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
818  int flags, PyObject* qualname,
819  PyObject *self,
820  PyObject *module, PyObject *globals,
821  PyObject* code);
822 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
823  size_t size,
824  int pyobjects);
825 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
826  PyObject *tuple);
827 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
828  PyObject *dict);
829 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
830  PyObject *dict);
831 static int __Pyx_CyFunction_init(void);
832 
833 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
834  PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/
835 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
836  PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /*proto*/
837 
838 #ifndef _ARRAYARRAY_H
839 #define _ARRAYARRAY_H
840 typedef struct arraydescr {
841  int typecode;
842  int itemsize;
843  PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
844  int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
845 #if PY_VERSION_HEX >= 0x03000000
846  char *formats;
847 #endif
848 } arraydescr;
849 struct arrayobject {
850  PyObject_HEAD
851  Py_ssize_t ob_size;
852  union {
853  char *ob_item;
854  float *as_floats;
855  double *as_doubles;
856  int *as_ints;
857  unsigned int *as_uints;
858  unsigned char *as_uchars;
859  signed char *as_schars;
860  char *as_chars;
861  unsigned long *as_ulongs;
862  long *as_longs;
863  short *as_shorts;
864  unsigned short *as_ushorts;
865  Py_UNICODE *as_pyunicodes;
866  void *as_voidptr;
867  } data;
868  Py_ssize_t allocated;
869  struct arraydescr *ob_descr;
870  PyObject *weakreflist; /* List of weak references */
871 #if PY_VERSION_HEX >= 0x03000000
872  int ob_exports; /* Number of exported buffers */
873 #endif
874 };
875 #ifndef NO_NEWARRAY_INLINE
876 static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
877  struct arraydescr *descr) {
878  arrayobject *op;
879  size_t nbytes;
880  if (size < 0) {
881  PyErr_BadInternalCall();
882  return NULL;
883  }
884  nbytes = size * descr->itemsize;
885  if (nbytes / descr->itemsize != (size_t)size) {
886  return PyErr_NoMemory();
887  }
888  op = (arrayobject *) type->tp_alloc(type, 0);
889  if (op == NULL) {
890  return NULL;
891  }
892  op->ob_descr = descr;
893  op->allocated = size;
894  op->weakreflist = NULL;
895  op->ob_size = size;
896  if (size <= 0) {
897  op->data.ob_item = NULL;
898  }
899  else {
900  op->data.ob_item = PyMem_NEW(char, nbytes);
901  if (op->data.ob_item == NULL) {
902  Py_DECREF(op);
903  return PyErr_NoMemory();
904  }
905  }
906  return (PyObject *) op;
907 }
908 #else
909 PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
910  struct arraydescr *descr);
911 #endif /* ifndef NO_NEWARRAY_INLINE */
912 static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
913  void *items = (void*) self->data.ob_item;
914  PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
915  if (items == NULL) {
916  PyErr_NoMemory();
917  return -1;
918  }
919  self->data.ob_item = (char*) items;
920  self->ob_size = n;
921  self->allocated = n;
922  return 0;
923 }
924 static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
925  void *items = (void*) self->data.ob_item;
926  Py_ssize_t newsize;
927  if (n < self->allocated) {
928  if (n*4 > self->allocated) {
929  self->ob_size = n;
930  return 0;
931  }
932  }
933  newsize = n * 3 / 2 + 1;
934  PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
935  if (items == NULL) {
936  PyErr_NoMemory();
937  return -1;
938  }
939  self->data.ob_item = (char*) items;
940  self->ob_size = n;
941  self->allocated = newsize;
942  return 0;
943 }
944 #endif
945 
946 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
947 
948 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
949 
950 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
951 
952 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);
953 
954 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
955 
956 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
957 
958 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value);
959 
960 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
961 
962 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
963 
964 static int __Pyx_check_binary_version(void);
965 
966 #if !defined(__Pyx_PyIdentifier_FromString)
967 #if PY_MAJOR_VERSION < 3
968  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
969 #else
970  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
971 #endif
972 #endif
973 
974 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
975 
976 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
977 
978 typedef struct {
979  int code_line;
980  PyCodeObject* code_object;
981 } __Pyx_CodeObjectCacheEntry;
982 struct __Pyx_CodeObjectCache {
983  int count;
984  int max_count;
985  __Pyx_CodeObjectCacheEntry* entries;
986 };
987 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
988 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
989 static PyCodeObject *__pyx_find_code_object(int code_line);
990 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
991 
992 static void __Pyx_AddTraceback(const char *funcname, int c_line,
993  int py_line, const char *filename); /*proto*/
994 
995 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
996 
997 
998 /* Module declarations from 'libc.string' */
999 
1000 /* Module declarations from 'libc.stdlib' */
1001 
1002 /* Module declarations from 'libc.stdio' */
1003 
1004 /* Module declarations from 'cpython.version' */
1005 
1006 /* Module declarations from 'cpython.ref' */
1007 
1008 /* Module declarations from 'cpython.exc' */
1009 
1010 /* Module declarations from 'cpython.module' */
1011 
1012 /* Module declarations from 'cpython.mem' */
1013 
1014 /* Module declarations from 'cpython.tuple' */
1015 
1016 /* Module declarations from 'cpython.list' */
1017 
1018 /* Module declarations from 'cpython.object' */
1019 
1020 /* Module declarations from 'cpython.sequence' */
1021 
1022 /* Module declarations from 'cpython.mapping' */
1023 
1024 /* Module declarations from 'cpython.iterator' */
1025 
1026 /* Module declarations from '__builtin__' */
1027 
1028 /* Module declarations from 'cpython.type' */
1029 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1030 
1031 /* Module declarations from 'cpython.number' */
1032 
1033 /* Module declarations from 'cpython.int' */
1034 
1035 /* Module declarations from '__builtin__' */
1036 
1037 /* Module declarations from 'cpython.bool' */
1038 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1039 
1040 /* Module declarations from 'cpython.long' */
1041 
1042 /* Module declarations from 'cpython.float' */
1043 
1044 /* Module declarations from '__builtin__' */
1045 
1046 /* Module declarations from 'cpython.complex' */
1047 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1048 
1049 /* Module declarations from 'cpython.string' */
1050 
1051 /* Module declarations from 'cpython.unicode' */
1052 
1053 /* Module declarations from 'cpython.dict' */
1054 
1055 /* Module declarations from 'cpython.instance' */
1056 
1057 /* Module declarations from 'cpython.function' */
1058 
1059 /* Module declarations from 'cpython.method' */
1060 
1061 /* Module declarations from 'cpython.weakref' */
1062 
1063 /* Module declarations from 'cpython.getargs' */
1064 
1065 /* Module declarations from 'cpython.pythread' */
1066 
1067 /* Module declarations from 'cpython.pystate' */
1068 
1069 /* Module declarations from 'cpython.cobject' */
1070 
1071 /* Module declarations from 'cpython.oldbuffer' */
1072 
1073 /* Module declarations from 'cpython.set' */
1074 
1075 /* Module declarations from 'cpython.buffer' */
1076 
1077 /* Module declarations from 'cpython.bytes' */
1078 
1079 /* Module declarations from 'cpython.pycapsule' */
1080 
1081 /* Module declarations from 'cpython' */
1082 
1083 /* Module declarations from 'array' */
1084 
1085 /* Module declarations from 'cpython.array' */
1086 static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0;
1087 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
1088 
1089 /* Module declarations from 'libc.stdint' */
1090 
1091 /* Module declarations from 'mpi4py.libmpi' */
1092 
1093 /* Module declarations from 'mpi4py.mpi_c' */
1094 
1095 /* Module declarations from 'csioninter' */
1096 
1097 /* Module declarations from 'sioninter' */
1098 static PyObject *__pyx_f_9sioninter_sion_open(PyObject *, PyObject *, struct __pyx_opt_args_9sioninter_sion_open *__pyx_optional_args); /*proto*/
1099 static PyObject *__pyx_f_9sioninter_sion_close(PyObject *); /*proto*/
1100 static PyObject *__pyx_f_9sioninter_sion_paropen_mpi(PyObject *, PyObject *, struct __pyx_opt_args_9sioninter_sion_paropen_mpi *__pyx_optional_args); /*proto*/
1101 static PyObject *__pyx_f_9sioninter_sion_parclose_mpi(PyObject *); /*proto*/
1102 static PyObject *__pyx_f_9sioninter_sion_fwrite(PyObject *, PyObject *); /*proto*/
1103 static PyObject *__pyx_f_9sioninter_sion_fread(PyObject *, struct __pyx_opt_args_9sioninter_sion_fread *__pyx_optional_args); /*proto*/
1104 static PyObject *__pyx_f_9sioninter_sion_bytes_avail_in_chunk(PyObject *); /*proto*/
1105 static PyObject *__pyx_f_9sioninter_sion_fwrite_key(PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
1106 static PyObject *__pyx_f_9sioninter_sion_fread_key(PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9sioninter_sion_fread_key *__pyx_optional_args); /*proto*/
1107 #define __Pyx_MODULE_NAME "sioninter"
1108 int __pyx_module_is_main_sioninter = 0;
1109 
1110 /* Implementation of 'sioninter' */
1111 static PyObject *__pyx_builtin_property;
1112 static PyObject *__pyx_builtin_AttributeError;
1113 static PyObject *__pyx_builtin_range;
1114 static PyObject *__pyx_builtin_IOError;
1115 static PyObject *__pyx_builtin_MemoryError;
1116 static PyObject *__pyx_pf_9sioninter_8SIONFile_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1117 static PyObject *__pyx_pf_9sioninter_8SIONFile___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_par_mode); /* proto */
1118 static PyObject *__pyx_pf_9sioninter_8SIONFile_2open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode); /* proto */
1119 static PyObject *__pyx_pf_9sioninter_8SIONFile_4closed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1120 static PyObject *__pyx_pf_9sioninter_8SIONFile_6close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1121 static PyObject *__pyx_pf_9sioninter_8SIONFile_8write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
1122 static PyObject *__pyx_pf_9sioninter_8SIONFile_18__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1123 static PyObject *__pyx_pf_9sioninter_8SIONFile_10read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nitems); /* proto */
1124 static PyObject *__pyx_pf_9sioninter_8SIONFile_12write_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_key); /* proto */
1125 static PyObject *__pyx_pf_9sioninter_8SIONFile_20__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1126 static PyObject *__pyx_pf_9sioninter_8SIONFile_14read_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_nitems); /* proto */
1127 static PyObject *__pyx_pf_9sioninter_open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode, PyObject *__pyx_v_par_mode); /* proto */
1128 static PyObject *__pyx_pf_9sioninter_2sion_fwrite_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, PyObject *__pyx_v_key, PyObject *__pyx_v_sid); /* proto */
1129 static PyObject *__pyx_pf_9sioninter_4sion_fread_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_sid, PyObject *__pyx_v_nitems); /* proto */
1130 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
1131 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1132 static char __pyx_k_[] = "";
1133 static char __pyx_k_io[] = "io";
1134 static char __pyx_k_MPI[] = "MPI";
1135 static char __pyx_k_doc[] = "__doc__";
1136 static char __pyx_k_key[] = "key";
1137 static char __pyx_k_mpi[] = "mpi";
1138 static char __pyx_k_ret[] = "ret";
1139 static char __pyx_k_sid[] = "_sid";
1140 static char __pyx_k_data[] = "data";
1141 static char __pyx_k_init[] = "__init__";
1142 static char __pyx_k_main[] = "__main__";
1143 static char __pyx_k_open[] = "open";
1144 static char __pyx_k_read[] = "read";
1145 static char __pyx_k_self[] = "self";
1146 static char __pyx_k_test[] = "__test__";
1147 static char __pyx_k_array[] = "array";
1148 static char __pyx_k_close[] = "close";
1149 static char __pyx_k_fname[] = "_fname";
1150 static char __pyx_k_range[] = "range";
1151 static char __pyx_k_sid_2[] = "sid";
1152 static char __pyx_k_write[] = "write";
1153 static char __pyx_k_closed[] = "closed";
1154 static char __pyx_k_encode[] = "encode";
1155 static char __pyx_k_format[] = "format";
1156 static char __pyx_k_import[] = "__import__";
1157 static char __pyx_k_module[] = "__module__";
1158 static char __pyx_k_mpi4py[] = "mpi4py";
1159 static char __pyx_k_nitems[] = "nitems";
1160 static char __pyx_k_serial[] = "serial";
1161 static char __pyx_k_IOError[] = "IOError";
1162 static char __pyx_k_fname_2[] = "fname";
1163 static char __pyx_k_prepare[] = "__prepare__";
1164 static char __pyx_k_Get_rank[] = "Get_rank";
1165 static char __pyx_k_SIONFile[] = "SIONFile";
1166 static char __pyx_k_par_mode[] = "par_mode";
1167 static char __pyx_k_property[] = "property";
1168 static char __pyx_k_qualname[] = "__qualname__";
1169 static char __pyx_k_read_key[] = "read_key";
1170 static char __pyx_k_sionfile[] = "sionfile";
1171 static char __pyx_k_file_mode[] = "_file_mode";
1172 static char __pyx_k_metaclass[] = "__metaclass__";
1173 static char __pyx_k_sioninter[] = "sioninter";
1174 static char __pyx_k_write_key[] = "write_key";
1175 static char __pyx_k_COMM_WORLD[] = "COMM_WORLD";
1176 static char __pyx_k_par_mode_2[] = "_par_mode";
1177 static char __pyx_k_MemoryError[] = "MemoryError";
1178 static char __pyx_k_file_mode_2[] = "file_mode";
1179 static char __pyx_k_DEFAULT_SIZE[] = "DEFAULT_SIZE";
1180 static char __pyx_k_DEFAULT_GCOMM[] = "DEFAULT_GCOMM";
1181 static char __pyx_k_DEFAULT_LCOMM[] = "DEFAULT_LCOMM";
1182 static char __pyx_k_SIONFile_open[] = "SIONFile.open";
1183 static char __pyx_k_SIONFile_read[] = "SIONFile.read";
1184 static char __pyx_k_AttributeError[] = "AttributeError";
1185 static char __pyx_k_BufferedIOBase[] = "BufferedIOBase";
1186 static char __pyx_k_DEFAULT_NFILES[] = "DEFAULT_NFILES";
1187 static char __pyx_k_DEFAULT_NITEMS[] = "DEFAULT_NITEMS";
1188 static char __pyx_k_DEFAULT_NTASKS[] = "DEFAULT_NTASKS";
1189 static char __pyx_k_SIONFile_close[] = "SIONFile.close";
1190 static char __pyx_k_SIONFile_write[] = "SIONFile.write";
1191 static char __pyx_k_DEFAULT_FILEPTR[] = "DEFAULT_FILEPTR";
1192 static char __pyx_k_SIONFile___init[] = "SIONFile.__init__";
1193 static char __pyx_k_SIONFile_closed[] = "SIONFile.closed";
1194 static char __pyx_k_valid_par_modes[] = "valid_par_modes";
1195 static char __pyx_k_DEFAULT_PAR_MODE[] = "DEFAULT_PAR_MODE";
1196 static char __pyx_k_DEFAULT_CHUNKSIZE[] = "DEFAULT_CHUNKSIZE";
1197 static char __pyx_k_DEFAULT_FSBLKSIZE[] = "DEFAULT_FSBLKSIZE";
1198 static char __pyx_k_SIONFile_read_key[] = "SIONFile.read_key";
1199 static char __pyx_k_DEFAULT_CHUNKSIZES[] = "DEFAULT_CHUNKSIZES";
1200 static char __pyx_k_DEFAULT_GLOBALRANK[] = "DEFAULT_GLOBALRANK";
1201 static char __pyx_k_SIONFile_write_key[] = "SIONFile.write_key";
1202 static char __pyx_k_DEFAULT_GLOBALRANKS[] = "DEFAULT_GLOBALRANKS";
1203 static char __pyx_k_read_not_successful[] = "read not successful";
1204 static char __pyx_k_read_not_successful_2[] = "read not successful: {} {} {}";
1205 static char __pyx_k_home_thust_src_sionlib_pythonin[] = "/home/thust/src/sionlib-pythoninterface/sioninter.pyx";
1206 static char __pyx_k_File_like_object_for_handling_SI[] = "File-like object for handling SIONlib files";
1207 static char __pyx_k_Interface_for_SIONlib_This_inter[] = "Interface for SIONlib\n\nThis interface wrapps access to SIONlib files for access in Python.\n";
1208 static char __pyx_k_invalid_attribute_self__par_mode[] = "invalid attribute self._par_mode = {}";
1209 static PyObject *__pyx_kp_u_;
1210 static PyObject *__pyx_n_s_AttributeError;
1211 static PyObject *__pyx_n_s_BufferedIOBase;
1212 static PyObject *__pyx_n_s_COMM_WORLD;
1213 static PyObject *__pyx_n_s_DEFAULT_CHUNKSIZE;
1214 static PyObject *__pyx_n_s_DEFAULT_CHUNKSIZES;
1215 static PyObject *__pyx_n_s_DEFAULT_FILEPTR;
1216 static PyObject *__pyx_n_s_DEFAULT_FSBLKSIZE;
1217 static PyObject *__pyx_n_s_DEFAULT_GCOMM;
1218 static PyObject *__pyx_n_s_DEFAULT_GLOBALRANK;
1219 static PyObject *__pyx_n_s_DEFAULT_GLOBALRANKS;
1220 static PyObject *__pyx_n_s_DEFAULT_LCOMM;
1221 static PyObject *__pyx_n_s_DEFAULT_NFILES;
1222 static PyObject *__pyx_n_s_DEFAULT_NITEMS;
1223 static PyObject *__pyx_n_s_DEFAULT_NTASKS;
1224 static PyObject *__pyx_n_s_DEFAULT_PAR_MODE;
1225 static PyObject *__pyx_n_s_DEFAULT_SIZE;
1226 static PyObject *__pyx_kp_s_File_like_object_for_handling_SI;
1227 static PyObject *__pyx_n_s_Get_rank;
1228 static PyObject *__pyx_n_s_IOError;
1229 static PyObject *__pyx_n_s_MPI;
1230 static PyObject *__pyx_n_s_MemoryError;
1231 static PyObject *__pyx_n_s_SIONFile;
1232 static PyObject *__pyx_n_s_SIONFile___init;
1233 static PyObject *__pyx_n_s_SIONFile_close;
1234 static PyObject *__pyx_n_s_SIONFile_closed;
1235 static PyObject *__pyx_n_s_SIONFile_open;
1236 static PyObject *__pyx_n_s_SIONFile_read;
1237 static PyObject *__pyx_n_s_SIONFile_read_key;
1238 static PyObject *__pyx_n_s_SIONFile_write;
1239 static PyObject *__pyx_n_s_SIONFile_write_key;
1240 static PyObject *__pyx_n_s_array;
1241 static PyObject *__pyx_n_s_close;
1242 static PyObject *__pyx_n_s_closed;
1243 static PyObject *__pyx_n_s_data;
1244 static PyObject *__pyx_n_s_doc;
1245 static PyObject *__pyx_n_s_encode;
1246 static PyObject *__pyx_n_s_file_mode;
1247 static PyObject *__pyx_n_s_file_mode_2;
1248 static PyObject *__pyx_n_s_fname;
1249 static PyObject *__pyx_n_s_fname_2;
1250 static PyObject *__pyx_n_s_format;
1251 static PyObject *__pyx_kp_s_home_thust_src_sionlib_pythonin;
1252 static PyObject *__pyx_n_s_import;
1253 static PyObject *__pyx_n_s_init;
1254 static PyObject *__pyx_kp_u_invalid_attribute_self__par_mode;
1255 static PyObject *__pyx_n_s_io;
1256 static PyObject *__pyx_n_s_key;
1257 static PyObject *__pyx_n_s_main;
1258 static PyObject *__pyx_n_s_metaclass;
1259 static PyObject *__pyx_n_s_module;
1260 static PyObject *__pyx_n_u_mpi;
1261 static PyObject *__pyx_n_s_mpi4py;
1262 static PyObject *__pyx_n_s_nitems;
1263 static PyObject *__pyx_n_s_open;
1264 static PyObject *__pyx_n_s_par_mode;
1265 static PyObject *__pyx_n_s_par_mode_2;
1266 static PyObject *__pyx_n_s_prepare;
1267 static PyObject *__pyx_n_s_property;
1268 static PyObject *__pyx_n_s_qualname;
1269 static PyObject *__pyx_n_s_range;
1270 static PyObject *__pyx_n_s_read;
1271 static PyObject *__pyx_n_s_read_key;
1272 static PyObject *__pyx_kp_u_read_not_successful;
1273 static PyObject *__pyx_kp_u_read_not_successful_2;
1274 static PyObject *__pyx_n_s_ret;
1275 static PyObject *__pyx_n_s_self;
1276 static PyObject *__pyx_n_u_serial;
1277 static PyObject *__pyx_n_s_sid;
1278 static PyObject *__pyx_n_s_sid_2;
1279 static PyObject *__pyx_n_s_sionfile;
1280 static PyObject *__pyx_n_s_sioninter;
1281 static PyObject *__pyx_n_s_test;
1282 static PyObject *__pyx_n_s_valid_par_modes;
1283 static PyObject *__pyx_n_s_write;
1284 static PyObject *__pyx_n_s_write_key;
1285 static PyObject *__pyx_int_0;
1286 static PyObject *__pyx_int_1;
1287 static PyObject *__pyx_int_32;
1288 static PyObject *__pyx_int_neg_1;
1289 static PyObject *__pyx_k__2;
1290 static PyObject *__pyx_k__3;
1291 static PyObject *__pyx_k__4;
1292 static PyObject *__pyx_k__5;
1293 static PyObject *__pyx_k__6;
1294 static PyObject *__pyx_k__7;
1295 static PyObject *__pyx_k__8;
1296 static PyObject *__pyx_k__9;
1297 static PyObject *__pyx_k__10;
1298 static PyObject *__pyx_k__12;
1299 static PyObject *__pyx_k__32;
1300 static PyObject *__pyx_k__33;
1301 static PyObject *__pyx_k__34;
1302 static PyObject *__pyx_k__35;
1303 static PyObject *__pyx_k__36;
1304 static PyObject *__pyx_k__37;
1305 static PyObject *__pyx_tuple__11;
1306 static PyObject *__pyx_tuple__13;
1307 static PyObject *__pyx_tuple__14;
1308 static PyObject *__pyx_tuple__16;
1309 static PyObject *__pyx_tuple__18;
1310 static PyObject *__pyx_tuple__20;
1311 static PyObject *__pyx_tuple__22;
1312 static PyObject *__pyx_tuple__24;
1313 static PyObject *__pyx_tuple__26;
1314 static PyObject *__pyx_tuple__28;
1315 static PyObject *__pyx_tuple__30;
1316 static PyObject *__pyx_codeobj__15;
1317 static PyObject *__pyx_codeobj__17;
1318 static PyObject *__pyx_codeobj__19;
1319 static PyObject *__pyx_codeobj__21;
1320 static PyObject *__pyx_codeobj__23;
1321 static PyObject *__pyx_codeobj__25;
1322 static PyObject *__pyx_codeobj__27;
1323 static PyObject *__pyx_codeobj__29;
1324 static PyObject *__pyx_codeobj__31;
1325 
1326 /* "sioninter.pyx":48
1327  * valid_par_modes = ("serial", "mpi")
1328  *
1329  * def __init__(self, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
1330  * self._fname = ""
1331  * self._file_mode = ""
1332  */
1333 
1334 static PyObject *__pyx_pf_9sioninter_8SIONFile_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
1335  PyObject *__pyx_r = NULL;
1336  __Pyx_RefNannyDeclarations
1337  PyObject *__pyx_t_1 = NULL;
1338  PyObject *__pyx_t_2 = NULL;
1339  int __pyx_lineno = 0;
1340  const char *__pyx_filename = NULL;
1341  int __pyx_clineno = 0;
1342  __Pyx_RefNannySetupContext("__defaults__", 0);
1343  __Pyx_XDECREF(__pyx_r);
1344  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1345  __Pyx_GOTREF(__pyx_t_1);
1346  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_par_mode);
1347  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_par_mode);
1348  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_par_mode);
1349  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1350  __Pyx_GOTREF(__pyx_t_2);
1351  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
1352  __Pyx_GIVEREF(__pyx_t_1);
1353  __Pyx_INCREF(Py_None);
1354  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
1355  __Pyx_GIVEREF(Py_None);
1356  __pyx_t_1 = 0;
1357  __pyx_r = __pyx_t_2;
1358  __pyx_t_2 = 0;
1359  goto __pyx_L0;
1360 
1361  /* function exit code */
1362  __pyx_L1_error:;
1363  __Pyx_XDECREF(__pyx_t_1);
1364  __Pyx_XDECREF(__pyx_t_2);
1365  __Pyx_AddTraceback("sioninter.SIONFile.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1366  __pyx_r = NULL;
1367  __pyx_L0:;
1368  __Pyx_XGIVEREF(__pyx_r);
1369  __Pyx_RefNannyFinishContext();
1370  return __pyx_r;
1371 }
1372 
1373 /* Python wrapper */
1374 static PyObject *__pyx_pw_9sioninter_8SIONFile_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1375 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
1376 static PyObject *__pyx_pw_9sioninter_8SIONFile_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1377  PyObject *__pyx_v_self = 0;
1378  PyObject *__pyx_v_par_mode = 0;
1379  int __pyx_lineno = 0;
1380  const char *__pyx_filename = NULL;
1381  int __pyx_clineno = 0;
1382  PyObject *__pyx_r = 0;
1383  __Pyx_RefNannyDeclarations
1384  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1385  {
1386  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_par_mode,0};
1387  PyObject* values[2] = {0,0};
1388  __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
1389  values[1] = __pyx_dynamic_args->__pyx_arg_par_mode;
1390  if (unlikely(__pyx_kwds)) {
1391  Py_ssize_t kw_args;
1392  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1393  switch (pos_args) {
1394  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1395  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1396  case 0: break;
1397  default: goto __pyx_L5_argtuple_error;
1398  }
1399  kw_args = PyDict_Size(__pyx_kwds);
1400  switch (pos_args) {
1401  case 0:
1402  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
1403  else goto __pyx_L5_argtuple_error;
1404  case 1:
1405  if (kw_args > 0) {
1406  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_par_mode);
1407  if (value) { values[1] = value; kw_args--; }
1408  }
1409  }
1410  if (unlikely(kw_args > 0)) {
1411  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1412  }
1413  } else {
1414  switch (PyTuple_GET_SIZE(__pyx_args)) {
1415  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1416  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1417  break;
1418  default: goto __pyx_L5_argtuple_error;
1419  }
1420  }
1421  __pyx_v_self = values[0];
1422  __pyx_v_par_mode = values[1];
1423  }
1424  goto __pyx_L4_argument_unpacking_done;
1425  __pyx_L5_argtuple_error:;
1426  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1427  __pyx_L3_error:;
1428  __Pyx_AddTraceback("sioninter.SIONFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1429  __Pyx_RefNannyFinishContext();
1430  return NULL;
1431  __pyx_L4_argument_unpacking_done:;
1432  __pyx_r = __pyx_pf_9sioninter_8SIONFile___init__(__pyx_self, __pyx_v_self, __pyx_v_par_mode);
1433 
1434  /* function exit code */
1435  __Pyx_RefNannyFinishContext();
1436  return __pyx_r;
1437 }
1438 
1439 static PyObject *__pyx_pf_9sioninter_8SIONFile___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_par_mode) {
1440  PyObject *__pyx_r = NULL;
1441  __Pyx_RefNannyDeclarations
1442  PyObject *__pyx_t_1 = NULL;
1443  int __pyx_t_2;
1444  int __pyx_t_3;
1445  PyObject *__pyx_t_4 = NULL;
1446  PyObject *__pyx_t_5 = NULL;
1447  int __pyx_lineno = 0;
1448  const char *__pyx_filename = NULL;
1449  int __pyx_clineno = 0;
1450  __Pyx_RefNannySetupContext("__init__", 0);
1451 
1452  /* "sioninter.pyx":49
1453  *
1454  * def __init__(self, par_mode=DEFAULT_PAR_MODE):
1455  * self._fname = "" # <<<<<<<<<<<<<<
1456  * self._file_mode = ""
1457  * self._sid = -1
1458  */
1459  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fname, __pyx_kp_u_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1460 
1461  /* "sioninter.pyx":50
1462  * def __init__(self, par_mode=DEFAULT_PAR_MODE):
1463  * self._fname = ""
1464  * self._file_mode = "" # <<<<<<<<<<<<<<
1465  * self._sid = -1
1466  * if par_mode not in self.valid_par_modes:
1467  */
1468  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_mode, __pyx_kp_u_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1469 
1470  /* "sioninter.pyx":51
1471  * self._fname = ""
1472  * self._file_mode = ""
1473  * self._sid = -1 # <<<<<<<<<<<<<<
1474  * if par_mode not in self.valid_par_modes:
1475  * raise AttributeError("invalid attribute self._par_mode = {}".
1476  */
1477  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sid, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1478 
1479  /* "sioninter.pyx":52
1480  * self._file_mode = ""
1481  * self._sid = -1
1482  * if par_mode not in self.valid_par_modes: # <<<<<<<<<<<<<<
1483  * raise AttributeError("invalid attribute self._par_mode = {}".
1484  * format(self._par_mode))
1485  */
1486  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_valid_par_modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1487  __Pyx_GOTREF(__pyx_t_1);
1488  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_par_mode, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1489  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1490  __pyx_t_3 = (__pyx_t_2 != 0);
1491  if (__pyx_t_3) {
1492 
1493  /* "sioninter.pyx":53
1494  * self._sid = -1
1495  * if par_mode not in self.valid_par_modes:
1496  * raise AttributeError("invalid attribute self._par_mode = {}". # <<<<<<<<<<<<<<
1497  * format(self._par_mode))
1498  * self._par_mode = par_mode
1499  */
1500  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_invalid_attribute_self__par_mode, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1501  __Pyx_GOTREF(__pyx_t_1);
1502 
1503  /* "sioninter.pyx":54
1504  * if par_mode not in self.valid_par_modes:
1505  * raise AttributeError("invalid attribute self._par_mode = {}".
1506  * format(self._par_mode)) # <<<<<<<<<<<<<<
1507  * self._par_mode = par_mode
1508  *
1509  */
1510  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1511  __Pyx_GOTREF(__pyx_t_4);
1512  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1513  __Pyx_GOTREF(__pyx_t_5);
1514  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
1515  __Pyx_GIVEREF(__pyx_t_4);
1516  __pyx_t_4 = 0;
1517  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1518  __Pyx_GOTREF(__pyx_t_4);
1519  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1520  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1521 
1522  /* "sioninter.pyx":53
1523  * self._sid = -1
1524  * if par_mode not in self.valid_par_modes:
1525  * raise AttributeError("invalid attribute self._par_mode = {}". # <<<<<<<<<<<<<<
1526  * format(self._par_mode))
1527  * self._par_mode = par_mode
1528  */
1529  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1530  __Pyx_GOTREF(__pyx_t_5);
1531  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
1532  __Pyx_GIVEREF(__pyx_t_4);
1533  __pyx_t_4 = 0;
1534  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1535  __Pyx_GOTREF(__pyx_t_4);
1536  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1537  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
1538  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1539  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1540  }
1541 
1542  /* "sioninter.pyx":55
1543  * raise AttributeError("invalid attribute self._par_mode = {}".
1544  * format(self._par_mode))
1545  * self._par_mode = par_mode # <<<<<<<<<<<<<<
1546  *
1547  * def open(self, fname, file_mode):
1548  */
1549  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2, __pyx_v_par_mode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1550 
1551  /* "sioninter.pyx":48
1552  * valid_par_modes = ("serial", "mpi")
1553  *
1554  * def __init__(self, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
1555  * self._fname = ""
1556  * self._file_mode = ""
1557  */
1558 
1559  /* function exit code */
1560  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1561  goto __pyx_L0;
1562  __pyx_L1_error:;
1563  __Pyx_XDECREF(__pyx_t_1);
1564  __Pyx_XDECREF(__pyx_t_4);
1565  __Pyx_XDECREF(__pyx_t_5);
1566  __Pyx_AddTraceback("sioninter.SIONFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1567  __pyx_r = NULL;
1568  __pyx_L0:;
1569  __Pyx_XGIVEREF(__pyx_r);
1570  __Pyx_RefNannyFinishContext();
1571  return __pyx_r;
1572 }
1573 
1574 /* "sioninter.pyx":57
1575  * self._par_mode = par_mode
1576  *
1577  * def open(self, fname, file_mode): # <<<<<<<<<<<<<<
1578  * """Open a file for reading or writing."""
1579  * self._fname = fname
1580  */
1581 
1582 /* Python wrapper */
1583 static PyObject *__pyx_pw_9sioninter_8SIONFile_3open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1584 static char __pyx_doc_9sioninter_8SIONFile_2open[] = "Open a file for reading or writing.";
1585 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_3open = {__Pyx_NAMESTR("open"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_3open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_2open)};
1586 static PyObject *__pyx_pw_9sioninter_8SIONFile_3open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1587  PyObject *__pyx_v_self = 0;
1588  PyObject *__pyx_v_fname = 0;
1589  PyObject *__pyx_v_file_mode = 0;
1590  int __pyx_lineno = 0;
1591  const char *__pyx_filename = NULL;
1592  int __pyx_clineno = 0;
1593  PyObject *__pyx_r = 0;
1594  __Pyx_RefNannyDeclarations
1595  __Pyx_RefNannySetupContext("open (wrapper)", 0);
1596  {
1597  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fname_2,&__pyx_n_s_file_mode_2,0};
1598  PyObject* values[3] = {0,0,0};
1599  if (unlikely(__pyx_kwds)) {
1600  Py_ssize_t kw_args;
1601  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1602  switch (pos_args) {
1603  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1604  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1605  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1606  case 0: break;
1607  default: goto __pyx_L5_argtuple_error;
1608  }
1609  kw_args = PyDict_Size(__pyx_kwds);
1610  switch (pos_args) {
1611  case 0:
1612  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
1613  else goto __pyx_L5_argtuple_error;
1614  case 1:
1615  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fname_2)) != 0)) kw_args--;
1616  else {
1617  __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1618  }
1619  case 2:
1620  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file_mode_2)) != 0)) kw_args--;
1621  else {
1622  __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1623  }
1624  }
1625  if (unlikely(kw_args > 0)) {
1626  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1627  }
1628  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1629  goto __pyx_L5_argtuple_error;
1630  } else {
1631  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1632  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1633  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1634  }
1635  __pyx_v_self = values[0];
1636  __pyx_v_fname = values[1];
1637  __pyx_v_file_mode = values[2];
1638  }
1639  goto __pyx_L4_argument_unpacking_done;
1640  __pyx_L5_argtuple_error:;
1641  __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1642  __pyx_L3_error:;
1643  __Pyx_AddTraceback("sioninter.SIONFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
1644  __Pyx_RefNannyFinishContext();
1645  return NULL;
1646  __pyx_L4_argument_unpacking_done:;
1647  __pyx_r = __pyx_pf_9sioninter_8SIONFile_2open(__pyx_self, __pyx_v_self, __pyx_v_fname, __pyx_v_file_mode);
1648 
1649  /* function exit code */
1650  __Pyx_RefNannyFinishContext();
1651  return __pyx_r;
1652 }
1653 
1654 static PyObject *__pyx_pf_9sioninter_8SIONFile_2open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode) {
1655  PyObject *__pyx_r = NULL;
1656  __Pyx_RefNannyDeclarations
1657  PyObject *__pyx_t_1 = NULL;
1658  int __pyx_t_2;
1659  int __pyx_lineno = 0;
1660  const char *__pyx_filename = NULL;
1661  int __pyx_clineno = 0;
1662  __Pyx_RefNannySetupContext("open", 0);
1663 
1664  /* "sioninter.pyx":59
1665  * def open(self, fname, file_mode):
1666  * """Open a file for reading or writing."""
1667  * self._fname = fname # <<<<<<<<<<<<<<
1668  * self._file_mode = file_mode
1669  * if self._par_mode == "serial":
1670  */
1671  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fname, __pyx_v_fname) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1672 
1673  /* "sioninter.pyx":60
1674  * """Open a file for reading or writing."""
1675  * self._fname = fname
1676  * self._file_mode = file_mode # <<<<<<<<<<<<<<
1677  * if self._par_mode == "serial":
1678  * self._sid = sion_open(fname, file_mode)
1679  */
1680  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_mode, __pyx_v_file_mode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1681 
1682  /* "sioninter.pyx":61
1683  * self._fname = fname
1684  * self._file_mode = file_mode
1685  * if self._par_mode == "serial": # <<<<<<<<<<<<<<
1686  * self._sid = sion_open(fname, file_mode)
1687  * elif self._par_mode == "mpi":
1688  */
1689  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1690  __Pyx_GOTREF(__pyx_t_1);
1691  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_serial, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1692  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1693  if (__pyx_t_2) {
1694 
1695  /* "sioninter.pyx":62
1696  * self._file_mode = file_mode
1697  * if self._par_mode == "serial":
1698  * self._sid = sion_open(fname, file_mode) # <<<<<<<<<<<<<<
1699  * elif self._par_mode == "mpi":
1700  * self._sid = sion_paropen_mpi(fname, file_mode)
1701  */
1702  __pyx_t_1 = __pyx_f_9sioninter_sion_open(__pyx_v_fname, __pyx_v_file_mode, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1703  __Pyx_GOTREF(__pyx_t_1);
1704  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sid, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1705  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1706  goto __pyx_L3;
1707  }
1708 
1709  /* "sioninter.pyx":63
1710  * if self._par_mode == "serial":
1711  * self._sid = sion_open(fname, file_mode)
1712  * elif self._par_mode == "mpi": # <<<<<<<<<<<<<<
1713  * self._sid = sion_paropen_mpi(fname, file_mode)
1714  *
1715  */
1716  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1717  __Pyx_GOTREF(__pyx_t_1);
1718  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_mpi, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1719  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1720  if (__pyx_t_2) {
1721 
1722  /* "sioninter.pyx":64
1723  * self._sid = sion_open(fname, file_mode)
1724  * elif self._par_mode == "mpi":
1725  * self._sid = sion_paropen_mpi(fname, file_mode) # <<<<<<<<<<<<<<
1726  *
1727  * @property
1728  */
1729  __pyx_t_1 = __pyx_f_9sioninter_sion_paropen_mpi(__pyx_v_fname, __pyx_v_file_mode, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1730  __Pyx_GOTREF(__pyx_t_1);
1731  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sid, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1732  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1733  goto __pyx_L3;
1734  }
1735  __pyx_L3:;
1736 
1737  /* "sioninter.pyx":57
1738  * self._par_mode = par_mode
1739  *
1740  * def open(self, fname, file_mode): # <<<<<<<<<<<<<<
1741  * """Open a file for reading or writing."""
1742  * self._fname = fname
1743  */
1744 
1745  /* function exit code */
1746  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1747  goto __pyx_L0;
1748  __pyx_L1_error:;
1749  __Pyx_XDECREF(__pyx_t_1);
1750  __Pyx_AddTraceback("sioninter.SIONFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
1751  __pyx_r = NULL;
1752  __pyx_L0:;
1753  __Pyx_XGIVEREF(__pyx_r);
1754  __Pyx_RefNannyFinishContext();
1755  return __pyx_r;
1756 }
1757 
1758 /* "sioninter.pyx":67
1759  *
1760  * @property
1761  * def closed(self): # <<<<<<<<<<<<<<
1762  * """Check whether sion file is closed."""
1763  * return self._sid == -1
1764  */
1765 
1766 /* Python wrapper */
1767 static PyObject *__pyx_pw_9sioninter_8SIONFile_5closed(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
1768 static char __pyx_doc_9sioninter_8SIONFile_4closed[] = "Check whether sion file is closed.";
1769 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_5closed = {__Pyx_NAMESTR("closed"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_5closed, METH_O, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_4closed)};
1770 static PyObject *__pyx_pw_9sioninter_8SIONFile_5closed(PyObject *__pyx_self, PyObject *__pyx_v_self) {
1771  PyObject *__pyx_r = 0;
1772  __Pyx_RefNannyDeclarations
1773  __Pyx_RefNannySetupContext("closed (wrapper)", 0);
1774  __pyx_r = __pyx_pf_9sioninter_8SIONFile_4closed(__pyx_self, ((PyObject *)__pyx_v_self));
1775 
1776  /* function exit code */
1777  __Pyx_RefNannyFinishContext();
1778  return __pyx_r;
1779 }
1780 
1781 static PyObject *__pyx_pf_9sioninter_8SIONFile_4closed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
1782  PyObject *__pyx_r = NULL;
1783  __Pyx_RefNannyDeclarations
1784  PyObject *__pyx_t_1 = NULL;
1785  PyObject *__pyx_t_2 = NULL;
1786  int __pyx_lineno = 0;
1787  const char *__pyx_filename = NULL;
1788  int __pyx_clineno = 0;
1789  __Pyx_RefNannySetupContext("closed", 0);
1790 
1791  /* "sioninter.pyx":69
1792  * def closed(self):
1793  * """Check whether sion file is closed."""
1794  * return self._sid == -1 # <<<<<<<<<<<<<<
1795  *
1796  * def close(self):
1797  */
1798  __Pyx_XDECREF(__pyx_r);
1799  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1800  __Pyx_GOTREF(__pyx_t_1);
1801  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1802  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1803  __pyx_r = __pyx_t_2;
1804  __pyx_t_2 = 0;
1805  goto __pyx_L0;
1806 
1807  /* "sioninter.pyx":67
1808  *
1809  * @property
1810  * def closed(self): # <<<<<<<<<<<<<<
1811  * """Check whether sion file is closed."""
1812  * return self._sid == -1
1813  */
1814 
1815  /* function exit code */
1816  __pyx_L1_error:;
1817  __Pyx_XDECREF(__pyx_t_1);
1818  __Pyx_XDECREF(__pyx_t_2);
1819  __Pyx_AddTraceback("sioninter.SIONFile.closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
1820  __pyx_r = NULL;
1821  __pyx_L0:;
1822  __Pyx_XGIVEREF(__pyx_r);
1823  __Pyx_RefNannyFinishContext();
1824  return __pyx_r;
1825 }
1826 
1827 /* "sioninter.pyx":71
1828  * return self._sid == -1
1829  *
1830  * def close(self): # <<<<<<<<<<<<<<
1831  * """Close sion file."""
1832  * if self._par_mode == "serial":
1833  */
1834 
1835 /* Python wrapper */
1836 static PyObject *__pyx_pw_9sioninter_8SIONFile_7close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
1837 static char __pyx_doc_9sioninter_8SIONFile_6close[] = "Close sion file.";
1838 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_7close = {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_7close, METH_O, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_6close)};
1839 static PyObject *__pyx_pw_9sioninter_8SIONFile_7close(PyObject *__pyx_self, PyObject *__pyx_v_self) {
1840  PyObject *__pyx_r = 0;
1841  __Pyx_RefNannyDeclarations
1842  __Pyx_RefNannySetupContext("close (wrapper)", 0);
1843  __pyx_r = __pyx_pf_9sioninter_8SIONFile_6close(__pyx_self, ((PyObject *)__pyx_v_self));
1844 
1845  /* function exit code */
1846  __Pyx_RefNannyFinishContext();
1847  return __pyx_r;
1848 }
1849 
1850 static PyObject *__pyx_pf_9sioninter_8SIONFile_6close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
1851  PyObject *__pyx_r = NULL;
1852  __Pyx_RefNannyDeclarations
1853  PyObject *__pyx_t_1 = NULL;
1854  int __pyx_t_2;
1855  PyObject *__pyx_t_3 = NULL;
1856  int __pyx_lineno = 0;
1857  const char *__pyx_filename = NULL;
1858  int __pyx_clineno = 0;
1859  __Pyx_RefNannySetupContext("close", 0);
1860 
1861  /* "sioninter.pyx":73
1862  * def close(self):
1863  * """Close sion file."""
1864  * if self._par_mode == "serial": # <<<<<<<<<<<<<<
1865  * sion_close(self._sid)
1866  * elif self._par_mode == "mpi":
1867  */
1868  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1869  __Pyx_GOTREF(__pyx_t_1);
1870  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_serial, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1871  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1872  if (__pyx_t_2) {
1873 
1874  /* "sioninter.pyx":74
1875  * """Close sion file."""
1876  * if self._par_mode == "serial":
1877  * sion_close(self._sid) # <<<<<<<<<<<<<<
1878  * elif self._par_mode == "mpi":
1879  * sion_parclose_mpi(self._sid)
1880  */
1881  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1882  __Pyx_GOTREF(__pyx_t_1);
1883  __pyx_t_3 = __pyx_f_9sioninter_sion_close(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1884  __Pyx_GOTREF(__pyx_t_3);
1885  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1886  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1887  goto __pyx_L3;
1888  }
1889 
1890  /* "sioninter.pyx":75
1891  * if self._par_mode == "serial":
1892  * sion_close(self._sid)
1893  * elif self._par_mode == "mpi": # <<<<<<<<<<<<<<
1894  * sion_parclose_mpi(self._sid)
1895  * self._fname = ""
1896  */
1897  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_par_mode_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1898  __Pyx_GOTREF(__pyx_t_3);
1899  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_mpi, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1900  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1901  if (__pyx_t_2) {
1902 
1903  /* "sioninter.pyx":76
1904  * sion_close(self._sid)
1905  * elif self._par_mode == "mpi":
1906  * sion_parclose_mpi(self._sid) # <<<<<<<<<<<<<<
1907  * self._fname = ""
1908  * self._file_mode = ""
1909  */
1910  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1911  __Pyx_GOTREF(__pyx_t_3);
1912  __pyx_t_1 = __pyx_f_9sioninter_sion_parclose_mpi(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1913  __Pyx_GOTREF(__pyx_t_1);
1914  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1915  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1916  goto __pyx_L3;
1917  }
1918  __pyx_L3:;
1919 
1920  /* "sioninter.pyx":77
1921  * elif self._par_mode == "mpi":
1922  * sion_parclose_mpi(self._sid)
1923  * self._fname = "" # <<<<<<<<<<<<<<
1924  * self._file_mode = ""
1925  * self._sid = -1
1926  */
1927  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fname, __pyx_kp_u_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1928 
1929  /* "sioninter.pyx":78
1930  * sion_parclose_mpi(self._sid)
1931  * self._fname = ""
1932  * self._file_mode = "" # <<<<<<<<<<<<<<
1933  * self._sid = -1
1934  *
1935  */
1936  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_mode, __pyx_kp_u_) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1937 
1938  /* "sioninter.pyx":79
1939  * self._fname = ""
1940  * self._file_mode = ""
1941  * self._sid = -1 # <<<<<<<<<<<<<<
1942  *
1943  * def write(self, data):
1944  */
1945  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sid, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1946 
1947  /* "sioninter.pyx":71
1948  * return self._sid == -1
1949  *
1950  * def close(self): # <<<<<<<<<<<<<<
1951  * """Close sion file."""
1952  * if self._par_mode == "serial":
1953  */
1954 
1955  /* function exit code */
1956  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1957  goto __pyx_L0;
1958  __pyx_L1_error:;
1959  __Pyx_XDECREF(__pyx_t_1);
1960  __Pyx_XDECREF(__pyx_t_3);
1961  __Pyx_AddTraceback("sioninter.SIONFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
1962  __pyx_r = NULL;
1963  __pyx_L0:;
1964  __Pyx_XGIVEREF(__pyx_r);
1965  __Pyx_RefNannyFinishContext();
1966  return __pyx_r;
1967 }
1968 
1969 /* "sioninter.pyx":81
1970  * self._sid = -1
1971  *
1972  * def write(self, data): # <<<<<<<<<<<<<<
1973  * """Write data."""
1974  * sion_fwrite(data, self._sid)
1975  */
1976 
1977 /* Python wrapper */
1978 static PyObject *__pyx_pw_9sioninter_8SIONFile_9write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1979 static char __pyx_doc_9sioninter_8SIONFile_8write[] = "Write data.";
1980 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_9write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_9write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_8write)};
1981 static PyObject *__pyx_pw_9sioninter_8SIONFile_9write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1982  PyObject *__pyx_v_self = 0;
1983  PyObject *__pyx_v_data = 0;
1984  int __pyx_lineno = 0;
1985  const char *__pyx_filename = NULL;
1986  int __pyx_clineno = 0;
1987  PyObject *__pyx_r = 0;
1988  __Pyx_RefNannyDeclarations
1989  __Pyx_RefNannySetupContext("write (wrapper)", 0);
1990  {
1991  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
1992  PyObject* values[2] = {0,0};
1993  if (unlikely(__pyx_kwds)) {
1994  Py_ssize_t kw_args;
1995  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1996  switch (pos_args) {
1997  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1998  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1999  case 0: break;
2000  default: goto __pyx_L5_argtuple_error;
2001  }
2002  kw_args = PyDict_Size(__pyx_kwds);
2003  switch (pos_args) {
2004  case 0:
2005  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2006  else goto __pyx_L5_argtuple_error;
2007  case 1:
2008  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
2009  else {
2010  __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2011  }
2012  }
2013  if (unlikely(kw_args > 0)) {
2014  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2015  }
2016  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2017  goto __pyx_L5_argtuple_error;
2018  } else {
2019  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2020  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2021  }
2022  __pyx_v_self = values[0];
2023  __pyx_v_data = values[1];
2024  }
2025  goto __pyx_L4_argument_unpacking_done;
2026  __pyx_L5_argtuple_error:;
2027  __Pyx_RaiseArgtupleInvalid("write", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2028  __pyx_L3_error:;
2029  __Pyx_AddTraceback("sioninter.SIONFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
2030  __Pyx_RefNannyFinishContext();
2031  return NULL;
2032  __pyx_L4_argument_unpacking_done:;
2033  __pyx_r = __pyx_pf_9sioninter_8SIONFile_8write(__pyx_self, __pyx_v_self, __pyx_v_data);
2034 
2035  /* function exit code */
2036  __Pyx_RefNannyFinishContext();
2037  return __pyx_r;
2038 }
2039 
2040 static PyObject *__pyx_pf_9sioninter_8SIONFile_8write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
2041  PyObject *__pyx_r = NULL;
2042  __Pyx_RefNannyDeclarations
2043  PyObject *__pyx_t_1 = NULL;
2044  PyObject *__pyx_t_2 = NULL;
2045  int __pyx_lineno = 0;
2046  const char *__pyx_filename = NULL;
2047  int __pyx_clineno = 0;
2048  __Pyx_RefNannySetupContext("write", 0);
2049 
2050  /* "sioninter.pyx":83
2051  * def write(self, data):
2052  * """Write data."""
2053  * sion_fwrite(data, self._sid) # <<<<<<<<<<<<<<
2054  *
2055  * def read(self, nitems=DEFAULT_NITEMS):
2056  */
2057  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2058  __Pyx_GOTREF(__pyx_t_1);
2059  __pyx_t_2 = __pyx_f_9sioninter_sion_fwrite(__pyx_v_data, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2060  __Pyx_GOTREF(__pyx_t_2);
2061  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2062  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2063 
2064  /* "sioninter.pyx":81
2065  * self._sid = -1
2066  *
2067  * def write(self, data): # <<<<<<<<<<<<<<
2068  * """Write data."""
2069  * sion_fwrite(data, self._sid)
2070  */
2071 
2072  /* function exit code */
2073  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2074  goto __pyx_L0;
2075  __pyx_L1_error:;
2076  __Pyx_XDECREF(__pyx_t_1);
2077  __Pyx_XDECREF(__pyx_t_2);
2078  __Pyx_AddTraceback("sioninter.SIONFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079  __pyx_r = NULL;
2080  __pyx_L0:;
2081  __Pyx_XGIVEREF(__pyx_r);
2082  __Pyx_RefNannyFinishContext();
2083  return __pyx_r;
2084 }
2085 
2086 /* "sioninter.pyx":85
2087  * sion_fwrite(data, self._sid)
2088  *
2089  * def read(self, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
2090  * """Read data."""
2091  * ret = sion_fread(self._sid, nitems)
2092  */
2093 
2094 static PyObject *__pyx_pf_9sioninter_8SIONFile_18__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
2095  PyObject *__pyx_r = NULL;
2096  __Pyx_RefNannyDeclarations
2097  PyObject *__pyx_t_1 = NULL;
2098  PyObject *__pyx_t_2 = NULL;
2099  int __pyx_lineno = 0;
2100  const char *__pyx_filename = NULL;
2101  int __pyx_clineno = 0;
2102  __Pyx_RefNannySetupContext("__defaults__", 0);
2103  __Pyx_XDECREF(__pyx_r);
2104  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2105  __Pyx_GOTREF(__pyx_t_1);
2106  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_nitems);
2107  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_nitems);
2108  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_nitems);
2109  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2110  __Pyx_GOTREF(__pyx_t_2);
2111  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
2112  __Pyx_GIVEREF(__pyx_t_1);
2113  __Pyx_INCREF(Py_None);
2114  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
2115  __Pyx_GIVEREF(Py_None);
2116  __pyx_t_1 = 0;
2117  __pyx_r = __pyx_t_2;
2118  __pyx_t_2 = 0;
2119  goto __pyx_L0;
2120 
2121  /* function exit code */
2122  __pyx_L1_error:;
2123  __Pyx_XDECREF(__pyx_t_1);
2124  __Pyx_XDECREF(__pyx_t_2);
2125  __Pyx_AddTraceback("sioninter.SIONFile.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2126  __pyx_r = NULL;
2127  __pyx_L0:;
2128  __Pyx_XGIVEREF(__pyx_r);
2129  __Pyx_RefNannyFinishContext();
2130  return __pyx_r;
2131 }
2132 
2133 /* Python wrapper */
2134 static PyObject *__pyx_pw_9sioninter_8SIONFile_11read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2135 static char __pyx_doc_9sioninter_8SIONFile_10read[] = "Read data.";
2136 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_11read = {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_11read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_10read)};
2137 static PyObject *__pyx_pw_9sioninter_8SIONFile_11read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2138  PyObject *__pyx_v_self = 0;
2139  PyObject *__pyx_v_nitems = 0;
2140  int __pyx_lineno = 0;
2141  const char *__pyx_filename = NULL;
2142  int __pyx_clineno = 0;
2143  PyObject *__pyx_r = 0;
2144  __Pyx_RefNannyDeclarations
2145  __Pyx_RefNannySetupContext("read (wrapper)", 0);
2146  {
2147  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_nitems,0};
2148  PyObject* values[2] = {0,0};
2149  __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
2150  values[1] = __pyx_dynamic_args->__pyx_arg_nitems;
2151  if (unlikely(__pyx_kwds)) {
2152  Py_ssize_t kw_args;
2153  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2154  switch (pos_args) {
2155  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2156  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2157  case 0: break;
2158  default: goto __pyx_L5_argtuple_error;
2159  }
2160  kw_args = PyDict_Size(__pyx_kwds);
2161  switch (pos_args) {
2162  case 0:
2163  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2164  else goto __pyx_L5_argtuple_error;
2165  case 1:
2166  if (kw_args > 0) {
2167  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nitems);
2168  if (value) { values[1] = value; kw_args--; }
2169  }
2170  }
2171  if (unlikely(kw_args > 0)) {
2172  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2173  }
2174  } else {
2175  switch (PyTuple_GET_SIZE(__pyx_args)) {
2176  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2177  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2178  break;
2179  default: goto __pyx_L5_argtuple_error;
2180  }
2181  }
2182  __pyx_v_self = values[0];
2183  __pyx_v_nitems = values[1];
2184  }
2185  goto __pyx_L4_argument_unpacking_done;
2186  __pyx_L5_argtuple_error:;
2187  __Pyx_RaiseArgtupleInvalid("read", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2188  __pyx_L3_error:;
2189  __Pyx_AddTraceback("sioninter.SIONFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
2190  __Pyx_RefNannyFinishContext();
2191  return NULL;
2192  __pyx_L4_argument_unpacking_done:;
2193  __pyx_r = __pyx_pf_9sioninter_8SIONFile_10read(__pyx_self, __pyx_v_self, __pyx_v_nitems);
2194 
2195  /* function exit code */
2196  __Pyx_RefNannyFinishContext();
2197  return __pyx_r;
2198 }
2199 
2200 static PyObject *__pyx_pf_9sioninter_8SIONFile_10read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nitems) {
2201  PyObject *__pyx_v_ret = NULL;
2202  PyObject *__pyx_r = NULL;
2203  __Pyx_RefNannyDeclarations
2204  PyObject *__pyx_t_1 = NULL;
2205  PyObject *__pyx_t_2 = NULL;
2206  struct __pyx_opt_args_9sioninter_sion_fread __pyx_t_3;
2207  int __pyx_lineno = 0;
2208  const char *__pyx_filename = NULL;
2209  int __pyx_clineno = 0;
2210  __Pyx_RefNannySetupContext("read", 0);
2211 
2212  /* "sioninter.pyx":87
2213  * def read(self, nitems=DEFAULT_NITEMS):
2214  * """Read data."""
2215  * ret = sion_fread(self._sid, nitems) # <<<<<<<<<<<<<<
2216  * return ret
2217  *
2218  */
2219  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2220  __Pyx_GOTREF(__pyx_t_1);
2221  __pyx_t_3.__pyx_n = 1;
2222  __pyx_t_3.nitems = __pyx_v_nitems;
2223  __pyx_t_2 = __pyx_f_9sioninter_sion_fread(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2224  __Pyx_GOTREF(__pyx_t_2);
2225  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2226  __pyx_v_ret = __pyx_t_2;
2227  __pyx_t_2 = 0;
2228 
2229  /* "sioninter.pyx":88
2230  * """Read data."""
2231  * ret = sion_fread(self._sid, nitems)
2232  * return ret # <<<<<<<<<<<<<<
2233  *
2234  * def write_key(self, data, key):
2235  */
2236  __Pyx_XDECREF(__pyx_r);
2237  __Pyx_INCREF(__pyx_v_ret);
2238  __pyx_r = __pyx_v_ret;
2239  goto __pyx_L0;
2240 
2241  /* "sioninter.pyx":85
2242  * sion_fwrite(data, self._sid)
2243  *
2244  * def read(self, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
2245  * """Read data."""
2246  * ret = sion_fread(self._sid, nitems)
2247  */
2248 
2249  /* function exit code */
2250  __pyx_L1_error:;
2251  __Pyx_XDECREF(__pyx_t_1);
2252  __Pyx_XDECREF(__pyx_t_2);
2253  __Pyx_AddTraceback("sioninter.SIONFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
2254  __pyx_r = NULL;
2255  __pyx_L0:;
2256  __Pyx_XDECREF(__pyx_v_ret);
2257  __Pyx_XGIVEREF(__pyx_r);
2258  __Pyx_RefNannyFinishContext();
2259  return __pyx_r;
2260 }
2261 
2262 /* "sioninter.pyx":90
2263  * return ret
2264  *
2265  * def write_key(self, data, key): # <<<<<<<<<<<<<<
2266  * """Write key value pair."""
2267  * sion_fwrite_key(data, key, self._sid)
2268  */
2269 
2270 /* Python wrapper */
2271 static PyObject *__pyx_pw_9sioninter_8SIONFile_13write_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2272 static char __pyx_doc_9sioninter_8SIONFile_12write_key[] = "Write key value pair.";
2273 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_13write_key = {__Pyx_NAMESTR("write_key"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_13write_key, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_12write_key)};
2274 static PyObject *__pyx_pw_9sioninter_8SIONFile_13write_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2275  PyObject *__pyx_v_self = 0;
2276  PyObject *__pyx_v_data = 0;
2277  PyObject *__pyx_v_key = 0;
2278  int __pyx_lineno = 0;
2279  const char *__pyx_filename = NULL;
2280  int __pyx_clineno = 0;
2281  PyObject *__pyx_r = 0;
2282  __Pyx_RefNannyDeclarations
2283  __Pyx_RefNannySetupContext("write_key (wrapper)", 0);
2284  {
2285  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,&__pyx_n_s_key,0};
2286  PyObject* values[3] = {0,0,0};
2287  if (unlikely(__pyx_kwds)) {
2288  Py_ssize_t kw_args;
2289  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2290  switch (pos_args) {
2291  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2292  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2293  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2294  case 0: break;
2295  default: goto __pyx_L5_argtuple_error;
2296  }
2297  kw_args = PyDict_Size(__pyx_kwds);
2298  switch (pos_args) {
2299  case 0:
2300  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2301  else goto __pyx_L5_argtuple_error;
2302  case 1:
2303  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
2304  else {
2305  __Pyx_RaiseArgtupleInvalid("write_key", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2306  }
2307  case 2:
2308  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
2309  else {
2310  __Pyx_RaiseArgtupleInvalid("write_key", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2311  }
2312  }
2313  if (unlikely(kw_args > 0)) {
2314  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_key") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2315  }
2316  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2317  goto __pyx_L5_argtuple_error;
2318  } else {
2319  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2320  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2321  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2322  }
2323  __pyx_v_self = values[0];
2324  __pyx_v_data = values[1];
2325  __pyx_v_key = values[2];
2326  }
2327  goto __pyx_L4_argument_unpacking_done;
2328  __pyx_L5_argtuple_error:;
2329  __Pyx_RaiseArgtupleInvalid("write_key", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2330  __pyx_L3_error:;
2331  __Pyx_AddTraceback("sioninter.SIONFile.write_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
2332  __Pyx_RefNannyFinishContext();
2333  return NULL;
2334  __pyx_L4_argument_unpacking_done:;
2335  __pyx_r = __pyx_pf_9sioninter_8SIONFile_12write_key(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_key);
2336 
2337  /* function exit code */
2338  __Pyx_RefNannyFinishContext();
2339  return __pyx_r;
2340 }
2341 
2342 static PyObject *__pyx_pf_9sioninter_8SIONFile_12write_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_key) {
2343  PyObject *__pyx_r = NULL;
2344  __Pyx_RefNannyDeclarations
2345  PyObject *__pyx_t_1 = NULL;
2346  PyObject *__pyx_t_2 = NULL;
2347  int __pyx_lineno = 0;
2348  const char *__pyx_filename = NULL;
2349  int __pyx_clineno = 0;
2350  __Pyx_RefNannySetupContext("write_key", 0);
2351 
2352  /* "sioninter.pyx":92
2353  * def write_key(self, data, key):
2354  * """Write key value pair."""
2355  * sion_fwrite_key(data, key, self._sid) # <<<<<<<<<<<<<<
2356  *
2357  * def read_key(self, key, nitems=DEFAULT_NITEMS):
2358  */
2359  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2360  __Pyx_GOTREF(__pyx_t_1);
2361  __pyx_t_2 = __pyx_f_9sioninter_sion_fwrite_key(__pyx_v_data, __pyx_v_key, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2362  __Pyx_GOTREF(__pyx_t_2);
2363  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2364  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2365 
2366  /* "sioninter.pyx":90
2367  * return ret
2368  *
2369  * def write_key(self, data, key): # <<<<<<<<<<<<<<
2370  * """Write key value pair."""
2371  * sion_fwrite_key(data, key, self._sid)
2372  */
2373 
2374  /* function exit code */
2375  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2376  goto __pyx_L0;
2377  __pyx_L1_error:;
2378  __Pyx_XDECREF(__pyx_t_1);
2379  __Pyx_XDECREF(__pyx_t_2);
2380  __Pyx_AddTraceback("sioninter.SIONFile.write_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
2381  __pyx_r = NULL;
2382  __pyx_L0:;
2383  __Pyx_XGIVEREF(__pyx_r);
2384  __Pyx_RefNannyFinishContext();
2385  return __pyx_r;
2386 }
2387 
2388 /* "sioninter.pyx":94
2389  * sion_fwrite_key(data, key, self._sid)
2390  *
2391  * def read_key(self, key, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
2392  * """Read value for corresponding key."""
2393  * ret = sion_fread_key(key, self._sid, nitems)
2394  */
2395 
2396 static PyObject *__pyx_pf_9sioninter_8SIONFile_20__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
2397  PyObject *__pyx_r = NULL;
2398  __Pyx_RefNannyDeclarations
2399  PyObject *__pyx_t_1 = NULL;
2400  PyObject *__pyx_t_2 = NULL;
2401  int __pyx_lineno = 0;
2402  const char *__pyx_filename = NULL;
2403  int __pyx_clineno = 0;
2404  __Pyx_RefNannySetupContext("__defaults__", 0);
2405  __Pyx_XDECREF(__pyx_r);
2406  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2407  __Pyx_GOTREF(__pyx_t_1);
2408  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_nitems);
2409  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_nitems);
2410  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_nitems);
2411  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2412  __Pyx_GOTREF(__pyx_t_2);
2413  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
2414  __Pyx_GIVEREF(__pyx_t_1);
2415  __Pyx_INCREF(Py_None);
2416  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
2417  __Pyx_GIVEREF(Py_None);
2418  __pyx_t_1 = 0;
2419  __pyx_r = __pyx_t_2;
2420  __pyx_t_2 = 0;
2421  goto __pyx_L0;
2422 
2423  /* function exit code */
2424  __pyx_L1_error:;
2425  __Pyx_XDECREF(__pyx_t_1);
2426  __Pyx_XDECREF(__pyx_t_2);
2427  __Pyx_AddTraceback("sioninter.SIONFile.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2428  __pyx_r = NULL;
2429  __pyx_L0:;
2430  __Pyx_XGIVEREF(__pyx_r);
2431  __Pyx_RefNannyFinishContext();
2432  return __pyx_r;
2433 }
2434 
2435 /* Python wrapper */
2436 static PyObject *__pyx_pw_9sioninter_8SIONFile_15read_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2437 static char __pyx_doc_9sioninter_8SIONFile_14read_key[] = "Read value for corresponding key.";
2438 static PyMethodDef __pyx_mdef_9sioninter_8SIONFile_15read_key = {__Pyx_NAMESTR("read_key"), (PyCFunction)__pyx_pw_9sioninter_8SIONFile_15read_key, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_8SIONFile_14read_key)};
2439 static PyObject *__pyx_pw_9sioninter_8SIONFile_15read_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2440  PyObject *__pyx_v_self = 0;
2441  PyObject *__pyx_v_key = 0;
2442  PyObject *__pyx_v_nitems = 0;
2443  int __pyx_lineno = 0;
2444  const char *__pyx_filename = NULL;
2445  int __pyx_clineno = 0;
2446  PyObject *__pyx_r = 0;
2447  __Pyx_RefNannyDeclarations
2448  __Pyx_RefNannySetupContext("read_key (wrapper)", 0);
2449  {
2450  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_key,&__pyx_n_s_nitems,0};
2451  PyObject* values[3] = {0,0,0};
2452  __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
2453  values[2] = __pyx_dynamic_args->__pyx_arg_nitems;
2454  if (unlikely(__pyx_kwds)) {
2455  Py_ssize_t kw_args;
2456  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2457  switch (pos_args) {
2458  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2459  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2460  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2461  case 0: break;
2462  default: goto __pyx_L5_argtuple_error;
2463  }
2464  kw_args = PyDict_Size(__pyx_kwds);
2465  switch (pos_args) {
2466  case 0:
2467  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2468  else goto __pyx_L5_argtuple_error;
2469  case 1:
2470  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
2471  else {
2472  __Pyx_RaiseArgtupleInvalid("read_key", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2473  }
2474  case 2:
2475  if (kw_args > 0) {
2476  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nitems);
2477  if (value) { values[2] = value; kw_args--; }
2478  }
2479  }
2480  if (unlikely(kw_args > 0)) {
2481  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_key") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2482  }
2483  } else {
2484  switch (PyTuple_GET_SIZE(__pyx_args)) {
2485  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2486  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2487  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2488  break;
2489  default: goto __pyx_L5_argtuple_error;
2490  }
2491  }
2492  __pyx_v_self = values[0];
2493  __pyx_v_key = values[1];
2494  __pyx_v_nitems = values[2];
2495  }
2496  goto __pyx_L4_argument_unpacking_done;
2497  __pyx_L5_argtuple_error:;
2498  __Pyx_RaiseArgtupleInvalid("read_key", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2499  __pyx_L3_error:;
2500  __Pyx_AddTraceback("sioninter.SIONFile.read_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
2501  __Pyx_RefNannyFinishContext();
2502  return NULL;
2503  __pyx_L4_argument_unpacking_done:;
2504  __pyx_r = __pyx_pf_9sioninter_8SIONFile_14read_key(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_nitems);
2505 
2506  /* function exit code */
2507  __Pyx_RefNannyFinishContext();
2508  return __pyx_r;
2509 }
2510 
2511 static PyObject *__pyx_pf_9sioninter_8SIONFile_14read_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_nitems) {
2512  PyObject *__pyx_v_ret = NULL;
2513  PyObject *__pyx_r = NULL;
2514  __Pyx_RefNannyDeclarations
2515  PyObject *__pyx_t_1 = NULL;
2516  PyObject *__pyx_t_2 = NULL;
2517  struct __pyx_opt_args_9sioninter_sion_fread_key __pyx_t_3;
2518  int __pyx_lineno = 0;
2519  const char *__pyx_filename = NULL;
2520  int __pyx_clineno = 0;
2521  __Pyx_RefNannySetupContext("read_key", 0);
2522 
2523  /* "sioninter.pyx":96
2524  * def read_key(self, key, nitems=DEFAULT_NITEMS):
2525  * """Read value for corresponding key."""
2526  * ret = sion_fread_key(key, self._sid, nitems) # <<<<<<<<<<<<<<
2527  * return ret
2528  *
2529  */
2530  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2531  __Pyx_GOTREF(__pyx_t_1);
2532  __pyx_t_3.__pyx_n = 1;
2533  __pyx_t_3.nitems = __pyx_v_nitems;
2534  __pyx_t_2 = __pyx_f_9sioninter_sion_fread_key(__pyx_v_key, __pyx_t_1, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2535  __Pyx_GOTREF(__pyx_t_2);
2536  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2537  __pyx_v_ret = __pyx_t_2;
2538  __pyx_t_2 = 0;
2539 
2540  /* "sioninter.pyx":97
2541  * """Read value for corresponding key."""
2542  * ret = sion_fread_key(key, self._sid, nitems)
2543  * return ret # <<<<<<<<<<<<<<
2544  *
2545  *
2546  */
2547  __Pyx_XDECREF(__pyx_r);
2548  __Pyx_INCREF(__pyx_v_ret);
2549  __pyx_r = __pyx_v_ret;
2550  goto __pyx_L0;
2551 
2552  /* "sioninter.pyx":94
2553  * sion_fwrite_key(data, key, self._sid)
2554  *
2555  * def read_key(self, key, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
2556  * """Read value for corresponding key."""
2557  * ret = sion_fread_key(key, self._sid, nitems)
2558  */
2559 
2560  /* function exit code */
2561  __pyx_L1_error:;
2562  __Pyx_XDECREF(__pyx_t_1);
2563  __Pyx_XDECREF(__pyx_t_2);
2564  __Pyx_AddTraceback("sioninter.SIONFile.read_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
2565  __pyx_r = NULL;
2566  __pyx_L0:;
2567  __Pyx_XDECREF(__pyx_v_ret);
2568  __Pyx_XGIVEREF(__pyx_r);
2569  __Pyx_RefNannyFinishContext();
2570  return __pyx_r;
2571 }
2572 
2573 /* "sioninter.pyx":100
2574  *
2575  *
2576  * def open(fname, file_mode, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
2577  * """Open a file and return a SIONFile instance."""
2578  * sionfile = SIONFile(par_mode=par_mode)
2579  */
2580 
2581 /* Python wrapper */
2582 static PyObject *__pyx_pw_9sioninter_1open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2583 static char __pyx_doc_9sioninter_open[] = "Open a file and return a SIONFile instance.";
2584 static PyMethodDef __pyx_mdef_9sioninter_1open = {__Pyx_NAMESTR("open"), (PyCFunction)__pyx_pw_9sioninter_1open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_open)};
2585 static PyObject *__pyx_pw_9sioninter_1open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2586  PyObject *__pyx_v_fname = 0;
2587  PyObject *__pyx_v_file_mode = 0;
2588  PyObject *__pyx_v_par_mode = 0;
2589  int __pyx_lineno = 0;
2590  const char *__pyx_filename = NULL;
2591  int __pyx_clineno = 0;
2592  PyObject *__pyx_r = 0;
2593  __Pyx_RefNannyDeclarations
2594  __Pyx_RefNannySetupContext("open (wrapper)", 0);
2595  {
2596  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fname_2,&__pyx_n_s_file_mode_2,&__pyx_n_s_par_mode,0};
2597  PyObject* values[3] = {0,0,0};
2598  values[2] = __pyx_k__2;
2599  if (unlikely(__pyx_kwds)) {
2600  Py_ssize_t kw_args;
2601  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2602  switch (pos_args) {
2603  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2604  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2605  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2606  case 0: break;
2607  default: goto __pyx_L5_argtuple_error;
2608  }
2609  kw_args = PyDict_Size(__pyx_kwds);
2610  switch (pos_args) {
2611  case 0:
2612  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fname_2)) != 0)) kw_args--;
2613  else goto __pyx_L5_argtuple_error;
2614  case 1:
2615  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file_mode_2)) != 0)) kw_args--;
2616  else {
2617  __Pyx_RaiseArgtupleInvalid("open", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2618  }
2619  case 2:
2620  if (kw_args > 0) {
2621  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_par_mode);
2622  if (value) { values[2] = value; kw_args--; }
2623  }
2624  }
2625  if (unlikely(kw_args > 0)) {
2626  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2627  }
2628  } else {
2629  switch (PyTuple_GET_SIZE(__pyx_args)) {
2630  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2631  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2632  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2633  break;
2634  default: goto __pyx_L5_argtuple_error;
2635  }
2636  }
2637  __pyx_v_fname = values[0];
2638  __pyx_v_file_mode = values[1];
2639  __pyx_v_par_mode = values[2];
2640  }
2641  goto __pyx_L4_argument_unpacking_done;
2642  __pyx_L5_argtuple_error:;
2643  __Pyx_RaiseArgtupleInvalid("open", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2644  __pyx_L3_error:;
2645  __Pyx_AddTraceback("sioninter.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2646  __Pyx_RefNannyFinishContext();
2647  return NULL;
2648  __pyx_L4_argument_unpacking_done:;
2649  __pyx_r = __pyx_pf_9sioninter_open(__pyx_self, __pyx_v_fname, __pyx_v_file_mode, __pyx_v_par_mode);
2650 
2651  /* function exit code */
2652  __Pyx_RefNannyFinishContext();
2653  return __pyx_r;
2654 }
2655 
2656 static PyObject *__pyx_pf_9sioninter_open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode, PyObject *__pyx_v_par_mode) {
2657  PyObject *__pyx_v_sionfile = NULL;
2658  PyObject *__pyx_r = NULL;
2659  __Pyx_RefNannyDeclarations
2660  PyObject *__pyx_t_1 = NULL;
2661  PyObject *__pyx_t_2 = NULL;
2662  PyObject *__pyx_t_3 = NULL;
2663  int __pyx_lineno = 0;
2664  const char *__pyx_filename = NULL;
2665  int __pyx_clineno = 0;
2666  __Pyx_RefNannySetupContext("open", 0);
2667 
2668  /* "sioninter.pyx":102
2669  * def open(fname, file_mode, par_mode=DEFAULT_PAR_MODE):
2670  * """Open a file and return a SIONFile instance."""
2671  * sionfile = SIONFile(par_mode=par_mode) # <<<<<<<<<<<<<<
2672  * sionfile.open(fname, file_mode)
2673  * return sionfile
2674  */
2675  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SIONFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2676  __Pyx_GOTREF(__pyx_t_1);
2677  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2678  __Pyx_GOTREF(__pyx_t_2);
2679  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_par_mode, __pyx_v_par_mode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2680  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2681  __Pyx_GOTREF(__pyx_t_3);
2682  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2683  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2684  __pyx_v_sionfile = __pyx_t_3;
2685  __pyx_t_3 = 0;
2686 
2687  /* "sioninter.pyx":103
2688  * """Open a file and return a SIONFile instance."""
2689  * sionfile = SIONFile(par_mode=par_mode)
2690  * sionfile.open(fname, file_mode) # <<<<<<<<<<<<<<
2691  * return sionfile
2692  *
2693  */
2694  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sionfile, __pyx_n_s_open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2695  __Pyx_GOTREF(__pyx_t_3);
2696  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2697  __Pyx_GOTREF(__pyx_t_2);
2698  __Pyx_INCREF(__pyx_v_fname);
2699  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fname);
2700  __Pyx_GIVEREF(__pyx_v_fname);
2701  __Pyx_INCREF(__pyx_v_file_mode);
2702  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_file_mode);
2703  __Pyx_GIVEREF(__pyx_v_file_mode);
2704  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2705  __Pyx_GOTREF(__pyx_t_1);
2706  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2707  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2708  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2709 
2710  /* "sioninter.pyx":104
2711  * sionfile = SIONFile(par_mode=par_mode)
2712  * sionfile.open(fname, file_mode)
2713  * return sionfile # <<<<<<<<<<<<<<
2714  *
2715  *
2716  */
2717  __Pyx_XDECREF(__pyx_r);
2718  __Pyx_INCREF(__pyx_v_sionfile);
2719  __pyx_r = __pyx_v_sionfile;
2720  goto __pyx_L0;
2721 
2722  /* "sioninter.pyx":100
2723  *
2724  *
2725  * def open(fname, file_mode, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
2726  * """Open a file and return a SIONFile instance."""
2727  * sionfile = SIONFile(par_mode=par_mode)
2728  */
2729 
2730  /* function exit code */
2731  __pyx_L1_error:;
2732  __Pyx_XDECREF(__pyx_t_1);
2733  __Pyx_XDECREF(__pyx_t_2);
2734  __Pyx_XDECREF(__pyx_t_3);
2735  __Pyx_AddTraceback("sioninter.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2736  __pyx_r = NULL;
2737  __pyx_L0:;
2738  __Pyx_XDECREF(__pyx_v_sionfile);
2739  __Pyx_XGIVEREF(__pyx_r);
2740  __Pyx_RefNannyFinishContext();
2741  return __pyx_r;
2742 }
2743 
2744 /* "sioninter.pyx":107
2745  *
2746  *
2747  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
2748  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE,
2749  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
2750  */
2751 
2752 static PyObject *__pyx_f_9sioninter_sion_open(PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode, struct __pyx_opt_args_9sioninter_sion_open *__pyx_optional_args) {
2753  PyObject *__pyx_v_ntasks = __pyx_k__3;
2754  PyObject *__pyx_v_nfiles = __pyx_k__4;
2755  PyObject *__pyx_v_fsblksize = __pyx_k__5;
2756  int __pyx_v__ntasks;
2757  int __pyx_v__nfiles;
2758  __pyx_t_10csioninter_sion_int32 __pyx_v__fsblksize;
2759  int *__pyx_v__globalranks;
2760  __pyx_t_10csioninter_sion_int64 *__pyx_v__chunksizes;
2761  FILE *__pyx_v__fileptr;
2762  PyObject *__pyx_v_fname_b = NULL;
2763  PyObject *__pyx_v_file_mode_b = NULL;
2764  long __pyx_v_rank;
2765  int __pyx_v_ret;
2766  PyObject *__pyx_r = NULL;
2767  __Pyx_RefNannyDeclarations
2768  int __pyx_t_1;
2769  __pyx_t_10csioninter_sion_int32 __pyx_t_2;
2770  PyObject *__pyx_t_3 = NULL;
2771  PyObject *__pyx_t_4 = NULL;
2772  long __pyx_t_5;
2773  __pyx_t_10csioninter_sion_int64 __pyx_t_6;
2774  char *__pyx_t_7;
2775  char const *__pyx_t_8;
2776  int __pyx_lineno = 0;
2777  const char *__pyx_filename = NULL;
2778  int __pyx_clineno = 0;
2779  __Pyx_RefNannySetupContext("sion_open", 0);
2780  if (__pyx_optional_args) {
2781  if (__pyx_optional_args->__pyx_n > 0) {
2782  __pyx_v_ntasks = __pyx_optional_args->ntasks;
2783  if (__pyx_optional_args->__pyx_n > 1) {
2784  __pyx_v_nfiles = __pyx_optional_args->nfiles;
2785  if (__pyx_optional_args->__pyx_n > 3) {
2786  __pyx_v_fsblksize = __pyx_optional_args->fsblksize;
2787  }
2788  }
2789  }
2790  }
2791 
2792  /* "sioninter.pyx":111
2793  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
2794  * """Open a file and return a sion id."""
2795  * cdef int _ntasks = ntasks # <<<<<<<<<<<<<<
2796  * cdef int _nfiles = nfiles
2797  * cdef sion_int32 _fsblksize = fsblksize
2798  */
2799  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ntasks); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2800  __pyx_v__ntasks = __pyx_t_1;
2801 
2802  /* "sioninter.pyx":112
2803  * """Open a file and return a sion id."""
2804  * cdef int _ntasks = ntasks
2805  * cdef int _nfiles = nfiles # <<<<<<<<<<<<<<
2806  * cdef sion_int32 _fsblksize = fsblksize
2807  * cdef int * _globalranks = NULL
2808  */
2809  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nfiles); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2810  __pyx_v__nfiles = __pyx_t_1;
2811 
2812  /* "sioninter.pyx":113
2813  * cdef int _ntasks = ntasks
2814  * cdef int _nfiles = nfiles
2815  * cdef sion_int32 _fsblksize = fsblksize # <<<<<<<<<<<<<<
2816  * cdef int * _globalranks = NULL
2817  * cdef sion_int64 * _chunksizes = NULL
2818  */
2819  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_fsblksize); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2820  __pyx_v__fsblksize = __pyx_t_2;
2821 
2822  /* "sioninter.pyx":114
2823  * cdef int _nfiles = nfiles
2824  * cdef sion_int32 _fsblksize = fsblksize
2825  * cdef int * _globalranks = NULL # <<<<<<<<<<<<<<
2826  * cdef sion_int64 * _chunksizes = NULL
2827  * cdef FILE * _fileptr = NULL
2828  */
2829  __pyx_v__globalranks = NULL;
2830 
2831  /* "sioninter.pyx":115
2832  * cdef sion_int32 _fsblksize = fsblksize
2833  * cdef int * _globalranks = NULL
2834  * cdef sion_int64 * _chunksizes = NULL # <<<<<<<<<<<<<<
2835  * cdef FILE * _fileptr = NULL
2836  *
2837  */
2838  __pyx_v__chunksizes = NULL;
2839 
2840  /* "sioninter.pyx":116
2841  * cdef int * _globalranks = NULL
2842  * cdef sion_int64 * _chunksizes = NULL
2843  * cdef FILE * _fileptr = NULL # <<<<<<<<<<<<<<
2844  *
2845  * fname_b = fname.encode()
2846  */
2847  __pyx_v__fileptr = NULL;
2848 
2849  /* "sioninter.pyx":118
2850  * cdef FILE * _fileptr = NULL
2851  *
2852  * fname_b = fname.encode() # <<<<<<<<<<<<<<
2853  * file_mode_b = file_mode.encode()
2854  *
2855  */
2856  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2857  __Pyx_GOTREF(__pyx_t_3);
2858  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2859  __Pyx_GOTREF(__pyx_t_4);
2860  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2861  __pyx_v_fname_b = __pyx_t_4;
2862  __pyx_t_4 = 0;
2863 
2864  /* "sioninter.pyx":119
2865  *
2866  * fname_b = fname.encode()
2867  * file_mode_b = file_mode.encode() # <<<<<<<<<<<<<<
2868  *
2869  * _chunksizes = <sion_int64 * >malloc(_ntasks * sizeof(sion_int64))
2870  */
2871  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_mode, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2872  __Pyx_GOTREF(__pyx_t_4);
2873  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2874  __Pyx_GOTREF(__pyx_t_3);
2875  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2876  __pyx_v_file_mode_b = __pyx_t_3;
2877  __pyx_t_3 = 0;
2878 
2879  /* "sioninter.pyx":121
2880  * file_mode_b = file_mode.encode()
2881  *
2882  * _chunksizes = <sion_int64 * >malloc(_ntasks * sizeof(sion_int64)) # <<<<<<<<<<<<<<
2883  * _globalranks = <int * > malloc(_ntasks * sizeof(int))
2884  *
2885  */
2886  __pyx_v__chunksizes = ((__pyx_t_10csioninter_sion_int64 *)malloc((__pyx_v__ntasks * (sizeof(__pyx_t_10csioninter_sion_int64)))));
2887 
2888  /* "sioninter.pyx":122
2889  *
2890  * _chunksizes = <sion_int64 * >malloc(_ntasks * sizeof(sion_int64))
2891  * _globalranks = <int * > malloc(_ntasks * sizeof(int)) # <<<<<<<<<<<<<<
2892  *
2893  * for rank in range(1):
2894  */
2895  __pyx_v__globalranks = ((int *)malloc((__pyx_v__ntasks * (sizeof(int)))));
2896 
2897  /* "sioninter.pyx":124
2898  * _globalranks = <int * > malloc(_ntasks * sizeof(int))
2899  *
2900  * for rank in range(1): # <<<<<<<<<<<<<<
2901  * _chunksizes[rank] = DEFAULT_CHUNKSIZE
2902  * _globalranks[rank] = 0
2903  */
2904  for (__pyx_t_5 = 0; __pyx_t_5 < 1; __pyx_t_5+=1) {
2905  __pyx_v_rank = __pyx_t_5;
2906 
2907  /* "sioninter.pyx":125
2908  *
2909  * for rank in range(1):
2910  * _chunksizes[rank] = DEFAULT_CHUNKSIZE # <<<<<<<<<<<<<<
2911  * _globalranks[rank] = 0
2912  *
2913  */
2914  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_CHUNKSIZE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2915  __Pyx_GOTREF(__pyx_t_3);
2916  __pyx_t_6 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_3); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2917  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2918  (__pyx_v__chunksizes[__pyx_v_rank]) = __pyx_t_6;
2919 
2920  /* "sioninter.pyx":126
2921  * for rank in range(1):
2922  * _chunksizes[rank] = DEFAULT_CHUNKSIZE
2923  * _globalranks[rank] = 0 # <<<<<<<<<<<<<<
2924  *
2925  * ret = csioninter.sion_open(fname_b, file_mode_b, & _ntasks, & _nfiles,
2926  */
2927  (__pyx_v__globalranks[__pyx_v_rank]) = 0;
2928  }
2929 
2930  /* "sioninter.pyx":128
2931  * _globalranks[rank] = 0
2932  *
2933  * ret = csioninter.sion_open(fname_b, file_mode_b, & _ntasks, & _nfiles, # <<<<<<<<<<<<<<
2934  * & _chunksizes, & _fsblksize, & _globalranks,
2935  * & _fileptr)
2936  */
2937  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_fname_b); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2938  __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_file_mode_b); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2939 
2940  /* "sioninter.pyx":130
2941  * ret = csioninter.sion_open(fname_b, file_mode_b, & _ntasks, & _nfiles,
2942  * & _chunksizes, & _fsblksize, & _globalranks,
2943  * & _fileptr) # <<<<<<<<<<<<<<
2944  *
2945  * free(_chunksizes)
2946  */
2947  __pyx_v_ret = sion_open(__pyx_t_7, __pyx_t_8, (&__pyx_v__ntasks), (&__pyx_v__nfiles), (&__pyx_v__chunksizes), (&__pyx_v__fsblksize), (&__pyx_v__globalranks), (&__pyx_v__fileptr));
2948 
2949  /* "sioninter.pyx":132
2950  * & _fileptr)
2951  *
2952  * free(_chunksizes) # <<<<<<<<<<<<<<
2953  * free(_globalranks)
2954  *
2955  */
2956  free(__pyx_v__chunksizes);
2957 
2958  /* "sioninter.pyx":133
2959  *
2960  * free(_chunksizes)
2961  * free(_globalranks) # <<<<<<<<<<<<<<
2962  *
2963  * return ret
2964  */
2965  free(__pyx_v__globalranks);
2966 
2967  /* "sioninter.pyx":135
2968  * free(_globalranks)
2969  *
2970  * return ret # <<<<<<<<<<<<<<
2971  *
2972  *
2973  */
2974  __Pyx_XDECREF(__pyx_r);
2975  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2976  __Pyx_GOTREF(__pyx_t_3);
2977  __pyx_r = __pyx_t_3;
2978  __pyx_t_3 = 0;
2979  goto __pyx_L0;
2980 
2981  /* "sioninter.pyx":107
2982  *
2983  *
2984  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
2985  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE,
2986  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
2987  */
2988 
2989  /* function exit code */
2990  __pyx_L1_error:;
2991  __Pyx_XDECREF(__pyx_t_3);
2992  __Pyx_XDECREF(__pyx_t_4);
2993  __Pyx_AddTraceback("sioninter.sion_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2994  __pyx_r = 0;
2995  __pyx_L0:;
2996  __Pyx_XDECREF(__pyx_v_fname_b);
2997  __Pyx_XDECREF(__pyx_v_file_mode_b);
2998  __Pyx_XGIVEREF(__pyx_r);
2999  __Pyx_RefNannyFinishContext();
3000  return __pyx_r;
3001 }
3002 
3003 /* "sioninter.pyx":138
3004  *
3005  *
3006  * cdef sion_close(sid): # <<<<<<<<<<<<<<
3007  * """Close file."""
3008  * ret = csioninter.sion_close(sid)
3009  */
3010 
3011 static PyObject *__pyx_f_9sioninter_sion_close(PyObject *__pyx_v_sid) {
3012  int __pyx_v_ret;
3013  PyObject *__pyx_r = NULL;
3014  __Pyx_RefNannyDeclarations
3015  int __pyx_t_1;
3016  PyObject *__pyx_t_2 = NULL;
3017  int __pyx_lineno = 0;
3018  const char *__pyx_filename = NULL;
3019  int __pyx_clineno = 0;
3020  __Pyx_RefNannySetupContext("sion_close", 0);
3021 
3022  /* "sioninter.pyx":140
3023  * cdef sion_close(sid):
3024  * """Close file."""
3025  * ret = csioninter.sion_close(sid) # <<<<<<<<<<<<<<
3026  * return ret
3027  *
3028  */
3029  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3030  __pyx_v_ret = sion_close(__pyx_t_1);
3031 
3032  /* "sioninter.pyx":141
3033  * """Close file."""
3034  * ret = csioninter.sion_close(sid)
3035  * return ret # <<<<<<<<<<<<<<
3036  *
3037  *
3038  */
3039  __Pyx_XDECREF(__pyx_r);
3040  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3041  __Pyx_GOTREF(__pyx_t_2);
3042  __pyx_r = __pyx_t_2;
3043  __pyx_t_2 = 0;
3044  goto __pyx_L0;
3045 
3046  /* "sioninter.pyx":138
3047  *
3048  *
3049  * cdef sion_close(sid): # <<<<<<<<<<<<<<
3050  * """Close file."""
3051  * ret = csioninter.sion_close(sid)
3052  */
3053 
3054  /* function exit code */
3055  __pyx_L1_error:;
3056  __Pyx_XDECREF(__pyx_t_2);
3057  __Pyx_AddTraceback("sioninter.sion_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
3058  __pyx_r = 0;
3059  __pyx_L0:;
3060  __Pyx_XGIVEREF(__pyx_r);
3061  __Pyx_RefNannyFinishContext();
3062  return __pyx_r;
3063 }
3064 
3065 /* "sioninter.pyx":144
3066  *
3067  *
3068  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
3069  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
3070  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
3071  */
3072 
3073 static PyObject *__pyx_f_9sioninter_sion_paropen_mpi(PyObject *__pyx_v_fname, PyObject *__pyx_v_file_mode, struct __pyx_opt_args_9sioninter_sion_paropen_mpi *__pyx_optional_args) {
3074  PyObject *__pyx_v_nfiles = __pyx_k__6;
3075  PyObject *__pyx_v_chunksize = __pyx_k__7;
3076  PyObject *__pyx_v_fsblksize = __pyx_k__8;
3077  PyObject *__pyx_v_globalrank = __pyx_k__9;
3078  int __pyx_v__nfiles;
3079  __pyx_t_10csioninter_sion_int32 __pyx_v__fsblksize;
3080  int __pyx_v__globalrank;
3081  __pyx_t_10csioninter_sion_int64 __pyx_v__chunksize;
3082  FILE *__pyx_v__fileptr;
3083  MPI_Comm __pyx_v__gComm;
3084  MPI_Comm __pyx_v__lComm;
3085  char *__pyx_v__newname;
3086  PyObject *__pyx_v_fname_b = NULL;
3087  PyObject *__pyx_v_file_mode_b = NULL;
3088  PyObject *__pyx_v_comm = NULL;
3089  PyObject *__pyx_v_rank = NULL;
3090  int __pyx_v_ret;
3091  PyObject *__pyx_r = NULL;
3092  __Pyx_RefNannyDeclarations
3093  int __pyx_t_1;
3094  __pyx_t_10csioninter_sion_int32 __pyx_t_2;
3095  __pyx_t_10csioninter_sion_int64 __pyx_t_3;
3096  PyObject *__pyx_t_4 = NULL;
3097  PyObject *__pyx_t_5 = NULL;
3098  char *__pyx_t_6;
3099  char const *__pyx_t_7;
3100  int __pyx_lineno = 0;
3101  const char *__pyx_filename = NULL;
3102  int __pyx_clineno = 0;
3103  __Pyx_RefNannySetupContext("sion_paropen_mpi", 0);
3104  if (__pyx_optional_args) {
3105  if (__pyx_optional_args->__pyx_n > 0) {
3106  __pyx_v_nfiles = __pyx_optional_args->nfiles;
3107  if (__pyx_optional_args->__pyx_n > 3) {
3108  __pyx_v_chunksize = __pyx_optional_args->chunksize;
3109  if (__pyx_optional_args->__pyx_n > 4) {
3110  __pyx_v_fsblksize = __pyx_optional_args->fsblksize;
3111  if (__pyx_optional_args->__pyx_n > 5) {
3112  __pyx_v_globalrank = __pyx_optional_args->globalrank;
3113  }
3114  }
3115  }
3116  }
3117  }
3118 
3119  /* "sioninter.pyx":149
3120  * globalrank=DEFAULT_GLOBALRANK, fileptr=DEFAULT_FILEPTR):
3121  * """Open a file and return a sion id."""
3122  * cdef int _nfiles = nfiles # <<<<<<<<<<<<<<
3123  * cdef sion_int32 _fsblksize = fsblksize
3124  * cdef int _globalrank = globalrank
3125  */
3126  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nfiles); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3127  __pyx_v__nfiles = __pyx_t_1;
3128 
3129  /* "sioninter.pyx":150
3130  * """Open a file and return a sion id."""
3131  * cdef int _nfiles = nfiles
3132  * cdef sion_int32 _fsblksize = fsblksize # <<<<<<<<<<<<<<
3133  * cdef int _globalrank = globalrank
3134  * cdef sion_int64 _chunksize = chunksize
3135  */
3136  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_fsblksize); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3137  __pyx_v__fsblksize = __pyx_t_2;
3138 
3139  /* "sioninter.pyx":151
3140  * cdef int _nfiles = nfiles
3141  * cdef sion_int32 _fsblksize = fsblksize
3142  * cdef int _globalrank = globalrank # <<<<<<<<<<<<<<
3143  * cdef sion_int64 _chunksize = chunksize
3144  * cdef FILE * _fileptr = NULL
3145  */
3146  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_globalrank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3147  __pyx_v__globalrank = __pyx_t_1;
3148 
3149  /* "sioninter.pyx":152
3150  * cdef sion_int32 _fsblksize = fsblksize
3151  * cdef int _globalrank = globalrank
3152  * cdef sion_int64 _chunksize = chunksize # <<<<<<<<<<<<<<
3153  * cdef FILE * _fileptr = NULL
3154  * cdef MPI_Comm _gComm = NULL
3155  */
3156  __pyx_t_3 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_chunksize); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3157  __pyx_v__chunksize = __pyx_t_3;
3158 
3159  /* "sioninter.pyx":153
3160  * cdef int _globalrank = globalrank
3161  * cdef sion_int64 _chunksize = chunksize
3162  * cdef FILE * _fileptr = NULL # <<<<<<<<<<<<<<
3163  * cdef MPI_Comm _gComm = NULL
3164  * cdef MPI_Comm _lComm = NULL
3165  */
3166  __pyx_v__fileptr = NULL;
3167 
3168  /* "sioninter.pyx":154
3169  * cdef sion_int64 _chunksize = chunksize
3170  * cdef FILE * _fileptr = NULL
3171  * cdef MPI_Comm _gComm = NULL # <<<<<<<<<<<<<<
3172  * cdef MPI_Comm _lComm = NULL
3173  * cdef char * _newname = NULL
3174  */
3175  __pyx_v__gComm = NULL;
3176 
3177  /* "sioninter.pyx":155
3178  * cdef FILE * _fileptr = NULL
3179  * cdef MPI_Comm _gComm = NULL
3180  * cdef MPI_Comm _lComm = NULL # <<<<<<<<<<<<<<
3181  * cdef char * _newname = NULL
3182  *
3183  */
3184  __pyx_v__lComm = NULL;
3185 
3186  /* "sioninter.pyx":156
3187  * cdef MPI_Comm _gComm = NULL
3188  * cdef MPI_Comm _lComm = NULL
3189  * cdef char * _newname = NULL # <<<<<<<<<<<<<<
3190  *
3191  * fname_b = fname.encode()
3192  */
3193  __pyx_v__newname = NULL;
3194 
3195  /* "sioninter.pyx":158
3196  * cdef char * _newname = NULL
3197  *
3198  * fname_b = fname.encode() # <<<<<<<<<<<<<<
3199  * file_mode_b = file_mode.encode()
3200  *
3201  */
3202  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3203  __Pyx_GOTREF(__pyx_t_4);
3204  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3205  __Pyx_GOTREF(__pyx_t_5);
3206  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3207  __pyx_v_fname_b = __pyx_t_5;
3208  __pyx_t_5 = 0;
3209 
3210  /* "sioninter.pyx":159
3211  *
3212  * fname_b = fname.encode()
3213  * file_mode_b = file_mode.encode() # <<<<<<<<<<<<<<
3214  *
3215  * comm = MPI.COMM_WORLD
3216  */
3217  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_mode, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3218  __Pyx_GOTREF(__pyx_t_5);
3219  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3220  __Pyx_GOTREF(__pyx_t_4);
3221  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3222  __pyx_v_file_mode_b = __pyx_t_4;
3223  __pyx_t_4 = 0;
3224 
3225  /* "sioninter.pyx":161
3226  * file_mode_b = file_mode.encode()
3227  *
3228  * comm = MPI.COMM_WORLD # <<<<<<<<<<<<<<
3229  * rank = comm.Get_rank()
3230  * _gComm = MPI_COMM_WORLD
3231  */
3232  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_MPI); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3233  __Pyx_GOTREF(__pyx_t_4);
3234  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_COMM_WORLD); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3235  __Pyx_GOTREF(__pyx_t_5);
3236  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3237  __pyx_v_comm = __pyx_t_5;
3238  __pyx_t_5 = 0;
3239 
3240  /* "sioninter.pyx":162
3241  *
3242  * comm = MPI.COMM_WORLD
3243  * rank = comm.Get_rank() # <<<<<<<<<<<<<<
3244  * _gComm = MPI_COMM_WORLD
3245  * _lComm = _gComm
3246  */
3247  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Get_rank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3248  __Pyx_GOTREF(__pyx_t_5);
3249  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3250  __Pyx_GOTREF(__pyx_t_4);
3251  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3252  __pyx_v_rank = __pyx_t_4;
3253  __pyx_t_4 = 0;
3254 
3255  /* "sioninter.pyx":163
3256  * comm = MPI.COMM_WORLD
3257  * rank = comm.Get_rank()
3258  * _gComm = MPI_COMM_WORLD # <<<<<<<<<<<<<<
3259  * _lComm = _gComm
3260  * _globalrank = rank
3261  */
3262  __pyx_v__gComm = MPI_COMM_WORLD;
3263 
3264  /* "sioninter.pyx":164
3265  * rank = comm.Get_rank()
3266  * _gComm = MPI_COMM_WORLD
3267  * _lComm = _gComm # <<<<<<<<<<<<<<
3268  * _globalrank = rank
3269  *
3270  */
3271  __pyx_v__lComm = __pyx_v__gComm;
3272 
3273  /* "sioninter.pyx":165
3274  * _gComm = MPI_COMM_WORLD
3275  * _lComm = _gComm
3276  * _globalrank = rank # <<<<<<<<<<<<<<
3277  *
3278  * ret = csioninter.sion_paropen_mpi(fname_b, file_mode_b, & _nfiles, _gComm,
3279  */
3280  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3281  __pyx_v__globalrank = __pyx_t_1;
3282 
3283  /* "sioninter.pyx":167
3284  * _globalrank = rank
3285  *
3286  * ret = csioninter.sion_paropen_mpi(fname_b, file_mode_b, & _nfiles, _gComm, # <<<<<<<<<<<<<<
3287  * & _lComm, & _chunksize, & _fsblksize,
3288  * & _globalrank, & _fileptr, & _newname)
3289  */
3290  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_fname_b); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3291  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_file_mode_b); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3292 
3293  /* "sioninter.pyx":169
3294  * ret = csioninter.sion_paropen_mpi(fname_b, file_mode_b, & _nfiles, _gComm,
3295  * & _lComm, & _chunksize, & _fsblksize,
3296  * & _globalrank, & _fileptr, & _newname) # <<<<<<<<<<<<<<
3297  *
3298  * return ret
3299  */
3300  __pyx_v_ret = sion_paropen_mpi(__pyx_t_6, __pyx_t_7, (&__pyx_v__nfiles), __pyx_v__gComm, (&__pyx_v__lComm), (&__pyx_v__chunksize), (&__pyx_v__fsblksize), (&__pyx_v__globalrank), (&__pyx_v__fileptr), (&__pyx_v__newname));
3301 
3302  /* "sioninter.pyx":171
3303  * & _globalrank, & _fileptr, & _newname)
3304  *
3305  * return ret # <<<<<<<<<<<<<<
3306  *
3307  *
3308  */
3309  __Pyx_XDECREF(__pyx_r);
3310  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3311  __Pyx_GOTREF(__pyx_t_4);
3312  __pyx_r = __pyx_t_4;
3313  __pyx_t_4 = 0;
3314  goto __pyx_L0;
3315 
3316  /* "sioninter.pyx":144
3317  *
3318  *
3319  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
3320  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
3321  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
3322  */
3323 
3324  /* function exit code */
3325  __pyx_L1_error:;
3326  __Pyx_XDECREF(__pyx_t_4);
3327  __Pyx_XDECREF(__pyx_t_5);
3328  __Pyx_AddTraceback("sioninter.sion_paropen_mpi", __pyx_clineno, __pyx_lineno, __pyx_filename);
3329  __pyx_r = 0;
3330  __pyx_L0:;
3331  __Pyx_XDECREF(__pyx_v_fname_b);
3332  __Pyx_XDECREF(__pyx_v_file_mode_b);
3333  __Pyx_XDECREF(__pyx_v_comm);
3334  __Pyx_XDECREF(__pyx_v_rank);
3335  __Pyx_XGIVEREF(__pyx_r);
3336  __Pyx_RefNannyFinishContext();
3337  return __pyx_r;
3338 }
3339 
3340 /* "sioninter.pyx":174
3341  *
3342  *
3343  * cdef sion_parclose_mpi(sid): # <<<<<<<<<<<<<<
3344  * """Open a file and return a sion id."""
3345  * ret = csioninter.sion_parclose_mpi(sid)
3346  */
3347 
3348 static PyObject *__pyx_f_9sioninter_sion_parclose_mpi(PyObject *__pyx_v_sid) {
3349  int __pyx_v_ret;
3350  PyObject *__pyx_r = NULL;
3351  __Pyx_RefNannyDeclarations
3352  int __pyx_t_1;
3353  PyObject *__pyx_t_2 = NULL;
3354  int __pyx_lineno = 0;
3355  const char *__pyx_filename = NULL;
3356  int __pyx_clineno = 0;
3357  __Pyx_RefNannySetupContext("sion_parclose_mpi", 0);
3358 
3359  /* "sioninter.pyx":176
3360  * cdef sion_parclose_mpi(sid):
3361  * """Open a file and return a sion id."""
3362  * ret = csioninter.sion_parclose_mpi(sid) # <<<<<<<<<<<<<<
3363  * return ret
3364  *
3365  */
3366  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3367  __pyx_v_ret = sion_parclose_mpi(__pyx_t_1);
3368 
3369  /* "sioninter.pyx":177
3370  * """Open a file and return a sion id."""
3371  * ret = csioninter.sion_parclose_mpi(sid)
3372  * return ret # <<<<<<<<<<<<<<
3373  *
3374  *
3375  */
3376  __Pyx_XDECREF(__pyx_r);
3377  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3378  __Pyx_GOTREF(__pyx_t_2);
3379  __pyx_r = __pyx_t_2;
3380  __pyx_t_2 = 0;
3381  goto __pyx_L0;
3382 
3383  /* "sioninter.pyx":174
3384  *
3385  *
3386  * cdef sion_parclose_mpi(sid): # <<<<<<<<<<<<<<
3387  * """Open a file and return a sion id."""
3388  * ret = csioninter.sion_parclose_mpi(sid)
3389  */
3390 
3391  /* function exit code */
3392  __pyx_L1_error:;
3393  __Pyx_XDECREF(__pyx_t_2);
3394  __Pyx_AddTraceback("sioninter.sion_parclose_mpi", __pyx_clineno, __pyx_lineno, __pyx_filename);
3395  __pyx_r = 0;
3396  __pyx_L0:;
3397  __Pyx_XGIVEREF(__pyx_r);
3398  __Pyx_RefNannyFinishContext();
3399  return __pyx_r;
3400 }
3401 
3402 /* "sioninter.pyx":180
3403  *
3404  *
3405  * cdef sion_fwrite(data, sid): # <<<<<<<<<<<<<<
3406  * """Write data to file."""
3407  * cdef char * _data = NULL
3408  */
3409 
3410 static PyObject *__pyx_f_9sioninter_sion_fwrite(PyObject *__pyx_v_data, PyObject *__pyx_v_sid) {
3411  char *__pyx_v__data;
3412  size_t __pyx_v_bytes_written;
3413  PyObject *__pyx_r = NULL;
3414  __Pyx_RefNannyDeclarations
3415  char *__pyx_t_1;
3416  PyObject *__pyx_t_2 = NULL;
3417  size_t __pyx_t_3;
3418  Py_ssize_t __pyx_t_4;
3419  int __pyx_t_5;
3420  int __pyx_lineno = 0;
3421  const char *__pyx_filename = NULL;
3422  int __pyx_clineno = 0;
3423  __Pyx_RefNannySetupContext("sion_fwrite", 0);
3424 
3425  /* "sioninter.pyx":182
3426  * cdef sion_fwrite(data, sid):
3427  * """Write data to file."""
3428  * cdef char * _data = NULL # <<<<<<<<<<<<<<
3429  *
3430  * _data = data
3431  */
3432  __pyx_v__data = NULL;
3433 
3434  /* "sioninter.pyx":184
3435  * cdef char * _data = NULL
3436  *
3437  * _data = data # <<<<<<<<<<<<<<
3438  *
3439  * bytes_written = csioninter.sion_fwrite(_data, DEFAULT_SIZE, len(data), sid)
3440  */
3441  __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3442  __pyx_v__data = __pyx_t_1;
3443 
3444  /* "sioninter.pyx":186
3445  * _data = data
3446  *
3447  * bytes_written = csioninter.sion_fwrite(_data, DEFAULT_SIZE, len(data), sid) # <<<<<<<<<<<<<<
3448  *
3449  * return bytes_written
3450  */
3451  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3452  __Pyx_GOTREF(__pyx_t_2);
3453  __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3454  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3455  __pyx_t_4 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3456  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3457  __pyx_v_bytes_written = sion_fwrite(__pyx_v__data, __pyx_t_3, __pyx_t_4, __pyx_t_5);
3458 
3459  /* "sioninter.pyx":188
3460  * bytes_written = csioninter.sion_fwrite(_data, DEFAULT_SIZE, len(data), sid)
3461  *
3462  * return bytes_written # <<<<<<<<<<<<<<
3463  *
3464  *
3465  */
3466  __Pyx_XDECREF(__pyx_r);
3467  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_written); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3468  __Pyx_GOTREF(__pyx_t_2);
3469  __pyx_r = __pyx_t_2;
3470  __pyx_t_2 = 0;
3471  goto __pyx_L0;
3472 
3473  /* "sioninter.pyx":180
3474  *
3475  *
3476  * cdef sion_fwrite(data, sid): # <<<<<<<<<<<<<<
3477  * """Write data to file."""
3478  * cdef char * _data = NULL
3479  */
3480 
3481  /* function exit code */
3482  __pyx_L1_error:;
3483  __Pyx_XDECREF(__pyx_t_2);
3484  __Pyx_AddTraceback("sioninter.sion_fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3485  __pyx_r = 0;
3486  __pyx_L0:;
3487  __Pyx_XGIVEREF(__pyx_r);
3488  __Pyx_RefNannyFinishContext();
3489  return __pyx_r;
3490 }
3491 
3492 /* "sioninter.pyx":191
3493  *
3494  *
3495  * cdef sion_fread(sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
3496  * """Read data from file."""
3497  * cdef size_t _size = DEFAULT_SIZE
3498  */
3499 
3500 static PyObject *__pyx_f_9sioninter_sion_fread(PyObject *__pyx_v_sid, struct __pyx_opt_args_9sioninter_sion_fread *__pyx_optional_args) {
3501  PyObject *__pyx_v_nitems = __pyx_k__10;
3502  size_t __pyx_v__size;
3503  size_t __pyx_v__nitems;
3504  PyObject *__pyx_v_arr = NULL;
3505  size_t __pyx_v_bytes_read;
3506  PyObject *__pyx_r = NULL;
3507  __Pyx_RefNannyDeclarations
3508  PyObject *__pyx_t_1 = NULL;
3509  size_t __pyx_t_2;
3510  PyObject *__pyx_t_3 = NULL;
3511  PyObject *__pyx_t_4 = NULL;
3512  int __pyx_t_5;
3513  char *__pyx_t_6;
3514  int __pyx_t_7;
3515  Py_ssize_t __pyx_t_8;
3516  int __pyx_t_9;
3517  int __pyx_t_10;
3518  int __pyx_lineno = 0;
3519  const char *__pyx_filename = NULL;
3520  int __pyx_clineno = 0;
3521  __Pyx_RefNannySetupContext("sion_fread", 0);
3522  if (__pyx_optional_args) {
3523  if (__pyx_optional_args->__pyx_n > 0) {
3524  __pyx_v_nitems = __pyx_optional_args->nitems;
3525  }
3526  }
3527 
3528  /* "sioninter.pyx":193
3529  * cdef sion_fread(sid, nitems=DEFAULT_NITEMS):
3530  * """Read data from file."""
3531  * cdef size_t _size = DEFAULT_SIZE # <<<<<<<<<<<<<<
3532  * cdef size_t _nitems = nitems
3533  *
3534  */
3535  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3536  __Pyx_GOTREF(__pyx_t_1);
3537  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3538  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3539  __pyx_v__size = __pyx_t_2;
3540 
3541  /* "sioninter.pyx":194
3542  * """Read data from file."""
3543  * cdef size_t _size = DEFAULT_SIZE
3544  * cdef size_t _nitems = nitems # <<<<<<<<<<<<<<
3545  *
3546  * if _nitems == DEFAULT_NITEMS:
3547  */
3548  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_v_nitems); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3549  __pyx_v__nitems = __pyx_t_2;
3550 
3551  /* "sioninter.pyx":196
3552  * cdef size_t _nitems = nitems
3553  *
3554  * if _nitems == DEFAULT_NITEMS: # <<<<<<<<<<<<<<
3555  * _nitems = sion_bytes_avail_in_chunk(sid)
3556  *
3557  */
3558  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v__nitems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3559  __Pyx_GOTREF(__pyx_t_1);
3560  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3561  __Pyx_GOTREF(__pyx_t_3);
3562  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3563  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3564  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3565  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3566  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3567  if (__pyx_t_5) {
3568 
3569  /* "sioninter.pyx":197
3570  *
3571  * if _nitems == DEFAULT_NITEMS:
3572  * _nitems = sion_bytes_avail_in_chunk(sid) # <<<<<<<<<<<<<<
3573  *
3574  * arr = bytearray(_nitems)
3575  */
3576  __pyx_t_4 = __pyx_f_9sioninter_sion_bytes_avail_in_chunk(__pyx_v_sid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3577  __Pyx_GOTREF(__pyx_t_4);
3578  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3579  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3580  __pyx_v__nitems = __pyx_t_2;
3581  goto __pyx_L3;
3582  }
3583  __pyx_L3:;
3584 
3585  /* "sioninter.pyx":199
3586  * _nitems = sion_bytes_avail_in_chunk(sid)
3587  *
3588  * arr = bytearray(_nitems) # <<<<<<<<<<<<<<
3589  *
3590  * bytes_read = csioninter.sion_fread(<char * >arr, _size, _nitems, sid)
3591  */
3592  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v__nitems); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3593  __Pyx_GOTREF(__pyx_t_4);
3594  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3595  __Pyx_GOTREF(__pyx_t_3);
3596  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
3597  __Pyx_GIVEREF(__pyx_t_4);
3598  __pyx_t_4 = 0;
3599  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyByteArray_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3600  __Pyx_GOTREF(__pyx_t_4);
3601  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3602  __pyx_v_arr = ((PyObject*)__pyx_t_4);
3603  __pyx_t_4 = 0;
3604 
3605  /* "sioninter.pyx":201
3606  * arr = bytearray(_nitems)
3607  *
3608  * bytes_read = csioninter.sion_fread(<char * >arr, _size, _nitems, sid) # <<<<<<<<<<<<<<
3609  *
3610  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
3611  */
3612  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_arr); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3613  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3614  __pyx_v_bytes_read = sion_fread(((char *)__pyx_t_6), __pyx_v__size, __pyx_v__nitems, __pyx_t_7);
3615 
3616  /* "sioninter.pyx":203
3617  * bytes_read = csioninter.sion_fread(<char * >arr, _size, _nitems, sid)
3618  *
3619  * if bytes_read != len(arr) or bytes_read != _size * _nitems: # <<<<<<<<<<<<<<
3620  * raise IOError("read not successful")
3621  *
3622  */
3623  __pyx_t_8 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3624  __pyx_t_5 = ((__pyx_v_bytes_read != __pyx_t_8) != 0);
3625  if (!__pyx_t_5) {
3626  __pyx_t_9 = ((__pyx_v_bytes_read != (__pyx_v__size * __pyx_v__nitems)) != 0);
3627  __pyx_t_10 = __pyx_t_9;
3628  } else {
3629  __pyx_t_10 = __pyx_t_5;
3630  }
3631  if (__pyx_t_10) {
3632 
3633  /* "sioninter.pyx":204
3634  *
3635  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
3636  * raise IOError("read not successful") # <<<<<<<<<<<<<<
3637  *
3638  * return arr
3639  */
3640  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3641  __Pyx_GOTREF(__pyx_t_4);
3642  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3643  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3644  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3645  }
3646 
3647  /* "sioninter.pyx":206
3648  * raise IOError("read not successful")
3649  *
3650  * return arr # <<<<<<<<<<<<<<
3651  *
3652  *
3653  */
3654  __Pyx_XDECREF(__pyx_r);
3655  __Pyx_INCREF(__pyx_v_arr);
3656  __pyx_r = __pyx_v_arr;
3657  goto __pyx_L0;
3658 
3659  /* "sioninter.pyx":191
3660  *
3661  *
3662  * cdef sion_fread(sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
3663  * """Read data from file."""
3664  * cdef size_t _size = DEFAULT_SIZE
3665  */
3666 
3667  /* function exit code */
3668  __pyx_L1_error:;
3669  __Pyx_XDECREF(__pyx_t_1);
3670  __Pyx_XDECREF(__pyx_t_3);
3671  __Pyx_XDECREF(__pyx_t_4);
3672  __Pyx_AddTraceback("sioninter.sion_fread", __pyx_clineno, __pyx_lineno, __pyx_filename);
3673  __pyx_r = 0;
3674  __pyx_L0:;
3675  __Pyx_XDECREF(__pyx_v_arr);
3676  __Pyx_XGIVEREF(__pyx_r);
3677  __Pyx_RefNannyFinishContext();
3678  return __pyx_r;
3679 }
3680 
3681 /* "sioninter.pyx":209
3682  *
3683  *
3684  * cdef sion_bytes_avail_in_chunk(sid): # <<<<<<<<<<<<<<
3685  * """Get number of remaining bytes in current chunk."""
3686  * ret = csioninter.sion_bytes_avail_in_chunk(sid)
3687  */
3688 
3689 static PyObject *__pyx_f_9sioninter_sion_bytes_avail_in_chunk(PyObject *__pyx_v_sid) {
3690  __pyx_t_10csioninter_sion_int64 __pyx_v_ret;
3691  PyObject *__pyx_r = NULL;
3692  __Pyx_RefNannyDeclarations
3693  int __pyx_t_1;
3694  PyObject *__pyx_t_2 = NULL;
3695  int __pyx_lineno = 0;
3696  const char *__pyx_filename = NULL;
3697  int __pyx_clineno = 0;
3698  __Pyx_RefNannySetupContext("sion_bytes_avail_in_chunk", 0);
3699 
3700  /* "sioninter.pyx":211
3701  * cdef sion_bytes_avail_in_chunk(sid):
3702  * """Get number of remaining bytes in current chunk."""
3703  * ret = csioninter.sion_bytes_avail_in_chunk(sid) # <<<<<<<<<<<<<<
3704  *
3705  * return ret
3706  */
3707  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3708  __pyx_v_ret = sion_bytes_avail_in_chunk(__pyx_t_1);
3709 
3710  /* "sioninter.pyx":213
3711  * ret = csioninter.sion_bytes_avail_in_chunk(sid)
3712  *
3713  * return ret # <<<<<<<<<<<<<<
3714  *
3715  *
3716  */
3717  __Pyx_XDECREF(__pyx_r);
3718  __pyx_t_2 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3719  __Pyx_GOTREF(__pyx_t_2);
3720  __pyx_r = __pyx_t_2;
3721  __pyx_t_2 = 0;
3722  goto __pyx_L0;
3723 
3724  /* "sioninter.pyx":209
3725  *
3726  *
3727  * cdef sion_bytes_avail_in_chunk(sid): # <<<<<<<<<<<<<<
3728  * """Get number of remaining bytes in current chunk."""
3729  * ret = csioninter.sion_bytes_avail_in_chunk(sid)
3730  */
3731 
3732  /* function exit code */
3733  __pyx_L1_error:;
3734  __Pyx_XDECREF(__pyx_t_2);
3735  __Pyx_AddTraceback("sioninter.sion_bytes_avail_in_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
3736  __pyx_r = 0;
3737  __pyx_L0:;
3738  __Pyx_XGIVEREF(__pyx_r);
3739  __Pyx_RefNannyFinishContext();
3740  return __pyx_r;
3741 }
3742 
3743 /* "sioninter.pyx":216
3744  *
3745  *
3746  * cpdef sion_fwrite_key(data, key, sid): # <<<<<<<<<<<<<<
3747  * """Write a key value pair."""
3748  * cdef char * _data = NULL
3749  */
3750 
3751 static PyObject *__pyx_pw_9sioninter_3sion_fwrite_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3752 static PyObject *__pyx_f_9sioninter_sion_fwrite_key(PyObject *__pyx_v_data, PyObject *__pyx_v_key, PyObject *__pyx_v_sid, CYTHON_UNUSED int __pyx_skip_dispatch) {
3753  char *__pyx_v__data;
3754  size_t __pyx_v_ret;
3755  PyObject *__pyx_r = NULL;
3756  __Pyx_RefNannyDeclarations
3757  char *__pyx_t_1;
3758  uint64_t __pyx_t_2;
3759  PyObject *__pyx_t_3 = NULL;
3760  size_t __pyx_t_4;
3761  Py_ssize_t __pyx_t_5;
3762  int __pyx_t_6;
3763  int __pyx_lineno = 0;
3764  const char *__pyx_filename = NULL;
3765  int __pyx_clineno = 0;
3766  __Pyx_RefNannySetupContext("sion_fwrite_key", 0);
3767 
3768  /* "sioninter.pyx":218
3769  * cpdef sion_fwrite_key(data, key, sid):
3770  * """Write a key value pair."""
3771  * cdef char * _data = NULL # <<<<<<<<<<<<<<
3772  *
3773  * _data = data
3774  */
3775  __pyx_v__data = NULL;
3776 
3777  /* "sioninter.pyx":220
3778  * cdef char * _data = NULL
3779  *
3780  * _data = data # <<<<<<<<<<<<<<
3781  *
3782  * ret = csioninter.sion_fwrite_key(_data, key, DEFAULT_SIZE, len(data), sid)
3783  */
3784  __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3785  __pyx_v__data = __pyx_t_1;
3786 
3787  /* "sioninter.pyx":222
3788  * _data = data
3789  *
3790  * ret = csioninter.sion_fwrite_key(_data, key, DEFAULT_SIZE, len(data), sid) # <<<<<<<<<<<<<<
3791  *
3792  * return ret
3793  */
3794  __pyx_t_2 = __Pyx_PyInt_As_uint64_t(__pyx_v_key); if (unlikely((__pyx_t_2 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3795  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3796  __Pyx_GOTREF(__pyx_t_3);
3797  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3798  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3799  __pyx_t_5 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3800  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3801  __pyx_v_ret = sion_fwrite_key(__pyx_v__data, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6);
3802 
3803  /* "sioninter.pyx":224
3804  * ret = csioninter.sion_fwrite_key(_data, key, DEFAULT_SIZE, len(data), sid)
3805  *
3806  * return ret # <<<<<<<<<<<<<<
3807  *
3808  *
3809  */
3810  __Pyx_XDECREF(__pyx_r);
3811  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3812  __Pyx_GOTREF(__pyx_t_3);
3813  __pyx_r = __pyx_t_3;
3814  __pyx_t_3 = 0;
3815  goto __pyx_L0;
3816 
3817  /* "sioninter.pyx":216
3818  *
3819  *
3820  * cpdef sion_fwrite_key(data, key, sid): # <<<<<<<<<<<<<<
3821  * """Write a key value pair."""
3822  * cdef char * _data = NULL
3823  */
3824 
3825  /* function exit code */
3826  __pyx_L1_error:;
3827  __Pyx_XDECREF(__pyx_t_3);
3828  __Pyx_AddTraceback("sioninter.sion_fwrite_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
3829  __pyx_r = 0;
3830  __pyx_L0:;
3831  __Pyx_XGIVEREF(__pyx_r);
3832  __Pyx_RefNannyFinishContext();
3833  return __pyx_r;
3834 }
3835 
3836 /* Python wrapper */
3837 static PyObject *__pyx_pw_9sioninter_3sion_fwrite_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3838 static char __pyx_doc_9sioninter_2sion_fwrite_key[] = "Write a key value pair.";
3839 static PyObject *__pyx_pw_9sioninter_3sion_fwrite_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3840  PyObject *__pyx_v_data = 0;
3841  PyObject *__pyx_v_key = 0;
3842  PyObject *__pyx_v_sid = 0;
3843  int __pyx_lineno = 0;
3844  const char *__pyx_filename = NULL;
3845  int __pyx_clineno = 0;
3846  PyObject *__pyx_r = 0;
3847  __Pyx_RefNannyDeclarations
3848  __Pyx_RefNannySetupContext("sion_fwrite_key (wrapper)", 0);
3849  {
3850  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_key,&__pyx_n_s_sid_2,0};
3851  PyObject* values[3] = {0,0,0};
3852  if (unlikely(__pyx_kwds)) {
3853  Py_ssize_t kw_args;
3854  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3855  switch (pos_args) {
3856  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3857  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3858  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3859  case 0: break;
3860  default: goto __pyx_L5_argtuple_error;
3861  }
3862  kw_args = PyDict_Size(__pyx_kwds);
3863  switch (pos_args) {
3864  case 0:
3865  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
3866  else goto __pyx_L5_argtuple_error;
3867  case 1:
3868  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
3869  else {
3870  __Pyx_RaiseArgtupleInvalid("sion_fwrite_key", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3871  }
3872  case 2:
3873  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sid_2)) != 0)) kw_args--;
3874  else {
3875  __Pyx_RaiseArgtupleInvalid("sion_fwrite_key", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3876  }
3877  }
3878  if (unlikely(kw_args > 0)) {
3879  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sion_fwrite_key") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3880  }
3881  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3882  goto __pyx_L5_argtuple_error;
3883  } else {
3884  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3885  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3886  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3887  }
3888  __pyx_v_data = values[0];
3889  __pyx_v_key = values[1];
3890  __pyx_v_sid = values[2];
3891  }
3892  goto __pyx_L4_argument_unpacking_done;
3893  __pyx_L5_argtuple_error:;
3894  __Pyx_RaiseArgtupleInvalid("sion_fwrite_key", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3895  __pyx_L3_error:;
3896  __Pyx_AddTraceback("sioninter.sion_fwrite_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
3897  __Pyx_RefNannyFinishContext();
3898  return NULL;
3899  __pyx_L4_argument_unpacking_done:;
3900  __pyx_r = __pyx_pf_9sioninter_2sion_fwrite_key(__pyx_self, __pyx_v_data, __pyx_v_key, __pyx_v_sid);
3901 
3902  /* function exit code */
3903  __Pyx_RefNannyFinishContext();
3904  return __pyx_r;
3905 }
3906 
3907 static PyObject *__pyx_pf_9sioninter_2sion_fwrite_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, PyObject *__pyx_v_key, PyObject *__pyx_v_sid) {
3908  PyObject *__pyx_r = NULL;
3909  __Pyx_RefNannyDeclarations
3910  PyObject *__pyx_t_1 = NULL;
3911  int __pyx_lineno = 0;
3912  const char *__pyx_filename = NULL;
3913  int __pyx_clineno = 0;
3914  __Pyx_RefNannySetupContext("sion_fwrite_key", 0);
3915  __Pyx_XDECREF(__pyx_r);
3916  __pyx_t_1 = __pyx_f_9sioninter_sion_fwrite_key(__pyx_v_data, __pyx_v_key, __pyx_v_sid, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3917  __Pyx_GOTREF(__pyx_t_1);
3918  __pyx_r = __pyx_t_1;
3919  __pyx_t_1 = 0;
3920  goto __pyx_L0;
3921 
3922  /* function exit code */
3923  __pyx_L1_error:;
3924  __Pyx_XDECREF(__pyx_t_1);
3925  __Pyx_AddTraceback("sioninter.sion_fwrite_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
3926  __pyx_r = NULL;
3927  __pyx_L0:;
3928  __Pyx_XGIVEREF(__pyx_r);
3929  __Pyx_RefNannyFinishContext();
3930  return __pyx_r;
3931 }
3932 
3933 /* "sioninter.pyx":227
3934  *
3935  *
3936  * cpdef sion_fread_key(key, sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
3937  * """Read value for corresponding key."""
3938  * cdef size_t _size = DEFAULT_SIZE
3939  */
3940 
3941 static PyObject *__pyx_pw_9sioninter_5sion_fread_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3942 static PyObject *__pyx_f_9sioninter_sion_fread_key(PyObject *__pyx_v_key, PyObject *__pyx_v_sid, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9sioninter_sion_fread_key *__pyx_optional_args) {
3943  PyObject *__pyx_v_nitems = __pyx_k__12;
3944  size_t __pyx_v__size;
3945  size_t __pyx_v__nitems;
3946  PyObject *__pyx_v_arr = NULL;
3947  size_t __pyx_v_bytes_read;
3948  PyObject *__pyx_r = NULL;
3949  __Pyx_RefNannyDeclarations
3950  PyObject *__pyx_t_1 = NULL;
3951  size_t __pyx_t_2;
3952  PyObject *__pyx_t_3 = NULL;
3953  PyObject *__pyx_t_4 = NULL;
3954  int __pyx_t_5;
3955  char *__pyx_t_6;
3956  uint64_t __pyx_t_7;
3957  int __pyx_t_8;
3958  Py_ssize_t __pyx_t_9;
3959  int __pyx_t_10;
3960  int __pyx_t_11;
3961  PyObject *__pyx_t_12 = NULL;
3962  PyObject *__pyx_t_13 = NULL;
3963  int __pyx_lineno = 0;
3964  const char *__pyx_filename = NULL;
3965  int __pyx_clineno = 0;
3966  __Pyx_RefNannySetupContext("sion_fread_key", 0);
3967  if (__pyx_optional_args) {
3968  if (__pyx_optional_args->__pyx_n > 0) {
3969  __pyx_v_nitems = __pyx_optional_args->nitems;
3970  }
3971  }
3972 
3973  /* "sioninter.pyx":229
3974  * cpdef sion_fread_key(key, sid, nitems=DEFAULT_NITEMS):
3975  * """Read value for corresponding key."""
3976  * cdef size_t _size = DEFAULT_SIZE # <<<<<<<<<<<<<<
3977  * cdef size_t _nitems = nitems
3978  *
3979  */
3980  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3981  __Pyx_GOTREF(__pyx_t_1);
3982  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3983  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3984  __pyx_v__size = __pyx_t_2;
3985 
3986  /* "sioninter.pyx":230
3987  * """Read value for corresponding key."""
3988  * cdef size_t _size = DEFAULT_SIZE
3989  * cdef size_t _nitems = nitems # <<<<<<<<<<<<<<
3990  *
3991  * if _nitems == DEFAULT_NITEMS:
3992  */
3993  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_v_nitems); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3994  __pyx_v__nitems = __pyx_t_2;
3995 
3996  /* "sioninter.pyx":232
3997  * cdef size_t _nitems = nitems
3998  *
3999  * if _nitems == DEFAULT_NITEMS: # <<<<<<<<<<<<<<
4000  * _nitems = sion_bytes_avail_in_chunk(sid)
4001  *
4002  */
4003  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v__nitems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4004  __Pyx_GOTREF(__pyx_t_1);
4005  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4006  __Pyx_GOTREF(__pyx_t_3);
4007  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4008  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4009  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4010  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4011  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4012  if (__pyx_t_5) {
4013 
4014  /* "sioninter.pyx":233
4015  *
4016  * if _nitems == DEFAULT_NITEMS:
4017  * _nitems = sion_bytes_avail_in_chunk(sid) # <<<<<<<<<<<<<<
4018  *
4019  * arr = bytearray(_nitems)
4020  */
4021  __pyx_t_4 = __pyx_f_9sioninter_sion_bytes_avail_in_chunk(__pyx_v_sid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4022  __Pyx_GOTREF(__pyx_t_4);
4023  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4024  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4025  __pyx_v__nitems = __pyx_t_2;
4026  goto __pyx_L3;
4027  }
4028  __pyx_L3:;
4029 
4030  /* "sioninter.pyx":235
4031  * _nitems = sion_bytes_avail_in_chunk(sid)
4032  *
4033  * arr = bytearray(_nitems) # <<<<<<<<<<<<<<
4034  *
4035  * bytes_read = csioninter.sion_fread_key(<char * >arr, key, _size, _nitems,
4036  */
4037  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v__nitems); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4038  __Pyx_GOTREF(__pyx_t_4);
4039  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4040  __Pyx_GOTREF(__pyx_t_3);
4041  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
4042  __Pyx_GIVEREF(__pyx_t_4);
4043  __pyx_t_4 = 0;
4044  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyByteArray_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4045  __Pyx_GOTREF(__pyx_t_4);
4046  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4047  __pyx_v_arr = ((PyObject*)__pyx_t_4);
4048  __pyx_t_4 = 0;
4049 
4050  /* "sioninter.pyx":237
4051  * arr = bytearray(_nitems)
4052  *
4053  * bytes_read = csioninter.sion_fread_key(<char * >arr, key, _size, _nitems, # <<<<<<<<<<<<<<
4054  * sid)
4055  *
4056  */
4057  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_arr); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4058  __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_v_key); if (unlikely((__pyx_t_7 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4059 
4060  /* "sioninter.pyx":238
4061  *
4062  * bytes_read = csioninter.sion_fread_key(<char * >arr, key, _size, _nitems,
4063  * sid) # <<<<<<<<<<<<<<
4064  *
4065  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
4066  */
4067  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_sid); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4068 
4069  /* "sioninter.pyx":237
4070  * arr = bytearray(_nitems)
4071  *
4072  * bytes_read = csioninter.sion_fread_key(<char * >arr, key, _size, _nitems, # <<<<<<<<<<<<<<
4073  * sid)
4074  *
4075  */
4076  __pyx_v_bytes_read = sion_fread_key(((char *)__pyx_t_6), __pyx_t_7, __pyx_v__size, __pyx_v__nitems, __pyx_t_8);
4077 
4078  /* "sioninter.pyx":240
4079  * sid)
4080  *
4081  * if bytes_read != len(arr) or bytes_read != _size * _nitems: # <<<<<<<<<<<<<<
4082  * raise IOError("read not successful: {} {} {}".format(bytes_read,
4083  * len(arr),
4084  */
4085  __pyx_t_9 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4086  __pyx_t_5 = ((__pyx_v_bytes_read != __pyx_t_9) != 0);
4087  if (!__pyx_t_5) {
4088  __pyx_t_10 = ((__pyx_v_bytes_read != (__pyx_v__size * __pyx_v__nitems)) != 0);
4089  __pyx_t_11 = __pyx_t_10;
4090  } else {
4091  __pyx_t_11 = __pyx_t_5;
4092  }
4093  if (__pyx_t_11) {
4094 
4095  /* "sioninter.pyx":241
4096  *
4097  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
4098  * raise IOError("read not successful: {} {} {}".format(bytes_read, # <<<<<<<<<<<<<<
4099  * len(arr),
4100  * _size * _nitems))
4101  */
4102  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_read_not_successful_2, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4103  __Pyx_GOTREF(__pyx_t_4);
4104  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_bytes_read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4105  __Pyx_GOTREF(__pyx_t_3);
4106 
4107  /* "sioninter.pyx":242
4108  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
4109  * raise IOError("read not successful: {} {} {}".format(bytes_read,
4110  * len(arr), # <<<<<<<<<<<<<<
4111  * _size * _nitems))
4112  *
4113  */
4114  __pyx_t_9 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4115  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4116  __Pyx_GOTREF(__pyx_t_1);
4117 
4118  /* "sioninter.pyx":243
4119  * raise IOError("read not successful: {} {} {}".format(bytes_read,
4120  * len(arr),
4121  * _size * _nitems)) # <<<<<<<<<<<<<<
4122  *
4123  * return arr
4124  */
4125  __pyx_t_12 = __Pyx_PyInt_FromSize_t((__pyx_v__size * __pyx_v__nitems)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4126  __Pyx_GOTREF(__pyx_t_12);
4127 
4128  /* "sioninter.pyx":241
4129  *
4130  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
4131  * raise IOError("read not successful: {} {} {}".format(bytes_read, # <<<<<<<<<<<<<<
4132  * len(arr),
4133  * _size * _nitems))
4134  */
4135  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4136  __Pyx_GOTREF(__pyx_t_13);
4137  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3);
4138  __Pyx_GIVEREF(__pyx_t_3);
4139  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1);
4140  __Pyx_GIVEREF(__pyx_t_1);
4141  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12);
4142  __Pyx_GIVEREF(__pyx_t_12);
4143  __pyx_t_3 = 0;
4144  __pyx_t_1 = 0;
4145  __pyx_t_12 = 0;
4146  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4147  __Pyx_GOTREF(__pyx_t_12);
4148  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4149  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4150  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4151  __Pyx_GOTREF(__pyx_t_13);
4152  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
4153  __Pyx_GIVEREF(__pyx_t_12);
4154  __pyx_t_12 = 0;
4155  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4156  __Pyx_GOTREF(__pyx_t_12);
4157  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4158  __Pyx_Raise(__pyx_t_12, 0, 0, 0);
4159  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4160  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4161  }
4162 
4163  /* "sioninter.pyx":245
4164  * _size * _nitems))
4165  *
4166  * return arr # <<<<<<<<<<<<<<
4167  */
4168  __Pyx_XDECREF(__pyx_r);
4169  __Pyx_INCREF(__pyx_v_arr);
4170  __pyx_r = __pyx_v_arr;
4171  goto __pyx_L0;
4172 
4173  /* "sioninter.pyx":227
4174  *
4175  *
4176  * cpdef sion_fread_key(key, sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
4177  * """Read value for corresponding key."""
4178  * cdef size_t _size = DEFAULT_SIZE
4179  */
4180 
4181  /* function exit code */
4182  __pyx_L1_error:;
4183  __Pyx_XDECREF(__pyx_t_1);
4184  __Pyx_XDECREF(__pyx_t_3);
4185  __Pyx_XDECREF(__pyx_t_4);
4186  __Pyx_XDECREF(__pyx_t_12);
4187  __Pyx_XDECREF(__pyx_t_13);
4188  __Pyx_AddTraceback("sioninter.sion_fread_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
4189  __pyx_r = 0;
4190  __pyx_L0:;
4191  __Pyx_XDECREF(__pyx_v_arr);
4192  __Pyx_XGIVEREF(__pyx_r);
4193  __Pyx_RefNannyFinishContext();
4194  return __pyx_r;
4195 }
4196 
4197 /* Python wrapper */
4198 static PyObject *__pyx_pw_9sioninter_5sion_fread_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4199 static char __pyx_doc_9sioninter_4sion_fread_key[] = "Read value for corresponding key.";
4200 static PyObject *__pyx_pw_9sioninter_5sion_fread_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4201  PyObject *__pyx_v_key = 0;
4202  PyObject *__pyx_v_sid = 0;
4203  PyObject *__pyx_v_nitems = 0;
4204  int __pyx_lineno = 0;
4205  const char *__pyx_filename = NULL;
4206  int __pyx_clineno = 0;
4207  PyObject *__pyx_r = 0;
4208  __Pyx_RefNannyDeclarations
4209  __Pyx_RefNannySetupContext("sion_fread_key (wrapper)", 0);
4210  {
4211  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_sid_2,&__pyx_n_s_nitems,0};
4212  PyObject* values[3] = {0,0,0};
4213  values[2] = __pyx_k__12;
4214  if (unlikely(__pyx_kwds)) {
4215  Py_ssize_t kw_args;
4216  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4217  switch (pos_args) {
4218  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4219  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4220  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4221  case 0: break;
4222  default: goto __pyx_L5_argtuple_error;
4223  }
4224  kw_args = PyDict_Size(__pyx_kwds);
4225  switch (pos_args) {
4226  case 0:
4227  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
4228  else goto __pyx_L5_argtuple_error;
4229  case 1:
4230  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sid_2)) != 0)) kw_args--;
4231  else {
4232  __Pyx_RaiseArgtupleInvalid("sion_fread_key", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4233  }
4234  case 2:
4235  if (kw_args > 0) {
4236  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nitems);
4237  if (value) { values[2] = value; kw_args--; }
4238  }
4239  }
4240  if (unlikely(kw_args > 0)) {
4241  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sion_fread_key") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4242  }
4243  } else {
4244  switch (PyTuple_GET_SIZE(__pyx_args)) {
4245  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4246  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4247  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4248  break;
4249  default: goto __pyx_L5_argtuple_error;
4250  }
4251  }
4252  __pyx_v_key = values[0];
4253  __pyx_v_sid = values[1];
4254  __pyx_v_nitems = values[2];
4255  }
4256  goto __pyx_L4_argument_unpacking_done;
4257  __pyx_L5_argtuple_error:;
4258  __Pyx_RaiseArgtupleInvalid("sion_fread_key", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4259  __pyx_L3_error:;
4260  __Pyx_AddTraceback("sioninter.sion_fread_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
4261  __Pyx_RefNannyFinishContext();
4262  return NULL;
4263  __pyx_L4_argument_unpacking_done:;
4264  __pyx_r = __pyx_pf_9sioninter_4sion_fread_key(__pyx_self, __pyx_v_key, __pyx_v_sid, __pyx_v_nitems);
4265 
4266  /* function exit code */
4267  __Pyx_RefNannyFinishContext();
4268  return __pyx_r;
4269 }
4270 
4271 static PyObject *__pyx_pf_9sioninter_4sion_fread_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key, PyObject *__pyx_v_sid, PyObject *__pyx_v_nitems) {
4272  PyObject *__pyx_r = NULL;
4273  __Pyx_RefNannyDeclarations
4274  PyObject *__pyx_t_1 = NULL;
4275  struct __pyx_opt_args_9sioninter_sion_fread_key __pyx_t_2;
4276  int __pyx_lineno = 0;
4277  const char *__pyx_filename = NULL;
4278  int __pyx_clineno = 0;
4279  __Pyx_RefNannySetupContext("sion_fread_key", 0);
4280  __Pyx_XDECREF(__pyx_r);
4281  __pyx_t_2.__pyx_n = 1;
4282  __pyx_t_2.nitems = __pyx_v_nitems;
4283  __pyx_t_1 = __pyx_f_9sioninter_sion_fread_key(__pyx_v_key, __pyx_v_sid, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4284  __Pyx_GOTREF(__pyx_t_1);
4285  __pyx_r = __pyx_t_1;
4286  __pyx_t_1 = 0;
4287  goto __pyx_L0;
4288 
4289  /* function exit code */
4290  __pyx_L1_error:;
4291  __Pyx_XDECREF(__pyx_t_1);
4292  __Pyx_AddTraceback("sioninter.sion_fread_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
4293  __pyx_r = NULL;
4294  __pyx_L0:;
4295  __Pyx_XGIVEREF(__pyx_r);
4296  __Pyx_RefNannyFinishContext();
4297  return __pyx_r;
4298 }
4299 
4300 /* "array.pxd":91
4301  * __data_union data
4302  *
4303  * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
4304  * # This implementation of getbuffer is geared towards Cython
4305  * # requirements, and does not yet fullfill the PEP.
4306  */
4307 
4308 /* Python wrapper */
4309 static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
4310 static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
4311  int __pyx_r;
4312  __Pyx_RefNannyDeclarations
4313  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
4314  __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
4315 
4316  /* function exit code */
4317  __Pyx_RefNannyFinishContext();
4318  return __pyx_r;
4319 }
4320 
4321 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
4322  PyObject *__pyx_v_item_count = NULL;
4323  int __pyx_r;
4324  __Pyx_RefNannyDeclarations
4325  PyObject *__pyx_t_1 = NULL;
4326  char *__pyx_t_2;
4327  int __pyx_t_3;
4328  PyObject *__pyx_t_4 = NULL;
4329  Py_ssize_t __pyx_t_5;
4330  int __pyx_t_6;
4331  int __pyx_lineno = 0;
4332  const char *__pyx_filename = NULL;
4333  int __pyx_clineno = 0;
4334  __Pyx_RefNannySetupContext("__getbuffer__", 0);
4335  if (__pyx_v_info != NULL) {
4336  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
4337  __Pyx_GIVEREF(__pyx_v_info->obj);
4338  }
4339 
4340  /* "array.pxd":96
4341  * # In particular strided access is always provided regardless
4342  * # of flags
4343  * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
4344  *
4345  * info.suboffsets = NULL
4346  */
4347  __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4348  __Pyx_GOTREF(__pyx_t_1);
4349  __pyx_v_item_count = __pyx_t_1;
4350  __pyx_t_1 = 0;
4351 
4352  /* "array.pxd":98
4353  * item_count = Py_SIZE(self)
4354  *
4355  * info.suboffsets = NULL # <<<<<<<<<<<<<<
4356  * info.buf = self.data.as_chars
4357  * info.readonly = 0
4358  */
4359  __pyx_v_info->suboffsets = NULL;
4360 
4361  /* "array.pxd":99
4362  *
4363  * info.suboffsets = NULL
4364  * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
4365  * info.readonly = 0
4366  * info.ndim = 1
4367  */
4368  __pyx_t_2 = __pyx_v_self->data.as_chars;
4369  __pyx_v_info->buf = __pyx_t_2;
4370 
4371  /* "array.pxd":100
4372  * info.suboffsets = NULL
4373  * info.buf = self.data.as_chars
4374  * info.readonly = 0 # <<<<<<<<<<<<<<
4375  * info.ndim = 1
4376  * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4377  */
4378  __pyx_v_info->readonly = 0;
4379 
4380  /* "array.pxd":101
4381  * info.buf = self.data.as_chars
4382  * info.readonly = 0
4383  * info.ndim = 1 # <<<<<<<<<<<<<<
4384  * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4385  * info.len = info.itemsize * item_count
4386  */
4387  __pyx_v_info->ndim = 1;
4388 
4389  /* "array.pxd":102
4390  * info.readonly = 0
4391  * info.ndim = 1
4392  * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
4393  * info.len = info.itemsize * item_count
4394  *
4395  */
4396  __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
4397  __pyx_v_info->itemsize = __pyx_t_3;
4398 
4399  /* "array.pxd":103
4400  * info.ndim = 1
4401  * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4402  * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
4403  *
4404  * info.shape = <Py_ssize_t*> PyMem_Malloc(sizeof(Py_ssize_t) + 2)
4405  */
4406  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4407  __Pyx_GOTREF(__pyx_t_1);
4408  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4409  __Pyx_GOTREF(__pyx_t_4);
4410  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4411  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4412  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4413  __pyx_v_info->len = __pyx_t_5;
4414 
4415  /* "array.pxd":105
4416  * info.len = info.itemsize * item_count
4417  *
4418  * info.shape = <Py_ssize_t*> PyMem_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
4419  * if not info.shape:
4420  * raise MemoryError()
4421  */
4422  __pyx_v_info->shape = ((Py_ssize_t *)PyMem_Malloc(((sizeof(Py_ssize_t)) + 2)));
4423 
4424  /* "array.pxd":106
4425  *
4426  * info.shape = <Py_ssize_t*> PyMem_Malloc(sizeof(Py_ssize_t) + 2)
4427  * if not info.shape: # <<<<<<<<<<<<<<
4428  * raise MemoryError()
4429  * info.shape[0] = item_count # constant regardless of resizing
4430  */
4431  __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0);
4432  if (__pyx_t_6) {
4433 
4434  /* "array.pxd":107
4435  * info.shape = <Py_ssize_t*> PyMem_Malloc(sizeof(Py_ssize_t) + 2)
4436  * if not info.shape:
4437  * raise MemoryError() # <<<<<<<<<<<<<<
4438  * info.shape[0] = item_count # constant regardless of resizing
4439  * info.strides = &info.itemsize
4440  */
4441  PyErr_NoMemory(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4442  }
4443 
4444  /* "array.pxd":108
4445  * if not info.shape:
4446  * raise MemoryError()
4447  * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
4448  * info.strides = &info.itemsize
4449  *
4450  */
4451  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4452  (__pyx_v_info->shape[0]) = __pyx_t_5;
4453 
4454  /* "array.pxd":109
4455  * raise MemoryError()
4456  * info.shape[0] = item_count # constant regardless of resizing
4457  * info.strides = &info.itemsize # <<<<<<<<<<<<<<
4458  *
4459  * info.format = <char*> (info.shape + 1)
4460  */
4461  __pyx_v_info->strides = (&__pyx_v_info->itemsize);
4462 
4463  /* "array.pxd":111
4464  * info.strides = &info.itemsize
4465  *
4466  * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
4467  * info.format[0] = self.ob_descr.typecode
4468  * info.format[1] = 0
4469  */
4470  __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
4471 
4472  /* "array.pxd":112
4473  *
4474  * info.format = <char*> (info.shape + 1)
4475  * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
4476  * info.format[1] = 0
4477  * info.obj = self
4478  */
4479  __pyx_t_3 = __pyx_v_self->ob_descr->typecode;
4480  (__pyx_v_info->format[0]) = __pyx_t_3;
4481 
4482  /* "array.pxd":113
4483  * info.format = <char*> (info.shape + 1)
4484  * info.format[0] = self.ob_descr.typecode
4485  * info.format[1] = 0 # <<<<<<<<<<<<<<
4486  * info.obj = self
4487  *
4488  */
4489  (__pyx_v_info->format[1]) = 0;
4490 
4491  /* "array.pxd":114
4492  * info.format[0] = self.ob_descr.typecode
4493  * info.format[1] = 0
4494  * info.obj = self # <<<<<<<<<<<<<<
4495  *
4496  * def __releasebuffer__(self, Py_buffer* info):
4497  */
4498  __Pyx_INCREF(((PyObject *)__pyx_v_self));
4499  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4500  __Pyx_GOTREF(__pyx_v_info->obj);
4501  __Pyx_DECREF(__pyx_v_info->obj);
4502  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
4503 
4504  /* "array.pxd":91
4505  * __data_union data
4506  *
4507  * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
4508  * # This implementation of getbuffer is geared towards Cython
4509  * # requirements, and does not yet fullfill the PEP.
4510  */
4511 
4512  /* function exit code */
4513  __pyx_r = 0;
4514  goto __pyx_L0;
4515  __pyx_L1_error:;
4516  __Pyx_XDECREF(__pyx_t_1);
4517  __Pyx_XDECREF(__pyx_t_4);
4518  __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4519  __pyx_r = -1;
4520  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
4521  __Pyx_GOTREF(__pyx_v_info->obj);
4522  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
4523  }
4524  goto __pyx_L2;
4525  __pyx_L0:;
4526  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
4527  __Pyx_GOTREF(Py_None);
4528  __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
4529  }
4530  __pyx_L2:;
4531  __Pyx_XDECREF(__pyx_v_item_count);
4532  __Pyx_RefNannyFinishContext();
4533  return __pyx_r;
4534 }
4535 
4536 /* "array.pxd":116
4537  * info.obj = self
4538  *
4539  * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
4540  * PyMem_Free(info.shape)
4541  *
4542  */
4543 
4544 /* Python wrapper */
4545 static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
4546 static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4547  __Pyx_RefNannyDeclarations
4548  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
4549  __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
4550 
4551  /* function exit code */
4552  __Pyx_RefNannyFinishContext();
4553 }
4554 
4555 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4556  __Pyx_RefNannyDeclarations
4557  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
4558 
4559  /* "array.pxd":117
4560  *
4561  * def __releasebuffer__(self, Py_buffer* info):
4562  * PyMem_Free(info.shape) # <<<<<<<<<<<<<<
4563  *
4564  * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
4565  */
4566  PyMem_Free(__pyx_v_info->shape);
4567 
4568  /* "array.pxd":116
4569  * info.obj = self
4570  *
4571  * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
4572  * PyMem_Free(info.shape)
4573  *
4574  */
4575 
4576  /* function exit code */
4577  __Pyx_RefNannyFinishContext();
4578 }
4579 
4580 /* "array.pxd":128
4581  *
4582  *
4583  * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
4584  * """ fast creation of a new array, given a template array.
4585  * type will be same as template.
4586  */
4587 
4588 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
4589  arrayobject *__pyx_v_op = NULL;
4590  arrayobject *__pyx_r = NULL;
4591  __Pyx_RefNannyDeclarations
4592  PyObject *__pyx_t_1 = NULL;
4593  int __pyx_t_2;
4594  int __pyx_t_3;
4595  int __pyx_lineno = 0;
4596  const char *__pyx_filename = NULL;
4597  int __pyx_clineno = 0;
4598  __Pyx_RefNannySetupContext("clone", 0);
4599 
4600  /* "array.pxd":132
4601  * type will be same as template.
4602  * if zero is true, new array will be initialized with zeroes."""
4603  * op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
4604  * if zero and op is not None:
4605  * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4606  */
4607  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4608  __Pyx_GOTREF(__pyx_t_1);
4609  __pyx_v_op = ((arrayobject *)__pyx_t_1);
4610  __pyx_t_1 = 0;
4611 
4612  /* "array.pxd":133
4613  * if zero is true, new array will be initialized with zeroes."""
4614  * op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
4615  * if zero and op is not None: # <<<<<<<<<<<<<<
4616  * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4617  * return op
4618  */
4619  if ((__pyx_v_zero != 0)) {
4620  __pyx_t_2 = (((PyObject *)__pyx_v_op) != Py_None);
4621  __pyx_t_3 = (__pyx_t_2 != 0);
4622  } else {
4623  __pyx_t_3 = (__pyx_v_zero != 0);
4624  }
4625  if (__pyx_t_3) {
4626 
4627  /* "array.pxd":134
4628  * op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
4629  * if zero and op is not None:
4630  * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
4631  * return op
4632  *
4633  */
4634  memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize));
4635  goto __pyx_L3;
4636  }
4637  __pyx_L3:;
4638 
4639  /* "array.pxd":135
4640  * if zero and op is not None:
4641  * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4642  * return op # <<<<<<<<<<<<<<
4643  *
4644  * cdef inline array copy(array self):
4645  */
4646  __Pyx_XDECREF(((PyObject *)__pyx_r));
4647  __Pyx_INCREF(((PyObject *)__pyx_v_op));
4648  __pyx_r = __pyx_v_op;
4649  goto __pyx_L0;
4650 
4651  /* "array.pxd":128
4652  *
4653  *
4654  * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
4655  * """ fast creation of a new array, given a template array.
4656  * type will be same as template.
4657  */
4658 
4659  /* function exit code */
4660  __pyx_L1_error:;
4661  __Pyx_XDECREF(__pyx_t_1);
4662  __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
4663  __pyx_r = 0;
4664  __pyx_L0:;
4665  __Pyx_XDECREF((PyObject *)__pyx_v_op);
4666  __Pyx_XGIVEREF((PyObject *)__pyx_r);
4667  __Pyx_RefNannyFinishContext();
4668  return __pyx_r;
4669 }
4670 
4671 /* "array.pxd":137
4672  * return op
4673  *
4674  * cdef inline array copy(array self): # <<<<<<<<<<<<<<
4675  * """ make a copy of an array. """
4676  * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4677  */
4678 
4679 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
4680  arrayobject *__pyx_v_op = NULL;
4681  arrayobject *__pyx_r = NULL;
4682  __Pyx_RefNannyDeclarations
4683  PyObject *__pyx_t_1 = NULL;
4684  int __pyx_lineno = 0;
4685  const char *__pyx_filename = NULL;
4686  int __pyx_clineno = 0;
4687  __Pyx_RefNannySetupContext("copy", 0);
4688 
4689  /* "array.pxd":139
4690  * cdef inline array copy(array self):
4691  * """ make a copy of an array. """
4692  * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
4693  * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
4694  * return op
4695  */
4696  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4697  __Pyx_GOTREF(__pyx_t_1);
4698  __pyx_v_op = ((arrayobject *)__pyx_t_1);
4699  __pyx_t_1 = 0;
4700 
4701  /* "array.pxd":140
4702  * """ make a copy of an array. """
4703  * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4704  * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
4705  * return op
4706  *
4707  */
4708  memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize));
4709 
4710  /* "array.pxd":141
4711  * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4712  * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
4713  * return op # <<<<<<<<<<<<<<
4714  *
4715  * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
4716  */
4717  __Pyx_XDECREF(((PyObject *)__pyx_r));
4718  __Pyx_INCREF(((PyObject *)__pyx_v_op));
4719  __pyx_r = __pyx_v_op;
4720  goto __pyx_L0;
4721 
4722  /* "array.pxd":137
4723  * return op
4724  *
4725  * cdef inline array copy(array self): # <<<<<<<<<<<<<<
4726  * """ make a copy of an array. """
4727  * op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4728  */
4729 
4730  /* function exit code */
4731  __pyx_L1_error:;
4732  __Pyx_XDECREF(__pyx_t_1);
4733  __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4734  __pyx_r = 0;
4735  __pyx_L0:;
4736  __Pyx_XDECREF((PyObject *)__pyx_v_op);
4737  __Pyx_XGIVEREF((PyObject *)__pyx_r);
4738  __Pyx_RefNannyFinishContext();
4739  return __pyx_r;
4740 }
4741 
4742 /* "array.pxd":143
4743  * return op
4744  *
4745  * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
4746  * """ efficent appending of new stuff of same type
4747  * (e.g. of same array type)
4748  */
4749 
4750 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
4751  Py_ssize_t __pyx_v_itemsize;
4752  Py_ssize_t __pyx_v_origsize;
4753  int __pyx_r;
4754  __Pyx_RefNannyDeclarations
4755  int __pyx_t_1;
4756  int __pyx_lineno = 0;
4757  const char *__pyx_filename = NULL;
4758  int __pyx_clineno = 0;
4759  __Pyx_RefNannySetupContext("extend_buffer", 0);
4760 
4761  /* "array.pxd":147
4762  * (e.g. of same array type)
4763  * n: number of elements (not number of bytes!) """
4764  * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
4765  * cdef Py_ssize_t origsize = Py_SIZE(self)
4766  * resize_smart(self, origsize + n)
4767  */
4768  __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
4769  __pyx_v_itemsize = __pyx_t_1;
4770 
4771  /* "array.pxd":148
4772  * n: number of elements (not number of bytes!) """
4773  * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
4774  * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
4775  * resize_smart(self, origsize + n)
4776  * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4777  */
4778  __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
4779 
4780  /* "array.pxd":149
4781  * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
4782  * cdef Py_ssize_t origsize = Py_SIZE(self)
4783  * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
4784  * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4785  * return 0
4786  */
4787  __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4788 
4789  /* "array.pxd":150
4790  * cdef Py_ssize_t origsize = Py_SIZE(self)
4791  * resize_smart(self, origsize + n)
4792  * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
4793  * return 0
4794  *
4795  */
4796  memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize));
4797 
4798  /* "array.pxd":151
4799  * resize_smart(self, origsize + n)
4800  * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4801  * return 0 # <<<<<<<<<<<<<<
4802  *
4803  * cdef inline int extend(array self, array other) except -1:
4804  */
4805  __pyx_r = 0;
4806  goto __pyx_L0;
4807 
4808  /* "array.pxd":143
4809  * return op
4810  *
4811  * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
4812  * """ efficent appending of new stuff of same type
4813  * (e.g. of same array type)
4814  */
4815 
4816  /* function exit code */
4817  __pyx_L1_error:;
4818  __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
4819  __pyx_r = -1;
4820  __pyx_L0:;
4821  __Pyx_RefNannyFinishContext();
4822  return __pyx_r;
4823 }
4824 
4825 /* "array.pxd":153
4826  * return 0
4827  *
4828  * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
4829  * """ extend array with data from another array; types must match. """
4830  * if self.ob_descr.typecode != other.ob_descr.typecode:
4831  */
4832 
4833 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
4834  int __pyx_r;
4835  __Pyx_RefNannyDeclarations
4836  int __pyx_t_1;
4837  int __pyx_t_2;
4838  int __pyx_lineno = 0;
4839  const char *__pyx_filename = NULL;
4840  int __pyx_clineno = 0;
4841  __Pyx_RefNannySetupContext("extend", 0);
4842 
4843  /* "array.pxd":155
4844  * cdef inline int extend(array self, array other) except -1:
4845  * """ extend array with data from another array; types must match. """
4846  * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
4847  * PyErr_BadArgument()
4848  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4849  */
4850  __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0);
4851  if (__pyx_t_1) {
4852 
4853  /* "array.pxd":156
4854  * """ extend array with data from another array; types must match. """
4855  * if self.ob_descr.typecode != other.ob_descr.typecode:
4856  * PyErr_BadArgument() # <<<<<<<<<<<<<<
4857  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4858  *
4859  */
4860  __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4861  goto __pyx_L3;
4862  }
4863  __pyx_L3:;
4864 
4865  /* "array.pxd":157
4866  * if self.ob_descr.typecode != other.ob_descr.typecode:
4867  * PyErr_BadArgument()
4868  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
4869  *
4870  * cdef inline void zero(array self):
4871  */
4872  __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4873  __pyx_r = __pyx_t_2;
4874  goto __pyx_L0;
4875 
4876  /* "array.pxd":153
4877  * return 0
4878  *
4879  * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
4880  * """ extend array with data from another array; types must match. """
4881  * if self.ob_descr.typecode != other.ob_descr.typecode:
4882  */
4883 
4884  /* function exit code */
4885  __pyx_L1_error:;
4886  __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
4887  __pyx_r = -1;
4888  __pyx_L0:;
4889  __Pyx_RefNannyFinishContext();
4890  return __pyx_r;
4891 }
4892 
4893 /* "array.pxd":159
4894  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4895  *
4896  * cdef inline void zero(array self): # <<<<<<<<<<<<<<
4897  * """ set all elements of array to zero. """
4898  * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
4899  */
4900 
4901 static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
4902  __Pyx_RefNannyDeclarations
4903  __Pyx_RefNannySetupContext("zero", 0);
4904 
4905  /* "array.pxd":161
4906  * cdef inline void zero(array self):
4907  * """ set all elements of array to zero. """
4908  * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
4909  */
4910  memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize));
4911 
4912  /* "array.pxd":159
4913  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4914  *
4915  * cdef inline void zero(array self): # <<<<<<<<<<<<<<
4916  * """ set all elements of array to zero. """
4917  * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
4918  */
4919 
4920  /* function exit code */
4921  __Pyx_RefNannyFinishContext();
4922 }
4923 
4924 static PyMethodDef __pyx_methods[] = {
4925  {__Pyx_NAMESTR("sion_fwrite_key"), (PyCFunction)__pyx_pw_9sioninter_3sion_fwrite_key, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_2sion_fwrite_key)},
4926  {__Pyx_NAMESTR("sion_fread_key"), (PyCFunction)__pyx_pw_9sioninter_5sion_fread_key, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9sioninter_4sion_fread_key)},
4927  {0, 0, 0, 0}
4928 };
4929 
4930 #if PY_MAJOR_VERSION >= 3
4931 static struct PyModuleDef __pyx_moduledef = {
4932  #if PY_VERSION_HEX < 0x03020000
4933  { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
4934  #else
4935  PyModuleDef_HEAD_INIT,
4936  #endif
4937  __Pyx_NAMESTR("sioninter"),
4938  __Pyx_DOCSTR(__pyx_k_Interface_for_SIONlib_This_inter), /* m_doc */
4939  -1, /* m_size */
4940  __pyx_methods /* m_methods */,
4941  NULL, /* m_reload */
4942  NULL, /* m_traverse */
4943  NULL, /* m_clear */
4944  NULL /* m_free */
4945 };
4946 #endif
4947 
4948 static __Pyx_StringTabEntry __pyx_string_tab[] = {
4949  {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
4950  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
4951  {&__pyx_n_s_BufferedIOBase, __pyx_k_BufferedIOBase, sizeof(__pyx_k_BufferedIOBase), 0, 0, 1, 1},
4952  {&__pyx_n_s_COMM_WORLD, __pyx_k_COMM_WORLD, sizeof(__pyx_k_COMM_WORLD), 0, 0, 1, 1},
4953  {&__pyx_n_s_DEFAULT_CHUNKSIZE, __pyx_k_DEFAULT_CHUNKSIZE, sizeof(__pyx_k_DEFAULT_CHUNKSIZE), 0, 0, 1, 1},
4954  {&__pyx_n_s_DEFAULT_CHUNKSIZES, __pyx_k_DEFAULT_CHUNKSIZES, sizeof(__pyx_k_DEFAULT_CHUNKSIZES), 0, 0, 1, 1},
4955  {&__pyx_n_s_DEFAULT_FILEPTR, __pyx_k_DEFAULT_FILEPTR, sizeof(__pyx_k_DEFAULT_FILEPTR), 0, 0, 1, 1},
4956  {&__pyx_n_s_DEFAULT_FSBLKSIZE, __pyx_k_DEFAULT_FSBLKSIZE, sizeof(__pyx_k_DEFAULT_FSBLKSIZE), 0, 0, 1, 1},
4957  {&__pyx_n_s_DEFAULT_GCOMM, __pyx_k_DEFAULT_GCOMM, sizeof(__pyx_k_DEFAULT_GCOMM), 0, 0, 1, 1},
4958  {&__pyx_n_s_DEFAULT_GLOBALRANK, __pyx_k_DEFAULT_GLOBALRANK, sizeof(__pyx_k_DEFAULT_GLOBALRANK), 0, 0, 1, 1},
4959  {&__pyx_n_s_DEFAULT_GLOBALRANKS, __pyx_k_DEFAULT_GLOBALRANKS, sizeof(__pyx_k_DEFAULT_GLOBALRANKS), 0, 0, 1, 1},
4960  {&__pyx_n_s_DEFAULT_LCOMM, __pyx_k_DEFAULT_LCOMM, sizeof(__pyx_k_DEFAULT_LCOMM), 0, 0, 1, 1},
4961  {&__pyx_n_s_DEFAULT_NFILES, __pyx_k_DEFAULT_NFILES, sizeof(__pyx_k_DEFAULT_NFILES), 0, 0, 1, 1},
4962  {&__pyx_n_s_DEFAULT_NITEMS, __pyx_k_DEFAULT_NITEMS, sizeof(__pyx_k_DEFAULT_NITEMS), 0, 0, 1, 1},
4963  {&__pyx_n_s_DEFAULT_NTASKS, __pyx_k_DEFAULT_NTASKS, sizeof(__pyx_k_DEFAULT_NTASKS), 0, 0, 1, 1},
4964  {&__pyx_n_s_DEFAULT_PAR_MODE, __pyx_k_DEFAULT_PAR_MODE, sizeof(__pyx_k_DEFAULT_PAR_MODE), 0, 0, 1, 1},
4965  {&__pyx_n_s_DEFAULT_SIZE, __pyx_k_DEFAULT_SIZE, sizeof(__pyx_k_DEFAULT_SIZE), 0, 0, 1, 1},
4966  {&__pyx_kp_s_File_like_object_for_handling_SI, __pyx_k_File_like_object_for_handling_SI, sizeof(__pyx_k_File_like_object_for_handling_SI), 0, 0, 1, 0},
4967  {&__pyx_n_s_Get_rank, __pyx_k_Get_rank, sizeof(__pyx_k_Get_rank), 0, 0, 1, 1},
4968  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
4969  {&__pyx_n_s_MPI, __pyx_k_MPI, sizeof(__pyx_k_MPI), 0, 0, 1, 1},
4970  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
4971  {&__pyx_n_s_SIONFile, __pyx_k_SIONFile, sizeof(__pyx_k_SIONFile), 0, 0, 1, 1},
4972  {&__pyx_n_s_SIONFile___init, __pyx_k_SIONFile___init, sizeof(__pyx_k_SIONFile___init), 0, 0, 1, 1},
4973  {&__pyx_n_s_SIONFile_close, __pyx_k_SIONFile_close, sizeof(__pyx_k_SIONFile_close), 0, 0, 1, 1},
4974  {&__pyx_n_s_SIONFile_closed, __pyx_k_SIONFile_closed, sizeof(__pyx_k_SIONFile_closed), 0, 0, 1, 1},
4975  {&__pyx_n_s_SIONFile_open, __pyx_k_SIONFile_open, sizeof(__pyx_k_SIONFile_open), 0, 0, 1, 1},
4976  {&__pyx_n_s_SIONFile_read, __pyx_k_SIONFile_read, sizeof(__pyx_k_SIONFile_read), 0, 0, 1, 1},
4977  {&__pyx_n_s_SIONFile_read_key, __pyx_k_SIONFile_read_key, sizeof(__pyx_k_SIONFile_read_key), 0, 0, 1, 1},
4978  {&__pyx_n_s_SIONFile_write, __pyx_k_SIONFile_write, sizeof(__pyx_k_SIONFile_write), 0, 0, 1, 1},
4979  {&__pyx_n_s_SIONFile_write_key, __pyx_k_SIONFile_write_key, sizeof(__pyx_k_SIONFile_write_key), 0, 0, 1, 1},
4980  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
4981  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
4982  {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1},
4983  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
4984  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
4985  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
4986  {&__pyx_n_s_file_mode, __pyx_k_file_mode, sizeof(__pyx_k_file_mode), 0, 0, 1, 1},
4987  {&__pyx_n_s_file_mode_2, __pyx_k_file_mode_2, sizeof(__pyx_k_file_mode_2), 0, 0, 1, 1},
4988  {&__pyx_n_s_fname, __pyx_k_fname, sizeof(__pyx_k_fname), 0, 0, 1, 1},
4989  {&__pyx_n_s_fname_2, __pyx_k_fname_2, sizeof(__pyx_k_fname_2), 0, 0, 1, 1},
4990  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
4991  {&__pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_k_home_thust_src_sionlib_pythonin, sizeof(__pyx_k_home_thust_src_sionlib_pythonin), 0, 0, 1, 0},
4992  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4993  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
4994  {&__pyx_kp_u_invalid_attribute_self__par_mode, __pyx_k_invalid_attribute_self__par_mode, sizeof(__pyx_k_invalid_attribute_self__par_mode), 0, 1, 0, 0},
4995  {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
4996  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
4997  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4998  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
4999  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
5000  {&__pyx_n_u_mpi, __pyx_k_mpi, sizeof(__pyx_k_mpi), 0, 1, 0, 1},
5001  {&__pyx_n_s_mpi4py, __pyx_k_mpi4py, sizeof(__pyx_k_mpi4py), 0, 0, 1, 1},
5002  {&__pyx_n_s_nitems, __pyx_k_nitems, sizeof(__pyx_k_nitems), 0, 0, 1, 1},
5003  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
5004  {&__pyx_n_s_par_mode, __pyx_k_par_mode, sizeof(__pyx_k_par_mode), 0, 0, 1, 1},
5005  {&__pyx_n_s_par_mode_2, __pyx_k_par_mode_2, sizeof(__pyx_k_par_mode_2), 0, 0, 1, 1},
5006  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
5007  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
5008  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
5009  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
5010  {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
5011  {&__pyx_n_s_read_key, __pyx_k_read_key, sizeof(__pyx_k_read_key), 0, 0, 1, 1},
5012  {&__pyx_kp_u_read_not_successful, __pyx_k_read_not_successful, sizeof(__pyx_k_read_not_successful), 0, 1, 0, 0},
5013  {&__pyx_kp_u_read_not_successful_2, __pyx_k_read_not_successful_2, sizeof(__pyx_k_read_not_successful_2), 0, 1, 0, 0},
5014  {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
5015  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
5016  {&__pyx_n_u_serial, __pyx_k_serial, sizeof(__pyx_k_serial), 0, 1, 0, 1},
5017  {&__pyx_n_s_sid, __pyx_k_sid, sizeof(__pyx_k_sid), 0, 0, 1, 1},
5018  {&__pyx_n_s_sid_2, __pyx_k_sid_2, sizeof(__pyx_k_sid_2), 0, 0, 1, 1},
5019  {&__pyx_n_s_sionfile, __pyx_k_sionfile, sizeof(__pyx_k_sionfile), 0, 0, 1, 1},
5020  {&__pyx_n_s_sioninter, __pyx_k_sioninter, sizeof(__pyx_k_sioninter), 0, 0, 1, 1},
5021  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
5022  {&__pyx_n_s_valid_par_modes, __pyx_k_valid_par_modes, sizeof(__pyx_k_valid_par_modes), 0, 0, 1, 1},
5023  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
5024  {&__pyx_n_s_write_key, __pyx_k_write_key, sizeof(__pyx_k_write_key), 0, 0, 1, 1},
5025  {0, 0, 0, 0, 0, 0, 0}
5026 };
5027 static int __Pyx_InitCachedBuiltins(void) {
5028  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5029  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5030  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5031  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5032  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5033  return 0;
5034  __pyx_L1_error:;
5035  return -1;
5036 }
5037 
5038 static int __Pyx_InitCachedConstants(void) {
5039  __Pyx_RefNannyDeclarations
5040  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
5041 
5042  /* "sioninter.pyx":204
5043  *
5044  * if bytes_read != len(arr) or bytes_read != _size * _nitems:
5045  * raise IOError("read not successful") # <<<<<<<<<<<<<<
5046  *
5047  * return arr
5048  */
5049  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_read_not_successful); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5050  __Pyx_GOTREF(__pyx_tuple__11);
5051  __Pyx_GIVEREF(__pyx_tuple__11);
5052 
5053  /* "sioninter.pyx":46
5054  * class SIONFile(io.BufferedIOBase):
5055  * """File-like object for handling SIONlib files"""
5056  * valid_par_modes = ("serial", "mpi") # <<<<<<<<<<<<<<
5057  *
5058  * def __init__(self, par_mode=DEFAULT_PAR_MODE):
5059  */
5060  __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_u_serial, __pyx_n_u_mpi); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5061  __Pyx_GOTREF(__pyx_tuple__13);
5062  __Pyx_GIVEREF(__pyx_tuple__13);
5063 
5064  /* "sioninter.pyx":48
5065  * valid_par_modes = ("serial", "mpi")
5066  *
5067  * def __init__(self, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
5068  * self._fname = ""
5069  * self._file_mode = ""
5070  */
5071  __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_par_mode); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5072  __Pyx_GOTREF(__pyx_tuple__14);
5073  __Pyx_GIVEREF(__pyx_tuple__14);
5074  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_init, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5075 
5076  /* "sioninter.pyx":57
5077  * self._par_mode = par_mode
5078  *
5079  * def open(self, fname, file_mode): # <<<<<<<<<<<<<<
5080  * """Open a file for reading or writing."""
5081  * self._fname = fname
5082  */
5083  __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_fname_2, __pyx_n_s_file_mode_2); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5084  __Pyx_GOTREF(__pyx_tuple__16);
5085  __Pyx_GIVEREF(__pyx_tuple__16);
5086  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_open, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5087 
5088  /* "sioninter.pyx":67
5089  *
5090  * @property
5091  * def closed(self): # <<<<<<<<<<<<<<
5092  * """Check whether sion file is closed."""
5093  * return self._sid == -1
5094  */
5095  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5096  __Pyx_GOTREF(__pyx_tuple__18);
5097  __Pyx_GIVEREF(__pyx_tuple__18);
5098  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_closed, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5099 
5100  /* "sioninter.pyx":71
5101  * return self._sid == -1
5102  *
5103  * def close(self): # <<<<<<<<<<<<<<
5104  * """Close sion file."""
5105  * if self._par_mode == "serial":
5106  */
5107  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5108  __Pyx_GOTREF(__pyx_tuple__20);
5109  __Pyx_GIVEREF(__pyx_tuple__20);
5110  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_close, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5111 
5112  /* "sioninter.pyx":81
5113  * self._sid = -1
5114  *
5115  * def write(self, data): # <<<<<<<<<<<<<<
5116  * """Write data."""
5117  * sion_fwrite(data, self._sid)
5118  */
5119  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5120  __Pyx_GOTREF(__pyx_tuple__22);
5121  __Pyx_GIVEREF(__pyx_tuple__22);
5122  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_write, 81, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5123 
5124  /* "sioninter.pyx":85
5125  * sion_fwrite(data, self._sid)
5126  *
5127  * def read(self, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5128  * """Read data."""
5129  * ret = sion_fread(self._sid, nitems)
5130  */
5131  __pyx_tuple__24 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_nitems, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5132  __Pyx_GOTREF(__pyx_tuple__24);
5133  __Pyx_GIVEREF(__pyx_tuple__24);
5134  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_read, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5135 
5136  /* "sioninter.pyx":90
5137  * return ret
5138  *
5139  * def write_key(self, data, key): # <<<<<<<<<<<<<<
5140  * """Write key value pair."""
5141  * sion_fwrite_key(data, key, self._sid)
5142  */
5143  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_key); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5144  __Pyx_GOTREF(__pyx_tuple__26);
5145  __Pyx_GIVEREF(__pyx_tuple__26);
5146  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_write_key, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5147 
5148  /* "sioninter.pyx":94
5149  * sion_fwrite_key(data, key, self._sid)
5150  *
5151  * def read_key(self, key, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5152  * """Read value for corresponding key."""
5153  * ret = sion_fread_key(key, self._sid, nitems)
5154  */
5155  __pyx_tuple__28 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_key, __pyx_n_s_nitems, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5156  __Pyx_GOTREF(__pyx_tuple__28);
5157  __Pyx_GIVEREF(__pyx_tuple__28);
5158  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_read_key, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5159 
5160  /* "sioninter.pyx":100
5161  *
5162  *
5163  * def open(fname, file_mode, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
5164  * """Open a file and return a SIONFile instance."""
5165  * sionfile = SIONFile(par_mode=par_mode)
5166  */
5167  __pyx_tuple__30 = PyTuple_Pack(4, __pyx_n_s_fname_2, __pyx_n_s_file_mode_2, __pyx_n_s_par_mode, __pyx_n_s_sionfile); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5168  __Pyx_GOTREF(__pyx_tuple__30);
5169  __Pyx_GIVEREF(__pyx_tuple__30);
5170  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_thust_src_sionlib_pythonin, __pyx_n_s_open, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5171  __Pyx_RefNannyFinishContext();
5172  return 0;
5173  __pyx_L1_error:;
5174  __Pyx_RefNannyFinishContext();
5175  return -1;
5176 }
5177 
5178 static int __Pyx_InitGlobals(void) {
5179  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5180  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5181  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5182  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5183  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5184  return 0;
5185  __pyx_L1_error:;
5186  return -1;
5187 }
5188 
5189 #if PY_MAJOR_VERSION < 3
5190 PyMODINIT_FUNC initsioninter(void); /*proto*/
5191 PyMODINIT_FUNC initsioninter(void)
5192 #else
5193 PyMODINIT_FUNC PyInit_sioninter(void); /*proto*/
5194 PyMODINIT_FUNC PyInit_sioninter(void)
5195 #endif
5196 {
5197  PyObject *__pyx_t_1 = NULL;
5198  PyObject *__pyx_t_2 = NULL;
5199  PyObject *__pyx_t_3 = NULL;
5200  PyObject *__pyx_t_4 = NULL;
5201  PyObject *__pyx_t_5 = NULL;
5202  int __pyx_lineno = 0;
5203  const char *__pyx_filename = NULL;
5204  int __pyx_clineno = 0;
5205  __Pyx_RefNannyDeclarations
5206  #if CYTHON_REFNANNY
5207  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
5208  if (!__Pyx_RefNanny) {
5209  PyErr_Clear();
5210  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
5211  if (!__Pyx_RefNanny)
5212  Py_FatalError("failed to import 'refnanny' module");
5213  }
5214  #endif
5215  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sioninter(void)", 0);
5216  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5217  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5218  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5219  #ifdef __Pyx_CyFunction_USED
5220  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5221  #endif
5222  #ifdef __Pyx_FusedFunction_USED
5223  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5224  #endif
5225  #ifdef __Pyx_Generator_USED
5226  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5227  #endif
5228  /*--- Library function declarations ---*/
5229  /*--- Threads initialization code ---*/
5230  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
5231  #ifdef WITH_THREAD /* Python build with threading support? */
5232  PyEval_InitThreads();
5233  #endif
5234  #endif
5235  /*--- Module creation code ---*/
5236  #if PY_MAJOR_VERSION < 3
5237  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sioninter"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_Interface_for_SIONlib_This_inter), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
5238  #else
5239  __pyx_m = PyModule_Create(&__pyx_moduledef);
5240  #endif
5241  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5242  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5243  Py_INCREF(__pyx_d);
5244  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5245  #if CYTHON_COMPILING_IN_PYPY
5246  Py_INCREF(__pyx_b);
5247  #endif
5248  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5249  /*--- Initialize various global constants etc. ---*/
5250  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5251  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
5252  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5253  #endif
5254  if (__pyx_module_is_main_sioninter) {
5255  if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
5256  }
5257  #if PY_MAJOR_VERSION >= 3
5258  {
5259  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5260  if (!PyDict_GetItemString(modules, "sioninter")) {
5261  if (unlikely(PyDict_SetItemString(modules, "sioninter", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5262  }
5263  }
5264  #endif
5265  /*--- Builtin init code ---*/
5266  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5267  /*--- Constants init code ---*/
5268  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5269  /*--- Global init code ---*/
5270  /*--- Variable export code ---*/
5271  /*--- Function export code ---*/
5272  /*--- Type init code ---*/
5273  /*--- Type import code ---*/
5274  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
5275  #if CYTHON_COMPILING_IN_PYPY
5276  sizeof(PyTypeObject),
5277  #else
5278  sizeof(PyHeapTypeObject),
5279  #endif
5280  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5281  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5282  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5283  __pyx_ptype_7cpython_5array_array = __Pyx_ImportType("array", "array", sizeof(arrayobject), 0); if (unlikely(!__pyx_ptype_7cpython_5array_array)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5284  /*--- Variable import code ---*/
5285  /*--- Function import code ---*/
5286  /*--- Execution code ---*/
5287 
5288  /* "sioninter.pyx":13
5289  *
5290  * from cpython cimport array
5291  * from array import array # <<<<<<<<<<<<<<
5292  * import io
5293  *
5294  */
5295  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5296  __Pyx_GOTREF(__pyx_t_1);
5297  __Pyx_INCREF(__pyx_n_s_array);
5298  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_array);
5299  __Pyx_GIVEREF(__pyx_n_s_array);
5300  __pyx_t_2 = __Pyx_Import(__pyx_n_s_array, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5301  __Pyx_GOTREF(__pyx_t_2);
5302  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5303  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5304  __Pyx_GOTREF(__pyx_t_1);
5305  if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5306  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5307  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5308 
5309  /* "sioninter.pyx":14
5310  * from cpython cimport array
5311  * from array import array
5312  * import io # <<<<<<<<<<<<<<
5313  *
5314  * cimport csioninter
5315  */
5316  __pyx_t_2 = __Pyx_Import(__pyx_n_s_io, 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5317  __Pyx_GOTREF(__pyx_t_2);
5318  if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5319  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5320 
5321  /* "sioninter.pyx":19
5322  * from csioninter cimport sion_int32, sion_int64, MPI_Comm, uint64_t
5323  *
5324  * from mpi4py import MPI # <<<<<<<<<<<<<<
5325  * from mpi4py.mpi_c cimport MPI_COMM_WORLD
5326  *
5327  */
5328  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5329  __Pyx_GOTREF(__pyx_t_2);
5330  __Pyx_INCREF(__pyx_n_s_MPI);
5331  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_MPI);
5332  __Pyx_GIVEREF(__pyx_n_s_MPI);
5333  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5334  __Pyx_GOTREF(__pyx_t_1);
5335  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5336  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_MPI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5337  __Pyx_GOTREF(__pyx_t_2);
5338  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MPI, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5339  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5340  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5341 
5342  /* "sioninter.pyx":23
5343  *
5344  * #### init
5345  * DEFAULT_PAR_MODE = "serial" # <<<<<<<<<<<<<<
5346  *
5347  * #### low level
5348  */
5349  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_PAR_MODE, __pyx_n_u_serial) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5350 
5351  /* "sioninter.pyx":28
5352  *
5353  * #### open
5354  * DEFAULT_NTASKS = 1 # <<<<<<<<<<<<<<
5355  * DEFAULT_NFILES = 1
5356  * DEFAULT_GCOMM = None
5357  */
5358  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_NTASKS, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5359 
5360  /* "sioninter.pyx":29
5361  * #### open
5362  * DEFAULT_NTASKS = 1
5363  * DEFAULT_NFILES = 1 # <<<<<<<<<<<<<<
5364  * DEFAULT_GCOMM = None
5365  * DEFAULT_LCOMM = None
5366  */
5367  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_NFILES, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5368 
5369  /* "sioninter.pyx":30
5370  * DEFAULT_NTASKS = 1
5371  * DEFAULT_NFILES = 1
5372  * DEFAULT_GCOMM = None # <<<<<<<<<<<<<<
5373  * DEFAULT_LCOMM = None
5374  * DEFAULT_CHUNKSIZE = 32
5375  */
5376  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_GCOMM, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5377 
5378  /* "sioninter.pyx":31
5379  * DEFAULT_NFILES = 1
5380  * DEFAULT_GCOMM = None
5381  * DEFAULT_LCOMM = None # <<<<<<<<<<<<<<
5382  * DEFAULT_CHUNKSIZE = 32
5383  * DEFAULT_CHUNKSIZES = None
5384  */
5385  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_LCOMM, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5386 
5387  /* "sioninter.pyx":32
5388  * DEFAULT_GCOMM = None
5389  * DEFAULT_LCOMM = None
5390  * DEFAULT_CHUNKSIZE = 32 # <<<<<<<<<<<<<<
5391  * DEFAULT_CHUNKSIZES = None
5392  * DEFAULT_FSBLKSIZE = -1
5393  */
5394  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_CHUNKSIZE, __pyx_int_32) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5395 
5396  /* "sioninter.pyx":33
5397  * DEFAULT_LCOMM = None
5398  * DEFAULT_CHUNKSIZE = 32
5399  * DEFAULT_CHUNKSIZES = None # <<<<<<<<<<<<<<
5400  * DEFAULT_FSBLKSIZE = -1
5401  * DEFAULT_GLOBALRANK = -1
5402  */
5403  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_CHUNKSIZES, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5404 
5405  /* "sioninter.pyx":34
5406  * DEFAULT_CHUNKSIZE = 32
5407  * DEFAULT_CHUNKSIZES = None
5408  * DEFAULT_FSBLKSIZE = -1 # <<<<<<<<<<<<<<
5409  * DEFAULT_GLOBALRANK = -1
5410  * DEFAULT_GLOBALRANKS = None
5411  */
5412  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FSBLKSIZE, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5413 
5414  /* "sioninter.pyx":35
5415  * DEFAULT_CHUNKSIZES = None
5416  * DEFAULT_FSBLKSIZE = -1
5417  * DEFAULT_GLOBALRANK = -1 # <<<<<<<<<<<<<<
5418  * DEFAULT_GLOBALRANKS = None
5419  * DEFAULT_FILEPTR = None
5420  */
5421  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_GLOBALRANK, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5422 
5423  /* "sioninter.pyx":36
5424  * DEFAULT_FSBLKSIZE = -1
5425  * DEFAULT_GLOBALRANK = -1
5426  * DEFAULT_GLOBALRANKS = None # <<<<<<<<<<<<<<
5427  * DEFAULT_FILEPTR = None
5428  *
5429  */
5430  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_GLOBALRANKS, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5431 
5432  /* "sioninter.pyx":37
5433  * DEFAULT_GLOBALRANK = -1
5434  * DEFAULT_GLOBALRANKS = None
5435  * DEFAULT_FILEPTR = None # <<<<<<<<<<<<<<
5436  *
5437  * #### read / write
5438  */
5439  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILEPTR, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5440 
5441  /* "sioninter.pyx":40
5442  *
5443  * #### read / write
5444  * DEFAULT_NITEMS = 0 # <<<<<<<<<<<<<<
5445  * DEFAULT_SIZE = 1
5446  *
5447  */
5448  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_NITEMS, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5449 
5450  /* "sioninter.pyx":41
5451  * #### read / write
5452  * DEFAULT_NITEMS = 0
5453  * DEFAULT_SIZE = 1 # <<<<<<<<<<<<<<
5454  *
5455  *
5456  */
5457  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_SIZE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5458 
5459  /* "sioninter.pyx":44
5460  *
5461  *
5462  * class SIONFile(io.BufferedIOBase): # <<<<<<<<<<<<<<
5463  * """File-like object for handling SIONlib files"""
5464  * valid_par_modes = ("serial", "mpi")
5465  */
5466  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5467  __Pyx_GOTREF(__pyx_t_1);
5468  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_BufferedIOBase); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5469  __Pyx_GOTREF(__pyx_t_2);
5470  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5471  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5472  __Pyx_GOTREF(__pyx_t_1);
5473  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
5474  __Pyx_GIVEREF(__pyx_t_2);
5475  __pyx_t_2 = 0;
5476  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5477  __Pyx_GOTREF(__pyx_t_2);
5478  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_SIONFile, __pyx_n_s_SIONFile, (PyObject *) NULL, __pyx_n_s_sioninter, __pyx_kp_s_File_like_object_for_handling_SI); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5479  __Pyx_GOTREF(__pyx_t_3);
5480 
5481  /* "sioninter.pyx":46
5482  * class SIONFile(io.BufferedIOBase):
5483  * """File-like object for handling SIONlib files"""
5484  * valid_par_modes = ("serial", "mpi") # <<<<<<<<<<<<<<
5485  *
5486  * def __init__(self, par_mode=DEFAULT_PAR_MODE):
5487  */
5488  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_valid_par_modes, __pyx_tuple__13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5489 
5490  /* "sioninter.pyx":48
5491  * valid_par_modes = ("serial", "mpi")
5492  *
5493  * def __init__(self, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
5494  * self._fname = ""
5495  * self._file_mode = ""
5496  */
5497  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_1__init__, 0, __pyx_n_s_SIONFile___init, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5498  __Pyx_GOTREF(__pyx_t_4);
5499  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_4, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5500  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_PAR_MODE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5501  __Pyx_GOTREF(__pyx_t_5);
5502  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_4)->__pyx_arg_par_mode = __pyx_t_5;
5503  __Pyx_GIVEREF(__pyx_t_5);
5504  __pyx_t_5 = 0;
5505  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_4, __pyx_pf_9sioninter_8SIONFile_16__defaults__);
5506  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5507  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5508 
5509  /* "sioninter.pyx":57
5510  * self._par_mode = par_mode
5511  *
5512  * def open(self, fname, file_mode): # <<<<<<<<<<<<<<
5513  * """Open a file for reading or writing."""
5514  * self._fname = fname
5515  */
5516  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_3open, 0, __pyx_n_s_SIONFile_open, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5517  __Pyx_GOTREF(__pyx_t_4);
5518  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_open, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5519  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5520 
5521  /* "sioninter.pyx":67
5522  *
5523  * @property
5524  * def closed(self): # <<<<<<<<<<<<<<
5525  * """Check whether sion file is closed."""
5526  * return self._sid == -1
5527  */
5528  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_5closed, 0, __pyx_n_s_SIONFile_closed, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5529  __Pyx_GOTREF(__pyx_t_4);
5530 
5531  /* "sioninter.pyx":66
5532  * self._sid = sion_paropen_mpi(fname, file_mode)
5533  *
5534  * @property # <<<<<<<<<<<<<<
5535  * def closed(self):
5536  * """Check whether sion file is closed."""
5537  */
5538  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5539  __Pyx_GOTREF(__pyx_t_5);
5540  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
5541  __Pyx_GIVEREF(__pyx_t_4);
5542  __pyx_t_4 = 0;
5543  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5544  __Pyx_GOTREF(__pyx_t_4);
5545  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5546  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_closed, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5547  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5548 
5549  /* "sioninter.pyx":71
5550  * return self._sid == -1
5551  *
5552  * def close(self): # <<<<<<<<<<<<<<
5553  * """Close sion file."""
5554  * if self._par_mode == "serial":
5555  */
5556  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_7close, 0, __pyx_n_s_SIONFile_close, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5557  __Pyx_GOTREF(__pyx_t_4);
5558  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_close, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5559  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5560 
5561  /* "sioninter.pyx":81
5562  * self._sid = -1
5563  *
5564  * def write(self, data): # <<<<<<<<<<<<<<
5565  * """Write data."""
5566  * sion_fwrite(data, self._sid)
5567  */
5568  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_9write, 0, __pyx_n_s_SIONFile_write, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5569  __Pyx_GOTREF(__pyx_t_4);
5570  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_write, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5571  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5572 
5573  /* "sioninter.pyx":85
5574  * sion_fwrite(data, self._sid)
5575  *
5576  * def read(self, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5577  * """Read data."""
5578  * ret = sion_fread(self._sid, nitems)
5579  */
5580  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_11read, 0, __pyx_n_s_SIONFile_read, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5581  __Pyx_GOTREF(__pyx_t_4);
5582  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_4, sizeof(__pyx_defaults1), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5583  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5584  __Pyx_GOTREF(__pyx_t_5);
5585  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_4)->__pyx_arg_nitems = __pyx_t_5;
5586  __Pyx_GIVEREF(__pyx_t_5);
5587  __pyx_t_5 = 0;
5588  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_4, __pyx_pf_9sioninter_8SIONFile_18__defaults__);
5589  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_read, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5590  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5591 
5592  /* "sioninter.pyx":90
5593  * return ret
5594  *
5595  * def write_key(self, data, key): # <<<<<<<<<<<<<<
5596  * """Write key value pair."""
5597  * sion_fwrite_key(data, key, self._sid)
5598  */
5599  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_13write_key, 0, __pyx_n_s_SIONFile_write_key, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5600  __Pyx_GOTREF(__pyx_t_4);
5601  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_write_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5602  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5603 
5604  /* "sioninter.pyx":94
5605  * sion_fwrite_key(data, key, self._sid)
5606  *
5607  * def read_key(self, key, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5608  * """Read value for corresponding key."""
5609  * ret = sion_fread_key(key, self._sid, nitems)
5610  */
5611  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9sioninter_8SIONFile_15read_key, 0, __pyx_n_s_SIONFile_read_key, NULL, __pyx_n_s_sioninter, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5612  __Pyx_GOTREF(__pyx_t_4);
5613  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_4, sizeof(__pyx_defaults2), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5614  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5615  __Pyx_GOTREF(__pyx_t_5);
5616  __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_4)->__pyx_arg_nitems = __pyx_t_5;
5617  __Pyx_GIVEREF(__pyx_t_5);
5618  __pyx_t_5 = 0;
5619  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_4, __pyx_pf_9sioninter_8SIONFile_20__defaults__);
5620  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_read_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5621  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5622 
5623  /* "sioninter.pyx":44
5624  *
5625  *
5626  * class SIONFile(io.BufferedIOBase): # <<<<<<<<<<<<<<
5627  * """File-like object for handling SIONlib files"""
5628  * valid_par_modes = ("serial", "mpi")
5629  */
5630  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SIONFile, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5631  __Pyx_GOTREF(__pyx_t_4);
5632  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SIONFile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5633  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5634  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5635  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5636  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5637 
5638  /* "sioninter.pyx":100
5639  *
5640  *
5641  * def open(fname, file_mode, par_mode=DEFAULT_PAR_MODE): # <<<<<<<<<<<<<<
5642  * """Open a file and return a SIONFile instance."""
5643  * sionfile = SIONFile(par_mode=par_mode)
5644  */
5645  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_PAR_MODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5646  __Pyx_GOTREF(__pyx_t_1);
5647  __pyx_k__2 = __pyx_t_1;
5648  __Pyx_GIVEREF(__pyx_t_1);
5649  __pyx_t_1 = 0;
5650  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9sioninter_1open, NULL, __pyx_n_s_sioninter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5651  __Pyx_GOTREF(__pyx_t_1);
5652  if (PyDict_SetItem(__pyx_d, __pyx_n_s_open, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5653  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5654 
5655  /* "sioninter.pyx":107
5656  *
5657  *
5658  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
5659  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE,
5660  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
5661  */
5662  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NTASKS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5663  __Pyx_GOTREF(__pyx_t_1);
5664  __pyx_k__3 = __pyx_t_1;
5665  __Pyx_GIVEREF(__pyx_t_1);
5666  __pyx_t_1 = 0;
5667  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NFILES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5668  __Pyx_GOTREF(__pyx_t_1);
5669  __pyx_k__4 = __pyx_t_1;
5670  __Pyx_GIVEREF(__pyx_t_1);
5671  __pyx_t_1 = 0;
5672 
5673  /* "sioninter.pyx":108
5674  *
5675  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES,
5676  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE, # <<<<<<<<<<<<<<
5677  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR):
5678  * """Open a file and return a sion id."""
5679  */
5680  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_CHUNKSIZES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5681  __Pyx_GOTREF(__pyx_t_1);
5682  __pyx_k__32 = __pyx_t_1;
5683  __Pyx_GIVEREF(__pyx_t_1);
5684  __pyx_t_1 = 0;
5685  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_FSBLKSIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5686  __Pyx_GOTREF(__pyx_t_1);
5687  __pyx_k__5 = __pyx_t_1;
5688  __Pyx_GIVEREF(__pyx_t_1);
5689  __pyx_t_1 = 0;
5690 
5691  /* "sioninter.pyx":109
5692  * cdef sion_open(fname, file_mode, ntasks=DEFAULT_NTASKS, nfiles=DEFAULT_NFILES,
5693  * chunksizes=DEFAULT_CHUNKSIZES, fsblksize=DEFAULT_FSBLKSIZE,
5694  * globalranks=DEFAULT_GLOBALRANKS, fileptr=DEFAULT_FILEPTR): # <<<<<<<<<<<<<<
5695  * """Open a file and return a sion id."""
5696  * cdef int _ntasks = ntasks
5697  */
5698  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_GLOBALRANKS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5699  __Pyx_GOTREF(__pyx_t_1);
5700  __pyx_k__33 = __pyx_t_1;
5701  __Pyx_GIVEREF(__pyx_t_1);
5702  __pyx_t_1 = 0;
5703  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_FILEPTR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5704  __Pyx_GOTREF(__pyx_t_1);
5705  __pyx_k__34 = __pyx_t_1;
5706  __Pyx_GIVEREF(__pyx_t_1);
5707  __pyx_t_1 = 0;
5708 
5709  /* "sioninter.pyx":144
5710  *
5711  *
5712  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES, # <<<<<<<<<<<<<<
5713  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
5714  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
5715  */
5716  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NFILES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5717  __Pyx_GOTREF(__pyx_t_1);
5718  __pyx_k__6 = __pyx_t_1;
5719  __Pyx_GIVEREF(__pyx_t_1);
5720  __pyx_t_1 = 0;
5721 
5722  /* "sioninter.pyx":145
5723  *
5724  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES,
5725  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM, # <<<<<<<<<<<<<<
5726  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
5727  * globalrank=DEFAULT_GLOBALRANK, fileptr=DEFAULT_FILEPTR):
5728  */
5729  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_GCOMM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5730  __Pyx_GOTREF(__pyx_t_1);
5731  __pyx_k__35 = __pyx_t_1;
5732  __Pyx_GIVEREF(__pyx_t_1);
5733  __pyx_t_1 = 0;
5734  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_LCOMM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5735  __Pyx_GOTREF(__pyx_t_1);
5736  __pyx_k__36 = __pyx_t_1;
5737  __Pyx_GIVEREF(__pyx_t_1);
5738  __pyx_t_1 = 0;
5739 
5740  /* "sioninter.pyx":146
5741  * cdef sion_paropen_mpi(fname, file_mode, nfiles=DEFAULT_NFILES,
5742  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
5743  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE, # <<<<<<<<<<<<<<
5744  * globalrank=DEFAULT_GLOBALRANK, fileptr=DEFAULT_FILEPTR):
5745  * """Open a file and return a sion id."""
5746  */
5747  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_CHUNKSIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5748  __Pyx_GOTREF(__pyx_t_1);
5749  __pyx_k__7 = __pyx_t_1;
5750  __Pyx_GIVEREF(__pyx_t_1);
5751  __pyx_t_1 = 0;
5752  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_FSBLKSIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5753  __Pyx_GOTREF(__pyx_t_1);
5754  __pyx_k__8 = __pyx_t_1;
5755  __Pyx_GIVEREF(__pyx_t_1);
5756  __pyx_t_1 = 0;
5757 
5758  /* "sioninter.pyx":147
5759  * gComm=DEFAULT_GCOMM, lComm=DEFAULT_LCOMM,
5760  * chunksize=DEFAULT_CHUNKSIZE, fsblksize=DEFAULT_FSBLKSIZE,
5761  * globalrank=DEFAULT_GLOBALRANK, fileptr=DEFAULT_FILEPTR): # <<<<<<<<<<<<<<
5762  * """Open a file and return a sion id."""
5763  * cdef int _nfiles = nfiles
5764  */
5765  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_GLOBALRANK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5766  __Pyx_GOTREF(__pyx_t_1);
5767  __pyx_k__9 = __pyx_t_1;
5768  __Pyx_GIVEREF(__pyx_t_1);
5769  __pyx_t_1 = 0;
5770  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_FILEPTR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5771  __Pyx_GOTREF(__pyx_t_1);
5772  __pyx_k__37 = __pyx_t_1;
5773  __Pyx_GIVEREF(__pyx_t_1);
5774  __pyx_t_1 = 0;
5775 
5776  /* "sioninter.pyx":191
5777  *
5778  *
5779  * cdef sion_fread(sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5780  * """Read data from file."""
5781  * cdef size_t _size = DEFAULT_SIZE
5782  */
5783  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5784  __Pyx_GOTREF(__pyx_t_1);
5785  __pyx_k__10 = __pyx_t_1;
5786  __Pyx_GIVEREF(__pyx_t_1);
5787  __pyx_t_1 = 0;
5788 
5789  /* "sioninter.pyx":227
5790  *
5791  *
5792  * cpdef sion_fread_key(key, sid, nitems=DEFAULT_NITEMS): # <<<<<<<<<<<<<<
5793  * """Read value for corresponding key."""
5794  * cdef size_t _size = DEFAULT_SIZE
5795  */
5796  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_NITEMS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5797  __Pyx_GOTREF(__pyx_t_1);
5798  __pyx_k__12 = __pyx_t_1;
5799  __Pyx_GIVEREF(__pyx_t_1);
5800  __pyx_t_1 = 0;
5801 
5802  /* "sioninter.pyx":1
5803  * # -*- python -*- # <<<<<<<<<<<<<<
5804  * """Interface for SIONlib
5805  *
5806  */
5807  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5808  __Pyx_GOTREF(__pyx_t_1);
5809  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5810  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5811 
5812  /* "array.pxd":159
5813  * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
5814  *
5815  * cdef inline void zero(array self): # <<<<<<<<<<<<<<
5816  * """ set all elements of array to zero. """
5817  * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
5818  */
5819  goto __pyx_L0;
5820  __pyx_L1_error:;
5821  __Pyx_XDECREF(__pyx_t_1);
5822  __Pyx_XDECREF(__pyx_t_2);
5823  __Pyx_XDECREF(__pyx_t_3);
5824  __Pyx_XDECREF(__pyx_t_4);
5825  __Pyx_XDECREF(__pyx_t_5);
5826  if (__pyx_m) {
5827  __Pyx_AddTraceback("init sioninter", __pyx_clineno, __pyx_lineno, __pyx_filename);
5828  Py_DECREF(__pyx_m); __pyx_m = 0;
5829  } else if (!PyErr_Occurred()) {
5830  PyErr_SetString(PyExc_ImportError, "init sioninter");
5831  }
5832  __pyx_L0:;
5833  __Pyx_RefNannyFinishContext();
5834  #if PY_MAJOR_VERSION < 3
5835  return;
5836  #else
5837  return __pyx_m;
5838  #endif
5839 }
5840 
5841 /* Runtime support code */
5842 #if CYTHON_REFNANNY
5843 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5844  PyObject *m = NULL, *p = NULL;
5845  void *r = NULL;
5846  m = PyImport_ImportModule((char *)modname);
5847  if (!m) goto end;
5848  p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
5849  if (!p) goto end;
5850  r = PyLong_AsVoidPtr(p);
5851 end:
5852  Py_XDECREF(p);
5853  Py_XDECREF(m);
5854  return (__Pyx_RefNannyAPIStruct *)r;
5855 }
5856 #endif /* CYTHON_REFNANNY */
5857 
5858 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5859  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5860  if (unlikely(!result)) {
5861  PyErr_Format(PyExc_NameError,
5862 #if PY_MAJOR_VERSION >= 3
5863  "name '%U' is not defined", name);
5864 #else
5865  "name '%.200s' is not defined", PyString_AS_STRING(name));
5866 #endif
5867  }
5868  return result;
5869 }
5870 
5871 static void __Pyx_RaiseDoubleKeywordsError(
5872  const char* func_name,
5873  PyObject* kw_name)
5874 {
5875  PyErr_Format(PyExc_TypeError,
5876  #if PY_MAJOR_VERSION >= 3
5877  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5878  #else
5879  "%s() got multiple values for keyword argument '%s'", func_name,
5880  PyString_AsString(kw_name));
5881  #endif
5882 }
5883 
5884 static int __Pyx_ParseOptionalKeywords(
5885  PyObject *kwds,
5886  PyObject **argnames[],
5887  PyObject *kwds2,
5888  PyObject *values[],
5889  Py_ssize_t num_pos_args,
5890  const char* function_name)
5891 {
5892  PyObject *key = 0, *value = 0;
5893  Py_ssize_t pos = 0;
5894  PyObject*** name;
5895  PyObject*** first_kw_arg = argnames + num_pos_args;
5896  while (PyDict_Next(kwds, &pos, &key, &value)) {
5897  name = first_kw_arg;
5898  while (*name && (**name != key)) name++;
5899  if (*name) {
5900  values[name-argnames] = value;
5901  continue;
5902  }
5903  name = first_kw_arg;
5904  #if PY_MAJOR_VERSION < 3
5905  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
5906  while (*name) {
5907  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
5908  && _PyString_Eq(**name, key)) {
5909  values[name-argnames] = value;
5910  break;
5911  }
5912  name++;
5913  }
5914  if (*name) continue;
5915  else {
5916  PyObject*** argname = argnames;
5917  while (argname != first_kw_arg) {
5918  if ((**argname == key) || (
5919  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
5920  && _PyString_Eq(**argname, key))) {
5921  goto arg_passed_twice;
5922  }
5923  argname++;
5924  }
5925  }
5926  } else
5927  #endif
5928  if (likely(PyUnicode_Check(key))) {
5929  while (*name) {
5930  int cmp = (**name == key) ? 0 :
5931  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5932  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
5933  #endif
5934  PyUnicode_Compare(**name, key);
5935  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5936  if (cmp == 0) {
5937  values[name-argnames] = value;
5938  break;
5939  }
5940  name++;
5941  }
5942  if (*name) continue;
5943  else {
5944  PyObject*** argname = argnames;
5945  while (argname != first_kw_arg) {
5946  int cmp = (**argname == key) ? 0 :
5947  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5948  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
5949  #endif
5950  PyUnicode_Compare(**argname, key);
5951  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5952  if (cmp == 0) goto arg_passed_twice;
5953  argname++;
5954  }
5955  }
5956  } else
5957  goto invalid_keyword_type;
5958  if (kwds2) {
5959  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
5960  } else {
5961  goto invalid_keyword;
5962  }
5963  }
5964  return 0;
5965 arg_passed_twice:
5966  __Pyx_RaiseDoubleKeywordsError(function_name, key);
5967  goto bad;
5968 invalid_keyword_type:
5969  PyErr_Format(PyExc_TypeError,
5970  "%.200s() keywords must be strings", function_name);
5971  goto bad;
5972 invalid_keyword:
5973  PyErr_Format(PyExc_TypeError,
5974  #if PY_MAJOR_VERSION < 3
5975  "%.200s() got an unexpected keyword argument '%.200s'",
5976  function_name, PyString_AsString(key));
5977  #else
5978  "%s() got an unexpected keyword argument '%U'",
5979  function_name, key);
5980  #endif
5981 bad:
5982  return -1;
5983 }
5984 
5985 static void __Pyx_RaiseArgtupleInvalid(
5986  const char* func_name,
5987  int exact,
5988  Py_ssize_t num_min,
5989  Py_ssize_t num_max,
5990  Py_ssize_t num_found)
5991 {
5992  Py_ssize_t num_expected;
5993  const char *more_or_less;
5994  if (num_found < num_min) {
5995  num_expected = num_min;
5996  more_or_less = "at least";
5997  } else {
5998  num_expected = num_max;
5999  more_or_less = "at most";
6000  }
6001  if (exact) {
6002  more_or_less = "exactly";
6003  }
6004  PyErr_Format(PyExc_TypeError,
6005  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6006  func_name, more_or_less, num_expected,
6007  (num_expected == 1) ? "" : "s", num_found);
6008 }
6009 
6010 #if CYTHON_COMPILING_IN_CPYTHON
6011 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6012  PyObject *result;
6013  ternaryfunc call = func->ob_type->tp_call;
6014  if (unlikely(!call))
6015  return PyObject_Call(func, arg, kw);
6016 #if PY_VERSION_HEX >= 0x02060000
6017  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6018  return NULL;
6019 #endif
6020  result = (*call)(func, arg, kw);
6021 #if PY_VERSION_HEX >= 0x02060000
6022  Py_LeaveRecursiveCall();
6023 #endif
6024  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6025  PyErr_SetString(
6026  PyExc_SystemError,
6027  "NULL result without error in PyObject_Call");
6028  }
6029  return result;
6030 }
6031 #endif
6032 
6033 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
6034 #if CYTHON_COMPILING_IN_CPYTHON
6035  PyObject *tmp_type, *tmp_value, *tmp_tb;
6036  PyThreadState *tstate = PyThreadState_GET();
6037  tmp_type = tstate->curexc_type;
6038  tmp_value = tstate->curexc_value;
6039  tmp_tb = tstate->curexc_traceback;
6040  tstate->curexc_type = type;
6041  tstate->curexc_value = value;
6042  tstate->curexc_traceback = tb;
6043  Py_XDECREF(tmp_type);
6044  Py_XDECREF(tmp_value);
6045  Py_XDECREF(tmp_tb);
6046 #else
6047  PyErr_Restore(type, value, tb);
6048 #endif
6049 }
6050 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
6051 #if CYTHON_COMPILING_IN_CPYTHON
6052  PyThreadState *tstate = PyThreadState_GET();
6053  *type = tstate->curexc_type;
6054  *value = tstate->curexc_value;
6055  *tb = tstate->curexc_traceback;
6056  tstate->curexc_type = 0;
6057  tstate->curexc_value = 0;
6058  tstate->curexc_traceback = 0;
6059 #else
6060  PyErr_Fetch(type, value, tb);
6061 #endif
6062 }
6063 
6064 #if PY_MAJOR_VERSION < 3
6065 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6066  CYTHON_UNUSED PyObject *cause) {
6067  Py_XINCREF(type);
6068  if (!value || value == Py_None)
6069  value = NULL;
6070  else
6071  Py_INCREF(value);
6072  if (!tb || tb == Py_None)
6073  tb = NULL;
6074  else {
6075  Py_INCREF(tb);
6076  if (!PyTraceBack_Check(tb)) {
6077  PyErr_SetString(PyExc_TypeError,
6078  "raise: arg 3 must be a traceback or None");
6079  goto raise_error;
6080  }
6081  }
6082  #if PY_VERSION_HEX < 0x02050000
6083  if (PyClass_Check(type)) {
6084  #else
6085  if (PyType_Check(type)) {
6086  #endif
6087 #if CYTHON_COMPILING_IN_PYPY
6088  if (!value) {
6089  Py_INCREF(Py_None);
6090  value = Py_None;
6091  }
6092 #endif
6093  PyErr_NormalizeException(&type, &value, &tb);
6094  } else {
6095  if (value) {
6096  PyErr_SetString(PyExc_TypeError,
6097  "instance exception may not have a separate value");
6098  goto raise_error;
6099  }
6100  value = type;
6101  #if PY_VERSION_HEX < 0x02050000
6102  if (PyInstance_Check(type)) {
6103  type = (PyObject*) ((PyInstanceObject*)type)->in_class;
6104  Py_INCREF(type);
6105  } else {
6106  type = 0;
6107  PyErr_SetString(PyExc_TypeError,
6108  "raise: exception must be an old-style class or instance");
6109  goto raise_error;
6110  }
6111  #else
6112  type = (PyObject*) Py_TYPE(type);
6113  Py_INCREF(type);
6114  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6115  PyErr_SetString(PyExc_TypeError,
6116  "raise: exception class must be a subclass of BaseException");
6117  goto raise_error;
6118  }
6119  #endif
6120  }
6121  __Pyx_ErrRestore(type, value, tb);
6122  return;
6123 raise_error:
6124  Py_XDECREF(value);
6125  Py_XDECREF(type);
6126  Py_XDECREF(tb);
6127  return;
6128 }
6129 #else /* Python 3+ */
6130 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6131  PyObject* owned_instance = NULL;
6132  if (tb == Py_None) {
6133  tb = 0;
6134  } else if (tb && !PyTraceBack_Check(tb)) {
6135  PyErr_SetString(PyExc_TypeError,
6136  "raise: arg 3 must be a traceback or None");
6137  goto bad;
6138  }
6139  if (value == Py_None)
6140  value = 0;
6141  if (PyExceptionInstance_Check(type)) {
6142  if (value) {
6143  PyErr_SetString(PyExc_TypeError,
6144  "instance exception may not have a separate value");
6145  goto bad;
6146  }
6147  value = type;
6148  type = (PyObject*) Py_TYPE(value);
6149  } else if (PyExceptionClass_Check(type)) {
6150  PyObject *instance_class = NULL;
6151  if (value && PyExceptionInstance_Check(value)) {
6152  instance_class = (PyObject*) Py_TYPE(value);
6153  if (instance_class != type) {
6154  if (PyObject_IsSubclass(instance_class, type)) {
6155  type = instance_class;
6156  } else {
6157  instance_class = NULL;
6158  }
6159  }
6160  }
6161  if (!instance_class) {
6162  PyObject *args;
6163  if (!value)
6164  args = PyTuple_New(0);
6165  else if (PyTuple_Check(value)) {
6166  Py_INCREF(value);
6167  args = value;
6168  } else
6169  args = PyTuple_Pack(1, value);
6170  if (!args)
6171  goto bad;
6172  owned_instance = PyObject_Call(type, args, NULL);
6173  Py_DECREF(args);
6174  if (!owned_instance)
6175  goto bad;
6176  value = owned_instance;
6177  if (!PyExceptionInstance_Check(value)) {
6178  PyErr_Format(PyExc_TypeError,
6179  "calling %R should have returned an instance of "
6180  "BaseException, not %R",
6181  type, Py_TYPE(value));
6182  goto bad;
6183  }
6184  }
6185  } else {
6186  PyErr_SetString(PyExc_TypeError,
6187  "raise: exception class must be a subclass of BaseException");
6188  goto bad;
6189  }
6190 #if PY_VERSION_HEX >= 0x03030000
6191  if (cause) {
6192 #else
6193  if (cause && cause != Py_None) {
6194 #endif
6195  PyObject *fixed_cause;
6196  if (cause == Py_None) {
6197  fixed_cause = NULL;
6198  } else if (PyExceptionClass_Check(cause)) {
6199  fixed_cause = PyObject_CallObject(cause, NULL);
6200  if (fixed_cause == NULL)
6201  goto bad;
6202  } else if (PyExceptionInstance_Check(cause)) {
6203  fixed_cause = cause;
6204  Py_INCREF(fixed_cause);
6205  } else {
6206  PyErr_SetString(PyExc_TypeError,
6207  "exception causes must derive from "
6208  "BaseException");
6209  goto bad;
6210  }
6211  PyException_SetCause(value, fixed_cause);
6212  }
6213  PyErr_SetObject(type, value);
6214  if (tb) {
6215  PyThreadState *tstate = PyThreadState_GET();
6216  PyObject* tmp_tb = tstate->curexc_traceback;
6217  if (tb != tmp_tb) {
6218  Py_INCREF(tb);
6219  tstate->curexc_traceback = tb;
6220  Py_XDECREF(tmp_tb);
6221  }
6222  }
6223 bad:
6224  Py_XDECREF(owned_instance);
6225  return;
6226 }
6227 #endif
6228 
6229 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
6230 #if CYTHON_COMPILING_IN_PYPY
6231  return PyObject_RichCompareBool(s1, s2, equals);
6232 #else
6233  if (s1 == s2) {
6234  return (equals == Py_EQ);
6235  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
6236  const char *ps1, *ps2;
6237  Py_ssize_t length = PyBytes_GET_SIZE(s1);
6238  if (length != PyBytes_GET_SIZE(s2))
6239  return (equals == Py_NE);
6240  ps1 = PyBytes_AS_STRING(s1);
6241  ps2 = PyBytes_AS_STRING(s2);
6242  if (ps1[0] != ps2[0]) {
6243  return (equals == Py_NE);
6244  } else if (length == 1) {
6245  return (equals == Py_EQ);
6246  } else {
6247  int result = memcmp(ps1, ps2, (size_t)length);
6248  return (equals == Py_EQ) ? (result == 0) : (result != 0);
6249  }
6250  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
6251  return (equals == Py_NE);
6252  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
6253  return (equals == Py_NE);
6254  } else {
6255  int result;
6256  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
6257  if (!py_result)
6258  return -1;
6259  result = __Pyx_PyObject_IsTrue(py_result);
6260  Py_DECREF(py_result);
6261  return result;
6262  }
6263 #endif
6264 }
6265 
6266 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
6267 #if CYTHON_COMPILING_IN_PYPY
6268  return PyObject_RichCompareBool(s1, s2, equals);
6269 #else
6270 #if PY_MAJOR_VERSION < 3
6271  PyObject* owned_ref = NULL;
6272 #endif
6273  int s1_is_unicode, s2_is_unicode;
6274  if (s1 == s2) {
6275  goto return_eq;
6276  }
6277  s1_is_unicode = PyUnicode_CheckExact(s1);
6278  s2_is_unicode = PyUnicode_CheckExact(s2);
6279 #if PY_MAJOR_VERSION < 3
6280  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
6281  owned_ref = PyUnicode_FromObject(s2);
6282  if (unlikely(!owned_ref))
6283  return -1;
6284  s2 = owned_ref;
6285  s2_is_unicode = 1;
6286  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
6287  owned_ref = PyUnicode_FromObject(s1);
6288  if (unlikely(!owned_ref))
6289  return -1;
6290  s1 = owned_ref;
6291  s1_is_unicode = 1;
6292  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
6293  return __Pyx_PyBytes_Equals(s1, s2, equals);
6294  }
6295 #endif
6296  if (s1_is_unicode & s2_is_unicode) {
6297  Py_ssize_t length;
6298  int kind;
6299  void *data1, *data2;
6300  #if CYTHON_PEP393_ENABLED
6301  if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
6302  return -1;
6303  #endif
6304  length = __Pyx_PyUnicode_GET_LENGTH(s1);
6305  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
6306  goto return_ne;
6307  }
6308  kind = __Pyx_PyUnicode_KIND(s1);
6309  if (kind != __Pyx_PyUnicode_KIND(s2)) {
6310  goto return_ne;
6311  }
6312  data1 = __Pyx_PyUnicode_DATA(s1);
6313  data2 = __Pyx_PyUnicode_DATA(s2);
6314  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
6315  goto return_ne;
6316  } else if (length == 1) {
6317  goto return_eq;
6318  } else {
6319  int result = memcmp(data1, data2, (size_t)(length * kind));
6320  #if PY_MAJOR_VERSION < 3
6321  Py_XDECREF(owned_ref);
6322  #endif
6323  return (equals == Py_EQ) ? (result == 0) : (result != 0);
6324  }
6325  } else if ((s1 == Py_None) & s2_is_unicode) {
6326  goto return_ne;
6327  } else if ((s2 == Py_None) & s1_is_unicode) {
6328  goto return_ne;
6329  } else {
6330  int result;
6331  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
6332  if (!py_result)
6333  return -1;
6334  result = __Pyx_PyObject_IsTrue(py_result);
6335  Py_DECREF(py_result);
6336  return result;
6337  }
6338 return_eq:
6339  #if PY_MAJOR_VERSION < 3
6340  Py_XDECREF(owned_ref);
6341  #endif
6342  return (equals == Py_EQ);
6343 return_ne:
6344  #if PY_MAJOR_VERSION < 3
6345  Py_XDECREF(owned_ref);
6346  #endif
6347  return (equals == Py_NE);
6348 #endif
6349 }
6350 
6351 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
6352  PyObject *result;
6353 #if CYTHON_COMPILING_IN_CPYTHON
6354  result = PyDict_GetItem(__pyx_d, name);
6355  if (result) {
6356  Py_INCREF(result);
6357  } else {
6358 #else
6359  result = PyObject_GetItem(__pyx_d, name);
6360  if (!result) {
6361  PyErr_Clear();
6362 #endif
6363  result = __Pyx_GetBuiltinName(name);
6364  }
6365  return result;
6366 }
6367 
6368 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
6369  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
6370  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
6371  PyErr_Format(PyExc_ImportError,
6372  #if PY_MAJOR_VERSION < 3
6373  "cannot import name %.230s", PyString_AS_STRING(name));
6374  #else
6375  "cannot import name %S", name);
6376  #endif
6377  }
6378  return value;
6379 }
6380 
6381 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
6382  Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
6383  for (i=0; i < nbases; i++) {
6384  PyTypeObject *tmptype;
6385  PyObject *tmp = PyTuple_GET_ITEM(bases, i);
6386  tmptype = Py_TYPE(tmp);
6387 #if PY_MAJOR_VERSION < 3
6388  if (tmptype == &PyClass_Type)
6389  continue;
6390 #endif
6391  if (!metaclass) {
6392  metaclass = tmptype;
6393  continue;
6394  }
6395  if (PyType_IsSubtype(metaclass, tmptype))
6396  continue;
6397  if (PyType_IsSubtype(tmptype, metaclass)) {
6398  metaclass = tmptype;
6399  continue;
6400  }
6401  PyErr_SetString(PyExc_TypeError,
6402  "metaclass conflict: "
6403  "the metaclass of a derived class "
6404  "must be a (non-strict) subclass "
6405  "of the metaclasses of all its bases");
6406  return NULL;
6407  }
6408  if (!metaclass) {
6409 #if PY_MAJOR_VERSION < 3
6410  metaclass = &PyClass_Type;
6411 #else
6412  metaclass = &PyType_Type;
6413 #endif
6414  }
6415  Py_INCREF((PyObject*) metaclass);
6416  return (PyObject*) metaclass;
6417 }
6418 
6419 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
6420  PyObject* fake_module;
6421  PyTypeObject* cached_type = NULL;
6422  fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
6423  if (!fake_module) return NULL;
6424  Py_INCREF(fake_module);
6425  cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
6426  if (cached_type) {
6427  if (!PyType_Check((PyObject*)cached_type)) {
6428  PyErr_Format(PyExc_TypeError,
6429  "Shared Cython type %.200s is not a type object",
6430  type->tp_name);
6431  goto bad;
6432  }
6433  if (cached_type->tp_basicsize != type->tp_basicsize) {
6434  PyErr_Format(PyExc_TypeError,
6435  "Shared Cython type %.200s has the wrong size, try recompiling",
6436  type->tp_name);
6437  goto bad;
6438  }
6439  } else {
6440  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
6441  PyErr_Clear();
6442  if (PyType_Ready(type) < 0) goto bad;
6443  if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
6444  goto bad;
6445  Py_INCREF(type);
6446  cached_type = type;
6447  }
6448 done:
6449  Py_DECREF(fake_module);
6450  return cached_type;
6451 bad:
6452  Py_XDECREF(cached_type);
6453  cached_type = NULL;
6454  goto done;
6455 }
6456 
6457 static PyObject *
6458 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
6459 {
6460  if (unlikely(op->func_doc == NULL)) {
6461  if (op->func.m_ml->ml_doc) {
6462 #if PY_MAJOR_VERSION >= 3
6463  op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
6464 #else
6465  op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
6466 #endif
6467  if (unlikely(op->func_doc == NULL))
6468  return NULL;
6469  } else {
6470  Py_INCREF(Py_None);
6471  return Py_None;
6472  }
6473  }
6474  Py_INCREF(op->func_doc);
6475  return op->func_doc;
6476 }
6477 static int
6478 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
6479 {
6480  PyObject *tmp = op->func_doc;
6481  if (value == NULL)
6482  value = Py_None; /* Mark as deleted */
6483  Py_INCREF(value);
6484  op->func_doc = value;
6485  Py_XDECREF(tmp);
6486  return 0;
6487 }
6488 static PyObject *
6489 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
6490 {
6491  if (unlikely(op->func_name == NULL)) {
6492 #if PY_MAJOR_VERSION >= 3
6493  op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
6494 #else
6495  op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
6496 #endif
6497  if (unlikely(op->func_name == NULL))
6498  return NULL;
6499  }
6500  Py_INCREF(op->func_name);
6501  return op->func_name;
6502 }
6503 static int
6504 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
6505 {
6506  PyObject *tmp;
6507 #if PY_MAJOR_VERSION >= 3
6508  if (unlikely(value == NULL || !PyUnicode_Check(value))) {
6509 #else
6510  if (unlikely(value == NULL || !PyString_Check(value))) {
6511 #endif
6512  PyErr_SetString(PyExc_TypeError,
6513  "__name__ must be set to a string object");
6514  return -1;
6515  }
6516  tmp = op->func_name;
6517  Py_INCREF(value);
6518  op->func_name = value;
6519  Py_XDECREF(tmp);
6520  return 0;
6521 }
6522 static PyObject *
6523 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
6524 {
6525  Py_INCREF(op->func_qualname);
6526  return op->func_qualname;
6527 }
6528 static int
6529 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
6530 {
6531  PyObject *tmp;
6532 #if PY_MAJOR_VERSION >= 3
6533  if (unlikely(value == NULL || !PyUnicode_Check(value))) {
6534 #else
6535  if (unlikely(value == NULL || !PyString_Check(value))) {
6536 #endif
6537  PyErr_SetString(PyExc_TypeError,
6538  "__qualname__ must be set to a string object");
6539  return -1;
6540  }
6541  tmp = op->func_qualname;
6542  Py_INCREF(value);
6543  op->func_qualname = value;
6544  Py_XDECREF(tmp);
6545  return 0;
6546 }
6547 static PyObject *
6548 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
6549 {
6550  PyObject *self;
6551  self = m->func_closure;
6552  if (self == NULL)
6553  self = Py_None;
6554  Py_INCREF(self);
6555  return self;
6556 }
6557 static PyObject *
6558 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
6559 {
6560  if (unlikely(op->func_dict == NULL)) {
6561  op->func_dict = PyDict_New();
6562  if (unlikely(op->func_dict == NULL))
6563  return NULL;
6564  }
6565  Py_INCREF(op->func_dict);
6566  return op->func_dict;
6567 }
6568 static int
6569 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
6570 {
6571  PyObject *tmp;
6572  if (unlikely(value == NULL)) {
6573  PyErr_SetString(PyExc_TypeError,
6574  "function's dictionary may not be deleted");
6575  return -1;
6576  }
6577  if (unlikely(!PyDict_Check(value))) {
6578  PyErr_SetString(PyExc_TypeError,
6579  "setting function's dictionary to a non-dict");
6580  return -1;
6581  }
6582  tmp = op->func_dict;
6583  Py_INCREF(value);
6584  op->func_dict = value;
6585  Py_XDECREF(tmp);
6586  return 0;
6587 }
6588 static PyObject *
6589 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
6590 {
6591  Py_INCREF(op->func_globals);
6592  return op->func_globals;
6593 }
6594 static PyObject *
6595 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
6596 {
6597  Py_INCREF(Py_None);
6598  return Py_None;
6599 }
6600 static PyObject *
6601 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
6602 {
6603  PyObject* result = (op->func_code) ? op->func_code : Py_None;
6604  Py_INCREF(result);
6605  return result;
6606 }
6607 static int
6608 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
6609  PyObject *res = op->defaults_getter((PyObject *) op);
6610  if (unlikely(!res))
6611  return -1;
6612  op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
6613  Py_INCREF(op->defaults_tuple);
6614  op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
6615  Py_INCREF(op->defaults_kwdict);
6616  Py_DECREF(res);
6617  return 0;
6618 }
6619 static int
6620 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
6621  PyObject* tmp;
6622  if (!value) {
6623  value = Py_None;
6624  } else if (value != Py_None && !PyTuple_Check(value)) {
6625  PyErr_SetString(PyExc_TypeError,
6626  "__defaults__ must be set to a tuple object");
6627  return -1;
6628  }
6629  Py_INCREF(value);
6630  tmp = op->defaults_tuple;
6631  op->defaults_tuple = value;
6632  Py_XDECREF(tmp);
6633  return 0;
6634 }
6635 static PyObject *
6636 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
6637  PyObject* result = op->defaults_tuple;
6638  if (unlikely(!result)) {
6639  if (op->defaults_getter) {
6640  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
6641  result = op->defaults_tuple;
6642  } else {
6643  result = Py_None;
6644  }
6645  }
6646  Py_INCREF(result);
6647  return result;
6648 }
6649 static int
6650 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
6651  PyObject* tmp;
6652  if (!value) {
6653  value = Py_None;
6654  } else if (value != Py_None && !PyDict_Check(value)) {
6655  PyErr_SetString(PyExc_TypeError,
6656  "__kwdefaults__ must be set to a dict object");
6657  return -1;
6658  }
6659  Py_INCREF(value);
6660  tmp = op->defaults_kwdict;
6661  op->defaults_kwdict = value;
6662  Py_XDECREF(tmp);
6663  return 0;
6664 }
6665 static PyObject *
6666 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
6667  PyObject* result = op->defaults_kwdict;
6668  if (unlikely(!result)) {
6669  if (op->defaults_getter) {
6670  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
6671  result = op->defaults_kwdict;
6672  } else {
6673  result = Py_None;
6674  }
6675  }
6676  Py_INCREF(result);
6677  return result;
6678 }
6679 static int
6680 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
6681  PyObject* tmp;
6682  if (!value || value == Py_None) {
6683  value = NULL;
6684  } else if (!PyDict_Check(value)) {
6685  PyErr_SetString(PyExc_TypeError,
6686  "__annotations__ must be set to a dict object");
6687  return -1;
6688  }
6689  Py_XINCREF(value);
6690  tmp = op->func_annotations;
6691  op->func_annotations = value;
6692  Py_XDECREF(tmp);
6693  return 0;
6694 }
6695 static PyObject *
6696 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
6697  PyObject* result = op->func_annotations;
6698  if (unlikely(!result)) {
6699  result = PyDict_New();
6700  if (unlikely(!result)) return NULL;
6701  op->func_annotations = result;
6702  }
6703  Py_INCREF(result);
6704  return result;
6705 }
6706 static PyGetSetDef __pyx_CyFunction_getsets[] = {
6707  {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
6708  {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
6709  {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
6710  {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
6711  {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
6712  {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
6713  {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
6714  {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
6715  {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
6716  {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
6717  {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
6718  {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
6719  {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
6720  {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
6721  {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
6722  {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
6723  {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
6724  {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
6725  {0, 0, 0, 0, 0}
6726 };
6727 #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
6728 #define PY_WRITE_RESTRICTED WRITE_RESTRICTED
6729 #endif
6730 static PyMemberDef __pyx_CyFunction_members[] = {
6731  {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
6732  {0, 0, 0, 0, 0}
6733 };
6734 static PyObject *
6735 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
6736 {
6737 #if PY_MAJOR_VERSION >= 3
6738  return PyUnicode_FromString(m->func.m_ml->ml_name);
6739 #else
6740  return PyString_FromString(m->func.m_ml->ml_name);
6741 #endif
6742 }
6743 static PyMethodDef __pyx_CyFunction_methods[] = {
6744  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
6745  {0, 0, 0, 0}
6746 };
6747 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
6748  PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
6749  __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
6750  if (op == NULL)
6751  return NULL;
6752  op->flags = flags;
6753  op->func_weakreflist = NULL;
6754  op->func.m_ml = ml;
6755  op->func.m_self = (PyObject *) op;
6756  Py_XINCREF(closure);
6757  op->func_closure = closure;
6758  Py_XINCREF(module);
6759  op->func.m_module = module;
6760  op->func_dict = NULL;
6761  op->func_name = NULL;
6762  Py_INCREF(qualname);
6763  op->func_qualname = qualname;
6764  op->func_doc = NULL;
6765  op->func_classobj = NULL;
6766  op->func_globals = globals;
6767  Py_INCREF(op->func_globals);
6768  Py_XINCREF(code);
6769  op->func_code = code;
6770  op->defaults_pyobjects = 0;
6771  op->defaults = NULL;
6772  op->defaults_tuple = NULL;
6773  op->defaults_kwdict = NULL;
6774  op->defaults_getter = NULL;
6775  op->func_annotations = NULL;
6776  PyObject_GC_Track(op);
6777  return (PyObject *) op;
6778 }
6779 static int
6780 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
6781 {
6782  Py_CLEAR(m->func_closure);
6783  Py_CLEAR(m->func.m_module);
6784  Py_CLEAR(m->func_dict);
6785  Py_CLEAR(m->func_name);
6786  Py_CLEAR(m->func_qualname);
6787  Py_CLEAR(m->func_doc);
6788  Py_CLEAR(m->func_globals);
6789  Py_CLEAR(m->func_code);
6790  Py_CLEAR(m->func_classobj);
6791  Py_CLEAR(m->defaults_tuple);
6792  Py_CLEAR(m->defaults_kwdict);
6793  Py_CLEAR(m->func_annotations);
6794  if (m->defaults) {
6795  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
6796  int i;
6797  for (i = 0; i < m->defaults_pyobjects; i++)
6798  Py_XDECREF(pydefaults[i]);
6799  PyMem_Free(m->defaults);
6800  m->defaults = NULL;
6801  }
6802  return 0;
6803 }
6804 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
6805 {
6806  PyObject_GC_UnTrack(m);
6807  if (m->func_weakreflist != NULL)
6808  PyObject_ClearWeakRefs((PyObject *) m);
6809  __Pyx_CyFunction_clear(m);
6810  PyObject_GC_Del(m);
6811 }
6812 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
6813 {
6814  Py_VISIT(m->func_closure);
6815  Py_VISIT(m->func.m_module);
6816  Py_VISIT(m->func_dict);
6817  Py_VISIT(m->func_name);
6818  Py_VISIT(m->func_qualname);
6819  Py_VISIT(m->func_doc);
6820  Py_VISIT(m->func_globals);
6821  Py_VISIT(m->func_code);
6822  Py_VISIT(m->func_classobj);
6823  Py_VISIT(m->defaults_tuple);
6824  Py_VISIT(m->defaults_kwdict);
6825  if (m->defaults) {
6826  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
6827  int i;
6828  for (i = 0; i < m->defaults_pyobjects; i++)
6829  Py_VISIT(pydefaults[i]);
6830  }
6831  return 0;
6832 }
6833 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
6834 {
6835  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6836  if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
6837  Py_INCREF(func);
6838  return func;
6839  }
6840  if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
6841  if (type == NULL)
6842  type = (PyObject *)(Py_TYPE(obj));
6843  return PyMethod_New(func,
6844  type, (PyObject *)(Py_TYPE(type)));
6845  }
6846  if (obj == Py_None)
6847  obj = NULL;
6848  return PyMethod_New(func, obj, type);
6849 }
6850 static PyObject*
6851 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
6852 {
6853 #if PY_MAJOR_VERSION >= 3
6854  return PyUnicode_FromFormat("<cyfunction %U at %p>",
6855  op->func_qualname, (void *)op);
6856 #else
6857  return PyString_FromFormat("<cyfunction %s at %p>",
6858  PyString_AsString(op->func_qualname), (void *)op);
6859 #endif
6860 }
6861 #if CYTHON_COMPILING_IN_PYPY
6862 static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6863  PyCFunctionObject* f = (PyCFunctionObject*)func;
6864  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6865  PyObject *self = PyCFunction_GET_SELF(func);
6866  Py_ssize_t size;
6867  switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
6868  case METH_VARARGS:
6869  if (likely(kw == NULL) || PyDict_Size(kw) == 0)
6870  return (*meth)(self, arg);
6871  break;
6872  case METH_VARARGS | METH_KEYWORDS:
6873  return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
6874  case METH_NOARGS:
6875  if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
6876  size = PyTuple_GET_SIZE(arg);
6877  if (size == 0)
6878  return (*meth)(self, NULL);
6879  PyErr_Format(PyExc_TypeError,
6880  "%.200s() takes no arguments (%zd given)",
6881  f->m_ml->ml_name, size);
6882  return NULL;
6883  }
6884  break;
6885  case METH_O:
6886  if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
6887  size = PyTuple_GET_SIZE(arg);
6888  if (size == 1)
6889  return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
6890  PyErr_Format(PyExc_TypeError,
6891  "%.200s() takes exactly one argument (%zd given)",
6892  f->m_ml->ml_name, size);
6893  return NULL;
6894  }
6895  break;
6896  default:
6897  PyErr_SetString(PyExc_SystemError, "Bad call flags in "
6898  "__Pyx_CyFunction_Call. METH_OLDARGS is no "
6899  "longer supported!");
6900  return NULL;
6901  }
6902  PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
6903  f->m_ml->ml_name);
6904  return NULL;
6905 }
6906 #else
6907 static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6908  return PyCFunction_Call(func, arg, kw);
6909 }
6910 #endif
6911 static PyTypeObject __pyx_CyFunctionType_type = {
6912  PyVarObject_HEAD_INIT(0, 0)
6913  __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
6914  sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
6915  0, /*tp_itemsize*/
6916  (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
6917  0, /*tp_print*/
6918  0, /*tp_getattr*/
6919  0, /*tp_setattr*/
6920 #if PY_MAJOR_VERSION < 3
6921  0, /*tp_compare*/
6922 #else
6923  0, /*reserved*/
6924 #endif
6925  (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
6926  0, /*tp_as_number*/
6927  0, /*tp_as_sequence*/
6928  0, /*tp_as_mapping*/
6929  0, /*tp_hash*/
6930  __Pyx_CyFunction_Call, /*tp_call*/
6931  0, /*tp_str*/
6932  0, /*tp_getattro*/
6933  0, /*tp_setattro*/
6934  0, /*tp_as_buffer*/
6935  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
6936  0, /*tp_doc*/
6937  (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
6938  (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
6939  0, /*tp_richcompare*/
6940  offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
6941  0, /*tp_iter*/
6942  0, /*tp_iternext*/
6943  __pyx_CyFunction_methods, /*tp_methods*/
6944  __pyx_CyFunction_members, /*tp_members*/
6945  __pyx_CyFunction_getsets, /*tp_getset*/
6946  0, /*tp_base*/
6947  0, /*tp_dict*/
6948  __Pyx_CyFunction_descr_get, /*tp_descr_get*/
6949  0, /*tp_descr_set*/
6950  offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
6951  0, /*tp_init*/
6952  0, /*tp_alloc*/
6953  0, /*tp_new*/
6954  0, /*tp_free*/
6955  0, /*tp_is_gc*/
6956  0, /*tp_bases*/
6957  0, /*tp_mro*/
6958  0, /*tp_cache*/
6959  0, /*tp_subclasses*/
6960  0, /*tp_weaklist*/
6961  0, /*tp_del*/
6962 #if PY_VERSION_HEX >= 0x02060000
6963  0, /*tp_version_tag*/
6964 #endif
6965 #if PY_VERSION_HEX >= 0x030400a1
6966  0, /*tp_finalize*/
6967 #endif
6968 };
6969 static int __Pyx_CyFunction_init(void) {
6970 #if !CYTHON_COMPILING_IN_PYPY
6971  __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
6972 #endif
6973  __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
6974  if (__pyx_CyFunctionType == NULL) {
6975  return -1;
6976  }
6977  return 0;
6978 }
6979 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
6980  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6981  m->defaults = PyMem_Malloc(size);
6982  if (!m->defaults)
6983  return PyErr_NoMemory();
6984  memset(m->defaults, 0, size);
6985  m->defaults_pyobjects = pyobjects;
6986  return m->defaults;
6987 }
6988 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
6989  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6990  m->defaults_tuple = tuple;
6991  Py_INCREF(tuple);
6992 }
6993 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
6994  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6995  m->defaults_kwdict = dict;
6996  Py_INCREF(dict);
6997 }
6998 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
6999  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
7000  m->func_annotations = dict;
7001  Py_INCREF(dict);
7002 }
7003 
7004 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
7005  PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
7006  PyObject *ns;
7007  if (metaclass) {
7008  PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
7009  if (prep) {
7010  PyObject *pargs = PyTuple_Pack(2, name, bases);
7011  if (unlikely(!pargs)) {
7012  Py_DECREF(prep);
7013  return NULL;
7014  }
7015  ns = PyObject_Call(prep, pargs, mkw);
7016  Py_DECREF(prep);
7017  Py_DECREF(pargs);
7018  } else {
7019  if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
7020  return NULL;
7021  PyErr_Clear();
7022  ns = PyDict_New();
7023  }
7024  } else {
7025  ns = PyDict_New();
7026  }
7027  if (unlikely(!ns))
7028  return NULL;
7029  if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
7030  if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
7031  if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
7032  return ns;
7033 bad:
7034  Py_DECREF(ns);
7035  return NULL;
7036 }
7037 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
7038  PyObject *dict, PyObject *mkw,
7039  int calculate_metaclass, int allow_py2_metaclass) {
7040  PyObject *result, *margs;
7041  PyObject *owned_metaclass = NULL;
7042  if (allow_py2_metaclass) {
7043  owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
7044  if (owned_metaclass) {
7045  metaclass = owned_metaclass;
7046  } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
7047  PyErr_Clear();
7048  } else {
7049  return NULL;
7050  }
7051  }
7052  if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
7053  metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
7054  Py_XDECREF(owned_metaclass);
7055  if (unlikely(!metaclass))
7056  return NULL;
7057  owned_metaclass = metaclass;
7058  }
7059  margs = PyTuple_Pack(3, name, bases, dict);
7060  if (unlikely(!margs)) {
7061  result = NULL;
7062  } else {
7063  result = PyObject_Call(metaclass, margs, mkw);
7064  Py_DECREF(margs);
7065  }
7066  Py_XDECREF(owned_metaclass);
7067  return result;
7068 }
7069 
7070 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
7071  PyObject *empty_list = 0;
7072  PyObject *module = 0;
7073  PyObject *global_dict = 0;
7074  PyObject *empty_dict = 0;
7075  PyObject *list;
7076  #if PY_VERSION_HEX < 0x03030000
7077  PyObject *py_import;
7078  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
7079  if (!py_import)
7080  goto bad;
7081  #endif
7082  if (from_list)
7083  list = from_list;
7084  else {
7085  empty_list = PyList_New(0);
7086  if (!empty_list)
7087  goto bad;
7088  list = empty_list;
7089  }
7090  global_dict = PyModule_GetDict(__pyx_m);
7091  if (!global_dict)
7092  goto bad;
7093  empty_dict = PyDict_New();
7094  if (!empty_dict)
7095  goto bad;
7096  #if PY_VERSION_HEX >= 0x02050000
7097  {
7098  #if PY_MAJOR_VERSION >= 3
7099  if (level == -1) {
7100  if (strchr(__Pyx_MODULE_NAME, '.')) {
7101  #if PY_VERSION_HEX < 0x03030000
7102  PyObject *py_level = PyInt_FromLong(1);
7103  if (!py_level)
7104  goto bad;
7105  module = PyObject_CallFunctionObjArgs(py_import,
7106  name, global_dict, empty_dict, list, py_level, NULL);
7107  Py_DECREF(py_level);
7108  #else
7109  module = PyImport_ImportModuleLevelObject(
7110  name, global_dict, empty_dict, list, 1);
7111  #endif
7112  if (!module) {
7113  if (!PyErr_ExceptionMatches(PyExc_ImportError))
7114  goto bad;
7115  PyErr_Clear();
7116  }
7117  }
7118  level = 0; /* try absolute import on failure */
7119  }
7120  #endif
7121  if (!module) {
7122  #if PY_VERSION_HEX < 0x03030000
7123  PyObject *py_level = PyInt_FromLong(level);
7124  if (!py_level)
7125  goto bad;
7126  module = PyObject_CallFunctionObjArgs(py_import,
7127  name, global_dict, empty_dict, list, py_level, NULL);
7128  Py_DECREF(py_level);
7129  #else
7130  module = PyImport_ImportModuleLevelObject(
7131  name, global_dict, empty_dict, list, level);
7132  #endif
7133  }
7134  }
7135  #else
7136  if (level>0) {
7137  PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
7138  goto bad;
7139  }
7140  module = PyObject_CallFunctionObjArgs(py_import,
7141  name, global_dict, empty_dict, list, NULL);
7142  #endif
7143 bad:
7144  #if PY_VERSION_HEX < 0x03030000
7145  Py_XDECREF(py_import);
7146  #endif
7147  Py_XDECREF(empty_list);
7148  Py_XDECREF(empty_dict);
7149  return module;
7150 }
7151 
7152 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \
7153  { \
7154  func_type value = func(x); \
7155  if (sizeof(target_type) < sizeof(func_type)) { \
7156  if (unlikely(value != (func_type) (target_type) value)) { \
7157  func_type zero = 0; \
7158  PyErr_SetString(PyExc_OverflowError, \
7159  (is_unsigned && unlikely(value < zero)) ? \
7160  "can't convert negative value to " #target_type : \
7161  "value too large to convert to " #target_type); \
7162  return (target_type) -1; \
7163  } \
7164  } \
7165  return (target_type) value; \
7166  }
7167 
7168 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7169  #if CYTHON_USE_PYLONG_INTERNALS
7170  #include "longintrepr.h"
7171  #endif
7172 #endif
7173 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
7174  const int neg_one = (int) -1, const_zero = 0;
7175  const int is_unsigned = neg_one > const_zero;
7176 #if PY_MAJOR_VERSION < 3
7177  if (likely(PyInt_Check(x))) {
7178  if (sizeof(int) < sizeof(long)) {
7179  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
7180  } else {
7181  long val = PyInt_AS_LONG(x);
7182  if (is_unsigned && unlikely(val < 0)) {
7183  PyErr_SetString(PyExc_OverflowError,
7184  "can't convert negative value to int");
7185  return (int) -1;
7186  }
7187  return (int) val;
7188  }
7189  } else
7190 #endif
7191  if (likely(PyLong_Check(x))) {
7192  if (is_unsigned) {
7193 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7194  #if CYTHON_USE_PYLONG_INTERNALS
7195  if (sizeof(digit) <= sizeof(int)) {
7196  switch (Py_SIZE(x)) {
7197  case 0: return 0;
7198  case 1: return (int) ((PyLongObject*)x)->ob_digit[0];
7199  }
7200  }
7201  #endif
7202 #endif
7203  if (unlikely(Py_SIZE(x) < 0)) {
7204  PyErr_SetString(PyExc_OverflowError,
7205  "can't convert negative value to int");
7206  return (int) -1;
7207  }
7208  if (sizeof(int) <= sizeof(unsigned long)) {
7209  __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
7210  } else if (sizeof(int) <= sizeof(unsigned long long)) {
7211  __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
7212  }
7213  } else {
7214 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7215  #if CYTHON_USE_PYLONG_INTERNALS
7216  if (sizeof(digit) <= sizeof(int)) {
7217  switch (Py_SIZE(x)) {
7218  case 0: return 0;
7219  case 1: return +(int) ((PyLongObject*)x)->ob_digit[0];
7220  case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
7221  }
7222  }
7223  #endif
7224 #endif
7225  if (sizeof(int) <= sizeof(long)) {
7226  __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
7227  } else if (sizeof(int) <= sizeof(long long)) {
7228  __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
7229  }
7230  }
7231  {
7232 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7233  PyErr_SetString(PyExc_RuntimeError,
7234  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7235 #else
7236  int val;
7237  PyObject *v = __Pyx_PyNumber_Int(x);
7238  #if PY_MAJOR_VERSION < 3
7239  if (likely(v) && !PyLong_Check(v)) {
7240  PyObject *tmp = v;
7241  v = PyNumber_Long(tmp);
7242  Py_DECREF(tmp);
7243  }
7244  #endif
7245  if (likely(v)) {
7246  int one = 1; int is_little = (int)*(unsigned char *)&one;
7247  unsigned char *bytes = (unsigned char *)&val;
7248  int ret = _PyLong_AsByteArray((PyLongObject *)v,
7249  bytes, sizeof(val),
7250  is_little, !is_unsigned);
7251  Py_DECREF(v);
7252  if (likely(!ret))
7253  return val;
7254  }
7255 #endif
7256  return (int) -1;
7257  }
7258  } else {
7259  int val;
7260  PyObject *tmp = __Pyx_PyNumber_Int(x);
7261  if (!tmp) return (int) -1;
7262  val = __Pyx_PyInt_As_int(tmp);
7263  Py_DECREF(tmp);
7264  return val;
7265  }
7266 }
7267 
7268 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7269  #if CYTHON_USE_PYLONG_INTERNALS
7270  #include "longintrepr.h"
7271  #endif
7272 #endif
7273 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
7274  const long neg_one = (long) -1, const_zero = 0;
7275  const int is_unsigned = neg_one > const_zero;
7276 #if PY_MAJOR_VERSION < 3
7277  if (likely(PyInt_Check(x))) {
7278  if (sizeof(long) < sizeof(long)) {
7279  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
7280  } else {
7281  long val = PyInt_AS_LONG(x);
7282  if (is_unsigned && unlikely(val < 0)) {
7283  PyErr_SetString(PyExc_OverflowError,
7284  "can't convert negative value to long");
7285  return (long) -1;
7286  }
7287  return (long) val;
7288  }
7289  } else
7290 #endif
7291  if (likely(PyLong_Check(x))) {
7292  if (is_unsigned) {
7293 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7294  #if CYTHON_USE_PYLONG_INTERNALS
7295  if (sizeof(digit) <= sizeof(long)) {
7296  switch (Py_SIZE(x)) {
7297  case 0: return 0;
7298  case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
7299  }
7300  }
7301  #endif
7302 #endif
7303  if (unlikely(Py_SIZE(x) < 0)) {
7304  PyErr_SetString(PyExc_OverflowError,
7305  "can't convert negative value to long");
7306  return (long) -1;
7307  }
7308  if (sizeof(long) <= sizeof(unsigned long)) {
7309  __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
7310  } else if (sizeof(long) <= sizeof(unsigned long long)) {
7311  __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
7312  }
7313  } else {
7314 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7315  #if CYTHON_USE_PYLONG_INTERNALS
7316  if (sizeof(digit) <= sizeof(long)) {
7317  switch (Py_SIZE(x)) {
7318  case 0: return 0;
7319  case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
7320  case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
7321  }
7322  }
7323  #endif
7324 #endif
7325  if (sizeof(long) <= sizeof(long)) {
7326  __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
7327  } else if (sizeof(long) <= sizeof(long long)) {
7328  __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
7329  }
7330  }
7331  {
7332 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7333  PyErr_SetString(PyExc_RuntimeError,
7334  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7335 #else
7336  long val;
7337  PyObject *v = __Pyx_PyNumber_Int(x);
7338  #if PY_MAJOR_VERSION < 3
7339  if (likely(v) && !PyLong_Check(v)) {
7340  PyObject *tmp = v;
7341  v = PyNumber_Long(tmp);
7342  Py_DECREF(tmp);
7343  }
7344  #endif
7345  if (likely(v)) {
7346  int one = 1; int is_little = (int)*(unsigned char *)&one;
7347  unsigned char *bytes = (unsigned char *)&val;
7348  int ret = _PyLong_AsByteArray((PyLongObject *)v,
7349  bytes, sizeof(val),
7350  is_little, !is_unsigned);
7351  Py_DECREF(v);
7352  if (likely(!ret))
7353  return val;
7354  }
7355 #endif
7356  return (long) -1;
7357  }
7358  } else {
7359  long val;
7360  PyObject *tmp = __Pyx_PyNumber_Int(x);
7361  if (!tmp) return (long) -1;
7362  val = __Pyx_PyInt_As_long(tmp);
7363  Py_DECREF(tmp);
7364  return val;
7365  }
7366 }
7367 
7368 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7369  #if CYTHON_USE_PYLONG_INTERNALS
7370  #include "longintrepr.h"
7371  #endif
7372 #endif
7373 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
7374  const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = 0;
7375  const int is_unsigned = neg_one > const_zero;
7376 #if PY_MAJOR_VERSION < 3
7377  if (likely(PyInt_Check(x))) {
7378  if (sizeof(PY_LONG_LONG) < sizeof(long)) {
7379  __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG)
7380  } else {
7381  long val = PyInt_AS_LONG(x);
7382  if (is_unsigned && unlikely(val < 0)) {
7383  PyErr_SetString(PyExc_OverflowError,
7384  "can't convert negative value to PY_LONG_LONG");
7385  return (PY_LONG_LONG) -1;
7386  }
7387  return (PY_LONG_LONG) val;
7388  }
7389  } else
7390 #endif
7391  if (likely(PyLong_Check(x))) {
7392  if (is_unsigned) {
7393 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7394  #if CYTHON_USE_PYLONG_INTERNALS
7395  if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
7396  switch (Py_SIZE(x)) {
7397  case 0: return 0;
7398  case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
7399  }
7400  }
7401  #endif
7402 #endif
7403  if (unlikely(Py_SIZE(x) < 0)) {
7404  PyErr_SetString(PyExc_OverflowError,
7405  "can't convert negative value to PY_LONG_LONG");
7406  return (PY_LONG_LONG) -1;
7407  }
7408  if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
7409  __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong)
7410  } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long long)) {
7411  __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long long, PyLong_AsUnsignedLongLong)
7412  }
7413  } else {
7414 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7415  #if CYTHON_USE_PYLONG_INTERNALS
7416  if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
7417  switch (Py_SIZE(x)) {
7418  case 0: return 0;
7419  case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
7420  case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
7421  }
7422  }
7423  #endif
7424 #endif
7425  if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
7426  __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyLong_AsLong)
7427  } else if (sizeof(PY_LONG_LONG) <= sizeof(long long)) {
7428  __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long long, PyLong_AsLongLong)
7429  }
7430  }
7431  {
7432 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7433  PyErr_SetString(PyExc_RuntimeError,
7434  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7435 #else
7436  PY_LONG_LONG val;
7437  PyObject *v = __Pyx_PyNumber_Int(x);
7438  #if PY_MAJOR_VERSION < 3
7439  if (likely(v) && !PyLong_Check(v)) {
7440  PyObject *tmp = v;
7441  v = PyNumber_Long(tmp);
7442  Py_DECREF(tmp);
7443  }
7444  #endif
7445  if (likely(v)) {
7446  int one = 1; int is_little = (int)*(unsigned char *)&one;
7447  unsigned char *bytes = (unsigned char *)&val;
7448  int ret = _PyLong_AsByteArray((PyLongObject *)v,
7449  bytes, sizeof(val),
7450  is_little, !is_unsigned);
7451  Py_DECREF(v);
7452  if (likely(!ret))
7453  return val;
7454  }
7455 #endif
7456  return (PY_LONG_LONG) -1;
7457  }
7458  } else {
7459  PY_LONG_LONG val;
7460  PyObject *tmp = __Pyx_PyNumber_Int(x);
7461  if (!tmp) return (PY_LONG_LONG) -1;
7462  val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
7463  Py_DECREF(tmp);
7464  return val;
7465  }
7466 }
7467 
7468 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
7469  const int neg_one = (int) -1, const_zero = 0;
7470  const int is_unsigned = neg_one > const_zero;
7471  if (is_unsigned) {
7472  if (sizeof(int) < sizeof(long)) {
7473  return PyInt_FromLong((long) value);
7474  } else if (sizeof(int) <= sizeof(unsigned long)) {
7475  return PyLong_FromUnsignedLong((unsigned long) value);
7476  } else if (sizeof(int) <= sizeof(unsigned long long)) {
7477  return PyLong_FromUnsignedLongLong((unsigned long long) value);
7478  }
7479  } else {
7480  if (sizeof(int) <= sizeof(long)) {
7481  return PyInt_FromLong((long) value);
7482  } else if (sizeof(int) <= sizeof(long long)) {
7483  return PyLong_FromLongLong((long long) value);
7484  }
7485  }
7486  {
7487  int one = 1; int little = (int)*(unsigned char *)&one;
7488  unsigned char *bytes = (unsigned char *)&value;
7489  return _PyLong_FromByteArray(bytes, sizeof(int),
7490  little, !is_unsigned);
7491  }
7492 }
7493 
7494 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7495  #if CYTHON_USE_PYLONG_INTERNALS
7496  #include "longintrepr.h"
7497  #endif
7498 #endif
7499 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
7500  const size_t neg_one = (size_t) -1, const_zero = 0;
7501  const int is_unsigned = neg_one > const_zero;
7502 #if PY_MAJOR_VERSION < 3
7503  if (likely(PyInt_Check(x))) {
7504  if (sizeof(size_t) < sizeof(long)) {
7505  __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG)
7506  } else {
7507  long val = PyInt_AS_LONG(x);
7508  if (is_unsigned && unlikely(val < 0)) {
7509  PyErr_SetString(PyExc_OverflowError,
7510  "can't convert negative value to size_t");
7511  return (size_t) -1;
7512  }
7513  return (size_t) val;
7514  }
7515  } else
7516 #endif
7517  if (likely(PyLong_Check(x))) {
7518  if (is_unsigned) {
7519 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7520  #if CYTHON_USE_PYLONG_INTERNALS
7521  if (sizeof(digit) <= sizeof(size_t)) {
7522  switch (Py_SIZE(x)) {
7523  case 0: return 0;
7524  case 1: return (size_t) ((PyLongObject*)x)->ob_digit[0];
7525  }
7526  }
7527  #endif
7528 #endif
7529  if (unlikely(Py_SIZE(x) < 0)) {
7530  PyErr_SetString(PyExc_OverflowError,
7531  "can't convert negative value to size_t");
7532  return (size_t) -1;
7533  }
7534  if (sizeof(size_t) <= sizeof(unsigned long)) {
7535  __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong)
7536  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
7537  __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong)
7538  }
7539  } else {
7540 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7541  #if CYTHON_USE_PYLONG_INTERNALS
7542  if (sizeof(digit) <= sizeof(size_t)) {
7543  switch (Py_SIZE(x)) {
7544  case 0: return 0;
7545  case 1: return +(size_t) ((PyLongObject*)x)->ob_digit[0];
7546  case -1: return -(size_t) ((PyLongObject*)x)->ob_digit[0];
7547  }
7548  }
7549  #endif
7550 #endif
7551  if (sizeof(size_t) <= sizeof(long)) {
7552  __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong)
7553  } else if (sizeof(size_t) <= sizeof(long long)) {
7554  __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong)
7555  }
7556  }
7557  {
7558 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7559  PyErr_SetString(PyExc_RuntimeError,
7560  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7561 #else
7562  size_t val;
7563  PyObject *v = __Pyx_PyNumber_Int(x);
7564  #if PY_MAJOR_VERSION < 3
7565  if (likely(v) && !PyLong_Check(v)) {
7566  PyObject *tmp = v;
7567  v = PyNumber_Long(tmp);
7568  Py_DECREF(tmp);
7569  }
7570  #endif
7571  if (likely(v)) {
7572  int one = 1; int is_little = (int)*(unsigned char *)&one;
7573  unsigned char *bytes = (unsigned char *)&val;
7574  int ret = _PyLong_AsByteArray((PyLongObject *)v,
7575  bytes, sizeof(val),
7576  is_little, !is_unsigned);
7577  Py_DECREF(v);
7578  if (likely(!ret))
7579  return val;
7580  }
7581 #endif
7582  return (size_t) -1;
7583  }
7584  } else {
7585  size_t val;
7586  PyObject *tmp = __Pyx_PyNumber_Int(x);
7587  if (!tmp) return (size_t) -1;
7588  val = __Pyx_PyInt_As_size_t(tmp);
7589  Py_DECREF(tmp);
7590  return val;
7591  }
7592 }
7593 
7594 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) {
7595  const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = 0;
7596  const int is_unsigned = neg_one > const_zero;
7597  if (is_unsigned) {
7598  if (sizeof(PY_LONG_LONG) < sizeof(long)) {
7599  return PyInt_FromLong((long) value);
7600  } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
7601  return PyLong_FromUnsignedLong((unsigned long) value);
7602  } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long long)) {
7603  return PyLong_FromUnsignedLongLong((unsigned long long) value);
7604  }
7605  } else {
7606  if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
7607  return PyInt_FromLong((long) value);
7608  } else if (sizeof(PY_LONG_LONG) <= sizeof(long long)) {
7609  return PyLong_FromLongLong((long long) value);
7610  }
7611  }
7612  {
7613  int one = 1; int little = (int)*(unsigned char *)&one;
7614  unsigned char *bytes = (unsigned char *)&value;
7615  return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG),
7616  little, !is_unsigned);
7617  }
7618 }
7619 
7620 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7621  #if CYTHON_USE_PYLONG_INTERNALS
7622  #include "longintrepr.h"
7623  #endif
7624 #endif
7625 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
7626  const uint64_t neg_one = (uint64_t) -1, const_zero = 0;
7627  const int is_unsigned = neg_one > const_zero;
7628 #if PY_MAJOR_VERSION < 3
7629  if (likely(PyInt_Check(x))) {
7630  if (sizeof(uint64_t) < sizeof(long)) {
7631  __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG)
7632  } else {
7633  long val = PyInt_AS_LONG(x);
7634  if (is_unsigned && unlikely(val < 0)) {
7635  PyErr_SetString(PyExc_OverflowError,
7636  "can't convert negative value to uint64_t");
7637  return (uint64_t) -1;
7638  }
7639  return (uint64_t) val;
7640  }
7641  } else
7642 #endif
7643  if (likely(PyLong_Check(x))) {
7644  if (is_unsigned) {
7645 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7646  #if CYTHON_USE_PYLONG_INTERNALS
7647  if (sizeof(digit) <= sizeof(uint64_t)) {
7648  switch (Py_SIZE(x)) {
7649  case 0: return 0;
7650  case 1: return (uint64_t) ((PyLongObject*)x)->ob_digit[0];
7651  }
7652  }
7653  #endif
7654 #endif
7655  if (unlikely(Py_SIZE(x) < 0)) {
7656  PyErr_SetString(PyExc_OverflowError,
7657  "can't convert negative value to uint64_t");
7658  return (uint64_t) -1;
7659  }
7660  if (sizeof(uint64_t) <= sizeof(unsigned long)) {
7661  __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, PyLong_AsUnsignedLong)
7662  } else if (sizeof(uint64_t) <= sizeof(unsigned long long)) {
7663  __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long long, PyLong_AsUnsignedLongLong)
7664  }
7665  } else {
7666 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
7667  #if CYTHON_USE_PYLONG_INTERNALS
7668  if (sizeof(digit) <= sizeof(uint64_t)) {
7669  switch (Py_SIZE(x)) {
7670  case 0: return 0;
7671  case 1: return +(uint64_t) ((PyLongObject*)x)->ob_digit[0];
7672  case -1: return -(uint64_t) ((PyLongObject*)x)->ob_digit[0];
7673  }
7674  }
7675  #endif
7676 #endif
7677  if (sizeof(uint64_t) <= sizeof(long)) {
7678  __PYX_VERIFY_RETURN_INT(uint64_t, long, PyLong_AsLong)
7679  } else if (sizeof(uint64_t) <= sizeof(long long)) {
7680  __PYX_VERIFY_RETURN_INT(uint64_t, long long, PyLong_AsLongLong)
7681  }
7682  }
7683  {
7684 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7685  PyErr_SetString(PyExc_RuntimeError,
7686  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7687 #else
7688  uint64_t val;
7689  PyObject *v = __Pyx_PyNumber_Int(x);
7690  #if PY_MAJOR_VERSION < 3
7691  if (likely(v) && !PyLong_Check(v)) {
7692  PyObject *tmp = v;
7693  v = PyNumber_Long(tmp);
7694  Py_DECREF(tmp);
7695  }
7696  #endif
7697  if (likely(v)) {
7698  int one = 1; int is_little = (int)*(unsigned char *)&one;
7699  unsigned char *bytes = (unsigned char *)&val;
7700  int ret = _PyLong_AsByteArray((PyLongObject *)v,
7701  bytes, sizeof(val),
7702  is_little, !is_unsigned);
7703  Py_DECREF(v);
7704  if (likely(!ret))
7705  return val;
7706  }
7707 #endif
7708  return (uint64_t) -1;
7709  }
7710  } else {
7711  uint64_t val;
7712  PyObject *tmp = __Pyx_PyNumber_Int(x);
7713  if (!tmp) return (uint64_t) -1;
7714  val = __Pyx_PyInt_As_uint64_t(tmp);
7715  Py_DECREF(tmp);
7716  return val;
7717  }
7718 }
7719 
7720 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
7721  const long neg_one = (long) -1, const_zero = 0;
7722  const int is_unsigned = neg_one > const_zero;
7723  if (is_unsigned) {
7724  if (sizeof(long) < sizeof(long)) {
7725  return PyInt_FromLong((long) value);
7726  } else if (sizeof(long) <= sizeof(unsigned long)) {
7727  return PyLong_FromUnsignedLong((unsigned long) value);
7728  } else if (sizeof(long) <= sizeof(unsigned long long)) {
7729  return PyLong_FromUnsignedLongLong((unsigned long long) value);
7730  }
7731  } else {
7732  if (sizeof(long) <= sizeof(long)) {
7733  return PyInt_FromLong((long) value);
7734  } else if (sizeof(long) <= sizeof(long long)) {
7735  return PyLong_FromLongLong((long long) value);
7736  }
7737  }
7738  {
7739  int one = 1; int little = (int)*(unsigned char *)&one;
7740  unsigned char *bytes = (unsigned char *)&value;
7741  return _PyLong_FromByteArray(bytes, sizeof(long),
7742  little, !is_unsigned);
7743  }
7744 }
7745 
7746 static int __Pyx_check_binary_version(void) {
7747  char ctversion[4], rtversion[4];
7748  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
7749  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
7750  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
7751  char message[200];
7752  PyOS_snprintf(message, sizeof(message),
7753  "compiletime version %s of module '%.100s' "
7754  "does not match runtime version %s",
7755  ctversion, __Pyx_MODULE_NAME, rtversion);
7756  #if PY_VERSION_HEX < 0x02050000
7757  return PyErr_Warn(NULL, message);
7758  #else
7759  return PyErr_WarnEx(NULL, message, 1);
7760  #endif
7761  }
7762  return 0;
7763 }
7764 
7765 #ifndef __PYX_HAVE_RT_ImportModule
7766 #define __PYX_HAVE_RT_ImportModule
7767 static PyObject *__Pyx_ImportModule(const char *name) {
7768  PyObject *py_name = 0;
7769  PyObject *py_module = 0;
7770  py_name = __Pyx_PyIdentifier_FromString(name);
7771  if (!py_name)
7772  goto bad;
7773  py_module = PyImport_Import(py_name);
7774  Py_DECREF(py_name);
7775  return py_module;
7776 bad:
7777  Py_XDECREF(py_name);
7778  return 0;
7779 }
7780 #endif
7781 
7782 #ifndef __PYX_HAVE_RT_ImportType
7783 #define __PYX_HAVE_RT_ImportType
7784 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
7785  size_t size, int strict)
7786 {
7787  PyObject *py_module = 0;
7788  PyObject *result = 0;
7789  PyObject *py_name = 0;
7790  char warning[200];
7791  Py_ssize_t basicsize;
7792 #ifdef Py_LIMITED_API
7793  PyObject *py_basicsize;
7794 #endif
7795  py_module = __Pyx_ImportModule(module_name);
7796  if (!py_module)
7797  goto bad;
7798  py_name = __Pyx_PyIdentifier_FromString(class_name);
7799  if (!py_name)
7800  goto bad;
7801  result = PyObject_GetAttr(py_module, py_name);
7802  Py_DECREF(py_name);
7803  py_name = 0;
7804  Py_DECREF(py_module);
7805  py_module = 0;
7806  if (!result)
7807  goto bad;
7808  if (!PyType_Check(result)) {
7809  PyErr_Format(PyExc_TypeError,
7810  "%.200s.%.200s is not a type object",
7811  module_name, class_name);
7812  goto bad;
7813  }
7814 #ifndef Py_LIMITED_API
7815  basicsize = ((PyTypeObject *)result)->tp_basicsize;
7816 #else
7817  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
7818  if (!py_basicsize)
7819  goto bad;
7820  basicsize = PyLong_AsSsize_t(py_basicsize);
7821  Py_DECREF(py_basicsize);
7822  py_basicsize = 0;
7823  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
7824  goto bad;
7825 #endif
7826  if (!strict && (size_t)basicsize > size) {
7827  PyOS_snprintf(warning, sizeof(warning),
7828  "%s.%s size changed, may indicate binary incompatibility",
7829  module_name, class_name);
7830  #if PY_VERSION_HEX < 0x02050000
7831  if (PyErr_Warn(NULL, warning) < 0) goto bad;
7832  #else
7833  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
7834  #endif
7835  }
7836  else if ((size_t)basicsize != size) {
7837  PyErr_Format(PyExc_ValueError,
7838  "%.200s.%.200s has the wrong size, try recompiling",
7839  module_name, class_name);
7840  goto bad;
7841  }
7842  return (PyTypeObject *)result;
7843 bad:
7844  Py_XDECREF(py_module);
7845  Py_XDECREF(result);
7846  return NULL;
7847 }
7848 #endif
7849 
7850 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
7851  int start = 0, mid = 0, end = count - 1;
7852  if (end >= 0 && code_line > entries[end].code_line) {
7853  return count;
7854  }
7855  while (start < end) {
7856  mid = (start + end) / 2;
7857  if (code_line < entries[mid].code_line) {
7858  end = mid;
7859  } else if (code_line > entries[mid].code_line) {
7860  start = mid + 1;
7861  } else {
7862  return mid;
7863  }
7864  }
7865  if (code_line <= entries[mid].code_line) {
7866  return mid;
7867  } else {
7868  return mid + 1;
7869  }
7870 }
7871 static PyCodeObject *__pyx_find_code_object(int code_line) {
7872  PyCodeObject* code_object;
7873  int pos;
7874  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
7875  return NULL;
7876  }
7877  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7878  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
7879  return NULL;
7880  }
7881  code_object = __pyx_code_cache.entries[pos].code_object;
7882  Py_INCREF(code_object);
7883  return code_object;
7884 }
7885 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
7886  int pos, i;
7887  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
7888  if (unlikely(!code_line)) {
7889  return;
7890  }
7891  if (unlikely(!entries)) {
7892  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
7893  if (likely(entries)) {
7894  __pyx_code_cache.entries = entries;
7895  __pyx_code_cache.max_count = 64;
7896  __pyx_code_cache.count = 1;
7897  entries[0].code_line = code_line;
7898  entries[0].code_object = code_object;
7899  Py_INCREF(code_object);
7900  }
7901  return;
7902  }
7903  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
7904  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
7905  PyCodeObject* tmp = entries[pos].code_object;
7906  entries[pos].code_object = code_object;
7907  Py_DECREF(tmp);
7908  return;
7909  }
7910  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
7911  int new_max = __pyx_code_cache.max_count + 64;
7912  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
7913  __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
7914  if (unlikely(!entries)) {
7915  return;
7916  }
7917  __pyx_code_cache.entries = entries;
7918  __pyx_code_cache.max_count = new_max;
7919  }
7920  for (i=__pyx_code_cache.count; i>pos; i--) {
7921  entries[i] = entries[i-1];
7922  }
7923  entries[pos].code_line = code_line;
7924  entries[pos].code_object = code_object;
7925  __pyx_code_cache.count++;
7926  Py_INCREF(code_object);
7927 }
7928 
7929 #include "compile.h"
7930 #include "frameobject.h"
7931 #include "traceback.h"
7932 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
7933  const char *funcname, int c_line,
7934  int py_line, const char *filename) {
7935  PyCodeObject *py_code = 0;
7936  PyObject *py_srcfile = 0;
7937  PyObject *py_funcname = 0;
7938  #if PY_MAJOR_VERSION < 3
7939  py_srcfile = PyString_FromString(filename);
7940  #else
7941  py_srcfile = PyUnicode_FromString(filename);
7942  #endif
7943  if (!py_srcfile) goto bad;
7944  if (c_line) {
7945  #if PY_MAJOR_VERSION < 3
7946  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7947  #else
7948  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
7949  #endif
7950  }
7951  else {
7952  #if PY_MAJOR_VERSION < 3
7953  py_funcname = PyString_FromString(funcname);
7954  #else
7955  py_funcname = PyUnicode_FromString(funcname);
7956  #endif
7957  }
7958  if (!py_funcname) goto bad;
7959  py_code = __Pyx_PyCode_New(
7960  0, /*int argcount,*/
7961  0, /*int kwonlyargcount,*/
7962  0, /*int nlocals,*/
7963  0, /*int stacksize,*/
7964  0, /*int flags,*/
7965  __pyx_empty_bytes, /*PyObject *code,*/
7966  __pyx_empty_tuple, /*PyObject *consts,*/
7967  __pyx_empty_tuple, /*PyObject *names,*/
7968  __pyx_empty_tuple, /*PyObject *varnames,*/
7969  __pyx_empty_tuple, /*PyObject *freevars,*/
7970  __pyx_empty_tuple, /*PyObject *cellvars,*/
7971  py_srcfile, /*PyObject *filename,*/
7972  py_funcname, /*PyObject *name,*/
7973  py_line, /*int firstlineno,*/
7974  __pyx_empty_bytes /*PyObject *lnotab*/
7975  );
7976  Py_DECREF(py_srcfile);
7977  Py_DECREF(py_funcname);
7978  return py_code;
7979 bad:
7980  Py_XDECREF(py_srcfile);
7981  Py_XDECREF(py_funcname);
7982  return NULL;
7983 }
7984 static void __Pyx_AddTraceback(const char *funcname, int c_line,
7985  int py_line, const char *filename) {
7986  PyCodeObject *py_code = 0;
7987  PyObject *py_globals = 0;
7988  PyFrameObject *py_frame = 0;
7989  py_code = __pyx_find_code_object(c_line ? c_line : py_line);
7990  if (!py_code) {
7991  py_code = __Pyx_CreateCodeObjectForTraceback(
7992  funcname, c_line, py_line, filename);
7993  if (!py_code) goto bad;
7994  __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
7995  }
7996  py_globals = PyModule_GetDict(__pyx_m);
7997  if (!py_globals) goto bad;
7998  py_frame = PyFrame_New(
7999  PyThreadState_GET(), /*PyThreadState *tstate,*/
8000  py_code, /*PyCodeObject *code,*/
8001  py_globals, /*PyObject *globals,*/
8002  0 /*PyObject *locals*/
8003  );
8004  if (!py_frame) goto bad;
8005  py_frame->f_lineno = py_line;
8006  PyTraceBack_Here(py_frame);
8007 bad:
8008  Py_XDECREF(py_code);
8009  Py_XDECREF(py_frame);
8010 }
8011 
8012 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
8013  while (t->p) {
8014  #if PY_MAJOR_VERSION < 3
8015  if (t->is_unicode) {
8016  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
8017  } else if (t->intern) {
8018  *t->p = PyString_InternFromString(t->s);
8019  } else {
8020  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
8021  }
8022  #else /* Python 3+ has unicode identifiers */
8023  if (t->is_unicode | t->is_str) {
8024  if (t->intern) {
8025  *t->p = PyUnicode_InternFromString(t->s);
8026  } else if (t->encoding) {
8027  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
8028  } else {
8029  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
8030  }
8031  } else {
8032  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
8033  }
8034  #endif
8035  if (!*t->p)
8036  return -1;
8037  ++t;
8038  }
8039  return 0;
8040 }
8041 
8042 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
8043  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
8044 }
8045 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
8046  Py_ssize_t ignore;
8047  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
8048 }
8049 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8050 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8051  if (
8052 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8053  __Pyx_sys_getdefaultencoding_not_ascii &&
8054 #endif
8055  PyUnicode_Check(o)) {
8056 #if PY_VERSION_HEX < 0x03030000
8057  char* defenc_c;
8058  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
8059  if (!defenc) return NULL;
8060  defenc_c = PyBytes_AS_STRING(defenc);
8061 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8062  {
8063  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
8064  char* c;
8065  for (c = defenc_c; c < end; c++) {
8066  if ((unsigned char) (*c) >= 128) {
8067  PyUnicode_AsASCIIString(o);
8068  return NULL;
8069  }
8070  }
8071  }
8072 #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
8073  *length = PyBytes_GET_SIZE(defenc);
8074  return defenc_c;
8075 #else /* PY_VERSION_HEX < 0x03030000 */
8076  if (PyUnicode_READY(o) == -1) return NULL;
8077 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8078  if (PyUnicode_IS_ASCII(o)) {
8079  *length = PyUnicode_GET_LENGTH(o);
8080  return PyUnicode_AsUTF8(o);
8081  } else {
8082  PyUnicode_AsASCIIString(o);
8083  return NULL;
8084  }
8085 #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
8086  return PyUnicode_AsUTF8AndSize(o, length);
8087 #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
8088 #endif /* PY_VERSION_HEX < 0x03030000 */
8089  } else
8090 #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
8091 #if !CYTHON_COMPILING_IN_PYPY
8092 #if PY_VERSION_HEX >= 0x02060000
8093  if (PyByteArray_Check(o)) {
8094  *length = PyByteArray_GET_SIZE(o);
8095  return PyByteArray_AS_STRING(o);
8096  } else
8097 #endif
8098 #endif
8099  {
8100  char* result;
8101  int r = PyBytes_AsStringAndSize(o, &result, length);
8102  if (unlikely(r < 0)) {
8103  return NULL;
8104  } else {
8105  return result;
8106  }
8107  }
8108 }
8109 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
8110  int is_true = x == Py_True;
8111  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
8112  else return PyObject_IsTrue(x);
8113 }
8114 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
8115  PyNumberMethods *m;
8116  const char *name = NULL;
8117  PyObject *res = NULL;
8118 #if PY_MAJOR_VERSION < 3
8119  if (PyInt_Check(x) || PyLong_Check(x))
8120 #else
8121  if (PyLong_Check(x))
8122 #endif
8123  return Py_INCREF(x), x;
8124  m = Py_TYPE(x)->tp_as_number;
8125 #if PY_MAJOR_VERSION < 3
8126  if (m && m->nb_int) {
8127  name = "int";
8128  res = PyNumber_Int(x);
8129  }
8130  else if (m && m->nb_long) {
8131  name = "long";
8132  res = PyNumber_Long(x);
8133  }
8134 #else
8135  if (m && m->nb_int) {
8136  name = "int";
8137  res = PyNumber_Long(x);
8138  }
8139 #endif
8140  if (res) {
8141 #if PY_MAJOR_VERSION < 3
8142  if (!PyInt_Check(res) && !PyLong_Check(res)) {
8143 #else
8144  if (!PyLong_Check(res)) {
8145 #endif
8146  PyErr_Format(PyExc_TypeError,
8147  "__%.4s__ returned non-%.4s (type %.200s)",
8148  name, name, Py_TYPE(res)->tp_name);
8149  Py_DECREF(res);
8150  return NULL;
8151  }
8152  }
8153  else if (!PyErr_Occurred()) {
8154  PyErr_SetString(PyExc_TypeError,
8155  "an integer is required");
8156  }
8157  return res;
8158 }
8159 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
8160  #if CYTHON_USE_PYLONG_INTERNALS
8161  #include "longintrepr.h"
8162  #endif
8163 #endif
8164 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
8165  Py_ssize_t ival;
8166  PyObject *x;
8167 #if PY_MAJOR_VERSION < 3
8168  if (likely(PyInt_CheckExact(b)))
8169  return PyInt_AS_LONG(b);
8170 #endif
8171  if (likely(PyLong_CheckExact(b))) {
8172  #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
8173  #if CYTHON_USE_PYLONG_INTERNALS
8174  switch (Py_SIZE(b)) {
8175  case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
8176  case 0: return 0;
8177  case 1: return ((PyLongObject*)b)->ob_digit[0];
8178  }
8179  #endif
8180  #endif
8181  #if PY_VERSION_HEX < 0x02060000
8182  return PyInt_AsSsize_t(b);
8183  #else
8184  return PyLong_AsSsize_t(b);
8185  #endif
8186  }
8187  x = PyNumber_Index(b);
8188  if (!x) return -1;
8189  ival = PyInt_AsSsize_t(x);
8190  Py_DECREF(x);
8191  return ival;
8192 }
8193 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
8194 #if PY_VERSION_HEX < 0x02050000
8195  if (ival <= LONG_MAX)
8196  return PyInt_FromLong((long)ival);
8197  else {
8198  unsigned char *bytes = (unsigned char *) &ival;
8199  int one = 1; int little = (int)*(unsigned char*)&one;
8200  return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
8201  }
8202 #else
8203  return PyInt_FromSize_t(ival);
8204 #endif
8205 }
8206 
8207 
8208 #endif /* Py_PYTHON_H */
size_t sion_fwrite_key(const void *data, uint64_t key, size_t size, size_t nitems, int sid)
Writes data for key.
size_t sion_fread_key(void *data, uint64_t key, size_t size, size_t nitems, int sid)
Read data for key.
size_t sion_fread(void *data, size_t size, size_t nitems, int sid)
Read data from sion file.
Definition: sion_common.c:609
size_t sion_fwrite(const void *data, size_t size, size_t nitems, int sid)
Write data to sion file.
Definition: sion_common.c:470
sion_int64 sion_bytes_avail_in_chunk(int sid)
Function that returns the number of bytes available in the current chunk.
Definition: sion_common.c:894
int sion_paropen_mpi(const char *fname, const char *file_mode, int *numFiles, MPI_Comm gComm, const MPI_Comm *lComm, sion_int64 *chunksize, sion_int32 *fsblksize, int *globalrank, FILE **fileptr, char **newfname)
Open a sion file using MPI.
Definition: sion_mpi_gen.c:85
int sion_parclose_mpi(int sid)
Close a sion file using MPI.
Definition: sion_mpi_gen.c:230
int sion_open(char *fname, const char *file_mode, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr)
Open a sion file in serial mode.
Definition: sion_serial.c:54
int sion_close(int sid)
Close a sion file.
Definition: sion_serial.c:106