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