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