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