1 /* Generated by Cython 0.29.23 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8     #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10     #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_23"
13 #define CYTHON_HEX_VERSION 0x001D17F0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20   #ifndef __stdcall
21     #define __stdcall
22   #endif
23   #ifndef __cdecl
24     #define __cdecl
25   #endif
26   #ifndef __fastcall
27     #define __fastcall
28   #endif
29 #endif
30 #ifndef DL_IMPORT
31   #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34   #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38   #if PY_VERSION_HEX >= 0x02070000
39     #define HAVE_LONG_LONG
40   #endif
41 #endif
42 #ifndef PY_LONG_LONG
43   #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46   #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49   #define CYTHON_COMPILING_IN_PYPY 1
50   #define CYTHON_COMPILING_IN_PYSTON 0
51   #define CYTHON_COMPILING_IN_CPYTHON 0
52   #undef CYTHON_USE_TYPE_SLOTS
53   #define CYTHON_USE_TYPE_SLOTS 0
54   #undef CYTHON_USE_PYTYPE_LOOKUP
55   #define CYTHON_USE_PYTYPE_LOOKUP 0
56   #if PY_VERSION_HEX < 0x03050000
57     #undef CYTHON_USE_ASYNC_SLOTS
58     #define CYTHON_USE_ASYNC_SLOTS 0
59   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60     #define CYTHON_USE_ASYNC_SLOTS 1
61   #endif
62   #undef CYTHON_USE_PYLIST_INTERNALS
63   #define CYTHON_USE_PYLIST_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_INTERNALS
65   #define CYTHON_USE_UNICODE_INTERNALS 0
66   #undef CYTHON_USE_UNICODE_WRITER
67   #define CYTHON_USE_UNICODE_WRITER 0
68   #undef CYTHON_USE_PYLONG_INTERNALS
69   #define CYTHON_USE_PYLONG_INTERNALS 0
70   #undef CYTHON_AVOID_BORROWED_REFS
71   #define CYTHON_AVOID_BORROWED_REFS 1
72   #undef CYTHON_ASSUME_SAFE_MACROS
73   #define CYTHON_ASSUME_SAFE_MACROS 0
74   #undef CYTHON_UNPACK_METHODS
75   #define CYTHON_UNPACK_METHODS 0
76   #undef CYTHON_FAST_THREAD_STATE
77   #define CYTHON_FAST_THREAD_STATE 0
78   #undef CYTHON_FAST_PYCALL
79   #define CYTHON_FAST_PYCALL 0
80   #undef CYTHON_PEP489_MULTI_PHASE_INIT
81   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82   #undef CYTHON_USE_TP_FINALIZE
83   #define CYTHON_USE_TP_FINALIZE 0
84   #undef CYTHON_USE_DICT_VERSIONS
85   #define CYTHON_USE_DICT_VERSIONS 0
86   #undef CYTHON_USE_EXC_INFO_STACK
87   #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89   #define CYTHON_COMPILING_IN_PYPY 0
90   #define CYTHON_COMPILING_IN_PYSTON 1
91   #define CYTHON_COMPILING_IN_CPYTHON 0
92   #ifndef CYTHON_USE_TYPE_SLOTS
93     #define CYTHON_USE_TYPE_SLOTS 1
94   #endif
95   #undef CYTHON_USE_PYTYPE_LOOKUP
96   #define CYTHON_USE_PYTYPE_LOOKUP 0
97   #undef CYTHON_USE_ASYNC_SLOTS
98   #define CYTHON_USE_ASYNC_SLOTS 0
99   #undef CYTHON_USE_PYLIST_INTERNALS
100   #define CYTHON_USE_PYLIST_INTERNALS 0
101   #ifndef CYTHON_USE_UNICODE_INTERNALS
102     #define CYTHON_USE_UNICODE_INTERNALS 1
103   #endif
104   #undef CYTHON_USE_UNICODE_WRITER
105   #define CYTHON_USE_UNICODE_WRITER 0
106   #undef CYTHON_USE_PYLONG_INTERNALS
107   #define CYTHON_USE_PYLONG_INTERNALS 0
108   #ifndef CYTHON_AVOID_BORROWED_REFS
109     #define CYTHON_AVOID_BORROWED_REFS 0
110   #endif
111   #ifndef CYTHON_ASSUME_SAFE_MACROS
112     #define CYTHON_ASSUME_SAFE_MACROS 1
113   #endif
114   #ifndef CYTHON_UNPACK_METHODS
115     #define CYTHON_UNPACK_METHODS 1
116   #endif
117   #undef CYTHON_FAST_THREAD_STATE
118   #define CYTHON_FAST_THREAD_STATE 0
119   #undef CYTHON_FAST_PYCALL
120   #define CYTHON_FAST_PYCALL 0
121   #undef CYTHON_PEP489_MULTI_PHASE_INIT
122   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123   #undef CYTHON_USE_TP_FINALIZE
124   #define CYTHON_USE_TP_FINALIZE 0
125   #undef CYTHON_USE_DICT_VERSIONS
126   #define CYTHON_USE_DICT_VERSIONS 0
127   #undef CYTHON_USE_EXC_INFO_STACK
128   #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130   #define CYTHON_COMPILING_IN_PYPY 0
131   #define CYTHON_COMPILING_IN_PYSTON 0
132   #define CYTHON_COMPILING_IN_CPYTHON 1
133   #ifndef CYTHON_USE_TYPE_SLOTS
134     #define CYTHON_USE_TYPE_SLOTS 1
135   #endif
136   #if PY_VERSION_HEX < 0x02070000
137     #undef CYTHON_USE_PYTYPE_LOOKUP
138     #define CYTHON_USE_PYTYPE_LOOKUP 0
139   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140     #define CYTHON_USE_PYTYPE_LOOKUP 1
141   #endif
142   #if PY_MAJOR_VERSION < 3
143     #undef CYTHON_USE_ASYNC_SLOTS
144     #define CYTHON_USE_ASYNC_SLOTS 0
145   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146     #define CYTHON_USE_ASYNC_SLOTS 1
147   #endif
148   #if PY_VERSION_HEX < 0x02070000
149     #undef CYTHON_USE_PYLONG_INTERNALS
150     #define CYTHON_USE_PYLONG_INTERNALS 0
151   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152     #define CYTHON_USE_PYLONG_INTERNALS 1
153   #endif
154   #ifndef CYTHON_USE_PYLIST_INTERNALS
155     #define CYTHON_USE_PYLIST_INTERNALS 1
156   #endif
157   #ifndef CYTHON_USE_UNICODE_INTERNALS
158     #define CYTHON_USE_UNICODE_INTERNALS 1
159   #endif
160   #if PY_VERSION_HEX < 0x030300F0
161     #undef CYTHON_USE_UNICODE_WRITER
162     #define CYTHON_USE_UNICODE_WRITER 0
163   #elif !defined(CYTHON_USE_UNICODE_WRITER)
164     #define CYTHON_USE_UNICODE_WRITER 1
165   #endif
166   #ifndef CYTHON_AVOID_BORROWED_REFS
167     #define CYTHON_AVOID_BORROWED_REFS 0
168   #endif
169   #ifndef CYTHON_ASSUME_SAFE_MACROS
170     #define CYTHON_ASSUME_SAFE_MACROS 1
171   #endif
172   #ifndef CYTHON_UNPACK_METHODS
173     #define CYTHON_UNPACK_METHODS 1
174   #endif
175   #ifndef CYTHON_FAST_THREAD_STATE
176     #define CYTHON_FAST_THREAD_STATE 1
177   #endif
178   #ifndef CYTHON_FAST_PYCALL
179     #define CYTHON_FAST_PYCALL 1
180   #endif
181   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183   #endif
184   #ifndef CYTHON_USE_TP_FINALIZE
185     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186   #endif
187   #ifndef CYTHON_USE_DICT_VERSIONS
188     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189   #endif
190   #ifndef CYTHON_USE_EXC_INFO_STACK
191     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192   #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198   #include "longintrepr.h"
199   #undef SHIFT
200   #undef BASE
201   #undef MASK
202   #ifdef SIZEOF_VOID_P
203     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204   #endif
205 #endif
206 #ifndef __has_attribute
207   #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210   #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213   #if defined(__GNUC__)
214     #define CYTHON_RESTRICT __restrict__
215   #elif defined(_MSC_VER) && _MSC_VER >= 1400
216     #define CYTHON_RESTRICT __restrict
217   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218     #define CYTHON_RESTRICT restrict
219   #else
220     #define CYTHON_RESTRICT
221   #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 #     define CYTHON_UNUSED __attribute__ ((__unused__))
227 #   else
228 #     define CYTHON_UNUSED
229 #   endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 #   define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 #   define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)238      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 #  else
240 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 #  endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 #  define CYTHON_NCP_UNUSED
246 # else
247 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252     #ifndef _MSC_STDINT_H_
253         #if _MSC_VER < 1300
254            typedef unsigned char     uint8_t;
255            typedef unsigned int      uint32_t;
256         #else
257            typedef unsigned __int8   uint8_t;
258            typedef unsigned __int32  uint32_t;
259         #endif
260     #endif
261 #else
262    #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265   #if defined(__cplusplus) && __cplusplus >= 201103L
266     #if __has_cpp_attribute(fallthrough)
267       #define CYTHON_FALLTHROUGH [[fallthrough]]
268     #elif __has_cpp_attribute(clang::fallthrough)
269       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270     #elif __has_cpp_attribute(gnu::fallthrough)
271       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272     #endif
273   #endif
274   #ifndef CYTHON_FALLTHROUGH
275     #if __has_attribute(fallthrough)
276       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277     #else
278       #define CYTHON_FALLTHROUGH
279     #endif
280   #endif
281   #if defined(__clang__ ) && defined(__apple_build_version__)
282     #if __apple_build_version__ < 7000000
283       #undef  CYTHON_FALLTHROUGH
284       #define CYTHON_FALLTHROUGH
285     #endif
286   #endif
287 #endif
288 
289 #ifndef __cplusplus
290   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
291 #endif
292 #ifndef CYTHON_INLINE
293   #if defined(__clang__)
294     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
295   #else
296     #define CYTHON_INLINE inline
297   #endif
298 #endif
299 template<typename T>
__Pyx_call_destructor(T & x)300 void __Pyx_call_destructor(T& x) {
301     x.~T();
302 }
303 template<typename T>
304 class __Pyx_FakeReference {
305   public:
__Pyx_FakeReference()306     __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)307     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()308     T *operator->() { return ptr; }
operator &()309     T *operator&() { return ptr; }
operator T&()310     operator T&() { return *ptr; }
operator ==(U other)311     template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)312     template<typename U> bool operator !=(U other) { return *ptr != other; }
313   private:
314     T *ptr;
315 };
316 
317 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
318   #define Py_OptimizeFlag 0
319 #endif
320 #define __PYX_BUILD_PY_SSIZE_T "n"
321 #define CYTHON_FORMAT_SSIZE_T "z"
322 #if PY_MAJOR_VERSION < 3
323   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
324   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
325           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
326   #define __Pyx_DefaultClassType PyClass_Type
327 #else
328   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
329 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
330   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #else
333   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
334           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
335 #endif
336   #define __Pyx_DefaultClassType PyType_Type
337 #endif
338 #ifndef Py_TPFLAGS_CHECKTYPES
339   #define Py_TPFLAGS_CHECKTYPES 0
340 #endif
341 #ifndef Py_TPFLAGS_HAVE_INDEX
342   #define Py_TPFLAGS_HAVE_INDEX 0
343 #endif
344 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
345   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
346 #endif
347 #ifndef Py_TPFLAGS_HAVE_FINALIZE
348   #define Py_TPFLAGS_HAVE_FINALIZE 0
349 #endif
350 #ifndef METH_STACKLESS
351   #define METH_STACKLESS 0
352 #endif
353 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
354   #ifndef METH_FASTCALL
355      #define METH_FASTCALL 0x80
356   #endif
357   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
358   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
359                                                           Py_ssize_t nargs, PyObject *kwnames);
360 #else
361   #define __Pyx_PyCFunctionFast _PyCFunctionFast
362   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
363 #endif
364 #if CYTHON_FAST_PYCCALL
365 #define __Pyx_PyFastCFunction_Check(func)\
366     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
367 #else
368 #define __Pyx_PyFastCFunction_Check(func) 0
369 #endif
370 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
371   #define PyObject_Malloc(s)   PyMem_Malloc(s)
372   #define PyObject_Free(p)     PyMem_Free(p)
373   #define PyObject_Realloc(p)  PyMem_Realloc(p)
374 #endif
375 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
376   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
377   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
378   #define PyMem_RawFree(p)             PyMem_Free(p)
379 #endif
380 #if CYTHON_COMPILING_IN_PYSTON
381   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
382   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
383 #else
384   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
385   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
386 #endif
387 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
388   #define __Pyx_PyThreadState_Current PyThreadState_GET()
389 #elif PY_VERSION_HEX >= 0x03060000
390   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
391 #elif PY_VERSION_HEX >= 0x03000000
392   #define __Pyx_PyThreadState_Current PyThreadState_GET()
393 #else
394   #define __Pyx_PyThreadState_Current _PyThreadState_Current
395 #endif
396 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
397 #include "pythread.h"
398 #define Py_tss_NEEDS_INIT 0
399 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)400 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
401   *key = PyThread_create_key();
402   return 0;
403 }
PyThread_tss_alloc(void)404 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
405   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
406   *key = Py_tss_NEEDS_INIT;
407   return key;
408 }
PyThread_tss_free(Py_tss_t * key)409 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
410   PyObject_Free(key);
411 }
PyThread_tss_is_created(Py_tss_t * key)412 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
413   return *key != Py_tss_NEEDS_INIT;
414 }
PyThread_tss_delete(Py_tss_t * key)415 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
416   PyThread_delete_key(*key);
417   *key = Py_tss_NEEDS_INIT;
418 }
PyThread_tss_set(Py_tss_t * key,void * value)419 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
420   return PyThread_set_key_value(*key, value);
421 }
PyThread_tss_get(Py_tss_t * key)422 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
423   return PyThread_get_key_value(*key);
424 }
425 #endif
426 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
427 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
428 #else
429 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
430 #endif
431 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
434 #else
435   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
436   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
437 #endif
438 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
439 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
440 #else
441 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
442 #endif
443 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
444   #define CYTHON_PEP393_ENABLED 1
445   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
446                                               0 : _PyUnicode_Ready((PyObject *)(op)))
447   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
448   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
449   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
450   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
451   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
452   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
453   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
454   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
455   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
456   #else
457   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
458   #endif
459 #else
460   #define CYTHON_PEP393_ENABLED 0
461   #define PyUnicode_1BYTE_KIND  1
462   #define PyUnicode_2BYTE_KIND  2
463   #define PyUnicode_4BYTE_KIND  4
464   #define __Pyx_PyUnicode_READY(op)       (0)
465   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
466   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
467   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
468   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
469   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
470   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
471   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
472   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
473 #endif
474 #if CYTHON_COMPILING_IN_PYPY
475   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
476   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
477 #else
478   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
479   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
480       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
483   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
484 #endif
485 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
486   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
487 #endif
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
489   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
490 #endif
491 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
492 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
493 #if PY_MAJOR_VERSION >= 3
494   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
495 #else
496   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
497 #endif
498 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
499   #define PyObject_ASCII(o)            PyObject_Repr(o)
500 #endif
501 #if PY_MAJOR_VERSION >= 3
502   #define PyBaseString_Type            PyUnicode_Type
503   #define PyStringObject               PyUnicodeObject
504   #define PyString_Type                PyUnicode_Type
505   #define PyString_Check               PyUnicode_Check
506   #define PyString_CheckExact          PyUnicode_CheckExact
507 #ifndef PyObject_Unicode
508   #define PyObject_Unicode             PyObject_Str
509 #endif
510 #endif
511 #if PY_MAJOR_VERSION >= 3
512   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
513   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
514 #else
515   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
516   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
517 #endif
518 #ifndef PySet_CheckExact
519   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
520 #endif
521 #if PY_VERSION_HEX >= 0x030900A4
522   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
523   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
524 #else
525   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
526   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
527 #endif
528 #if CYTHON_ASSUME_SAFE_MACROS
529   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
530 #else
531   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
532 #endif
533 #if PY_MAJOR_VERSION >= 3
534   #define PyIntObject                  PyLongObject
535   #define PyInt_Type                   PyLong_Type
536   #define PyInt_Check(op)              PyLong_Check(op)
537   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
538   #define PyInt_FromString             PyLong_FromString
539   #define PyInt_FromUnicode            PyLong_FromUnicode
540   #define PyInt_FromLong               PyLong_FromLong
541   #define PyInt_FromSize_t             PyLong_FromSize_t
542   #define PyInt_FromSsize_t            PyLong_FromSsize_t
543   #define PyInt_AsLong                 PyLong_AsLong
544   #define PyInt_AS_LONG                PyLong_AS_LONG
545   #define PyInt_AsSsize_t              PyLong_AsSsize_t
546   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
547   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
548   #define PyNumber_Int                 PyNumber_Long
549 #endif
550 #if PY_MAJOR_VERSION >= 3
551   #define PyBoolObject                 PyLongObject
552 #endif
553 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
554   #ifndef PyUnicode_InternFromString
555     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
556   #endif
557 #endif
558 #if PY_VERSION_HEX < 0x030200A4
559   typedef long Py_hash_t;
560   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
561   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
562 #else
563   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
564   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
565 #endif
566 #if PY_MAJOR_VERSION >= 3
567   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
568 #else
569   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
570 #endif
571 #if CYTHON_USE_ASYNC_SLOTS
572   #if PY_VERSION_HEX >= 0x030500B1
573     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
574     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
575   #else
576     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
577   #endif
578 #else
579   #define __Pyx_PyType_AsAsync(obj) NULL
580 #endif
581 #ifndef __Pyx_PyAsyncMethodsStruct
582     typedef struct {
583         unaryfunc am_await;
584         unaryfunc am_aiter;
585         unaryfunc am_anext;
586     } __Pyx_PyAsyncMethodsStruct;
587 #endif
588 
589 #if defined(WIN32) || defined(MS_WINDOWS)
590   #define _USE_MATH_DEFINES
591 #endif
592 #include <math.h>
593 #ifdef NAN
594 #define __PYX_NAN() ((float) NAN)
595 #else
__PYX_NAN()596 static CYTHON_INLINE float __PYX_NAN() {
597   float value;
598   memset(&value, 0xFF, sizeof(value));
599   return value;
600 }
601 #endif
602 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
603 #define __Pyx_truncl trunc
604 #else
605 #define __Pyx_truncl truncl
606 #endif
607 
608 #define __PYX_MARK_ERR_POS(f_index, lineno) \
609     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
610 #define __PYX_ERR(f_index, lineno, Ln_error) \
611     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
612 
613 #ifndef __PYX_EXTERN_C
614   #ifdef __cplusplus
615     #define __PYX_EXTERN_C extern "C"
616   #else
617     #define __PYX_EXTERN_C extern
618   #endif
619 #endif
620 
621 #define __PYX_HAVE__borg__algorithms__msgpack___packer
622 #define __PYX_HAVE_API__borg__algorithms__msgpack___packer
623 /* Early includes */
624 #include <string.h>
625 #include <stdio.h>
626 #include "pythread.h"
627 #include "pack.h"
628 #ifdef _OPENMP
629 #include <omp.h>
630 #endif /* _OPENMP */
631 
632 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
633 #define CYTHON_WITHOUT_ASSERTIONS
634 #endif
635 
636 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
637                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
638 
639 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1
640 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
641 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
642 #define __PYX_DEFAULT_STRING_ENCODING "ascii"
643 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
644 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
645 #define __Pyx_uchar_cast(c) ((unsigned char)c)
646 #define __Pyx_long_cast(x) ((long)x)
647 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
648     (sizeof(type) < sizeof(Py_ssize_t))  ||\
649     (sizeof(type) > sizeof(Py_ssize_t) &&\
650           likely(v < (type)PY_SSIZE_T_MAX ||\
651                  v == (type)PY_SSIZE_T_MAX)  &&\
652           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
653                                 v == (type)PY_SSIZE_T_MIN)))  ||\
654     (sizeof(type) == sizeof(Py_ssize_t) &&\
655           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
656                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)657 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
658     return (size_t) i < (size_t) limit;
659 }
660 #if defined (__cplusplus) && __cplusplus >= 201103L
661     #include <cstdlib>
662     #define __Pyx_sst_abs(value) std::abs(value)
663 #elif SIZEOF_INT >= SIZEOF_SIZE_T
664     #define __Pyx_sst_abs(value) abs(value)
665 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
666     #define __Pyx_sst_abs(value) labs(value)
667 #elif defined (_MSC_VER)
668     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
669 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
670     #define __Pyx_sst_abs(value) llabs(value)
671 #elif defined (__GNUC__)
672     #define __Pyx_sst_abs(value) __builtin_llabs(value)
673 #else
674     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
675 #endif
676 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
677 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
678 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
679 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
680 #define __Pyx_PyBytes_FromString        PyBytes_FromString
681 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
682 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
683 #if PY_MAJOR_VERSION < 3
684     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
685     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
686 #else
687     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
688     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
689 #endif
690 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
692 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
693 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
694 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
695 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
696 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
697 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
698 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
699 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
700 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
701 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
702 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
703 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
704 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
705 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)706 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
707     const Py_UNICODE *u_end = u;
708     while (*u_end++) ;
709     return (size_t)(u_end - u - 1);
710 }
711 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
712 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
713 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
714 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
715 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
716 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
717 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
718 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
719 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
720 #define __Pyx_PySequence_Tuple(obj)\
721     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
722 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
723 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
724 #if CYTHON_ASSUME_SAFE_MACROS
725 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
726 #else
727 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
728 #endif
729 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
730 #if PY_MAJOR_VERSION >= 3
731 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
732 #else
733 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
734 #endif
735 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
736 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
737 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)738 static int __Pyx_init_sys_getdefaultencoding_params(void) {
739     PyObject* sys;
740     PyObject* default_encoding = NULL;
741     PyObject* ascii_chars_u = NULL;
742     PyObject* ascii_chars_b = NULL;
743     const char* default_encoding_c;
744     sys = PyImport_ImportModule("sys");
745     if (!sys) goto bad;
746     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
747     Py_DECREF(sys);
748     if (!default_encoding) goto bad;
749     default_encoding_c = PyBytes_AsString(default_encoding);
750     if (!default_encoding_c) goto bad;
751     if (strcmp(default_encoding_c, "ascii") == 0) {
752         __Pyx_sys_getdefaultencoding_not_ascii = 0;
753     } else {
754         char ascii_chars[128];
755         int c;
756         for (c = 0; c < 128; c++) {
757             ascii_chars[c] = c;
758         }
759         __Pyx_sys_getdefaultencoding_not_ascii = 1;
760         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
761         if (!ascii_chars_u) goto bad;
762         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
763         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
764             PyErr_Format(
765                 PyExc_ValueError,
766                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
767                 default_encoding_c);
768             goto bad;
769         }
770         Py_DECREF(ascii_chars_u);
771         Py_DECREF(ascii_chars_b);
772     }
773     Py_DECREF(default_encoding);
774     return 0;
775 bad:
776     Py_XDECREF(default_encoding);
777     Py_XDECREF(ascii_chars_u);
778     Py_XDECREF(ascii_chars_b);
779     return -1;
780 }
781 #endif
782 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
783 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
784 #else
785 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
786 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
787 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)788 static int __Pyx_init_sys_getdefaultencoding_params(void) {
789     PyObject* sys;
790     PyObject* default_encoding = NULL;
791     char* default_encoding_c;
792     sys = PyImport_ImportModule("sys");
793     if (!sys) goto bad;
794     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
795     Py_DECREF(sys);
796     if (!default_encoding) goto bad;
797     default_encoding_c = PyBytes_AsString(default_encoding);
798     if (!default_encoding_c) goto bad;
799     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
800     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
801     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
802     Py_DECREF(default_encoding);
803     return 0;
804 bad:
805     Py_XDECREF(default_encoding);
806     return -1;
807 }
808 #endif
809 #endif
810 
811 
812 /* Test for GCC > 2.95 */
813 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
814   #define likely(x)   __builtin_expect(!!(x), 1)
815   #define unlikely(x) __builtin_expect(!!(x), 0)
816 #else /* !__GNUC__ or GCC < 2.95 */
817   #define likely(x)   (x)
818   #define unlikely(x) (x)
819 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)820 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
821 
822 static PyObject *__pyx_m = NULL;
823 static PyObject *__pyx_d;
824 static PyObject *__pyx_b;
825 static PyObject *__pyx_cython_runtime = NULL;
826 static PyObject *__pyx_empty_tuple;
827 static PyObject *__pyx_empty_bytes;
828 static PyObject *__pyx_empty_unicode;
829 static int __pyx_lineno;
830 static int __pyx_clineno = 0;
831 static const char * __pyx_cfilenm= __FILE__;
832 static const char *__pyx_filename;
833 
834 
835 static const char *__pyx_f[] = {
836   "src/borg/algorithms/msgpack/_packer.pyx",
837   "stringsource",
838   "type.pxd",
839   "bool.pxd",
840   "complex.pxd",
841 };
842 
843 /*--- Type declarations ---*/
844 struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer;
845 struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack;
846 
847 /* "borg/algorithms/msgpack/_packer.pyx":150
848  *         self.pk.buf = NULL
849  *
850  *     cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:             # <<<<<<<<<<<<<<
851  *         cdef long long llval
852  *         cdef unsigned long long ullval
853  */
854 struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack {
855   int __pyx_n;
856   int nest_limit;
857 };
858 
859 /* "borg/algorithms/msgpack/_packer.pyx":56
860  *
861  *
862  * cdef class Packer(object):             # <<<<<<<<<<<<<<
863  *     """
864  *     MessagePack Packer
865  */
866 struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer {
867   PyObject_HEAD
868   struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_vtab;
869   struct msgpack_packer pk;
870   PyObject *_default;
871   PyObject *_bencoding;
872   PyObject *_berrors;
873   char const *encoding;
874   char const *unicode_errors;
875   int strict_types;
876   PyBoolObject *use_float;
877   int autoreset;
878 };
879 
880 
881 
882 struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer {
883   int (*_pack)(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *, PyObject *, struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack *__pyx_optional_args);
884   PyObject *(*pack)(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *, PyObject *, int __pyx_skip_dispatch);
885 };
886 static struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_vtabptr_4borg_10algorithms_7msgpack_7_packer_Packer;
887 
888 /* --- Runtime support code (head) --- */
889 /* Refnanny.proto */
890 #ifndef CYTHON_REFNANNY
891   #define CYTHON_REFNANNY 0
892 #endif
893 #if CYTHON_REFNANNY
894   typedef struct {
895     void (*INCREF)(void*, PyObject*, int);
896     void (*DECREF)(void*, PyObject*, int);
897     void (*GOTREF)(void*, PyObject*, int);
898     void (*GIVEREF)(void*, PyObject*, int);
899     void* (*SetupContext)(const char*, int, const char*);
900     void (*FinishContext)(void**);
901   } __Pyx_RefNannyAPIStruct;
902   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
903   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
904   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
905 #ifdef WITH_THREAD
906   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
907           if (acquire_gil) {\
908               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
909               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
910               PyGILState_Release(__pyx_gilstate_save);\
911           } else {\
912               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
913           }
914 #else
915   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
916           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
917 #endif
918   #define __Pyx_RefNannyFinishContext()\
919           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
920   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
921   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
922   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
923   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
924   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
925   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
926   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
927   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
928 #else
929   #define __Pyx_RefNannyDeclarations
930   #define __Pyx_RefNannySetupContext(name, acquire_gil)
931   #define __Pyx_RefNannyFinishContext()
932   #define __Pyx_INCREF(r) Py_INCREF(r)
933   #define __Pyx_DECREF(r) Py_DECREF(r)
934   #define __Pyx_GOTREF(r)
935   #define __Pyx_GIVEREF(r)
936   #define __Pyx_XINCREF(r) Py_XINCREF(r)
937   #define __Pyx_XDECREF(r) Py_XDECREF(r)
938   #define __Pyx_XGOTREF(r)
939   #define __Pyx_XGIVEREF(r)
940 #endif
941 #define __Pyx_XDECREF_SET(r, v) do {\
942         PyObject *tmp = (PyObject *) r;\
943         r = v; __Pyx_XDECREF(tmp);\
944     } while (0)
945 #define __Pyx_DECREF_SET(r, v) do {\
946         PyObject *tmp = (PyObject *) r;\
947         r = v; __Pyx_DECREF(tmp);\
948     } while (0)
949 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
950 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
951 
952 /* PyObjectGetAttrStr.proto */
953 #if CYTHON_USE_TYPE_SLOTS
954 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
955 #else
956 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
957 #endif
958 
959 /* GetBuiltinName.proto */
960 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
961 
962 /* RaiseArgTupleInvalid.proto */
963 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
964     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
965 
966 /* KeywordStringCheck.proto */
967 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
968 
969 /* PyObjectCall.proto */
970 #if CYTHON_COMPILING_IN_CPYTHON
971 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
972 #else
973 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
974 #endif
975 
976 /* PyThreadStateGet.proto */
977 #if CYTHON_FAST_THREAD_STATE
978 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
979 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
980 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
981 #else
982 #define __Pyx_PyThreadState_declare
983 #define __Pyx_PyThreadState_assign
984 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
985 #endif
986 
987 /* PyErrFetchRestore.proto */
988 #if CYTHON_FAST_THREAD_STATE
989 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
990 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
991 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
992 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
993 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
994 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
995 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
996 #if CYTHON_COMPILING_IN_CPYTHON
997 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
998 #else
999 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1000 #endif
1001 #else
1002 #define __Pyx_PyErr_Clear() PyErr_Clear()
1003 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1004 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1005 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1006 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1007 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1008 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1009 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1010 #endif
1011 
1012 /* RaiseException.proto */
1013 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1014 
1015 /* RaiseDoubleKeywords.proto */
1016 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1017 
1018 /* ParseKeywords.proto */
1019 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1020     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1021     const char* function_name);
1022 
1023 /* ExtTypeTest.proto */
1024 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1025 
1026 /* PyDictVersioning.proto */
1027 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1028 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1029 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1030 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1031     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1032     (cache_var) = (value);
1033 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1034     static PY_UINT64_T __pyx_dict_version = 0;\
1035     static PyObject *__pyx_dict_cached_value = NULL;\
1036     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1037         (VAR) = __pyx_dict_cached_value;\
1038     } else {\
1039         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1040         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1041     }\
1042 }
1043 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1044 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1045 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1046 #else
1047 #define __PYX_GET_DICT_VERSION(dict)  (0)
1048 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1049 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1050 #endif
1051 
1052 /* GetModuleGlobalName.proto */
1053 #if CYTHON_USE_DICT_VERSIONS
1054 #define __Pyx_GetModuleGlobalName(var, name)  {\
1055     static PY_UINT64_T __pyx_dict_version = 0;\
1056     static PyObject *__pyx_dict_cached_value = NULL;\
1057     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1058         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1059         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1060 }
1061 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1062     PY_UINT64_T __pyx_dict_version;\
1063     PyObject *__pyx_dict_cached_value;\
1064     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1065 }
1066 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1067 #else
1068 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1069 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1070 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1071 #endif
1072 
1073 /* PyCFunctionFastCall.proto */
1074 #if CYTHON_FAST_PYCCALL
1075 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1076 #else
1077 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1078 #endif
1079 
1080 /* PyFunctionFastCall.proto */
1081 #if CYTHON_FAST_PYCALL
1082 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1083     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1084 #if 1 || PY_VERSION_HEX < 0x030600B1
1085 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1086 #else
1087 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1088 #endif
1089 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1090     (sizeof(char [1 - 2*!(cond)]) - 1)
1091 #ifndef Py_MEMBER_SIZE
1092 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1093 #endif
1094   static size_t __pyx_pyframe_localsplus_offset = 0;
1095   #include "frameobject.h"
1096   #define __Pxy_PyFrame_Initialize_Offsets()\
1097     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1098      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1099   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1100     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1101 #endif
1102 
1103 /* PyObjectCall2Args.proto */
1104 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1105 
1106 /* PyObjectCallMethO.proto */
1107 #if CYTHON_COMPILING_IN_CPYTHON
1108 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1109 #endif
1110 
1111 /* PyObjectCallOneArg.proto */
1112 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1113 
1114 /* GetTopmostException.proto */
1115 #if CYTHON_USE_EXC_INFO_STACK
1116 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1117 #endif
1118 
1119 /* SaveResetException.proto */
1120 #if CYTHON_FAST_THREAD_STATE
1121 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1122 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1123 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1124 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1125 #else
1126 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1127 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1128 #endif
1129 
1130 /* PyErrExceptionMatches.proto */
1131 #if CYTHON_FAST_THREAD_STATE
1132 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1133 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1134 #else
1135 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1136 #endif
1137 
1138 /* GetException.proto */
1139 #if CYTHON_FAST_THREAD_STATE
1140 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1141 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1142 #else
1143 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1144 #endif
1145 
1146 /* IterFinish.proto */
1147 static CYTHON_INLINE int __Pyx_IterFinish(void);
1148 
1149 /* PyObjectCallNoArg.proto */
1150 #if CYTHON_COMPILING_IN_CPYTHON
1151 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1152 #else
1153 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1154 #endif
1155 
1156 /* PyObjectGetMethod.proto */
1157 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1158 
1159 /* PyObjectCallMethod0.proto */
1160 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1161 
1162 /* RaiseNeedMoreValuesToUnpack.proto */
1163 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1164 
1165 /* RaiseTooManyValuesToUnpack.proto */
1166 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1167 
1168 /* UnpackItemEndCheck.proto */
1169 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1170 
1171 /* RaiseNoneIterError.proto */
1172 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1173 
1174 /* UnpackTupleError.proto */
1175 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1176 
1177 /* UnpackTuple2.proto */
1178 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1179     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1180         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1181             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1182             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1183         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1184 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1185     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1186 static int __Pyx_unpack_tuple2_generic(
1187     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1188 
1189 /* dict_iter.proto */
1190 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1191                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1192 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1193                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1194 
1195 /* PyObject_GenericGetAttrNoDict.proto */
1196 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1197 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1198 #else
1199 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1200 #endif
1201 
1202 /* PyObject_GenericGetAttr.proto */
1203 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1204 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1205 #else
1206 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1207 #endif
1208 
1209 /* SetVTable.proto */
1210 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1211 
1212 /* PyObjectGetAttrStrNoError.proto */
1213 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1214 
1215 /* SetupReduce.proto */
1216 static int __Pyx_setup_reduce(PyObject* type_obj);
1217 
1218 /* TypeImport.proto */
1219 #ifndef __PYX_HAVE_RT_ImportType_proto
1220 #define __PYX_HAVE_RT_ImportType_proto
1221 enum __Pyx_ImportType_CheckSize {
1222    __Pyx_ImportType_CheckSize_Error = 0,
1223    __Pyx_ImportType_CheckSize_Warn = 1,
1224    __Pyx_ImportType_CheckSize_Ignore = 2
1225 };
1226 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1227 #endif
1228 
1229 /* Import.proto */
1230 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1231 
1232 /* ImportFrom.proto */
1233 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1234 
1235 /* CLineInTraceback.proto */
1236 #ifdef CYTHON_CLINE_IN_TRACEBACK
1237 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1238 #else
1239 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1240 #endif
1241 
1242 /* CodeObjectCache.proto */
1243 typedef struct {
1244     PyCodeObject* code_object;
1245     int code_line;
1246 } __Pyx_CodeObjectCacheEntry;
1247 struct __Pyx_CodeObjectCache {
1248     int count;
1249     int max_count;
1250     __Pyx_CodeObjectCacheEntry* entries;
1251 };
1252 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1253 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1254 static PyCodeObject *__pyx_find_code_object(int code_line);
1255 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1256 
1257 /* AddTraceback.proto */
1258 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1259                                int py_line, const char *filename);
1260 
1261 /* GCCDiagnostics.proto */
1262 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1263 #define __Pyx_HAS_GCC_DIAGNOSTIC
1264 #endif
1265 
1266 /* CIntFromPy.proto */
1267 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);
1268 
1269 /* CIntToPy.proto */
1270 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1271 
1272 /* CIntFromPy.proto */
1273 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *);
1274 
1275 /* CIntFromPy.proto */
1276 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1277 
1278 /* CIntFromPy.proto */
1279 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
1280 
1281 /* CIntToPy.proto */
1282 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1283 
1284 /* CIntFromPy.proto */
1285 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1286 
1287 /* FastTypeChecks.proto */
1288 #if CYTHON_COMPILING_IN_CPYTHON
1289 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1290 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1291 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1292 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1293 #else
1294 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1295 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1296 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1297 #endif
1298 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1299 
1300 /* CheckBinaryVersion.proto */
1301 static int __Pyx_check_binary_version(void);
1302 
1303 /* InitStrings.proto */
1304 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1305 
1306 static int __pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer__pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_o, struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack *__pyx_optional_args); /* proto*/
1307 static PyObject *__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer_pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch); /* proto*/
1308 
1309 /* Module declarations from 'cpython.version' */
1310 
1311 /* Module declarations from '__builtin__' */
1312 
1313 /* Module declarations from 'cpython.type' */
1314 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1315 
1316 /* Module declarations from 'libc.string' */
1317 
1318 /* Module declarations from 'libc.stdio' */
1319 
1320 /* Module declarations from 'cpython.object' */
1321 
1322 /* Module declarations from 'cpython.ref' */
1323 
1324 /* Module declarations from 'cpython.exc' */
1325 
1326 /* Module declarations from 'cpython.module' */
1327 
1328 /* Module declarations from 'cpython.mem' */
1329 
1330 /* Module declarations from 'cpython.tuple' */
1331 
1332 /* Module declarations from 'cpython.list' */
1333 
1334 /* Module declarations from 'cpython.sequence' */
1335 
1336 /* Module declarations from 'cpython.mapping' */
1337 
1338 /* Module declarations from 'cpython.iterator' */
1339 
1340 /* Module declarations from 'cpython.number' */
1341 
1342 /* Module declarations from 'cpython.int' */
1343 
1344 /* Module declarations from '__builtin__' */
1345 
1346 /* Module declarations from 'cpython.bool' */
1347 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1348 
1349 /* Module declarations from 'cpython.long' */
1350 
1351 /* Module declarations from 'cpython.float' */
1352 
1353 /* Module declarations from '__builtin__' */
1354 
1355 /* Module declarations from 'cpython.complex' */
1356 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1357 
1358 /* Module declarations from 'cpython.string' */
1359 
1360 /* Module declarations from 'cpython.unicode' */
1361 
1362 /* Module declarations from 'cpython.dict' */
1363 
1364 /* Module declarations from 'cpython.instance' */
1365 
1366 /* Module declarations from 'cpython.function' */
1367 
1368 /* Module declarations from 'cpython.method' */
1369 
1370 /* Module declarations from 'cpython.weakref' */
1371 
1372 /* Module declarations from 'cpython.getargs' */
1373 
1374 /* Module declarations from 'cpython.pythread' */
1375 
1376 /* Module declarations from 'cpython.pystate' */
1377 
1378 /* Module declarations from 'cpython.cobject' */
1379 
1380 /* Module declarations from 'cpython.oldbuffer' */
1381 
1382 /* Module declarations from 'cpython.set' */
1383 
1384 /* Module declarations from 'cpython.buffer' */
1385 
1386 /* Module declarations from 'cpython.bytes' */
1387 
1388 /* Module declarations from 'cpython.pycapsule' */
1389 
1390 /* Module declarations from 'cpython' */
1391 
1392 /* Module declarations from 'borg.algorithms.msgpack._packer' */
1393 static PyTypeObject *__pyx_ptype_4borg_10algorithms_7msgpack_7_packer_Packer = 0;
1394 static int __pyx_v_4borg_10algorithms_7msgpack_7_packer_DEFAULT_RECURSE_LIMIT;
1395 static PY_LONG_LONG __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT;
1396 static CYTHON_INLINE int __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_Check(PyObject *); /*proto*/
1397 static CYTHON_INLINE int __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_CheckExact(PyObject *); /*proto*/
1398 #define __Pyx_MODULE_NAME "borg.algorithms.msgpack._packer"
1399 extern int __pyx_module_is_main_borg__algorithms__msgpack___packer;
1400 int __pyx_module_is_main_borg__algorithms__msgpack___packer = 0;
1401 
1402 /* Implementation of 'borg.algorithms.msgpack._packer' */
1403 static PyObject *__pyx_builtin_MemoryError;
1404 static PyObject *__pyx_builtin_PendingDeprecationWarning;
1405 static PyObject *__pyx_builtin_TypeError;
1406 static PyObject *__pyx_builtin_OverflowError;
1407 static PyObject *__pyx_builtin_RuntimeError;
1408 static const char __pyx_k__7[] = "";
1409 static const char __pyx_k_code[] = "code";
1410 static const char __pyx_k_data[] = "data";
1411 static const char __pyx_k_main[] = "__main__";
1412 static const char __pyx_k_name[] = "__name__";
1413 static const char __pyx_k_pack[] = "pack";
1414 static const char __pyx_k_test[] = "__test__";
1415 static const char __pyx_k_items[] = "items";
1416 static const char __pyx_k_Packer[] = "Packer";
1417 static const char __pyx_k_import[] = "__import__";
1418 static const char __pyx_k_reduce[] = "__reduce__";
1419 static const char __pyx_k_ExtType[] = "ExtType";
1420 static const char __pyx_k_default[] = "default";
1421 static const char __pyx_k_encoding[] = "encoding";
1422 static const char __pyx_k_getstate[] = "__getstate__";
1423 static const char __pyx_k_setstate[] = "__setstate__";
1424 static const char __pyx_k_typecode[] = "typecode";
1425 static const char __pyx_k_TypeError[] = "TypeError";
1426 static const char __pyx_k_autoreset[] = "autoreset";
1427 static const char __pyx_k_iteritems[] = "iteritems";
1428 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1429 static const char __pyx_k_exceptions[] = "exceptions";
1430 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1431 static const char __pyx_k_MemoryError[] = "MemoryError";
1432 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1433 static const char __pyx_k_strict_types[] = "strict_types";
1434 static const char __pyx_k_use_bin_type[] = "use_bin_type";
1435 static const char __pyx_k_OverflowError[] = "OverflowError";
1436 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1437 static const char __pyx_k_PackValueError[] = "PackValueError";
1438 static const char __pyx_k_internal_error[] = "internal error";
1439 static const char __pyx_k_s_is_too_large[] = "%s is too large";
1440 static const char __pyx_k_unicode_errors[] = "unicode_errors";
1441 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1442 static const char __pyx_k_use_single_float[] = "use_single_float";
1443 static const char __pyx_k_PackOverflowError[] = "PackOverflowError";
1444 static const char __pyx_k_can_t_serialize_r[] = "can't serialize %r";
1445 static const char __pyx_k_dict_is_too_large[] = "dict is too large";
1446 static const char __pyx_k_list_is_too_large[] = "list is too large";
1447 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1448 static const char __pyx_k_EXT_data_is_too_large[] = "EXT data is too large";
1449 static const char __pyx_k_memoryview_is_too_large[] = "memoryview is too large";
1450 static const char __pyx_k_recursion_limit_exceeded[] = "recursion limit exceeded.";
1451 static const char __pyx_k_PendingDeprecationWarning[] = "PendingDeprecationWarning";
1452 static const char __pyx_k_Integer_value_out_of_range[] = "Integer value out of range";
1453 static const char __pyx_k_default_must_be_a_callable[] = "default must be a callable.";
1454 static const char __pyx_k_unicode_string_is_too_large[] = "unicode string is too large";
1455 static const char __pyx_k_Unable_to_allocate_internal_buff[] = "Unable to allocate internal buffer.";
1456 static const char __pyx_k_could_not_get_buffer_for_memoryv[] = "could not get buffer for memoryview";
1457 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1458 static PyObject *__pyx_kp_s_EXT_data_is_too_large;
1459 static PyObject *__pyx_n_s_ExtType;
1460 static PyObject *__pyx_kp_s_Integer_value_out_of_range;
1461 static PyObject *__pyx_n_s_MemoryError;
1462 static PyObject *__pyx_n_s_OverflowError;
1463 static PyObject *__pyx_n_s_PackOverflowError;
1464 static PyObject *__pyx_n_s_PackValueError;
1465 static PyObject *__pyx_n_s_Packer;
1466 static PyObject *__pyx_n_s_PendingDeprecationWarning;
1467 static PyObject *__pyx_n_s_RuntimeError;
1468 static PyObject *__pyx_n_s_TypeError;
1469 static PyObject *__pyx_kp_s_Unable_to_allocate_internal_buff;
1470 static PyObject *__pyx_n_s__7;
1471 static PyObject *__pyx_n_s_autoreset;
1472 static PyObject *__pyx_kp_s_can_t_serialize_r;
1473 static PyObject *__pyx_n_s_cline_in_traceback;
1474 static PyObject *__pyx_n_s_code;
1475 static PyObject *__pyx_kp_s_could_not_get_buffer_for_memoryv;
1476 static PyObject *__pyx_n_s_data;
1477 static PyObject *__pyx_n_s_default;
1478 static PyObject *__pyx_kp_s_default_must_be_a_callable;
1479 static PyObject *__pyx_kp_s_dict_is_too_large;
1480 static PyObject *__pyx_n_s_encoding;
1481 static PyObject *__pyx_n_s_exceptions;
1482 static PyObject *__pyx_n_s_getstate;
1483 static PyObject *__pyx_n_s_import;
1484 static PyObject *__pyx_kp_s_internal_error;
1485 static PyObject *__pyx_n_s_items;
1486 static PyObject *__pyx_n_s_iteritems;
1487 static PyObject *__pyx_kp_s_list_is_too_large;
1488 static PyObject *__pyx_n_s_main;
1489 static PyObject *__pyx_kp_s_memoryview_is_too_large;
1490 static PyObject *__pyx_n_s_name;
1491 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1492 static PyObject *__pyx_n_s_pack;
1493 static PyObject *__pyx_n_s_pyx_vtable;
1494 static PyObject *__pyx_kp_s_recursion_limit_exceeded;
1495 static PyObject *__pyx_n_s_reduce;
1496 static PyObject *__pyx_n_s_reduce_cython;
1497 static PyObject *__pyx_n_s_reduce_ex;
1498 static PyObject *__pyx_kp_s_s_is_too_large;
1499 static PyObject *__pyx_n_s_setstate;
1500 static PyObject *__pyx_n_s_setstate_cython;
1501 static PyObject *__pyx_n_s_strict_types;
1502 static PyObject *__pyx_n_s_test;
1503 static PyObject *__pyx_n_s_typecode;
1504 static PyObject *__pyx_n_s_unicode_errors;
1505 static PyObject *__pyx_kp_s_unicode_string_is_too_large;
1506 static PyObject *__pyx_n_s_use_bin_type;
1507 static PyObject *__pyx_n_s_use_single_float;
1508 static int __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer___cinit__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self); /* proto */
1509 static int __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_2__init__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_default, PyObject *__pyx_v_encoding, PyObject *__pyx_v_unicode_errors, int __pyx_v_use_single_float, int __pyx_v_autoreset, int __pyx_v_use_bin_type, int __pyx_v_strict_types); /* proto */
1510 static void __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_4__dealloc__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self); /* proto */
1511 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
1512 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_typecode, PyObject *__pyx_v_data); /* proto */
1513 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size); /* proto */
1514 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size); /* proto */
1515 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_pairs); /* proto */
1516 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self); /* proto */
1517 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self); /* proto */
1518 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self); /* proto */
1519 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1520 static PyObject *__pyx_tp_new_4borg_10algorithms_7msgpack_7_packer_Packer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1521 static PyObject *__pyx_int_0;
1522 static int __pyx_k__3;
1523 static PyObject *__pyx_tuple_;
1524 static PyObject *__pyx_tuple__2;
1525 static PyObject *__pyx_tuple__4;
1526 static PyObject *__pyx_tuple__5;
1527 static PyObject *__pyx_tuple__6;
1528 /* Late includes */
1529 
1530 /* "borg/algorithms/msgpack/_packer.pyx":48
1531  *
1532  *
1533  * cdef inline int PyBytesLike_Check(object o):             # <<<<<<<<<<<<<<
1534  *     return PyBytes_Check(o) or PyByteArray_Check(o)
1535  *
1536  */
1537 
__pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_Check(PyObject * __pyx_v_o)1538 static CYTHON_INLINE int __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_Check(PyObject *__pyx_v_o) {
1539   int __pyx_r;
1540   __Pyx_RefNannyDeclarations
1541   int __pyx_t_1;
1542   int __pyx_t_2;
1543   int __pyx_t_3;
1544   __Pyx_RefNannySetupContext("PyBytesLike_Check", 0);
1545 
1546   /* "borg/algorithms/msgpack/_packer.pyx":49
1547  *
1548  * cdef inline int PyBytesLike_Check(object o):
1549  *     return PyBytes_Check(o) or PyByteArray_Check(o)             # <<<<<<<<<<<<<<
1550  *
1551  *
1552  */
1553   __pyx_t_2 = PyBytes_Check(__pyx_v_o);
1554   if (!__pyx_t_2) {
1555   } else {
1556     __pyx_t_1 = __pyx_t_2;
1557     goto __pyx_L3_bool_binop_done;
1558   }
1559   __pyx_t_3 = PyByteArray_Check(__pyx_v_o);
1560   __pyx_t_1 = __pyx_t_3;
1561   __pyx_L3_bool_binop_done:;
1562   __pyx_r = __pyx_t_1;
1563   goto __pyx_L0;
1564 
1565   /* "borg/algorithms/msgpack/_packer.pyx":48
1566  *
1567  *
1568  * cdef inline int PyBytesLike_Check(object o):             # <<<<<<<<<<<<<<
1569  *     return PyBytes_Check(o) or PyByteArray_Check(o)
1570  *
1571  */
1572 
1573   /* function exit code */
1574   __pyx_L0:;
1575   __Pyx_RefNannyFinishContext();
1576   return __pyx_r;
1577 }
1578 
1579 /* "borg/algorithms/msgpack/_packer.pyx":52
1580  *
1581  *
1582  * cdef inline int PyBytesLike_CheckExact(object o):             # <<<<<<<<<<<<<<
1583  *     return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o)
1584  *
1585  */
1586 
__pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_CheckExact(PyObject * __pyx_v_o)1587 static CYTHON_INLINE int __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_CheckExact(PyObject *__pyx_v_o) {
1588   int __pyx_r;
1589   __Pyx_RefNannyDeclarations
1590   int __pyx_t_1;
1591   int __pyx_t_2;
1592   int __pyx_t_3;
1593   __Pyx_RefNannySetupContext("PyBytesLike_CheckExact", 0);
1594 
1595   /* "borg/algorithms/msgpack/_packer.pyx":53
1596  *
1597  * cdef inline int PyBytesLike_CheckExact(object o):
1598  *     return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o)             # <<<<<<<<<<<<<<
1599  *
1600  *
1601  */
1602   __pyx_t_2 = PyBytes_CheckExact(__pyx_v_o);
1603   if (!__pyx_t_2) {
1604   } else {
1605     __pyx_t_1 = __pyx_t_2;
1606     goto __pyx_L3_bool_binop_done;
1607   }
1608   __pyx_t_3 = PyByteArray_CheckExact(__pyx_v_o);
1609   __pyx_t_1 = __pyx_t_3;
1610   __pyx_L3_bool_binop_done:;
1611   __pyx_r = __pyx_t_1;
1612   goto __pyx_L0;
1613 
1614   /* "borg/algorithms/msgpack/_packer.pyx":52
1615  *
1616  *
1617  * cdef inline int PyBytesLike_CheckExact(object o):             # <<<<<<<<<<<<<<
1618  *     return PyBytes_CheckExact(o) or PyByteArray_CheckExact(o)
1619  *
1620  */
1621 
1622   /* function exit code */
1623   __pyx_L0:;
1624   __Pyx_RefNannyFinishContext();
1625   return __pyx_r;
1626 }
1627 
1628 /* "borg/algorithms/msgpack/_packer.pyx":109
1629  *     cdef bint autoreset
1630  *
1631  *     def __cinit__(self):             # <<<<<<<<<<<<<<
1632  *         cdef int buf_size = 1024*1024
1633  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1634  */
1635 
1636 /* Python wrapper */
1637 static int __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1638 static int __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1639   int __pyx_r;
1640   __Pyx_RefNannyDeclarations
1641   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1642   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
1643     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
1644   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
1645   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer___cinit__(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self));
1646 
1647   /* function exit code */
1648   __Pyx_RefNannyFinishContext();
1649   return __pyx_r;
1650 }
1651 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer___cinit__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self)1652 static int __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer___cinit__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self) {
1653   int __pyx_v_buf_size;
1654   int __pyx_r;
1655   __Pyx_RefNannyDeclarations
1656   int __pyx_t_1;
1657   PyObject *__pyx_t_2 = NULL;
1658   int __pyx_lineno = 0;
1659   const char *__pyx_filename = NULL;
1660   int __pyx_clineno = 0;
1661   __Pyx_RefNannySetupContext("__cinit__", 0);
1662 
1663   /* "borg/algorithms/msgpack/_packer.pyx":110
1664  *
1665  *     def __cinit__(self):
1666  *         cdef int buf_size = 1024*1024             # <<<<<<<<<<<<<<
1667  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1668  *         if self.pk.buf == NULL:
1669  */
1670   __pyx_v_buf_size = 0x100000;
1671 
1672   /* "borg/algorithms/msgpack/_packer.pyx":111
1673  *     def __cinit__(self):
1674  *         cdef int buf_size = 1024*1024
1675  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)             # <<<<<<<<<<<<<<
1676  *         if self.pk.buf == NULL:
1677  *             raise MemoryError("Unable to allocate internal buffer.")
1678  */
1679   __pyx_v_self->pk.buf = ((char *)PyMem_Malloc(__pyx_v_buf_size));
1680 
1681   /* "borg/algorithms/msgpack/_packer.pyx":112
1682  *         cdef int buf_size = 1024*1024
1683  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1684  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
1685  *             raise MemoryError("Unable to allocate internal buffer.")
1686  *         self.pk.buf_size = buf_size
1687  */
1688   __pyx_t_1 = ((__pyx_v_self->pk.buf == NULL) != 0);
1689   if (unlikely(__pyx_t_1)) {
1690 
1691     /* "borg/algorithms/msgpack/_packer.pyx":113
1692  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1693  *         if self.pk.buf == NULL:
1694  *             raise MemoryError("Unable to allocate internal buffer.")             # <<<<<<<<<<<<<<
1695  *         self.pk.buf_size = buf_size
1696  *         self.pk.length = 0
1697  */
1698     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
1699     __Pyx_GOTREF(__pyx_t_2);
1700     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
1701     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1702     __PYX_ERR(0, 113, __pyx_L1_error)
1703 
1704     /* "borg/algorithms/msgpack/_packer.pyx":112
1705  *         cdef int buf_size = 1024*1024
1706  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1707  *         if self.pk.buf == NULL:             # <<<<<<<<<<<<<<
1708  *             raise MemoryError("Unable to allocate internal buffer.")
1709  *         self.pk.buf_size = buf_size
1710  */
1711   }
1712 
1713   /* "borg/algorithms/msgpack/_packer.pyx":114
1714  *         if self.pk.buf == NULL:
1715  *             raise MemoryError("Unable to allocate internal buffer.")
1716  *         self.pk.buf_size = buf_size             # <<<<<<<<<<<<<<
1717  *         self.pk.length = 0
1718  *
1719  */
1720   __pyx_v_self->pk.buf_size = __pyx_v_buf_size;
1721 
1722   /* "borg/algorithms/msgpack/_packer.pyx":115
1723  *             raise MemoryError("Unable to allocate internal buffer.")
1724  *         self.pk.buf_size = buf_size
1725  *         self.pk.length = 0             # <<<<<<<<<<<<<<
1726  *
1727  *     def __init__(self, default=None, encoding=None, unicode_errors=None,
1728  */
1729   __pyx_v_self->pk.length = 0;
1730 
1731   /* "borg/algorithms/msgpack/_packer.pyx":109
1732  *     cdef bint autoreset
1733  *
1734  *     def __cinit__(self):             # <<<<<<<<<<<<<<
1735  *         cdef int buf_size = 1024*1024
1736  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
1737  */
1738 
1739   /* function exit code */
1740   __pyx_r = 0;
1741   goto __pyx_L0;
1742   __pyx_L1_error:;
1743   __Pyx_XDECREF(__pyx_t_2);
1744   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1745   __pyx_r = -1;
1746   __pyx_L0:;
1747   __Pyx_RefNannyFinishContext();
1748   return __pyx_r;
1749 }
1750 
1751 /* "borg/algorithms/msgpack/_packer.pyx":117
1752  *         self.pk.length = 0
1753  *
1754  *     def __init__(self, default=None, encoding=None, unicode_errors=None,             # <<<<<<<<<<<<<<
1755  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
1756  *                  bint strict_types=False):
1757  */
1758 
1759 /* Python wrapper */
1760 static int __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1761 static int __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1762   PyObject *__pyx_v_default = 0;
1763   PyObject *__pyx_v_encoding = 0;
1764   PyObject *__pyx_v_unicode_errors = 0;
1765   int __pyx_v_use_single_float;
1766   int __pyx_v_autoreset;
1767   int __pyx_v_use_bin_type;
1768   int __pyx_v_strict_types;
1769   int __pyx_lineno = 0;
1770   const char *__pyx_filename = NULL;
1771   int __pyx_clineno = 0;
1772   int __pyx_r;
1773   __Pyx_RefNannyDeclarations
1774   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1775   {
1776     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_default,&__pyx_n_s_encoding,&__pyx_n_s_unicode_errors,&__pyx_n_s_use_single_float,&__pyx_n_s_autoreset,&__pyx_n_s_use_bin_type,&__pyx_n_s_strict_types,0};
1777     PyObject* values[7] = {0,0,0,0,0,0,0};
1778     values[0] = ((PyObject *)Py_None);
1779     values[1] = ((PyObject *)Py_None);
1780     values[2] = ((PyObject *)Py_None);
1781     if (unlikely(__pyx_kwds)) {
1782       Py_ssize_t kw_args;
1783       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1784       switch (pos_args) {
1785         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
1786         CYTHON_FALLTHROUGH;
1787         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1788         CYTHON_FALLTHROUGH;
1789         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1790         CYTHON_FALLTHROUGH;
1791         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1792         CYTHON_FALLTHROUGH;
1793         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1794         CYTHON_FALLTHROUGH;
1795         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1796         CYTHON_FALLTHROUGH;
1797         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1798         CYTHON_FALLTHROUGH;
1799         case  0: break;
1800         default: goto __pyx_L5_argtuple_error;
1801       }
1802       kw_args = PyDict_Size(__pyx_kwds);
1803       switch (pos_args) {
1804         case  0:
1805         if (kw_args > 0) {
1806           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
1807           if (value) { values[0] = value; kw_args--; }
1808         }
1809         CYTHON_FALLTHROUGH;
1810         case  1:
1811         if (kw_args > 0) {
1812           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding);
1813           if (value) { values[1] = value; kw_args--; }
1814         }
1815         CYTHON_FALLTHROUGH;
1816         case  2:
1817         if (kw_args > 0) {
1818           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unicode_errors);
1819           if (value) { values[2] = value; kw_args--; }
1820         }
1821         CYTHON_FALLTHROUGH;
1822         case  3:
1823         if (kw_args > 0) {
1824           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_single_float);
1825           if (value) { values[3] = value; kw_args--; }
1826         }
1827         CYTHON_FALLTHROUGH;
1828         case  4:
1829         if (kw_args > 0) {
1830           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_autoreset);
1831           if (value) { values[4] = value; kw_args--; }
1832         }
1833         CYTHON_FALLTHROUGH;
1834         case  5:
1835         if (kw_args > 0) {
1836           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_bin_type);
1837           if (value) { values[5] = value; kw_args--; }
1838         }
1839         CYTHON_FALLTHROUGH;
1840         case  6:
1841         if (kw_args > 0) {
1842           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strict_types);
1843           if (value) { values[6] = value; kw_args--; }
1844         }
1845       }
1846       if (unlikely(kw_args > 0)) {
1847         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 117, __pyx_L3_error)
1848       }
1849     } else {
1850       switch (PyTuple_GET_SIZE(__pyx_args)) {
1851         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
1852         CYTHON_FALLTHROUGH;
1853         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1854         CYTHON_FALLTHROUGH;
1855         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1856         CYTHON_FALLTHROUGH;
1857         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1858         CYTHON_FALLTHROUGH;
1859         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1860         CYTHON_FALLTHROUGH;
1861         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1862         CYTHON_FALLTHROUGH;
1863         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1864         CYTHON_FALLTHROUGH;
1865         case  0: break;
1866         default: goto __pyx_L5_argtuple_error;
1867       }
1868     }
1869     __pyx_v_default = values[0];
1870     __pyx_v_encoding = values[1];
1871     __pyx_v_unicode_errors = values[2];
1872     if (values[3]) {
1873       __pyx_v_use_single_float = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_single_float == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error)
1874     } else {
1875 
1876       /* "borg/algorithms/msgpack/_packer.pyx":118
1877  *
1878  *     def __init__(self, default=None, encoding=None, unicode_errors=None,
1879  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,             # <<<<<<<<<<<<<<
1880  *                  bint strict_types=False):
1881  *         if encoding is not None:
1882  */
1883       __pyx_v_use_single_float = ((int)0);
1884     }
1885     if (values[4]) {
1886       __pyx_v_autoreset = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_autoreset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error)
1887     } else {
1888       __pyx_v_autoreset = ((int)1);
1889     }
1890     if (values[5]) {
1891       __pyx_v_use_bin_type = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_use_bin_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error)
1892     } else {
1893       __pyx_v_use_bin_type = ((int)0);
1894     }
1895     if (values[6]) {
1896       __pyx_v_strict_types = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_strict_types == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
1897     } else {
1898 
1899       /* "borg/algorithms/msgpack/_packer.pyx":119
1900  *     def __init__(self, default=None, encoding=None, unicode_errors=None,
1901  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
1902  *                  bint strict_types=False):             # <<<<<<<<<<<<<<
1903  *         if encoding is not None:
1904  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
1905  */
1906       __pyx_v_strict_types = ((int)0);
1907     }
1908   }
1909   goto __pyx_L4_argument_unpacking_done;
1910   __pyx_L5_argtuple_error:;
1911   __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 117, __pyx_L3_error)
1912   __pyx_L3_error:;
1913   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1914   __Pyx_RefNannyFinishContext();
1915   return -1;
1916   __pyx_L4_argument_unpacking_done:;
1917   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_2__init__(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), __pyx_v_default, __pyx_v_encoding, __pyx_v_unicode_errors, __pyx_v_use_single_float, __pyx_v_autoreset, __pyx_v_use_bin_type, __pyx_v_strict_types);
1918 
1919   /* "borg/algorithms/msgpack/_packer.pyx":117
1920  *         self.pk.length = 0
1921  *
1922  *     def __init__(self, default=None, encoding=None, unicode_errors=None,             # <<<<<<<<<<<<<<
1923  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
1924  *                  bint strict_types=False):
1925  */
1926 
1927   /* function exit code */
1928   __Pyx_RefNannyFinishContext();
1929   return __pyx_r;
1930 }
1931 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_2__init__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_default,PyObject * __pyx_v_encoding,PyObject * __pyx_v_unicode_errors,int __pyx_v_use_single_float,int __pyx_v_autoreset,int __pyx_v_use_bin_type,int __pyx_v_strict_types)1932 static int __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_2__init__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_default, PyObject *__pyx_v_encoding, PyObject *__pyx_v_unicode_errors, int __pyx_v_use_single_float, int __pyx_v_autoreset, int __pyx_v_use_bin_type, int __pyx_v_strict_types) {
1933   int __pyx_r;
1934   __Pyx_RefNannyDeclarations
1935   int __pyx_t_1;
1936   int __pyx_t_2;
1937   int __pyx_t_3;
1938   PyObject *__pyx_t_4 = NULL;
1939   char const *__pyx_t_5;
1940   char const *__pyx_t_6;
1941   int __pyx_lineno = 0;
1942   const char *__pyx_filename = NULL;
1943   int __pyx_clineno = 0;
1944   __Pyx_RefNannySetupContext("__init__", 0);
1945 
1946   /* "borg/algorithms/msgpack/_packer.pyx":120
1947  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
1948  *                  bint strict_types=False):
1949  *         if encoding is not None:             # <<<<<<<<<<<<<<
1950  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
1951  *         self.use_float = use_single_float
1952  */
1953   __pyx_t_1 = (__pyx_v_encoding != Py_None);
1954   __pyx_t_2 = (__pyx_t_1 != 0);
1955   if (__pyx_t_2) {
1956 
1957     /* "borg/algorithms/msgpack/_packer.pyx":121
1958  *                  bint strict_types=False):
1959  *         if encoding is not None:
1960  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)             # <<<<<<<<<<<<<<
1961  *         self.use_float = use_single_float
1962  *         self.strict_types = strict_types
1963  */
1964     __pyx_t_3 = PyErr_WarnEx(__pyx_builtin_PendingDeprecationWarning, ((char *)"encoding is deprecated."), 1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 121, __pyx_L1_error)
1965 
1966     /* "borg/algorithms/msgpack/_packer.pyx":120
1967  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
1968  *                  bint strict_types=False):
1969  *         if encoding is not None:             # <<<<<<<<<<<<<<
1970  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
1971  *         self.use_float = use_single_float
1972  */
1973   }
1974 
1975   /* "borg/algorithms/msgpack/_packer.pyx":122
1976  *         if encoding is not None:
1977  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
1978  *         self.use_float = use_single_float             # <<<<<<<<<<<<<<
1979  *         self.strict_types = strict_types
1980  *         self.autoreset = autoreset
1981  */
1982   __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_use_single_float); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
1983   __Pyx_GOTREF(__pyx_t_4);
1984   if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 122, __pyx_L1_error)
1985   __Pyx_GIVEREF(__pyx_t_4);
1986   __Pyx_GOTREF(__pyx_v_self->use_float);
1987   __Pyx_DECREF(((PyObject *)__pyx_v_self->use_float));
1988   __pyx_v_self->use_float = ((PyBoolObject *)__pyx_t_4);
1989   __pyx_t_4 = 0;
1990 
1991   /* "borg/algorithms/msgpack/_packer.pyx":123
1992  *             PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
1993  *         self.use_float = use_single_float
1994  *         self.strict_types = strict_types             # <<<<<<<<<<<<<<
1995  *         self.autoreset = autoreset
1996  *         self.pk.use_bin_type = use_bin_type
1997  */
1998   __pyx_v_self->strict_types = __pyx_v_strict_types;
1999 
2000   /* "borg/algorithms/msgpack/_packer.pyx":124
2001  *         self.use_float = use_single_float
2002  *         self.strict_types = strict_types
2003  *         self.autoreset = autoreset             # <<<<<<<<<<<<<<
2004  *         self.pk.use_bin_type = use_bin_type
2005  *         if default is not None:
2006  */
2007   __pyx_v_self->autoreset = __pyx_v_autoreset;
2008 
2009   /* "borg/algorithms/msgpack/_packer.pyx":125
2010  *         self.strict_types = strict_types
2011  *         self.autoreset = autoreset
2012  *         self.pk.use_bin_type = use_bin_type             # <<<<<<<<<<<<<<
2013  *         if default is not None:
2014  *             if not PyCallable_Check(default):
2015  */
2016   __pyx_v_self->pk.use_bin_type = __pyx_v_use_bin_type;
2017 
2018   /* "borg/algorithms/msgpack/_packer.pyx":126
2019  *         self.autoreset = autoreset
2020  *         self.pk.use_bin_type = use_bin_type
2021  *         if default is not None:             # <<<<<<<<<<<<<<
2022  *             if not PyCallable_Check(default):
2023  *                 raise TypeError("default must be a callable.")
2024  */
2025   __pyx_t_2 = (__pyx_v_default != Py_None);
2026   __pyx_t_1 = (__pyx_t_2 != 0);
2027   if (__pyx_t_1) {
2028 
2029     /* "borg/algorithms/msgpack/_packer.pyx":127
2030  *         self.pk.use_bin_type = use_bin_type
2031  *         if default is not None:
2032  *             if not PyCallable_Check(default):             # <<<<<<<<<<<<<<
2033  *                 raise TypeError("default must be a callable.")
2034  *         self._default = default
2035  */
2036     __pyx_t_1 = ((!(PyCallable_Check(__pyx_v_default) != 0)) != 0);
2037     if (unlikely(__pyx_t_1)) {
2038 
2039       /* "borg/algorithms/msgpack/_packer.pyx":128
2040  *         if default is not None:
2041  *             if not PyCallable_Check(default):
2042  *                 raise TypeError("default must be a callable.")             # <<<<<<<<<<<<<<
2043  *         self._default = default
2044  *
2045  */
2046       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error)
2047       __Pyx_GOTREF(__pyx_t_4);
2048       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
2049       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2050       __PYX_ERR(0, 128, __pyx_L1_error)
2051 
2052       /* "borg/algorithms/msgpack/_packer.pyx":127
2053  *         self.pk.use_bin_type = use_bin_type
2054  *         if default is not None:
2055  *             if not PyCallable_Check(default):             # <<<<<<<<<<<<<<
2056  *                 raise TypeError("default must be a callable.")
2057  *         self._default = default
2058  */
2059     }
2060 
2061     /* "borg/algorithms/msgpack/_packer.pyx":126
2062  *         self.autoreset = autoreset
2063  *         self.pk.use_bin_type = use_bin_type
2064  *         if default is not None:             # <<<<<<<<<<<<<<
2065  *             if not PyCallable_Check(default):
2066  *                 raise TypeError("default must be a callable.")
2067  */
2068   }
2069 
2070   /* "borg/algorithms/msgpack/_packer.pyx":129
2071  *             if not PyCallable_Check(default):
2072  *                 raise TypeError("default must be a callable.")
2073  *         self._default = default             # <<<<<<<<<<<<<<
2074  *
2075  *         self._bencoding = encoding
2076  */
2077   __Pyx_INCREF(__pyx_v_default);
2078   __Pyx_GIVEREF(__pyx_v_default);
2079   __Pyx_GOTREF(__pyx_v_self->_default);
2080   __Pyx_DECREF(__pyx_v_self->_default);
2081   __pyx_v_self->_default = __pyx_v_default;
2082 
2083   /* "borg/algorithms/msgpack/_packer.pyx":131
2084  *         self._default = default
2085  *
2086  *         self._bencoding = encoding             # <<<<<<<<<<<<<<
2087  *         if encoding is None:
2088  *             if PY_MAJOR_VERSION < 3:
2089  */
2090   __Pyx_INCREF(__pyx_v_encoding);
2091   __Pyx_GIVEREF(__pyx_v_encoding);
2092   __Pyx_GOTREF(__pyx_v_self->_bencoding);
2093   __Pyx_DECREF(__pyx_v_self->_bencoding);
2094   __pyx_v_self->_bencoding = __pyx_v_encoding;
2095 
2096   /* "borg/algorithms/msgpack/_packer.pyx":132
2097  *
2098  *         self._bencoding = encoding
2099  *         if encoding is None:             # <<<<<<<<<<<<<<
2100  *             if PY_MAJOR_VERSION < 3:
2101  *                 self.encoding = 'utf-8'
2102  */
2103   __pyx_t_1 = (__pyx_v_encoding == Py_None);
2104   __pyx_t_2 = (__pyx_t_1 != 0);
2105   if (__pyx_t_2) {
2106 
2107     /* "borg/algorithms/msgpack/_packer.pyx":133
2108  *         self._bencoding = encoding
2109  *         if encoding is None:
2110  *             if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
2111  *                 self.encoding = 'utf-8'
2112  *             else:
2113  */
2114     __pyx_t_2 = ((PY_MAJOR_VERSION < 3) != 0);
2115     if (__pyx_t_2) {
2116 
2117       /* "borg/algorithms/msgpack/_packer.pyx":134
2118  *         if encoding is None:
2119  *             if PY_MAJOR_VERSION < 3:
2120  *                 self.encoding = 'utf-8'             # <<<<<<<<<<<<<<
2121  *             else:
2122  *                 self.encoding = NULL
2123  */
2124       __pyx_v_self->encoding = ((char const *)"utf-8");
2125 
2126       /* "borg/algorithms/msgpack/_packer.pyx":133
2127  *         self._bencoding = encoding
2128  *         if encoding is None:
2129  *             if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
2130  *                 self.encoding = 'utf-8'
2131  *             else:
2132  */
2133       goto __pyx_L7;
2134     }
2135 
2136     /* "borg/algorithms/msgpack/_packer.pyx":136
2137  *                 self.encoding = 'utf-8'
2138  *             else:
2139  *                 self.encoding = NULL             # <<<<<<<<<<<<<<
2140  *         else:
2141  *             self.encoding = self._bencoding
2142  */
2143     /*else*/ {
2144       __pyx_v_self->encoding = NULL;
2145     }
2146     __pyx_L7:;
2147 
2148     /* "borg/algorithms/msgpack/_packer.pyx":132
2149  *
2150  *         self._bencoding = encoding
2151  *         if encoding is None:             # <<<<<<<<<<<<<<
2152  *             if PY_MAJOR_VERSION < 3:
2153  *                 self.encoding = 'utf-8'
2154  */
2155     goto __pyx_L6;
2156   }
2157 
2158   /* "borg/algorithms/msgpack/_packer.pyx":138
2159  *                 self.encoding = NULL
2160  *         else:
2161  *             self.encoding = self._bencoding             # <<<<<<<<<<<<<<
2162  *
2163  *         self._berrors = unicode_errors
2164  */
2165   /*else*/ {
2166     __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_self->_bencoding); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
2167     __pyx_v_self->encoding = __pyx_t_5;
2168   }
2169   __pyx_L6:;
2170 
2171   /* "borg/algorithms/msgpack/_packer.pyx":140
2172  *             self.encoding = self._bencoding
2173  *
2174  *         self._berrors = unicode_errors             # <<<<<<<<<<<<<<
2175  *         if unicode_errors is None:
2176  *             self.unicode_errors = NULL
2177  */
2178   __Pyx_INCREF(__pyx_v_unicode_errors);
2179   __Pyx_GIVEREF(__pyx_v_unicode_errors);
2180   __Pyx_GOTREF(__pyx_v_self->_berrors);
2181   __Pyx_DECREF(__pyx_v_self->_berrors);
2182   __pyx_v_self->_berrors = __pyx_v_unicode_errors;
2183 
2184   /* "borg/algorithms/msgpack/_packer.pyx":141
2185  *
2186  *         self._berrors = unicode_errors
2187  *         if unicode_errors is None:             # <<<<<<<<<<<<<<
2188  *             self.unicode_errors = NULL
2189  *         else:
2190  */
2191   __pyx_t_2 = (__pyx_v_unicode_errors == Py_None);
2192   __pyx_t_1 = (__pyx_t_2 != 0);
2193   if (__pyx_t_1) {
2194 
2195     /* "borg/algorithms/msgpack/_packer.pyx":142
2196  *         self._berrors = unicode_errors
2197  *         if unicode_errors is None:
2198  *             self.unicode_errors = NULL             # <<<<<<<<<<<<<<
2199  *         else:
2200  *             self.unicode_errors = self._berrors
2201  */
2202     __pyx_v_self->unicode_errors = NULL;
2203 
2204     /* "borg/algorithms/msgpack/_packer.pyx":141
2205  *
2206  *         self._berrors = unicode_errors
2207  *         if unicode_errors is None:             # <<<<<<<<<<<<<<
2208  *             self.unicode_errors = NULL
2209  *         else:
2210  */
2211     goto __pyx_L8;
2212   }
2213 
2214   /* "borg/algorithms/msgpack/_packer.pyx":144
2215  *             self.unicode_errors = NULL
2216  *         else:
2217  *             self.unicode_errors = self._berrors             # <<<<<<<<<<<<<<
2218  *
2219  *     def __dealloc__(self):
2220  */
2221   /*else*/ {
2222     __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->_berrors); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error)
2223     __pyx_v_self->unicode_errors = __pyx_t_6;
2224   }
2225   __pyx_L8:;
2226 
2227   /* "borg/algorithms/msgpack/_packer.pyx":117
2228  *         self.pk.length = 0
2229  *
2230  *     def __init__(self, default=None, encoding=None, unicode_errors=None,             # <<<<<<<<<<<<<<
2231  *                  bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
2232  *                  bint strict_types=False):
2233  */
2234 
2235   /* function exit code */
2236   __pyx_r = 0;
2237   goto __pyx_L0;
2238   __pyx_L1_error:;
2239   __Pyx_XDECREF(__pyx_t_4);
2240   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2241   __pyx_r = -1;
2242   __pyx_L0:;
2243   __Pyx_RefNannyFinishContext();
2244   return __pyx_r;
2245 }
2246 
2247 /* "borg/algorithms/msgpack/_packer.pyx":146
2248  *             self.unicode_errors = self._berrors
2249  *
2250  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2251  *         PyMem_Free(self.pk.buf)
2252  *         self.pk.buf = NULL
2253  */
2254 
2255 /* Python wrapper */
2256 static void __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_5__dealloc__(PyObject * __pyx_v_self)2257 static void __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_5__dealloc__(PyObject *__pyx_v_self) {
2258   __Pyx_RefNannyDeclarations
2259   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2260   __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_4__dealloc__(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self));
2261 
2262   /* function exit code */
2263   __Pyx_RefNannyFinishContext();
2264 }
2265 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_4__dealloc__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self)2266 static void __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_4__dealloc__(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self) {
2267   __Pyx_RefNannyDeclarations
2268   __Pyx_RefNannySetupContext("__dealloc__", 0);
2269 
2270   /* "borg/algorithms/msgpack/_packer.pyx":147
2271  *
2272  *     def __dealloc__(self):
2273  *         PyMem_Free(self.pk.buf)             # <<<<<<<<<<<<<<
2274  *         self.pk.buf = NULL
2275  *
2276  */
2277   PyMem_Free(__pyx_v_self->pk.buf);
2278 
2279   /* "borg/algorithms/msgpack/_packer.pyx":148
2280  *     def __dealloc__(self):
2281  *         PyMem_Free(self.pk.buf)
2282  *         self.pk.buf = NULL             # <<<<<<<<<<<<<<
2283  *
2284  *     cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:
2285  */
2286   __pyx_v_self->pk.buf = NULL;
2287 
2288   /* "borg/algorithms/msgpack/_packer.pyx":146
2289  *             self.unicode_errors = self._berrors
2290  *
2291  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2292  *         PyMem_Free(self.pk.buf)
2293  *         self.pk.buf = NULL
2294  */
2295 
2296   /* function exit code */
2297   __Pyx_RefNannyFinishContext();
2298 }
2299 
2300 /* "borg/algorithms/msgpack/_packer.pyx":150
2301  *         self.pk.buf = NULL
2302  *
2303  *     cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:             # <<<<<<<<<<<<<<
2304  *         cdef long long llval
2305  *         cdef unsigned long long ullval
2306  */
2307 
__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer__pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_o,struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack * __pyx_optional_args)2308 static int __pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer__pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_o, struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack *__pyx_optional_args) {
2309   int __pyx_v_nest_limit = __pyx_k__3;
2310   PY_LONG_LONG __pyx_v_llval;
2311   unsigned PY_LONG_LONG __pyx_v_ullval;
2312   long __pyx_v_longval;
2313   float __pyx_v_fval;
2314   double __pyx_v_dval;
2315   char *__pyx_v_rawval;
2316   int __pyx_v_ret;
2317   PyObject *__pyx_v_d = 0;
2318   Py_ssize_t __pyx_v_L;
2319   int __pyx_v_default_used;
2320   int __pyx_v_strict_types;
2321   Py_buffer __pyx_v_view;
2322   CYTHON_UNUSED PyObject *__pyx_v_oe = NULL;
2323   PyObject *__pyx_v_k = NULL;
2324   PyObject *__pyx_v_v = NULL;
2325   int __pyx_r;
2326   __Pyx_RefNannyDeclarations
2327   int __pyx_t_1;
2328   PyObject *__pyx_t_2 = NULL;
2329   PyObject *__pyx_t_3 = NULL;
2330   PyObject *__pyx_t_4 = NULL;
2331   int __pyx_t_5;
2332   PyObject *__pyx_t_6 = NULL;
2333   PyObject *__pyx_t_7 = NULL;
2334   PyObject *__pyx_t_8 = NULL;
2335   unsigned PY_LONG_LONG __pyx_t_9;
2336   PY_LONG_LONG __pyx_t_10;
2337   int __pyx_t_11;
2338   int __pyx_t_12;
2339   PyObject *__pyx_t_13 = NULL;
2340   PyObject *__pyx_t_14 = NULL;
2341   PyObject *__pyx_t_15 = NULL;
2342   long __pyx_t_16;
2343   float __pyx_t_17;
2344   double __pyx_t_18;
2345   Py_ssize_t __pyx_t_19;
2346   char *__pyx_t_20;
2347   Py_ssize_t __pyx_t_21;
2348   int __pyx_t_22;
2349   struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack __pyx_t_23;
2350   PyObject *(*__pyx_t_24)(PyObject *);
2351   PyObject *(*__pyx_t_25)(PyObject *);
2352   int __pyx_lineno = 0;
2353   const char *__pyx_filename = NULL;
2354   int __pyx_clineno = 0;
2355   __Pyx_RefNannySetupContext("_pack", 0);
2356   if (__pyx_optional_args) {
2357     if (__pyx_optional_args->__pyx_n > 0) {
2358       __pyx_v_nest_limit = __pyx_optional_args->nest_limit;
2359     }
2360   }
2361   __Pyx_INCREF(__pyx_v_o);
2362 
2363   /* "borg/algorithms/msgpack/_packer.pyx":160
2364  *         cdef dict d
2365  *         cdef Py_ssize_t L
2366  *         cdef int default_used = 0             # <<<<<<<<<<<<<<
2367  *         cdef bint strict_types = self.strict_types
2368  *         cdef Py_buffer view
2369  */
2370   __pyx_v_default_used = 0;
2371 
2372   /* "borg/algorithms/msgpack/_packer.pyx":161
2373  *         cdef Py_ssize_t L
2374  *         cdef int default_used = 0
2375  *         cdef bint strict_types = self.strict_types             # <<<<<<<<<<<<<<
2376  *         cdef Py_buffer view
2377  *
2378  */
2379   __pyx_t_1 = __pyx_v_self->strict_types;
2380   __pyx_v_strict_types = __pyx_t_1;
2381 
2382   /* "borg/algorithms/msgpack/_packer.pyx":164
2383  *         cdef Py_buffer view
2384  *
2385  *         if nest_limit < 0:             # <<<<<<<<<<<<<<
2386  *             raise PackValueError("recursion limit exceeded.")
2387  *
2388  */
2389   __pyx_t_1 = ((__pyx_v_nest_limit < 0) != 0);
2390   if (unlikely(__pyx_t_1)) {
2391 
2392     /* "borg/algorithms/msgpack/_packer.pyx":165
2393  *
2394  *         if nest_limit < 0:
2395  *             raise PackValueError("recursion limit exceeded.")             # <<<<<<<<<<<<<<
2396  *
2397  *         while True:
2398  */
2399     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error)
2400     __Pyx_GOTREF(__pyx_t_3);
2401     __pyx_t_4 = NULL;
2402     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2403       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2404       if (likely(__pyx_t_4)) {
2405         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2406         __Pyx_INCREF(__pyx_t_4);
2407         __Pyx_INCREF(function);
2408         __Pyx_DECREF_SET(__pyx_t_3, function);
2409       }
2410     }
2411     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_recursion_limit_exceeded) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_recursion_limit_exceeded);
2412     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2413     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
2414     __Pyx_GOTREF(__pyx_t_2);
2415     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2416     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2417     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2418     __PYX_ERR(0, 165, __pyx_L1_error)
2419 
2420     /* "borg/algorithms/msgpack/_packer.pyx":164
2421  *         cdef Py_buffer view
2422  *
2423  *         if nest_limit < 0:             # <<<<<<<<<<<<<<
2424  *             raise PackValueError("recursion limit exceeded.")
2425  *
2426  */
2427   }
2428 
2429   /* "borg/algorithms/msgpack/_packer.pyx":167
2430  *             raise PackValueError("recursion limit exceeded.")
2431  *
2432  *         while True:             # <<<<<<<<<<<<<<
2433  *             if o is None:
2434  *                 ret = msgpack_pack_nil(&self.pk)
2435  */
2436   while (1) {
2437 
2438     /* "borg/algorithms/msgpack/_packer.pyx":168
2439  *
2440  *         while True:
2441  *             if o is None:             # <<<<<<<<<<<<<<
2442  *                 ret = msgpack_pack_nil(&self.pk)
2443  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2444  */
2445     __pyx_t_1 = (__pyx_v_o == Py_None);
2446     __pyx_t_5 = (__pyx_t_1 != 0);
2447     if (__pyx_t_5) {
2448 
2449       /* "borg/algorithms/msgpack/_packer.pyx":169
2450  *         while True:
2451  *             if o is None:
2452  *                 ret = msgpack_pack_nil(&self.pk)             # <<<<<<<<<<<<<<
2453  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2454  *                 if o:
2455  */
2456       __pyx_v_ret = msgpack_pack_nil((&__pyx_v_self->pk));
2457 
2458       /* "borg/algorithms/msgpack/_packer.pyx":168
2459  *
2460  *         while True:
2461  *             if o is None:             # <<<<<<<<<<<<<<
2462  *                 ret = msgpack_pack_nil(&self.pk)
2463  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2464  */
2465       goto __pyx_L6;
2466     }
2467 
2468     /* "borg/algorithms/msgpack/_packer.pyx":170
2469  *             if o is None:
2470  *                 ret = msgpack_pack_nil(&self.pk)
2471  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):             # <<<<<<<<<<<<<<
2472  *                 if o:
2473  *                     ret = msgpack_pack_true(&self.pk)
2474  */
2475     if ((__pyx_v_strict_types != 0)) {
2476       __pyx_t_5 = PyBool_Check(__pyx_v_o);
2477     } else {
2478       __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_ptype_7cpython_4bool_bool);
2479       __pyx_t_5 = __pyx_t_1;
2480     }
2481     __pyx_t_1 = (__pyx_t_5 != 0);
2482     if (__pyx_t_1) {
2483 
2484       /* "borg/algorithms/msgpack/_packer.pyx":171
2485  *                 ret = msgpack_pack_nil(&self.pk)
2486  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2487  *                 if o:             # <<<<<<<<<<<<<<
2488  *                     ret = msgpack_pack_true(&self.pk)
2489  *                 else:
2490  */
2491       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_o); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
2492       if (__pyx_t_1) {
2493 
2494         /* "borg/algorithms/msgpack/_packer.pyx":172
2495  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2496  *                 if o:
2497  *                     ret = msgpack_pack_true(&self.pk)             # <<<<<<<<<<<<<<
2498  *                 else:
2499  *                     ret = msgpack_pack_false(&self.pk)
2500  */
2501         __pyx_v_ret = msgpack_pack_true((&__pyx_v_self->pk));
2502 
2503         /* "borg/algorithms/msgpack/_packer.pyx":171
2504  *                 ret = msgpack_pack_nil(&self.pk)
2505  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):
2506  *                 if o:             # <<<<<<<<<<<<<<
2507  *                     ret = msgpack_pack_true(&self.pk)
2508  *                 else:
2509  */
2510         goto __pyx_L7;
2511       }
2512 
2513       /* "borg/algorithms/msgpack/_packer.pyx":174
2514  *                     ret = msgpack_pack_true(&self.pk)
2515  *                 else:
2516  *                     ret = msgpack_pack_false(&self.pk)             # <<<<<<<<<<<<<<
2517  *             elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):
2518  *                 # PyInt_Check(long) is True for Python 3.
2519  */
2520       /*else*/ {
2521         __pyx_v_ret = msgpack_pack_false((&__pyx_v_self->pk));
2522       }
2523       __pyx_L7:;
2524 
2525       /* "borg/algorithms/msgpack/_packer.pyx":170
2526  *             if o is None:
2527  *                 ret = msgpack_pack_nil(&self.pk)
2528  *             elif PyBool_Check(o) if strict_types else isinstance(o, bool):             # <<<<<<<<<<<<<<
2529  *                 if o:
2530  *                     ret = msgpack_pack_true(&self.pk)
2531  */
2532       goto __pyx_L6;
2533     }
2534 
2535     /* "borg/algorithms/msgpack/_packer.pyx":175
2536  *                 else:
2537  *                     ret = msgpack_pack_false(&self.pk)
2538  *             elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):             # <<<<<<<<<<<<<<
2539  *                 # PyInt_Check(long) is True for Python 3.
2540  *                 # So we should test long before int.
2541  */
2542     if ((__pyx_v_strict_types != 0)) {
2543       __pyx_t_1 = PyLong_CheckExact(__pyx_v_o);
2544     } else {
2545       __pyx_t_1 = PyLong_Check(__pyx_v_o);
2546     }
2547     __pyx_t_5 = (__pyx_t_1 != 0);
2548     if (__pyx_t_5) {
2549 
2550       /* "borg/algorithms/msgpack/_packer.pyx":178
2551  *                 # PyInt_Check(long) is True for Python 3.
2552  *                 # So we should test long before int.
2553  *                 try:             # <<<<<<<<<<<<<<
2554  *                     if o > 0:
2555  *                         ullval = o
2556  */
2557       {
2558         __Pyx_PyThreadState_declare
2559         __Pyx_PyThreadState_assign
2560         __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
2561         __Pyx_XGOTREF(__pyx_t_6);
2562         __Pyx_XGOTREF(__pyx_t_7);
2563         __Pyx_XGOTREF(__pyx_t_8);
2564         /*try:*/ {
2565 
2566           /* "borg/algorithms/msgpack/_packer.pyx":179
2567  *                 # So we should test long before int.
2568  *                 try:
2569  *                     if o > 0:             # <<<<<<<<<<<<<<
2570  *                         ullval = o
2571  *                         ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2572  */
2573           __pyx_t_2 = PyObject_RichCompare(__pyx_v_o, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L8_error)
2574           __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 179, __pyx_L8_error)
2575           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2576           if (__pyx_t_5) {
2577 
2578             /* "borg/algorithms/msgpack/_packer.pyx":180
2579  *                 try:
2580  *                     if o > 0:
2581  *                         ullval = o             # <<<<<<<<<<<<<<
2582  *                         ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2583  *                     else:
2584  */
2585             __pyx_t_9 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_v_o); if (unlikely((__pyx_t_9 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L8_error)
2586             __pyx_v_ullval = __pyx_t_9;
2587 
2588             /* "borg/algorithms/msgpack/_packer.pyx":181
2589  *                     if o > 0:
2590  *                         ullval = o
2591  *                         ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)             # <<<<<<<<<<<<<<
2592  *                     else:
2593  *                         llval = o
2594  */
2595             __pyx_v_ret = msgpack_pack_unsigned_long_long((&__pyx_v_self->pk), __pyx_v_ullval);
2596 
2597             /* "borg/algorithms/msgpack/_packer.pyx":179
2598  *                 # So we should test long before int.
2599  *                 try:
2600  *                     if o > 0:             # <<<<<<<<<<<<<<
2601  *                         ullval = o
2602  *                         ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2603  */
2604             goto __pyx_L16;
2605           }
2606 
2607           /* "borg/algorithms/msgpack/_packer.pyx":183
2608  *                         ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
2609  *                     else:
2610  *                         llval = o             # <<<<<<<<<<<<<<
2611  *                         ret = msgpack_pack_long_long(&self.pk, llval)
2612  *                 except OverflowError as oe:
2613  */
2614           /*else*/ {
2615             __pyx_t_10 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_o); if (unlikely((__pyx_t_10 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L8_error)
2616             __pyx_v_llval = __pyx_t_10;
2617 
2618             /* "borg/algorithms/msgpack/_packer.pyx":184
2619  *                     else:
2620  *                         llval = o
2621  *                         ret = msgpack_pack_long_long(&self.pk, llval)             # <<<<<<<<<<<<<<
2622  *                 except OverflowError as oe:
2623  *                     if not default_used and self._default is not None:
2624  */
2625             __pyx_v_ret = msgpack_pack_long_long((&__pyx_v_self->pk), __pyx_v_llval);
2626           }
2627           __pyx_L16:;
2628 
2629           /* "borg/algorithms/msgpack/_packer.pyx":178
2630  *                 # PyInt_Check(long) is True for Python 3.
2631  *                 # So we should test long before int.
2632  *                 try:             # <<<<<<<<<<<<<<
2633  *                     if o > 0:
2634  *                         ullval = o
2635  */
2636         }
2637         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2638         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2639         __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2640         goto __pyx_L15_try_end;
2641         __pyx_L8_error:;
2642         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2643         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2644         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2645 
2646         /* "borg/algorithms/msgpack/_packer.pyx":185
2647  *                         llval = o
2648  *                         ret = msgpack_pack_long_long(&self.pk, llval)
2649  *                 except OverflowError as oe:             # <<<<<<<<<<<<<<
2650  *                     if not default_used and self._default is not None:
2651  *                         o = self._default(o)
2652  */
2653         __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
2654         if (__pyx_t_11) {
2655           __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer._pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
2656           if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 185, __pyx_L10_except_error)
2657           __Pyx_GOTREF(__pyx_t_2);
2658           __Pyx_GOTREF(__pyx_t_3);
2659           __Pyx_GOTREF(__pyx_t_4);
2660           __Pyx_INCREF(__pyx_t_3);
2661           __Pyx_XDECREF_SET(__pyx_v_oe, __pyx_t_3);
2662 
2663           /* "borg/algorithms/msgpack/_packer.pyx":186
2664  *                         ret = msgpack_pack_long_long(&self.pk, llval)
2665  *                 except OverflowError as oe:
2666  *                     if not default_used and self._default is not None:             # <<<<<<<<<<<<<<
2667  *                         o = self._default(o)
2668  *                         default_used = True
2669  */
2670           __pyx_t_1 = ((!(__pyx_v_default_used != 0)) != 0);
2671           if (__pyx_t_1) {
2672           } else {
2673             __pyx_t_5 = __pyx_t_1;
2674             goto __pyx_L20_bool_binop_done;
2675           }
2676           __pyx_t_1 = (__pyx_v_self->_default != Py_None);
2677           __pyx_t_12 = (__pyx_t_1 != 0);
2678           __pyx_t_5 = __pyx_t_12;
2679           __pyx_L20_bool_binop_done:;
2680           if (likely(__pyx_t_5)) {
2681 
2682             /* "borg/algorithms/msgpack/_packer.pyx":187
2683  *                 except OverflowError as oe:
2684  *                     if not default_used and self._default is not None:
2685  *                         o = self._default(o)             # <<<<<<<<<<<<<<
2686  *                         default_used = True
2687  *                         continue
2688  */
2689             __Pyx_INCREF(__pyx_v_self->_default);
2690             __pyx_t_14 = __pyx_v_self->_default; __pyx_t_15 = NULL;
2691             if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
2692               __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
2693               if (likely(__pyx_t_15)) {
2694                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
2695                 __Pyx_INCREF(__pyx_t_15);
2696                 __Pyx_INCREF(function);
2697                 __Pyx_DECREF_SET(__pyx_t_14, function);
2698               }
2699             }
2700             __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_v_o) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_o);
2701             __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
2702             if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 187, __pyx_L10_except_error)
2703             __Pyx_GOTREF(__pyx_t_13);
2704             __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
2705             __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_13);
2706             __pyx_t_13 = 0;
2707 
2708             /* "borg/algorithms/msgpack/_packer.pyx":188
2709  *                     if not default_used and self._default is not None:
2710  *                         o = self._default(o)
2711  *                         default_used = True             # <<<<<<<<<<<<<<
2712  *                         continue
2713  *                     else:
2714  */
2715             __pyx_v_default_used = 1;
2716 
2717             /* "borg/algorithms/msgpack/_packer.pyx":189
2718  *                         o = self._default(o)
2719  *                         default_used = True
2720  *                         continue             # <<<<<<<<<<<<<<
2721  *                     else:
2722  *                         raise PackOverflowError("Integer value out of range")
2723  */
2724             goto __pyx_L18_except_continue;
2725 
2726             /* "borg/algorithms/msgpack/_packer.pyx":186
2727  *                         ret = msgpack_pack_long_long(&self.pk, llval)
2728  *                 except OverflowError as oe:
2729  *                     if not default_used and self._default is not None:             # <<<<<<<<<<<<<<
2730  *                         o = self._default(o)
2731  *                         default_used = True
2732  */
2733           }
2734 
2735           /* "borg/algorithms/msgpack/_packer.pyx":191
2736  *                         continue
2737  *                     else:
2738  *                         raise PackOverflowError("Integer value out of range")             # <<<<<<<<<<<<<<
2739  *             elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2740  *                 longval = o
2741  */
2742           /*else*/ {
2743             __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PackOverflowError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 191, __pyx_L10_except_error)
2744             __Pyx_GOTREF(__pyx_t_14);
2745             __pyx_t_15 = NULL;
2746             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
2747               __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
2748               if (likely(__pyx_t_15)) {
2749                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
2750                 __Pyx_INCREF(__pyx_t_15);
2751                 __Pyx_INCREF(function);
2752                 __Pyx_DECREF_SET(__pyx_t_14, function);
2753               }
2754             }
2755             __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_kp_s_Integer_value_out_of_range) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_Integer_value_out_of_range);
2756             __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
2757             if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 191, __pyx_L10_except_error)
2758             __Pyx_GOTREF(__pyx_t_13);
2759             __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
2760             __Pyx_Raise(__pyx_t_13, 0, 0, 0);
2761             __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2762             __PYX_ERR(0, 191, __pyx_L10_except_error)
2763           }
2764           __pyx_L18_except_continue:;
2765           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2766           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2767           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2768           goto __pyx_L14_try_continue;
2769         }
2770         goto __pyx_L10_except_error;
2771         __pyx_L10_except_error:;
2772 
2773         /* "borg/algorithms/msgpack/_packer.pyx":178
2774  *                 # PyInt_Check(long) is True for Python 3.
2775  *                 # So we should test long before int.
2776  *                 try:             # <<<<<<<<<<<<<<
2777  *                     if o > 0:
2778  *                         ullval = o
2779  */
2780         __Pyx_XGIVEREF(__pyx_t_6);
2781         __Pyx_XGIVEREF(__pyx_t_7);
2782         __Pyx_XGIVEREF(__pyx_t_8);
2783         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
2784         goto __pyx_L1_error;
2785         __pyx_L14_try_continue:;
2786         __Pyx_XGIVEREF(__pyx_t_6);
2787         __Pyx_XGIVEREF(__pyx_t_7);
2788         __Pyx_XGIVEREF(__pyx_t_8);
2789         __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
2790         goto __pyx_L4_continue;
2791         __pyx_L15_try_end:;
2792       }
2793 
2794       /* "borg/algorithms/msgpack/_packer.pyx":175
2795  *                 else:
2796  *                     ret = msgpack_pack_false(&self.pk)
2797  *             elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):             # <<<<<<<<<<<<<<
2798  *                 # PyInt_Check(long) is True for Python 3.
2799  *                 # So we should test long before int.
2800  */
2801       goto __pyx_L6;
2802     }
2803 
2804     /* "borg/algorithms/msgpack/_packer.pyx":192
2805  *                     else:
2806  *                         raise PackOverflowError("Integer value out of range")
2807  *             elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):             # <<<<<<<<<<<<<<
2808  *                 longval = o
2809  *                 ret = msgpack_pack_long(&self.pk, longval)
2810  */
2811     if ((__pyx_v_strict_types != 0)) {
2812       __pyx_t_5 = PyInt_CheckExact(__pyx_v_o);
2813     } else {
2814       __pyx_t_5 = PyInt_Check(__pyx_v_o);
2815     }
2816     __pyx_t_12 = (__pyx_t_5 != 0);
2817     if (__pyx_t_12) {
2818 
2819       /* "borg/algorithms/msgpack/_packer.pyx":193
2820  *                         raise PackOverflowError("Integer value out of range")
2821  *             elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2822  *                 longval = o             # <<<<<<<<<<<<<<
2823  *                 ret = msgpack_pack_long(&self.pk, longval)
2824  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2825  */
2826       __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_v_o); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error)
2827       __pyx_v_longval = __pyx_t_16;
2828 
2829       /* "borg/algorithms/msgpack/_packer.pyx":194
2830  *             elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):
2831  *                 longval = o
2832  *                 ret = msgpack_pack_long(&self.pk, longval)             # <<<<<<<<<<<<<<
2833  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2834  *                 if self.use_float:
2835  */
2836       __pyx_v_ret = msgpack_pack_long((&__pyx_v_self->pk), __pyx_v_longval);
2837 
2838       /* "borg/algorithms/msgpack/_packer.pyx":192
2839  *                     else:
2840  *                         raise PackOverflowError("Integer value out of range")
2841  *             elif PyInt_CheckExact(o) if strict_types else PyInt_Check(o):             # <<<<<<<<<<<<<<
2842  *                 longval = o
2843  *                 ret = msgpack_pack_long(&self.pk, longval)
2844  */
2845       goto __pyx_L6;
2846     }
2847 
2848     /* "borg/algorithms/msgpack/_packer.pyx":195
2849  *                 longval = o
2850  *                 ret = msgpack_pack_long(&self.pk, longval)
2851  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):             # <<<<<<<<<<<<<<
2852  *                 if self.use_float:
2853  *                    fval = o
2854  */
2855     if ((__pyx_v_strict_types != 0)) {
2856       __pyx_t_12 = PyFloat_CheckExact(__pyx_v_o);
2857     } else {
2858       __pyx_t_12 = PyFloat_Check(__pyx_v_o);
2859     }
2860     __pyx_t_5 = (__pyx_t_12 != 0);
2861     if (__pyx_t_5) {
2862 
2863       /* "borg/algorithms/msgpack/_packer.pyx":196
2864  *                 ret = msgpack_pack_long(&self.pk, longval)
2865  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2866  *                 if self.use_float:             # <<<<<<<<<<<<<<
2867  *                    fval = o
2868  *                    ret = msgpack_pack_float(&self.pk, fval)
2869  */
2870       __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->use_float)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 196, __pyx_L1_error)
2871       if (__pyx_t_5) {
2872 
2873         /* "borg/algorithms/msgpack/_packer.pyx":197
2874  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2875  *                 if self.use_float:
2876  *                    fval = o             # <<<<<<<<<<<<<<
2877  *                    ret = msgpack_pack_float(&self.pk, fval)
2878  *                 else:
2879  */
2880         __pyx_t_17 = __pyx_PyFloat_AsFloat(__pyx_v_o); if (unlikely((__pyx_t_17 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
2881         __pyx_v_fval = __pyx_t_17;
2882 
2883         /* "borg/algorithms/msgpack/_packer.pyx":198
2884  *                 if self.use_float:
2885  *                    fval = o
2886  *                    ret = msgpack_pack_float(&self.pk, fval)             # <<<<<<<<<<<<<<
2887  *                 else:
2888  *                    dval = o
2889  */
2890         __pyx_v_ret = msgpack_pack_float((&__pyx_v_self->pk), __pyx_v_fval);
2891 
2892         /* "borg/algorithms/msgpack/_packer.pyx":196
2893  *                 ret = msgpack_pack_long(&self.pk, longval)
2894  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):
2895  *                 if self.use_float:             # <<<<<<<<<<<<<<
2896  *                    fval = o
2897  *                    ret = msgpack_pack_float(&self.pk, fval)
2898  */
2899         goto __pyx_L22;
2900       }
2901 
2902       /* "borg/algorithms/msgpack/_packer.pyx":200
2903  *                    ret = msgpack_pack_float(&self.pk, fval)
2904  *                 else:
2905  *                    dval = o             # <<<<<<<<<<<<<<
2906  *                    ret = msgpack_pack_double(&self.pk, dval)
2907  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
2908  */
2909       /*else*/ {
2910         __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error)
2911         __pyx_v_dval = __pyx_t_18;
2912 
2913         /* "borg/algorithms/msgpack/_packer.pyx":201
2914  *                 else:
2915  *                    dval = o
2916  *                    ret = msgpack_pack_double(&self.pk, dval)             # <<<<<<<<<<<<<<
2917  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
2918  *                 L = len(o)
2919  */
2920         __pyx_v_ret = msgpack_pack_double((&__pyx_v_self->pk), __pyx_v_dval);
2921       }
2922       __pyx_L22:;
2923 
2924       /* "borg/algorithms/msgpack/_packer.pyx":195
2925  *                 longval = o
2926  *                 ret = msgpack_pack_long(&self.pk, longval)
2927  *             elif PyFloat_CheckExact(o) if strict_types else PyFloat_Check(o):             # <<<<<<<<<<<<<<
2928  *                 if self.use_float:
2929  *                    fval = o
2930  */
2931       goto __pyx_L6;
2932     }
2933 
2934     /* "borg/algorithms/msgpack/_packer.pyx":202
2935  *                    dval = o
2936  *                    ret = msgpack_pack_double(&self.pk, dval)
2937  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):             # <<<<<<<<<<<<<<
2938  *                 L = len(o)
2939  *                 if L > ITEM_LIMIT:
2940  */
2941     if ((__pyx_v_strict_types != 0)) {
2942       __pyx_t_11 = __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_CheckExact(__pyx_v_o);
2943     } else {
2944       __pyx_t_11 = __pyx_f_4borg_10algorithms_7msgpack_7_packer_PyBytesLike_Check(__pyx_v_o);
2945     }
2946     __pyx_t_5 = (__pyx_t_11 != 0);
2947     if (__pyx_t_5) {
2948 
2949       /* "borg/algorithms/msgpack/_packer.pyx":203
2950  *                    ret = msgpack_pack_double(&self.pk, dval)
2951  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
2952  *                 L = len(o)             # <<<<<<<<<<<<<<
2953  *                 if L > ITEM_LIMIT:
2954  *                     raise PackValueError("%s is too large" % type(o).__name__)
2955  */
2956       __pyx_t_19 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 203, __pyx_L1_error)
2957       __pyx_v_L = __pyx_t_19;
2958 
2959       /* "borg/algorithms/msgpack/_packer.pyx":204
2960  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
2961  *                 L = len(o)
2962  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
2963  *                     raise PackValueError("%s is too large" % type(o).__name__)
2964  *                 rawval = o
2965  */
2966       __pyx_t_5 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
2967       if (unlikely(__pyx_t_5)) {
2968 
2969         /* "borg/algorithms/msgpack/_packer.pyx":205
2970  *                 L = len(o)
2971  *                 if L > ITEM_LIMIT:
2972  *                     raise PackValueError("%s is too large" % type(o).__name__)             # <<<<<<<<<<<<<<
2973  *                 rawval = o
2974  *                 ret = msgpack_pack_bin(&self.pk, L)
2975  */
2976         __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
2977         __Pyx_GOTREF(__pyx_t_3);
2978         __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_o); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
2979         __Pyx_GOTREF(__pyx_t_2);
2980         __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 205, __pyx_L1_error)
2981         __Pyx_GOTREF(__pyx_t_13);
2982         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2983         __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_s_is_too_large, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
2984         __Pyx_GOTREF(__pyx_t_2);
2985         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2986         __pyx_t_13 = NULL;
2987         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2988           __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3);
2989           if (likely(__pyx_t_13)) {
2990             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2991             __Pyx_INCREF(__pyx_t_13);
2992             __Pyx_INCREF(function);
2993             __Pyx_DECREF_SET(__pyx_t_3, function);
2994           }
2995         }
2996         __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_13, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
2997         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2998         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2999         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
3000         __Pyx_GOTREF(__pyx_t_4);
3001         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3002         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3003         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3004         __PYX_ERR(0, 205, __pyx_L1_error)
3005 
3006         /* "borg/algorithms/msgpack/_packer.pyx":204
3007  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
3008  *                 L = len(o)
3009  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3010  *                     raise PackValueError("%s is too large" % type(o).__name__)
3011  *                 rawval = o
3012  */
3013       }
3014 
3015       /* "borg/algorithms/msgpack/_packer.pyx":206
3016  *                 if L > ITEM_LIMIT:
3017  *                     raise PackValueError("%s is too large" % type(o).__name__)
3018  *                 rawval = o             # <<<<<<<<<<<<<<
3019  *                 ret = msgpack_pack_bin(&self.pk, L)
3020  *                 if ret == 0:
3021  */
3022       __pyx_t_20 = __Pyx_PyObject_AsWritableString(__pyx_v_o); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error)
3023       __pyx_v_rawval = __pyx_t_20;
3024 
3025       /* "borg/algorithms/msgpack/_packer.pyx":207
3026  *                     raise PackValueError("%s is too large" % type(o).__name__)
3027  *                 rawval = o
3028  *                 ret = msgpack_pack_bin(&self.pk, L)             # <<<<<<<<<<<<<<
3029  *                 if ret == 0:
3030  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3031  */
3032       __pyx_v_ret = msgpack_pack_bin((&__pyx_v_self->pk), __pyx_v_L);
3033 
3034       /* "borg/algorithms/msgpack/_packer.pyx":208
3035  *                 rawval = o
3036  *                 ret = msgpack_pack_bin(&self.pk, L)
3037  *                 if ret == 0:             # <<<<<<<<<<<<<<
3038  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3039  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3040  */
3041       __pyx_t_5 = ((__pyx_v_ret == 0) != 0);
3042       if (__pyx_t_5) {
3043 
3044         /* "borg/algorithms/msgpack/_packer.pyx":209
3045  *                 ret = msgpack_pack_bin(&self.pk, L)
3046  *                 if ret == 0:
3047  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)             # <<<<<<<<<<<<<<
3048  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3049  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3050  */
3051         __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3052 
3053         /* "borg/algorithms/msgpack/_packer.pyx":208
3054  *                 rawval = o
3055  *                 ret = msgpack_pack_bin(&self.pk, L)
3056  *                 if ret == 0:             # <<<<<<<<<<<<<<
3057  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3058  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3059  */
3060       }
3061 
3062       /* "borg/algorithms/msgpack/_packer.pyx":202
3063  *                    dval = o
3064  *                    ret = msgpack_pack_double(&self.pk, dval)
3065  *             elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):             # <<<<<<<<<<<<<<
3066  *                 L = len(o)
3067  *                 if L > ITEM_LIMIT:
3068  */
3069       goto __pyx_L6;
3070     }
3071 
3072     /* "borg/algorithms/msgpack/_packer.pyx":210
3073  *                 if ret == 0:
3074  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3075  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):             # <<<<<<<<<<<<<<
3076  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3077  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3078  */
3079     if ((__pyx_v_strict_types != 0)) {
3080       __pyx_t_5 = PyUnicode_CheckExact(__pyx_v_o);
3081     } else {
3082       __pyx_t_5 = PyUnicode_Check(__pyx_v_o);
3083     }
3084     __pyx_t_12 = (__pyx_t_5 != 0);
3085     if (__pyx_t_12) {
3086 
3087       /* "borg/algorithms/msgpack/_packer.pyx":211
3088  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3089  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3090  *                 if self.encoding == NULL and self.unicode_errors == NULL:             # <<<<<<<<<<<<<<
3091  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3092  *                     if ret == -2:
3093  */
3094       __pyx_t_5 = ((__pyx_v_self->encoding == NULL) != 0);
3095       if (__pyx_t_5) {
3096       } else {
3097         __pyx_t_12 = __pyx_t_5;
3098         goto __pyx_L26_bool_binop_done;
3099       }
3100       __pyx_t_5 = ((__pyx_v_self->unicode_errors == NULL) != 0);
3101       __pyx_t_12 = __pyx_t_5;
3102       __pyx_L26_bool_binop_done:;
3103       if (__pyx_t_12) {
3104 
3105         /* "borg/algorithms/msgpack/_packer.pyx":212
3106  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3107  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3108  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);             # <<<<<<<<<<<<<<
3109  *                     if ret == -2:
3110  *                         raise PackValueError("unicode string is too large")
3111  */
3112         __pyx_v_ret = msgpack_pack_unicode((&__pyx_v_self->pk), __pyx_v_o, __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT);
3113 
3114         /* "borg/algorithms/msgpack/_packer.pyx":213
3115  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3116  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3117  *                     if ret == -2:             # <<<<<<<<<<<<<<
3118  *                         raise PackValueError("unicode string is too large")
3119  *                 else:
3120  */
3121         __pyx_t_12 = ((__pyx_v_ret == -2L) != 0);
3122         if (unlikely(__pyx_t_12)) {
3123 
3124           /* "borg/algorithms/msgpack/_packer.pyx":214
3125  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3126  *                     if ret == -2:
3127  *                         raise PackValueError("unicode string is too large")             # <<<<<<<<<<<<<<
3128  *                 else:
3129  *                     o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
3130  */
3131           __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
3132           __Pyx_GOTREF(__pyx_t_3);
3133           __pyx_t_2 = NULL;
3134           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3135             __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3136             if (likely(__pyx_t_2)) {
3137               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3138               __Pyx_INCREF(__pyx_t_2);
3139               __Pyx_INCREF(function);
3140               __Pyx_DECREF_SET(__pyx_t_3, function);
3141             }
3142           }
3143           __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_unicode_string_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_unicode_string_is_too_large);
3144           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3145           if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
3146           __Pyx_GOTREF(__pyx_t_4);
3147           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3148           __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3149           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3150           __PYX_ERR(0, 214, __pyx_L1_error)
3151 
3152           /* "borg/algorithms/msgpack/_packer.pyx":213
3153  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3154  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3155  *                     if ret == -2:             # <<<<<<<<<<<<<<
3156  *                         raise PackValueError("unicode string is too large")
3157  *                 else:
3158  */
3159         }
3160 
3161         /* "borg/algorithms/msgpack/_packer.pyx":211
3162  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3163  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):
3164  *                 if self.encoding == NULL and self.unicode_errors == NULL:             # <<<<<<<<<<<<<<
3165  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3166  *                     if ret == -2:
3167  */
3168         goto __pyx_L25;
3169       }
3170 
3171       /* "borg/algorithms/msgpack/_packer.pyx":216
3172  *                         raise PackValueError("unicode string is too large")
3173  *                 else:
3174  *                     o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)             # <<<<<<<<<<<<<<
3175  *                     L = len(o)
3176  *                     if L > ITEM_LIMIT:
3177  */
3178       /*else*/ {
3179         __pyx_t_4 = PyUnicode_AsEncodedString(__pyx_v_o, __pyx_v_self->encoding, __pyx_v_self->unicode_errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
3180         __Pyx_GOTREF(__pyx_t_4);
3181         __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_4);
3182         __pyx_t_4 = 0;
3183 
3184         /* "borg/algorithms/msgpack/_packer.pyx":217
3185  *                 else:
3186  *                     o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
3187  *                     L = len(o)             # <<<<<<<<<<<<<<
3188  *                     if L > ITEM_LIMIT:
3189  *                         raise PackValueError("unicode string is too large")
3190  */
3191         __pyx_t_19 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 217, __pyx_L1_error)
3192         __pyx_v_L = __pyx_t_19;
3193 
3194         /* "borg/algorithms/msgpack/_packer.pyx":218
3195  *                     o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
3196  *                     L = len(o)
3197  *                     if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3198  *                         raise PackValueError("unicode string is too large")
3199  *                     ret = msgpack_pack_raw(&self.pk, L)
3200  */
3201         __pyx_t_12 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
3202         if (unlikely(__pyx_t_12)) {
3203 
3204           /* "borg/algorithms/msgpack/_packer.pyx":219
3205  *                     L = len(o)
3206  *                     if L > ITEM_LIMIT:
3207  *                         raise PackValueError("unicode string is too large")             # <<<<<<<<<<<<<<
3208  *                     ret = msgpack_pack_raw(&self.pk, L)
3209  *                     if ret == 0:
3210  */
3211           __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
3212           __Pyx_GOTREF(__pyx_t_3);
3213           __pyx_t_2 = NULL;
3214           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3215             __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3216             if (likely(__pyx_t_2)) {
3217               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3218               __Pyx_INCREF(__pyx_t_2);
3219               __Pyx_INCREF(function);
3220               __Pyx_DECREF_SET(__pyx_t_3, function);
3221             }
3222           }
3223           __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_unicode_string_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_unicode_string_is_too_large);
3224           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3225           if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error)
3226           __Pyx_GOTREF(__pyx_t_4);
3227           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3228           __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3229           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3230           __PYX_ERR(0, 219, __pyx_L1_error)
3231 
3232           /* "borg/algorithms/msgpack/_packer.pyx":218
3233  *                     o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
3234  *                     L = len(o)
3235  *                     if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3236  *                         raise PackValueError("unicode string is too large")
3237  *                     ret = msgpack_pack_raw(&self.pk, L)
3238  */
3239         }
3240 
3241         /* "borg/algorithms/msgpack/_packer.pyx":220
3242  *                     if L > ITEM_LIMIT:
3243  *                         raise PackValueError("unicode string is too large")
3244  *                     ret = msgpack_pack_raw(&self.pk, L)             # <<<<<<<<<<<<<<
3245  *                     if ret == 0:
3246  *                         rawval = o
3247  */
3248         __pyx_v_ret = msgpack_pack_raw((&__pyx_v_self->pk), __pyx_v_L);
3249 
3250         /* "borg/algorithms/msgpack/_packer.pyx":221
3251  *                         raise PackValueError("unicode string is too large")
3252  *                     ret = msgpack_pack_raw(&self.pk, L)
3253  *                     if ret == 0:             # <<<<<<<<<<<<<<
3254  *                         rawval = o
3255  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3256  */
3257         __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3258         if (__pyx_t_12) {
3259 
3260           /* "borg/algorithms/msgpack/_packer.pyx":222
3261  *                     ret = msgpack_pack_raw(&self.pk, L)
3262  *                     if ret == 0:
3263  *                         rawval = o             # <<<<<<<<<<<<<<
3264  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3265  *             elif PyDict_CheckExact(o):
3266  */
3267           __pyx_t_20 = __Pyx_PyObject_AsWritableString(__pyx_v_o); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
3268           __pyx_v_rawval = __pyx_t_20;
3269 
3270           /* "borg/algorithms/msgpack/_packer.pyx":223
3271  *                     if ret == 0:
3272  *                         rawval = o
3273  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)             # <<<<<<<<<<<<<<
3274  *             elif PyDict_CheckExact(o):
3275  *                 d = <dict>o
3276  */
3277           __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3278 
3279           /* "borg/algorithms/msgpack/_packer.pyx":221
3280  *                         raise PackValueError("unicode string is too large")
3281  *                     ret = msgpack_pack_raw(&self.pk, L)
3282  *                     if ret == 0:             # <<<<<<<<<<<<<<
3283  *                         rawval = o
3284  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3285  */
3286         }
3287       }
3288       __pyx_L25:;
3289 
3290       /* "borg/algorithms/msgpack/_packer.pyx":210
3291  *                 if ret == 0:
3292  *                     ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3293  *             elif PyUnicode_CheckExact(o) if strict_types else PyUnicode_Check(o):             # <<<<<<<<<<<<<<
3294  *                 if self.encoding == NULL and self.unicode_errors == NULL:
3295  *                     ret = msgpack_pack_unicode(&self.pk, o, ITEM_LIMIT);
3296  */
3297       goto __pyx_L6;
3298     }
3299 
3300     /* "borg/algorithms/msgpack/_packer.pyx":224
3301  *                         rawval = o
3302  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3303  *             elif PyDict_CheckExact(o):             # <<<<<<<<<<<<<<
3304  *                 d = <dict>o
3305  *                 L = len(d)
3306  */
3307     __pyx_t_12 = (PyDict_CheckExact(__pyx_v_o) != 0);
3308     if (__pyx_t_12) {
3309 
3310       /* "borg/algorithms/msgpack/_packer.pyx":225
3311  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3312  *             elif PyDict_CheckExact(o):
3313  *                 d = <dict>o             # <<<<<<<<<<<<<<
3314  *                 L = len(d)
3315  *                 if L > ITEM_LIMIT:
3316  */
3317       __pyx_t_4 = __pyx_v_o;
3318       __Pyx_INCREF(__pyx_t_4);
3319       __pyx_v_d = ((PyObject*)__pyx_t_4);
3320       __pyx_t_4 = 0;
3321 
3322       /* "borg/algorithms/msgpack/_packer.pyx":226
3323  *             elif PyDict_CheckExact(o):
3324  *                 d = <dict>o
3325  *                 L = len(d)             # <<<<<<<<<<<<<<
3326  *                 if L > ITEM_LIMIT:
3327  *                     raise PackValueError("dict is too large")
3328  */
3329       if (unlikely(__pyx_v_d == Py_None)) {
3330         PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3331         __PYX_ERR(0, 226, __pyx_L1_error)
3332       }
3333       __pyx_t_19 = PyDict_Size(__pyx_v_d); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 226, __pyx_L1_error)
3334       __pyx_v_L = __pyx_t_19;
3335 
3336       /* "borg/algorithms/msgpack/_packer.pyx":227
3337  *                 d = <dict>o
3338  *                 L = len(d)
3339  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3340  *                     raise PackValueError("dict is too large")
3341  *                 ret = msgpack_pack_map(&self.pk, L)
3342  */
3343       __pyx_t_12 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
3344       if (unlikely(__pyx_t_12)) {
3345 
3346         /* "borg/algorithms/msgpack/_packer.pyx":228
3347  *                 L = len(d)
3348  *                 if L > ITEM_LIMIT:
3349  *                     raise PackValueError("dict is too large")             # <<<<<<<<<<<<<<
3350  *                 ret = msgpack_pack_map(&self.pk, L)
3351  *                 if ret == 0:
3352  */
3353         __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
3354         __Pyx_GOTREF(__pyx_t_3);
3355         __pyx_t_2 = NULL;
3356         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3357           __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3358           if (likely(__pyx_t_2)) {
3359             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3360             __Pyx_INCREF(__pyx_t_2);
3361             __Pyx_INCREF(function);
3362             __Pyx_DECREF_SET(__pyx_t_3, function);
3363           }
3364         }
3365         __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_dict_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_dict_is_too_large);
3366         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3367         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
3368         __Pyx_GOTREF(__pyx_t_4);
3369         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3370         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3371         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3372         __PYX_ERR(0, 228, __pyx_L1_error)
3373 
3374         /* "borg/algorithms/msgpack/_packer.pyx":227
3375  *                 d = <dict>o
3376  *                 L = len(d)
3377  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3378  *                     raise PackValueError("dict is too large")
3379  *                 ret = msgpack_pack_map(&self.pk, L)
3380  */
3381       }
3382 
3383       /* "borg/algorithms/msgpack/_packer.pyx":229
3384  *                 if L > ITEM_LIMIT:
3385  *                     raise PackValueError("dict is too large")
3386  *                 ret = msgpack_pack_map(&self.pk, L)             # <<<<<<<<<<<<<<
3387  *                 if ret == 0:
3388  *                     for k, v in d.iteritems():
3389  */
3390       __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_L);
3391 
3392       /* "borg/algorithms/msgpack/_packer.pyx":230
3393  *                     raise PackValueError("dict is too large")
3394  *                 ret = msgpack_pack_map(&self.pk, L)
3395  *                 if ret == 0:             # <<<<<<<<<<<<<<
3396  *                     for k, v in d.iteritems():
3397  *                         ret = self._pack(k, nest_limit-1)
3398  */
3399       __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3400       if (__pyx_t_12) {
3401 
3402         /* "borg/algorithms/msgpack/_packer.pyx":231
3403  *                 ret = msgpack_pack_map(&self.pk, L)
3404  *                 if ret == 0:
3405  *                     for k, v in d.iteritems():             # <<<<<<<<<<<<<<
3406  *                         ret = self._pack(k, nest_limit-1)
3407  *                         if ret != 0: break
3408  */
3409         __pyx_t_19 = 0;
3410         if (unlikely(__pyx_v_d == Py_None)) {
3411           PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
3412           __PYX_ERR(0, 231, __pyx_L1_error)
3413         }
3414         __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_21), (&__pyx_t_11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
3415         __Pyx_GOTREF(__pyx_t_3);
3416         __Pyx_XDECREF(__pyx_t_4);
3417         __pyx_t_4 = __pyx_t_3;
3418         __pyx_t_3 = 0;
3419         while (1) {
3420           __pyx_t_22 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_21, &__pyx_t_19, &__pyx_t_3, &__pyx_t_2, NULL, __pyx_t_11);
3421           if (unlikely(__pyx_t_22 == 0)) break;
3422           if (unlikely(__pyx_t_22 == -1)) __PYX_ERR(0, 231, __pyx_L1_error)
3423           __Pyx_GOTREF(__pyx_t_3);
3424           __Pyx_GOTREF(__pyx_t_2);
3425           __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
3426           __pyx_t_3 = 0;
3427           __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_2);
3428           __pyx_t_2 = 0;
3429 
3430           /* "borg/algorithms/msgpack/_packer.pyx":232
3431  *                 if ret == 0:
3432  *                     for k, v in d.iteritems():
3433  *                         ret = self._pack(k, nest_limit-1)             # <<<<<<<<<<<<<<
3434  *                         if ret != 0: break
3435  *                         ret = self._pack(v, nest_limit-1)
3436  */
3437           __pyx_t_23.__pyx_n = 1;
3438           __pyx_t_23.nest_limit = (__pyx_v_nest_limit - 1);
3439           __pyx_t_22 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, &__pyx_t_23); if (unlikely(__pyx_t_22 == ((int)-1))) __PYX_ERR(0, 232, __pyx_L1_error)
3440           __pyx_v_ret = __pyx_t_22;
3441 
3442           /* "borg/algorithms/msgpack/_packer.pyx":233
3443  *                     for k, v in d.iteritems():
3444  *                         ret = self._pack(k, nest_limit-1)
3445  *                         if ret != 0: break             # <<<<<<<<<<<<<<
3446  *                         ret = self._pack(v, nest_limit-1)
3447  *                         if ret != 0: break
3448  */
3449           __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3450           if (__pyx_t_12) {
3451             goto __pyx_L34_break;
3452           }
3453 
3454           /* "borg/algorithms/msgpack/_packer.pyx":234
3455  *                         ret = self._pack(k, nest_limit-1)
3456  *                         if ret != 0: break
3457  *                         ret = self._pack(v, nest_limit-1)             # <<<<<<<<<<<<<<
3458  *                         if ret != 0: break
3459  *             elif not strict_types and PyDict_Check(o):
3460  */
3461           __pyx_t_23.__pyx_n = 1;
3462           __pyx_t_23.nest_limit = (__pyx_v_nest_limit - 1);
3463           __pyx_t_22 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_23); if (unlikely(__pyx_t_22 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error)
3464           __pyx_v_ret = __pyx_t_22;
3465 
3466           /* "borg/algorithms/msgpack/_packer.pyx":235
3467  *                         if ret != 0: break
3468  *                         ret = self._pack(v, nest_limit-1)
3469  *                         if ret != 0: break             # <<<<<<<<<<<<<<
3470  *             elif not strict_types and PyDict_Check(o):
3471  *                 L = len(o)
3472  */
3473           __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3474           if (__pyx_t_12) {
3475             goto __pyx_L34_break;
3476           }
3477         }
3478         __pyx_L34_break:;
3479         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3480 
3481         /* "borg/algorithms/msgpack/_packer.pyx":230
3482  *                     raise PackValueError("dict is too large")
3483  *                 ret = msgpack_pack_map(&self.pk, L)
3484  *                 if ret == 0:             # <<<<<<<<<<<<<<
3485  *                     for k, v in d.iteritems():
3486  *                         ret = self._pack(k, nest_limit-1)
3487  */
3488       }
3489 
3490       /* "borg/algorithms/msgpack/_packer.pyx":224
3491  *                         rawval = o
3492  *                         ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3493  *             elif PyDict_CheckExact(o):             # <<<<<<<<<<<<<<
3494  *                 d = <dict>o
3495  *                 L = len(d)
3496  */
3497       goto __pyx_L6;
3498     }
3499 
3500     /* "borg/algorithms/msgpack/_packer.pyx":236
3501  *                         ret = self._pack(v, nest_limit-1)
3502  *                         if ret != 0: break
3503  *             elif not strict_types and PyDict_Check(o):             # <<<<<<<<<<<<<<
3504  *                 L = len(o)
3505  *                 if L > ITEM_LIMIT:
3506  */
3507     __pyx_t_5 = ((!(__pyx_v_strict_types != 0)) != 0);
3508     if (__pyx_t_5) {
3509     } else {
3510       __pyx_t_12 = __pyx_t_5;
3511       goto __pyx_L37_bool_binop_done;
3512     }
3513     __pyx_t_5 = (PyDict_Check(__pyx_v_o) != 0);
3514     __pyx_t_12 = __pyx_t_5;
3515     __pyx_L37_bool_binop_done:;
3516     if (__pyx_t_12) {
3517 
3518       /* "borg/algorithms/msgpack/_packer.pyx":237
3519  *                         if ret != 0: break
3520  *             elif not strict_types and PyDict_Check(o):
3521  *                 L = len(o)             # <<<<<<<<<<<<<<
3522  *                 if L > ITEM_LIMIT:
3523  *                     raise PackValueError("dict is too large")
3524  */
3525       __pyx_t_21 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 237, __pyx_L1_error)
3526       __pyx_v_L = __pyx_t_21;
3527 
3528       /* "borg/algorithms/msgpack/_packer.pyx":238
3529  *             elif not strict_types and PyDict_Check(o):
3530  *                 L = len(o)
3531  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3532  *                     raise PackValueError("dict is too large")
3533  *                 ret = msgpack_pack_map(&self.pk, L)
3534  */
3535       __pyx_t_12 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
3536       if (unlikely(__pyx_t_12)) {
3537 
3538         /* "borg/algorithms/msgpack/_packer.pyx":239
3539  *                 L = len(o)
3540  *                 if L > ITEM_LIMIT:
3541  *                     raise PackValueError("dict is too large")             # <<<<<<<<<<<<<<
3542  *                 ret = msgpack_pack_map(&self.pk, L)
3543  *                 if ret == 0:
3544  */
3545         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
3546         __Pyx_GOTREF(__pyx_t_2);
3547         __pyx_t_3 = NULL;
3548         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3549           __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3550           if (likely(__pyx_t_3)) {
3551             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3552             __Pyx_INCREF(__pyx_t_3);
3553             __Pyx_INCREF(function);
3554             __Pyx_DECREF_SET(__pyx_t_2, function);
3555           }
3556         }
3557         __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_s_dict_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_dict_is_too_large);
3558         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3559         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
3560         __Pyx_GOTREF(__pyx_t_4);
3561         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3562         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3563         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3564         __PYX_ERR(0, 239, __pyx_L1_error)
3565 
3566         /* "borg/algorithms/msgpack/_packer.pyx":238
3567  *             elif not strict_types and PyDict_Check(o):
3568  *                 L = len(o)
3569  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3570  *                     raise PackValueError("dict is too large")
3571  *                 ret = msgpack_pack_map(&self.pk, L)
3572  */
3573       }
3574 
3575       /* "borg/algorithms/msgpack/_packer.pyx":240
3576  *                 if L > ITEM_LIMIT:
3577  *                     raise PackValueError("dict is too large")
3578  *                 ret = msgpack_pack_map(&self.pk, L)             # <<<<<<<<<<<<<<
3579  *                 if ret == 0:
3580  *                     for k, v in o.items():
3581  */
3582       __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_L);
3583 
3584       /* "borg/algorithms/msgpack/_packer.pyx":241
3585  *                     raise PackValueError("dict is too large")
3586  *                 ret = msgpack_pack_map(&self.pk, L)
3587  *                 if ret == 0:             # <<<<<<<<<<<<<<
3588  *                     for k, v in o.items():
3589  *                         ret = self._pack(k, nest_limit-1)
3590  */
3591       __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
3592       if (__pyx_t_12) {
3593 
3594         /* "borg/algorithms/msgpack/_packer.pyx":242
3595  *                 ret = msgpack_pack_map(&self.pk, L)
3596  *                 if ret == 0:
3597  *                     for k, v in o.items():             # <<<<<<<<<<<<<<
3598  *                         ret = self._pack(k, nest_limit-1)
3599  *                         if ret != 0: break
3600  */
3601         __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
3602         __Pyx_GOTREF(__pyx_t_2);
3603         __pyx_t_3 = NULL;
3604         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3605           __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3606           if (likely(__pyx_t_3)) {
3607             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3608             __Pyx_INCREF(__pyx_t_3);
3609             __Pyx_INCREF(function);
3610             __Pyx_DECREF_SET(__pyx_t_2, function);
3611           }
3612         }
3613         __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3614         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3615         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
3616         __Pyx_GOTREF(__pyx_t_4);
3617         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3618         if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
3619           __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_21 = 0;
3620           __pyx_t_24 = NULL;
3621         } else {
3622           __pyx_t_21 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
3623           __Pyx_GOTREF(__pyx_t_2);
3624           __pyx_t_24 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 242, __pyx_L1_error)
3625         }
3626         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3627         for (;;) {
3628           if (likely(!__pyx_t_24)) {
3629             if (likely(PyList_CheckExact(__pyx_t_2))) {
3630               if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_2)) break;
3631               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3632               __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_21); __Pyx_INCREF(__pyx_t_4); __pyx_t_21++; if (unlikely(0 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
3633               #else
3634               __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
3635               __Pyx_GOTREF(__pyx_t_4);
3636               #endif
3637             } else {
3638               if (__pyx_t_21 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3639               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3640               __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_21); __Pyx_INCREF(__pyx_t_4); __pyx_t_21++; if (unlikely(0 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
3641               #else
3642               __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
3643               __Pyx_GOTREF(__pyx_t_4);
3644               #endif
3645             }
3646           } else {
3647             __pyx_t_4 = __pyx_t_24(__pyx_t_2);
3648             if (unlikely(!__pyx_t_4)) {
3649               PyObject* exc_type = PyErr_Occurred();
3650               if (exc_type) {
3651                 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3652                 else __PYX_ERR(0, 242, __pyx_L1_error)
3653               }
3654               break;
3655             }
3656             __Pyx_GOTREF(__pyx_t_4);
3657           }
3658           if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
3659             PyObject* sequence = __pyx_t_4;
3660             Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3661             if (unlikely(size != 2)) {
3662               if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3663               else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3664               __PYX_ERR(0, 242, __pyx_L1_error)
3665             }
3666             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3667             if (likely(PyTuple_CheckExact(sequence))) {
3668               __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3669               __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
3670             } else {
3671               __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
3672               __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
3673             }
3674             __Pyx_INCREF(__pyx_t_3);
3675             __Pyx_INCREF(__pyx_t_13);
3676             #else
3677             __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
3678             __Pyx_GOTREF(__pyx_t_3);
3679             __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 242, __pyx_L1_error)
3680             __Pyx_GOTREF(__pyx_t_13);
3681             #endif
3682             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3683           } else {
3684             Py_ssize_t index = -1;
3685             __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 242, __pyx_L1_error)
3686             __Pyx_GOTREF(__pyx_t_14);
3687             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3688             __pyx_t_25 = Py_TYPE(__pyx_t_14)->tp_iternext;
3689             index = 0; __pyx_t_3 = __pyx_t_25(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L43_unpacking_failed;
3690             __Pyx_GOTREF(__pyx_t_3);
3691             index = 1; __pyx_t_13 = __pyx_t_25(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L43_unpacking_failed;
3692             __Pyx_GOTREF(__pyx_t_13);
3693             if (__Pyx_IternextUnpackEndCheck(__pyx_t_25(__pyx_t_14), 2) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
3694             __pyx_t_25 = NULL;
3695             __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3696             goto __pyx_L44_unpacking_done;
3697             __pyx_L43_unpacking_failed:;
3698             __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3699             __pyx_t_25 = NULL;
3700             if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3701             __PYX_ERR(0, 242, __pyx_L1_error)
3702             __pyx_L44_unpacking_done:;
3703           }
3704           __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
3705           __pyx_t_3 = 0;
3706           __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_13);
3707           __pyx_t_13 = 0;
3708 
3709           /* "borg/algorithms/msgpack/_packer.pyx":243
3710  *                 if ret == 0:
3711  *                     for k, v in o.items():
3712  *                         ret = self._pack(k, nest_limit-1)             # <<<<<<<<<<<<<<
3713  *                         if ret != 0: break
3714  *                         ret = self._pack(v, nest_limit-1)
3715  */
3716           __pyx_t_23.__pyx_n = 1;
3717           __pyx_t_23.nest_limit = (__pyx_v_nest_limit - 1);
3718           __pyx_t_11 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, &__pyx_t_23); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 243, __pyx_L1_error)
3719           __pyx_v_ret = __pyx_t_11;
3720 
3721           /* "borg/algorithms/msgpack/_packer.pyx":244
3722  *                     for k, v in o.items():
3723  *                         ret = self._pack(k, nest_limit-1)
3724  *                         if ret != 0: break             # <<<<<<<<<<<<<<
3725  *                         ret = self._pack(v, nest_limit-1)
3726  *                         if ret != 0: break
3727  */
3728           __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3729           if (__pyx_t_12) {
3730             goto __pyx_L42_break;
3731           }
3732 
3733           /* "borg/algorithms/msgpack/_packer.pyx":245
3734  *                         ret = self._pack(k, nest_limit-1)
3735  *                         if ret != 0: break
3736  *                         ret = self._pack(v, nest_limit-1)             # <<<<<<<<<<<<<<
3737  *                         if ret != 0: break
3738  *             elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3739  */
3740           __pyx_t_23.__pyx_n = 1;
3741           __pyx_t_23.nest_limit = (__pyx_v_nest_limit - 1);
3742           __pyx_t_11 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_23); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 245, __pyx_L1_error)
3743           __pyx_v_ret = __pyx_t_11;
3744 
3745           /* "borg/algorithms/msgpack/_packer.pyx":246
3746  *                         if ret != 0: break
3747  *                         ret = self._pack(v, nest_limit-1)
3748  *                         if ret != 0: break             # <<<<<<<<<<<<<<
3749  *             elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3750  *                 # This should be before Tuple because ExtType is namedtuple.
3751  */
3752           __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
3753           if (__pyx_t_12) {
3754             goto __pyx_L42_break;
3755           }
3756 
3757           /* "borg/algorithms/msgpack/_packer.pyx":242
3758  *                 ret = msgpack_pack_map(&self.pk, L)
3759  *                 if ret == 0:
3760  *                     for k, v in o.items():             # <<<<<<<<<<<<<<
3761  *                         ret = self._pack(k, nest_limit-1)
3762  *                         if ret != 0: break
3763  */
3764         }
3765         __pyx_L42_break:;
3766         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3767 
3768         /* "borg/algorithms/msgpack/_packer.pyx":241
3769  *                     raise PackValueError("dict is too large")
3770  *                 ret = msgpack_pack_map(&self.pk, L)
3771  *                 if ret == 0:             # <<<<<<<<<<<<<<
3772  *                     for k, v in o.items():
3773  *                         ret = self._pack(k, nest_limit-1)
3774  */
3775       }
3776 
3777       /* "borg/algorithms/msgpack/_packer.pyx":236
3778  *                         ret = self._pack(v, nest_limit-1)
3779  *                         if ret != 0: break
3780  *             elif not strict_types and PyDict_Check(o):             # <<<<<<<<<<<<<<
3781  *                 L = len(o)
3782  *                 if L > ITEM_LIMIT:
3783  */
3784       goto __pyx_L6;
3785     }
3786 
3787     /* "borg/algorithms/msgpack/_packer.pyx":247
3788  *                         ret = self._pack(v, nest_limit-1)
3789  *                         if ret != 0: break
3790  *             elif type(o) is ExtType if strict_types else isinstance(o, ExtType):             # <<<<<<<<<<<<<<
3791  *                 # This should be before Tuple because ExtType is namedtuple.
3792  *                 longval = o.code
3793  */
3794     if ((__pyx_v_strict_types != 0)) {
3795       __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_7cpython_4type_type), __pyx_v_o); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
3796       __Pyx_GOTREF(__pyx_t_2);
3797       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ExtType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
3798       __Pyx_GOTREF(__pyx_t_4);
3799       __pyx_t_5 = (__pyx_t_2 == __pyx_t_4);
3800       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3801       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3802       __pyx_t_12 = __pyx_t_5;
3803     } else {
3804       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ExtType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
3805       __Pyx_GOTREF(__pyx_t_4);
3806       __pyx_t_5 = PyObject_IsInstance(__pyx_v_o, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 247, __pyx_L1_error)
3807       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3808       __pyx_t_12 = __pyx_t_5;
3809     }
3810     __pyx_t_5 = (__pyx_t_12 != 0);
3811     if (__pyx_t_5) {
3812 
3813       /* "borg/algorithms/msgpack/_packer.pyx":249
3814  *             elif type(o) is ExtType if strict_types else isinstance(o, ExtType):
3815  *                 # This should be before Tuple because ExtType is namedtuple.
3816  *                 longval = o.code             # <<<<<<<<<<<<<<
3817  *                 rawval = o.data
3818  *                 L = len(o.data)
3819  */
3820       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_code); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
3821       __Pyx_GOTREF(__pyx_t_4);
3822       __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error)
3823       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3824       __pyx_v_longval = __pyx_t_16;
3825 
3826       /* "borg/algorithms/msgpack/_packer.pyx":250
3827  *                 # This should be before Tuple because ExtType is namedtuple.
3828  *                 longval = o.code
3829  *                 rawval = o.data             # <<<<<<<<<<<<<<
3830  *                 L = len(o.data)
3831  *                 if L > ITEM_LIMIT:
3832  */
3833       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
3834       __Pyx_GOTREF(__pyx_t_4);
3835       __pyx_t_20 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
3836       __pyx_v_rawval = __pyx_t_20;
3837       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3838 
3839       /* "borg/algorithms/msgpack/_packer.pyx":251
3840  *                 longval = o.code
3841  *                 rawval = o.data
3842  *                 L = len(o.data)             # <<<<<<<<<<<<<<
3843  *                 if L > ITEM_LIMIT:
3844  *                     raise PackValueError("EXT data is too large")
3845  */
3846       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
3847       __Pyx_GOTREF(__pyx_t_4);
3848       __pyx_t_21 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 251, __pyx_L1_error)
3849       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3850       __pyx_v_L = __pyx_t_21;
3851 
3852       /* "borg/algorithms/msgpack/_packer.pyx":252
3853  *                 rawval = o.data
3854  *                 L = len(o.data)
3855  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3856  *                     raise PackValueError("EXT data is too large")
3857  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
3858  */
3859       __pyx_t_5 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
3860       if (unlikely(__pyx_t_5)) {
3861 
3862         /* "borg/algorithms/msgpack/_packer.pyx":253
3863  *                 L = len(o.data)
3864  *                 if L > ITEM_LIMIT:
3865  *                     raise PackValueError("EXT data is too large")             # <<<<<<<<<<<<<<
3866  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
3867  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3868  */
3869         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
3870         __Pyx_GOTREF(__pyx_t_2);
3871         __pyx_t_13 = NULL;
3872         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3873           __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
3874           if (likely(__pyx_t_13)) {
3875             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3876             __Pyx_INCREF(__pyx_t_13);
3877             __Pyx_INCREF(function);
3878             __Pyx_DECREF_SET(__pyx_t_2, function);
3879           }
3880         }
3881         __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_kp_s_EXT_data_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_EXT_data_is_too_large);
3882         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
3883         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
3884         __Pyx_GOTREF(__pyx_t_4);
3885         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3886         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3887         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3888         __PYX_ERR(0, 253, __pyx_L1_error)
3889 
3890         /* "borg/algorithms/msgpack/_packer.pyx":252
3891  *                 rawval = o.data
3892  *                 L = len(o.data)
3893  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3894  *                     raise PackValueError("EXT data is too large")
3895  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
3896  */
3897       }
3898 
3899       /* "borg/algorithms/msgpack/_packer.pyx":254
3900  *                 if L > ITEM_LIMIT:
3901  *                     raise PackValueError("EXT data is too large")
3902  *                 ret = msgpack_pack_ext(&self.pk, longval, L)             # <<<<<<<<<<<<<<
3903  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3904  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3905  */
3906       __pyx_v_ret = msgpack_pack_ext((&__pyx_v_self->pk), __pyx_v_longval, __pyx_v_L);
3907 
3908       /* "borg/algorithms/msgpack/_packer.pyx":255
3909  *                     raise PackValueError("EXT data is too large")
3910  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
3911  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)             # <<<<<<<<<<<<<<
3912  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3913  *                 L = len(o)
3914  */
3915       __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_v_L);
3916 
3917       /* "borg/algorithms/msgpack/_packer.pyx":247
3918  *                         ret = self._pack(v, nest_limit-1)
3919  *                         if ret != 0: break
3920  *             elif type(o) is ExtType if strict_types else isinstance(o, ExtType):             # <<<<<<<<<<<<<<
3921  *                 # This should be before Tuple because ExtType is namedtuple.
3922  *                 longval = o.code
3923  */
3924       goto __pyx_L6;
3925     }
3926 
3927     /* "borg/algorithms/msgpack/_packer.pyx":256
3928  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
3929  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3930  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):             # <<<<<<<<<<<<<<
3931  *                 L = len(o)
3932  *                 if L > ITEM_LIMIT:
3933  */
3934     if ((__pyx_v_strict_types != 0)) {
3935       __pyx_t_5 = PyList_CheckExact(__pyx_v_o);
3936     } else {
3937       __pyx_t_1 = PyTuple_Check(__pyx_v_o);
3938       if (!__pyx_t_1) {
3939       } else {
3940         __pyx_t_12 = __pyx_t_1;
3941         goto __pyx_L48_bool_binop_done;
3942       }
3943       __pyx_t_1 = PyList_Check(__pyx_v_o);
3944       __pyx_t_12 = __pyx_t_1;
3945       __pyx_L48_bool_binop_done:;
3946       __pyx_t_5 = __pyx_t_12;
3947     }
3948     __pyx_t_12 = (__pyx_t_5 != 0);
3949     if (__pyx_t_12) {
3950 
3951       /* "borg/algorithms/msgpack/_packer.pyx":257
3952  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)
3953  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3954  *                 L = len(o)             # <<<<<<<<<<<<<<
3955  *                 if L > ITEM_LIMIT:
3956  *                     raise PackValueError("list is too large")
3957  */
3958       __pyx_t_21 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 257, __pyx_L1_error)
3959       __pyx_v_L = __pyx_t_21;
3960 
3961       /* "borg/algorithms/msgpack/_packer.pyx":258
3962  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
3963  *                 L = len(o)
3964  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
3965  *                     raise PackValueError("list is too large")
3966  *                 ret = msgpack_pack_array(&self.pk, L)
3967  */
3968       __pyx_t_12 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
3969       if (unlikely(__pyx_t_12)) {
3970 
3971         /* "borg/algorithms/msgpack/_packer.pyx":259
3972  *                 L = len(o)
3973  *                 if L > ITEM_LIMIT:
3974  *                     raise PackValueError("list is too large")             # <<<<<<<<<<<<<<
3975  *                 ret = msgpack_pack_array(&self.pk, L)
3976  *                 if ret == 0:
3977  */
3978         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
3979         __Pyx_GOTREF(__pyx_t_2);
3980         __pyx_t_13 = NULL;
3981         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3982           __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
3983           if (likely(__pyx_t_13)) {
3984             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3985             __Pyx_INCREF(__pyx_t_13);
3986             __Pyx_INCREF(function);
3987             __Pyx_DECREF_SET(__pyx_t_2, function);
3988           }
3989         }
3990         __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_kp_s_list_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_list_is_too_large);
3991         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
3992         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
3993         __Pyx_GOTREF(__pyx_t_4);
3994         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3995         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3996         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3997         __PYX_ERR(0, 259, __pyx_L1_error)
3998 
3999         /* "borg/algorithms/msgpack/_packer.pyx":258
4000  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
4001  *                 L = len(o)
4002  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
4003  *                     raise PackValueError("list is too large")
4004  *                 ret = msgpack_pack_array(&self.pk, L)
4005  */
4006       }
4007 
4008       /* "borg/algorithms/msgpack/_packer.pyx":260
4009  *                 if L > ITEM_LIMIT:
4010  *                     raise PackValueError("list is too large")
4011  *                 ret = msgpack_pack_array(&self.pk, L)             # <<<<<<<<<<<<<<
4012  *                 if ret == 0:
4013  *                     for v in o:
4014  */
4015       __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_L);
4016 
4017       /* "borg/algorithms/msgpack/_packer.pyx":261
4018  *                     raise PackValueError("list is too large")
4019  *                 ret = msgpack_pack_array(&self.pk, L)
4020  *                 if ret == 0:             # <<<<<<<<<<<<<<
4021  *                     for v in o:
4022  *                         ret = self._pack(v, nest_limit-1)
4023  */
4024       __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
4025       if (__pyx_t_12) {
4026 
4027         /* "borg/algorithms/msgpack/_packer.pyx":262
4028  *                 ret = msgpack_pack_array(&self.pk, L)
4029  *                 if ret == 0:
4030  *                     for v in o:             # <<<<<<<<<<<<<<
4031  *                         ret = self._pack(v, nest_limit-1)
4032  *                         if ret != 0: break
4033  */
4034         if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
4035           __pyx_t_4 = __pyx_v_o; __Pyx_INCREF(__pyx_t_4); __pyx_t_21 = 0;
4036           __pyx_t_24 = NULL;
4037         } else {
4038           __pyx_t_21 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error)
4039           __Pyx_GOTREF(__pyx_t_4);
4040           __pyx_t_24 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 262, __pyx_L1_error)
4041         }
4042         for (;;) {
4043           if (likely(!__pyx_t_24)) {
4044             if (likely(PyList_CheckExact(__pyx_t_4))) {
4045               if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_4)) break;
4046               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4047               __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_21); __Pyx_INCREF(__pyx_t_2); __pyx_t_21++; if (unlikely(0 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
4048               #else
4049               __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
4050               __Pyx_GOTREF(__pyx_t_2);
4051               #endif
4052             } else {
4053               if (__pyx_t_21 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
4054               #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4055               __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_21); __Pyx_INCREF(__pyx_t_2); __pyx_t_21++; if (unlikely(0 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
4056               #else
4057               __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
4058               __Pyx_GOTREF(__pyx_t_2);
4059               #endif
4060             }
4061           } else {
4062             __pyx_t_2 = __pyx_t_24(__pyx_t_4);
4063             if (unlikely(!__pyx_t_2)) {
4064               PyObject* exc_type = PyErr_Occurred();
4065               if (exc_type) {
4066                 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4067                 else __PYX_ERR(0, 262, __pyx_L1_error)
4068               }
4069               break;
4070             }
4071             __Pyx_GOTREF(__pyx_t_2);
4072           }
4073           __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_2);
4074           __pyx_t_2 = 0;
4075 
4076           /* "borg/algorithms/msgpack/_packer.pyx":263
4077  *                 if ret == 0:
4078  *                     for v in o:
4079  *                         ret = self._pack(v, nest_limit-1)             # <<<<<<<<<<<<<<
4080  *                         if ret != 0: break
4081  *             elif PyMemoryView_Check(o):
4082  */
4083           __pyx_t_23.__pyx_n = 1;
4084           __pyx_t_23.nest_limit = (__pyx_v_nest_limit - 1);
4085           __pyx_t_11 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_23); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 263, __pyx_L1_error)
4086           __pyx_v_ret = __pyx_t_11;
4087 
4088           /* "borg/algorithms/msgpack/_packer.pyx":264
4089  *                     for v in o:
4090  *                         ret = self._pack(v, nest_limit-1)
4091  *                         if ret != 0: break             # <<<<<<<<<<<<<<
4092  *             elif PyMemoryView_Check(o):
4093  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4094  */
4095           __pyx_t_12 = ((__pyx_v_ret != 0) != 0);
4096           if (__pyx_t_12) {
4097             goto __pyx_L53_break;
4098           }
4099 
4100           /* "borg/algorithms/msgpack/_packer.pyx":262
4101  *                 ret = msgpack_pack_array(&self.pk, L)
4102  *                 if ret == 0:
4103  *                     for v in o:             # <<<<<<<<<<<<<<
4104  *                         ret = self._pack(v, nest_limit-1)
4105  *                         if ret != 0: break
4106  */
4107         }
4108         __pyx_L53_break:;
4109         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4110 
4111         /* "borg/algorithms/msgpack/_packer.pyx":261
4112  *                     raise PackValueError("list is too large")
4113  *                 ret = msgpack_pack_array(&self.pk, L)
4114  *                 if ret == 0:             # <<<<<<<<<<<<<<
4115  *                     for v in o:
4116  *                         ret = self._pack(v, nest_limit-1)
4117  */
4118       }
4119 
4120       /* "borg/algorithms/msgpack/_packer.pyx":256
4121  *                 ret = msgpack_pack_ext(&self.pk, longval, L)
4122  *                 ret = msgpack_pack_raw_body(&self.pk, rawval, L)
4123  *             elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):             # <<<<<<<<<<<<<<
4124  *                 L = len(o)
4125  *                 if L > ITEM_LIMIT:
4126  */
4127       goto __pyx_L6;
4128     }
4129 
4130     /* "borg/algorithms/msgpack/_packer.pyx":265
4131  *                         ret = self._pack(v, nest_limit-1)
4132  *                         if ret != 0: break
4133  *             elif PyMemoryView_Check(o):             # <<<<<<<<<<<<<<
4134  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4135  *                     raise PackValueError("could not get buffer for memoryview")
4136  */
4137     __pyx_t_12 = (PyMemoryView_Check(__pyx_v_o) != 0);
4138     if (__pyx_t_12) {
4139 
4140       /* "borg/algorithms/msgpack/_packer.pyx":266
4141  *                         if ret != 0: break
4142  *             elif PyMemoryView_Check(o):
4143  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:             # <<<<<<<<<<<<<<
4144  *                     raise PackValueError("could not get buffer for memoryview")
4145  *                 L = view.len
4146  */
4147       __pyx_t_11 = PyObject_GetBuffer(__pyx_v_o, (&__pyx_v_view), PyBUF_SIMPLE); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 266, __pyx_L1_error)
4148       __pyx_t_12 = ((__pyx_t_11 != 0) != 0);
4149       if (unlikely(__pyx_t_12)) {
4150 
4151         /* "borg/algorithms/msgpack/_packer.pyx":267
4152  *             elif PyMemoryView_Check(o):
4153  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4154  *                     raise PackValueError("could not get buffer for memoryview")             # <<<<<<<<<<<<<<
4155  *                 L = view.len
4156  *                 if L > ITEM_LIMIT:
4157  */
4158         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
4159         __Pyx_GOTREF(__pyx_t_2);
4160         __pyx_t_13 = NULL;
4161         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4162           __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
4163           if (likely(__pyx_t_13)) {
4164             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4165             __Pyx_INCREF(__pyx_t_13);
4166             __Pyx_INCREF(function);
4167             __Pyx_DECREF_SET(__pyx_t_2, function);
4168           }
4169         }
4170         __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_kp_s_could_not_get_buffer_for_memoryv) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_could_not_get_buffer_for_memoryv);
4171         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
4172         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
4173         __Pyx_GOTREF(__pyx_t_4);
4174         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4175         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4176         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4177         __PYX_ERR(0, 267, __pyx_L1_error)
4178 
4179         /* "borg/algorithms/msgpack/_packer.pyx":266
4180  *                         if ret != 0: break
4181  *             elif PyMemoryView_Check(o):
4182  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:             # <<<<<<<<<<<<<<
4183  *                     raise PackValueError("could not get buffer for memoryview")
4184  *                 L = view.len
4185  */
4186       }
4187 
4188       /* "borg/algorithms/msgpack/_packer.pyx":268
4189  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4190  *                     raise PackValueError("could not get buffer for memoryview")
4191  *                 L = view.len             # <<<<<<<<<<<<<<
4192  *                 if L > ITEM_LIMIT:
4193  *                     PyBuffer_Release(&view);
4194  */
4195       __pyx_t_21 = __pyx_v_view.len;
4196       __pyx_v_L = __pyx_t_21;
4197 
4198       /* "borg/algorithms/msgpack/_packer.pyx":269
4199  *                     raise PackValueError("could not get buffer for memoryview")
4200  *                 L = view.len
4201  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
4202  *                     PyBuffer_Release(&view);
4203  *                     raise PackValueError("memoryview is too large")
4204  */
4205       __pyx_t_12 = ((__pyx_v_L > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
4206       if (unlikely(__pyx_t_12)) {
4207 
4208         /* "borg/algorithms/msgpack/_packer.pyx":270
4209  *                 L = view.len
4210  *                 if L > ITEM_LIMIT:
4211  *                     PyBuffer_Release(&view);             # <<<<<<<<<<<<<<
4212  *                     raise PackValueError("memoryview is too large")
4213  *                 ret = msgpack_pack_bin(&self.pk, L)
4214  */
4215         PyBuffer_Release((&__pyx_v_view));
4216 
4217         /* "borg/algorithms/msgpack/_packer.pyx":271
4218  *                 if L > ITEM_LIMIT:
4219  *                     PyBuffer_Release(&view);
4220  *                     raise PackValueError("memoryview is too large")             # <<<<<<<<<<<<<<
4221  *                 ret = msgpack_pack_bin(&self.pk, L)
4222  *                 if ret == 0:
4223  */
4224         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error)
4225         __Pyx_GOTREF(__pyx_t_2);
4226         __pyx_t_13 = NULL;
4227         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4228           __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
4229           if (likely(__pyx_t_13)) {
4230             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4231             __Pyx_INCREF(__pyx_t_13);
4232             __Pyx_INCREF(function);
4233             __Pyx_DECREF_SET(__pyx_t_2, function);
4234           }
4235         }
4236         __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_kp_s_memoryview_is_too_large) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_memoryview_is_too_large);
4237         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
4238         if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
4239         __Pyx_GOTREF(__pyx_t_4);
4240         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4241         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4242         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4243         __PYX_ERR(0, 271, __pyx_L1_error)
4244 
4245         /* "borg/algorithms/msgpack/_packer.pyx":269
4246  *                     raise PackValueError("could not get buffer for memoryview")
4247  *                 L = view.len
4248  *                 if L > ITEM_LIMIT:             # <<<<<<<<<<<<<<
4249  *                     PyBuffer_Release(&view);
4250  *                     raise PackValueError("memoryview is too large")
4251  */
4252       }
4253 
4254       /* "borg/algorithms/msgpack/_packer.pyx":272
4255  *                     PyBuffer_Release(&view);
4256  *                     raise PackValueError("memoryview is too large")
4257  *                 ret = msgpack_pack_bin(&self.pk, L)             # <<<<<<<<<<<<<<
4258  *                 if ret == 0:
4259  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4260  */
4261       __pyx_v_ret = msgpack_pack_bin((&__pyx_v_self->pk), __pyx_v_L);
4262 
4263       /* "borg/algorithms/msgpack/_packer.pyx":273
4264  *                     raise PackValueError("memoryview is too large")
4265  *                 ret = msgpack_pack_bin(&self.pk, L)
4266  *                 if ret == 0:             # <<<<<<<<<<<<<<
4267  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4268  *                 PyBuffer_Release(&view);
4269  */
4270       __pyx_t_12 = ((__pyx_v_ret == 0) != 0);
4271       if (__pyx_t_12) {
4272 
4273         /* "borg/algorithms/msgpack/_packer.pyx":274
4274  *                 ret = msgpack_pack_bin(&self.pk, L)
4275  *                 if ret == 0:
4276  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)             # <<<<<<<<<<<<<<
4277  *                 PyBuffer_Release(&view);
4278  *             elif not default_used and self._default:
4279  */
4280         __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), ((char *)__pyx_v_view.buf), __pyx_v_L);
4281 
4282         /* "borg/algorithms/msgpack/_packer.pyx":273
4283  *                     raise PackValueError("memoryview is too large")
4284  *                 ret = msgpack_pack_bin(&self.pk, L)
4285  *                 if ret == 0:             # <<<<<<<<<<<<<<
4286  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4287  *                 PyBuffer_Release(&view);
4288  */
4289       }
4290 
4291       /* "borg/algorithms/msgpack/_packer.pyx":275
4292  *                 if ret == 0:
4293  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4294  *                 PyBuffer_Release(&view);             # <<<<<<<<<<<<<<
4295  *             elif not default_used and self._default:
4296  *                 o = self._default(o)
4297  */
4298       PyBuffer_Release((&__pyx_v_view));
4299 
4300       /* "borg/algorithms/msgpack/_packer.pyx":265
4301  *                         ret = self._pack(v, nest_limit-1)
4302  *                         if ret != 0: break
4303  *             elif PyMemoryView_Check(o):             # <<<<<<<<<<<<<<
4304  *                 if PyObject_GetBuffer(o, &view, PyBUF_SIMPLE) != 0:
4305  *                     raise PackValueError("could not get buffer for memoryview")
4306  */
4307       goto __pyx_L6;
4308     }
4309 
4310     /* "borg/algorithms/msgpack/_packer.pyx":276
4311  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4312  *                 PyBuffer_Release(&view);
4313  *             elif not default_used and self._default:             # <<<<<<<<<<<<<<
4314  *                 o = self._default(o)
4315  *                 default_used = 1
4316  */
4317     __pyx_t_5 = ((!(__pyx_v_default_used != 0)) != 0);
4318     if (__pyx_t_5) {
4319     } else {
4320       __pyx_t_12 = __pyx_t_5;
4321       goto __pyx_L58_bool_binop_done;
4322     }
4323     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_default); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 276, __pyx_L1_error)
4324     __pyx_t_12 = __pyx_t_5;
4325     __pyx_L58_bool_binop_done:;
4326     if (likely(__pyx_t_12)) {
4327 
4328       /* "borg/algorithms/msgpack/_packer.pyx":277
4329  *                 PyBuffer_Release(&view);
4330  *             elif not default_used and self._default:
4331  *                 o = self._default(o)             # <<<<<<<<<<<<<<
4332  *                 default_used = 1
4333  *                 continue
4334  */
4335       __Pyx_INCREF(__pyx_v_self->_default);
4336       __pyx_t_2 = __pyx_v_self->_default; __pyx_t_13 = NULL;
4337       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4338         __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
4339         if (likely(__pyx_t_13)) {
4340           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4341           __Pyx_INCREF(__pyx_t_13);
4342           __Pyx_INCREF(function);
4343           __Pyx_DECREF_SET(__pyx_t_2, function);
4344         }
4345       }
4346       __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_13, __pyx_v_o) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_o);
4347       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
4348       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
4349       __Pyx_GOTREF(__pyx_t_4);
4350       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4351       __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_4);
4352       __pyx_t_4 = 0;
4353 
4354       /* "borg/algorithms/msgpack/_packer.pyx":278
4355  *             elif not default_used and self._default:
4356  *                 o = self._default(o)
4357  *                 default_used = 1             # <<<<<<<<<<<<<<
4358  *                 continue
4359  *             else:
4360  */
4361       __pyx_v_default_used = 1;
4362 
4363       /* "borg/algorithms/msgpack/_packer.pyx":279
4364  *                 o = self._default(o)
4365  *                 default_used = 1
4366  *                 continue             # <<<<<<<<<<<<<<
4367  *             else:
4368  *                 raise TypeError("can't serialize %r" % (o,))
4369  */
4370       goto __pyx_L4_continue;
4371 
4372       /* "borg/algorithms/msgpack/_packer.pyx":276
4373  *                     ret = msgpack_pack_raw_body(&self.pk, <char*>view.buf, L)
4374  *                 PyBuffer_Release(&view);
4375  *             elif not default_used and self._default:             # <<<<<<<<<<<<<<
4376  *                 o = self._default(o)
4377  *                 default_used = 1
4378  */
4379     }
4380 
4381     /* "borg/algorithms/msgpack/_packer.pyx":281
4382  *                 continue
4383  *             else:
4384  *                 raise TypeError("can't serialize %r" % (o,))             # <<<<<<<<<<<<<<
4385  *             return ret
4386  *
4387  */
4388     /*else*/ {
4389       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
4390       __Pyx_GOTREF(__pyx_t_4);
4391       __Pyx_INCREF(__pyx_v_o);
4392       __Pyx_GIVEREF(__pyx_v_o);
4393       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_o);
4394       __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_can_t_serialize_r, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error)
4395       __Pyx_GOTREF(__pyx_t_2);
4396       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4397       __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
4398       __Pyx_GOTREF(__pyx_t_4);
4399       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4400       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4401       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4402       __PYX_ERR(0, 281, __pyx_L1_error)
4403     }
4404     __pyx_L6:;
4405 
4406     /* "borg/algorithms/msgpack/_packer.pyx":282
4407  *             else:
4408  *                 raise TypeError("can't serialize %r" % (o,))
4409  *             return ret             # <<<<<<<<<<<<<<
4410  *
4411  *     cpdef pack(self, object obj):
4412  */
4413     __pyx_r = __pyx_v_ret;
4414     goto __pyx_L0;
4415     __pyx_L4_continue:;
4416   }
4417 
4418   /* "borg/algorithms/msgpack/_packer.pyx":150
4419  *         self.pk.buf = NULL
4420  *
4421  *     cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:             # <<<<<<<<<<<<<<
4422  *         cdef long long llval
4423  *         cdef unsigned long long ullval
4424  */
4425 
4426   /* function exit code */
4427   __pyx_r = 0;
4428   goto __pyx_L0;
4429   __pyx_L1_error:;
4430   __Pyx_XDECREF(__pyx_t_2);
4431   __Pyx_XDECREF(__pyx_t_3);
4432   __Pyx_XDECREF(__pyx_t_4);
4433   __Pyx_XDECREF(__pyx_t_13);
4434   __Pyx_XDECREF(__pyx_t_14);
4435   __Pyx_XDECREF(__pyx_t_15);
4436   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer._pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4437   __pyx_r = -1;
4438   __pyx_L0:;
4439   __Pyx_XDECREF(__pyx_v_d);
4440   __Pyx_XDECREF(__pyx_v_oe);
4441   __Pyx_XDECREF(__pyx_v_k);
4442   __Pyx_XDECREF(__pyx_v_v);
4443   __Pyx_XDECREF(__pyx_v_o);
4444   __Pyx_RefNannyFinishContext();
4445   return __pyx_r;
4446 }
4447 
4448 /* "borg/algorithms/msgpack/_packer.pyx":284
4449  *             return ret
4450  *
4451  *     cpdef pack(self, object obj):             # <<<<<<<<<<<<<<
4452  *         cdef int ret
4453  *         try:
4454  */
4455 
4456 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/
__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer_pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_obj,int __pyx_skip_dispatch)4457 static PyObject *__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer_pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) {
4458   int __pyx_v_ret;
4459   PyObject *__pyx_v_buf = NULL;
4460   PyObject *__pyx_r = NULL;
4461   __Pyx_RefNannyDeclarations
4462   PyObject *__pyx_t_1 = NULL;
4463   PyObject *__pyx_t_2 = NULL;
4464   PyObject *__pyx_t_3 = NULL;
4465   PyObject *__pyx_t_4 = NULL;
4466   PyObject *__pyx_t_5 = NULL;
4467   PyObject *__pyx_t_6 = NULL;
4468   PyObject *__pyx_t_7 = NULL;
4469   int __pyx_t_8;
4470   struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack __pyx_t_9;
4471   int __pyx_t_10;
4472   int __pyx_lineno = 0;
4473   const char *__pyx_filename = NULL;
4474   int __pyx_clineno = 0;
4475   __Pyx_RefNannySetupContext("pack", 0);
4476   /* Check if called by wrapper */
4477   if (unlikely(__pyx_skip_dispatch)) ;
4478   /* Check if overridden in Python */
4479   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
4480     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4481     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
4482     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
4483       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
4484       #endif
4485       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
4486       __Pyx_GOTREF(__pyx_t_1);
4487       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack)) {
4488         __Pyx_XDECREF(__pyx_r);
4489         __Pyx_INCREF(__pyx_t_1);
4490         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
4491         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4492           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4493           if (likely(__pyx_t_4)) {
4494             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4495             __Pyx_INCREF(__pyx_t_4);
4496             __Pyx_INCREF(function);
4497             __Pyx_DECREF_SET(__pyx_t_3, function);
4498           }
4499         }
4500         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_obj) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_obj);
4501         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4502         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
4503         __Pyx_GOTREF(__pyx_t_2);
4504         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4505         __pyx_r = __pyx_t_2;
4506         __pyx_t_2 = 0;
4507         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4508         goto __pyx_L0;
4509       }
4510       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4511       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
4512       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
4513       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
4514         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
4515       }
4516       #endif
4517       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4518       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
4519     }
4520     #endif
4521   }
4522 
4523   /* "borg/algorithms/msgpack/_packer.pyx":286
4524  *     cpdef pack(self, object obj):
4525  *         cdef int ret
4526  *         try:             # <<<<<<<<<<<<<<
4527  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4528  *         except:
4529  */
4530   {
4531     __Pyx_PyThreadState_declare
4532     __Pyx_PyThreadState_assign
4533     __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
4534     __Pyx_XGOTREF(__pyx_t_5);
4535     __Pyx_XGOTREF(__pyx_t_6);
4536     __Pyx_XGOTREF(__pyx_t_7);
4537     /*try:*/ {
4538 
4539       /* "borg/algorithms/msgpack/_packer.pyx":287
4540  *         cdef int ret
4541  *         try:
4542  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)             # <<<<<<<<<<<<<<
4543  *         except:
4544  *             self.pk.length = 0
4545  */
4546       __pyx_t_9.__pyx_n = 1;
4547       __pyx_t_9.nest_limit = __pyx_v_4borg_10algorithms_7msgpack_7_packer_DEFAULT_RECURSE_LIMIT;
4548       __pyx_t_8 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_obj, &__pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 287, __pyx_L3_error)
4549       __pyx_v_ret = __pyx_t_8;
4550 
4551       /* "borg/algorithms/msgpack/_packer.pyx":286
4552  *     cpdef pack(self, object obj):
4553  *         cdef int ret
4554  *         try:             # <<<<<<<<<<<<<<
4555  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4556  *         except:
4557  */
4558     }
4559     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4560     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4561     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4562     goto __pyx_L8_try_end;
4563     __pyx_L3_error:;
4564     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4565     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4566     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4567     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4568 
4569     /* "borg/algorithms/msgpack/_packer.pyx":288
4570  *         try:
4571  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4572  *         except:             # <<<<<<<<<<<<<<
4573  *             self.pk.length = 0
4574  *             raise
4575  */
4576     /*except:*/ {
4577       __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4578       if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 288, __pyx_L5_except_error)
4579       __Pyx_GOTREF(__pyx_t_1);
4580       __Pyx_GOTREF(__pyx_t_2);
4581       __Pyx_GOTREF(__pyx_t_3);
4582 
4583       /* "borg/algorithms/msgpack/_packer.pyx":289
4584  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4585  *         except:
4586  *             self.pk.length = 0             # <<<<<<<<<<<<<<
4587  *             raise
4588  *         if ret:  # should not happen.
4589  */
4590       __pyx_v_self->pk.length = 0;
4591 
4592       /* "borg/algorithms/msgpack/_packer.pyx":290
4593  *         except:
4594  *             self.pk.length = 0
4595  *             raise             # <<<<<<<<<<<<<<
4596  *         if ret:  # should not happen.
4597  *             raise RuntimeError("internal error")
4598  */
4599       __Pyx_GIVEREF(__pyx_t_1);
4600       __Pyx_GIVEREF(__pyx_t_2);
4601       __Pyx_XGIVEREF(__pyx_t_3);
4602       __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4603       __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
4604       __PYX_ERR(0, 290, __pyx_L5_except_error)
4605     }
4606     __pyx_L5_except_error:;
4607 
4608     /* "borg/algorithms/msgpack/_packer.pyx":286
4609  *     cpdef pack(self, object obj):
4610  *         cdef int ret
4611  *         try:             # <<<<<<<<<<<<<<
4612  *             ret = self._pack(obj, DEFAULT_RECURSE_LIMIT)
4613  *         except:
4614  */
4615     __Pyx_XGIVEREF(__pyx_t_5);
4616     __Pyx_XGIVEREF(__pyx_t_6);
4617     __Pyx_XGIVEREF(__pyx_t_7);
4618     __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
4619     goto __pyx_L1_error;
4620     __pyx_L8_try_end:;
4621   }
4622 
4623   /* "borg/algorithms/msgpack/_packer.pyx":291
4624  *             self.pk.length = 0
4625  *             raise
4626  *         if ret:  # should not happen.             # <<<<<<<<<<<<<<
4627  *             raise RuntimeError("internal error")
4628  *         if self.autoreset:
4629  */
4630   __pyx_t_10 = (__pyx_v_ret != 0);
4631   if (unlikely(__pyx_t_10)) {
4632 
4633     /* "borg/algorithms/msgpack/_packer.pyx":292
4634  *             raise
4635  *         if ret:  # should not happen.
4636  *             raise RuntimeError("internal error")             # <<<<<<<<<<<<<<
4637  *         if self.autoreset:
4638  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4639  */
4640     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
4641     __Pyx_GOTREF(__pyx_t_3);
4642     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4643     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4644     __PYX_ERR(0, 292, __pyx_L1_error)
4645 
4646     /* "borg/algorithms/msgpack/_packer.pyx":291
4647  *             self.pk.length = 0
4648  *             raise
4649  *         if ret:  # should not happen.             # <<<<<<<<<<<<<<
4650  *             raise RuntimeError("internal error")
4651  *         if self.autoreset:
4652  */
4653   }
4654 
4655   /* "borg/algorithms/msgpack/_packer.pyx":293
4656  *         if ret:  # should not happen.
4657  *             raise RuntimeError("internal error")
4658  *         if self.autoreset:             # <<<<<<<<<<<<<<
4659  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4660  *             self.pk.length = 0
4661  */
4662   __pyx_t_10 = (__pyx_v_self->autoreset != 0);
4663   if (__pyx_t_10) {
4664 
4665     /* "borg/algorithms/msgpack/_packer.pyx":294
4666  *             raise RuntimeError("internal error")
4667  *         if self.autoreset:
4668  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)             # <<<<<<<<<<<<<<
4669  *             self.pk.length = 0
4670  *             return buf
4671  */
4672     __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error)
4673     __Pyx_GOTREF(__pyx_t_3);
4674     __pyx_v_buf = ((PyObject*)__pyx_t_3);
4675     __pyx_t_3 = 0;
4676 
4677     /* "borg/algorithms/msgpack/_packer.pyx":295
4678  *         if self.autoreset:
4679  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4680  *             self.pk.length = 0             # <<<<<<<<<<<<<<
4681  *             return buf
4682  *
4683  */
4684     __pyx_v_self->pk.length = 0;
4685 
4686     /* "borg/algorithms/msgpack/_packer.pyx":296
4687  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4688  *             self.pk.length = 0
4689  *             return buf             # <<<<<<<<<<<<<<
4690  *
4691  *     def pack_ext_type(self, typecode, data):
4692  */
4693     __Pyx_XDECREF(__pyx_r);
4694     __Pyx_INCREF(__pyx_v_buf);
4695     __pyx_r = __pyx_v_buf;
4696     goto __pyx_L0;
4697 
4698     /* "borg/algorithms/msgpack/_packer.pyx":293
4699  *         if ret:  # should not happen.
4700  *             raise RuntimeError("internal error")
4701  *         if self.autoreset:             # <<<<<<<<<<<<<<
4702  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
4703  *             self.pk.length = 0
4704  */
4705   }
4706 
4707   /* "borg/algorithms/msgpack/_packer.pyx":284
4708  *             return ret
4709  *
4710  *     cpdef pack(self, object obj):             # <<<<<<<<<<<<<<
4711  *         cdef int ret
4712  *         try:
4713  */
4714 
4715   /* function exit code */
4716   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4717   goto __pyx_L0;
4718   __pyx_L1_error:;
4719   __Pyx_XDECREF(__pyx_t_1);
4720   __Pyx_XDECREF(__pyx_t_2);
4721   __Pyx_XDECREF(__pyx_t_3);
4722   __Pyx_XDECREF(__pyx_t_4);
4723   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4724   __pyx_r = 0;
4725   __pyx_L0:;
4726   __Pyx_XDECREF(__pyx_v_buf);
4727   __Pyx_XGIVEREF(__pyx_r);
4728   __Pyx_RefNannyFinishContext();
4729   return __pyx_r;
4730 }
4731 
4732 /* Python wrapper */
4733 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/
4734 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack[] = "Packer.pack(self, obj)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack(PyObject * __pyx_v_self,PyObject * __pyx_v_obj)4735 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) {
4736   PyObject *__pyx_r = 0;
4737   __Pyx_RefNannyDeclarations
4738   __Pyx_RefNannySetupContext("pack (wrapper)", 0);
4739   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), ((PyObject *)__pyx_v_obj));
4740 
4741   /* function exit code */
4742   __Pyx_RefNannyFinishContext();
4743   return __pyx_r;
4744 }
4745 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_obj)4746 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_obj) {
4747   PyObject *__pyx_r = NULL;
4748   __Pyx_RefNannyDeclarations
4749   PyObject *__pyx_t_1 = NULL;
4750   int __pyx_lineno = 0;
4751   const char *__pyx_filename = NULL;
4752   int __pyx_clineno = 0;
4753   __Pyx_RefNannySetupContext("pack", 0);
4754   __Pyx_XDECREF(__pyx_r);
4755   __pyx_t_1 = __pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer_pack(__pyx_v_self, __pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
4756   __Pyx_GOTREF(__pyx_t_1);
4757   __pyx_r = __pyx_t_1;
4758   __pyx_t_1 = 0;
4759   goto __pyx_L0;
4760 
4761   /* function exit code */
4762   __pyx_L1_error:;
4763   __Pyx_XDECREF(__pyx_t_1);
4764   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4765   __pyx_r = NULL;
4766   __pyx_L0:;
4767   __Pyx_XGIVEREF(__pyx_r);
4768   __Pyx_RefNannyFinishContext();
4769   return __pyx_r;
4770 }
4771 
4772 /* "borg/algorithms/msgpack/_packer.pyx":298
4773  *             return buf
4774  *
4775  *     def pack_ext_type(self, typecode, data):             # <<<<<<<<<<<<<<
4776  *         msgpack_pack_ext(&self.pk, typecode, len(data))
4777  *         msgpack_pack_raw_body(&self.pk, data, len(data))
4778  */
4779 
4780 /* Python wrapper */
4781 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_9pack_ext_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4782 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type[] = "Packer.pack_ext_type(self, typecode, data)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_9pack_ext_type(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4783 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_9pack_ext_type(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4784   PyObject *__pyx_v_typecode = 0;
4785   PyObject *__pyx_v_data = 0;
4786   int __pyx_lineno = 0;
4787   const char *__pyx_filename = NULL;
4788   int __pyx_clineno = 0;
4789   PyObject *__pyx_r = 0;
4790   __Pyx_RefNannyDeclarations
4791   __Pyx_RefNannySetupContext("pack_ext_type (wrapper)", 0);
4792   {
4793     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_typecode,&__pyx_n_s_data,0};
4794     PyObject* values[2] = {0,0};
4795     if (unlikely(__pyx_kwds)) {
4796       Py_ssize_t kw_args;
4797       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4798       switch (pos_args) {
4799         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4800         CYTHON_FALLTHROUGH;
4801         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4802         CYTHON_FALLTHROUGH;
4803         case  0: break;
4804         default: goto __pyx_L5_argtuple_error;
4805       }
4806       kw_args = PyDict_Size(__pyx_kwds);
4807       switch (pos_args) {
4808         case  0:
4809         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_typecode)) != 0)) kw_args--;
4810         else goto __pyx_L5_argtuple_error;
4811         CYTHON_FALLTHROUGH;
4812         case  1:
4813         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4814         else {
4815           __Pyx_RaiseArgtupleInvalid("pack_ext_type", 1, 2, 2, 1); __PYX_ERR(0, 298, __pyx_L3_error)
4816         }
4817       }
4818       if (unlikely(kw_args > 0)) {
4819         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pack_ext_type") < 0)) __PYX_ERR(0, 298, __pyx_L3_error)
4820       }
4821     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4822       goto __pyx_L5_argtuple_error;
4823     } else {
4824       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4825       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4826     }
4827     __pyx_v_typecode = values[0];
4828     __pyx_v_data = values[1];
4829   }
4830   goto __pyx_L4_argument_unpacking_done;
4831   __pyx_L5_argtuple_error:;
4832   __Pyx_RaiseArgtupleInvalid("pack_ext_type", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 298, __pyx_L3_error)
4833   __pyx_L3_error:;
4834   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_ext_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
4835   __Pyx_RefNannyFinishContext();
4836   return NULL;
4837   __pyx_L4_argument_unpacking_done:;
4838   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), __pyx_v_typecode, __pyx_v_data);
4839 
4840   /* function exit code */
4841   __Pyx_RefNannyFinishContext();
4842   return __pyx_r;
4843 }
4844 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_typecode,PyObject * __pyx_v_data)4845 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_typecode, PyObject *__pyx_v_data) {
4846   PyObject *__pyx_r = NULL;
4847   __Pyx_RefNannyDeclarations
4848   char __pyx_t_1;
4849   Py_ssize_t __pyx_t_2;
4850   char *__pyx_t_3;
4851   int __pyx_lineno = 0;
4852   const char *__pyx_filename = NULL;
4853   int __pyx_clineno = 0;
4854   __Pyx_RefNannySetupContext("pack_ext_type", 0);
4855 
4856   /* "borg/algorithms/msgpack/_packer.pyx":299
4857  *
4858  *     def pack_ext_type(self, typecode, data):
4859  *         msgpack_pack_ext(&self.pk, typecode, len(data))             # <<<<<<<<<<<<<<
4860  *         msgpack_pack_raw_body(&self.pk, data, len(data))
4861  *
4862  */
4863   __pyx_t_1 = __Pyx_PyInt_As_char(__pyx_v_typecode); if (unlikely((__pyx_t_1 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error)
4864   __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 299, __pyx_L1_error)
4865   (void)(msgpack_pack_ext((&__pyx_v_self->pk), __pyx_t_1, __pyx_t_2));
4866 
4867   /* "borg/algorithms/msgpack/_packer.pyx":300
4868  *     def pack_ext_type(self, typecode, data):
4869  *         msgpack_pack_ext(&self.pk, typecode, len(data))
4870  *         msgpack_pack_raw_body(&self.pk, data, len(data))             # <<<<<<<<<<<<<<
4871  *
4872  *     def pack_array_header(self, long long size):
4873  */
4874   __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error)
4875   __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 300, __pyx_L1_error)
4876   (void)(msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_t_3, __pyx_t_2));
4877 
4878   /* "borg/algorithms/msgpack/_packer.pyx":298
4879  *             return buf
4880  *
4881  *     def pack_ext_type(self, typecode, data):             # <<<<<<<<<<<<<<
4882  *         msgpack_pack_ext(&self.pk, typecode, len(data))
4883  *         msgpack_pack_raw_body(&self.pk, data, len(data))
4884  */
4885 
4886   /* function exit code */
4887   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4888   goto __pyx_L0;
4889   __pyx_L1_error:;
4890   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_ext_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
4891   __pyx_r = NULL;
4892   __pyx_L0:;
4893   __Pyx_XGIVEREF(__pyx_r);
4894   __Pyx_RefNannyFinishContext();
4895   return __pyx_r;
4896 }
4897 
4898 /* "borg/algorithms/msgpack/_packer.pyx":302
4899  *         msgpack_pack_raw_body(&self.pk, data, len(data))
4900  *
4901  *     def pack_array_header(self, long long size):             # <<<<<<<<<<<<<<
4902  *         if size > ITEM_LIMIT:
4903  *             raise PackValueError
4904  */
4905 
4906 /* Python wrapper */
4907 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_11pack_array_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
4908 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header[] = "Packer.pack_array_header(self, long long size)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_11pack_array_header(PyObject * __pyx_v_self,PyObject * __pyx_arg_size)4909 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_11pack_array_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
4910   PY_LONG_LONG __pyx_v_size;
4911   int __pyx_lineno = 0;
4912   const char *__pyx_filename = NULL;
4913   int __pyx_clineno = 0;
4914   PyObject *__pyx_r = 0;
4915   __Pyx_RefNannyDeclarations
4916   __Pyx_RefNannySetupContext("pack_array_header (wrapper)", 0);
4917   assert(__pyx_arg_size); {
4918     __pyx_v_size = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_arg_size); if (unlikely((__pyx_v_size == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
4919   }
4920   goto __pyx_L4_argument_unpacking_done;
4921   __pyx_L3_error:;
4922   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_array_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
4923   __Pyx_RefNannyFinishContext();
4924   return NULL;
4925   __pyx_L4_argument_unpacking_done:;
4926   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), ((PY_LONG_LONG)__pyx_v_size));
4927 
4928   /* function exit code */
4929   __Pyx_RefNannyFinishContext();
4930   return __pyx_r;
4931 }
4932 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PY_LONG_LONG __pyx_v_size)4933 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size) {
4934   int __pyx_v_ret;
4935   PyObject *__pyx_v_buf = NULL;
4936   PyObject *__pyx_r = NULL;
4937   __Pyx_RefNannyDeclarations
4938   int __pyx_t_1;
4939   PyObject *__pyx_t_2 = NULL;
4940   int __pyx_lineno = 0;
4941   const char *__pyx_filename = NULL;
4942   int __pyx_clineno = 0;
4943   __Pyx_RefNannySetupContext("pack_array_header", 0);
4944 
4945   /* "borg/algorithms/msgpack/_packer.pyx":303
4946  *
4947  *     def pack_array_header(self, long long size):
4948  *         if size > ITEM_LIMIT:             # <<<<<<<<<<<<<<
4949  *             raise PackValueError
4950  *         cdef int ret = msgpack_pack_array(&self.pk, size)
4951  */
4952   __pyx_t_1 = ((__pyx_v_size > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
4953   if (unlikely(__pyx_t_1)) {
4954 
4955     /* "borg/algorithms/msgpack/_packer.pyx":304
4956  *     def pack_array_header(self, long long size):
4957  *         if size > ITEM_LIMIT:
4958  *             raise PackValueError             # <<<<<<<<<<<<<<
4959  *         cdef int ret = msgpack_pack_array(&self.pk, size)
4960  *         if ret == -1:
4961  */
4962     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
4963     __Pyx_GOTREF(__pyx_t_2);
4964     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4965     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4966     __PYX_ERR(0, 304, __pyx_L1_error)
4967 
4968     /* "borg/algorithms/msgpack/_packer.pyx":303
4969  *
4970  *     def pack_array_header(self, long long size):
4971  *         if size > ITEM_LIMIT:             # <<<<<<<<<<<<<<
4972  *             raise PackValueError
4973  *         cdef int ret = msgpack_pack_array(&self.pk, size)
4974  */
4975   }
4976 
4977   /* "borg/algorithms/msgpack/_packer.pyx":305
4978  *         if size > ITEM_LIMIT:
4979  *             raise PackValueError
4980  *         cdef int ret = msgpack_pack_array(&self.pk, size)             # <<<<<<<<<<<<<<
4981  *         if ret == -1:
4982  *             raise MemoryError
4983  */
4984   __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_v_size);
4985 
4986   /* "borg/algorithms/msgpack/_packer.pyx":306
4987  *             raise PackValueError
4988  *         cdef int ret = msgpack_pack_array(&self.pk, size)
4989  *         if ret == -1:             # <<<<<<<<<<<<<<
4990  *             raise MemoryError
4991  *         elif ret:  # should not happen
4992  */
4993   __pyx_t_1 = ((__pyx_v_ret == -1L) != 0);
4994   if (unlikely(__pyx_t_1)) {
4995 
4996     /* "borg/algorithms/msgpack/_packer.pyx":307
4997  *         cdef int ret = msgpack_pack_array(&self.pk, size)
4998  *         if ret == -1:
4999  *             raise MemoryError             # <<<<<<<<<<<<<<
5000  *         elif ret:  # should not happen
5001  *             raise TypeError
5002  */
5003     PyErr_NoMemory(); __PYX_ERR(0, 307, __pyx_L1_error)
5004 
5005     /* "borg/algorithms/msgpack/_packer.pyx":306
5006  *             raise PackValueError
5007  *         cdef int ret = msgpack_pack_array(&self.pk, size)
5008  *         if ret == -1:             # <<<<<<<<<<<<<<
5009  *             raise MemoryError
5010  *         elif ret:  # should not happen
5011  */
5012   }
5013 
5014   /* "borg/algorithms/msgpack/_packer.pyx":308
5015  *         if ret == -1:
5016  *             raise MemoryError
5017  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5018  *             raise TypeError
5019  *         if self.autoreset:
5020  */
5021   __pyx_t_1 = (__pyx_v_ret != 0);
5022   if (unlikely(__pyx_t_1)) {
5023 
5024     /* "borg/algorithms/msgpack/_packer.pyx":309
5025  *             raise MemoryError
5026  *         elif ret:  # should not happen
5027  *             raise TypeError             # <<<<<<<<<<<<<<
5028  *         if self.autoreset:
5029  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5030  */
5031     __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5032     __PYX_ERR(0, 309, __pyx_L1_error)
5033 
5034     /* "borg/algorithms/msgpack/_packer.pyx":308
5035  *         if ret == -1:
5036  *             raise MemoryError
5037  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5038  *             raise TypeError
5039  *         if self.autoreset:
5040  */
5041   }
5042 
5043   /* "borg/algorithms/msgpack/_packer.pyx":310
5044  *         elif ret:  # should not happen
5045  *             raise TypeError
5046  *         if self.autoreset:             # <<<<<<<<<<<<<<
5047  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5048  *             self.pk.length = 0
5049  */
5050   __pyx_t_1 = (__pyx_v_self->autoreset != 0);
5051   if (__pyx_t_1) {
5052 
5053     /* "borg/algorithms/msgpack/_packer.pyx":311
5054  *             raise TypeError
5055  *         if self.autoreset:
5056  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)             # <<<<<<<<<<<<<<
5057  *             self.pk.length = 0
5058  *             return buf
5059  */
5060     __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error)
5061     __Pyx_GOTREF(__pyx_t_2);
5062     __pyx_v_buf = ((PyObject*)__pyx_t_2);
5063     __pyx_t_2 = 0;
5064 
5065     /* "borg/algorithms/msgpack/_packer.pyx":312
5066  *         if self.autoreset:
5067  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5068  *             self.pk.length = 0             # <<<<<<<<<<<<<<
5069  *             return buf
5070  *
5071  */
5072     __pyx_v_self->pk.length = 0;
5073 
5074     /* "borg/algorithms/msgpack/_packer.pyx":313
5075  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5076  *             self.pk.length = 0
5077  *             return buf             # <<<<<<<<<<<<<<
5078  *
5079  *     def pack_map_header(self, long long size):
5080  */
5081     __Pyx_XDECREF(__pyx_r);
5082     __Pyx_INCREF(__pyx_v_buf);
5083     __pyx_r = __pyx_v_buf;
5084     goto __pyx_L0;
5085 
5086     /* "borg/algorithms/msgpack/_packer.pyx":310
5087  *         elif ret:  # should not happen
5088  *             raise TypeError
5089  *         if self.autoreset:             # <<<<<<<<<<<<<<
5090  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5091  *             self.pk.length = 0
5092  */
5093   }
5094 
5095   /* "borg/algorithms/msgpack/_packer.pyx":302
5096  *         msgpack_pack_raw_body(&self.pk, data, len(data))
5097  *
5098  *     def pack_array_header(self, long long size):             # <<<<<<<<<<<<<<
5099  *         if size > ITEM_LIMIT:
5100  *             raise PackValueError
5101  */
5102 
5103   /* function exit code */
5104   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5105   goto __pyx_L0;
5106   __pyx_L1_error:;
5107   __Pyx_XDECREF(__pyx_t_2);
5108   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_array_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5109   __pyx_r = NULL;
5110   __pyx_L0:;
5111   __Pyx_XDECREF(__pyx_v_buf);
5112   __Pyx_XGIVEREF(__pyx_r);
5113   __Pyx_RefNannyFinishContext();
5114   return __pyx_r;
5115 }
5116 
5117 /* "borg/algorithms/msgpack/_packer.pyx":315
5118  *             return buf
5119  *
5120  *     def pack_map_header(self, long long size):             # <<<<<<<<<<<<<<
5121  *         if size > ITEM_LIMIT:
5122  *             raise PackValueError
5123  */
5124 
5125 /* Python wrapper */
5126 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_13pack_map_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
5127 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header[] = "Packer.pack_map_header(self, long long size)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_13pack_map_header(PyObject * __pyx_v_self,PyObject * __pyx_arg_size)5128 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_13pack_map_header(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
5129   PY_LONG_LONG __pyx_v_size;
5130   int __pyx_lineno = 0;
5131   const char *__pyx_filename = NULL;
5132   int __pyx_clineno = 0;
5133   PyObject *__pyx_r = 0;
5134   __Pyx_RefNannyDeclarations
5135   __Pyx_RefNannySetupContext("pack_map_header (wrapper)", 0);
5136   assert(__pyx_arg_size); {
5137     __pyx_v_size = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_arg_size); if (unlikely((__pyx_v_size == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L3_error)
5138   }
5139   goto __pyx_L4_argument_unpacking_done;
5140   __pyx_L3_error:;
5141   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_map_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5142   __Pyx_RefNannyFinishContext();
5143   return NULL;
5144   __pyx_L4_argument_unpacking_done:;
5145   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), ((PY_LONG_LONG)__pyx_v_size));
5146 
5147   /* function exit code */
5148   __Pyx_RefNannyFinishContext();
5149   return __pyx_r;
5150 }
5151 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PY_LONG_LONG __pyx_v_size)5152 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PY_LONG_LONG __pyx_v_size) {
5153   int __pyx_v_ret;
5154   PyObject *__pyx_v_buf = NULL;
5155   PyObject *__pyx_r = NULL;
5156   __Pyx_RefNannyDeclarations
5157   int __pyx_t_1;
5158   PyObject *__pyx_t_2 = NULL;
5159   int __pyx_lineno = 0;
5160   const char *__pyx_filename = NULL;
5161   int __pyx_clineno = 0;
5162   __Pyx_RefNannySetupContext("pack_map_header", 0);
5163 
5164   /* "borg/algorithms/msgpack/_packer.pyx":316
5165  *
5166  *     def pack_map_header(self, long long size):
5167  *         if size > ITEM_LIMIT:             # <<<<<<<<<<<<<<
5168  *             raise PackValueError
5169  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5170  */
5171   __pyx_t_1 = ((__pyx_v_size > __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT) != 0);
5172   if (unlikely(__pyx_t_1)) {
5173 
5174     /* "borg/algorithms/msgpack/_packer.pyx":317
5175  *     def pack_map_header(self, long long size):
5176  *         if size > ITEM_LIMIT:
5177  *             raise PackValueError             # <<<<<<<<<<<<<<
5178  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5179  *         if ret == -1:
5180  */
5181     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
5182     __Pyx_GOTREF(__pyx_t_2);
5183     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5184     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5185     __PYX_ERR(0, 317, __pyx_L1_error)
5186 
5187     /* "borg/algorithms/msgpack/_packer.pyx":316
5188  *
5189  *     def pack_map_header(self, long long size):
5190  *         if size > ITEM_LIMIT:             # <<<<<<<<<<<<<<
5191  *             raise PackValueError
5192  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5193  */
5194   }
5195 
5196   /* "borg/algorithms/msgpack/_packer.pyx":318
5197  *         if size > ITEM_LIMIT:
5198  *             raise PackValueError
5199  *         cdef int ret = msgpack_pack_map(&self.pk, size)             # <<<<<<<<<<<<<<
5200  *         if ret == -1:
5201  *             raise MemoryError
5202  */
5203   __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_v_size);
5204 
5205   /* "borg/algorithms/msgpack/_packer.pyx":319
5206  *             raise PackValueError
5207  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5208  *         if ret == -1:             # <<<<<<<<<<<<<<
5209  *             raise MemoryError
5210  *         elif ret:  # should not happen
5211  */
5212   __pyx_t_1 = ((__pyx_v_ret == -1L) != 0);
5213   if (unlikely(__pyx_t_1)) {
5214 
5215     /* "borg/algorithms/msgpack/_packer.pyx":320
5216  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5217  *         if ret == -1:
5218  *             raise MemoryError             # <<<<<<<<<<<<<<
5219  *         elif ret:  # should not happen
5220  *             raise TypeError
5221  */
5222     PyErr_NoMemory(); __PYX_ERR(0, 320, __pyx_L1_error)
5223 
5224     /* "borg/algorithms/msgpack/_packer.pyx":319
5225  *             raise PackValueError
5226  *         cdef int ret = msgpack_pack_map(&self.pk, size)
5227  *         if ret == -1:             # <<<<<<<<<<<<<<
5228  *             raise MemoryError
5229  *         elif ret:  # should not happen
5230  */
5231   }
5232 
5233   /* "borg/algorithms/msgpack/_packer.pyx":321
5234  *         if ret == -1:
5235  *             raise MemoryError
5236  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5237  *             raise TypeError
5238  *         if self.autoreset:
5239  */
5240   __pyx_t_1 = (__pyx_v_ret != 0);
5241   if (unlikely(__pyx_t_1)) {
5242 
5243     /* "borg/algorithms/msgpack/_packer.pyx":322
5244  *             raise MemoryError
5245  *         elif ret:  # should not happen
5246  *             raise TypeError             # <<<<<<<<<<<<<<
5247  *         if self.autoreset:
5248  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5249  */
5250     __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5251     __PYX_ERR(0, 322, __pyx_L1_error)
5252 
5253     /* "borg/algorithms/msgpack/_packer.pyx":321
5254  *         if ret == -1:
5255  *             raise MemoryError
5256  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5257  *             raise TypeError
5258  *         if self.autoreset:
5259  */
5260   }
5261 
5262   /* "borg/algorithms/msgpack/_packer.pyx":323
5263  *         elif ret:  # should not happen
5264  *             raise TypeError
5265  *         if self.autoreset:             # <<<<<<<<<<<<<<
5266  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5267  *             self.pk.length = 0
5268  */
5269   __pyx_t_1 = (__pyx_v_self->autoreset != 0);
5270   if (__pyx_t_1) {
5271 
5272     /* "borg/algorithms/msgpack/_packer.pyx":324
5273  *             raise TypeError
5274  *         if self.autoreset:
5275  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)             # <<<<<<<<<<<<<<
5276  *             self.pk.length = 0
5277  *             return buf
5278  */
5279     __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
5280     __Pyx_GOTREF(__pyx_t_2);
5281     __pyx_v_buf = ((PyObject*)__pyx_t_2);
5282     __pyx_t_2 = 0;
5283 
5284     /* "borg/algorithms/msgpack/_packer.pyx":325
5285  *         if self.autoreset:
5286  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5287  *             self.pk.length = 0             # <<<<<<<<<<<<<<
5288  *             return buf
5289  *
5290  */
5291     __pyx_v_self->pk.length = 0;
5292 
5293     /* "borg/algorithms/msgpack/_packer.pyx":326
5294  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5295  *             self.pk.length = 0
5296  *             return buf             # <<<<<<<<<<<<<<
5297  *
5298  *     def pack_map_pairs(self, object pairs):
5299  */
5300     __Pyx_XDECREF(__pyx_r);
5301     __Pyx_INCREF(__pyx_v_buf);
5302     __pyx_r = __pyx_v_buf;
5303     goto __pyx_L0;
5304 
5305     /* "borg/algorithms/msgpack/_packer.pyx":323
5306  *         elif ret:  # should not happen
5307  *             raise TypeError
5308  *         if self.autoreset:             # <<<<<<<<<<<<<<
5309  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5310  *             self.pk.length = 0
5311  */
5312   }
5313 
5314   /* "borg/algorithms/msgpack/_packer.pyx":315
5315  *             return buf
5316  *
5317  *     def pack_map_header(self, long long size):             # <<<<<<<<<<<<<<
5318  *         if size > ITEM_LIMIT:
5319  *             raise PackValueError
5320  */
5321 
5322   /* function exit code */
5323   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5324   goto __pyx_L0;
5325   __pyx_L1_error:;
5326   __Pyx_XDECREF(__pyx_t_2);
5327   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_map_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
5328   __pyx_r = NULL;
5329   __pyx_L0:;
5330   __Pyx_XDECREF(__pyx_v_buf);
5331   __Pyx_XGIVEREF(__pyx_r);
5332   __Pyx_RefNannyFinishContext();
5333   return __pyx_r;
5334 }
5335 
5336 /* "borg/algorithms/msgpack/_packer.pyx":328
5337  *             return buf
5338  *
5339  *     def pack_map_pairs(self, object pairs):             # <<<<<<<<<<<<<<
5340  *         """
5341  *         Pack *pairs* as msgpack map type.
5342  */
5343 
5344 /* Python wrapper */
5345 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_15pack_map_pairs(PyObject *__pyx_v_self, PyObject *__pyx_v_pairs); /*proto*/
5346 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs[] = "Packer.pack_map_pairs(self, pairs)\n\n        Pack *pairs* as msgpack map type.\n\n        *pairs* should be a sequence of pairs.\n        (`len(pairs)` and `for k, v in pairs:` should be supported.)\n        ";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_15pack_map_pairs(PyObject * __pyx_v_self,PyObject * __pyx_v_pairs)5347 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_15pack_map_pairs(PyObject *__pyx_v_self, PyObject *__pyx_v_pairs) {
5348   PyObject *__pyx_r = 0;
5349   __Pyx_RefNannyDeclarations
5350   __Pyx_RefNannySetupContext("pack_map_pairs (wrapper)", 0);
5351   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), ((PyObject *)__pyx_v_pairs));
5352 
5353   /* function exit code */
5354   __Pyx_RefNannyFinishContext();
5355   return __pyx_r;
5356 }
5357 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,PyObject * __pyx_v_pairs)5358 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, PyObject *__pyx_v_pairs) {
5359   int __pyx_v_ret;
5360   PyObject *__pyx_v_k = NULL;
5361   PyObject *__pyx_v_v = NULL;
5362   PyObject *__pyx_v_buf = NULL;
5363   PyObject *__pyx_r = NULL;
5364   __Pyx_RefNannyDeclarations
5365   Py_ssize_t __pyx_t_1;
5366   int __pyx_t_2;
5367   PyObject *__pyx_t_3 = NULL;
5368   PyObject *(*__pyx_t_4)(PyObject *);
5369   PyObject *__pyx_t_5 = NULL;
5370   PyObject *__pyx_t_6 = NULL;
5371   PyObject *__pyx_t_7 = NULL;
5372   PyObject *__pyx_t_8 = NULL;
5373   PyObject *(*__pyx_t_9)(PyObject *);
5374   int __pyx_t_10;
5375   int __pyx_lineno = 0;
5376   const char *__pyx_filename = NULL;
5377   int __pyx_clineno = 0;
5378   __Pyx_RefNannySetupContext("pack_map_pairs", 0);
5379 
5380   /* "borg/algorithms/msgpack/_packer.pyx":335
5381  *         (`len(pairs)` and `for k, v in pairs:` should be supported.)
5382  *         """
5383  *         cdef int ret = msgpack_pack_map(&self.pk, len(pairs))             # <<<<<<<<<<<<<<
5384  *         if ret == 0:
5385  *             for k, v in pairs:
5386  */
5387   __pyx_t_1 = PyObject_Length(__pyx_v_pairs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 335, __pyx_L1_error)
5388   __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_t_1);
5389 
5390   /* "borg/algorithms/msgpack/_packer.pyx":336
5391  *         """
5392  *         cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5393  *         if ret == 0:             # <<<<<<<<<<<<<<
5394  *             for k, v in pairs:
5395  *                 ret = self._pack(k)
5396  */
5397   __pyx_t_2 = ((__pyx_v_ret == 0) != 0);
5398   if (__pyx_t_2) {
5399 
5400     /* "borg/algorithms/msgpack/_packer.pyx":337
5401  *         cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5402  *         if ret == 0:
5403  *             for k, v in pairs:             # <<<<<<<<<<<<<<
5404  *                 ret = self._pack(k)
5405  *                 if ret != 0: break
5406  */
5407     if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
5408       __pyx_t_3 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5409       __pyx_t_4 = NULL;
5410     } else {
5411       __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
5412       __Pyx_GOTREF(__pyx_t_3);
5413       __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
5414     }
5415     for (;;) {
5416       if (likely(!__pyx_t_4)) {
5417         if (likely(PyList_CheckExact(__pyx_t_3))) {
5418           if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
5419           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5420           __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 337, __pyx_L1_error)
5421           #else
5422           __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
5423           __Pyx_GOTREF(__pyx_t_5);
5424           #endif
5425         } else {
5426           if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
5427           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5428           __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 337, __pyx_L1_error)
5429           #else
5430           __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
5431           __Pyx_GOTREF(__pyx_t_5);
5432           #endif
5433         }
5434       } else {
5435         __pyx_t_5 = __pyx_t_4(__pyx_t_3);
5436         if (unlikely(!__pyx_t_5)) {
5437           PyObject* exc_type = PyErr_Occurred();
5438           if (exc_type) {
5439             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5440             else __PYX_ERR(0, 337, __pyx_L1_error)
5441           }
5442           break;
5443         }
5444         __Pyx_GOTREF(__pyx_t_5);
5445       }
5446       if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
5447         PyObject* sequence = __pyx_t_5;
5448         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5449         if (unlikely(size != 2)) {
5450           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5451           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5452           __PYX_ERR(0, 337, __pyx_L1_error)
5453         }
5454         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5455         if (likely(PyTuple_CheckExact(sequence))) {
5456           __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
5457           __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
5458         } else {
5459           __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
5460           __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
5461         }
5462         __Pyx_INCREF(__pyx_t_6);
5463         __Pyx_INCREF(__pyx_t_7);
5464         #else
5465         __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
5466         __Pyx_GOTREF(__pyx_t_6);
5467         __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
5468         __Pyx_GOTREF(__pyx_t_7);
5469         #endif
5470         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5471       } else {
5472         Py_ssize_t index = -1;
5473         __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 337, __pyx_L1_error)
5474         __Pyx_GOTREF(__pyx_t_8);
5475         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5476         __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
5477         index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
5478         __Pyx_GOTREF(__pyx_t_6);
5479         index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
5480         __Pyx_GOTREF(__pyx_t_7);
5481         if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 337, __pyx_L1_error)
5482         __pyx_t_9 = NULL;
5483         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5484         goto __pyx_L7_unpacking_done;
5485         __pyx_L6_unpacking_failed:;
5486         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5487         __pyx_t_9 = NULL;
5488         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5489         __PYX_ERR(0, 337, __pyx_L1_error)
5490         __pyx_L7_unpacking_done:;
5491       }
5492       __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
5493       __pyx_t_6 = 0;
5494       __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
5495       __pyx_t_7 = 0;
5496 
5497       /* "borg/algorithms/msgpack/_packer.pyx":338
5498  *         if ret == 0:
5499  *             for k, v in pairs:
5500  *                 ret = self._pack(k)             # <<<<<<<<<<<<<<
5501  *                 if ret != 0: break
5502  *                 ret = self._pack(v)
5503  */
5504       __pyx_t_10 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, NULL); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 338, __pyx_L1_error)
5505       __pyx_v_ret = __pyx_t_10;
5506 
5507       /* "borg/algorithms/msgpack/_packer.pyx":339
5508  *             for k, v in pairs:
5509  *                 ret = self._pack(k)
5510  *                 if ret != 0: break             # <<<<<<<<<<<<<<
5511  *                 ret = self._pack(v)
5512  *                 if ret != 0: break
5513  */
5514       __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
5515       if (__pyx_t_2) {
5516         goto __pyx_L5_break;
5517       }
5518 
5519       /* "borg/algorithms/msgpack/_packer.pyx":340
5520  *                 ret = self._pack(k)
5521  *                 if ret != 0: break
5522  *                 ret = self._pack(v)             # <<<<<<<<<<<<<<
5523  *                 if ret != 0: break
5524  *         if ret == -1:
5525  */
5526       __pyx_t_10 = ((struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, NULL); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 340, __pyx_L1_error)
5527       __pyx_v_ret = __pyx_t_10;
5528 
5529       /* "borg/algorithms/msgpack/_packer.pyx":341
5530  *                 if ret != 0: break
5531  *                 ret = self._pack(v)
5532  *                 if ret != 0: break             # <<<<<<<<<<<<<<
5533  *         if ret == -1:
5534  *             raise MemoryError
5535  */
5536       __pyx_t_2 = ((__pyx_v_ret != 0) != 0);
5537       if (__pyx_t_2) {
5538         goto __pyx_L5_break;
5539       }
5540 
5541       /* "borg/algorithms/msgpack/_packer.pyx":337
5542  *         cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5543  *         if ret == 0:
5544  *             for k, v in pairs:             # <<<<<<<<<<<<<<
5545  *                 ret = self._pack(k)
5546  *                 if ret != 0: break
5547  */
5548     }
5549     __pyx_L5_break:;
5550     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5551 
5552     /* "borg/algorithms/msgpack/_packer.pyx":336
5553  *         """
5554  *         cdef int ret = msgpack_pack_map(&self.pk, len(pairs))
5555  *         if ret == 0:             # <<<<<<<<<<<<<<
5556  *             for k, v in pairs:
5557  *                 ret = self._pack(k)
5558  */
5559   }
5560 
5561   /* "borg/algorithms/msgpack/_packer.pyx":342
5562  *                 ret = self._pack(v)
5563  *                 if ret != 0: break
5564  *         if ret == -1:             # <<<<<<<<<<<<<<
5565  *             raise MemoryError
5566  *         elif ret:  # should not happen
5567  */
5568   __pyx_t_2 = ((__pyx_v_ret == -1L) != 0);
5569   if (unlikely(__pyx_t_2)) {
5570 
5571     /* "borg/algorithms/msgpack/_packer.pyx":343
5572  *                 if ret != 0: break
5573  *         if ret == -1:
5574  *             raise MemoryError             # <<<<<<<<<<<<<<
5575  *         elif ret:  # should not happen
5576  *             raise TypeError
5577  */
5578     PyErr_NoMemory(); __PYX_ERR(0, 343, __pyx_L1_error)
5579 
5580     /* "borg/algorithms/msgpack/_packer.pyx":342
5581  *                 ret = self._pack(v)
5582  *                 if ret != 0: break
5583  *         if ret == -1:             # <<<<<<<<<<<<<<
5584  *             raise MemoryError
5585  *         elif ret:  # should not happen
5586  */
5587   }
5588 
5589   /* "borg/algorithms/msgpack/_packer.pyx":344
5590  *         if ret == -1:
5591  *             raise MemoryError
5592  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5593  *             raise TypeError
5594  *         if self.autoreset:
5595  */
5596   __pyx_t_2 = (__pyx_v_ret != 0);
5597   if (unlikely(__pyx_t_2)) {
5598 
5599     /* "borg/algorithms/msgpack/_packer.pyx":345
5600  *             raise MemoryError
5601  *         elif ret:  # should not happen
5602  *             raise TypeError             # <<<<<<<<<<<<<<
5603  *         if self.autoreset:
5604  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5605  */
5606     __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
5607     __PYX_ERR(0, 345, __pyx_L1_error)
5608 
5609     /* "borg/algorithms/msgpack/_packer.pyx":344
5610  *         if ret == -1:
5611  *             raise MemoryError
5612  *         elif ret:  # should not happen             # <<<<<<<<<<<<<<
5613  *             raise TypeError
5614  *         if self.autoreset:
5615  */
5616   }
5617 
5618   /* "borg/algorithms/msgpack/_packer.pyx":346
5619  *         elif ret:  # should not happen
5620  *             raise TypeError
5621  *         if self.autoreset:             # <<<<<<<<<<<<<<
5622  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5623  *             self.pk.length = 0
5624  */
5625   __pyx_t_2 = (__pyx_v_self->autoreset != 0);
5626   if (__pyx_t_2) {
5627 
5628     /* "borg/algorithms/msgpack/_packer.pyx":347
5629  *             raise TypeError
5630  *         if self.autoreset:
5631  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)             # <<<<<<<<<<<<<<
5632  *             self.pk.length = 0
5633  *             return buf
5634  */
5635     __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error)
5636     __Pyx_GOTREF(__pyx_t_3);
5637     __pyx_v_buf = ((PyObject*)__pyx_t_3);
5638     __pyx_t_3 = 0;
5639 
5640     /* "borg/algorithms/msgpack/_packer.pyx":348
5641  *         if self.autoreset:
5642  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5643  *             self.pk.length = 0             # <<<<<<<<<<<<<<
5644  *             return buf
5645  *
5646  */
5647     __pyx_v_self->pk.length = 0;
5648 
5649     /* "borg/algorithms/msgpack/_packer.pyx":349
5650  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5651  *             self.pk.length = 0
5652  *             return buf             # <<<<<<<<<<<<<<
5653  *
5654  *     def reset(self):
5655  */
5656     __Pyx_XDECREF(__pyx_r);
5657     __Pyx_INCREF(__pyx_v_buf);
5658     __pyx_r = __pyx_v_buf;
5659     goto __pyx_L0;
5660 
5661     /* "borg/algorithms/msgpack/_packer.pyx":346
5662  *         elif ret:  # should not happen
5663  *             raise TypeError
5664  *         if self.autoreset:             # <<<<<<<<<<<<<<
5665  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5666  *             self.pk.length = 0
5667  */
5668   }
5669 
5670   /* "borg/algorithms/msgpack/_packer.pyx":328
5671  *             return buf
5672  *
5673  *     def pack_map_pairs(self, object pairs):             # <<<<<<<<<<<<<<
5674  *         """
5675  *         Pack *pairs* as msgpack map type.
5676  */
5677 
5678   /* function exit code */
5679   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5680   goto __pyx_L0;
5681   __pyx_L1_error:;
5682   __Pyx_XDECREF(__pyx_t_3);
5683   __Pyx_XDECREF(__pyx_t_5);
5684   __Pyx_XDECREF(__pyx_t_6);
5685   __Pyx_XDECREF(__pyx_t_7);
5686   __Pyx_XDECREF(__pyx_t_8);
5687   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.pack_map_pairs", __pyx_clineno, __pyx_lineno, __pyx_filename);
5688   __pyx_r = NULL;
5689   __pyx_L0:;
5690   __Pyx_XDECREF(__pyx_v_k);
5691   __Pyx_XDECREF(__pyx_v_v);
5692   __Pyx_XDECREF(__pyx_v_buf);
5693   __Pyx_XGIVEREF(__pyx_r);
5694   __Pyx_RefNannyFinishContext();
5695   return __pyx_r;
5696 }
5697 
5698 /* "borg/algorithms/msgpack/_packer.pyx":351
5699  *             return buf
5700  *
5701  *     def reset(self):             # <<<<<<<<<<<<<<
5702  *         """Clear internal buffer."""
5703  *         self.pk.length = 0
5704  */
5705 
5706 /* Python wrapper */
5707 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5708 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset[] = "Packer.reset(self)\nClear internal buffer.";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_17reset(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5709 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_17reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5710   PyObject *__pyx_r = 0;
5711   __Pyx_RefNannyDeclarations
5712   __Pyx_RefNannySetupContext("reset (wrapper)", 0);
5713   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self));
5714 
5715   /* function exit code */
5716   __Pyx_RefNannyFinishContext();
5717   return __pyx_r;
5718 }
5719 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self)5720 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self) {
5721   PyObject *__pyx_r = NULL;
5722   __Pyx_RefNannyDeclarations
5723   __Pyx_RefNannySetupContext("reset", 0);
5724 
5725   /* "borg/algorithms/msgpack/_packer.pyx":353
5726  *     def reset(self):
5727  *         """Clear internal buffer."""
5728  *         self.pk.length = 0             # <<<<<<<<<<<<<<
5729  *
5730  *     def bytes(self):
5731  */
5732   __pyx_v_self->pk.length = 0;
5733 
5734   /* "borg/algorithms/msgpack/_packer.pyx":351
5735  *             return buf
5736  *
5737  *     def reset(self):             # <<<<<<<<<<<<<<
5738  *         """Clear internal buffer."""
5739  *         self.pk.length = 0
5740  */
5741 
5742   /* function exit code */
5743   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5744   __Pyx_XGIVEREF(__pyx_r);
5745   __Pyx_RefNannyFinishContext();
5746   return __pyx_r;
5747 }
5748 
5749 /* "borg/algorithms/msgpack/_packer.pyx":355
5750  *         self.pk.length = 0
5751  *
5752  *     def bytes(self):             # <<<<<<<<<<<<<<
5753  *         """Return buffer content."""
5754  *         return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5755  */
5756 
5757 /* Python wrapper */
5758 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_19bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5759 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes[] = "Packer.bytes(self)\nReturn buffer content.";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_19bytes(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5760 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_19bytes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5761   PyObject *__pyx_r = 0;
5762   __Pyx_RefNannyDeclarations
5763   __Pyx_RefNannySetupContext("bytes (wrapper)", 0);
5764   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self));
5765 
5766   /* function exit code */
5767   __Pyx_RefNannyFinishContext();
5768   return __pyx_r;
5769 }
5770 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self)5771 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self) {
5772   PyObject *__pyx_r = NULL;
5773   __Pyx_RefNannyDeclarations
5774   PyObject *__pyx_t_1 = NULL;
5775   int __pyx_lineno = 0;
5776   const char *__pyx_filename = NULL;
5777   int __pyx_clineno = 0;
5778   __Pyx_RefNannySetupContext("bytes", 0);
5779 
5780   /* "borg/algorithms/msgpack/_packer.pyx":357
5781  *     def bytes(self):
5782  *         """Return buffer content."""
5783  *         return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)             # <<<<<<<<<<<<<<
5784  */
5785   __Pyx_XDECREF(__pyx_r);
5786   __pyx_t_1 = PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
5787   __Pyx_GOTREF(__pyx_t_1);
5788   __pyx_r = __pyx_t_1;
5789   __pyx_t_1 = 0;
5790   goto __pyx_L0;
5791 
5792   /* "borg/algorithms/msgpack/_packer.pyx":355
5793  *         self.pk.length = 0
5794  *
5795  *     def bytes(self):             # <<<<<<<<<<<<<<
5796  *         """Return buffer content."""
5797  *         return PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
5798  */
5799 
5800   /* function exit code */
5801   __pyx_L1_error:;
5802   __Pyx_XDECREF(__pyx_t_1);
5803   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5804   __pyx_r = NULL;
5805   __pyx_L0:;
5806   __Pyx_XGIVEREF(__pyx_r);
5807   __Pyx_RefNannyFinishContext();
5808   return __pyx_r;
5809 }
5810 
5811 /* "(tree fragment)":1
5812  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5813  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5814  * def __setstate_cython__(self, __pyx_state):
5815  */
5816 
5817 /* Python wrapper */
5818 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5819 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__[] = "Packer.__reduce_cython__(self)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_21__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5820 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5821   PyObject *__pyx_r = 0;
5822   __Pyx_RefNannyDeclarations
5823   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5824   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self));
5825 
5826   /* function exit code */
5827   __Pyx_RefNannyFinishContext();
5828   return __pyx_r;
5829 }
5830 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self)5831 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self) {
5832   PyObject *__pyx_r = NULL;
5833   __Pyx_RefNannyDeclarations
5834   PyObject *__pyx_t_1 = NULL;
5835   int __pyx_lineno = 0;
5836   const char *__pyx_filename = NULL;
5837   int __pyx_clineno = 0;
5838   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5839 
5840   /* "(tree fragment)":2
5841  * def __reduce_cython__(self):
5842  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
5843  * def __setstate_cython__(self, __pyx_state):
5844  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5845  */
5846   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5847   __Pyx_GOTREF(__pyx_t_1);
5848   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5849   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5850   __PYX_ERR(1, 2, __pyx_L1_error)
5851 
5852   /* "(tree fragment)":1
5853  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5854  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5855  * def __setstate_cython__(self, __pyx_state):
5856  */
5857 
5858   /* function exit code */
5859   __pyx_L1_error:;
5860   __Pyx_XDECREF(__pyx_t_1);
5861   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5862   __pyx_r = NULL;
5863   __Pyx_XGIVEREF(__pyx_r);
5864   __Pyx_RefNannyFinishContext();
5865   return __pyx_r;
5866 }
5867 
5868 /* "(tree fragment)":3
5869  * def __reduce_cython__(self):
5870  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5871  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5872  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5873  */
5874 
5875 /* Python wrapper */
5876 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
5877 static char __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__[] = "Packer.__setstate_cython__(self, __pyx_state)";
__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_23__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5878 static PyObject *__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5879   PyObject *__pyx_r = 0;
5880   __Pyx_RefNannyDeclarations
5881   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5882   __pyx_r = __pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__(((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5883 
5884   /* function exit code */
5885   __Pyx_RefNannyFinishContext();
5886   return __pyx_r;
5887 }
5888 
__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)5889 static PyObject *__pyx_pf_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5890   PyObject *__pyx_r = NULL;
5891   __Pyx_RefNannyDeclarations
5892   PyObject *__pyx_t_1 = NULL;
5893   int __pyx_lineno = 0;
5894   const char *__pyx_filename = NULL;
5895   int __pyx_clineno = 0;
5896   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5897 
5898   /* "(tree fragment)":4
5899  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5900  * def __setstate_cython__(self, __pyx_state):
5901  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
5902  */
5903   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5904   __Pyx_GOTREF(__pyx_t_1);
5905   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5906   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5907   __PYX_ERR(1, 4, __pyx_L1_error)
5908 
5909   /* "(tree fragment)":3
5910  * def __reduce_cython__(self):
5911  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5912  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5913  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5914  */
5915 
5916   /* function exit code */
5917   __pyx_L1_error:;
5918   __Pyx_XDECREF(__pyx_t_1);
5919   __Pyx_AddTraceback("borg.algorithms.msgpack._packer.Packer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5920   __pyx_r = NULL;
5921   __Pyx_XGIVEREF(__pyx_r);
5922   __Pyx_RefNannyFinishContext();
5923   return __pyx_r;
5924 }
5925 static struct __pyx_vtabstruct_4borg_10algorithms_7msgpack_7_packer_Packer __pyx_vtable_4borg_10algorithms_7msgpack_7_packer_Packer;
5926 
__pyx_tp_new_4borg_10algorithms_7msgpack_7_packer_Packer(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)5927 static PyObject *__pyx_tp_new_4borg_10algorithms_7msgpack_7_packer_Packer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
5928   struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *p;
5929   PyObject *o;
5930   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
5931     o = (*t->tp_alloc)(t, 0);
5932   } else {
5933     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
5934   }
5935   if (unlikely(!o)) return 0;
5936   p = ((struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)o);
5937   p->__pyx_vtab = __pyx_vtabptr_4borg_10algorithms_7msgpack_7_packer_Packer;
5938   p->_default = Py_None; Py_INCREF(Py_None);
5939   p->_bencoding = Py_None; Py_INCREF(Py_None);
5940   p->_berrors = Py_None; Py_INCREF(Py_None);
5941   p->use_float = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
5942   if (unlikely(__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
5943   return o;
5944   bad:
5945   Py_DECREF(o); o = 0;
5946   return NULL;
5947 }
5948 
__pyx_tp_dealloc_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject * o)5949 static void __pyx_tp_dealloc_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject *o) {
5950   struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *p = (struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)o;
5951   #if CYTHON_USE_TP_FINALIZE
5952   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
5953     if (PyObject_CallFinalizerFromDealloc(o)) return;
5954   }
5955   #endif
5956   PyObject_GC_UnTrack(o);
5957   {
5958     PyObject *etype, *eval, *etb;
5959     PyErr_Fetch(&etype, &eval, &etb);
5960     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
5961     __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_5__dealloc__(o);
5962     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
5963     PyErr_Restore(etype, eval, etb);
5964   }
5965   Py_CLEAR(p->_default);
5966   Py_CLEAR(p->_bencoding);
5967   Py_CLEAR(p->_berrors);
5968   Py_CLEAR(p->use_float);
5969   (*Py_TYPE(o)->tp_free)(o);
5970 }
5971 
__pyx_tp_traverse_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject * o,visitproc v,void * a)5972 static int __pyx_tp_traverse_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject *o, visitproc v, void *a) {
5973   int e;
5974   struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *p = (struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)o;
5975   if (p->_default) {
5976     e = (*v)(p->_default, a); if (e) return e;
5977   }
5978   if (p->_bencoding) {
5979     e = (*v)(p->_bencoding, a); if (e) return e;
5980   }
5981   if (p->_berrors) {
5982     e = (*v)(p->_berrors, a); if (e) return e;
5983   }
5984   if (p->use_float) {
5985     e = (*v)(((PyObject *)p->use_float), a); if (e) return e;
5986   }
5987   return 0;
5988 }
5989 
__pyx_tp_clear_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject * o)5990 static int __pyx_tp_clear_4borg_10algorithms_7msgpack_7_packer_Packer(PyObject *o) {
5991   PyObject* tmp;
5992   struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *p = (struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *)o;
5993   tmp = ((PyObject*)p->_default);
5994   p->_default = Py_None; Py_INCREF(Py_None);
5995   Py_XDECREF(tmp);
5996   tmp = ((PyObject*)p->_bencoding);
5997   p->_bencoding = Py_None; Py_INCREF(Py_None);
5998   Py_XDECREF(tmp);
5999   tmp = ((PyObject*)p->_berrors);
6000   p->_berrors = Py_None; Py_INCREF(Py_None);
6001   Py_XDECREF(tmp);
6002   tmp = ((PyObject*)p->use_float);
6003   p->use_float = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
6004   Py_XDECREF(tmp);
6005   return 0;
6006 }
6007 
6008 static PyMethodDef __pyx_methods_4borg_10algorithms_7msgpack_7_packer_Packer[] = {
6009   {"pack", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_7pack, METH_O, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_6pack},
6010   {"pack_ext_type", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_9pack_ext_type, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_8pack_ext_type},
6011   {"pack_array_header", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_11pack_array_header, METH_O, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_10pack_array_header},
6012   {"pack_map_header", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_13pack_map_header, METH_O, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_12pack_map_header},
6013   {"pack_map_pairs", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_15pack_map_pairs, METH_O, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_14pack_map_pairs},
6014   {"reset", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_17reset, METH_NOARGS, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_16reset},
6015   {"bytes", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_19bytes, METH_NOARGS, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_18bytes},
6016   {"__reduce_cython__", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_21__reduce_cython__, METH_NOARGS, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_20__reduce_cython__},
6017   {"__setstate_cython__", (PyCFunction)__pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_23__setstate_cython__, METH_O, __pyx_doc_4borg_10algorithms_7msgpack_7_packer_6Packer_22__setstate_cython__},
6018   {0, 0, 0, 0}
6019 };
6020 
6021 static PyTypeObject __pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer = {
6022   PyVarObject_HEAD_INIT(0, 0)
6023   "borg.algorithms.msgpack._packer.Packer", /*tp_name*/
6024   sizeof(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer), /*tp_basicsize*/
6025   0, /*tp_itemsize*/
6026   __pyx_tp_dealloc_4borg_10algorithms_7msgpack_7_packer_Packer, /*tp_dealloc*/
6027   #if PY_VERSION_HEX < 0x030800b4
6028   0, /*tp_print*/
6029   #endif
6030   #if PY_VERSION_HEX >= 0x030800b4
6031   0, /*tp_vectorcall_offset*/
6032   #endif
6033   0, /*tp_getattr*/
6034   0, /*tp_setattr*/
6035   #if PY_MAJOR_VERSION < 3
6036   0, /*tp_compare*/
6037   #endif
6038   #if PY_MAJOR_VERSION >= 3
6039   0, /*tp_as_async*/
6040   #endif
6041   0, /*tp_repr*/
6042   0, /*tp_as_number*/
6043   0, /*tp_as_sequence*/
6044   0, /*tp_as_mapping*/
6045   0, /*tp_hash*/
6046   0, /*tp_call*/
6047   0, /*tp_str*/
6048   0, /*tp_getattro*/
6049   0, /*tp_setattro*/
6050   0, /*tp_as_buffer*/
6051   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
6052   "Packer(default=None, encoding=None, unicode_errors=None, bool use_single_float=False, bool autoreset=True, bool use_bin_type=False, bool strict_types=False)\n\n    MessagePack Packer\n\n    usage::\n\n        packer = Packer()\n        astream.write(packer.pack(a))\n        astream.write(packer.pack(b))\n\n    Packer's constructor has some keyword arguments:\n\n    :param callable default:\n        Convert user type to builtin type that Packer supports.\n        See also simplejson's document.\n\n    :param bool use_single_float:\n        Use single precision float type for float. (default: False)\n\n    :param bool autoreset:\n        Reset buffer after each pack and return its content as `bytes`. (default: True).\n        If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.\n\n    :param bool use_bin_type:\n        Use bin type introduced in msgpack spec 2.0 for bytes.\n        It also enables str8 type for unicode.\n        Current default value is false, but it will be changed to true\n        in future version.  You should specify it explicitly.\n\n    :param bool strict_types:\n        If set to true, types will be checked to be exact. Derived classes\n        from serializeable types will not be serialized and will be\n        treated as unsupported type and forwarded to default.\n        Additionally tuples will not be serialized as lists.\n        This is useful when trying to implement accurate serialization\n        for python types.\n\n    :param str unicode_errors:\n        Error handler for encoding unicode. (default: 'strict')\n\n    :param str encoding:\n        (deprecated) Convert unicode to bytes with this encoding. (default: 'utf-8')\n    ", /*tp_doc*/
6053   __pyx_tp_traverse_4borg_10algorithms_7msgpack_7_packer_Packer, /*tp_traverse*/
6054   __pyx_tp_clear_4borg_10algorithms_7msgpack_7_packer_Packer, /*tp_clear*/
6055   0, /*tp_richcompare*/
6056   0, /*tp_weaklistoffset*/
6057   0, /*tp_iter*/
6058   0, /*tp_iternext*/
6059   __pyx_methods_4borg_10algorithms_7msgpack_7_packer_Packer, /*tp_methods*/
6060   0, /*tp_members*/
6061   0, /*tp_getset*/
6062   0, /*tp_base*/
6063   0, /*tp_dict*/
6064   0, /*tp_descr_get*/
6065   0, /*tp_descr_set*/
6066   0, /*tp_dictoffset*/
6067   __pyx_pw_4borg_10algorithms_7msgpack_7_packer_6Packer_3__init__, /*tp_init*/
6068   0, /*tp_alloc*/
6069   __pyx_tp_new_4borg_10algorithms_7msgpack_7_packer_Packer, /*tp_new*/
6070   0, /*tp_free*/
6071   0, /*tp_is_gc*/
6072   0, /*tp_bases*/
6073   0, /*tp_mro*/
6074   0, /*tp_cache*/
6075   0, /*tp_subclasses*/
6076   0, /*tp_weaklist*/
6077   0, /*tp_del*/
6078   0, /*tp_version_tag*/
6079   #if PY_VERSION_HEX >= 0x030400a1
6080   0, /*tp_finalize*/
6081   #endif
6082   #if PY_VERSION_HEX >= 0x030800b1
6083   0, /*tp_vectorcall*/
6084   #endif
6085   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
6086   0, /*tp_print*/
6087   #endif
6088 };
6089 
6090 static PyMethodDef __pyx_methods[] = {
6091   {0, 0, 0, 0}
6092 };
6093 
6094 #if PY_MAJOR_VERSION >= 3
6095 #if CYTHON_PEP489_MULTI_PHASE_INIT
6096 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
6097 static int __pyx_pymod_exec__packer(PyObject* module); /*proto*/
6098 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
6099   {Py_mod_create, (void*)__pyx_pymod_create},
6100   {Py_mod_exec, (void*)__pyx_pymod_exec__packer},
6101   {0, NULL}
6102 };
6103 #endif
6104 
6105 static struct PyModuleDef __pyx_moduledef = {
6106     PyModuleDef_HEAD_INIT,
6107     "_packer",
6108     0, /* m_doc */
6109   #if CYTHON_PEP489_MULTI_PHASE_INIT
6110     0, /* m_size */
6111   #else
6112     -1, /* m_size */
6113   #endif
6114     __pyx_methods /* m_methods */,
6115   #if CYTHON_PEP489_MULTI_PHASE_INIT
6116     __pyx_moduledef_slots, /* m_slots */
6117   #else
6118     NULL, /* m_reload */
6119   #endif
6120     NULL, /* m_traverse */
6121     NULL, /* m_clear */
6122     NULL /* m_free */
6123 };
6124 #endif
6125 #ifndef CYTHON_SMALL_CODE
6126 #if defined(__clang__)
6127     #define CYTHON_SMALL_CODE
6128 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
6129     #define CYTHON_SMALL_CODE __attribute__((cold))
6130 #else
6131     #define CYTHON_SMALL_CODE
6132 #endif
6133 #endif
6134 
6135 static __Pyx_StringTabEntry __pyx_string_tab[] = {
6136   {&__pyx_kp_s_EXT_data_is_too_large, __pyx_k_EXT_data_is_too_large, sizeof(__pyx_k_EXT_data_is_too_large), 0, 0, 1, 0},
6137   {&__pyx_n_s_ExtType, __pyx_k_ExtType, sizeof(__pyx_k_ExtType), 0, 0, 1, 1},
6138   {&__pyx_kp_s_Integer_value_out_of_range, __pyx_k_Integer_value_out_of_range, sizeof(__pyx_k_Integer_value_out_of_range), 0, 0, 1, 0},
6139   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
6140   {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
6141   {&__pyx_n_s_PackOverflowError, __pyx_k_PackOverflowError, sizeof(__pyx_k_PackOverflowError), 0, 0, 1, 1},
6142   {&__pyx_n_s_PackValueError, __pyx_k_PackValueError, sizeof(__pyx_k_PackValueError), 0, 0, 1, 1},
6143   {&__pyx_n_s_Packer, __pyx_k_Packer, sizeof(__pyx_k_Packer), 0, 0, 1, 1},
6144   {&__pyx_n_s_PendingDeprecationWarning, __pyx_k_PendingDeprecationWarning, sizeof(__pyx_k_PendingDeprecationWarning), 0, 0, 1, 1},
6145   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
6146   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
6147   {&__pyx_kp_s_Unable_to_allocate_internal_buff, __pyx_k_Unable_to_allocate_internal_buff, sizeof(__pyx_k_Unable_to_allocate_internal_buff), 0, 0, 1, 0},
6148   {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1},
6149   {&__pyx_n_s_autoreset, __pyx_k_autoreset, sizeof(__pyx_k_autoreset), 0, 0, 1, 1},
6150   {&__pyx_kp_s_can_t_serialize_r, __pyx_k_can_t_serialize_r, sizeof(__pyx_k_can_t_serialize_r), 0, 0, 1, 0},
6151   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
6152   {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
6153   {&__pyx_kp_s_could_not_get_buffer_for_memoryv, __pyx_k_could_not_get_buffer_for_memoryv, sizeof(__pyx_k_could_not_get_buffer_for_memoryv), 0, 0, 1, 0},
6154   {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
6155   {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
6156   {&__pyx_kp_s_default_must_be_a_callable, __pyx_k_default_must_be_a_callable, sizeof(__pyx_k_default_must_be_a_callable), 0, 0, 1, 0},
6157   {&__pyx_kp_s_dict_is_too_large, __pyx_k_dict_is_too_large, sizeof(__pyx_k_dict_is_too_large), 0, 0, 1, 0},
6158   {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
6159   {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1},
6160   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
6161   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
6162   {&__pyx_kp_s_internal_error, __pyx_k_internal_error, sizeof(__pyx_k_internal_error), 0, 0, 1, 0},
6163   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
6164   {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
6165   {&__pyx_kp_s_list_is_too_large, __pyx_k_list_is_too_large, sizeof(__pyx_k_list_is_too_large), 0, 0, 1, 0},
6166   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
6167   {&__pyx_kp_s_memoryview_is_too_large, __pyx_k_memoryview_is_too_large, sizeof(__pyx_k_memoryview_is_too_large), 0, 0, 1, 0},
6168   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
6169   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
6170   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
6171   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
6172   {&__pyx_kp_s_recursion_limit_exceeded, __pyx_k_recursion_limit_exceeded, sizeof(__pyx_k_recursion_limit_exceeded), 0, 0, 1, 0},
6173   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
6174   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
6175   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
6176   {&__pyx_kp_s_s_is_too_large, __pyx_k_s_is_too_large, sizeof(__pyx_k_s_is_too_large), 0, 0, 1, 0},
6177   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
6178   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
6179   {&__pyx_n_s_strict_types, __pyx_k_strict_types, sizeof(__pyx_k_strict_types), 0, 0, 1, 1},
6180   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
6181   {&__pyx_n_s_typecode, __pyx_k_typecode, sizeof(__pyx_k_typecode), 0, 0, 1, 1},
6182   {&__pyx_n_s_unicode_errors, __pyx_k_unicode_errors, sizeof(__pyx_k_unicode_errors), 0, 0, 1, 1},
6183   {&__pyx_kp_s_unicode_string_is_too_large, __pyx_k_unicode_string_is_too_large, sizeof(__pyx_k_unicode_string_is_too_large), 0, 0, 1, 0},
6184   {&__pyx_n_s_use_bin_type, __pyx_k_use_bin_type, sizeof(__pyx_k_use_bin_type), 0, 0, 1, 1},
6185   {&__pyx_n_s_use_single_float, __pyx_k_use_single_float, sizeof(__pyx_k_use_single_float), 0, 0, 1, 1},
6186   {0, 0, 0, 0, 0, 0, 0}
6187 };
__Pyx_InitCachedBuiltins(void)6188 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
6189   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 113, __pyx_L1_error)
6190   __pyx_builtin_PendingDeprecationWarning = __Pyx_GetBuiltinName(__pyx_n_s_PendingDeprecationWarning); if (!__pyx_builtin_PendingDeprecationWarning) __PYX_ERR(0, 121, __pyx_L1_error)
6191   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 128, __pyx_L1_error)
6192   __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 185, __pyx_L1_error)
6193   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 292, __pyx_L1_error)
6194   return 0;
6195   __pyx_L1_error:;
6196   return -1;
6197 }
6198 
__Pyx_InitCachedConstants(void)6199 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
6200   __Pyx_RefNannyDeclarations
6201   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6202 
6203   /* "borg/algorithms/msgpack/_packer.pyx":113
6204  *         self.pk.buf = <char*> PyMem_Malloc(buf_size)
6205  *         if self.pk.buf == NULL:
6206  *             raise MemoryError("Unable to allocate internal buffer.")             # <<<<<<<<<<<<<<
6207  *         self.pk.buf_size = buf_size
6208  *         self.pk.length = 0
6209  */
6210   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Unable_to_allocate_internal_buff); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 113, __pyx_L1_error)
6211   __Pyx_GOTREF(__pyx_tuple_);
6212   __Pyx_GIVEREF(__pyx_tuple_);
6213 
6214   /* "borg/algorithms/msgpack/_packer.pyx":128
6215  *         if default is not None:
6216  *             if not PyCallable_Check(default):
6217  *                 raise TypeError("default must be a callable.")             # <<<<<<<<<<<<<<
6218  *         self._default = default
6219  *
6220  */
6221   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_default_must_be_a_callable); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 128, __pyx_L1_error)
6222   __Pyx_GOTREF(__pyx_tuple__2);
6223   __Pyx_GIVEREF(__pyx_tuple__2);
6224 
6225   /* "borg/algorithms/msgpack/_packer.pyx":292
6226  *             raise
6227  *         if ret:  # should not happen.
6228  *             raise RuntimeError("internal error")             # <<<<<<<<<<<<<<
6229  *         if self.autoreset:
6230  *             buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
6231  */
6232   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_internal_error); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 292, __pyx_L1_error)
6233   __Pyx_GOTREF(__pyx_tuple__4);
6234   __Pyx_GIVEREF(__pyx_tuple__4);
6235 
6236   /* "(tree fragment)":2
6237  * def __reduce_cython__(self):
6238  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6239  * def __setstate_cython__(self, __pyx_state):
6240  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6241  */
6242   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error)
6243   __Pyx_GOTREF(__pyx_tuple__5);
6244   __Pyx_GIVEREF(__pyx_tuple__5);
6245 
6246   /* "(tree fragment)":4
6247  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6248  * def __setstate_cython__(self, __pyx_state):
6249  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
6250  */
6251   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error)
6252   __Pyx_GOTREF(__pyx_tuple__6);
6253   __Pyx_GIVEREF(__pyx_tuple__6);
6254   __Pyx_RefNannyFinishContext();
6255   return 0;
6256   __pyx_L1_error:;
6257   __Pyx_RefNannyFinishContext();
6258   return -1;
6259 }
6260 
__Pyx_InitGlobals(void)6261 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
6262   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6263   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
6264   return 0;
6265   __pyx_L1_error:;
6266   return -1;
6267 }
6268 
6269 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
6270 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
6271 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
6272 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
6273 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
6274 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
6275 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
6276 
__Pyx_modinit_global_init_code(void)6277 static int __Pyx_modinit_global_init_code(void) {
6278   __Pyx_RefNannyDeclarations
6279   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
6280   /*--- Global init code ---*/
6281   __Pyx_RefNannyFinishContext();
6282   return 0;
6283 }
6284 
__Pyx_modinit_variable_export_code(void)6285 static int __Pyx_modinit_variable_export_code(void) {
6286   __Pyx_RefNannyDeclarations
6287   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
6288   /*--- Variable export code ---*/
6289   __Pyx_RefNannyFinishContext();
6290   return 0;
6291 }
6292 
__Pyx_modinit_function_export_code(void)6293 static int __Pyx_modinit_function_export_code(void) {
6294   __Pyx_RefNannyDeclarations
6295   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
6296   /*--- Function export code ---*/
6297   __Pyx_RefNannyFinishContext();
6298   return 0;
6299 }
6300 
__Pyx_modinit_type_init_code(void)6301 static int __Pyx_modinit_type_init_code(void) {
6302   __Pyx_RefNannyDeclarations
6303   int __pyx_lineno = 0;
6304   const char *__pyx_filename = NULL;
6305   int __pyx_clineno = 0;
6306   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
6307   /*--- Type init code ---*/
6308   __pyx_vtabptr_4borg_10algorithms_7msgpack_7_packer_Packer = &__pyx_vtable_4borg_10algorithms_7msgpack_7_packer_Packer;
6309   __pyx_vtable_4borg_10algorithms_7msgpack_7_packer_Packer._pack = (int (*)(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *, PyObject *, struct __pyx_opt_args_4borg_10algorithms_7msgpack_7_packer_6Packer__pack *__pyx_optional_args))__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer__pack;
6310   __pyx_vtable_4borg_10algorithms_7msgpack_7_packer_Packer.pack = (PyObject *(*)(struct __pyx_obj_4borg_10algorithms_7msgpack_7_packer_Packer *, PyObject *, int __pyx_skip_dispatch))__pyx_f_4borg_10algorithms_7msgpack_7_packer_6Packer_pack;
6311   if (PyType_Ready(&__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
6312   #if PY_VERSION_HEX < 0x030800B1
6313   __pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer.tp_print = 0;
6314   #endif
6315   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer.tp_dictoffset && __pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer.tp_getattro == PyObject_GenericGetAttr)) {
6316     __pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
6317   }
6318   if (__Pyx_SetVtable(__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer.tp_dict, __pyx_vtabptr_4borg_10algorithms_7msgpack_7_packer_Packer) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
6319   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Packer, (PyObject *)&__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
6320   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
6321   __pyx_ptype_4borg_10algorithms_7msgpack_7_packer_Packer = &__pyx_type_4borg_10algorithms_7msgpack_7_packer_Packer;
6322   __Pyx_RefNannyFinishContext();
6323   return 0;
6324   __pyx_L1_error:;
6325   __Pyx_RefNannyFinishContext();
6326   return -1;
6327 }
6328 
__Pyx_modinit_type_import_code(void)6329 static int __Pyx_modinit_type_import_code(void) {
6330   __Pyx_RefNannyDeclarations
6331   PyObject *__pyx_t_1 = NULL;
6332   int __pyx_lineno = 0;
6333   const char *__pyx_filename = NULL;
6334   int __pyx_clineno = 0;
6335   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
6336   /*--- Type import code ---*/
6337   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
6338   __Pyx_GOTREF(__pyx_t_1);
6339   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
6340   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
6341   sizeof(PyTypeObject),
6342   #else
6343   sizeof(PyHeapTypeObject),
6344   #endif
6345   __Pyx_ImportType_CheckSize_Warn);
6346    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
6347   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6348   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
6349   __Pyx_GOTREF(__pyx_t_1);
6350   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
6351    if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error)
6352   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6353   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
6354   __Pyx_GOTREF(__pyx_t_1);
6355   __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
6356    if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
6357   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6358   __Pyx_RefNannyFinishContext();
6359   return 0;
6360   __pyx_L1_error:;
6361   __Pyx_XDECREF(__pyx_t_1);
6362   __Pyx_RefNannyFinishContext();
6363   return -1;
6364 }
6365 
__Pyx_modinit_variable_import_code(void)6366 static int __Pyx_modinit_variable_import_code(void) {
6367   __Pyx_RefNannyDeclarations
6368   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
6369   /*--- Variable import code ---*/
6370   __Pyx_RefNannyFinishContext();
6371   return 0;
6372 }
6373 
__Pyx_modinit_function_import_code(void)6374 static int __Pyx_modinit_function_import_code(void) {
6375   __Pyx_RefNannyDeclarations
6376   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
6377   /*--- Function import code ---*/
6378   __Pyx_RefNannyFinishContext();
6379   return 0;
6380 }
6381 
6382 
6383 #ifndef CYTHON_NO_PYINIT_EXPORT
6384 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6385 #elif PY_MAJOR_VERSION < 3
6386 #ifdef __cplusplus
6387 #define __Pyx_PyMODINIT_FUNC extern "C" void
6388 #else
6389 #define __Pyx_PyMODINIT_FUNC void
6390 #endif
6391 #else
6392 #ifdef __cplusplus
6393 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
6394 #else
6395 #define __Pyx_PyMODINIT_FUNC PyObject *
6396 #endif
6397 #endif
6398 
6399 
6400 #if PY_MAJOR_VERSION < 3
6401 __Pyx_PyMODINIT_FUNC init_packer(void) CYTHON_SMALL_CODE; /*proto*/
init_packer(void)6402 __Pyx_PyMODINIT_FUNC init_packer(void)
6403 #else
6404 __Pyx_PyMODINIT_FUNC PyInit__packer(void) CYTHON_SMALL_CODE; /*proto*/
6405 __Pyx_PyMODINIT_FUNC PyInit__packer(void)
6406 #if CYTHON_PEP489_MULTI_PHASE_INIT
6407 {
6408   return PyModuleDef_Init(&__pyx_moduledef);
6409 }
6410 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
6411     #if PY_VERSION_HEX >= 0x030700A1
6412     static PY_INT64_T main_interpreter_id = -1;
6413     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
6414     if (main_interpreter_id == -1) {
6415         main_interpreter_id = current_id;
6416         return (unlikely(current_id == -1)) ? -1 : 0;
6417     } else if (unlikely(main_interpreter_id != current_id))
6418     #else
6419     static PyInterpreterState *main_interpreter = NULL;
6420     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
6421     if (!main_interpreter) {
6422         main_interpreter = current_interpreter;
6423     } else if (unlikely(main_interpreter != current_interpreter))
6424     #endif
6425     {
6426         PyErr_SetString(
6427             PyExc_ImportError,
6428             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
6429         return -1;
6430     }
6431     return 0;
6432 }
6433 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
6434     PyObject *value = PyObject_GetAttrString(spec, from_name);
6435     int result = 0;
6436     if (likely(value)) {
6437         if (allow_none || value != Py_None) {
6438             result = PyDict_SetItemString(moddict, to_name, value);
6439         }
6440         Py_DECREF(value);
6441     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
6442         PyErr_Clear();
6443     } else {
6444         result = -1;
6445     }
6446     return result;
6447 }
6448 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
6449     PyObject *module = NULL, *moddict, *modname;
6450     if (__Pyx_check_single_interpreter())
6451         return NULL;
6452     if (__pyx_m)
6453         return __Pyx_NewRef(__pyx_m);
6454     modname = PyObject_GetAttrString(spec, "name");
6455     if (unlikely(!modname)) goto bad;
6456     module = PyModule_NewObject(modname);
6457     Py_DECREF(modname);
6458     if (unlikely(!module)) goto bad;
6459     moddict = PyModule_GetDict(module);
6460     if (unlikely(!moddict)) goto bad;
6461     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
6462     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
6463     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
6464     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
6465     return module;
6466 bad:
6467     Py_XDECREF(module);
6468     return NULL;
6469 }
6470 
6471 
6472 static CYTHON_SMALL_CODE int __pyx_pymod_exec__packer(PyObject *__pyx_pyinit_module)
6473 #endif
6474 #endif
6475 {
6476   PyObject *__pyx_t_1 = NULL;
6477   PyObject *__pyx_t_2 = NULL;
6478   int __pyx_lineno = 0;
6479   const char *__pyx_filename = NULL;
6480   int __pyx_clineno = 0;
6481   __Pyx_RefNannyDeclarations
6482   #if CYTHON_PEP489_MULTI_PHASE_INIT
6483   if (__pyx_m) {
6484     if (__pyx_m == __pyx_pyinit_module) return 0;
6485     PyErr_SetString(PyExc_RuntimeError, "Module '_packer' has already been imported. Re-initialisation is not supported.");
6486     return -1;
6487   }
6488   #elif PY_MAJOR_VERSION >= 3
6489   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
6490   #endif
6491   #if CYTHON_REFNANNY
6492 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6493 if (!__Pyx_RefNanny) {
6494   PyErr_Clear();
6495   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6496   if (!__Pyx_RefNanny)
6497       Py_FatalError("failed to import 'refnanny' module");
6498 }
6499 #endif
6500   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__packer(void)", 0);
6501   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6502   #ifdef __Pxy_PyFrame_Initialize_Offsets
6503   __Pxy_PyFrame_Initialize_Offsets();
6504   #endif
6505   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6506   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6507   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6508   #ifdef __Pyx_CyFunction_USED
6509   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6510   #endif
6511   #ifdef __Pyx_FusedFunction_USED
6512   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6513   #endif
6514   #ifdef __Pyx_Coroutine_USED
6515   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6516   #endif
6517   #ifdef __Pyx_Generator_USED
6518   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6519   #endif
6520   #ifdef __Pyx_AsyncGen_USED
6521   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6522   #endif
6523   #ifdef __Pyx_StopAsyncIteration_USED
6524   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6525   #endif
6526   /*--- Library function declarations ---*/
6527   /*--- Threads initialization code ---*/
6528   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
6529   #ifdef WITH_THREAD /* Python build with threading support? */
6530   PyEval_InitThreads();
6531   #endif
6532   #endif
6533   /*--- Module creation code ---*/
6534   #if CYTHON_PEP489_MULTI_PHASE_INIT
6535   __pyx_m = __pyx_pyinit_module;
6536   Py_INCREF(__pyx_m);
6537   #else
6538   #if PY_MAJOR_VERSION < 3
6539   __pyx_m = Py_InitModule4("_packer", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
6540   #else
6541   __pyx_m = PyModule_Create(&__pyx_moduledef);
6542   #endif
6543   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
6544   #endif
6545   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
6546   Py_INCREF(__pyx_d);
6547   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
6548   Py_INCREF(__pyx_b);
6549   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
6550   Py_INCREF(__pyx_cython_runtime);
6551   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6552   /*--- Initialize various global constants etc. ---*/
6553   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6554   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6555   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6556   #endif
6557   if (__pyx_module_is_main_borg__algorithms__msgpack___packer) {
6558     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6559   }
6560   #if PY_MAJOR_VERSION >= 3
6561   {
6562     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
6563     if (!PyDict_GetItemString(modules, "borg.algorithms.msgpack._packer")) {
6564       if (unlikely(PyDict_SetItemString(modules, "borg.algorithms.msgpack._packer", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6565     }
6566   }
6567   #endif
6568   /*--- Builtin init code ---*/
6569   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6570   /*--- Constants init code ---*/
6571   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6572   /*--- Global type/function init code ---*/
6573   (void)__Pyx_modinit_global_init_code();
6574   (void)__Pyx_modinit_variable_export_code();
6575   (void)__Pyx_modinit_function_export_code();
6576   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6577   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6578   (void)__Pyx_modinit_variable_import_code();
6579   (void)__Pyx_modinit_function_import_code();
6580   /*--- Execution code ---*/
6581   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
6582   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6583   #endif
6584 
6585   /* "borg/algorithms/msgpack/_packer.pyx":8
6586  * from cpython.exc cimport PyErr_WarnEx
6587  *
6588  * from .exceptions import PackValueError, PackOverflowError             # <<<<<<<<<<<<<<
6589  * from . import ExtType
6590  *
6591  */
6592   __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
6593   __Pyx_GOTREF(__pyx_t_1);
6594   __Pyx_INCREF(__pyx_n_s_PackValueError);
6595   __Pyx_GIVEREF(__pyx_n_s_PackValueError);
6596   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PackValueError);
6597   __Pyx_INCREF(__pyx_n_s_PackOverflowError);
6598   __Pyx_GIVEREF(__pyx_n_s_PackOverflowError);
6599   PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_PackOverflowError);
6600   __pyx_t_2 = __Pyx_Import(__pyx_n_s_exceptions, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
6601   __Pyx_GOTREF(__pyx_t_2);
6602   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6603   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PackValueError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
6604   __Pyx_GOTREF(__pyx_t_1);
6605   if (PyDict_SetItem(__pyx_d, __pyx_n_s_PackValueError, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6606   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6607   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PackOverflowError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
6608   __Pyx_GOTREF(__pyx_t_1);
6609   if (PyDict_SetItem(__pyx_d, __pyx_n_s_PackOverflowError, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6610   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6611   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6612 
6613   /* "borg/algorithms/msgpack/_packer.pyx":9
6614  *
6615  * from .exceptions import PackValueError, PackOverflowError
6616  * from . import ExtType             # <<<<<<<<<<<<<<
6617  *
6618  *
6619  */
6620   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
6621   __Pyx_GOTREF(__pyx_t_2);
6622   __Pyx_INCREF(__pyx_n_s_ExtType);
6623   __Pyx_GIVEREF(__pyx_n_s_ExtType);
6624   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ExtType);
6625   __pyx_t_1 = __Pyx_Import(__pyx_n_s__7, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
6626   __Pyx_GOTREF(__pyx_t_1);
6627   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6628   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ExtType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
6629   __Pyx_GOTREF(__pyx_t_2);
6630   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExtType, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
6631   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6632   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6633 
6634   /* "borg/algorithms/msgpack/_packer.pyx":44
6635  *     int msgpack_pack_unicode(msgpack_packer* pk, object o, long long limit)
6636  *
6637  * cdef int DEFAULT_RECURSE_LIMIT=511             # <<<<<<<<<<<<<<
6638  * cdef long long ITEM_LIMIT = (2**32)-1
6639  *
6640  */
6641   __pyx_v_4borg_10algorithms_7msgpack_7_packer_DEFAULT_RECURSE_LIMIT = 0x1FF;
6642 
6643   /* "borg/algorithms/msgpack/_packer.pyx":45
6644  *
6645  * cdef int DEFAULT_RECURSE_LIMIT=511
6646  * cdef long long ITEM_LIMIT = (2**32)-1             # <<<<<<<<<<<<<<
6647  *
6648  *
6649  */
6650   __pyx_v_4borg_10algorithms_7msgpack_7_packer_ITEM_LIMIT = 0xFFFFFFFF;
6651 
6652   /* "borg/algorithms/msgpack/_packer.pyx":150
6653  *         self.pk.buf = NULL
6654  *
6655  *     cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1:             # <<<<<<<<<<<<<<
6656  *         cdef long long llval
6657  *         cdef unsigned long long ullval
6658  */
6659   __pyx_k__3 = __pyx_v_4borg_10algorithms_7msgpack_7_packer_DEFAULT_RECURSE_LIMIT;
6660 
6661   /* "borg/algorithms/msgpack/_packer.pyx":1
6662  * # coding: utf-8             # <<<<<<<<<<<<<<
6663  * #cython: embedsignature=True, c_string_encoding=ascii, language_level=2
6664  *
6665  */
6666   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6667   __Pyx_GOTREF(__pyx_t_1);
6668   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6669   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6670 
6671   /*--- Wrapped vars code ---*/
6672 
6673   goto __pyx_L0;
6674   __pyx_L1_error:;
6675   __Pyx_XDECREF(__pyx_t_1);
6676   __Pyx_XDECREF(__pyx_t_2);
6677   if (__pyx_m) {
6678     if (__pyx_d) {
6679       __Pyx_AddTraceback("init borg.algorithms.msgpack._packer", __pyx_clineno, __pyx_lineno, __pyx_filename);
6680     }
6681     Py_CLEAR(__pyx_m);
6682   } else if (!PyErr_Occurred()) {
6683     PyErr_SetString(PyExc_ImportError, "init borg.algorithms.msgpack._packer");
6684   }
6685   __pyx_L0:;
6686   __Pyx_RefNannyFinishContext();
6687   #if CYTHON_PEP489_MULTI_PHASE_INIT
6688   return (__pyx_m != NULL) ? 0 : -1;
6689   #elif PY_MAJOR_VERSION >= 3
6690   return __pyx_m;
6691   #else
6692   return;
6693   #endif
6694 }
6695 
6696 /* --- Runtime support code --- */
6697 /* Refnanny */
6698 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)6699 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
6700     PyObject *m = NULL, *p = NULL;
6701     void *r = NULL;
6702     m = PyImport_ImportModule(modname);
6703     if (!m) goto end;
6704     p = PyObject_GetAttrString(m, "RefNannyAPI");
6705     if (!p) goto end;
6706     r = PyLong_AsVoidPtr(p);
6707 end:
6708     Py_XDECREF(p);
6709     Py_XDECREF(m);
6710     return (__Pyx_RefNannyAPIStruct *)r;
6711 }
6712 #endif
6713 
6714 /* PyObjectGetAttrStr */
6715 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)6716 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
6717     PyTypeObject* tp = Py_TYPE(obj);
6718     if (likely(tp->tp_getattro))
6719         return tp->tp_getattro(obj, attr_name);
6720 #if PY_MAJOR_VERSION < 3
6721     if (likely(tp->tp_getattr))
6722         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
6723 #endif
6724     return PyObject_GetAttr(obj, attr_name);
6725 }
6726 #endif
6727 
6728 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)6729 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
6730     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
6731     if (unlikely(!result)) {
6732         PyErr_Format(PyExc_NameError,
6733 #if PY_MAJOR_VERSION >= 3
6734             "name '%U' is not defined", name);
6735 #else
6736             "name '%.200s' is not defined", PyString_AS_STRING(name));
6737 #endif
6738     }
6739     return result;
6740 }
6741 
6742 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)6743 static void __Pyx_RaiseArgtupleInvalid(
6744     const char* func_name,
6745     int exact,
6746     Py_ssize_t num_min,
6747     Py_ssize_t num_max,
6748     Py_ssize_t num_found)
6749 {
6750     Py_ssize_t num_expected;
6751     const char *more_or_less;
6752     if (num_found < num_min) {
6753         num_expected = num_min;
6754         more_or_less = "at least";
6755     } else {
6756         num_expected = num_max;
6757         more_or_less = "at most";
6758     }
6759     if (exact) {
6760         more_or_less = "exactly";
6761     }
6762     PyErr_Format(PyExc_TypeError,
6763                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6764                  func_name, more_or_less, num_expected,
6765                  (num_expected == 1) ? "" : "s", num_found);
6766 }
6767 
6768 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)6769 static int __Pyx_CheckKeywordStrings(
6770     PyObject *kwdict,
6771     const char* function_name,
6772     int kw_allowed)
6773 {
6774     PyObject* key = 0;
6775     Py_ssize_t pos = 0;
6776 #if CYTHON_COMPILING_IN_PYPY
6777     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
6778         goto invalid_keyword;
6779     return 1;
6780 #else
6781     while (PyDict_Next(kwdict, &pos, &key, 0)) {
6782         #if PY_MAJOR_VERSION < 3
6783         if (unlikely(!PyString_Check(key)))
6784         #endif
6785             if (unlikely(!PyUnicode_Check(key)))
6786                 goto invalid_keyword_type;
6787     }
6788     if ((!kw_allowed) && unlikely(key))
6789         goto invalid_keyword;
6790     return 1;
6791 invalid_keyword_type:
6792     PyErr_Format(PyExc_TypeError,
6793         "%.200s() keywords must be strings", function_name);
6794     return 0;
6795 #endif
6796 invalid_keyword:
6797     PyErr_Format(PyExc_TypeError,
6798     #if PY_MAJOR_VERSION < 3
6799         "%.200s() got an unexpected keyword argument '%.200s'",
6800         function_name, PyString_AsString(key));
6801     #else
6802         "%s() got an unexpected keyword argument '%U'",
6803         function_name, key);
6804     #endif
6805     return 0;
6806 }
6807 
6808 /* PyObjectCall */
6809 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)6810 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6811     PyObject *result;
6812     ternaryfunc call = func->ob_type->tp_call;
6813     if (unlikely(!call))
6814         return PyObject_Call(func, arg, kw);
6815     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6816         return NULL;
6817     result = (*call)(func, arg, kw);
6818     Py_LeaveRecursiveCall();
6819     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6820         PyErr_SetString(
6821             PyExc_SystemError,
6822             "NULL result without error in PyObject_Call");
6823     }
6824     return result;
6825 }
6826 #endif
6827 
6828 /* PyErrFetchRestore */
6829 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)6830 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6831     PyObject *tmp_type, *tmp_value, *tmp_tb;
6832     tmp_type = tstate->curexc_type;
6833     tmp_value = tstate->curexc_value;
6834     tmp_tb = tstate->curexc_traceback;
6835     tstate->curexc_type = type;
6836     tstate->curexc_value = value;
6837     tstate->curexc_traceback = tb;
6838     Py_XDECREF(tmp_type);
6839     Py_XDECREF(tmp_value);
6840     Py_XDECREF(tmp_tb);
6841 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)6842 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6843     *type = tstate->curexc_type;
6844     *value = tstate->curexc_value;
6845     *tb = tstate->curexc_traceback;
6846     tstate->curexc_type = 0;
6847     tstate->curexc_value = 0;
6848     tstate->curexc_traceback = 0;
6849 }
6850 #endif
6851 
6852 /* RaiseException */
6853 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)6854 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6855                         CYTHON_UNUSED PyObject *cause) {
6856     __Pyx_PyThreadState_declare
6857     Py_XINCREF(type);
6858     if (!value || value == Py_None)
6859         value = NULL;
6860     else
6861         Py_INCREF(value);
6862     if (!tb || tb == Py_None)
6863         tb = NULL;
6864     else {
6865         Py_INCREF(tb);
6866         if (!PyTraceBack_Check(tb)) {
6867             PyErr_SetString(PyExc_TypeError,
6868                 "raise: arg 3 must be a traceback or None");
6869             goto raise_error;
6870         }
6871     }
6872     if (PyType_Check(type)) {
6873 #if CYTHON_COMPILING_IN_PYPY
6874         if (!value) {
6875             Py_INCREF(Py_None);
6876             value = Py_None;
6877         }
6878 #endif
6879         PyErr_NormalizeException(&type, &value, &tb);
6880     } else {
6881         if (value) {
6882             PyErr_SetString(PyExc_TypeError,
6883                 "instance exception may not have a separate value");
6884             goto raise_error;
6885         }
6886         value = type;
6887         type = (PyObject*) Py_TYPE(type);
6888         Py_INCREF(type);
6889         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6890             PyErr_SetString(PyExc_TypeError,
6891                 "raise: exception class must be a subclass of BaseException");
6892             goto raise_error;
6893         }
6894     }
6895     __Pyx_PyThreadState_assign
6896     __Pyx_ErrRestore(type, value, tb);
6897     return;
6898 raise_error:
6899     Py_XDECREF(value);
6900     Py_XDECREF(type);
6901     Py_XDECREF(tb);
6902     return;
6903 }
6904 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)6905 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6906     PyObject* owned_instance = NULL;
6907     if (tb == Py_None) {
6908         tb = 0;
6909     } else if (tb && !PyTraceBack_Check(tb)) {
6910         PyErr_SetString(PyExc_TypeError,
6911             "raise: arg 3 must be a traceback or None");
6912         goto bad;
6913     }
6914     if (value == Py_None)
6915         value = 0;
6916     if (PyExceptionInstance_Check(type)) {
6917         if (value) {
6918             PyErr_SetString(PyExc_TypeError,
6919                 "instance exception may not have a separate value");
6920             goto bad;
6921         }
6922         value = type;
6923         type = (PyObject*) Py_TYPE(value);
6924     } else if (PyExceptionClass_Check(type)) {
6925         PyObject *instance_class = NULL;
6926         if (value && PyExceptionInstance_Check(value)) {
6927             instance_class = (PyObject*) Py_TYPE(value);
6928             if (instance_class != type) {
6929                 int is_subclass = PyObject_IsSubclass(instance_class, type);
6930                 if (!is_subclass) {
6931                     instance_class = NULL;
6932                 } else if (unlikely(is_subclass == -1)) {
6933                     goto bad;
6934                 } else {
6935                     type = instance_class;
6936                 }
6937             }
6938         }
6939         if (!instance_class) {
6940             PyObject *args;
6941             if (!value)
6942                 args = PyTuple_New(0);
6943             else if (PyTuple_Check(value)) {
6944                 Py_INCREF(value);
6945                 args = value;
6946             } else
6947                 args = PyTuple_Pack(1, value);
6948             if (!args)
6949                 goto bad;
6950             owned_instance = PyObject_Call(type, args, NULL);
6951             Py_DECREF(args);
6952             if (!owned_instance)
6953                 goto bad;
6954             value = owned_instance;
6955             if (!PyExceptionInstance_Check(value)) {
6956                 PyErr_Format(PyExc_TypeError,
6957                              "calling %R should have returned an instance of "
6958                              "BaseException, not %R",
6959                              type, Py_TYPE(value));
6960                 goto bad;
6961             }
6962         }
6963     } else {
6964         PyErr_SetString(PyExc_TypeError,
6965             "raise: exception class must be a subclass of BaseException");
6966         goto bad;
6967     }
6968     if (cause) {
6969         PyObject *fixed_cause;
6970         if (cause == Py_None) {
6971             fixed_cause = NULL;
6972         } else if (PyExceptionClass_Check(cause)) {
6973             fixed_cause = PyObject_CallObject(cause, NULL);
6974             if (fixed_cause == NULL)
6975                 goto bad;
6976         } else if (PyExceptionInstance_Check(cause)) {
6977             fixed_cause = cause;
6978             Py_INCREF(fixed_cause);
6979         } else {
6980             PyErr_SetString(PyExc_TypeError,
6981                             "exception causes must derive from "
6982                             "BaseException");
6983             goto bad;
6984         }
6985         PyException_SetCause(value, fixed_cause);
6986     }
6987     PyErr_SetObject(type, value);
6988     if (tb) {
6989 #if CYTHON_COMPILING_IN_PYPY
6990         PyObject *tmp_type, *tmp_value, *tmp_tb;
6991         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6992         Py_INCREF(tb);
6993         PyErr_Restore(tmp_type, tmp_value, tb);
6994         Py_XDECREF(tmp_tb);
6995 #else
6996         PyThreadState *tstate = __Pyx_PyThreadState_Current;
6997         PyObject* tmp_tb = tstate->curexc_traceback;
6998         if (tb != tmp_tb) {
6999             Py_INCREF(tb);
7000             tstate->curexc_traceback = tb;
7001             Py_XDECREF(tmp_tb);
7002         }
7003 #endif
7004     }
7005 bad:
7006     Py_XDECREF(owned_instance);
7007     return;
7008 }
7009 #endif
7010 
7011 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)7012 static void __Pyx_RaiseDoubleKeywordsError(
7013     const char* func_name,
7014     PyObject* kw_name)
7015 {
7016     PyErr_Format(PyExc_TypeError,
7017         #if PY_MAJOR_VERSION >= 3
7018         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
7019         #else
7020         "%s() got multiple values for keyword argument '%s'", func_name,
7021         PyString_AsString(kw_name));
7022         #endif
7023 }
7024 
7025 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)7026 static int __Pyx_ParseOptionalKeywords(
7027     PyObject *kwds,
7028     PyObject **argnames[],
7029     PyObject *kwds2,
7030     PyObject *values[],
7031     Py_ssize_t num_pos_args,
7032     const char* function_name)
7033 {
7034     PyObject *key = 0, *value = 0;
7035     Py_ssize_t pos = 0;
7036     PyObject*** name;
7037     PyObject*** first_kw_arg = argnames + num_pos_args;
7038     while (PyDict_Next(kwds, &pos, &key, &value)) {
7039         name = first_kw_arg;
7040         while (*name && (**name != key)) name++;
7041         if (*name) {
7042             values[name-argnames] = value;
7043             continue;
7044         }
7045         name = first_kw_arg;
7046         #if PY_MAJOR_VERSION < 3
7047         if (likely(PyString_Check(key))) {
7048             while (*name) {
7049                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
7050                         && _PyString_Eq(**name, key)) {
7051                     values[name-argnames] = value;
7052                     break;
7053                 }
7054                 name++;
7055             }
7056             if (*name) continue;
7057             else {
7058                 PyObject*** argname = argnames;
7059                 while (argname != first_kw_arg) {
7060                     if ((**argname == key) || (
7061                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
7062                              && _PyString_Eq(**argname, key))) {
7063                         goto arg_passed_twice;
7064                     }
7065                     argname++;
7066                 }
7067             }
7068         } else
7069         #endif
7070         if (likely(PyUnicode_Check(key))) {
7071             while (*name) {
7072                 int cmp = (**name == key) ? 0 :
7073                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7074                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
7075                 #endif
7076                     PyUnicode_Compare(**name, key);
7077                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7078                 if (cmp == 0) {
7079                     values[name-argnames] = value;
7080                     break;
7081                 }
7082                 name++;
7083             }
7084             if (*name) continue;
7085             else {
7086                 PyObject*** argname = argnames;
7087                 while (argname != first_kw_arg) {
7088                     int cmp = (**argname == key) ? 0 :
7089                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7090                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
7091                     #endif
7092                         PyUnicode_Compare(**argname, key);
7093                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7094                     if (cmp == 0) goto arg_passed_twice;
7095                     argname++;
7096                 }
7097             }
7098         } else
7099             goto invalid_keyword_type;
7100         if (kwds2) {
7101             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
7102         } else {
7103             goto invalid_keyword;
7104         }
7105     }
7106     return 0;
7107 arg_passed_twice:
7108     __Pyx_RaiseDoubleKeywordsError(function_name, key);
7109     goto bad;
7110 invalid_keyword_type:
7111     PyErr_Format(PyExc_TypeError,
7112         "%.200s() keywords must be strings", function_name);
7113     goto bad;
7114 invalid_keyword:
7115     PyErr_Format(PyExc_TypeError,
7116     #if PY_MAJOR_VERSION < 3
7117         "%.200s() got an unexpected keyword argument '%.200s'",
7118         function_name, PyString_AsString(key));
7119     #else
7120         "%s() got an unexpected keyword argument '%U'",
7121         function_name, key);
7122     #endif
7123 bad:
7124     return -1;
7125 }
7126 
7127 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)7128 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
7129     if (unlikely(!type)) {
7130         PyErr_SetString(PyExc_SystemError, "Missing type object");
7131         return 0;
7132     }
7133     if (likely(__Pyx_TypeCheck(obj, type)))
7134         return 1;
7135     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
7136                  Py_TYPE(obj)->tp_name, type->tp_name);
7137     return 0;
7138 }
7139 
7140 /* PyDictVersioning */
7141 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)7142 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
7143     PyObject *dict = Py_TYPE(obj)->tp_dict;
7144     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
7145 }
__Pyx_get_object_dict_version(PyObject * obj)7146 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
7147     PyObject **dictptr = NULL;
7148     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
7149     if (offset) {
7150 #if CYTHON_COMPILING_IN_CPYTHON
7151         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
7152 #else
7153         dictptr = _PyObject_GetDictPtr(obj);
7154 #endif
7155     }
7156     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
7157 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)7158 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
7159     PyObject *dict = Py_TYPE(obj)->tp_dict;
7160     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
7161         return 0;
7162     return obj_dict_version == __Pyx_get_object_dict_version(obj);
7163 }
7164 #endif
7165 
7166 /* GetModuleGlobalName */
7167 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)7168 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
7169 #else
7170 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
7171 #endif
7172 {
7173     PyObject *result;
7174 #if !CYTHON_AVOID_BORROWED_REFS
7175 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
7176     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
7177     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7178     if (likely(result)) {
7179         return __Pyx_NewRef(result);
7180     } else if (unlikely(PyErr_Occurred())) {
7181         return NULL;
7182     }
7183 #else
7184     result = PyDict_GetItem(__pyx_d, name);
7185     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7186     if (likely(result)) {
7187         return __Pyx_NewRef(result);
7188     }
7189 #endif
7190 #else
7191     result = PyObject_GetItem(__pyx_d, name);
7192     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7193     if (likely(result)) {
7194         return __Pyx_NewRef(result);
7195     }
7196     PyErr_Clear();
7197 #endif
7198     return __Pyx_GetBuiltinName(name);
7199 }
7200 
7201 /* PyCFunctionFastCall */
7202 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)7203 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
7204     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
7205     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
7206     PyObject *self = PyCFunction_GET_SELF(func);
7207     int flags = PyCFunction_GET_FLAGS(func);
7208     assert(PyCFunction_Check(func));
7209     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
7210     assert(nargs >= 0);
7211     assert(nargs == 0 || args != NULL);
7212     /* _PyCFunction_FastCallDict() must not be called with an exception set,
7213        because it may clear it (directly or indirectly) and so the
7214        caller loses its exception */
7215     assert(!PyErr_Occurred());
7216     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
7217         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
7218     } else {
7219         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
7220     }
7221 }
7222 #endif
7223 
7224 /* PyFunctionFastCall */
7225 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)7226 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
7227                                                PyObject *globals) {
7228     PyFrameObject *f;
7229     PyThreadState *tstate = __Pyx_PyThreadState_Current;
7230     PyObject **fastlocals;
7231     Py_ssize_t i;
7232     PyObject *result;
7233     assert(globals != NULL);
7234     /* XXX Perhaps we should create a specialized
7235        PyFrame_New() that doesn't take locals, but does
7236        take builtins without sanity checking them.
7237        */
7238     assert(tstate != NULL);
7239     f = PyFrame_New(tstate, co, globals, NULL);
7240     if (f == NULL) {
7241         return NULL;
7242     }
7243     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
7244     for (i = 0; i < na; i++) {
7245         Py_INCREF(*args);
7246         fastlocals[i] = *args++;
7247     }
7248     result = PyEval_EvalFrameEx(f,0);
7249     ++tstate->recursion_depth;
7250     Py_DECREF(f);
7251     --tstate->recursion_depth;
7252     return result;
7253 }
7254 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)7255 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
7256     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
7257     PyObject *globals = PyFunction_GET_GLOBALS(func);
7258     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
7259     PyObject *closure;
7260 #if PY_MAJOR_VERSION >= 3
7261     PyObject *kwdefs;
7262 #endif
7263     PyObject *kwtuple, **k;
7264     PyObject **d;
7265     Py_ssize_t nd;
7266     Py_ssize_t nk;
7267     PyObject *result;
7268     assert(kwargs == NULL || PyDict_Check(kwargs));
7269     nk = kwargs ? PyDict_Size(kwargs) : 0;
7270     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
7271         return NULL;
7272     }
7273     if (
7274 #if PY_MAJOR_VERSION >= 3
7275             co->co_kwonlyargcount == 0 &&
7276 #endif
7277             likely(kwargs == NULL || nk == 0) &&
7278             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
7279         if (argdefs == NULL && co->co_argcount == nargs) {
7280             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
7281             goto done;
7282         }
7283         else if (nargs == 0 && argdefs != NULL
7284                  && co->co_argcount == Py_SIZE(argdefs)) {
7285             /* function called with no arguments, but all parameters have
7286                a default value: use default values as arguments .*/
7287             args = &PyTuple_GET_ITEM(argdefs, 0);
7288             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
7289             goto done;
7290         }
7291     }
7292     if (kwargs != NULL) {
7293         Py_ssize_t pos, i;
7294         kwtuple = PyTuple_New(2 * nk);
7295         if (kwtuple == NULL) {
7296             result = NULL;
7297             goto done;
7298         }
7299         k = &PyTuple_GET_ITEM(kwtuple, 0);
7300         pos = i = 0;
7301         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
7302             Py_INCREF(k[i]);
7303             Py_INCREF(k[i+1]);
7304             i += 2;
7305         }
7306         nk = i / 2;
7307     }
7308     else {
7309         kwtuple = NULL;
7310         k = NULL;
7311     }
7312     closure = PyFunction_GET_CLOSURE(func);
7313 #if PY_MAJOR_VERSION >= 3
7314     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
7315 #endif
7316     if (argdefs != NULL) {
7317         d = &PyTuple_GET_ITEM(argdefs, 0);
7318         nd = Py_SIZE(argdefs);
7319     }
7320     else {
7321         d = NULL;
7322         nd = 0;
7323     }
7324 #if PY_MAJOR_VERSION >= 3
7325     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
7326                                args, (int)nargs,
7327                                k, (int)nk,
7328                                d, (int)nd, kwdefs, closure);
7329 #else
7330     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
7331                                args, (int)nargs,
7332                                k, (int)nk,
7333                                d, (int)nd, closure);
7334 #endif
7335     Py_XDECREF(kwtuple);
7336 done:
7337     Py_LeaveRecursiveCall();
7338     return result;
7339 }
7340 #endif
7341 #endif
7342 
7343 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)7344 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
7345     PyObject *args, *result = NULL;
7346     #if CYTHON_FAST_PYCALL
7347     if (PyFunction_Check(function)) {
7348         PyObject *args[2] = {arg1, arg2};
7349         return __Pyx_PyFunction_FastCall(function, args, 2);
7350     }
7351     #endif
7352     #if CYTHON_FAST_PYCCALL
7353     if (__Pyx_PyFastCFunction_Check(function)) {
7354         PyObject *args[2] = {arg1, arg2};
7355         return __Pyx_PyCFunction_FastCall(function, args, 2);
7356     }
7357     #endif
7358     args = PyTuple_New(2);
7359     if (unlikely(!args)) goto done;
7360     Py_INCREF(arg1);
7361     PyTuple_SET_ITEM(args, 0, arg1);
7362     Py_INCREF(arg2);
7363     PyTuple_SET_ITEM(args, 1, arg2);
7364     Py_INCREF(function);
7365     result = __Pyx_PyObject_Call(function, args, NULL);
7366     Py_DECREF(args);
7367     Py_DECREF(function);
7368 done:
7369     return result;
7370 }
7371 
7372 /* PyObjectCallMethO */
7373 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)7374 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
7375     PyObject *self, *result;
7376     PyCFunction cfunc;
7377     cfunc = PyCFunction_GET_FUNCTION(func);
7378     self = PyCFunction_GET_SELF(func);
7379     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7380         return NULL;
7381     result = cfunc(self, arg);
7382     Py_LeaveRecursiveCall();
7383     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7384         PyErr_SetString(
7385             PyExc_SystemError,
7386             "NULL result without error in PyObject_Call");
7387     }
7388     return result;
7389 }
7390 #endif
7391 
7392 /* PyObjectCallOneArg */
7393 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)7394 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7395     PyObject *result;
7396     PyObject *args = PyTuple_New(1);
7397     if (unlikely(!args)) return NULL;
7398     Py_INCREF(arg);
7399     PyTuple_SET_ITEM(args, 0, arg);
7400     result = __Pyx_PyObject_Call(func, args, NULL);
7401     Py_DECREF(args);
7402     return result;
7403 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)7404 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7405 #if CYTHON_FAST_PYCALL
7406     if (PyFunction_Check(func)) {
7407         return __Pyx_PyFunction_FastCall(func, &arg, 1);
7408     }
7409 #endif
7410     if (likely(PyCFunction_Check(func))) {
7411         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
7412             return __Pyx_PyObject_CallMethO(func, arg);
7413 #if CYTHON_FAST_PYCCALL
7414         } else if (__Pyx_PyFastCFunction_Check(func)) {
7415             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
7416 #endif
7417         }
7418     }
7419     return __Pyx__PyObject_CallOneArg(func, arg);
7420 }
7421 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)7422 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7423     PyObject *result;
7424     PyObject *args = PyTuple_Pack(1, arg);
7425     if (unlikely(!args)) return NULL;
7426     result = __Pyx_PyObject_Call(func, args, NULL);
7427     Py_DECREF(args);
7428     return result;
7429 }
7430 #endif
7431 
7432 /* GetTopmostException */
7433 #if CYTHON_USE_EXC_INFO_STACK
7434 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)7435 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
7436 {
7437     _PyErr_StackItem *exc_info = tstate->exc_info;
7438     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
7439            exc_info->previous_item != NULL)
7440     {
7441         exc_info = exc_info->previous_item;
7442     }
7443     return exc_info;
7444 }
7445 #endif
7446 
7447 /* SaveResetException */
7448 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)7449 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7450     #if CYTHON_USE_EXC_INFO_STACK
7451     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
7452     *type = exc_info->exc_type;
7453     *value = exc_info->exc_value;
7454     *tb = exc_info->exc_traceback;
7455     #else
7456     *type = tstate->exc_type;
7457     *value = tstate->exc_value;
7458     *tb = tstate->exc_traceback;
7459     #endif
7460     Py_XINCREF(*type);
7461     Py_XINCREF(*value);
7462     Py_XINCREF(*tb);
7463 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)7464 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
7465     PyObject *tmp_type, *tmp_value, *tmp_tb;
7466     #if CYTHON_USE_EXC_INFO_STACK
7467     _PyErr_StackItem *exc_info = tstate->exc_info;
7468     tmp_type = exc_info->exc_type;
7469     tmp_value = exc_info->exc_value;
7470     tmp_tb = exc_info->exc_traceback;
7471     exc_info->exc_type = type;
7472     exc_info->exc_value = value;
7473     exc_info->exc_traceback = tb;
7474     #else
7475     tmp_type = tstate->exc_type;
7476     tmp_value = tstate->exc_value;
7477     tmp_tb = tstate->exc_traceback;
7478     tstate->exc_type = type;
7479     tstate->exc_value = value;
7480     tstate->exc_traceback = tb;
7481     #endif
7482     Py_XDECREF(tmp_type);
7483     Py_XDECREF(tmp_value);
7484     Py_XDECREF(tmp_tb);
7485 }
7486 #endif
7487 
7488 /* PyErrExceptionMatches */
7489 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)7490 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
7491     Py_ssize_t i, n;
7492     n = PyTuple_GET_SIZE(tuple);
7493 #if PY_MAJOR_VERSION >= 3
7494     for (i=0; i<n; i++) {
7495         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
7496     }
7497 #endif
7498     for (i=0; i<n; i++) {
7499         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
7500     }
7501     return 0;
7502 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)7503 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
7504     PyObject *exc_type = tstate->curexc_type;
7505     if (exc_type == err) return 1;
7506     if (unlikely(!exc_type)) return 0;
7507     if (unlikely(PyTuple_Check(err)))
7508         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
7509     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
7510 }
7511 #endif
7512 
7513 /* GetException */
7514 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)7515 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
7516 #else
7517 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
7518 #endif
7519 {
7520     PyObject *local_type, *local_value, *local_tb;
7521 #if CYTHON_FAST_THREAD_STATE
7522     PyObject *tmp_type, *tmp_value, *tmp_tb;
7523     local_type = tstate->curexc_type;
7524     local_value = tstate->curexc_value;
7525     local_tb = tstate->curexc_traceback;
7526     tstate->curexc_type = 0;
7527     tstate->curexc_value = 0;
7528     tstate->curexc_traceback = 0;
7529 #else
7530     PyErr_Fetch(&local_type, &local_value, &local_tb);
7531 #endif
7532     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
7533 #if CYTHON_FAST_THREAD_STATE
7534     if (unlikely(tstate->curexc_type))
7535 #else
7536     if (unlikely(PyErr_Occurred()))
7537 #endif
7538         goto bad;
7539     #if PY_MAJOR_VERSION >= 3
7540     if (local_tb) {
7541         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
7542             goto bad;
7543     }
7544     #endif
7545     Py_XINCREF(local_tb);
7546     Py_XINCREF(local_type);
7547     Py_XINCREF(local_value);
7548     *type = local_type;
7549     *value = local_value;
7550     *tb = local_tb;
7551 #if CYTHON_FAST_THREAD_STATE
7552     #if CYTHON_USE_EXC_INFO_STACK
7553     {
7554         _PyErr_StackItem *exc_info = tstate->exc_info;
7555         tmp_type = exc_info->exc_type;
7556         tmp_value = exc_info->exc_value;
7557         tmp_tb = exc_info->exc_traceback;
7558         exc_info->exc_type = local_type;
7559         exc_info->exc_value = local_value;
7560         exc_info->exc_traceback = local_tb;
7561     }
7562     #else
7563     tmp_type = tstate->exc_type;
7564     tmp_value = tstate->exc_value;
7565     tmp_tb = tstate->exc_traceback;
7566     tstate->exc_type = local_type;
7567     tstate->exc_value = local_value;
7568     tstate->exc_traceback = local_tb;
7569     #endif
7570     Py_XDECREF(tmp_type);
7571     Py_XDECREF(tmp_value);
7572     Py_XDECREF(tmp_tb);
7573 #else
7574     PyErr_SetExcInfo(local_type, local_value, local_tb);
7575 #endif
7576     return 0;
7577 bad:
7578     *type = 0;
7579     *value = 0;
7580     *tb = 0;
7581     Py_XDECREF(local_type);
7582     Py_XDECREF(local_value);
7583     Py_XDECREF(local_tb);
7584     return -1;
7585 }
7586 
7587 /* IterFinish */
__Pyx_IterFinish(void)7588 static CYTHON_INLINE int __Pyx_IterFinish(void) {
7589 #if CYTHON_FAST_THREAD_STATE
7590     PyThreadState *tstate = __Pyx_PyThreadState_Current;
7591     PyObject* exc_type = tstate->curexc_type;
7592     if (unlikely(exc_type)) {
7593         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
7594             PyObject *exc_value, *exc_tb;
7595             exc_value = tstate->curexc_value;
7596             exc_tb = tstate->curexc_traceback;
7597             tstate->curexc_type = 0;
7598             tstate->curexc_value = 0;
7599             tstate->curexc_traceback = 0;
7600             Py_DECREF(exc_type);
7601             Py_XDECREF(exc_value);
7602             Py_XDECREF(exc_tb);
7603             return 0;
7604         } else {
7605             return -1;
7606         }
7607     }
7608     return 0;
7609 #else
7610     if (unlikely(PyErr_Occurred())) {
7611         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
7612             PyErr_Clear();
7613             return 0;
7614         } else {
7615             return -1;
7616         }
7617     }
7618     return 0;
7619 #endif
7620 }
7621 
7622 /* PyObjectCallNoArg */
7623 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)7624 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
7625 #if CYTHON_FAST_PYCALL
7626     if (PyFunction_Check(func)) {
7627         return __Pyx_PyFunction_FastCall(func, NULL, 0);
7628     }
7629 #endif
7630 #ifdef __Pyx_CyFunction_USED
7631     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
7632 #else
7633     if (likely(PyCFunction_Check(func)))
7634 #endif
7635     {
7636         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
7637             return __Pyx_PyObject_CallMethO(func, NULL);
7638         }
7639     }
7640     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
7641 }
7642 #endif
7643 
7644 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)7645 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
7646     PyObject *attr;
7647 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
7648     PyTypeObject *tp = Py_TYPE(obj);
7649     PyObject *descr;
7650     descrgetfunc f = NULL;
7651     PyObject **dictptr, *dict;
7652     int meth_found = 0;
7653     assert (*method == NULL);
7654     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
7655         attr = __Pyx_PyObject_GetAttrStr(obj, name);
7656         goto try_unpack;
7657     }
7658     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
7659         return 0;
7660     }
7661     descr = _PyType_Lookup(tp, name);
7662     if (likely(descr != NULL)) {
7663         Py_INCREF(descr);
7664 #if PY_MAJOR_VERSION >= 3
7665         #ifdef __Pyx_CyFunction_USED
7666         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
7667         #else
7668         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
7669         #endif
7670 #else
7671         #ifdef __Pyx_CyFunction_USED
7672         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
7673         #else
7674         if (likely(PyFunction_Check(descr)))
7675         #endif
7676 #endif
7677         {
7678             meth_found = 1;
7679         } else {
7680             f = Py_TYPE(descr)->tp_descr_get;
7681             if (f != NULL && PyDescr_IsData(descr)) {
7682                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
7683                 Py_DECREF(descr);
7684                 goto try_unpack;
7685             }
7686         }
7687     }
7688     dictptr = _PyObject_GetDictPtr(obj);
7689     if (dictptr != NULL && (dict = *dictptr) != NULL) {
7690         Py_INCREF(dict);
7691         attr = __Pyx_PyDict_GetItemStr(dict, name);
7692         if (attr != NULL) {
7693             Py_INCREF(attr);
7694             Py_DECREF(dict);
7695             Py_XDECREF(descr);
7696             goto try_unpack;
7697         }
7698         Py_DECREF(dict);
7699     }
7700     if (meth_found) {
7701         *method = descr;
7702         return 1;
7703     }
7704     if (f != NULL) {
7705         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
7706         Py_DECREF(descr);
7707         goto try_unpack;
7708     }
7709     if (descr != NULL) {
7710         *method = descr;
7711         return 0;
7712     }
7713     PyErr_Format(PyExc_AttributeError,
7714 #if PY_MAJOR_VERSION >= 3
7715                  "'%.50s' object has no attribute '%U'",
7716                  tp->tp_name, name);
7717 #else
7718                  "'%.50s' object has no attribute '%.400s'",
7719                  tp->tp_name, PyString_AS_STRING(name));
7720 #endif
7721     return 0;
7722 #else
7723     attr = __Pyx_PyObject_GetAttrStr(obj, name);
7724     goto try_unpack;
7725 #endif
7726 try_unpack:
7727 #if CYTHON_UNPACK_METHODS
7728     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
7729         PyObject *function = PyMethod_GET_FUNCTION(attr);
7730         Py_INCREF(function);
7731         Py_DECREF(attr);
7732         *method = function;
7733         return 1;
7734     }
7735 #endif
7736     *method = attr;
7737     return 0;
7738 }
7739 
7740 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)7741 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
7742     PyObject *method = NULL, *result = NULL;
7743     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
7744     if (likely(is_method)) {
7745         result = __Pyx_PyObject_CallOneArg(method, obj);
7746         Py_DECREF(method);
7747         return result;
7748     }
7749     if (unlikely(!method)) goto bad;
7750     result = __Pyx_PyObject_CallNoArg(method);
7751     Py_DECREF(method);
7752 bad:
7753     return result;
7754 }
7755 
7756 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)7757 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
7758     PyErr_Format(PyExc_ValueError,
7759                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
7760                  index, (index == 1) ? "" : "s");
7761 }
7762 
7763 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)7764 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
7765     PyErr_Format(PyExc_ValueError,
7766                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
7767 }
7768 
7769 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)7770 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
7771     if (unlikely(retval)) {
7772         Py_DECREF(retval);
7773         __Pyx_RaiseTooManyValuesError(expected);
7774         return -1;
7775     } else {
7776         return __Pyx_IterFinish();
7777     }
7778     return 0;
7779 }
7780 
7781 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)7782 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
7783     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
7784 }
7785 
7786 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)7787 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
7788     if (t == Py_None) {
7789       __Pyx_RaiseNoneNotIterableError();
7790     } else if (PyTuple_GET_SIZE(t) < index) {
7791       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
7792     } else {
7793       __Pyx_RaiseTooManyValuesError(index);
7794     }
7795 }
7796 
7797 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)7798 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
7799         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
7800     PyObject *value1 = NULL, *value2 = NULL;
7801 #if CYTHON_COMPILING_IN_PYPY
7802     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
7803     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
7804 #else
7805     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
7806     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
7807 #endif
7808     if (decref_tuple) {
7809         Py_DECREF(tuple);
7810     }
7811     *pvalue1 = value1;
7812     *pvalue2 = value2;
7813     return 0;
7814 #if CYTHON_COMPILING_IN_PYPY
7815 bad:
7816     Py_XDECREF(value1);
7817     Py_XDECREF(value2);
7818     if (decref_tuple) { Py_XDECREF(tuple); }
7819     return -1;
7820 #endif
7821 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)7822 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
7823                                        int has_known_size, int decref_tuple) {
7824     Py_ssize_t index;
7825     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
7826     iternextfunc iternext;
7827     iter = PyObject_GetIter(tuple);
7828     if (unlikely(!iter)) goto bad;
7829     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
7830     iternext = Py_TYPE(iter)->tp_iternext;
7831     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
7832     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
7833     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
7834     Py_DECREF(iter);
7835     *pvalue1 = value1;
7836     *pvalue2 = value2;
7837     return 0;
7838 unpacking_failed:
7839     if (!has_known_size && __Pyx_IterFinish() == 0)
7840         __Pyx_RaiseNeedMoreValuesError(index);
7841 bad:
7842     Py_XDECREF(iter);
7843     Py_XDECREF(value1);
7844     Py_XDECREF(value2);
7845     if (decref_tuple) { Py_XDECREF(tuple); }
7846     return -1;
7847 }
7848 
7849 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)7850 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
7851                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
7852     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
7853     *p_source_is_dict = is_dict;
7854     if (is_dict) {
7855 #if !CYTHON_COMPILING_IN_PYPY
7856         *p_orig_length = PyDict_Size(iterable);
7857         Py_INCREF(iterable);
7858         return iterable;
7859 #elif PY_MAJOR_VERSION >= 3
7860         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
7861         PyObject **pp = NULL;
7862         if (method_name) {
7863             const char *name = PyUnicode_AsUTF8(method_name);
7864             if (strcmp(name, "iteritems") == 0) pp = &py_items;
7865             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
7866             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
7867             if (pp) {
7868                 if (!*pp) {
7869                     *pp = PyUnicode_FromString(name + 4);
7870                     if (!*pp)
7871                         return NULL;
7872                 }
7873                 method_name = *pp;
7874             }
7875         }
7876 #endif
7877     }
7878     *p_orig_length = 0;
7879     if (method_name) {
7880         PyObject* iter;
7881         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
7882         if (!iterable)
7883             return NULL;
7884 #if !CYTHON_COMPILING_IN_PYPY
7885         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
7886             return iterable;
7887 #endif
7888         iter = PyObject_GetIter(iterable);
7889         Py_DECREF(iterable);
7890         return iter;
7891     }
7892     return PyObject_GetIter(iterable);
7893 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)7894 static CYTHON_INLINE int __Pyx_dict_iter_next(
7895         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
7896         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
7897     PyObject* next_item;
7898 #if !CYTHON_COMPILING_IN_PYPY
7899     if (source_is_dict) {
7900         PyObject *key, *value;
7901         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
7902             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
7903             return -1;
7904         }
7905         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
7906             return 0;
7907         }
7908         if (pitem) {
7909             PyObject* tuple = PyTuple_New(2);
7910             if (unlikely(!tuple)) {
7911                 return -1;
7912             }
7913             Py_INCREF(key);
7914             Py_INCREF(value);
7915             PyTuple_SET_ITEM(tuple, 0, key);
7916             PyTuple_SET_ITEM(tuple, 1, value);
7917             *pitem = tuple;
7918         } else {
7919             if (pkey) {
7920                 Py_INCREF(key);
7921                 *pkey = key;
7922             }
7923             if (pvalue) {
7924                 Py_INCREF(value);
7925                 *pvalue = value;
7926             }
7927         }
7928         return 1;
7929     } else if (PyTuple_CheckExact(iter_obj)) {
7930         Py_ssize_t pos = *ppos;
7931         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
7932         *ppos = pos + 1;
7933         next_item = PyTuple_GET_ITEM(iter_obj, pos);
7934         Py_INCREF(next_item);
7935     } else if (PyList_CheckExact(iter_obj)) {
7936         Py_ssize_t pos = *ppos;
7937         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
7938         *ppos = pos + 1;
7939         next_item = PyList_GET_ITEM(iter_obj, pos);
7940         Py_INCREF(next_item);
7941     } else
7942 #endif
7943     {
7944         next_item = PyIter_Next(iter_obj);
7945         if (unlikely(!next_item)) {
7946             return __Pyx_IterFinish();
7947         }
7948     }
7949     if (pitem) {
7950         *pitem = next_item;
7951     } else if (pkey && pvalue) {
7952         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
7953             return -1;
7954     } else if (pkey) {
7955         *pkey = next_item;
7956     } else {
7957         *pvalue = next_item;
7958     }
7959     return 1;
7960 }
7961 
7962 /* PyObject_GenericGetAttrNoDict */
7963 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)7964 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
7965     PyErr_Format(PyExc_AttributeError,
7966 #if PY_MAJOR_VERSION >= 3
7967                  "'%.50s' object has no attribute '%U'",
7968                  tp->tp_name, attr_name);
7969 #else
7970                  "'%.50s' object has no attribute '%.400s'",
7971                  tp->tp_name, PyString_AS_STRING(attr_name));
7972 #endif
7973     return NULL;
7974 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)7975 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
7976     PyObject *descr;
7977     PyTypeObject *tp = Py_TYPE(obj);
7978     if (unlikely(!PyString_Check(attr_name))) {
7979         return PyObject_GenericGetAttr(obj, attr_name);
7980     }
7981     assert(!tp->tp_dictoffset);
7982     descr = _PyType_Lookup(tp, attr_name);
7983     if (unlikely(!descr)) {
7984         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
7985     }
7986     Py_INCREF(descr);
7987     #if PY_MAJOR_VERSION < 3
7988     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
7989     #endif
7990     {
7991         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
7992         if (unlikely(f)) {
7993             PyObject *res = f(descr, obj, (PyObject *)tp);
7994             Py_DECREF(descr);
7995             return res;
7996         }
7997     }
7998     return descr;
7999 }
8000 #endif
8001 
8002 /* PyObject_GenericGetAttr */
8003 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)8004 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
8005     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
8006         return PyObject_GenericGetAttr(obj, attr_name);
8007     }
8008     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
8009 }
8010 #endif
8011 
8012 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)8013 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
8014 #if PY_VERSION_HEX >= 0x02070000
8015     PyObject *ob = PyCapsule_New(vtable, 0, 0);
8016 #else
8017     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
8018 #endif
8019     if (!ob)
8020         goto bad;
8021     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
8022         goto bad;
8023     Py_DECREF(ob);
8024     return 0;
8025 bad:
8026     Py_XDECREF(ob);
8027     return -1;
8028 }
8029 
8030 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)8031 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
8032     __Pyx_PyThreadState_declare
8033     __Pyx_PyThreadState_assign
8034     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
8035         __Pyx_PyErr_Clear();
8036 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)8037 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
8038     PyObject *result;
8039 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
8040     PyTypeObject* tp = Py_TYPE(obj);
8041     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
8042         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
8043     }
8044 #endif
8045     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
8046     if (unlikely(!result)) {
8047         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
8048     }
8049     return result;
8050 }
8051 
8052 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)8053 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
8054   int ret;
8055   PyObject *name_attr;
8056   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
8057   if (likely(name_attr)) {
8058       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
8059   } else {
8060       ret = -1;
8061   }
8062   if (unlikely(ret < 0)) {
8063       PyErr_Clear();
8064       ret = 0;
8065   }
8066   Py_XDECREF(name_attr);
8067   return ret;
8068 }
__Pyx_setup_reduce(PyObject * type_obj)8069 static int __Pyx_setup_reduce(PyObject* type_obj) {
8070     int ret = 0;
8071     PyObject *object_reduce = NULL;
8072     PyObject *object_reduce_ex = NULL;
8073     PyObject *reduce = NULL;
8074     PyObject *reduce_ex = NULL;
8075     PyObject *reduce_cython = NULL;
8076     PyObject *setstate = NULL;
8077     PyObject *setstate_cython = NULL;
8078 #if CYTHON_USE_PYTYPE_LOOKUP
8079     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8080 #else
8081     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8082 #endif
8083 #if CYTHON_USE_PYTYPE_LOOKUP
8084     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8085 #else
8086     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8087 #endif
8088     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
8089     if (reduce_ex == object_reduce_ex) {
8090 #if CYTHON_USE_PYTYPE_LOOKUP
8091         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8092 #else
8093         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8094 #endif
8095         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
8096         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
8097             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
8098             if (likely(reduce_cython)) {
8099                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8100                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8101             } else if (reduce == object_reduce || PyErr_Occurred()) {
8102                 goto __PYX_BAD;
8103             }
8104             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
8105             if (!setstate) PyErr_Clear();
8106             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
8107                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
8108                 if (likely(setstate_cython)) {
8109                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8110                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8111                 } else if (!setstate || PyErr_Occurred()) {
8112                     goto __PYX_BAD;
8113                 }
8114             }
8115             PyType_Modified((PyTypeObject*)type_obj);
8116         }
8117     }
8118     goto __PYX_GOOD;
8119 __PYX_BAD:
8120     if (!PyErr_Occurred())
8121         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
8122     ret = -1;
8123 __PYX_GOOD:
8124 #if !CYTHON_USE_PYTYPE_LOOKUP
8125     Py_XDECREF(object_reduce);
8126     Py_XDECREF(object_reduce_ex);
8127 #endif
8128     Py_XDECREF(reduce);
8129     Py_XDECREF(reduce_ex);
8130     Py_XDECREF(reduce_cython);
8131     Py_XDECREF(setstate);
8132     Py_XDECREF(setstate_cython);
8133     return ret;
8134 }
8135 
8136 /* TypeImport */
8137 #ifndef __PYX_HAVE_RT_ImportType
8138 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)8139 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
8140     size_t size, enum __Pyx_ImportType_CheckSize check_size)
8141 {
8142     PyObject *result = 0;
8143     char warning[200];
8144     Py_ssize_t basicsize;
8145 #ifdef Py_LIMITED_API
8146     PyObject *py_basicsize;
8147 #endif
8148     result = PyObject_GetAttrString(module, class_name);
8149     if (!result)
8150         goto bad;
8151     if (!PyType_Check(result)) {
8152         PyErr_Format(PyExc_TypeError,
8153             "%.200s.%.200s is not a type object",
8154             module_name, class_name);
8155         goto bad;
8156     }
8157 #ifndef Py_LIMITED_API
8158     basicsize = ((PyTypeObject *)result)->tp_basicsize;
8159 #else
8160     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
8161     if (!py_basicsize)
8162         goto bad;
8163     basicsize = PyLong_AsSsize_t(py_basicsize);
8164     Py_DECREF(py_basicsize);
8165     py_basicsize = 0;
8166     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
8167         goto bad;
8168 #endif
8169     if ((size_t)basicsize < size) {
8170         PyErr_Format(PyExc_ValueError,
8171             "%.200s.%.200s size changed, may indicate binary incompatibility. "
8172             "Expected %zd from C header, got %zd from PyObject",
8173             module_name, class_name, size, basicsize);
8174         goto bad;
8175     }
8176     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
8177         PyErr_Format(PyExc_ValueError,
8178             "%.200s.%.200s size changed, may indicate binary incompatibility. "
8179             "Expected %zd from C header, got %zd from PyObject",
8180             module_name, class_name, size, basicsize);
8181         goto bad;
8182     }
8183     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
8184         PyOS_snprintf(warning, sizeof(warning),
8185             "%s.%s size changed, may indicate binary incompatibility. "
8186             "Expected %zd from C header, got %zd from PyObject",
8187             module_name, class_name, size, basicsize);
8188         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
8189     }
8190     return (PyTypeObject *)result;
8191 bad:
8192     Py_XDECREF(result);
8193     return NULL;
8194 }
8195 #endif
8196 
8197 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)8198 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
8199     PyObject *empty_list = 0;
8200     PyObject *module = 0;
8201     PyObject *global_dict = 0;
8202     PyObject *empty_dict = 0;
8203     PyObject *list;
8204     #if PY_MAJOR_VERSION < 3
8205     PyObject *py_import;
8206     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
8207     if (!py_import)
8208         goto bad;
8209     #endif
8210     if (from_list)
8211         list = from_list;
8212     else {
8213         empty_list = PyList_New(0);
8214         if (!empty_list)
8215             goto bad;
8216         list = empty_list;
8217     }
8218     global_dict = PyModule_GetDict(__pyx_m);
8219     if (!global_dict)
8220         goto bad;
8221     empty_dict = PyDict_New();
8222     if (!empty_dict)
8223         goto bad;
8224     {
8225         #if PY_MAJOR_VERSION >= 3
8226         if (level == -1) {
8227             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
8228                 module = PyImport_ImportModuleLevelObject(
8229                     name, global_dict, empty_dict, list, 1);
8230                 if (!module) {
8231                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
8232                         goto bad;
8233                     PyErr_Clear();
8234                 }
8235             }
8236             level = 0;
8237         }
8238         #endif
8239         if (!module) {
8240             #if PY_MAJOR_VERSION < 3
8241             PyObject *py_level = PyInt_FromLong(level);
8242             if (!py_level)
8243                 goto bad;
8244             module = PyObject_CallFunctionObjArgs(py_import,
8245                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
8246             Py_DECREF(py_level);
8247             #else
8248             module = PyImport_ImportModuleLevelObject(
8249                 name, global_dict, empty_dict, list, level);
8250             #endif
8251         }
8252     }
8253 bad:
8254     #if PY_MAJOR_VERSION < 3
8255     Py_XDECREF(py_import);
8256     #endif
8257     Py_XDECREF(empty_list);
8258     Py_XDECREF(empty_dict);
8259     return module;
8260 }
8261 
8262 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)8263 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
8264     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
8265     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
8266         PyErr_Format(PyExc_ImportError,
8267         #if PY_MAJOR_VERSION < 3
8268             "cannot import name %.230s", PyString_AS_STRING(name));
8269         #else
8270             "cannot import name %S", name);
8271         #endif
8272     }
8273     return value;
8274 }
8275 
8276 /* CLineInTraceback */
8277 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)8278 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
8279     PyObject *use_cline;
8280     PyObject *ptype, *pvalue, *ptraceback;
8281 #if CYTHON_COMPILING_IN_CPYTHON
8282     PyObject **cython_runtime_dict;
8283 #endif
8284     if (unlikely(!__pyx_cython_runtime)) {
8285         return c_line;
8286     }
8287     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8288 #if CYTHON_COMPILING_IN_CPYTHON
8289     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8290     if (likely(cython_runtime_dict)) {
8291         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8292             use_cline, *cython_runtime_dict,
8293             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8294     } else
8295 #endif
8296     {
8297       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8298       if (use_cline_obj) {
8299         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8300         Py_DECREF(use_cline_obj);
8301       } else {
8302         PyErr_Clear();
8303         use_cline = NULL;
8304       }
8305     }
8306     if (!use_cline) {
8307         c_line = 0;
8308         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8309     }
8310     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8311         c_line = 0;
8312     }
8313     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8314     return c_line;
8315 }
8316 #endif
8317 
8318 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)8319 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8320     int start = 0, mid = 0, end = count - 1;
8321     if (end >= 0 && code_line > entries[end].code_line) {
8322         return count;
8323     }
8324     while (start < end) {
8325         mid = start + (end - start) / 2;
8326         if (code_line < entries[mid].code_line) {
8327             end = mid;
8328         } else if (code_line > entries[mid].code_line) {
8329              start = mid + 1;
8330         } else {
8331             return mid;
8332         }
8333     }
8334     if (code_line <= entries[mid].code_line) {
8335         return mid;
8336     } else {
8337         return mid + 1;
8338     }
8339 }
__pyx_find_code_object(int code_line)8340 static PyCodeObject *__pyx_find_code_object(int code_line) {
8341     PyCodeObject* code_object;
8342     int pos;
8343     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8344         return NULL;
8345     }
8346     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8347     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8348         return NULL;
8349     }
8350     code_object = __pyx_code_cache.entries[pos].code_object;
8351     Py_INCREF(code_object);
8352     return code_object;
8353 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)8354 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8355     int pos, i;
8356     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8357     if (unlikely(!code_line)) {
8358         return;
8359     }
8360     if (unlikely(!entries)) {
8361         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8362         if (likely(entries)) {
8363             __pyx_code_cache.entries = entries;
8364             __pyx_code_cache.max_count = 64;
8365             __pyx_code_cache.count = 1;
8366             entries[0].code_line = code_line;
8367             entries[0].code_object = code_object;
8368             Py_INCREF(code_object);
8369         }
8370         return;
8371     }
8372     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8373     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8374         PyCodeObject* tmp = entries[pos].code_object;
8375         entries[pos].code_object = code_object;
8376         Py_DECREF(tmp);
8377         return;
8378     }
8379     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8380         int new_max = __pyx_code_cache.max_count + 64;
8381         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8382             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
8383         if (unlikely(!entries)) {
8384             return;
8385         }
8386         __pyx_code_cache.entries = entries;
8387         __pyx_code_cache.max_count = new_max;
8388     }
8389     for (i=__pyx_code_cache.count; i>pos; i--) {
8390         entries[i] = entries[i-1];
8391     }
8392     entries[pos].code_line = code_line;
8393     entries[pos].code_object = code_object;
8394     __pyx_code_cache.count++;
8395     Py_INCREF(code_object);
8396 }
8397 
8398 /* AddTraceback */
8399 #include "compile.h"
8400 #include "frameobject.h"
8401 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)8402 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8403             const char *funcname, int c_line,
8404             int py_line, const char *filename) {
8405     PyCodeObject *py_code = 0;
8406     PyObject *py_srcfile = 0;
8407     PyObject *py_funcname = 0;
8408     #if PY_MAJOR_VERSION < 3
8409     py_srcfile = PyString_FromString(filename);
8410     #else
8411     py_srcfile = PyUnicode_FromString(filename);
8412     #endif
8413     if (!py_srcfile) goto bad;
8414     if (c_line) {
8415         #if PY_MAJOR_VERSION < 3
8416         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8417         #else
8418         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8419         #endif
8420     }
8421     else {
8422         #if PY_MAJOR_VERSION < 3
8423         py_funcname = PyString_FromString(funcname);
8424         #else
8425         py_funcname = PyUnicode_FromString(funcname);
8426         #endif
8427     }
8428     if (!py_funcname) goto bad;
8429     py_code = __Pyx_PyCode_New(
8430         0,
8431         0,
8432         0,
8433         0,
8434         0,
8435         __pyx_empty_bytes, /*PyObject *code,*/
8436         __pyx_empty_tuple, /*PyObject *consts,*/
8437         __pyx_empty_tuple, /*PyObject *names,*/
8438         __pyx_empty_tuple, /*PyObject *varnames,*/
8439         __pyx_empty_tuple, /*PyObject *freevars,*/
8440         __pyx_empty_tuple, /*PyObject *cellvars,*/
8441         py_srcfile,   /*PyObject *filename,*/
8442         py_funcname,  /*PyObject *name,*/
8443         py_line,
8444         __pyx_empty_bytes  /*PyObject *lnotab*/
8445     );
8446     Py_DECREF(py_srcfile);
8447     Py_DECREF(py_funcname);
8448     return py_code;
8449 bad:
8450     Py_XDECREF(py_srcfile);
8451     Py_XDECREF(py_funcname);
8452     return NULL;
8453 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)8454 static void __Pyx_AddTraceback(const char *funcname, int c_line,
8455                                int py_line, const char *filename) {
8456     PyCodeObject *py_code = 0;
8457     PyFrameObject *py_frame = 0;
8458     PyThreadState *tstate = __Pyx_PyThreadState_Current;
8459     if (c_line) {
8460         c_line = __Pyx_CLineForTraceback(tstate, c_line);
8461     }
8462     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
8463     if (!py_code) {
8464         py_code = __Pyx_CreateCodeObjectForTraceback(
8465             funcname, c_line, py_line, filename);
8466         if (!py_code) goto bad;
8467         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
8468     }
8469     py_frame = PyFrame_New(
8470         tstate,            /*PyThreadState *tstate,*/
8471         py_code,           /*PyCodeObject *code,*/
8472         __pyx_d,    /*PyObject *globals,*/
8473         0                  /*PyObject *locals*/
8474     );
8475     if (!py_frame) goto bad;
8476     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
8477     PyTraceBack_Here(py_frame);
8478 bad:
8479     Py_XDECREF(py_code);
8480     Py_XDECREF(py_frame);
8481 }
8482 
8483 /* CIntFromPyVerify */
8484 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
8485     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
8486 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
8487     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
8488 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
8489     {\
8490         func_type value = func_value;\
8491         if (sizeof(target_type) < sizeof(func_type)) {\
8492             if (unlikely(value != (func_type) (target_type) value)) {\
8493                 func_type zero = 0;\
8494                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
8495                     return (target_type) -1;\
8496                 if (is_unsigned && unlikely(value < zero))\
8497                     goto raise_neg_overflow;\
8498                 else\
8499                     goto raise_overflow;\
8500             }\
8501         }\
8502         return (target_type) value;\
8503     }
8504 
8505 /* CIntFromPy */
__Pyx_PyInt_As_PY_LONG_LONG(PyObject * x)8506 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
8507 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8508 #pragma GCC diagnostic push
8509 #pragma GCC diagnostic ignored "-Wconversion"
8510 #endif
8511     const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
8512 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8513 #pragma GCC diagnostic pop
8514 #endif
8515     const int is_unsigned = neg_one > const_zero;
8516 #if PY_MAJOR_VERSION < 3
8517     if (likely(PyInt_Check(x))) {
8518         if (sizeof(PY_LONG_LONG) < sizeof(long)) {
8519             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
8520         } else {
8521             long val = PyInt_AS_LONG(x);
8522             if (is_unsigned && unlikely(val < 0)) {
8523                 goto raise_neg_overflow;
8524             }
8525             return (PY_LONG_LONG) val;
8526         }
8527     } else
8528 #endif
8529     if (likely(PyLong_Check(x))) {
8530         if (is_unsigned) {
8531 #if CYTHON_USE_PYLONG_INTERNALS
8532             const digit* digits = ((PyLongObject*)x)->ob_digit;
8533             switch (Py_SIZE(x)) {
8534                 case  0: return (PY_LONG_LONG) 0;
8535                 case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
8536                 case 2:
8537                     if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
8538                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8539                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8540                         } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
8541                             return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
8542                         }
8543                     }
8544                     break;
8545                 case 3:
8546                     if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
8547                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8548                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8549                         } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
8550                             return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
8551                         }
8552                     }
8553                     break;
8554                 case 4:
8555                     if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
8556                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8557                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8558                         } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
8559                             return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
8560                         }
8561                     }
8562                     break;
8563             }
8564 #endif
8565 #if CYTHON_COMPILING_IN_CPYTHON
8566             if (unlikely(Py_SIZE(x) < 0)) {
8567                 goto raise_neg_overflow;
8568             }
8569 #else
8570             {
8571                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8572                 if (unlikely(result < 0))
8573                     return (PY_LONG_LONG) -1;
8574                 if (unlikely(result == 1))
8575                     goto raise_neg_overflow;
8576             }
8577 #endif
8578             if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
8579                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
8580 #ifdef HAVE_LONG_LONG
8581             } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
8582                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8583 #endif
8584             }
8585         } else {
8586 #if CYTHON_USE_PYLONG_INTERNALS
8587             const digit* digits = ((PyLongObject*)x)->ob_digit;
8588             switch (Py_SIZE(x)) {
8589                 case  0: return (PY_LONG_LONG) 0;
8590                 case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
8591                 case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG,  digit, +digits[0])
8592                 case -2:
8593                     if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
8594                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8595                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8596                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8597                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8598                         }
8599                     }
8600                     break;
8601                 case 2:
8602                     if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
8603                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8604                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8605                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8606                             return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8607                         }
8608                     }
8609                     break;
8610                 case -3:
8611                     if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8612                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8613                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8614                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8615                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8616                         }
8617                     }
8618                     break;
8619                 case 3:
8620                     if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
8621                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8622                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8623                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8624                             return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8625                         }
8626                     }
8627                     break;
8628                 case -4:
8629                     if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8630                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8631                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8632                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8633                             return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8634                         }
8635                     }
8636                     break;
8637                 case 4:
8638                     if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
8639                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8640                             __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8641                         } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8642                             return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
8643                         }
8644                     }
8645                     break;
8646             }
8647 #endif
8648             if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
8649                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
8650 #ifdef HAVE_LONG_LONG
8651             } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
8652                 __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
8653 #endif
8654             }
8655         }
8656         {
8657 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8658             PyErr_SetString(PyExc_RuntimeError,
8659                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8660 #else
8661             PY_LONG_LONG val;
8662             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8663  #if PY_MAJOR_VERSION < 3
8664             if (likely(v) && !PyLong_Check(v)) {
8665                 PyObject *tmp = v;
8666                 v = PyNumber_Long(tmp);
8667                 Py_DECREF(tmp);
8668             }
8669  #endif
8670             if (likely(v)) {
8671                 int one = 1; int is_little = (int)*(unsigned char *)&one;
8672                 unsigned char *bytes = (unsigned char *)&val;
8673                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8674                                               bytes, sizeof(val),
8675                                               is_little, !is_unsigned);
8676                 Py_DECREF(v);
8677                 if (likely(!ret))
8678                     return val;
8679             }
8680 #endif
8681             return (PY_LONG_LONG) -1;
8682         }
8683     } else {
8684         PY_LONG_LONG val;
8685         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8686         if (!tmp) return (PY_LONG_LONG) -1;
8687         val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
8688         Py_DECREF(tmp);
8689         return val;
8690     }
8691 raise_overflow:
8692     PyErr_SetString(PyExc_OverflowError,
8693         "value too large to convert to PY_LONG_LONG");
8694     return (PY_LONG_LONG) -1;
8695 raise_neg_overflow:
8696     PyErr_SetString(PyExc_OverflowError,
8697         "can't convert negative value to PY_LONG_LONG");
8698     return (PY_LONG_LONG) -1;
8699 }
8700 
8701 /* CIntToPy */
__Pyx_PyInt_From_int(int value)8702 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
8703 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8704 #pragma GCC diagnostic push
8705 #pragma GCC diagnostic ignored "-Wconversion"
8706 #endif
8707     const int neg_one = (int) -1, const_zero = (int) 0;
8708 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8709 #pragma GCC diagnostic pop
8710 #endif
8711     const int is_unsigned = neg_one > const_zero;
8712     if (is_unsigned) {
8713         if (sizeof(int) < sizeof(long)) {
8714             return PyInt_FromLong((long) value);
8715         } else if (sizeof(int) <= sizeof(unsigned long)) {
8716             return PyLong_FromUnsignedLong((unsigned long) value);
8717 #ifdef HAVE_LONG_LONG
8718         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8719             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8720 #endif
8721         }
8722     } else {
8723         if (sizeof(int) <= sizeof(long)) {
8724             return PyInt_FromLong((long) value);
8725 #ifdef HAVE_LONG_LONG
8726         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8727             return PyLong_FromLongLong((PY_LONG_LONG) value);
8728 #endif
8729         }
8730     }
8731     {
8732         int one = 1; int little = (int)*(unsigned char *)&one;
8733         unsigned char *bytes = (unsigned char *)&value;
8734         return _PyLong_FromByteArray(bytes, sizeof(int),
8735                                      little, !is_unsigned);
8736     }
8737 }
8738 
8739 /* CIntFromPy */
__Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject * x)8740 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) {
8741 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8742 #pragma GCC diagnostic push
8743 #pragma GCC diagnostic ignored "-Wconversion"
8744 #endif
8745     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0;
8746 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8747 #pragma GCC diagnostic pop
8748 #endif
8749     const int is_unsigned = neg_one > const_zero;
8750 #if PY_MAJOR_VERSION < 3
8751     if (likely(PyInt_Check(x))) {
8752         if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
8753             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, PyInt_AS_LONG(x))
8754         } else {
8755             long val = PyInt_AS_LONG(x);
8756             if (is_unsigned && unlikely(val < 0)) {
8757                 goto raise_neg_overflow;
8758             }
8759             return (unsigned PY_LONG_LONG) val;
8760         }
8761     } else
8762 #endif
8763     if (likely(PyLong_Check(x))) {
8764         if (is_unsigned) {
8765 #if CYTHON_USE_PYLONG_INTERNALS
8766             const digit* digits = ((PyLongObject*)x)->ob_digit;
8767             switch (Py_SIZE(x)) {
8768                 case  0: return (unsigned PY_LONG_LONG) 0;
8769                 case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, digits[0])
8770                 case 2:
8771                     if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
8772                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8773                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8774                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
8775                             return (unsigned PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8776                         }
8777                     }
8778                     break;
8779                 case 3:
8780                     if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
8781                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8782                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8783                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
8784                             return (unsigned PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8785                         }
8786                     }
8787                     break;
8788                 case 4:
8789                     if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
8790                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8791                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8792                         } else if (8 * sizeof(unsigned PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
8793                             return (unsigned PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8794                         }
8795                     }
8796                     break;
8797             }
8798 #endif
8799 #if CYTHON_COMPILING_IN_CPYTHON
8800             if (unlikely(Py_SIZE(x) < 0)) {
8801                 goto raise_neg_overflow;
8802             }
8803 #else
8804             {
8805                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8806                 if (unlikely(result < 0))
8807                     return (unsigned PY_LONG_LONG) -1;
8808                 if (unlikely(result == 1))
8809                     goto raise_neg_overflow;
8810             }
8811 #endif
8812             if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
8813                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
8814 #ifdef HAVE_LONG_LONG
8815             } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
8816                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8817 #endif
8818             }
8819         } else {
8820 #if CYTHON_USE_PYLONG_INTERNALS
8821             const digit* digits = ((PyLongObject*)x)->ob_digit;
8822             switch (Py_SIZE(x)) {
8823                 case  0: return (unsigned PY_LONG_LONG) 0;
8824                 case -1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
8825                 case  1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG,  digit, +digits[0])
8826                 case -2:
8827                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
8828                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8829                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8830                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8831                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8832                         }
8833                     }
8834                     break;
8835                 case 2:
8836                     if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
8837                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8838                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8839                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8840                             return (unsigned PY_LONG_LONG) ((((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8841                         }
8842                     }
8843                     break;
8844                 case -3:
8845                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8846                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8847                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8848                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8849                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8850                         }
8851                     }
8852                     break;
8853                 case 3:
8854                     if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
8855                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8856                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8857                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8858                             return (unsigned PY_LONG_LONG) ((((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8859                         }
8860                     }
8861                     break;
8862                 case -4:
8863                     if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8864                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8865                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8866                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8867                             return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8868                         }
8869                     }
8870                     break;
8871                 case 4:
8872                     if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
8873                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8874                             __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8875                         } else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8876                             return (unsigned PY_LONG_LONG) ((((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
8877                         }
8878                     }
8879                     break;
8880             }
8881 #endif
8882             if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
8883                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, long, PyLong_AsLong(x))
8884 #ifdef HAVE_LONG_LONG
8885             } else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
8886                 __PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
8887 #endif
8888             }
8889         }
8890         {
8891 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8892             PyErr_SetString(PyExc_RuntimeError,
8893                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8894 #else
8895             unsigned PY_LONG_LONG val;
8896             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8897  #if PY_MAJOR_VERSION < 3
8898             if (likely(v) && !PyLong_Check(v)) {
8899                 PyObject *tmp = v;
8900                 v = PyNumber_Long(tmp);
8901                 Py_DECREF(tmp);
8902             }
8903  #endif
8904             if (likely(v)) {
8905                 int one = 1; int is_little = (int)*(unsigned char *)&one;
8906                 unsigned char *bytes = (unsigned char *)&val;
8907                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8908                                               bytes, sizeof(val),
8909                                               is_little, !is_unsigned);
8910                 Py_DECREF(v);
8911                 if (likely(!ret))
8912                     return val;
8913             }
8914 #endif
8915             return (unsigned PY_LONG_LONG) -1;
8916         }
8917     } else {
8918         unsigned PY_LONG_LONG val;
8919         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8920         if (!tmp) return (unsigned PY_LONG_LONG) -1;
8921         val = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(tmp);
8922         Py_DECREF(tmp);
8923         return val;
8924     }
8925 raise_overflow:
8926     PyErr_SetString(PyExc_OverflowError,
8927         "value too large to convert to unsigned PY_LONG_LONG");
8928     return (unsigned PY_LONG_LONG) -1;
8929 raise_neg_overflow:
8930     PyErr_SetString(PyExc_OverflowError,
8931         "can't convert negative value to unsigned PY_LONG_LONG");
8932     return (unsigned PY_LONG_LONG) -1;
8933 }
8934 
8935 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)8936 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
8937 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8938 #pragma GCC diagnostic push
8939 #pragma GCC diagnostic ignored "-Wconversion"
8940 #endif
8941     const long neg_one = (long) -1, const_zero = (long) 0;
8942 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
8943 #pragma GCC diagnostic pop
8944 #endif
8945     const int is_unsigned = neg_one > const_zero;
8946 #if PY_MAJOR_VERSION < 3
8947     if (likely(PyInt_Check(x))) {
8948         if (sizeof(long) < sizeof(long)) {
8949             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
8950         } else {
8951             long val = PyInt_AS_LONG(x);
8952             if (is_unsigned && unlikely(val < 0)) {
8953                 goto raise_neg_overflow;
8954             }
8955             return (long) val;
8956         }
8957     } else
8958 #endif
8959     if (likely(PyLong_Check(x))) {
8960         if (is_unsigned) {
8961 #if CYTHON_USE_PYLONG_INTERNALS
8962             const digit* digits = ((PyLongObject*)x)->ob_digit;
8963             switch (Py_SIZE(x)) {
8964                 case  0: return (long) 0;
8965                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
8966                 case 2:
8967                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8968                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8969                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8970                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
8971                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8972                         }
8973                     }
8974                     break;
8975                 case 3:
8976                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8977                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8978                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8979                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
8980                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8981                         }
8982                     }
8983                     break;
8984                 case 4:
8985                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8986                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8987                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8988                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
8989                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8990                         }
8991                     }
8992                     break;
8993             }
8994 #endif
8995 #if CYTHON_COMPILING_IN_CPYTHON
8996             if (unlikely(Py_SIZE(x) < 0)) {
8997                 goto raise_neg_overflow;
8998             }
8999 #else
9000             {
9001                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9002                 if (unlikely(result < 0))
9003                     return (long) -1;
9004                 if (unlikely(result == 1))
9005                     goto raise_neg_overflow;
9006             }
9007 #endif
9008             if (sizeof(long) <= sizeof(unsigned long)) {
9009                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
9010 #ifdef HAVE_LONG_LONG
9011             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9012                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9013 #endif
9014             }
9015         } else {
9016 #if CYTHON_USE_PYLONG_INTERNALS
9017             const digit* digits = ((PyLongObject*)x)->ob_digit;
9018             switch (Py_SIZE(x)) {
9019                 case  0: return (long) 0;
9020                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
9021                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
9022                 case -2:
9023                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
9024                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9025                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9026                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9027                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9028                         }
9029                     }
9030                     break;
9031                 case 2:
9032                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9033                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9034                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9035                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9036                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9037                         }
9038                     }
9039                     break;
9040                 case -3:
9041                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9042                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9043                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9044                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9045                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9046                         }
9047                     }
9048                     break;
9049                 case 3:
9050                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9051                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9052                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9053                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9054                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9055                         }
9056                     }
9057                     break;
9058                 case -4:
9059                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9060                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9061                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9062                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9063                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9064                         }
9065                     }
9066                     break;
9067                 case 4:
9068                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9069                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9070                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9071                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9072                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9073                         }
9074                     }
9075                     break;
9076             }
9077 #endif
9078             if (sizeof(long) <= sizeof(long)) {
9079                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
9080 #ifdef HAVE_LONG_LONG
9081             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9082                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
9083 #endif
9084             }
9085         }
9086         {
9087 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9088             PyErr_SetString(PyExc_RuntimeError,
9089                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9090 #else
9091             long val;
9092             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9093  #if PY_MAJOR_VERSION < 3
9094             if (likely(v) && !PyLong_Check(v)) {
9095                 PyObject *tmp = v;
9096                 v = PyNumber_Long(tmp);
9097                 Py_DECREF(tmp);
9098             }
9099  #endif
9100             if (likely(v)) {
9101                 int one = 1; int is_little = (int)*(unsigned char *)&one;
9102                 unsigned char *bytes = (unsigned char *)&val;
9103                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9104                                               bytes, sizeof(val),
9105                                               is_little, !is_unsigned);
9106                 Py_DECREF(v);
9107                 if (likely(!ret))
9108                     return val;
9109             }
9110 #endif
9111             return (long) -1;
9112         }
9113     } else {
9114         long val;
9115         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9116         if (!tmp) return (long) -1;
9117         val = __Pyx_PyInt_As_long(tmp);
9118         Py_DECREF(tmp);
9119         return val;
9120     }
9121 raise_overflow:
9122     PyErr_SetString(PyExc_OverflowError,
9123         "value too large to convert to long");
9124     return (long) -1;
9125 raise_neg_overflow:
9126     PyErr_SetString(PyExc_OverflowError,
9127         "can't convert negative value to long");
9128     return (long) -1;
9129 }
9130 
9131 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)9132 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
9133 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9134 #pragma GCC diagnostic push
9135 #pragma GCC diagnostic ignored "-Wconversion"
9136 #endif
9137     const char neg_one = (char) -1, const_zero = (char) 0;
9138 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9139 #pragma GCC diagnostic pop
9140 #endif
9141     const int is_unsigned = neg_one > const_zero;
9142 #if PY_MAJOR_VERSION < 3
9143     if (likely(PyInt_Check(x))) {
9144         if (sizeof(char) < sizeof(long)) {
9145             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
9146         } else {
9147             long val = PyInt_AS_LONG(x);
9148             if (is_unsigned && unlikely(val < 0)) {
9149                 goto raise_neg_overflow;
9150             }
9151             return (char) val;
9152         }
9153     } else
9154 #endif
9155     if (likely(PyLong_Check(x))) {
9156         if (is_unsigned) {
9157 #if CYTHON_USE_PYLONG_INTERNALS
9158             const digit* digits = ((PyLongObject*)x)->ob_digit;
9159             switch (Py_SIZE(x)) {
9160                 case  0: return (char) 0;
9161                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
9162                 case 2:
9163                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
9164                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9165                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9166                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
9167                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
9168                         }
9169                     }
9170                     break;
9171                 case 3:
9172                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
9173                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9174                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9175                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
9176                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
9177                         }
9178                     }
9179                     break;
9180                 case 4:
9181                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
9182                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9183                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9184                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
9185                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
9186                         }
9187                     }
9188                     break;
9189             }
9190 #endif
9191 #if CYTHON_COMPILING_IN_CPYTHON
9192             if (unlikely(Py_SIZE(x) < 0)) {
9193                 goto raise_neg_overflow;
9194             }
9195 #else
9196             {
9197                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9198                 if (unlikely(result < 0))
9199                     return (char) -1;
9200                 if (unlikely(result == 1))
9201                     goto raise_neg_overflow;
9202             }
9203 #endif
9204             if (sizeof(char) <= sizeof(unsigned long)) {
9205                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
9206 #ifdef HAVE_LONG_LONG
9207             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
9208                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9209 #endif
9210             }
9211         } else {
9212 #if CYTHON_USE_PYLONG_INTERNALS
9213             const digit* digits = ((PyLongObject*)x)->ob_digit;
9214             switch (Py_SIZE(x)) {
9215                 case  0: return (char) 0;
9216                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
9217                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
9218                 case -2:
9219                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
9220                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9221                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9222                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
9223                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9224                         }
9225                     }
9226                     break;
9227                 case 2:
9228                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
9229                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9230                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9231                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
9232                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9233                         }
9234                     }
9235                     break;
9236                 case -3:
9237                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
9238                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9239                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9240                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
9241                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9242                         }
9243                     }
9244                     break;
9245                 case 3:
9246                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
9247                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9248                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9249                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
9250                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9251                         }
9252                     }
9253                     break;
9254                 case -4:
9255                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
9256                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9257                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9258                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
9259                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9260                         }
9261                     }
9262                     break;
9263                 case 4:
9264                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
9265                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9266                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9267                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
9268                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
9269                         }
9270                     }
9271                     break;
9272             }
9273 #endif
9274             if (sizeof(char) <= sizeof(long)) {
9275                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
9276 #ifdef HAVE_LONG_LONG
9277             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
9278                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
9279 #endif
9280             }
9281         }
9282         {
9283 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9284             PyErr_SetString(PyExc_RuntimeError,
9285                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9286 #else
9287             char val;
9288             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9289  #if PY_MAJOR_VERSION < 3
9290             if (likely(v) && !PyLong_Check(v)) {
9291                 PyObject *tmp = v;
9292                 v = PyNumber_Long(tmp);
9293                 Py_DECREF(tmp);
9294             }
9295  #endif
9296             if (likely(v)) {
9297                 int one = 1; int is_little = (int)*(unsigned char *)&one;
9298                 unsigned char *bytes = (unsigned char *)&val;
9299                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9300                                               bytes, sizeof(val),
9301                                               is_little, !is_unsigned);
9302                 Py_DECREF(v);
9303                 if (likely(!ret))
9304                     return val;
9305             }
9306 #endif
9307             return (char) -1;
9308         }
9309     } else {
9310         char val;
9311         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9312         if (!tmp) return (char) -1;
9313         val = __Pyx_PyInt_As_char(tmp);
9314         Py_DECREF(tmp);
9315         return val;
9316     }
9317 raise_overflow:
9318     PyErr_SetString(PyExc_OverflowError,
9319         "value too large to convert to char");
9320     return (char) -1;
9321 raise_neg_overflow:
9322     PyErr_SetString(PyExc_OverflowError,
9323         "can't convert negative value to char");
9324     return (char) -1;
9325 }
9326 
9327 /* CIntToPy */
__Pyx_PyInt_From_long(long value)9328 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
9329 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9330 #pragma GCC diagnostic push
9331 #pragma GCC diagnostic ignored "-Wconversion"
9332 #endif
9333     const long neg_one = (long) -1, const_zero = (long) 0;
9334 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9335 #pragma GCC diagnostic pop
9336 #endif
9337     const int is_unsigned = neg_one > const_zero;
9338     if (is_unsigned) {
9339         if (sizeof(long) < sizeof(long)) {
9340             return PyInt_FromLong((long) value);
9341         } else if (sizeof(long) <= sizeof(unsigned long)) {
9342             return PyLong_FromUnsignedLong((unsigned long) value);
9343 #ifdef HAVE_LONG_LONG
9344         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9345             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9346 #endif
9347         }
9348     } else {
9349         if (sizeof(long) <= sizeof(long)) {
9350             return PyInt_FromLong((long) value);
9351 #ifdef HAVE_LONG_LONG
9352         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9353             return PyLong_FromLongLong((PY_LONG_LONG) value);
9354 #endif
9355         }
9356     }
9357     {
9358         int one = 1; int little = (int)*(unsigned char *)&one;
9359         unsigned char *bytes = (unsigned char *)&value;
9360         return _PyLong_FromByteArray(bytes, sizeof(long),
9361                                      little, !is_unsigned);
9362     }
9363 }
9364 
9365 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)9366 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
9367 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9368 #pragma GCC diagnostic push
9369 #pragma GCC diagnostic ignored "-Wconversion"
9370 #endif
9371     const int neg_one = (int) -1, const_zero = (int) 0;
9372 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
9373 #pragma GCC diagnostic pop
9374 #endif
9375     const int is_unsigned = neg_one > const_zero;
9376 #if PY_MAJOR_VERSION < 3
9377     if (likely(PyInt_Check(x))) {
9378         if (sizeof(int) < sizeof(long)) {
9379             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
9380         } else {
9381             long val = PyInt_AS_LONG(x);
9382             if (is_unsigned && unlikely(val < 0)) {
9383                 goto raise_neg_overflow;
9384             }
9385             return (int) val;
9386         }
9387     } else
9388 #endif
9389     if (likely(PyLong_Check(x))) {
9390         if (is_unsigned) {
9391 #if CYTHON_USE_PYLONG_INTERNALS
9392             const digit* digits = ((PyLongObject*)x)->ob_digit;
9393             switch (Py_SIZE(x)) {
9394                 case  0: return (int) 0;
9395                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
9396                 case 2:
9397                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9398                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9399                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9400                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
9401                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9402                         }
9403                     }
9404                     break;
9405                 case 3:
9406                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9407                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9408                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9409                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
9410                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9411                         }
9412                     }
9413                     break;
9414                 case 4:
9415                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9416                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9417                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9418                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
9419                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9420                         }
9421                     }
9422                     break;
9423             }
9424 #endif
9425 #if CYTHON_COMPILING_IN_CPYTHON
9426             if (unlikely(Py_SIZE(x) < 0)) {
9427                 goto raise_neg_overflow;
9428             }
9429 #else
9430             {
9431                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9432                 if (unlikely(result < 0))
9433                     return (int) -1;
9434                 if (unlikely(result == 1))
9435                     goto raise_neg_overflow;
9436             }
9437 #endif
9438             if (sizeof(int) <= sizeof(unsigned long)) {
9439                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
9440 #ifdef HAVE_LONG_LONG
9441             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9442                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9443 #endif
9444             }
9445         } else {
9446 #if CYTHON_USE_PYLONG_INTERNALS
9447             const digit* digits = ((PyLongObject*)x)->ob_digit;
9448             switch (Py_SIZE(x)) {
9449                 case  0: return (int) 0;
9450                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
9451                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
9452                 case -2:
9453                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
9454                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9455                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9456                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9457                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9458                         }
9459                     }
9460                     break;
9461                 case 2:
9462                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9463                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9464                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9465                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9466                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9467                         }
9468                     }
9469                     break;
9470                 case -3:
9471                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9472                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9473                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9474                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9475                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9476                         }
9477                     }
9478                     break;
9479                 case 3:
9480                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9481                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9482                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9483                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9484                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9485                         }
9486                     }
9487                     break;
9488                 case -4:
9489                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9490                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9491                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9492                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9493                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9494                         }
9495                     }
9496                     break;
9497                 case 4:
9498                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9499                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9500                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9501                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9502                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9503                         }
9504                     }
9505                     break;
9506             }
9507 #endif
9508             if (sizeof(int) <= sizeof(long)) {
9509                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
9510 #ifdef HAVE_LONG_LONG
9511             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9512                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
9513 #endif
9514             }
9515         }
9516         {
9517 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9518             PyErr_SetString(PyExc_RuntimeError,
9519                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9520 #else
9521             int val;
9522             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9523  #if PY_MAJOR_VERSION < 3
9524             if (likely(v) && !PyLong_Check(v)) {
9525                 PyObject *tmp = v;
9526                 v = PyNumber_Long(tmp);
9527                 Py_DECREF(tmp);
9528             }
9529  #endif
9530             if (likely(v)) {
9531                 int one = 1; int is_little = (int)*(unsigned char *)&one;
9532                 unsigned char *bytes = (unsigned char *)&val;
9533                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9534                                               bytes, sizeof(val),
9535                                               is_little, !is_unsigned);
9536                 Py_DECREF(v);
9537                 if (likely(!ret))
9538                     return val;
9539             }
9540 #endif
9541             return (int) -1;
9542         }
9543     } else {
9544         int val;
9545         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9546         if (!tmp) return (int) -1;
9547         val = __Pyx_PyInt_As_int(tmp);
9548         Py_DECREF(tmp);
9549         return val;
9550     }
9551 raise_overflow:
9552     PyErr_SetString(PyExc_OverflowError,
9553         "value too large to convert to int");
9554     return (int) -1;
9555 raise_neg_overflow:
9556     PyErr_SetString(PyExc_OverflowError,
9557         "can't convert negative value to int");
9558     return (int) -1;
9559 }
9560 
9561 /* FastTypeChecks */
9562 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)9563 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
9564     while (a) {
9565         a = a->tp_base;
9566         if (a == b)
9567             return 1;
9568     }
9569     return b == &PyBaseObject_Type;
9570 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)9571 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
9572     PyObject *mro;
9573     if (a == b) return 1;
9574     mro = a->tp_mro;
9575     if (likely(mro)) {
9576         Py_ssize_t i, n;
9577         n = PyTuple_GET_SIZE(mro);
9578         for (i = 0; i < n; i++) {
9579             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
9580                 return 1;
9581         }
9582         return 0;
9583     }
9584     return __Pyx_InBases(a, b);
9585 }
9586 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9587 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
9588     PyObject *exception, *value, *tb;
9589     int res;
9590     __Pyx_PyThreadState_declare
9591     __Pyx_PyThreadState_assign
9592     __Pyx_ErrFetch(&exception, &value, &tb);
9593     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
9594     if (unlikely(res == -1)) {
9595         PyErr_WriteUnraisable(err);
9596         res = 0;
9597     }
9598     if (!res) {
9599         res = PyObject_IsSubclass(err, exc_type2);
9600         if (unlikely(res == -1)) {
9601             PyErr_WriteUnraisable(err);
9602             res = 0;
9603         }
9604     }
9605     __Pyx_ErrRestore(exception, value, tb);
9606     return res;
9607 }
9608 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9609 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
9610     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
9611     if (!res) {
9612         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
9613     }
9614     return res;
9615 }
9616 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)9617 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9618     Py_ssize_t i, n;
9619     assert(PyExceptionClass_Check(exc_type));
9620     n = PyTuple_GET_SIZE(tuple);
9621 #if PY_MAJOR_VERSION >= 3
9622     for (i=0; i<n; i++) {
9623         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9624     }
9625 #endif
9626     for (i=0; i<n; i++) {
9627         PyObject *t = PyTuple_GET_ITEM(tuple, i);
9628         #if PY_MAJOR_VERSION < 3
9629         if (likely(exc_type == t)) return 1;
9630         #endif
9631         if (likely(PyExceptionClass_Check(t))) {
9632             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
9633         } else {
9634         }
9635     }
9636     return 0;
9637 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)9638 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
9639     if (likely(err == exc_type)) return 1;
9640     if (likely(PyExceptionClass_Check(err))) {
9641         if (likely(PyExceptionClass_Check(exc_type))) {
9642             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
9643         } else if (likely(PyTuple_Check(exc_type))) {
9644             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
9645         } else {
9646         }
9647     }
9648     return PyErr_GivenExceptionMatches(err, exc_type);
9649 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9650 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
9651     assert(PyExceptionClass_Check(exc_type1));
9652     assert(PyExceptionClass_Check(exc_type2));
9653     if (likely(err == exc_type1 || err == exc_type2)) return 1;
9654     if (likely(PyExceptionClass_Check(err))) {
9655         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
9656     }
9657     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
9658 }
9659 #endif
9660 
9661 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)9662 static int __Pyx_check_binary_version(void) {
9663     char ctversion[4], rtversion[4];
9664     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
9665     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
9666     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
9667         char message[200];
9668         PyOS_snprintf(message, sizeof(message),
9669                       "compiletime version %s of module '%.100s' "
9670                       "does not match runtime version %s",
9671                       ctversion, __Pyx_MODULE_NAME, rtversion);
9672         return PyErr_WarnEx(NULL, message, 1);
9673     }
9674     return 0;
9675 }
9676 
9677 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)9678 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9679     while (t->p) {
9680         #if PY_MAJOR_VERSION < 3
9681         if (t->is_unicode) {
9682             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9683         } else if (t->intern) {
9684             *t->p = PyString_InternFromString(t->s);
9685         } else {
9686             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9687         }
9688         #else
9689         if (t->is_unicode | t->is_str) {
9690             if (t->intern) {
9691                 *t->p = PyUnicode_InternFromString(t->s);
9692             } else if (t->encoding) {
9693                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9694             } else {
9695                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9696             }
9697         } else {
9698             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9699         }
9700         #endif
9701         if (!*t->p)
9702             return -1;
9703         if (PyObject_Hash(*t->p) == -1)
9704             return -1;
9705         ++t;
9706     }
9707     return 0;
9708 }
9709 
__Pyx_PyUnicode_FromString(const char * c_str)9710 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9711     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9712 }
__Pyx_PyObject_AsString(PyObject * o)9713 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
9714     Py_ssize_t ignore;
9715     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9716 }
9717 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9718 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)9719 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9720     char* defenc_c;
9721     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9722     if (!defenc) return NULL;
9723     defenc_c = PyBytes_AS_STRING(defenc);
9724 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9725     {
9726         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
9727         char* c;
9728         for (c = defenc_c; c < end; c++) {
9729             if ((unsigned char) (*c) >= 128) {
9730                 PyUnicode_AsASCIIString(o);
9731                 return NULL;
9732             }
9733         }
9734     }
9735 #endif
9736     *length = PyBytes_GET_SIZE(defenc);
9737     return defenc_c;
9738 }
9739 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)9740 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9741     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
9742 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9743     if (likely(PyUnicode_IS_ASCII(o))) {
9744         *length = PyUnicode_GET_LENGTH(o);
9745         return PyUnicode_AsUTF8(o);
9746     } else {
9747         PyUnicode_AsASCIIString(o);
9748         return NULL;
9749     }
9750 #else
9751     return PyUnicode_AsUTF8AndSize(o, length);
9752 #endif
9753 }
9754 #endif
9755 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)9756 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9757 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9758     if (
9759 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9760             __Pyx_sys_getdefaultencoding_not_ascii &&
9761 #endif
9762             PyUnicode_Check(o)) {
9763         return __Pyx_PyUnicode_AsStringAndSize(o, length);
9764     } else
9765 #endif
9766 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
9767     if (PyByteArray_Check(o)) {
9768         *length = PyByteArray_GET_SIZE(o);
9769         return PyByteArray_AS_STRING(o);
9770     } else
9771 #endif
9772     {
9773         char* result;
9774         int r = PyBytes_AsStringAndSize(o, &result, length);
9775         if (unlikely(r < 0)) {
9776             return NULL;
9777         } else {
9778             return result;
9779         }
9780     }
9781 }
__Pyx_PyObject_IsTrue(PyObject * x)9782 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9783    int is_true = x == Py_True;
9784    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9785    else return PyObject_IsTrue(x);
9786 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)9787 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
9788     int retval;
9789     if (unlikely(!x)) return -1;
9790     retval = __Pyx_PyObject_IsTrue(x);
9791     Py_DECREF(x);
9792     return retval;
9793 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)9794 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
9795 #if PY_MAJOR_VERSION >= 3
9796     if (PyLong_Check(result)) {
9797         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
9798                 "__int__ returned non-int (type %.200s).  "
9799                 "The ability to return an instance of a strict subclass of int "
9800                 "is deprecated, and may be removed in a future version of Python.",
9801                 Py_TYPE(result)->tp_name)) {
9802             Py_DECREF(result);
9803             return NULL;
9804         }
9805         return result;
9806     }
9807 #endif
9808     PyErr_Format(PyExc_TypeError,
9809                  "__%.4s__ returned non-%.4s (type %.200s)",
9810                  type_name, type_name, Py_TYPE(result)->tp_name);
9811     Py_DECREF(result);
9812     return NULL;
9813 }
__Pyx_PyNumber_IntOrLong(PyObject * x)9814 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
9815 #if CYTHON_USE_TYPE_SLOTS
9816   PyNumberMethods *m;
9817 #endif
9818   const char *name = NULL;
9819   PyObject *res = NULL;
9820 #if PY_MAJOR_VERSION < 3
9821   if (likely(PyInt_Check(x) || PyLong_Check(x)))
9822 #else
9823   if (likely(PyLong_Check(x)))
9824 #endif
9825     return __Pyx_NewRef(x);
9826 #if CYTHON_USE_TYPE_SLOTS
9827   m = Py_TYPE(x)->tp_as_number;
9828   #if PY_MAJOR_VERSION < 3
9829   if (m && m->nb_int) {
9830     name = "int";
9831     res = m->nb_int(x);
9832   }
9833   else if (m && m->nb_long) {
9834     name = "long";
9835     res = m->nb_long(x);
9836   }
9837   #else
9838   if (likely(m && m->nb_int)) {
9839     name = "int";
9840     res = m->nb_int(x);
9841   }
9842   #endif
9843 #else
9844   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
9845     res = PyNumber_Int(x);
9846   }
9847 #endif
9848   if (likely(res)) {
9849 #if PY_MAJOR_VERSION < 3
9850     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
9851 #else
9852     if (unlikely(!PyLong_CheckExact(res))) {
9853 #endif
9854         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
9855     }
9856   }
9857   else if (!PyErr_Occurred()) {
9858     PyErr_SetString(PyExc_TypeError,
9859                     "an integer is required");
9860   }
9861   return res;
9862 }
9863 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9864   Py_ssize_t ival;
9865   PyObject *x;
9866 #if PY_MAJOR_VERSION < 3
9867   if (likely(PyInt_CheckExact(b))) {
9868     if (sizeof(Py_ssize_t) >= sizeof(long))
9869         return PyInt_AS_LONG(b);
9870     else
9871         return PyInt_AsSsize_t(b);
9872   }
9873 #endif
9874   if (likely(PyLong_CheckExact(b))) {
9875     #if CYTHON_USE_PYLONG_INTERNALS
9876     const digit* digits = ((PyLongObject*)b)->ob_digit;
9877     const Py_ssize_t size = Py_SIZE(b);
9878     if (likely(__Pyx_sst_abs(size) <= 1)) {
9879         ival = likely(size) ? digits[0] : 0;
9880         if (size == -1) ival = -ival;
9881         return ival;
9882     } else {
9883       switch (size) {
9884          case 2:
9885            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9886              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9887            }
9888            break;
9889          case -2:
9890            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9891              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9892            }
9893            break;
9894          case 3:
9895            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9896              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9897            }
9898            break;
9899          case -3:
9900            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9901              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9902            }
9903            break;
9904          case 4:
9905            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9906              return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9907            }
9908            break;
9909          case -4:
9910            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9911              return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9912            }
9913            break;
9914       }
9915     }
9916     #endif
9917     return PyLong_AsSsize_t(b);
9918   }
9919   x = PyNumber_Index(b);
9920   if (!x) return -1;
9921   ival = PyInt_AsSsize_t(x);
9922   Py_DECREF(x);
9923   return ival;
9924 }
9925 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
9926   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
9927 }
9928 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9929     return PyInt_FromSize_t(ival);
9930 }
9931 
9932 
9933 #endif /* Py_PYTHON_H */
9934