Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcbcftools.c @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* Generated by Cython 3.0.11 */ | |
2 | |
3 /* BEGIN: Cython Metadata | |
4 { | |
5 "distutils": { | |
6 "define_macros": [ | |
7 [ | |
8 "BUILDING_WHEEL", | |
9 null | |
10 ] | |
11 ], | |
12 "depends": [ | |
13 "/project/bcftools/bcftools.pysam.h" | |
14 ], | |
15 "extra_compile_args": [ | |
16 "-Wno-unused", | |
17 "-Wno-strict-prototypes", | |
18 "-Wno-sign-compare", | |
19 "-Wno-error=declaration-after-statement" | |
20 ], | |
21 "extra_link_args": [ | |
22 "-Wl,-rpath,$ORIGIN" | |
23 ], | |
24 "include_dirs": [ | |
25 "/project/pysam", | |
26 "/project/htslib", | |
27 "/project/samtools", | |
28 "/project/samtools/lz4", | |
29 "/project/bcftools", | |
30 "/project" | |
31 ], | |
32 "language": "c", | |
33 "libraries": [ | |
34 "z", | |
35 "lzma", | |
36 "bz2", | |
37 "z", | |
38 "m", | |
39 "curl", | |
40 "crypto", | |
41 "chtslib.cpython-36m-x86_64-linux-gnu" | |
42 ], | |
43 "library_dirs": [ | |
44 "/project/pysam", | |
45 "/project", | |
46 "build/lib.linux-x86_64-3.6/pysam", | |
47 "build/lib.linux-x86_64-3.6/pysam", | |
48 "build/lib.linux-x86_64-3.6/pysam" | |
49 ], | |
50 "name": "pysam.libcbcftools", | |
51 "sources": [ | |
52 "pysam/libcbcftools.pyx", | |
53 "bcftools/vcfannotate.c.pysam.c", | |
54 "bcftools/mpileup.c.pysam.c", | |
55 "bcftools/vcfisec.c.pysam.c", | |
56 "bcftools/vcfsom.c.pysam.c", | |
57 "bcftools/vcfcall.c.pysam.c", | |
58 "bcftools/HMM.c.pysam.c", | |
59 "bcftools/bam2bcf_edlib.c.pysam.c", | |
60 "bcftools/consensus.c.pysam.c", | |
61 "bcftools/vcfroh.c.pysam.c", | |
62 "bcftools/ccall.c.pysam.c", | |
63 "bcftools/vcfgtcheck.c.pysam.c", | |
64 "bcftools/dist.c.pysam.c", | |
65 "bcftools/vcfindex.c.pysam.c", | |
66 "bcftools/ploidy.c.pysam.c", | |
67 "bcftools/str_finder.c.pysam.c", | |
68 "bcftools/bin.c.pysam.c", | |
69 "bcftools/vcfhead.c.pysam.c", | |
70 "bcftools/gvcf.c.pysam.c", | |
71 "bcftools/vcfplugin.c.pysam.c", | |
72 "bcftools/tsv2vcf.c.pysam.c", | |
73 "bcftools/vcfquery.c.pysam.c", | |
74 "bcftools/edlib.c.pysam.c", | |
75 "bcftools/version.c.pysam.c", | |
76 "bcftools/filter.c.pysam.c", | |
77 "bcftools/regidx.c.pysam.c", | |
78 "bcftools/vcmp.c.pysam.c", | |
79 "bcftools/cols.c.pysam.c", | |
80 "bcftools/em.c.pysam.c", | |
81 "bcftools/read_consensus.c.pysam.c", | |
82 "bcftools/convert.c.pysam.c", | |
83 "bcftools/bam2bcf_iaux.c.pysam.c", | |
84 "bcftools/hclust.c.pysam.c", | |
85 "bcftools/reheader.c.pysam.c", | |
86 "bcftools/extsort.c.pysam.c", | |
87 "bcftools/gff.c.pysam.c", | |
88 "bcftools/bcftools.pysam.c", | |
89 "bcftools/prob1.c.pysam.c", | |
90 "bcftools/mcall.c.pysam.c", | |
91 "bcftools/smpl_ilist.c.pysam.c", | |
92 "bcftools/vcfsort.c.pysam.c", | |
93 "bcftools/bam2bcf.c.pysam.c", | |
94 "bcftools/kmin.c.pysam.c", | |
95 "bcftools/main.c.pysam.c", | |
96 "bcftools/vcfnorm.c.pysam.c", | |
97 "bcftools/vcffilter.c.pysam.c", | |
98 "bcftools/abuf.c.pysam.c", | |
99 "bcftools/bam2bcf_indel.c.pysam.c", | |
100 "bcftools/vcfcnv.c.pysam.c", | |
101 "bcftools/vcfbuf.c.pysam.c", | |
102 "bcftools/vcfstats.c.pysam.c", | |
103 "bcftools/vcfconvert.c.pysam.c", | |
104 "bcftools/vcfmerge.c.pysam.c", | |
105 "bcftools/csq.c.pysam.c", | |
106 "bcftools/bam_sample.c.pysam.c", | |
107 "bcftools/vcfconcat.c.pysam.c", | |
108 "bcftools/vcfview.c.pysam.c", | |
109 "bcftools/tabix.c.pysam.c" | |
110 ] | |
111 }, | |
112 "module_name": "pysam.libcbcftools" | |
113 } | |
114 END: Cython Metadata */ | |
115 | |
116 #ifndef PY_SSIZE_T_CLEAN | |
117 #define PY_SSIZE_T_CLEAN | |
118 #endif /* PY_SSIZE_T_CLEAN */ | |
119 #if defined(CYTHON_LIMITED_API) && 0 | |
120 #ifndef Py_LIMITED_API | |
121 #if CYTHON_LIMITED_API+0 > 0x03030000 | |
122 #define Py_LIMITED_API CYTHON_LIMITED_API | |
123 #else | |
124 #define Py_LIMITED_API 0x03030000 | |
125 #endif | |
126 #endif | |
127 #endif | |
128 | |
129 #include "Python.h" | |
130 #ifndef Py_PYTHON_H | |
131 #error Python headers needed to compile C extensions, please install development version of Python. | |
132 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) | |
133 #error Cython requires Python 2.7+ or Python 3.3+. | |
134 #else | |
135 #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API | |
136 #define __PYX_EXTRA_ABI_MODULE_NAME "limited" | |
137 #else | |
138 #define __PYX_EXTRA_ABI_MODULE_NAME "" | |
139 #endif | |
140 #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME | |
141 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI | |
142 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." | |
143 #define CYTHON_HEX_VERSION 0x03000BF0 | |
144 #define CYTHON_FUTURE_DIVISION 1 | |
145 #include <stddef.h> | |
146 #ifndef offsetof | |
147 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) | |
148 #endif | |
149 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) | |
150 #ifndef __stdcall | |
151 #define __stdcall | |
152 #endif | |
153 #ifndef __cdecl | |
154 #define __cdecl | |
155 #endif | |
156 #ifndef __fastcall | |
157 #define __fastcall | |
158 #endif | |
159 #endif | |
160 #ifndef DL_IMPORT | |
161 #define DL_IMPORT(t) t | |
162 #endif | |
163 #ifndef DL_EXPORT | |
164 #define DL_EXPORT(t) t | |
165 #endif | |
166 #define __PYX_COMMA , | |
167 #ifndef HAVE_LONG_LONG | |
168 #define HAVE_LONG_LONG | |
169 #endif | |
170 #ifndef PY_LONG_LONG | |
171 #define PY_LONG_LONG LONG_LONG | |
172 #endif | |
173 #ifndef Py_HUGE_VAL | |
174 #define Py_HUGE_VAL HUGE_VAL | |
175 #endif | |
176 #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX | |
177 #if defined(GRAALVM_PYTHON) | |
178 /* For very preliminary testing purposes. Most variables are set the same as PyPy. | |
179 The existence of this section does not imply that anything works or is even tested */ | |
180 #define CYTHON_COMPILING_IN_PYPY 0 | |
181 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
182 #define CYTHON_COMPILING_IN_LIMITED_API 0 | |
183 #define CYTHON_COMPILING_IN_GRAAL 1 | |
184 #define CYTHON_COMPILING_IN_NOGIL 0 | |
185 #undef CYTHON_USE_TYPE_SLOTS | |
186 #define CYTHON_USE_TYPE_SLOTS 0 | |
187 #undef CYTHON_USE_TYPE_SPECS | |
188 #define CYTHON_USE_TYPE_SPECS 0 | |
189 #undef CYTHON_USE_PYTYPE_LOOKUP | |
190 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
191 #if PY_VERSION_HEX < 0x03050000 | |
192 #undef CYTHON_USE_ASYNC_SLOTS | |
193 #define CYTHON_USE_ASYNC_SLOTS 0 | |
194 #elif !defined(CYTHON_USE_ASYNC_SLOTS) | |
195 #define CYTHON_USE_ASYNC_SLOTS 1 | |
196 #endif | |
197 #undef CYTHON_USE_PYLIST_INTERNALS | |
198 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
199 #undef CYTHON_USE_UNICODE_INTERNALS | |
200 #define CYTHON_USE_UNICODE_INTERNALS 0 | |
201 #undef CYTHON_USE_UNICODE_WRITER | |
202 #define CYTHON_USE_UNICODE_WRITER 0 | |
203 #undef CYTHON_USE_PYLONG_INTERNALS | |
204 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
205 #undef CYTHON_AVOID_BORROWED_REFS | |
206 #define CYTHON_AVOID_BORROWED_REFS 1 | |
207 #undef CYTHON_ASSUME_SAFE_MACROS | |
208 #define CYTHON_ASSUME_SAFE_MACROS 0 | |
209 #undef CYTHON_UNPACK_METHODS | |
210 #define CYTHON_UNPACK_METHODS 0 | |
211 #undef CYTHON_FAST_THREAD_STATE | |
212 #define CYTHON_FAST_THREAD_STATE 0 | |
213 #undef CYTHON_FAST_GIL | |
214 #define CYTHON_FAST_GIL 0 | |
215 #undef CYTHON_METH_FASTCALL | |
216 #define CYTHON_METH_FASTCALL 0 | |
217 #undef CYTHON_FAST_PYCALL | |
218 #define CYTHON_FAST_PYCALL 0 | |
219 #ifndef CYTHON_PEP487_INIT_SUBCLASS | |
220 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) | |
221 #endif | |
222 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
223 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
224 #undef CYTHON_USE_MODULE_STATE | |
225 #define CYTHON_USE_MODULE_STATE 0 | |
226 #undef CYTHON_USE_TP_FINALIZE | |
227 #define CYTHON_USE_TP_FINALIZE 0 | |
228 #undef CYTHON_USE_DICT_VERSIONS | |
229 #define CYTHON_USE_DICT_VERSIONS 0 | |
230 #undef CYTHON_USE_EXC_INFO_STACK | |
231 #define CYTHON_USE_EXC_INFO_STACK 0 | |
232 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
233 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 | |
234 #endif | |
235 #undef CYTHON_USE_FREELISTS | |
236 #define CYTHON_USE_FREELISTS 0 | |
237 #elif defined(PYPY_VERSION) | |
238 #define CYTHON_COMPILING_IN_PYPY 1 | |
239 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
240 #define CYTHON_COMPILING_IN_LIMITED_API 0 | |
241 #define CYTHON_COMPILING_IN_GRAAL 0 | |
242 #define CYTHON_COMPILING_IN_NOGIL 0 | |
243 #undef CYTHON_USE_TYPE_SLOTS | |
244 #define CYTHON_USE_TYPE_SLOTS 0 | |
245 #ifndef CYTHON_USE_TYPE_SPECS | |
246 #define CYTHON_USE_TYPE_SPECS 0 | |
247 #endif | |
248 #undef CYTHON_USE_PYTYPE_LOOKUP | |
249 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
250 #if PY_VERSION_HEX < 0x03050000 | |
251 #undef CYTHON_USE_ASYNC_SLOTS | |
252 #define CYTHON_USE_ASYNC_SLOTS 0 | |
253 #elif !defined(CYTHON_USE_ASYNC_SLOTS) | |
254 #define CYTHON_USE_ASYNC_SLOTS 1 | |
255 #endif | |
256 #undef CYTHON_USE_PYLIST_INTERNALS | |
257 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
258 #undef CYTHON_USE_UNICODE_INTERNALS | |
259 #define CYTHON_USE_UNICODE_INTERNALS 0 | |
260 #undef CYTHON_USE_UNICODE_WRITER | |
261 #define CYTHON_USE_UNICODE_WRITER 0 | |
262 #undef CYTHON_USE_PYLONG_INTERNALS | |
263 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
264 #undef CYTHON_AVOID_BORROWED_REFS | |
265 #define CYTHON_AVOID_BORROWED_REFS 1 | |
266 #undef CYTHON_ASSUME_SAFE_MACROS | |
267 #define CYTHON_ASSUME_SAFE_MACROS 0 | |
268 #undef CYTHON_UNPACK_METHODS | |
269 #define CYTHON_UNPACK_METHODS 0 | |
270 #undef CYTHON_FAST_THREAD_STATE | |
271 #define CYTHON_FAST_THREAD_STATE 0 | |
272 #undef CYTHON_FAST_GIL | |
273 #define CYTHON_FAST_GIL 0 | |
274 #undef CYTHON_METH_FASTCALL | |
275 #define CYTHON_METH_FASTCALL 0 | |
276 #undef CYTHON_FAST_PYCALL | |
277 #define CYTHON_FAST_PYCALL 0 | |
278 #ifndef CYTHON_PEP487_INIT_SUBCLASS | |
279 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) | |
280 #endif | |
281 #if PY_VERSION_HEX < 0x03090000 | |
282 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
283 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 | |
284 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) | |
285 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
286 #endif | |
287 #undef CYTHON_USE_MODULE_STATE | |
288 #define CYTHON_USE_MODULE_STATE 0 | |
289 #undef CYTHON_USE_TP_FINALIZE | |
290 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) | |
291 #undef CYTHON_USE_DICT_VERSIONS | |
292 #define CYTHON_USE_DICT_VERSIONS 0 | |
293 #undef CYTHON_USE_EXC_INFO_STACK | |
294 #define CYTHON_USE_EXC_INFO_STACK 0 | |
295 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
296 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 | |
297 #endif | |
298 #undef CYTHON_USE_FREELISTS | |
299 #define CYTHON_USE_FREELISTS 0 | |
300 #elif defined(CYTHON_LIMITED_API) | |
301 #ifdef Py_LIMITED_API | |
302 #undef __PYX_LIMITED_VERSION_HEX | |
303 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API | |
304 #endif | |
305 #define CYTHON_COMPILING_IN_PYPY 0 | |
306 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
307 #define CYTHON_COMPILING_IN_LIMITED_API 1 | |
308 #define CYTHON_COMPILING_IN_GRAAL 0 | |
309 #define CYTHON_COMPILING_IN_NOGIL 0 | |
310 #undef CYTHON_CLINE_IN_TRACEBACK | |
311 #define CYTHON_CLINE_IN_TRACEBACK 0 | |
312 #undef CYTHON_USE_TYPE_SLOTS | |
313 #define CYTHON_USE_TYPE_SLOTS 0 | |
314 #undef CYTHON_USE_TYPE_SPECS | |
315 #define CYTHON_USE_TYPE_SPECS 1 | |
316 #undef CYTHON_USE_PYTYPE_LOOKUP | |
317 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
318 #undef CYTHON_USE_ASYNC_SLOTS | |
319 #define CYTHON_USE_ASYNC_SLOTS 0 | |
320 #undef CYTHON_USE_PYLIST_INTERNALS | |
321 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
322 #undef CYTHON_USE_UNICODE_INTERNALS | |
323 #define CYTHON_USE_UNICODE_INTERNALS 0 | |
324 #ifndef CYTHON_USE_UNICODE_WRITER | |
325 #define CYTHON_USE_UNICODE_WRITER 0 | |
326 #endif | |
327 #undef CYTHON_USE_PYLONG_INTERNALS | |
328 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
329 #ifndef CYTHON_AVOID_BORROWED_REFS | |
330 #define CYTHON_AVOID_BORROWED_REFS 0 | |
331 #endif | |
332 #undef CYTHON_ASSUME_SAFE_MACROS | |
333 #define CYTHON_ASSUME_SAFE_MACROS 0 | |
334 #undef CYTHON_UNPACK_METHODS | |
335 #define CYTHON_UNPACK_METHODS 0 | |
336 #undef CYTHON_FAST_THREAD_STATE | |
337 #define CYTHON_FAST_THREAD_STATE 0 | |
338 #undef CYTHON_FAST_GIL | |
339 #define CYTHON_FAST_GIL 0 | |
340 #undef CYTHON_METH_FASTCALL | |
341 #define CYTHON_METH_FASTCALL 0 | |
342 #undef CYTHON_FAST_PYCALL | |
343 #define CYTHON_FAST_PYCALL 0 | |
344 #ifndef CYTHON_PEP487_INIT_SUBCLASS | |
345 #define CYTHON_PEP487_INIT_SUBCLASS 1 | |
346 #endif | |
347 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
348 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 | |
349 #undef CYTHON_USE_MODULE_STATE | |
350 #define CYTHON_USE_MODULE_STATE 1 | |
351 #ifndef CYTHON_USE_TP_FINALIZE | |
352 #define CYTHON_USE_TP_FINALIZE 0 | |
353 #endif | |
354 #undef CYTHON_USE_DICT_VERSIONS | |
355 #define CYTHON_USE_DICT_VERSIONS 0 | |
356 #undef CYTHON_USE_EXC_INFO_STACK | |
357 #define CYTHON_USE_EXC_INFO_STACK 0 | |
358 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
359 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 | |
360 #endif | |
361 #undef CYTHON_USE_FREELISTS | |
362 #define CYTHON_USE_FREELISTS 0 | |
363 #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) | |
364 #define CYTHON_COMPILING_IN_PYPY 0 | |
365 #define CYTHON_COMPILING_IN_CPYTHON 0 | |
366 #define CYTHON_COMPILING_IN_LIMITED_API 0 | |
367 #define CYTHON_COMPILING_IN_GRAAL 0 | |
368 #define CYTHON_COMPILING_IN_NOGIL 1 | |
369 #ifndef CYTHON_USE_TYPE_SLOTS | |
370 #define CYTHON_USE_TYPE_SLOTS 1 | |
371 #endif | |
372 #ifndef CYTHON_USE_TYPE_SPECS | |
373 #define CYTHON_USE_TYPE_SPECS 0 | |
374 #endif | |
375 #undef CYTHON_USE_PYTYPE_LOOKUP | |
376 #define CYTHON_USE_PYTYPE_LOOKUP 0 | |
377 #ifndef CYTHON_USE_ASYNC_SLOTS | |
378 #define CYTHON_USE_ASYNC_SLOTS 1 | |
379 #endif | |
380 #ifndef CYTHON_USE_PYLONG_INTERNALS | |
381 #define CYTHON_USE_PYLONG_INTERNALS 0 | |
382 #endif | |
383 #undef CYTHON_USE_PYLIST_INTERNALS | |
384 #define CYTHON_USE_PYLIST_INTERNALS 0 | |
385 #ifndef CYTHON_USE_UNICODE_INTERNALS | |
386 #define CYTHON_USE_UNICODE_INTERNALS 1 | |
387 #endif | |
388 #undef CYTHON_USE_UNICODE_WRITER | |
389 #define CYTHON_USE_UNICODE_WRITER 0 | |
390 #ifndef CYTHON_AVOID_BORROWED_REFS | |
391 #define CYTHON_AVOID_BORROWED_REFS 0 | |
392 #endif | |
393 #ifndef CYTHON_ASSUME_SAFE_MACROS | |
394 #define CYTHON_ASSUME_SAFE_MACROS 1 | |
395 #endif | |
396 #ifndef CYTHON_UNPACK_METHODS | |
397 #define CYTHON_UNPACK_METHODS 1 | |
398 #endif | |
399 #undef CYTHON_FAST_THREAD_STATE | |
400 #define CYTHON_FAST_THREAD_STATE 0 | |
401 #undef CYTHON_FAST_GIL | |
402 #define CYTHON_FAST_GIL 0 | |
403 #ifndef CYTHON_METH_FASTCALL | |
404 #define CYTHON_METH_FASTCALL 1 | |
405 #endif | |
406 #undef CYTHON_FAST_PYCALL | |
407 #define CYTHON_FAST_PYCALL 0 | |
408 #ifndef CYTHON_PEP487_INIT_SUBCLASS | |
409 #define CYTHON_PEP487_INIT_SUBCLASS 1 | |
410 #endif | |
411 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT | |
412 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
413 #endif | |
414 #ifndef CYTHON_USE_MODULE_STATE | |
415 #define CYTHON_USE_MODULE_STATE 0 | |
416 #endif | |
417 #ifndef CYTHON_USE_TP_FINALIZE | |
418 #define CYTHON_USE_TP_FINALIZE 1 | |
419 #endif | |
420 #undef CYTHON_USE_DICT_VERSIONS | |
421 #define CYTHON_USE_DICT_VERSIONS 0 | |
422 #undef CYTHON_USE_EXC_INFO_STACK | |
423 #define CYTHON_USE_EXC_INFO_STACK 0 | |
424 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
425 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 | |
426 #endif | |
427 #ifndef CYTHON_USE_FREELISTS | |
428 #define CYTHON_USE_FREELISTS 0 | |
429 #endif | |
430 #else | |
431 #define CYTHON_COMPILING_IN_PYPY 0 | |
432 #define CYTHON_COMPILING_IN_CPYTHON 1 | |
433 #define CYTHON_COMPILING_IN_LIMITED_API 0 | |
434 #define CYTHON_COMPILING_IN_GRAAL 0 | |
435 #define CYTHON_COMPILING_IN_NOGIL 0 | |
436 #ifndef CYTHON_USE_TYPE_SLOTS | |
437 #define CYTHON_USE_TYPE_SLOTS 1 | |
438 #endif | |
439 #ifndef CYTHON_USE_TYPE_SPECS | |
440 #define CYTHON_USE_TYPE_SPECS 0 | |
441 #endif | |
442 #ifndef CYTHON_USE_PYTYPE_LOOKUP | |
443 #define CYTHON_USE_PYTYPE_LOOKUP 1 | |
444 #endif | |
445 #if PY_MAJOR_VERSION < 3 | |
446 #undef CYTHON_USE_ASYNC_SLOTS | |
447 #define CYTHON_USE_ASYNC_SLOTS 0 | |
448 #elif !defined(CYTHON_USE_ASYNC_SLOTS) | |
449 #define CYTHON_USE_ASYNC_SLOTS 1 | |
450 #endif | |
451 #ifndef CYTHON_USE_PYLONG_INTERNALS | |
452 #define CYTHON_USE_PYLONG_INTERNALS 1 | |
453 #endif | |
454 #ifndef CYTHON_USE_PYLIST_INTERNALS | |
455 #define CYTHON_USE_PYLIST_INTERNALS 1 | |
456 #endif | |
457 #ifndef CYTHON_USE_UNICODE_INTERNALS | |
458 #define CYTHON_USE_UNICODE_INTERNALS 1 | |
459 #endif | |
460 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 | |
461 #undef CYTHON_USE_UNICODE_WRITER | |
462 #define CYTHON_USE_UNICODE_WRITER 0 | |
463 #elif !defined(CYTHON_USE_UNICODE_WRITER) | |
464 #define CYTHON_USE_UNICODE_WRITER 1 | |
465 #endif | |
466 #ifndef CYTHON_AVOID_BORROWED_REFS | |
467 #define CYTHON_AVOID_BORROWED_REFS 0 | |
468 #endif | |
469 #ifndef CYTHON_ASSUME_SAFE_MACROS | |
470 #define CYTHON_ASSUME_SAFE_MACROS 1 | |
471 #endif | |
472 #ifndef CYTHON_UNPACK_METHODS | |
473 #define CYTHON_UNPACK_METHODS 1 | |
474 #endif | |
475 #ifndef CYTHON_FAST_THREAD_STATE | |
476 #define CYTHON_FAST_THREAD_STATE 1 | |
477 #endif | |
478 #ifndef CYTHON_FAST_GIL | |
479 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) | |
480 #endif | |
481 #ifndef CYTHON_METH_FASTCALL | |
482 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) | |
483 #endif | |
484 #ifndef CYTHON_FAST_PYCALL | |
485 #define CYTHON_FAST_PYCALL 1 | |
486 #endif | |
487 #ifndef CYTHON_PEP487_INIT_SUBCLASS | |
488 #define CYTHON_PEP487_INIT_SUBCLASS 1 | |
489 #endif | |
490 #if PY_VERSION_HEX < 0x03050000 | |
491 #undef CYTHON_PEP489_MULTI_PHASE_INIT | |
492 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 | |
493 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) | |
494 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 | |
495 #endif | |
496 #ifndef CYTHON_USE_MODULE_STATE | |
497 #define CYTHON_USE_MODULE_STATE 0 | |
498 #endif | |
499 #if PY_VERSION_HEX < 0x030400a1 | |
500 #undef CYTHON_USE_TP_FINALIZE | |
501 #define CYTHON_USE_TP_FINALIZE 0 | |
502 #elif !defined(CYTHON_USE_TP_FINALIZE) | |
503 #define CYTHON_USE_TP_FINALIZE 1 | |
504 #endif | |
505 #if PY_VERSION_HEX < 0x030600B1 | |
506 #undef CYTHON_USE_DICT_VERSIONS | |
507 #define CYTHON_USE_DICT_VERSIONS 0 | |
508 #elif !defined(CYTHON_USE_DICT_VERSIONS) | |
509 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) | |
510 #endif | |
511 #if PY_VERSION_HEX < 0x030700A3 | |
512 #undef CYTHON_USE_EXC_INFO_STACK | |
513 #define CYTHON_USE_EXC_INFO_STACK 0 | |
514 #elif !defined(CYTHON_USE_EXC_INFO_STACK) | |
515 #define CYTHON_USE_EXC_INFO_STACK 1 | |
516 #endif | |
517 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC | |
518 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 | |
519 #endif | |
520 #ifndef CYTHON_USE_FREELISTS | |
521 #define CYTHON_USE_FREELISTS 1 | |
522 #endif | |
523 #endif | |
524 #if !defined(CYTHON_FAST_PYCCALL) | |
525 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) | |
526 #endif | |
527 #if !defined(CYTHON_VECTORCALL) | |
528 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) | |
529 #endif | |
530 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) | |
531 #if CYTHON_USE_PYLONG_INTERNALS | |
532 #if PY_MAJOR_VERSION < 3 | |
533 #include "longintrepr.h" | |
534 #endif | |
535 #undef SHIFT | |
536 #undef BASE | |
537 #undef MASK | |
538 #ifdef SIZEOF_VOID_P | |
539 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; | |
540 #endif | |
541 #endif | |
542 #ifndef __has_attribute | |
543 #define __has_attribute(x) 0 | |
544 #endif | |
545 #ifndef __has_cpp_attribute | |
546 #define __has_cpp_attribute(x) 0 | |
547 #endif | |
548 #ifndef CYTHON_RESTRICT | |
549 #if defined(__GNUC__) | |
550 #define CYTHON_RESTRICT __restrict__ | |
551 #elif defined(_MSC_VER) && _MSC_VER >= 1400 | |
552 #define CYTHON_RESTRICT __restrict | |
553 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
554 #define CYTHON_RESTRICT restrict | |
555 #else | |
556 #define CYTHON_RESTRICT | |
557 #endif | |
558 #endif | |
559 #ifndef CYTHON_UNUSED | |
560 #if defined(__cplusplus) | |
561 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 | |
562 * but leads to warnings with -pedantic, since it is a C++17 feature */ | |
563 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) | |
564 #if __has_cpp_attribute(maybe_unused) | |
565 #define CYTHON_UNUSED [[maybe_unused]] | |
566 #endif | |
567 #endif | |
568 #endif | |
569 #endif | |
570 #ifndef CYTHON_UNUSED | |
571 # if defined(__GNUC__) | |
572 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
573 # define CYTHON_UNUSED __attribute__ ((__unused__)) | |
574 # else | |
575 # define CYTHON_UNUSED | |
576 # endif | |
577 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) | |
578 # define CYTHON_UNUSED __attribute__ ((__unused__)) | |
579 # else | |
580 # define CYTHON_UNUSED | |
581 # endif | |
582 #endif | |
583 #ifndef CYTHON_UNUSED_VAR | |
584 # if defined(__cplusplus) | |
585 template<class T> void CYTHON_UNUSED_VAR( const T& ) { } | |
586 # else | |
587 # define CYTHON_UNUSED_VAR(x) (void)(x) | |
588 # endif | |
589 #endif | |
590 #ifndef CYTHON_MAYBE_UNUSED_VAR | |
591 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) | |
592 #endif | |
593 #ifndef CYTHON_NCP_UNUSED | |
594 # if CYTHON_COMPILING_IN_CPYTHON | |
595 # define CYTHON_NCP_UNUSED | |
596 # else | |
597 # define CYTHON_NCP_UNUSED CYTHON_UNUSED | |
598 # endif | |
599 #endif | |
600 #ifndef CYTHON_USE_CPP_STD_MOVE | |
601 #if defined(__cplusplus) && (\ | |
602 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) | |
603 #define CYTHON_USE_CPP_STD_MOVE 1 | |
604 #else | |
605 #define CYTHON_USE_CPP_STD_MOVE 0 | |
606 #endif | |
607 #endif | |
608 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) | |
609 #ifdef _MSC_VER | |
610 #ifndef _MSC_STDINT_H_ | |
611 #if _MSC_VER < 1300 | |
612 typedef unsigned char uint8_t; | |
613 typedef unsigned short uint16_t; | |
614 typedef unsigned int uint32_t; | |
615 #else | |
616 typedef unsigned __int8 uint8_t; | |
617 typedef unsigned __int16 uint16_t; | |
618 typedef unsigned __int32 uint32_t; | |
619 #endif | |
620 #endif | |
621 #if _MSC_VER < 1300 | |
622 #ifdef _WIN64 | |
623 typedef unsigned long long __pyx_uintptr_t; | |
624 #else | |
625 typedef unsigned int __pyx_uintptr_t; | |
626 #endif | |
627 #else | |
628 #ifdef _WIN64 | |
629 typedef unsigned __int64 __pyx_uintptr_t; | |
630 #else | |
631 typedef unsigned __int32 __pyx_uintptr_t; | |
632 #endif | |
633 #endif | |
634 #else | |
635 #include <stdint.h> | |
636 typedef uintptr_t __pyx_uintptr_t; | |
637 #endif | |
638 #ifndef CYTHON_FALLTHROUGH | |
639 #if defined(__cplusplus) | |
640 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 | |
641 * but leads to warnings with -pedantic, since it is a C++17 feature */ | |
642 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) | |
643 #if __has_cpp_attribute(fallthrough) | |
644 #define CYTHON_FALLTHROUGH [[fallthrough]] | |
645 #endif | |
646 #endif | |
647 #ifndef CYTHON_FALLTHROUGH | |
648 #if __has_cpp_attribute(clang::fallthrough) | |
649 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] | |
650 #elif __has_cpp_attribute(gnu::fallthrough) | |
651 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] | |
652 #endif | |
653 #endif | |
654 #endif | |
655 #ifndef CYTHON_FALLTHROUGH | |
656 #if __has_attribute(fallthrough) | |
657 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) | |
658 #else | |
659 #define CYTHON_FALLTHROUGH | |
660 #endif | |
661 #endif | |
662 #if defined(__clang__) && defined(__apple_build_version__) | |
663 #if __apple_build_version__ < 7000000 | |
664 #undef CYTHON_FALLTHROUGH | |
665 #define CYTHON_FALLTHROUGH | |
666 #endif | |
667 #endif | |
668 #endif | |
669 #ifdef __cplusplus | |
670 template <typename T> | |
671 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; | |
672 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value) | |
673 #else | |
674 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) | |
675 #endif | |
676 #if CYTHON_COMPILING_IN_PYPY == 1 | |
677 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) | |
678 #else | |
679 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) | |
680 #endif | |
681 #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) | |
682 | |
683 #ifndef CYTHON_INLINE | |
684 #if defined(__clang__) | |
685 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) | |
686 #elif defined(__GNUC__) | |
687 #define CYTHON_INLINE __inline__ | |
688 #elif defined(_MSC_VER) | |
689 #define CYTHON_INLINE __inline | |
690 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
691 #define CYTHON_INLINE inline | |
692 #else | |
693 #define CYTHON_INLINE | |
694 #endif | |
695 #endif | |
696 | |
697 #define __PYX_BUILD_PY_SSIZE_T "n" | |
698 #define CYTHON_FORMAT_SSIZE_T "z" | |
699 #if PY_MAJOR_VERSION < 3 | |
700 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" | |
701 #define __Pyx_DefaultClassType PyClass_Type | |
702 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ | |
703 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) | |
704 #else | |
705 #define __Pyx_BUILTIN_MODULE_NAME "builtins" | |
706 #define __Pyx_DefaultClassType PyType_Type | |
707 #if CYTHON_COMPILING_IN_LIMITED_API | |
708 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, | |
709 PyObject *code, PyObject *c, PyObject* n, PyObject *v, | |
710 PyObject *fv, PyObject *cell, PyObject* fn, | |
711 PyObject *name, int fline, PyObject *lnos) { | |
712 PyObject *exception_table = NULL; | |
713 PyObject *types_module=NULL, *code_type=NULL, *result=NULL; | |
714 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 | |
715 PyObject *version_info; | |
716 PyObject *py_minor_version = NULL; | |
717 #endif | |
718 long minor_version = 0; | |
719 PyObject *type, *value, *traceback; | |
720 PyErr_Fetch(&type, &value, &traceback); | |
721 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 | |
722 minor_version = 11; | |
723 #else | |
724 if (!(version_info = PySys_GetObject("version_info"))) goto end; | |
725 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; | |
726 minor_version = PyLong_AsLong(py_minor_version); | |
727 Py_DECREF(py_minor_version); | |
728 if (minor_version == -1 && PyErr_Occurred()) goto end; | |
729 #endif | |
730 if (!(types_module = PyImport_ImportModule("types"))) goto end; | |
731 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; | |
732 if (minor_version <= 7) { | |
733 (void)p; | |
734 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, | |
735 c, n, v, fn, name, fline, lnos, fv, cell); | |
736 } else if (minor_version <= 10) { | |
737 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, | |
738 c, n, v, fn, name, fline, lnos, fv, cell); | |
739 } else { | |
740 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; | |
741 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, | |
742 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); | |
743 } | |
744 end: | |
745 Py_XDECREF(code_type); | |
746 Py_XDECREF(exception_table); | |
747 Py_XDECREF(types_module); | |
748 if (type) { | |
749 PyErr_Restore(type, value, traceback); | |
750 } | |
751 return result; | |
752 } | |
753 #ifndef CO_OPTIMIZED | |
754 #define CO_OPTIMIZED 0x0001 | |
755 #endif | |
756 #ifndef CO_NEWLOCALS | |
757 #define CO_NEWLOCALS 0x0002 | |
758 #endif | |
759 #ifndef CO_VARARGS | |
760 #define CO_VARARGS 0x0004 | |
761 #endif | |
762 #ifndef CO_VARKEYWORDS | |
763 #define CO_VARKEYWORDS 0x0008 | |
764 #endif | |
765 #ifndef CO_ASYNC_GENERATOR | |
766 #define CO_ASYNC_GENERATOR 0x0200 | |
767 #endif | |
768 #ifndef CO_GENERATOR | |
769 #define CO_GENERATOR 0x0020 | |
770 #endif | |
771 #ifndef CO_COROUTINE | |
772 #define CO_COROUTINE 0x0080 | |
773 #endif | |
774 #elif PY_VERSION_HEX >= 0x030B0000 | |
775 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, | |
776 PyObject *code, PyObject *c, PyObject* n, PyObject *v, | |
777 PyObject *fv, PyObject *cell, PyObject* fn, | |
778 PyObject *name, int fline, PyObject *lnos) { | |
779 PyCodeObject *result; | |
780 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); | |
781 if (!empty_bytes) return NULL; | |
782 result = | |
783 #if PY_VERSION_HEX >= 0x030C0000 | |
784 PyUnstable_Code_NewWithPosOnlyArgs | |
785 #else | |
786 PyCode_NewWithPosOnlyArgs | |
787 #endif | |
788 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); | |
789 Py_DECREF(empty_bytes); | |
790 return result; | |
791 } | |
792 #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY | |
793 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ | |
794 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) | |
795 #else | |
796 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ | |
797 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) | |
798 #endif | |
799 #endif | |
800 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) | |
801 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) | |
802 #else | |
803 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) | |
804 #endif | |
805 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) | |
806 #define __Pyx_Py_Is(x, y) Py_Is(x, y) | |
807 #else | |
808 #define __Pyx_Py_Is(x, y) ((x) == (y)) | |
809 #endif | |
810 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) | |
811 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) | |
812 #else | |
813 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) | |
814 #endif | |
815 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) | |
816 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) | |
817 #else | |
818 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) | |
819 #endif | |
820 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) | |
821 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) | |
822 #else | |
823 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) | |
824 #endif | |
825 #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) | |
826 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY | |
827 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) | |
828 #else | |
829 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) | |
830 #endif | |
831 #ifndef CO_COROUTINE | |
832 #define CO_COROUTINE 0x80 | |
833 #endif | |
834 #ifndef CO_ASYNC_GENERATOR | |
835 #define CO_ASYNC_GENERATOR 0x200 | |
836 #endif | |
837 #ifndef Py_TPFLAGS_CHECKTYPES | |
838 #define Py_TPFLAGS_CHECKTYPES 0 | |
839 #endif | |
840 #ifndef Py_TPFLAGS_HAVE_INDEX | |
841 #define Py_TPFLAGS_HAVE_INDEX 0 | |
842 #endif | |
843 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER | |
844 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 | |
845 #endif | |
846 #ifndef Py_TPFLAGS_HAVE_FINALIZE | |
847 #define Py_TPFLAGS_HAVE_FINALIZE 0 | |
848 #endif | |
849 #ifndef Py_TPFLAGS_SEQUENCE | |
850 #define Py_TPFLAGS_SEQUENCE 0 | |
851 #endif | |
852 #ifndef Py_TPFLAGS_MAPPING | |
853 #define Py_TPFLAGS_MAPPING 0 | |
854 #endif | |
855 #ifndef METH_STACKLESS | |
856 #define METH_STACKLESS 0 | |
857 #endif | |
858 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) | |
859 #ifndef METH_FASTCALL | |
860 #define METH_FASTCALL 0x80 | |
861 #endif | |
862 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); | |
863 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, | |
864 Py_ssize_t nargs, PyObject *kwnames); | |
865 #else | |
866 #if PY_VERSION_HEX >= 0x030d00A4 | |
867 # define __Pyx_PyCFunctionFast PyCFunctionFast | |
868 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords | |
869 #else | |
870 # define __Pyx_PyCFunctionFast _PyCFunctionFast | |
871 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords | |
872 #endif | |
873 #endif | |
874 #if CYTHON_METH_FASTCALL | |
875 #define __Pyx_METH_FASTCALL METH_FASTCALL | |
876 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast | |
877 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords | |
878 #else | |
879 #define __Pyx_METH_FASTCALL METH_VARARGS | |
880 #define __Pyx_PyCFunction_FastCall PyCFunction | |
881 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords | |
882 #endif | |
883 #if CYTHON_VECTORCALL | |
884 #define __pyx_vectorcallfunc vectorcallfunc | |
885 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET | |
886 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) | |
887 #elif CYTHON_BACKPORT_VECTORCALL | |
888 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, | |
889 size_t nargsf, PyObject *kwnames); | |
890 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) | |
891 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) | |
892 #else | |
893 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 | |
894 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) | |
895 #endif | |
896 #if PY_MAJOR_VERSION >= 0x030900B1 | |
897 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) | |
898 #else | |
899 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) | |
900 #endif | |
901 #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) | |
902 #if CYTHON_COMPILING_IN_CPYTHON | |
903 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) | |
904 #elif !CYTHON_COMPILING_IN_LIMITED_API | |
905 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) | |
906 #endif | |
907 #if CYTHON_COMPILING_IN_CPYTHON | |
908 #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) | |
909 static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { | |
910 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; | |
911 } | |
912 #endif | |
913 static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) { | |
914 #if CYTHON_COMPILING_IN_LIMITED_API | |
915 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; | |
916 #else | |
917 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; | |
918 #endif | |
919 } | |
920 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) | |
921 #if __PYX_LIMITED_VERSION_HEX < 0x030900B1 | |
922 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) | |
923 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); | |
924 #else | |
925 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) | |
926 #define __Pyx_PyCMethod PyCMethod | |
927 #endif | |
928 #ifndef METH_METHOD | |
929 #define METH_METHOD 0x200 | |
930 #endif | |
931 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) | |
932 #define PyObject_Malloc(s) PyMem_Malloc(s) | |
933 #define PyObject_Free(p) PyMem_Free(p) | |
934 #define PyObject_Realloc(p) PyMem_Realloc(p) | |
935 #endif | |
936 #if CYTHON_COMPILING_IN_LIMITED_API | |
937 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) | |
938 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) | |
939 #else | |
940 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) | |
941 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) | |
942 #endif | |
943 #if CYTHON_COMPILING_IN_LIMITED_API | |
944 #define __Pyx_PyThreadState_Current PyThreadState_Get() | |
945 #elif !CYTHON_FAST_THREAD_STATE | |
946 #define __Pyx_PyThreadState_Current PyThreadState_GET() | |
947 #elif PY_VERSION_HEX >= 0x030d00A1 | |
948 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() | |
949 #elif PY_VERSION_HEX >= 0x03060000 | |
950 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() | |
951 #elif PY_VERSION_HEX >= 0x03000000 | |
952 #define __Pyx_PyThreadState_Current PyThreadState_GET() | |
953 #else | |
954 #define __Pyx_PyThreadState_Current _PyThreadState_Current | |
955 #endif | |
956 #if CYTHON_COMPILING_IN_LIMITED_API | |
957 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) | |
958 { | |
959 void *result; | |
960 result = PyModule_GetState(op); | |
961 if (!result) | |
962 Py_FatalError("Couldn't find the module state"); | |
963 return result; | |
964 } | |
965 #endif | |
966 #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) | |
967 #if CYTHON_COMPILING_IN_LIMITED_API | |
968 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) | |
969 #else | |
970 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) | |
971 #endif | |
972 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) | |
973 #include "pythread.h" | |
974 #define Py_tss_NEEDS_INIT 0 | |
975 typedef int Py_tss_t; | |
976 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { | |
977 *key = PyThread_create_key(); | |
978 return 0; | |
979 } | |
980 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { | |
981 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); | |
982 *key = Py_tss_NEEDS_INIT; | |
983 return key; | |
984 } | |
985 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { | |
986 PyObject_Free(key); | |
987 } | |
988 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { | |
989 return *key != Py_tss_NEEDS_INIT; | |
990 } | |
991 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { | |
992 PyThread_delete_key(*key); | |
993 *key = Py_tss_NEEDS_INIT; | |
994 } | |
995 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { | |
996 return PyThread_set_key_value(*key, value); | |
997 } | |
998 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { | |
999 return PyThread_get_key_value(*key); | |
1000 } | |
1001 #endif | |
1002 #if PY_MAJOR_VERSION < 3 | |
1003 #if CYTHON_COMPILING_IN_PYPY | |
1004 #if PYPY_VERSION_NUM < 0x07030600 | |
1005 #if defined(__cplusplus) && __cplusplus >= 201402L | |
1006 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] | |
1007 #elif defined(__GNUC__) || defined(__clang__) | |
1008 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) | |
1009 #elif defined(_MSC_VER) | |
1010 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) | |
1011 #endif | |
1012 static CYTHON_INLINE int PyGILState_Check(void) { | |
1013 return 0; | |
1014 } | |
1015 #else // PYPY_VERSION_NUM < 0x07030600 | |
1016 #endif // PYPY_VERSION_NUM < 0x07030600 | |
1017 #else | |
1018 static CYTHON_INLINE int PyGILState_Check(void) { | |
1019 PyThreadState * tstate = _PyThreadState_Current; | |
1020 return tstate && (tstate == PyGILState_GetThisThreadState()); | |
1021 } | |
1022 #endif | |
1023 #endif | |
1024 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) | |
1025 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) | |
1026 #else | |
1027 #define __Pyx_PyDict_NewPresized(n) PyDict_New() | |
1028 #endif | |
1029 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION | |
1030 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) | |
1031 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) | |
1032 #else | |
1033 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) | |
1034 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) | |
1035 #endif | |
1036 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS | |
1037 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) | |
1038 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { | |
1039 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); | |
1040 if (res == NULL) PyErr_Clear(); | |
1041 return res; | |
1042 } | |
1043 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) | |
1044 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError | |
1045 #define __Pyx_PyDict_GetItemStr PyDict_GetItem | |
1046 #else | |
1047 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { | |
1048 #if CYTHON_COMPILING_IN_PYPY | |
1049 return PyDict_GetItem(dict, name); | |
1050 #else | |
1051 PyDictEntry *ep; | |
1052 PyDictObject *mp = (PyDictObject*) dict; | |
1053 long hash = ((PyStringObject *) name)->ob_shash; | |
1054 assert(hash != -1); | |
1055 ep = (mp->ma_lookup)(mp, name, hash); | |
1056 if (ep == NULL) { | |
1057 return NULL; | |
1058 } | |
1059 return ep->me_value; | |
1060 #endif | |
1061 } | |
1062 #define __Pyx_PyDict_GetItemStr PyDict_GetItem | |
1063 #endif | |
1064 #if CYTHON_USE_TYPE_SLOTS | |
1065 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) | |
1066 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) | |
1067 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) | |
1068 #else | |
1069 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) | |
1070 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) | |
1071 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next | |
1072 #endif | |
1073 #if CYTHON_COMPILING_IN_LIMITED_API | |
1074 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) | |
1075 #else | |
1076 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) | |
1077 #endif | |
1078 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 | |
1079 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ | |
1080 PyTypeObject *type = Py_TYPE((PyObject*)obj);\ | |
1081 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ | |
1082 PyObject_GC_Del(obj);\ | |
1083 Py_DECREF(type);\ | |
1084 } | |
1085 #else | |
1086 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) | |
1087 #endif | |
1088 #if CYTHON_COMPILING_IN_LIMITED_API | |
1089 #define CYTHON_PEP393_ENABLED 1 | |
1090 #define __Pyx_PyUnicode_READY(op) (0) | |
1091 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) | |
1092 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) | |
1093 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) | |
1094 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) | |
1095 #define __Pyx_PyUnicode_DATA(u) ((void*)u) | |
1096 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) | |
1097 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) | |
1098 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) | |
1099 #define CYTHON_PEP393_ENABLED 1 | |
1100 #if PY_VERSION_HEX >= 0x030C0000 | |
1101 #define __Pyx_PyUnicode_READY(op) (0) | |
1102 #else | |
1103 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ | |
1104 0 : _PyUnicode_Ready((PyObject *)(op))) | |
1105 #endif | |
1106 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) | |
1107 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) | |
1108 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) | |
1109 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) | |
1110 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) | |
1111 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) | |
1112 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) | |
1113 #if PY_VERSION_HEX >= 0x030C0000 | |
1114 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) | |
1115 #else | |
1116 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 | |
1117 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) | |
1118 #else | |
1119 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) | |
1120 #endif | |
1121 #endif | |
1122 #else | |
1123 #define CYTHON_PEP393_ENABLED 0 | |
1124 #define PyUnicode_1BYTE_KIND 1 | |
1125 #define PyUnicode_2BYTE_KIND 2 | |
1126 #define PyUnicode_4BYTE_KIND 4 | |
1127 #define __Pyx_PyUnicode_READY(op) (0) | |
1128 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) | |
1129 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) | |
1130 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) | |
1131 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) | |
1132 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) | |
1133 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) | |
1134 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) | |
1135 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) | |
1136 #endif | |
1137 #if CYTHON_COMPILING_IN_PYPY | |
1138 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) | |
1139 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) | |
1140 #else | |
1141 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) | |
1142 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ | |
1143 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) | |
1144 #endif | |
1145 #if CYTHON_COMPILING_IN_PYPY | |
1146 #if !defined(PyUnicode_DecodeUnicodeEscape) | |
1147 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) | |
1148 #endif | |
1149 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) | |
1150 #undef PyUnicode_Contains | |
1151 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) | |
1152 #endif | |
1153 #if !defined(PyByteArray_Check) | |
1154 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) | |
1155 #endif | |
1156 #if !defined(PyObject_Format) | |
1157 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) | |
1158 #endif | |
1159 #endif | |
1160 #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)) | |
1161 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) | |
1162 #if PY_MAJOR_VERSION >= 3 | |
1163 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) | |
1164 #else | |
1165 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) | |
1166 #endif | |
1167 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) | |
1168 #define PyObject_ASCII(o) PyObject_Repr(o) | |
1169 #endif | |
1170 #if PY_MAJOR_VERSION >= 3 | |
1171 #define PyBaseString_Type PyUnicode_Type | |
1172 #define PyStringObject PyUnicodeObject | |
1173 #define PyString_Type PyUnicode_Type | |
1174 #define PyString_Check PyUnicode_Check | |
1175 #define PyString_CheckExact PyUnicode_CheckExact | |
1176 #ifndef PyObject_Unicode | |
1177 #define PyObject_Unicode PyObject_Str | |
1178 #endif | |
1179 #endif | |
1180 #if PY_MAJOR_VERSION >= 3 | |
1181 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) | |
1182 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) | |
1183 #else | |
1184 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) | |
1185 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) | |
1186 #endif | |
1187 #if CYTHON_COMPILING_IN_CPYTHON | |
1188 #define __Pyx_PySequence_ListKeepNew(obj)\ | |
1189 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) | |
1190 #else | |
1191 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) | |
1192 #endif | |
1193 #ifndef PySet_CheckExact | |
1194 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) | |
1195 #endif | |
1196 #if PY_VERSION_HEX >= 0x030900A4 | |
1197 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) | |
1198 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) | |
1199 #else | |
1200 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) | |
1201 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) | |
1202 #endif | |
1203 #if CYTHON_ASSUME_SAFE_MACROS | |
1204 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) | |
1205 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) | |
1206 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) | |
1207 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) | |
1208 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) | |
1209 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) | |
1210 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) | |
1211 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) | |
1212 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) | |
1213 #else | |
1214 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) | |
1215 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) | |
1216 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) | |
1217 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) | |
1218 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) | |
1219 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) | |
1220 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) | |
1221 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) | |
1222 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) | |
1223 #endif | |
1224 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 | |
1225 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) | |
1226 #else | |
1227 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { | |
1228 PyObject *module = PyImport_AddModule(name); | |
1229 Py_XINCREF(module); | |
1230 return module; | |
1231 } | |
1232 #endif | |
1233 #if PY_MAJOR_VERSION >= 3 | |
1234 #define PyIntObject PyLongObject | |
1235 #define PyInt_Type PyLong_Type | |
1236 #define PyInt_Check(op) PyLong_Check(op) | |
1237 #define PyInt_CheckExact(op) PyLong_CheckExact(op) | |
1238 #define __Pyx_Py3Int_Check(op) PyLong_Check(op) | |
1239 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) | |
1240 #define PyInt_FromString PyLong_FromString | |
1241 #define PyInt_FromUnicode PyLong_FromUnicode | |
1242 #define PyInt_FromLong PyLong_FromLong | |
1243 #define PyInt_FromSize_t PyLong_FromSize_t | |
1244 #define PyInt_FromSsize_t PyLong_FromSsize_t | |
1245 #define PyInt_AsLong PyLong_AsLong | |
1246 #define PyInt_AS_LONG PyLong_AS_LONG | |
1247 #define PyInt_AsSsize_t PyLong_AsSsize_t | |
1248 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask | |
1249 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask | |
1250 #define PyNumber_Int PyNumber_Long | |
1251 #else | |
1252 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) | |
1253 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) | |
1254 #endif | |
1255 #if PY_MAJOR_VERSION >= 3 | |
1256 #define PyBoolObject PyLongObject | |
1257 #endif | |
1258 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY | |
1259 #ifndef PyUnicode_InternFromString | |
1260 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) | |
1261 #endif | |
1262 #endif | |
1263 #if PY_VERSION_HEX < 0x030200A4 | |
1264 typedef long Py_hash_t; | |
1265 #define __Pyx_PyInt_FromHash_t PyInt_FromLong | |
1266 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t | |
1267 #else | |
1268 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t | |
1269 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t | |
1270 #endif | |
1271 #if CYTHON_USE_ASYNC_SLOTS | |
1272 #if PY_VERSION_HEX >= 0x030500B1 | |
1273 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods | |
1274 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) | |
1275 #else | |
1276 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) | |
1277 #endif | |
1278 #else | |
1279 #define __Pyx_PyType_AsAsync(obj) NULL | |
1280 #endif | |
1281 #ifndef __Pyx_PyAsyncMethodsStruct | |
1282 typedef struct { | |
1283 unaryfunc am_await; | |
1284 unaryfunc am_aiter; | |
1285 unaryfunc am_anext; | |
1286 } __Pyx_PyAsyncMethodsStruct; | |
1287 #endif | |
1288 | |
1289 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) | |
1290 #if !defined(_USE_MATH_DEFINES) | |
1291 #define _USE_MATH_DEFINES | |
1292 #endif | |
1293 #endif | |
1294 #include <math.h> | |
1295 #ifdef NAN | |
1296 #define __PYX_NAN() ((float) NAN) | |
1297 #else | |
1298 static CYTHON_INLINE float __PYX_NAN() { | |
1299 float value; | |
1300 memset(&value, 0xFF, sizeof(value)); | |
1301 return value; | |
1302 } | |
1303 #endif | |
1304 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) | |
1305 #define __Pyx_truncl trunc | |
1306 #else | |
1307 #define __Pyx_truncl truncl | |
1308 #endif | |
1309 | |
1310 #define __PYX_MARK_ERR_POS(f_index, lineno) \ | |
1311 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } | |
1312 #define __PYX_ERR(f_index, lineno, Ln_error) \ | |
1313 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } | |
1314 | |
1315 #ifdef CYTHON_EXTERN_C | |
1316 #undef __PYX_EXTERN_C | |
1317 #define __PYX_EXTERN_C CYTHON_EXTERN_C | |
1318 #elif defined(__PYX_EXTERN_C) | |
1319 #ifdef _MSC_VER | |
1320 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") | |
1321 #else | |
1322 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. | |
1323 #endif | |
1324 #else | |
1325 #ifdef __cplusplus | |
1326 #define __PYX_EXTERN_C extern "C" | |
1327 #else | |
1328 #define __PYX_EXTERN_C extern | |
1329 #endif | |
1330 #endif | |
1331 | |
1332 #define __PYX_HAVE__pysam__libcbcftools | |
1333 #define __PYX_HAVE_API__pysam__libcbcftools | |
1334 /* Early includes */ | |
1335 #include "bcftools.pysam.h" | |
1336 #ifdef _OPENMP | |
1337 #include <omp.h> | |
1338 #endif /* _OPENMP */ | |
1339 | |
1340 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) | |
1341 #define CYTHON_WITHOUT_ASSERTIONS | |
1342 #endif | |
1343 | |
1344 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; | |
1345 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; | |
1346 | |
1347 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 | |
1348 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 | |
1349 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) | |
1350 #define __PYX_DEFAULT_STRING_ENCODING "" | |
1351 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString | |
1352 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize | |
1353 #define __Pyx_uchar_cast(c) ((unsigned char)c) | |
1354 #define __Pyx_long_cast(x) ((long)x) | |
1355 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ | |
1356 (sizeof(type) < sizeof(Py_ssize_t)) ||\ | |
1357 (sizeof(type) > sizeof(Py_ssize_t) &&\ | |
1358 likely(v < (type)PY_SSIZE_T_MAX ||\ | |
1359 v == (type)PY_SSIZE_T_MAX) &&\ | |
1360 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ | |
1361 v == (type)PY_SSIZE_T_MIN))) ||\ | |
1362 (sizeof(type) == sizeof(Py_ssize_t) &&\ | |
1363 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ | |
1364 v == (type)PY_SSIZE_T_MAX))) ) | |
1365 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { | |
1366 return (size_t) i < (size_t) limit; | |
1367 } | |
1368 #if defined (__cplusplus) && __cplusplus >= 201103L | |
1369 #include <cstdlib> | |
1370 #define __Pyx_sst_abs(value) std::abs(value) | |
1371 #elif SIZEOF_INT >= SIZEOF_SIZE_T | |
1372 #define __Pyx_sst_abs(value) abs(value) | |
1373 #elif SIZEOF_LONG >= SIZEOF_SIZE_T | |
1374 #define __Pyx_sst_abs(value) labs(value) | |
1375 #elif defined (_MSC_VER) | |
1376 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) | |
1377 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
1378 #define __Pyx_sst_abs(value) llabs(value) | |
1379 #elif defined (__GNUC__) | |
1380 #define __Pyx_sst_abs(value) __builtin_llabs(value) | |
1381 #else | |
1382 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) | |
1383 #endif | |
1384 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); | |
1385 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); | |
1386 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); | |
1387 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); | |
1388 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) | |
1389 #define __Pyx_PyBytes_FromString PyBytes_FromString | |
1390 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize | |
1391 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); | |
1392 #if PY_MAJOR_VERSION < 3 | |
1393 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString | |
1394 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize | |
1395 #else | |
1396 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString | |
1397 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize | |
1398 #endif | |
1399 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) | |
1400 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) | |
1401 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) | |
1402 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) | |
1403 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) | |
1404 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) | |
1405 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) | |
1406 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) | |
1407 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) | |
1408 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) | |
1409 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) | |
1410 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) | |
1411 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) | |
1412 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) | |
1413 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) | |
1414 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) | |
1415 #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) | |
1416 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode | |
1417 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) | |
1418 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) | |
1419 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); | |
1420 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); | |
1421 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); | |
1422 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); | |
1423 #define __Pyx_PySequence_Tuple(obj)\ | |
1424 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) | |
1425 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); | |
1426 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); | |
1427 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); | |
1428 #if CYTHON_ASSUME_SAFE_MACROS | |
1429 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) | |
1430 #else | |
1431 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) | |
1432 #endif | |
1433 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) | |
1434 #if PY_MAJOR_VERSION >= 3 | |
1435 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) | |
1436 #else | |
1437 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) | |
1438 #endif | |
1439 #if CYTHON_USE_PYLONG_INTERNALS | |
1440 #if PY_VERSION_HEX >= 0x030C00A7 | |
1441 #ifndef _PyLong_SIGN_MASK | |
1442 #define _PyLong_SIGN_MASK 3 | |
1443 #endif | |
1444 #ifndef _PyLong_NON_SIZE_BITS | |
1445 #define _PyLong_NON_SIZE_BITS 3 | |
1446 #endif | |
1447 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) | |
1448 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) | |
1449 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) | |
1450 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) | |
1451 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) | |
1452 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) | |
1453 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) | |
1454 #define __Pyx_PyLong_SignedDigitCount(x)\ | |
1455 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) | |
1456 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) | |
1457 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) | |
1458 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) | |
1459 #else | |
1460 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) | |
1461 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) | |
1462 #endif | |
1463 typedef Py_ssize_t __Pyx_compact_pylong; | |
1464 typedef size_t __Pyx_compact_upylong; | |
1465 #else | |
1466 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) | |
1467 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) | |
1468 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) | |
1469 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) | |
1470 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) | |
1471 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) | |
1472 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) | |
1473 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) | |
1474 #define __Pyx_PyLong_CompactValue(x)\ | |
1475 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) | |
1476 typedef sdigit __Pyx_compact_pylong; | |
1477 typedef digit __Pyx_compact_upylong; | |
1478 #endif | |
1479 #if PY_VERSION_HEX >= 0x030C00A5 | |
1480 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) | |
1481 #else | |
1482 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) | |
1483 #endif | |
1484 #endif | |
1485 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
1486 #include <string.h> | |
1487 static int __Pyx_sys_getdefaultencoding_not_ascii; | |
1488 static int __Pyx_init_sys_getdefaultencoding_params(void) { | |
1489 PyObject* sys; | |
1490 PyObject* default_encoding = NULL; | |
1491 PyObject* ascii_chars_u = NULL; | |
1492 PyObject* ascii_chars_b = NULL; | |
1493 const char* default_encoding_c; | |
1494 sys = PyImport_ImportModule("sys"); | |
1495 if (!sys) goto bad; | |
1496 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); | |
1497 Py_DECREF(sys); | |
1498 if (!default_encoding) goto bad; | |
1499 default_encoding_c = PyBytes_AsString(default_encoding); | |
1500 if (!default_encoding_c) goto bad; | |
1501 if (strcmp(default_encoding_c, "ascii") == 0) { | |
1502 __Pyx_sys_getdefaultencoding_not_ascii = 0; | |
1503 } else { | |
1504 char ascii_chars[128]; | |
1505 int c; | |
1506 for (c = 0; c < 128; c++) { | |
1507 ascii_chars[c] = (char) c; | |
1508 } | |
1509 __Pyx_sys_getdefaultencoding_not_ascii = 1; | |
1510 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); | |
1511 if (!ascii_chars_u) goto bad; | |
1512 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); | |
1513 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { | |
1514 PyErr_Format( | |
1515 PyExc_ValueError, | |
1516 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", | |
1517 default_encoding_c); | |
1518 goto bad; | |
1519 } | |
1520 Py_DECREF(ascii_chars_u); | |
1521 Py_DECREF(ascii_chars_b); | |
1522 } | |
1523 Py_DECREF(default_encoding); | |
1524 return 0; | |
1525 bad: | |
1526 Py_XDECREF(default_encoding); | |
1527 Py_XDECREF(ascii_chars_u); | |
1528 Py_XDECREF(ascii_chars_b); | |
1529 return -1; | |
1530 } | |
1531 #endif | |
1532 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 | |
1533 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) | |
1534 #else | |
1535 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) | |
1536 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
1537 #include <string.h> | |
1538 static char* __PYX_DEFAULT_STRING_ENCODING; | |
1539 static int __Pyx_init_sys_getdefaultencoding_params(void) { | |
1540 PyObject* sys; | |
1541 PyObject* default_encoding = NULL; | |
1542 char* default_encoding_c; | |
1543 sys = PyImport_ImportModule("sys"); | |
1544 if (!sys) goto bad; | |
1545 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); | |
1546 Py_DECREF(sys); | |
1547 if (!default_encoding) goto bad; | |
1548 default_encoding_c = PyBytes_AsString(default_encoding); | |
1549 if (!default_encoding_c) goto bad; | |
1550 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); | |
1551 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; | |
1552 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); | |
1553 Py_DECREF(default_encoding); | |
1554 return 0; | |
1555 bad: | |
1556 Py_XDECREF(default_encoding); | |
1557 return -1; | |
1558 } | |
1559 #endif | |
1560 #endif | |
1561 | |
1562 | |
1563 /* Test for GCC > 2.95 */ | |
1564 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) | |
1565 #define likely(x) __builtin_expect(!!(x), 1) | |
1566 #define unlikely(x) __builtin_expect(!!(x), 0) | |
1567 #else /* !__GNUC__ or GCC < 2.95 */ | |
1568 #define likely(x) (x) | |
1569 #define unlikely(x) (x) | |
1570 #endif /* __GNUC__ */ | |
1571 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } | |
1572 | |
1573 #if !CYTHON_USE_MODULE_STATE | |
1574 static PyObject *__pyx_m = NULL; | |
1575 #endif | |
1576 static int __pyx_lineno; | |
1577 static int __pyx_clineno = 0; | |
1578 static const char * __pyx_cfilenm = __FILE__; | |
1579 static const char *__pyx_filename; | |
1580 | |
1581 /* #### Code section: filename_table ### */ | |
1582 | |
1583 static const char *__pyx_f[] = { | |
1584 "pysam/libcbcftools.pyx", | |
1585 }; | |
1586 /* #### Code section: utility_code_proto_before_types ### */ | |
1587 /* ForceInitThreads.proto */ | |
1588 #ifndef __PYX_FORCE_INIT_THREADS | |
1589 #define __PYX_FORCE_INIT_THREADS 0 | |
1590 #endif | |
1591 | |
1592 /* #### Code section: numeric_typedefs ### */ | |
1593 /* #### Code section: complex_type_declarations ### */ | |
1594 /* #### Code section: type_declarations ### */ | |
1595 | |
1596 /*--- Type declarations ---*/ | |
1597 /* #### Code section: utility_code_proto ### */ | |
1598 | |
1599 /* --- Runtime support code (head) --- */ | |
1600 /* Refnanny.proto */ | |
1601 #ifndef CYTHON_REFNANNY | |
1602 #define CYTHON_REFNANNY 0 | |
1603 #endif | |
1604 #if CYTHON_REFNANNY | |
1605 typedef struct { | |
1606 void (*INCREF)(void*, PyObject*, Py_ssize_t); | |
1607 void (*DECREF)(void*, PyObject*, Py_ssize_t); | |
1608 void (*GOTREF)(void*, PyObject*, Py_ssize_t); | |
1609 void (*GIVEREF)(void*, PyObject*, Py_ssize_t); | |
1610 void* (*SetupContext)(const char*, Py_ssize_t, const char*); | |
1611 void (*FinishContext)(void**); | |
1612 } __Pyx_RefNannyAPIStruct; | |
1613 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; | |
1614 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); | |
1615 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; | |
1616 #ifdef WITH_THREAD | |
1617 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ | |
1618 if (acquire_gil) {\ | |
1619 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ | |
1620 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ | |
1621 PyGILState_Release(__pyx_gilstate_save);\ | |
1622 } else {\ | |
1623 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ | |
1624 } | |
1625 #define __Pyx_RefNannyFinishContextNogil() {\ | |
1626 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ | |
1627 __Pyx_RefNannyFinishContext();\ | |
1628 PyGILState_Release(__pyx_gilstate_save);\ | |
1629 } | |
1630 #else | |
1631 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ | |
1632 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) | |
1633 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() | |
1634 #endif | |
1635 #define __Pyx_RefNannyFinishContextNogil() {\ | |
1636 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ | |
1637 __Pyx_RefNannyFinishContext();\ | |
1638 PyGILState_Release(__pyx_gilstate_save);\ | |
1639 } | |
1640 #define __Pyx_RefNannyFinishContext()\ | |
1641 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) | |
1642 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) | |
1643 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) | |
1644 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) | |
1645 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) | |
1646 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) | |
1647 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) | |
1648 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) | |
1649 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) | |
1650 #else | |
1651 #define __Pyx_RefNannyDeclarations | |
1652 #define __Pyx_RefNannySetupContext(name, acquire_gil) | |
1653 #define __Pyx_RefNannyFinishContextNogil() | |
1654 #define __Pyx_RefNannyFinishContext() | |
1655 #define __Pyx_INCREF(r) Py_INCREF(r) | |
1656 #define __Pyx_DECREF(r) Py_DECREF(r) | |
1657 #define __Pyx_GOTREF(r) | |
1658 #define __Pyx_GIVEREF(r) | |
1659 #define __Pyx_XINCREF(r) Py_XINCREF(r) | |
1660 #define __Pyx_XDECREF(r) Py_XDECREF(r) | |
1661 #define __Pyx_XGOTREF(r) | |
1662 #define __Pyx_XGIVEREF(r) | |
1663 #endif | |
1664 #define __Pyx_Py_XDECREF_SET(r, v) do {\ | |
1665 PyObject *tmp = (PyObject *) r;\ | |
1666 r = v; Py_XDECREF(tmp);\ | |
1667 } while (0) | |
1668 #define __Pyx_XDECREF_SET(r, v) do {\ | |
1669 PyObject *tmp = (PyObject *) r;\ | |
1670 r = v; __Pyx_XDECREF(tmp);\ | |
1671 } while (0) | |
1672 #define __Pyx_DECREF_SET(r, v) do {\ | |
1673 PyObject *tmp = (PyObject *) r;\ | |
1674 r = v; __Pyx_DECREF(tmp);\ | |
1675 } while (0) | |
1676 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) | |
1677 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) | |
1678 | |
1679 /* TupleAndListFromArray.proto */ | |
1680 #if CYTHON_COMPILING_IN_CPYTHON | |
1681 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); | |
1682 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); | |
1683 #endif | |
1684 | |
1685 /* IncludeStringH.proto */ | |
1686 #include <string.h> | |
1687 | |
1688 /* BytesEquals.proto */ | |
1689 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); | |
1690 | |
1691 /* UnicodeEquals.proto */ | |
1692 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); | |
1693 | |
1694 /* fastcall.proto */ | |
1695 #if CYTHON_AVOID_BORROWED_REFS | |
1696 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) | |
1697 #elif CYTHON_ASSUME_SAFE_MACROS | |
1698 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) | |
1699 #else | |
1700 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) | |
1701 #endif | |
1702 #if CYTHON_AVOID_BORROWED_REFS | |
1703 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) | |
1704 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) | |
1705 #else | |
1706 #define __Pyx_Arg_NewRef_VARARGS(arg) arg | |
1707 #define __Pyx_Arg_XDECREF_VARARGS(arg) | |
1708 #endif | |
1709 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) | |
1710 #define __Pyx_KwValues_VARARGS(args, nargs) NULL | |
1711 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) | |
1712 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) | |
1713 #if CYTHON_METH_FASTCALL | |
1714 #define __Pyx_Arg_FASTCALL(args, i) args[i] | |
1715 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) | |
1716 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) | |
1717 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); | |
1718 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 | |
1719 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); | |
1720 #else | |
1721 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) | |
1722 #endif | |
1723 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs | |
1724 to have the same reference counting */ | |
1725 #define __Pyx_Arg_XDECREF_FASTCALL(arg) | |
1726 #else | |
1727 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS | |
1728 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS | |
1729 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS | |
1730 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS | |
1731 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS | |
1732 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) | |
1733 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) | |
1734 #endif | |
1735 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
1736 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) | |
1737 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) | |
1738 #else | |
1739 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) | |
1740 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) | |
1741 #endif | |
1742 | |
1743 /* IncludeStructmemberH.proto */ | |
1744 #include <structmember.h> | |
1745 | |
1746 /* FixUpExtensionType.proto */ | |
1747 #if CYTHON_USE_TYPE_SPECS | |
1748 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); | |
1749 #endif | |
1750 | |
1751 /* FetchSharedCythonModule.proto */ | |
1752 static PyObject *__Pyx_FetchSharedCythonABIModule(void); | |
1753 | |
1754 /* FetchCommonType.proto */ | |
1755 #if !CYTHON_USE_TYPE_SPECS | |
1756 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); | |
1757 #else | |
1758 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); | |
1759 #endif | |
1760 | |
1761 /* PyMethodNew.proto */ | |
1762 #if CYTHON_COMPILING_IN_LIMITED_API | |
1763 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { | |
1764 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; | |
1765 CYTHON_UNUSED_VAR(typ); | |
1766 if (!self) | |
1767 return __Pyx_NewRef(func); | |
1768 typesModule = PyImport_ImportModule("types"); | |
1769 if (!typesModule) return NULL; | |
1770 methodType = PyObject_GetAttrString(typesModule, "MethodType"); | |
1771 Py_DECREF(typesModule); | |
1772 if (!methodType) return NULL; | |
1773 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); | |
1774 Py_DECREF(methodType); | |
1775 return result; | |
1776 } | |
1777 #elif PY_MAJOR_VERSION >= 3 | |
1778 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { | |
1779 CYTHON_UNUSED_VAR(typ); | |
1780 if (!self) | |
1781 return __Pyx_NewRef(func); | |
1782 return PyMethod_New(func, self); | |
1783 } | |
1784 #else | |
1785 #define __Pyx_PyMethod_New PyMethod_New | |
1786 #endif | |
1787 | |
1788 /* PyObjectGetAttrStr.proto */ | |
1789 #if CYTHON_USE_TYPE_SLOTS | |
1790 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); | |
1791 #else | |
1792 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) | |
1793 #endif | |
1794 | |
1795 /* PyVectorcallFastCallDict.proto */ | |
1796 #if CYTHON_METH_FASTCALL | |
1797 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); | |
1798 #endif | |
1799 | |
1800 /* CythonFunctionShared.proto */ | |
1801 #define __Pyx_CyFunction_USED | |
1802 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 | |
1803 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 | |
1804 #define __Pyx_CYFUNCTION_CCLASS 0x04 | |
1805 #define __Pyx_CYFUNCTION_COROUTINE 0x08 | |
1806 #define __Pyx_CyFunction_GetClosure(f)\ | |
1807 (((__pyx_CyFunctionObject *) (f))->func_closure) | |
1808 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API | |
1809 #define __Pyx_CyFunction_GetClassObj(f)\ | |
1810 (((__pyx_CyFunctionObject *) (f))->func_classobj) | |
1811 #else | |
1812 #define __Pyx_CyFunction_GetClassObj(f)\ | |
1813 ((PyObject*) ((PyCMethodObject *) (f))->mm_class) | |
1814 #endif | |
1815 #define __Pyx_CyFunction_SetClassObj(f, classobj)\ | |
1816 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) | |
1817 #define __Pyx_CyFunction_Defaults(type, f)\ | |
1818 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) | |
1819 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ | |
1820 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) | |
1821 typedef struct { | |
1822 #if CYTHON_COMPILING_IN_LIMITED_API | |
1823 PyObject_HEAD | |
1824 PyObject *func; | |
1825 #elif PY_VERSION_HEX < 0x030900B1 | |
1826 PyCFunctionObject func; | |
1827 #else | |
1828 PyCMethodObject func; | |
1829 #endif | |
1830 #if CYTHON_BACKPORT_VECTORCALL | |
1831 __pyx_vectorcallfunc func_vectorcall; | |
1832 #endif | |
1833 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API | |
1834 PyObject *func_weakreflist; | |
1835 #endif | |
1836 PyObject *func_dict; | |
1837 PyObject *func_name; | |
1838 PyObject *func_qualname; | |
1839 PyObject *func_doc; | |
1840 PyObject *func_globals; | |
1841 PyObject *func_code; | |
1842 PyObject *func_closure; | |
1843 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API | |
1844 PyObject *func_classobj; | |
1845 #endif | |
1846 void *defaults; | |
1847 int defaults_pyobjects; | |
1848 size_t defaults_size; | |
1849 int flags; | |
1850 PyObject *defaults_tuple; | |
1851 PyObject *defaults_kwdict; | |
1852 PyObject *(*defaults_getter)(PyObject *); | |
1853 PyObject *func_annotations; | |
1854 PyObject *func_is_coroutine; | |
1855 } __pyx_CyFunctionObject; | |
1856 #undef __Pyx_CyOrPyCFunction_Check | |
1857 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) | |
1858 #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) | |
1859 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) | |
1860 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); | |
1861 #undef __Pyx_IsSameCFunction | |
1862 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) | |
1863 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, | |
1864 int flags, PyObject* qualname, | |
1865 PyObject *closure, | |
1866 PyObject *module, PyObject *globals, | |
1867 PyObject* code); | |
1868 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); | |
1869 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, | |
1870 size_t size, | |
1871 int pyobjects); | |
1872 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, | |
1873 PyObject *tuple); | |
1874 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, | |
1875 PyObject *dict); | |
1876 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, | |
1877 PyObject *dict); | |
1878 static int __pyx_CyFunction_init(PyObject *module); | |
1879 #if CYTHON_METH_FASTCALL | |
1880 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); | |
1881 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); | |
1882 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); | |
1883 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); | |
1884 #if CYTHON_BACKPORT_VECTORCALL | |
1885 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) | |
1886 #else | |
1887 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) | |
1888 #endif | |
1889 #endif | |
1890 | |
1891 /* CythonFunction.proto */ | |
1892 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, | |
1893 int flags, PyObject* qualname, | |
1894 PyObject *closure, | |
1895 PyObject *module, PyObject *globals, | |
1896 PyObject* code); | |
1897 | |
1898 /* PyDictVersioning.proto */ | |
1899 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS | |
1900 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) | |
1901 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) | |
1902 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ | |
1903 (version_var) = __PYX_GET_DICT_VERSION(dict);\ | |
1904 (cache_var) = (value); | |
1905 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ | |
1906 static PY_UINT64_T __pyx_dict_version = 0;\ | |
1907 static PyObject *__pyx_dict_cached_value = NULL;\ | |
1908 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ | |
1909 (VAR) = __pyx_dict_cached_value;\ | |
1910 } else {\ | |
1911 (VAR) = __pyx_dict_cached_value = (LOOKUP);\ | |
1912 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ | |
1913 }\ | |
1914 } | |
1915 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); | |
1916 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); | |
1917 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); | |
1918 #else | |
1919 #define __PYX_GET_DICT_VERSION(dict) (0) | |
1920 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) | |
1921 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); | |
1922 #endif | |
1923 | |
1924 /* PyErrExceptionMatches.proto */ | |
1925 #if CYTHON_FAST_THREAD_STATE | |
1926 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) | |
1927 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); | |
1928 #else | |
1929 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) | |
1930 #endif | |
1931 | |
1932 /* PyThreadStateGet.proto */ | |
1933 #if CYTHON_FAST_THREAD_STATE | |
1934 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; | |
1935 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; | |
1936 #if PY_VERSION_HEX >= 0x030C00A6 | |
1937 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) | |
1938 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) | |
1939 #else | |
1940 #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) | |
1941 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) | |
1942 #endif | |
1943 #else | |
1944 #define __Pyx_PyThreadState_declare | |
1945 #define __Pyx_PyThreadState_assign | |
1946 #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) | |
1947 #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() | |
1948 #endif | |
1949 | |
1950 /* PyErrFetchRestore.proto */ | |
1951 #if CYTHON_FAST_THREAD_STATE | |
1952 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) | |
1953 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) | |
1954 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) | |
1955 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) | |
1956 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) | |
1957 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); | |
1958 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); | |
1959 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 | |
1960 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) | |
1961 #else | |
1962 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) | |
1963 #endif | |
1964 #else | |
1965 #define __Pyx_PyErr_Clear() PyErr_Clear() | |
1966 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) | |
1967 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) | |
1968 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) | |
1969 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) | |
1970 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) | |
1971 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) | |
1972 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) | |
1973 #endif | |
1974 | |
1975 /* PyObjectGetAttrStrNoError.proto */ | |
1976 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); | |
1977 | |
1978 /* CLineInTraceback.proto */ | |
1979 #ifdef CYTHON_CLINE_IN_TRACEBACK | |
1980 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) | |
1981 #else | |
1982 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); | |
1983 #endif | |
1984 | |
1985 /* CodeObjectCache.proto */ | |
1986 #if !CYTHON_COMPILING_IN_LIMITED_API | |
1987 typedef struct { | |
1988 PyCodeObject* code_object; | |
1989 int code_line; | |
1990 } __Pyx_CodeObjectCacheEntry; | |
1991 struct __Pyx_CodeObjectCache { | |
1992 int count; | |
1993 int max_count; | |
1994 __Pyx_CodeObjectCacheEntry* entries; | |
1995 }; | |
1996 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; | |
1997 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); | |
1998 static PyCodeObject *__pyx_find_code_object(int code_line); | |
1999 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); | |
2000 #endif | |
2001 | |
2002 /* AddTraceback.proto */ | |
2003 static void __Pyx_AddTraceback(const char *funcname, int c_line, | |
2004 int py_line, const char *filename); | |
2005 | |
2006 /* FormatTypeName.proto */ | |
2007 #if CYTHON_COMPILING_IN_LIMITED_API | |
2008 typedef PyObject *__Pyx_TypeName; | |
2009 #define __Pyx_FMT_TYPENAME "%U" | |
2010 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); | |
2011 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) | |
2012 #else | |
2013 typedef const char *__Pyx_TypeName; | |
2014 #define __Pyx_FMT_TYPENAME "%.200s" | |
2015 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name) | |
2016 #define __Pyx_DECREF_TypeName(obj) | |
2017 #endif | |
2018 | |
2019 /* GCCDiagnostics.proto */ | |
2020 #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |
2021 #define __Pyx_HAS_GCC_DIAGNOSTIC | |
2022 #endif | |
2023 | |
2024 /* CIntToPy.proto */ | |
2025 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); | |
2026 | |
2027 /* CIntFromPy.proto */ | |
2028 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); | |
2029 | |
2030 /* CIntFromPy.proto */ | |
2031 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); | |
2032 | |
2033 /* FastTypeChecks.proto */ | |
2034 #if CYTHON_COMPILING_IN_CPYTHON | |
2035 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) | |
2036 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) | |
2037 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); | |
2038 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); | |
2039 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); | |
2040 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); | |
2041 #else | |
2042 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) | |
2043 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) | |
2044 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) | |
2045 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) | |
2046 #endif | |
2047 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) | |
2048 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) | |
2049 | |
2050 /* CheckBinaryVersion.proto */ | |
2051 static unsigned long __Pyx_get_runtime_version(void); | |
2052 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); | |
2053 | |
2054 /* InitStrings.proto */ | |
2055 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); | |
2056 | |
2057 /* #### Code section: module_declarations ### */ | |
2058 | |
2059 /* Module declarations from "pysam.libcbcftools" */ | |
2060 /* #### Code section: typeinfo ### */ | |
2061 /* #### Code section: before_global_var ### */ | |
2062 #define __Pyx_MODULE_NAME "pysam.libcbcftools" | |
2063 extern int __pyx_module_is_main_pysam__libcbcftools; | |
2064 int __pyx_module_is_main_pysam__libcbcftools = 0; | |
2065 | |
2066 /* Implementation of "pysam.libcbcftools" */ | |
2067 /* #### Code section: global_var ### */ | |
2068 /* #### Code section: string_decls ### */ | |
2069 static const char __pyx_k__2[] = "?"; | |
2070 static const char __pyx_k_main[] = "__main__"; | |
2071 static const char __pyx_k_name[] = "__name__"; | |
2072 static const char __pyx_k_test[] = "__test__"; | |
2073 static const char __pyx_k_py_bcftools[] = "py_bcftools"; | |
2074 static const char __pyx_k_is_coroutine[] = "_is_coroutine"; | |
2075 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; | |
2076 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; | |
2077 static const char __pyx_k_pysam_libcbcftools[] = "pysam.libcbcftools"; | |
2078 static const char __pyx_k_pysam_libcbcftools_pyx[] = "pysam/libcbcftools.pyx"; | |
2079 /* #### Code section: decls ### */ | |
2080 static PyObject *__pyx_pf_5pysam_12libcbcftools_py_bcftools(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ | |
2081 /* #### Code section: late_includes ### */ | |
2082 /* #### Code section: module_state ### */ | |
2083 typedef struct { | |
2084 PyObject *__pyx_d; | |
2085 PyObject *__pyx_b; | |
2086 PyObject *__pyx_cython_runtime; | |
2087 PyObject *__pyx_empty_tuple; | |
2088 PyObject *__pyx_empty_bytes; | |
2089 PyObject *__pyx_empty_unicode; | |
2090 #ifdef __Pyx_CyFunction_USED | |
2091 PyTypeObject *__pyx_CyFunctionType; | |
2092 #endif | |
2093 #ifdef __Pyx_FusedFunction_USED | |
2094 PyTypeObject *__pyx_FusedFunctionType; | |
2095 #endif | |
2096 #ifdef __Pyx_Generator_USED | |
2097 PyTypeObject *__pyx_GeneratorType; | |
2098 #endif | |
2099 #ifdef __Pyx_IterableCoroutine_USED | |
2100 PyTypeObject *__pyx_IterableCoroutineType; | |
2101 #endif | |
2102 #ifdef __Pyx_Coroutine_USED | |
2103 PyTypeObject *__pyx_CoroutineAwaitType; | |
2104 #endif | |
2105 #ifdef __Pyx_Coroutine_USED | |
2106 PyTypeObject *__pyx_CoroutineType; | |
2107 #endif | |
2108 #if CYTHON_USE_MODULE_STATE | |
2109 #endif | |
2110 PyObject *__pyx_n_s__2; | |
2111 PyObject *__pyx_n_s_asyncio_coroutines; | |
2112 PyObject *__pyx_n_s_cline_in_traceback; | |
2113 PyObject *__pyx_n_s_is_coroutine; | |
2114 PyObject *__pyx_n_s_main; | |
2115 PyObject *__pyx_n_s_name; | |
2116 PyObject *__pyx_n_s_py_bcftools; | |
2117 PyObject *__pyx_n_s_pysam_libcbcftools; | |
2118 PyObject *__pyx_kp_s_pysam_libcbcftools_pyx; | |
2119 PyObject *__pyx_n_s_test; | |
2120 PyObject *__pyx_codeobj_; | |
2121 } __pyx_mstate; | |
2122 | |
2123 #if CYTHON_USE_MODULE_STATE | |
2124 #ifdef __cplusplus | |
2125 namespace { | |
2126 extern struct PyModuleDef __pyx_moduledef; | |
2127 } /* anonymous namespace */ | |
2128 #else | |
2129 static struct PyModuleDef __pyx_moduledef; | |
2130 #endif | |
2131 | |
2132 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) | |
2133 | |
2134 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) | |
2135 | |
2136 #define __pyx_m (PyState_FindModule(&__pyx_moduledef)) | |
2137 #else | |
2138 static __pyx_mstate __pyx_mstate_global_static = | |
2139 #ifdef __cplusplus | |
2140 {}; | |
2141 #else | |
2142 {0}; | |
2143 #endif | |
2144 static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; | |
2145 #endif | |
2146 /* #### Code section: module_state_clear ### */ | |
2147 #if CYTHON_USE_MODULE_STATE | |
2148 static int __pyx_m_clear(PyObject *m) { | |
2149 __pyx_mstate *clear_module_state = __pyx_mstate(m); | |
2150 if (!clear_module_state) return 0; | |
2151 Py_CLEAR(clear_module_state->__pyx_d); | |
2152 Py_CLEAR(clear_module_state->__pyx_b); | |
2153 Py_CLEAR(clear_module_state->__pyx_cython_runtime); | |
2154 Py_CLEAR(clear_module_state->__pyx_empty_tuple); | |
2155 Py_CLEAR(clear_module_state->__pyx_empty_bytes); | |
2156 Py_CLEAR(clear_module_state->__pyx_empty_unicode); | |
2157 #ifdef __Pyx_CyFunction_USED | |
2158 Py_CLEAR(clear_module_state->__pyx_CyFunctionType); | |
2159 #endif | |
2160 #ifdef __Pyx_FusedFunction_USED | |
2161 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); | |
2162 #endif | |
2163 Py_CLEAR(clear_module_state->__pyx_n_s__2); | |
2164 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); | |
2165 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); | |
2166 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); | |
2167 Py_CLEAR(clear_module_state->__pyx_n_s_main); | |
2168 Py_CLEAR(clear_module_state->__pyx_n_s_name); | |
2169 Py_CLEAR(clear_module_state->__pyx_n_s_py_bcftools); | |
2170 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libcbcftools); | |
2171 Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libcbcftools_pyx); | |
2172 Py_CLEAR(clear_module_state->__pyx_n_s_test); | |
2173 Py_CLEAR(clear_module_state->__pyx_codeobj_); | |
2174 return 0; | |
2175 } | |
2176 #endif | |
2177 /* #### Code section: module_state_traverse ### */ | |
2178 #if CYTHON_USE_MODULE_STATE | |
2179 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { | |
2180 __pyx_mstate *traverse_module_state = __pyx_mstate(m); | |
2181 if (!traverse_module_state) return 0; | |
2182 Py_VISIT(traverse_module_state->__pyx_d); | |
2183 Py_VISIT(traverse_module_state->__pyx_b); | |
2184 Py_VISIT(traverse_module_state->__pyx_cython_runtime); | |
2185 Py_VISIT(traverse_module_state->__pyx_empty_tuple); | |
2186 Py_VISIT(traverse_module_state->__pyx_empty_bytes); | |
2187 Py_VISIT(traverse_module_state->__pyx_empty_unicode); | |
2188 #ifdef __Pyx_CyFunction_USED | |
2189 Py_VISIT(traverse_module_state->__pyx_CyFunctionType); | |
2190 #endif | |
2191 #ifdef __Pyx_FusedFunction_USED | |
2192 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); | |
2193 #endif | |
2194 Py_VISIT(traverse_module_state->__pyx_n_s__2); | |
2195 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); | |
2196 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); | |
2197 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); | |
2198 Py_VISIT(traverse_module_state->__pyx_n_s_main); | |
2199 Py_VISIT(traverse_module_state->__pyx_n_s_name); | |
2200 Py_VISIT(traverse_module_state->__pyx_n_s_py_bcftools); | |
2201 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libcbcftools); | |
2202 Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libcbcftools_pyx); | |
2203 Py_VISIT(traverse_module_state->__pyx_n_s_test); | |
2204 Py_VISIT(traverse_module_state->__pyx_codeobj_); | |
2205 return 0; | |
2206 } | |
2207 #endif | |
2208 /* #### Code section: module_state_defines ### */ | |
2209 #define __pyx_d __pyx_mstate_global->__pyx_d | |
2210 #define __pyx_b __pyx_mstate_global->__pyx_b | |
2211 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime | |
2212 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple | |
2213 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes | |
2214 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode | |
2215 #ifdef __Pyx_CyFunction_USED | |
2216 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType | |
2217 #endif | |
2218 #ifdef __Pyx_FusedFunction_USED | |
2219 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType | |
2220 #endif | |
2221 #ifdef __Pyx_Generator_USED | |
2222 #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType | |
2223 #endif | |
2224 #ifdef __Pyx_IterableCoroutine_USED | |
2225 #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType | |
2226 #endif | |
2227 #ifdef __Pyx_Coroutine_USED | |
2228 #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType | |
2229 #endif | |
2230 #ifdef __Pyx_Coroutine_USED | |
2231 #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType | |
2232 #endif | |
2233 #if CYTHON_USE_MODULE_STATE | |
2234 #endif | |
2235 #define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2 | |
2236 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines | |
2237 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback | |
2238 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine | |
2239 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main | |
2240 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name | |
2241 #define __pyx_n_s_py_bcftools __pyx_mstate_global->__pyx_n_s_py_bcftools | |
2242 #define __pyx_n_s_pysam_libcbcftools __pyx_mstate_global->__pyx_n_s_pysam_libcbcftools | |
2243 #define __pyx_kp_s_pysam_libcbcftools_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libcbcftools_pyx | |
2244 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test | |
2245 #define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ | |
2246 /* #### Code section: module_code ### */ | |
2247 | |
2248 /* "pysam/libcbcftools.pyx":1 | |
2249 * def py_bcftools(): # <<<<<<<<<<<<<< | |
2250 * pass | |
2251 */ | |
2252 | |
2253 /* Python wrapper */ | |
2254 static PyObject *__pyx_pw_5pysam_12libcbcftools_1py_bcftools(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ | |
2255 static PyMethodDef __pyx_mdef_5pysam_12libcbcftools_1py_bcftools = {"py_bcftools", (PyCFunction)__pyx_pw_5pysam_12libcbcftools_1py_bcftools, METH_NOARGS, 0}; | |
2256 static PyObject *__pyx_pw_5pysam_12libcbcftools_1py_bcftools(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { | |
2257 CYTHON_UNUSED PyObject *const *__pyx_kwvalues; | |
2258 PyObject *__pyx_r = 0; | |
2259 __Pyx_RefNannyDeclarations | |
2260 __Pyx_RefNannySetupContext("py_bcftools (wrapper)", 0); | |
2261 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); | |
2262 __pyx_r = __pyx_pf_5pysam_12libcbcftools_py_bcftools(__pyx_self); | |
2263 | |
2264 /* function exit code */ | |
2265 __Pyx_RefNannyFinishContext(); | |
2266 return __pyx_r; | |
2267 } | |
2268 | |
2269 static PyObject *__pyx_pf_5pysam_12libcbcftools_py_bcftools(CYTHON_UNUSED PyObject *__pyx_self) { | |
2270 PyObject *__pyx_r = NULL; | |
2271 __Pyx_RefNannyDeclarations | |
2272 __Pyx_RefNannySetupContext("py_bcftools", 1); | |
2273 | |
2274 /* function exit code */ | |
2275 __pyx_r = Py_None; __Pyx_INCREF(Py_None); | |
2276 __Pyx_XGIVEREF(__pyx_r); | |
2277 __Pyx_RefNannyFinishContext(); | |
2278 return __pyx_r; | |
2279 } | |
2280 | |
2281 static PyMethodDef __pyx_methods[] = { | |
2282 {0, 0, 0, 0} | |
2283 }; | |
2284 #ifndef CYTHON_SMALL_CODE | |
2285 #if defined(__clang__) | |
2286 #define CYTHON_SMALL_CODE | |
2287 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) | |
2288 #define CYTHON_SMALL_CODE __attribute__((cold)) | |
2289 #else | |
2290 #define CYTHON_SMALL_CODE | |
2291 #endif | |
2292 #endif | |
2293 /* #### Code section: pystring_table ### */ | |
2294 | |
2295 static int __Pyx_CreateStringTabAndInitStrings(void) { | |
2296 __Pyx_StringTabEntry __pyx_string_tab[] = { | |
2297 {&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, | |
2298 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, | |
2299 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, | |
2300 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, | |
2301 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, | |
2302 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, | |
2303 {&__pyx_n_s_py_bcftools, __pyx_k_py_bcftools, sizeof(__pyx_k_py_bcftools), 0, 0, 1, 1}, | |
2304 {&__pyx_n_s_pysam_libcbcftools, __pyx_k_pysam_libcbcftools, sizeof(__pyx_k_pysam_libcbcftools), 0, 0, 1, 1}, | |
2305 {&__pyx_kp_s_pysam_libcbcftools_pyx, __pyx_k_pysam_libcbcftools_pyx, sizeof(__pyx_k_pysam_libcbcftools_pyx), 0, 0, 1, 0}, | |
2306 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, | |
2307 {0, 0, 0, 0, 0, 0, 0} | |
2308 }; | |
2309 return __Pyx_InitStrings(__pyx_string_tab); | |
2310 } | |
2311 /* #### Code section: cached_builtins ### */ | |
2312 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { | |
2313 return 0; | |
2314 } | |
2315 /* #### Code section: cached_constants ### */ | |
2316 | |
2317 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { | |
2318 __Pyx_RefNannyDeclarations | |
2319 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); | |
2320 | |
2321 /* "pysam/libcbcftools.pyx":1 | |
2322 * def py_bcftools(): # <<<<<<<<<<<<<< | |
2323 * pass | |
2324 */ | |
2325 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbcftools_pyx, __pyx_n_s_py_bcftools, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2326 __Pyx_RefNannyFinishContext(); | |
2327 return 0; | |
2328 __pyx_L1_error:; | |
2329 __Pyx_RefNannyFinishContext(); | |
2330 return -1; | |
2331 } | |
2332 /* #### Code section: init_constants ### */ | |
2333 | |
2334 static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { | |
2335 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); | |
2336 return 0; | |
2337 __pyx_L1_error:; | |
2338 return -1; | |
2339 } | |
2340 /* #### Code section: init_globals ### */ | |
2341 | |
2342 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { | |
2343 return 0; | |
2344 } | |
2345 /* #### Code section: init_module ### */ | |
2346 | |
2347 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ | |
2348 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ | |
2349 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ | |
2350 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ | |
2351 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ | |
2352 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ | |
2353 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ | |
2354 | |
2355 static int __Pyx_modinit_global_init_code(void) { | |
2356 __Pyx_RefNannyDeclarations | |
2357 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); | |
2358 /*--- Global init code ---*/ | |
2359 __Pyx_RefNannyFinishContext(); | |
2360 return 0; | |
2361 } | |
2362 | |
2363 static int __Pyx_modinit_variable_export_code(void) { | |
2364 __Pyx_RefNannyDeclarations | |
2365 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); | |
2366 /*--- Variable export code ---*/ | |
2367 __Pyx_RefNannyFinishContext(); | |
2368 return 0; | |
2369 } | |
2370 | |
2371 static int __Pyx_modinit_function_export_code(void) { | |
2372 __Pyx_RefNannyDeclarations | |
2373 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); | |
2374 /*--- Function export code ---*/ | |
2375 __Pyx_RefNannyFinishContext(); | |
2376 return 0; | |
2377 } | |
2378 | |
2379 static int __Pyx_modinit_type_init_code(void) { | |
2380 __Pyx_RefNannyDeclarations | |
2381 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); | |
2382 /*--- Type init code ---*/ | |
2383 __Pyx_RefNannyFinishContext(); | |
2384 return 0; | |
2385 } | |
2386 | |
2387 static int __Pyx_modinit_type_import_code(void) { | |
2388 __Pyx_RefNannyDeclarations | |
2389 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); | |
2390 /*--- Type import code ---*/ | |
2391 __Pyx_RefNannyFinishContext(); | |
2392 return 0; | |
2393 } | |
2394 | |
2395 static int __Pyx_modinit_variable_import_code(void) { | |
2396 __Pyx_RefNannyDeclarations | |
2397 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); | |
2398 /*--- Variable import code ---*/ | |
2399 __Pyx_RefNannyFinishContext(); | |
2400 return 0; | |
2401 } | |
2402 | |
2403 static int __Pyx_modinit_function_import_code(void) { | |
2404 __Pyx_RefNannyDeclarations | |
2405 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); | |
2406 /*--- Function import code ---*/ | |
2407 __Pyx_RefNannyFinishContext(); | |
2408 return 0; | |
2409 } | |
2410 | |
2411 | |
2412 #if PY_MAJOR_VERSION >= 3 | |
2413 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2414 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ | |
2415 static int __pyx_pymod_exec_libcbcftools(PyObject* module); /*proto*/ | |
2416 static PyModuleDef_Slot __pyx_moduledef_slots[] = { | |
2417 {Py_mod_create, (void*)__pyx_pymod_create}, | |
2418 {Py_mod_exec, (void*)__pyx_pymod_exec_libcbcftools}, | |
2419 {0, NULL} | |
2420 }; | |
2421 #endif | |
2422 | |
2423 #ifdef __cplusplus | |
2424 namespace { | |
2425 struct PyModuleDef __pyx_moduledef = | |
2426 #else | |
2427 static struct PyModuleDef __pyx_moduledef = | |
2428 #endif | |
2429 { | |
2430 PyModuleDef_HEAD_INIT, | |
2431 "libcbcftools", | |
2432 0, /* m_doc */ | |
2433 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2434 0, /* m_size */ | |
2435 #elif CYTHON_USE_MODULE_STATE | |
2436 sizeof(__pyx_mstate), /* m_size */ | |
2437 #else | |
2438 -1, /* m_size */ | |
2439 #endif | |
2440 __pyx_methods /* m_methods */, | |
2441 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2442 __pyx_moduledef_slots, /* m_slots */ | |
2443 #else | |
2444 NULL, /* m_reload */ | |
2445 #endif | |
2446 #if CYTHON_USE_MODULE_STATE | |
2447 __pyx_m_traverse, /* m_traverse */ | |
2448 __pyx_m_clear, /* m_clear */ | |
2449 NULL /* m_free */ | |
2450 #else | |
2451 NULL, /* m_traverse */ | |
2452 NULL, /* m_clear */ | |
2453 NULL /* m_free */ | |
2454 #endif | |
2455 }; | |
2456 #ifdef __cplusplus | |
2457 } /* anonymous namespace */ | |
2458 #endif | |
2459 #endif | |
2460 | |
2461 #ifndef CYTHON_NO_PYINIT_EXPORT | |
2462 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC | |
2463 #elif PY_MAJOR_VERSION < 3 | |
2464 #ifdef __cplusplus | |
2465 #define __Pyx_PyMODINIT_FUNC extern "C" void | |
2466 #else | |
2467 #define __Pyx_PyMODINIT_FUNC void | |
2468 #endif | |
2469 #else | |
2470 #ifdef __cplusplus | |
2471 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * | |
2472 #else | |
2473 #define __Pyx_PyMODINIT_FUNC PyObject * | |
2474 #endif | |
2475 #endif | |
2476 | |
2477 | |
2478 #if PY_MAJOR_VERSION < 3 | |
2479 __Pyx_PyMODINIT_FUNC initlibcbcftools(void) CYTHON_SMALL_CODE; /*proto*/ | |
2480 __Pyx_PyMODINIT_FUNC initlibcbcftools(void) | |
2481 #else | |
2482 __Pyx_PyMODINIT_FUNC PyInit_libcbcftools(void) CYTHON_SMALL_CODE; /*proto*/ | |
2483 __Pyx_PyMODINIT_FUNC PyInit_libcbcftools(void) | |
2484 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2485 { | |
2486 return PyModuleDef_Init(&__pyx_moduledef); | |
2487 } | |
2488 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { | |
2489 #if PY_VERSION_HEX >= 0x030700A1 | |
2490 static PY_INT64_T main_interpreter_id = -1; | |
2491 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); | |
2492 if (main_interpreter_id == -1) { | |
2493 main_interpreter_id = current_id; | |
2494 return (unlikely(current_id == -1)) ? -1 : 0; | |
2495 } else if (unlikely(main_interpreter_id != current_id)) | |
2496 #else | |
2497 static PyInterpreterState *main_interpreter = NULL; | |
2498 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; | |
2499 if (!main_interpreter) { | |
2500 main_interpreter = current_interpreter; | |
2501 } else if (unlikely(main_interpreter != current_interpreter)) | |
2502 #endif | |
2503 { | |
2504 PyErr_SetString( | |
2505 PyExc_ImportError, | |
2506 "Interpreter change detected - this module can only be loaded into one interpreter per process."); | |
2507 return -1; | |
2508 } | |
2509 return 0; | |
2510 } | |
2511 #if CYTHON_COMPILING_IN_LIMITED_API | |
2512 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) | |
2513 #else | |
2514 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) | |
2515 #endif | |
2516 { | |
2517 PyObject *value = PyObject_GetAttrString(spec, from_name); | |
2518 int result = 0; | |
2519 if (likely(value)) { | |
2520 if (allow_none || value != Py_None) { | |
2521 #if CYTHON_COMPILING_IN_LIMITED_API | |
2522 result = PyModule_AddObject(module, to_name, value); | |
2523 #else | |
2524 result = PyDict_SetItemString(moddict, to_name, value); | |
2525 #endif | |
2526 } | |
2527 Py_DECREF(value); | |
2528 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { | |
2529 PyErr_Clear(); | |
2530 } else { | |
2531 result = -1; | |
2532 } | |
2533 return result; | |
2534 } | |
2535 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { | |
2536 PyObject *module = NULL, *moddict, *modname; | |
2537 CYTHON_UNUSED_VAR(def); | |
2538 if (__Pyx_check_single_interpreter()) | |
2539 return NULL; | |
2540 if (__pyx_m) | |
2541 return __Pyx_NewRef(__pyx_m); | |
2542 modname = PyObject_GetAttrString(spec, "name"); | |
2543 if (unlikely(!modname)) goto bad; | |
2544 module = PyModule_NewObject(modname); | |
2545 Py_DECREF(modname); | |
2546 if (unlikely(!module)) goto bad; | |
2547 #if CYTHON_COMPILING_IN_LIMITED_API | |
2548 moddict = module; | |
2549 #else | |
2550 moddict = PyModule_GetDict(module); | |
2551 if (unlikely(!moddict)) goto bad; | |
2552 #endif | |
2553 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; | |
2554 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; | |
2555 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; | |
2556 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; | |
2557 return module; | |
2558 bad: | |
2559 Py_XDECREF(module); | |
2560 return NULL; | |
2561 } | |
2562 | |
2563 | |
2564 static CYTHON_SMALL_CODE int __pyx_pymod_exec_libcbcftools(PyObject *__pyx_pyinit_module) | |
2565 #endif | |
2566 #endif | |
2567 { | |
2568 int stringtab_initialized = 0; | |
2569 #if CYTHON_USE_MODULE_STATE | |
2570 int pystate_addmodule_run = 0; | |
2571 #endif | |
2572 PyObject *__pyx_t_1 = NULL; | |
2573 PyObject *__pyx_t_2 = NULL; | |
2574 int __pyx_lineno = 0; | |
2575 const char *__pyx_filename = NULL; | |
2576 int __pyx_clineno = 0; | |
2577 __Pyx_RefNannyDeclarations | |
2578 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2579 if (__pyx_m) { | |
2580 if (__pyx_m == __pyx_pyinit_module) return 0; | |
2581 PyErr_SetString(PyExc_RuntimeError, "Module 'libcbcftools' has already been imported. Re-initialisation is not supported."); | |
2582 return -1; | |
2583 } | |
2584 #elif PY_MAJOR_VERSION >= 3 | |
2585 if (__pyx_m) return __Pyx_NewRef(__pyx_m); | |
2586 #endif | |
2587 /*--- Module creation code ---*/ | |
2588 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2589 __pyx_m = __pyx_pyinit_module; | |
2590 Py_INCREF(__pyx_m); | |
2591 #else | |
2592 #if PY_MAJOR_VERSION < 3 | |
2593 __pyx_m = Py_InitModule4("libcbcftools", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); | |
2594 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2595 #elif CYTHON_USE_MODULE_STATE | |
2596 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2597 { | |
2598 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); | |
2599 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "libcbcftools" pseudovariable */ | |
2600 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) | |
2601 pystate_addmodule_run = 1; | |
2602 } | |
2603 #else | |
2604 __pyx_m = PyModule_Create(&__pyx_moduledef); | |
2605 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2606 #endif | |
2607 #endif | |
2608 CYTHON_UNUSED_VAR(__pyx_t_1); | |
2609 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2610 Py_INCREF(__pyx_d); | |
2611 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2612 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2613 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2614 #if CYTHON_REFNANNY | |
2615 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); | |
2616 if (!__Pyx_RefNanny) { | |
2617 PyErr_Clear(); | |
2618 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); | |
2619 if (!__Pyx_RefNanny) | |
2620 Py_FatalError("failed to import 'refnanny' module"); | |
2621 } | |
2622 #endif | |
2623 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libcbcftools(void)", 0); | |
2624 if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2625 #ifdef __Pxy_PyFrame_Initialize_Offsets | |
2626 __Pxy_PyFrame_Initialize_Offsets(); | |
2627 #endif | |
2628 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2629 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2630 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2631 #ifdef __Pyx_CyFunction_USED | |
2632 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2633 #endif | |
2634 #ifdef __Pyx_FusedFunction_USED | |
2635 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2636 #endif | |
2637 #ifdef __Pyx_Coroutine_USED | |
2638 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2639 #endif | |
2640 #ifdef __Pyx_Generator_USED | |
2641 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2642 #endif | |
2643 #ifdef __Pyx_AsyncGen_USED | |
2644 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2645 #endif | |
2646 #ifdef __Pyx_StopAsyncIteration_USED | |
2647 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2648 #endif | |
2649 /*--- Library function declarations ---*/ | |
2650 /*--- Threads initialization code ---*/ | |
2651 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS | |
2652 PyEval_InitThreads(); | |
2653 #endif | |
2654 /*--- Initialize various global constants etc. ---*/ | |
2655 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2656 stringtab_initialized = 1; | |
2657 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2658 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) | |
2659 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2660 #endif | |
2661 if (__pyx_module_is_main_pysam__libcbcftools) { | |
2662 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2663 } | |
2664 #if PY_MAJOR_VERSION >= 3 | |
2665 { | |
2666 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2667 if (!PyDict_GetItemString(modules, "pysam.libcbcftools")) { | |
2668 if (unlikely((PyDict_SetItemString(modules, "pysam.libcbcftools", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) | |
2669 } | |
2670 } | |
2671 #endif | |
2672 /*--- Builtin init code ---*/ | |
2673 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2674 /*--- Constants init code ---*/ | |
2675 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2676 /*--- Global type/function init code ---*/ | |
2677 (void)__Pyx_modinit_global_init_code(); | |
2678 (void)__Pyx_modinit_variable_export_code(); | |
2679 (void)__Pyx_modinit_function_export_code(); | |
2680 (void)__Pyx_modinit_type_init_code(); | |
2681 (void)__Pyx_modinit_type_import_code(); | |
2682 (void)__Pyx_modinit_variable_import_code(); | |
2683 (void)__Pyx_modinit_function_import_code(); | |
2684 /*--- Execution code ---*/ | |
2685 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) | |
2686 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2687 #endif | |
2688 | |
2689 /* "pysam/libcbcftools.pyx":1 | |
2690 * def py_bcftools(): # <<<<<<<<<<<<<< | |
2691 * pass | |
2692 */ | |
2693 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_12libcbcftools_1py_bcftools, 0, __pyx_n_s_py_bcftools, NULL, __pyx_n_s_pysam_libcbcftools, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2694 __Pyx_GOTREF(__pyx_t_2); | |
2695 if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_bcftools, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2696 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2697 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) | |
2698 __Pyx_GOTREF(__pyx_t_2); | |
2699 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) | |
2700 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | |
2701 | |
2702 /*--- Wrapped vars code ---*/ | |
2703 | |
2704 goto __pyx_L0; | |
2705 __pyx_L1_error:; | |
2706 __Pyx_XDECREF(__pyx_t_2); | |
2707 if (__pyx_m) { | |
2708 if (__pyx_d && stringtab_initialized) { | |
2709 __Pyx_AddTraceback("init pysam.libcbcftools", __pyx_clineno, __pyx_lineno, __pyx_filename); | |
2710 } | |
2711 #if !CYTHON_USE_MODULE_STATE | |
2712 Py_CLEAR(__pyx_m); | |
2713 #else | |
2714 Py_DECREF(__pyx_m); | |
2715 if (pystate_addmodule_run) { | |
2716 PyObject *tp, *value, *tb; | |
2717 PyErr_Fetch(&tp, &value, &tb); | |
2718 PyState_RemoveModule(&__pyx_moduledef); | |
2719 PyErr_Restore(tp, value, tb); | |
2720 } | |
2721 #endif | |
2722 } else if (!PyErr_Occurred()) { | |
2723 PyErr_SetString(PyExc_ImportError, "init pysam.libcbcftools"); | |
2724 } | |
2725 __pyx_L0:; | |
2726 __Pyx_RefNannyFinishContext(); | |
2727 #if CYTHON_PEP489_MULTI_PHASE_INIT | |
2728 return (__pyx_m != NULL) ? 0 : -1; | |
2729 #elif PY_MAJOR_VERSION >= 3 | |
2730 return __pyx_m; | |
2731 #else | |
2732 return; | |
2733 #endif | |
2734 } | |
2735 /* #### Code section: cleanup_globals ### */ | |
2736 /* #### Code section: cleanup_module ### */ | |
2737 /* #### Code section: main_method ### */ | |
2738 /* #### Code section: utility_code_pragmas ### */ | |
2739 #ifdef _MSC_VER | |
2740 #pragma warning( push ) | |
2741 /* Warning 4127: conditional expression is constant | |
2742 * Cython uses constant conditional expressions to allow in inline functions to be optimized at | |
2743 * compile-time, so this warning is not useful | |
2744 */ | |
2745 #pragma warning( disable : 4127 ) | |
2746 #endif | |
2747 | |
2748 | |
2749 | |
2750 /* #### Code section: utility_code_def ### */ | |
2751 | |
2752 /* --- Runtime support code --- */ | |
2753 /* Refnanny */ | |
2754 #if CYTHON_REFNANNY | |
2755 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { | |
2756 PyObject *m = NULL, *p = NULL; | |
2757 void *r = NULL; | |
2758 m = PyImport_ImportModule(modname); | |
2759 if (!m) goto end; | |
2760 p = PyObject_GetAttrString(m, "RefNannyAPI"); | |
2761 if (!p) goto end; | |
2762 r = PyLong_AsVoidPtr(p); | |
2763 end: | |
2764 Py_XDECREF(p); | |
2765 Py_XDECREF(m); | |
2766 return (__Pyx_RefNannyAPIStruct *)r; | |
2767 } | |
2768 #endif | |
2769 | |
2770 /* TupleAndListFromArray */ | |
2771 #if CYTHON_COMPILING_IN_CPYTHON | |
2772 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { | |
2773 PyObject *v; | |
2774 Py_ssize_t i; | |
2775 for (i = 0; i < length; i++) { | |
2776 v = dest[i] = src[i]; | |
2777 Py_INCREF(v); | |
2778 } | |
2779 } | |
2780 static CYTHON_INLINE PyObject * | |
2781 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) | |
2782 { | |
2783 PyObject *res; | |
2784 if (n <= 0) { | |
2785 Py_INCREF(__pyx_empty_tuple); | |
2786 return __pyx_empty_tuple; | |
2787 } | |
2788 res = PyTuple_New(n); | |
2789 if (unlikely(res == NULL)) return NULL; | |
2790 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); | |
2791 return res; | |
2792 } | |
2793 static CYTHON_INLINE PyObject * | |
2794 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) | |
2795 { | |
2796 PyObject *res; | |
2797 if (n <= 0) { | |
2798 return PyList_New(0); | |
2799 } | |
2800 res = PyList_New(n); | |
2801 if (unlikely(res == NULL)) return NULL; | |
2802 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); | |
2803 return res; | |
2804 } | |
2805 #endif | |
2806 | |
2807 /* BytesEquals */ | |
2808 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { | |
2809 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API | |
2810 return PyObject_RichCompareBool(s1, s2, equals); | |
2811 #else | |
2812 if (s1 == s2) { | |
2813 return (equals == Py_EQ); | |
2814 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { | |
2815 const char *ps1, *ps2; | |
2816 Py_ssize_t length = PyBytes_GET_SIZE(s1); | |
2817 if (length != PyBytes_GET_SIZE(s2)) | |
2818 return (equals == Py_NE); | |
2819 ps1 = PyBytes_AS_STRING(s1); | |
2820 ps2 = PyBytes_AS_STRING(s2); | |
2821 if (ps1[0] != ps2[0]) { | |
2822 return (equals == Py_NE); | |
2823 } else if (length == 1) { | |
2824 return (equals == Py_EQ); | |
2825 } else { | |
2826 int result; | |
2827 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) | |
2828 Py_hash_t hash1, hash2; | |
2829 hash1 = ((PyBytesObject*)s1)->ob_shash; | |
2830 hash2 = ((PyBytesObject*)s2)->ob_shash; | |
2831 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { | |
2832 return (equals == Py_NE); | |
2833 } | |
2834 #endif | |
2835 result = memcmp(ps1, ps2, (size_t)length); | |
2836 return (equals == Py_EQ) ? (result == 0) : (result != 0); | |
2837 } | |
2838 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { | |
2839 return (equals == Py_NE); | |
2840 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { | |
2841 return (equals == Py_NE); | |
2842 } else { | |
2843 int result; | |
2844 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); | |
2845 if (!py_result) | |
2846 return -1; | |
2847 result = __Pyx_PyObject_IsTrue(py_result); | |
2848 Py_DECREF(py_result); | |
2849 return result; | |
2850 } | |
2851 #endif | |
2852 } | |
2853 | |
2854 /* UnicodeEquals */ | |
2855 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { | |
2856 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API | |
2857 return PyObject_RichCompareBool(s1, s2, equals); | |
2858 #else | |
2859 #if PY_MAJOR_VERSION < 3 | |
2860 PyObject* owned_ref = NULL; | |
2861 #endif | |
2862 int s1_is_unicode, s2_is_unicode; | |
2863 if (s1 == s2) { | |
2864 goto return_eq; | |
2865 } | |
2866 s1_is_unicode = PyUnicode_CheckExact(s1); | |
2867 s2_is_unicode = PyUnicode_CheckExact(s2); | |
2868 #if PY_MAJOR_VERSION < 3 | |
2869 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { | |
2870 owned_ref = PyUnicode_FromObject(s2); | |
2871 if (unlikely(!owned_ref)) | |
2872 return -1; | |
2873 s2 = owned_ref; | |
2874 s2_is_unicode = 1; | |
2875 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { | |
2876 owned_ref = PyUnicode_FromObject(s1); | |
2877 if (unlikely(!owned_ref)) | |
2878 return -1; | |
2879 s1 = owned_ref; | |
2880 s1_is_unicode = 1; | |
2881 } else if (((!s2_is_unicode) & (!s1_is_unicode))) { | |
2882 return __Pyx_PyBytes_Equals(s1, s2, equals); | |
2883 } | |
2884 #endif | |
2885 if (s1_is_unicode & s2_is_unicode) { | |
2886 Py_ssize_t length; | |
2887 int kind; | |
2888 void *data1, *data2; | |
2889 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) | |
2890 return -1; | |
2891 length = __Pyx_PyUnicode_GET_LENGTH(s1); | |
2892 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { | |
2893 goto return_ne; | |
2894 } | |
2895 #if CYTHON_USE_UNICODE_INTERNALS | |
2896 { | |
2897 Py_hash_t hash1, hash2; | |
2898 #if CYTHON_PEP393_ENABLED | |
2899 hash1 = ((PyASCIIObject*)s1)->hash; | |
2900 hash2 = ((PyASCIIObject*)s2)->hash; | |
2901 #else | |
2902 hash1 = ((PyUnicodeObject*)s1)->hash; | |
2903 hash2 = ((PyUnicodeObject*)s2)->hash; | |
2904 #endif | |
2905 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { | |
2906 goto return_ne; | |
2907 } | |
2908 } | |
2909 #endif | |
2910 kind = __Pyx_PyUnicode_KIND(s1); | |
2911 if (kind != __Pyx_PyUnicode_KIND(s2)) { | |
2912 goto return_ne; | |
2913 } | |
2914 data1 = __Pyx_PyUnicode_DATA(s1); | |
2915 data2 = __Pyx_PyUnicode_DATA(s2); | |
2916 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { | |
2917 goto return_ne; | |
2918 } else if (length == 1) { | |
2919 goto return_eq; | |
2920 } else { | |
2921 int result = memcmp(data1, data2, (size_t)(length * kind)); | |
2922 #if PY_MAJOR_VERSION < 3 | |
2923 Py_XDECREF(owned_ref); | |
2924 #endif | |
2925 return (equals == Py_EQ) ? (result == 0) : (result != 0); | |
2926 } | |
2927 } else if ((s1 == Py_None) & s2_is_unicode) { | |
2928 goto return_ne; | |
2929 } else if ((s2 == Py_None) & s1_is_unicode) { | |
2930 goto return_ne; | |
2931 } else { | |
2932 int result; | |
2933 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); | |
2934 #if PY_MAJOR_VERSION < 3 | |
2935 Py_XDECREF(owned_ref); | |
2936 #endif | |
2937 if (!py_result) | |
2938 return -1; | |
2939 result = __Pyx_PyObject_IsTrue(py_result); | |
2940 Py_DECREF(py_result); | |
2941 return result; | |
2942 } | |
2943 return_eq: | |
2944 #if PY_MAJOR_VERSION < 3 | |
2945 Py_XDECREF(owned_ref); | |
2946 #endif | |
2947 return (equals == Py_EQ); | |
2948 return_ne: | |
2949 #if PY_MAJOR_VERSION < 3 | |
2950 Py_XDECREF(owned_ref); | |
2951 #endif | |
2952 return (equals == Py_NE); | |
2953 #endif | |
2954 } | |
2955 | |
2956 /* fastcall */ | |
2957 #if CYTHON_METH_FASTCALL | |
2958 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) | |
2959 { | |
2960 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); | |
2961 for (i = 0; i < n; i++) | |
2962 { | |
2963 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; | |
2964 } | |
2965 for (i = 0; i < n; i++) | |
2966 { | |
2967 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); | |
2968 if (unlikely(eq != 0)) { | |
2969 if (unlikely(eq < 0)) return NULL; | |
2970 return kwvalues[i]; | |
2971 } | |
2972 } | |
2973 return NULL; | |
2974 } | |
2975 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 | |
2976 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { | |
2977 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); | |
2978 PyObject *dict; | |
2979 dict = PyDict_New(); | |
2980 if (unlikely(!dict)) | |
2981 return NULL; | |
2982 for (i=0; i<nkwargs; i++) { | |
2983 PyObject *key = PyTuple_GET_ITEM(kwnames, i); | |
2984 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0)) | |
2985 goto bad; | |
2986 } | |
2987 return dict; | |
2988 bad: | |
2989 Py_DECREF(dict); | |
2990 return NULL; | |
2991 } | |
2992 #endif | |
2993 #endif | |
2994 | |
2995 /* FixUpExtensionType */ | |
2996 #if CYTHON_USE_TYPE_SPECS | |
2997 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { | |
2998 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API | |
2999 CYTHON_UNUSED_VAR(spec); | |
3000 CYTHON_UNUSED_VAR(type); | |
3001 #else | |
3002 const PyType_Slot *slot = spec->slots; | |
3003 while (slot && slot->slot && slot->slot != Py_tp_members) | |
3004 slot++; | |
3005 if (slot && slot->slot == Py_tp_members) { | |
3006 int changed = 0; | |
3007 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) | |
3008 const | |
3009 #endif | |
3010 PyMemberDef *memb = (PyMemberDef*) slot->pfunc; | |
3011 while (memb && memb->name) { | |
3012 if (memb->name[0] == '_' && memb->name[1] == '_') { | |
3013 #if PY_VERSION_HEX < 0x030900b1 | |
3014 if (strcmp(memb->name, "__weaklistoffset__") == 0) { | |
3015 assert(memb->type == T_PYSSIZET); | |
3016 assert(memb->flags == READONLY); | |
3017 type->tp_weaklistoffset = memb->offset; | |
3018 changed = 1; | |
3019 } | |
3020 else if (strcmp(memb->name, "__dictoffset__") == 0) { | |
3021 assert(memb->type == T_PYSSIZET); | |
3022 assert(memb->flags == READONLY); | |
3023 type->tp_dictoffset = memb->offset; | |
3024 changed = 1; | |
3025 } | |
3026 #if CYTHON_METH_FASTCALL | |
3027 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { | |
3028 assert(memb->type == T_PYSSIZET); | |
3029 assert(memb->flags == READONLY); | |
3030 #if PY_VERSION_HEX >= 0x030800b4 | |
3031 type->tp_vectorcall_offset = memb->offset; | |
3032 #else | |
3033 type->tp_print = (printfunc) memb->offset; | |
3034 #endif | |
3035 changed = 1; | |
3036 } | |
3037 #endif | |
3038 #else | |
3039 if ((0)); | |
3040 #endif | |
3041 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON | |
3042 else if (strcmp(memb->name, "__module__") == 0) { | |
3043 PyObject *descr; | |
3044 assert(memb->type == T_OBJECT); | |
3045 assert(memb->flags == 0 || memb->flags == READONLY); | |
3046 descr = PyDescr_NewMember(type, memb); | |
3047 if (unlikely(!descr)) | |
3048 return -1; | |
3049 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { | |
3050 Py_DECREF(descr); | |
3051 return -1; | |
3052 } | |
3053 Py_DECREF(descr); | |
3054 changed = 1; | |
3055 } | |
3056 #endif | |
3057 } | |
3058 memb++; | |
3059 } | |
3060 if (changed) | |
3061 PyType_Modified(type); | |
3062 } | |
3063 #endif | |
3064 return 0; | |
3065 } | |
3066 #endif | |
3067 | |
3068 /* FetchSharedCythonModule */ | |
3069 static PyObject *__Pyx_FetchSharedCythonABIModule(void) { | |
3070 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); | |
3071 } | |
3072 | |
3073 /* FetchCommonType */ | |
3074 static int __Pyx_VerifyCachedType(PyObject *cached_type, | |
3075 const char *name, | |
3076 Py_ssize_t basicsize, | |
3077 Py_ssize_t expected_basicsize) { | |
3078 if (!PyType_Check(cached_type)) { | |
3079 PyErr_Format(PyExc_TypeError, | |
3080 "Shared Cython type %.200s is not a type object", name); | |
3081 return -1; | |
3082 } | |
3083 if (basicsize != expected_basicsize) { | |
3084 PyErr_Format(PyExc_TypeError, | |
3085 "Shared Cython type %.200s has the wrong size, try recompiling", | |
3086 name); | |
3087 return -1; | |
3088 } | |
3089 return 0; | |
3090 } | |
3091 #if !CYTHON_USE_TYPE_SPECS | |
3092 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { | |
3093 PyObject* abi_module; | |
3094 const char* object_name; | |
3095 PyTypeObject *cached_type = NULL; | |
3096 abi_module = __Pyx_FetchSharedCythonABIModule(); | |
3097 if (!abi_module) return NULL; | |
3098 object_name = strrchr(type->tp_name, '.'); | |
3099 object_name = object_name ? object_name+1 : type->tp_name; | |
3100 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); | |
3101 if (cached_type) { | |
3102 if (__Pyx_VerifyCachedType( | |
3103 (PyObject *)cached_type, | |
3104 object_name, | |
3105 cached_type->tp_basicsize, | |
3106 type->tp_basicsize) < 0) { | |
3107 goto bad; | |
3108 } | |
3109 goto done; | |
3110 } | |
3111 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; | |
3112 PyErr_Clear(); | |
3113 if (PyType_Ready(type) < 0) goto bad; | |
3114 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) | |
3115 goto bad; | |
3116 Py_INCREF(type); | |
3117 cached_type = type; | |
3118 done: | |
3119 Py_DECREF(abi_module); | |
3120 return cached_type; | |
3121 bad: | |
3122 Py_XDECREF(cached_type); | |
3123 cached_type = NULL; | |
3124 goto done; | |
3125 } | |
3126 #else | |
3127 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { | |
3128 PyObject *abi_module, *cached_type = NULL; | |
3129 const char* object_name = strrchr(spec->name, '.'); | |
3130 object_name = object_name ? object_name+1 : spec->name; | |
3131 abi_module = __Pyx_FetchSharedCythonABIModule(); | |
3132 if (!abi_module) return NULL; | |
3133 cached_type = PyObject_GetAttrString(abi_module, object_name); | |
3134 if (cached_type) { | |
3135 Py_ssize_t basicsize; | |
3136 #if CYTHON_COMPILING_IN_LIMITED_API | |
3137 PyObject *py_basicsize; | |
3138 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); | |
3139 if (unlikely(!py_basicsize)) goto bad; | |
3140 basicsize = PyLong_AsSsize_t(py_basicsize); | |
3141 Py_DECREF(py_basicsize); | |
3142 py_basicsize = 0; | |
3143 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; | |
3144 #else | |
3145 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; | |
3146 #endif | |
3147 if (__Pyx_VerifyCachedType( | |
3148 cached_type, | |
3149 object_name, | |
3150 basicsize, | |
3151 spec->basicsize) < 0) { | |
3152 goto bad; | |
3153 } | |
3154 goto done; | |
3155 } | |
3156 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; | |
3157 PyErr_Clear(); | |
3158 CYTHON_UNUSED_VAR(module); | |
3159 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); | |
3160 if (unlikely(!cached_type)) goto bad; | |
3161 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; | |
3162 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; | |
3163 done: | |
3164 Py_DECREF(abi_module); | |
3165 assert(cached_type == NULL || PyType_Check(cached_type)); | |
3166 return (PyTypeObject *) cached_type; | |
3167 bad: | |
3168 Py_XDECREF(cached_type); | |
3169 cached_type = NULL; | |
3170 goto done; | |
3171 } | |
3172 #endif | |
3173 | |
3174 /* PyObjectGetAttrStr */ | |
3175 #if CYTHON_USE_TYPE_SLOTS | |
3176 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { | |
3177 PyTypeObject* tp = Py_TYPE(obj); | |
3178 if (likely(tp->tp_getattro)) | |
3179 return tp->tp_getattro(obj, attr_name); | |
3180 #if PY_MAJOR_VERSION < 3 | |
3181 if (likely(tp->tp_getattr)) | |
3182 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); | |
3183 #endif | |
3184 return PyObject_GetAttr(obj, attr_name); | |
3185 } | |
3186 #endif | |
3187 | |
3188 /* PyVectorcallFastCallDict */ | |
3189 #if CYTHON_METH_FASTCALL | |
3190 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) | |
3191 { | |
3192 PyObject *res = NULL; | |
3193 PyObject *kwnames; | |
3194 PyObject **newargs; | |
3195 PyObject **kwvalues; | |
3196 Py_ssize_t i, pos; | |
3197 size_t j; | |
3198 PyObject *key, *value; | |
3199 unsigned long keys_are_strings; | |
3200 Py_ssize_t nkw = PyDict_GET_SIZE(kw); | |
3201 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); | |
3202 if (unlikely(newargs == NULL)) { | |
3203 PyErr_NoMemory(); | |
3204 return NULL; | |
3205 } | |
3206 for (j = 0; j < nargs; j++) newargs[j] = args[j]; | |
3207 kwnames = PyTuple_New(nkw); | |
3208 if (unlikely(kwnames == NULL)) { | |
3209 PyMem_Free(newargs); | |
3210 return NULL; | |
3211 } | |
3212 kwvalues = newargs + nargs; | |
3213 pos = i = 0; | |
3214 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; | |
3215 while (PyDict_Next(kw, &pos, &key, &value)) { | |
3216 keys_are_strings &= Py_TYPE(key)->tp_flags; | |
3217 Py_INCREF(key); | |
3218 Py_INCREF(value); | |
3219 PyTuple_SET_ITEM(kwnames, i, key); | |
3220 kwvalues[i] = value; | |
3221 i++; | |
3222 } | |
3223 if (unlikely(!keys_are_strings)) { | |
3224 PyErr_SetString(PyExc_TypeError, "keywords must be strings"); | |
3225 goto cleanup; | |
3226 } | |
3227 res = vc(func, newargs, nargs, kwnames); | |
3228 cleanup: | |
3229 Py_DECREF(kwnames); | |
3230 for (i = 0; i < nkw; i++) | |
3231 Py_DECREF(kwvalues[i]); | |
3232 PyMem_Free(newargs); | |
3233 return res; | |
3234 } | |
3235 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) | |
3236 { | |
3237 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { | |
3238 return vc(func, args, nargs, NULL); | |
3239 } | |
3240 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); | |
3241 } | |
3242 #endif | |
3243 | |
3244 /* CythonFunctionShared */ | |
3245 #if CYTHON_COMPILING_IN_LIMITED_API | |
3246 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { | |
3247 if (__Pyx_CyFunction_Check(func)) { | |
3248 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; | |
3249 } else if (PyCFunction_Check(func)) { | |
3250 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; | |
3251 } | |
3252 return 0; | |
3253 } | |
3254 #else | |
3255 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { | |
3256 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; | |
3257 } | |
3258 #endif | |
3259 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { | |
3260 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API | |
3261 __Pyx_Py_XDECREF_SET( | |
3262 __Pyx_CyFunction_GetClassObj(f), | |
3263 ((classobj) ? __Pyx_NewRef(classobj) : NULL)); | |
3264 #else | |
3265 __Pyx_Py_XDECREF_SET( | |
3266 ((PyCMethodObject *) (f))->mm_class, | |
3267 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); | |
3268 #endif | |
3269 } | |
3270 static PyObject * | |
3271 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) | |
3272 { | |
3273 CYTHON_UNUSED_VAR(closure); | |
3274 if (unlikely(op->func_doc == NULL)) { | |
3275 #if CYTHON_COMPILING_IN_LIMITED_API | |
3276 op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); | |
3277 if (unlikely(!op->func_doc)) return NULL; | |
3278 #else | |
3279 if (((PyCFunctionObject*)op)->m_ml->ml_doc) { | |
3280 #if PY_MAJOR_VERSION >= 3 | |
3281 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); | |
3282 #else | |
3283 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); | |
3284 #endif | |
3285 if (unlikely(op->func_doc == NULL)) | |
3286 return NULL; | |
3287 } else { | |
3288 Py_INCREF(Py_None); | |
3289 return Py_None; | |
3290 } | |
3291 #endif | |
3292 } | |
3293 Py_INCREF(op->func_doc); | |
3294 return op->func_doc; | |
3295 } | |
3296 static int | |
3297 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) | |
3298 { | |
3299 CYTHON_UNUSED_VAR(context); | |
3300 if (value == NULL) { | |
3301 value = Py_None; | |
3302 } | |
3303 Py_INCREF(value); | |
3304 __Pyx_Py_XDECREF_SET(op->func_doc, value); | |
3305 return 0; | |
3306 } | |
3307 static PyObject * | |
3308 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) | |
3309 { | |
3310 CYTHON_UNUSED_VAR(context); | |
3311 if (unlikely(op->func_name == NULL)) { | |
3312 #if CYTHON_COMPILING_IN_LIMITED_API | |
3313 op->func_name = PyObject_GetAttrString(op->func, "__name__"); | |
3314 #elif PY_MAJOR_VERSION >= 3 | |
3315 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); | |
3316 #else | |
3317 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); | |
3318 #endif | |
3319 if (unlikely(op->func_name == NULL)) | |
3320 return NULL; | |
3321 } | |
3322 Py_INCREF(op->func_name); | |
3323 return op->func_name; | |
3324 } | |
3325 static int | |
3326 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) | |
3327 { | |
3328 CYTHON_UNUSED_VAR(context); | |
3329 #if PY_MAJOR_VERSION >= 3 | |
3330 if (unlikely(value == NULL || !PyUnicode_Check(value))) | |
3331 #else | |
3332 if (unlikely(value == NULL || !PyString_Check(value))) | |
3333 #endif | |
3334 { | |
3335 PyErr_SetString(PyExc_TypeError, | |
3336 "__name__ must be set to a string object"); | |
3337 return -1; | |
3338 } | |
3339 Py_INCREF(value); | |
3340 __Pyx_Py_XDECREF_SET(op->func_name, value); | |
3341 return 0; | |
3342 } | |
3343 static PyObject * | |
3344 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) | |
3345 { | |
3346 CYTHON_UNUSED_VAR(context); | |
3347 Py_INCREF(op->func_qualname); | |
3348 return op->func_qualname; | |
3349 } | |
3350 static int | |
3351 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) | |
3352 { | |
3353 CYTHON_UNUSED_VAR(context); | |
3354 #if PY_MAJOR_VERSION >= 3 | |
3355 if (unlikely(value == NULL || !PyUnicode_Check(value))) | |
3356 #else | |
3357 if (unlikely(value == NULL || !PyString_Check(value))) | |
3358 #endif | |
3359 { | |
3360 PyErr_SetString(PyExc_TypeError, | |
3361 "__qualname__ must be set to a string object"); | |
3362 return -1; | |
3363 } | |
3364 Py_INCREF(value); | |
3365 __Pyx_Py_XDECREF_SET(op->func_qualname, value); | |
3366 return 0; | |
3367 } | |
3368 static PyObject * | |
3369 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) | |
3370 { | |
3371 CYTHON_UNUSED_VAR(context); | |
3372 if (unlikely(op->func_dict == NULL)) { | |
3373 op->func_dict = PyDict_New(); | |
3374 if (unlikely(op->func_dict == NULL)) | |
3375 return NULL; | |
3376 } | |
3377 Py_INCREF(op->func_dict); | |
3378 return op->func_dict; | |
3379 } | |
3380 static int | |
3381 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) | |
3382 { | |
3383 CYTHON_UNUSED_VAR(context); | |
3384 if (unlikely(value == NULL)) { | |
3385 PyErr_SetString(PyExc_TypeError, | |
3386 "function's dictionary may not be deleted"); | |
3387 return -1; | |
3388 } | |
3389 if (unlikely(!PyDict_Check(value))) { | |
3390 PyErr_SetString(PyExc_TypeError, | |
3391 "setting function's dictionary to a non-dict"); | |
3392 return -1; | |
3393 } | |
3394 Py_INCREF(value); | |
3395 __Pyx_Py_XDECREF_SET(op->func_dict, value); | |
3396 return 0; | |
3397 } | |
3398 static PyObject * | |
3399 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) | |
3400 { | |
3401 CYTHON_UNUSED_VAR(context); | |
3402 Py_INCREF(op->func_globals); | |
3403 return op->func_globals; | |
3404 } | |
3405 static PyObject * | |
3406 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) | |
3407 { | |
3408 CYTHON_UNUSED_VAR(op); | |
3409 CYTHON_UNUSED_VAR(context); | |
3410 Py_INCREF(Py_None); | |
3411 return Py_None; | |
3412 } | |
3413 static PyObject * | |
3414 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) | |
3415 { | |
3416 PyObject* result = (op->func_code) ? op->func_code : Py_None; | |
3417 CYTHON_UNUSED_VAR(context); | |
3418 Py_INCREF(result); | |
3419 return result; | |
3420 } | |
3421 static int | |
3422 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { | |
3423 int result = 0; | |
3424 PyObject *res = op->defaults_getter((PyObject *) op); | |
3425 if (unlikely(!res)) | |
3426 return -1; | |
3427 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3428 op->defaults_tuple = PyTuple_GET_ITEM(res, 0); | |
3429 Py_INCREF(op->defaults_tuple); | |
3430 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); | |
3431 Py_INCREF(op->defaults_kwdict); | |
3432 #else | |
3433 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); | |
3434 if (unlikely(!op->defaults_tuple)) result = -1; | |
3435 else { | |
3436 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); | |
3437 if (unlikely(!op->defaults_kwdict)) result = -1; | |
3438 } | |
3439 #endif | |
3440 Py_DECREF(res); | |
3441 return result; | |
3442 } | |
3443 static int | |
3444 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { | |
3445 CYTHON_UNUSED_VAR(context); | |
3446 if (!value) { | |
3447 value = Py_None; | |
3448 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { | |
3449 PyErr_SetString(PyExc_TypeError, | |
3450 "__defaults__ must be set to a tuple object"); | |
3451 return -1; | |
3452 } | |
3453 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " | |
3454 "currently affect the values used in function calls", 1); | |
3455 Py_INCREF(value); | |
3456 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); | |
3457 return 0; | |
3458 } | |
3459 static PyObject * | |
3460 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { | |
3461 PyObject* result = op->defaults_tuple; | |
3462 CYTHON_UNUSED_VAR(context); | |
3463 if (unlikely(!result)) { | |
3464 if (op->defaults_getter) { | |
3465 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; | |
3466 result = op->defaults_tuple; | |
3467 } else { | |
3468 result = Py_None; | |
3469 } | |
3470 } | |
3471 Py_INCREF(result); | |
3472 return result; | |
3473 } | |
3474 static int | |
3475 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { | |
3476 CYTHON_UNUSED_VAR(context); | |
3477 if (!value) { | |
3478 value = Py_None; | |
3479 } else if (unlikely(value != Py_None && !PyDict_Check(value))) { | |
3480 PyErr_SetString(PyExc_TypeError, | |
3481 "__kwdefaults__ must be set to a dict object"); | |
3482 return -1; | |
3483 } | |
3484 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " | |
3485 "currently affect the values used in function calls", 1); | |
3486 Py_INCREF(value); | |
3487 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); | |
3488 return 0; | |
3489 } | |
3490 static PyObject * | |
3491 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { | |
3492 PyObject* result = op->defaults_kwdict; | |
3493 CYTHON_UNUSED_VAR(context); | |
3494 if (unlikely(!result)) { | |
3495 if (op->defaults_getter) { | |
3496 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; | |
3497 result = op->defaults_kwdict; | |
3498 } else { | |
3499 result = Py_None; | |
3500 } | |
3501 } | |
3502 Py_INCREF(result); | |
3503 return result; | |
3504 } | |
3505 static int | |
3506 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { | |
3507 CYTHON_UNUSED_VAR(context); | |
3508 if (!value || value == Py_None) { | |
3509 value = NULL; | |
3510 } else if (unlikely(!PyDict_Check(value))) { | |
3511 PyErr_SetString(PyExc_TypeError, | |
3512 "__annotations__ must be set to a dict object"); | |
3513 return -1; | |
3514 } | |
3515 Py_XINCREF(value); | |
3516 __Pyx_Py_XDECREF_SET(op->func_annotations, value); | |
3517 return 0; | |
3518 } | |
3519 static PyObject * | |
3520 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { | |
3521 PyObject* result = op->func_annotations; | |
3522 CYTHON_UNUSED_VAR(context); | |
3523 if (unlikely(!result)) { | |
3524 result = PyDict_New(); | |
3525 if (unlikely(!result)) return NULL; | |
3526 op->func_annotations = result; | |
3527 } | |
3528 Py_INCREF(result); | |
3529 return result; | |
3530 } | |
3531 static PyObject * | |
3532 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { | |
3533 int is_coroutine; | |
3534 CYTHON_UNUSED_VAR(context); | |
3535 if (op->func_is_coroutine) { | |
3536 return __Pyx_NewRef(op->func_is_coroutine); | |
3537 } | |
3538 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; | |
3539 #if PY_VERSION_HEX >= 0x03050000 | |
3540 if (is_coroutine) { | |
3541 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; | |
3542 fromlist = PyList_New(1); | |
3543 if (unlikely(!fromlist)) return NULL; | |
3544 Py_INCREF(marker); | |
3545 #if CYTHON_ASSUME_SAFE_MACROS | |
3546 PyList_SET_ITEM(fromlist, 0, marker); | |
3547 #else | |
3548 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { | |
3549 Py_DECREF(marker); | |
3550 Py_DECREF(fromlist); | |
3551 return NULL; | |
3552 } | |
3553 #endif | |
3554 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); | |
3555 Py_DECREF(fromlist); | |
3556 if (unlikely(!module)) goto ignore; | |
3557 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); | |
3558 Py_DECREF(module); | |
3559 if (likely(op->func_is_coroutine)) { | |
3560 return __Pyx_NewRef(op->func_is_coroutine); | |
3561 } | |
3562 ignore: | |
3563 PyErr_Clear(); | |
3564 } | |
3565 #endif | |
3566 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); | |
3567 return __Pyx_NewRef(op->func_is_coroutine); | |
3568 } | |
3569 #if CYTHON_COMPILING_IN_LIMITED_API | |
3570 static PyObject * | |
3571 __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { | |
3572 CYTHON_UNUSED_VAR(context); | |
3573 return PyObject_GetAttrString(op->func, "__module__"); | |
3574 } | |
3575 static int | |
3576 __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { | |
3577 CYTHON_UNUSED_VAR(context); | |
3578 return PyObject_SetAttrString(op->func, "__module__", value); | |
3579 } | |
3580 #endif | |
3581 static PyGetSetDef __pyx_CyFunction_getsets[] = { | |
3582 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, | |
3583 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, | |
3584 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, | |
3585 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, | |
3586 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, | |
3587 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, | |
3588 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, | |
3589 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, | |
3590 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, | |
3591 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, | |
3592 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, | |
3593 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, | |
3594 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, | |
3595 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, | |
3596 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, | |
3597 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, | |
3598 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, | |
3599 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, | |
3600 #if CYTHON_COMPILING_IN_LIMITED_API | |
3601 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, | |
3602 #endif | |
3603 {0, 0, 0, 0, 0} | |
3604 }; | |
3605 static PyMemberDef __pyx_CyFunction_members[] = { | |
3606 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3607 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, | |
3608 #endif | |
3609 #if CYTHON_USE_TYPE_SPECS | |
3610 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, | |
3611 #if CYTHON_METH_FASTCALL | |
3612 #if CYTHON_BACKPORT_VECTORCALL | |
3613 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, | |
3614 #else | |
3615 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3616 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, | |
3617 #endif | |
3618 #endif | |
3619 #endif | |
3620 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API | |
3621 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, | |
3622 #else | |
3623 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, | |
3624 #endif | |
3625 #endif | |
3626 {0, 0, 0, 0, 0} | |
3627 }; | |
3628 static PyObject * | |
3629 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) | |
3630 { | |
3631 CYTHON_UNUSED_VAR(args); | |
3632 #if PY_MAJOR_VERSION >= 3 | |
3633 Py_INCREF(m->func_qualname); | |
3634 return m->func_qualname; | |
3635 #else | |
3636 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); | |
3637 #endif | |
3638 } | |
3639 static PyMethodDef __pyx_CyFunction_methods[] = { | |
3640 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, | |
3641 {0, 0, 0, 0} | |
3642 }; | |
3643 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API | |
3644 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) | |
3645 #else | |
3646 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) | |
3647 #endif | |
3648 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, | |
3649 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { | |
3650 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3651 PyCFunctionObject *cf = (PyCFunctionObject*) op; | |
3652 #endif | |
3653 if (unlikely(op == NULL)) | |
3654 return NULL; | |
3655 #if CYTHON_COMPILING_IN_LIMITED_API | |
3656 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); | |
3657 if (unlikely(!op->func)) return NULL; | |
3658 #endif | |
3659 op->flags = flags; | |
3660 __Pyx_CyFunction_weakreflist(op) = NULL; | |
3661 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3662 cf->m_ml = ml; | |
3663 cf->m_self = (PyObject *) op; | |
3664 #endif | |
3665 Py_XINCREF(closure); | |
3666 op->func_closure = closure; | |
3667 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3668 Py_XINCREF(module); | |
3669 cf->m_module = module; | |
3670 #endif | |
3671 op->func_dict = NULL; | |
3672 op->func_name = NULL; | |
3673 Py_INCREF(qualname); | |
3674 op->func_qualname = qualname; | |
3675 op->func_doc = NULL; | |
3676 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API | |
3677 op->func_classobj = NULL; | |
3678 #else | |
3679 ((PyCMethodObject*)op)->mm_class = NULL; | |
3680 #endif | |
3681 op->func_globals = globals; | |
3682 Py_INCREF(op->func_globals); | |
3683 Py_XINCREF(code); | |
3684 op->func_code = code; | |
3685 op->defaults_pyobjects = 0; | |
3686 op->defaults_size = 0; | |
3687 op->defaults = NULL; | |
3688 op->defaults_tuple = NULL; | |
3689 op->defaults_kwdict = NULL; | |
3690 op->defaults_getter = NULL; | |
3691 op->func_annotations = NULL; | |
3692 op->func_is_coroutine = NULL; | |
3693 #if CYTHON_METH_FASTCALL | |
3694 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { | |
3695 case METH_NOARGS: | |
3696 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; | |
3697 break; | |
3698 case METH_O: | |
3699 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; | |
3700 break; | |
3701 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: | |
3702 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; | |
3703 break; | |
3704 case METH_FASTCALL | METH_KEYWORDS: | |
3705 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; | |
3706 break; | |
3707 case METH_VARARGS | METH_KEYWORDS: | |
3708 __Pyx_CyFunction_func_vectorcall(op) = NULL; | |
3709 break; | |
3710 default: | |
3711 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); | |
3712 Py_DECREF(op); | |
3713 return NULL; | |
3714 } | |
3715 #endif | |
3716 return (PyObject *) op; | |
3717 } | |
3718 static int | |
3719 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) | |
3720 { | |
3721 Py_CLEAR(m->func_closure); | |
3722 #if CYTHON_COMPILING_IN_LIMITED_API | |
3723 Py_CLEAR(m->func); | |
3724 #else | |
3725 Py_CLEAR(((PyCFunctionObject*)m)->m_module); | |
3726 #endif | |
3727 Py_CLEAR(m->func_dict); | |
3728 Py_CLEAR(m->func_name); | |
3729 Py_CLEAR(m->func_qualname); | |
3730 Py_CLEAR(m->func_doc); | |
3731 Py_CLEAR(m->func_globals); | |
3732 Py_CLEAR(m->func_code); | |
3733 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3734 #if PY_VERSION_HEX < 0x030900B1 | |
3735 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); | |
3736 #else | |
3737 { | |
3738 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; | |
3739 ((PyCMethodObject *) (m))->mm_class = NULL; | |
3740 Py_XDECREF(cls); | |
3741 } | |
3742 #endif | |
3743 #endif | |
3744 Py_CLEAR(m->defaults_tuple); | |
3745 Py_CLEAR(m->defaults_kwdict); | |
3746 Py_CLEAR(m->func_annotations); | |
3747 Py_CLEAR(m->func_is_coroutine); | |
3748 if (m->defaults) { | |
3749 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); | |
3750 int i; | |
3751 for (i = 0; i < m->defaults_pyobjects; i++) | |
3752 Py_XDECREF(pydefaults[i]); | |
3753 PyObject_Free(m->defaults); | |
3754 m->defaults = NULL; | |
3755 } | |
3756 return 0; | |
3757 } | |
3758 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) | |
3759 { | |
3760 if (__Pyx_CyFunction_weakreflist(m) != NULL) | |
3761 PyObject_ClearWeakRefs((PyObject *) m); | |
3762 __Pyx_CyFunction_clear(m); | |
3763 __Pyx_PyHeapTypeObject_GC_Del(m); | |
3764 } | |
3765 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) | |
3766 { | |
3767 PyObject_GC_UnTrack(m); | |
3768 __Pyx__CyFunction_dealloc(m); | |
3769 } | |
3770 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) | |
3771 { | |
3772 Py_VISIT(m->func_closure); | |
3773 #if CYTHON_COMPILING_IN_LIMITED_API | |
3774 Py_VISIT(m->func); | |
3775 #else | |
3776 Py_VISIT(((PyCFunctionObject*)m)->m_module); | |
3777 #endif | |
3778 Py_VISIT(m->func_dict); | |
3779 Py_VISIT(m->func_name); | |
3780 Py_VISIT(m->func_qualname); | |
3781 Py_VISIT(m->func_doc); | |
3782 Py_VISIT(m->func_globals); | |
3783 Py_VISIT(m->func_code); | |
3784 #if !CYTHON_COMPILING_IN_LIMITED_API | |
3785 Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); | |
3786 #endif | |
3787 Py_VISIT(m->defaults_tuple); | |
3788 Py_VISIT(m->defaults_kwdict); | |
3789 Py_VISIT(m->func_is_coroutine); | |
3790 if (m->defaults) { | |
3791 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); | |
3792 int i; | |
3793 for (i = 0; i < m->defaults_pyobjects; i++) | |
3794 Py_VISIT(pydefaults[i]); | |
3795 } | |
3796 return 0; | |
3797 } | |
3798 static PyObject* | |
3799 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) | |
3800 { | |
3801 #if PY_MAJOR_VERSION >= 3 | |
3802 return PyUnicode_FromFormat("<cyfunction %U at %p>", | |
3803 op->func_qualname, (void *)op); | |
3804 #else | |
3805 return PyString_FromFormat("<cyfunction %s at %p>", | |
3806 PyString_AsString(op->func_qualname), (void *)op); | |
3807 #endif | |
3808 } | |
3809 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { | |
3810 #if CYTHON_COMPILING_IN_LIMITED_API | |
3811 PyObject *f = ((__pyx_CyFunctionObject*)func)->func; | |
3812 PyObject *py_name = NULL; | |
3813 PyCFunction meth; | |
3814 int flags; | |
3815 meth = PyCFunction_GetFunction(f); | |
3816 if (unlikely(!meth)) return NULL; | |
3817 flags = PyCFunction_GetFlags(f); | |
3818 if (unlikely(flags < 0)) return NULL; | |
3819 #else | |
3820 PyCFunctionObject* f = (PyCFunctionObject*)func; | |
3821 PyCFunction meth = f->m_ml->ml_meth; | |
3822 int flags = f->m_ml->ml_flags; | |
3823 #endif | |
3824 Py_ssize_t size; | |
3825 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { | |
3826 case METH_VARARGS: | |
3827 if (likely(kw == NULL || PyDict_Size(kw) == 0)) | |
3828 return (*meth)(self, arg); | |
3829 break; | |
3830 case METH_VARARGS | METH_KEYWORDS: | |
3831 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); | |
3832 case METH_NOARGS: | |
3833 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { | |
3834 #if CYTHON_ASSUME_SAFE_MACROS | |
3835 size = PyTuple_GET_SIZE(arg); | |
3836 #else | |
3837 size = PyTuple_Size(arg); | |
3838 if (unlikely(size < 0)) return NULL; | |
3839 #endif | |
3840 if (likely(size == 0)) | |
3841 return (*meth)(self, NULL); | |
3842 #if CYTHON_COMPILING_IN_LIMITED_API | |
3843 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); | |
3844 if (!py_name) return NULL; | |
3845 PyErr_Format(PyExc_TypeError, | |
3846 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
3847 py_name, size); | |
3848 Py_DECREF(py_name); | |
3849 #else | |
3850 PyErr_Format(PyExc_TypeError, | |
3851 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
3852 f->m_ml->ml_name, size); | |
3853 #endif | |
3854 return NULL; | |
3855 } | |
3856 break; | |
3857 case METH_O: | |
3858 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { | |
3859 #if CYTHON_ASSUME_SAFE_MACROS | |
3860 size = PyTuple_GET_SIZE(arg); | |
3861 #else | |
3862 size = PyTuple_Size(arg); | |
3863 if (unlikely(size < 0)) return NULL; | |
3864 #endif | |
3865 if (likely(size == 1)) { | |
3866 PyObject *result, *arg0; | |
3867 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS | |
3868 arg0 = PyTuple_GET_ITEM(arg, 0); | |
3869 #else | |
3870 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; | |
3871 #endif | |
3872 result = (*meth)(self, arg0); | |
3873 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) | |
3874 Py_DECREF(arg0); | |
3875 #endif | |
3876 return result; | |
3877 } | |
3878 #if CYTHON_COMPILING_IN_LIMITED_API | |
3879 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); | |
3880 if (!py_name) return NULL; | |
3881 PyErr_Format(PyExc_TypeError, | |
3882 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
3883 py_name, size); | |
3884 Py_DECREF(py_name); | |
3885 #else | |
3886 PyErr_Format(PyExc_TypeError, | |
3887 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
3888 f->m_ml->ml_name, size); | |
3889 #endif | |
3890 return NULL; | |
3891 } | |
3892 break; | |
3893 default: | |
3894 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); | |
3895 return NULL; | |
3896 } | |
3897 #if CYTHON_COMPILING_IN_LIMITED_API | |
3898 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); | |
3899 if (!py_name) return NULL; | |
3900 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", | |
3901 py_name); | |
3902 Py_DECREF(py_name); | |
3903 #else | |
3904 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", | |
3905 f->m_ml->ml_name); | |
3906 #endif | |
3907 return NULL; | |
3908 } | |
3909 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { | |
3910 PyObject *self, *result; | |
3911 #if CYTHON_COMPILING_IN_LIMITED_API | |
3912 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); | |
3913 if (unlikely(!self) && PyErr_Occurred()) return NULL; | |
3914 #else | |
3915 self = ((PyCFunctionObject*)func)->m_self; | |
3916 #endif | |
3917 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); | |
3918 return result; | |
3919 } | |
3920 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { | |
3921 PyObject *result; | |
3922 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; | |
3923 #if CYTHON_METH_FASTCALL | |
3924 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); | |
3925 if (vc) { | |
3926 #if CYTHON_ASSUME_SAFE_MACROS | |
3927 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); | |
3928 #else | |
3929 (void) &__Pyx_PyVectorcall_FastCallDict; | |
3930 return PyVectorcall_Call(func, args, kw); | |
3931 #endif | |
3932 } | |
3933 #endif | |
3934 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { | |
3935 Py_ssize_t argc; | |
3936 PyObject *new_args; | |
3937 PyObject *self; | |
3938 #if CYTHON_ASSUME_SAFE_MACROS | |
3939 argc = PyTuple_GET_SIZE(args); | |
3940 #else | |
3941 argc = PyTuple_Size(args); | |
3942 if (unlikely(!argc) < 0) return NULL; | |
3943 #endif | |
3944 new_args = PyTuple_GetSlice(args, 1, argc); | |
3945 if (unlikely(!new_args)) | |
3946 return NULL; | |
3947 self = PyTuple_GetItem(args, 0); | |
3948 if (unlikely(!self)) { | |
3949 Py_DECREF(new_args); | |
3950 #if PY_MAJOR_VERSION > 2 | |
3951 PyErr_Format(PyExc_TypeError, | |
3952 "unbound method %.200S() needs an argument", | |
3953 cyfunc->func_qualname); | |
3954 #else | |
3955 PyErr_SetString(PyExc_TypeError, | |
3956 "unbound method needs an argument"); | |
3957 #endif | |
3958 return NULL; | |
3959 } | |
3960 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); | |
3961 Py_DECREF(new_args); | |
3962 } else { | |
3963 result = __Pyx_CyFunction_Call(func, args, kw); | |
3964 } | |
3965 return result; | |
3966 } | |
3967 #if CYTHON_METH_FASTCALL | |
3968 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) | |
3969 { | |
3970 int ret = 0; | |
3971 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { | |
3972 if (unlikely(nargs < 1)) { | |
3973 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", | |
3974 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); | |
3975 return -1; | |
3976 } | |
3977 ret = 1; | |
3978 } | |
3979 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { | |
3980 PyErr_Format(PyExc_TypeError, | |
3981 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); | |
3982 return -1; | |
3983 } | |
3984 return ret; | |
3985 } | |
3986 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) | |
3987 { | |
3988 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; | |
3989 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; | |
3990 #if CYTHON_BACKPORT_VECTORCALL | |
3991 Py_ssize_t nargs = (Py_ssize_t)nargsf; | |
3992 #else | |
3993 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); | |
3994 #endif | |
3995 PyObject *self; | |
3996 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { | |
3997 case 1: | |
3998 self = args[0]; | |
3999 args += 1; | |
4000 nargs -= 1; | |
4001 break; | |
4002 case 0: | |
4003 self = ((PyCFunctionObject*)cyfunc)->m_self; | |
4004 break; | |
4005 default: | |
4006 return NULL; | |
4007 } | |
4008 if (unlikely(nargs != 0)) { | |
4009 PyErr_Format(PyExc_TypeError, | |
4010 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
4011 def->ml_name, nargs); | |
4012 return NULL; | |
4013 } | |
4014 return def->ml_meth(self, NULL); | |
4015 } | |
4016 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) | |
4017 { | |
4018 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; | |
4019 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; | |
4020 #if CYTHON_BACKPORT_VECTORCALL | |
4021 Py_ssize_t nargs = (Py_ssize_t)nargsf; | |
4022 #else | |
4023 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); | |
4024 #endif | |
4025 PyObject *self; | |
4026 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { | |
4027 case 1: | |
4028 self = args[0]; | |
4029 args += 1; | |
4030 nargs -= 1; | |
4031 break; | |
4032 case 0: | |
4033 self = ((PyCFunctionObject*)cyfunc)->m_self; | |
4034 break; | |
4035 default: | |
4036 return NULL; | |
4037 } | |
4038 if (unlikely(nargs != 1)) { | |
4039 PyErr_Format(PyExc_TypeError, | |
4040 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", | |
4041 def->ml_name, nargs); | |
4042 return NULL; | |
4043 } | |
4044 return def->ml_meth(self, args[0]); | |
4045 } | |
4046 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) | |
4047 { | |
4048 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; | |
4049 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; | |
4050 #if CYTHON_BACKPORT_VECTORCALL | |
4051 Py_ssize_t nargs = (Py_ssize_t)nargsf; | |
4052 #else | |
4053 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); | |
4054 #endif | |
4055 PyObject *self; | |
4056 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { | |
4057 case 1: | |
4058 self = args[0]; | |
4059 args += 1; | |
4060 nargs -= 1; | |
4061 break; | |
4062 case 0: | |
4063 self = ((PyCFunctionObject*)cyfunc)->m_self; | |
4064 break; | |
4065 default: | |
4066 return NULL; | |
4067 } | |
4068 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); | |
4069 } | |
4070 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) | |
4071 { | |
4072 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; | |
4073 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; | |
4074 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); | |
4075 #if CYTHON_BACKPORT_VECTORCALL | |
4076 Py_ssize_t nargs = (Py_ssize_t)nargsf; | |
4077 #else | |
4078 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); | |
4079 #endif | |
4080 PyObject *self; | |
4081 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { | |
4082 case 1: | |
4083 self = args[0]; | |
4084 args += 1; | |
4085 nargs -= 1; | |
4086 break; | |
4087 case 0: | |
4088 self = ((PyCFunctionObject*)cyfunc)->m_self; | |
4089 break; | |
4090 default: | |
4091 return NULL; | |
4092 } | |
4093 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); | |
4094 } | |
4095 #endif | |
4096 #if CYTHON_USE_TYPE_SPECS | |
4097 static PyType_Slot __pyx_CyFunctionType_slots[] = { | |
4098 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, | |
4099 {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, | |
4100 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, | |
4101 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, | |
4102 {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, | |
4103 {Py_tp_methods, (void *)__pyx_CyFunction_methods}, | |
4104 {Py_tp_members, (void *)__pyx_CyFunction_members}, | |
4105 {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, | |
4106 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, | |
4107 {0, 0}, | |
4108 }; | |
4109 static PyType_Spec __pyx_CyFunctionType_spec = { | |
4110 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", | |
4111 sizeof(__pyx_CyFunctionObject), | |
4112 0, | |
4113 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR | |
4114 Py_TPFLAGS_METHOD_DESCRIPTOR | | |
4115 #endif | |
4116 #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) | |
4117 _Py_TPFLAGS_HAVE_VECTORCALL | | |
4118 #endif | |
4119 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, | |
4120 __pyx_CyFunctionType_slots | |
4121 }; | |
4122 #else | |
4123 static PyTypeObject __pyx_CyFunctionType_type = { | |
4124 PyVarObject_HEAD_INIT(0, 0) | |
4125 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", | |
4126 sizeof(__pyx_CyFunctionObject), | |
4127 0, | |
4128 (destructor) __Pyx_CyFunction_dealloc, | |
4129 #if !CYTHON_METH_FASTCALL | |
4130 0, | |
4131 #elif CYTHON_BACKPORT_VECTORCALL | |
4132 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), | |
4133 #else | |
4134 offsetof(PyCFunctionObject, vectorcall), | |
4135 #endif | |
4136 0, | |
4137 0, | |
4138 #if PY_MAJOR_VERSION < 3 | |
4139 0, | |
4140 #else | |
4141 0, | |
4142 #endif | |
4143 (reprfunc) __Pyx_CyFunction_repr, | |
4144 0, | |
4145 0, | |
4146 0, | |
4147 0, | |
4148 __Pyx_CyFunction_CallAsMethod, | |
4149 0, | |
4150 0, | |
4151 0, | |
4152 0, | |
4153 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR | |
4154 Py_TPFLAGS_METHOD_DESCRIPTOR | | |
4155 #endif | |
4156 #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL | |
4157 _Py_TPFLAGS_HAVE_VECTORCALL | | |
4158 #endif | |
4159 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, | |
4160 0, | |
4161 (traverseproc) __Pyx_CyFunction_traverse, | |
4162 (inquiry) __Pyx_CyFunction_clear, | |
4163 0, | |
4164 #if PY_VERSION_HEX < 0x030500A0 | |
4165 offsetof(__pyx_CyFunctionObject, func_weakreflist), | |
4166 #else | |
4167 offsetof(PyCFunctionObject, m_weakreflist), | |
4168 #endif | |
4169 0, | |
4170 0, | |
4171 __pyx_CyFunction_methods, | |
4172 __pyx_CyFunction_members, | |
4173 __pyx_CyFunction_getsets, | |
4174 0, | |
4175 0, | |
4176 __Pyx_PyMethod_New, | |
4177 0, | |
4178 offsetof(__pyx_CyFunctionObject, func_dict), | |
4179 0, | |
4180 0, | |
4181 0, | |
4182 0, | |
4183 0, | |
4184 0, | |
4185 0, | |
4186 0, | |
4187 0, | |
4188 0, | |
4189 0, | |
4190 0, | |
4191 #if PY_VERSION_HEX >= 0x030400a1 | |
4192 0, | |
4193 #endif | |
4194 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) | |
4195 0, | |
4196 #endif | |
4197 #if __PYX_NEED_TP_PRINT_SLOT | |
4198 0, | |
4199 #endif | |
4200 #if PY_VERSION_HEX >= 0x030C0000 | |
4201 0, | |
4202 #endif | |
4203 #if PY_VERSION_HEX >= 0x030d00A4 | |
4204 0, | |
4205 #endif | |
4206 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 | |
4207 0, | |
4208 #endif | |
4209 }; | |
4210 #endif | |
4211 static int __pyx_CyFunction_init(PyObject *module) { | |
4212 #if CYTHON_USE_TYPE_SPECS | |
4213 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); | |
4214 #else | |
4215 CYTHON_UNUSED_VAR(module); | |
4216 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); | |
4217 #endif | |
4218 if (unlikely(__pyx_CyFunctionType == NULL)) { | |
4219 return -1; | |
4220 } | |
4221 return 0; | |
4222 } | |
4223 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { | |
4224 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
4225 m->defaults = PyObject_Malloc(size); | |
4226 if (unlikely(!m->defaults)) | |
4227 return PyErr_NoMemory(); | |
4228 memset(m->defaults, 0, size); | |
4229 m->defaults_pyobjects = pyobjects; | |
4230 m->defaults_size = size; | |
4231 return m->defaults; | |
4232 } | |
4233 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { | |
4234 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
4235 m->defaults_tuple = tuple; | |
4236 Py_INCREF(tuple); | |
4237 } | |
4238 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { | |
4239 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
4240 m->defaults_kwdict = dict; | |
4241 Py_INCREF(dict); | |
4242 } | |
4243 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { | |
4244 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; | |
4245 m->func_annotations = dict; | |
4246 Py_INCREF(dict); | |
4247 } | |
4248 | |
4249 /* CythonFunction */ | |
4250 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, | |
4251 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { | |
4252 PyObject *op = __Pyx_CyFunction_Init( | |
4253 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), | |
4254 ml, flags, qualname, closure, module, globals, code | |
4255 ); | |
4256 if (likely(op)) { | |
4257 PyObject_GC_Track(op); | |
4258 } | |
4259 return op; | |
4260 } | |
4261 | |
4262 /* PyDictVersioning */ | |
4263 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS | |
4264 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { | |
4265 PyObject *dict = Py_TYPE(obj)->tp_dict; | |
4266 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; | |
4267 } | |
4268 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { | |
4269 PyObject **dictptr = NULL; | |
4270 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; | |
4271 if (offset) { | |
4272 #if CYTHON_COMPILING_IN_CPYTHON | |
4273 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); | |
4274 #else | |
4275 dictptr = _PyObject_GetDictPtr(obj); | |
4276 #endif | |
4277 } | |
4278 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; | |
4279 } | |
4280 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { | |
4281 PyObject *dict = Py_TYPE(obj)->tp_dict; | |
4282 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) | |
4283 return 0; | |
4284 return obj_dict_version == __Pyx_get_object_dict_version(obj); | |
4285 } | |
4286 #endif | |
4287 | |
4288 /* PyErrExceptionMatches */ | |
4289 #if CYTHON_FAST_THREAD_STATE | |
4290 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { | |
4291 Py_ssize_t i, n; | |
4292 n = PyTuple_GET_SIZE(tuple); | |
4293 #if PY_MAJOR_VERSION >= 3 | |
4294 for (i=0; i<n; i++) { | |
4295 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; | |
4296 } | |
4297 #endif | |
4298 for (i=0; i<n; i++) { | |
4299 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; | |
4300 } | |
4301 return 0; | |
4302 } | |
4303 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { | |
4304 int result; | |
4305 PyObject *exc_type; | |
4306 #if PY_VERSION_HEX >= 0x030C00A6 | |
4307 PyObject *current_exception = tstate->current_exception; | |
4308 if (unlikely(!current_exception)) return 0; | |
4309 exc_type = (PyObject*) Py_TYPE(current_exception); | |
4310 if (exc_type == err) return 1; | |
4311 #else | |
4312 exc_type = tstate->curexc_type; | |
4313 if (exc_type == err) return 1; | |
4314 if (unlikely(!exc_type)) return 0; | |
4315 #endif | |
4316 #if CYTHON_AVOID_BORROWED_REFS | |
4317 Py_INCREF(exc_type); | |
4318 #endif | |
4319 if (unlikely(PyTuple_Check(err))) { | |
4320 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); | |
4321 } else { | |
4322 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); | |
4323 } | |
4324 #if CYTHON_AVOID_BORROWED_REFS | |
4325 Py_DECREF(exc_type); | |
4326 #endif | |
4327 return result; | |
4328 } | |
4329 #endif | |
4330 | |
4331 /* PyErrFetchRestore */ | |
4332 #if CYTHON_FAST_THREAD_STATE | |
4333 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { | |
4334 #if PY_VERSION_HEX >= 0x030C00A6 | |
4335 PyObject *tmp_value; | |
4336 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); | |
4337 if (value) { | |
4338 #if CYTHON_COMPILING_IN_CPYTHON | |
4339 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) | |
4340 #endif | |
4341 PyException_SetTraceback(value, tb); | |
4342 } | |
4343 tmp_value = tstate->current_exception; | |
4344 tstate->current_exception = value; | |
4345 Py_XDECREF(tmp_value); | |
4346 Py_XDECREF(type); | |
4347 Py_XDECREF(tb); | |
4348 #else | |
4349 PyObject *tmp_type, *tmp_value, *tmp_tb; | |
4350 tmp_type = tstate->curexc_type; | |
4351 tmp_value = tstate->curexc_value; | |
4352 tmp_tb = tstate->curexc_traceback; | |
4353 tstate->curexc_type = type; | |
4354 tstate->curexc_value = value; | |
4355 tstate->curexc_traceback = tb; | |
4356 Py_XDECREF(tmp_type); | |
4357 Py_XDECREF(tmp_value); | |
4358 Py_XDECREF(tmp_tb); | |
4359 #endif | |
4360 } | |
4361 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { | |
4362 #if PY_VERSION_HEX >= 0x030C00A6 | |
4363 PyObject* exc_value; | |
4364 exc_value = tstate->current_exception; | |
4365 tstate->current_exception = 0; | |
4366 *value = exc_value; | |
4367 *type = NULL; | |
4368 *tb = NULL; | |
4369 if (exc_value) { | |
4370 *type = (PyObject*) Py_TYPE(exc_value); | |
4371 Py_INCREF(*type); | |
4372 #if CYTHON_COMPILING_IN_CPYTHON | |
4373 *tb = ((PyBaseExceptionObject*) exc_value)->traceback; | |
4374 Py_XINCREF(*tb); | |
4375 #else | |
4376 *tb = PyException_GetTraceback(exc_value); | |
4377 #endif | |
4378 } | |
4379 #else | |
4380 *type = tstate->curexc_type; | |
4381 *value = tstate->curexc_value; | |
4382 *tb = tstate->curexc_traceback; | |
4383 tstate->curexc_type = 0; | |
4384 tstate->curexc_value = 0; | |
4385 tstate->curexc_traceback = 0; | |
4386 #endif | |
4387 } | |
4388 #endif | |
4389 | |
4390 /* PyObjectGetAttrStrNoError */ | |
4391 #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 | |
4392 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { | |
4393 __Pyx_PyThreadState_declare | |
4394 __Pyx_PyThreadState_assign | |
4395 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) | |
4396 __Pyx_PyErr_Clear(); | |
4397 } | |
4398 #endif | |
4399 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { | |
4400 PyObject *result; | |
4401 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 | |
4402 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); | |
4403 return result; | |
4404 #else | |
4405 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 | |
4406 PyTypeObject* tp = Py_TYPE(obj); | |
4407 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { | |
4408 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); | |
4409 } | |
4410 #endif | |
4411 result = __Pyx_PyObject_GetAttrStr(obj, attr_name); | |
4412 if (unlikely(!result)) { | |
4413 __Pyx_PyObject_GetAttrStr_ClearAttributeError(); | |
4414 } | |
4415 return result; | |
4416 #endif | |
4417 } | |
4418 | |
4419 /* CLineInTraceback */ | |
4420 #ifndef CYTHON_CLINE_IN_TRACEBACK | |
4421 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { | |
4422 PyObject *use_cline; | |
4423 PyObject *ptype, *pvalue, *ptraceback; | |
4424 #if CYTHON_COMPILING_IN_CPYTHON | |
4425 PyObject **cython_runtime_dict; | |
4426 #endif | |
4427 CYTHON_MAYBE_UNUSED_VAR(tstate); | |
4428 if (unlikely(!__pyx_cython_runtime)) { | |
4429 return c_line; | |
4430 } | |
4431 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); | |
4432 #if CYTHON_COMPILING_IN_CPYTHON | |
4433 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); | |
4434 if (likely(cython_runtime_dict)) { | |
4435 __PYX_PY_DICT_LOOKUP_IF_MODIFIED( | |
4436 use_cline, *cython_runtime_dict, | |
4437 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) | |
4438 } else | |
4439 #endif | |
4440 { | |
4441 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); | |
4442 if (use_cline_obj) { | |
4443 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; | |
4444 Py_DECREF(use_cline_obj); | |
4445 } else { | |
4446 PyErr_Clear(); | |
4447 use_cline = NULL; | |
4448 } | |
4449 } | |
4450 if (!use_cline) { | |
4451 c_line = 0; | |
4452 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); | |
4453 } | |
4454 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { | |
4455 c_line = 0; | |
4456 } | |
4457 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); | |
4458 return c_line; | |
4459 } | |
4460 #endif | |
4461 | |
4462 /* CodeObjectCache */ | |
4463 #if !CYTHON_COMPILING_IN_LIMITED_API | |
4464 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { | |
4465 int start = 0, mid = 0, end = count - 1; | |
4466 if (end >= 0 && code_line > entries[end].code_line) { | |
4467 return count; | |
4468 } | |
4469 while (start < end) { | |
4470 mid = start + (end - start) / 2; | |
4471 if (code_line < entries[mid].code_line) { | |
4472 end = mid; | |
4473 } else if (code_line > entries[mid].code_line) { | |
4474 start = mid + 1; | |
4475 } else { | |
4476 return mid; | |
4477 } | |
4478 } | |
4479 if (code_line <= entries[mid].code_line) { | |
4480 return mid; | |
4481 } else { | |
4482 return mid + 1; | |
4483 } | |
4484 } | |
4485 static PyCodeObject *__pyx_find_code_object(int code_line) { | |
4486 PyCodeObject* code_object; | |
4487 int pos; | |
4488 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { | |
4489 return NULL; | |
4490 } | |
4491 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); | |
4492 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { | |
4493 return NULL; | |
4494 } | |
4495 code_object = __pyx_code_cache.entries[pos].code_object; | |
4496 Py_INCREF(code_object); | |
4497 return code_object; | |
4498 } | |
4499 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { | |
4500 int pos, i; | |
4501 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; | |
4502 if (unlikely(!code_line)) { | |
4503 return; | |
4504 } | |
4505 if (unlikely(!entries)) { | |
4506 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); | |
4507 if (likely(entries)) { | |
4508 __pyx_code_cache.entries = entries; | |
4509 __pyx_code_cache.max_count = 64; | |
4510 __pyx_code_cache.count = 1; | |
4511 entries[0].code_line = code_line; | |
4512 entries[0].code_object = code_object; | |
4513 Py_INCREF(code_object); | |
4514 } | |
4515 return; | |
4516 } | |
4517 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); | |
4518 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { | |
4519 PyCodeObject* tmp = entries[pos].code_object; | |
4520 entries[pos].code_object = code_object; | |
4521 Py_DECREF(tmp); | |
4522 return; | |
4523 } | |
4524 if (__pyx_code_cache.count == __pyx_code_cache.max_count) { | |
4525 int new_max = __pyx_code_cache.max_count + 64; | |
4526 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( | |
4527 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); | |
4528 if (unlikely(!entries)) { | |
4529 return; | |
4530 } | |
4531 __pyx_code_cache.entries = entries; | |
4532 __pyx_code_cache.max_count = new_max; | |
4533 } | |
4534 for (i=__pyx_code_cache.count; i>pos; i--) { | |
4535 entries[i] = entries[i-1]; | |
4536 } | |
4537 entries[pos].code_line = code_line; | |
4538 entries[pos].code_object = code_object; | |
4539 __pyx_code_cache.count++; | |
4540 Py_INCREF(code_object); | |
4541 } | |
4542 #endif | |
4543 | |
4544 /* AddTraceback */ | |
4545 #include "compile.h" | |
4546 #include "frameobject.h" | |
4547 #include "traceback.h" | |
4548 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API | |
4549 #ifndef Py_BUILD_CORE | |
4550 #define Py_BUILD_CORE 1 | |
4551 #endif | |
4552 #include "internal/pycore_frame.h" | |
4553 #endif | |
4554 #if CYTHON_COMPILING_IN_LIMITED_API | |
4555 static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, | |
4556 PyObject *firstlineno, PyObject *name) { | |
4557 PyObject *replace = NULL; | |
4558 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; | |
4559 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; | |
4560 replace = PyObject_GetAttrString(code, "replace"); | |
4561 if (likely(replace)) { | |
4562 PyObject *result; | |
4563 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); | |
4564 Py_DECREF(replace); | |
4565 return result; | |
4566 } | |
4567 PyErr_Clear(); | |
4568 #if __PYX_LIMITED_VERSION_HEX < 0x030780000 | |
4569 { | |
4570 PyObject *compiled = NULL, *result = NULL; | |
4571 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; | |
4572 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; | |
4573 compiled = Py_CompileString( | |
4574 "out = type(code)(\n" | |
4575 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" | |
4576 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" | |
4577 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" | |
4578 " code.co_lnotab)\n", "<dummy>", Py_file_input); | |
4579 if (!compiled) return NULL; | |
4580 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); | |
4581 Py_DECREF(compiled); | |
4582 if (!result) PyErr_Print(); | |
4583 Py_DECREF(result); | |
4584 result = PyDict_GetItemString(scratch_dict, "out"); | |
4585 if (result) Py_INCREF(result); | |
4586 return result; | |
4587 } | |
4588 #else | |
4589 return NULL; | |
4590 #endif | |
4591 } | |
4592 static void __Pyx_AddTraceback(const char *funcname, int c_line, | |
4593 int py_line, const char *filename) { | |
4594 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; | |
4595 PyObject *replace = NULL, *getframe = NULL, *frame = NULL; | |
4596 PyObject *exc_type, *exc_value, *exc_traceback; | |
4597 int success = 0; | |
4598 if (c_line) { | |
4599 (void) __pyx_cfilenm; | |
4600 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); | |
4601 } | |
4602 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); | |
4603 code_object = Py_CompileString("_getframe()", filename, Py_eval_input); | |
4604 if (unlikely(!code_object)) goto bad; | |
4605 py_py_line = PyLong_FromLong(py_line); | |
4606 if (unlikely(!py_py_line)) goto bad; | |
4607 py_funcname = PyUnicode_FromString(funcname); | |
4608 if (unlikely(!py_funcname)) goto bad; | |
4609 dict = PyDict_New(); | |
4610 if (unlikely(!dict)) goto bad; | |
4611 { | |
4612 PyObject *old_code_object = code_object; | |
4613 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); | |
4614 Py_DECREF(old_code_object); | |
4615 } | |
4616 if (unlikely(!code_object)) goto bad; | |
4617 getframe = PySys_GetObject("_getframe"); | |
4618 if (unlikely(!getframe)) goto bad; | |
4619 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; | |
4620 frame = PyEval_EvalCode(code_object, dict, dict); | |
4621 if (unlikely(!frame) || frame == Py_None) goto bad; | |
4622 success = 1; | |
4623 bad: | |
4624 PyErr_Restore(exc_type, exc_value, exc_traceback); | |
4625 Py_XDECREF(code_object); | |
4626 Py_XDECREF(py_py_line); | |
4627 Py_XDECREF(py_funcname); | |
4628 Py_XDECREF(dict); | |
4629 Py_XDECREF(replace); | |
4630 if (success) { | |
4631 PyTraceBack_Here( | |
4632 (struct _frame*)frame); | |
4633 } | |
4634 Py_XDECREF(frame); | |
4635 } | |
4636 #else | |
4637 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( | |
4638 const char *funcname, int c_line, | |
4639 int py_line, const char *filename) { | |
4640 PyCodeObject *py_code = NULL; | |
4641 PyObject *py_funcname = NULL; | |
4642 #if PY_MAJOR_VERSION < 3 | |
4643 PyObject *py_srcfile = NULL; | |
4644 py_srcfile = PyString_FromString(filename); | |
4645 if (!py_srcfile) goto bad; | |
4646 #endif | |
4647 if (c_line) { | |
4648 #if PY_MAJOR_VERSION < 3 | |
4649 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); | |
4650 if (!py_funcname) goto bad; | |
4651 #else | |
4652 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); | |
4653 if (!py_funcname) goto bad; | |
4654 funcname = PyUnicode_AsUTF8(py_funcname); | |
4655 if (!funcname) goto bad; | |
4656 #endif | |
4657 } | |
4658 else { | |
4659 #if PY_MAJOR_VERSION < 3 | |
4660 py_funcname = PyString_FromString(funcname); | |
4661 if (!py_funcname) goto bad; | |
4662 #endif | |
4663 } | |
4664 #if PY_MAJOR_VERSION < 3 | |
4665 py_code = __Pyx_PyCode_New( | |
4666 0, | |
4667 0, | |
4668 0, | |
4669 0, | |
4670 0, | |
4671 0, | |
4672 __pyx_empty_bytes, /*PyObject *code,*/ | |
4673 __pyx_empty_tuple, /*PyObject *consts,*/ | |
4674 __pyx_empty_tuple, /*PyObject *names,*/ | |
4675 __pyx_empty_tuple, /*PyObject *varnames,*/ | |
4676 __pyx_empty_tuple, /*PyObject *freevars,*/ | |
4677 __pyx_empty_tuple, /*PyObject *cellvars,*/ | |
4678 py_srcfile, /*PyObject *filename,*/ | |
4679 py_funcname, /*PyObject *name,*/ | |
4680 py_line, | |
4681 __pyx_empty_bytes /*PyObject *lnotab*/ | |
4682 ); | |
4683 Py_DECREF(py_srcfile); | |
4684 #else | |
4685 py_code = PyCode_NewEmpty(filename, funcname, py_line); | |
4686 #endif | |
4687 Py_XDECREF(py_funcname); | |
4688 return py_code; | |
4689 bad: | |
4690 Py_XDECREF(py_funcname); | |
4691 #if PY_MAJOR_VERSION < 3 | |
4692 Py_XDECREF(py_srcfile); | |
4693 #endif | |
4694 return NULL; | |
4695 } | |
4696 static void __Pyx_AddTraceback(const char *funcname, int c_line, | |
4697 int py_line, const char *filename) { | |
4698 PyCodeObject *py_code = 0; | |
4699 PyFrameObject *py_frame = 0; | |
4700 PyThreadState *tstate = __Pyx_PyThreadState_Current; | |
4701 PyObject *ptype, *pvalue, *ptraceback; | |
4702 if (c_line) { | |
4703 c_line = __Pyx_CLineForTraceback(tstate, c_line); | |
4704 } | |
4705 py_code = __pyx_find_code_object(c_line ? -c_line : py_line); | |
4706 if (!py_code) { | |
4707 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); | |
4708 py_code = __Pyx_CreateCodeObjectForTraceback( | |
4709 funcname, c_line, py_line, filename); | |
4710 if (!py_code) { | |
4711 /* If the code object creation fails, then we should clear the | |
4712 fetched exception references and propagate the new exception */ | |
4713 Py_XDECREF(ptype); | |
4714 Py_XDECREF(pvalue); | |
4715 Py_XDECREF(ptraceback); | |
4716 goto bad; | |
4717 } | |
4718 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); | |
4719 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); | |
4720 } | |
4721 py_frame = PyFrame_New( | |
4722 tstate, /*PyThreadState *tstate,*/ | |
4723 py_code, /*PyCodeObject *code,*/ | |
4724 __pyx_d, /*PyObject *globals,*/ | |
4725 0 /*PyObject *locals*/ | |
4726 ); | |
4727 if (!py_frame) goto bad; | |
4728 __Pyx_PyFrame_SetLineNumber(py_frame, py_line); | |
4729 PyTraceBack_Here(py_frame); | |
4730 bad: | |
4731 Py_XDECREF(py_code); | |
4732 Py_XDECREF(py_frame); | |
4733 } | |
4734 #endif | |
4735 | |
4736 /* FormatTypeName */ | |
4737 #if CYTHON_COMPILING_IN_LIMITED_API | |
4738 static __Pyx_TypeName | |
4739 __Pyx_PyType_GetName(PyTypeObject* tp) | |
4740 { | |
4741 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, | |
4742 __pyx_n_s_name); | |
4743 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { | |
4744 PyErr_Clear(); | |
4745 Py_XDECREF(name); | |
4746 name = __Pyx_NewRef(__pyx_n_s__2); | |
4747 } | |
4748 return name; | |
4749 } | |
4750 #endif | |
4751 | |
4752 /* CIntToPy */ | |
4753 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { | |
4754 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
4755 #pragma GCC diagnostic push | |
4756 #pragma GCC diagnostic ignored "-Wconversion" | |
4757 #endif | |
4758 const long neg_one = (long) -1, const_zero = (long) 0; | |
4759 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
4760 #pragma GCC diagnostic pop | |
4761 #endif | |
4762 const int is_unsigned = neg_one > const_zero; | |
4763 if (is_unsigned) { | |
4764 if (sizeof(long) < sizeof(long)) { | |
4765 return PyInt_FromLong((long) value); | |
4766 } else if (sizeof(long) <= sizeof(unsigned long)) { | |
4767 return PyLong_FromUnsignedLong((unsigned long) value); | |
4768 #ifdef HAVE_LONG_LONG | |
4769 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { | |
4770 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); | |
4771 #endif | |
4772 } | |
4773 } else { | |
4774 if (sizeof(long) <= sizeof(long)) { | |
4775 return PyInt_FromLong((long) value); | |
4776 #ifdef HAVE_LONG_LONG | |
4777 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { | |
4778 return PyLong_FromLongLong((PY_LONG_LONG) value); | |
4779 #endif | |
4780 } | |
4781 } | |
4782 { | |
4783 unsigned char *bytes = (unsigned char *)&value; | |
4784 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 | |
4785 if (is_unsigned) { | |
4786 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); | |
4787 } else { | |
4788 return PyLong_FromNativeBytes(bytes, sizeof(value), -1); | |
4789 } | |
4790 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 | |
4791 int one = 1; int little = (int)*(unsigned char *)&one; | |
4792 return _PyLong_FromByteArray(bytes, sizeof(long), | |
4793 little, !is_unsigned); | |
4794 #else | |
4795 int one = 1; int little = (int)*(unsigned char *)&one; | |
4796 PyObject *from_bytes, *result = NULL; | |
4797 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; | |
4798 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); | |
4799 if (!from_bytes) return NULL; | |
4800 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); | |
4801 if (!py_bytes) goto limited_bad; | |
4802 order_str = PyUnicode_FromString(little ? "little" : "big"); | |
4803 if (!order_str) goto limited_bad; | |
4804 arg_tuple = PyTuple_Pack(2, py_bytes, order_str); | |
4805 if (!arg_tuple) goto limited_bad; | |
4806 if (!is_unsigned) { | |
4807 kwds = PyDict_New(); | |
4808 if (!kwds) goto limited_bad; | |
4809 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; | |
4810 } | |
4811 result = PyObject_Call(from_bytes, arg_tuple, kwds); | |
4812 limited_bad: | |
4813 Py_XDECREF(kwds); | |
4814 Py_XDECREF(arg_tuple); | |
4815 Py_XDECREF(order_str); | |
4816 Py_XDECREF(py_bytes); | |
4817 Py_XDECREF(from_bytes); | |
4818 return result; | |
4819 #endif | |
4820 } | |
4821 } | |
4822 | |
4823 /* CIntFromPyVerify */ | |
4824 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ | |
4825 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) | |
4826 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ | |
4827 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) | |
4828 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ | |
4829 {\ | |
4830 func_type value = func_value;\ | |
4831 if (sizeof(target_type) < sizeof(func_type)) {\ | |
4832 if (unlikely(value != (func_type) (target_type) value)) {\ | |
4833 func_type zero = 0;\ | |
4834 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ | |
4835 return (target_type) -1;\ | |
4836 if (is_unsigned && unlikely(value < zero))\ | |
4837 goto raise_neg_overflow;\ | |
4838 else\ | |
4839 goto raise_overflow;\ | |
4840 }\ | |
4841 }\ | |
4842 return (target_type) value;\ | |
4843 } | |
4844 | |
4845 /* CIntFromPy */ | |
4846 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { | |
4847 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
4848 #pragma GCC diagnostic push | |
4849 #pragma GCC diagnostic ignored "-Wconversion" | |
4850 #endif | |
4851 const long neg_one = (long) -1, const_zero = (long) 0; | |
4852 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
4853 #pragma GCC diagnostic pop | |
4854 #endif | |
4855 const int is_unsigned = neg_one > const_zero; | |
4856 #if PY_MAJOR_VERSION < 3 | |
4857 if (likely(PyInt_Check(x))) { | |
4858 if ((sizeof(long) < sizeof(long))) { | |
4859 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) | |
4860 } else { | |
4861 long val = PyInt_AS_LONG(x); | |
4862 if (is_unsigned && unlikely(val < 0)) { | |
4863 goto raise_neg_overflow; | |
4864 } | |
4865 return (long) val; | |
4866 } | |
4867 } | |
4868 #endif | |
4869 if (unlikely(!PyLong_Check(x))) { | |
4870 long val; | |
4871 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
4872 if (!tmp) return (long) -1; | |
4873 val = __Pyx_PyInt_As_long(tmp); | |
4874 Py_DECREF(tmp); | |
4875 return val; | |
4876 } | |
4877 if (is_unsigned) { | |
4878 #if CYTHON_USE_PYLONG_INTERNALS | |
4879 if (unlikely(__Pyx_PyLong_IsNeg(x))) { | |
4880 goto raise_neg_overflow; | |
4881 } else if (__Pyx_PyLong_IsCompact(x)) { | |
4882 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) | |
4883 } else { | |
4884 const digit* digits = __Pyx_PyLong_Digits(x); | |
4885 assert(__Pyx_PyLong_DigitCount(x) > 1); | |
4886 switch (__Pyx_PyLong_DigitCount(x)) { | |
4887 case 2: | |
4888 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { | |
4889 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
4890 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4891 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { | |
4892 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
4893 } | |
4894 } | |
4895 break; | |
4896 case 3: | |
4897 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { | |
4898 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
4899 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4900 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { | |
4901 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
4902 } | |
4903 } | |
4904 break; | |
4905 case 4: | |
4906 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { | |
4907 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
4908 __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]))) | |
4909 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { | |
4910 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); | |
4911 } | |
4912 } | |
4913 break; | |
4914 } | |
4915 } | |
4916 #endif | |
4917 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
4918 if (unlikely(Py_SIZE(x) < 0)) { | |
4919 goto raise_neg_overflow; | |
4920 } | |
4921 #else | |
4922 { | |
4923 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
4924 if (unlikely(result < 0)) | |
4925 return (long) -1; | |
4926 if (unlikely(result == 1)) | |
4927 goto raise_neg_overflow; | |
4928 } | |
4929 #endif | |
4930 if ((sizeof(long) <= sizeof(unsigned long))) { | |
4931 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) | |
4932 #ifdef HAVE_LONG_LONG | |
4933 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { | |
4934 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
4935 #endif | |
4936 } | |
4937 } else { | |
4938 #if CYTHON_USE_PYLONG_INTERNALS | |
4939 if (__Pyx_PyLong_IsCompact(x)) { | |
4940 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) | |
4941 } else { | |
4942 const digit* digits = __Pyx_PyLong_Digits(x); | |
4943 assert(__Pyx_PyLong_DigitCount(x) > 1); | |
4944 switch (__Pyx_PyLong_SignedDigitCount(x)) { | |
4945 case -2: | |
4946 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { | |
4947 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
4948 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4949 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { | |
4950 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4951 } | |
4952 } | |
4953 break; | |
4954 case 2: | |
4955 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { | |
4956 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
4957 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4958 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { | |
4959 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4960 } | |
4961 } | |
4962 break; | |
4963 case -3: | |
4964 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { | |
4965 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
4966 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4967 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { | |
4968 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4969 } | |
4970 } | |
4971 break; | |
4972 case 3: | |
4973 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { | |
4974 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
4975 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
4976 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { | |
4977 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4978 } | |
4979 } | |
4980 break; | |
4981 case -4: | |
4982 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { | |
4983 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
4984 __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]))) | |
4985 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { | |
4986 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4987 } | |
4988 } | |
4989 break; | |
4990 case 4: | |
4991 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { | |
4992 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
4993 __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]))) | |
4994 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { | |
4995 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); | |
4996 } | |
4997 } | |
4998 break; | |
4999 } | |
5000 } | |
5001 #endif | |
5002 if ((sizeof(long) <= sizeof(long))) { | |
5003 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) | |
5004 #ifdef HAVE_LONG_LONG | |
5005 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { | |
5006 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
5007 #endif | |
5008 } | |
5009 } | |
5010 { | |
5011 long val; | |
5012 int ret = -1; | |
5013 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API | |
5014 Py_ssize_t bytes_copied = PyLong_AsNativeBytes( | |
5015 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); | |
5016 if (unlikely(bytes_copied == -1)) { | |
5017 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { | |
5018 goto raise_overflow; | |
5019 } else { | |
5020 ret = 0; | |
5021 } | |
5022 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) | |
5023 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
5024 unsigned char *bytes = (unsigned char *)&val; | |
5025 ret = _PyLong_AsByteArray((PyLongObject *)x, | |
5026 bytes, sizeof(val), | |
5027 is_little, !is_unsigned); | |
5028 #else | |
5029 PyObject *v; | |
5030 PyObject *stepval = NULL, *mask = NULL, *shift = NULL; | |
5031 int bits, remaining_bits, is_negative = 0; | |
5032 int chunk_size = (sizeof(long) < 8) ? 30 : 62; | |
5033 if (likely(PyLong_CheckExact(x))) { | |
5034 v = __Pyx_NewRef(x); | |
5035 } else { | |
5036 v = PyNumber_Long(x); | |
5037 if (unlikely(!v)) return (long) -1; | |
5038 assert(PyLong_CheckExact(v)); | |
5039 } | |
5040 { | |
5041 int result = PyObject_RichCompareBool(v, Py_False, Py_LT); | |
5042 if (unlikely(result < 0)) { | |
5043 Py_DECREF(v); | |
5044 return (long) -1; | |
5045 } | |
5046 is_negative = result == 1; | |
5047 } | |
5048 if (is_unsigned && unlikely(is_negative)) { | |
5049 Py_DECREF(v); | |
5050 goto raise_neg_overflow; | |
5051 } else if (is_negative) { | |
5052 stepval = PyNumber_Invert(v); | |
5053 Py_DECREF(v); | |
5054 if (unlikely(!stepval)) | |
5055 return (long) -1; | |
5056 } else { | |
5057 stepval = v; | |
5058 } | |
5059 v = NULL; | |
5060 val = (long) 0; | |
5061 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; | |
5062 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; | |
5063 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { | |
5064 PyObject *tmp, *digit; | |
5065 long idigit; | |
5066 digit = PyNumber_And(stepval, mask); | |
5067 if (unlikely(!digit)) goto done; | |
5068 idigit = PyLong_AsLong(digit); | |
5069 Py_DECREF(digit); | |
5070 if (unlikely(idigit < 0)) goto done; | |
5071 val |= ((long) idigit) << bits; | |
5072 tmp = PyNumber_Rshift(stepval, shift); | |
5073 if (unlikely(!tmp)) goto done; | |
5074 Py_DECREF(stepval); stepval = tmp; | |
5075 } | |
5076 Py_DECREF(shift); shift = NULL; | |
5077 Py_DECREF(mask); mask = NULL; | |
5078 { | |
5079 long idigit = PyLong_AsLong(stepval); | |
5080 if (unlikely(idigit < 0)) goto done; | |
5081 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); | |
5082 if (unlikely(idigit >= (1L << remaining_bits))) | |
5083 goto raise_overflow; | |
5084 val |= ((long) idigit) << bits; | |
5085 } | |
5086 if (!is_unsigned) { | |
5087 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) | |
5088 goto raise_overflow; | |
5089 if (is_negative) | |
5090 val = ~val; | |
5091 } | |
5092 ret = 0; | |
5093 done: | |
5094 Py_XDECREF(shift); | |
5095 Py_XDECREF(mask); | |
5096 Py_XDECREF(stepval); | |
5097 #endif | |
5098 if (unlikely(ret)) | |
5099 return (long) -1; | |
5100 return val; | |
5101 } | |
5102 raise_overflow: | |
5103 PyErr_SetString(PyExc_OverflowError, | |
5104 "value too large to convert to long"); | |
5105 return (long) -1; | |
5106 raise_neg_overflow: | |
5107 PyErr_SetString(PyExc_OverflowError, | |
5108 "can't convert negative value to long"); | |
5109 return (long) -1; | |
5110 } | |
5111 | |
5112 /* CIntFromPy */ | |
5113 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { | |
5114 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
5115 #pragma GCC diagnostic push | |
5116 #pragma GCC diagnostic ignored "-Wconversion" | |
5117 #endif | |
5118 const int neg_one = (int) -1, const_zero = (int) 0; | |
5119 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC | |
5120 #pragma GCC diagnostic pop | |
5121 #endif | |
5122 const int is_unsigned = neg_one > const_zero; | |
5123 #if PY_MAJOR_VERSION < 3 | |
5124 if (likely(PyInt_Check(x))) { | |
5125 if ((sizeof(int) < sizeof(long))) { | |
5126 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) | |
5127 } else { | |
5128 long val = PyInt_AS_LONG(x); | |
5129 if (is_unsigned && unlikely(val < 0)) { | |
5130 goto raise_neg_overflow; | |
5131 } | |
5132 return (int) val; | |
5133 } | |
5134 } | |
5135 #endif | |
5136 if (unlikely(!PyLong_Check(x))) { | |
5137 int val; | |
5138 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); | |
5139 if (!tmp) return (int) -1; | |
5140 val = __Pyx_PyInt_As_int(tmp); | |
5141 Py_DECREF(tmp); | |
5142 return val; | |
5143 } | |
5144 if (is_unsigned) { | |
5145 #if CYTHON_USE_PYLONG_INTERNALS | |
5146 if (unlikely(__Pyx_PyLong_IsNeg(x))) { | |
5147 goto raise_neg_overflow; | |
5148 } else if (__Pyx_PyLong_IsCompact(x)) { | |
5149 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) | |
5150 } else { | |
5151 const digit* digits = __Pyx_PyLong_Digits(x); | |
5152 assert(__Pyx_PyLong_DigitCount(x) > 1); | |
5153 switch (__Pyx_PyLong_DigitCount(x)) { | |
5154 case 2: | |
5155 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { | |
5156 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
5157 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5158 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { | |
5159 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
5160 } | |
5161 } | |
5162 break; | |
5163 case 3: | |
5164 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { | |
5165 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
5166 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5167 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { | |
5168 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
5169 } | |
5170 } | |
5171 break; | |
5172 case 4: | |
5173 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { | |
5174 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
5175 __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]))) | |
5176 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { | |
5177 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); | |
5178 } | |
5179 } | |
5180 break; | |
5181 } | |
5182 } | |
5183 #endif | |
5184 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 | |
5185 if (unlikely(Py_SIZE(x) < 0)) { | |
5186 goto raise_neg_overflow; | |
5187 } | |
5188 #else | |
5189 { | |
5190 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); | |
5191 if (unlikely(result < 0)) | |
5192 return (int) -1; | |
5193 if (unlikely(result == 1)) | |
5194 goto raise_neg_overflow; | |
5195 } | |
5196 #endif | |
5197 if ((sizeof(int) <= sizeof(unsigned long))) { | |
5198 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) | |
5199 #ifdef HAVE_LONG_LONG | |
5200 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { | |
5201 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) | |
5202 #endif | |
5203 } | |
5204 } else { | |
5205 #if CYTHON_USE_PYLONG_INTERNALS | |
5206 if (__Pyx_PyLong_IsCompact(x)) { | |
5207 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) | |
5208 } else { | |
5209 const digit* digits = __Pyx_PyLong_Digits(x); | |
5210 assert(__Pyx_PyLong_DigitCount(x) > 1); | |
5211 switch (__Pyx_PyLong_SignedDigitCount(x)) { | |
5212 case -2: | |
5213 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { | |
5214 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
5215 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5216 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { | |
5217 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5218 } | |
5219 } | |
5220 break; | |
5221 case 2: | |
5222 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { | |
5223 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { | |
5224 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5225 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { | |
5226 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5227 } | |
5228 } | |
5229 break; | |
5230 case -3: | |
5231 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { | |
5232 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
5233 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5234 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { | |
5235 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5236 } | |
5237 } | |
5238 break; | |
5239 case 3: | |
5240 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { | |
5241 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { | |
5242 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) | |
5243 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { | |
5244 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5245 } | |
5246 } | |
5247 break; | |
5248 case -4: | |
5249 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { | |
5250 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
5251 __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]))) | |
5252 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { | |
5253 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5254 } | |
5255 } | |
5256 break; | |
5257 case 4: | |
5258 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { | |
5259 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { | |
5260 __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]))) | |
5261 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { | |
5262 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); | |
5263 } | |
5264 } | |
5265 break; | |
5266 } | |
5267 } | |
5268 #endif | |
5269 if ((sizeof(int) <= sizeof(long))) { | |
5270 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) | |
5271 #ifdef HAVE_LONG_LONG | |
5272 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { | |
5273 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) | |
5274 #endif | |
5275 } | |
5276 } | |
5277 { | |
5278 int val; | |
5279 int ret = -1; | |
5280 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API | |
5281 Py_ssize_t bytes_copied = PyLong_AsNativeBytes( | |
5282 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); | |
5283 if (unlikely(bytes_copied == -1)) { | |
5284 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { | |
5285 goto raise_overflow; | |
5286 } else { | |
5287 ret = 0; | |
5288 } | |
5289 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) | |
5290 int one = 1; int is_little = (int)*(unsigned char *)&one; | |
5291 unsigned char *bytes = (unsigned char *)&val; | |
5292 ret = _PyLong_AsByteArray((PyLongObject *)x, | |
5293 bytes, sizeof(val), | |
5294 is_little, !is_unsigned); | |
5295 #else | |
5296 PyObject *v; | |
5297 PyObject *stepval = NULL, *mask = NULL, *shift = NULL; | |
5298 int bits, remaining_bits, is_negative = 0; | |
5299 int chunk_size = (sizeof(long) < 8) ? 30 : 62; | |
5300 if (likely(PyLong_CheckExact(x))) { | |
5301 v = __Pyx_NewRef(x); | |
5302 } else { | |
5303 v = PyNumber_Long(x); | |
5304 if (unlikely(!v)) return (int) -1; | |
5305 assert(PyLong_CheckExact(v)); | |
5306 } | |
5307 { | |
5308 int result = PyObject_RichCompareBool(v, Py_False, Py_LT); | |
5309 if (unlikely(result < 0)) { | |
5310 Py_DECREF(v); | |
5311 return (int) -1; | |
5312 } | |
5313 is_negative = result == 1; | |
5314 } | |
5315 if (is_unsigned && unlikely(is_negative)) { | |
5316 Py_DECREF(v); | |
5317 goto raise_neg_overflow; | |
5318 } else if (is_negative) { | |
5319 stepval = PyNumber_Invert(v); | |
5320 Py_DECREF(v); | |
5321 if (unlikely(!stepval)) | |
5322 return (int) -1; | |
5323 } else { | |
5324 stepval = v; | |
5325 } | |
5326 v = NULL; | |
5327 val = (int) 0; | |
5328 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; | |
5329 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; | |
5330 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { | |
5331 PyObject *tmp, *digit; | |
5332 long idigit; | |
5333 digit = PyNumber_And(stepval, mask); | |
5334 if (unlikely(!digit)) goto done; | |
5335 idigit = PyLong_AsLong(digit); | |
5336 Py_DECREF(digit); | |
5337 if (unlikely(idigit < 0)) goto done; | |
5338 val |= ((int) idigit) << bits; | |
5339 tmp = PyNumber_Rshift(stepval, shift); | |
5340 if (unlikely(!tmp)) goto done; | |
5341 Py_DECREF(stepval); stepval = tmp; | |
5342 } | |
5343 Py_DECREF(shift); shift = NULL; | |
5344 Py_DECREF(mask); mask = NULL; | |
5345 { | |
5346 long idigit = PyLong_AsLong(stepval); | |
5347 if (unlikely(idigit < 0)) goto done; | |
5348 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); | |
5349 if (unlikely(idigit >= (1L << remaining_bits))) | |
5350 goto raise_overflow; | |
5351 val |= ((int) idigit) << bits; | |
5352 } | |
5353 if (!is_unsigned) { | |
5354 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) | |
5355 goto raise_overflow; | |
5356 if (is_negative) | |
5357 val = ~val; | |
5358 } | |
5359 ret = 0; | |
5360 done: | |
5361 Py_XDECREF(shift); | |
5362 Py_XDECREF(mask); | |
5363 Py_XDECREF(stepval); | |
5364 #endif | |
5365 if (unlikely(ret)) | |
5366 return (int) -1; | |
5367 return val; | |
5368 } | |
5369 raise_overflow: | |
5370 PyErr_SetString(PyExc_OverflowError, | |
5371 "value too large to convert to int"); | |
5372 return (int) -1; | |
5373 raise_neg_overflow: | |
5374 PyErr_SetString(PyExc_OverflowError, | |
5375 "can't convert negative value to int"); | |
5376 return (int) -1; | |
5377 } | |
5378 | |
5379 /* FastTypeChecks */ | |
5380 #if CYTHON_COMPILING_IN_CPYTHON | |
5381 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { | |
5382 while (a) { | |
5383 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); | |
5384 if (a == b) | |
5385 return 1; | |
5386 } | |
5387 return b == &PyBaseObject_Type; | |
5388 } | |
5389 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { | |
5390 PyObject *mro; | |
5391 if (a == b) return 1; | |
5392 mro = a->tp_mro; | |
5393 if (likely(mro)) { | |
5394 Py_ssize_t i, n; | |
5395 n = PyTuple_GET_SIZE(mro); | |
5396 for (i = 0; i < n; i++) { | |
5397 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) | |
5398 return 1; | |
5399 } | |
5400 return 0; | |
5401 } | |
5402 return __Pyx_InBases(a, b); | |
5403 } | |
5404 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { | |
5405 PyObject *mro; | |
5406 if (cls == a || cls == b) return 1; | |
5407 mro = cls->tp_mro; | |
5408 if (likely(mro)) { | |
5409 Py_ssize_t i, n; | |
5410 n = PyTuple_GET_SIZE(mro); | |
5411 for (i = 0; i < n; i++) { | |
5412 PyObject *base = PyTuple_GET_ITEM(mro, i); | |
5413 if (base == (PyObject *)a || base == (PyObject *)b) | |
5414 return 1; | |
5415 } | |
5416 return 0; | |
5417 } | |
5418 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); | |
5419 } | |
5420 #if PY_MAJOR_VERSION == 2 | |
5421 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { | |
5422 PyObject *exception, *value, *tb; | |
5423 int res; | |
5424 __Pyx_PyThreadState_declare | |
5425 __Pyx_PyThreadState_assign | |
5426 __Pyx_ErrFetch(&exception, &value, &tb); | |
5427 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; | |
5428 if (unlikely(res == -1)) { | |
5429 PyErr_WriteUnraisable(err); | |
5430 res = 0; | |
5431 } | |
5432 if (!res) { | |
5433 res = PyObject_IsSubclass(err, exc_type2); | |
5434 if (unlikely(res == -1)) { | |
5435 PyErr_WriteUnraisable(err); | |
5436 res = 0; | |
5437 } | |
5438 } | |
5439 __Pyx_ErrRestore(exception, value, tb); | |
5440 return res; | |
5441 } | |
5442 #else | |
5443 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { | |
5444 if (exc_type1) { | |
5445 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); | |
5446 } else { | |
5447 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); | |
5448 } | |
5449 } | |
5450 #endif | |
5451 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { | |
5452 Py_ssize_t i, n; | |
5453 assert(PyExceptionClass_Check(exc_type)); | |
5454 n = PyTuple_GET_SIZE(tuple); | |
5455 #if PY_MAJOR_VERSION >= 3 | |
5456 for (i=0; i<n; i++) { | |
5457 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; | |
5458 } | |
5459 #endif | |
5460 for (i=0; i<n; i++) { | |
5461 PyObject *t = PyTuple_GET_ITEM(tuple, i); | |
5462 #if PY_MAJOR_VERSION < 3 | |
5463 if (likely(exc_type == t)) return 1; | |
5464 #endif | |
5465 if (likely(PyExceptionClass_Check(t))) { | |
5466 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; | |
5467 } else { | |
5468 } | |
5469 } | |
5470 return 0; | |
5471 } | |
5472 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { | |
5473 if (likely(err == exc_type)) return 1; | |
5474 if (likely(PyExceptionClass_Check(err))) { | |
5475 if (likely(PyExceptionClass_Check(exc_type))) { | |
5476 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); | |
5477 } else if (likely(PyTuple_Check(exc_type))) { | |
5478 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); | |
5479 } else { | |
5480 } | |
5481 } | |
5482 return PyErr_GivenExceptionMatches(err, exc_type); | |
5483 } | |
5484 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { | |
5485 assert(PyExceptionClass_Check(exc_type1)); | |
5486 assert(PyExceptionClass_Check(exc_type2)); | |
5487 if (likely(err == exc_type1 || err == exc_type2)) return 1; | |
5488 if (likely(PyExceptionClass_Check(err))) { | |
5489 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); | |
5490 } | |
5491 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); | |
5492 } | |
5493 #endif | |
5494 | |
5495 /* CheckBinaryVersion */ | |
5496 static unsigned long __Pyx_get_runtime_version(void) { | |
5497 #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4 | |
5498 return Py_Version & ~0xFFUL; | |
5499 #else | |
5500 const char* rt_version = Py_GetVersion(); | |
5501 unsigned long version = 0; | |
5502 unsigned long factor = 0x01000000UL; | |
5503 unsigned int digit = 0; | |
5504 int i = 0; | |
5505 while (factor) { | |
5506 while ('0' <= rt_version[i] && rt_version[i] <= '9') { | |
5507 digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); | |
5508 ++i; | |
5509 } | |
5510 version += factor * digit; | |
5511 if (rt_version[i] != '.') | |
5512 break; | |
5513 digit = 0; | |
5514 factor >>= 8; | |
5515 ++i; | |
5516 } | |
5517 return version; | |
5518 #endif | |
5519 } | |
5520 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { | |
5521 const unsigned long MAJOR_MINOR = 0xFFFF0000UL; | |
5522 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) | |
5523 return 0; | |
5524 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) | |
5525 return 1; | |
5526 { | |
5527 char message[200]; | |
5528 PyOS_snprintf(message, sizeof(message), | |
5529 "compile time Python version %d.%d " | |
5530 "of module '%.100s' " | |
5531 "%s " | |
5532 "runtime version %d.%d", | |
5533 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), | |
5534 __Pyx_MODULE_NAME, | |
5535 (allow_newer) ? "was newer than" : "does not match", | |
5536 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) | |
5537 ); | |
5538 return PyErr_WarnEx(NULL, message, 1); | |
5539 } | |
5540 } | |
5541 | |
5542 /* InitStrings */ | |
5543 #if PY_MAJOR_VERSION >= 3 | |
5544 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { | |
5545 if (t.is_unicode | t.is_str) { | |
5546 if (t.intern) { | |
5547 *str = PyUnicode_InternFromString(t.s); | |
5548 } else if (t.encoding) { | |
5549 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); | |
5550 } else { | |
5551 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); | |
5552 } | |
5553 } else { | |
5554 *str = PyBytes_FromStringAndSize(t.s, t.n - 1); | |
5555 } | |
5556 if (!*str) | |
5557 return -1; | |
5558 if (PyObject_Hash(*str) == -1) | |
5559 return -1; | |
5560 return 0; | |
5561 } | |
5562 #endif | |
5563 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { | |
5564 while (t->p) { | |
5565 #if PY_MAJOR_VERSION >= 3 | |
5566 __Pyx_InitString(*t, t->p); | |
5567 #else | |
5568 if (t->is_unicode) { | |
5569 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); | |
5570 } else if (t->intern) { | |
5571 *t->p = PyString_InternFromString(t->s); | |
5572 } else { | |
5573 *t->p = PyString_FromStringAndSize(t->s, t->n - 1); | |
5574 } | |
5575 if (!*t->p) | |
5576 return -1; | |
5577 if (PyObject_Hash(*t->p) == -1) | |
5578 return -1; | |
5579 #endif | |
5580 ++t; | |
5581 } | |
5582 return 0; | |
5583 } | |
5584 | |
5585 #include <string.h> | |
5586 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { | |
5587 size_t len = strlen(s); | |
5588 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { | |
5589 PyErr_SetString(PyExc_OverflowError, "byte string is too long"); | |
5590 return -1; | |
5591 } | |
5592 return (Py_ssize_t) len; | |
5593 } | |
5594 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { | |
5595 Py_ssize_t len = __Pyx_ssize_strlen(c_str); | |
5596 if (unlikely(len < 0)) return NULL; | |
5597 return __Pyx_PyUnicode_FromStringAndSize(c_str, len); | |
5598 } | |
5599 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { | |
5600 Py_ssize_t len = __Pyx_ssize_strlen(c_str); | |
5601 if (unlikely(len < 0)) return NULL; | |
5602 return PyByteArray_FromStringAndSize(c_str, len); | |
5603 } | |
5604 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { | |
5605 Py_ssize_t ignore; | |
5606 return __Pyx_PyObject_AsStringAndSize(o, &ignore); | |
5607 } | |
5608 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
5609 #if !CYTHON_PEP393_ENABLED | |
5610 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
5611 char* defenc_c; | |
5612 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); | |
5613 if (!defenc) return NULL; | |
5614 defenc_c = PyBytes_AS_STRING(defenc); | |
5615 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
5616 { | |
5617 char* end = defenc_c + PyBytes_GET_SIZE(defenc); | |
5618 char* c; | |
5619 for (c = defenc_c; c < end; c++) { | |
5620 if ((unsigned char) (*c) >= 128) { | |
5621 PyUnicode_AsASCIIString(o); | |
5622 return NULL; | |
5623 } | |
5624 } | |
5625 } | |
5626 #endif | |
5627 *length = PyBytes_GET_SIZE(defenc); | |
5628 return defenc_c; | |
5629 } | |
5630 #else | |
5631 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
5632 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; | |
5633 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
5634 if (likely(PyUnicode_IS_ASCII(o))) { | |
5635 *length = PyUnicode_GET_LENGTH(o); | |
5636 return PyUnicode_AsUTF8(o); | |
5637 } else { | |
5638 PyUnicode_AsASCIIString(o); | |
5639 return NULL; | |
5640 } | |
5641 #else | |
5642 return PyUnicode_AsUTF8AndSize(o, length); | |
5643 #endif | |
5644 } | |
5645 #endif | |
5646 #endif | |
5647 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { | |
5648 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT | |
5649 if ( | |
5650 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII | |
5651 __Pyx_sys_getdefaultencoding_not_ascii && | |
5652 #endif | |
5653 PyUnicode_Check(o)) { | |
5654 return __Pyx_PyUnicode_AsStringAndSize(o, length); | |
5655 } else | |
5656 #endif | |
5657 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) | |
5658 if (PyByteArray_Check(o)) { | |
5659 *length = PyByteArray_GET_SIZE(o); | |
5660 return PyByteArray_AS_STRING(o); | |
5661 } else | |
5662 #endif | |
5663 { | |
5664 char* result; | |
5665 int r = PyBytes_AsStringAndSize(o, &result, length); | |
5666 if (unlikely(r < 0)) { | |
5667 return NULL; | |
5668 } else { | |
5669 return result; | |
5670 } | |
5671 } | |
5672 } | |
5673 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { | |
5674 int is_true = x == Py_True; | |
5675 if (is_true | (x == Py_False) | (x == Py_None)) return is_true; | |
5676 else return PyObject_IsTrue(x); | |
5677 } | |
5678 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { | |
5679 int retval; | |
5680 if (unlikely(!x)) return -1; | |
5681 retval = __Pyx_PyObject_IsTrue(x); | |
5682 Py_DECREF(x); | |
5683 return retval; | |
5684 } | |
5685 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { | |
5686 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); | |
5687 #if PY_MAJOR_VERSION >= 3 | |
5688 if (PyLong_Check(result)) { | |
5689 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, | |
5690 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " | |
5691 "The ability to return an instance of a strict subclass of int is deprecated, " | |
5692 "and may be removed in a future version of Python.", | |
5693 result_type_name)) { | |
5694 __Pyx_DECREF_TypeName(result_type_name); | |
5695 Py_DECREF(result); | |
5696 return NULL; | |
5697 } | |
5698 __Pyx_DECREF_TypeName(result_type_name); | |
5699 return result; | |
5700 } | |
5701 #endif | |
5702 PyErr_Format(PyExc_TypeError, | |
5703 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", | |
5704 type_name, type_name, result_type_name); | |
5705 __Pyx_DECREF_TypeName(result_type_name); | |
5706 Py_DECREF(result); | |
5707 return NULL; | |
5708 } | |
5709 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { | |
5710 #if CYTHON_USE_TYPE_SLOTS | |
5711 PyNumberMethods *m; | |
5712 #endif | |
5713 const char *name = NULL; | |
5714 PyObject *res = NULL; | |
5715 #if PY_MAJOR_VERSION < 3 | |
5716 if (likely(PyInt_Check(x) || PyLong_Check(x))) | |
5717 #else | |
5718 if (likely(PyLong_Check(x))) | |
5719 #endif | |
5720 return __Pyx_NewRef(x); | |
5721 #if CYTHON_USE_TYPE_SLOTS | |
5722 m = Py_TYPE(x)->tp_as_number; | |
5723 #if PY_MAJOR_VERSION < 3 | |
5724 if (m && m->nb_int) { | |
5725 name = "int"; | |
5726 res = m->nb_int(x); | |
5727 } | |
5728 else if (m && m->nb_long) { | |
5729 name = "long"; | |
5730 res = m->nb_long(x); | |
5731 } | |
5732 #else | |
5733 if (likely(m && m->nb_int)) { | |
5734 name = "int"; | |
5735 res = m->nb_int(x); | |
5736 } | |
5737 #endif | |
5738 #else | |
5739 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { | |
5740 res = PyNumber_Int(x); | |
5741 } | |
5742 #endif | |
5743 if (likely(res)) { | |
5744 #if PY_MAJOR_VERSION < 3 | |
5745 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { | |
5746 #else | |
5747 if (unlikely(!PyLong_CheckExact(res))) { | |
5748 #endif | |
5749 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); | |
5750 } | |
5751 } | |
5752 else if (!PyErr_Occurred()) { | |
5753 PyErr_SetString(PyExc_TypeError, | |
5754 "an integer is required"); | |
5755 } | |
5756 return res; | |
5757 } | |
5758 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { | |
5759 Py_ssize_t ival; | |
5760 PyObject *x; | |
5761 #if PY_MAJOR_VERSION < 3 | |
5762 if (likely(PyInt_CheckExact(b))) { | |
5763 if (sizeof(Py_ssize_t) >= sizeof(long)) | |
5764 return PyInt_AS_LONG(b); | |
5765 else | |
5766 return PyInt_AsSsize_t(b); | |
5767 } | |
5768 #endif | |
5769 if (likely(PyLong_CheckExact(b))) { | |
5770 #if CYTHON_USE_PYLONG_INTERNALS | |
5771 if (likely(__Pyx_PyLong_IsCompact(b))) { | |
5772 return __Pyx_PyLong_CompactValue(b); | |
5773 } else { | |
5774 const digit* digits = __Pyx_PyLong_Digits(b); | |
5775 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); | |
5776 switch (size) { | |
5777 case 2: | |
5778 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { | |
5779 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
5780 } | |
5781 break; | |
5782 case -2: | |
5783 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { | |
5784 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
5785 } | |
5786 break; | |
5787 case 3: | |
5788 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { | |
5789 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
5790 } | |
5791 break; | |
5792 case -3: | |
5793 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { | |
5794 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); | |
5795 } | |
5796 break; | |
5797 case 4: | |
5798 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { | |
5799 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])); | |
5800 } | |
5801 break; | |
5802 case -4: | |
5803 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { | |
5804 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])); | |
5805 } | |
5806 break; | |
5807 } | |
5808 } | |
5809 #endif | |
5810 return PyLong_AsSsize_t(b); | |
5811 } | |
5812 x = PyNumber_Index(b); | |
5813 if (!x) return -1; | |
5814 ival = PyInt_AsSsize_t(x); | |
5815 Py_DECREF(x); | |
5816 return ival; | |
5817 } | |
5818 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { | |
5819 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { | |
5820 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); | |
5821 #if PY_MAJOR_VERSION < 3 | |
5822 } else if (likely(PyInt_CheckExact(o))) { | |
5823 return PyInt_AS_LONG(o); | |
5824 #endif | |
5825 } else { | |
5826 Py_ssize_t ival; | |
5827 PyObject *x; | |
5828 x = PyNumber_Index(o); | |
5829 if (!x) return -1; | |
5830 ival = PyInt_AsLong(x); | |
5831 Py_DECREF(x); | |
5832 return ival; | |
5833 } | |
5834 } | |
5835 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { | |
5836 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); | |
5837 } | |
5838 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { | |
5839 return PyInt_FromSize_t(ival); | |
5840 } | |
5841 | |
5842 | |
5843 /* #### Code section: utility_code_pragmas_end ### */ | |
5844 #ifdef _MSC_VER | |
5845 #pragma warning( pop ) | |
5846 #endif | |
5847 | |
5848 | |
5849 | |
5850 /* #### Code section: end ### */ | |
5851 #endif /* Py_PYTHON_H */ |