1 /* Generated by Cython 0.29.23 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "depends": [
7 "gssapi/raw/python_gssapi.h",
8 "gssapi/raw/python_gssapi_ext.h"
9 ],
10 "extra_compile_args": [
11 "-DHAS_GSSAPI_EXT_H"
12 ],
13 "extra_link_args": [
14 "-Wl,-z,relro",
15 "-Wl,--as-needed",
16 "-Wl,-z,now"
17 ],
18 "include_dirs": [
19 "gssapi/raw",
20 "./gssapi/raw"
21 ],
22 "libraries": [
23 "gssapi_krb5",
24 "krb5",
25 "k5crypto",
26 "com_err"
27 ],
28 "name": "gssapi.raw.ext_cred_imp_exp",
29 "sources": [
30 "gssapi/raw/ext_cred_imp_exp.pyx"
31 ]
32 },
33 "module_name": "gssapi.raw.ext_cred_imp_exp"
34 }
35 END: Cython Metadata */
36
37 #ifndef PY_SSIZE_T_CLEAN
38 #define PY_SSIZE_T_CLEAN
39 #endif /* PY_SSIZE_T_CLEAN */
40 #include "Python.h"
41 #ifndef Py_PYTHON_H
42 #error Python headers needed to compile C extensions, please install development version of Python.
43 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
44 #error Cython requires Python 2.6+ or Python 3.3+.
45 #else
46 #define CYTHON_ABI "0_29_23"
47 #define CYTHON_HEX_VERSION 0x001D17F0
48 #define CYTHON_FUTURE_DIVISION 0
49 #include <stddef.h>
50 #ifndef offsetof
51 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
52 #endif
53 #if !defined(WIN32) && !defined(MS_WINDOWS)
54 #ifndef __stdcall
55 #define __stdcall
56 #endif
57 #ifndef __cdecl
58 #define __cdecl
59 #endif
60 #ifndef __fastcall
61 #define __fastcall
62 #endif
63 #endif
64 #ifndef DL_IMPORT
65 #define DL_IMPORT(t) t
66 #endif
67 #ifndef DL_EXPORT
68 #define DL_EXPORT(t) t
69 #endif
70 #define __PYX_COMMA ,
71 #ifndef HAVE_LONG_LONG
72 #if PY_VERSION_HEX >= 0x02070000
73 #define HAVE_LONG_LONG
74 #endif
75 #endif
76 #ifndef PY_LONG_LONG
77 #define PY_LONG_LONG LONG_LONG
78 #endif
79 #ifndef Py_HUGE_VAL
80 #define Py_HUGE_VAL HUGE_VAL
81 #endif
82 #ifdef PYPY_VERSION
83 #define CYTHON_COMPILING_IN_PYPY 1
84 #define CYTHON_COMPILING_IN_PYSTON 0
85 #define CYTHON_COMPILING_IN_CPYTHON 0
86 #undef CYTHON_USE_TYPE_SLOTS
87 #define CYTHON_USE_TYPE_SLOTS 0
88 #undef CYTHON_USE_PYTYPE_LOOKUP
89 #define CYTHON_USE_PYTYPE_LOOKUP 0
90 #if PY_VERSION_HEX < 0x03050000
91 #undef CYTHON_USE_ASYNC_SLOTS
92 #define CYTHON_USE_ASYNC_SLOTS 0
93 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
94 #define CYTHON_USE_ASYNC_SLOTS 1
95 #endif
96 #undef CYTHON_USE_PYLIST_INTERNALS
97 #define CYTHON_USE_PYLIST_INTERNALS 0
98 #undef CYTHON_USE_UNICODE_INTERNALS
99 #define CYTHON_USE_UNICODE_INTERNALS 0
100 #undef CYTHON_USE_UNICODE_WRITER
101 #define CYTHON_USE_UNICODE_WRITER 0
102 #undef CYTHON_USE_PYLONG_INTERNALS
103 #define CYTHON_USE_PYLONG_INTERNALS 0
104 #undef CYTHON_AVOID_BORROWED_REFS
105 #define CYTHON_AVOID_BORROWED_REFS 1
106 #undef CYTHON_ASSUME_SAFE_MACROS
107 #define CYTHON_ASSUME_SAFE_MACROS 0
108 #undef CYTHON_UNPACK_METHODS
109 #define CYTHON_UNPACK_METHODS 0
110 #undef CYTHON_FAST_THREAD_STATE
111 #define CYTHON_FAST_THREAD_STATE 0
112 #undef CYTHON_FAST_PYCALL
113 #define CYTHON_FAST_PYCALL 0
114 #undef CYTHON_PEP489_MULTI_PHASE_INIT
115 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
116 #undef CYTHON_USE_TP_FINALIZE
117 #define CYTHON_USE_TP_FINALIZE 0
118 #undef CYTHON_USE_DICT_VERSIONS
119 #define CYTHON_USE_DICT_VERSIONS 0
120 #undef CYTHON_USE_EXC_INFO_STACK
121 #define CYTHON_USE_EXC_INFO_STACK 0
122 #elif defined(PYSTON_VERSION)
123 #define CYTHON_COMPILING_IN_PYPY 0
124 #define CYTHON_COMPILING_IN_PYSTON 1
125 #define CYTHON_COMPILING_IN_CPYTHON 0
126 #ifndef CYTHON_USE_TYPE_SLOTS
127 #define CYTHON_USE_TYPE_SLOTS 1
128 #endif
129 #undef CYTHON_USE_PYTYPE_LOOKUP
130 #define CYTHON_USE_PYTYPE_LOOKUP 0
131 #undef CYTHON_USE_ASYNC_SLOTS
132 #define CYTHON_USE_ASYNC_SLOTS 0
133 #undef CYTHON_USE_PYLIST_INTERNALS
134 #define CYTHON_USE_PYLIST_INTERNALS 0
135 #ifndef CYTHON_USE_UNICODE_INTERNALS
136 #define CYTHON_USE_UNICODE_INTERNALS 1
137 #endif
138 #undef CYTHON_USE_UNICODE_WRITER
139 #define CYTHON_USE_UNICODE_WRITER 0
140 #undef CYTHON_USE_PYLONG_INTERNALS
141 #define CYTHON_USE_PYLONG_INTERNALS 0
142 #ifndef CYTHON_AVOID_BORROWED_REFS
143 #define CYTHON_AVOID_BORROWED_REFS 0
144 #endif
145 #ifndef CYTHON_ASSUME_SAFE_MACROS
146 #define CYTHON_ASSUME_SAFE_MACROS 1
147 #endif
148 #ifndef CYTHON_UNPACK_METHODS
149 #define CYTHON_UNPACK_METHODS 1
150 #endif
151 #undef CYTHON_FAST_THREAD_STATE
152 #define CYTHON_FAST_THREAD_STATE 0
153 #undef CYTHON_FAST_PYCALL
154 #define CYTHON_FAST_PYCALL 0
155 #undef CYTHON_PEP489_MULTI_PHASE_INIT
156 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
157 #undef CYTHON_USE_TP_FINALIZE
158 #define CYTHON_USE_TP_FINALIZE 0
159 #undef CYTHON_USE_DICT_VERSIONS
160 #define CYTHON_USE_DICT_VERSIONS 0
161 #undef CYTHON_USE_EXC_INFO_STACK
162 #define CYTHON_USE_EXC_INFO_STACK 0
163 #else
164 #define CYTHON_COMPILING_IN_PYPY 0
165 #define CYTHON_COMPILING_IN_PYSTON 0
166 #define CYTHON_COMPILING_IN_CPYTHON 1
167 #ifndef CYTHON_USE_TYPE_SLOTS
168 #define CYTHON_USE_TYPE_SLOTS 1
169 #endif
170 #if PY_VERSION_HEX < 0x02070000
171 #undef CYTHON_USE_PYTYPE_LOOKUP
172 #define CYTHON_USE_PYTYPE_LOOKUP 0
173 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
174 #define CYTHON_USE_PYTYPE_LOOKUP 1
175 #endif
176 #if PY_MAJOR_VERSION < 3
177 #undef CYTHON_USE_ASYNC_SLOTS
178 #define CYTHON_USE_ASYNC_SLOTS 0
179 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
180 #define CYTHON_USE_ASYNC_SLOTS 1
181 #endif
182 #if PY_VERSION_HEX < 0x02070000
183 #undef CYTHON_USE_PYLONG_INTERNALS
184 #define CYTHON_USE_PYLONG_INTERNALS 0
185 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
186 #define CYTHON_USE_PYLONG_INTERNALS 1
187 #endif
188 #ifndef CYTHON_USE_PYLIST_INTERNALS
189 #define CYTHON_USE_PYLIST_INTERNALS 1
190 #endif
191 #ifndef CYTHON_USE_UNICODE_INTERNALS
192 #define CYTHON_USE_UNICODE_INTERNALS 1
193 #endif
194 #if PY_VERSION_HEX < 0x030300F0
195 #undef CYTHON_USE_UNICODE_WRITER
196 #define CYTHON_USE_UNICODE_WRITER 0
197 #elif !defined(CYTHON_USE_UNICODE_WRITER)
198 #define CYTHON_USE_UNICODE_WRITER 1
199 #endif
200 #ifndef CYTHON_AVOID_BORROWED_REFS
201 #define CYTHON_AVOID_BORROWED_REFS 0
202 #endif
203 #ifndef CYTHON_ASSUME_SAFE_MACROS
204 #define CYTHON_ASSUME_SAFE_MACROS 1
205 #endif
206 #ifndef CYTHON_UNPACK_METHODS
207 #define CYTHON_UNPACK_METHODS 1
208 #endif
209 #ifndef CYTHON_FAST_THREAD_STATE
210 #define CYTHON_FAST_THREAD_STATE 1
211 #endif
212 #ifndef CYTHON_FAST_PYCALL
213 #define CYTHON_FAST_PYCALL 1
214 #endif
215 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
216 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
217 #endif
218 #ifndef CYTHON_USE_TP_FINALIZE
219 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
220 #endif
221 #ifndef CYTHON_USE_DICT_VERSIONS
222 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
223 #endif
224 #ifndef CYTHON_USE_EXC_INFO_STACK
225 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
226 #endif
227 #endif
228 #if !defined(CYTHON_FAST_PYCCALL)
229 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
230 #endif
231 #if CYTHON_USE_PYLONG_INTERNALS
232 #include "longintrepr.h"
233 #undef SHIFT
234 #undef BASE
235 #undef MASK
236 #ifdef SIZEOF_VOID_P
237 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
238 #endif
239 #endif
240 #ifndef __has_attribute
241 #define __has_attribute(x) 0
242 #endif
243 #ifndef __has_cpp_attribute
244 #define __has_cpp_attribute(x) 0
245 #endif
246 #ifndef CYTHON_RESTRICT
247 #if defined(__GNUC__)
248 #define CYTHON_RESTRICT __restrict__
249 #elif defined(_MSC_VER) && _MSC_VER >= 1400
250 #define CYTHON_RESTRICT __restrict
251 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
252 #define CYTHON_RESTRICT restrict
253 #else
254 #define CYTHON_RESTRICT
255 #endif
256 #endif
257 #ifndef CYTHON_UNUSED
258 # if defined(__GNUC__)
259 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
260 # define CYTHON_UNUSED __attribute__ ((__unused__))
261 # else
262 # define CYTHON_UNUSED
263 # endif
264 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
265 # define CYTHON_UNUSED __attribute__ ((__unused__))
266 # else
267 # define CYTHON_UNUSED
268 # endif
269 #endif
270 #ifndef CYTHON_MAYBE_UNUSED_VAR
271 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)272 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
273 # else
274 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
275 # endif
276 #endif
277 #ifndef CYTHON_NCP_UNUSED
278 # if CYTHON_COMPILING_IN_CPYTHON
279 # define CYTHON_NCP_UNUSED
280 # else
281 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
282 # endif
283 #endif
284 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
285 #ifdef _MSC_VER
286 #ifndef _MSC_STDINT_H_
287 #if _MSC_VER < 1300
288 typedef unsigned char uint8_t;
289 typedef unsigned int uint32_t;
290 #else
291 typedef unsigned __int8 uint8_t;
292 typedef unsigned __int32 uint32_t;
293 #endif
294 #endif
295 #else
296 #include <stdint.h>
297 #endif
298 #ifndef CYTHON_FALLTHROUGH
299 #if defined(__cplusplus) && __cplusplus >= 201103L
300 #if __has_cpp_attribute(fallthrough)
301 #define CYTHON_FALLTHROUGH [[fallthrough]]
302 #elif __has_cpp_attribute(clang::fallthrough)
303 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
304 #elif __has_cpp_attribute(gnu::fallthrough)
305 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
306 #endif
307 #endif
308 #ifndef CYTHON_FALLTHROUGH
309 #if __has_attribute(fallthrough)
310 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
311 #else
312 #define CYTHON_FALLTHROUGH
313 #endif
314 #endif
315 #if defined(__clang__ ) && defined(__apple_build_version__)
316 #if __apple_build_version__ < 7000000
317 #undef CYTHON_FALLTHROUGH
318 #define CYTHON_FALLTHROUGH
319 #endif
320 #endif
321 #endif
322
323 #ifndef CYTHON_INLINE
324 #if defined(__clang__)
325 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
326 #elif defined(__GNUC__)
327 #define CYTHON_INLINE __inline__
328 #elif defined(_MSC_VER)
329 #define CYTHON_INLINE __inline
330 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
331 #define CYTHON_INLINE inline
332 #else
333 #define CYTHON_INLINE
334 #endif
335 #endif
336
337 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
338 #define Py_OptimizeFlag 0
339 #endif
340 #define __PYX_BUILD_PY_SSIZE_T "n"
341 #define CYTHON_FORMAT_SSIZE_T "z"
342 #if PY_MAJOR_VERSION < 3
343 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
344 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
345 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
346 #define __Pyx_DefaultClassType PyClass_Type
347 #else
348 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
349 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
350 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
351 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
352 #else
353 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
354 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
355 #endif
356 #define __Pyx_DefaultClassType PyType_Type
357 #endif
358 #ifndef Py_TPFLAGS_CHECKTYPES
359 #define Py_TPFLAGS_CHECKTYPES 0
360 #endif
361 #ifndef Py_TPFLAGS_HAVE_INDEX
362 #define Py_TPFLAGS_HAVE_INDEX 0
363 #endif
364 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
365 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
366 #endif
367 #ifndef Py_TPFLAGS_HAVE_FINALIZE
368 #define Py_TPFLAGS_HAVE_FINALIZE 0
369 #endif
370 #ifndef METH_STACKLESS
371 #define METH_STACKLESS 0
372 #endif
373 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
374 #ifndef METH_FASTCALL
375 #define METH_FASTCALL 0x80
376 #endif
377 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
378 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
379 Py_ssize_t nargs, PyObject *kwnames);
380 #else
381 #define __Pyx_PyCFunctionFast _PyCFunctionFast
382 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
383 #endif
384 #if CYTHON_FAST_PYCCALL
385 #define __Pyx_PyFastCFunction_Check(func)\
386 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
387 #else
388 #define __Pyx_PyFastCFunction_Check(func) 0
389 #endif
390 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
391 #define PyObject_Malloc(s) PyMem_Malloc(s)
392 #define PyObject_Free(p) PyMem_Free(p)
393 #define PyObject_Realloc(p) PyMem_Realloc(p)
394 #endif
395 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
396 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
397 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
398 #define PyMem_RawFree(p) PyMem_Free(p)
399 #endif
400 #if CYTHON_COMPILING_IN_PYSTON
401 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
402 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
403 #else
404 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
405 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
406 #endif
407 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
408 #define __Pyx_PyThreadState_Current PyThreadState_GET()
409 #elif PY_VERSION_HEX >= 0x03060000
410 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
411 #elif PY_VERSION_HEX >= 0x03000000
412 #define __Pyx_PyThreadState_Current PyThreadState_GET()
413 #else
414 #define __Pyx_PyThreadState_Current _PyThreadState_Current
415 #endif
416 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
417 #include "pythread.h"
418 #define Py_tss_NEEDS_INIT 0
419 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)420 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
421 *key = PyThread_create_key();
422 return 0;
423 }
PyThread_tss_alloc(void)424 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
425 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
426 *key = Py_tss_NEEDS_INIT;
427 return key;
428 }
PyThread_tss_free(Py_tss_t * key)429 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
430 PyObject_Free(key);
431 }
PyThread_tss_is_created(Py_tss_t * key)432 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
433 return *key != Py_tss_NEEDS_INIT;
434 }
PyThread_tss_delete(Py_tss_t * key)435 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
436 PyThread_delete_key(*key);
437 *key = Py_tss_NEEDS_INIT;
438 }
PyThread_tss_set(Py_tss_t * key,void * value)439 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
440 return PyThread_set_key_value(*key, value);
441 }
PyThread_tss_get(Py_tss_t * key)442 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
443 return PyThread_get_key_value(*key);
444 }
445 #endif
446 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
447 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
448 #else
449 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
450 #endif
451 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
452 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
453 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
454 #else
455 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
456 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
457 #endif
458 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
459 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
460 #else
461 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
462 #endif
463 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
464 #define CYTHON_PEP393_ENABLED 1
465 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
466 0 : _PyUnicode_Ready((PyObject *)(op)))
467 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
468 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
469 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
470 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
471 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
472 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
473 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
474 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
475 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
476 #else
477 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
478 #endif
479 #else
480 #define CYTHON_PEP393_ENABLED 0
481 #define PyUnicode_1BYTE_KIND 1
482 #define PyUnicode_2BYTE_KIND 2
483 #define PyUnicode_4BYTE_KIND 4
484 #define __Pyx_PyUnicode_READY(op) (0)
485 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
486 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
487 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
488 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
489 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
490 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
491 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
492 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
493 #endif
494 #if CYTHON_COMPILING_IN_PYPY
495 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
496 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
497 #else
498 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
499 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
500 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
501 #endif
502 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
503 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
504 #endif
505 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
506 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
507 #endif
508 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
509 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
510 #endif
511 #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))
512 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
513 #if PY_MAJOR_VERSION >= 3
514 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
515 #else
516 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
517 #endif
518 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
519 #define PyObject_ASCII(o) PyObject_Repr(o)
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522 #define PyBaseString_Type PyUnicode_Type
523 #define PyStringObject PyUnicodeObject
524 #define PyString_Type PyUnicode_Type
525 #define PyString_Check PyUnicode_Check
526 #define PyString_CheckExact PyUnicode_CheckExact
527 #ifndef PyObject_Unicode
528 #define PyObject_Unicode PyObject_Str
529 #endif
530 #endif
531 #if PY_MAJOR_VERSION >= 3
532 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
533 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
534 #else
535 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
536 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
537 #endif
538 #ifndef PySet_CheckExact
539 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
540 #endif
541 #if PY_VERSION_HEX >= 0x030900A4
542 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
543 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
544 #else
545 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
546 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
547 #endif
548 #if CYTHON_ASSUME_SAFE_MACROS
549 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
550 #else
551 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
552 #endif
553 #if PY_MAJOR_VERSION >= 3
554 #define PyIntObject PyLongObject
555 #define PyInt_Type PyLong_Type
556 #define PyInt_Check(op) PyLong_Check(op)
557 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
558 #define PyInt_FromString PyLong_FromString
559 #define PyInt_FromUnicode PyLong_FromUnicode
560 #define PyInt_FromLong PyLong_FromLong
561 #define PyInt_FromSize_t PyLong_FromSize_t
562 #define PyInt_FromSsize_t PyLong_FromSsize_t
563 #define PyInt_AsLong PyLong_AsLong
564 #define PyInt_AS_LONG PyLong_AS_LONG
565 #define PyInt_AsSsize_t PyLong_AsSsize_t
566 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
567 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
568 #define PyNumber_Int PyNumber_Long
569 #endif
570 #if PY_MAJOR_VERSION >= 3
571 #define PyBoolObject PyLongObject
572 #endif
573 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
574 #ifndef PyUnicode_InternFromString
575 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
576 #endif
577 #endif
578 #if PY_VERSION_HEX < 0x030200A4
579 typedef long Py_hash_t;
580 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
581 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
582 #else
583 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
584 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
585 #endif
586 #if PY_MAJOR_VERSION >= 3
587 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
588 #else
589 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
590 #endif
591 #if CYTHON_USE_ASYNC_SLOTS
592 #if PY_VERSION_HEX >= 0x030500B1
593 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
594 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
595 #else
596 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
597 #endif
598 #else
599 #define __Pyx_PyType_AsAsync(obj) NULL
600 #endif
601 #ifndef __Pyx_PyAsyncMethodsStruct
602 typedef struct {
603 unaryfunc am_await;
604 unaryfunc am_aiter;
605 unaryfunc am_anext;
606 } __Pyx_PyAsyncMethodsStruct;
607 #endif
608
609 #if defined(WIN32) || defined(MS_WINDOWS)
610 #define _USE_MATH_DEFINES
611 #endif
612 #include <math.h>
613 #ifdef NAN
614 #define __PYX_NAN() ((float) NAN)
615 #else
__PYX_NAN()616 static CYTHON_INLINE float __PYX_NAN() {
617 float value;
618 memset(&value, 0xFF, sizeof(value));
619 return value;
620 }
621 #endif
622 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
623 #define __Pyx_truncl trunc
624 #else
625 #define __Pyx_truncl truncl
626 #endif
627
628 #define __PYX_MARK_ERR_POS(f_index, lineno) \
629 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
630 #define __PYX_ERR(f_index, lineno, Ln_error) \
631 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
632
633 #ifndef __PYX_EXTERN_C
634 #ifdef __cplusplus
635 #define __PYX_EXTERN_C extern "C"
636 #else
637 #define __PYX_EXTERN_C extern
638 #endif
639 #endif
640
641 #define __PYX_HAVE__gssapi__raw__ext_cred_imp_exp
642 #define __PYX_HAVE_API__gssapi__raw__ext_cred_imp_exp
643 /* Early includes */
644 #include <stdint.h>
645 #include "python_gssapi.h"
646 #include <string.h>
647 #include "python_gssapi_ext.h"
648 #ifdef _OPENMP
649 #include <omp.h>
650 #endif /* _OPENMP */
651
652 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
653 #define CYTHON_WITHOUT_ASSERTIONS
654 #endif
655
656 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
657 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
658
659 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
660 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
661 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
662 #define __PYX_DEFAULT_STRING_ENCODING ""
663 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
664 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
665 #define __Pyx_uchar_cast(c) ((unsigned char)c)
666 #define __Pyx_long_cast(x) ((long)x)
667 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
668 (sizeof(type) < sizeof(Py_ssize_t)) ||\
669 (sizeof(type) > sizeof(Py_ssize_t) &&\
670 likely(v < (type)PY_SSIZE_T_MAX ||\
671 v == (type)PY_SSIZE_T_MAX) &&\
672 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
673 v == (type)PY_SSIZE_T_MIN))) ||\
674 (sizeof(type) == sizeof(Py_ssize_t) &&\
675 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
676 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)677 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
678 return (size_t) i < (size_t) limit;
679 }
680 #if defined (__cplusplus) && __cplusplus >= 201103L
681 #include <cstdlib>
682 #define __Pyx_sst_abs(value) std::abs(value)
683 #elif SIZEOF_INT >= SIZEOF_SIZE_T
684 #define __Pyx_sst_abs(value) abs(value)
685 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
686 #define __Pyx_sst_abs(value) labs(value)
687 #elif defined (_MSC_VER)
688 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
689 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
690 #define __Pyx_sst_abs(value) llabs(value)
691 #elif defined (__GNUC__)
692 #define __Pyx_sst_abs(value) __builtin_llabs(value)
693 #else
694 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
695 #endif
696 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
697 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
698 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
699 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
700 #define __Pyx_PyBytes_FromString PyBytes_FromString
701 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
702 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
703 #if PY_MAJOR_VERSION < 3
704 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
705 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
706 #else
707 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
708 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
709 #endif
710 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
711 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
712 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
713 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
714 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
715 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
716 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
717 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
718 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
719 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
720 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
721 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
722 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
723 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
724 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
725 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)726 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
727 const Py_UNICODE *u_end = u;
728 while (*u_end++) ;
729 return (size_t)(u_end - u - 1);
730 }
731 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
732 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
733 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
734 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
735 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
736 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
737 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
738 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
739 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
740 #define __Pyx_PySequence_Tuple(obj)\
741 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
742 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
743 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
744 #if CYTHON_ASSUME_SAFE_MACROS
745 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
746 #else
747 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
748 #endif
749 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
750 #if PY_MAJOR_VERSION >= 3
751 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
752 #else
753 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
754 #endif
755 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
756 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
757 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)758 static int __Pyx_init_sys_getdefaultencoding_params(void) {
759 PyObject* sys;
760 PyObject* default_encoding = NULL;
761 PyObject* ascii_chars_u = NULL;
762 PyObject* ascii_chars_b = NULL;
763 const char* default_encoding_c;
764 sys = PyImport_ImportModule("sys");
765 if (!sys) goto bad;
766 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
767 Py_DECREF(sys);
768 if (!default_encoding) goto bad;
769 default_encoding_c = PyBytes_AsString(default_encoding);
770 if (!default_encoding_c) goto bad;
771 if (strcmp(default_encoding_c, "ascii") == 0) {
772 __Pyx_sys_getdefaultencoding_not_ascii = 0;
773 } else {
774 char ascii_chars[128];
775 int c;
776 for (c = 0; c < 128; c++) {
777 ascii_chars[c] = c;
778 }
779 __Pyx_sys_getdefaultencoding_not_ascii = 1;
780 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
781 if (!ascii_chars_u) goto bad;
782 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
783 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
784 PyErr_Format(
785 PyExc_ValueError,
786 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
787 default_encoding_c);
788 goto bad;
789 }
790 Py_DECREF(ascii_chars_u);
791 Py_DECREF(ascii_chars_b);
792 }
793 Py_DECREF(default_encoding);
794 return 0;
795 bad:
796 Py_XDECREF(default_encoding);
797 Py_XDECREF(ascii_chars_u);
798 Py_XDECREF(ascii_chars_b);
799 return -1;
800 }
801 #endif
802 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
803 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
804 #else
805 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
806 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
807 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)808 static int __Pyx_init_sys_getdefaultencoding_params(void) {
809 PyObject* sys;
810 PyObject* default_encoding = NULL;
811 char* default_encoding_c;
812 sys = PyImport_ImportModule("sys");
813 if (!sys) goto bad;
814 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
815 Py_DECREF(sys);
816 if (!default_encoding) goto bad;
817 default_encoding_c = PyBytes_AsString(default_encoding);
818 if (!default_encoding_c) goto bad;
819 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
820 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
821 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
822 Py_DECREF(default_encoding);
823 return 0;
824 bad:
825 Py_XDECREF(default_encoding);
826 return -1;
827 }
828 #endif
829 #endif
830
831
832 /* Test for GCC > 2.95 */
833 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
834 #define likely(x) __builtin_expect(!!(x), 1)
835 #define unlikely(x) __builtin_expect(!!(x), 0)
836 #else /* !__GNUC__ or GCC < 2.95 */
837 #define likely(x) (x)
838 #define unlikely(x) (x)
839 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)840 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
841
842 static PyObject *__pyx_m = NULL;
843 static PyObject *__pyx_d;
844 static PyObject *__pyx_b;
845 static PyObject *__pyx_cython_runtime = NULL;
846 static PyObject *__pyx_empty_tuple;
847 static PyObject *__pyx_empty_bytes;
848 static PyObject *__pyx_empty_unicode;
849 static int __pyx_lineno;
850 static int __pyx_clineno = 0;
851 static const char * __pyx_cfilenm= __FILE__;
852 static const char *__pyx_filename;
853
854
855 static const char *__pyx_f[] = {
856 "gssapi/raw/ext_cred_imp_exp.pyx",
857 "gssapi/raw/cython_converters.pxd",
858 "gssapi/raw/oids.pxd",
859 "gssapi/raw/creds.pxd",
860 "gssapi/raw/names.pxd",
861 };
862 /* NoFastGil.proto */
863 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
864 #define __Pyx_PyGILState_Release PyGILState_Release
865 #define __Pyx_FastGIL_Remember()
866 #define __Pyx_FastGIL_Forget()
867 #define __Pyx_FastGilFuncInit()
868
869 /* ForceInitThreads.proto */
870 #ifndef __PYX_FORCE_INIT_THREADS
871 #define __PYX_FORCE_INIT_THREADS 0
872 #endif
873
874
875 /*--- Type declarations ---*/
876 struct __pyx_obj_6gssapi_3raw_4oids_OID;
877 struct __pyx_obj_6gssapi_3raw_5creds_Creds;
878 struct __pyx_obj_6gssapi_3raw_5names_Name;
879 struct __pyx_opt_args_6gssapi_3raw_17cython_converters_c_create_oid_set;
880
881 /* "gssapi/raw/cython_converters.pxd":13
882 * cdef gss_OID_set c_get_mech_oid_set(object mechs)
883 * cdef bint c_compare_oids(gss_OID a, gss_OID b)
884 * cdef object c_create_oid_set(gss_OID_set mech_set, bint free=*) # <<<<<<<<<<<<<<
885 * cdef OID c_make_oid(gss_OID oid)
886 *
887 */
888 struct __pyx_opt_args_6gssapi_3raw_17cython_converters_c_create_oid_set {
889 int __pyx_n;
890 int free;
891 };
892
893 /* "gssapi/raw/oids.pxd":4
894 *
895 *
896 * cdef class OID: # <<<<<<<<<<<<<<
897 * # NB(directxman12): this is a pointer, not a gss_OID_desc
898 * cdef gss_OID_desc raw_oid
899 */
900 struct __pyx_obj_6gssapi_3raw_4oids_OID {
901 PyObject_HEAD
902 struct __pyx_vtabstruct_6gssapi_3raw_4oids_OID *__pyx_vtab;
903 gss_OID_desc raw_oid;
904 int _free_on_dealloc;
905 };
906
907
908 /* "gssapi/raw/creds.pxd":4
909 *
910 *
911 * cdef class Creds: # <<<<<<<<<<<<<<
912 * cdef gss_cred_id_t raw_creds
913 * cdef bint _free_on_dealloc
914 */
915 struct __pyx_obj_6gssapi_3raw_5creds_Creds {
916 PyObject_HEAD
917 gss_cred_id_t raw_creds;
918 int _free_on_dealloc;
919 };
920
921
922 /* "gssapi/raw/names.pxd":3
923 * from gssapi.raw.cython_types cimport gss_name_t
924 *
925 * cdef class Name: # <<<<<<<<<<<<<<
926 * cdef gss_name_t raw_name
927 * cdef bint _free_on_dealloc
928 */
929 struct __pyx_obj_6gssapi_3raw_5names_Name {
930 PyObject_HEAD
931 gss_name_t raw_name;
932 int _free_on_dealloc;
933 };
934
935
936
937 /* "gssapi/raw/oids.pxd":4
938 *
939 *
940 * cdef class OID: # <<<<<<<<<<<<<<
941 * # NB(directxman12): this is a pointer, not a gss_OID_desc
942 * cdef gss_OID_desc raw_oid
943 */
944
945 struct __pyx_vtabstruct_6gssapi_3raw_4oids_OID {
946 int (*_copy_from)(struct __pyx_obj_6gssapi_3raw_4oids_OID *, gss_OID_desc);
947 int (*_from_bytes)(struct __pyx_obj_6gssapi_3raw_4oids_OID *, PyObject *);
948 };
949 static struct __pyx_vtabstruct_6gssapi_3raw_4oids_OID *__pyx_vtabptr_6gssapi_3raw_4oids_OID;
950
951 /* --- Runtime support code (head) --- */
952 /* Refnanny.proto */
953 #ifndef CYTHON_REFNANNY
954 #define CYTHON_REFNANNY 0
955 #endif
956 #if CYTHON_REFNANNY
957 typedef struct {
958 void (*INCREF)(void*, PyObject*, int);
959 void (*DECREF)(void*, PyObject*, int);
960 void (*GOTREF)(void*, PyObject*, int);
961 void (*GIVEREF)(void*, PyObject*, int);
962 void* (*SetupContext)(const char*, int, const char*);
963 void (*FinishContext)(void**);
964 } __Pyx_RefNannyAPIStruct;
965 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
966 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
967 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
968 #ifdef WITH_THREAD
969 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
970 if (acquire_gil) {\
971 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
972 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
973 PyGILState_Release(__pyx_gilstate_save);\
974 } else {\
975 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
976 }
977 #else
978 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
979 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
980 #endif
981 #define __Pyx_RefNannyFinishContext()\
982 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
983 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
984 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
985 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
986 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
987 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
988 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
989 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
990 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
991 #else
992 #define __Pyx_RefNannyDeclarations
993 #define __Pyx_RefNannySetupContext(name, acquire_gil)
994 #define __Pyx_RefNannyFinishContext()
995 #define __Pyx_INCREF(r) Py_INCREF(r)
996 #define __Pyx_DECREF(r) Py_DECREF(r)
997 #define __Pyx_GOTREF(r)
998 #define __Pyx_GIVEREF(r)
999 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1000 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1001 #define __Pyx_XGOTREF(r)
1002 #define __Pyx_XGIVEREF(r)
1003 #endif
1004 #define __Pyx_XDECREF_SET(r, v) do {\
1005 PyObject *tmp = (PyObject *) r;\
1006 r = v; __Pyx_XDECREF(tmp);\
1007 } while (0)
1008 #define __Pyx_DECREF_SET(r, v) do {\
1009 PyObject *tmp = (PyObject *) r;\
1010 r = v; __Pyx_DECREF(tmp);\
1011 } while (0)
1012 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1013 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1014
1015 /* ArgTypeTest.proto */
1016 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1017 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1018 __Pyx__ArgTypeTest(obj, type, name, exact))
1019 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1020
1021 /* PyObjectGetAttrStr.proto */
1022 #if CYTHON_USE_TYPE_SLOTS
1023 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1024 #else
1025 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1026 #endif
1027
1028 /* GetBuiltinName.proto */
1029 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1030
1031 /* PyDictVersioning.proto */
1032 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1033 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1034 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1035 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1036 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1037 (cache_var) = (value);
1038 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1039 static PY_UINT64_T __pyx_dict_version = 0;\
1040 static PyObject *__pyx_dict_cached_value = NULL;\
1041 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1042 (VAR) = __pyx_dict_cached_value;\
1043 } else {\
1044 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1045 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1046 }\
1047 }
1048 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1049 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1050 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1051 #else
1052 #define __PYX_GET_DICT_VERSION(dict) (0)
1053 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1054 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1055 #endif
1056
1057 /* GetModuleGlobalName.proto */
1058 #if CYTHON_USE_DICT_VERSIONS
1059 #define __Pyx_GetModuleGlobalName(var, name) {\
1060 static PY_UINT64_T __pyx_dict_version = 0;\
1061 static PyObject *__pyx_dict_cached_value = NULL;\
1062 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1063 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1064 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1065 }
1066 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1067 PY_UINT64_T __pyx_dict_version;\
1068 PyObject *__pyx_dict_cached_value;\
1069 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1070 }
1071 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1072 #else
1073 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1074 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1075 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1076 #endif
1077
1078 /* PyFunctionFastCall.proto */
1079 #if CYTHON_FAST_PYCALL
1080 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1081 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1082 #if 1 || PY_VERSION_HEX < 0x030600B1
1083 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1084 #else
1085 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1086 #endif
1087 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1088 (sizeof(char [1 - 2*!(cond)]) - 1)
1089 #ifndef Py_MEMBER_SIZE
1090 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1091 #endif
1092 static size_t __pyx_pyframe_localsplus_offset = 0;
1093 #include "frameobject.h"
1094 #define __Pxy_PyFrame_Initialize_Offsets()\
1095 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1096 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1097 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1098 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1099 #endif
1100
1101 /* PyCFunctionFastCall.proto */
1102 #if CYTHON_FAST_PYCCALL
1103 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1104 #else
1105 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1106 #endif
1107
1108 /* PyObjectCall.proto */
1109 #if CYTHON_COMPILING_IN_CPYTHON
1110 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1111 #else
1112 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1113 #endif
1114
1115 /* PyThreadStateGet.proto */
1116 #if CYTHON_FAST_THREAD_STATE
1117 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1118 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1119 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1120 #else
1121 #define __Pyx_PyThreadState_declare
1122 #define __Pyx_PyThreadState_assign
1123 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1124 #endif
1125
1126 /* PyErrFetchRestore.proto */
1127 #if CYTHON_FAST_THREAD_STATE
1128 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1129 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1130 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1131 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1132 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1133 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1134 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1135 #if CYTHON_COMPILING_IN_CPYTHON
1136 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1137 #else
1138 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1139 #endif
1140 #else
1141 #define __Pyx_PyErr_Clear() PyErr_Clear()
1142 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1143 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1144 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1145 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1146 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1147 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1148 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1149 #endif
1150
1151 /* RaiseException.proto */
1152 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1153
1154 /* PyObjectCallMethO.proto */
1155 #if CYTHON_COMPILING_IN_CPYTHON
1156 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1157 #endif
1158
1159 /* PyObjectCallNoArg.proto */
1160 #if CYTHON_COMPILING_IN_CPYTHON
1161 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1162 #else
1163 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1164 #endif
1165
1166 /* TypeImport.proto */
1167 #ifndef __PYX_HAVE_RT_ImportType_proto
1168 #define __PYX_HAVE_RT_ImportType_proto
1169 enum __Pyx_ImportType_CheckSize {
1170 __Pyx_ImportType_CheckSize_Error = 0,
1171 __Pyx_ImportType_CheckSize_Warn = 1,
1172 __Pyx_ImportType_CheckSize_Ignore = 2
1173 };
1174 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1175 #endif
1176
1177 /* GetVTable.proto */
1178 static void* __Pyx_GetVtable(PyObject *dict);
1179
1180 /* Import.proto */
1181 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1182
1183 /* ImportFrom.proto */
1184 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1185
1186 /* CLineInTraceback.proto */
1187 #ifdef CYTHON_CLINE_IN_TRACEBACK
1188 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1189 #else
1190 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1191 #endif
1192
1193 /* CodeObjectCache.proto */
1194 typedef struct {
1195 PyCodeObject* code_object;
1196 int code_line;
1197 } __Pyx_CodeObjectCacheEntry;
1198 struct __Pyx_CodeObjectCache {
1199 int count;
1200 int max_count;
1201 __Pyx_CodeObjectCacheEntry* entries;
1202 };
1203 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1204 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1205 static PyCodeObject *__pyx_find_code_object(int code_line);
1206 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1207
1208 /* AddTraceback.proto */
1209 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1210 int py_line, const char *filename);
1211
1212 /* GCCDiagnostics.proto */
1213 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1214 #define __Pyx_HAS_GCC_DIAGNOSTIC
1215 #endif
1216
1217 /* CIntToPy.proto */
1218 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);
1219
1220 /* CIntFromPy.proto */
1221 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);
1222
1223 /* CIntToPy.proto */
1224 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1225
1226 /* CIntFromPy.proto */
1227 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1228
1229 /* CIntFromPy.proto */
1230 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1231
1232 /* FastTypeChecks.proto */
1233 #if CYTHON_COMPILING_IN_CPYTHON
1234 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1235 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1236 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1237 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1238 #else
1239 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1240 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1241 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1242 #endif
1243 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1244
1245 /* CheckBinaryVersion.proto */
1246 static int __Pyx_check_binary_version(void);
1247
1248 /* FunctionImport.proto */
1249 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
1250
1251 /* InitStrings.proto */
1252 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1253
1254
1255 /* Module declarations from 'libc.stdint' */
1256
1257 /* Module declarations from 'gssapi.raw.cython_types' */
1258
1259 /* Module declarations from 'libc.string' */
1260
1261 /* Module declarations from 'gssapi.raw.oids' */
1262 static PyTypeObject *__pyx_ptype_6gssapi_3raw_4oids_OID = 0;
1263
1264 /* Module declarations from 'gssapi.raw.cython_converters' */
1265 static gss_OID_set (*__pyx_f_6gssapi_3raw_17cython_converters_c_get_mech_oid_set)(PyObject *); /*proto*/
1266 static PyObject *(*__pyx_f_6gssapi_3raw_17cython_converters_c_create_oid_set)(gss_OID_set, struct __pyx_opt_args_6gssapi_3raw_17cython_converters_c_create_oid_set *__pyx_optional_args); /*proto*/
1267 static CYTHON_INLINE OM_uint32 __pyx_f_6gssapi_3raw_17cython_converters_c_py_ttl_to_c(PyObject *); /*proto*/
1268 static CYTHON_INLINE PyObject *__pyx_f_6gssapi_3raw_17cython_converters_c_c_ttl_to_py(OM_uint32); /*proto*/
1269
1270 /* Module declarations from 'gssapi.raw.creds' */
1271 static PyTypeObject *__pyx_ptype_6gssapi_3raw_5creds_Creds = 0;
1272
1273 /* Module declarations from 'gssapi.raw.names' */
1274 static PyTypeObject *__pyx_ptype_6gssapi_3raw_5names_Name = 0;
1275
1276 /* Module declarations from 'gssapi.raw.ext_cred_imp_exp' */
1277 #define __Pyx_MODULE_NAME "gssapi.raw.ext_cred_imp_exp"
1278 extern int __pyx_module_is_main_gssapi__raw__ext_cred_imp_exp;
1279 int __pyx_module_is_main_gssapi__raw__ext_cred_imp_exp = 0;
1280
1281 /* Implementation of 'gssapi.raw.ext_cred_imp_exp' */
1282 static const char __pyx_k_res[] = "res";
1283 static const char __pyx_k_BASE[] = "BASE";
1284 static const char __pyx_k_main[] = "__main__";
1285 static const char __pyx_k_name[] = "__name__";
1286 static const char __pyx_k_test[] = "__test__";
1287 static const char __pyx_k_creds[] = "creds";
1288 static const char __pyx_k_token[] = "token";
1289 static const char __pyx_k_value[] = "value";
1290 static const char __pyx_k_GSSAPI[] = "GSSAPI";
1291 static const char __pyx_k_import[] = "__import__";
1292 static const char __pyx_k_length[] = "length";
1293 static const char __pyx_k_GSSError[] = "GSSError";
1294 static const char __pyx_k_maj_stat[] = "maj_stat";
1295 static const char __pyx_k_min_stat[] = "min_stat";
1296 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1297 static const char __pyx_k_export_cred[] = "export_cred";
1298 static const char __pyx_k_import_cred[] = "import_cred";
1299 static const char __pyx_k_token_buffer[] = "token_buffer";
1300 static const char __pyx_k_AddCredResult[] = "AddCredResult";
1301 static const char __pyx_k_exported_creds[] = "exported_creds";
1302 static const char __pyx_k_gssapi_raw_misc[] = "gssapi.raw.misc";
1303 static const char __pyx_k_AcquireCredResult[] = "AcquireCredResult";
1304 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1305 static const char __pyx_k_gssapi_raw_named_tuples[] = "gssapi.raw.named_tuples";
1306 static const char __pyx_k_gssapi_raw_ext_cred_imp_exp[] = "gssapi.raw.ext_cred_imp_exp";
1307 static const char __pyx_k_gssapi_raw_ext_cred_imp_exp_pyx[] = "gssapi/raw/ext_cred_imp_exp.pyx";
1308 static const char __pyx_k_Credentials_Import_Export_Extens[] = "Credentials Import/Export Extension";
1309 static PyObject *__pyx_n_s_AcquireCredResult;
1310 static PyObject *__pyx_n_s_AddCredResult;
1311 static PyObject *__pyx_n_s_BASE;
1312 static PyObject *__pyx_n_s_GSSAPI;
1313 static PyObject *__pyx_n_s_GSSError;
1314 static PyObject *__pyx_n_s_cline_in_traceback;
1315 static PyObject *__pyx_n_s_creds;
1316 static PyObject *__pyx_n_s_export_cred;
1317 static PyObject *__pyx_n_s_exported_creds;
1318 static PyObject *__pyx_n_s_gssapi_raw_ext_cred_imp_exp;
1319 static PyObject *__pyx_kp_s_gssapi_raw_ext_cred_imp_exp_pyx;
1320 static PyObject *__pyx_n_s_gssapi_raw_misc;
1321 static PyObject *__pyx_n_s_gssapi_raw_named_tuples;
1322 static PyObject *__pyx_n_s_import;
1323 static PyObject *__pyx_n_s_import_cred;
1324 static PyObject *__pyx_n_s_length;
1325 static PyObject *__pyx_n_s_main;
1326 static PyObject *__pyx_n_s_maj_stat;
1327 static PyObject *__pyx_n_s_min_stat;
1328 static PyObject *__pyx_n_s_name;
1329 static PyObject *__pyx_n_s_pyx_vtable;
1330 static PyObject *__pyx_n_s_res;
1331 static PyObject *__pyx_n_s_test;
1332 static PyObject *__pyx_n_s_token;
1333 static PyObject *__pyx_n_s_token_buffer;
1334 static PyObject *__pyx_n_s_value;
1335 static PyObject *__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_export_cred(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6gssapi_3raw_5creds_Creds *__pyx_v_creds); /* proto */
1336 static PyObject *__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_2import_cred(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_token); /* proto */
1337 static PyObject *__pyx_tuple_;
1338 static PyObject *__pyx_tuple__3;
1339 static PyObject *__pyx_codeobj__2;
1340 static PyObject *__pyx_codeobj__4;
1341 /* Late includes */
1342
1343 /* "gssapi/raw/ext_cred_imp_exp.pyx":24
1344 *
1345 *
1346 * def export_cred(Creds creds not None): # <<<<<<<<<<<<<<
1347 * """
1348 * export_cred(creds)
1349 */
1350
1351 /* Python wrapper */
1352 static PyObject *__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_1export_cred(PyObject *__pyx_self, PyObject *__pyx_v_creds); /*proto*/
1353 static char __pyx_doc_6gssapi_3raw_16ext_cred_imp_exp_export_cred[] = "\n export_cred(creds)\n Export GSSAPI credentials.\n\n This method exports GSSSAPI credentials into a token\n which may be transmitted between different processes.\n\n Args:\n creds (Creds): the credentials object to be exported\n\n Returns:\n bytes: the exported token representing the given credentials object\n\n Raises:\n GSSError\n ";
1354 static PyMethodDef __pyx_mdef_6gssapi_3raw_16ext_cred_imp_exp_1export_cred = {"export_cred", (PyCFunction)__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_1export_cred, METH_O, __pyx_doc_6gssapi_3raw_16ext_cred_imp_exp_export_cred};
__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_1export_cred(PyObject * __pyx_self,PyObject * __pyx_v_creds)1355 static PyObject *__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_1export_cred(PyObject *__pyx_self, PyObject *__pyx_v_creds) {
1356 int __pyx_lineno = 0;
1357 const char *__pyx_filename = NULL;
1358 int __pyx_clineno = 0;
1359 PyObject *__pyx_r = 0;
1360 __Pyx_RefNannyDeclarations
1361 __Pyx_RefNannySetupContext("export_cred (wrapper)", 0);
1362 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_creds), __pyx_ptype_6gssapi_3raw_5creds_Creds, 0, "creds", 0))) __PYX_ERR(0, 24, __pyx_L1_error)
1363 __pyx_r = __pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_export_cred(__pyx_self, ((struct __pyx_obj_6gssapi_3raw_5creds_Creds *)__pyx_v_creds));
1364
1365 /* function exit code */
1366 goto __pyx_L0;
1367 __pyx_L1_error:;
1368 __pyx_r = NULL;
1369 __pyx_L0:;
1370 __Pyx_RefNannyFinishContext();
1371 return __pyx_r;
1372 }
1373
__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_export_cred(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_6gssapi_3raw_5creds_Creds * __pyx_v_creds)1374 static PyObject *__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_export_cred(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6gssapi_3raw_5creds_Creds *__pyx_v_creds) {
1375 gss_buffer_desc __pyx_v_exported_creds;
1376 OM_uint32 __pyx_v_maj_stat;
1377 OM_uint32 __pyx_v_min_stat;
1378 PyObject *__pyx_v_res = NULL;
1379 PyObject *__pyx_r = NULL;
1380 __Pyx_RefNannyDeclarations
1381 gss_buffer_desc __pyx_t_1;
1382 int __pyx_t_2;
1383 PyObject *__pyx_t_3 = NULL;
1384 PyObject *__pyx_t_4 = NULL;
1385 PyObject *__pyx_t_5 = NULL;
1386 PyObject *__pyx_t_6 = NULL;
1387 PyObject *__pyx_t_7 = NULL;
1388 int __pyx_t_8;
1389 PyObject *__pyx_t_9 = NULL;
1390 int __pyx_lineno = 0;
1391 const char *__pyx_filename = NULL;
1392 int __pyx_clineno = 0;
1393 __Pyx_RefNannySetupContext("export_cred", 0);
1394
1395 /* "gssapi/raw/ext_cred_imp_exp.pyx":43
1396 *
1397 * # GSS_C_EMPTY_BUFFER
1398 * cdef gss_buffer_desc exported_creds = gss_buffer_desc(0, NULL) # <<<<<<<<<<<<<<
1399 *
1400 * cdef OM_uint32 maj_stat, min_stat
1401 */
1402 __pyx_t_1.length = 0;
1403 __pyx_t_1.value = NULL;
1404 __pyx_v_exported_creds = __pyx_t_1;
1405
1406 /* "gssapi/raw/ext_cred_imp_exp.pyx":47
1407 * cdef OM_uint32 maj_stat, min_stat
1408 *
1409 * with nogil: # <<<<<<<<<<<<<<
1410 * maj_stat = gss_export_cred(&min_stat, creds.raw_creds, &exported_creds)
1411 *
1412 */
1413 {
1414 #ifdef WITH_THREAD
1415 PyThreadState *_save;
1416 Py_UNBLOCK_THREADS
1417 __Pyx_FastGIL_Remember();
1418 #endif
1419 /*try:*/ {
1420
1421 /* "gssapi/raw/ext_cred_imp_exp.pyx":48
1422 *
1423 * with nogil:
1424 * maj_stat = gss_export_cred(&min_stat, creds.raw_creds, &exported_creds) # <<<<<<<<<<<<<<
1425 *
1426 * if maj_stat == GSS_S_COMPLETE:
1427 */
1428 __pyx_v_maj_stat = gss_export_cred((&__pyx_v_min_stat), __pyx_v_creds->raw_creds, (&__pyx_v_exported_creds));
1429 }
1430
1431 /* "gssapi/raw/ext_cred_imp_exp.pyx":47
1432 * cdef OM_uint32 maj_stat, min_stat
1433 *
1434 * with nogil: # <<<<<<<<<<<<<<
1435 * maj_stat = gss_export_cred(&min_stat, creds.raw_creds, &exported_creds)
1436 *
1437 */
1438 /*finally:*/ {
1439 /*normal exit:*/{
1440 #ifdef WITH_THREAD
1441 __Pyx_FastGIL_Forget();
1442 Py_BLOCK_THREADS
1443 #endif
1444 goto __pyx_L5;
1445 }
1446 __pyx_L5:;
1447 }
1448 }
1449
1450 /* "gssapi/raw/ext_cred_imp_exp.pyx":50
1451 * maj_stat = gss_export_cred(&min_stat, creds.raw_creds, &exported_creds)
1452 *
1453 * if maj_stat == GSS_S_COMPLETE: # <<<<<<<<<<<<<<
1454 * res = (<char*>exported_creds.value)[:exported_creds.length]
1455 * gss_release_buffer(&min_stat, &exported_creds)
1456 */
1457 __pyx_t_2 = ((__pyx_v_maj_stat == GSS_S_COMPLETE) != 0);
1458 if (likely(__pyx_t_2)) {
1459
1460 /* "gssapi/raw/ext_cred_imp_exp.pyx":51
1461 *
1462 * if maj_stat == GSS_S_COMPLETE:
1463 * res = (<char*>exported_creds.value)[:exported_creds.length] # <<<<<<<<<<<<<<
1464 * gss_release_buffer(&min_stat, &exported_creds)
1465 * return res
1466 */
1467 __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((char *)__pyx_v_exported_creds.value) + 0, __pyx_v_exported_creds.length - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
1468 __Pyx_GOTREF(__pyx_t_3);
1469 __pyx_v_res = ((PyObject*)__pyx_t_3);
1470 __pyx_t_3 = 0;
1471
1472 /* "gssapi/raw/ext_cred_imp_exp.pyx":52
1473 * if maj_stat == GSS_S_COMPLETE:
1474 * res = (<char*>exported_creds.value)[:exported_creds.length]
1475 * gss_release_buffer(&min_stat, &exported_creds) # <<<<<<<<<<<<<<
1476 * return res
1477 * else:
1478 */
1479 (void)(gss_release_buffer((&__pyx_v_min_stat), (&__pyx_v_exported_creds)));
1480
1481 /* "gssapi/raw/ext_cred_imp_exp.pyx":53
1482 * res = (<char*>exported_creds.value)[:exported_creds.length]
1483 * gss_release_buffer(&min_stat, &exported_creds)
1484 * return res # <<<<<<<<<<<<<<
1485 * else:
1486 * raise GSSError(maj_stat, min_stat)
1487 */
1488 __Pyx_XDECREF(__pyx_r);
1489 __Pyx_INCREF(__pyx_v_res);
1490 __pyx_r = __pyx_v_res;
1491 goto __pyx_L0;
1492
1493 /* "gssapi/raw/ext_cred_imp_exp.pyx":50
1494 * maj_stat = gss_export_cred(&min_stat, creds.raw_creds, &exported_creds)
1495 *
1496 * if maj_stat == GSS_S_COMPLETE: # <<<<<<<<<<<<<<
1497 * res = (<char*>exported_creds.value)[:exported_creds.length]
1498 * gss_release_buffer(&min_stat, &exported_creds)
1499 */
1500 }
1501
1502 /* "gssapi/raw/ext_cred_imp_exp.pyx":55
1503 * return res
1504 * else:
1505 * raise GSSError(maj_stat, min_stat) # <<<<<<<<<<<<<<
1506 *
1507 *
1508 */
1509 /*else*/ {
1510 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GSSError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
1511 __Pyx_GOTREF(__pyx_t_4);
1512 __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_maj_stat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
1513 __Pyx_GOTREF(__pyx_t_5);
1514 __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_min_stat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error)
1515 __Pyx_GOTREF(__pyx_t_6);
1516 __pyx_t_7 = NULL;
1517 __pyx_t_8 = 0;
1518 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
1519 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
1520 if (likely(__pyx_t_7)) {
1521 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
1522 __Pyx_INCREF(__pyx_t_7);
1523 __Pyx_INCREF(function);
1524 __Pyx_DECREF_SET(__pyx_t_4, function);
1525 __pyx_t_8 = 1;
1526 }
1527 }
1528 #if CYTHON_FAST_PYCALL
1529 if (PyFunction_Check(__pyx_t_4)) {
1530 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
1531 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
1532 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
1533 __Pyx_GOTREF(__pyx_t_3);
1534 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1535 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1536 } else
1537 #endif
1538 #if CYTHON_FAST_PYCCALL
1539 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
1540 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
1541 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
1542 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
1543 __Pyx_GOTREF(__pyx_t_3);
1544 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1545 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1546 } else
1547 #endif
1548 {
1549 __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L1_error)
1550 __Pyx_GOTREF(__pyx_t_9);
1551 if (__pyx_t_7) {
1552 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
1553 }
1554 __Pyx_GIVEREF(__pyx_t_5);
1555 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
1556 __Pyx_GIVEREF(__pyx_t_6);
1557 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
1558 __pyx_t_5 = 0;
1559 __pyx_t_6 = 0;
1560 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
1561 __Pyx_GOTREF(__pyx_t_3);
1562 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
1563 }
1564 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1565 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
1566 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1567 __PYX_ERR(0, 55, __pyx_L1_error)
1568 }
1569
1570 /* "gssapi/raw/ext_cred_imp_exp.pyx":24
1571 *
1572 *
1573 * def export_cred(Creds creds not None): # <<<<<<<<<<<<<<
1574 * """
1575 * export_cred(creds)
1576 */
1577
1578 /* function exit code */
1579 __pyx_L1_error:;
1580 __Pyx_XDECREF(__pyx_t_3);
1581 __Pyx_XDECREF(__pyx_t_4);
1582 __Pyx_XDECREF(__pyx_t_5);
1583 __Pyx_XDECREF(__pyx_t_6);
1584 __Pyx_XDECREF(__pyx_t_7);
1585 __Pyx_XDECREF(__pyx_t_9);
1586 __Pyx_AddTraceback("gssapi.raw.ext_cred_imp_exp.export_cred", __pyx_clineno, __pyx_lineno, __pyx_filename);
1587 __pyx_r = NULL;
1588 __pyx_L0:;
1589 __Pyx_XDECREF(__pyx_v_res);
1590 __Pyx_XGIVEREF(__pyx_r);
1591 __Pyx_RefNannyFinishContext();
1592 return __pyx_r;
1593 }
1594
1595 /* "gssapi/raw/ext_cred_imp_exp.pyx":58
1596 *
1597 *
1598 * def import_cred(token not None): # <<<<<<<<<<<<<<
1599 * """
1600 * import_cred(token)
1601 */
1602
1603 /* Python wrapper */
1604 static PyObject *__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_3import_cred(PyObject *__pyx_self, PyObject *__pyx_v_token); /*proto*/
1605 static char __pyx_doc_6gssapi_3raw_16ext_cred_imp_exp_2import_cred[] = "\n import_cred(token)\n Import GSSAPI credentials from a token.\n\n This method imports a credentials object from a token\n previously exported by :func:`export_cred`.\n\n Args:\n token (bytes): the token to import\n\n Returns:\n Creds: the imported credentials object\n\n Raises:\n GSSError\n ";
1606 static PyMethodDef __pyx_mdef_6gssapi_3raw_16ext_cred_imp_exp_3import_cred = {"import_cred", (PyCFunction)__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_3import_cred, METH_O, __pyx_doc_6gssapi_3raw_16ext_cred_imp_exp_2import_cred};
__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_3import_cred(PyObject * __pyx_self,PyObject * __pyx_v_token)1607 static PyObject *__pyx_pw_6gssapi_3raw_16ext_cred_imp_exp_3import_cred(PyObject *__pyx_self, PyObject *__pyx_v_token) {
1608 int __pyx_lineno = 0;
1609 const char *__pyx_filename = NULL;
1610 int __pyx_clineno = 0;
1611 PyObject *__pyx_r = 0;
1612 __Pyx_RefNannyDeclarations
1613 __Pyx_RefNannySetupContext("import_cred (wrapper)", 0);
1614 if (unlikely(((PyObject *)__pyx_v_token) == Py_None)) {
1615 PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "token"); __PYX_ERR(0, 58, __pyx_L1_error)
1616 }
1617 __pyx_r = __pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_2import_cred(__pyx_self, ((PyObject *)__pyx_v_token));
1618
1619 /* function exit code */
1620 goto __pyx_L0;
1621 __pyx_L1_error:;
1622 __pyx_r = NULL;
1623 __pyx_L0:;
1624 __Pyx_RefNannyFinishContext();
1625 return __pyx_r;
1626 }
1627
__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_2import_cred(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_token)1628 static PyObject *__pyx_pf_6gssapi_3raw_16ext_cred_imp_exp_2import_cred(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_token) {
1629 gss_buffer_desc __pyx_v_token_buffer;
1630 gss_cred_id_t __pyx_v_creds;
1631 OM_uint32 __pyx_v_maj_stat;
1632 OM_uint32 __pyx_v_min_stat;
1633 struct __pyx_obj_6gssapi_3raw_5creds_Creds *__pyx_v_res = 0;
1634 PyObject *__pyx_r = NULL;
1635 __Pyx_RefNannyDeclarations
1636 gss_buffer_desc __pyx_t_1;
1637 Py_ssize_t __pyx_t_2;
1638 char *__pyx_t_3;
1639 int __pyx_t_4;
1640 PyObject *__pyx_t_5 = NULL;
1641 PyObject *__pyx_t_6 = NULL;
1642 PyObject *__pyx_t_7 = NULL;
1643 PyObject *__pyx_t_8 = NULL;
1644 PyObject *__pyx_t_9 = NULL;
1645 int __pyx_t_10;
1646 PyObject *__pyx_t_11 = NULL;
1647 int __pyx_lineno = 0;
1648 const char *__pyx_filename = NULL;
1649 int __pyx_clineno = 0;
1650 __Pyx_RefNannySetupContext("import_cred", 0);
1651
1652 /* "gssapi/raw/ext_cred_imp_exp.pyx":76
1653 * """
1654 *
1655 * cdef gss_buffer_desc token_buffer = gss_buffer_desc(len(token), token) # <<<<<<<<<<<<<<
1656 *
1657 * cdef gss_cred_id_t creds
1658 */
1659 __pyx_t_2 = PyObject_Length(__pyx_v_token); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 76, __pyx_L1_error)
1660 __pyx_t_1.length = __pyx_t_2;
1661 __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_token); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error)
1662 __pyx_t_1.value = __pyx_t_3;
1663 __pyx_v_token_buffer = __pyx_t_1;
1664
1665 /* "gssapi/raw/ext_cred_imp_exp.pyx":82
1666 * cdef OM_uint32 maj_stat, min_stat
1667 *
1668 * with nogil: # <<<<<<<<<<<<<<
1669 * maj_stat = gss_import_cred(&min_stat, &token_buffer, &creds)
1670 *
1671 */
1672 {
1673 #ifdef WITH_THREAD
1674 PyThreadState *_save;
1675 Py_UNBLOCK_THREADS
1676 __Pyx_FastGIL_Remember();
1677 #endif
1678 /*try:*/ {
1679
1680 /* "gssapi/raw/ext_cred_imp_exp.pyx":83
1681 *
1682 * with nogil:
1683 * maj_stat = gss_import_cred(&min_stat, &token_buffer, &creds) # <<<<<<<<<<<<<<
1684 *
1685 * cdef Creds res
1686 */
1687 __pyx_v_maj_stat = gss_import_cred((&__pyx_v_min_stat), (&__pyx_v_token_buffer), (&__pyx_v_creds));
1688 }
1689
1690 /* "gssapi/raw/ext_cred_imp_exp.pyx":82
1691 * cdef OM_uint32 maj_stat, min_stat
1692 *
1693 * with nogil: # <<<<<<<<<<<<<<
1694 * maj_stat = gss_import_cred(&min_stat, &token_buffer, &creds)
1695 *
1696 */
1697 /*finally:*/ {
1698 /*normal exit:*/{
1699 #ifdef WITH_THREAD
1700 __Pyx_FastGIL_Forget();
1701 Py_BLOCK_THREADS
1702 #endif
1703 goto __pyx_L5;
1704 }
1705 __pyx_L5:;
1706 }
1707 }
1708
1709 /* "gssapi/raw/ext_cred_imp_exp.pyx":86
1710 *
1711 * cdef Creds res
1712 * if maj_stat == GSS_S_COMPLETE: # <<<<<<<<<<<<<<
1713 * res = Creds()
1714 * res.raw_creds = creds
1715 */
1716 __pyx_t_4 = ((__pyx_v_maj_stat == GSS_S_COMPLETE) != 0);
1717 if (likely(__pyx_t_4)) {
1718
1719 /* "gssapi/raw/ext_cred_imp_exp.pyx":87
1720 * cdef Creds res
1721 * if maj_stat == GSS_S_COMPLETE:
1722 * res = Creds() # <<<<<<<<<<<<<<
1723 * res.raw_creds = creds
1724 * return res
1725 */
1726 __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gssapi_3raw_5creds_Creds)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
1727 __Pyx_GOTREF(__pyx_t_5);
1728 __pyx_v_res = ((struct __pyx_obj_6gssapi_3raw_5creds_Creds *)__pyx_t_5);
1729 __pyx_t_5 = 0;
1730
1731 /* "gssapi/raw/ext_cred_imp_exp.pyx":88
1732 * if maj_stat == GSS_S_COMPLETE:
1733 * res = Creds()
1734 * res.raw_creds = creds # <<<<<<<<<<<<<<
1735 * return res
1736 * else:
1737 */
1738 __pyx_v_res->raw_creds = __pyx_v_creds;
1739
1740 /* "gssapi/raw/ext_cred_imp_exp.pyx":89
1741 * res = Creds()
1742 * res.raw_creds = creds
1743 * return res # <<<<<<<<<<<<<<
1744 * else:
1745 * raise GSSError(maj_stat, min_stat)
1746 */
1747 __Pyx_XDECREF(__pyx_r);
1748 __Pyx_INCREF(((PyObject *)__pyx_v_res));
1749 __pyx_r = ((PyObject *)__pyx_v_res);
1750 goto __pyx_L0;
1751
1752 /* "gssapi/raw/ext_cred_imp_exp.pyx":86
1753 *
1754 * cdef Creds res
1755 * if maj_stat == GSS_S_COMPLETE: # <<<<<<<<<<<<<<
1756 * res = Creds()
1757 * res.raw_creds = creds
1758 */
1759 }
1760
1761 /* "gssapi/raw/ext_cred_imp_exp.pyx":91
1762 * return res
1763 * else:
1764 * raise GSSError(maj_stat, min_stat) # <<<<<<<<<<<<<<
1765 */
1766 /*else*/ {
1767 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_GSSError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
1768 __Pyx_GOTREF(__pyx_t_6);
1769 __pyx_t_7 = __Pyx_PyInt_From_uint32_t(__pyx_v_maj_stat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
1770 __Pyx_GOTREF(__pyx_t_7);
1771 __pyx_t_8 = __Pyx_PyInt_From_uint32_t(__pyx_v_min_stat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L1_error)
1772 __Pyx_GOTREF(__pyx_t_8);
1773 __pyx_t_9 = NULL;
1774 __pyx_t_10 = 0;
1775 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
1776 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
1777 if (likely(__pyx_t_9)) {
1778 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
1779 __Pyx_INCREF(__pyx_t_9);
1780 __Pyx_INCREF(function);
1781 __Pyx_DECREF_SET(__pyx_t_6, function);
1782 __pyx_t_10 = 1;
1783 }
1784 }
1785 #if CYTHON_FAST_PYCALL
1786 if (PyFunction_Check(__pyx_t_6)) {
1787 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
1788 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
1789 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
1790 __Pyx_GOTREF(__pyx_t_5);
1791 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1792 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1793 } else
1794 #endif
1795 #if CYTHON_FAST_PYCCALL
1796 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
1797 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_7, __pyx_t_8};
1798 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
1799 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
1800 __Pyx_GOTREF(__pyx_t_5);
1801 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1802 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1803 } else
1804 #endif
1805 {
1806 __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 91, __pyx_L1_error)
1807 __Pyx_GOTREF(__pyx_t_11);
1808 if (__pyx_t_9) {
1809 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
1810 }
1811 __Pyx_GIVEREF(__pyx_t_7);
1812 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7);
1813 __Pyx_GIVEREF(__pyx_t_8);
1814 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
1815 __pyx_t_7 = 0;
1816 __pyx_t_8 = 0;
1817 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
1818 __Pyx_GOTREF(__pyx_t_5);
1819 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
1820 }
1821 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1822 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
1823 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1824 __PYX_ERR(0, 91, __pyx_L1_error)
1825 }
1826
1827 /* "gssapi/raw/ext_cred_imp_exp.pyx":58
1828 *
1829 *
1830 * def import_cred(token not None): # <<<<<<<<<<<<<<
1831 * """
1832 * import_cred(token)
1833 */
1834
1835 /* function exit code */
1836 __pyx_L1_error:;
1837 __Pyx_XDECREF(__pyx_t_5);
1838 __Pyx_XDECREF(__pyx_t_6);
1839 __Pyx_XDECREF(__pyx_t_7);
1840 __Pyx_XDECREF(__pyx_t_8);
1841 __Pyx_XDECREF(__pyx_t_9);
1842 __Pyx_XDECREF(__pyx_t_11);
1843 __Pyx_AddTraceback("gssapi.raw.ext_cred_imp_exp.import_cred", __pyx_clineno, __pyx_lineno, __pyx_filename);
1844 __pyx_r = NULL;
1845 __pyx_L0:;
1846 __Pyx_XDECREF((PyObject *)__pyx_v_res);
1847 __Pyx_XGIVEREF(__pyx_r);
1848 __Pyx_RefNannyFinishContext();
1849 return __pyx_r;
1850 }
1851
1852 /* "gssapi/raw/cython_converters.pxd":16
1853 * cdef OID c_make_oid(gss_OID oid)
1854 *
1855 * cdef inline OM_uint32 c_py_ttl_to_c(object ttl) except? 1: # <<<<<<<<<<<<<<
1856 * """Converts None to GSS_C_INDEFINITE, otherwise returns input."""
1857 * if ttl is None:
1858 */
1859
__pyx_f_6gssapi_3raw_17cython_converters_c_py_ttl_to_c(PyObject * __pyx_v_ttl)1860 static CYTHON_INLINE OM_uint32 __pyx_f_6gssapi_3raw_17cython_converters_c_py_ttl_to_c(PyObject *__pyx_v_ttl) {
1861 OM_uint32 __pyx_r;
1862 __Pyx_RefNannyDeclarations
1863 int __pyx_t_1;
1864 int __pyx_t_2;
1865 OM_uint32 __pyx_t_3;
1866 int __pyx_lineno = 0;
1867 const char *__pyx_filename = NULL;
1868 int __pyx_clineno = 0;
1869 __Pyx_RefNannySetupContext("c_py_ttl_to_c", 0);
1870
1871 /* "gssapi/raw/cython_converters.pxd":18
1872 * cdef inline OM_uint32 c_py_ttl_to_c(object ttl) except? 1:
1873 * """Converts None to GSS_C_INDEFINITE, otherwise returns input."""
1874 * if ttl is None: # <<<<<<<<<<<<<<
1875 * return GSS_C_INDEFINITE
1876 * else:
1877 */
1878 __pyx_t_1 = (__pyx_v_ttl == Py_None);
1879 __pyx_t_2 = (__pyx_t_1 != 0);
1880 if (__pyx_t_2) {
1881
1882 /* "gssapi/raw/cython_converters.pxd":19
1883 * """Converts None to GSS_C_INDEFINITE, otherwise returns input."""
1884 * if ttl is None:
1885 * return GSS_C_INDEFINITE # <<<<<<<<<<<<<<
1886 * else:
1887 * return <OM_uint32>ttl
1888 */
1889 __pyx_r = GSS_C_INDEFINITE;
1890 goto __pyx_L0;
1891
1892 /* "gssapi/raw/cython_converters.pxd":18
1893 * cdef inline OM_uint32 c_py_ttl_to_c(object ttl) except? 1:
1894 * """Converts None to GSS_C_INDEFINITE, otherwise returns input."""
1895 * if ttl is None: # <<<<<<<<<<<<<<
1896 * return GSS_C_INDEFINITE
1897 * else:
1898 */
1899 }
1900
1901 /* "gssapi/raw/cython_converters.pxd":21
1902 * return GSS_C_INDEFINITE
1903 * else:
1904 * return <OM_uint32>ttl # <<<<<<<<<<<<<<
1905 *
1906 *
1907 */
1908 /*else*/ {
1909 __pyx_t_3 = __Pyx_PyInt_As_uint32_t(__pyx_v_ttl); if (unlikely((__pyx_t_3 == ((OM_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(1, 21, __pyx_L1_error)
1910 __pyx_r = ((OM_uint32)__pyx_t_3);
1911 goto __pyx_L0;
1912 }
1913
1914 /* "gssapi/raw/cython_converters.pxd":16
1915 * cdef OID c_make_oid(gss_OID oid)
1916 *
1917 * cdef inline OM_uint32 c_py_ttl_to_c(object ttl) except? 1: # <<<<<<<<<<<<<<
1918 * """Converts None to GSS_C_INDEFINITE, otherwise returns input."""
1919 * if ttl is None:
1920 */
1921
1922 /* function exit code */
1923 __pyx_L1_error:;
1924 __Pyx_AddTraceback("gssapi.raw.cython_converters.c_py_ttl_to_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
1925 __pyx_r = 1;
1926 __pyx_L0:;
1927 __Pyx_RefNannyFinishContext();
1928 return __pyx_r;
1929 }
1930
1931 /* "gssapi/raw/cython_converters.pxd":24
1932 *
1933 *
1934 * cdef inline object c_c_ttl_to_py(OM_uint32 ttl): # <<<<<<<<<<<<<<
1935 * """Converts GSS_C_INDEFINITE to None, otherwise return input."""
1936 * if ttl == GSS_C_INDEFINITE:
1937 */
1938
__pyx_f_6gssapi_3raw_17cython_converters_c_c_ttl_to_py(OM_uint32 __pyx_v_ttl)1939 static CYTHON_INLINE PyObject *__pyx_f_6gssapi_3raw_17cython_converters_c_c_ttl_to_py(OM_uint32 __pyx_v_ttl) {
1940 PyObject *__pyx_r = NULL;
1941 __Pyx_RefNannyDeclarations
1942 int __pyx_t_1;
1943 PyObject *__pyx_t_2 = NULL;
1944 int __pyx_lineno = 0;
1945 const char *__pyx_filename = NULL;
1946 int __pyx_clineno = 0;
1947 __Pyx_RefNannySetupContext("c_c_ttl_to_py", 0);
1948
1949 /* "gssapi/raw/cython_converters.pxd":26
1950 * cdef inline object c_c_ttl_to_py(OM_uint32 ttl):
1951 * """Converts GSS_C_INDEFINITE to None, otherwise return input."""
1952 * if ttl == GSS_C_INDEFINITE: # <<<<<<<<<<<<<<
1953 * return None
1954 * else:
1955 */
1956 __pyx_t_1 = ((__pyx_v_ttl == GSS_C_INDEFINITE) != 0);
1957 if (__pyx_t_1) {
1958
1959 /* "gssapi/raw/cython_converters.pxd":27
1960 * """Converts GSS_C_INDEFINITE to None, otherwise return input."""
1961 * if ttl == GSS_C_INDEFINITE:
1962 * return None # <<<<<<<<<<<<<<
1963 * else:
1964 * return ttl
1965 */
1966 __Pyx_XDECREF(__pyx_r);
1967 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1968 goto __pyx_L0;
1969
1970 /* "gssapi/raw/cython_converters.pxd":26
1971 * cdef inline object c_c_ttl_to_py(OM_uint32 ttl):
1972 * """Converts GSS_C_INDEFINITE to None, otherwise return input."""
1973 * if ttl == GSS_C_INDEFINITE: # <<<<<<<<<<<<<<
1974 * return None
1975 * else:
1976 */
1977 }
1978
1979 /* "gssapi/raw/cython_converters.pxd":29
1980 * return None
1981 * else:
1982 * return ttl # <<<<<<<<<<<<<<
1983 *
1984 *
1985 */
1986 /*else*/ {
1987 __Pyx_XDECREF(__pyx_r);
1988 __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_ttl); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 29, __pyx_L1_error)
1989 __Pyx_GOTREF(__pyx_t_2);
1990 __pyx_r = __pyx_t_2;
1991 __pyx_t_2 = 0;
1992 goto __pyx_L0;
1993 }
1994
1995 /* "gssapi/raw/cython_converters.pxd":24
1996 *
1997 *
1998 * cdef inline object c_c_ttl_to_py(OM_uint32 ttl): # <<<<<<<<<<<<<<
1999 * """Converts GSS_C_INDEFINITE to None, otherwise return input."""
2000 * if ttl == GSS_C_INDEFINITE:
2001 */
2002
2003 /* function exit code */
2004 __pyx_L1_error:;
2005 __Pyx_XDECREF(__pyx_t_2);
2006 __Pyx_AddTraceback("gssapi.raw.cython_converters.c_c_ttl_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
2007 __pyx_r = 0;
2008 __pyx_L0:;
2009 __Pyx_XGIVEREF(__pyx_r);
2010 __Pyx_RefNannyFinishContext();
2011 return __pyx_r;
2012 }
2013
2014 /* "gssapi/raw/cython_converters.pxd":32
2015 *
2016 *
2017 * cdef inline bint c_compare_oids(gss_OID a, gss_OID b): # <<<<<<<<<<<<<<
2018 * """Compare two OIDs to see if they are the same."""
2019 *
2020 */
2021
__pyx_f_6gssapi_3raw_17cython_converters_c_compare_oids(gss_OID __pyx_v_a,gss_OID __pyx_v_b)2022 static CYTHON_INLINE int __pyx_f_6gssapi_3raw_17cython_converters_c_compare_oids(gss_OID __pyx_v_a, gss_OID __pyx_v_b) {
2023 int __pyx_r;
2024 __Pyx_RefNannyDeclarations
2025 int __pyx_t_1;
2026 int __pyx_t_2;
2027 __Pyx_RefNannySetupContext("c_compare_oids", 0);
2028
2029 /* "gssapi/raw/cython_converters.pxd":35
2030 * """Compare two OIDs to see if they are the same."""
2031 *
2032 * return (a.length == b.length and not # <<<<<<<<<<<<<<
2033 * memcmp(a.elements, b.elements, a.length))
2034 */
2035 __pyx_t_2 = ((__pyx_v_a->length == __pyx_v_b->length) != 0);
2036 if (__pyx_t_2) {
2037 } else {
2038 __pyx_t_1 = __pyx_t_2;
2039 goto __pyx_L3_bool_binop_done;
2040 }
2041
2042 /* "gssapi/raw/cython_converters.pxd":36
2043 *
2044 * return (a.length == b.length and not
2045 * memcmp(a.elements, b.elements, a.length)) # <<<<<<<<<<<<<<
2046 */
2047 __pyx_t_2 = ((!(memcmp(__pyx_v_a->elements, __pyx_v_b->elements, __pyx_v_a->length) != 0)) != 0);
2048 __pyx_t_1 = __pyx_t_2;
2049 __pyx_L3_bool_binop_done:;
2050 __pyx_r = __pyx_t_1;
2051 goto __pyx_L0;
2052
2053 /* "gssapi/raw/cython_converters.pxd":32
2054 *
2055 *
2056 * cdef inline bint c_compare_oids(gss_OID a, gss_OID b): # <<<<<<<<<<<<<<
2057 * """Compare two OIDs to see if they are the same."""
2058 *
2059 */
2060
2061 /* function exit code */
2062 __pyx_L0:;
2063 __Pyx_RefNannyFinishContext();
2064 return __pyx_r;
2065 }
2066
2067 static PyMethodDef __pyx_methods[] = {
2068 {0, 0, 0, 0}
2069 };
2070
2071 #if PY_MAJOR_VERSION >= 3
2072 #if CYTHON_PEP489_MULTI_PHASE_INIT
2073 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
2074 static int __pyx_pymod_exec_ext_cred_imp_exp(PyObject* module); /*proto*/
2075 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
2076 {Py_mod_create, (void*)__pyx_pymod_create},
2077 {Py_mod_exec, (void*)__pyx_pymod_exec_ext_cred_imp_exp},
2078 {0, NULL}
2079 };
2080 #endif
2081
2082 static struct PyModuleDef __pyx_moduledef = {
2083 PyModuleDef_HEAD_INIT,
2084 "ext_cred_imp_exp",
2085 __pyx_k_Credentials_Import_Export_Extens, /* m_doc */
2086 #if CYTHON_PEP489_MULTI_PHASE_INIT
2087 0, /* m_size */
2088 #else
2089 -1, /* m_size */
2090 #endif
2091 __pyx_methods /* m_methods */,
2092 #if CYTHON_PEP489_MULTI_PHASE_INIT
2093 __pyx_moduledef_slots, /* m_slots */
2094 #else
2095 NULL, /* m_reload */
2096 #endif
2097 NULL, /* m_traverse */
2098 NULL, /* m_clear */
2099 NULL /* m_free */
2100 };
2101 #endif
2102 #ifndef CYTHON_SMALL_CODE
2103 #if defined(__clang__)
2104 #define CYTHON_SMALL_CODE
2105 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
2106 #define CYTHON_SMALL_CODE __attribute__((cold))
2107 #else
2108 #define CYTHON_SMALL_CODE
2109 #endif
2110 #endif
2111
2112 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2113 {&__pyx_n_s_AcquireCredResult, __pyx_k_AcquireCredResult, sizeof(__pyx_k_AcquireCredResult), 0, 0, 1, 1},
2114 {&__pyx_n_s_AddCredResult, __pyx_k_AddCredResult, sizeof(__pyx_k_AddCredResult), 0, 0, 1, 1},
2115 {&__pyx_n_s_BASE, __pyx_k_BASE, sizeof(__pyx_k_BASE), 0, 0, 1, 1},
2116 {&__pyx_n_s_GSSAPI, __pyx_k_GSSAPI, sizeof(__pyx_k_GSSAPI), 0, 0, 1, 1},
2117 {&__pyx_n_s_GSSError, __pyx_k_GSSError, sizeof(__pyx_k_GSSError), 0, 0, 1, 1},
2118 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2119 {&__pyx_n_s_creds, __pyx_k_creds, sizeof(__pyx_k_creds), 0, 0, 1, 1},
2120 {&__pyx_n_s_export_cred, __pyx_k_export_cred, sizeof(__pyx_k_export_cred), 0, 0, 1, 1},
2121 {&__pyx_n_s_exported_creds, __pyx_k_exported_creds, sizeof(__pyx_k_exported_creds), 0, 0, 1, 1},
2122 {&__pyx_n_s_gssapi_raw_ext_cred_imp_exp, __pyx_k_gssapi_raw_ext_cred_imp_exp, sizeof(__pyx_k_gssapi_raw_ext_cred_imp_exp), 0, 0, 1, 1},
2123 {&__pyx_kp_s_gssapi_raw_ext_cred_imp_exp_pyx, __pyx_k_gssapi_raw_ext_cred_imp_exp_pyx, sizeof(__pyx_k_gssapi_raw_ext_cred_imp_exp_pyx), 0, 0, 1, 0},
2124 {&__pyx_n_s_gssapi_raw_misc, __pyx_k_gssapi_raw_misc, sizeof(__pyx_k_gssapi_raw_misc), 0, 0, 1, 1},
2125 {&__pyx_n_s_gssapi_raw_named_tuples, __pyx_k_gssapi_raw_named_tuples, sizeof(__pyx_k_gssapi_raw_named_tuples), 0, 0, 1, 1},
2126 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
2127 {&__pyx_n_s_import_cred, __pyx_k_import_cred, sizeof(__pyx_k_import_cred), 0, 0, 1, 1},
2128 {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
2129 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
2130 {&__pyx_n_s_maj_stat, __pyx_k_maj_stat, sizeof(__pyx_k_maj_stat), 0, 0, 1, 1},
2131 {&__pyx_n_s_min_stat, __pyx_k_min_stat, sizeof(__pyx_k_min_stat), 0, 0, 1, 1},
2132 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
2133 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
2134 {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
2135 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
2136 {&__pyx_n_s_token, __pyx_k_token, sizeof(__pyx_k_token), 0, 0, 1, 1},
2137 {&__pyx_n_s_token_buffer, __pyx_k_token_buffer, sizeof(__pyx_k_token_buffer), 0, 0, 1, 1},
2138 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
2139 {0, 0, 0, 0, 0, 0, 0}
2140 };
__Pyx_InitCachedBuiltins(void)2141 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
2142 return 0;
2143 }
2144
__Pyx_InitCachedConstants(void)2145 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
2146 __Pyx_RefNannyDeclarations
2147 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
2148
2149 /* "gssapi/raw/ext_cred_imp_exp.pyx":24
2150 *
2151 *
2152 * def export_cred(Creds creds not None): # <<<<<<<<<<<<<<
2153 * """
2154 * export_cred(creds)
2155 */
2156 __pyx_tuple_ = PyTuple_Pack(5, __pyx_n_s_creds, __pyx_n_s_exported_creds, __pyx_n_s_maj_stat, __pyx_n_s_min_stat, __pyx_n_s_res); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 24, __pyx_L1_error)
2157 __Pyx_GOTREF(__pyx_tuple_);
2158 __Pyx_GIVEREF(__pyx_tuple_);
2159 __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gssapi_raw_ext_cred_imp_exp_pyx, __pyx_n_s_export_cred, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 24, __pyx_L1_error)
2160
2161 /* "gssapi/raw/ext_cred_imp_exp.pyx":58
2162 *
2163 *
2164 * def import_cred(token not None): # <<<<<<<<<<<<<<
2165 * """
2166 * import_cred(token)
2167 */
2168 __pyx_tuple__3 = PyTuple_Pack(6, __pyx_n_s_token, __pyx_n_s_token_buffer, __pyx_n_s_creds, __pyx_n_s_maj_stat, __pyx_n_s_min_stat, __pyx_n_s_res); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 58, __pyx_L1_error)
2169 __Pyx_GOTREF(__pyx_tuple__3);
2170 __Pyx_GIVEREF(__pyx_tuple__3);
2171 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gssapi_raw_ext_cred_imp_exp_pyx, __pyx_n_s_import_cred, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 58, __pyx_L1_error)
2172 __Pyx_RefNannyFinishContext();
2173 return 0;
2174 __pyx_L1_error:;
2175 __Pyx_RefNannyFinishContext();
2176 return -1;
2177 }
2178
__Pyx_InitGlobals(void)2179 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
2180 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2181 return 0;
2182 __pyx_L1_error:;
2183 return -1;
2184 }
2185
2186 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
2187 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
2188 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
2189 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
2190 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
2191 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
2192 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
2193
__Pyx_modinit_global_init_code(void)2194 static int __Pyx_modinit_global_init_code(void) {
2195 __Pyx_RefNannyDeclarations
2196 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
2197 /*--- Global init code ---*/
2198 __Pyx_RefNannyFinishContext();
2199 return 0;
2200 }
2201
__Pyx_modinit_variable_export_code(void)2202 static int __Pyx_modinit_variable_export_code(void) {
2203 __Pyx_RefNannyDeclarations
2204 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
2205 /*--- Variable export code ---*/
2206 __Pyx_RefNannyFinishContext();
2207 return 0;
2208 }
2209
__Pyx_modinit_function_export_code(void)2210 static int __Pyx_modinit_function_export_code(void) {
2211 __Pyx_RefNannyDeclarations
2212 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
2213 /*--- Function export code ---*/
2214 __Pyx_RefNannyFinishContext();
2215 return 0;
2216 }
2217
__Pyx_modinit_type_init_code(void)2218 static int __Pyx_modinit_type_init_code(void) {
2219 __Pyx_RefNannyDeclarations
2220 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
2221 /*--- Type init code ---*/
2222 __Pyx_RefNannyFinishContext();
2223 return 0;
2224 }
2225
__Pyx_modinit_type_import_code(void)2226 static int __Pyx_modinit_type_import_code(void) {
2227 __Pyx_RefNannyDeclarations
2228 PyObject *__pyx_t_1 = NULL;
2229 int __pyx_lineno = 0;
2230 const char *__pyx_filename = NULL;
2231 int __pyx_clineno = 0;
2232 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
2233 /*--- Type import code ---*/
2234 __pyx_t_1 = PyImport_ImportModule("gssapi.raw.oids"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
2235 __Pyx_GOTREF(__pyx_t_1);
2236 __pyx_ptype_6gssapi_3raw_4oids_OID = __Pyx_ImportType(__pyx_t_1, "gssapi.raw.oids", "OID", sizeof(struct __pyx_obj_6gssapi_3raw_4oids_OID), __Pyx_ImportType_CheckSize_Warn);
2237 if (!__pyx_ptype_6gssapi_3raw_4oids_OID) __PYX_ERR(2, 4, __pyx_L1_error)
2238 __pyx_vtabptr_6gssapi_3raw_4oids_OID = (struct __pyx_vtabstruct_6gssapi_3raw_4oids_OID*)__Pyx_GetVtable(__pyx_ptype_6gssapi_3raw_4oids_OID->tp_dict); if (unlikely(!__pyx_vtabptr_6gssapi_3raw_4oids_OID)) __PYX_ERR(2, 4, __pyx_L1_error)
2239 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2240 __pyx_t_1 = PyImport_ImportModule("gssapi.raw.creds"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
2241 __Pyx_GOTREF(__pyx_t_1);
2242 __pyx_ptype_6gssapi_3raw_5creds_Creds = __Pyx_ImportType(__pyx_t_1, "gssapi.raw.creds", "Creds", sizeof(struct __pyx_obj_6gssapi_3raw_5creds_Creds), __Pyx_ImportType_CheckSize_Warn);
2243 if (!__pyx_ptype_6gssapi_3raw_5creds_Creds) __PYX_ERR(3, 4, __pyx_L1_error)
2244 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2245 __pyx_t_1 = PyImport_ImportModule("gssapi.raw.names"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3, __pyx_L1_error)
2246 __Pyx_GOTREF(__pyx_t_1);
2247 __pyx_ptype_6gssapi_3raw_5names_Name = __Pyx_ImportType(__pyx_t_1, "gssapi.raw.names", "Name", sizeof(struct __pyx_obj_6gssapi_3raw_5names_Name), __Pyx_ImportType_CheckSize_Warn);
2248 if (!__pyx_ptype_6gssapi_3raw_5names_Name) __PYX_ERR(4, 3, __pyx_L1_error)
2249 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2250 __Pyx_RefNannyFinishContext();
2251 return 0;
2252 __pyx_L1_error:;
2253 __Pyx_XDECREF(__pyx_t_1);
2254 __Pyx_RefNannyFinishContext();
2255 return -1;
2256 }
2257
__Pyx_modinit_variable_import_code(void)2258 static int __Pyx_modinit_variable_import_code(void) {
2259 __Pyx_RefNannyDeclarations
2260 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
2261 /*--- Variable import code ---*/
2262 __Pyx_RefNannyFinishContext();
2263 return 0;
2264 }
2265
__Pyx_modinit_function_import_code(void)2266 static int __Pyx_modinit_function_import_code(void) {
2267 __Pyx_RefNannyDeclarations
2268 PyObject *__pyx_t_1 = NULL;
2269 int __pyx_lineno = 0;
2270 const char *__pyx_filename = NULL;
2271 int __pyx_clineno = 0;
2272 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
2273 /*--- Function import code ---*/
2274 __pyx_t_1 = PyImport_ImportModule("gssapi.raw.cython_converters"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
2275 __Pyx_GOTREF(__pyx_t_1);
2276 if (__Pyx_ImportFunction(__pyx_t_1, "c_get_mech_oid_set", (void (**)(void))&__pyx_f_6gssapi_3raw_17cython_converters_c_get_mech_oid_set, "gss_OID_set (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2277 if (__Pyx_ImportFunction(__pyx_t_1, "c_create_oid_set", (void (**)(void))&__pyx_f_6gssapi_3raw_17cython_converters_c_create_oid_set, "PyObject *(gss_OID_set, struct __pyx_opt_args_6gssapi_3raw_17cython_converters_c_create_oid_set *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2278 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2279 __Pyx_RefNannyFinishContext();
2280 return 0;
2281 __pyx_L1_error:;
2282 __Pyx_XDECREF(__pyx_t_1);
2283 __Pyx_RefNannyFinishContext();
2284 return -1;
2285 }
2286
2287
2288 #ifndef CYTHON_NO_PYINIT_EXPORT
2289 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2290 #elif PY_MAJOR_VERSION < 3
2291 #ifdef __cplusplus
2292 #define __Pyx_PyMODINIT_FUNC extern "C" void
2293 #else
2294 #define __Pyx_PyMODINIT_FUNC void
2295 #endif
2296 #else
2297 #ifdef __cplusplus
2298 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
2299 #else
2300 #define __Pyx_PyMODINIT_FUNC PyObject *
2301 #endif
2302 #endif
2303
2304
2305 #if PY_MAJOR_VERSION < 3
2306 __Pyx_PyMODINIT_FUNC initext_cred_imp_exp(void) CYTHON_SMALL_CODE; /*proto*/
initext_cred_imp_exp(void)2307 __Pyx_PyMODINIT_FUNC initext_cred_imp_exp(void)
2308 #else
2309 __Pyx_PyMODINIT_FUNC PyInit_ext_cred_imp_exp(void) CYTHON_SMALL_CODE; /*proto*/
2310 __Pyx_PyMODINIT_FUNC PyInit_ext_cred_imp_exp(void)
2311 #if CYTHON_PEP489_MULTI_PHASE_INIT
2312 {
2313 return PyModuleDef_Init(&__pyx_moduledef);
2314 }
2315 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
2316 #if PY_VERSION_HEX >= 0x030700A1
2317 static PY_INT64_T main_interpreter_id = -1;
2318 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
2319 if (main_interpreter_id == -1) {
2320 main_interpreter_id = current_id;
2321 return (unlikely(current_id == -1)) ? -1 : 0;
2322 } else if (unlikely(main_interpreter_id != current_id))
2323 #else
2324 static PyInterpreterState *main_interpreter = NULL;
2325 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
2326 if (!main_interpreter) {
2327 main_interpreter = current_interpreter;
2328 } else if (unlikely(main_interpreter != current_interpreter))
2329 #endif
2330 {
2331 PyErr_SetString(
2332 PyExc_ImportError,
2333 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
2334 return -1;
2335 }
2336 return 0;
2337 }
2338 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) {
2339 PyObject *value = PyObject_GetAttrString(spec, from_name);
2340 int result = 0;
2341 if (likely(value)) {
2342 if (allow_none || value != Py_None) {
2343 result = PyDict_SetItemString(moddict, to_name, value);
2344 }
2345 Py_DECREF(value);
2346 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
2347 PyErr_Clear();
2348 } else {
2349 result = -1;
2350 }
2351 return result;
2352 }
2353 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
2354 PyObject *module = NULL, *moddict, *modname;
2355 if (__Pyx_check_single_interpreter())
2356 return NULL;
2357 if (__pyx_m)
2358 return __Pyx_NewRef(__pyx_m);
2359 modname = PyObject_GetAttrString(spec, "name");
2360 if (unlikely(!modname)) goto bad;
2361 module = PyModule_NewObject(modname);
2362 Py_DECREF(modname);
2363 if (unlikely(!module)) goto bad;
2364 moddict = PyModule_GetDict(module);
2365 if (unlikely(!moddict)) goto bad;
2366 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
2367 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
2368 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
2369 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
2370 return module;
2371 bad:
2372 Py_XDECREF(module);
2373 return NULL;
2374 }
2375
2376
2377 static CYTHON_SMALL_CODE int __pyx_pymod_exec_ext_cred_imp_exp(PyObject *__pyx_pyinit_module)
2378 #endif
2379 #endif
2380 {
2381 PyObject *__pyx_t_1 = NULL;
2382 PyObject *__pyx_t_2 = NULL;
2383 int __pyx_lineno = 0;
2384 const char *__pyx_filename = NULL;
2385 int __pyx_clineno = 0;
2386 __Pyx_RefNannyDeclarations
2387 #if CYTHON_PEP489_MULTI_PHASE_INIT
2388 if (__pyx_m) {
2389 if (__pyx_m == __pyx_pyinit_module) return 0;
2390 PyErr_SetString(PyExc_RuntimeError, "Module 'ext_cred_imp_exp' has already been imported. Re-initialisation is not supported.");
2391 return -1;
2392 }
2393 #elif PY_MAJOR_VERSION >= 3
2394 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
2395 #endif
2396 #if CYTHON_REFNANNY
2397 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
2398 if (!__Pyx_RefNanny) {
2399 PyErr_Clear();
2400 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
2401 if (!__Pyx_RefNanny)
2402 Py_FatalError("failed to import 'refnanny' module");
2403 }
2404 #endif
2405 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_ext_cred_imp_exp(void)", 0);
2406 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2407 #ifdef __Pxy_PyFrame_Initialize_Offsets
2408 __Pxy_PyFrame_Initialize_Offsets();
2409 #endif
2410 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
2411 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
2412 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
2413 #ifdef __Pyx_CyFunction_USED
2414 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2415 #endif
2416 #ifdef __Pyx_FusedFunction_USED
2417 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2418 #endif
2419 #ifdef __Pyx_Coroutine_USED
2420 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2421 #endif
2422 #ifdef __Pyx_Generator_USED
2423 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2424 #endif
2425 #ifdef __Pyx_AsyncGen_USED
2426 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2427 #endif
2428 #ifdef __Pyx_StopAsyncIteration_USED
2429 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2430 #endif
2431 /*--- Library function declarations ---*/
2432 /*--- Threads initialization code ---*/
2433 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
2434 #ifdef WITH_THREAD /* Python build with threading support? */
2435 PyEval_InitThreads();
2436 #endif
2437 #endif
2438 /*--- Module creation code ---*/
2439 #if CYTHON_PEP489_MULTI_PHASE_INIT
2440 __pyx_m = __pyx_pyinit_module;
2441 Py_INCREF(__pyx_m);
2442 #else
2443 #if PY_MAJOR_VERSION < 3
2444 __pyx_m = Py_InitModule4("ext_cred_imp_exp", __pyx_methods, __pyx_k_Credentials_Import_Export_Extens, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
2445 #else
2446 __pyx_m = PyModule_Create(&__pyx_moduledef);
2447 #endif
2448 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
2449 #endif
2450 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
2451 Py_INCREF(__pyx_d);
2452 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
2453 Py_INCREF(__pyx_b);
2454 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
2455 Py_INCREF(__pyx_cython_runtime);
2456 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2457 /*--- Initialize various global constants etc. ---*/
2458 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2459 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
2460 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2461 #endif
2462 if (__pyx_module_is_main_gssapi__raw__ext_cred_imp_exp) {
2463 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2464 }
2465 #if PY_MAJOR_VERSION >= 3
2466 {
2467 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2468 if (!PyDict_GetItemString(modules, "gssapi.raw.ext_cred_imp_exp")) {
2469 if (unlikely(PyDict_SetItemString(modules, "gssapi.raw.ext_cred_imp_exp", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2470 }
2471 }
2472 #endif
2473 /*--- Builtin init code ---*/
2474 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2475 /*--- Constants init code ---*/
2476 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2477 /*--- Global type/function init code ---*/
2478 (void)__Pyx_modinit_global_init_code();
2479 (void)__Pyx_modinit_variable_export_code();
2480 (void)__Pyx_modinit_function_export_code();
2481 (void)__Pyx_modinit_type_init_code();
2482 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2483 (void)__Pyx_modinit_variable_import_code();
2484 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2485 /*--- Execution code ---*/
2486 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2487 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2488 #endif
2489
2490 /* "gssapi/raw/ext_cred_imp_exp.pyx":2
2491 * """Credentials Import/Export Extension"""
2492 * GSSAPI="BASE" # This ensures that a full module is generated by Cython # <<<<<<<<<<<<<<
2493 *
2494 * from gssapi.raw.cython_types cimport *
2495 */
2496 if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSAPI, __pyx_n_s_BASE) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
2497
2498 /* "gssapi/raw/ext_cred_imp_exp.pyx":12
2499 * from gssapi.raw.oids cimport OID
2500 *
2501 * from gssapi.raw.misc import GSSError # <<<<<<<<<<<<<<
2502 * from gssapi.raw.named_tuples import AcquireCredResult, AddCredResult
2503 *
2504 */
2505 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
2506 __Pyx_GOTREF(__pyx_t_1);
2507 __Pyx_INCREF(__pyx_n_s_GSSError);
2508 __Pyx_GIVEREF(__pyx_n_s_GSSError);
2509 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_GSSError);
2510 __pyx_t_2 = __Pyx_Import(__pyx_n_s_gssapi_raw_misc, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
2511 __Pyx_GOTREF(__pyx_t_2);
2512 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2513 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_GSSError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
2514 __Pyx_GOTREF(__pyx_t_1);
2515 if (PyDict_SetItem(__pyx_d, __pyx_n_s_GSSError, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
2516 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2518
2519 /* "gssapi/raw/ext_cred_imp_exp.pyx":13
2520 *
2521 * from gssapi.raw.misc import GSSError
2522 * from gssapi.raw.named_tuples import AcquireCredResult, AddCredResult # <<<<<<<<<<<<<<
2523 *
2524 *
2525 */
2526 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
2527 __Pyx_GOTREF(__pyx_t_2);
2528 __Pyx_INCREF(__pyx_n_s_AcquireCredResult);
2529 __Pyx_GIVEREF(__pyx_n_s_AcquireCredResult);
2530 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AcquireCredResult);
2531 __Pyx_INCREF(__pyx_n_s_AddCredResult);
2532 __Pyx_GIVEREF(__pyx_n_s_AddCredResult);
2533 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_AddCredResult);
2534 __pyx_t_1 = __Pyx_Import(__pyx_n_s_gssapi_raw_named_tuples, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
2535 __Pyx_GOTREF(__pyx_t_1);
2536 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2537 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_AcquireCredResult); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
2538 __Pyx_GOTREF(__pyx_t_2);
2539 if (PyDict_SetItem(__pyx_d, __pyx_n_s_AcquireCredResult, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
2540 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2541 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_AddCredResult); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
2542 __Pyx_GOTREF(__pyx_t_2);
2543 if (PyDict_SetItem(__pyx_d, __pyx_n_s_AddCredResult, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
2544 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2545 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2546
2547 /* "gssapi/raw/ext_cred_imp_exp.pyx":24
2548 *
2549 *
2550 * def export_cred(Creds creds not None): # <<<<<<<<<<<<<<
2551 * """
2552 * export_cred(creds)
2553 */
2554 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gssapi_3raw_16ext_cred_imp_exp_1export_cred, NULL, __pyx_n_s_gssapi_raw_ext_cred_imp_exp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
2555 __Pyx_GOTREF(__pyx_t_1);
2556 if (PyDict_SetItem(__pyx_d, __pyx_n_s_export_cred, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
2557 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2558
2559 /* "gssapi/raw/ext_cred_imp_exp.pyx":58
2560 *
2561 *
2562 * def import_cred(token not None): # <<<<<<<<<<<<<<
2563 * """
2564 * import_cred(token)
2565 */
2566 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gssapi_3raw_16ext_cred_imp_exp_3import_cred, NULL, __pyx_n_s_gssapi_raw_ext_cred_imp_exp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
2567 __Pyx_GOTREF(__pyx_t_1);
2568 if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_cred, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
2569 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2570
2571 /* "gssapi/raw/ext_cred_imp_exp.pyx":1
2572 * """Credentials Import/Export Extension""" # <<<<<<<<<<<<<<
2573 * GSSAPI="BASE" # This ensures that a full module is generated by Cython
2574 *
2575 */
2576 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2577 __Pyx_GOTREF(__pyx_t_1);
2578 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2579 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2580
2581 /* "gssapi/raw/cython_converters.pxd":32
2582 *
2583 *
2584 * cdef inline bint c_compare_oids(gss_OID a, gss_OID b): # <<<<<<<<<<<<<<
2585 * """Compare two OIDs to see if they are the same."""
2586 *
2587 */
2588
2589 /*--- Wrapped vars code ---*/
2590
2591 goto __pyx_L0;
2592 __pyx_L1_error:;
2593 __Pyx_XDECREF(__pyx_t_1);
2594 __Pyx_XDECREF(__pyx_t_2);
2595 if (__pyx_m) {
2596 if (__pyx_d) {
2597 __Pyx_AddTraceback("init gssapi.raw.ext_cred_imp_exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
2598 }
2599 Py_CLEAR(__pyx_m);
2600 } else if (!PyErr_Occurred()) {
2601 PyErr_SetString(PyExc_ImportError, "init gssapi.raw.ext_cred_imp_exp");
2602 }
2603 __pyx_L0:;
2604 __Pyx_RefNannyFinishContext();
2605 #if CYTHON_PEP489_MULTI_PHASE_INIT
2606 return (__pyx_m != NULL) ? 0 : -1;
2607 #elif PY_MAJOR_VERSION >= 3
2608 return __pyx_m;
2609 #else
2610 return;
2611 #endif
2612 }
2613
2614 /* --- Runtime support code --- */
2615 /* Refnanny */
2616 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)2617 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2618 PyObject *m = NULL, *p = NULL;
2619 void *r = NULL;
2620 m = PyImport_ImportModule(modname);
2621 if (!m) goto end;
2622 p = PyObject_GetAttrString(m, "RefNannyAPI");
2623 if (!p) goto end;
2624 r = PyLong_AsVoidPtr(p);
2625 end:
2626 Py_XDECREF(p);
2627 Py_XDECREF(m);
2628 return (__Pyx_RefNannyAPIStruct *)r;
2629 }
2630 #endif
2631
2632 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)2633 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
2634 {
2635 if (unlikely(!type)) {
2636 PyErr_SetString(PyExc_SystemError, "Missing type object");
2637 return 0;
2638 }
2639 else if (exact) {
2640 #if PY_MAJOR_VERSION == 2
2641 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
2642 #endif
2643 }
2644 else {
2645 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
2646 }
2647 PyErr_Format(PyExc_TypeError,
2648 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
2649 name, type->tp_name, Py_TYPE(obj)->tp_name);
2650 return 0;
2651 }
2652
2653 /* PyObjectGetAttrStr */
2654 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)2655 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2656 PyTypeObject* tp = Py_TYPE(obj);
2657 if (likely(tp->tp_getattro))
2658 return tp->tp_getattro(obj, attr_name);
2659 #if PY_MAJOR_VERSION < 3
2660 if (likely(tp->tp_getattr))
2661 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2662 #endif
2663 return PyObject_GetAttr(obj, attr_name);
2664 }
2665 #endif
2666
2667 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)2668 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
2669 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
2670 if (unlikely(!result)) {
2671 PyErr_Format(PyExc_NameError,
2672 #if PY_MAJOR_VERSION >= 3
2673 "name '%U' is not defined", name);
2674 #else
2675 "name '%.200s' is not defined", PyString_AS_STRING(name));
2676 #endif
2677 }
2678 return result;
2679 }
2680
2681 /* PyDictVersioning */
2682 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)2683 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
2684 PyObject *dict = Py_TYPE(obj)->tp_dict;
2685 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
2686 }
__Pyx_get_object_dict_version(PyObject * obj)2687 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
2688 PyObject **dictptr = NULL;
2689 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
2690 if (offset) {
2691 #if CYTHON_COMPILING_IN_CPYTHON
2692 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
2693 #else
2694 dictptr = _PyObject_GetDictPtr(obj);
2695 #endif
2696 }
2697 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2698 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)2699 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
2700 PyObject *dict = Py_TYPE(obj)->tp_dict;
2701 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
2702 return 0;
2703 return obj_dict_version == __Pyx_get_object_dict_version(obj);
2704 }
2705 #endif
2706
2707 /* GetModuleGlobalName */
2708 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)2709 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
2710 #else
2711 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
2712 #endif
2713 {
2714 PyObject *result;
2715 #if !CYTHON_AVOID_BORROWED_REFS
2716 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
2717 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
2718 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
2719 if (likely(result)) {
2720 return __Pyx_NewRef(result);
2721 } else if (unlikely(PyErr_Occurred())) {
2722 return NULL;
2723 }
2724 #else
2725 result = PyDict_GetItem(__pyx_d, name);
2726 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
2727 if (likely(result)) {
2728 return __Pyx_NewRef(result);
2729 }
2730 #endif
2731 #else
2732 result = PyObject_GetItem(__pyx_d, name);
2733 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
2734 if (likely(result)) {
2735 return __Pyx_NewRef(result);
2736 }
2737 PyErr_Clear();
2738 #endif
2739 return __Pyx_GetBuiltinName(name);
2740 }
2741
2742 /* PyFunctionFastCall */
2743 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)2744 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2745 PyObject *globals) {
2746 PyFrameObject *f;
2747 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2748 PyObject **fastlocals;
2749 Py_ssize_t i;
2750 PyObject *result;
2751 assert(globals != NULL);
2752 /* XXX Perhaps we should create a specialized
2753 PyFrame_New() that doesn't take locals, but does
2754 take builtins without sanity checking them.
2755 */
2756 assert(tstate != NULL);
2757 f = PyFrame_New(tstate, co, globals, NULL);
2758 if (f == NULL) {
2759 return NULL;
2760 }
2761 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
2762 for (i = 0; i < na; i++) {
2763 Py_INCREF(*args);
2764 fastlocals[i] = *args++;
2765 }
2766 result = PyEval_EvalFrameEx(f,0);
2767 ++tstate->recursion_depth;
2768 Py_DECREF(f);
2769 --tstate->recursion_depth;
2770 return result;
2771 }
2772 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)2773 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
2774 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2775 PyObject *globals = PyFunction_GET_GLOBALS(func);
2776 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2777 PyObject *closure;
2778 #if PY_MAJOR_VERSION >= 3
2779 PyObject *kwdefs;
2780 #endif
2781 PyObject *kwtuple, **k;
2782 PyObject **d;
2783 Py_ssize_t nd;
2784 Py_ssize_t nk;
2785 PyObject *result;
2786 assert(kwargs == NULL || PyDict_Check(kwargs));
2787 nk = kwargs ? PyDict_Size(kwargs) : 0;
2788 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
2789 return NULL;
2790 }
2791 if (
2792 #if PY_MAJOR_VERSION >= 3
2793 co->co_kwonlyargcount == 0 &&
2794 #endif
2795 likely(kwargs == NULL || nk == 0) &&
2796 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2797 if (argdefs == NULL && co->co_argcount == nargs) {
2798 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2799 goto done;
2800 }
2801 else if (nargs == 0 && argdefs != NULL
2802 && co->co_argcount == Py_SIZE(argdefs)) {
2803 /* function called with no arguments, but all parameters have
2804 a default value: use default values as arguments .*/
2805 args = &PyTuple_GET_ITEM(argdefs, 0);
2806 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2807 goto done;
2808 }
2809 }
2810 if (kwargs != NULL) {
2811 Py_ssize_t pos, i;
2812 kwtuple = PyTuple_New(2 * nk);
2813 if (kwtuple == NULL) {
2814 result = NULL;
2815 goto done;
2816 }
2817 k = &PyTuple_GET_ITEM(kwtuple, 0);
2818 pos = i = 0;
2819 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2820 Py_INCREF(k[i]);
2821 Py_INCREF(k[i+1]);
2822 i += 2;
2823 }
2824 nk = i / 2;
2825 }
2826 else {
2827 kwtuple = NULL;
2828 k = NULL;
2829 }
2830 closure = PyFunction_GET_CLOSURE(func);
2831 #if PY_MAJOR_VERSION >= 3
2832 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2833 #endif
2834 if (argdefs != NULL) {
2835 d = &PyTuple_GET_ITEM(argdefs, 0);
2836 nd = Py_SIZE(argdefs);
2837 }
2838 else {
2839 d = NULL;
2840 nd = 0;
2841 }
2842 #if PY_MAJOR_VERSION >= 3
2843 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2844 args, (int)nargs,
2845 k, (int)nk,
2846 d, (int)nd, kwdefs, closure);
2847 #else
2848 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2849 args, (int)nargs,
2850 k, (int)nk,
2851 d, (int)nd, closure);
2852 #endif
2853 Py_XDECREF(kwtuple);
2854 done:
2855 Py_LeaveRecursiveCall();
2856 return result;
2857 }
2858 #endif
2859 #endif
2860
2861 /* PyCFunctionFastCall */
2862 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)2863 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
2864 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
2865 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
2866 PyObject *self = PyCFunction_GET_SELF(func);
2867 int flags = PyCFunction_GET_FLAGS(func);
2868 assert(PyCFunction_Check(func));
2869 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
2870 assert(nargs >= 0);
2871 assert(nargs == 0 || args != NULL);
2872 /* _PyCFunction_FastCallDict() must not be called with an exception set,
2873 because it may clear it (directly or indirectly) and so the
2874 caller loses its exception */
2875 assert(!PyErr_Occurred());
2876 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
2877 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
2878 } else {
2879 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
2880 }
2881 }
2882 #endif
2883
2884 /* PyObjectCall */
2885 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)2886 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2887 PyObject *result;
2888 ternaryfunc call = func->ob_type->tp_call;
2889 if (unlikely(!call))
2890 return PyObject_Call(func, arg, kw);
2891 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2892 return NULL;
2893 result = (*call)(func, arg, kw);
2894 Py_LeaveRecursiveCall();
2895 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2896 PyErr_SetString(
2897 PyExc_SystemError,
2898 "NULL result without error in PyObject_Call");
2899 }
2900 return result;
2901 }
2902 #endif
2903
2904 /* PyErrFetchRestore */
2905 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)2906 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2907 PyObject *tmp_type, *tmp_value, *tmp_tb;
2908 tmp_type = tstate->curexc_type;
2909 tmp_value = tstate->curexc_value;
2910 tmp_tb = tstate->curexc_traceback;
2911 tstate->curexc_type = type;
2912 tstate->curexc_value = value;
2913 tstate->curexc_traceback = tb;
2914 Py_XDECREF(tmp_type);
2915 Py_XDECREF(tmp_value);
2916 Py_XDECREF(tmp_tb);
2917 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)2918 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2919 *type = tstate->curexc_type;
2920 *value = tstate->curexc_value;
2921 *tb = tstate->curexc_traceback;
2922 tstate->curexc_type = 0;
2923 tstate->curexc_value = 0;
2924 tstate->curexc_traceback = 0;
2925 }
2926 #endif
2927
2928 /* RaiseException */
2929 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)2930 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
2931 CYTHON_UNUSED PyObject *cause) {
2932 __Pyx_PyThreadState_declare
2933 Py_XINCREF(type);
2934 if (!value || value == Py_None)
2935 value = NULL;
2936 else
2937 Py_INCREF(value);
2938 if (!tb || tb == Py_None)
2939 tb = NULL;
2940 else {
2941 Py_INCREF(tb);
2942 if (!PyTraceBack_Check(tb)) {
2943 PyErr_SetString(PyExc_TypeError,
2944 "raise: arg 3 must be a traceback or None");
2945 goto raise_error;
2946 }
2947 }
2948 if (PyType_Check(type)) {
2949 #if CYTHON_COMPILING_IN_PYPY
2950 if (!value) {
2951 Py_INCREF(Py_None);
2952 value = Py_None;
2953 }
2954 #endif
2955 PyErr_NormalizeException(&type, &value, &tb);
2956 } else {
2957 if (value) {
2958 PyErr_SetString(PyExc_TypeError,
2959 "instance exception may not have a separate value");
2960 goto raise_error;
2961 }
2962 value = type;
2963 type = (PyObject*) Py_TYPE(type);
2964 Py_INCREF(type);
2965 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
2966 PyErr_SetString(PyExc_TypeError,
2967 "raise: exception class must be a subclass of BaseException");
2968 goto raise_error;
2969 }
2970 }
2971 __Pyx_PyThreadState_assign
2972 __Pyx_ErrRestore(type, value, tb);
2973 return;
2974 raise_error:
2975 Py_XDECREF(value);
2976 Py_XDECREF(type);
2977 Py_XDECREF(tb);
2978 return;
2979 }
2980 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)2981 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
2982 PyObject* owned_instance = NULL;
2983 if (tb == Py_None) {
2984 tb = 0;
2985 } else if (tb && !PyTraceBack_Check(tb)) {
2986 PyErr_SetString(PyExc_TypeError,
2987 "raise: arg 3 must be a traceback or None");
2988 goto bad;
2989 }
2990 if (value == Py_None)
2991 value = 0;
2992 if (PyExceptionInstance_Check(type)) {
2993 if (value) {
2994 PyErr_SetString(PyExc_TypeError,
2995 "instance exception may not have a separate value");
2996 goto bad;
2997 }
2998 value = type;
2999 type = (PyObject*) Py_TYPE(value);
3000 } else if (PyExceptionClass_Check(type)) {
3001 PyObject *instance_class = NULL;
3002 if (value && PyExceptionInstance_Check(value)) {
3003 instance_class = (PyObject*) Py_TYPE(value);
3004 if (instance_class != type) {
3005 int is_subclass = PyObject_IsSubclass(instance_class, type);
3006 if (!is_subclass) {
3007 instance_class = NULL;
3008 } else if (unlikely(is_subclass == -1)) {
3009 goto bad;
3010 } else {
3011 type = instance_class;
3012 }
3013 }
3014 }
3015 if (!instance_class) {
3016 PyObject *args;
3017 if (!value)
3018 args = PyTuple_New(0);
3019 else if (PyTuple_Check(value)) {
3020 Py_INCREF(value);
3021 args = value;
3022 } else
3023 args = PyTuple_Pack(1, value);
3024 if (!args)
3025 goto bad;
3026 owned_instance = PyObject_Call(type, args, NULL);
3027 Py_DECREF(args);
3028 if (!owned_instance)
3029 goto bad;
3030 value = owned_instance;
3031 if (!PyExceptionInstance_Check(value)) {
3032 PyErr_Format(PyExc_TypeError,
3033 "calling %R should have returned an instance of "
3034 "BaseException, not %R",
3035 type, Py_TYPE(value));
3036 goto bad;
3037 }
3038 }
3039 } else {
3040 PyErr_SetString(PyExc_TypeError,
3041 "raise: exception class must be a subclass of BaseException");
3042 goto bad;
3043 }
3044 if (cause) {
3045 PyObject *fixed_cause;
3046 if (cause == Py_None) {
3047 fixed_cause = NULL;
3048 } else if (PyExceptionClass_Check(cause)) {
3049 fixed_cause = PyObject_CallObject(cause, NULL);
3050 if (fixed_cause == NULL)
3051 goto bad;
3052 } else if (PyExceptionInstance_Check(cause)) {
3053 fixed_cause = cause;
3054 Py_INCREF(fixed_cause);
3055 } else {
3056 PyErr_SetString(PyExc_TypeError,
3057 "exception causes must derive from "
3058 "BaseException");
3059 goto bad;
3060 }
3061 PyException_SetCause(value, fixed_cause);
3062 }
3063 PyErr_SetObject(type, value);
3064 if (tb) {
3065 #if CYTHON_COMPILING_IN_PYPY
3066 PyObject *tmp_type, *tmp_value, *tmp_tb;
3067 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
3068 Py_INCREF(tb);
3069 PyErr_Restore(tmp_type, tmp_value, tb);
3070 Py_XDECREF(tmp_tb);
3071 #else
3072 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3073 PyObject* tmp_tb = tstate->curexc_traceback;
3074 if (tb != tmp_tb) {
3075 Py_INCREF(tb);
3076 tstate->curexc_traceback = tb;
3077 Py_XDECREF(tmp_tb);
3078 }
3079 #endif
3080 }
3081 bad:
3082 Py_XDECREF(owned_instance);
3083 return;
3084 }
3085 #endif
3086
3087 /* PyObjectCallMethO */
3088 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)3089 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
3090 PyObject *self, *result;
3091 PyCFunction cfunc;
3092 cfunc = PyCFunction_GET_FUNCTION(func);
3093 self = PyCFunction_GET_SELF(func);
3094 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
3095 return NULL;
3096 result = cfunc(self, arg);
3097 Py_LeaveRecursiveCall();
3098 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3099 PyErr_SetString(
3100 PyExc_SystemError,
3101 "NULL result without error in PyObject_Call");
3102 }
3103 return result;
3104 }
3105 #endif
3106
3107 /* PyObjectCallNoArg */
3108 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)3109 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
3110 #if CYTHON_FAST_PYCALL
3111 if (PyFunction_Check(func)) {
3112 return __Pyx_PyFunction_FastCall(func, NULL, 0);
3113 }
3114 #endif
3115 #ifdef __Pyx_CyFunction_USED
3116 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
3117 #else
3118 if (likely(PyCFunction_Check(func)))
3119 #endif
3120 {
3121 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
3122 return __Pyx_PyObject_CallMethO(func, NULL);
3123 }
3124 }
3125 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
3126 }
3127 #endif
3128
3129 /* TypeImport */
3130 #ifndef __PYX_HAVE_RT_ImportType
3131 #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)3132 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
3133 size_t size, enum __Pyx_ImportType_CheckSize check_size)
3134 {
3135 PyObject *result = 0;
3136 char warning[200];
3137 Py_ssize_t basicsize;
3138 #ifdef Py_LIMITED_API
3139 PyObject *py_basicsize;
3140 #endif
3141 result = PyObject_GetAttrString(module, class_name);
3142 if (!result)
3143 goto bad;
3144 if (!PyType_Check(result)) {
3145 PyErr_Format(PyExc_TypeError,
3146 "%.200s.%.200s is not a type object",
3147 module_name, class_name);
3148 goto bad;
3149 }
3150 #ifndef Py_LIMITED_API
3151 basicsize = ((PyTypeObject *)result)->tp_basicsize;
3152 #else
3153 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
3154 if (!py_basicsize)
3155 goto bad;
3156 basicsize = PyLong_AsSsize_t(py_basicsize);
3157 Py_DECREF(py_basicsize);
3158 py_basicsize = 0;
3159 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
3160 goto bad;
3161 #endif
3162 if ((size_t)basicsize < size) {
3163 PyErr_Format(PyExc_ValueError,
3164 "%.200s.%.200s size changed, may indicate binary incompatibility. "
3165 "Expected %zd from C header, got %zd from PyObject",
3166 module_name, class_name, size, basicsize);
3167 goto bad;
3168 }
3169 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
3170 PyErr_Format(PyExc_ValueError,
3171 "%.200s.%.200s size changed, may indicate binary incompatibility. "
3172 "Expected %zd from C header, got %zd from PyObject",
3173 module_name, class_name, size, basicsize);
3174 goto bad;
3175 }
3176 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
3177 PyOS_snprintf(warning, sizeof(warning),
3178 "%s.%s size changed, may indicate binary incompatibility. "
3179 "Expected %zd from C header, got %zd from PyObject",
3180 module_name, class_name, size, basicsize);
3181 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
3182 }
3183 return (PyTypeObject *)result;
3184 bad:
3185 Py_XDECREF(result);
3186 return NULL;
3187 }
3188 #endif
3189
3190 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)3191 static void* __Pyx_GetVtable(PyObject *dict) {
3192 void* ptr;
3193 PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
3194 if (!ob)
3195 goto bad;
3196 #if PY_VERSION_HEX >= 0x02070000
3197 ptr = PyCapsule_GetPointer(ob, 0);
3198 #else
3199 ptr = PyCObject_AsVoidPtr(ob);
3200 #endif
3201 if (!ptr && !PyErr_Occurred())
3202 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
3203 Py_DECREF(ob);
3204 return ptr;
3205 bad:
3206 Py_XDECREF(ob);
3207 return NULL;
3208 }
3209
3210 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)3211 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
3212 PyObject *empty_list = 0;
3213 PyObject *module = 0;
3214 PyObject *global_dict = 0;
3215 PyObject *empty_dict = 0;
3216 PyObject *list;
3217 #if PY_MAJOR_VERSION < 3
3218 PyObject *py_import;
3219 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
3220 if (!py_import)
3221 goto bad;
3222 #endif
3223 if (from_list)
3224 list = from_list;
3225 else {
3226 empty_list = PyList_New(0);
3227 if (!empty_list)
3228 goto bad;
3229 list = empty_list;
3230 }
3231 global_dict = PyModule_GetDict(__pyx_m);
3232 if (!global_dict)
3233 goto bad;
3234 empty_dict = PyDict_New();
3235 if (!empty_dict)
3236 goto bad;
3237 {
3238 #if PY_MAJOR_VERSION >= 3
3239 if (level == -1) {
3240 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
3241 module = PyImport_ImportModuleLevelObject(
3242 name, global_dict, empty_dict, list, 1);
3243 if (!module) {
3244 if (!PyErr_ExceptionMatches(PyExc_ImportError))
3245 goto bad;
3246 PyErr_Clear();
3247 }
3248 }
3249 level = 0;
3250 }
3251 #endif
3252 if (!module) {
3253 #if PY_MAJOR_VERSION < 3
3254 PyObject *py_level = PyInt_FromLong(level);
3255 if (!py_level)
3256 goto bad;
3257 module = PyObject_CallFunctionObjArgs(py_import,
3258 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
3259 Py_DECREF(py_level);
3260 #else
3261 module = PyImport_ImportModuleLevelObject(
3262 name, global_dict, empty_dict, list, level);
3263 #endif
3264 }
3265 }
3266 bad:
3267 #if PY_MAJOR_VERSION < 3
3268 Py_XDECREF(py_import);
3269 #endif
3270 Py_XDECREF(empty_list);
3271 Py_XDECREF(empty_dict);
3272 return module;
3273 }
3274
3275 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)3276 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
3277 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
3278 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
3279 PyErr_Format(PyExc_ImportError,
3280 #if PY_MAJOR_VERSION < 3
3281 "cannot import name %.230s", PyString_AS_STRING(name));
3282 #else
3283 "cannot import name %S", name);
3284 #endif
3285 }
3286 return value;
3287 }
3288
3289 /* CLineInTraceback */
3290 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)3291 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
3292 PyObject *use_cline;
3293 PyObject *ptype, *pvalue, *ptraceback;
3294 #if CYTHON_COMPILING_IN_CPYTHON
3295 PyObject **cython_runtime_dict;
3296 #endif
3297 if (unlikely(!__pyx_cython_runtime)) {
3298 return c_line;
3299 }
3300 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3301 #if CYTHON_COMPILING_IN_CPYTHON
3302 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3303 if (likely(cython_runtime_dict)) {
3304 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
3305 use_cline, *cython_runtime_dict,
3306 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
3307 } else
3308 #endif
3309 {
3310 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3311 if (use_cline_obj) {
3312 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3313 Py_DECREF(use_cline_obj);
3314 } else {
3315 PyErr_Clear();
3316 use_cline = NULL;
3317 }
3318 }
3319 if (!use_cline) {
3320 c_line = 0;
3321 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3322 }
3323 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
3324 c_line = 0;
3325 }
3326 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3327 return c_line;
3328 }
3329 #endif
3330
3331 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)3332 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
3333 int start = 0, mid = 0, end = count - 1;
3334 if (end >= 0 && code_line > entries[end].code_line) {
3335 return count;
3336 }
3337 while (start < end) {
3338 mid = start + (end - start) / 2;
3339 if (code_line < entries[mid].code_line) {
3340 end = mid;
3341 } else if (code_line > entries[mid].code_line) {
3342 start = mid + 1;
3343 } else {
3344 return mid;
3345 }
3346 }
3347 if (code_line <= entries[mid].code_line) {
3348 return mid;
3349 } else {
3350 return mid + 1;
3351 }
3352 }
__pyx_find_code_object(int code_line)3353 static PyCodeObject *__pyx_find_code_object(int code_line) {
3354 PyCodeObject* code_object;
3355 int pos;
3356 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3357 return NULL;
3358 }
3359 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3360 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
3361 return NULL;
3362 }
3363 code_object = __pyx_code_cache.entries[pos].code_object;
3364 Py_INCREF(code_object);
3365 return code_object;
3366 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)3367 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
3368 int pos, i;
3369 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3370 if (unlikely(!code_line)) {
3371 return;
3372 }
3373 if (unlikely(!entries)) {
3374 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
3375 if (likely(entries)) {
3376 __pyx_code_cache.entries = entries;
3377 __pyx_code_cache.max_count = 64;
3378 __pyx_code_cache.count = 1;
3379 entries[0].code_line = code_line;
3380 entries[0].code_object = code_object;
3381 Py_INCREF(code_object);
3382 }
3383 return;
3384 }
3385 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3386 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
3387 PyCodeObject* tmp = entries[pos].code_object;
3388 entries[pos].code_object = code_object;
3389 Py_DECREF(tmp);
3390 return;
3391 }
3392 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
3393 int new_max = __pyx_code_cache.max_count + 64;
3394 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
3395 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
3396 if (unlikely(!entries)) {
3397 return;
3398 }
3399 __pyx_code_cache.entries = entries;
3400 __pyx_code_cache.max_count = new_max;
3401 }
3402 for (i=__pyx_code_cache.count; i>pos; i--) {
3403 entries[i] = entries[i-1];
3404 }
3405 entries[pos].code_line = code_line;
3406 entries[pos].code_object = code_object;
3407 __pyx_code_cache.count++;
3408 Py_INCREF(code_object);
3409 }
3410
3411 /* AddTraceback */
3412 #include "compile.h"
3413 #include "frameobject.h"
3414 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)3415 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3416 const char *funcname, int c_line,
3417 int py_line, const char *filename) {
3418 PyCodeObject *py_code = 0;
3419 PyObject *py_srcfile = 0;
3420 PyObject *py_funcname = 0;
3421 #if PY_MAJOR_VERSION < 3
3422 py_srcfile = PyString_FromString(filename);
3423 #else
3424 py_srcfile = PyUnicode_FromString(filename);
3425 #endif
3426 if (!py_srcfile) goto bad;
3427 if (c_line) {
3428 #if PY_MAJOR_VERSION < 3
3429 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3430 #else
3431 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3432 #endif
3433 }
3434 else {
3435 #if PY_MAJOR_VERSION < 3
3436 py_funcname = PyString_FromString(funcname);
3437 #else
3438 py_funcname = PyUnicode_FromString(funcname);
3439 #endif
3440 }
3441 if (!py_funcname) goto bad;
3442 py_code = __Pyx_PyCode_New(
3443 0,
3444 0,
3445 0,
3446 0,
3447 0,
3448 __pyx_empty_bytes, /*PyObject *code,*/
3449 __pyx_empty_tuple, /*PyObject *consts,*/
3450 __pyx_empty_tuple, /*PyObject *names,*/
3451 __pyx_empty_tuple, /*PyObject *varnames,*/
3452 __pyx_empty_tuple, /*PyObject *freevars,*/
3453 __pyx_empty_tuple, /*PyObject *cellvars,*/
3454 py_srcfile, /*PyObject *filename,*/
3455 py_funcname, /*PyObject *name,*/
3456 py_line,
3457 __pyx_empty_bytes /*PyObject *lnotab*/
3458 );
3459 Py_DECREF(py_srcfile);
3460 Py_DECREF(py_funcname);
3461 return py_code;
3462 bad:
3463 Py_XDECREF(py_srcfile);
3464 Py_XDECREF(py_funcname);
3465 return NULL;
3466 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)3467 static void __Pyx_AddTraceback(const char *funcname, int c_line,
3468 int py_line, const char *filename) {
3469 PyCodeObject *py_code = 0;
3470 PyFrameObject *py_frame = 0;
3471 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3472 if (c_line) {
3473 c_line = __Pyx_CLineForTraceback(tstate, c_line);
3474 }
3475 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3476 if (!py_code) {
3477 py_code = __Pyx_CreateCodeObjectForTraceback(
3478 funcname, c_line, py_line, filename);
3479 if (!py_code) goto bad;
3480 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3481 }
3482 py_frame = PyFrame_New(
3483 tstate, /*PyThreadState *tstate,*/
3484 py_code, /*PyCodeObject *code,*/
3485 __pyx_d, /*PyObject *globals,*/
3486 0 /*PyObject *locals*/
3487 );
3488 if (!py_frame) goto bad;
3489 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3490 PyTraceBack_Here(py_frame);
3491 bad:
3492 Py_XDECREF(py_code);
3493 Py_XDECREF(py_frame);
3494 }
3495
3496 /* CIntFromPyVerify */
3497 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
3498 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
3499 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
3500 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
3501 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
3502 {\
3503 func_type value = func_value;\
3504 if (sizeof(target_type) < sizeof(func_type)) {\
3505 if (unlikely(value != (func_type) (target_type) value)) {\
3506 func_type zero = 0;\
3507 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
3508 return (target_type) -1;\
3509 if (is_unsigned && unlikely(value < zero))\
3510 goto raise_neg_overflow;\
3511 else\
3512 goto raise_overflow;\
3513 }\
3514 }\
3515 return (target_type) value;\
3516 }
3517
3518 /* CIntToPy */
__Pyx_PyInt_From_uint32_t(uint32_t value)3519 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
3520 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3521 #pragma GCC diagnostic push
3522 #pragma GCC diagnostic ignored "-Wconversion"
3523 #endif
3524 const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
3525 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3526 #pragma GCC diagnostic pop
3527 #endif
3528 const int is_unsigned = neg_one > const_zero;
3529 if (is_unsigned) {
3530 if (sizeof(uint32_t) < sizeof(long)) {
3531 return PyInt_FromLong((long) value);
3532 } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
3533 return PyLong_FromUnsignedLong((unsigned long) value);
3534 #ifdef HAVE_LONG_LONG
3535 } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
3536 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3537 #endif
3538 }
3539 } else {
3540 if (sizeof(uint32_t) <= sizeof(long)) {
3541 return PyInt_FromLong((long) value);
3542 #ifdef HAVE_LONG_LONG
3543 } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
3544 return PyLong_FromLongLong((PY_LONG_LONG) value);
3545 #endif
3546 }
3547 }
3548 {
3549 int one = 1; int little = (int)*(unsigned char *)&one;
3550 unsigned char *bytes = (unsigned char *)&value;
3551 return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
3552 little, !is_unsigned);
3553 }
3554 }
3555
3556 /* CIntFromPy */
__Pyx_PyInt_As_uint32_t(PyObject * x)3557 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
3558 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3559 #pragma GCC diagnostic push
3560 #pragma GCC diagnostic ignored "-Wconversion"
3561 #endif
3562 const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
3563 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3564 #pragma GCC diagnostic pop
3565 #endif
3566 const int is_unsigned = neg_one > const_zero;
3567 #if PY_MAJOR_VERSION < 3
3568 if (likely(PyInt_Check(x))) {
3569 if (sizeof(uint32_t) < sizeof(long)) {
3570 __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
3571 } else {
3572 long val = PyInt_AS_LONG(x);
3573 if (is_unsigned && unlikely(val < 0)) {
3574 goto raise_neg_overflow;
3575 }
3576 return (uint32_t) val;
3577 }
3578 } else
3579 #endif
3580 if (likely(PyLong_Check(x))) {
3581 if (is_unsigned) {
3582 #if CYTHON_USE_PYLONG_INTERNALS
3583 const digit* digits = ((PyLongObject*)x)->ob_digit;
3584 switch (Py_SIZE(x)) {
3585 case 0: return (uint32_t) 0;
3586 case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
3587 case 2:
3588 if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
3589 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3590 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3591 } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
3592 return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
3593 }
3594 }
3595 break;
3596 case 3:
3597 if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
3598 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3599 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3600 } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
3601 return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
3602 }
3603 }
3604 break;
3605 case 4:
3606 if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
3607 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3608 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3609 } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
3610 return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
3611 }
3612 }
3613 break;
3614 }
3615 #endif
3616 #if CYTHON_COMPILING_IN_CPYTHON
3617 if (unlikely(Py_SIZE(x) < 0)) {
3618 goto raise_neg_overflow;
3619 }
3620 #else
3621 {
3622 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3623 if (unlikely(result < 0))
3624 return (uint32_t) -1;
3625 if (unlikely(result == 1))
3626 goto raise_neg_overflow;
3627 }
3628 #endif
3629 if (sizeof(uint32_t) <= sizeof(unsigned long)) {
3630 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
3631 #ifdef HAVE_LONG_LONG
3632 } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
3633 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3634 #endif
3635 }
3636 } else {
3637 #if CYTHON_USE_PYLONG_INTERNALS
3638 const digit* digits = ((PyLongObject*)x)->ob_digit;
3639 switch (Py_SIZE(x)) {
3640 case 0: return (uint32_t) 0;
3641 case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
3642 case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0])
3643 case -2:
3644 if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
3645 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3646 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3647 } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
3648 return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3649 }
3650 }
3651 break;
3652 case 2:
3653 if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
3654 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3655 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3656 } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
3657 return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3658 }
3659 }
3660 break;
3661 case -3:
3662 if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
3663 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3664 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3665 } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
3666 return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3667 }
3668 }
3669 break;
3670 case 3:
3671 if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
3672 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3673 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3674 } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
3675 return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3676 }
3677 }
3678 break;
3679 case -4:
3680 if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
3681 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3682 __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3683 } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
3684 return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3685 }
3686 }
3687 break;
3688 case 4:
3689 if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
3690 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3691 __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3692 } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
3693 return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
3694 }
3695 }
3696 break;
3697 }
3698 #endif
3699 if (sizeof(uint32_t) <= sizeof(long)) {
3700 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
3701 #ifdef HAVE_LONG_LONG
3702 } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
3703 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
3704 #endif
3705 }
3706 }
3707 {
3708 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3709 PyErr_SetString(PyExc_RuntimeError,
3710 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3711 #else
3712 uint32_t val;
3713 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3714 #if PY_MAJOR_VERSION < 3
3715 if (likely(v) && !PyLong_Check(v)) {
3716 PyObject *tmp = v;
3717 v = PyNumber_Long(tmp);
3718 Py_DECREF(tmp);
3719 }
3720 #endif
3721 if (likely(v)) {
3722 int one = 1; int is_little = (int)*(unsigned char *)&one;
3723 unsigned char *bytes = (unsigned char *)&val;
3724 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3725 bytes, sizeof(val),
3726 is_little, !is_unsigned);
3727 Py_DECREF(v);
3728 if (likely(!ret))
3729 return val;
3730 }
3731 #endif
3732 return (uint32_t) -1;
3733 }
3734 } else {
3735 uint32_t val;
3736 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3737 if (!tmp) return (uint32_t) -1;
3738 val = __Pyx_PyInt_As_uint32_t(tmp);
3739 Py_DECREF(tmp);
3740 return val;
3741 }
3742 raise_overflow:
3743 PyErr_SetString(PyExc_OverflowError,
3744 "value too large to convert to uint32_t");
3745 return (uint32_t) -1;
3746 raise_neg_overflow:
3747 PyErr_SetString(PyExc_OverflowError,
3748 "can't convert negative value to uint32_t");
3749 return (uint32_t) -1;
3750 }
3751
3752 /* CIntToPy */
__Pyx_PyInt_From_long(long value)3753 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
3754 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3755 #pragma GCC diagnostic push
3756 #pragma GCC diagnostic ignored "-Wconversion"
3757 #endif
3758 const long neg_one = (long) -1, const_zero = (long) 0;
3759 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3760 #pragma GCC diagnostic pop
3761 #endif
3762 const int is_unsigned = neg_one > const_zero;
3763 if (is_unsigned) {
3764 if (sizeof(long) < sizeof(long)) {
3765 return PyInt_FromLong((long) value);
3766 } else if (sizeof(long) <= sizeof(unsigned long)) {
3767 return PyLong_FromUnsignedLong((unsigned long) value);
3768 #ifdef HAVE_LONG_LONG
3769 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3770 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3771 #endif
3772 }
3773 } else {
3774 if (sizeof(long) <= sizeof(long)) {
3775 return PyInt_FromLong((long) value);
3776 #ifdef HAVE_LONG_LONG
3777 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3778 return PyLong_FromLongLong((PY_LONG_LONG) value);
3779 #endif
3780 }
3781 }
3782 {
3783 int one = 1; int little = (int)*(unsigned char *)&one;
3784 unsigned char *bytes = (unsigned char *)&value;
3785 return _PyLong_FromByteArray(bytes, sizeof(long),
3786 little, !is_unsigned);
3787 }
3788 }
3789
3790 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)3791 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
3792 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3793 #pragma GCC diagnostic push
3794 #pragma GCC diagnostic ignored "-Wconversion"
3795 #endif
3796 const long neg_one = (long) -1, const_zero = (long) 0;
3797 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3798 #pragma GCC diagnostic pop
3799 #endif
3800 const int is_unsigned = neg_one > const_zero;
3801 #if PY_MAJOR_VERSION < 3
3802 if (likely(PyInt_Check(x))) {
3803 if (sizeof(long) < sizeof(long)) {
3804 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
3805 } else {
3806 long val = PyInt_AS_LONG(x);
3807 if (is_unsigned && unlikely(val < 0)) {
3808 goto raise_neg_overflow;
3809 }
3810 return (long) val;
3811 }
3812 } else
3813 #endif
3814 if (likely(PyLong_Check(x))) {
3815 if (is_unsigned) {
3816 #if CYTHON_USE_PYLONG_INTERNALS
3817 const digit* digits = ((PyLongObject*)x)->ob_digit;
3818 switch (Py_SIZE(x)) {
3819 case 0: return (long) 0;
3820 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
3821 case 2:
3822 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3823 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3824 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3825 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
3826 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3827 }
3828 }
3829 break;
3830 case 3:
3831 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3832 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3833 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3834 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
3835 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3836 }
3837 }
3838 break;
3839 case 4:
3840 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3841 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3842 __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])))
3843 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
3844 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3845 }
3846 }
3847 break;
3848 }
3849 #endif
3850 #if CYTHON_COMPILING_IN_CPYTHON
3851 if (unlikely(Py_SIZE(x) < 0)) {
3852 goto raise_neg_overflow;
3853 }
3854 #else
3855 {
3856 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3857 if (unlikely(result < 0))
3858 return (long) -1;
3859 if (unlikely(result == 1))
3860 goto raise_neg_overflow;
3861 }
3862 #endif
3863 if (sizeof(long) <= sizeof(unsigned long)) {
3864 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
3865 #ifdef HAVE_LONG_LONG
3866 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3867 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3868 #endif
3869 }
3870 } else {
3871 #if CYTHON_USE_PYLONG_INTERNALS
3872 const digit* digits = ((PyLongObject*)x)->ob_digit;
3873 switch (Py_SIZE(x)) {
3874 case 0: return (long) 0;
3875 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
3876 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
3877 case -2:
3878 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
3879 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3880 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3881 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3882 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3883 }
3884 }
3885 break;
3886 case 2:
3887 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3888 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3889 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3890 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3891 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3892 }
3893 }
3894 break;
3895 case -3:
3896 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3897 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3898 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3899 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3900 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3901 }
3902 }
3903 break;
3904 case 3:
3905 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3906 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3907 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3908 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3909 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3910 }
3911 }
3912 break;
3913 case -4:
3914 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3915 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3916 __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])))
3917 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3918 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3919 }
3920 }
3921 break;
3922 case 4:
3923 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3924 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3925 __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])))
3926 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3927 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3928 }
3929 }
3930 break;
3931 }
3932 #endif
3933 if (sizeof(long) <= sizeof(long)) {
3934 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
3935 #ifdef HAVE_LONG_LONG
3936 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3937 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
3938 #endif
3939 }
3940 }
3941 {
3942 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3943 PyErr_SetString(PyExc_RuntimeError,
3944 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3945 #else
3946 long val;
3947 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3948 #if PY_MAJOR_VERSION < 3
3949 if (likely(v) && !PyLong_Check(v)) {
3950 PyObject *tmp = v;
3951 v = PyNumber_Long(tmp);
3952 Py_DECREF(tmp);
3953 }
3954 #endif
3955 if (likely(v)) {
3956 int one = 1; int is_little = (int)*(unsigned char *)&one;
3957 unsigned char *bytes = (unsigned char *)&val;
3958 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3959 bytes, sizeof(val),
3960 is_little, !is_unsigned);
3961 Py_DECREF(v);
3962 if (likely(!ret))
3963 return val;
3964 }
3965 #endif
3966 return (long) -1;
3967 }
3968 } else {
3969 long val;
3970 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3971 if (!tmp) return (long) -1;
3972 val = __Pyx_PyInt_As_long(tmp);
3973 Py_DECREF(tmp);
3974 return val;
3975 }
3976 raise_overflow:
3977 PyErr_SetString(PyExc_OverflowError,
3978 "value too large to convert to long");
3979 return (long) -1;
3980 raise_neg_overflow:
3981 PyErr_SetString(PyExc_OverflowError,
3982 "can't convert negative value to long");
3983 return (long) -1;
3984 }
3985
3986 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)3987 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
3988 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3989 #pragma GCC diagnostic push
3990 #pragma GCC diagnostic ignored "-Wconversion"
3991 #endif
3992 const int neg_one = (int) -1, const_zero = (int) 0;
3993 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3994 #pragma GCC diagnostic pop
3995 #endif
3996 const int is_unsigned = neg_one > const_zero;
3997 #if PY_MAJOR_VERSION < 3
3998 if (likely(PyInt_Check(x))) {
3999 if (sizeof(int) < sizeof(long)) {
4000 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
4001 } else {
4002 long val = PyInt_AS_LONG(x);
4003 if (is_unsigned && unlikely(val < 0)) {
4004 goto raise_neg_overflow;
4005 }
4006 return (int) val;
4007 }
4008 } else
4009 #endif
4010 if (likely(PyLong_Check(x))) {
4011 if (is_unsigned) {
4012 #if CYTHON_USE_PYLONG_INTERNALS
4013 const digit* digits = ((PyLongObject*)x)->ob_digit;
4014 switch (Py_SIZE(x)) {
4015 case 0: return (int) 0;
4016 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
4017 case 2:
4018 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
4019 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4020 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4021 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
4022 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
4023 }
4024 }
4025 break;
4026 case 3:
4027 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
4028 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4029 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4030 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
4031 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
4032 }
4033 }
4034 break;
4035 case 4:
4036 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
4037 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4038 __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])))
4039 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
4040 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
4041 }
4042 }
4043 break;
4044 }
4045 #endif
4046 #if CYTHON_COMPILING_IN_CPYTHON
4047 if (unlikely(Py_SIZE(x) < 0)) {
4048 goto raise_neg_overflow;
4049 }
4050 #else
4051 {
4052 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
4053 if (unlikely(result < 0))
4054 return (int) -1;
4055 if (unlikely(result == 1))
4056 goto raise_neg_overflow;
4057 }
4058 #endif
4059 if (sizeof(int) <= sizeof(unsigned long)) {
4060 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
4061 #ifdef HAVE_LONG_LONG
4062 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
4063 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
4064 #endif
4065 }
4066 } else {
4067 #if CYTHON_USE_PYLONG_INTERNALS
4068 const digit* digits = ((PyLongObject*)x)->ob_digit;
4069 switch (Py_SIZE(x)) {
4070 case 0: return (int) 0;
4071 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
4072 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
4073 case -2:
4074 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
4075 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4076 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4077 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
4078 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4079 }
4080 }
4081 break;
4082 case 2:
4083 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
4084 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
4085 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4086 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
4087 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4088 }
4089 }
4090 break;
4091 case -3:
4092 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
4093 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4094 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4095 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
4096 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4097 }
4098 }
4099 break;
4100 case 3:
4101 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
4102 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
4103 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
4104 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
4105 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4106 }
4107 }
4108 break;
4109 case -4:
4110 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
4111 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4112 __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])))
4113 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
4114 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4115 }
4116 }
4117 break;
4118 case 4:
4119 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
4120 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
4121 __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])))
4122 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
4123 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4124 }
4125 }
4126 break;
4127 }
4128 #endif
4129 if (sizeof(int) <= sizeof(long)) {
4130 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
4131 #ifdef HAVE_LONG_LONG
4132 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
4133 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
4134 #endif
4135 }
4136 }
4137 {
4138 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
4139 PyErr_SetString(PyExc_RuntimeError,
4140 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
4141 #else
4142 int val;
4143 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
4144 #if PY_MAJOR_VERSION < 3
4145 if (likely(v) && !PyLong_Check(v)) {
4146 PyObject *tmp = v;
4147 v = PyNumber_Long(tmp);
4148 Py_DECREF(tmp);
4149 }
4150 #endif
4151 if (likely(v)) {
4152 int one = 1; int is_little = (int)*(unsigned char *)&one;
4153 unsigned char *bytes = (unsigned char *)&val;
4154 int ret = _PyLong_AsByteArray((PyLongObject *)v,
4155 bytes, sizeof(val),
4156 is_little, !is_unsigned);
4157 Py_DECREF(v);
4158 if (likely(!ret))
4159 return val;
4160 }
4161 #endif
4162 return (int) -1;
4163 }
4164 } else {
4165 int val;
4166 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
4167 if (!tmp) return (int) -1;
4168 val = __Pyx_PyInt_As_int(tmp);
4169 Py_DECREF(tmp);
4170 return val;
4171 }
4172 raise_overflow:
4173 PyErr_SetString(PyExc_OverflowError,
4174 "value too large to convert to int");
4175 return (int) -1;
4176 raise_neg_overflow:
4177 PyErr_SetString(PyExc_OverflowError,
4178 "can't convert negative value to int");
4179 return (int) -1;
4180 }
4181
4182 /* FastTypeChecks */
4183 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)4184 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
4185 while (a) {
4186 a = a->tp_base;
4187 if (a == b)
4188 return 1;
4189 }
4190 return b == &PyBaseObject_Type;
4191 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)4192 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
4193 PyObject *mro;
4194 if (a == b) return 1;
4195 mro = a->tp_mro;
4196 if (likely(mro)) {
4197 Py_ssize_t i, n;
4198 n = PyTuple_GET_SIZE(mro);
4199 for (i = 0; i < n; i++) {
4200 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
4201 return 1;
4202 }
4203 return 0;
4204 }
4205 return __Pyx_InBases(a, b);
4206 }
4207 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4208 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
4209 PyObject *exception, *value, *tb;
4210 int res;
4211 __Pyx_PyThreadState_declare
4212 __Pyx_PyThreadState_assign
4213 __Pyx_ErrFetch(&exception, &value, &tb);
4214 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
4215 if (unlikely(res == -1)) {
4216 PyErr_WriteUnraisable(err);
4217 res = 0;
4218 }
4219 if (!res) {
4220 res = PyObject_IsSubclass(err, exc_type2);
4221 if (unlikely(res == -1)) {
4222 PyErr_WriteUnraisable(err);
4223 res = 0;
4224 }
4225 }
4226 __Pyx_ErrRestore(exception, value, tb);
4227 return res;
4228 }
4229 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4230 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
4231 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
4232 if (!res) {
4233 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
4234 }
4235 return res;
4236 }
4237 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)4238 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4239 Py_ssize_t i, n;
4240 assert(PyExceptionClass_Check(exc_type));
4241 n = PyTuple_GET_SIZE(tuple);
4242 #if PY_MAJOR_VERSION >= 3
4243 for (i=0; i<n; i++) {
4244 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4245 }
4246 #endif
4247 for (i=0; i<n; i++) {
4248 PyObject *t = PyTuple_GET_ITEM(tuple, i);
4249 #if PY_MAJOR_VERSION < 3
4250 if (likely(exc_type == t)) return 1;
4251 #endif
4252 if (likely(PyExceptionClass_Check(t))) {
4253 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
4254 } else {
4255 }
4256 }
4257 return 0;
4258 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)4259 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
4260 if (likely(err == exc_type)) return 1;
4261 if (likely(PyExceptionClass_Check(err))) {
4262 if (likely(PyExceptionClass_Check(exc_type))) {
4263 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
4264 } else if (likely(PyTuple_Check(exc_type))) {
4265 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
4266 } else {
4267 }
4268 }
4269 return PyErr_GivenExceptionMatches(err, exc_type);
4270 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4271 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
4272 assert(PyExceptionClass_Check(exc_type1));
4273 assert(PyExceptionClass_Check(exc_type2));
4274 if (likely(err == exc_type1 || err == exc_type2)) return 1;
4275 if (likely(PyExceptionClass_Check(err))) {
4276 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
4277 }
4278 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
4279 }
4280 #endif
4281
4282 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)4283 static int __Pyx_check_binary_version(void) {
4284 char ctversion[4], rtversion[4];
4285 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
4286 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
4287 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
4288 char message[200];
4289 PyOS_snprintf(message, sizeof(message),
4290 "compiletime version %s of module '%.100s' "
4291 "does not match runtime version %s",
4292 ctversion, __Pyx_MODULE_NAME, rtversion);
4293 return PyErr_WarnEx(NULL, message, 1);
4294 }
4295 return 0;
4296 }
4297
4298 /* FunctionImport */
4299 #ifndef __PYX_HAVE_RT_ImportFunction
4300 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)4301 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
4302 PyObject *d = 0;
4303 PyObject *cobj = 0;
4304 union {
4305 void (*fp)(void);
4306 void *p;
4307 } tmp;
4308 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
4309 if (!d)
4310 goto bad;
4311 cobj = PyDict_GetItemString(d, funcname);
4312 if (!cobj) {
4313 PyErr_Format(PyExc_ImportError,
4314 "%.200s does not export expected C function %.200s",
4315 PyModule_GetName(module), funcname);
4316 goto bad;
4317 }
4318 #if PY_VERSION_HEX >= 0x02070000
4319 if (!PyCapsule_IsValid(cobj, sig)) {
4320 PyErr_Format(PyExc_TypeError,
4321 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
4322 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
4323 goto bad;
4324 }
4325 tmp.p = PyCapsule_GetPointer(cobj, sig);
4326 #else
4327 {const char *desc, *s1, *s2;
4328 desc = (const char *)PyCObject_GetDesc(cobj);
4329 if (!desc)
4330 goto bad;
4331 s1 = desc; s2 = sig;
4332 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
4333 if (*s1 != *s2) {
4334 PyErr_Format(PyExc_TypeError,
4335 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
4336 PyModule_GetName(module), funcname, sig, desc);
4337 goto bad;
4338 }
4339 tmp.p = PyCObject_AsVoidPtr(cobj);}
4340 #endif
4341 *f = tmp.fp;
4342 if (!(*f))
4343 goto bad;
4344 Py_DECREF(d);
4345 return 0;
4346 bad:
4347 Py_XDECREF(d);
4348 return -1;
4349 }
4350 #endif
4351
4352 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)4353 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4354 while (t->p) {
4355 #if PY_MAJOR_VERSION < 3
4356 if (t->is_unicode) {
4357 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4358 } else if (t->intern) {
4359 *t->p = PyString_InternFromString(t->s);
4360 } else {
4361 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4362 }
4363 #else
4364 if (t->is_unicode | t->is_str) {
4365 if (t->intern) {
4366 *t->p = PyUnicode_InternFromString(t->s);
4367 } else if (t->encoding) {
4368 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
4369 } else {
4370 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
4371 }
4372 } else {
4373 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
4374 }
4375 #endif
4376 if (!*t->p)
4377 return -1;
4378 if (PyObject_Hash(*t->p) == -1)
4379 return -1;
4380 ++t;
4381 }
4382 return 0;
4383 }
4384
__Pyx_PyUnicode_FromString(const char * c_str)4385 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
4386 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
4387 }
__Pyx_PyObject_AsString(PyObject * o)4388 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
4389 Py_ssize_t ignore;
4390 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4391 }
4392 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4393 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)4394 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4395 char* defenc_c;
4396 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
4397 if (!defenc) return NULL;
4398 defenc_c = PyBytes_AS_STRING(defenc);
4399 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4400 {
4401 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
4402 char* c;
4403 for (c = defenc_c; c < end; c++) {
4404 if ((unsigned char) (*c) >= 128) {
4405 PyUnicode_AsASCIIString(o);
4406 return NULL;
4407 }
4408 }
4409 }
4410 #endif
4411 *length = PyBytes_GET_SIZE(defenc);
4412 return defenc_c;
4413 }
4414 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)4415 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4416 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
4417 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4418 if (likely(PyUnicode_IS_ASCII(o))) {
4419 *length = PyUnicode_GET_LENGTH(o);
4420 return PyUnicode_AsUTF8(o);
4421 } else {
4422 PyUnicode_AsASCIIString(o);
4423 return NULL;
4424 }
4425 #else
4426 return PyUnicode_AsUTF8AndSize(o, length);
4427 #endif
4428 }
4429 #endif
4430 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)4431 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4432 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4433 if (
4434 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4435 __Pyx_sys_getdefaultencoding_not_ascii &&
4436 #endif
4437 PyUnicode_Check(o)) {
4438 return __Pyx_PyUnicode_AsStringAndSize(o, length);
4439 } else
4440 #endif
4441 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
4442 if (PyByteArray_Check(o)) {
4443 *length = PyByteArray_GET_SIZE(o);
4444 return PyByteArray_AS_STRING(o);
4445 } else
4446 #endif
4447 {
4448 char* result;
4449 int r = PyBytes_AsStringAndSize(o, &result, length);
4450 if (unlikely(r < 0)) {
4451 return NULL;
4452 } else {
4453 return result;
4454 }
4455 }
4456 }
__Pyx_PyObject_IsTrue(PyObject * x)4457 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
4458 int is_true = x == Py_True;
4459 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
4460 else return PyObject_IsTrue(x);
4461 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)4462 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
4463 int retval;
4464 if (unlikely(!x)) return -1;
4465 retval = __Pyx_PyObject_IsTrue(x);
4466 Py_DECREF(x);
4467 return retval;
4468 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)4469 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
4470 #if PY_MAJOR_VERSION >= 3
4471 if (PyLong_Check(result)) {
4472 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
4473 "__int__ returned non-int (type %.200s). "
4474 "The ability to return an instance of a strict subclass of int "
4475 "is deprecated, and may be removed in a future version of Python.",
4476 Py_TYPE(result)->tp_name)) {
4477 Py_DECREF(result);
4478 return NULL;
4479 }
4480 return result;
4481 }
4482 #endif
4483 PyErr_Format(PyExc_TypeError,
4484 "__%.4s__ returned non-%.4s (type %.200s)",
4485 type_name, type_name, Py_TYPE(result)->tp_name);
4486 Py_DECREF(result);
4487 return NULL;
4488 }
__Pyx_PyNumber_IntOrLong(PyObject * x)4489 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4490 #if CYTHON_USE_TYPE_SLOTS
4491 PyNumberMethods *m;
4492 #endif
4493 const char *name = NULL;
4494 PyObject *res = NULL;
4495 #if PY_MAJOR_VERSION < 3
4496 if (likely(PyInt_Check(x) || PyLong_Check(x)))
4497 #else
4498 if (likely(PyLong_Check(x)))
4499 #endif
4500 return __Pyx_NewRef(x);
4501 #if CYTHON_USE_TYPE_SLOTS
4502 m = Py_TYPE(x)->tp_as_number;
4503 #if PY_MAJOR_VERSION < 3
4504 if (m && m->nb_int) {
4505 name = "int";
4506 res = m->nb_int(x);
4507 }
4508 else if (m && m->nb_long) {
4509 name = "long";
4510 res = m->nb_long(x);
4511 }
4512 #else
4513 if (likely(m && m->nb_int)) {
4514 name = "int";
4515 res = m->nb_int(x);
4516 }
4517 #endif
4518 #else
4519 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4520 res = PyNumber_Int(x);
4521 }
4522 #endif
4523 if (likely(res)) {
4524 #if PY_MAJOR_VERSION < 3
4525 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
4526 #else
4527 if (unlikely(!PyLong_CheckExact(res))) {
4528 #endif
4529 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
4530 }
4531 }
4532 else if (!PyErr_Occurred()) {
4533 PyErr_SetString(PyExc_TypeError,
4534 "an integer is required");
4535 }
4536 return res;
4537 }
4538 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4539 Py_ssize_t ival;
4540 PyObject *x;
4541 #if PY_MAJOR_VERSION < 3
4542 if (likely(PyInt_CheckExact(b))) {
4543 if (sizeof(Py_ssize_t) >= sizeof(long))
4544 return PyInt_AS_LONG(b);
4545 else
4546 return PyInt_AsSsize_t(b);
4547 }
4548 #endif
4549 if (likely(PyLong_CheckExact(b))) {
4550 #if CYTHON_USE_PYLONG_INTERNALS
4551 const digit* digits = ((PyLongObject*)b)->ob_digit;
4552 const Py_ssize_t size = Py_SIZE(b);
4553 if (likely(__Pyx_sst_abs(size) <= 1)) {
4554 ival = likely(size) ? digits[0] : 0;
4555 if (size == -1) ival = -ival;
4556 return ival;
4557 } else {
4558 switch (size) {
4559 case 2:
4560 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4561 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4562 }
4563 break;
4564 case -2:
4565 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4566 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4567 }
4568 break;
4569 case 3:
4570 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4571 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4572 }
4573 break;
4574 case -3:
4575 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4576 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4577 }
4578 break;
4579 case 4:
4580 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4581 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]));
4582 }
4583 break;
4584 case -4:
4585 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4586 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]));
4587 }
4588 break;
4589 }
4590 }
4591 #endif
4592 return PyLong_AsSsize_t(b);
4593 }
4594 x = PyNumber_Index(b);
4595 if (!x) return -1;
4596 ival = PyInt_AsSsize_t(x);
4597 Py_DECREF(x);
4598 return ival;
4599 }
4600 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
4601 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
4602 }
4603 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
4604 return PyInt_FromSize_t(ival);
4605 }
4606
4607
4608 #endif /* Py_PYTHON_H */
4609