comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcbgzf.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/htslib/htslib/bgzf.h",
14 "/project/htslib/htslib/cram.h",
15 "/project/htslib/htslib/faidx.h",
16 "/project/htslib/htslib/hfile.h",
17 "/project/htslib/htslib/hts.h",
18 "/project/htslib/htslib/kstring.h",
19 "/project/htslib/htslib/sam.h",
20 "/project/htslib/htslib/tbx.h",
21 "/project/htslib/htslib/vcf.h",
22 "/project/htslib/htslib/vcfutils.h",
23 "/project/pysam/htslib_util.h"
24 ],
25 "extra_compile_args": [
26 "-Wno-unused",
27 "-Wno-strict-prototypes",
28 "-Wno-sign-compare",
29 "-Wno-error=declaration-after-statement"
30 ],
31 "extra_link_args": [
32 "-Wl,-rpath,$ORIGIN"
33 ],
34 "include_dirs": [
35 "pysam",
36 "/project/pysam",
37 "/project/htslib",
38 "/project/samtools",
39 "/project/samtools/lz4",
40 "/project/bcftools",
41 "/project"
42 ],
43 "language": "c",
44 "libraries": [
45 "z",
46 "lzma",
47 "bz2",
48 "z",
49 "m",
50 "curl",
51 "crypto",
52 "chtslib.cpython-37m-x86_64-linux-gnu",
53 "cutils.cpython-37m-x86_64-linux-gnu"
54 ],
55 "library_dirs": [
56 "/project/pysam",
57 "/project",
58 "build/lib.linux-x86_64-cpython-37/pysam",
59 "build/lib.linux-x86_64-cpython-37/pysam",
60 "build/lib.linux-x86_64-cpython-37/pysam",
61 "build/lib.linux-x86_64-cpython-37/pysam",
62 "build/lib.linux-x86_64-cpython-37/pysam",
63 "build/lib.linux-x86_64-cpython-37/pysam",
64 "build/lib.linux-x86_64-cpython-37/pysam",
65 "build/lib.linux-x86_64-cpython-37/pysam",
66 "build/lib.linux-x86_64-cpython-37/pysam",
67 "build/lib.linux-x86_64-cpython-37/pysam",
68 "build/lib.linux-x86_64-cpython-37/pysam"
69 ],
70 "name": "pysam.libcbgzf",
71 "sources": [
72 "pysam/libcbgzf.pyx"
73 ]
74 },
75 "module_name": "pysam.libcbgzf"
76 }
77 END: Cython Metadata */
78
79 #ifndef PY_SSIZE_T_CLEAN
80 #define PY_SSIZE_T_CLEAN
81 #endif /* PY_SSIZE_T_CLEAN */
82 #if defined(CYTHON_LIMITED_API) && 0
83 #ifndef Py_LIMITED_API
84 #if CYTHON_LIMITED_API+0 > 0x03030000
85 #define Py_LIMITED_API CYTHON_LIMITED_API
86 #else
87 #define Py_LIMITED_API 0x03030000
88 #endif
89 #endif
90 #endif
91
92 #include "Python.h"
93
94 #if PY_MAJOR_VERSION >= 3
95 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj)
96 #else
97 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL)
98 #endif
99
100
101 #if PY_MAJOR_VERSION <= 2
102 #define PyDict_GetItemWithError _PyDict_GetItemWithError
103 #endif
104
105
106 #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get)
107 #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) )
108 #endif
109
110 #ifndef Py_PYTHON_H
111 #error Python headers needed to compile C extensions, please install development version of Python.
112 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
113 #error Cython requires Python 2.7+ or Python 3.3+.
114 #else
115 #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
116 #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
117 #else
118 #define __PYX_EXTRA_ABI_MODULE_NAME ""
119 #endif
120 #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
121 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
122 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
123 #define CYTHON_HEX_VERSION 0x03000BF0
124 #define CYTHON_FUTURE_DIVISION 1
125 #include <stddef.h>
126 #ifndef offsetof
127 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
128 #endif
129 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
130 #ifndef __stdcall
131 #define __stdcall
132 #endif
133 #ifndef __cdecl
134 #define __cdecl
135 #endif
136 #ifndef __fastcall
137 #define __fastcall
138 #endif
139 #endif
140 #ifndef DL_IMPORT
141 #define DL_IMPORT(t) t
142 #endif
143 #ifndef DL_EXPORT
144 #define DL_EXPORT(t) t
145 #endif
146 #define __PYX_COMMA ,
147 #ifndef HAVE_LONG_LONG
148 #define HAVE_LONG_LONG
149 #endif
150 #ifndef PY_LONG_LONG
151 #define PY_LONG_LONG LONG_LONG
152 #endif
153 #ifndef Py_HUGE_VAL
154 #define Py_HUGE_VAL HUGE_VAL
155 #endif
156 #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
157 #if defined(GRAALVM_PYTHON)
158 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
159 The existence of this section does not imply that anything works or is even tested */
160 #define CYTHON_COMPILING_IN_PYPY 0
161 #define CYTHON_COMPILING_IN_CPYTHON 0
162 #define CYTHON_COMPILING_IN_LIMITED_API 0
163 #define CYTHON_COMPILING_IN_GRAAL 1
164 #define CYTHON_COMPILING_IN_NOGIL 0
165 #undef CYTHON_USE_TYPE_SLOTS
166 #define CYTHON_USE_TYPE_SLOTS 0
167 #undef CYTHON_USE_TYPE_SPECS
168 #define CYTHON_USE_TYPE_SPECS 0
169 #undef CYTHON_USE_PYTYPE_LOOKUP
170 #define CYTHON_USE_PYTYPE_LOOKUP 0
171 #if PY_VERSION_HEX < 0x03050000
172 #undef CYTHON_USE_ASYNC_SLOTS
173 #define CYTHON_USE_ASYNC_SLOTS 0
174 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
175 #define CYTHON_USE_ASYNC_SLOTS 1
176 #endif
177 #undef CYTHON_USE_PYLIST_INTERNALS
178 #define CYTHON_USE_PYLIST_INTERNALS 0
179 #undef CYTHON_USE_UNICODE_INTERNALS
180 #define CYTHON_USE_UNICODE_INTERNALS 0
181 #undef CYTHON_USE_UNICODE_WRITER
182 #define CYTHON_USE_UNICODE_WRITER 0
183 #undef CYTHON_USE_PYLONG_INTERNALS
184 #define CYTHON_USE_PYLONG_INTERNALS 0
185 #undef CYTHON_AVOID_BORROWED_REFS
186 #define CYTHON_AVOID_BORROWED_REFS 1
187 #undef CYTHON_ASSUME_SAFE_MACROS
188 #define CYTHON_ASSUME_SAFE_MACROS 0
189 #undef CYTHON_UNPACK_METHODS
190 #define CYTHON_UNPACK_METHODS 0
191 #undef CYTHON_FAST_THREAD_STATE
192 #define CYTHON_FAST_THREAD_STATE 0
193 #undef CYTHON_FAST_GIL
194 #define CYTHON_FAST_GIL 0
195 #undef CYTHON_METH_FASTCALL
196 #define CYTHON_METH_FASTCALL 0
197 #undef CYTHON_FAST_PYCALL
198 #define CYTHON_FAST_PYCALL 0
199 #ifndef CYTHON_PEP487_INIT_SUBCLASS
200 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
201 #endif
202 #undef CYTHON_PEP489_MULTI_PHASE_INIT
203 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
204 #undef CYTHON_USE_MODULE_STATE
205 #define CYTHON_USE_MODULE_STATE 0
206 #undef CYTHON_USE_TP_FINALIZE
207 #define CYTHON_USE_TP_FINALIZE 0
208 #undef CYTHON_USE_DICT_VERSIONS
209 #define CYTHON_USE_DICT_VERSIONS 0
210 #undef CYTHON_USE_EXC_INFO_STACK
211 #define CYTHON_USE_EXC_INFO_STACK 0
212 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
213 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
214 #endif
215 #undef CYTHON_USE_FREELISTS
216 #define CYTHON_USE_FREELISTS 0
217 #elif defined(PYPY_VERSION)
218 #define CYTHON_COMPILING_IN_PYPY 1
219 #define CYTHON_COMPILING_IN_CPYTHON 0
220 #define CYTHON_COMPILING_IN_LIMITED_API 0
221 #define CYTHON_COMPILING_IN_GRAAL 0
222 #define CYTHON_COMPILING_IN_NOGIL 0
223 #undef CYTHON_USE_TYPE_SLOTS
224 #define CYTHON_USE_TYPE_SLOTS 0
225 #ifndef CYTHON_USE_TYPE_SPECS
226 #define CYTHON_USE_TYPE_SPECS 0
227 #endif
228 #undef CYTHON_USE_PYTYPE_LOOKUP
229 #define CYTHON_USE_PYTYPE_LOOKUP 0
230 #if PY_VERSION_HEX < 0x03050000
231 #undef CYTHON_USE_ASYNC_SLOTS
232 #define CYTHON_USE_ASYNC_SLOTS 0
233 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
234 #define CYTHON_USE_ASYNC_SLOTS 1
235 #endif
236 #undef CYTHON_USE_PYLIST_INTERNALS
237 #define CYTHON_USE_PYLIST_INTERNALS 0
238 #undef CYTHON_USE_UNICODE_INTERNALS
239 #define CYTHON_USE_UNICODE_INTERNALS 0
240 #undef CYTHON_USE_UNICODE_WRITER
241 #define CYTHON_USE_UNICODE_WRITER 0
242 #undef CYTHON_USE_PYLONG_INTERNALS
243 #define CYTHON_USE_PYLONG_INTERNALS 0
244 #undef CYTHON_AVOID_BORROWED_REFS
245 #define CYTHON_AVOID_BORROWED_REFS 1
246 #undef CYTHON_ASSUME_SAFE_MACROS
247 #define CYTHON_ASSUME_SAFE_MACROS 0
248 #undef CYTHON_UNPACK_METHODS
249 #define CYTHON_UNPACK_METHODS 0
250 #undef CYTHON_FAST_THREAD_STATE
251 #define CYTHON_FAST_THREAD_STATE 0
252 #undef CYTHON_FAST_GIL
253 #define CYTHON_FAST_GIL 0
254 #undef CYTHON_METH_FASTCALL
255 #define CYTHON_METH_FASTCALL 0
256 #undef CYTHON_FAST_PYCALL
257 #define CYTHON_FAST_PYCALL 0
258 #ifndef CYTHON_PEP487_INIT_SUBCLASS
259 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
260 #endif
261 #if PY_VERSION_HEX < 0x03090000
262 #undef CYTHON_PEP489_MULTI_PHASE_INIT
263 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
264 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
265 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
266 #endif
267 #undef CYTHON_USE_MODULE_STATE
268 #define CYTHON_USE_MODULE_STATE 0
269 #undef CYTHON_USE_TP_FINALIZE
270 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
271 #undef CYTHON_USE_DICT_VERSIONS
272 #define CYTHON_USE_DICT_VERSIONS 0
273 #undef CYTHON_USE_EXC_INFO_STACK
274 #define CYTHON_USE_EXC_INFO_STACK 0
275 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
276 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
277 #endif
278 #undef CYTHON_USE_FREELISTS
279 #define CYTHON_USE_FREELISTS 0
280 #elif defined(CYTHON_LIMITED_API)
281 #ifdef Py_LIMITED_API
282 #undef __PYX_LIMITED_VERSION_HEX
283 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
284 #endif
285 #define CYTHON_COMPILING_IN_PYPY 0
286 #define CYTHON_COMPILING_IN_CPYTHON 0
287 #define CYTHON_COMPILING_IN_LIMITED_API 1
288 #define CYTHON_COMPILING_IN_GRAAL 0
289 #define CYTHON_COMPILING_IN_NOGIL 0
290 #undef CYTHON_CLINE_IN_TRACEBACK
291 #define CYTHON_CLINE_IN_TRACEBACK 0
292 #undef CYTHON_USE_TYPE_SLOTS
293 #define CYTHON_USE_TYPE_SLOTS 0
294 #undef CYTHON_USE_TYPE_SPECS
295 #define CYTHON_USE_TYPE_SPECS 1
296 #undef CYTHON_USE_PYTYPE_LOOKUP
297 #define CYTHON_USE_PYTYPE_LOOKUP 0
298 #undef CYTHON_USE_ASYNC_SLOTS
299 #define CYTHON_USE_ASYNC_SLOTS 0
300 #undef CYTHON_USE_PYLIST_INTERNALS
301 #define CYTHON_USE_PYLIST_INTERNALS 0
302 #undef CYTHON_USE_UNICODE_INTERNALS
303 #define CYTHON_USE_UNICODE_INTERNALS 0
304 #ifndef CYTHON_USE_UNICODE_WRITER
305 #define CYTHON_USE_UNICODE_WRITER 0
306 #endif
307 #undef CYTHON_USE_PYLONG_INTERNALS
308 #define CYTHON_USE_PYLONG_INTERNALS 0
309 #ifndef CYTHON_AVOID_BORROWED_REFS
310 #define CYTHON_AVOID_BORROWED_REFS 0
311 #endif
312 #undef CYTHON_ASSUME_SAFE_MACROS
313 #define CYTHON_ASSUME_SAFE_MACROS 0
314 #undef CYTHON_UNPACK_METHODS
315 #define CYTHON_UNPACK_METHODS 0
316 #undef CYTHON_FAST_THREAD_STATE
317 #define CYTHON_FAST_THREAD_STATE 0
318 #undef CYTHON_FAST_GIL
319 #define CYTHON_FAST_GIL 0
320 #undef CYTHON_METH_FASTCALL
321 #define CYTHON_METH_FASTCALL 0
322 #undef CYTHON_FAST_PYCALL
323 #define CYTHON_FAST_PYCALL 0
324 #ifndef CYTHON_PEP487_INIT_SUBCLASS
325 #define CYTHON_PEP487_INIT_SUBCLASS 1
326 #endif
327 #undef CYTHON_PEP489_MULTI_PHASE_INIT
328 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
329 #undef CYTHON_USE_MODULE_STATE
330 #define CYTHON_USE_MODULE_STATE 1
331 #ifndef CYTHON_USE_TP_FINALIZE
332 #define CYTHON_USE_TP_FINALIZE 0
333 #endif
334 #undef CYTHON_USE_DICT_VERSIONS
335 #define CYTHON_USE_DICT_VERSIONS 0
336 #undef CYTHON_USE_EXC_INFO_STACK
337 #define CYTHON_USE_EXC_INFO_STACK 0
338 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
339 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
340 #endif
341 #undef CYTHON_USE_FREELISTS
342 #define CYTHON_USE_FREELISTS 0
343 #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
344 #define CYTHON_COMPILING_IN_PYPY 0
345 #define CYTHON_COMPILING_IN_CPYTHON 0
346 #define CYTHON_COMPILING_IN_LIMITED_API 0
347 #define CYTHON_COMPILING_IN_GRAAL 0
348 #define CYTHON_COMPILING_IN_NOGIL 1
349 #ifndef CYTHON_USE_TYPE_SLOTS
350 #define CYTHON_USE_TYPE_SLOTS 1
351 #endif
352 #ifndef CYTHON_USE_TYPE_SPECS
353 #define CYTHON_USE_TYPE_SPECS 0
354 #endif
355 #undef CYTHON_USE_PYTYPE_LOOKUP
356 #define CYTHON_USE_PYTYPE_LOOKUP 0
357 #ifndef CYTHON_USE_ASYNC_SLOTS
358 #define CYTHON_USE_ASYNC_SLOTS 1
359 #endif
360 #ifndef CYTHON_USE_PYLONG_INTERNALS
361 #define CYTHON_USE_PYLONG_INTERNALS 0
362 #endif
363 #undef CYTHON_USE_PYLIST_INTERNALS
364 #define CYTHON_USE_PYLIST_INTERNALS 0
365 #ifndef CYTHON_USE_UNICODE_INTERNALS
366 #define CYTHON_USE_UNICODE_INTERNALS 1
367 #endif
368 #undef CYTHON_USE_UNICODE_WRITER
369 #define CYTHON_USE_UNICODE_WRITER 0
370 #ifndef CYTHON_AVOID_BORROWED_REFS
371 #define CYTHON_AVOID_BORROWED_REFS 0
372 #endif
373 #ifndef CYTHON_ASSUME_SAFE_MACROS
374 #define CYTHON_ASSUME_SAFE_MACROS 1
375 #endif
376 #ifndef CYTHON_UNPACK_METHODS
377 #define CYTHON_UNPACK_METHODS 1
378 #endif
379 #undef CYTHON_FAST_THREAD_STATE
380 #define CYTHON_FAST_THREAD_STATE 0
381 #undef CYTHON_FAST_GIL
382 #define CYTHON_FAST_GIL 0
383 #ifndef CYTHON_METH_FASTCALL
384 #define CYTHON_METH_FASTCALL 1
385 #endif
386 #undef CYTHON_FAST_PYCALL
387 #define CYTHON_FAST_PYCALL 0
388 #ifndef CYTHON_PEP487_INIT_SUBCLASS
389 #define CYTHON_PEP487_INIT_SUBCLASS 1
390 #endif
391 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
392 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
393 #endif
394 #ifndef CYTHON_USE_MODULE_STATE
395 #define CYTHON_USE_MODULE_STATE 0
396 #endif
397 #ifndef CYTHON_USE_TP_FINALIZE
398 #define CYTHON_USE_TP_FINALIZE 1
399 #endif
400 #undef CYTHON_USE_DICT_VERSIONS
401 #define CYTHON_USE_DICT_VERSIONS 0
402 #undef CYTHON_USE_EXC_INFO_STACK
403 #define CYTHON_USE_EXC_INFO_STACK 0
404 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
405 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
406 #endif
407 #ifndef CYTHON_USE_FREELISTS
408 #define CYTHON_USE_FREELISTS 0
409 #endif
410 #else
411 #define CYTHON_COMPILING_IN_PYPY 0
412 #define CYTHON_COMPILING_IN_CPYTHON 1
413 #define CYTHON_COMPILING_IN_LIMITED_API 0
414 #define CYTHON_COMPILING_IN_GRAAL 0
415 #define CYTHON_COMPILING_IN_NOGIL 0
416 #ifndef CYTHON_USE_TYPE_SLOTS
417 #define CYTHON_USE_TYPE_SLOTS 1
418 #endif
419 #ifndef CYTHON_USE_TYPE_SPECS
420 #define CYTHON_USE_TYPE_SPECS 0
421 #endif
422 #ifndef CYTHON_USE_PYTYPE_LOOKUP
423 #define CYTHON_USE_PYTYPE_LOOKUP 1
424 #endif
425 #if PY_MAJOR_VERSION < 3
426 #undef CYTHON_USE_ASYNC_SLOTS
427 #define CYTHON_USE_ASYNC_SLOTS 0
428 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
429 #define CYTHON_USE_ASYNC_SLOTS 1
430 #endif
431 #ifndef CYTHON_USE_PYLONG_INTERNALS
432 #define CYTHON_USE_PYLONG_INTERNALS 1
433 #endif
434 #ifndef CYTHON_USE_PYLIST_INTERNALS
435 #define CYTHON_USE_PYLIST_INTERNALS 1
436 #endif
437 #ifndef CYTHON_USE_UNICODE_INTERNALS
438 #define CYTHON_USE_UNICODE_INTERNALS 1
439 #endif
440 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
441 #undef CYTHON_USE_UNICODE_WRITER
442 #define CYTHON_USE_UNICODE_WRITER 0
443 #elif !defined(CYTHON_USE_UNICODE_WRITER)
444 #define CYTHON_USE_UNICODE_WRITER 1
445 #endif
446 #ifndef CYTHON_AVOID_BORROWED_REFS
447 #define CYTHON_AVOID_BORROWED_REFS 0
448 #endif
449 #ifndef CYTHON_ASSUME_SAFE_MACROS
450 #define CYTHON_ASSUME_SAFE_MACROS 1
451 #endif
452 #ifndef CYTHON_UNPACK_METHODS
453 #define CYTHON_UNPACK_METHODS 1
454 #endif
455 #ifndef CYTHON_FAST_THREAD_STATE
456 #define CYTHON_FAST_THREAD_STATE 1
457 #endif
458 #ifndef CYTHON_FAST_GIL
459 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
460 #endif
461 #ifndef CYTHON_METH_FASTCALL
462 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
463 #endif
464 #ifndef CYTHON_FAST_PYCALL
465 #define CYTHON_FAST_PYCALL 1
466 #endif
467 #ifndef CYTHON_PEP487_INIT_SUBCLASS
468 #define CYTHON_PEP487_INIT_SUBCLASS 1
469 #endif
470 #if PY_VERSION_HEX < 0x03050000
471 #undef CYTHON_PEP489_MULTI_PHASE_INIT
472 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
473 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
474 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
475 #endif
476 #ifndef CYTHON_USE_MODULE_STATE
477 #define CYTHON_USE_MODULE_STATE 0
478 #endif
479 #if PY_VERSION_HEX < 0x030400a1
480 #undef CYTHON_USE_TP_FINALIZE
481 #define CYTHON_USE_TP_FINALIZE 0
482 #elif !defined(CYTHON_USE_TP_FINALIZE)
483 #define CYTHON_USE_TP_FINALIZE 1
484 #endif
485 #if PY_VERSION_HEX < 0x030600B1
486 #undef CYTHON_USE_DICT_VERSIONS
487 #define CYTHON_USE_DICT_VERSIONS 0
488 #elif !defined(CYTHON_USE_DICT_VERSIONS)
489 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
490 #endif
491 #if PY_VERSION_HEX < 0x030700A3
492 #undef CYTHON_USE_EXC_INFO_STACK
493 #define CYTHON_USE_EXC_INFO_STACK 0
494 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
495 #define CYTHON_USE_EXC_INFO_STACK 1
496 #endif
497 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
498 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
499 #endif
500 #ifndef CYTHON_USE_FREELISTS
501 #define CYTHON_USE_FREELISTS 1
502 #endif
503 #endif
504 #if !defined(CYTHON_FAST_PYCCALL)
505 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
506 #endif
507 #if !defined(CYTHON_VECTORCALL)
508 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
509 #endif
510 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
511 #if CYTHON_USE_PYLONG_INTERNALS
512 #if PY_MAJOR_VERSION < 3
513 #include "longintrepr.h"
514 #endif
515 #undef SHIFT
516 #undef BASE
517 #undef MASK
518 #ifdef SIZEOF_VOID_P
519 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
520 #endif
521 #endif
522 #ifndef __has_attribute
523 #define __has_attribute(x) 0
524 #endif
525 #ifndef __has_cpp_attribute
526 #define __has_cpp_attribute(x) 0
527 #endif
528 #ifndef CYTHON_RESTRICT
529 #if defined(__GNUC__)
530 #define CYTHON_RESTRICT __restrict__
531 #elif defined(_MSC_VER) && _MSC_VER >= 1400
532 #define CYTHON_RESTRICT __restrict
533 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
534 #define CYTHON_RESTRICT restrict
535 #else
536 #define CYTHON_RESTRICT
537 #endif
538 #endif
539 #ifndef CYTHON_UNUSED
540 #if defined(__cplusplus)
541 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
542 * but leads to warnings with -pedantic, since it is a C++17 feature */
543 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
544 #if __has_cpp_attribute(maybe_unused)
545 #define CYTHON_UNUSED [[maybe_unused]]
546 #endif
547 #endif
548 #endif
549 #endif
550 #ifndef CYTHON_UNUSED
551 # if defined(__GNUC__)
552 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
553 # define CYTHON_UNUSED __attribute__ ((__unused__))
554 # else
555 # define CYTHON_UNUSED
556 # endif
557 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
558 # define CYTHON_UNUSED __attribute__ ((__unused__))
559 # else
560 # define CYTHON_UNUSED
561 # endif
562 #endif
563 #ifndef CYTHON_UNUSED_VAR
564 # if defined(__cplusplus)
565 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
566 # else
567 # define CYTHON_UNUSED_VAR(x) (void)(x)
568 # endif
569 #endif
570 #ifndef CYTHON_MAYBE_UNUSED_VAR
571 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
572 #endif
573 #ifndef CYTHON_NCP_UNUSED
574 # if CYTHON_COMPILING_IN_CPYTHON
575 # define CYTHON_NCP_UNUSED
576 # else
577 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
578 # endif
579 #endif
580 #ifndef CYTHON_USE_CPP_STD_MOVE
581 #if defined(__cplusplus) && (\
582 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
583 #define CYTHON_USE_CPP_STD_MOVE 1
584 #else
585 #define CYTHON_USE_CPP_STD_MOVE 0
586 #endif
587 #endif
588 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
589 #ifdef _MSC_VER
590 #ifndef _MSC_STDINT_H_
591 #if _MSC_VER < 1300
592 typedef unsigned char uint8_t;
593 typedef unsigned short uint16_t;
594 typedef unsigned int uint32_t;
595 #else
596 typedef unsigned __int8 uint8_t;
597 typedef unsigned __int16 uint16_t;
598 typedef unsigned __int32 uint32_t;
599 #endif
600 #endif
601 #if _MSC_VER < 1300
602 #ifdef _WIN64
603 typedef unsigned long long __pyx_uintptr_t;
604 #else
605 typedef unsigned int __pyx_uintptr_t;
606 #endif
607 #else
608 #ifdef _WIN64
609 typedef unsigned __int64 __pyx_uintptr_t;
610 #else
611 typedef unsigned __int32 __pyx_uintptr_t;
612 #endif
613 #endif
614 #else
615 #include <stdint.h>
616 typedef uintptr_t __pyx_uintptr_t;
617 #endif
618 #ifndef CYTHON_FALLTHROUGH
619 #if defined(__cplusplus)
620 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
621 * but leads to warnings with -pedantic, since it is a C++17 feature */
622 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
623 #if __has_cpp_attribute(fallthrough)
624 #define CYTHON_FALLTHROUGH [[fallthrough]]
625 #endif
626 #endif
627 #ifndef CYTHON_FALLTHROUGH
628 #if __has_cpp_attribute(clang::fallthrough)
629 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
630 #elif __has_cpp_attribute(gnu::fallthrough)
631 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
632 #endif
633 #endif
634 #endif
635 #ifndef CYTHON_FALLTHROUGH
636 #if __has_attribute(fallthrough)
637 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
638 #else
639 #define CYTHON_FALLTHROUGH
640 #endif
641 #endif
642 #if defined(__clang__) && defined(__apple_build_version__)
643 #if __apple_build_version__ < 7000000
644 #undef CYTHON_FALLTHROUGH
645 #define CYTHON_FALLTHROUGH
646 #endif
647 #endif
648 #endif
649 #ifdef __cplusplus
650 template <typename T>
651 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
652 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
653 #else
654 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
655 #endif
656 #if CYTHON_COMPILING_IN_PYPY == 1
657 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
658 #else
659 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
660 #endif
661 #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
662
663 #ifndef CYTHON_INLINE
664 #if defined(__clang__)
665 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
666 #elif defined(__GNUC__)
667 #define CYTHON_INLINE __inline__
668 #elif defined(_MSC_VER)
669 #define CYTHON_INLINE __inline
670 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
671 #define CYTHON_INLINE inline
672 #else
673 #define CYTHON_INLINE
674 #endif
675 #endif
676
677 #define __PYX_BUILD_PY_SSIZE_T "n"
678 #define CYTHON_FORMAT_SSIZE_T "z"
679 #if PY_MAJOR_VERSION < 3
680 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
681 #define __Pyx_DefaultClassType PyClass_Type
682 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
683 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
684 #else
685 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
686 #define __Pyx_DefaultClassType PyType_Type
687 #if CYTHON_COMPILING_IN_LIMITED_API
688 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
689 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
690 PyObject *fv, PyObject *cell, PyObject* fn,
691 PyObject *name, int fline, PyObject *lnos) {
692 PyObject *exception_table = NULL;
693 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
694 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
695 PyObject *version_info;
696 PyObject *py_minor_version = NULL;
697 #endif
698 long minor_version = 0;
699 PyObject *type, *value, *traceback;
700 PyErr_Fetch(&type, &value, &traceback);
701 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
702 minor_version = 11;
703 #else
704 if (!(version_info = PySys_GetObject("version_info"))) goto end;
705 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
706 minor_version = PyLong_AsLong(py_minor_version);
707 Py_DECREF(py_minor_version);
708 if (minor_version == -1 && PyErr_Occurred()) goto end;
709 #endif
710 if (!(types_module = PyImport_ImportModule("types"))) goto end;
711 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
712 if (minor_version <= 7) {
713 (void)p;
714 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
715 c, n, v, fn, name, fline, lnos, fv, cell);
716 } else if (minor_version <= 10) {
717 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
718 c, n, v, fn, name, fline, lnos, fv, cell);
719 } else {
720 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
721 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
722 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
723 }
724 end:
725 Py_XDECREF(code_type);
726 Py_XDECREF(exception_table);
727 Py_XDECREF(types_module);
728 if (type) {
729 PyErr_Restore(type, value, traceback);
730 }
731 return result;
732 }
733 #ifndef CO_OPTIMIZED
734 #define CO_OPTIMIZED 0x0001
735 #endif
736 #ifndef CO_NEWLOCALS
737 #define CO_NEWLOCALS 0x0002
738 #endif
739 #ifndef CO_VARARGS
740 #define CO_VARARGS 0x0004
741 #endif
742 #ifndef CO_VARKEYWORDS
743 #define CO_VARKEYWORDS 0x0008
744 #endif
745 #ifndef CO_ASYNC_GENERATOR
746 #define CO_ASYNC_GENERATOR 0x0200
747 #endif
748 #ifndef CO_GENERATOR
749 #define CO_GENERATOR 0x0020
750 #endif
751 #ifndef CO_COROUTINE
752 #define CO_COROUTINE 0x0080
753 #endif
754 #elif PY_VERSION_HEX >= 0x030B0000
755 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
756 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
757 PyObject *fv, PyObject *cell, PyObject* fn,
758 PyObject *name, int fline, PyObject *lnos) {
759 PyCodeObject *result;
760 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
761 if (!empty_bytes) return NULL;
762 result =
763 #if PY_VERSION_HEX >= 0x030C0000
764 PyUnstable_Code_NewWithPosOnlyArgs
765 #else
766 PyCode_NewWithPosOnlyArgs
767 #endif
768 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
769 Py_DECREF(empty_bytes);
770 return result;
771 }
772 #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
773 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
774 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
775 #else
776 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
777 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
778 #endif
779 #endif
780 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
781 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
782 #else
783 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
784 #endif
785 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
786 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
787 #else
788 #define __Pyx_Py_Is(x, y) ((x) == (y))
789 #endif
790 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
791 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
792 #else
793 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
794 #endif
795 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
796 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
797 #else
798 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
799 #endif
800 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
801 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
802 #else
803 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
804 #endif
805 #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
806 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
807 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
808 #else
809 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
810 #endif
811 #ifndef CO_COROUTINE
812 #define CO_COROUTINE 0x80
813 #endif
814 #ifndef CO_ASYNC_GENERATOR
815 #define CO_ASYNC_GENERATOR 0x200
816 #endif
817 #ifndef Py_TPFLAGS_CHECKTYPES
818 #define Py_TPFLAGS_CHECKTYPES 0
819 #endif
820 #ifndef Py_TPFLAGS_HAVE_INDEX
821 #define Py_TPFLAGS_HAVE_INDEX 0
822 #endif
823 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
824 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
825 #endif
826 #ifndef Py_TPFLAGS_HAVE_FINALIZE
827 #define Py_TPFLAGS_HAVE_FINALIZE 0
828 #endif
829 #ifndef Py_TPFLAGS_SEQUENCE
830 #define Py_TPFLAGS_SEQUENCE 0
831 #endif
832 #ifndef Py_TPFLAGS_MAPPING
833 #define Py_TPFLAGS_MAPPING 0
834 #endif
835 #ifndef METH_STACKLESS
836 #define METH_STACKLESS 0
837 #endif
838 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
839 #ifndef METH_FASTCALL
840 #define METH_FASTCALL 0x80
841 #endif
842 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
843 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
844 Py_ssize_t nargs, PyObject *kwnames);
845 #else
846 #if PY_VERSION_HEX >= 0x030d00A4
847 # define __Pyx_PyCFunctionFast PyCFunctionFast
848 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
849 #else
850 # define __Pyx_PyCFunctionFast _PyCFunctionFast
851 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
852 #endif
853 #endif
854 #if CYTHON_METH_FASTCALL
855 #define __Pyx_METH_FASTCALL METH_FASTCALL
856 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
857 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
858 #else
859 #define __Pyx_METH_FASTCALL METH_VARARGS
860 #define __Pyx_PyCFunction_FastCall PyCFunction
861 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
862 #endif
863 #if CYTHON_VECTORCALL
864 #define __pyx_vectorcallfunc vectorcallfunc
865 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
866 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
867 #elif CYTHON_BACKPORT_VECTORCALL
868 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
869 size_t nargsf, PyObject *kwnames);
870 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
871 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
872 #else
873 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
874 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
875 #endif
876 #if PY_MAJOR_VERSION >= 0x030900B1
877 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
878 #else
879 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
880 #endif
881 #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
882 #if CYTHON_COMPILING_IN_CPYTHON
883 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
884 #elif !CYTHON_COMPILING_IN_LIMITED_API
885 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
886 #endif
887 #if CYTHON_COMPILING_IN_CPYTHON
888 #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
889 static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
890 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
891 }
892 #endif
893 static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
894 #if CYTHON_COMPILING_IN_LIMITED_API
895 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
896 #else
897 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
898 #endif
899 }
900 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
901 #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
902 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
903 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
904 #else
905 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
906 #define __Pyx_PyCMethod PyCMethod
907 #endif
908 #ifndef METH_METHOD
909 #define METH_METHOD 0x200
910 #endif
911 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
912 #define PyObject_Malloc(s) PyMem_Malloc(s)
913 #define PyObject_Free(p) PyMem_Free(p)
914 #define PyObject_Realloc(p) PyMem_Realloc(p)
915 #endif
916 #if CYTHON_COMPILING_IN_LIMITED_API
917 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
918 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
919 #else
920 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
921 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
922 #endif
923 #if CYTHON_COMPILING_IN_LIMITED_API
924 #define __Pyx_PyThreadState_Current PyThreadState_Get()
925 #elif !CYTHON_FAST_THREAD_STATE
926 #define __Pyx_PyThreadState_Current PyThreadState_GET()
927 #elif PY_VERSION_HEX >= 0x030d00A1
928 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
929 #elif PY_VERSION_HEX >= 0x03060000
930 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
931 #elif PY_VERSION_HEX >= 0x03000000
932 #define __Pyx_PyThreadState_Current PyThreadState_GET()
933 #else
934 #define __Pyx_PyThreadState_Current _PyThreadState_Current
935 #endif
936 #if CYTHON_COMPILING_IN_LIMITED_API
937 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
938 {
939 void *result;
940 result = PyModule_GetState(op);
941 if (!result)
942 Py_FatalError("Couldn't find the module state");
943 return result;
944 }
945 #endif
946 #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
947 #if CYTHON_COMPILING_IN_LIMITED_API
948 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
949 #else
950 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
951 #endif
952 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
953 #include "pythread.h"
954 #define Py_tss_NEEDS_INIT 0
955 typedef int Py_tss_t;
956 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
957 *key = PyThread_create_key();
958 return 0;
959 }
960 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
961 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
962 *key = Py_tss_NEEDS_INIT;
963 return key;
964 }
965 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
966 PyObject_Free(key);
967 }
968 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
969 return *key != Py_tss_NEEDS_INIT;
970 }
971 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
972 PyThread_delete_key(*key);
973 *key = Py_tss_NEEDS_INIT;
974 }
975 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
976 return PyThread_set_key_value(*key, value);
977 }
978 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
979 return PyThread_get_key_value(*key);
980 }
981 #endif
982 #if PY_MAJOR_VERSION < 3
983 #if CYTHON_COMPILING_IN_PYPY
984 #if PYPY_VERSION_NUM < 0x07030600
985 #if defined(__cplusplus) && __cplusplus >= 201402L
986 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
987 #elif defined(__GNUC__) || defined(__clang__)
988 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
989 #elif defined(_MSC_VER)
990 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
991 #endif
992 static CYTHON_INLINE int PyGILState_Check(void) {
993 return 0;
994 }
995 #else // PYPY_VERSION_NUM < 0x07030600
996 #endif // PYPY_VERSION_NUM < 0x07030600
997 #else
998 static CYTHON_INLINE int PyGILState_Check(void) {
999 PyThreadState * tstate = _PyThreadState_Current;
1000 return tstate && (tstate == PyGILState_GetThisThreadState());
1001 }
1002 #endif
1003 #endif
1004 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
1005 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
1006 #else
1007 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
1008 #endif
1009 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
1010 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
1011 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
1012 #else
1013 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
1014 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
1015 #endif
1016 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
1017 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
1018 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
1019 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
1020 if (res == NULL) PyErr_Clear();
1021 return res;
1022 }
1023 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
1024 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
1025 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
1026 #else
1027 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
1028 #if CYTHON_COMPILING_IN_PYPY
1029 return PyDict_GetItem(dict, name);
1030 #else
1031 PyDictEntry *ep;
1032 PyDictObject *mp = (PyDictObject*) dict;
1033 long hash = ((PyStringObject *) name)->ob_shash;
1034 assert(hash != -1);
1035 ep = (mp->ma_lookup)(mp, name, hash);
1036 if (ep == NULL) {
1037 return NULL;
1038 }
1039 return ep->me_value;
1040 #endif
1041 }
1042 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
1043 #endif
1044 #if CYTHON_USE_TYPE_SLOTS
1045 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
1046 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
1047 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
1048 #else
1049 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
1050 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
1051 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
1052 #endif
1053 #if CYTHON_COMPILING_IN_LIMITED_API
1054 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
1055 #else
1056 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
1057 #endif
1058 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
1059 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
1060 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
1061 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
1062 PyObject_GC_Del(obj);\
1063 Py_DECREF(type);\
1064 }
1065 #else
1066 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
1067 #endif
1068 #if CYTHON_COMPILING_IN_LIMITED_API
1069 #define CYTHON_PEP393_ENABLED 1
1070 #define __Pyx_PyUnicode_READY(op) (0)
1071 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
1072 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
1073 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
1074 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
1075 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
1076 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
1077 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
1078 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
1079 #define CYTHON_PEP393_ENABLED 1
1080 #if PY_VERSION_HEX >= 0x030C0000
1081 #define __Pyx_PyUnicode_READY(op) (0)
1082 #else
1083 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1084 0 : _PyUnicode_Ready((PyObject *)(op)))
1085 #endif
1086 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
1087 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1088 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1089 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1090 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1091 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1092 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1093 #if PY_VERSION_HEX >= 0x030C0000
1094 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1095 #else
1096 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1097 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1098 #else
1099 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1100 #endif
1101 #endif
1102 #else
1103 #define CYTHON_PEP393_ENABLED 0
1104 #define PyUnicode_1BYTE_KIND 1
1105 #define PyUnicode_2BYTE_KIND 2
1106 #define PyUnicode_4BYTE_KIND 4
1107 #define __Pyx_PyUnicode_READY(op) (0)
1108 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
1109 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
1110 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
1111 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
1112 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
1113 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
1114 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
1115 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
1116 #endif
1117 #if CYTHON_COMPILING_IN_PYPY
1118 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1119 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1120 #else
1121 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1122 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
1123 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1124 #endif
1125 #if CYTHON_COMPILING_IN_PYPY
1126 #if !defined(PyUnicode_DecodeUnicodeEscape)
1127 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1128 #endif
1129 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
1130 #undef PyUnicode_Contains
1131 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1132 #endif
1133 #if !defined(PyByteArray_Check)
1134 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1135 #endif
1136 #if !defined(PyObject_Format)
1137 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1138 #endif
1139 #endif
1140 #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))
1141 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1142 #if PY_MAJOR_VERSION >= 3
1143 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
1144 #else
1145 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1146 #endif
1147 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1148 #define PyObject_ASCII(o) PyObject_Repr(o)
1149 #endif
1150 #if PY_MAJOR_VERSION >= 3
1151 #define PyBaseString_Type PyUnicode_Type
1152 #define PyStringObject PyUnicodeObject
1153 #define PyString_Type PyUnicode_Type
1154 #define PyString_Check PyUnicode_Check
1155 #define PyString_CheckExact PyUnicode_CheckExact
1156 #ifndef PyObject_Unicode
1157 #define PyObject_Unicode PyObject_Str
1158 #endif
1159 #endif
1160 #if PY_MAJOR_VERSION >= 3
1161 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1162 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1163 #else
1164 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1165 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1166 #endif
1167 #if CYTHON_COMPILING_IN_CPYTHON
1168 #define __Pyx_PySequence_ListKeepNew(obj)\
1169 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1170 #else
1171 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1172 #endif
1173 #ifndef PySet_CheckExact
1174 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1175 #endif
1176 #if PY_VERSION_HEX >= 0x030900A4
1177 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1178 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1179 #else
1180 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1181 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1182 #endif
1183 #if CYTHON_ASSUME_SAFE_MACROS
1184 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1185 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1186 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1187 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1188 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1189 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1190 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1191 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1192 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1193 #else
1194 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1195 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1196 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1197 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1198 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1199 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1200 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1201 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1202 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1203 #endif
1204 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1205 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1206 #else
1207 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1208 PyObject *module = PyImport_AddModule(name);
1209 Py_XINCREF(module);
1210 return module;
1211 }
1212 #endif
1213 #if PY_MAJOR_VERSION >= 3
1214 #define PyIntObject PyLongObject
1215 #define PyInt_Type PyLong_Type
1216 #define PyInt_Check(op) PyLong_Check(op)
1217 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
1218 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
1219 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
1220 #define PyInt_FromString PyLong_FromString
1221 #define PyInt_FromUnicode PyLong_FromUnicode
1222 #define PyInt_FromLong PyLong_FromLong
1223 #define PyInt_FromSize_t PyLong_FromSize_t
1224 #define PyInt_FromSsize_t PyLong_FromSsize_t
1225 #define PyInt_AsLong PyLong_AsLong
1226 #define PyInt_AS_LONG PyLong_AS_LONG
1227 #define PyInt_AsSsize_t PyLong_AsSsize_t
1228 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
1229 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
1230 #define PyNumber_Int PyNumber_Long
1231 #else
1232 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1233 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1234 #endif
1235 #if PY_MAJOR_VERSION >= 3
1236 #define PyBoolObject PyLongObject
1237 #endif
1238 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1239 #ifndef PyUnicode_InternFromString
1240 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1241 #endif
1242 #endif
1243 #if PY_VERSION_HEX < 0x030200A4
1244 typedef long Py_hash_t;
1245 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
1246 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
1247 #else
1248 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1249 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1250 #endif
1251 #if CYTHON_USE_ASYNC_SLOTS
1252 #if PY_VERSION_HEX >= 0x030500B1
1253 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1254 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
1255 #else
1256 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1257 #endif
1258 #else
1259 #define __Pyx_PyType_AsAsync(obj) NULL
1260 #endif
1261 #ifndef __Pyx_PyAsyncMethodsStruct
1262 typedef struct {
1263 unaryfunc am_await;
1264 unaryfunc am_aiter;
1265 unaryfunc am_anext;
1266 } __Pyx_PyAsyncMethodsStruct;
1267 #endif
1268
1269 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1270 #if !defined(_USE_MATH_DEFINES)
1271 #define _USE_MATH_DEFINES
1272 #endif
1273 #endif
1274 #include <math.h>
1275 #ifdef NAN
1276 #define __PYX_NAN() ((float) NAN)
1277 #else
1278 static CYTHON_INLINE float __PYX_NAN() {
1279 float value;
1280 memset(&value, 0xFF, sizeof(value));
1281 return value;
1282 }
1283 #endif
1284 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1285 #define __Pyx_truncl trunc
1286 #else
1287 #define __Pyx_truncl truncl
1288 #endif
1289
1290 #define __PYX_MARK_ERR_POS(f_index, lineno) \
1291 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
1292 #define __PYX_ERR(f_index, lineno, Ln_error) \
1293 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1294
1295 #ifdef CYTHON_EXTERN_C
1296 #undef __PYX_EXTERN_C
1297 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1298 #elif defined(__PYX_EXTERN_C)
1299 #ifdef _MSC_VER
1300 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1301 #else
1302 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1303 #endif
1304 #else
1305 #ifdef __cplusplus
1306 #define __PYX_EXTERN_C extern "C"
1307 #else
1308 #define __PYX_EXTERN_C extern
1309 #endif
1310 #endif
1311
1312 #define __PYX_HAVE__pysam__libcbgzf
1313 #define __PYX_HAVE_API__pysam__libcbgzf
1314 /* Early includes */
1315 #include <stdint.h>
1316 #include <string.h>
1317 #include <stdlib.h>
1318 #include <stdio.h>
1319 #include <sys/types.h>
1320 #include "stdarg.h"
1321 #include "htslib/kstring.h"
1322 #include "htslib_util.h"
1323 #include "htslib/hfile.h"
1324 #include "htslib/bgzf.h"
1325 #include "htslib/hts.h"
1326 #include "htslib/sam.h"
1327 #include "htslib/faidx.h"
1328 #include "htslib/tbx.h"
1329 #include "htslib/vcf.h"
1330 #include "htslib/vcfutils.h"
1331 #include "htslib/cram.h"
1332 #include <stddef.h>
1333 #include "pythread.h"
1334
1335 #if CYTHON_COMPILING_IN_PYPY
1336 #ifdef _MSC_VER
1337 #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy.")
1338 #else
1339 #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy.
1340 #endif
1341 #endif
1342
1343 #ifdef _OPENMP
1344 #include <omp.h>
1345 #endif /* _OPENMP */
1346
1347 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1348 #define CYTHON_WITHOUT_ASSERTIONS
1349 #endif
1350
1351 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
1352 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
1353
1354 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1355 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1356 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
1357 #define __PYX_DEFAULT_STRING_ENCODING ""
1358 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1359 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1360 #define __Pyx_uchar_cast(c) ((unsigned char)c)
1361 #define __Pyx_long_cast(x) ((long)x)
1362 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1363 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1364 (sizeof(type) > sizeof(Py_ssize_t) &&\
1365 likely(v < (type)PY_SSIZE_T_MAX ||\
1366 v == (type)PY_SSIZE_T_MAX) &&\
1367 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1368 v == (type)PY_SSIZE_T_MIN))) ||\
1369 (sizeof(type) == sizeof(Py_ssize_t) &&\
1370 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1371 v == (type)PY_SSIZE_T_MAX))) )
1372 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1373 return (size_t) i < (size_t) limit;
1374 }
1375 #if defined (__cplusplus) && __cplusplus >= 201103L
1376 #include <cstdlib>
1377 #define __Pyx_sst_abs(value) std::abs(value)
1378 #elif SIZEOF_INT >= SIZEOF_SIZE_T
1379 #define __Pyx_sst_abs(value) abs(value)
1380 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
1381 #define __Pyx_sst_abs(value) labs(value)
1382 #elif defined (_MSC_VER)
1383 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1384 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1385 #define __Pyx_sst_abs(value) llabs(value)
1386 #elif defined (__GNUC__)
1387 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1388 #else
1389 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1390 #endif
1391 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
1392 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
1393 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1394 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
1395 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1396 #define __Pyx_PyBytes_FromString PyBytes_FromString
1397 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1398 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
1399 #if PY_MAJOR_VERSION < 3
1400 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1401 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1402 #else
1403 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1404 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1405 #endif
1406 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1407 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1408 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1409 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1410 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1411 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1412 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1413 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1414 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1415 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1416 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1417 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1418 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1419 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1420 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1421 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1422 #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1423 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1424 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1425 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1426 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
1427 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
1428 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1429 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1430 #define __Pyx_PySequence_Tuple(obj)\
1431 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1432 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1433 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
1434 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1435 #if CYTHON_ASSUME_SAFE_MACROS
1436 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1437 #else
1438 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1439 #endif
1440 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1441 #if PY_MAJOR_VERSION >= 3
1442 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1443 #else
1444 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1445 #endif
1446 #if CYTHON_USE_PYLONG_INTERNALS
1447 #if PY_VERSION_HEX >= 0x030C00A7
1448 #ifndef _PyLong_SIGN_MASK
1449 #define _PyLong_SIGN_MASK 3
1450 #endif
1451 #ifndef _PyLong_NON_SIZE_BITS
1452 #define _PyLong_NON_SIZE_BITS 3
1453 #endif
1454 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1455 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1456 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1457 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1458 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1459 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1460 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1461 #define __Pyx_PyLong_SignedDigitCount(x)\
1462 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1463 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1464 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1465 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1466 #else
1467 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1468 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1469 #endif
1470 typedef Py_ssize_t __Pyx_compact_pylong;
1471 typedef size_t __Pyx_compact_upylong;
1472 #else
1473 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1474 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1475 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1476 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1477 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1478 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1479 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1480 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1481 #define __Pyx_PyLong_CompactValue(x)\
1482 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1483 typedef sdigit __Pyx_compact_pylong;
1484 typedef digit __Pyx_compact_upylong;
1485 #endif
1486 #if PY_VERSION_HEX >= 0x030C00A5
1487 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1488 #else
1489 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1490 #endif
1491 #endif
1492 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1493 #include <string.h>
1494 static int __Pyx_sys_getdefaultencoding_not_ascii;
1495 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1496 PyObject* sys;
1497 PyObject* default_encoding = NULL;
1498 PyObject* ascii_chars_u = NULL;
1499 PyObject* ascii_chars_b = NULL;
1500 const char* default_encoding_c;
1501 sys = PyImport_ImportModule("sys");
1502 if (!sys) goto bad;
1503 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1504 Py_DECREF(sys);
1505 if (!default_encoding) goto bad;
1506 default_encoding_c = PyBytes_AsString(default_encoding);
1507 if (!default_encoding_c) goto bad;
1508 if (strcmp(default_encoding_c, "ascii") == 0) {
1509 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1510 } else {
1511 char ascii_chars[128];
1512 int c;
1513 for (c = 0; c < 128; c++) {
1514 ascii_chars[c] = (char) c;
1515 }
1516 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1517 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1518 if (!ascii_chars_u) goto bad;
1519 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1520 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1521 PyErr_Format(
1522 PyExc_ValueError,
1523 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1524 default_encoding_c);
1525 goto bad;
1526 }
1527 Py_DECREF(ascii_chars_u);
1528 Py_DECREF(ascii_chars_b);
1529 }
1530 Py_DECREF(default_encoding);
1531 return 0;
1532 bad:
1533 Py_XDECREF(default_encoding);
1534 Py_XDECREF(ascii_chars_u);
1535 Py_XDECREF(ascii_chars_b);
1536 return -1;
1537 }
1538 #endif
1539 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1540 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1541 #else
1542 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1543 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1544 #include <string.h>
1545 static char* __PYX_DEFAULT_STRING_ENCODING;
1546 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1547 PyObject* sys;
1548 PyObject* default_encoding = NULL;
1549 char* default_encoding_c;
1550 sys = PyImport_ImportModule("sys");
1551 if (!sys) goto bad;
1552 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1553 Py_DECREF(sys);
1554 if (!default_encoding) goto bad;
1555 default_encoding_c = PyBytes_AsString(default_encoding);
1556 if (!default_encoding_c) goto bad;
1557 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1558 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1559 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1560 Py_DECREF(default_encoding);
1561 return 0;
1562 bad:
1563 Py_XDECREF(default_encoding);
1564 return -1;
1565 }
1566 #endif
1567 #endif
1568
1569
1570 /* Test for GCC > 2.95 */
1571 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1572 #define likely(x) __builtin_expect(!!(x), 1)
1573 #define unlikely(x) __builtin_expect(!!(x), 0)
1574 #else /* !__GNUC__ or GCC < 2.95 */
1575 #define likely(x) (x)
1576 #define unlikely(x) (x)
1577 #endif /* __GNUC__ */
1578 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1579
1580 #if !CYTHON_USE_MODULE_STATE
1581 static PyObject *__pyx_m = NULL;
1582 #endif
1583 static int __pyx_lineno;
1584 static int __pyx_clineno = 0;
1585 static const char * __pyx_cfilenm = __FILE__;
1586 static const char *__pyx_filename;
1587
1588 /* #### Code section: filename_table ### */
1589
1590 static const char *__pyx_f[] = {
1591 "pysam/libcbgzf.pyx",
1592 "<stringsource>",
1593 "contextvars.pxd",
1594 "array.pxd",
1595 "pysam/libchtslib.pxd",
1596 "type.pxd",
1597 "bool.pxd",
1598 "complex.pxd",
1599 };
1600 /* #### Code section: utility_code_proto_before_types ### */
1601 /* ForceInitThreads.proto */
1602 #ifndef __PYX_FORCE_INIT_THREADS
1603 #define __PYX_FORCE_INIT_THREADS 0
1604 #endif
1605
1606 /* #### Code section: numeric_typedefs ### */
1607 /* #### Code section: complex_type_declarations ### */
1608 /* #### Code section: type_declarations ### */
1609
1610 /*--- Type declarations ---*/
1611 #ifndef _ARRAYARRAY_H
1612 struct arrayobject;
1613 typedef struct arrayobject arrayobject;
1614 #endif
1615 struct __pyx_obj_5pysam_10libchtslib_HTSFile;
1616 struct __pyx_obj_5pysam_8libcbgzf_BGZFile;
1617 struct __pyx_opt_args_7cpython_11contextvars_get_value;
1618 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;
1619
1620 /* "cpython/contextvars.pxd":112
1621 *
1622 *
1623 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
1624 * """Return a new reference to the value of the context variable,
1625 * or the default value of the context variable,
1626 */
1627 struct __pyx_opt_args_7cpython_11contextvars_get_value {
1628 int __pyx_n;
1629 PyObject *default_value;
1630 };
1631
1632 /* "cpython/contextvars.pxd":129
1633 *
1634 *
1635 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
1636 * """Return a new reference to the value of the context variable,
1637 * or the provided default value if no such value was found.
1638 */
1639 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
1640 int __pyx_n;
1641 PyObject *default_value;
1642 };
1643 struct __pyx_opt_args_5pysam_9libcutils_parse_region;
1644 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array;
1645 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring;
1646 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring;
1647 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str;
1648 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes;
1649 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len;
1650 struct __pyx_opt_args_5pysam_9libcutils_force_str;
1651 struct __pyx_opt_args_5pysam_9libcutils_force_bytes;
1652 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes;
1653
1654 /* "pysam/libcutils.pxd":8
1655 * from cpython cimport array as c_array
1656 *
1657 * cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) # <<<<<<<<<<<<<<
1658 *
1659 * cdef int libc_whence_from_io(int whence)
1660 */
1661 struct __pyx_opt_args_5pysam_9libcutils_parse_region {
1662 int __pyx_n;
1663 PyObject *contig;
1664 PyObject *start;
1665 PyObject *stop;
1666 PyObject *region;
1667 PyObject *reference;
1668 PyObject *end;
1669 };
1670
1671 /* "pysam/libcutils.pxd":15
1672 * # Utility functions for quality string conversions
1673 *
1674 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*) # <<<<<<<<<<<<<<
1675 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
1676 * cpdef qualities_to_qualitystring(qualities, int offset=*)
1677 */
1678 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array {
1679 int __pyx_n;
1680 int offset;
1681 };
1682
1683 /* "pysam/libcutils.pxd":16
1684 *
1685 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
1686 * cpdef array_to_qualitystring(c_array.array arr, int offset=*) # <<<<<<<<<<<<<<
1687 * cpdef qualities_to_qualitystring(qualities, int offset=*)
1688 *
1689 */
1690 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring {
1691 int __pyx_n;
1692 int offset;
1693 };
1694
1695 /* "pysam/libcutils.pxd":17
1696 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
1697 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
1698 * cpdef qualities_to_qualitystring(qualities, int offset=*) # <<<<<<<<<<<<<<
1699 *
1700 * ########################################################################
1701 */
1702 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring {
1703 int __pyx_n;
1704 int offset;
1705 };
1706
1707 /* "pysam/libcutils.pxd":29
1708 * ## Python 3 compatibility functions
1709 * ########################################################################
1710 * cdef charptr_to_str(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1711 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1712 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1713 */
1714 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str {
1715 int __pyx_n;
1716 PyObject *encoding;
1717 PyObject *errors;
1718 };
1719
1720 /* "pysam/libcutils.pxd":30
1721 * ########################################################################
1722 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
1723 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1724 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1725 * cdef force_str(object s, encoding=*, errors=*)
1726 */
1727 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes {
1728 int __pyx_n;
1729 PyObject *encoding;
1730 PyObject *errors;
1731 };
1732
1733 /* "pysam/libcutils.pxd":31
1734 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
1735 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1736 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) # <<<<<<<<<<<<<<
1737 * cdef force_str(object s, encoding=*, errors=*)
1738 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1739 */
1740 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len {
1741 int __pyx_n;
1742 PyObject *encoding;
1743 PyObject *errors;
1744 };
1745
1746 /* "pysam/libcutils.pxd":32
1747 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1748 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1749 * cdef force_str(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1750 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1751 * cdef decode_bytes(bytes s, encoding=*, errors=*)
1752 */
1753 struct __pyx_opt_args_5pysam_9libcutils_force_str {
1754 int __pyx_n;
1755 PyObject *encoding;
1756 PyObject *errors;
1757 };
1758
1759 /* "pysam/libcutils.pxd":33
1760 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1761 * cdef force_str(object s, encoding=*, errors=*)
1762 * cdef bytes force_bytes(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1763 * cdef decode_bytes(bytes s, encoding=*, errors=*)
1764 * cdef bytes encode_filename(object filename)
1765 */
1766 struct __pyx_opt_args_5pysam_9libcutils_force_bytes {
1767 int __pyx_n;
1768 PyObject *encoding;
1769 PyObject *errors;
1770 };
1771
1772 /* "pysam/libcutils.pxd":34
1773 * cdef force_str(object s, encoding=*, errors=*)
1774 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1775 * cdef decode_bytes(bytes s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1776 * cdef bytes encode_filename(object filename)
1777 * cdef from_string_and_size(const char *s, size_t length)
1778 */
1779 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes {
1780 int __pyx_n;
1781 PyObject *encoding;
1782 PyObject *errors;
1783 };
1784
1785 /* "pysam/libchtslib.pxd":2706
1786 *
1787 *
1788 * cdef class HTSFile(object): # <<<<<<<<<<<<<<
1789 * cdef htsFile *htsfile # pointer to htsFile structure
1790 * cdef int64_t start_offset # BGZF offset of first record
1791 */
1792 struct __pyx_obj_5pysam_10libchtslib_HTSFile {
1793 PyObject_HEAD
1794 struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtab;
1795 htsFile *htsfile;
1796 int64_t start_offset;
1797 PyObject *filename;
1798 PyObject *mode;
1799 PyObject *threads;
1800 PyObject *index_filename;
1801 int is_stream;
1802 int is_remote;
1803 int duplicate_filehandle;
1804 };
1805
1806
1807 /* "pysam/libcbgzf.pxd":5
1808 * from pysam.libchtslib cimport BGZF
1809 *
1810 * cdef class BGZFile(object): # <<<<<<<<<<<<<<
1811 * cdef BGZF *bgzf
1812 * cdef readonly object name, index
1813 */
1814 struct __pyx_obj_5pysam_8libcbgzf_BGZFile {
1815 PyObject_HEAD
1816 BGZF *bgzf;
1817 PyObject *name;
1818 PyObject *index;
1819 };
1820
1821
1822
1823 /* "pysam/libchtslib.pxd":2706
1824 *
1825 *
1826 * cdef class HTSFile(object): # <<<<<<<<<<<<<<
1827 * cdef htsFile *htsfile # pointer to htsFile structure
1828 * cdef int64_t start_offset # BGZF offset of first record
1829 */
1830
1831 struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile {
1832 htsFile *(*_open_htsfile)(struct __pyx_obj_5pysam_10libchtslib_HTSFile *);
1833 };
1834 static struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtabptr_5pysam_10libchtslib_HTSFile;
1835 /* #### Code section: utility_code_proto ### */
1836
1837 /* --- Runtime support code (head) --- */
1838 /* Refnanny.proto */
1839 #ifndef CYTHON_REFNANNY
1840 #define CYTHON_REFNANNY 0
1841 #endif
1842 #if CYTHON_REFNANNY
1843 typedef struct {
1844 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1845 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1846 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1847 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1848 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1849 void (*FinishContext)(void**);
1850 } __Pyx_RefNannyAPIStruct;
1851 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1852 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1853 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1854 #ifdef WITH_THREAD
1855 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1856 if (acquire_gil) {\
1857 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1858 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1859 PyGILState_Release(__pyx_gilstate_save);\
1860 } else {\
1861 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1862 }
1863 #define __Pyx_RefNannyFinishContextNogil() {\
1864 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1865 __Pyx_RefNannyFinishContext();\
1866 PyGILState_Release(__pyx_gilstate_save);\
1867 }
1868 #else
1869 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1870 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1871 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1872 #endif
1873 #define __Pyx_RefNannyFinishContextNogil() {\
1874 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1875 __Pyx_RefNannyFinishContext();\
1876 PyGILState_Release(__pyx_gilstate_save);\
1877 }
1878 #define __Pyx_RefNannyFinishContext()\
1879 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1880 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1881 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1882 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1883 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1884 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1885 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1886 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1887 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1888 #else
1889 #define __Pyx_RefNannyDeclarations
1890 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1891 #define __Pyx_RefNannyFinishContextNogil()
1892 #define __Pyx_RefNannyFinishContext()
1893 #define __Pyx_INCREF(r) Py_INCREF(r)
1894 #define __Pyx_DECREF(r) Py_DECREF(r)
1895 #define __Pyx_GOTREF(r)
1896 #define __Pyx_GIVEREF(r)
1897 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1898 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1899 #define __Pyx_XGOTREF(r)
1900 #define __Pyx_XGIVEREF(r)
1901 #endif
1902 #define __Pyx_Py_XDECREF_SET(r, v) do {\
1903 PyObject *tmp = (PyObject *) r;\
1904 r = v; Py_XDECREF(tmp);\
1905 } while (0)
1906 #define __Pyx_XDECREF_SET(r, v) do {\
1907 PyObject *tmp = (PyObject *) r;\
1908 r = v; __Pyx_XDECREF(tmp);\
1909 } while (0)
1910 #define __Pyx_DECREF_SET(r, v) do {\
1911 PyObject *tmp = (PyObject *) r;\
1912 r = v; __Pyx_DECREF(tmp);\
1913 } while (0)
1914 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1915 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1916
1917 /* PyErrExceptionMatches.proto */
1918 #if CYTHON_FAST_THREAD_STATE
1919 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1920 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1921 #else
1922 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1923 #endif
1924
1925 /* PyThreadStateGet.proto */
1926 #if CYTHON_FAST_THREAD_STATE
1927 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1928 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1929 #if PY_VERSION_HEX >= 0x030C00A6
1930 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
1931 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
1932 #else
1933 #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1934 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1935 #endif
1936 #else
1937 #define __Pyx_PyThreadState_declare
1938 #define __Pyx_PyThreadState_assign
1939 #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
1940 #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
1941 #endif
1942
1943 /* PyErrFetchRestore.proto */
1944 #if CYTHON_FAST_THREAD_STATE
1945 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1946 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1947 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1948 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1949 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1950 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1951 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1952 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
1953 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1954 #else
1955 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1956 #endif
1957 #else
1958 #define __Pyx_PyErr_Clear() PyErr_Clear()
1959 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1960 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1961 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1962 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1963 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1964 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1965 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1966 #endif
1967
1968 /* PyObjectGetAttrStr.proto */
1969 #if CYTHON_USE_TYPE_SLOTS
1970 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1971 #else
1972 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1973 #endif
1974
1975 /* PyObjectGetAttrStrNoError.proto */
1976 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1977
1978 /* GetBuiltinName.proto */
1979 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1980
1981 /* TupleAndListFromArray.proto */
1982 #if CYTHON_COMPILING_IN_CPYTHON
1983 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
1984 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
1985 #endif
1986
1987 /* IncludeStringH.proto */
1988 #include <string.h>
1989
1990 /* BytesEquals.proto */
1991 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1992
1993 /* UnicodeEquals.proto */
1994 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1995
1996 /* fastcall.proto */
1997 #if CYTHON_AVOID_BORROWED_REFS
1998 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
1999 #elif CYTHON_ASSUME_SAFE_MACROS
2000 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
2001 #else
2002 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
2003 #endif
2004 #if CYTHON_AVOID_BORROWED_REFS
2005 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
2006 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
2007 #else
2008 #define __Pyx_Arg_NewRef_VARARGS(arg) arg
2009 #define __Pyx_Arg_XDECREF_VARARGS(arg)
2010 #endif
2011 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
2012 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
2013 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
2014 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
2015 #if CYTHON_METH_FASTCALL
2016 #define __Pyx_Arg_FASTCALL(args, i) args[i]
2017 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
2018 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
2019 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
2020 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
2021 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
2022 #else
2023 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
2024 #endif
2025 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
2026 to have the same reference counting */
2027 #define __Pyx_Arg_XDECREF_FASTCALL(arg)
2028 #else
2029 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
2030 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
2031 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
2032 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
2033 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
2034 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
2035 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
2036 #endif
2037 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2038 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
2039 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
2040 #else
2041 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
2042 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
2043 #endif
2044
2045 /* RaiseDoubleKeywords.proto */
2046 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
2047
2048 /* ParseKeywords.proto */
2049 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
2050 PyObject **argnames[],
2051 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
2052 const char* function_name);
2053
2054 /* RaiseArgTupleInvalid.proto */
2055 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
2056 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
2057
2058 /* PySequenceContains.proto */
2059 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
2060 int result = PySequence_Contains(seq, item);
2061 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2062 }
2063
2064 /* PyFunctionFastCall.proto */
2065 #if CYTHON_FAST_PYCALL
2066 #if !CYTHON_VECTORCALL
2067 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
2068 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
2069 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
2070 #endif
2071 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
2072 (sizeof(char [1 - 2*!(cond)]) - 1)
2073 #ifndef Py_MEMBER_SIZE
2074 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
2075 #endif
2076 #if !CYTHON_VECTORCALL
2077 #if PY_VERSION_HEX >= 0x03080000
2078 #include "frameobject.h"
2079 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
2080 #ifndef Py_BUILD_CORE
2081 #define Py_BUILD_CORE 1
2082 #endif
2083 #include "internal/pycore_frame.h"
2084 #endif
2085 #define __Pxy_PyFrame_Initialize_Offsets()
2086 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
2087 #else
2088 static size_t __pyx_pyframe_localsplus_offset = 0;
2089 #include "frameobject.h"
2090 #define __Pxy_PyFrame_Initialize_Offsets()\
2091 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
2092 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
2093 #define __Pyx_PyFrame_GetLocalsplus(frame)\
2094 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
2095 #endif
2096 #endif
2097 #endif
2098
2099 /* PyObjectCall.proto */
2100 #if CYTHON_COMPILING_IN_CPYTHON
2101 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
2102 #else
2103 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
2104 #endif
2105
2106 /* PyObjectCallMethO.proto */
2107 #if CYTHON_COMPILING_IN_CPYTHON
2108 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
2109 #endif
2110
2111 /* PyObjectFastCall.proto */
2112 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
2113 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
2114
2115 /* PyObjectCallOneArg.proto */
2116 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
2117
2118 /* RaiseException.proto */
2119 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
2120
2121 /* WriteUnraisableException.proto */
2122 static void __Pyx_WriteUnraisable(const char *name, int clineno,
2123 int lineno, const char *filename,
2124 int full_traceback, int nogil);
2125
2126 /* Import.proto */
2127 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
2128
2129 /* ImportDottedModule.proto */
2130 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
2131 #if PY_MAJOR_VERSION >= 3
2132 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
2133 #endif
2134
2135 /* PyDictVersioning.proto */
2136 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2137 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
2138 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
2139 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
2140 (version_var) = __PYX_GET_DICT_VERSION(dict);\
2141 (cache_var) = (value);
2142 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
2143 static PY_UINT64_T __pyx_dict_version = 0;\
2144 static PyObject *__pyx_dict_cached_value = NULL;\
2145 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
2146 (VAR) = __pyx_dict_cached_value;\
2147 } else {\
2148 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
2149 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
2150 }\
2151 }
2152 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
2153 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
2154 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
2155 #else
2156 #define __PYX_GET_DICT_VERSION(dict) (0)
2157 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
2158 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
2159 #endif
2160
2161 /* GetModuleGlobalName.proto */
2162 #if CYTHON_USE_DICT_VERSIONS
2163 #define __Pyx_GetModuleGlobalName(var, name) do {\
2164 static PY_UINT64_T __pyx_dict_version = 0;\
2165 static PyObject *__pyx_dict_cached_value = NULL;\
2166 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
2167 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
2168 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2169 } while(0)
2170 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
2171 PY_UINT64_T __pyx_dict_version;\
2172 PyObject *__pyx_dict_cached_value;\
2173 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2174 } while(0)
2175 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
2176 #else
2177 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2178 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2179 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
2180 #endif
2181
2182 /* ListAppend.proto */
2183 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2184 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2185 PyListObject* L = (PyListObject*) list;
2186 Py_ssize_t len = Py_SIZE(list);
2187 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2188 Py_INCREF(x);
2189 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
2190 L->ob_item[len] = x;
2191 #else
2192 PyList_SET_ITEM(list, len, x);
2193 #endif
2194 __Pyx_SET_SIZE(list, len + 1);
2195 return 0;
2196 }
2197 return PyList_Append(list, x);
2198 }
2199 #else
2200 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2201 #endif
2202
2203 /* PyObjectCall2Args.proto */
2204 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
2205
2206 /* PyObjectGetMethod.proto */
2207 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2208
2209 /* PyObjectCallMethod1.proto */
2210 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2211
2212 /* StringJoin.proto */
2213 #if PY_MAJOR_VERSION < 3
2214 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
2215 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
2216 #else
2217 #define __Pyx_PyString_Join PyUnicode_Join
2218 #define __Pyx_PyBaseString_Join PyUnicode_Join
2219 #endif
2220 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
2221
2222 /* KeywordStringCheck.proto */
2223 static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed);
2224
2225 /* IncludeStructmemberH.proto */
2226 #include <structmember.h>
2227
2228 /* FixUpExtensionType.proto */
2229 #if CYTHON_USE_TYPE_SPECS
2230 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
2231 #endif
2232
2233 /* PyObjectCallNoArg.proto */
2234 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
2235
2236 /* PyObjectCallMethod0.proto */
2237 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
2238
2239 /* ValidateBasesTuple.proto */
2240 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
2241 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
2242 #endif
2243
2244 /* PyType_Ready.proto */
2245 CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
2246
2247 /* PyObject_GenericGetAttrNoDict.proto */
2248 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2249 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2250 #else
2251 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2252 #endif
2253
2254 /* PyObject_GenericGetAttr.proto */
2255 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2256 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2257 #else
2258 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2259 #endif
2260
2261 /* SetupReduce.proto */
2262 #if !CYTHON_COMPILING_IN_LIMITED_API
2263 static int __Pyx_setup_reduce(PyObject* type_obj);
2264 #endif
2265
2266 /* TypeImport.proto */
2267 #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
2268 #define __PYX_HAVE_RT_ImportType_proto_3_0_11
2269 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
2270 #include <stdalign.h>
2271 #endif
2272 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
2273 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
2274 #else
2275 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
2276 #endif
2277 enum __Pyx_ImportType_CheckSize_3_0_11 {
2278 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
2279 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
2280 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
2281 };
2282 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size);
2283 #endif
2284
2285 /* GetVTable.proto */
2286 static void* __Pyx_GetVtable(PyTypeObject *type);
2287
2288 /* FetchSharedCythonModule.proto */
2289 static PyObject *__Pyx_FetchSharedCythonABIModule(void);
2290
2291 /* FetchCommonType.proto */
2292 #if !CYTHON_USE_TYPE_SPECS
2293 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2294 #else
2295 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
2296 #endif
2297
2298 /* PyMethodNew.proto */
2299 #if CYTHON_COMPILING_IN_LIMITED_API
2300 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
2301 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
2302 CYTHON_UNUSED_VAR(typ);
2303 if (!self)
2304 return __Pyx_NewRef(func);
2305 typesModule = PyImport_ImportModule("types");
2306 if (!typesModule) return NULL;
2307 methodType = PyObject_GetAttrString(typesModule, "MethodType");
2308 Py_DECREF(typesModule);
2309 if (!methodType) return NULL;
2310 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
2311 Py_DECREF(methodType);
2312 return result;
2313 }
2314 #elif PY_MAJOR_VERSION >= 3
2315 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
2316 CYTHON_UNUSED_VAR(typ);
2317 if (!self)
2318 return __Pyx_NewRef(func);
2319 return PyMethod_New(func, self);
2320 }
2321 #else
2322 #define __Pyx_PyMethod_New PyMethod_New
2323 #endif
2324
2325 /* PyVectorcallFastCallDict.proto */
2326 #if CYTHON_METH_FASTCALL
2327 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
2328 #endif
2329
2330 /* CythonFunctionShared.proto */
2331 #define __Pyx_CyFunction_USED
2332 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2333 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2334 #define __Pyx_CYFUNCTION_CCLASS 0x04
2335 #define __Pyx_CYFUNCTION_COROUTINE 0x08
2336 #define __Pyx_CyFunction_GetClosure(f)\
2337 (((__pyx_CyFunctionObject *) (f))->func_closure)
2338 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
2339 #define __Pyx_CyFunction_GetClassObj(f)\
2340 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2341 #else
2342 #define __Pyx_CyFunction_GetClassObj(f)\
2343 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
2344 #endif
2345 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
2346 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
2347 #define __Pyx_CyFunction_Defaults(type, f)\
2348 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2349 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2350 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2351 typedef struct {
2352 #if CYTHON_COMPILING_IN_LIMITED_API
2353 PyObject_HEAD
2354 PyObject *func;
2355 #elif PY_VERSION_HEX < 0x030900B1
2356 PyCFunctionObject func;
2357 #else
2358 PyCMethodObject func;
2359 #endif
2360 #if CYTHON_BACKPORT_VECTORCALL
2361 __pyx_vectorcallfunc func_vectorcall;
2362 #endif
2363 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
2364 PyObject *func_weakreflist;
2365 #endif
2366 PyObject *func_dict;
2367 PyObject *func_name;
2368 PyObject *func_qualname;
2369 PyObject *func_doc;
2370 PyObject *func_globals;
2371 PyObject *func_code;
2372 PyObject *func_closure;
2373 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
2374 PyObject *func_classobj;
2375 #endif
2376 void *defaults;
2377 int defaults_pyobjects;
2378 size_t defaults_size;
2379 int flags;
2380 PyObject *defaults_tuple;
2381 PyObject *defaults_kwdict;
2382 PyObject *(*defaults_getter)(PyObject *);
2383 PyObject *func_annotations;
2384 PyObject *func_is_coroutine;
2385 } __pyx_CyFunctionObject;
2386 #undef __Pyx_CyOrPyCFunction_Check
2387 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
2388 #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
2389 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
2390 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
2391 #undef __Pyx_IsSameCFunction
2392 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
2393 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2394 int flags, PyObject* qualname,
2395 PyObject *closure,
2396 PyObject *module, PyObject *globals,
2397 PyObject* code);
2398 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
2399 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2400 size_t size,
2401 int pyobjects);
2402 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2403 PyObject *tuple);
2404 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2405 PyObject *dict);
2406 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2407 PyObject *dict);
2408 static int __pyx_CyFunction_init(PyObject *module);
2409 #if CYTHON_METH_FASTCALL
2410 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2411 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2412 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2413 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2414 #if CYTHON_BACKPORT_VECTORCALL
2415 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
2416 #else
2417 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
2418 #endif
2419 #endif
2420
2421 /* CythonFunction.proto */
2422 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2423 int flags, PyObject* qualname,
2424 PyObject *closure,
2425 PyObject *module, PyObject *globals,
2426 PyObject* code);
2427
2428 /* CLineInTraceback.proto */
2429 #ifdef CYTHON_CLINE_IN_TRACEBACK
2430 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2431 #else
2432 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2433 #endif
2434
2435 /* CodeObjectCache.proto */
2436 #if !CYTHON_COMPILING_IN_LIMITED_API
2437 typedef struct {
2438 PyCodeObject* code_object;
2439 int code_line;
2440 } __Pyx_CodeObjectCacheEntry;
2441 struct __Pyx_CodeObjectCache {
2442 int count;
2443 int max_count;
2444 __Pyx_CodeObjectCacheEntry* entries;
2445 };
2446 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2447 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2448 static PyCodeObject *__pyx_find_code_object(int code_line);
2449 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2450 #endif
2451
2452 /* AddTraceback.proto */
2453 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2454 int py_line, const char *filename);
2455
2456 /* GCCDiagnostics.proto */
2457 #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2458 #define __Pyx_HAS_GCC_DIAGNOSTIC
2459 #endif
2460
2461 /* ArrayAPI.proto */
2462 #ifndef _ARRAYARRAY_H
2463 #define _ARRAYARRAY_H
2464 typedef struct arraydescr {
2465 int typecode;
2466 int itemsize;
2467 PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
2468 int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
2469 #if PY_MAJOR_VERSION >= 3
2470 char *formats;
2471 #endif
2472 } arraydescr;
2473 struct arrayobject {
2474 PyObject_HEAD
2475 Py_ssize_t ob_size;
2476 union {
2477 char *ob_item;
2478 float *as_floats;
2479 double *as_doubles;
2480 int *as_ints;
2481 unsigned int *as_uints;
2482 unsigned char *as_uchars;
2483 signed char *as_schars;
2484 char *as_chars;
2485 unsigned long *as_ulongs;
2486 long *as_longs;
2487 #if PY_MAJOR_VERSION >= 3
2488 unsigned long long *as_ulonglongs;
2489 long long *as_longlongs;
2490 #endif
2491 short *as_shorts;
2492 unsigned short *as_ushorts;
2493 Py_UNICODE *as_pyunicodes;
2494 void *as_voidptr;
2495 } data;
2496 Py_ssize_t allocated;
2497 struct arraydescr *ob_descr;
2498 PyObject *weakreflist;
2499 #if PY_MAJOR_VERSION >= 3
2500 int ob_exports;
2501 #endif
2502 };
2503 #ifndef NO_NEWARRAY_INLINE
2504 static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
2505 struct arraydescr *descr) {
2506 arrayobject *op;
2507 size_t nbytes;
2508 if (size < 0) {
2509 PyErr_BadInternalCall();
2510 return NULL;
2511 }
2512 nbytes = size * descr->itemsize;
2513 if (nbytes / descr->itemsize != (size_t)size) {
2514 return PyErr_NoMemory();
2515 }
2516 op = (arrayobject *) type->tp_alloc(type, 0);
2517 if (op == NULL) {
2518 return NULL;
2519 }
2520 op->ob_descr = descr;
2521 op->allocated = size;
2522 op->weakreflist = NULL;
2523 __Pyx_SET_SIZE(op, size);
2524 if (size <= 0) {
2525 op->data.ob_item = NULL;
2526 }
2527 else {
2528 op->data.ob_item = PyMem_NEW(char, nbytes);
2529 if (op->data.ob_item == NULL) {
2530 Py_DECREF(op);
2531 return PyErr_NoMemory();
2532 }
2533 }
2534 return (PyObject *) op;
2535 }
2536 #else
2537 PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
2538 struct arraydescr *descr);
2539 #endif
2540 static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
2541 void *items = (void*) self->data.ob_item;
2542 PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
2543 if (items == NULL) {
2544 PyErr_NoMemory();
2545 return -1;
2546 }
2547 self->data.ob_item = (char*) items;
2548 __Pyx_SET_SIZE(self, n);
2549 self->allocated = n;
2550 return 0;
2551 }
2552 static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
2553 void *items = (void*) self->data.ob_item;
2554 Py_ssize_t newsize;
2555 if (n < self->allocated && n*4 > self->allocated) {
2556 __Pyx_SET_SIZE(self, n);
2557 return 0;
2558 }
2559 newsize = n + (n / 2) + 1;
2560 if (newsize <= n) {
2561 PyErr_NoMemory();
2562 return -1;
2563 }
2564 PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
2565 if (items == NULL) {
2566 PyErr_NoMemory();
2567 return -1;
2568 }
2569 self->data.ob_item = (char*) items;
2570 __Pyx_SET_SIZE(self, n);
2571 self->allocated = newsize;
2572 return 0;
2573 }
2574 #endif
2575
2576 /* CIntToPy.proto */
2577 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
2578
2579 /* CIntFromPy.proto */
2580 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
2581
2582 /* CIntToPy.proto */
2583 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2584
2585 /* CIntToPy.proto */
2586 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);
2587
2588 /* CIntFromPy.proto */
2589 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);
2590
2591 /* CIntFromPy.proto */
2592 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2593
2594 /* FormatTypeName.proto */
2595 #if CYTHON_COMPILING_IN_LIMITED_API
2596 typedef PyObject *__Pyx_TypeName;
2597 #define __Pyx_FMT_TYPENAME "%U"
2598 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
2599 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
2600 #else
2601 typedef const char *__Pyx_TypeName;
2602 #define __Pyx_FMT_TYPENAME "%.200s"
2603 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
2604 #define __Pyx_DECREF_TypeName(obj)
2605 #endif
2606
2607 /* CIntToPy.proto */
2608 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2609
2610 /* CIntFromPy.proto */
2611 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2612
2613 /* FastTypeChecks.proto */
2614 #if CYTHON_COMPILING_IN_CPYTHON
2615 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2616 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
2617 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2618 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
2619 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2620 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2621 #else
2622 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2623 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
2624 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2625 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2626 #endif
2627 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
2628 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2629
2630 /* CheckBinaryVersion.proto */
2631 static unsigned long __Pyx_get_runtime_version(void);
2632 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
2633
2634 /* FunctionImport.proto */
2635 static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2636
2637 /* InitStrings.proto */
2638 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2639
2640 /* #### Code section: module_declarations ### */
2641 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
2642 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
2643
2644 /* Module declarations from "libc.stdint" */
2645
2646 /* Module declarations from "libc.string" */
2647
2648 /* Module declarations from "libc.stdlib" */
2649
2650 /* Module declarations from "libc.stdio" */
2651
2652 /* Module declarations from "posix.types" */
2653
2654 /* Module declarations from "pysam.libchtslib" */
2655
2656 /* Module declarations from "__builtin__" */
2657
2658 /* Module declarations from "cpython.type" */
2659
2660 /* Module declarations from "cpython.version" */
2661
2662 /* Module declarations from "cpython.ref" */
2663
2664 /* Module declarations from "cpython.exc" */
2665
2666 /* Module declarations from "cpython.module" */
2667
2668 /* Module declarations from "cpython.mem" */
2669
2670 /* Module declarations from "cpython.tuple" */
2671
2672 /* Module declarations from "cpython.list" */
2673
2674 /* Module declarations from "cpython.sequence" */
2675
2676 /* Module declarations from "cpython.mapping" */
2677
2678 /* Module declarations from "cpython.iterator" */
2679
2680 /* Module declarations from "cpython.number" */
2681
2682 /* Module declarations from "cpython.int" */
2683
2684 /* Module declarations from "__builtin__" */
2685
2686 /* Module declarations from "cpython.bool" */
2687
2688 /* Module declarations from "cpython.long" */
2689
2690 /* Module declarations from "cpython.float" */
2691
2692 /* Module declarations from "__builtin__" */
2693
2694 /* Module declarations from "cpython.complex" */
2695
2696 /* Module declarations from "cpython.string" */
2697
2698 /* Module declarations from "libc.stddef" */
2699
2700 /* Module declarations from "cpython.unicode" */
2701
2702 /* Module declarations from "cpython.pyport" */
2703
2704 /* Module declarations from "cpython.dict" */
2705
2706 /* Module declarations from "cpython.instance" */
2707
2708 /* Module declarations from "cpython.function" */
2709
2710 /* Module declarations from "cpython.method" */
2711
2712 /* Module declarations from "cpython.weakref" */
2713
2714 /* Module declarations from "cpython.getargs" */
2715
2716 /* Module declarations from "cpython.pythread" */
2717
2718 /* Module declarations from "cpython.pystate" */
2719
2720 /* Module declarations from "cpython.cobject" */
2721
2722 /* Module declarations from "cpython.oldbuffer" */
2723
2724 /* Module declarations from "cpython.set" */
2725
2726 /* Module declarations from "cpython.buffer" */
2727
2728 /* Module declarations from "cpython.bytes" */
2729
2730 /* Module declarations from "cpython.pycapsule" */
2731
2732 /* Module declarations from "cpython.contextvars" */
2733
2734 /* Module declarations from "cpython" */
2735
2736 /* Module declarations from "cpython.object" */
2737
2738 /* Module declarations from "cython" */
2739
2740 /* Module declarations from "array" */
2741
2742 /* Module declarations from "cpython.array" */
2743 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
2744
2745 /* Module declarations from "pysam.libcutils" */
2746 static PyObject *(*__pyx_f_5pysam_9libcutils_force_bytes)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args); /*proto*/
2747 static PyObject *(*__pyx_f_5pysam_9libcutils_encode_filename)(PyObject *); /*proto*/
2748
2749 /* Module declarations from "pysam.libcbgzf" */
2750 /* #### Code section: typeinfo ### */
2751 /* #### Code section: before_global_var ### */
2752 #define __Pyx_MODULE_NAME "pysam.libcbgzf"
2753 extern int __pyx_module_is_main_pysam__libcbgzf;
2754 int __pyx_module_is_main_pysam__libcbgzf = 0;
2755
2756 /* Implementation of "pysam.libcbgzf" */
2757 /* #### Code section: global_var ### */
2758 static PyObject *__pyx_builtin_ValueError;
2759 static PyObject *__pyx_builtin_IOError;
2760 static PyObject *__pyx_builtin_AttributeError;
2761 static PyObject *__pyx_builtin_StopIteration;
2762 static PyObject *__pyx_builtin_TypeError;
2763 static PyObject *__pyx_builtin_MemoryError;
2764 /* #### Code section: string_decls ### */
2765 static const char __pyx_k_U[] = "U";
2766 static const char __pyx_k_b[] = "b";
2767 static const char __pyx_k_c[] = "c";
2768 static const char __pyx_k_s[] = "s";
2769 static const char __pyx_k_t[] = "t";
2770 static const char __pyx_k__3[] = "*";
2771 static const char __pyx_k__7[] = "";
2772 static const char __pyx_k_gc[] = "gc";
2773 static const char __pyx_k_io[] = "io";
2774 static const char __pyx_k_rb[] = "rb";
2775 static const char __pyx_k_tb[] = "tb";
2776 static const char __pyx_k__48[] = "?";
2777 static const char __pyx_k_all[] = "__all__";
2778 static const char __pyx_k_off[] = "off";
2779 static const char __pyx_k_ret[] = "ret";
2780 static const char __pyx_k_data[] = "data";
2781 static const char __pyx_k_exit[] = "__exit__";
2782 static const char __pyx_k_join[] = "join";
2783 static const char __pyx_k_line[] = "line";
2784 static const char __pyx_k_main[] = "__main__";
2785 static const char __pyx_k_mode[] = "mode";
2786 static const char __pyx_k_name[] = "__name__";
2787 static const char __pyx_k_read[] = "read";
2788 static const char __pyx_k_seek[] = "seek";
2789 static const char __pyx_k_self[] = "self";
2790 static const char __pyx_k_size[] = "size";
2791 static const char __pyx_k_spec[] = "__spec__";
2792 static const char __pyx_k_tell[] = "tell";
2793 static const char __pyx_k_test[] = "__test__";
2794 static const char __pyx_k_type[] = "type";
2795 static const char __pyx_k_EBADF[] = "EBADF";
2796 static const char __pyx_k_cdata[] = "cdata";
2797 static const char __pyx_k_chunk[] = "chunk";
2798 static const char __pyx_k_close[] = "close";
2799 static const char __pyx_k_enter[] = "__enter__";
2800 static const char __pyx_k_errno[] = "errno";
2801 static const char __pyx_k_flush[] = "flush";
2802 static const char __pyx_k_index[] = "index";
2803 static const char __pyx_k_value[] = "value";
2804 static const char __pyx_k_write[] = "write";
2805 static const char __pyx_k_chunks[] = "chunks";
2806 static const char __pyx_k_enable[] = "enable";
2807 static const char __pyx_k_fileno[] = "fileno";
2808 static const char __pyx_k_format[] = "format";
2809 static const char __pyx_k_import[] = "__import__";
2810 static const char __pyx_k_length[] = "length";
2811 static const char __pyx_k_nbytes[] = "nbytes";
2812 static const char __pyx_k_offset[] = "offset";
2813 static const char __pyx_k_reduce[] = "__reduce__";
2814 static const char __pyx_k_rewind[] = "rewind";
2815 static const char __pyx_k_whence[] = "whence";
2816 static const char __pyx_k_BGZFile[] = "BGZFile";
2817 static const char __pyx_k_IOError[] = "IOError";
2818 static const char __pyx_k_disable[] = "disable";
2819 static const char __pyx_k_SEEK_SET[] = "SEEK_SET";
2820 static const char __pyx_k_filename[] = "filename";
2821 static const char __pyx_k_getstate[] = "__getstate__";
2822 static const char __pyx_k_readable[] = "readable";
2823 static const char __pyx_k_readline[] = "readline";
2824 static const char __pyx_k_seekable[] = "seekable";
2825 static const char __pyx_k_setstate[] = "__setstate__";
2826 static const char __pyx_k_writable[] = "writable";
2827 static const char __pyx_k_TypeError[] = "TypeError";
2828 static const char __pyx_k_isenabled[] = "isenabled";
2829 static const char __pyx_k_pyx_state[] = "__pyx_state";
2830 static const char __pyx_k_read_size[] = "read_size";
2831 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2832 static const char __pyx_k_ValueError[] = "ValueError";
2833 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2834 static const char __pyx_k_BUFFER_SIZE[] = "BUFFER_SIZE";
2835 static const char __pyx_k_MemoryError[] = "MemoryError";
2836 static const char __pyx_k_BGZFile_read[] = "BGZFile.read";
2837 static const char __pyx_k_BGZFile_seek[] = "BGZFile.seek";
2838 static const char __pyx_k_BGZFile_tell[] = "BGZFile.tell";
2839 static const char __pyx_k_initializing[] = "_initializing";
2840 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
2841 static const char __pyx_k_stringsource[] = "<stringsource>";
2842 static const char __pyx_k_BGZFile_close[] = "BGZFile.close";
2843 static const char __pyx_k_BGZFile_flush[] = "BGZFile.flush";
2844 static const char __pyx_k_BGZFile_write[] = "BGZFile.write";
2845 static const char __pyx_k_StopIteration[] = "StopIteration";
2846 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2847 static const char __pyx_k_AttributeError[] = "AttributeError";
2848 static const char __pyx_k_BGZFile___exit[] = "BGZFile.__exit__";
2849 static const char __pyx_k_BGZFile_fileno[] = "BGZFile.fileno";
2850 static const char __pyx_k_BGZFile_rewind[] = "BGZFile.rewind";
2851 static const char __pyx_k_Invalid_mode_r[] = "Invalid mode: {!r}";
2852 static const char __pyx_k_pysam_libcbgzf[] = "pysam.libcbgzf";
2853 static const char __pyx_k_BGZFile___enter[] = "BGZFile.__enter__";
2854 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2855 static const char __pyx_k_BGZFile_readable[] = "BGZFile.readable";
2856 static const char __pyx_k_BGZFile_readline[] = "BGZFile.readline";
2857 static const char __pyx_k_BGZFile_seekable[] = "BGZFile.seekable";
2858 static const char __pyx_k_BGZFile_writable[] = "BGZFile.writable";
2859 static const char __pyx_k_Cannot_write_index[] = "Cannot write index";
2860 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
2861 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2862 static const char __pyx_k_pysam_libcbgzf_pyx[] = "pysam/libcbgzf.pyx";
2863 static const char __pyx_k_DEFAULT_BUFFER_SIZE[] = "DEFAULT_BUFFER_SIZE";
2864 static const char __pyx_k_BGZFile_write_failed[] = "BGZFile write failed";
2865 static const char __pyx_k_BGZFile___reduce_cython[] = "BGZFile.__reduce_cython__";
2866 static const char __pyx_k_BGZFile___setstate_cython[] = "BGZFile.__setstate_cython__";
2867 static const char __pyx_k_Error_building_bgzf_index[] = "Error building bgzf index";
2868 static const char __pyx_k_Can_t_rewind_in_write_mode[] = "Can't rewind in write mode";
2869 static const char __pyx_k_Error_reading_from_BGZFile[] = "Error reading from BGZFile";
2870 static const char __pyx_k_Seek_from_end_not_supported[] = "Seek from end not supported";
2871 static const char __pyx_k_Error_closing_BGZFile_object[] = "Error closing BGZFile object";
2872 static const char __pyx_k_Error_flushing_BGZFile_object[] = "Error flushing BGZFile object";
2873 static const char __pyx_k_Error_seeking_BGZFFile_object[] = "Error seeking BGZFFile object";
2874 static const char __pyx_k_read_on_closed_BGZFile_object[] = "read() on closed BGZFile object";
2875 static const char __pyx_k_seek_on_closed_BGZFile_object[] = "seek() on closed BGZFile object";
2876 static const char __pyx_k_write_on_closed_BGZFile_object[] = "write() on closed BGZFile object";
2877 static const char __pyx_k_rewind_on_closed_BGZFile_object[] = "rewind() on closed BGZFile object";
2878 static const char __pyx_k_Error_in_tell_on_BGZFFile_object[] = "Error in tell on BGZFFile object";
2879 static const char __pyx_k_Error_reading_line_in_BGZFFile_o[] = "Error reading line in BGZFFile object";
2880 static const char __pyx_k_Functions_that_read_and_write_bl[] = "Functions that read and write block gzipped files.\n\nThe user of the file doesn't have to worry about the compression\nand random access is allowed if an index file is present.";
2881 static const char __pyx_k_read_on_write_only_BGZFile_objec[] = "read() on write-only BGZFile object";
2882 static const char __pyx_k_readable_on_closed_BGZFile_objec[] = "readable() on closed BGZFile object";
2883 static const char __pyx_k_readline_on_closed_BGZFile_objec[] = "readline() on closed BGZFile object";
2884 static const char __pyx_k_self_bgzf_cannot_be_converted_to[] = "self.bgzf cannot be converted to a Python object for pickling";
2885 static const char __pyx_k_write_on_read_only_BGZFile_objec[] = "write() on read-only BGZFile object";
2886 /* #### Code section: decls ### */
2887 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
2888 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2889 static int __pyx_pf_5pysam_8libcbgzf_7BGZFile___init__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_index); /* proto */
2890 static void __pyx_pf_5pysam_8libcbgzf_7BGZFile_2__dealloc__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2891 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_4write(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
2892 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_6read(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
2893 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_6closed___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2894 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_8close(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2895 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_10__enter__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2896 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_12__exit__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */
2897 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_14flush(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2898 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_16fileno(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2899 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_18rewind(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2900 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_20readable(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2901 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_22writable(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2902 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_24seekable(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2903 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_26tell(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2904 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_28seek(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_offset, PyObject *__pyx_v_whence); /* proto */
2905 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_30readline(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size); /* proto */
2906 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_32__iter__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2907 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_34__next__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2908 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_4name___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2909 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_5index___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2910 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self); /* proto */
2911 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2912 static PyObject *__pyx_tp_new_5pysam_8libcbgzf_BGZFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2913 /* #### Code section: late_includes ### */
2914 /* #### Code section: module_state ### */
2915 typedef struct {
2916 PyObject *__pyx_d;
2917 PyObject *__pyx_b;
2918 PyObject *__pyx_cython_runtime;
2919 PyObject *__pyx_empty_tuple;
2920 PyObject *__pyx_empty_bytes;
2921 PyObject *__pyx_empty_unicode;
2922 #ifdef __Pyx_CyFunction_USED
2923 PyTypeObject *__pyx_CyFunctionType;
2924 #endif
2925 #ifdef __Pyx_FusedFunction_USED
2926 PyTypeObject *__pyx_FusedFunctionType;
2927 #endif
2928 #ifdef __Pyx_Generator_USED
2929 PyTypeObject *__pyx_GeneratorType;
2930 #endif
2931 #ifdef __Pyx_IterableCoroutine_USED
2932 PyTypeObject *__pyx_IterableCoroutineType;
2933 #endif
2934 #ifdef __Pyx_Coroutine_USED
2935 PyTypeObject *__pyx_CoroutineAwaitType;
2936 #endif
2937 #ifdef __Pyx_Coroutine_USED
2938 PyTypeObject *__pyx_CoroutineType;
2939 #endif
2940 #if CYTHON_USE_MODULE_STATE
2941 #endif
2942 #if CYTHON_USE_MODULE_STATE
2943 #endif
2944 #if CYTHON_USE_MODULE_STATE
2945 #endif
2946 #if CYTHON_USE_MODULE_STATE
2947 #endif
2948 #if CYTHON_USE_MODULE_STATE
2949 #endif
2950 #if CYTHON_USE_MODULE_STATE
2951 #endif
2952 PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HTSFile;
2953 #if CYTHON_USE_MODULE_STATE
2954 #endif
2955 #if CYTHON_USE_MODULE_STATE
2956 #endif
2957 PyTypeObject *__pyx_ptype_7cpython_4type_type;
2958 #if CYTHON_USE_MODULE_STATE
2959 #endif
2960 #if CYTHON_USE_MODULE_STATE
2961 #endif
2962 #if CYTHON_USE_MODULE_STATE
2963 #endif
2964 #if CYTHON_USE_MODULE_STATE
2965 #endif
2966 #if CYTHON_USE_MODULE_STATE
2967 #endif
2968 #if CYTHON_USE_MODULE_STATE
2969 #endif
2970 #if CYTHON_USE_MODULE_STATE
2971 #endif
2972 #if CYTHON_USE_MODULE_STATE
2973 #endif
2974 #if CYTHON_USE_MODULE_STATE
2975 #endif
2976 #if CYTHON_USE_MODULE_STATE
2977 #endif
2978 #if CYTHON_USE_MODULE_STATE
2979 #endif
2980 #if CYTHON_USE_MODULE_STATE
2981 #endif
2982 #if CYTHON_USE_MODULE_STATE
2983 #endif
2984 #if CYTHON_USE_MODULE_STATE
2985 #endif
2986 PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
2987 #if CYTHON_USE_MODULE_STATE
2988 #endif
2989 #if CYTHON_USE_MODULE_STATE
2990 #endif
2991 #if CYTHON_USE_MODULE_STATE
2992 #endif
2993 #if CYTHON_USE_MODULE_STATE
2994 #endif
2995 PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
2996 #if CYTHON_USE_MODULE_STATE
2997 #endif
2998 #if CYTHON_USE_MODULE_STATE
2999 #endif
3000 #if CYTHON_USE_MODULE_STATE
3001 #endif
3002 #if CYTHON_USE_MODULE_STATE
3003 #endif
3004 #if CYTHON_USE_MODULE_STATE
3005 #endif
3006 #if CYTHON_USE_MODULE_STATE
3007 #endif
3008 #if CYTHON_USE_MODULE_STATE
3009 #endif
3010 #if CYTHON_USE_MODULE_STATE
3011 #endif
3012 #if CYTHON_USE_MODULE_STATE
3013 #endif
3014 #if CYTHON_USE_MODULE_STATE
3015 #endif
3016 #if CYTHON_USE_MODULE_STATE
3017 #endif
3018 #if CYTHON_USE_MODULE_STATE
3019 #endif
3020 #if CYTHON_USE_MODULE_STATE
3021 #endif
3022 #if CYTHON_USE_MODULE_STATE
3023 #endif
3024 #if CYTHON_USE_MODULE_STATE
3025 #endif
3026 #if CYTHON_USE_MODULE_STATE
3027 #endif
3028 #if CYTHON_USE_MODULE_STATE
3029 #endif
3030 #if CYTHON_USE_MODULE_STATE
3031 #endif
3032 #if CYTHON_USE_MODULE_STATE
3033 #endif
3034 #if CYTHON_USE_MODULE_STATE
3035 #endif
3036 #if CYTHON_USE_MODULE_STATE
3037 #endif
3038 #if CYTHON_USE_MODULE_STATE
3039 #endif
3040 #if CYTHON_USE_MODULE_STATE
3041 #endif
3042 #if CYTHON_USE_MODULE_STATE
3043 #endif
3044 PyTypeObject *__pyx_ptype_7cpython_5array_array;
3045 #if CYTHON_USE_MODULE_STATE
3046 #endif
3047 #if CYTHON_USE_MODULE_STATE
3048 PyObject *__pyx_type_5pysam_8libcbgzf_BGZFile;
3049 #endif
3050 PyTypeObject *__pyx_ptype_5pysam_8libcbgzf_BGZFile;
3051 PyObject *__pyx_n_s_AttributeError;
3052 PyObject *__pyx_n_s_BGZFile;
3053 PyObject *__pyx_n_u_BGZFile;
3054 PyObject *__pyx_n_s_BGZFile___enter;
3055 PyObject *__pyx_n_s_BGZFile___exit;
3056 PyObject *__pyx_n_s_BGZFile___reduce_cython;
3057 PyObject *__pyx_n_s_BGZFile___setstate_cython;
3058 PyObject *__pyx_n_s_BGZFile_close;
3059 PyObject *__pyx_n_s_BGZFile_fileno;
3060 PyObject *__pyx_n_s_BGZFile_flush;
3061 PyObject *__pyx_n_s_BGZFile_read;
3062 PyObject *__pyx_n_s_BGZFile_readable;
3063 PyObject *__pyx_n_s_BGZFile_readline;
3064 PyObject *__pyx_n_s_BGZFile_rewind;
3065 PyObject *__pyx_n_s_BGZFile_seek;
3066 PyObject *__pyx_n_s_BGZFile_seekable;
3067 PyObject *__pyx_n_s_BGZFile_tell;
3068 PyObject *__pyx_n_s_BGZFile_writable;
3069 PyObject *__pyx_n_s_BGZFile_write;
3070 PyObject *__pyx_kp_u_BGZFile_write_failed;
3071 PyObject *__pyx_n_s_BUFFER_SIZE;
3072 PyObject *__pyx_kp_u_Can_t_rewind_in_write_mode;
3073 PyObject *__pyx_kp_u_Cannot_write_index;
3074 PyObject *__pyx_n_s_DEFAULT_BUFFER_SIZE;
3075 PyObject *__pyx_n_s_EBADF;
3076 PyObject *__pyx_kp_u_Error_building_bgzf_index;
3077 PyObject *__pyx_kp_u_Error_closing_BGZFile_object;
3078 PyObject *__pyx_kp_u_Error_flushing_BGZFile_object;
3079 PyObject *__pyx_kp_u_Error_in_tell_on_BGZFFile_object;
3080 PyObject *__pyx_kp_u_Error_reading_from_BGZFile;
3081 PyObject *__pyx_kp_u_Error_reading_line_in_BGZFFile_o;
3082 PyObject *__pyx_kp_u_Error_seeking_BGZFFile_object;
3083 PyObject *__pyx_n_s_IOError;
3084 PyObject *__pyx_kp_u_Invalid_mode_r;
3085 PyObject *__pyx_n_s_MemoryError;
3086 PyObject *__pyx_n_s_SEEK_SET;
3087 PyObject *__pyx_kp_u_Seek_from_end_not_supported;
3088 PyObject *__pyx_n_s_StopIteration;
3089 PyObject *__pyx_n_s_TypeError;
3090 PyObject *__pyx_n_u_U;
3091 PyObject *__pyx_n_s_ValueError;
3092 PyObject *__pyx_n_s__3;
3093 PyObject *__pyx_n_s__48;
3094 PyObject *__pyx_kp_b__7;
3095 PyObject *__pyx_n_s_all;
3096 PyObject *__pyx_n_s_asyncio_coroutines;
3097 PyObject *__pyx_n_u_b;
3098 PyObject *__pyx_n_s_c;
3099 PyObject *__pyx_n_s_cdata;
3100 PyObject *__pyx_n_s_chunk;
3101 PyObject *__pyx_n_s_chunks;
3102 PyObject *__pyx_n_s_cline_in_traceback;
3103 PyObject *__pyx_n_s_close;
3104 PyObject *__pyx_n_s_data;
3105 PyObject *__pyx_kp_u_disable;
3106 PyObject *__pyx_kp_u_enable;
3107 PyObject *__pyx_n_s_enter;
3108 PyObject *__pyx_n_s_errno;
3109 PyObject *__pyx_n_s_exit;
3110 PyObject *__pyx_n_s_filename;
3111 PyObject *__pyx_n_s_fileno;
3112 PyObject *__pyx_n_u_fileno;
3113 PyObject *__pyx_n_s_flush;
3114 PyObject *__pyx_n_s_format;
3115 PyObject *__pyx_kp_u_gc;
3116 PyObject *__pyx_n_s_getstate;
3117 PyObject *__pyx_n_s_import;
3118 PyObject *__pyx_n_s_index;
3119 PyObject *__pyx_n_s_initializing;
3120 PyObject *__pyx_n_s_io;
3121 PyObject *__pyx_n_s_is_coroutine;
3122 PyObject *__pyx_kp_u_isenabled;
3123 PyObject *__pyx_n_s_join;
3124 PyObject *__pyx_n_s_length;
3125 PyObject *__pyx_n_s_line;
3126 PyObject *__pyx_n_s_main;
3127 PyObject *__pyx_n_s_mode;
3128 PyObject *__pyx_n_s_name;
3129 PyObject *__pyx_n_s_nbytes;
3130 PyObject *__pyx_n_s_off;
3131 PyObject *__pyx_n_s_offset;
3132 PyObject *__pyx_n_s_pysam_libcbgzf;
3133 PyObject *__pyx_kp_s_pysam_libcbgzf_pyx;
3134 PyObject *__pyx_n_s_pyx_state;
3135 PyObject *__pyx_n_s_pyx_vtable;
3136 PyObject *__pyx_n_u_rb;
3137 PyObject *__pyx_n_s_read;
3138 PyObject *__pyx_kp_u_read_on_closed_BGZFile_object;
3139 PyObject *__pyx_kp_u_read_on_write_only_BGZFile_objec;
3140 PyObject *__pyx_n_s_read_size;
3141 PyObject *__pyx_n_s_readable;
3142 PyObject *__pyx_kp_u_readable_on_closed_BGZFile_objec;
3143 PyObject *__pyx_n_s_readline;
3144 PyObject *__pyx_kp_u_readline_on_closed_BGZFile_objec;
3145 PyObject *__pyx_n_s_reduce;
3146 PyObject *__pyx_n_s_reduce_cython;
3147 PyObject *__pyx_n_s_reduce_ex;
3148 PyObject *__pyx_n_s_ret;
3149 PyObject *__pyx_n_s_rewind;
3150 PyObject *__pyx_kp_u_rewind_on_closed_BGZFile_object;
3151 PyObject *__pyx_n_s_s;
3152 PyObject *__pyx_n_s_seek;
3153 PyObject *__pyx_kp_u_seek_on_closed_BGZFile_object;
3154 PyObject *__pyx_n_s_seekable;
3155 PyObject *__pyx_n_s_self;
3156 PyObject *__pyx_kp_s_self_bgzf_cannot_be_converted_to;
3157 PyObject *__pyx_n_s_setstate;
3158 PyObject *__pyx_n_s_setstate_cython;
3159 PyObject *__pyx_n_s_size;
3160 PyObject *__pyx_n_s_spec;
3161 PyObject *__pyx_kp_s_stringsource;
3162 PyObject *__pyx_n_u_t;
3163 PyObject *__pyx_n_s_tb;
3164 PyObject *__pyx_n_s_tell;
3165 PyObject *__pyx_n_s_test;
3166 PyObject *__pyx_n_s_type;
3167 PyObject *__pyx_n_s_value;
3168 PyObject *__pyx_n_s_whence;
3169 PyObject *__pyx_n_s_writable;
3170 PyObject *__pyx_n_s_write;
3171 PyObject *__pyx_kp_u_write_on_closed_BGZFile_object;
3172 PyObject *__pyx_kp_u_write_on_read_only_BGZFile_objec;
3173 PyObject *__pyx_int_0;
3174 PyObject *__pyx_int_neg_1;
3175 PyObject *__pyx_k__18;
3176 PyObject *__pyx_tuple_;
3177 PyObject *__pyx_tuple__2;
3178 PyObject *__pyx_tuple__4;
3179 PyObject *__pyx_tuple__5;
3180 PyObject *__pyx_tuple__6;
3181 PyObject *__pyx_tuple__8;
3182 PyObject *__pyx_tuple__9;
3183 PyObject *__pyx_tuple__10;
3184 PyObject *__pyx_tuple__11;
3185 PyObject *__pyx_tuple__12;
3186 PyObject *__pyx_tuple__13;
3187 PyObject *__pyx_tuple__14;
3188 PyObject *__pyx_tuple__15;
3189 PyObject *__pyx_tuple__16;
3190 PyObject *__pyx_tuple__17;
3191 PyObject *__pyx_tuple__19;
3192 PyObject *__pyx_tuple__20;
3193 PyObject *__pyx_tuple__21;
3194 PyObject *__pyx_tuple__22;
3195 PyObject *__pyx_tuple__24;
3196 PyObject *__pyx_tuple__26;
3197 PyObject *__pyx_tuple__27;
3198 PyObject *__pyx_tuple__29;
3199 PyObject *__pyx_tuple__31;
3200 PyObject *__pyx_tuple__39;
3201 PyObject *__pyx_tuple__41;
3202 PyObject *__pyx_tuple__43;
3203 PyObject *__pyx_tuple__46;
3204 PyObject *__pyx_codeobj__23;
3205 PyObject *__pyx_codeobj__25;
3206 PyObject *__pyx_codeobj__28;
3207 PyObject *__pyx_codeobj__30;
3208 PyObject *__pyx_codeobj__32;
3209 PyObject *__pyx_codeobj__33;
3210 PyObject *__pyx_codeobj__34;
3211 PyObject *__pyx_codeobj__35;
3212 PyObject *__pyx_codeobj__36;
3213 PyObject *__pyx_codeobj__37;
3214 PyObject *__pyx_codeobj__38;
3215 PyObject *__pyx_codeobj__40;
3216 PyObject *__pyx_codeobj__42;
3217 PyObject *__pyx_codeobj__44;
3218 PyObject *__pyx_codeobj__45;
3219 PyObject *__pyx_codeobj__47;
3220 } __pyx_mstate;
3221
3222 #if CYTHON_USE_MODULE_STATE
3223 #ifdef __cplusplus
3224 namespace {
3225 extern struct PyModuleDef __pyx_moduledef;
3226 } /* anonymous namespace */
3227 #else
3228 static struct PyModuleDef __pyx_moduledef;
3229 #endif
3230
3231 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
3232
3233 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
3234
3235 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
3236 #else
3237 static __pyx_mstate __pyx_mstate_global_static =
3238 #ifdef __cplusplus
3239 {};
3240 #else
3241 {0};
3242 #endif
3243 static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
3244 #endif
3245 /* #### Code section: module_state_clear ### */
3246 #if CYTHON_USE_MODULE_STATE
3247 static int __pyx_m_clear(PyObject *m) {
3248 __pyx_mstate *clear_module_state = __pyx_mstate(m);
3249 if (!clear_module_state) return 0;
3250 Py_CLEAR(clear_module_state->__pyx_d);
3251 Py_CLEAR(clear_module_state->__pyx_b);
3252 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
3253 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
3254 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
3255 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
3256 #ifdef __Pyx_CyFunction_USED
3257 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
3258 #endif
3259 #ifdef __Pyx_FusedFunction_USED
3260 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
3261 #endif
3262 Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
3263 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
3264 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
3265 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
3266 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
3267 Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_8libcbgzf_BGZFile);
3268 Py_CLEAR(clear_module_state->__pyx_type_5pysam_8libcbgzf_BGZFile);
3269 Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError);
3270 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile);
3271 Py_CLEAR(clear_module_state->__pyx_n_u_BGZFile);
3272 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile___enter);
3273 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile___exit);
3274 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile___reduce_cython);
3275 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile___setstate_cython);
3276 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_close);
3277 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_fileno);
3278 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_flush);
3279 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_read);
3280 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_readable);
3281 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_readline);
3282 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_rewind);
3283 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_seek);
3284 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_seekable);
3285 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_tell);
3286 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_writable);
3287 Py_CLEAR(clear_module_state->__pyx_n_s_BGZFile_write);
3288 Py_CLEAR(clear_module_state->__pyx_kp_u_BGZFile_write_failed);
3289 Py_CLEAR(clear_module_state->__pyx_n_s_BUFFER_SIZE);
3290 Py_CLEAR(clear_module_state->__pyx_kp_u_Can_t_rewind_in_write_mode);
3291 Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_write_index);
3292 Py_CLEAR(clear_module_state->__pyx_n_s_DEFAULT_BUFFER_SIZE);
3293 Py_CLEAR(clear_module_state->__pyx_n_s_EBADF);
3294 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_building_bgzf_index);
3295 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_closing_BGZFile_object);
3296 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_flushing_BGZFile_object);
3297 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_in_tell_on_BGZFFile_object);
3298 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_reading_from_BGZFile);
3299 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_reading_line_in_BGZFFile_o);
3300 Py_CLEAR(clear_module_state->__pyx_kp_u_Error_seeking_BGZFFile_object);
3301 Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
3302 Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_r);
3303 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
3304 Py_CLEAR(clear_module_state->__pyx_n_s_SEEK_SET);
3305 Py_CLEAR(clear_module_state->__pyx_kp_u_Seek_from_end_not_supported);
3306 Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration);
3307 Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
3308 Py_CLEAR(clear_module_state->__pyx_n_u_U);
3309 Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
3310 Py_CLEAR(clear_module_state->__pyx_n_s__3);
3311 Py_CLEAR(clear_module_state->__pyx_n_s__48);
3312 Py_CLEAR(clear_module_state->__pyx_kp_b__7);
3313 Py_CLEAR(clear_module_state->__pyx_n_s_all);
3314 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
3315 Py_CLEAR(clear_module_state->__pyx_n_u_b);
3316 Py_CLEAR(clear_module_state->__pyx_n_s_c);
3317 Py_CLEAR(clear_module_state->__pyx_n_s_cdata);
3318 Py_CLEAR(clear_module_state->__pyx_n_s_chunk);
3319 Py_CLEAR(clear_module_state->__pyx_n_s_chunks);
3320 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
3321 Py_CLEAR(clear_module_state->__pyx_n_s_close);
3322 Py_CLEAR(clear_module_state->__pyx_n_s_data);
3323 Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
3324 Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
3325 Py_CLEAR(clear_module_state->__pyx_n_s_enter);
3326 Py_CLEAR(clear_module_state->__pyx_n_s_errno);
3327 Py_CLEAR(clear_module_state->__pyx_n_s_exit);
3328 Py_CLEAR(clear_module_state->__pyx_n_s_filename);
3329 Py_CLEAR(clear_module_state->__pyx_n_s_fileno);
3330 Py_CLEAR(clear_module_state->__pyx_n_u_fileno);
3331 Py_CLEAR(clear_module_state->__pyx_n_s_flush);
3332 Py_CLEAR(clear_module_state->__pyx_n_s_format);
3333 Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
3334 Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
3335 Py_CLEAR(clear_module_state->__pyx_n_s_import);
3336 Py_CLEAR(clear_module_state->__pyx_n_s_index);
3337 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
3338 Py_CLEAR(clear_module_state->__pyx_n_s_io);
3339 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
3340 Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
3341 Py_CLEAR(clear_module_state->__pyx_n_s_join);
3342 Py_CLEAR(clear_module_state->__pyx_n_s_length);
3343 Py_CLEAR(clear_module_state->__pyx_n_s_line);
3344 Py_CLEAR(clear_module_state->__pyx_n_s_main);
3345 Py_CLEAR(clear_module_state->__pyx_n_s_mode);
3346 Py_CLEAR(clear_module_state->__pyx_n_s_name);
3347 Py_CLEAR(clear_module_state->__pyx_n_s_nbytes);
3348 Py_CLEAR(clear_module_state->__pyx_n_s_off);
3349 Py_CLEAR(clear_module_state->__pyx_n_s_offset);
3350 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libcbgzf);
3351 Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libcbgzf_pyx);
3352 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state);
3353 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
3354 Py_CLEAR(clear_module_state->__pyx_n_u_rb);
3355 Py_CLEAR(clear_module_state->__pyx_n_s_read);
3356 Py_CLEAR(clear_module_state->__pyx_kp_u_read_on_closed_BGZFile_object);
3357 Py_CLEAR(clear_module_state->__pyx_kp_u_read_on_write_only_BGZFile_objec);
3358 Py_CLEAR(clear_module_state->__pyx_n_s_read_size);
3359 Py_CLEAR(clear_module_state->__pyx_n_s_readable);
3360 Py_CLEAR(clear_module_state->__pyx_kp_u_readable_on_closed_BGZFile_objec);
3361 Py_CLEAR(clear_module_state->__pyx_n_s_readline);
3362 Py_CLEAR(clear_module_state->__pyx_kp_u_readline_on_closed_BGZFile_objec);
3363 Py_CLEAR(clear_module_state->__pyx_n_s_reduce);
3364 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython);
3365 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex);
3366 Py_CLEAR(clear_module_state->__pyx_n_s_ret);
3367 Py_CLEAR(clear_module_state->__pyx_n_s_rewind);
3368 Py_CLEAR(clear_module_state->__pyx_kp_u_rewind_on_closed_BGZFile_object);
3369 Py_CLEAR(clear_module_state->__pyx_n_s_s);
3370 Py_CLEAR(clear_module_state->__pyx_n_s_seek);
3371 Py_CLEAR(clear_module_state->__pyx_kp_u_seek_on_closed_BGZFile_object);
3372 Py_CLEAR(clear_module_state->__pyx_n_s_seekable);
3373 Py_CLEAR(clear_module_state->__pyx_n_s_self);
3374 Py_CLEAR(clear_module_state->__pyx_kp_s_self_bgzf_cannot_be_converted_to);
3375 Py_CLEAR(clear_module_state->__pyx_n_s_setstate);
3376 Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython);
3377 Py_CLEAR(clear_module_state->__pyx_n_s_size);
3378 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
3379 Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource);
3380 Py_CLEAR(clear_module_state->__pyx_n_u_t);
3381 Py_CLEAR(clear_module_state->__pyx_n_s_tb);
3382 Py_CLEAR(clear_module_state->__pyx_n_s_tell);
3383 Py_CLEAR(clear_module_state->__pyx_n_s_test);
3384 Py_CLEAR(clear_module_state->__pyx_n_s_type);
3385 Py_CLEAR(clear_module_state->__pyx_n_s_value);
3386 Py_CLEAR(clear_module_state->__pyx_n_s_whence);
3387 Py_CLEAR(clear_module_state->__pyx_n_s_writable);
3388 Py_CLEAR(clear_module_state->__pyx_n_s_write);
3389 Py_CLEAR(clear_module_state->__pyx_kp_u_write_on_closed_BGZFile_object);
3390 Py_CLEAR(clear_module_state->__pyx_kp_u_write_on_read_only_BGZFile_objec);
3391 Py_CLEAR(clear_module_state->__pyx_int_0);
3392 Py_CLEAR(clear_module_state->__pyx_int_neg_1);
3393 Py_CLEAR(clear_module_state->__pyx_k__18);
3394 Py_CLEAR(clear_module_state->__pyx_tuple_);
3395 Py_CLEAR(clear_module_state->__pyx_tuple__2);
3396 Py_CLEAR(clear_module_state->__pyx_tuple__4);
3397 Py_CLEAR(clear_module_state->__pyx_tuple__5);
3398 Py_CLEAR(clear_module_state->__pyx_tuple__6);
3399 Py_CLEAR(clear_module_state->__pyx_tuple__8);
3400 Py_CLEAR(clear_module_state->__pyx_tuple__9);
3401 Py_CLEAR(clear_module_state->__pyx_tuple__10);
3402 Py_CLEAR(clear_module_state->__pyx_tuple__11);
3403 Py_CLEAR(clear_module_state->__pyx_tuple__12);
3404 Py_CLEAR(clear_module_state->__pyx_tuple__13);
3405 Py_CLEAR(clear_module_state->__pyx_tuple__14);
3406 Py_CLEAR(clear_module_state->__pyx_tuple__15);
3407 Py_CLEAR(clear_module_state->__pyx_tuple__16);
3408 Py_CLEAR(clear_module_state->__pyx_tuple__17);
3409 Py_CLEAR(clear_module_state->__pyx_tuple__19);
3410 Py_CLEAR(clear_module_state->__pyx_tuple__20);
3411 Py_CLEAR(clear_module_state->__pyx_tuple__21);
3412 Py_CLEAR(clear_module_state->__pyx_tuple__22);
3413 Py_CLEAR(clear_module_state->__pyx_tuple__24);
3414 Py_CLEAR(clear_module_state->__pyx_tuple__26);
3415 Py_CLEAR(clear_module_state->__pyx_tuple__27);
3416 Py_CLEAR(clear_module_state->__pyx_tuple__29);
3417 Py_CLEAR(clear_module_state->__pyx_tuple__31);
3418 Py_CLEAR(clear_module_state->__pyx_tuple__39);
3419 Py_CLEAR(clear_module_state->__pyx_tuple__41);
3420 Py_CLEAR(clear_module_state->__pyx_tuple__43);
3421 Py_CLEAR(clear_module_state->__pyx_tuple__46);
3422 Py_CLEAR(clear_module_state->__pyx_codeobj__23);
3423 Py_CLEAR(clear_module_state->__pyx_codeobj__25);
3424 Py_CLEAR(clear_module_state->__pyx_codeobj__28);
3425 Py_CLEAR(clear_module_state->__pyx_codeobj__30);
3426 Py_CLEAR(clear_module_state->__pyx_codeobj__32);
3427 Py_CLEAR(clear_module_state->__pyx_codeobj__33);
3428 Py_CLEAR(clear_module_state->__pyx_codeobj__34);
3429 Py_CLEAR(clear_module_state->__pyx_codeobj__35);
3430 Py_CLEAR(clear_module_state->__pyx_codeobj__36);
3431 Py_CLEAR(clear_module_state->__pyx_codeobj__37);
3432 Py_CLEAR(clear_module_state->__pyx_codeobj__38);
3433 Py_CLEAR(clear_module_state->__pyx_codeobj__40);
3434 Py_CLEAR(clear_module_state->__pyx_codeobj__42);
3435 Py_CLEAR(clear_module_state->__pyx_codeobj__44);
3436 Py_CLEAR(clear_module_state->__pyx_codeobj__45);
3437 Py_CLEAR(clear_module_state->__pyx_codeobj__47);
3438 return 0;
3439 }
3440 #endif
3441 /* #### Code section: module_state_traverse ### */
3442 #if CYTHON_USE_MODULE_STATE
3443 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
3444 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
3445 if (!traverse_module_state) return 0;
3446 Py_VISIT(traverse_module_state->__pyx_d);
3447 Py_VISIT(traverse_module_state->__pyx_b);
3448 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
3449 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
3450 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
3451 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
3452 #ifdef __Pyx_CyFunction_USED
3453 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
3454 #endif
3455 #ifdef __Pyx_FusedFunction_USED
3456 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
3457 #endif
3458 Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
3459 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
3460 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
3461 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
3462 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
3463 Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_8libcbgzf_BGZFile);
3464 Py_VISIT(traverse_module_state->__pyx_type_5pysam_8libcbgzf_BGZFile);
3465 Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError);
3466 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile);
3467 Py_VISIT(traverse_module_state->__pyx_n_u_BGZFile);
3468 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile___enter);
3469 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile___exit);
3470 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile___reduce_cython);
3471 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile___setstate_cython);
3472 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_close);
3473 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_fileno);
3474 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_flush);
3475 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_read);
3476 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_readable);
3477 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_readline);
3478 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_rewind);
3479 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_seek);
3480 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_seekable);
3481 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_tell);
3482 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_writable);
3483 Py_VISIT(traverse_module_state->__pyx_n_s_BGZFile_write);
3484 Py_VISIT(traverse_module_state->__pyx_kp_u_BGZFile_write_failed);
3485 Py_VISIT(traverse_module_state->__pyx_n_s_BUFFER_SIZE);
3486 Py_VISIT(traverse_module_state->__pyx_kp_u_Can_t_rewind_in_write_mode);
3487 Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_write_index);
3488 Py_VISIT(traverse_module_state->__pyx_n_s_DEFAULT_BUFFER_SIZE);
3489 Py_VISIT(traverse_module_state->__pyx_n_s_EBADF);
3490 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_building_bgzf_index);
3491 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_closing_BGZFile_object);
3492 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_flushing_BGZFile_object);
3493 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_in_tell_on_BGZFFile_object);
3494 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_reading_from_BGZFile);
3495 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_reading_line_in_BGZFFile_o);
3496 Py_VISIT(traverse_module_state->__pyx_kp_u_Error_seeking_BGZFFile_object);
3497 Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
3498 Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_r);
3499 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
3500 Py_VISIT(traverse_module_state->__pyx_n_s_SEEK_SET);
3501 Py_VISIT(traverse_module_state->__pyx_kp_u_Seek_from_end_not_supported);
3502 Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration);
3503 Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
3504 Py_VISIT(traverse_module_state->__pyx_n_u_U);
3505 Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
3506 Py_VISIT(traverse_module_state->__pyx_n_s__3);
3507 Py_VISIT(traverse_module_state->__pyx_n_s__48);
3508 Py_VISIT(traverse_module_state->__pyx_kp_b__7);
3509 Py_VISIT(traverse_module_state->__pyx_n_s_all);
3510 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
3511 Py_VISIT(traverse_module_state->__pyx_n_u_b);
3512 Py_VISIT(traverse_module_state->__pyx_n_s_c);
3513 Py_VISIT(traverse_module_state->__pyx_n_s_cdata);
3514 Py_VISIT(traverse_module_state->__pyx_n_s_chunk);
3515 Py_VISIT(traverse_module_state->__pyx_n_s_chunks);
3516 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
3517 Py_VISIT(traverse_module_state->__pyx_n_s_close);
3518 Py_VISIT(traverse_module_state->__pyx_n_s_data);
3519 Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
3520 Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
3521 Py_VISIT(traverse_module_state->__pyx_n_s_enter);
3522 Py_VISIT(traverse_module_state->__pyx_n_s_errno);
3523 Py_VISIT(traverse_module_state->__pyx_n_s_exit);
3524 Py_VISIT(traverse_module_state->__pyx_n_s_filename);
3525 Py_VISIT(traverse_module_state->__pyx_n_s_fileno);
3526 Py_VISIT(traverse_module_state->__pyx_n_u_fileno);
3527 Py_VISIT(traverse_module_state->__pyx_n_s_flush);
3528 Py_VISIT(traverse_module_state->__pyx_n_s_format);
3529 Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
3530 Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
3531 Py_VISIT(traverse_module_state->__pyx_n_s_import);
3532 Py_VISIT(traverse_module_state->__pyx_n_s_index);
3533 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
3534 Py_VISIT(traverse_module_state->__pyx_n_s_io);
3535 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
3536 Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
3537 Py_VISIT(traverse_module_state->__pyx_n_s_join);
3538 Py_VISIT(traverse_module_state->__pyx_n_s_length);
3539 Py_VISIT(traverse_module_state->__pyx_n_s_line);
3540 Py_VISIT(traverse_module_state->__pyx_n_s_main);
3541 Py_VISIT(traverse_module_state->__pyx_n_s_mode);
3542 Py_VISIT(traverse_module_state->__pyx_n_s_name);
3543 Py_VISIT(traverse_module_state->__pyx_n_s_nbytes);
3544 Py_VISIT(traverse_module_state->__pyx_n_s_off);
3545 Py_VISIT(traverse_module_state->__pyx_n_s_offset);
3546 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libcbgzf);
3547 Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libcbgzf_pyx);
3548 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state);
3549 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
3550 Py_VISIT(traverse_module_state->__pyx_n_u_rb);
3551 Py_VISIT(traverse_module_state->__pyx_n_s_read);
3552 Py_VISIT(traverse_module_state->__pyx_kp_u_read_on_closed_BGZFile_object);
3553 Py_VISIT(traverse_module_state->__pyx_kp_u_read_on_write_only_BGZFile_objec);
3554 Py_VISIT(traverse_module_state->__pyx_n_s_read_size);
3555 Py_VISIT(traverse_module_state->__pyx_n_s_readable);
3556 Py_VISIT(traverse_module_state->__pyx_kp_u_readable_on_closed_BGZFile_objec);
3557 Py_VISIT(traverse_module_state->__pyx_n_s_readline);
3558 Py_VISIT(traverse_module_state->__pyx_kp_u_readline_on_closed_BGZFile_objec);
3559 Py_VISIT(traverse_module_state->__pyx_n_s_reduce);
3560 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython);
3561 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex);
3562 Py_VISIT(traverse_module_state->__pyx_n_s_ret);
3563 Py_VISIT(traverse_module_state->__pyx_n_s_rewind);
3564 Py_VISIT(traverse_module_state->__pyx_kp_u_rewind_on_closed_BGZFile_object);
3565 Py_VISIT(traverse_module_state->__pyx_n_s_s);
3566 Py_VISIT(traverse_module_state->__pyx_n_s_seek);
3567 Py_VISIT(traverse_module_state->__pyx_kp_u_seek_on_closed_BGZFile_object);
3568 Py_VISIT(traverse_module_state->__pyx_n_s_seekable);
3569 Py_VISIT(traverse_module_state->__pyx_n_s_self);
3570 Py_VISIT(traverse_module_state->__pyx_kp_s_self_bgzf_cannot_be_converted_to);
3571 Py_VISIT(traverse_module_state->__pyx_n_s_setstate);
3572 Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython);
3573 Py_VISIT(traverse_module_state->__pyx_n_s_size);
3574 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
3575 Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource);
3576 Py_VISIT(traverse_module_state->__pyx_n_u_t);
3577 Py_VISIT(traverse_module_state->__pyx_n_s_tb);
3578 Py_VISIT(traverse_module_state->__pyx_n_s_tell);
3579 Py_VISIT(traverse_module_state->__pyx_n_s_test);
3580 Py_VISIT(traverse_module_state->__pyx_n_s_type);
3581 Py_VISIT(traverse_module_state->__pyx_n_s_value);
3582 Py_VISIT(traverse_module_state->__pyx_n_s_whence);
3583 Py_VISIT(traverse_module_state->__pyx_n_s_writable);
3584 Py_VISIT(traverse_module_state->__pyx_n_s_write);
3585 Py_VISIT(traverse_module_state->__pyx_kp_u_write_on_closed_BGZFile_object);
3586 Py_VISIT(traverse_module_state->__pyx_kp_u_write_on_read_only_BGZFile_objec);
3587 Py_VISIT(traverse_module_state->__pyx_int_0);
3588 Py_VISIT(traverse_module_state->__pyx_int_neg_1);
3589 Py_VISIT(traverse_module_state->__pyx_k__18);
3590 Py_VISIT(traverse_module_state->__pyx_tuple_);
3591 Py_VISIT(traverse_module_state->__pyx_tuple__2);
3592 Py_VISIT(traverse_module_state->__pyx_tuple__4);
3593 Py_VISIT(traverse_module_state->__pyx_tuple__5);
3594 Py_VISIT(traverse_module_state->__pyx_tuple__6);
3595 Py_VISIT(traverse_module_state->__pyx_tuple__8);
3596 Py_VISIT(traverse_module_state->__pyx_tuple__9);
3597 Py_VISIT(traverse_module_state->__pyx_tuple__10);
3598 Py_VISIT(traverse_module_state->__pyx_tuple__11);
3599 Py_VISIT(traverse_module_state->__pyx_tuple__12);
3600 Py_VISIT(traverse_module_state->__pyx_tuple__13);
3601 Py_VISIT(traverse_module_state->__pyx_tuple__14);
3602 Py_VISIT(traverse_module_state->__pyx_tuple__15);
3603 Py_VISIT(traverse_module_state->__pyx_tuple__16);
3604 Py_VISIT(traverse_module_state->__pyx_tuple__17);
3605 Py_VISIT(traverse_module_state->__pyx_tuple__19);
3606 Py_VISIT(traverse_module_state->__pyx_tuple__20);
3607 Py_VISIT(traverse_module_state->__pyx_tuple__21);
3608 Py_VISIT(traverse_module_state->__pyx_tuple__22);
3609 Py_VISIT(traverse_module_state->__pyx_tuple__24);
3610 Py_VISIT(traverse_module_state->__pyx_tuple__26);
3611 Py_VISIT(traverse_module_state->__pyx_tuple__27);
3612 Py_VISIT(traverse_module_state->__pyx_tuple__29);
3613 Py_VISIT(traverse_module_state->__pyx_tuple__31);
3614 Py_VISIT(traverse_module_state->__pyx_tuple__39);
3615 Py_VISIT(traverse_module_state->__pyx_tuple__41);
3616 Py_VISIT(traverse_module_state->__pyx_tuple__43);
3617 Py_VISIT(traverse_module_state->__pyx_tuple__46);
3618 Py_VISIT(traverse_module_state->__pyx_codeobj__23);
3619 Py_VISIT(traverse_module_state->__pyx_codeobj__25);
3620 Py_VISIT(traverse_module_state->__pyx_codeobj__28);
3621 Py_VISIT(traverse_module_state->__pyx_codeobj__30);
3622 Py_VISIT(traverse_module_state->__pyx_codeobj__32);
3623 Py_VISIT(traverse_module_state->__pyx_codeobj__33);
3624 Py_VISIT(traverse_module_state->__pyx_codeobj__34);
3625 Py_VISIT(traverse_module_state->__pyx_codeobj__35);
3626 Py_VISIT(traverse_module_state->__pyx_codeobj__36);
3627 Py_VISIT(traverse_module_state->__pyx_codeobj__37);
3628 Py_VISIT(traverse_module_state->__pyx_codeobj__38);
3629 Py_VISIT(traverse_module_state->__pyx_codeobj__40);
3630 Py_VISIT(traverse_module_state->__pyx_codeobj__42);
3631 Py_VISIT(traverse_module_state->__pyx_codeobj__44);
3632 Py_VISIT(traverse_module_state->__pyx_codeobj__45);
3633 Py_VISIT(traverse_module_state->__pyx_codeobj__47);
3634 return 0;
3635 }
3636 #endif
3637 /* #### Code section: module_state_defines ### */
3638 #define __pyx_d __pyx_mstate_global->__pyx_d
3639 #define __pyx_b __pyx_mstate_global->__pyx_b
3640 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
3641 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
3642 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
3643 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
3644 #ifdef __Pyx_CyFunction_USED
3645 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
3646 #endif
3647 #ifdef __Pyx_FusedFunction_USED
3648 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
3649 #endif
3650 #ifdef __Pyx_Generator_USED
3651 #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
3652 #endif
3653 #ifdef __Pyx_IterableCoroutine_USED
3654 #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
3655 #endif
3656 #ifdef __Pyx_Coroutine_USED
3657 #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
3658 #endif
3659 #ifdef __Pyx_Coroutine_USED
3660 #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
3661 #endif
3662 #if CYTHON_USE_MODULE_STATE
3663 #endif
3664 #if CYTHON_USE_MODULE_STATE
3665 #endif
3666 #if CYTHON_USE_MODULE_STATE
3667 #endif
3668 #if CYTHON_USE_MODULE_STATE
3669 #endif
3670 #if CYTHON_USE_MODULE_STATE
3671 #endif
3672 #if CYTHON_USE_MODULE_STATE
3673 #endif
3674 #define __pyx_ptype_5pysam_10libchtslib_HTSFile __pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile
3675 #if CYTHON_USE_MODULE_STATE
3676 #endif
3677 #if CYTHON_USE_MODULE_STATE
3678 #endif
3679 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
3680 #if CYTHON_USE_MODULE_STATE
3681 #endif
3682 #if CYTHON_USE_MODULE_STATE
3683 #endif
3684 #if CYTHON_USE_MODULE_STATE
3685 #endif
3686 #if CYTHON_USE_MODULE_STATE
3687 #endif
3688 #if CYTHON_USE_MODULE_STATE
3689 #endif
3690 #if CYTHON_USE_MODULE_STATE
3691 #endif
3692 #if CYTHON_USE_MODULE_STATE
3693 #endif
3694 #if CYTHON_USE_MODULE_STATE
3695 #endif
3696 #if CYTHON_USE_MODULE_STATE
3697 #endif
3698 #if CYTHON_USE_MODULE_STATE
3699 #endif
3700 #if CYTHON_USE_MODULE_STATE
3701 #endif
3702 #if CYTHON_USE_MODULE_STATE
3703 #endif
3704 #if CYTHON_USE_MODULE_STATE
3705 #endif
3706 #if CYTHON_USE_MODULE_STATE
3707 #endif
3708 #define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool
3709 #if CYTHON_USE_MODULE_STATE
3710 #endif
3711 #if CYTHON_USE_MODULE_STATE
3712 #endif
3713 #if CYTHON_USE_MODULE_STATE
3714 #endif
3715 #if CYTHON_USE_MODULE_STATE
3716 #endif
3717 #define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex
3718 #if CYTHON_USE_MODULE_STATE
3719 #endif
3720 #if CYTHON_USE_MODULE_STATE
3721 #endif
3722 #if CYTHON_USE_MODULE_STATE
3723 #endif
3724 #if CYTHON_USE_MODULE_STATE
3725 #endif
3726 #if CYTHON_USE_MODULE_STATE
3727 #endif
3728 #if CYTHON_USE_MODULE_STATE
3729 #endif
3730 #if CYTHON_USE_MODULE_STATE
3731 #endif
3732 #if CYTHON_USE_MODULE_STATE
3733 #endif
3734 #if CYTHON_USE_MODULE_STATE
3735 #endif
3736 #if CYTHON_USE_MODULE_STATE
3737 #endif
3738 #if CYTHON_USE_MODULE_STATE
3739 #endif
3740 #if CYTHON_USE_MODULE_STATE
3741 #endif
3742 #if CYTHON_USE_MODULE_STATE
3743 #endif
3744 #if CYTHON_USE_MODULE_STATE
3745 #endif
3746 #if CYTHON_USE_MODULE_STATE
3747 #endif
3748 #if CYTHON_USE_MODULE_STATE
3749 #endif
3750 #if CYTHON_USE_MODULE_STATE
3751 #endif
3752 #if CYTHON_USE_MODULE_STATE
3753 #endif
3754 #if CYTHON_USE_MODULE_STATE
3755 #endif
3756 #if CYTHON_USE_MODULE_STATE
3757 #endif
3758 #if CYTHON_USE_MODULE_STATE
3759 #endif
3760 #if CYTHON_USE_MODULE_STATE
3761 #endif
3762 #if CYTHON_USE_MODULE_STATE
3763 #endif
3764 #if CYTHON_USE_MODULE_STATE
3765 #endif
3766 #define __pyx_ptype_7cpython_5array_array __pyx_mstate_global->__pyx_ptype_7cpython_5array_array
3767 #if CYTHON_USE_MODULE_STATE
3768 #endif
3769 #if CYTHON_USE_MODULE_STATE
3770 #define __pyx_type_5pysam_8libcbgzf_BGZFile __pyx_mstate_global->__pyx_type_5pysam_8libcbgzf_BGZFile
3771 #endif
3772 #define __pyx_ptype_5pysam_8libcbgzf_BGZFile __pyx_mstate_global->__pyx_ptype_5pysam_8libcbgzf_BGZFile
3773 #define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError
3774 #define __pyx_n_s_BGZFile __pyx_mstate_global->__pyx_n_s_BGZFile
3775 #define __pyx_n_u_BGZFile __pyx_mstate_global->__pyx_n_u_BGZFile
3776 #define __pyx_n_s_BGZFile___enter __pyx_mstate_global->__pyx_n_s_BGZFile___enter
3777 #define __pyx_n_s_BGZFile___exit __pyx_mstate_global->__pyx_n_s_BGZFile___exit
3778 #define __pyx_n_s_BGZFile___reduce_cython __pyx_mstate_global->__pyx_n_s_BGZFile___reduce_cython
3779 #define __pyx_n_s_BGZFile___setstate_cython __pyx_mstate_global->__pyx_n_s_BGZFile___setstate_cython
3780 #define __pyx_n_s_BGZFile_close __pyx_mstate_global->__pyx_n_s_BGZFile_close
3781 #define __pyx_n_s_BGZFile_fileno __pyx_mstate_global->__pyx_n_s_BGZFile_fileno
3782 #define __pyx_n_s_BGZFile_flush __pyx_mstate_global->__pyx_n_s_BGZFile_flush
3783 #define __pyx_n_s_BGZFile_read __pyx_mstate_global->__pyx_n_s_BGZFile_read
3784 #define __pyx_n_s_BGZFile_readable __pyx_mstate_global->__pyx_n_s_BGZFile_readable
3785 #define __pyx_n_s_BGZFile_readline __pyx_mstate_global->__pyx_n_s_BGZFile_readline
3786 #define __pyx_n_s_BGZFile_rewind __pyx_mstate_global->__pyx_n_s_BGZFile_rewind
3787 #define __pyx_n_s_BGZFile_seek __pyx_mstate_global->__pyx_n_s_BGZFile_seek
3788 #define __pyx_n_s_BGZFile_seekable __pyx_mstate_global->__pyx_n_s_BGZFile_seekable
3789 #define __pyx_n_s_BGZFile_tell __pyx_mstate_global->__pyx_n_s_BGZFile_tell
3790 #define __pyx_n_s_BGZFile_writable __pyx_mstate_global->__pyx_n_s_BGZFile_writable
3791 #define __pyx_n_s_BGZFile_write __pyx_mstate_global->__pyx_n_s_BGZFile_write
3792 #define __pyx_kp_u_BGZFile_write_failed __pyx_mstate_global->__pyx_kp_u_BGZFile_write_failed
3793 #define __pyx_n_s_BUFFER_SIZE __pyx_mstate_global->__pyx_n_s_BUFFER_SIZE
3794 #define __pyx_kp_u_Can_t_rewind_in_write_mode __pyx_mstate_global->__pyx_kp_u_Can_t_rewind_in_write_mode
3795 #define __pyx_kp_u_Cannot_write_index __pyx_mstate_global->__pyx_kp_u_Cannot_write_index
3796 #define __pyx_n_s_DEFAULT_BUFFER_SIZE __pyx_mstate_global->__pyx_n_s_DEFAULT_BUFFER_SIZE
3797 #define __pyx_n_s_EBADF __pyx_mstate_global->__pyx_n_s_EBADF
3798 #define __pyx_kp_u_Error_building_bgzf_index __pyx_mstate_global->__pyx_kp_u_Error_building_bgzf_index
3799 #define __pyx_kp_u_Error_closing_BGZFile_object __pyx_mstate_global->__pyx_kp_u_Error_closing_BGZFile_object
3800 #define __pyx_kp_u_Error_flushing_BGZFile_object __pyx_mstate_global->__pyx_kp_u_Error_flushing_BGZFile_object
3801 #define __pyx_kp_u_Error_in_tell_on_BGZFFile_object __pyx_mstate_global->__pyx_kp_u_Error_in_tell_on_BGZFFile_object
3802 #define __pyx_kp_u_Error_reading_from_BGZFile __pyx_mstate_global->__pyx_kp_u_Error_reading_from_BGZFile
3803 #define __pyx_kp_u_Error_reading_line_in_BGZFFile_o __pyx_mstate_global->__pyx_kp_u_Error_reading_line_in_BGZFFile_o
3804 #define __pyx_kp_u_Error_seeking_BGZFFile_object __pyx_mstate_global->__pyx_kp_u_Error_seeking_BGZFFile_object
3805 #define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
3806 #define __pyx_kp_u_Invalid_mode_r __pyx_mstate_global->__pyx_kp_u_Invalid_mode_r
3807 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
3808 #define __pyx_n_s_SEEK_SET __pyx_mstate_global->__pyx_n_s_SEEK_SET
3809 #define __pyx_kp_u_Seek_from_end_not_supported __pyx_mstate_global->__pyx_kp_u_Seek_from_end_not_supported
3810 #define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration
3811 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
3812 #define __pyx_n_u_U __pyx_mstate_global->__pyx_n_u_U
3813 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
3814 #define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3
3815 #define __pyx_n_s__48 __pyx_mstate_global->__pyx_n_s__48
3816 #define __pyx_kp_b__7 __pyx_mstate_global->__pyx_kp_b__7
3817 #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
3818 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
3819 #define __pyx_n_u_b __pyx_mstate_global->__pyx_n_u_b
3820 #define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c
3821 #define __pyx_n_s_cdata __pyx_mstate_global->__pyx_n_s_cdata
3822 #define __pyx_n_s_chunk __pyx_mstate_global->__pyx_n_s_chunk
3823 #define __pyx_n_s_chunks __pyx_mstate_global->__pyx_n_s_chunks
3824 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
3825 #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
3826 #define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data
3827 #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
3828 #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
3829 #define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter
3830 #define __pyx_n_s_errno __pyx_mstate_global->__pyx_n_s_errno
3831 #define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit
3832 #define __pyx_n_s_filename __pyx_mstate_global->__pyx_n_s_filename
3833 #define __pyx_n_s_fileno __pyx_mstate_global->__pyx_n_s_fileno
3834 #define __pyx_n_u_fileno __pyx_mstate_global->__pyx_n_u_fileno
3835 #define __pyx_n_s_flush __pyx_mstate_global->__pyx_n_s_flush
3836 #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
3837 #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
3838 #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
3839 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
3840 #define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index
3841 #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
3842 #define __pyx_n_s_io __pyx_mstate_global->__pyx_n_s_io
3843 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
3844 #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
3845 #define __pyx_n_s_join __pyx_mstate_global->__pyx_n_s_join
3846 #define __pyx_n_s_length __pyx_mstate_global->__pyx_n_s_length
3847 #define __pyx_n_s_line __pyx_mstate_global->__pyx_n_s_line
3848 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
3849 #define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
3850 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
3851 #define __pyx_n_s_nbytes __pyx_mstate_global->__pyx_n_s_nbytes
3852 #define __pyx_n_s_off __pyx_mstate_global->__pyx_n_s_off
3853 #define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset
3854 #define __pyx_n_s_pysam_libcbgzf __pyx_mstate_global->__pyx_n_s_pysam_libcbgzf
3855 #define __pyx_kp_s_pysam_libcbgzf_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libcbgzf_pyx
3856 #define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state
3857 #define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
3858 #define __pyx_n_u_rb __pyx_mstate_global->__pyx_n_u_rb
3859 #define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read
3860 #define __pyx_kp_u_read_on_closed_BGZFile_object __pyx_mstate_global->__pyx_kp_u_read_on_closed_BGZFile_object
3861 #define __pyx_kp_u_read_on_write_only_BGZFile_objec __pyx_mstate_global->__pyx_kp_u_read_on_write_only_BGZFile_objec
3862 #define __pyx_n_s_read_size __pyx_mstate_global->__pyx_n_s_read_size
3863 #define __pyx_n_s_readable __pyx_mstate_global->__pyx_n_s_readable
3864 #define __pyx_kp_u_readable_on_closed_BGZFile_objec __pyx_mstate_global->__pyx_kp_u_readable_on_closed_BGZFile_objec
3865 #define __pyx_n_s_readline __pyx_mstate_global->__pyx_n_s_readline
3866 #define __pyx_kp_u_readline_on_closed_BGZFile_objec __pyx_mstate_global->__pyx_kp_u_readline_on_closed_BGZFile_objec
3867 #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce
3868 #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython
3869 #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex
3870 #define __pyx_n_s_ret __pyx_mstate_global->__pyx_n_s_ret
3871 #define __pyx_n_s_rewind __pyx_mstate_global->__pyx_n_s_rewind
3872 #define __pyx_kp_u_rewind_on_closed_BGZFile_object __pyx_mstate_global->__pyx_kp_u_rewind_on_closed_BGZFile_object
3873 #define __pyx_n_s_s __pyx_mstate_global->__pyx_n_s_s
3874 #define __pyx_n_s_seek __pyx_mstate_global->__pyx_n_s_seek
3875 #define __pyx_kp_u_seek_on_closed_BGZFile_object __pyx_mstate_global->__pyx_kp_u_seek_on_closed_BGZFile_object
3876 #define __pyx_n_s_seekable __pyx_mstate_global->__pyx_n_s_seekable
3877 #define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
3878 #define __pyx_kp_s_self_bgzf_cannot_be_converted_to __pyx_mstate_global->__pyx_kp_s_self_bgzf_cannot_be_converted_to
3879 #define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate
3880 #define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython
3881 #define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size
3882 #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
3883 #define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource
3884 #define __pyx_n_u_t __pyx_mstate_global->__pyx_n_u_t
3885 #define __pyx_n_s_tb __pyx_mstate_global->__pyx_n_s_tb
3886 #define __pyx_n_s_tell __pyx_mstate_global->__pyx_n_s_tell
3887 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
3888 #define __pyx_n_s_type __pyx_mstate_global->__pyx_n_s_type
3889 #define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value
3890 #define __pyx_n_s_whence __pyx_mstate_global->__pyx_n_s_whence
3891 #define __pyx_n_s_writable __pyx_mstate_global->__pyx_n_s_writable
3892 #define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write
3893 #define __pyx_kp_u_write_on_closed_BGZFile_object __pyx_mstate_global->__pyx_kp_u_write_on_closed_BGZFile_object
3894 #define __pyx_kp_u_write_on_read_only_BGZFile_objec __pyx_mstate_global->__pyx_kp_u_write_on_read_only_BGZFile_objec
3895 #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
3896 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
3897 #define __pyx_k__18 __pyx_mstate_global->__pyx_k__18
3898 #define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_
3899 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
3900 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
3901 #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
3902 #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
3903 #define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8
3904 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
3905 #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10
3906 #define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11
3907 #define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12
3908 #define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13
3909 #define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14
3910 #define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
3911 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
3912 #define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17
3913 #define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
3914 #define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20
3915 #define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21
3916 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
3917 #define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24
3918 #define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26
3919 #define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
3920 #define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29
3921 #define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31
3922 #define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39
3923 #define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41
3924 #define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43
3925 #define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46
3926 #define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23
3927 #define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25
3928 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28
3929 #define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30
3930 #define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32
3931 #define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33
3932 #define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34
3933 #define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35
3934 #define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36
3935 #define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37
3936 #define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38
3937 #define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40
3938 #define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42
3939 #define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44
3940 #define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45
3941 #define __pyx_codeobj__47 __pyx_mstate_global->__pyx_codeobj__47
3942 /* #### Code section: module_code ### */
3943
3944 /* "cpython/complex.pxd":19
3945 *
3946 * @property
3947 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
3948 * return self.cval.real
3949 *
3950 */
3951
3952 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
3953 double __pyx_r;
3954
3955 /* "cpython/complex.pxd":20
3956 * @property
3957 * cdef inline double real(self) noexcept:
3958 * return self.cval.real # <<<<<<<<<<<<<<
3959 *
3960 * @property
3961 */
3962 __pyx_r = __pyx_v_self->cval.real;
3963 goto __pyx_L0;
3964
3965 /* "cpython/complex.pxd":19
3966 *
3967 * @property
3968 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
3969 * return self.cval.real
3970 *
3971 */
3972
3973 /* function exit code */
3974 __pyx_L0:;
3975 return __pyx_r;
3976 }
3977
3978 /* "cpython/complex.pxd":23
3979 *
3980 * @property
3981 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
3982 * return self.cval.imag
3983 *
3984 */
3985
3986 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
3987 double __pyx_r;
3988
3989 /* "cpython/complex.pxd":24
3990 * @property
3991 * cdef inline double imag(self) noexcept:
3992 * return self.cval.imag # <<<<<<<<<<<<<<
3993 *
3994 * # PyTypeObject PyComplex_Type
3995 */
3996 __pyx_r = __pyx_v_self->cval.imag;
3997 goto __pyx_L0;
3998
3999 /* "cpython/complex.pxd":23
4000 *
4001 * @property
4002 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
4003 * return self.cval.imag
4004 *
4005 */
4006
4007 /* function exit code */
4008 __pyx_L0:;
4009 return __pyx_r;
4010 }
4011
4012 /* "cpython/contextvars.pxd":112
4013 *
4014 *
4015 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
4016 * """Return a new reference to the value of the context variable,
4017 * or the default value of the context variable,
4018 */
4019
4020 static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {
4021 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
4022 PyObject *__pyx_v_value;
4023 PyObject *__pyx_v_pyvalue = NULL;
4024 PyObject *__pyx_r = NULL;
4025 __Pyx_RefNannyDeclarations
4026 int __pyx_t_1;
4027 int __pyx_t_2;
4028 PyObject *__pyx_t_3 = NULL;
4029 int __pyx_lineno = 0;
4030 const char *__pyx_filename = NULL;
4031 int __pyx_clineno = 0;
4032 __Pyx_RefNannySetupContext("get_value", 1);
4033 if (__pyx_optional_args) {
4034 if (__pyx_optional_args->__pyx_n > 0) {
4035 __pyx_v_default_value = __pyx_optional_args->default_value;
4036 }
4037 }
4038
4039 /* "cpython/contextvars.pxd":117
4040 * or None if no such value or default was found.
4041 * """
4042 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
4043 * PyContextVar_Get(var, NULL, &value)
4044 * if value is NULL:
4045 */
4046 __pyx_v_value = NULL;
4047
4048 /* "cpython/contextvars.pxd":118
4049 * """
4050 * cdef PyObject *value = NULL
4051 * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<<
4052 * if value is NULL:
4053 * # context variable does not have a default
4054 */
4055 __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 118, __pyx_L1_error)
4056
4057 /* "cpython/contextvars.pxd":119
4058 * cdef PyObject *value = NULL
4059 * PyContextVar_Get(var, NULL, &value)
4060 * if value is NULL: # <<<<<<<<<<<<<<
4061 * # context variable does not have a default
4062 * pyvalue = default_value
4063 */
4064 __pyx_t_2 = (__pyx_v_value == NULL);
4065 if (__pyx_t_2) {
4066
4067 /* "cpython/contextvars.pxd":121
4068 * if value is NULL:
4069 * # context variable does not have a default
4070 * pyvalue = default_value # <<<<<<<<<<<<<<
4071 * else:
4072 * # value or default value of context variable
4073 */
4074 __Pyx_INCREF(__pyx_v_default_value);
4075 __pyx_v_pyvalue = __pyx_v_default_value;
4076
4077 /* "cpython/contextvars.pxd":119
4078 * cdef PyObject *value = NULL
4079 * PyContextVar_Get(var, NULL, &value)
4080 * if value is NULL: # <<<<<<<<<<<<<<
4081 * # context variable does not have a default
4082 * pyvalue = default_value
4083 */
4084 goto __pyx_L3;
4085 }
4086
4087 /* "cpython/contextvars.pxd":124
4088 * else:
4089 * # value or default value of context variable
4090 * pyvalue = <object>value # <<<<<<<<<<<<<<
4091 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
4092 * return pyvalue
4093 */
4094 /*else*/ {
4095 __pyx_t_3 = ((PyObject *)__pyx_v_value);
4096 __Pyx_INCREF(__pyx_t_3);
4097 __pyx_v_pyvalue = __pyx_t_3;
4098 __pyx_t_3 = 0;
4099
4100 /* "cpython/contextvars.pxd":125
4101 * # value or default value of context variable
4102 * pyvalue = <object>value
4103 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
4104 * return pyvalue
4105 *
4106 */
4107 Py_XDECREF(__pyx_v_value);
4108 }
4109 __pyx_L3:;
4110
4111 /* "cpython/contextvars.pxd":126
4112 * pyvalue = <object>value
4113 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
4114 * return pyvalue # <<<<<<<<<<<<<<
4115 *
4116 *
4117 */
4118 __Pyx_XDECREF(__pyx_r);
4119 __Pyx_INCREF(__pyx_v_pyvalue);
4120 __pyx_r = __pyx_v_pyvalue;
4121 goto __pyx_L0;
4122
4123 /* "cpython/contextvars.pxd":112
4124 *
4125 *
4126 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
4127 * """Return a new reference to the value of the context variable,
4128 * or the default value of the context variable,
4129 */
4130
4131 /* function exit code */
4132 __pyx_L1_error:;
4133 __Pyx_XDECREF(__pyx_t_3);
4134 __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
4135 __pyx_r = 0;
4136 __pyx_L0:;
4137 __Pyx_XDECREF(__pyx_v_pyvalue);
4138 __Pyx_XGIVEREF(__pyx_r);
4139 __Pyx_RefNannyFinishContext();
4140 return __pyx_r;
4141 }
4142
4143 /* "cpython/contextvars.pxd":129
4144 *
4145 *
4146 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
4147 * """Return a new reference to the value of the context variable,
4148 * or the provided default value if no such value was found.
4149 */
4150
4151 static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {
4152 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
4153 PyObject *__pyx_v_value;
4154 PyObject *__pyx_v_pyvalue = NULL;
4155 PyObject *__pyx_r = NULL;
4156 __Pyx_RefNannyDeclarations
4157 int __pyx_t_1;
4158 PyObject *__pyx_t_2 = NULL;
4159 int __pyx_lineno = 0;
4160 const char *__pyx_filename = NULL;
4161 int __pyx_clineno = 0;
4162 __Pyx_RefNannySetupContext("get_value_no_default", 1);
4163 if (__pyx_optional_args) {
4164 if (__pyx_optional_args->__pyx_n > 0) {
4165 __pyx_v_default_value = __pyx_optional_args->default_value;
4166 }
4167 }
4168
4169 /* "cpython/contextvars.pxd":135
4170 * Ignores the default value of the context variable, if any.
4171 * """
4172 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
4173 * PyContextVar_Get(var, <PyObject*>default_value, &value)
4174 * # value of context variable or 'default_value'
4175 */
4176 __pyx_v_value = NULL;
4177
4178 /* "cpython/contextvars.pxd":136
4179 * """
4180 * cdef PyObject *value = NULL
4181 * PyContextVar_Get(var, <PyObject*>default_value, &value) # <<<<<<<<<<<<<<
4182 * # value of context variable or 'default_value'
4183 * pyvalue = <object>value
4184 */
4185 __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 136, __pyx_L1_error)
4186
4187 /* "cpython/contextvars.pxd":138
4188 * PyContextVar_Get(var, <PyObject*>default_value, &value)
4189 * # value of context variable or 'default_value'
4190 * pyvalue = <object>value # <<<<<<<<<<<<<<
4191 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
4192 * return pyvalue
4193 */
4194 __pyx_t_2 = ((PyObject *)__pyx_v_value);
4195 __Pyx_INCREF(__pyx_t_2);
4196 __pyx_v_pyvalue = __pyx_t_2;
4197 __pyx_t_2 = 0;
4198
4199 /* "cpython/contextvars.pxd":139
4200 * # value of context variable or 'default_value'
4201 * pyvalue = <object>value
4202 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
4203 * return pyvalue
4204 */
4205 Py_XDECREF(__pyx_v_value);
4206
4207 /* "cpython/contextvars.pxd":140
4208 * pyvalue = <object>value
4209 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
4210 * return pyvalue # <<<<<<<<<<<<<<
4211 */
4212 __Pyx_XDECREF(__pyx_r);
4213 __Pyx_INCREF(__pyx_v_pyvalue);
4214 __pyx_r = __pyx_v_pyvalue;
4215 goto __pyx_L0;
4216
4217 /* "cpython/contextvars.pxd":129
4218 *
4219 *
4220 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
4221 * """Return a new reference to the value of the context variable,
4222 * or the provided default value if no such value was found.
4223 */
4224
4225 /* function exit code */
4226 __pyx_L1_error:;
4227 __Pyx_XDECREF(__pyx_t_2);
4228 __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
4229 __pyx_r = 0;
4230 __pyx_L0:;
4231 __Pyx_XDECREF(__pyx_v_pyvalue);
4232 __Pyx_XGIVEREF(__pyx_r);
4233 __Pyx_RefNannyFinishContext();
4234 return __pyx_r;
4235 }
4236
4237 /* "array.pxd":104
4238 * __data_union data
4239 *
4240 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
4241 * # This implementation of getbuffer is geared towards Cython
4242 * # requirements, and does not yet fulfill the PEP.
4243 */
4244
4245 /* Python wrapper */
4246 CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
4247 CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
4248 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
4249 int __pyx_r;
4250 __Pyx_RefNannyDeclarations
4251 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
4252 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
4253 __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
4254
4255 /* function exit code */
4256 __Pyx_RefNannyFinishContext();
4257 return __pyx_r;
4258 }
4259
4260 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
4261 PyObject *__pyx_v_item_count = NULL;
4262 int __pyx_r;
4263 __Pyx_RefNannyDeclarations
4264 PyObject *__pyx_t_1 = NULL;
4265 char *__pyx_t_2;
4266 int __pyx_t_3;
4267 PyObject *__pyx_t_4 = NULL;
4268 Py_ssize_t __pyx_t_5;
4269 int __pyx_t_6;
4270 char __pyx_t_7;
4271 int __pyx_lineno = 0;
4272 const char *__pyx_filename = NULL;
4273 int __pyx_clineno = 0;
4274 if (unlikely(__pyx_v_info == NULL)) {
4275 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
4276 return -1;
4277 }
4278 __Pyx_RefNannySetupContext("__getbuffer__", 0);
4279 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
4280 __Pyx_GIVEREF(__pyx_v_info->obj);
4281
4282 /* "array.pxd":109
4283 * # In particular strided access is always provided regardless
4284 * # of flags
4285 * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
4286 *
4287 * info.suboffsets = NULL
4288 */
4289 __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 109, __pyx_L1_error)
4290 __Pyx_GOTREF(__pyx_t_1);
4291 __pyx_v_item_count = __pyx_t_1;
4292 __pyx_t_1 = 0;
4293
4294 /* "array.pxd":111
4295 * item_count = Py_SIZE(self)
4296 *
4297 * info.suboffsets = NULL # <<<<<<<<<<<<<<
4298 * info.buf = self.data.as_chars
4299 * info.readonly = 0
4300 */
4301 __pyx_v_info->suboffsets = NULL;
4302
4303 /* "array.pxd":112
4304 *
4305 * info.suboffsets = NULL
4306 * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
4307 * info.readonly = 0
4308 * info.ndim = 1
4309 */
4310 __pyx_t_2 = __pyx_v_self->data.as_chars;
4311 __pyx_v_info->buf = __pyx_t_2;
4312
4313 /* "array.pxd":113
4314 * info.suboffsets = NULL
4315 * info.buf = self.data.as_chars
4316 * info.readonly = 0 # <<<<<<<<<<<<<<
4317 * info.ndim = 1
4318 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4319 */
4320 __pyx_v_info->readonly = 0;
4321
4322 /* "array.pxd":114
4323 * info.buf = self.data.as_chars
4324 * info.readonly = 0
4325 * info.ndim = 1 # <<<<<<<<<<<<<<
4326 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4327 * info.len = info.itemsize * item_count
4328 */
4329 __pyx_v_info->ndim = 1;
4330
4331 /* "array.pxd":115
4332 * info.readonly = 0
4333 * info.ndim = 1
4334 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
4335 * info.len = info.itemsize * item_count
4336 *
4337 */
4338 __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
4339 __pyx_v_info->itemsize = __pyx_t_3;
4340
4341 /* "array.pxd":116
4342 * info.ndim = 1
4343 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
4344 * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
4345 *
4346 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
4347 */
4348 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 116, __pyx_L1_error)
4349 __Pyx_GOTREF(__pyx_t_1);
4350 __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 116, __pyx_L1_error)
4351 __Pyx_GOTREF(__pyx_t_4);
4352 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4353 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 116, __pyx_L1_error)
4354 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4355 __pyx_v_info->len = __pyx_t_5;
4356
4357 /* "array.pxd":118
4358 * info.len = info.itemsize * item_count
4359 *
4360 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
4361 * if not info.shape:
4362 * raise MemoryError()
4363 */
4364 __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));
4365
4366 /* "array.pxd":119
4367 *
4368 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
4369 * if not info.shape: # <<<<<<<<<<<<<<
4370 * raise MemoryError()
4371 * info.shape[0] = item_count # constant regardless of resizing
4372 */
4373 __pyx_t_6 = (!(__pyx_v_info->shape != 0));
4374 if (unlikely(__pyx_t_6)) {
4375
4376 /* "array.pxd":120
4377 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
4378 * if not info.shape:
4379 * raise MemoryError() # <<<<<<<<<<<<<<
4380 * info.shape[0] = item_count # constant regardless of resizing
4381 * info.strides = &info.itemsize
4382 */
4383 PyErr_NoMemory(); __PYX_ERR(3, 120, __pyx_L1_error)
4384
4385 /* "array.pxd":119
4386 *
4387 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
4388 * if not info.shape: # <<<<<<<<<<<<<<
4389 * raise MemoryError()
4390 * info.shape[0] = item_count # constant regardless of resizing
4391 */
4392 }
4393
4394 /* "array.pxd":121
4395 * if not info.shape:
4396 * raise MemoryError()
4397 * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
4398 * info.strides = &info.itemsize
4399 *
4400 */
4401 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 121, __pyx_L1_error)
4402 (__pyx_v_info->shape[0]) = __pyx_t_5;
4403
4404 /* "array.pxd":122
4405 * raise MemoryError()
4406 * info.shape[0] = item_count # constant regardless of resizing
4407 * info.strides = &info.itemsize # <<<<<<<<<<<<<<
4408 *
4409 * info.format = <char*> (info.shape + 1)
4410 */
4411 __pyx_v_info->strides = (&__pyx_v_info->itemsize);
4412
4413 /* "array.pxd":124
4414 * info.strides = &info.itemsize
4415 *
4416 * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
4417 * info.format[0] = self.ob_descr.typecode
4418 * info.format[1] = 0
4419 */
4420 __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
4421
4422 /* "array.pxd":125
4423 *
4424 * info.format = <char*> (info.shape + 1)
4425 * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
4426 * info.format[1] = 0
4427 * info.obj = self
4428 */
4429 __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
4430 (__pyx_v_info->format[0]) = __pyx_t_7;
4431
4432 /* "array.pxd":126
4433 * info.format = <char*> (info.shape + 1)
4434 * info.format[0] = self.ob_descr.typecode
4435 * info.format[1] = 0 # <<<<<<<<<<<<<<
4436 * info.obj = self
4437 *
4438 */
4439 (__pyx_v_info->format[1]) = 0;
4440
4441 /* "array.pxd":127
4442 * info.format[0] = self.ob_descr.typecode
4443 * info.format[1] = 0
4444 * info.obj = self # <<<<<<<<<<<<<<
4445 *
4446 * def __releasebuffer__(self, Py_buffer* info):
4447 */
4448 __Pyx_INCREF((PyObject *)__pyx_v_self);
4449 __Pyx_GIVEREF((PyObject *)__pyx_v_self);
4450 __Pyx_GOTREF(__pyx_v_info->obj);
4451 __Pyx_DECREF(__pyx_v_info->obj);
4452 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
4453
4454 /* "array.pxd":104
4455 * __data_union data
4456 *
4457 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
4458 * # This implementation of getbuffer is geared towards Cython
4459 * # requirements, and does not yet fulfill the PEP.
4460 */
4461
4462 /* function exit code */
4463 __pyx_r = 0;
4464 goto __pyx_L0;
4465 __pyx_L1_error:;
4466 __Pyx_XDECREF(__pyx_t_1);
4467 __Pyx_XDECREF(__pyx_t_4);
4468 __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4469 __pyx_r = -1;
4470 if (__pyx_v_info->obj != NULL) {
4471 __Pyx_GOTREF(__pyx_v_info->obj);
4472 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
4473 }
4474 goto __pyx_L2;
4475 __pyx_L0:;
4476 if (__pyx_v_info->obj == Py_None) {
4477 __Pyx_GOTREF(__pyx_v_info->obj);
4478 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
4479 }
4480 __pyx_L2:;
4481 __Pyx_XDECREF(__pyx_v_item_count);
4482 __Pyx_RefNannyFinishContext();
4483 return __pyx_r;
4484 }
4485
4486 /* "array.pxd":129
4487 * info.obj = self
4488 *
4489 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
4490 * PyObject_Free(info.shape)
4491 *
4492 */
4493
4494 /* Python wrapper */
4495 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
4496 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4497 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
4498 __Pyx_RefNannyDeclarations
4499 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
4500 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
4501 __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
4502
4503 /* function exit code */
4504 __Pyx_RefNannyFinishContext();
4505 }
4506
4507 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4508
4509 /* "array.pxd":130
4510 *
4511 * def __releasebuffer__(self, Py_buffer* info):
4512 * PyObject_Free(info.shape) # <<<<<<<<<<<<<<
4513 *
4514 * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
4515 */
4516 PyObject_Free(__pyx_v_info->shape);
4517
4518 /* "array.pxd":129
4519 * info.obj = self
4520 *
4521 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
4522 * PyObject_Free(info.shape)
4523 *
4524 */
4525
4526 /* function exit code */
4527 }
4528
4529 /* "array.pxd":141
4530 *
4531 *
4532 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
4533 * """ fast creation of a new array, given a template array.
4534 * type will be same as template.
4535 */
4536
4537 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
4538 arrayobject *__pyx_v_op = 0;
4539 arrayobject *__pyx_r = NULL;
4540 __Pyx_RefNannyDeclarations
4541 PyObject *__pyx_t_1 = NULL;
4542 int __pyx_t_2;
4543 int __pyx_t_3;
4544 int __pyx_lineno = 0;
4545 const char *__pyx_filename = NULL;
4546 int __pyx_clineno = 0;
4547 __Pyx_RefNannySetupContext("clone", 1);
4548
4549 /* "array.pxd":145
4550 * type will be same as template.
4551 * if zero is true, new array will be initialized with zeroes."""
4552 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
4553 * if zero and op is not None:
4554 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4555 */
4556 __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 145, __pyx_L1_error)
4557 __Pyx_GOTREF(__pyx_t_1);
4558 __pyx_v_op = ((arrayobject *)__pyx_t_1);
4559 __pyx_t_1 = 0;
4560
4561 /* "array.pxd":146
4562 * if zero is true, new array will be initialized with zeroes."""
4563 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
4564 * if zero and op is not None: # <<<<<<<<<<<<<<
4565 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4566 * return op
4567 */
4568 if (__pyx_v_zero) {
4569 } else {
4570 __pyx_t_2 = __pyx_v_zero;
4571 goto __pyx_L4_bool_binop_done;
4572 }
4573 __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
4574 __pyx_t_2 = __pyx_t_3;
4575 __pyx_L4_bool_binop_done:;
4576 if (__pyx_t_2) {
4577
4578 /* "array.pxd":147
4579 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
4580 * if zero and op is not None:
4581 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
4582 * return op
4583 *
4584 */
4585 (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));
4586
4587 /* "array.pxd":146
4588 * if zero is true, new array will be initialized with zeroes."""
4589 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
4590 * if zero and op is not None: # <<<<<<<<<<<<<<
4591 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4592 * return op
4593 */
4594 }
4595
4596 /* "array.pxd":148
4597 * if zero and op is not None:
4598 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
4599 * return op # <<<<<<<<<<<<<<
4600 *
4601 * cdef inline array copy(array self):
4602 */
4603 __Pyx_XDECREF((PyObject *)__pyx_r);
4604 __Pyx_INCREF((PyObject *)__pyx_v_op);
4605 __pyx_r = __pyx_v_op;
4606 goto __pyx_L0;
4607
4608 /* "array.pxd":141
4609 *
4610 *
4611 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
4612 * """ fast creation of a new array, given a template array.
4613 * type will be same as template.
4614 */
4615
4616 /* function exit code */
4617 __pyx_L1_error:;
4618 __Pyx_XDECREF(__pyx_t_1);
4619 __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
4620 __pyx_r = 0;
4621 __pyx_L0:;
4622 __Pyx_XDECREF((PyObject *)__pyx_v_op);
4623 __Pyx_XGIVEREF((PyObject *)__pyx_r);
4624 __Pyx_RefNannyFinishContext();
4625 return __pyx_r;
4626 }
4627
4628 /* "array.pxd":150
4629 * return op
4630 *
4631 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
4632 * """ make a copy of an array. """
4633 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4634 */
4635
4636 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
4637 arrayobject *__pyx_v_op = 0;
4638 arrayobject *__pyx_r = NULL;
4639 __Pyx_RefNannyDeclarations
4640 PyObject *__pyx_t_1 = NULL;
4641 int __pyx_lineno = 0;
4642 const char *__pyx_filename = NULL;
4643 int __pyx_clineno = 0;
4644 __Pyx_RefNannySetupContext("copy", 1);
4645
4646 /* "array.pxd":152
4647 * cdef inline array copy(array self):
4648 * """ make a copy of an array. """
4649 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
4650 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
4651 * return op
4652 */
4653 __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 152, __pyx_L1_error)
4654 __Pyx_GOTREF(__pyx_t_1);
4655 __pyx_v_op = ((arrayobject *)__pyx_t_1);
4656 __pyx_t_1 = 0;
4657
4658 /* "array.pxd":153
4659 * """ make a copy of an array. """
4660 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4661 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
4662 * return op
4663 *
4664 */
4665 (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));
4666
4667 /* "array.pxd":154
4668 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4669 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
4670 * return op # <<<<<<<<<<<<<<
4671 *
4672 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
4673 */
4674 __Pyx_XDECREF((PyObject *)__pyx_r);
4675 __Pyx_INCREF((PyObject *)__pyx_v_op);
4676 __pyx_r = __pyx_v_op;
4677 goto __pyx_L0;
4678
4679 /* "array.pxd":150
4680 * return op
4681 *
4682 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
4683 * """ make a copy of an array. """
4684 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
4685 */
4686
4687 /* function exit code */
4688 __pyx_L1_error:;
4689 __Pyx_XDECREF(__pyx_t_1);
4690 __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4691 __pyx_r = 0;
4692 __pyx_L0:;
4693 __Pyx_XDECREF((PyObject *)__pyx_v_op);
4694 __Pyx_XGIVEREF((PyObject *)__pyx_r);
4695 __Pyx_RefNannyFinishContext();
4696 return __pyx_r;
4697 }
4698
4699 /* "array.pxd":156
4700 * return op
4701 *
4702 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
4703 * """ efficient appending of new stuff of same type
4704 * (e.g. of same array type)
4705 */
4706
4707 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
4708 Py_ssize_t __pyx_v_itemsize;
4709 Py_ssize_t __pyx_v_origsize;
4710 int __pyx_r;
4711 int __pyx_t_1;
4712 int __pyx_lineno = 0;
4713 const char *__pyx_filename = NULL;
4714 int __pyx_clineno = 0;
4715
4716 /* "array.pxd":160
4717 * (e.g. of same array type)
4718 * n: number of elements (not number of bytes!) """
4719 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
4720 * cdef Py_ssize_t origsize = Py_SIZE(self)
4721 * resize_smart(self, origsize + n)
4722 */
4723 __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
4724 __pyx_v_itemsize = __pyx_t_1;
4725
4726 /* "array.pxd":161
4727 * n: number of elements (not number of bytes!) """
4728 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
4729 * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
4730 * resize_smart(self, origsize + n)
4731 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4732 */
4733 __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
4734
4735 /* "array.pxd":162
4736 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
4737 * cdef Py_ssize_t origsize = Py_SIZE(self)
4738 * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
4739 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4740 * return 0
4741 */
4742 __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 162, __pyx_L1_error)
4743
4744 /* "array.pxd":163
4745 * cdef Py_ssize_t origsize = Py_SIZE(self)
4746 * resize_smart(self, origsize + n)
4747 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
4748 * return 0
4749 *
4750 */
4751 (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));
4752
4753 /* "array.pxd":164
4754 * resize_smart(self, origsize + n)
4755 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
4756 * return 0 # <<<<<<<<<<<<<<
4757 *
4758 * cdef inline int extend(array self, array other) except -1:
4759 */
4760 __pyx_r = 0;
4761 goto __pyx_L0;
4762
4763 /* "array.pxd":156
4764 * return op
4765 *
4766 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
4767 * """ efficient appending of new stuff of same type
4768 * (e.g. of same array type)
4769 */
4770
4771 /* function exit code */
4772 __pyx_L1_error:;
4773 __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
4774 __pyx_r = -1;
4775 __pyx_L0:;
4776 return __pyx_r;
4777 }
4778
4779 /* "array.pxd":166
4780 * return 0
4781 *
4782 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
4783 * """ extend array with data from another array; types must match. """
4784 * if self.ob_descr.typecode != other.ob_descr.typecode:
4785 */
4786
4787 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
4788 int __pyx_r;
4789 int __pyx_t_1;
4790 int __pyx_t_2;
4791 int __pyx_lineno = 0;
4792 const char *__pyx_filename = NULL;
4793 int __pyx_clineno = 0;
4794
4795 /* "array.pxd":168
4796 * cdef inline int extend(array self, array other) except -1:
4797 * """ extend array with data from another array; types must match. """
4798 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
4799 * PyErr_BadArgument()
4800 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4801 */
4802 __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
4803 if (__pyx_t_1) {
4804
4805 /* "array.pxd":169
4806 * """ extend array with data from another array; types must match. """
4807 * if self.ob_descr.typecode != other.ob_descr.typecode:
4808 * PyErr_BadArgument() # <<<<<<<<<<<<<<
4809 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4810 *
4811 */
4812 __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 169, __pyx_L1_error)
4813
4814 /* "array.pxd":168
4815 * cdef inline int extend(array self, array other) except -1:
4816 * """ extend array with data from another array; types must match. """
4817 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
4818 * PyErr_BadArgument()
4819 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4820 */
4821 }
4822
4823 /* "array.pxd":170
4824 * if self.ob_descr.typecode != other.ob_descr.typecode:
4825 * PyErr_BadArgument()
4826 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
4827 *
4828 * cdef inline void zero(array self) noexcept:
4829 */
4830 __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(3, 170, __pyx_L1_error)
4831 __pyx_r = __pyx_t_2;
4832 goto __pyx_L0;
4833
4834 /* "array.pxd":166
4835 * return 0
4836 *
4837 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
4838 * """ extend array with data from another array; types must match. """
4839 * if self.ob_descr.typecode != other.ob_descr.typecode:
4840 */
4841
4842 /* function exit code */
4843 __pyx_L1_error:;
4844 __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
4845 __pyx_r = -1;
4846 __pyx_L0:;
4847 return __pyx_r;
4848 }
4849
4850 /* "array.pxd":172
4851 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4852 *
4853 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
4854 * """ set all elements of array to zero. """
4855 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
4856 */
4857
4858 static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
4859
4860 /* "array.pxd":174
4861 * cdef inline void zero(array self) noexcept:
4862 * """ set all elements of array to zero. """
4863 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
4864 */
4865 (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));
4866
4867 /* "array.pxd":172
4868 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
4869 *
4870 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
4871 * """ set all elements of array to zero. """
4872 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
4873 */
4874
4875 /* function exit code */
4876 }
4877
4878 /* "pysam/libcbgzf.pyx":37
4879 * compressed file in text mode, use the gzip.open() function.
4880 * """
4881 * def __init__(self, filename, mode=None, index=None): # <<<<<<<<<<<<<<
4882 * """Constructor for the BGZFile class.
4883 *
4884 */
4885
4886 /* Python wrapper */
4887 static int __pyx_pw_5pysam_8libcbgzf_7BGZFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4888 PyDoc_STRVAR(__pyx_doc_5pysam_8libcbgzf_7BGZFile___init__, "Constructor for the BGZFile class.\n\n The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or\n 'xb' depending on whether the file will be read or written. The default\n is the mode of fileobj if discernible; otherwise, the default is 'rb'.\n A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and\n 'wb', 'a' and 'ab', and 'x' and 'xb'.\n ");
4889 #if CYTHON_UPDATE_DESCRIPTOR_DOC
4890 struct wrapperbase __pyx_wrapperbase_5pysam_8libcbgzf_7BGZFile___init__;
4891 #endif
4892 static int __pyx_pw_5pysam_8libcbgzf_7BGZFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4893 PyObject *__pyx_v_filename = 0;
4894 PyObject *__pyx_v_mode = 0;
4895 PyObject *__pyx_v_index = 0;
4896 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
4897 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
4898 PyObject* values[3] = {0,0,0};
4899 int __pyx_lineno = 0;
4900 const char *__pyx_filename = NULL;
4901 int __pyx_clineno = 0;
4902 int __pyx_r;
4903 __Pyx_RefNannyDeclarations
4904 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4905 #if CYTHON_ASSUME_SAFE_MACROS
4906 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
4907 #else
4908 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
4909 #endif
4910 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
4911 {
4912 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,&__pyx_n_s_index,0};
4913 values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
4914 values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_None));
4915 if (__pyx_kwds) {
4916 Py_ssize_t kw_args;
4917 switch (__pyx_nargs) {
4918 case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
4919 CYTHON_FALLTHROUGH;
4920 case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
4921 CYTHON_FALLTHROUGH;
4922 case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
4923 CYTHON_FALLTHROUGH;
4924 case 0: break;
4925 default: goto __pyx_L5_argtuple_error;
4926 }
4927 kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
4928 switch (__pyx_nargs) {
4929 case 0:
4930 if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
4931 (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
4932 kw_args--;
4933 }
4934 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)
4935 else goto __pyx_L5_argtuple_error;
4936 CYTHON_FALLTHROUGH;
4937 case 1:
4938 if (kw_args > 0) {
4939 PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode);
4940 if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
4941 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)
4942 }
4943 CYTHON_FALLTHROUGH;
4944 case 2:
4945 if (kw_args > 0) {
4946 PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index);
4947 if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
4948 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)
4949 }
4950 }
4951 if (unlikely(kw_args > 0)) {
4952 const Py_ssize_t kwd_pos_args = __pyx_nargs;
4953 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 37, __pyx_L3_error)
4954 }
4955 } else {
4956 switch (__pyx_nargs) {
4957 case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
4958 CYTHON_FALLTHROUGH;
4959 case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
4960 CYTHON_FALLTHROUGH;
4961 case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
4962 break;
4963 default: goto __pyx_L5_argtuple_error;
4964 }
4965 }
4966 __pyx_v_filename = values[0];
4967 __pyx_v_mode = values[1];
4968 __pyx_v_index = values[2];
4969 }
4970 goto __pyx_L6_skip;
4971 __pyx_L5_argtuple_error:;
4972 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 37, __pyx_L3_error)
4973 __pyx_L6_skip:;
4974 goto __pyx_L4_argument_unpacking_done;
4975 __pyx_L3_error:;
4976 {
4977 Py_ssize_t __pyx_temp;
4978 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
4979 __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
4980 }
4981 }
4982 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4983 __Pyx_RefNannyFinishContext();
4984 return -1;
4985 __pyx_L4_argument_unpacking_done:;
4986 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile___init__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_index);
4987
4988 /* function exit code */
4989 {
4990 Py_ssize_t __pyx_temp;
4991 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
4992 __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
4993 }
4994 }
4995 __Pyx_RefNannyFinishContext();
4996 return __pyx_r;
4997 }
4998
4999 static int __pyx_pf_5pysam_8libcbgzf_7BGZFile___init__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_index) {
5000 int __pyx_r;
5001 __Pyx_RefNannyDeclarations
5002 int __pyx_t_1;
5003 int __pyx_t_2;
5004 PyObject *__pyx_t_3 = NULL;
5005 PyObject *__pyx_t_4 = NULL;
5006 PyObject *__pyx_t_5 = NULL;
5007 unsigned int __pyx_t_6;
5008 char const *__pyx_t_7;
5009 char const *__pyx_t_8;
5010 int __pyx_lineno = 0;
5011 const char *__pyx_filename = NULL;
5012 int __pyx_clineno = 0;
5013 __Pyx_RefNannySetupContext("__init__", 0);
5014 __Pyx_INCREF(__pyx_v_mode);
5015
5016 /* "pysam/libcbgzf.pyx":46
5017 * 'wb', 'a' and 'ab', and 'x' and 'xb'.
5018 * """
5019 * if mode and ('t' in mode or 'U' in mode): # <<<<<<<<<<<<<<
5020 * raise ValueError("Invalid mode: {!r}".format(mode))
5021 * if not mode:
5022 */
5023 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_mode); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 46, __pyx_L1_error)
5024 if (__pyx_t_2) {
5025 } else {
5026 __pyx_t_1 = __pyx_t_2;
5027 goto __pyx_L4_bool_binop_done;
5028 }
5029 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_t, __pyx_v_mode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 46, __pyx_L1_error)
5030 if (!__pyx_t_2) {
5031 } else {
5032 __pyx_t_1 = __pyx_t_2;
5033 goto __pyx_L4_bool_binop_done;
5034 }
5035 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_U, __pyx_v_mode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 46, __pyx_L1_error)
5036 __pyx_t_1 = __pyx_t_2;
5037 __pyx_L4_bool_binop_done:;
5038 if (unlikely(__pyx_t_1)) {
5039
5040 /* "pysam/libcbgzf.pyx":47
5041 * """
5042 * if mode and ('t' in mode or 'U' in mode):
5043 * raise ValueError("Invalid mode: {!r}".format(mode)) # <<<<<<<<<<<<<<
5044 * if not mode:
5045 * mode = 'rb'
5046 */
5047 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_mode_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
5048 __Pyx_GOTREF(__pyx_t_4);
5049 __pyx_t_5 = NULL;
5050 __pyx_t_6 = 0;
5051 #if CYTHON_UNPACK_METHODS
5052 if (likely(PyMethod_Check(__pyx_t_4))) {
5053 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5054 if (likely(__pyx_t_5)) {
5055 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5056 __Pyx_INCREF(__pyx_t_5);
5057 __Pyx_INCREF(function);
5058 __Pyx_DECREF_SET(__pyx_t_4, function);
5059 __pyx_t_6 = 1;
5060 }
5061 }
5062 #endif
5063 {
5064 PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_mode};
5065 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
5066 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5067 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
5068 __Pyx_GOTREF(__pyx_t_3);
5069 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5070 }
5071 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
5072 __Pyx_GOTREF(__pyx_t_4);
5073 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5074 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5075 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5076 __PYX_ERR(0, 47, __pyx_L1_error)
5077
5078 /* "pysam/libcbgzf.pyx":46
5079 * 'wb', 'a' and 'ab', and 'x' and 'xb'.
5080 * """
5081 * if mode and ('t' in mode or 'U' in mode): # <<<<<<<<<<<<<<
5082 * raise ValueError("Invalid mode: {!r}".format(mode))
5083 * if not mode:
5084 */
5085 }
5086
5087 /* "pysam/libcbgzf.pyx":48
5088 * if mode and ('t' in mode or 'U' in mode):
5089 * raise ValueError("Invalid mode: {!r}".format(mode))
5090 * if not mode: # <<<<<<<<<<<<<<
5091 * mode = 'rb'
5092 * elif mode and 'b' not in mode:
5093 */
5094 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_mode); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 48, __pyx_L1_error)
5095 __pyx_t_2 = (!__pyx_t_1);
5096 if (__pyx_t_2) {
5097
5098 /* "pysam/libcbgzf.pyx":49
5099 * raise ValueError("Invalid mode: {!r}".format(mode))
5100 * if not mode:
5101 * mode = 'rb' # <<<<<<<<<<<<<<
5102 * elif mode and 'b' not in mode:
5103 * mode += 'b'
5104 */
5105 __Pyx_INCREF(__pyx_n_u_rb);
5106 __Pyx_DECREF_SET(__pyx_v_mode, __pyx_n_u_rb);
5107
5108 /* "pysam/libcbgzf.pyx":48
5109 * if mode and ('t' in mode or 'U' in mode):
5110 * raise ValueError("Invalid mode: {!r}".format(mode))
5111 * if not mode: # <<<<<<<<<<<<<<
5112 * mode = 'rb'
5113 * elif mode and 'b' not in mode:
5114 */
5115 goto __pyx_L7;
5116 }
5117
5118 /* "pysam/libcbgzf.pyx":50
5119 * if not mode:
5120 * mode = 'rb'
5121 * elif mode and 'b' not in mode: # <<<<<<<<<<<<<<
5122 * mode += 'b'
5123 *
5124 */
5125 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_mode); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 50, __pyx_L1_error)
5126 if (__pyx_t_1) {
5127 } else {
5128 __pyx_t_2 = __pyx_t_1;
5129 goto __pyx_L8_bool_binop_done;
5130 }
5131 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_b, __pyx_v_mode, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 50, __pyx_L1_error)
5132 __pyx_t_2 = __pyx_t_1;
5133 __pyx_L8_bool_binop_done:;
5134 if (__pyx_t_2) {
5135
5136 /* "pysam/libcbgzf.pyx":51
5137 * mode = 'rb'
5138 * elif mode and 'b' not in mode:
5139 * mode += 'b' # <<<<<<<<<<<<<<
5140 *
5141 * mode = force_bytes(mode)
5142 */
5143 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_mode, __pyx_n_u_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
5144 __Pyx_GOTREF(__pyx_t_4);
5145 __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_4);
5146 __pyx_t_4 = 0;
5147
5148 /* "pysam/libcbgzf.pyx":50
5149 * if not mode:
5150 * mode = 'rb'
5151 * elif mode and 'b' not in mode: # <<<<<<<<<<<<<<
5152 * mode += 'b'
5153 *
5154 */
5155 }
5156 __pyx_L7:;
5157
5158 /* "pysam/libcbgzf.pyx":53
5159 * mode += 'b'
5160 *
5161 * mode = force_bytes(mode) # <<<<<<<<<<<<<<
5162 *
5163 * self.name = encode_filename(filename)
5164 */
5165 __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_mode, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
5166 __Pyx_GOTREF(__pyx_t_4);
5167 __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_4);
5168 __pyx_t_4 = 0;
5169
5170 /* "pysam/libcbgzf.pyx":55
5171 * mode = force_bytes(mode)
5172 *
5173 * self.name = encode_filename(filename) # <<<<<<<<<<<<<<
5174 * self.index = encode_filename(index) if index is not None else None
5175 *
5176 */
5177 __pyx_t_4 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
5178 __Pyx_GOTREF(__pyx_t_4);
5179 __Pyx_GIVEREF(__pyx_t_4);
5180 __Pyx_GOTREF(__pyx_v_self->name);
5181 __Pyx_DECREF(__pyx_v_self->name);
5182 __pyx_v_self->name = __pyx_t_4;
5183 __pyx_t_4 = 0;
5184
5185 /* "pysam/libcbgzf.pyx":56
5186 *
5187 * self.name = encode_filename(filename)
5188 * self.index = encode_filename(index) if index is not None else None # <<<<<<<<<<<<<<
5189 *
5190 * self.bgzf = bgzf_open(self.name, mode)
5191 */
5192 __pyx_t_2 = (__pyx_v_index != Py_None);
5193 if (__pyx_t_2) {
5194 __pyx_t_3 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
5195 __Pyx_GOTREF(__pyx_t_3);
5196 __pyx_t_4 = __pyx_t_3;
5197 __pyx_t_3 = 0;
5198 } else {
5199 __Pyx_INCREF(Py_None);
5200 __pyx_t_4 = Py_None;
5201 }
5202 __Pyx_GIVEREF(__pyx_t_4);
5203 __Pyx_GOTREF(__pyx_v_self->index);
5204 __Pyx_DECREF(__pyx_v_self->index);
5205 __pyx_v_self->index = __pyx_t_4;
5206 __pyx_t_4 = 0;
5207
5208 /* "pysam/libcbgzf.pyx":58
5209 * self.index = encode_filename(index) if index is not None else None
5210 *
5211 * self.bgzf = bgzf_open(self.name, mode) # <<<<<<<<<<<<<<
5212 *
5213 * if self.bgzf.is_write and index is not None and bgzf_index_build_init(self.bgzf) < 0:
5214 */
5215 __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_self->name); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L1_error)
5216 __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L1_error)
5217 __pyx_v_self->bgzf = bgzf_open(__pyx_t_7, __pyx_t_8);
5218
5219 /* "pysam/libcbgzf.pyx":60
5220 * self.bgzf = bgzf_open(self.name, mode)
5221 *
5222 * if self.bgzf.is_write and index is not None and bgzf_index_build_init(self.bgzf) < 0: # <<<<<<<<<<<<<<
5223 * raise IOError('Error building bgzf index')
5224 *
5225 */
5226 __pyx_t_1 = (__pyx_v_self->bgzf->is_write != 0);
5227 if (__pyx_t_1) {
5228 } else {
5229 __pyx_t_2 = __pyx_t_1;
5230 goto __pyx_L11_bool_binop_done;
5231 }
5232 __pyx_t_1 = (__pyx_v_index != Py_None);
5233 if (__pyx_t_1) {
5234 } else {
5235 __pyx_t_2 = __pyx_t_1;
5236 goto __pyx_L11_bool_binop_done;
5237 }
5238 __pyx_t_1 = (bgzf_index_build_init(__pyx_v_self->bgzf) < 0);
5239 __pyx_t_2 = __pyx_t_1;
5240 __pyx_L11_bool_binop_done:;
5241 if (unlikely(__pyx_t_2)) {
5242
5243 /* "pysam/libcbgzf.pyx":61
5244 *
5245 * if self.bgzf.is_write and index is not None and bgzf_index_build_init(self.bgzf) < 0:
5246 * raise IOError('Error building bgzf index') # <<<<<<<<<<<<<<
5247 *
5248 * def __dealloc__(self):
5249 */
5250 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error)
5251 __Pyx_GOTREF(__pyx_t_4);
5252 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5253 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5254 __PYX_ERR(0, 61, __pyx_L1_error)
5255
5256 /* "pysam/libcbgzf.pyx":60
5257 * self.bgzf = bgzf_open(self.name, mode)
5258 *
5259 * if self.bgzf.is_write and index is not None and bgzf_index_build_init(self.bgzf) < 0: # <<<<<<<<<<<<<<
5260 * raise IOError('Error building bgzf index')
5261 *
5262 */
5263 }
5264
5265 /* "pysam/libcbgzf.pyx":37
5266 * compressed file in text mode, use the gzip.open() function.
5267 * """
5268 * def __init__(self, filename, mode=None, index=None): # <<<<<<<<<<<<<<
5269 * """Constructor for the BGZFile class.
5270 *
5271 */
5272
5273 /* function exit code */
5274 __pyx_r = 0;
5275 goto __pyx_L0;
5276 __pyx_L1_error:;
5277 __Pyx_XDECREF(__pyx_t_3);
5278 __Pyx_XDECREF(__pyx_t_4);
5279 __Pyx_XDECREF(__pyx_t_5);
5280 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5281 __pyx_r = -1;
5282 __pyx_L0:;
5283 __Pyx_XDECREF(__pyx_v_mode);
5284 __Pyx_RefNannyFinishContext();
5285 return __pyx_r;
5286 }
5287
5288 /* "pysam/libcbgzf.pyx":63
5289 * raise IOError('Error building bgzf index')
5290 *
5291 * def __dealloc__(self): # <<<<<<<<<<<<<<
5292 * self.close()
5293 *
5294 */
5295
5296 /* Python wrapper */
5297 static void __pyx_pw_5pysam_8libcbgzf_7BGZFile_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
5298 static void __pyx_pw_5pysam_8libcbgzf_7BGZFile_3__dealloc__(PyObject *__pyx_v_self) {
5299 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
5300 __Pyx_RefNannyDeclarations
5301 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5302 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
5303 __pyx_pf_5pysam_8libcbgzf_7BGZFile_2__dealloc__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
5304
5305 /* function exit code */
5306 __Pyx_RefNannyFinishContext();
5307 }
5308
5309 static void __pyx_pf_5pysam_8libcbgzf_7BGZFile_2__dealloc__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
5310 __Pyx_RefNannyDeclarations
5311 PyObject *__pyx_t_1 = NULL;
5312 PyObject *__pyx_t_2 = NULL;
5313 PyObject *__pyx_t_3 = NULL;
5314 unsigned int __pyx_t_4;
5315 int __pyx_lineno = 0;
5316 const char *__pyx_filename = NULL;
5317 int __pyx_clineno = 0;
5318 __Pyx_RefNannySetupContext("__dealloc__", 1);
5319
5320 /* "pysam/libcbgzf.pyx":64
5321 *
5322 * def __dealloc__(self):
5323 * self.close() # <<<<<<<<<<<<<<
5324 *
5325 * def write(self, data):
5326 */
5327 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
5328 __Pyx_GOTREF(__pyx_t_2);
5329 __pyx_t_3 = NULL;
5330 __pyx_t_4 = 0;
5331 #if CYTHON_UNPACK_METHODS
5332 if (likely(PyMethod_Check(__pyx_t_2))) {
5333 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5334 if (likely(__pyx_t_3)) {
5335 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5336 __Pyx_INCREF(__pyx_t_3);
5337 __Pyx_INCREF(function);
5338 __Pyx_DECREF_SET(__pyx_t_2, function);
5339 __pyx_t_4 = 1;
5340 }
5341 }
5342 #endif
5343 {
5344 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
5345 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
5346 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5347 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
5348 __Pyx_GOTREF(__pyx_t_1);
5349 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5350 }
5351 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5352
5353 /* "pysam/libcbgzf.pyx":63
5354 * raise IOError('Error building bgzf index')
5355 *
5356 * def __dealloc__(self): # <<<<<<<<<<<<<<
5357 * self.close()
5358 *
5359 */
5360
5361 /* function exit code */
5362 goto __pyx_L0;
5363 __pyx_L1_error:;
5364 __Pyx_XDECREF(__pyx_t_1);
5365 __Pyx_XDECREF(__pyx_t_2);
5366 __Pyx_XDECREF(__pyx_t_3);
5367 __Pyx_WriteUnraisable("pysam.libcbgzf.BGZFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5368 __pyx_L0:;
5369 __Pyx_RefNannyFinishContext();
5370 }
5371
5372 /* "pysam/libcbgzf.pyx":66
5373 * self.close()
5374 *
5375 * def write(self, data): # <<<<<<<<<<<<<<
5376 * if not self.bgzf:
5377 * raise ValueError("write() on closed BGZFile object")
5378 */
5379
5380 /* Python wrapper */
5381 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_5write(PyObject *__pyx_v_self,
5382 #if CYTHON_METH_FASTCALL
5383 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5384 #else
5385 PyObject *__pyx_args, PyObject *__pyx_kwds
5386 #endif
5387 ); /*proto*/
5388 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_5write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_5write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
5389 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_5write(PyObject *__pyx_v_self,
5390 #if CYTHON_METH_FASTCALL
5391 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5392 #else
5393 PyObject *__pyx_args, PyObject *__pyx_kwds
5394 #endif
5395 ) {
5396 PyObject *__pyx_v_data = 0;
5397 #if !CYTHON_METH_FASTCALL
5398 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
5399 #endif
5400 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
5401 PyObject* values[1] = {0};
5402 int __pyx_lineno = 0;
5403 const char *__pyx_filename = NULL;
5404 int __pyx_clineno = 0;
5405 PyObject *__pyx_r = 0;
5406 __Pyx_RefNannyDeclarations
5407 __Pyx_RefNannySetupContext("write (wrapper)", 0);
5408 #if !CYTHON_METH_FASTCALL
5409 #if CYTHON_ASSUME_SAFE_MACROS
5410 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
5411 #else
5412 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
5413 #endif
5414 #endif
5415 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
5416 {
5417 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
5418 if (__pyx_kwds) {
5419 Py_ssize_t kw_args;
5420 switch (__pyx_nargs) {
5421 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5422 CYTHON_FALLTHROUGH;
5423 case 0: break;
5424 default: goto __pyx_L5_argtuple_error;
5425 }
5426 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
5427 switch (__pyx_nargs) {
5428 case 0:
5429 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
5430 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
5431 kw_args--;
5432 }
5433 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error)
5434 else goto __pyx_L5_argtuple_error;
5435 }
5436 if (unlikely(kw_args > 0)) {
5437 const Py_ssize_t kwd_pos_args = __pyx_nargs;
5438 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 66, __pyx_L3_error)
5439 }
5440 } else if (unlikely(__pyx_nargs != 1)) {
5441 goto __pyx_L5_argtuple_error;
5442 } else {
5443 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5444 }
5445 __pyx_v_data = values[0];
5446 }
5447 goto __pyx_L6_skip;
5448 __pyx_L5_argtuple_error:;
5449 __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 66, __pyx_L3_error)
5450 __pyx_L6_skip:;
5451 goto __pyx_L4_argument_unpacking_done;
5452 __pyx_L3_error:;
5453 {
5454 Py_ssize_t __pyx_temp;
5455 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
5456 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
5457 }
5458 }
5459 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
5460 __Pyx_RefNannyFinishContext();
5461 return NULL;
5462 __pyx_L4_argument_unpacking_done:;
5463 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_4write(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_data);
5464
5465 /* function exit code */
5466 {
5467 Py_ssize_t __pyx_temp;
5468 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
5469 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
5470 }
5471 }
5472 __Pyx_RefNannyFinishContext();
5473 return __pyx_r;
5474 }
5475
5476 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_4write(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_data) {
5477 PyObject *__pyx_v_errno = NULL;
5478 PyObject *__pyx_v_length = NULL;
5479 PyObject *__pyx_r = NULL;
5480 __Pyx_RefNannyDeclarations
5481 int __pyx_t_1;
5482 PyObject *__pyx_t_2 = NULL;
5483 PyObject *__pyx_t_3 = NULL;
5484 Py_ssize_t __pyx_t_4;
5485 int __pyx_t_5;
5486 char *__pyx_t_6;
5487 size_t __pyx_t_7;
5488 int __pyx_lineno = 0;
5489 const char *__pyx_filename = NULL;
5490 int __pyx_clineno = 0;
5491 __Pyx_RefNannySetupContext("write", 0);
5492 __Pyx_INCREF(__pyx_v_data);
5493
5494 /* "pysam/libcbgzf.pyx":67
5495 *
5496 * def write(self, data):
5497 * if not self.bgzf: # <<<<<<<<<<<<<<
5498 * raise ValueError("write() on closed BGZFile object")
5499 *
5500 */
5501 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
5502 if (unlikely(__pyx_t_1)) {
5503
5504 /* "pysam/libcbgzf.pyx":68
5505 * def write(self, data):
5506 * if not self.bgzf:
5507 * raise ValueError("write() on closed BGZFile object") # <<<<<<<<<<<<<<
5508 *
5509 * if not self.bgzf.is_write:
5510 */
5511 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
5512 __Pyx_GOTREF(__pyx_t_2);
5513 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5514 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5515 __PYX_ERR(0, 68, __pyx_L1_error)
5516
5517 /* "pysam/libcbgzf.pyx":67
5518 *
5519 * def write(self, data):
5520 * if not self.bgzf: # <<<<<<<<<<<<<<
5521 * raise ValueError("write() on closed BGZFile object")
5522 *
5523 */
5524 }
5525
5526 /* "pysam/libcbgzf.pyx":70
5527 * raise ValueError("write() on closed BGZFile object")
5528 *
5529 * if not self.bgzf.is_write: # <<<<<<<<<<<<<<
5530 * import errno
5531 * raise IOError(errno.EBADF, "write() on read-only BGZFile object")
5532 */
5533 __pyx_t_1 = (!(__pyx_v_self->bgzf->is_write != 0));
5534 if (unlikely(__pyx_t_1)) {
5535
5536 /* "pysam/libcbgzf.pyx":71
5537 *
5538 * if not self.bgzf.is_write:
5539 * import errno # <<<<<<<<<<<<<<
5540 * raise IOError(errno.EBADF, "write() on read-only BGZFile object")
5541 *
5542 */
5543 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_errno, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error)
5544 __Pyx_GOTREF(__pyx_t_2);
5545 __pyx_v_errno = __pyx_t_2;
5546 __pyx_t_2 = 0;
5547
5548 /* "pysam/libcbgzf.pyx":72
5549 * if not self.bgzf.is_write:
5550 * import errno
5551 * raise IOError(errno.EBADF, "write() on read-only BGZFile object") # <<<<<<<<<<<<<<
5552 *
5553 * if isinstance(data, bytes):
5554 */
5555 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_errno, __pyx_n_s_EBADF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
5556 __Pyx_GOTREF(__pyx_t_2);
5557 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
5558 __Pyx_GOTREF(__pyx_t_3);
5559 __Pyx_GIVEREF(__pyx_t_2);
5560 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error);
5561 __Pyx_INCREF(__pyx_kp_u_write_on_read_only_BGZFile_objec);
5562 __Pyx_GIVEREF(__pyx_kp_u_write_on_read_only_BGZFile_objec);
5563 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_write_on_read_only_BGZFile_objec)) __PYX_ERR(0, 72, __pyx_L1_error);
5564 __pyx_t_2 = 0;
5565 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
5566 __Pyx_GOTREF(__pyx_t_2);
5567 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5568 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5569 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5570 __PYX_ERR(0, 72, __pyx_L1_error)
5571
5572 /* "pysam/libcbgzf.pyx":70
5573 * raise ValueError("write() on closed BGZFile object")
5574 *
5575 * if not self.bgzf.is_write: # <<<<<<<<<<<<<<
5576 * import errno
5577 * raise IOError(errno.EBADF, "write() on read-only BGZFile object")
5578 */
5579 }
5580
5581 /* "pysam/libcbgzf.pyx":74
5582 * raise IOError(errno.EBADF, "write() on read-only BGZFile object")
5583 *
5584 * if isinstance(data, bytes): # <<<<<<<<<<<<<<
5585 * length = len(data)
5586 * else:
5587 */
5588 __pyx_t_1 = PyBytes_Check(__pyx_v_data);
5589 if (__pyx_t_1) {
5590
5591 /* "pysam/libcbgzf.pyx":75
5592 *
5593 * if isinstance(data, bytes):
5594 * length = len(data) # <<<<<<<<<<<<<<
5595 * else:
5596 * # accept any data that supports the buffer protocol
5597 */
5598 __pyx_t_4 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 75, __pyx_L1_error)
5599 __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
5600 __Pyx_GOTREF(__pyx_t_2);
5601 __pyx_v_length = __pyx_t_2;
5602 __pyx_t_2 = 0;
5603
5604 /* "pysam/libcbgzf.pyx":74
5605 * raise IOError(errno.EBADF, "write() on read-only BGZFile object")
5606 *
5607 * if isinstance(data, bytes): # <<<<<<<<<<<<<<
5608 * length = len(data)
5609 * else:
5610 */
5611 goto __pyx_L5;
5612 }
5613
5614 /* "pysam/libcbgzf.pyx":78
5615 * else:
5616 * # accept any data that supports the buffer protocol
5617 * data = memoryview(data) # <<<<<<<<<<<<<<
5618 * length = data.nbytes
5619 *
5620 */
5621 /*else*/ {
5622 __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
5623 __Pyx_GOTREF(__pyx_t_2);
5624 __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_2);
5625 __pyx_t_2 = 0;
5626
5627 /* "pysam/libcbgzf.pyx":79
5628 * # accept any data that supports the buffer protocol
5629 * data = memoryview(data)
5630 * length = data.nbytes # <<<<<<<<<<<<<<
5631 *
5632 * if length > 0 and bgzf_write(self.bgzf, <char *>data, length) < 0:
5633 */
5634 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
5635 __Pyx_GOTREF(__pyx_t_2);
5636 __pyx_v_length = __pyx_t_2;
5637 __pyx_t_2 = 0;
5638 }
5639 __pyx_L5:;
5640
5641 /* "pysam/libcbgzf.pyx":81
5642 * length = data.nbytes
5643 *
5644 * if length > 0 and bgzf_write(self.bgzf, <char *>data, length) < 0: # <<<<<<<<<<<<<<
5645 * raise IOError('BGZFile write failed')
5646 *
5647 */
5648 __pyx_t_2 = PyObject_RichCompare(__pyx_v_length, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
5649 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 81, __pyx_L1_error)
5650 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5651 if (__pyx_t_5) {
5652 } else {
5653 __pyx_t_1 = __pyx_t_5;
5654 goto __pyx_L7_bool_binop_done;
5655 }
5656 __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
5657 __pyx_t_7 = __Pyx_PyInt_As_size_t(__pyx_v_length); if (unlikely((__pyx_t_7 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
5658 __pyx_t_5 = (bgzf_write(__pyx_v_self->bgzf, ((char *)__pyx_t_6), __pyx_t_7) < 0);
5659 __pyx_t_1 = __pyx_t_5;
5660 __pyx_L7_bool_binop_done:;
5661 if (unlikely(__pyx_t_1)) {
5662
5663 /* "pysam/libcbgzf.pyx":82
5664 *
5665 * if length > 0 and bgzf_write(self.bgzf, <char *>data, length) < 0:
5666 * raise IOError('BGZFile write failed') # <<<<<<<<<<<<<<
5667 *
5668 * return length
5669 */
5670 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
5671 __Pyx_GOTREF(__pyx_t_2);
5672 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5673 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5674 __PYX_ERR(0, 82, __pyx_L1_error)
5675
5676 /* "pysam/libcbgzf.pyx":81
5677 * length = data.nbytes
5678 *
5679 * if length > 0 and bgzf_write(self.bgzf, <char *>data, length) < 0: # <<<<<<<<<<<<<<
5680 * raise IOError('BGZFile write failed')
5681 *
5682 */
5683 }
5684
5685 /* "pysam/libcbgzf.pyx":84
5686 * raise IOError('BGZFile write failed')
5687 *
5688 * return length # <<<<<<<<<<<<<<
5689 *
5690 * def read(self, size=-1):
5691 */
5692 __Pyx_XDECREF(__pyx_r);
5693 __Pyx_INCREF(__pyx_v_length);
5694 __pyx_r = __pyx_v_length;
5695 goto __pyx_L0;
5696
5697 /* "pysam/libcbgzf.pyx":66
5698 * self.close()
5699 *
5700 * def write(self, data): # <<<<<<<<<<<<<<
5701 * if not self.bgzf:
5702 * raise ValueError("write() on closed BGZFile object")
5703 */
5704
5705 /* function exit code */
5706 __pyx_L1_error:;
5707 __Pyx_XDECREF(__pyx_t_2);
5708 __Pyx_XDECREF(__pyx_t_3);
5709 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
5710 __pyx_r = NULL;
5711 __pyx_L0:;
5712 __Pyx_XDECREF(__pyx_v_errno);
5713 __Pyx_XDECREF(__pyx_v_length);
5714 __Pyx_XDECREF(__pyx_v_data);
5715 __Pyx_XGIVEREF(__pyx_r);
5716 __Pyx_RefNannyFinishContext();
5717 return __pyx_r;
5718 }
5719
5720 /* "pysam/libcbgzf.pyx":86
5721 * return length
5722 *
5723 * def read(self, size=-1): # <<<<<<<<<<<<<<
5724 * cdef ssize_t read_size
5725 *
5726 */
5727
5728 /* Python wrapper */
5729 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_7read(PyObject *__pyx_v_self,
5730 #if CYTHON_METH_FASTCALL
5731 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5732 #else
5733 PyObject *__pyx_args, PyObject *__pyx_kwds
5734 #endif
5735 ); /*proto*/
5736 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_7read = {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_7read, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
5737 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_7read(PyObject *__pyx_v_self,
5738 #if CYTHON_METH_FASTCALL
5739 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
5740 #else
5741 PyObject *__pyx_args, PyObject *__pyx_kwds
5742 #endif
5743 ) {
5744 PyObject *__pyx_v_size = 0;
5745 #if !CYTHON_METH_FASTCALL
5746 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
5747 #endif
5748 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
5749 PyObject* values[1] = {0};
5750 int __pyx_lineno = 0;
5751 const char *__pyx_filename = NULL;
5752 int __pyx_clineno = 0;
5753 PyObject *__pyx_r = 0;
5754 __Pyx_RefNannyDeclarations
5755 __Pyx_RefNannySetupContext("read (wrapper)", 0);
5756 #if !CYTHON_METH_FASTCALL
5757 #if CYTHON_ASSUME_SAFE_MACROS
5758 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
5759 #else
5760 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
5761 #endif
5762 #endif
5763 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
5764 {
5765 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0};
5766 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_neg_1));
5767 if (__pyx_kwds) {
5768 Py_ssize_t kw_args;
5769 switch (__pyx_nargs) {
5770 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5771 CYTHON_FALLTHROUGH;
5772 case 0: break;
5773 default: goto __pyx_L5_argtuple_error;
5774 }
5775 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
5776 switch (__pyx_nargs) {
5777 case 0:
5778 if (kw_args > 0) {
5779 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
5780 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
5781 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L3_error)
5782 }
5783 }
5784 if (unlikely(kw_args > 0)) {
5785 const Py_ssize_t kwd_pos_args = __pyx_nargs;
5786 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read") < 0)) __PYX_ERR(0, 86, __pyx_L3_error)
5787 }
5788 } else {
5789 switch (__pyx_nargs) {
5790 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
5791 CYTHON_FALLTHROUGH;
5792 case 0: break;
5793 default: goto __pyx_L5_argtuple_error;
5794 }
5795 }
5796 __pyx_v_size = values[0];
5797 }
5798 goto __pyx_L6_skip;
5799 __pyx_L5_argtuple_error:;
5800 __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 86, __pyx_L3_error)
5801 __pyx_L6_skip:;
5802 goto __pyx_L4_argument_unpacking_done;
5803 __pyx_L3_error:;
5804 {
5805 Py_ssize_t __pyx_temp;
5806 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
5807 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
5808 }
5809 }
5810 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
5811 __Pyx_RefNannyFinishContext();
5812 return NULL;
5813 __pyx_L4_argument_unpacking_done:;
5814 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_6read(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_size);
5815
5816 /* function exit code */
5817 {
5818 Py_ssize_t __pyx_temp;
5819 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
5820 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
5821 }
5822 }
5823 __Pyx_RefNannyFinishContext();
5824 return __pyx_r;
5825 }
5826
5827 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_6read(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_size) {
5828 Py_ssize_t __pyx_v_read_size;
5829 PyObject *__pyx_v_errno = NULL;
5830 PyObject *__pyx_v_chunks = NULL;
5831 PyObject *__pyx_v_chunk = NULL;
5832 CYTHON_UNUSED PyObject *__pyx_v_cdata = NULL;
5833 PyObject *__pyx_r = NULL;
5834 __Pyx_RefNannyDeclarations
5835 int __pyx_t_1;
5836 PyObject *__pyx_t_2 = NULL;
5837 PyObject *__pyx_t_3 = NULL;
5838 Py_ssize_t __pyx_t_4;
5839 char *__pyx_t_5;
5840 size_t __pyx_t_6;
5841 PyObject *__pyx_t_7 = NULL;
5842 int __pyx_t_8;
5843 int __pyx_lineno = 0;
5844 const char *__pyx_filename = NULL;
5845 int __pyx_clineno = 0;
5846 __Pyx_RefNannySetupContext("read", 1);
5847
5848 /* "pysam/libcbgzf.pyx":89
5849 * cdef ssize_t read_size
5850 *
5851 * if not self.bgzf: # <<<<<<<<<<<<<<
5852 * raise ValueError("read() on closed BGZFile object")
5853 *
5854 */
5855 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
5856 if (unlikely(__pyx_t_1)) {
5857
5858 /* "pysam/libcbgzf.pyx":90
5859 *
5860 * if not self.bgzf:
5861 * raise ValueError("read() on closed BGZFile object") # <<<<<<<<<<<<<<
5862 *
5863 * if self.bgzf.is_write:
5864 */
5865 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
5866 __Pyx_GOTREF(__pyx_t_2);
5867 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5868 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5869 __PYX_ERR(0, 90, __pyx_L1_error)
5870
5871 /* "pysam/libcbgzf.pyx":89
5872 * cdef ssize_t read_size
5873 *
5874 * if not self.bgzf: # <<<<<<<<<<<<<<
5875 * raise ValueError("read() on closed BGZFile object")
5876 *
5877 */
5878 }
5879
5880 /* "pysam/libcbgzf.pyx":92
5881 * raise ValueError("read() on closed BGZFile object")
5882 *
5883 * if self.bgzf.is_write: # <<<<<<<<<<<<<<
5884 * import errno
5885 * raise IOError(errno.EBADF, "read() on write-only BGZFile object")
5886 */
5887 __pyx_t_1 = (__pyx_v_self->bgzf->is_write != 0);
5888 if (unlikely(__pyx_t_1)) {
5889
5890 /* "pysam/libcbgzf.pyx":93
5891 *
5892 * if self.bgzf.is_write:
5893 * import errno # <<<<<<<<<<<<<<
5894 * raise IOError(errno.EBADF, "read() on write-only BGZFile object")
5895 *
5896 */
5897 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_errno, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
5898 __Pyx_GOTREF(__pyx_t_2);
5899 __pyx_v_errno = __pyx_t_2;
5900 __pyx_t_2 = 0;
5901
5902 /* "pysam/libcbgzf.pyx":94
5903 * if self.bgzf.is_write:
5904 * import errno
5905 * raise IOError(errno.EBADF, "read() on write-only BGZFile object") # <<<<<<<<<<<<<<
5906 *
5907 * if size < 0:
5908 */
5909 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_errno, __pyx_n_s_EBADF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
5910 __Pyx_GOTREF(__pyx_t_2);
5911 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
5912 __Pyx_GOTREF(__pyx_t_3);
5913 __Pyx_GIVEREF(__pyx_t_2);
5914 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error);
5915 __Pyx_INCREF(__pyx_kp_u_read_on_write_only_BGZFile_objec);
5916 __Pyx_GIVEREF(__pyx_kp_u_read_on_write_only_BGZFile_objec);
5917 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_read_on_write_only_BGZFile_objec)) __PYX_ERR(0, 94, __pyx_L1_error);
5918 __pyx_t_2 = 0;
5919 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
5920 __Pyx_GOTREF(__pyx_t_2);
5921 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5922 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5924 __PYX_ERR(0, 94, __pyx_L1_error)
5925
5926 /* "pysam/libcbgzf.pyx":92
5927 * raise ValueError("read() on closed BGZFile object")
5928 *
5929 * if self.bgzf.is_write: # <<<<<<<<<<<<<<
5930 * import errno
5931 * raise IOError(errno.EBADF, "read() on write-only BGZFile object")
5932 */
5933 }
5934
5935 /* "pysam/libcbgzf.pyx":96
5936 * raise IOError(errno.EBADF, "read() on write-only BGZFile object")
5937 *
5938 * if size < 0: # <<<<<<<<<<<<<<
5939 * chunks = []
5940 * while 1:
5941 */
5942 __pyx_t_2 = PyObject_RichCompare(__pyx_v_size, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
5943 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 96, __pyx_L1_error)
5944 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5945 if (__pyx_t_1) {
5946
5947 /* "pysam/libcbgzf.pyx":97
5948 *
5949 * if size < 0:
5950 * chunks = [] # <<<<<<<<<<<<<<
5951 * while 1:
5952 * chunk = PyBytes_FromStringAndSize(NULL, BUFFER_SIZE)
5953 */
5954 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
5955 __Pyx_GOTREF(__pyx_t_2);
5956 __pyx_v_chunks = ((PyObject*)__pyx_t_2);
5957 __pyx_t_2 = 0;
5958
5959 /* "pysam/libcbgzf.pyx":98
5960 * if size < 0:
5961 * chunks = []
5962 * while 1: # <<<<<<<<<<<<<<
5963 * chunk = PyBytes_FromStringAndSize(NULL, BUFFER_SIZE)
5964 * cdata = <bytes>chunk
5965 */
5966 while (1) {
5967
5968 /* "pysam/libcbgzf.pyx":99
5969 * chunks = []
5970 * while 1:
5971 * chunk = PyBytes_FromStringAndSize(NULL, BUFFER_SIZE) # <<<<<<<<<<<<<<
5972 * cdata = <bytes>chunk
5973 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
5974 */
5975 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUFFER_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
5976 __Pyx_GOTREF(__pyx_t_2);
5977 __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error)
5978 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5979 __pyx_t_2 = PyBytes_FromStringAndSize(NULL, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
5980 __Pyx_GOTREF(__pyx_t_2);
5981 __Pyx_XDECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_2));
5982 __pyx_t_2 = 0;
5983
5984 /* "pysam/libcbgzf.pyx":100
5985 * while 1:
5986 * chunk = PyBytes_FromStringAndSize(NULL, BUFFER_SIZE)
5987 * cdata = <bytes>chunk # <<<<<<<<<<<<<<
5988 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
5989 * if read_size < 0:
5990 */
5991 __pyx_t_2 = __pyx_v_chunk;
5992 __Pyx_INCREF(__pyx_t_2);
5993 __Pyx_XDECREF_SET(__pyx_v_cdata, ((PyObject*)__pyx_t_2));
5994 __pyx_t_2 = 0;
5995
5996 /* "pysam/libcbgzf.pyx":101
5997 * chunk = PyBytes_FromStringAndSize(NULL, BUFFER_SIZE)
5998 * cdata = <bytes>chunk
5999 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE) # <<<<<<<<<<<<<<
6000 * if read_size < 0:
6001 * raise IOError('Error reading from BGZFile')
6002 */
6003 if (unlikely(__pyx_v_chunk == Py_None)) {
6004 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6005 __PYX_ERR(0, 101, __pyx_L1_error)
6006 }
6007 __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_chunk); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
6008 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BUFFER_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
6009 __Pyx_GOTREF(__pyx_t_2);
6010 __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error)
6011 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6012 __pyx_v_read_size = bgzf_read(__pyx_v_self->bgzf, ((char *)__pyx_t_5), __pyx_t_6);
6013
6014 /* "pysam/libcbgzf.pyx":102
6015 * cdata = <bytes>chunk
6016 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
6017 * if read_size < 0: # <<<<<<<<<<<<<<
6018 * raise IOError('Error reading from BGZFile')
6019 * elif not read_size:
6020 */
6021 __pyx_t_1 = (__pyx_v_read_size < 0);
6022 if (unlikely(__pyx_t_1)) {
6023
6024 /* "pysam/libcbgzf.pyx":103
6025 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
6026 * if read_size < 0:
6027 * raise IOError('Error reading from BGZFile') # <<<<<<<<<<<<<<
6028 * elif not read_size:
6029 * break
6030 */
6031 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
6032 __Pyx_GOTREF(__pyx_t_2);
6033 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
6034 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6035 __PYX_ERR(0, 103, __pyx_L1_error)
6036
6037 /* "pysam/libcbgzf.pyx":102
6038 * cdata = <bytes>chunk
6039 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
6040 * if read_size < 0: # <<<<<<<<<<<<<<
6041 * raise IOError('Error reading from BGZFile')
6042 * elif not read_size:
6043 */
6044 }
6045
6046 /* "pysam/libcbgzf.pyx":104
6047 * if read_size < 0:
6048 * raise IOError('Error reading from BGZFile')
6049 * elif not read_size: # <<<<<<<<<<<<<<
6050 * break
6051 * elif read_size < BUFFER_SIZE:
6052 */
6053 __pyx_t_1 = (!(__pyx_v_read_size != 0));
6054 if (__pyx_t_1) {
6055
6056 /* "pysam/libcbgzf.pyx":105
6057 * raise IOError('Error reading from BGZFile')
6058 * elif not read_size:
6059 * break # <<<<<<<<<<<<<<
6060 * elif read_size < BUFFER_SIZE:
6061 * chunk = chunk[:read_size]
6062 */
6063 goto __pyx_L7_break;
6064
6065 /* "pysam/libcbgzf.pyx":104
6066 * if read_size < 0:
6067 * raise IOError('Error reading from BGZFile')
6068 * elif not read_size: # <<<<<<<<<<<<<<
6069 * break
6070 * elif read_size < BUFFER_SIZE:
6071 */
6072 }
6073
6074 /* "pysam/libcbgzf.pyx":106
6075 * elif not read_size:
6076 * break
6077 * elif read_size < BUFFER_SIZE: # <<<<<<<<<<<<<<
6078 * chunk = chunk[:read_size]
6079 * chunks.append(chunk)
6080 */
6081 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_read_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
6082 __Pyx_GOTREF(__pyx_t_2);
6083 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BUFFER_SIZE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
6084 __Pyx_GOTREF(__pyx_t_3);
6085 __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L1_error)
6086 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6087 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6088 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 106, __pyx_L1_error)
6089 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6090 if (__pyx_t_1) {
6091
6092 /* "pysam/libcbgzf.pyx":107
6093 * break
6094 * elif read_size < BUFFER_SIZE:
6095 * chunk = chunk[:read_size] # <<<<<<<<<<<<<<
6096 * chunks.append(chunk)
6097 * return b''.join(chunks)
6098 */
6099 if (unlikely(__pyx_v_chunk == Py_None)) {
6100 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6101 __PYX_ERR(0, 107, __pyx_L1_error)
6102 }
6103 __pyx_t_7 = PySequence_GetSlice(__pyx_v_chunk, 0, __pyx_v_read_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error)
6104 __Pyx_GOTREF(__pyx_t_7);
6105 __Pyx_DECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_7));
6106 __pyx_t_7 = 0;
6107
6108 /* "pysam/libcbgzf.pyx":106
6109 * elif not read_size:
6110 * break
6111 * elif read_size < BUFFER_SIZE: # <<<<<<<<<<<<<<
6112 * chunk = chunk[:read_size]
6113 * chunks.append(chunk)
6114 */
6115 }
6116
6117 /* "pysam/libcbgzf.pyx":108
6118 * elif read_size < BUFFER_SIZE:
6119 * chunk = chunk[:read_size]
6120 * chunks.append(chunk) # <<<<<<<<<<<<<<
6121 * return b''.join(chunks)
6122 *
6123 */
6124 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_chunks, __pyx_v_chunk); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 108, __pyx_L1_error)
6125 }
6126 __pyx_L7_break:;
6127
6128 /* "pysam/libcbgzf.pyx":109
6129 * chunk = chunk[:read_size]
6130 * chunks.append(chunk)
6131 * return b''.join(chunks) # <<<<<<<<<<<<<<
6132 *
6133 * elif size > 0:
6134 */
6135 __Pyx_XDECREF(__pyx_r);
6136 __pyx_t_7 = __Pyx_PyBytes_Join(__pyx_kp_b__7, __pyx_v_chunks); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 109, __pyx_L1_error)
6137 __Pyx_GOTREF(__pyx_t_7);
6138 __pyx_r = __pyx_t_7;
6139 __pyx_t_7 = 0;
6140 goto __pyx_L0;
6141
6142 /* "pysam/libcbgzf.pyx":96
6143 * raise IOError(errno.EBADF, "read() on write-only BGZFile object")
6144 *
6145 * if size < 0: # <<<<<<<<<<<<<<
6146 * chunks = []
6147 * while 1:
6148 */
6149 }
6150
6151 /* "pysam/libcbgzf.pyx":111
6152 * return b''.join(chunks)
6153 *
6154 * elif size > 0: # <<<<<<<<<<<<<<
6155 * chunk = PyBytes_FromStringAndSize(NULL, size)
6156 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6157 */
6158 __pyx_t_7 = PyObject_RichCompare(__pyx_v_size, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error)
6159 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 111, __pyx_L1_error)
6160 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6161 if (__pyx_t_1) {
6162
6163 /* "pysam/libcbgzf.pyx":112
6164 *
6165 * elif size > 0:
6166 * chunk = PyBytes_FromStringAndSize(NULL, size) # <<<<<<<<<<<<<<
6167 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6168 * if read_size < 0:
6169 */
6170 __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_size); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
6171 __pyx_t_7 = PyBytes_FromStringAndSize(NULL, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 112, __pyx_L1_error)
6172 __Pyx_GOTREF(__pyx_t_7);
6173 __pyx_v_chunk = ((PyObject*)__pyx_t_7);
6174 __pyx_t_7 = 0;
6175
6176 /* "pysam/libcbgzf.pyx":113
6177 * elif size > 0:
6178 * chunk = PyBytes_FromStringAndSize(NULL, size)
6179 * read_size = bgzf_read(self.bgzf, <char *>chunk, size) # <<<<<<<<<<<<<<
6180 * if read_size < 0:
6181 * raise IOError('Error reading from BGZFile')
6182 */
6183 if (unlikely(__pyx_v_chunk == Py_None)) {
6184 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6185 __PYX_ERR(0, 113, __pyx_L1_error)
6186 }
6187 __pyx_t_5 = __Pyx_PyBytes_AsWritableString(__pyx_v_chunk); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
6188 __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_size); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
6189 __pyx_v_read_size = bgzf_read(__pyx_v_self->bgzf, ((char *)__pyx_t_5), __pyx_t_6);
6190
6191 /* "pysam/libcbgzf.pyx":114
6192 * chunk = PyBytes_FromStringAndSize(NULL, size)
6193 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6194 * if read_size < 0: # <<<<<<<<<<<<<<
6195 * raise IOError('Error reading from BGZFile')
6196 * elif read_size < size:
6197 */
6198 __pyx_t_1 = (__pyx_v_read_size < 0);
6199 if (unlikely(__pyx_t_1)) {
6200
6201 /* "pysam/libcbgzf.pyx":115
6202 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6203 * if read_size < 0:
6204 * raise IOError('Error reading from BGZFile') # <<<<<<<<<<<<<<
6205 * elif read_size < size:
6206 * chunk = chunk[:read_size]
6207 */
6208 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __pyx_L1_error)
6209 __Pyx_GOTREF(__pyx_t_7);
6210 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
6211 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6212 __PYX_ERR(0, 115, __pyx_L1_error)
6213
6214 /* "pysam/libcbgzf.pyx":114
6215 * chunk = PyBytes_FromStringAndSize(NULL, size)
6216 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6217 * if read_size < 0: # <<<<<<<<<<<<<<
6218 * raise IOError('Error reading from BGZFile')
6219 * elif read_size < size:
6220 */
6221 }
6222
6223 /* "pysam/libcbgzf.pyx":116
6224 * if read_size < 0:
6225 * raise IOError('Error reading from BGZFile')
6226 * elif read_size < size: # <<<<<<<<<<<<<<
6227 * chunk = chunk[:read_size]
6228 * return chunk
6229 */
6230 __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_read_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __pyx_L1_error)
6231 __Pyx_GOTREF(__pyx_t_7);
6232 __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_v_size, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
6233 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6234 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
6235 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6236 if (__pyx_t_1) {
6237
6238 /* "pysam/libcbgzf.pyx":117
6239 * raise IOError('Error reading from BGZFile')
6240 * elif read_size < size:
6241 * chunk = chunk[:read_size] # <<<<<<<<<<<<<<
6242 * return chunk
6243 * else:
6244 */
6245 if (unlikely(__pyx_v_chunk == Py_None)) {
6246 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6247 __PYX_ERR(0, 117, __pyx_L1_error)
6248 }
6249 __pyx_t_3 = PySequence_GetSlice(__pyx_v_chunk, 0, __pyx_v_read_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
6250 __Pyx_GOTREF(__pyx_t_3);
6251 __Pyx_DECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_3));
6252 __pyx_t_3 = 0;
6253
6254 /* "pysam/libcbgzf.pyx":116
6255 * if read_size < 0:
6256 * raise IOError('Error reading from BGZFile')
6257 * elif read_size < size: # <<<<<<<<<<<<<<
6258 * chunk = chunk[:read_size]
6259 * return chunk
6260 */
6261 }
6262
6263 /* "pysam/libcbgzf.pyx":118
6264 * elif read_size < size:
6265 * chunk = chunk[:read_size]
6266 * return chunk # <<<<<<<<<<<<<<
6267 * else:
6268 * return b''
6269 */
6270 __Pyx_XDECREF(__pyx_r);
6271 __Pyx_INCREF(__pyx_v_chunk);
6272 __pyx_r = __pyx_v_chunk;
6273 goto __pyx_L0;
6274
6275 /* "pysam/libcbgzf.pyx":111
6276 * return b''.join(chunks)
6277 *
6278 * elif size > 0: # <<<<<<<<<<<<<<
6279 * chunk = PyBytes_FromStringAndSize(NULL, size)
6280 * read_size = bgzf_read(self.bgzf, <char *>chunk, size)
6281 */
6282 }
6283
6284 /* "pysam/libcbgzf.pyx":120
6285 * return chunk
6286 * else:
6287 * return b'' # <<<<<<<<<<<<<<
6288 *
6289 * @property
6290 */
6291 /*else*/ {
6292 __Pyx_XDECREF(__pyx_r);
6293 __Pyx_INCREF(__pyx_kp_b__7);
6294 __pyx_r = __pyx_kp_b__7;
6295 goto __pyx_L0;
6296 }
6297
6298 /* "pysam/libcbgzf.pyx":86
6299 * return length
6300 *
6301 * def read(self, size=-1): # <<<<<<<<<<<<<<
6302 * cdef ssize_t read_size
6303 *
6304 */
6305
6306 /* function exit code */
6307 __pyx_L1_error:;
6308 __Pyx_XDECREF(__pyx_t_2);
6309 __Pyx_XDECREF(__pyx_t_3);
6310 __Pyx_XDECREF(__pyx_t_7);
6311 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
6312 __pyx_r = NULL;
6313 __pyx_L0:;
6314 __Pyx_XDECREF(__pyx_v_errno);
6315 __Pyx_XDECREF(__pyx_v_chunks);
6316 __Pyx_XDECREF(__pyx_v_chunk);
6317 __Pyx_XDECREF(__pyx_v_cdata);
6318 __Pyx_XGIVEREF(__pyx_r);
6319 __Pyx_RefNannyFinishContext();
6320 return __pyx_r;
6321 }
6322
6323 /* "pysam/libcbgzf.pyx":122
6324 * return b''
6325 *
6326 * @property # <<<<<<<<<<<<<<
6327 * def closed(self):
6328 * return self.bgzf == NULL
6329 */
6330
6331 /* Python wrapper */
6332 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
6333 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_6closed_1__get__(PyObject *__pyx_v_self) {
6334 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6335 PyObject *__pyx_r = 0;
6336 __Pyx_RefNannyDeclarations
6337 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6338 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
6339 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_6closed___get__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
6340
6341 /* function exit code */
6342 __Pyx_RefNannyFinishContext();
6343 return __pyx_r;
6344 }
6345
6346 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_6closed___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
6347 PyObject *__pyx_r = NULL;
6348 __Pyx_RefNannyDeclarations
6349 PyObject *__pyx_t_1 = NULL;
6350 int __pyx_lineno = 0;
6351 const char *__pyx_filename = NULL;
6352 int __pyx_clineno = 0;
6353 __Pyx_RefNannySetupContext("__get__", 1);
6354
6355 /* "pysam/libcbgzf.pyx":124
6356 * @property
6357 * def closed(self):
6358 * return self.bgzf == NULL # <<<<<<<<<<<<<<
6359 *
6360 * def close(self):
6361 */
6362 __Pyx_XDECREF(__pyx_r);
6363 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->bgzf == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
6364 __Pyx_GOTREF(__pyx_t_1);
6365 __pyx_r = __pyx_t_1;
6366 __pyx_t_1 = 0;
6367 goto __pyx_L0;
6368
6369 /* "pysam/libcbgzf.pyx":122
6370 * return b''
6371 *
6372 * @property # <<<<<<<<<<<<<<
6373 * def closed(self):
6374 * return self.bgzf == NULL
6375 */
6376
6377 /* function exit code */
6378 __pyx_L1_error:;
6379 __Pyx_XDECREF(__pyx_t_1);
6380 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6381 __pyx_r = NULL;
6382 __pyx_L0:;
6383 __Pyx_XGIVEREF(__pyx_r);
6384 __Pyx_RefNannyFinishContext();
6385 return __pyx_r;
6386 }
6387
6388 /* "pysam/libcbgzf.pyx":126
6389 * return self.bgzf == NULL
6390 *
6391 * def close(self): # <<<<<<<<<<<<<<
6392 * if not self.bgzf:
6393 * return
6394 */
6395
6396 /* Python wrapper */
6397 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_9close(PyObject *__pyx_v_self,
6398 #if CYTHON_METH_FASTCALL
6399 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6400 #else
6401 PyObject *__pyx_args, PyObject *__pyx_kwds
6402 #endif
6403 ); /*proto*/
6404 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_9close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_9close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
6405 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_9close(PyObject *__pyx_v_self,
6406 #if CYTHON_METH_FASTCALL
6407 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6408 #else
6409 PyObject *__pyx_args, PyObject *__pyx_kwds
6410 #endif
6411 ) {
6412 #if !CYTHON_METH_FASTCALL
6413 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6414 #endif
6415 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6416 PyObject *__pyx_r = 0;
6417 __Pyx_RefNannyDeclarations
6418 __Pyx_RefNannySetupContext("close (wrapper)", 0);
6419 #if !CYTHON_METH_FASTCALL
6420 #if CYTHON_ASSUME_SAFE_MACROS
6421 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6422 #else
6423 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
6424 #endif
6425 #endif
6426 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6427 if (unlikely(__pyx_nargs > 0)) {
6428 __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
6429 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
6430 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_8close(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
6431
6432 /* function exit code */
6433 __Pyx_RefNannyFinishContext();
6434 return __pyx_r;
6435 }
6436
6437 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_8close(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
6438 PyObject *__pyx_v_ret = 0;
6439 PyObject *__pyx_r = NULL;
6440 __Pyx_RefNannyDeclarations
6441 int __pyx_t_1;
6442 int __pyx_t_2;
6443 PyObject *__pyx_t_3 = NULL;
6444 char const *__pyx_t_4;
6445 int __pyx_lineno = 0;
6446 const char *__pyx_filename = NULL;
6447 int __pyx_clineno = 0;
6448 __Pyx_RefNannySetupContext("close", 1);
6449
6450 /* "pysam/libcbgzf.pyx":127
6451 *
6452 * def close(self):
6453 * if not self.bgzf: # <<<<<<<<<<<<<<
6454 * return
6455 *
6456 */
6457 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
6458 if (__pyx_t_1) {
6459
6460 /* "pysam/libcbgzf.pyx":128
6461 * def close(self):
6462 * if not self.bgzf:
6463 * return # <<<<<<<<<<<<<<
6464 *
6465 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0:
6466 */
6467 __Pyx_XDECREF(__pyx_r);
6468 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6469 goto __pyx_L0;
6470
6471 /* "pysam/libcbgzf.pyx":127
6472 *
6473 * def close(self):
6474 * if not self.bgzf: # <<<<<<<<<<<<<<
6475 * return
6476 *
6477 */
6478 }
6479
6480 /* "pysam/libcbgzf.pyx":130
6481 * return
6482 *
6483 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0: # <<<<<<<<<<<<<<
6484 * raise IOError('Error flushing BGZFile object')
6485 *
6486 */
6487 __pyx_t_2 = (__pyx_v_self->bgzf->is_write != 0);
6488 if (__pyx_t_2) {
6489 } else {
6490 __pyx_t_1 = __pyx_t_2;
6491 goto __pyx_L5_bool_binop_done;
6492 }
6493 __pyx_t_2 = (bgzf_flush(__pyx_v_self->bgzf) < 0);
6494 __pyx_t_1 = __pyx_t_2;
6495 __pyx_L5_bool_binop_done:;
6496 if (unlikely(__pyx_t_1)) {
6497
6498 /* "pysam/libcbgzf.pyx":131
6499 *
6500 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0:
6501 * raise IOError('Error flushing BGZFile object') # <<<<<<<<<<<<<<
6502 *
6503 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0:
6504 */
6505 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error)
6506 __Pyx_GOTREF(__pyx_t_3);
6507 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6508 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6509 __PYX_ERR(0, 131, __pyx_L1_error)
6510
6511 /* "pysam/libcbgzf.pyx":130
6512 * return
6513 *
6514 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0: # <<<<<<<<<<<<<<
6515 * raise IOError('Error flushing BGZFile object')
6516 *
6517 */
6518 }
6519
6520 /* "pysam/libcbgzf.pyx":133
6521 * raise IOError('Error flushing BGZFile object')
6522 *
6523 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0: # <<<<<<<<<<<<<<
6524 * raise IOError('Cannot write index')
6525 *
6526 */
6527 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->index); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 133, __pyx_L1_error)
6528 if (__pyx_t_2) {
6529 } else {
6530 __pyx_t_1 = __pyx_t_2;
6531 goto __pyx_L8_bool_binop_done;
6532 }
6533 __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_self->index); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)
6534 __pyx_t_2 = (bgzf_index_dump(__pyx_v_self->bgzf, __pyx_t_4, NULL) < 0);
6535 __pyx_t_1 = __pyx_t_2;
6536 __pyx_L8_bool_binop_done:;
6537 if (unlikely(__pyx_t_1)) {
6538
6539 /* "pysam/libcbgzf.pyx":134
6540 *
6541 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0:
6542 * raise IOError('Cannot write index') # <<<<<<<<<<<<<<
6543 *
6544 * cdef ret = bgzf_close(self.bgzf)
6545 */
6546 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
6547 __Pyx_GOTREF(__pyx_t_3);
6548 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6549 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6550 __PYX_ERR(0, 134, __pyx_L1_error)
6551
6552 /* "pysam/libcbgzf.pyx":133
6553 * raise IOError('Error flushing BGZFile object')
6554 *
6555 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0: # <<<<<<<<<<<<<<
6556 * raise IOError('Cannot write index')
6557 *
6558 */
6559 }
6560
6561 /* "pysam/libcbgzf.pyx":136
6562 * raise IOError('Cannot write index')
6563 *
6564 * cdef ret = bgzf_close(self.bgzf) # <<<<<<<<<<<<<<
6565 * self.bgzf = NULL
6566 *
6567 */
6568 __pyx_t_3 = __Pyx_PyInt_From_int(bgzf_close(__pyx_v_self->bgzf)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error)
6569 __Pyx_GOTREF(__pyx_t_3);
6570 __pyx_v_ret = __pyx_t_3;
6571 __pyx_t_3 = 0;
6572
6573 /* "pysam/libcbgzf.pyx":137
6574 *
6575 * cdef ret = bgzf_close(self.bgzf)
6576 * self.bgzf = NULL # <<<<<<<<<<<<<<
6577 *
6578 * if ret < 0:
6579 */
6580 __pyx_v_self->bgzf = NULL;
6581
6582 /* "pysam/libcbgzf.pyx":139
6583 * self.bgzf = NULL
6584 *
6585 * if ret < 0: # <<<<<<<<<<<<<<
6586 * raise IOError('Error closing BGZFile object')
6587 *
6588 */
6589 __pyx_t_3 = PyObject_RichCompare(__pyx_v_ret, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
6590 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 139, __pyx_L1_error)
6591 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6592 if (unlikely(__pyx_t_1)) {
6593
6594 /* "pysam/libcbgzf.pyx":140
6595 *
6596 * if ret < 0:
6597 * raise IOError('Error closing BGZFile object') # <<<<<<<<<<<<<<
6598 *
6599 * def __enter__(self):
6600 */
6601 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error)
6602 __Pyx_GOTREF(__pyx_t_3);
6603 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6604 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6605 __PYX_ERR(0, 140, __pyx_L1_error)
6606
6607 /* "pysam/libcbgzf.pyx":139
6608 * self.bgzf = NULL
6609 *
6610 * if ret < 0: # <<<<<<<<<<<<<<
6611 * raise IOError('Error closing BGZFile object')
6612 *
6613 */
6614 }
6615
6616 /* "pysam/libcbgzf.pyx":126
6617 * return self.bgzf == NULL
6618 *
6619 * def close(self): # <<<<<<<<<<<<<<
6620 * if not self.bgzf:
6621 * return
6622 */
6623
6624 /* function exit code */
6625 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6626 goto __pyx_L0;
6627 __pyx_L1_error:;
6628 __Pyx_XDECREF(__pyx_t_3);
6629 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
6630 __pyx_r = NULL;
6631 __pyx_L0:;
6632 __Pyx_XDECREF(__pyx_v_ret);
6633 __Pyx_XGIVEREF(__pyx_r);
6634 __Pyx_RefNannyFinishContext();
6635 return __pyx_r;
6636 }
6637
6638 /* "pysam/libcbgzf.pyx":142
6639 * raise IOError('Error closing BGZFile object')
6640 *
6641 * def __enter__(self): # <<<<<<<<<<<<<<
6642 * return self
6643 *
6644 */
6645
6646 /* Python wrapper */
6647 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_11__enter__(PyObject *__pyx_v_self,
6648 #if CYTHON_METH_FASTCALL
6649 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6650 #else
6651 PyObject *__pyx_args, PyObject *__pyx_kwds
6652 #endif
6653 ); /*proto*/
6654 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_11__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_11__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
6655 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_11__enter__(PyObject *__pyx_v_self,
6656 #if CYTHON_METH_FASTCALL
6657 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6658 #else
6659 PyObject *__pyx_args, PyObject *__pyx_kwds
6660 #endif
6661 ) {
6662 #if !CYTHON_METH_FASTCALL
6663 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6664 #endif
6665 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6666 PyObject *__pyx_r = 0;
6667 __Pyx_RefNannyDeclarations
6668 __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
6669 #if !CYTHON_METH_FASTCALL
6670 #if CYTHON_ASSUME_SAFE_MACROS
6671 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6672 #else
6673 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
6674 #endif
6675 #endif
6676 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6677 if (unlikely(__pyx_nargs > 0)) {
6678 __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
6679 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
6680 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_10__enter__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
6681
6682 /* function exit code */
6683 __Pyx_RefNannyFinishContext();
6684 return __pyx_r;
6685 }
6686
6687 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_10__enter__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
6688 PyObject *__pyx_r = NULL;
6689 __Pyx_RefNannyDeclarations
6690 __Pyx_RefNannySetupContext("__enter__", 1);
6691
6692 /* "pysam/libcbgzf.pyx":143
6693 *
6694 * def __enter__(self):
6695 * return self # <<<<<<<<<<<<<<
6696 *
6697 * def __exit__(self, type, value, tb):
6698 */
6699 __Pyx_XDECREF(__pyx_r);
6700 __Pyx_INCREF((PyObject *)__pyx_v_self);
6701 __pyx_r = ((PyObject *)__pyx_v_self);
6702 goto __pyx_L0;
6703
6704 /* "pysam/libcbgzf.pyx":142
6705 * raise IOError('Error closing BGZFile object')
6706 *
6707 * def __enter__(self): # <<<<<<<<<<<<<<
6708 * return self
6709 *
6710 */
6711
6712 /* function exit code */
6713 __pyx_L0:;
6714 __Pyx_XGIVEREF(__pyx_r);
6715 __Pyx_RefNannyFinishContext();
6716 return __pyx_r;
6717 }
6718
6719 /* "pysam/libcbgzf.pyx":145
6720 * return self
6721 *
6722 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
6723 * self.close()
6724 *
6725 */
6726
6727 /* Python wrapper */
6728 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_13__exit__(PyObject *__pyx_v_self,
6729 #if CYTHON_METH_FASTCALL
6730 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6731 #else
6732 PyObject *__pyx_args, PyObject *__pyx_kwds
6733 #endif
6734 ); /*proto*/
6735 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_13__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_13__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
6736 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_13__exit__(PyObject *__pyx_v_self,
6737 #if CYTHON_METH_FASTCALL
6738 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6739 #else
6740 PyObject *__pyx_args, PyObject *__pyx_kwds
6741 #endif
6742 ) {
6743 CYTHON_UNUSED PyObject *__pyx_v_type = 0;
6744 CYTHON_UNUSED PyObject *__pyx_v_value = 0;
6745 CYTHON_UNUSED PyObject *__pyx_v_tb = 0;
6746 #if !CYTHON_METH_FASTCALL
6747 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6748 #endif
6749 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6750 PyObject* values[3] = {0,0,0};
6751 int __pyx_lineno = 0;
6752 const char *__pyx_filename = NULL;
6753 int __pyx_clineno = 0;
6754 PyObject *__pyx_r = 0;
6755 __Pyx_RefNannyDeclarations
6756 __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
6757 #if !CYTHON_METH_FASTCALL
6758 #if CYTHON_ASSUME_SAFE_MACROS
6759 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6760 #else
6761 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
6762 #endif
6763 #endif
6764 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6765 {
6766 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_tb,0};
6767 if (__pyx_kwds) {
6768 Py_ssize_t kw_args;
6769 switch (__pyx_nargs) {
6770 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
6771 CYTHON_FALLTHROUGH;
6772 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
6773 CYTHON_FALLTHROUGH;
6774 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6775 CYTHON_FALLTHROUGH;
6776 case 0: break;
6777 default: goto __pyx_L5_argtuple_error;
6778 }
6779 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
6780 switch (__pyx_nargs) {
6781 case 0:
6782 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) {
6783 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
6784 kw_args--;
6785 }
6786 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
6787 else goto __pyx_L5_argtuple_error;
6788 CYTHON_FALLTHROUGH;
6789 case 1:
6790 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
6791 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
6792 kw_args--;
6793 }
6794 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
6795 else {
6796 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 145, __pyx_L3_error)
6797 }
6798 CYTHON_FALLTHROUGH;
6799 case 2:
6800 if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tb)) != 0)) {
6801 (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
6802 kw_args--;
6803 }
6804 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
6805 else {
6806 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 145, __pyx_L3_error)
6807 }
6808 }
6809 if (unlikely(kw_args > 0)) {
6810 const Py_ssize_t kwd_pos_args = __pyx_nargs;
6811 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(0, 145, __pyx_L3_error)
6812 }
6813 } else if (unlikely(__pyx_nargs != 3)) {
6814 goto __pyx_L5_argtuple_error;
6815 } else {
6816 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6817 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
6818 values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
6819 }
6820 __pyx_v_type = values[0];
6821 __pyx_v_value = values[1];
6822 __pyx_v_tb = values[2];
6823 }
6824 goto __pyx_L6_skip;
6825 __pyx_L5_argtuple_error:;
6826 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 145, __pyx_L3_error)
6827 __pyx_L6_skip:;
6828 goto __pyx_L4_argument_unpacking_done;
6829 __pyx_L3_error:;
6830 {
6831 Py_ssize_t __pyx_temp;
6832 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6833 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
6834 }
6835 }
6836 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6837 __Pyx_RefNannyFinishContext();
6838 return NULL;
6839 __pyx_L4_argument_unpacking_done:;
6840 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_12__exit__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_tb);
6841
6842 /* function exit code */
6843 {
6844 Py_ssize_t __pyx_temp;
6845 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6846 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
6847 }
6848 }
6849 __Pyx_RefNannyFinishContext();
6850 return __pyx_r;
6851 }
6852
6853 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_12__exit__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb) {
6854 PyObject *__pyx_r = NULL;
6855 __Pyx_RefNannyDeclarations
6856 PyObject *__pyx_t_1 = NULL;
6857 PyObject *__pyx_t_2 = NULL;
6858 PyObject *__pyx_t_3 = NULL;
6859 unsigned int __pyx_t_4;
6860 int __pyx_lineno = 0;
6861 const char *__pyx_filename = NULL;
6862 int __pyx_clineno = 0;
6863 __Pyx_RefNannySetupContext("__exit__", 1);
6864
6865 /* "pysam/libcbgzf.pyx":146
6866 *
6867 * def __exit__(self, type, value, tb):
6868 * self.close() # <<<<<<<<<<<<<<
6869 *
6870 * def flush(self):
6871 */
6872 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
6873 __Pyx_GOTREF(__pyx_t_2);
6874 __pyx_t_3 = NULL;
6875 __pyx_t_4 = 0;
6876 #if CYTHON_UNPACK_METHODS
6877 if (likely(PyMethod_Check(__pyx_t_2))) {
6878 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6879 if (likely(__pyx_t_3)) {
6880 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6881 __Pyx_INCREF(__pyx_t_3);
6882 __Pyx_INCREF(function);
6883 __Pyx_DECREF_SET(__pyx_t_2, function);
6884 __pyx_t_4 = 1;
6885 }
6886 }
6887 #endif
6888 {
6889 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
6890 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
6891 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6892 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
6893 __Pyx_GOTREF(__pyx_t_1);
6894 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6895 }
6896 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6897
6898 /* "pysam/libcbgzf.pyx":145
6899 * return self
6900 *
6901 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
6902 * self.close()
6903 *
6904 */
6905
6906 /* function exit code */
6907 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6908 goto __pyx_L0;
6909 __pyx_L1_error:;
6910 __Pyx_XDECREF(__pyx_t_1);
6911 __Pyx_XDECREF(__pyx_t_2);
6912 __Pyx_XDECREF(__pyx_t_3);
6913 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6914 __pyx_r = NULL;
6915 __pyx_L0:;
6916 __Pyx_XGIVEREF(__pyx_r);
6917 __Pyx_RefNannyFinishContext();
6918 return __pyx_r;
6919 }
6920
6921 /* "pysam/libcbgzf.pyx":148
6922 * self.close()
6923 *
6924 * def flush(self): # <<<<<<<<<<<<<<
6925 * if not self.bgzf:
6926 * return
6927 */
6928
6929 /* Python wrapper */
6930 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_15flush(PyObject *__pyx_v_self,
6931 #if CYTHON_METH_FASTCALL
6932 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6933 #else
6934 PyObject *__pyx_args, PyObject *__pyx_kwds
6935 #endif
6936 ); /*proto*/
6937 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_15flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
6938 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_15flush(PyObject *__pyx_v_self,
6939 #if CYTHON_METH_FASTCALL
6940 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6941 #else
6942 PyObject *__pyx_args, PyObject *__pyx_kwds
6943 #endif
6944 ) {
6945 #if !CYTHON_METH_FASTCALL
6946 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6947 #endif
6948 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6949 PyObject *__pyx_r = 0;
6950 __Pyx_RefNannyDeclarations
6951 __Pyx_RefNannySetupContext("flush (wrapper)", 0);
6952 #if !CYTHON_METH_FASTCALL
6953 #if CYTHON_ASSUME_SAFE_MACROS
6954 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6955 #else
6956 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
6957 #endif
6958 #endif
6959 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6960 if (unlikely(__pyx_nargs > 0)) {
6961 __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL;}
6962 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
6963 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_14flush(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
6964
6965 /* function exit code */
6966 __Pyx_RefNannyFinishContext();
6967 return __pyx_r;
6968 }
6969
6970 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_14flush(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
6971 PyObject *__pyx_r = NULL;
6972 __Pyx_RefNannyDeclarations
6973 int __pyx_t_1;
6974 int __pyx_t_2;
6975 PyObject *__pyx_t_3 = NULL;
6976 int __pyx_lineno = 0;
6977 const char *__pyx_filename = NULL;
6978 int __pyx_clineno = 0;
6979 __Pyx_RefNannySetupContext("flush", 1);
6980
6981 /* "pysam/libcbgzf.pyx":149
6982 *
6983 * def flush(self):
6984 * if not self.bgzf: # <<<<<<<<<<<<<<
6985 * return
6986 *
6987 */
6988 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
6989 if (__pyx_t_1) {
6990
6991 /* "pysam/libcbgzf.pyx":150
6992 * def flush(self):
6993 * if not self.bgzf:
6994 * return # <<<<<<<<<<<<<<
6995 *
6996 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0:
6997 */
6998 __Pyx_XDECREF(__pyx_r);
6999 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7000 goto __pyx_L0;
7001
7002 /* "pysam/libcbgzf.pyx":149
7003 *
7004 * def flush(self):
7005 * if not self.bgzf: # <<<<<<<<<<<<<<
7006 * return
7007 *
7008 */
7009 }
7010
7011 /* "pysam/libcbgzf.pyx":152
7012 * return
7013 *
7014 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0: # <<<<<<<<<<<<<<
7015 * raise IOError('Error flushing BGZFile object')
7016 *
7017 */
7018 __pyx_t_2 = (__pyx_v_self->bgzf->is_write != 0);
7019 if (__pyx_t_2) {
7020 } else {
7021 __pyx_t_1 = __pyx_t_2;
7022 goto __pyx_L5_bool_binop_done;
7023 }
7024 __pyx_t_2 = (bgzf_flush(__pyx_v_self->bgzf) < 0);
7025 __pyx_t_1 = __pyx_t_2;
7026 __pyx_L5_bool_binop_done:;
7027 if (unlikely(__pyx_t_1)) {
7028
7029 /* "pysam/libcbgzf.pyx":153
7030 *
7031 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0:
7032 * raise IOError('Error flushing BGZFile object') # <<<<<<<<<<<<<<
7033 *
7034 * def fileno(self):
7035 */
7036 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
7037 __Pyx_GOTREF(__pyx_t_3);
7038 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7039 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7040 __PYX_ERR(0, 153, __pyx_L1_error)
7041
7042 /* "pysam/libcbgzf.pyx":152
7043 * return
7044 *
7045 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0: # <<<<<<<<<<<<<<
7046 * raise IOError('Error flushing BGZFile object')
7047 *
7048 */
7049 }
7050
7051 /* "pysam/libcbgzf.pyx":148
7052 * self.close()
7053 *
7054 * def flush(self): # <<<<<<<<<<<<<<
7055 * if not self.bgzf:
7056 * return
7057 */
7058
7059 /* function exit code */
7060 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7061 goto __pyx_L0;
7062 __pyx_L1_error:;
7063 __Pyx_XDECREF(__pyx_t_3);
7064 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
7065 __pyx_r = NULL;
7066 __pyx_L0:;
7067 __Pyx_XGIVEREF(__pyx_r);
7068 __Pyx_RefNannyFinishContext();
7069 return __pyx_r;
7070 }
7071
7072 /* "pysam/libcbgzf.pyx":155
7073 * raise IOError('Error flushing BGZFile object')
7074 *
7075 * def fileno(self): # <<<<<<<<<<<<<<
7076 * """Invoke the underlying file object's fileno() method.
7077 *
7078 */
7079
7080 /* Python wrapper */
7081 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_17fileno(PyObject *__pyx_v_self,
7082 #if CYTHON_METH_FASTCALL
7083 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7084 #else
7085 PyObject *__pyx_args, PyObject *__pyx_kwds
7086 #endif
7087 ); /*proto*/
7088 PyDoc_STRVAR(__pyx_doc_5pysam_8libcbgzf_7BGZFile_16fileno, "Invoke the underlying file object's fileno() method.\n\n This will raise AttributeError if the underlying file object\n doesn't support fileno().\n ");
7089 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_17fileno = {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_17fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_8libcbgzf_7BGZFile_16fileno};
7090 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_17fileno(PyObject *__pyx_v_self,
7091 #if CYTHON_METH_FASTCALL
7092 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7093 #else
7094 PyObject *__pyx_args, PyObject *__pyx_kwds
7095 #endif
7096 ) {
7097 #if !CYTHON_METH_FASTCALL
7098 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7099 #endif
7100 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7101 PyObject *__pyx_r = 0;
7102 __Pyx_RefNannyDeclarations
7103 __Pyx_RefNannySetupContext("fileno (wrapper)", 0);
7104 #if !CYTHON_METH_FASTCALL
7105 #if CYTHON_ASSUME_SAFE_MACROS
7106 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7107 #else
7108 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7109 #endif
7110 #endif
7111 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7112 if (unlikely(__pyx_nargs > 0)) {
7113 __Pyx_RaiseArgtupleInvalid("fileno", 1, 0, 0, __pyx_nargs); return NULL;}
7114 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "fileno", 0))) return NULL;
7115 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_16fileno(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7116
7117 /* function exit code */
7118 __Pyx_RefNannyFinishContext();
7119 return __pyx_r;
7120 }
7121
7122 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_16fileno(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7123 PyObject *__pyx_r = NULL;
7124 __Pyx_RefNannyDeclarations
7125 PyObject *__pyx_t_1 = NULL;
7126 int __pyx_lineno = 0;
7127 const char *__pyx_filename = NULL;
7128 int __pyx_clineno = 0;
7129 __Pyx_RefNannySetupContext("fileno", 1);
7130
7131 /* "pysam/libcbgzf.pyx":161
7132 * doesn't support fileno().
7133 * """
7134 * raise AttributeError('fileno') # <<<<<<<<<<<<<<
7135 *
7136 * def rewind(self):
7137 */
7138 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
7139 __Pyx_GOTREF(__pyx_t_1);
7140 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7141 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7142 __PYX_ERR(0, 161, __pyx_L1_error)
7143
7144 /* "pysam/libcbgzf.pyx":155
7145 * raise IOError('Error flushing BGZFile object')
7146 *
7147 * def fileno(self): # <<<<<<<<<<<<<<
7148 * """Invoke the underlying file object's fileno() method.
7149 *
7150 */
7151
7152 /* function exit code */
7153 __pyx_L1_error:;
7154 __Pyx_XDECREF(__pyx_t_1);
7155 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
7156 __pyx_r = NULL;
7157 __Pyx_XGIVEREF(__pyx_r);
7158 __Pyx_RefNannyFinishContext();
7159 return __pyx_r;
7160 }
7161
7162 /* "pysam/libcbgzf.pyx":163
7163 * raise AttributeError('fileno')
7164 *
7165 * def rewind(self): # <<<<<<<<<<<<<<
7166 * '''Return the uncompressed stream file position indicator to the
7167 * beginning of the file'''
7168 */
7169
7170 /* Python wrapper */
7171 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_19rewind(PyObject *__pyx_v_self,
7172 #if CYTHON_METH_FASTCALL
7173 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7174 #else
7175 PyObject *__pyx_args, PyObject *__pyx_kwds
7176 #endif
7177 ); /*proto*/
7178 PyDoc_STRVAR(__pyx_doc_5pysam_8libcbgzf_7BGZFile_18rewind, "Return the uncompressed stream file position indicator to the\n beginning of the file");
7179 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_19rewind = {"rewind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_19rewind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_8libcbgzf_7BGZFile_18rewind};
7180 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_19rewind(PyObject *__pyx_v_self,
7181 #if CYTHON_METH_FASTCALL
7182 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7183 #else
7184 PyObject *__pyx_args, PyObject *__pyx_kwds
7185 #endif
7186 ) {
7187 #if !CYTHON_METH_FASTCALL
7188 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7189 #endif
7190 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7191 PyObject *__pyx_r = 0;
7192 __Pyx_RefNannyDeclarations
7193 __Pyx_RefNannySetupContext("rewind (wrapper)", 0);
7194 #if !CYTHON_METH_FASTCALL
7195 #if CYTHON_ASSUME_SAFE_MACROS
7196 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7197 #else
7198 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7199 #endif
7200 #endif
7201 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7202 if (unlikely(__pyx_nargs > 0)) {
7203 __Pyx_RaiseArgtupleInvalid("rewind", 1, 0, 0, __pyx_nargs); return NULL;}
7204 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rewind", 0))) return NULL;
7205 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_18rewind(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7206
7207 /* function exit code */
7208 __Pyx_RefNannyFinishContext();
7209 return __pyx_r;
7210 }
7211
7212 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_18rewind(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7213 PyObject *__pyx_r = NULL;
7214 __Pyx_RefNannyDeclarations
7215 int __pyx_t_1;
7216 PyObject *__pyx_t_2 = NULL;
7217 int __pyx_lineno = 0;
7218 const char *__pyx_filename = NULL;
7219 int __pyx_clineno = 0;
7220 __Pyx_RefNannySetupContext("rewind", 1);
7221
7222 /* "pysam/libcbgzf.pyx":166
7223 * '''Return the uncompressed stream file position indicator to the
7224 * beginning of the file'''
7225 * if not self.bgzf: # <<<<<<<<<<<<<<
7226 * raise ValueError("rewind() on closed BGZFile object")
7227 * if not self.bgzf.is_write:
7228 */
7229 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
7230 if (unlikely(__pyx_t_1)) {
7231
7232 /* "pysam/libcbgzf.pyx":167
7233 * beginning of the file'''
7234 * if not self.bgzf:
7235 * raise ValueError("rewind() on closed BGZFile object") # <<<<<<<<<<<<<<
7236 * if not self.bgzf.is_write:
7237 * raise IOError("Can't rewind in write mode")
7238 */
7239 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
7240 __Pyx_GOTREF(__pyx_t_2);
7241 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7242 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7243 __PYX_ERR(0, 167, __pyx_L1_error)
7244
7245 /* "pysam/libcbgzf.pyx":166
7246 * '''Return the uncompressed stream file position indicator to the
7247 * beginning of the file'''
7248 * if not self.bgzf: # <<<<<<<<<<<<<<
7249 * raise ValueError("rewind() on closed BGZFile object")
7250 * if not self.bgzf.is_write:
7251 */
7252 }
7253
7254 /* "pysam/libcbgzf.pyx":168
7255 * if not self.bgzf:
7256 * raise ValueError("rewind() on closed BGZFile object")
7257 * if not self.bgzf.is_write: # <<<<<<<<<<<<<<
7258 * raise IOError("Can't rewind in write mode")
7259 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
7260 */
7261 __pyx_t_1 = (!(__pyx_v_self->bgzf->is_write != 0));
7262 if (unlikely(__pyx_t_1)) {
7263
7264 /* "pysam/libcbgzf.pyx":169
7265 * raise ValueError("rewind() on closed BGZFile object")
7266 * if not self.bgzf.is_write:
7267 * raise IOError("Can't rewind in write mode") # <<<<<<<<<<<<<<
7268 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
7269 * raise IOError('Error seeking BGZFFile object')
7270 */
7271 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
7272 __Pyx_GOTREF(__pyx_t_2);
7273 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7274 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7275 __PYX_ERR(0, 169, __pyx_L1_error)
7276
7277 /* "pysam/libcbgzf.pyx":168
7278 * if not self.bgzf:
7279 * raise ValueError("rewind() on closed BGZFile object")
7280 * if not self.bgzf.is_write: # <<<<<<<<<<<<<<
7281 * raise IOError("Can't rewind in write mode")
7282 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
7283 */
7284 }
7285
7286 /* "pysam/libcbgzf.pyx":170
7287 * if not self.bgzf.is_write:
7288 * raise IOError("Can't rewind in write mode")
7289 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0: # <<<<<<<<<<<<<<
7290 * raise IOError('Error seeking BGZFFile object')
7291 *
7292 */
7293 __pyx_t_1 = (bgzf_seek(__pyx_v_self->bgzf, 0, SEEK_SET) < 0);
7294 if (unlikely(__pyx_t_1)) {
7295
7296 /* "pysam/libcbgzf.pyx":171
7297 * raise IOError("Can't rewind in write mode")
7298 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
7299 * raise IOError('Error seeking BGZFFile object') # <<<<<<<<<<<<<<
7300 *
7301 * def readable(self):
7302 */
7303 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
7304 __Pyx_GOTREF(__pyx_t_2);
7305 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7306 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7307 __PYX_ERR(0, 171, __pyx_L1_error)
7308
7309 /* "pysam/libcbgzf.pyx":170
7310 * if not self.bgzf.is_write:
7311 * raise IOError("Can't rewind in write mode")
7312 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0: # <<<<<<<<<<<<<<
7313 * raise IOError('Error seeking BGZFFile object')
7314 *
7315 */
7316 }
7317
7318 /* "pysam/libcbgzf.pyx":163
7319 * raise AttributeError('fileno')
7320 *
7321 * def rewind(self): # <<<<<<<<<<<<<<
7322 * '''Return the uncompressed stream file position indicator to the
7323 * beginning of the file'''
7324 */
7325
7326 /* function exit code */
7327 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7328 goto __pyx_L0;
7329 __pyx_L1_error:;
7330 __Pyx_XDECREF(__pyx_t_2);
7331 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.rewind", __pyx_clineno, __pyx_lineno, __pyx_filename);
7332 __pyx_r = NULL;
7333 __pyx_L0:;
7334 __Pyx_XGIVEREF(__pyx_r);
7335 __Pyx_RefNannyFinishContext();
7336 return __pyx_r;
7337 }
7338
7339 /* "pysam/libcbgzf.pyx":173
7340 * raise IOError('Error seeking BGZFFile object')
7341 *
7342 * def readable(self): # <<<<<<<<<<<<<<
7343 * if not self.bgzf:
7344 * raise ValueError("readable() on closed BGZFile object")
7345 */
7346
7347 /* Python wrapper */
7348 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_21readable(PyObject *__pyx_v_self,
7349 #if CYTHON_METH_FASTCALL
7350 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7351 #else
7352 PyObject *__pyx_args, PyObject *__pyx_kwds
7353 #endif
7354 ); /*proto*/
7355 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_21readable = {"readable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_21readable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
7356 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_21readable(PyObject *__pyx_v_self,
7357 #if CYTHON_METH_FASTCALL
7358 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7359 #else
7360 PyObject *__pyx_args, PyObject *__pyx_kwds
7361 #endif
7362 ) {
7363 #if !CYTHON_METH_FASTCALL
7364 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7365 #endif
7366 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7367 PyObject *__pyx_r = 0;
7368 __Pyx_RefNannyDeclarations
7369 __Pyx_RefNannySetupContext("readable (wrapper)", 0);
7370 #if !CYTHON_METH_FASTCALL
7371 #if CYTHON_ASSUME_SAFE_MACROS
7372 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7373 #else
7374 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7375 #endif
7376 #endif
7377 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7378 if (unlikely(__pyx_nargs > 0)) {
7379 __Pyx_RaiseArgtupleInvalid("readable", 1, 0, 0, __pyx_nargs); return NULL;}
7380 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "readable", 0))) return NULL;
7381 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_20readable(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7382
7383 /* function exit code */
7384 __Pyx_RefNannyFinishContext();
7385 return __pyx_r;
7386 }
7387
7388 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_20readable(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7389 PyObject *__pyx_r = NULL;
7390 __Pyx_RefNannyDeclarations
7391 int __pyx_t_1;
7392 PyObject *__pyx_t_2 = NULL;
7393 PyObject *__pyx_t_3 = NULL;
7394 int __pyx_lineno = 0;
7395 const char *__pyx_filename = NULL;
7396 int __pyx_clineno = 0;
7397 __Pyx_RefNannySetupContext("readable", 1);
7398
7399 /* "pysam/libcbgzf.pyx":174
7400 *
7401 * def readable(self):
7402 * if not self.bgzf: # <<<<<<<<<<<<<<
7403 * raise ValueError("readable() on closed BGZFile object")
7404 * return self.bgzf != NULL and not self.bgzf.is_write
7405 */
7406 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
7407 if (unlikely(__pyx_t_1)) {
7408
7409 /* "pysam/libcbgzf.pyx":175
7410 * def readable(self):
7411 * if not self.bgzf:
7412 * raise ValueError("readable() on closed BGZFile object") # <<<<<<<<<<<<<<
7413 * return self.bgzf != NULL and not self.bgzf.is_write
7414 *
7415 */
7416 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
7417 __Pyx_GOTREF(__pyx_t_2);
7418 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7419 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7420 __PYX_ERR(0, 175, __pyx_L1_error)
7421
7422 /* "pysam/libcbgzf.pyx":174
7423 *
7424 * def readable(self):
7425 * if not self.bgzf: # <<<<<<<<<<<<<<
7426 * raise ValueError("readable() on closed BGZFile object")
7427 * return self.bgzf != NULL and not self.bgzf.is_write
7428 */
7429 }
7430
7431 /* "pysam/libcbgzf.pyx":176
7432 * if not self.bgzf:
7433 * raise ValueError("readable() on closed BGZFile object")
7434 * return self.bgzf != NULL and not self.bgzf.is_write # <<<<<<<<<<<<<<
7435 *
7436 * def writable(self):
7437 */
7438 __Pyx_XDECREF(__pyx_r);
7439 __pyx_t_1 = (__pyx_v_self->bgzf != NULL);
7440 if (__pyx_t_1) {
7441 } else {
7442 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
7443 __Pyx_GOTREF(__pyx_t_3);
7444 __pyx_t_2 = __pyx_t_3;
7445 __pyx_t_3 = 0;
7446 goto __pyx_L4_bool_binop_done;
7447 }
7448 __pyx_t_1 = (!(__pyx_v_self->bgzf->is_write != 0));
7449 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
7450 __Pyx_GOTREF(__pyx_t_3);
7451 __pyx_t_2 = __pyx_t_3;
7452 __pyx_t_3 = 0;
7453 __pyx_L4_bool_binop_done:;
7454 __pyx_r = __pyx_t_2;
7455 __pyx_t_2 = 0;
7456 goto __pyx_L0;
7457
7458 /* "pysam/libcbgzf.pyx":173
7459 * raise IOError('Error seeking BGZFFile object')
7460 *
7461 * def readable(self): # <<<<<<<<<<<<<<
7462 * if not self.bgzf:
7463 * raise ValueError("readable() on closed BGZFile object")
7464 */
7465
7466 /* function exit code */
7467 __pyx_L1_error:;
7468 __Pyx_XDECREF(__pyx_t_2);
7469 __Pyx_XDECREF(__pyx_t_3);
7470 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.readable", __pyx_clineno, __pyx_lineno, __pyx_filename);
7471 __pyx_r = NULL;
7472 __pyx_L0:;
7473 __Pyx_XGIVEREF(__pyx_r);
7474 __Pyx_RefNannyFinishContext();
7475 return __pyx_r;
7476 }
7477
7478 /* "pysam/libcbgzf.pyx":178
7479 * return self.bgzf != NULL and not self.bgzf.is_write
7480 *
7481 * def writable(self): # <<<<<<<<<<<<<<
7482 * return self.bgzf != NULL and self.bgzf.is_write
7483 *
7484 */
7485
7486 /* Python wrapper */
7487 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_23writable(PyObject *__pyx_v_self,
7488 #if CYTHON_METH_FASTCALL
7489 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7490 #else
7491 PyObject *__pyx_args, PyObject *__pyx_kwds
7492 #endif
7493 ); /*proto*/
7494 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_23writable = {"writable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_23writable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
7495 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_23writable(PyObject *__pyx_v_self,
7496 #if CYTHON_METH_FASTCALL
7497 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7498 #else
7499 PyObject *__pyx_args, PyObject *__pyx_kwds
7500 #endif
7501 ) {
7502 #if !CYTHON_METH_FASTCALL
7503 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7504 #endif
7505 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7506 PyObject *__pyx_r = 0;
7507 __Pyx_RefNannyDeclarations
7508 __Pyx_RefNannySetupContext("writable (wrapper)", 0);
7509 #if !CYTHON_METH_FASTCALL
7510 #if CYTHON_ASSUME_SAFE_MACROS
7511 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7512 #else
7513 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7514 #endif
7515 #endif
7516 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7517 if (unlikely(__pyx_nargs > 0)) {
7518 __Pyx_RaiseArgtupleInvalid("writable", 1, 0, 0, __pyx_nargs); return NULL;}
7519 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "writable", 0))) return NULL;
7520 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_22writable(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7521
7522 /* function exit code */
7523 __Pyx_RefNannyFinishContext();
7524 return __pyx_r;
7525 }
7526
7527 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_22writable(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7528 PyObject *__pyx_r = NULL;
7529 __Pyx_RefNannyDeclarations
7530 PyObject *__pyx_t_1 = NULL;
7531 int __pyx_t_2;
7532 PyObject *__pyx_t_3 = NULL;
7533 int __pyx_lineno = 0;
7534 const char *__pyx_filename = NULL;
7535 int __pyx_clineno = 0;
7536 __Pyx_RefNannySetupContext("writable", 1);
7537
7538 /* "pysam/libcbgzf.pyx":179
7539 *
7540 * def writable(self):
7541 * return self.bgzf != NULL and self.bgzf.is_write # <<<<<<<<<<<<<<
7542 *
7543 * def seekable(self):
7544 */
7545 __Pyx_XDECREF(__pyx_r);
7546 __pyx_t_2 = (__pyx_v_self->bgzf != NULL);
7547 if (__pyx_t_2) {
7548 } else {
7549 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
7550 __Pyx_GOTREF(__pyx_t_3);
7551 __pyx_t_1 = __pyx_t_3;
7552 __pyx_t_3 = 0;
7553 goto __pyx_L3_bool_binop_done;
7554 }
7555 __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->bgzf->is_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
7556 __Pyx_GOTREF(__pyx_t_3);
7557 __pyx_t_1 = __pyx_t_3;
7558 __pyx_t_3 = 0;
7559 __pyx_L3_bool_binop_done:;
7560 __pyx_r = __pyx_t_1;
7561 __pyx_t_1 = 0;
7562 goto __pyx_L0;
7563
7564 /* "pysam/libcbgzf.pyx":178
7565 * return self.bgzf != NULL and not self.bgzf.is_write
7566 *
7567 * def writable(self): # <<<<<<<<<<<<<<
7568 * return self.bgzf != NULL and self.bgzf.is_write
7569 *
7570 */
7571
7572 /* function exit code */
7573 __pyx_L1_error:;
7574 __Pyx_XDECREF(__pyx_t_1);
7575 __Pyx_XDECREF(__pyx_t_3);
7576 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.writable", __pyx_clineno, __pyx_lineno, __pyx_filename);
7577 __pyx_r = NULL;
7578 __pyx_L0:;
7579 __Pyx_XGIVEREF(__pyx_r);
7580 __Pyx_RefNannyFinishContext();
7581 return __pyx_r;
7582 }
7583
7584 /* "pysam/libcbgzf.pyx":181
7585 * return self.bgzf != NULL and self.bgzf.is_write
7586 *
7587 * def seekable(self): # <<<<<<<<<<<<<<
7588 * return True
7589 *
7590 */
7591
7592 /* Python wrapper */
7593 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_25seekable(PyObject *__pyx_v_self,
7594 #if CYTHON_METH_FASTCALL
7595 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7596 #else
7597 PyObject *__pyx_args, PyObject *__pyx_kwds
7598 #endif
7599 ); /*proto*/
7600 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_25seekable = {"seekable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_25seekable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
7601 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_25seekable(PyObject *__pyx_v_self,
7602 #if CYTHON_METH_FASTCALL
7603 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7604 #else
7605 PyObject *__pyx_args, PyObject *__pyx_kwds
7606 #endif
7607 ) {
7608 #if !CYTHON_METH_FASTCALL
7609 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7610 #endif
7611 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7612 PyObject *__pyx_r = 0;
7613 __Pyx_RefNannyDeclarations
7614 __Pyx_RefNannySetupContext("seekable (wrapper)", 0);
7615 #if !CYTHON_METH_FASTCALL
7616 #if CYTHON_ASSUME_SAFE_MACROS
7617 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7618 #else
7619 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7620 #endif
7621 #endif
7622 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7623 if (unlikely(__pyx_nargs > 0)) {
7624 __Pyx_RaiseArgtupleInvalid("seekable", 1, 0, 0, __pyx_nargs); return NULL;}
7625 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "seekable", 0))) return NULL;
7626 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_24seekable(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7627
7628 /* function exit code */
7629 __Pyx_RefNannyFinishContext();
7630 return __pyx_r;
7631 }
7632
7633 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_24seekable(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7634 PyObject *__pyx_r = NULL;
7635 __Pyx_RefNannyDeclarations
7636 __Pyx_RefNannySetupContext("seekable", 1);
7637
7638 /* "pysam/libcbgzf.pyx":182
7639 *
7640 * def seekable(self):
7641 * return True # <<<<<<<<<<<<<<
7642 *
7643 * def tell(self):
7644 */
7645 __Pyx_XDECREF(__pyx_r);
7646 __Pyx_INCREF(Py_True);
7647 __pyx_r = Py_True;
7648 goto __pyx_L0;
7649
7650 /* "pysam/libcbgzf.pyx":181
7651 * return self.bgzf != NULL and self.bgzf.is_write
7652 *
7653 * def seekable(self): # <<<<<<<<<<<<<<
7654 * return True
7655 *
7656 */
7657
7658 /* function exit code */
7659 __pyx_L0:;
7660 __Pyx_XGIVEREF(__pyx_r);
7661 __Pyx_RefNannyFinishContext();
7662 return __pyx_r;
7663 }
7664
7665 /* "pysam/libcbgzf.pyx":184
7666 * return True
7667 *
7668 * def tell(self): # <<<<<<<<<<<<<<
7669 * if not self.bgzf:
7670 * raise ValueError("seek() on closed BGZFile object")
7671 */
7672
7673 /* Python wrapper */
7674 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_27tell(PyObject *__pyx_v_self,
7675 #if CYTHON_METH_FASTCALL
7676 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7677 #else
7678 PyObject *__pyx_args, PyObject *__pyx_kwds
7679 #endif
7680 ); /*proto*/
7681 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_27tell = {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_27tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
7682 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_27tell(PyObject *__pyx_v_self,
7683 #if CYTHON_METH_FASTCALL
7684 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7685 #else
7686 PyObject *__pyx_args, PyObject *__pyx_kwds
7687 #endif
7688 ) {
7689 #if !CYTHON_METH_FASTCALL
7690 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7691 #endif
7692 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7693 PyObject *__pyx_r = 0;
7694 __Pyx_RefNannyDeclarations
7695 __Pyx_RefNannySetupContext("tell (wrapper)", 0);
7696 #if !CYTHON_METH_FASTCALL
7697 #if CYTHON_ASSUME_SAFE_MACROS
7698 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7699 #else
7700 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7701 #endif
7702 #endif
7703 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7704 if (unlikely(__pyx_nargs > 0)) {
7705 __Pyx_RaiseArgtupleInvalid("tell", 1, 0, 0, __pyx_nargs); return NULL;}
7706 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "tell", 0))) return NULL;
7707 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_26tell(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
7708
7709 /* function exit code */
7710 __Pyx_RefNannyFinishContext();
7711 return __pyx_r;
7712 }
7713
7714 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_26tell(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
7715 int64_t __pyx_v_off;
7716 PyObject *__pyx_r = NULL;
7717 __Pyx_RefNannyDeclarations
7718 int __pyx_t_1;
7719 PyObject *__pyx_t_2 = NULL;
7720 int __pyx_lineno = 0;
7721 const char *__pyx_filename = NULL;
7722 int __pyx_clineno = 0;
7723 __Pyx_RefNannySetupContext("tell", 1);
7724
7725 /* "pysam/libcbgzf.pyx":185
7726 *
7727 * def tell(self):
7728 * if not self.bgzf: # <<<<<<<<<<<<<<
7729 * raise ValueError("seek() on closed BGZFile object")
7730 * cdef int64_t off = bgzf_tell(self.bgzf)
7731 */
7732 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
7733 if (unlikely(__pyx_t_1)) {
7734
7735 /* "pysam/libcbgzf.pyx":186
7736 * def tell(self):
7737 * if not self.bgzf:
7738 * raise ValueError("seek() on closed BGZFile object") # <<<<<<<<<<<<<<
7739 * cdef int64_t off = bgzf_tell(self.bgzf)
7740 * if off < 0:
7741 */
7742 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
7743 __Pyx_GOTREF(__pyx_t_2);
7744 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7745 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7746 __PYX_ERR(0, 186, __pyx_L1_error)
7747
7748 /* "pysam/libcbgzf.pyx":185
7749 *
7750 * def tell(self):
7751 * if not self.bgzf: # <<<<<<<<<<<<<<
7752 * raise ValueError("seek() on closed BGZFile object")
7753 * cdef int64_t off = bgzf_tell(self.bgzf)
7754 */
7755 }
7756
7757 /* "pysam/libcbgzf.pyx":187
7758 * if not self.bgzf:
7759 * raise ValueError("seek() on closed BGZFile object")
7760 * cdef int64_t off = bgzf_tell(self.bgzf) # <<<<<<<<<<<<<<
7761 * if off < 0:
7762 * raise IOError('Error in tell on BGZFFile object')
7763 */
7764 __pyx_v_off = bgzf_tell(__pyx_v_self->bgzf);
7765
7766 /* "pysam/libcbgzf.pyx":188
7767 * raise ValueError("seek() on closed BGZFile object")
7768 * cdef int64_t off = bgzf_tell(self.bgzf)
7769 * if off < 0: # <<<<<<<<<<<<<<
7770 * raise IOError('Error in tell on BGZFFile object')
7771 *
7772 */
7773 __pyx_t_1 = (__pyx_v_off < 0);
7774 if (unlikely(__pyx_t_1)) {
7775
7776 /* "pysam/libcbgzf.pyx":189
7777 * cdef int64_t off = bgzf_tell(self.bgzf)
7778 * if off < 0:
7779 * raise IOError('Error in tell on BGZFFile object') # <<<<<<<<<<<<<<
7780 *
7781 * return off
7782 */
7783 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
7784 __Pyx_GOTREF(__pyx_t_2);
7785 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7786 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7787 __PYX_ERR(0, 189, __pyx_L1_error)
7788
7789 /* "pysam/libcbgzf.pyx":188
7790 * raise ValueError("seek() on closed BGZFile object")
7791 * cdef int64_t off = bgzf_tell(self.bgzf)
7792 * if off < 0: # <<<<<<<<<<<<<<
7793 * raise IOError('Error in tell on BGZFFile object')
7794 *
7795 */
7796 }
7797
7798 /* "pysam/libcbgzf.pyx":191
7799 * raise IOError('Error in tell on BGZFFile object')
7800 *
7801 * return off # <<<<<<<<<<<<<<
7802 *
7803 * def seek(self, offset, whence=io.SEEK_SET):
7804 */
7805 __Pyx_XDECREF(__pyx_r);
7806 __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_off); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
7807 __Pyx_GOTREF(__pyx_t_2);
7808 __pyx_r = __pyx_t_2;
7809 __pyx_t_2 = 0;
7810 goto __pyx_L0;
7811
7812 /* "pysam/libcbgzf.pyx":184
7813 * return True
7814 *
7815 * def tell(self): # <<<<<<<<<<<<<<
7816 * if not self.bgzf:
7817 * raise ValueError("seek() on closed BGZFile object")
7818 */
7819
7820 /* function exit code */
7821 __pyx_L1_error:;
7822 __Pyx_XDECREF(__pyx_t_2);
7823 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
7824 __pyx_r = NULL;
7825 __pyx_L0:;
7826 __Pyx_XGIVEREF(__pyx_r);
7827 __Pyx_RefNannyFinishContext();
7828 return __pyx_r;
7829 }
7830
7831 /* "pysam/libcbgzf.pyx":193
7832 * return off
7833 *
7834 * def seek(self, offset, whence=io.SEEK_SET): # <<<<<<<<<<<<<<
7835 * if not self.bgzf:
7836 * raise ValueError("seek() on closed BGZFile object")
7837 */
7838
7839 /* Python wrapper */
7840 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_29seek(PyObject *__pyx_v_self,
7841 #if CYTHON_METH_FASTCALL
7842 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7843 #else
7844 PyObject *__pyx_args, PyObject *__pyx_kwds
7845 #endif
7846 ); /*proto*/
7847 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_29seek = {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_29seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
7848 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_29seek(PyObject *__pyx_v_self,
7849 #if CYTHON_METH_FASTCALL
7850 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7851 #else
7852 PyObject *__pyx_args, PyObject *__pyx_kwds
7853 #endif
7854 ) {
7855 PyObject *__pyx_v_offset = 0;
7856 PyObject *__pyx_v_whence = 0;
7857 #if !CYTHON_METH_FASTCALL
7858 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7859 #endif
7860 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7861 PyObject* values[2] = {0,0};
7862 int __pyx_lineno = 0;
7863 const char *__pyx_filename = NULL;
7864 int __pyx_clineno = 0;
7865 PyObject *__pyx_r = 0;
7866 __Pyx_RefNannyDeclarations
7867 __Pyx_RefNannySetupContext("seek (wrapper)", 0);
7868 #if !CYTHON_METH_FASTCALL
7869 #if CYTHON_ASSUME_SAFE_MACROS
7870 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7871 #else
7872 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7873 #endif
7874 #endif
7875 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7876 {
7877 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_whence,0};
7878 values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__18);
7879 if (__pyx_kwds) {
7880 Py_ssize_t kw_args;
7881 switch (__pyx_nargs) {
7882 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
7883 CYTHON_FALLTHROUGH;
7884 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
7885 CYTHON_FALLTHROUGH;
7886 case 0: break;
7887 default: goto __pyx_L5_argtuple_error;
7888 }
7889 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
7890 switch (__pyx_nargs) {
7891 case 0:
7892 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset)) != 0)) {
7893 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
7894 kw_args--;
7895 }
7896 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error)
7897 else goto __pyx_L5_argtuple_error;
7898 CYTHON_FALLTHROUGH;
7899 case 1:
7900 if (kw_args > 0) {
7901 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_whence);
7902 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
7903 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error)
7904 }
7905 }
7906 if (unlikely(kw_args > 0)) {
7907 const Py_ssize_t kwd_pos_args = __pyx_nargs;
7908 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 193, __pyx_L3_error)
7909 }
7910 } else {
7911 switch (__pyx_nargs) {
7912 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
7913 CYTHON_FALLTHROUGH;
7914 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
7915 break;
7916 default: goto __pyx_L5_argtuple_error;
7917 }
7918 }
7919 __pyx_v_offset = values[0];
7920 __pyx_v_whence = values[1];
7921 }
7922 goto __pyx_L6_skip;
7923 __pyx_L5_argtuple_error:;
7924 __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 193, __pyx_L3_error)
7925 __pyx_L6_skip:;
7926 goto __pyx_L4_argument_unpacking_done;
7927 __pyx_L3_error:;
7928 {
7929 Py_ssize_t __pyx_temp;
7930 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
7931 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
7932 }
7933 }
7934 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
7935 __Pyx_RefNannyFinishContext();
7936 return NULL;
7937 __pyx_L4_argument_unpacking_done:;
7938 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_28seek(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_offset, __pyx_v_whence);
7939
7940 /* function exit code */
7941 {
7942 Py_ssize_t __pyx_temp;
7943 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
7944 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
7945 }
7946 }
7947 __Pyx_RefNannyFinishContext();
7948 return __pyx_r;
7949 }
7950
7951 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_28seek(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, PyObject *__pyx_v_offset, PyObject *__pyx_v_whence) {
7952 int64_t __pyx_v_off;
7953 PyObject *__pyx_r = NULL;
7954 __Pyx_RefNannyDeclarations
7955 int __pyx_t_1;
7956 PyObject *__pyx_t_2 = NULL;
7957 PyObject *__pyx_t_3 = NULL;
7958 int64_t __pyx_t_4;
7959 int __pyx_lineno = 0;
7960 const char *__pyx_filename = NULL;
7961 int __pyx_clineno = 0;
7962 __Pyx_RefNannySetupContext("seek", 1);
7963
7964 /* "pysam/libcbgzf.pyx":194
7965 *
7966 * def seek(self, offset, whence=io.SEEK_SET):
7967 * if not self.bgzf: # <<<<<<<<<<<<<<
7968 * raise ValueError("seek() on closed BGZFile object")
7969 * if whence is not io.SEEK_SET:
7970 */
7971 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
7972 if (unlikely(__pyx_t_1)) {
7973
7974 /* "pysam/libcbgzf.pyx":195
7975 * def seek(self, offset, whence=io.SEEK_SET):
7976 * if not self.bgzf:
7977 * raise ValueError("seek() on closed BGZFile object") # <<<<<<<<<<<<<<
7978 * if whence is not io.SEEK_SET:
7979 * raise ValueError('Seek from end not supported')
7980 */
7981 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
7982 __Pyx_GOTREF(__pyx_t_2);
7983 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7984 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7985 __PYX_ERR(0, 195, __pyx_L1_error)
7986
7987 /* "pysam/libcbgzf.pyx":194
7988 *
7989 * def seek(self, offset, whence=io.SEEK_SET):
7990 * if not self.bgzf: # <<<<<<<<<<<<<<
7991 * raise ValueError("seek() on closed BGZFile object")
7992 * if whence is not io.SEEK_SET:
7993 */
7994 }
7995
7996 /* "pysam/libcbgzf.pyx":196
7997 * if not self.bgzf:
7998 * raise ValueError("seek() on closed BGZFile object")
7999 * if whence is not io.SEEK_SET: # <<<<<<<<<<<<<<
8000 * raise ValueError('Seek from end not supported')
8001 *
8002 */
8003 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_io); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
8004 __Pyx_GOTREF(__pyx_t_2);
8005 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
8006 __Pyx_GOTREF(__pyx_t_3);
8007 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8008 __pyx_t_1 = (__pyx_v_whence != __pyx_t_3);
8009 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8010 if (unlikely(__pyx_t_1)) {
8011
8012 /* "pysam/libcbgzf.pyx":197
8013 * raise ValueError("seek() on closed BGZFile object")
8014 * if whence is not io.SEEK_SET:
8015 * raise ValueError('Seek from end not supported') # <<<<<<<<<<<<<<
8016 *
8017 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET)
8018 */
8019 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
8020 __Pyx_GOTREF(__pyx_t_3);
8021 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8022 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8023 __PYX_ERR(0, 197, __pyx_L1_error)
8024
8025 /* "pysam/libcbgzf.pyx":196
8026 * if not self.bgzf:
8027 * raise ValueError("seek() on closed BGZFile object")
8028 * if whence is not io.SEEK_SET: # <<<<<<<<<<<<<<
8029 * raise ValueError('Seek from end not supported')
8030 *
8031 */
8032 }
8033
8034 /* "pysam/libcbgzf.pyx":199
8035 * raise ValueError('Seek from end not supported')
8036 *
8037 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET) # <<<<<<<<<<<<<<
8038 * if off < 0:
8039 * raise IOError('Error seeking BGZFFile object')
8040 */
8041 __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_v_offset); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error)
8042 __pyx_v_off = bgzf_seek(__pyx_v_self->bgzf, __pyx_t_4, SEEK_SET);
8043
8044 /* "pysam/libcbgzf.pyx":200
8045 *
8046 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET)
8047 * if off < 0: # <<<<<<<<<<<<<<
8048 * raise IOError('Error seeking BGZFFile object')
8049 *
8050 */
8051 __pyx_t_1 = (__pyx_v_off < 0);
8052 if (unlikely(__pyx_t_1)) {
8053
8054 /* "pysam/libcbgzf.pyx":201
8055 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET)
8056 * if off < 0:
8057 * raise IOError('Error seeking BGZFFile object') # <<<<<<<<<<<<<<
8058 *
8059 * return off
8060 */
8061 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
8062 __Pyx_GOTREF(__pyx_t_3);
8063 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8064 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8065 __PYX_ERR(0, 201, __pyx_L1_error)
8066
8067 /* "pysam/libcbgzf.pyx":200
8068 *
8069 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET)
8070 * if off < 0: # <<<<<<<<<<<<<<
8071 * raise IOError('Error seeking BGZFFile object')
8072 *
8073 */
8074 }
8075
8076 /* "pysam/libcbgzf.pyx":203
8077 * raise IOError('Error seeking BGZFFile object')
8078 *
8079 * return off # <<<<<<<<<<<<<<
8080 *
8081 * def readline(self, size=-1):
8082 */
8083 __Pyx_XDECREF(__pyx_r);
8084 __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_off); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
8085 __Pyx_GOTREF(__pyx_t_3);
8086 __pyx_r = __pyx_t_3;
8087 __pyx_t_3 = 0;
8088 goto __pyx_L0;
8089
8090 /* "pysam/libcbgzf.pyx":193
8091 * return off
8092 *
8093 * def seek(self, offset, whence=io.SEEK_SET): # <<<<<<<<<<<<<<
8094 * if not self.bgzf:
8095 * raise ValueError("seek() on closed BGZFile object")
8096 */
8097
8098 /* function exit code */
8099 __pyx_L1_error:;
8100 __Pyx_XDECREF(__pyx_t_2);
8101 __Pyx_XDECREF(__pyx_t_3);
8102 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
8103 __pyx_r = NULL;
8104 __pyx_L0:;
8105 __Pyx_XGIVEREF(__pyx_r);
8106 __Pyx_RefNannyFinishContext();
8107 return __pyx_r;
8108 }
8109
8110 /* "pysam/libcbgzf.pyx":205
8111 * return off
8112 *
8113 * def readline(self, size=-1): # <<<<<<<<<<<<<<
8114 * if not self.bgzf:
8115 * raise ValueError("readline() on closed BGZFile object")
8116 */
8117
8118 /* Python wrapper */
8119 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_31readline(PyObject *__pyx_v_self,
8120 #if CYTHON_METH_FASTCALL
8121 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8122 #else
8123 PyObject *__pyx_args, PyObject *__pyx_kwds
8124 #endif
8125 ); /*proto*/
8126 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_31readline = {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_31readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
8127 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_31readline(PyObject *__pyx_v_self,
8128 #if CYTHON_METH_FASTCALL
8129 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8130 #else
8131 PyObject *__pyx_args, PyObject *__pyx_kwds
8132 #endif
8133 ) {
8134 CYTHON_UNUSED PyObject *__pyx_v_size = 0;
8135 #if !CYTHON_METH_FASTCALL
8136 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8137 #endif
8138 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8139 PyObject* values[1] = {0};
8140 int __pyx_lineno = 0;
8141 const char *__pyx_filename = NULL;
8142 int __pyx_clineno = 0;
8143 PyObject *__pyx_r = 0;
8144 __Pyx_RefNannyDeclarations
8145 __Pyx_RefNannySetupContext("readline (wrapper)", 0);
8146 #if !CYTHON_METH_FASTCALL
8147 #if CYTHON_ASSUME_SAFE_MACROS
8148 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8149 #else
8150 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8151 #endif
8152 #endif
8153 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8154 {
8155 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0};
8156 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_neg_1));
8157 if (__pyx_kwds) {
8158 Py_ssize_t kw_args;
8159 switch (__pyx_nargs) {
8160 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8161 CYTHON_FALLTHROUGH;
8162 case 0: break;
8163 default: goto __pyx_L5_argtuple_error;
8164 }
8165 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8166 switch (__pyx_nargs) {
8167 case 0:
8168 if (kw_args > 0) {
8169 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
8170 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
8171 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
8172 }
8173 }
8174 if (unlikely(kw_args > 0)) {
8175 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8176 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readline") < 0)) __PYX_ERR(0, 205, __pyx_L3_error)
8177 }
8178 } else {
8179 switch (__pyx_nargs) {
8180 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8181 CYTHON_FALLTHROUGH;
8182 case 0: break;
8183 default: goto __pyx_L5_argtuple_error;
8184 }
8185 }
8186 __pyx_v_size = values[0];
8187 }
8188 goto __pyx_L6_skip;
8189 __pyx_L5_argtuple_error:;
8190 __Pyx_RaiseArgtupleInvalid("readline", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 205, __pyx_L3_error)
8191 __pyx_L6_skip:;
8192 goto __pyx_L4_argument_unpacking_done;
8193 __pyx_L3_error:;
8194 {
8195 Py_ssize_t __pyx_temp;
8196 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8197 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8198 }
8199 }
8200 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
8201 __Pyx_RefNannyFinishContext();
8202 return NULL;
8203 __pyx_L4_argument_unpacking_done:;
8204 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_30readline(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v_size);
8205
8206 /* function exit code */
8207 {
8208 Py_ssize_t __pyx_temp;
8209 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8210 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8211 }
8212 }
8213 __Pyx_RefNannyFinishContext();
8214 return __pyx_r;
8215 }
8216
8217 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_30readline(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size) {
8218 kstring_t __pyx_v_line;
8219 int __pyx_v_ret;
8220 PyObject *__pyx_v_s = NULL;
8221 PyObject *__pyx_r = NULL;
8222 __Pyx_RefNannyDeclarations
8223 int __pyx_t_1;
8224 PyObject *__pyx_t_2 = NULL;
8225 int __pyx_lineno = 0;
8226 const char *__pyx_filename = NULL;
8227 int __pyx_clineno = 0;
8228 __Pyx_RefNannySetupContext("readline", 1);
8229
8230 /* "pysam/libcbgzf.pyx":206
8231 *
8232 * def readline(self, size=-1):
8233 * if not self.bgzf: # <<<<<<<<<<<<<<
8234 * raise ValueError("readline() on closed BGZFile object")
8235 *
8236 */
8237 __pyx_t_1 = (!(__pyx_v_self->bgzf != 0));
8238 if (unlikely(__pyx_t_1)) {
8239
8240 /* "pysam/libcbgzf.pyx":207
8241 * def readline(self, size=-1):
8242 * if not self.bgzf:
8243 * raise ValueError("readline() on closed BGZFile object") # <<<<<<<<<<<<<<
8244 *
8245 * cdef kstring_t line
8246 */
8247 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
8248 __Pyx_GOTREF(__pyx_t_2);
8249 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8250 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8251 __PYX_ERR(0, 207, __pyx_L1_error)
8252
8253 /* "pysam/libcbgzf.pyx":206
8254 *
8255 * def readline(self, size=-1):
8256 * if not self.bgzf: # <<<<<<<<<<<<<<
8257 * raise ValueError("readline() on closed BGZFile object")
8258 *
8259 */
8260 }
8261
8262 /* "pysam/libcbgzf.pyx":212
8263 * cdef char c
8264 *
8265 * line.l = line.m = 0 # <<<<<<<<<<<<<<
8266 * line.s = NULL
8267 *
8268 */
8269 __pyx_v_line.l = 0;
8270 __pyx_v_line.m = 0;
8271
8272 /* "pysam/libcbgzf.pyx":213
8273 *
8274 * line.l = line.m = 0
8275 * line.s = NULL # <<<<<<<<<<<<<<
8276 *
8277 * cdef int ret = bgzf_getline(self.bgzf, b'\n', &line)
8278 */
8279 __pyx_v_line.s = NULL;
8280
8281 /* "pysam/libcbgzf.pyx":215
8282 * line.s = NULL
8283 *
8284 * cdef int ret = bgzf_getline(self.bgzf, b'\n', &line) # <<<<<<<<<<<<<<
8285 * if ret == -1:
8286 * s = b''
8287 */
8288 __pyx_v_ret = bgzf_getline(__pyx_v_self->bgzf, '\n', (&__pyx_v_line));
8289
8290 /* "pysam/libcbgzf.pyx":216
8291 *
8292 * cdef int ret = bgzf_getline(self.bgzf, b'\n', &line)
8293 * if ret == -1: # <<<<<<<<<<<<<<
8294 * s = b''
8295 * elif ret == -2:
8296 */
8297 switch (__pyx_v_ret) {
8298 case -1L:
8299
8300 /* "pysam/libcbgzf.pyx":217
8301 * cdef int ret = bgzf_getline(self.bgzf, b'\n', &line)
8302 * if ret == -1:
8303 * s = b'' # <<<<<<<<<<<<<<
8304 * elif ret == -2:
8305 * if line.m:
8306 */
8307 __Pyx_INCREF(__pyx_kp_b__7);
8308 __pyx_v_s = __pyx_kp_b__7;
8309
8310 /* "pysam/libcbgzf.pyx":216
8311 *
8312 * cdef int ret = bgzf_getline(self.bgzf, b'\n', &line)
8313 * if ret == -1: # <<<<<<<<<<<<<<
8314 * s = b''
8315 * elif ret == -2:
8316 */
8317 break;
8318 case -2L:
8319
8320 /* "pysam/libcbgzf.pyx":219
8321 * s = b''
8322 * elif ret == -2:
8323 * if line.m: # <<<<<<<<<<<<<<
8324 * free(line.s)
8325 * raise IOError('Error reading line in BGZFFile object')
8326 */
8327 __pyx_t_1 = (__pyx_v_line.m != 0);
8328 if (__pyx_t_1) {
8329
8330 /* "pysam/libcbgzf.pyx":220
8331 * elif ret == -2:
8332 * if line.m:
8333 * free(line.s) # <<<<<<<<<<<<<<
8334 * raise IOError('Error reading line in BGZFFile object')
8335 * else:
8336 */
8337 free(__pyx_v_line.s);
8338
8339 /* "pysam/libcbgzf.pyx":219
8340 * s = b''
8341 * elif ret == -2:
8342 * if line.m: # <<<<<<<<<<<<<<
8343 * free(line.s)
8344 * raise IOError('Error reading line in BGZFFile object')
8345 */
8346 }
8347
8348 /* "pysam/libcbgzf.pyx":221
8349 * if line.m:
8350 * free(line.s)
8351 * raise IOError('Error reading line in BGZFFile object') # <<<<<<<<<<<<<<
8352 * else:
8353 * s = line.s[:line.l]
8354 */
8355 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
8356 __Pyx_GOTREF(__pyx_t_2);
8357 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8358 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8359 __PYX_ERR(0, 221, __pyx_L1_error)
8360
8361 /* "pysam/libcbgzf.pyx":218
8362 * if ret == -1:
8363 * s = b''
8364 * elif ret == -2: # <<<<<<<<<<<<<<
8365 * if line.m:
8366 * free(line.s)
8367 */
8368 break;
8369 default:
8370
8371 /* "pysam/libcbgzf.pyx":223
8372 * raise IOError('Error reading line in BGZFFile object')
8373 * else:
8374 * s = line.s[:line.l] # <<<<<<<<<<<<<<
8375 *
8376 * if line.m:
8377 */
8378 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_line.s + 0, __pyx_v_line.l - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)
8379 __Pyx_GOTREF(__pyx_t_2);
8380 __pyx_v_s = ((PyObject*)__pyx_t_2);
8381 __pyx_t_2 = 0;
8382 break;
8383 }
8384
8385 /* "pysam/libcbgzf.pyx":225
8386 * s = line.s[:line.l]
8387 *
8388 * if line.m: # <<<<<<<<<<<<<<
8389 * free(line.s)
8390 *
8391 */
8392 __pyx_t_1 = (__pyx_v_line.m != 0);
8393 if (__pyx_t_1) {
8394
8395 /* "pysam/libcbgzf.pyx":226
8396 *
8397 * if line.m:
8398 * free(line.s) # <<<<<<<<<<<<<<
8399 *
8400 * return s
8401 */
8402 free(__pyx_v_line.s);
8403
8404 /* "pysam/libcbgzf.pyx":225
8405 * s = line.s[:line.l]
8406 *
8407 * if line.m: # <<<<<<<<<<<<<<
8408 * free(line.s)
8409 *
8410 */
8411 }
8412
8413 /* "pysam/libcbgzf.pyx":228
8414 * free(line.s)
8415 *
8416 * return s # <<<<<<<<<<<<<<
8417 *
8418 * def __iter__(self):
8419 */
8420 __Pyx_XDECREF(__pyx_r);
8421 __Pyx_INCREF(__pyx_v_s);
8422 __pyx_r = __pyx_v_s;
8423 goto __pyx_L0;
8424
8425 /* "pysam/libcbgzf.pyx":205
8426 * return off
8427 *
8428 * def readline(self, size=-1): # <<<<<<<<<<<<<<
8429 * if not self.bgzf:
8430 * raise ValueError("readline() on closed BGZFile object")
8431 */
8432
8433 /* function exit code */
8434 __pyx_L1_error:;
8435 __Pyx_XDECREF(__pyx_t_2);
8436 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
8437 __pyx_r = NULL;
8438 __pyx_L0:;
8439 __Pyx_XDECREF(__pyx_v_s);
8440 __Pyx_XGIVEREF(__pyx_r);
8441 __Pyx_RefNannyFinishContext();
8442 return __pyx_r;
8443 }
8444
8445 /* "pysam/libcbgzf.pyx":230
8446 * return s
8447 *
8448 * def __iter__(self): # <<<<<<<<<<<<<<
8449 * return self
8450 *
8451 */
8452
8453 /* Python wrapper */
8454 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_33__iter__(PyObject *__pyx_v_self); /*proto*/
8455 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_33__iter__(PyObject *__pyx_v_self) {
8456 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8457 PyObject *__pyx_r = 0;
8458 __Pyx_RefNannyDeclarations
8459 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
8460 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
8461 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_32__iter__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
8462
8463 /* function exit code */
8464 __Pyx_RefNannyFinishContext();
8465 return __pyx_r;
8466 }
8467
8468 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_32__iter__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
8469 PyObject *__pyx_r = NULL;
8470 __Pyx_RefNannyDeclarations
8471 __Pyx_RefNannySetupContext("__iter__", 1);
8472
8473 /* "pysam/libcbgzf.pyx":231
8474 *
8475 * def __iter__(self):
8476 * return self # <<<<<<<<<<<<<<
8477 *
8478 * def __next__(self):
8479 */
8480 __Pyx_XDECREF(__pyx_r);
8481 __Pyx_INCREF((PyObject *)__pyx_v_self);
8482 __pyx_r = ((PyObject *)__pyx_v_self);
8483 goto __pyx_L0;
8484
8485 /* "pysam/libcbgzf.pyx":230
8486 * return s
8487 *
8488 * def __iter__(self): # <<<<<<<<<<<<<<
8489 * return self
8490 *
8491 */
8492
8493 /* function exit code */
8494 __pyx_L0:;
8495 __Pyx_XGIVEREF(__pyx_r);
8496 __Pyx_RefNannyFinishContext();
8497 return __pyx_r;
8498 }
8499
8500 /* "pysam/libcbgzf.pyx":233
8501 * return self
8502 *
8503 * def __next__(self): # <<<<<<<<<<<<<<
8504 * line = self.readline()
8505 * if not line:
8506 */
8507
8508 /* Python wrapper */
8509 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__(PyObject *__pyx_v_self); /*proto*/
8510 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__(PyObject *__pyx_v_self) {
8511 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8512 PyObject *__pyx_r = 0;
8513 __Pyx_RefNannyDeclarations
8514 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
8515 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
8516 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_34__next__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
8517
8518 /* function exit code */
8519 __Pyx_RefNannyFinishContext();
8520 return __pyx_r;
8521 }
8522
8523 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_34__next__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
8524 PyObject *__pyx_v_line = NULL;
8525 PyObject *__pyx_r = NULL;
8526 __Pyx_RefNannyDeclarations
8527 int __pyx_error_without_exception = 0; /* StopIteration */
8528 PyObject *__pyx_t_1 = NULL;
8529 PyObject *__pyx_t_2 = NULL;
8530 PyObject *__pyx_t_3 = NULL;
8531 unsigned int __pyx_t_4;
8532 int __pyx_t_5;
8533 int __pyx_t_6;
8534 int __pyx_lineno = 0;
8535 const char *__pyx_filename = NULL;
8536 int __pyx_clineno = 0;
8537 __Pyx_RefNannySetupContext("__next__", 1);
8538
8539 /* "pysam/libcbgzf.pyx":234
8540 *
8541 * def __next__(self):
8542 * line = self.readline() # <<<<<<<<<<<<<<
8543 * if not line:
8544 * raise StopIteration()
8545 */
8546 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_readline); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
8547 __Pyx_GOTREF(__pyx_t_2);
8548 __pyx_t_3 = NULL;
8549 __pyx_t_4 = 0;
8550 #if CYTHON_UNPACK_METHODS
8551 if (likely(PyMethod_Check(__pyx_t_2))) {
8552 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8553 if (likely(__pyx_t_3)) {
8554 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8555 __Pyx_INCREF(__pyx_t_3);
8556 __Pyx_INCREF(function);
8557 __Pyx_DECREF_SET(__pyx_t_2, function);
8558 __pyx_t_4 = 1;
8559 }
8560 }
8561 #endif
8562 {
8563 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
8564 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
8565 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8566 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
8567 __Pyx_GOTREF(__pyx_t_1);
8568 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8569 }
8570 __pyx_v_line = __pyx_t_1;
8571 __pyx_t_1 = 0;
8572
8573 /* "pysam/libcbgzf.pyx":235
8574 * def __next__(self):
8575 * line = self.readline()
8576 * if not line: # <<<<<<<<<<<<<<
8577 * raise StopIteration()
8578 * return line
8579 */
8580 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 235, __pyx_L1_error)
8581 __pyx_t_6 = (!__pyx_t_5);
8582 if (unlikely(__pyx_t_6)) {
8583
8584 /* "pysam/libcbgzf.pyx":236
8585 * line = self.readline()
8586 * if not line:
8587 * raise StopIteration() # <<<<<<<<<<<<<<
8588 * return line
8589 */
8590 __pyx_error_without_exception = 1;
8591 goto __pyx_L1_error;;
8592
8593 /* "pysam/libcbgzf.pyx":235
8594 * def __next__(self):
8595 * line = self.readline()
8596 * if not line: # <<<<<<<<<<<<<<
8597 * raise StopIteration()
8598 * return line
8599 */
8600 }
8601
8602 /* "pysam/libcbgzf.pyx":237
8603 * if not line:
8604 * raise StopIteration()
8605 * return line # <<<<<<<<<<<<<<
8606 */
8607 __Pyx_XDECREF(__pyx_r);
8608 __Pyx_INCREF(__pyx_v_line);
8609 __pyx_r = __pyx_v_line;
8610 goto __pyx_L0;
8611
8612 /* "pysam/libcbgzf.pyx":233
8613 * return self
8614 *
8615 * def __next__(self): # <<<<<<<<<<<<<<
8616 * line = self.readline()
8617 * if not line:
8618 */
8619
8620 /* function exit code */
8621 __pyx_L1_error:;
8622 __Pyx_XDECREF(__pyx_t_1);
8623 __Pyx_XDECREF(__pyx_t_2);
8624 __Pyx_XDECREF(__pyx_t_3);
8625 if (!__pyx_error_without_exception) {
8626 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8627 }
8628 __pyx_r = NULL;
8629 __pyx_L0:;
8630 __Pyx_XDECREF(__pyx_v_line);
8631 __Pyx_XGIVEREF(__pyx_r);
8632 __Pyx_RefNannyFinishContext();
8633 return __pyx_r;
8634 }
8635
8636 /* "pysam/libcbgzf.pxd":7
8637 * cdef class BGZFile(object):
8638 * cdef BGZF *bgzf
8639 * cdef readonly object name, index # <<<<<<<<<<<<<<
8640 */
8641
8642 /* Python wrapper */
8643 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
8644 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_4name_1__get__(PyObject *__pyx_v_self) {
8645 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8646 PyObject *__pyx_r = 0;
8647 __Pyx_RefNannyDeclarations
8648 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8649 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
8650 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_4name___get__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
8651
8652 /* function exit code */
8653 __Pyx_RefNannyFinishContext();
8654 return __pyx_r;
8655 }
8656
8657 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_4name___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
8658 PyObject *__pyx_r = NULL;
8659 __Pyx_RefNannyDeclarations
8660 __Pyx_RefNannySetupContext("__get__", 1);
8661 __Pyx_XDECREF(__pyx_r);
8662 __Pyx_INCREF(__pyx_v_self->name);
8663 __pyx_r = __pyx_v_self->name;
8664 goto __pyx_L0;
8665
8666 /* function exit code */
8667 __pyx_L0:;
8668 __Pyx_XGIVEREF(__pyx_r);
8669 __Pyx_RefNannyFinishContext();
8670 return __pyx_r;
8671 }
8672
8673 /* Python wrapper */
8674 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
8675 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_5index_1__get__(PyObject *__pyx_v_self) {
8676 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8677 PyObject *__pyx_r = 0;
8678 __Pyx_RefNannyDeclarations
8679 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8680 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
8681 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_5index___get__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
8682
8683 /* function exit code */
8684 __Pyx_RefNannyFinishContext();
8685 return __pyx_r;
8686 }
8687
8688 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_5index___get__(struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
8689 PyObject *__pyx_r = NULL;
8690 __Pyx_RefNannyDeclarations
8691 __Pyx_RefNannySetupContext("__get__", 1);
8692 __Pyx_XDECREF(__pyx_r);
8693 __Pyx_INCREF(__pyx_v_self->index);
8694 __pyx_r = __pyx_v_self->index;
8695 goto __pyx_L0;
8696
8697 /* function exit code */
8698 __pyx_L0:;
8699 __Pyx_XGIVEREF(__pyx_r);
8700 __Pyx_RefNannyFinishContext();
8701 return __pyx_r;
8702 }
8703
8704 /* "(tree fragment)":1
8705 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8706 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8707 * def __setstate_cython__(self, __pyx_state):
8708 */
8709
8710 /* Python wrapper */
8711 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__(PyObject *__pyx_v_self,
8712 #if CYTHON_METH_FASTCALL
8713 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8714 #else
8715 PyObject *__pyx_args, PyObject *__pyx_kwds
8716 #endif
8717 ); /*proto*/
8718 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
8719 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__(PyObject *__pyx_v_self,
8720 #if CYTHON_METH_FASTCALL
8721 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8722 #else
8723 PyObject *__pyx_args, PyObject *__pyx_kwds
8724 #endif
8725 ) {
8726 #if !CYTHON_METH_FASTCALL
8727 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8728 #endif
8729 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8730 PyObject *__pyx_r = 0;
8731 __Pyx_RefNannyDeclarations
8732 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8733 #if !CYTHON_METH_FASTCALL
8734 #if CYTHON_ASSUME_SAFE_MACROS
8735 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8736 #else
8737 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8738 #endif
8739 #endif
8740 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8741 if (unlikely(__pyx_nargs > 0)) {
8742 __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
8743 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
8744 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_36__reduce_cython__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self));
8745
8746 /* function exit code */
8747 __Pyx_RefNannyFinishContext();
8748 return __pyx_r;
8749 }
8750
8751 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self) {
8752 PyObject *__pyx_r = NULL;
8753 __Pyx_RefNannyDeclarations
8754 int __pyx_lineno = 0;
8755 const char *__pyx_filename = NULL;
8756 int __pyx_clineno = 0;
8757 __Pyx_RefNannySetupContext("__reduce_cython__", 1);
8758
8759 /* "(tree fragment)":2
8760 * def __reduce_cython__(self):
8761 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<<
8762 * def __setstate_cython__(self, __pyx_state):
8763 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8764 */
8765 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_bgzf_cannot_be_converted_to, 0, 0);
8766 __PYX_ERR(1, 2, __pyx_L1_error)
8767
8768 /* "(tree fragment)":1
8769 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8770 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8771 * def __setstate_cython__(self, __pyx_state):
8772 */
8773
8774 /* function exit code */
8775 __pyx_L1_error:;
8776 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8777 __pyx_r = NULL;
8778 __Pyx_XGIVEREF(__pyx_r);
8779 __Pyx_RefNannyFinishContext();
8780 return __pyx_r;
8781 }
8782
8783 /* "(tree fragment)":3
8784 * def __reduce_cython__(self):
8785 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8786 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8787 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8788 */
8789
8790 /* Python wrapper */
8791 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__(PyObject *__pyx_v_self,
8792 #if CYTHON_METH_FASTCALL
8793 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8794 #else
8795 PyObject *__pyx_args, PyObject *__pyx_kwds
8796 #endif
8797 ); /*proto*/
8798 static PyMethodDef __pyx_mdef_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
8799 static PyObject *__pyx_pw_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__(PyObject *__pyx_v_self,
8800 #if CYTHON_METH_FASTCALL
8801 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8802 #else
8803 PyObject *__pyx_args, PyObject *__pyx_kwds
8804 #endif
8805 ) {
8806 CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
8807 #if !CYTHON_METH_FASTCALL
8808 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8809 #endif
8810 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8811 PyObject* values[1] = {0};
8812 int __pyx_lineno = 0;
8813 const char *__pyx_filename = NULL;
8814 int __pyx_clineno = 0;
8815 PyObject *__pyx_r = 0;
8816 __Pyx_RefNannyDeclarations
8817 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8818 #if !CYTHON_METH_FASTCALL
8819 #if CYTHON_ASSUME_SAFE_MACROS
8820 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8821 #else
8822 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8823 #endif
8824 #endif
8825 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8826 {
8827 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
8828 if (__pyx_kwds) {
8829 Py_ssize_t kw_args;
8830 switch (__pyx_nargs) {
8831 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8832 CYTHON_FALLTHROUGH;
8833 case 0: break;
8834 default: goto __pyx_L5_argtuple_error;
8835 }
8836 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8837 switch (__pyx_nargs) {
8838 case 0:
8839 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
8840 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
8841 kw_args--;
8842 }
8843 else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error)
8844 else goto __pyx_L5_argtuple_error;
8845 }
8846 if (unlikely(kw_args > 0)) {
8847 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8848 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
8849 }
8850 } else if (unlikely(__pyx_nargs != 1)) {
8851 goto __pyx_L5_argtuple_error;
8852 } else {
8853 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8854 }
8855 __pyx_v___pyx_state = values[0];
8856 }
8857 goto __pyx_L6_skip;
8858 __pyx_L5_argtuple_error:;
8859 __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
8860 __pyx_L6_skip:;
8861 goto __pyx_L4_argument_unpacking_done;
8862 __pyx_L3_error:;
8863 {
8864 Py_ssize_t __pyx_temp;
8865 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8866 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8867 }
8868 }
8869 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8870 __Pyx_RefNannyFinishContext();
8871 return NULL;
8872 __pyx_L4_argument_unpacking_done:;
8873 __pyx_r = __pyx_pf_5pysam_8libcbgzf_7BGZFile_38__setstate_cython__(((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)__pyx_v_self), __pyx_v___pyx_state);
8874
8875 /* function exit code */
8876 {
8877 Py_ssize_t __pyx_temp;
8878 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8879 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8880 }
8881 }
8882 __Pyx_RefNannyFinishContext();
8883 return __pyx_r;
8884 }
8885
8886 static PyObject *__pyx_pf_5pysam_8libcbgzf_7BGZFile_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_8libcbgzf_BGZFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8887 PyObject *__pyx_r = NULL;
8888 __Pyx_RefNannyDeclarations
8889 int __pyx_lineno = 0;
8890 const char *__pyx_filename = NULL;
8891 int __pyx_clineno = 0;
8892 __Pyx_RefNannySetupContext("__setstate_cython__", 1);
8893
8894 /* "(tree fragment)":4
8895 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8896 * def __setstate_cython__(self, __pyx_state):
8897 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<<
8898 */
8899 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_bgzf_cannot_be_converted_to, 0, 0);
8900 __PYX_ERR(1, 4, __pyx_L1_error)
8901
8902 /* "(tree fragment)":3
8903 * def __reduce_cython__(self):
8904 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8905 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8906 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
8907 */
8908
8909 /* function exit code */
8910 __pyx_L1_error:;
8911 __Pyx_AddTraceback("pysam.libcbgzf.BGZFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8912 __pyx_r = NULL;
8913 __Pyx_XGIVEREF(__pyx_r);
8914 __Pyx_RefNannyFinishContext();
8915 return __pyx_r;
8916 }
8917
8918 static PyObject *__pyx_tp_new_5pysam_8libcbgzf_BGZFile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8919 struct __pyx_obj_5pysam_8libcbgzf_BGZFile *p;
8920 PyObject *o;
8921 #if CYTHON_COMPILING_IN_LIMITED_API
8922 allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
8923 o = alloc_func(t, 0);
8924 #else
8925 if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
8926 o = (*t->tp_alloc)(t, 0);
8927 } else {
8928 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
8929 }
8930 if (unlikely(!o)) return 0;
8931 #endif
8932 p = ((struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)o);
8933 p->name = Py_None; Py_INCREF(Py_None);
8934 p->index = Py_None; Py_INCREF(Py_None);
8935 return o;
8936 }
8937
8938 static void __pyx_tp_dealloc_5pysam_8libcbgzf_BGZFile(PyObject *o) {
8939 struct __pyx_obj_5pysam_8libcbgzf_BGZFile *p = (struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)o;
8940 #if CYTHON_USE_TP_FINALIZE
8941 if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
8942 if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_8libcbgzf_BGZFile) {
8943 if (PyObject_CallFinalizerFromDealloc(o)) return;
8944 }
8945 }
8946 #endif
8947 PyObject_GC_UnTrack(o);
8948 {
8949 PyObject *etype, *eval, *etb;
8950 PyErr_Fetch(&etype, &eval, &etb);
8951 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
8952 __pyx_pw_5pysam_8libcbgzf_7BGZFile_3__dealloc__(o);
8953 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
8954 PyErr_Restore(etype, eval, etb);
8955 }
8956 Py_CLEAR(p->name);
8957 Py_CLEAR(p->index);
8958 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
8959 (*Py_TYPE(o)->tp_free)(o);
8960 #else
8961 {
8962 freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
8963 if (tp_free) tp_free(o);
8964 }
8965 #endif
8966 }
8967
8968 static int __pyx_tp_traverse_5pysam_8libcbgzf_BGZFile(PyObject *o, visitproc v, void *a) {
8969 int e;
8970 struct __pyx_obj_5pysam_8libcbgzf_BGZFile *p = (struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)o;
8971 if (p->name) {
8972 e = (*v)(p->name, a); if (e) return e;
8973 }
8974 if (p->index) {
8975 e = (*v)(p->index, a); if (e) return e;
8976 }
8977 return 0;
8978 }
8979
8980 static int __pyx_tp_clear_5pysam_8libcbgzf_BGZFile(PyObject *o) {
8981 PyObject* tmp;
8982 struct __pyx_obj_5pysam_8libcbgzf_BGZFile *p = (struct __pyx_obj_5pysam_8libcbgzf_BGZFile *)o;
8983 tmp = ((PyObject*)p->name);
8984 p->name = Py_None; Py_INCREF(Py_None);
8985 Py_XDECREF(tmp);
8986 tmp = ((PyObject*)p->index);
8987 p->index = Py_None; Py_INCREF(Py_None);
8988 Py_XDECREF(tmp);
8989 return 0;
8990 }
8991
8992 static PyObject *__pyx_getprop_5pysam_8libcbgzf_7BGZFile_closed(PyObject *o, CYTHON_UNUSED void *x) {
8993 return __pyx_pw_5pysam_8libcbgzf_7BGZFile_6closed_1__get__(o);
8994 }
8995
8996 static PyObject *__pyx_getprop_5pysam_8libcbgzf_7BGZFile_name(PyObject *o, CYTHON_UNUSED void *x) {
8997 return __pyx_pw_5pysam_8libcbgzf_7BGZFile_4name_1__get__(o);
8998 }
8999
9000 static PyObject *__pyx_getprop_5pysam_8libcbgzf_7BGZFile_index(PyObject *o, CYTHON_UNUSED void *x) {
9001 return __pyx_pw_5pysam_8libcbgzf_7BGZFile_5index_1__get__(o);
9002 }
9003
9004 static PyObject *__pyx_specialmethod___pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
9005 PyObject *res = __pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__(self);
9006 if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
9007 return res;
9008 }
9009
9010 static PyMethodDef __pyx_methods_5pysam_8libcbgzf_BGZFile[] = {
9011 {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_5write, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9012 {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_7read, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9013 {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_9close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9014 {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_11__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9015 {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_13__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9016 {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_15flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9017 {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_17fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_8libcbgzf_7BGZFile_16fileno},
9018 {"rewind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_19rewind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_8libcbgzf_7BGZFile_18rewind},
9019 {"readable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_21readable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9020 {"writable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_23writable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9021 {"seekable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_25seekable, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9022 {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_27tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9023 {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_29seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9024 {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_31readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9025 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__, METH_NOARGS|METH_COEXIST, 0},
9026 {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9027 {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0},
9028 {0, 0, 0, 0}
9029 };
9030
9031 static struct PyGetSetDef __pyx_getsets_5pysam_8libcbgzf_BGZFile[] = {
9032 {(char *)"closed", __pyx_getprop_5pysam_8libcbgzf_7BGZFile_closed, 0, (char *)0, 0},
9033 {(char *)"name", __pyx_getprop_5pysam_8libcbgzf_7BGZFile_name, 0, (char *)0, 0},
9034 {(char *)"index", __pyx_getprop_5pysam_8libcbgzf_7BGZFile_index, 0, (char *)0, 0},
9035 {0, 0, 0, 0, 0}
9036 };
9037 #if CYTHON_USE_TYPE_SPECS
9038 static PyType_Slot __pyx_type_5pysam_8libcbgzf_BGZFile_slots[] = {
9039 {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_8libcbgzf_BGZFile},
9040 {Py_tp_doc, (void *)PyDoc_STR("The BGZFile class simulates most of the methods of a file object with\n the exception of the truncate() method.\n\n This class only supports opening files in binary mode. If you need to open a\n compressed file in text mode, use the gzip.open() function.\n ")},
9041 {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_8libcbgzf_BGZFile},
9042 {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_8libcbgzf_BGZFile},
9043 {Py_tp_iter, (void *)__pyx_pw_5pysam_8libcbgzf_7BGZFile_33__iter__},
9044 {Py_tp_iternext, (void *)__pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__},
9045 {Py_tp_methods, (void *)__pyx_methods_5pysam_8libcbgzf_BGZFile},
9046 {Py_tp_getset, (void *)__pyx_getsets_5pysam_8libcbgzf_BGZFile},
9047 {Py_tp_init, (void *)__pyx_pw_5pysam_8libcbgzf_7BGZFile_1__init__},
9048 {Py_tp_new, (void *)__pyx_tp_new_5pysam_8libcbgzf_BGZFile},
9049 {0, 0},
9050 };
9051 static PyType_Spec __pyx_type_5pysam_8libcbgzf_BGZFile_spec = {
9052 "pysam.libcbgzf.BGZFile",
9053 sizeof(struct __pyx_obj_5pysam_8libcbgzf_BGZFile),
9054 0,
9055 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
9056 __pyx_type_5pysam_8libcbgzf_BGZFile_slots,
9057 };
9058 #else
9059
9060 static PyTypeObject __pyx_type_5pysam_8libcbgzf_BGZFile = {
9061 PyVarObject_HEAD_INIT(0, 0)
9062 "pysam.libcbgzf.""BGZFile", /*tp_name*/
9063 sizeof(struct __pyx_obj_5pysam_8libcbgzf_BGZFile), /*tp_basicsize*/
9064 0, /*tp_itemsize*/
9065 __pyx_tp_dealloc_5pysam_8libcbgzf_BGZFile, /*tp_dealloc*/
9066 #if PY_VERSION_HEX < 0x030800b4
9067 0, /*tp_print*/
9068 #endif
9069 #if PY_VERSION_HEX >= 0x030800b4
9070 0, /*tp_vectorcall_offset*/
9071 #endif
9072 0, /*tp_getattr*/
9073 0, /*tp_setattr*/
9074 #if PY_MAJOR_VERSION < 3
9075 0, /*tp_compare*/
9076 #endif
9077 #if PY_MAJOR_VERSION >= 3
9078 0, /*tp_as_async*/
9079 #endif
9080 0, /*tp_repr*/
9081 0, /*tp_as_number*/
9082 0, /*tp_as_sequence*/
9083 0, /*tp_as_mapping*/
9084 0, /*tp_hash*/
9085 0, /*tp_call*/
9086 0, /*tp_str*/
9087 0, /*tp_getattro*/
9088 0, /*tp_setattro*/
9089 0, /*tp_as_buffer*/
9090 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9091 PyDoc_STR("The BGZFile class simulates most of the methods of a file object with\n the exception of the truncate() method.\n\n This class only supports opening files in binary mode. If you need to open a\n compressed file in text mode, use the gzip.open() function.\n "), /*tp_doc*/
9092 __pyx_tp_traverse_5pysam_8libcbgzf_BGZFile, /*tp_traverse*/
9093 __pyx_tp_clear_5pysam_8libcbgzf_BGZFile, /*tp_clear*/
9094 0, /*tp_richcompare*/
9095 0, /*tp_weaklistoffset*/
9096 __pyx_pw_5pysam_8libcbgzf_7BGZFile_33__iter__, /*tp_iter*/
9097 __pyx_pw_5pysam_8libcbgzf_7BGZFile_35__next__, /*tp_iternext*/
9098 __pyx_methods_5pysam_8libcbgzf_BGZFile, /*tp_methods*/
9099 0, /*tp_members*/
9100 __pyx_getsets_5pysam_8libcbgzf_BGZFile, /*tp_getset*/
9101 0, /*tp_base*/
9102 0, /*tp_dict*/
9103 0, /*tp_descr_get*/
9104 0, /*tp_descr_set*/
9105 #if !CYTHON_USE_TYPE_SPECS
9106 0, /*tp_dictoffset*/
9107 #endif
9108 __pyx_pw_5pysam_8libcbgzf_7BGZFile_1__init__, /*tp_init*/
9109 0, /*tp_alloc*/
9110 __pyx_tp_new_5pysam_8libcbgzf_BGZFile, /*tp_new*/
9111 0, /*tp_free*/
9112 0, /*tp_is_gc*/
9113 0, /*tp_bases*/
9114 0, /*tp_mro*/
9115 0, /*tp_cache*/
9116 0, /*tp_subclasses*/
9117 0, /*tp_weaklist*/
9118 0, /*tp_del*/
9119 0, /*tp_version_tag*/
9120 #if PY_VERSION_HEX >= 0x030400a1
9121 #if CYTHON_USE_TP_FINALIZE
9122 0, /*tp_finalize*/
9123 #else
9124 NULL, /*tp_finalize*/
9125 #endif
9126 #endif
9127 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
9128 0, /*tp_vectorcall*/
9129 #endif
9130 #if __PYX_NEED_TP_PRINT_SLOT == 1
9131 0, /*tp_print*/
9132 #endif
9133 #if PY_VERSION_HEX >= 0x030C0000
9134 0, /*tp_watched*/
9135 #endif
9136 #if PY_VERSION_HEX >= 0x030d00A4
9137 0, /*tp_versions_used*/
9138 #endif
9139 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
9140 0, /*tp_pypy_flags*/
9141 #endif
9142 };
9143 #endif
9144
9145 static PyMethodDef __pyx_methods[] = {
9146 {0, 0, 0, 0}
9147 };
9148 #ifndef CYTHON_SMALL_CODE
9149 #if defined(__clang__)
9150 #define CYTHON_SMALL_CODE
9151 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
9152 #define CYTHON_SMALL_CODE __attribute__((cold))
9153 #else
9154 #define CYTHON_SMALL_CODE
9155 #endif
9156 #endif
9157 /* #### Code section: pystring_table ### */
9158
9159 static int __Pyx_CreateStringTabAndInitStrings(void) {
9160 __Pyx_StringTabEntry __pyx_string_tab[] = {
9161 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
9162 {&__pyx_n_s_BGZFile, __pyx_k_BGZFile, sizeof(__pyx_k_BGZFile), 0, 0, 1, 1},
9163 {&__pyx_n_u_BGZFile, __pyx_k_BGZFile, sizeof(__pyx_k_BGZFile), 0, 1, 0, 1},
9164 {&__pyx_n_s_BGZFile___enter, __pyx_k_BGZFile___enter, sizeof(__pyx_k_BGZFile___enter), 0, 0, 1, 1},
9165 {&__pyx_n_s_BGZFile___exit, __pyx_k_BGZFile___exit, sizeof(__pyx_k_BGZFile___exit), 0, 0, 1, 1},
9166 {&__pyx_n_s_BGZFile___reduce_cython, __pyx_k_BGZFile___reduce_cython, sizeof(__pyx_k_BGZFile___reduce_cython), 0, 0, 1, 1},
9167 {&__pyx_n_s_BGZFile___setstate_cython, __pyx_k_BGZFile___setstate_cython, sizeof(__pyx_k_BGZFile___setstate_cython), 0, 0, 1, 1},
9168 {&__pyx_n_s_BGZFile_close, __pyx_k_BGZFile_close, sizeof(__pyx_k_BGZFile_close), 0, 0, 1, 1},
9169 {&__pyx_n_s_BGZFile_fileno, __pyx_k_BGZFile_fileno, sizeof(__pyx_k_BGZFile_fileno), 0, 0, 1, 1},
9170 {&__pyx_n_s_BGZFile_flush, __pyx_k_BGZFile_flush, sizeof(__pyx_k_BGZFile_flush), 0, 0, 1, 1},
9171 {&__pyx_n_s_BGZFile_read, __pyx_k_BGZFile_read, sizeof(__pyx_k_BGZFile_read), 0, 0, 1, 1},
9172 {&__pyx_n_s_BGZFile_readable, __pyx_k_BGZFile_readable, sizeof(__pyx_k_BGZFile_readable), 0, 0, 1, 1},
9173 {&__pyx_n_s_BGZFile_readline, __pyx_k_BGZFile_readline, sizeof(__pyx_k_BGZFile_readline), 0, 0, 1, 1},
9174 {&__pyx_n_s_BGZFile_rewind, __pyx_k_BGZFile_rewind, sizeof(__pyx_k_BGZFile_rewind), 0, 0, 1, 1},
9175 {&__pyx_n_s_BGZFile_seek, __pyx_k_BGZFile_seek, sizeof(__pyx_k_BGZFile_seek), 0, 0, 1, 1},
9176 {&__pyx_n_s_BGZFile_seekable, __pyx_k_BGZFile_seekable, sizeof(__pyx_k_BGZFile_seekable), 0, 0, 1, 1},
9177 {&__pyx_n_s_BGZFile_tell, __pyx_k_BGZFile_tell, sizeof(__pyx_k_BGZFile_tell), 0, 0, 1, 1},
9178 {&__pyx_n_s_BGZFile_writable, __pyx_k_BGZFile_writable, sizeof(__pyx_k_BGZFile_writable), 0, 0, 1, 1},
9179 {&__pyx_n_s_BGZFile_write, __pyx_k_BGZFile_write, sizeof(__pyx_k_BGZFile_write), 0, 0, 1, 1},
9180 {&__pyx_kp_u_BGZFile_write_failed, __pyx_k_BGZFile_write_failed, sizeof(__pyx_k_BGZFile_write_failed), 0, 1, 0, 0},
9181 {&__pyx_n_s_BUFFER_SIZE, __pyx_k_BUFFER_SIZE, sizeof(__pyx_k_BUFFER_SIZE), 0, 0, 1, 1},
9182 {&__pyx_kp_u_Can_t_rewind_in_write_mode, __pyx_k_Can_t_rewind_in_write_mode, sizeof(__pyx_k_Can_t_rewind_in_write_mode), 0, 1, 0, 0},
9183 {&__pyx_kp_u_Cannot_write_index, __pyx_k_Cannot_write_index, sizeof(__pyx_k_Cannot_write_index), 0, 1, 0, 0},
9184 {&__pyx_n_s_DEFAULT_BUFFER_SIZE, __pyx_k_DEFAULT_BUFFER_SIZE, sizeof(__pyx_k_DEFAULT_BUFFER_SIZE), 0, 0, 1, 1},
9185 {&__pyx_n_s_EBADF, __pyx_k_EBADF, sizeof(__pyx_k_EBADF), 0, 0, 1, 1},
9186 {&__pyx_kp_u_Error_building_bgzf_index, __pyx_k_Error_building_bgzf_index, sizeof(__pyx_k_Error_building_bgzf_index), 0, 1, 0, 0},
9187 {&__pyx_kp_u_Error_closing_BGZFile_object, __pyx_k_Error_closing_BGZFile_object, sizeof(__pyx_k_Error_closing_BGZFile_object), 0, 1, 0, 0},
9188 {&__pyx_kp_u_Error_flushing_BGZFile_object, __pyx_k_Error_flushing_BGZFile_object, sizeof(__pyx_k_Error_flushing_BGZFile_object), 0, 1, 0, 0},
9189 {&__pyx_kp_u_Error_in_tell_on_BGZFFile_object, __pyx_k_Error_in_tell_on_BGZFFile_object, sizeof(__pyx_k_Error_in_tell_on_BGZFFile_object), 0, 1, 0, 0},
9190 {&__pyx_kp_u_Error_reading_from_BGZFile, __pyx_k_Error_reading_from_BGZFile, sizeof(__pyx_k_Error_reading_from_BGZFile), 0, 1, 0, 0},
9191 {&__pyx_kp_u_Error_reading_line_in_BGZFFile_o, __pyx_k_Error_reading_line_in_BGZFFile_o, sizeof(__pyx_k_Error_reading_line_in_BGZFFile_o), 0, 1, 0, 0},
9192 {&__pyx_kp_u_Error_seeking_BGZFFile_object, __pyx_k_Error_seeking_BGZFFile_object, sizeof(__pyx_k_Error_seeking_BGZFFile_object), 0, 1, 0, 0},
9193 {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
9194 {&__pyx_kp_u_Invalid_mode_r, __pyx_k_Invalid_mode_r, sizeof(__pyx_k_Invalid_mode_r), 0, 1, 0, 0},
9195 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
9196 {&__pyx_n_s_SEEK_SET, __pyx_k_SEEK_SET, sizeof(__pyx_k_SEEK_SET), 0, 0, 1, 1},
9197 {&__pyx_kp_u_Seek_from_end_not_supported, __pyx_k_Seek_from_end_not_supported, sizeof(__pyx_k_Seek_from_end_not_supported), 0, 1, 0, 0},
9198 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
9199 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
9200 {&__pyx_n_u_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 1, 0, 1},
9201 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
9202 {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1},
9203 {&__pyx_n_s__48, __pyx_k__48, sizeof(__pyx_k__48), 0, 0, 1, 1},
9204 {&__pyx_kp_b__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 0, 0},
9205 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
9206 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
9207 {&__pyx_n_u_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 1, 0, 1},
9208 {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
9209 {&__pyx_n_s_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 0, 1, 1},
9210 {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1},
9211 {&__pyx_n_s_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 0, 1, 1},
9212 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
9213 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
9214 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
9215 {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
9216 {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
9217 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
9218 {&__pyx_n_s_errno, __pyx_k_errno, sizeof(__pyx_k_errno), 0, 0, 1, 1},
9219 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
9220 {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
9221 {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1},
9222 {&__pyx_n_u_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 1, 0, 1},
9223 {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
9224 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
9225 {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
9226 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
9227 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
9228 {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
9229 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
9230 {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
9231 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
9232 {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
9233 {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
9234 {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
9235 {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
9236 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
9237 {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
9238 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
9239 {&__pyx_n_s_nbytes, __pyx_k_nbytes, sizeof(__pyx_k_nbytes), 0, 0, 1, 1},
9240 {&__pyx_n_s_off, __pyx_k_off, sizeof(__pyx_k_off), 0, 0, 1, 1},
9241 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
9242 {&__pyx_n_s_pysam_libcbgzf, __pyx_k_pysam_libcbgzf, sizeof(__pyx_k_pysam_libcbgzf), 0, 0, 1, 1},
9243 {&__pyx_kp_s_pysam_libcbgzf_pyx, __pyx_k_pysam_libcbgzf_pyx, sizeof(__pyx_k_pysam_libcbgzf_pyx), 0, 0, 1, 0},
9244 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
9245 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
9246 {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
9247 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
9248 {&__pyx_kp_u_read_on_closed_BGZFile_object, __pyx_k_read_on_closed_BGZFile_object, sizeof(__pyx_k_read_on_closed_BGZFile_object), 0, 1, 0, 0},
9249 {&__pyx_kp_u_read_on_write_only_BGZFile_objec, __pyx_k_read_on_write_only_BGZFile_objec, sizeof(__pyx_k_read_on_write_only_BGZFile_objec), 0, 1, 0, 0},
9250 {&__pyx_n_s_read_size, __pyx_k_read_size, sizeof(__pyx_k_read_size), 0, 0, 1, 1},
9251 {&__pyx_n_s_readable, __pyx_k_readable, sizeof(__pyx_k_readable), 0, 0, 1, 1},
9252 {&__pyx_kp_u_readable_on_closed_BGZFile_objec, __pyx_k_readable_on_closed_BGZFile_objec, sizeof(__pyx_k_readable_on_closed_BGZFile_objec), 0, 1, 0, 0},
9253 {&__pyx_n_s_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 0, 0, 1, 1},
9254 {&__pyx_kp_u_readline_on_closed_BGZFile_objec, __pyx_k_readline_on_closed_BGZFile_objec, sizeof(__pyx_k_readline_on_closed_BGZFile_objec), 0, 1, 0, 0},
9255 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
9256 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
9257 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
9258 {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
9259 {&__pyx_n_s_rewind, __pyx_k_rewind, sizeof(__pyx_k_rewind), 0, 0, 1, 1},
9260 {&__pyx_kp_u_rewind_on_closed_BGZFile_object, __pyx_k_rewind_on_closed_BGZFile_object, sizeof(__pyx_k_rewind_on_closed_BGZFile_object), 0, 1, 0, 0},
9261 {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
9262 {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
9263 {&__pyx_kp_u_seek_on_closed_BGZFile_object, __pyx_k_seek_on_closed_BGZFile_object, sizeof(__pyx_k_seek_on_closed_BGZFile_object), 0, 1, 0, 0},
9264 {&__pyx_n_s_seekable, __pyx_k_seekable, sizeof(__pyx_k_seekable), 0, 0, 1, 1},
9265 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
9266 {&__pyx_kp_s_self_bgzf_cannot_be_converted_to, __pyx_k_self_bgzf_cannot_be_converted_to, sizeof(__pyx_k_self_bgzf_cannot_be_converted_to), 0, 0, 1, 0},
9267 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
9268 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
9269 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
9270 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
9271 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
9272 {&__pyx_n_u_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 1, 0, 1},
9273 {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
9274 {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
9275 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
9276 {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
9277 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
9278 {&__pyx_n_s_whence, __pyx_k_whence, sizeof(__pyx_k_whence), 0, 0, 1, 1},
9279 {&__pyx_n_s_writable, __pyx_k_writable, sizeof(__pyx_k_writable), 0, 0, 1, 1},
9280 {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
9281 {&__pyx_kp_u_write_on_closed_BGZFile_object, __pyx_k_write_on_closed_BGZFile_object, sizeof(__pyx_k_write_on_closed_BGZFile_object), 0, 1, 0, 0},
9282 {&__pyx_kp_u_write_on_read_only_BGZFile_objec, __pyx_k_write_on_read_only_BGZFile_objec, sizeof(__pyx_k_write_on_read_only_BGZFile_objec), 0, 1, 0, 0},
9283 {0, 0, 0, 0, 0, 0, 0}
9284 };
9285 return __Pyx_InitStrings(__pyx_string_tab);
9286 }
9287 /* #### Code section: cached_builtins ### */
9288 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
9289 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 47, __pyx_L1_error)
9290 __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 61, __pyx_L1_error)
9291 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 161, __pyx_L1_error)
9292 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 236, __pyx_L1_error)
9293 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
9294 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(3, 120, __pyx_L1_error)
9295 return 0;
9296 __pyx_L1_error:;
9297 return -1;
9298 }
9299 /* #### Code section: cached_constants ### */
9300
9301 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
9302 __Pyx_RefNannyDeclarations
9303 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
9304
9305 /* "pysam/libcbgzf.pyx":61
9306 *
9307 * if self.bgzf.is_write and index is not None and bgzf_index_build_init(self.bgzf) < 0:
9308 * raise IOError('Error building bgzf index') # <<<<<<<<<<<<<<
9309 *
9310 * def __dealloc__(self):
9311 */
9312 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Error_building_bgzf_index); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 61, __pyx_L1_error)
9313 __Pyx_GOTREF(__pyx_tuple_);
9314 __Pyx_GIVEREF(__pyx_tuple_);
9315
9316 /* "pysam/libcbgzf.pyx":68
9317 * def write(self, data):
9318 * if not self.bgzf:
9319 * raise ValueError("write() on closed BGZFile object") # <<<<<<<<<<<<<<
9320 *
9321 * if not self.bgzf.is_write:
9322 */
9323 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_write_on_closed_BGZFile_object); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 68, __pyx_L1_error)
9324 __Pyx_GOTREF(__pyx_tuple__2);
9325 __Pyx_GIVEREF(__pyx_tuple__2);
9326
9327 /* "pysam/libcbgzf.pyx":82
9328 *
9329 * if length > 0 and bgzf_write(self.bgzf, <char *>data, length) < 0:
9330 * raise IOError('BGZFile write failed') # <<<<<<<<<<<<<<
9331 *
9332 * return length
9333 */
9334 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_BGZFile_write_failed); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 82, __pyx_L1_error)
9335 __Pyx_GOTREF(__pyx_tuple__4);
9336 __Pyx_GIVEREF(__pyx_tuple__4);
9337
9338 /* "pysam/libcbgzf.pyx":90
9339 *
9340 * if not self.bgzf:
9341 * raise ValueError("read() on closed BGZFile object") # <<<<<<<<<<<<<<
9342 *
9343 * if self.bgzf.is_write:
9344 */
9345 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_read_on_closed_BGZFile_object); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 90, __pyx_L1_error)
9346 __Pyx_GOTREF(__pyx_tuple__5);
9347 __Pyx_GIVEREF(__pyx_tuple__5);
9348
9349 /* "pysam/libcbgzf.pyx":103
9350 * read_size = bgzf_read(self.bgzf, <char *>chunk, BUFFER_SIZE)
9351 * if read_size < 0:
9352 * raise IOError('Error reading from BGZFile') # <<<<<<<<<<<<<<
9353 * elif not read_size:
9354 * break
9355 */
9356 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Error_reading_from_BGZFile); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 103, __pyx_L1_error)
9357 __Pyx_GOTREF(__pyx_tuple__6);
9358 __Pyx_GIVEREF(__pyx_tuple__6);
9359
9360 /* "pysam/libcbgzf.pyx":131
9361 *
9362 * if self.bgzf.is_write and bgzf_flush(self.bgzf) < 0:
9363 * raise IOError('Error flushing BGZFile object') # <<<<<<<<<<<<<<
9364 *
9365 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0:
9366 */
9367 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Error_flushing_BGZFile_object); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 131, __pyx_L1_error)
9368 __Pyx_GOTREF(__pyx_tuple__8);
9369 __Pyx_GIVEREF(__pyx_tuple__8);
9370
9371 /* "pysam/libcbgzf.pyx":134
9372 *
9373 * if self.index and bgzf_index_dump(self.bgzf, self.index, NULL) < 0:
9374 * raise IOError('Cannot write index') # <<<<<<<<<<<<<<
9375 *
9376 * cdef ret = bgzf_close(self.bgzf)
9377 */
9378 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Cannot_write_index); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 134, __pyx_L1_error)
9379 __Pyx_GOTREF(__pyx_tuple__9);
9380 __Pyx_GIVEREF(__pyx_tuple__9);
9381
9382 /* "pysam/libcbgzf.pyx":140
9383 *
9384 * if ret < 0:
9385 * raise IOError('Error closing BGZFile object') # <<<<<<<<<<<<<<
9386 *
9387 * def __enter__(self):
9388 */
9389 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Error_closing_BGZFile_object); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 140, __pyx_L1_error)
9390 __Pyx_GOTREF(__pyx_tuple__10);
9391 __Pyx_GIVEREF(__pyx_tuple__10);
9392
9393 /* "pysam/libcbgzf.pyx":161
9394 * doesn't support fileno().
9395 * """
9396 * raise AttributeError('fileno') # <<<<<<<<<<<<<<
9397 *
9398 * def rewind(self):
9399 */
9400 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_u_fileno); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 161, __pyx_L1_error)
9401 __Pyx_GOTREF(__pyx_tuple__11);
9402 __Pyx_GIVEREF(__pyx_tuple__11);
9403
9404 /* "pysam/libcbgzf.pyx":167
9405 * beginning of the file'''
9406 * if not self.bgzf:
9407 * raise ValueError("rewind() on closed BGZFile object") # <<<<<<<<<<<<<<
9408 * if not self.bgzf.is_write:
9409 * raise IOError("Can't rewind in write mode")
9410 */
9411 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_rewind_on_closed_BGZFile_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 167, __pyx_L1_error)
9412 __Pyx_GOTREF(__pyx_tuple__12);
9413 __Pyx_GIVEREF(__pyx_tuple__12);
9414
9415 /* "pysam/libcbgzf.pyx":169
9416 * raise ValueError("rewind() on closed BGZFile object")
9417 * if not self.bgzf.is_write:
9418 * raise IOError("Can't rewind in write mode") # <<<<<<<<<<<<<<
9419 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
9420 * raise IOError('Error seeking BGZFFile object')
9421 */
9422 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Can_t_rewind_in_write_mode); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 169, __pyx_L1_error)
9423 __Pyx_GOTREF(__pyx_tuple__13);
9424 __Pyx_GIVEREF(__pyx_tuple__13);
9425
9426 /* "pysam/libcbgzf.pyx":171
9427 * raise IOError("Can't rewind in write mode")
9428 * if bgzf_seek(self.bgzf, 0, SEEK_SET) < 0:
9429 * raise IOError('Error seeking BGZFFile object') # <<<<<<<<<<<<<<
9430 *
9431 * def readable(self):
9432 */
9433 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Error_seeking_BGZFFile_object); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 171, __pyx_L1_error)
9434 __Pyx_GOTREF(__pyx_tuple__14);
9435 __Pyx_GIVEREF(__pyx_tuple__14);
9436
9437 /* "pysam/libcbgzf.pyx":175
9438 * def readable(self):
9439 * if not self.bgzf:
9440 * raise ValueError("readable() on closed BGZFile object") # <<<<<<<<<<<<<<
9441 * return self.bgzf != NULL and not self.bgzf.is_write
9442 *
9443 */
9444 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_readable_on_closed_BGZFile_objec); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 175, __pyx_L1_error)
9445 __Pyx_GOTREF(__pyx_tuple__15);
9446 __Pyx_GIVEREF(__pyx_tuple__15);
9447
9448 /* "pysam/libcbgzf.pyx":186
9449 * def tell(self):
9450 * if not self.bgzf:
9451 * raise ValueError("seek() on closed BGZFile object") # <<<<<<<<<<<<<<
9452 * cdef int64_t off = bgzf_tell(self.bgzf)
9453 * if off < 0:
9454 */
9455 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_seek_on_closed_BGZFile_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 186, __pyx_L1_error)
9456 __Pyx_GOTREF(__pyx_tuple__16);
9457 __Pyx_GIVEREF(__pyx_tuple__16);
9458
9459 /* "pysam/libcbgzf.pyx":189
9460 * cdef int64_t off = bgzf_tell(self.bgzf)
9461 * if off < 0:
9462 * raise IOError('Error in tell on BGZFFile object') # <<<<<<<<<<<<<<
9463 *
9464 * return off
9465 */
9466 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_Error_in_tell_on_BGZFFile_object); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 189, __pyx_L1_error)
9467 __Pyx_GOTREF(__pyx_tuple__17);
9468 __Pyx_GIVEREF(__pyx_tuple__17);
9469
9470 /* "pysam/libcbgzf.pyx":197
9471 * raise ValueError("seek() on closed BGZFile object")
9472 * if whence is not io.SEEK_SET:
9473 * raise ValueError('Seek from end not supported') # <<<<<<<<<<<<<<
9474 *
9475 * cdef int64_t off = bgzf_seek(self.bgzf, offset, SEEK_SET)
9476 */
9477 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_Seek_from_end_not_supported); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 197, __pyx_L1_error)
9478 __Pyx_GOTREF(__pyx_tuple__19);
9479 __Pyx_GIVEREF(__pyx_tuple__19);
9480
9481 /* "pysam/libcbgzf.pyx":207
9482 * def readline(self, size=-1):
9483 * if not self.bgzf:
9484 * raise ValueError("readline() on closed BGZFile object") # <<<<<<<<<<<<<<
9485 *
9486 * cdef kstring_t line
9487 */
9488 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_readline_on_closed_BGZFile_objec); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 207, __pyx_L1_error)
9489 __Pyx_GOTREF(__pyx_tuple__20);
9490 __Pyx_GIVEREF(__pyx_tuple__20);
9491
9492 /* "pysam/libcbgzf.pyx":221
9493 * if line.m:
9494 * free(line.s)
9495 * raise IOError('Error reading line in BGZFFile object') # <<<<<<<<<<<<<<
9496 * else:
9497 * s = line.s[:line.l]
9498 */
9499 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_Error_reading_line_in_BGZFFile_o); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 221, __pyx_L1_error)
9500 __Pyx_GOTREF(__pyx_tuple__21);
9501 __Pyx_GIVEREF(__pyx_tuple__21);
9502
9503 /* "pysam/libcbgzf.pyx":66
9504 * self.close()
9505 *
9506 * def write(self, data): # <<<<<<<<<<<<<<
9507 * if not self.bgzf:
9508 * raise ValueError("write() on closed BGZFile object")
9509 */
9510 __pyx_tuple__22 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_errno, __pyx_n_s_length); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 66, __pyx_L1_error)
9511 __Pyx_GOTREF(__pyx_tuple__22);
9512 __Pyx_GIVEREF(__pyx_tuple__22);
9513 __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_write, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 66, __pyx_L1_error)
9514
9515 /* "pysam/libcbgzf.pyx":86
9516 * return length
9517 *
9518 * def read(self, size=-1): # <<<<<<<<<<<<<<
9519 * cdef ssize_t read_size
9520 *
9521 */
9522 __pyx_tuple__24 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_size, __pyx_n_s_read_size, __pyx_n_s_errno, __pyx_n_s_chunks, __pyx_n_s_chunk, __pyx_n_s_cdata); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 86, __pyx_L1_error)
9523 __Pyx_GOTREF(__pyx_tuple__24);
9524 __Pyx_GIVEREF(__pyx_tuple__24);
9525 __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_read, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 86, __pyx_L1_error)
9526 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 86, __pyx_L1_error)
9527 __Pyx_GOTREF(__pyx_tuple__26);
9528 __Pyx_GIVEREF(__pyx_tuple__26);
9529
9530 /* "pysam/libcbgzf.pyx":126
9531 * return self.bgzf == NULL
9532 *
9533 * def close(self): # <<<<<<<<<<<<<<
9534 * if not self.bgzf:
9535 * return
9536 */
9537 __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 126, __pyx_L1_error)
9538 __Pyx_GOTREF(__pyx_tuple__27);
9539 __Pyx_GIVEREF(__pyx_tuple__27);
9540 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_close, 126, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 126, __pyx_L1_error)
9541
9542 /* "pysam/libcbgzf.pyx":142
9543 * raise IOError('Error closing BGZFile object')
9544 *
9545 * def __enter__(self): # <<<<<<<<<<<<<<
9546 * return self
9547 *
9548 */
9549 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 142, __pyx_L1_error)
9550 __Pyx_GOTREF(__pyx_tuple__29);
9551 __Pyx_GIVEREF(__pyx_tuple__29);
9552 __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_enter, 142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 142, __pyx_L1_error)
9553
9554 /* "pysam/libcbgzf.pyx":145
9555 * return self
9556 *
9557 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
9558 * self.close()
9559 *
9560 */
9561 __pyx_tuple__31 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_value, __pyx_n_s_tb); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 145, __pyx_L1_error)
9562 __Pyx_GOTREF(__pyx_tuple__31);
9563 __Pyx_GIVEREF(__pyx_tuple__31);
9564 __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_exit, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 145, __pyx_L1_error)
9565
9566 /* "pysam/libcbgzf.pyx":148
9567 * self.close()
9568 *
9569 * def flush(self): # <<<<<<<<<<<<<<
9570 * if not self.bgzf:
9571 * return
9572 */
9573 __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_flush, 148, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 148, __pyx_L1_error)
9574
9575 /* "pysam/libcbgzf.pyx":155
9576 * raise IOError('Error flushing BGZFile object')
9577 *
9578 * def fileno(self): # <<<<<<<<<<<<<<
9579 * """Invoke the underlying file object's fileno() method.
9580 *
9581 */
9582 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_fileno, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 155, __pyx_L1_error)
9583
9584 /* "pysam/libcbgzf.pyx":163
9585 * raise AttributeError('fileno')
9586 *
9587 * def rewind(self): # <<<<<<<<<<<<<<
9588 * '''Return the uncompressed stream file position indicator to the
9589 * beginning of the file'''
9590 */
9591 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_rewind, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 163, __pyx_L1_error)
9592
9593 /* "pysam/libcbgzf.pyx":173
9594 * raise IOError('Error seeking BGZFFile object')
9595 *
9596 * def readable(self): # <<<<<<<<<<<<<<
9597 * if not self.bgzf:
9598 * raise ValueError("readable() on closed BGZFile object")
9599 */
9600 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_readable, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 173, __pyx_L1_error)
9601
9602 /* "pysam/libcbgzf.pyx":178
9603 * return self.bgzf != NULL and not self.bgzf.is_write
9604 *
9605 * def writable(self): # <<<<<<<<<<<<<<
9606 * return self.bgzf != NULL and self.bgzf.is_write
9607 *
9608 */
9609 __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_writable, 178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 178, __pyx_L1_error)
9610
9611 /* "pysam/libcbgzf.pyx":181
9612 * return self.bgzf != NULL and self.bgzf.is_write
9613 *
9614 * def seekable(self): # <<<<<<<<<<<<<<
9615 * return True
9616 *
9617 */
9618 __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_seekable, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 181, __pyx_L1_error)
9619
9620 /* "pysam/libcbgzf.pyx":184
9621 * return True
9622 *
9623 * def tell(self): # <<<<<<<<<<<<<<
9624 * if not self.bgzf:
9625 * raise ValueError("seek() on closed BGZFile object")
9626 */
9627 __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_off); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 184, __pyx_L1_error)
9628 __Pyx_GOTREF(__pyx_tuple__39);
9629 __Pyx_GIVEREF(__pyx_tuple__39);
9630 __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_tell, 184, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 184, __pyx_L1_error)
9631
9632 /* "pysam/libcbgzf.pyx":193
9633 * return off
9634 *
9635 * def seek(self, offset, whence=io.SEEK_SET): # <<<<<<<<<<<<<<
9636 * if not self.bgzf:
9637 * raise ValueError("seek() on closed BGZFile object")
9638 */
9639 __pyx_tuple__41 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_offset, __pyx_n_s_whence, __pyx_n_s_off); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 193, __pyx_L1_error)
9640 __Pyx_GOTREF(__pyx_tuple__41);
9641 __Pyx_GIVEREF(__pyx_tuple__41);
9642 __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_seek, 193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 193, __pyx_L1_error)
9643
9644 /* "pysam/libcbgzf.pyx":205
9645 * return off
9646 *
9647 * def readline(self, size=-1): # <<<<<<<<<<<<<<
9648 * if not self.bgzf:
9649 * raise ValueError("readline() on closed BGZFile object")
9650 */
9651 __pyx_tuple__43 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_size, __pyx_n_s_line, __pyx_n_s_c, __pyx_n_s_ret, __pyx_n_s_s); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 205, __pyx_L1_error)
9652 __Pyx_GOTREF(__pyx_tuple__43);
9653 __Pyx_GIVEREF(__pyx_tuple__43);
9654 __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcbgzf_pyx, __pyx_n_s_readline, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 205, __pyx_L1_error)
9655
9656 /* "(tree fragment)":1
9657 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9658 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
9659 * def __setstate_cython__(self, __pyx_state):
9660 */
9661 __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 1, __pyx_L1_error)
9662
9663 /* "(tree fragment)":3
9664 * def __reduce_cython__(self):
9665 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
9666 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9667 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
9668 */
9669 __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 3, __pyx_L1_error)
9670 __Pyx_GOTREF(__pyx_tuple__46);
9671 __Pyx_GIVEREF(__pyx_tuple__46);
9672 __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 3, __pyx_L1_error)
9673 __Pyx_RefNannyFinishContext();
9674 return 0;
9675 __pyx_L1_error:;
9676 __Pyx_RefNannyFinishContext();
9677 return -1;
9678 }
9679 /* #### Code section: init_constants ### */
9680
9681 static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
9682 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
9683 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
9684 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
9685 return 0;
9686 __pyx_L1_error:;
9687 return -1;
9688 }
9689 /* #### Code section: init_globals ### */
9690
9691 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
9692 return 0;
9693 }
9694 /* #### Code section: init_module ### */
9695
9696 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
9697 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
9698 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
9699 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
9700 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
9701 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
9702 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
9703
9704 static int __Pyx_modinit_global_init_code(void) {
9705 __Pyx_RefNannyDeclarations
9706 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
9707 /*--- Global init code ---*/
9708 __Pyx_RefNannyFinishContext();
9709 return 0;
9710 }
9711
9712 static int __Pyx_modinit_variable_export_code(void) {
9713 __Pyx_RefNannyDeclarations
9714 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
9715 /*--- Variable export code ---*/
9716 __Pyx_RefNannyFinishContext();
9717 return 0;
9718 }
9719
9720 static int __Pyx_modinit_function_export_code(void) {
9721 __Pyx_RefNannyDeclarations
9722 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
9723 /*--- Function export code ---*/
9724 __Pyx_RefNannyFinishContext();
9725 return 0;
9726 }
9727
9728 static int __Pyx_modinit_type_init_code(void) {
9729 __Pyx_RefNannyDeclarations
9730 int __pyx_lineno = 0;
9731 const char *__pyx_filename = NULL;
9732 int __pyx_clineno = 0;
9733 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
9734 /*--- Type init code ---*/
9735 #if CYTHON_USE_TYPE_SPECS
9736 __pyx_ptype_5pysam_8libcbgzf_BGZFile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_8libcbgzf_BGZFile_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_8libcbgzf_BGZFile)) __PYX_ERR(0, 30, __pyx_L1_error)
9737 if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_8libcbgzf_BGZFile_spec, __pyx_ptype_5pysam_8libcbgzf_BGZFile) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
9738 #else
9739 __pyx_ptype_5pysam_8libcbgzf_BGZFile = &__pyx_type_5pysam_8libcbgzf_BGZFile;
9740 #endif
9741 #if !CYTHON_COMPILING_IN_LIMITED_API
9742 #endif
9743 #if !CYTHON_USE_TYPE_SPECS
9744 if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_8libcbgzf_BGZFile) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
9745 #endif
9746 #if PY_MAJOR_VERSION < 3
9747 __pyx_ptype_5pysam_8libcbgzf_BGZFile->tp_print = 0;
9748 #endif
9749 #if !CYTHON_COMPILING_IN_LIMITED_API
9750 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_8libcbgzf_BGZFile->tp_dictoffset && __pyx_ptype_5pysam_8libcbgzf_BGZFile->tp_getattro == PyObject_GenericGetAttr)) {
9751 __pyx_ptype_5pysam_8libcbgzf_BGZFile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
9752 }
9753 #endif
9754 #if CYTHON_UPDATE_DESCRIPTOR_DOC
9755 {
9756 PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 30, __pyx_L1_error)
9757 if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
9758 __pyx_wrapperbase_5pysam_8libcbgzf_7BGZFile___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
9759 __pyx_wrapperbase_5pysam_8libcbgzf_7BGZFile___init__.doc = __pyx_doc_5pysam_8libcbgzf_7BGZFile___init__;
9760 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_8libcbgzf_7BGZFile___init__;
9761 }
9762 }
9763 #endif
9764 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BGZFile, (PyObject *) __pyx_ptype_5pysam_8libcbgzf_BGZFile) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
9765 #if !CYTHON_COMPILING_IN_LIMITED_API
9766 if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_8libcbgzf_BGZFile) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
9767 #endif
9768 __Pyx_RefNannyFinishContext();
9769 return 0;
9770 __pyx_L1_error:;
9771 __Pyx_RefNannyFinishContext();
9772 return -1;
9773 }
9774
9775 static int __Pyx_modinit_type_import_code(void) {
9776 __Pyx_RefNannyDeclarations
9777 PyObject *__pyx_t_1 = NULL;
9778 int __pyx_lineno = 0;
9779 const char *__pyx_filename = NULL;
9780 int __pyx_clineno = 0;
9781 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
9782 /*--- Type import code ---*/
9783 __pyx_t_1 = PyImport_ImportModule("pysam.libchtslib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2706, __pyx_L1_error)
9784 __Pyx_GOTREF(__pyx_t_1);
9785 __pyx_ptype_5pysam_10libchtslib_HTSFile = __Pyx_ImportType_3_0_11(__pyx_t_1, "pysam.libchtslib", "HTSFile", sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(struct __pyx_obj_5pysam_10libchtslib_HTSFile),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_5pysam_10libchtslib_HTSFile) __PYX_ERR(4, 2706, __pyx_L1_error)
9786 __pyx_vtabptr_5pysam_10libchtslib_HTSFile = (struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile*)__Pyx_GetVtable(__pyx_ptype_5pysam_10libchtslib_HTSFile); if (unlikely(!__pyx_vtabptr_5pysam_10libchtslib_HTSFile)) __PYX_ERR(4, 2706, __pyx_L1_error)
9787 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9788 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error)
9789 __Pyx_GOTREF(__pyx_t_1);
9790 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
9791 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
9792 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
9793 #elif CYTHON_COMPILING_IN_LIMITED_API
9794 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
9795 #else
9796 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
9797 #endif
9798 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
9799 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9800 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
9801 __Pyx_GOTREF(__pyx_t_1);
9802 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(6, 8, __pyx_L1_error)
9803 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9804 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
9805 __Pyx_GOTREF(__pyx_t_1);
9806 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 15, __pyx_L1_error)
9807 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9808 __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 69, __pyx_L1_error)
9809 __Pyx_GOTREF(__pyx_t_1);
9810 __pyx_ptype_7cpython_5array_array = __Pyx_ImportType_3_0_11(__pyx_t_1, "array", "array", sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(arrayobject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(3, 69, __pyx_L1_error)
9811 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9812 __Pyx_RefNannyFinishContext();
9813 return 0;
9814 __pyx_L1_error:;
9815 __Pyx_XDECREF(__pyx_t_1);
9816 __Pyx_RefNannyFinishContext();
9817 return -1;
9818 }
9819
9820 static int __Pyx_modinit_variable_import_code(void) {
9821 __Pyx_RefNannyDeclarations
9822 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
9823 /*--- Variable import code ---*/
9824 __Pyx_RefNannyFinishContext();
9825 return 0;
9826 }
9827
9828 static int __Pyx_modinit_function_import_code(void) {
9829 __Pyx_RefNannyDeclarations
9830 PyObject *__pyx_t_1 = NULL;
9831 int __pyx_lineno = 0;
9832 const char *__pyx_filename = NULL;
9833 int __pyx_clineno = 0;
9834 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
9835 /*--- Function import code ---*/
9836 __pyx_t_1 = PyImport_ImportModule("pysam.libcutils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
9837 __Pyx_GOTREF(__pyx_t_1);
9838 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "force_bytes", (void (**)(void))&__pyx_f_5pysam_9libcutils_force_bytes, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9839 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "encode_filename", (void (**)(void))&__pyx_f_5pysam_9libcutils_encode_filename, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
9840 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9841 __Pyx_RefNannyFinishContext();
9842 return 0;
9843 __pyx_L1_error:;
9844 __Pyx_XDECREF(__pyx_t_1);
9845 __Pyx_RefNannyFinishContext();
9846 return -1;
9847 }
9848
9849
9850 #if PY_MAJOR_VERSION >= 3
9851 #if CYTHON_PEP489_MULTI_PHASE_INIT
9852 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
9853 static int __pyx_pymod_exec_libcbgzf(PyObject* module); /*proto*/
9854 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
9855 {Py_mod_create, (void*)__pyx_pymod_create},
9856 {Py_mod_exec, (void*)__pyx_pymod_exec_libcbgzf},
9857 {0, NULL}
9858 };
9859 #endif
9860
9861 #ifdef __cplusplus
9862 namespace {
9863 struct PyModuleDef __pyx_moduledef =
9864 #else
9865 static struct PyModuleDef __pyx_moduledef =
9866 #endif
9867 {
9868 PyModuleDef_HEAD_INIT,
9869 "libcbgzf",
9870 __pyx_k_Functions_that_read_and_write_bl, /* m_doc */
9871 #if CYTHON_PEP489_MULTI_PHASE_INIT
9872 0, /* m_size */
9873 #elif CYTHON_USE_MODULE_STATE
9874 sizeof(__pyx_mstate), /* m_size */
9875 #else
9876 -1, /* m_size */
9877 #endif
9878 __pyx_methods /* m_methods */,
9879 #if CYTHON_PEP489_MULTI_PHASE_INIT
9880 __pyx_moduledef_slots, /* m_slots */
9881 #else
9882 NULL, /* m_reload */
9883 #endif
9884 #if CYTHON_USE_MODULE_STATE
9885 __pyx_m_traverse, /* m_traverse */
9886 __pyx_m_clear, /* m_clear */
9887 NULL /* m_free */
9888 #else
9889 NULL, /* m_traverse */
9890 NULL, /* m_clear */
9891 NULL /* m_free */
9892 #endif
9893 };
9894 #ifdef __cplusplus
9895 } /* anonymous namespace */
9896 #endif
9897 #endif
9898
9899 #ifndef CYTHON_NO_PYINIT_EXPORT
9900 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
9901 #elif PY_MAJOR_VERSION < 3
9902 #ifdef __cplusplus
9903 #define __Pyx_PyMODINIT_FUNC extern "C" void
9904 #else
9905 #define __Pyx_PyMODINIT_FUNC void
9906 #endif
9907 #else
9908 #ifdef __cplusplus
9909 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
9910 #else
9911 #define __Pyx_PyMODINIT_FUNC PyObject *
9912 #endif
9913 #endif
9914
9915
9916 #if PY_MAJOR_VERSION < 3
9917 __Pyx_PyMODINIT_FUNC initlibcbgzf(void) CYTHON_SMALL_CODE; /*proto*/
9918 __Pyx_PyMODINIT_FUNC initlibcbgzf(void)
9919 #else
9920 __Pyx_PyMODINIT_FUNC PyInit_libcbgzf(void) CYTHON_SMALL_CODE; /*proto*/
9921 __Pyx_PyMODINIT_FUNC PyInit_libcbgzf(void)
9922 #if CYTHON_PEP489_MULTI_PHASE_INIT
9923 {
9924 return PyModuleDef_Init(&__pyx_moduledef);
9925 }
9926 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
9927 #if PY_VERSION_HEX >= 0x030700A1
9928 static PY_INT64_T main_interpreter_id = -1;
9929 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
9930 if (main_interpreter_id == -1) {
9931 main_interpreter_id = current_id;
9932 return (unlikely(current_id == -1)) ? -1 : 0;
9933 } else if (unlikely(main_interpreter_id != current_id))
9934 #else
9935 static PyInterpreterState *main_interpreter = NULL;
9936 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
9937 if (!main_interpreter) {
9938 main_interpreter = current_interpreter;
9939 } else if (unlikely(main_interpreter != current_interpreter))
9940 #endif
9941 {
9942 PyErr_SetString(
9943 PyExc_ImportError,
9944 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
9945 return -1;
9946 }
9947 return 0;
9948 }
9949 #if CYTHON_COMPILING_IN_LIMITED_API
9950 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)
9951 #else
9952 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)
9953 #endif
9954 {
9955 PyObject *value = PyObject_GetAttrString(spec, from_name);
9956 int result = 0;
9957 if (likely(value)) {
9958 if (allow_none || value != Py_None) {
9959 #if CYTHON_COMPILING_IN_LIMITED_API
9960 result = PyModule_AddObject(module, to_name, value);
9961 #else
9962 result = PyDict_SetItemString(moddict, to_name, value);
9963 #endif
9964 }
9965 Py_DECREF(value);
9966 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
9967 PyErr_Clear();
9968 } else {
9969 result = -1;
9970 }
9971 return result;
9972 }
9973 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
9974 PyObject *module = NULL, *moddict, *modname;
9975 CYTHON_UNUSED_VAR(def);
9976 if (__Pyx_check_single_interpreter())
9977 return NULL;
9978 if (__pyx_m)
9979 return __Pyx_NewRef(__pyx_m);
9980 modname = PyObject_GetAttrString(spec, "name");
9981 if (unlikely(!modname)) goto bad;
9982 module = PyModule_NewObject(modname);
9983 Py_DECREF(modname);
9984 if (unlikely(!module)) goto bad;
9985 #if CYTHON_COMPILING_IN_LIMITED_API
9986 moddict = module;
9987 #else
9988 moddict = PyModule_GetDict(module);
9989 if (unlikely(!moddict)) goto bad;
9990 #endif
9991 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
9992 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
9993 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
9994 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
9995 return module;
9996 bad:
9997 Py_XDECREF(module);
9998 return NULL;
9999 }
10000
10001
10002 static CYTHON_SMALL_CODE int __pyx_pymod_exec_libcbgzf(PyObject *__pyx_pyinit_module)
10003 #endif
10004 #endif
10005 {
10006 int stringtab_initialized = 0;
10007 #if CYTHON_USE_MODULE_STATE
10008 int pystate_addmodule_run = 0;
10009 #endif
10010 PyObject *__pyx_t_1 = NULL;
10011 PyObject *__pyx_t_2 = NULL;
10012 PyObject *__pyx_t_3 = NULL;
10013 int __pyx_lineno = 0;
10014 const char *__pyx_filename = NULL;
10015 int __pyx_clineno = 0;
10016 __Pyx_RefNannyDeclarations
10017 #if CYTHON_PEP489_MULTI_PHASE_INIT
10018 if (__pyx_m) {
10019 if (__pyx_m == __pyx_pyinit_module) return 0;
10020 PyErr_SetString(PyExc_RuntimeError, "Module 'libcbgzf' has already been imported. Re-initialisation is not supported.");
10021 return -1;
10022 }
10023 #elif PY_MAJOR_VERSION >= 3
10024 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
10025 #endif
10026 /*--- Module creation code ---*/
10027 #if CYTHON_PEP489_MULTI_PHASE_INIT
10028 __pyx_m = __pyx_pyinit_module;
10029 Py_INCREF(__pyx_m);
10030 #else
10031 #if PY_MAJOR_VERSION < 3
10032 __pyx_m = Py_InitModule4("libcbgzf", __pyx_methods, __pyx_k_Functions_that_read_and_write_bl, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
10033 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
10034 #elif CYTHON_USE_MODULE_STATE
10035 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
10036 {
10037 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
10038 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "libcbgzf" pseudovariable */
10039 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10040 pystate_addmodule_run = 1;
10041 }
10042 #else
10043 __pyx_m = PyModule_Create(&__pyx_moduledef);
10044 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
10045 #endif
10046 #endif
10047 CYTHON_UNUSED_VAR(__pyx_t_1);
10048 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
10049 Py_INCREF(__pyx_d);
10050 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
10051 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
10052 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10053 #if CYTHON_REFNANNY
10054 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
10055 if (!__Pyx_RefNanny) {
10056 PyErr_Clear();
10057 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
10058 if (!__Pyx_RefNanny)
10059 Py_FatalError("failed to import 'refnanny' module");
10060 }
10061 #endif
10062 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libcbgzf(void)", 0);
10063 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)
10064 #ifdef __Pxy_PyFrame_Initialize_Offsets
10065 __Pxy_PyFrame_Initialize_Offsets();
10066 #endif
10067 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
10068 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
10069 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
10070 #ifdef __Pyx_CyFunction_USED
10071 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10072 #endif
10073 #ifdef __Pyx_FusedFunction_USED
10074 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10075 #endif
10076 #ifdef __Pyx_Coroutine_USED
10077 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10078 #endif
10079 #ifdef __Pyx_Generator_USED
10080 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10081 #endif
10082 #ifdef __Pyx_AsyncGen_USED
10083 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10084 #endif
10085 #ifdef __Pyx_StopAsyncIteration_USED
10086 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10087 #endif
10088 /*--- Library function declarations ---*/
10089 /*--- Threads initialization code ---*/
10090 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
10091 PyEval_InitThreads();
10092 #endif
10093 /*--- Initialize various global constants etc. ---*/
10094 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10095 stringtab_initialized = 1;
10096 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10097 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
10098 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10099 #endif
10100 if (__pyx_module_is_main_pysam__libcbgzf) {
10101 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10102 }
10103 #if PY_MAJOR_VERSION >= 3
10104 {
10105 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
10106 if (!PyDict_GetItemString(modules, "pysam.libcbgzf")) {
10107 if (unlikely((PyDict_SetItemString(modules, "pysam.libcbgzf", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10108 }
10109 }
10110 #endif
10111 /*--- Builtin init code ---*/
10112 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10113 /*--- Constants init code ---*/
10114 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10115 /*--- Global type/function init code ---*/
10116 (void)__Pyx_modinit_global_init_code();
10117 (void)__Pyx_modinit_variable_export_code();
10118 (void)__Pyx_modinit_function_export_code();
10119 if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10120 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10121 (void)__Pyx_modinit_variable_import_code();
10122 if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
10123 /*--- Execution code ---*/
10124 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
10125 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10126 #endif
10127
10128 /* "pysam/libcbgzf.pyx":9
10129 * # based on Python 3.5's gzip module
10130 *
10131 * import io # <<<<<<<<<<<<<<
10132 *
10133 * from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
10134 */
10135 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_io, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
10136 __Pyx_GOTREF(__pyx_t_2);
10137 if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
10138 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10139
10140 /* "pysam/libcbgzf.pyx":24
10141 * bgzf_tell, bgzf_getline, kstring_t, BGZF
10142 *
10143 * __all__ = ["BGZFile"] # <<<<<<<<<<<<<<
10144 *
10145 *
10146 */
10147 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
10148 __Pyx_GOTREF(__pyx_t_2);
10149 __Pyx_INCREF(__pyx_n_u_BGZFile);
10150 __Pyx_GIVEREF(__pyx_n_u_BGZFile);
10151 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_BGZFile)) __PYX_ERR(0, 24, __pyx_L1_error);
10152 if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
10153 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10154
10155 /* "pysam/libcbgzf.pyx":27
10156 *
10157 *
10158 * BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE # <<<<<<<<<<<<<<
10159 *
10160 *
10161 */
10162 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_io); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
10163 __Pyx_GOTREF(__pyx_t_2);
10164 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DEFAULT_BUFFER_SIZE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
10165 __Pyx_GOTREF(__pyx_t_3);
10166 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10167 if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUFFER_SIZE, __pyx_t_3) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
10168 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10169
10170 /* "pysam/libcbgzf.pyx":66
10171 * self.close()
10172 *
10173 * def write(self, data): # <<<<<<<<<<<<<<
10174 * if not self.bgzf:
10175 * raise ValueError("write() on closed BGZFile object")
10176 */
10177 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_5write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_write, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
10178 __Pyx_GOTREF(__pyx_t_3);
10179 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
10180 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10181 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10182
10183 /* "pysam/libcbgzf.pyx":86
10184 * return length
10185 *
10186 * def read(self, size=-1): # <<<<<<<<<<<<<<
10187 * cdef ssize_t read_size
10188 *
10189 */
10190 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_7read, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_read, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
10191 __Pyx_GOTREF(__pyx_t_3);
10192 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__26);
10193 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_read, __pyx_t_3) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
10194 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10195 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10196
10197 /* "pysam/libcbgzf.pyx":126
10198 * return self.bgzf == NULL
10199 *
10200 * def close(self): # <<<<<<<<<<<<<<
10201 * if not self.bgzf:
10202 * return
10203 */
10204 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_9close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_close, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
10205 __Pyx_GOTREF(__pyx_t_3);
10206 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_close, __pyx_t_3) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
10207 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10208 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10209
10210 /* "pysam/libcbgzf.pyx":142
10211 * raise IOError('Error closing BGZFile object')
10212 *
10213 * def __enter__(self): # <<<<<<<<<<<<<<
10214 * return self
10215 *
10216 */
10217 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_11__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile___enter, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
10218 __Pyx_GOTREF(__pyx_t_3);
10219 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_enter, __pyx_t_3) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
10220 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10221 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10222
10223 /* "pysam/libcbgzf.pyx":145
10224 * return self
10225 *
10226 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
10227 * self.close()
10228 *
10229 */
10230 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_13__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile___exit, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
10231 __Pyx_GOTREF(__pyx_t_3);
10232 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_exit, __pyx_t_3) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
10233 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10234 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10235
10236 /* "pysam/libcbgzf.pyx":148
10237 * self.close()
10238 *
10239 * def flush(self): # <<<<<<<<<<<<<<
10240 * if not self.bgzf:
10241 * return
10242 */
10243 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_15flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_flush, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
10244 __Pyx_GOTREF(__pyx_t_3);
10245 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_flush, __pyx_t_3) < 0) __PYX_ERR(0, 148, __pyx_L1_error)
10246 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10247 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10248
10249 /* "pysam/libcbgzf.pyx":155
10250 * raise IOError('Error flushing BGZFile object')
10251 *
10252 * def fileno(self): # <<<<<<<<<<<<<<
10253 * """Invoke the underlying file object's fileno() method.
10254 *
10255 */
10256 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_17fileno, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_fileno, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
10257 __Pyx_GOTREF(__pyx_t_3);
10258 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_fileno, __pyx_t_3) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
10259 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10260 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10261
10262 /* "pysam/libcbgzf.pyx":163
10263 * raise AttributeError('fileno')
10264 *
10265 * def rewind(self): # <<<<<<<<<<<<<<
10266 * '''Return the uncompressed stream file position indicator to the
10267 * beginning of the file'''
10268 */
10269 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_19rewind, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_rewind, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
10270 __Pyx_GOTREF(__pyx_t_3);
10271 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_rewind, __pyx_t_3) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
10272 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10273 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10274
10275 /* "pysam/libcbgzf.pyx":173
10276 * raise IOError('Error seeking BGZFFile object')
10277 *
10278 * def readable(self): # <<<<<<<<<<<<<<
10279 * if not self.bgzf:
10280 * raise ValueError("readable() on closed BGZFile object")
10281 */
10282 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_21readable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_readable, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
10283 __Pyx_GOTREF(__pyx_t_3);
10284 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_readable, __pyx_t_3) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
10285 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10286 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10287
10288 /* "pysam/libcbgzf.pyx":178
10289 * return self.bgzf != NULL and not self.bgzf.is_write
10290 *
10291 * def writable(self): # <<<<<<<<<<<<<<
10292 * return self.bgzf != NULL and self.bgzf.is_write
10293 *
10294 */
10295 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_23writable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_writable, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
10296 __Pyx_GOTREF(__pyx_t_3);
10297 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_writable, __pyx_t_3) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
10298 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10299 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10300
10301 /* "pysam/libcbgzf.pyx":181
10302 * return self.bgzf != NULL and self.bgzf.is_write
10303 *
10304 * def seekable(self): # <<<<<<<<<<<<<<
10305 * return True
10306 *
10307 */
10308 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_25seekable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_seekable, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
10309 __Pyx_GOTREF(__pyx_t_3);
10310 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_seekable, __pyx_t_3) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
10311 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10312 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10313
10314 /* "pysam/libcbgzf.pyx":184
10315 * return True
10316 *
10317 * def tell(self): # <<<<<<<<<<<<<<
10318 * if not self.bgzf:
10319 * raise ValueError("seek() on closed BGZFile object")
10320 */
10321 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_27tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_tell, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
10322 __Pyx_GOTREF(__pyx_t_3);
10323 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_tell, __pyx_t_3) < 0) __PYX_ERR(0, 184, __pyx_L1_error)
10324 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10325 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10326
10327 /* "pysam/libcbgzf.pyx":193
10328 * return off
10329 *
10330 * def seek(self, offset, whence=io.SEEK_SET): # <<<<<<<<<<<<<<
10331 * if not self.bgzf:
10332 * raise ValueError("seek() on closed BGZFile object")
10333 */
10334 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
10335 __Pyx_GOTREF(__pyx_t_3);
10336 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
10337 __Pyx_GOTREF(__pyx_t_2);
10338 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10339 __pyx_k__18 = __pyx_t_2;
10340 __Pyx_GIVEREF(__pyx_t_2);
10341 __pyx_t_2 = 0;
10342 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_io); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
10343 __Pyx_GOTREF(__pyx_t_2);
10344 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
10345 __Pyx_GOTREF(__pyx_t_3);
10346 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10347 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
10348 __Pyx_GOTREF(__pyx_t_2);
10349 __Pyx_GIVEREF(__pyx_t_3);
10350 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error);
10351 __pyx_t_3 = 0;
10352 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_29seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_seek, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
10353 __Pyx_GOTREF(__pyx_t_3);
10354 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
10355 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10356 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_seek, __pyx_t_3) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
10357 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10358 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10359
10360 /* "pysam/libcbgzf.pyx":205
10361 * return off
10362 *
10363 * def readline(self, size=-1): # <<<<<<<<<<<<<<
10364 * if not self.bgzf:
10365 * raise ValueError("readline() on closed BGZFile object")
10366 */
10367 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_31readline, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile_readline, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
10368 __Pyx_GOTREF(__pyx_t_3);
10369 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__26);
10370 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_8libcbgzf_BGZFile, __pyx_n_s_readline, __pyx_t_3) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
10371 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10372 PyType_Modified(__pyx_ptype_5pysam_8libcbgzf_BGZFile);
10373
10374 /* "(tree fragment)":1
10375 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10376 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
10377 * def __setstate_cython__(self, __pyx_state):
10378 */
10379 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_37__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile___reduce_cython, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
10380 __Pyx_GOTREF(__pyx_t_3);
10381 if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
10382 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10383
10384 /* "(tree fragment)":3
10385 * def __reduce_cython__(self):
10386 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
10387 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10388 * raise TypeError, "self.bgzf cannot be converted to a Python object for pickling"
10389 */
10390 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_8libcbgzf_7BGZFile_39__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_BGZFile___setstate_cython, NULL, __pyx_n_s_pysam_libcbgzf, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
10391 __Pyx_GOTREF(__pyx_t_3);
10392 if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
10393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10394
10395 /* "pysam/libcbgzf.pyx":1
10396 * # cython: language_level=3 # <<<<<<<<<<<<<<
10397 * """Functions that read and write block gzipped files.
10398 *
10399 */
10400 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
10401 __Pyx_GOTREF(__pyx_t_3);
10402 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
10403 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10404
10405 /*--- Wrapped vars code ---*/
10406
10407 goto __pyx_L0;
10408 __pyx_L1_error:;
10409 __Pyx_XDECREF(__pyx_t_2);
10410 __Pyx_XDECREF(__pyx_t_3);
10411 if (__pyx_m) {
10412 if (__pyx_d && stringtab_initialized) {
10413 __Pyx_AddTraceback("init pysam.libcbgzf", __pyx_clineno, __pyx_lineno, __pyx_filename);
10414 }
10415 #if !CYTHON_USE_MODULE_STATE
10416 Py_CLEAR(__pyx_m);
10417 #else
10418 Py_DECREF(__pyx_m);
10419 if (pystate_addmodule_run) {
10420 PyObject *tp, *value, *tb;
10421 PyErr_Fetch(&tp, &value, &tb);
10422 PyState_RemoveModule(&__pyx_moduledef);
10423 PyErr_Restore(tp, value, tb);
10424 }
10425 #endif
10426 } else if (!PyErr_Occurred()) {
10427 PyErr_SetString(PyExc_ImportError, "init pysam.libcbgzf");
10428 }
10429 __pyx_L0:;
10430 __Pyx_RefNannyFinishContext();
10431 #if CYTHON_PEP489_MULTI_PHASE_INIT
10432 return (__pyx_m != NULL) ? 0 : -1;
10433 #elif PY_MAJOR_VERSION >= 3
10434 return __pyx_m;
10435 #else
10436 return;
10437 #endif
10438 }
10439 /* #### Code section: cleanup_globals ### */
10440 /* #### Code section: cleanup_module ### */
10441 /* #### Code section: main_method ### */
10442 /* #### Code section: utility_code_pragmas ### */
10443 #ifdef _MSC_VER
10444 #pragma warning( push )
10445 /* Warning 4127: conditional expression is constant
10446 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
10447 * compile-time, so this warning is not useful
10448 */
10449 #pragma warning( disable : 4127 )
10450 #endif
10451
10452
10453
10454 /* #### Code section: utility_code_def ### */
10455
10456 /* --- Runtime support code --- */
10457 /* Refnanny */
10458 #if CYTHON_REFNANNY
10459 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
10460 PyObject *m = NULL, *p = NULL;
10461 void *r = NULL;
10462 m = PyImport_ImportModule(modname);
10463 if (!m) goto end;
10464 p = PyObject_GetAttrString(m, "RefNannyAPI");
10465 if (!p) goto end;
10466 r = PyLong_AsVoidPtr(p);
10467 end:
10468 Py_XDECREF(p);
10469 Py_XDECREF(m);
10470 return (__Pyx_RefNannyAPIStruct *)r;
10471 }
10472 #endif
10473
10474 /* PyErrExceptionMatches */
10475 #if CYTHON_FAST_THREAD_STATE
10476 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10477 Py_ssize_t i, n;
10478 n = PyTuple_GET_SIZE(tuple);
10479 #if PY_MAJOR_VERSION >= 3
10480 for (i=0; i<n; i++) {
10481 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10482 }
10483 #endif
10484 for (i=0; i<n; i++) {
10485 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
10486 }
10487 return 0;
10488 }
10489 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
10490 int result;
10491 PyObject *exc_type;
10492 #if PY_VERSION_HEX >= 0x030C00A6
10493 PyObject *current_exception = tstate->current_exception;
10494 if (unlikely(!current_exception)) return 0;
10495 exc_type = (PyObject*) Py_TYPE(current_exception);
10496 if (exc_type == err) return 1;
10497 #else
10498 exc_type = tstate->curexc_type;
10499 if (exc_type == err) return 1;
10500 if (unlikely(!exc_type)) return 0;
10501 #endif
10502 #if CYTHON_AVOID_BORROWED_REFS
10503 Py_INCREF(exc_type);
10504 #endif
10505 if (unlikely(PyTuple_Check(err))) {
10506 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
10507 } else {
10508 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
10509 }
10510 #if CYTHON_AVOID_BORROWED_REFS
10511 Py_DECREF(exc_type);
10512 #endif
10513 return result;
10514 }
10515 #endif
10516
10517 /* PyErrFetchRestore */
10518 #if CYTHON_FAST_THREAD_STATE
10519 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
10520 #if PY_VERSION_HEX >= 0x030C00A6
10521 PyObject *tmp_value;
10522 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
10523 if (value) {
10524 #if CYTHON_COMPILING_IN_CPYTHON
10525 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
10526 #endif
10527 PyException_SetTraceback(value, tb);
10528 }
10529 tmp_value = tstate->current_exception;
10530 tstate->current_exception = value;
10531 Py_XDECREF(tmp_value);
10532 Py_XDECREF(type);
10533 Py_XDECREF(tb);
10534 #else
10535 PyObject *tmp_type, *tmp_value, *tmp_tb;
10536 tmp_type = tstate->curexc_type;
10537 tmp_value = tstate->curexc_value;
10538 tmp_tb = tstate->curexc_traceback;
10539 tstate->curexc_type = type;
10540 tstate->curexc_value = value;
10541 tstate->curexc_traceback = tb;
10542 Py_XDECREF(tmp_type);
10543 Py_XDECREF(tmp_value);
10544 Py_XDECREF(tmp_tb);
10545 #endif
10546 }
10547 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
10548 #if PY_VERSION_HEX >= 0x030C00A6
10549 PyObject* exc_value;
10550 exc_value = tstate->current_exception;
10551 tstate->current_exception = 0;
10552 *value = exc_value;
10553 *type = NULL;
10554 *tb = NULL;
10555 if (exc_value) {
10556 *type = (PyObject*) Py_TYPE(exc_value);
10557 Py_INCREF(*type);
10558 #if CYTHON_COMPILING_IN_CPYTHON
10559 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
10560 Py_XINCREF(*tb);
10561 #else
10562 *tb = PyException_GetTraceback(exc_value);
10563 #endif
10564 }
10565 #else
10566 *type = tstate->curexc_type;
10567 *value = tstate->curexc_value;
10568 *tb = tstate->curexc_traceback;
10569 tstate->curexc_type = 0;
10570 tstate->curexc_value = 0;
10571 tstate->curexc_traceback = 0;
10572 #endif
10573 }
10574 #endif
10575
10576 /* PyObjectGetAttrStr */
10577 #if CYTHON_USE_TYPE_SLOTS
10578 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
10579 PyTypeObject* tp = Py_TYPE(obj);
10580 if (likely(tp->tp_getattro))
10581 return tp->tp_getattro(obj, attr_name);
10582 #if PY_MAJOR_VERSION < 3
10583 if (likely(tp->tp_getattr))
10584 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
10585 #endif
10586 return PyObject_GetAttr(obj, attr_name);
10587 }
10588 #endif
10589
10590 /* PyObjectGetAttrStrNoError */
10591 #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
10592 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
10593 __Pyx_PyThreadState_declare
10594 __Pyx_PyThreadState_assign
10595 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
10596 __Pyx_PyErr_Clear();
10597 }
10598 #endif
10599 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
10600 PyObject *result;
10601 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
10602 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
10603 return result;
10604 #else
10605 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
10606 PyTypeObject* tp = Py_TYPE(obj);
10607 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
10608 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
10609 }
10610 #endif
10611 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
10612 if (unlikely(!result)) {
10613 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
10614 }
10615 return result;
10616 #endif
10617 }
10618
10619 /* GetBuiltinName */
10620 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
10621 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
10622 if (unlikely(!result) && !PyErr_Occurred()) {
10623 PyErr_Format(PyExc_NameError,
10624 #if PY_MAJOR_VERSION >= 3
10625 "name '%U' is not defined", name);
10626 #else
10627 "name '%.200s' is not defined", PyString_AS_STRING(name));
10628 #endif
10629 }
10630 return result;
10631 }
10632
10633 /* TupleAndListFromArray */
10634 #if CYTHON_COMPILING_IN_CPYTHON
10635 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
10636 PyObject *v;
10637 Py_ssize_t i;
10638 for (i = 0; i < length; i++) {
10639 v = dest[i] = src[i];
10640 Py_INCREF(v);
10641 }
10642 }
10643 static CYTHON_INLINE PyObject *
10644 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
10645 {
10646 PyObject *res;
10647 if (n <= 0) {
10648 Py_INCREF(__pyx_empty_tuple);
10649 return __pyx_empty_tuple;
10650 }
10651 res = PyTuple_New(n);
10652 if (unlikely(res == NULL)) return NULL;
10653 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
10654 return res;
10655 }
10656 static CYTHON_INLINE PyObject *
10657 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
10658 {
10659 PyObject *res;
10660 if (n <= 0) {
10661 return PyList_New(0);
10662 }
10663 res = PyList_New(n);
10664 if (unlikely(res == NULL)) return NULL;
10665 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
10666 return res;
10667 }
10668 #endif
10669
10670 /* BytesEquals */
10671 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10672 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
10673 return PyObject_RichCompareBool(s1, s2, equals);
10674 #else
10675 if (s1 == s2) {
10676 return (equals == Py_EQ);
10677 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10678 const char *ps1, *ps2;
10679 Py_ssize_t length = PyBytes_GET_SIZE(s1);
10680 if (length != PyBytes_GET_SIZE(s2))
10681 return (equals == Py_NE);
10682 ps1 = PyBytes_AS_STRING(s1);
10683 ps2 = PyBytes_AS_STRING(s2);
10684 if (ps1[0] != ps2[0]) {
10685 return (equals == Py_NE);
10686 } else if (length == 1) {
10687 return (equals == Py_EQ);
10688 } else {
10689 int result;
10690 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
10691 Py_hash_t hash1, hash2;
10692 hash1 = ((PyBytesObject*)s1)->ob_shash;
10693 hash2 = ((PyBytesObject*)s2)->ob_shash;
10694 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10695 return (equals == Py_NE);
10696 }
10697 #endif
10698 result = memcmp(ps1, ps2, (size_t)length);
10699 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10700 }
10701 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10702 return (equals == Py_NE);
10703 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10704 return (equals == Py_NE);
10705 } else {
10706 int result;
10707 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10708 if (!py_result)
10709 return -1;
10710 result = __Pyx_PyObject_IsTrue(py_result);
10711 Py_DECREF(py_result);
10712 return result;
10713 }
10714 #endif
10715 }
10716
10717 /* UnicodeEquals */
10718 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
10719 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
10720 return PyObject_RichCompareBool(s1, s2, equals);
10721 #else
10722 #if PY_MAJOR_VERSION < 3
10723 PyObject* owned_ref = NULL;
10724 #endif
10725 int s1_is_unicode, s2_is_unicode;
10726 if (s1 == s2) {
10727 goto return_eq;
10728 }
10729 s1_is_unicode = PyUnicode_CheckExact(s1);
10730 s2_is_unicode = PyUnicode_CheckExact(s2);
10731 #if PY_MAJOR_VERSION < 3
10732 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
10733 owned_ref = PyUnicode_FromObject(s2);
10734 if (unlikely(!owned_ref))
10735 return -1;
10736 s2 = owned_ref;
10737 s2_is_unicode = 1;
10738 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
10739 owned_ref = PyUnicode_FromObject(s1);
10740 if (unlikely(!owned_ref))
10741 return -1;
10742 s1 = owned_ref;
10743 s1_is_unicode = 1;
10744 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
10745 return __Pyx_PyBytes_Equals(s1, s2, equals);
10746 }
10747 #endif
10748 if (s1_is_unicode & s2_is_unicode) {
10749 Py_ssize_t length;
10750 int kind;
10751 void *data1, *data2;
10752 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
10753 return -1;
10754 length = __Pyx_PyUnicode_GET_LENGTH(s1);
10755 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
10756 goto return_ne;
10757 }
10758 #if CYTHON_USE_UNICODE_INTERNALS
10759 {
10760 Py_hash_t hash1, hash2;
10761 #if CYTHON_PEP393_ENABLED
10762 hash1 = ((PyASCIIObject*)s1)->hash;
10763 hash2 = ((PyASCIIObject*)s2)->hash;
10764 #else
10765 hash1 = ((PyUnicodeObject*)s1)->hash;
10766 hash2 = ((PyUnicodeObject*)s2)->hash;
10767 #endif
10768 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10769 goto return_ne;
10770 }
10771 }
10772 #endif
10773 kind = __Pyx_PyUnicode_KIND(s1);
10774 if (kind != __Pyx_PyUnicode_KIND(s2)) {
10775 goto return_ne;
10776 }
10777 data1 = __Pyx_PyUnicode_DATA(s1);
10778 data2 = __Pyx_PyUnicode_DATA(s2);
10779 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
10780 goto return_ne;
10781 } else if (length == 1) {
10782 goto return_eq;
10783 } else {
10784 int result = memcmp(data1, data2, (size_t)(length * kind));
10785 #if PY_MAJOR_VERSION < 3
10786 Py_XDECREF(owned_ref);
10787 #endif
10788 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10789 }
10790 } else if ((s1 == Py_None) & s2_is_unicode) {
10791 goto return_ne;
10792 } else if ((s2 == Py_None) & s1_is_unicode) {
10793 goto return_ne;
10794 } else {
10795 int result;
10796 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10797 #if PY_MAJOR_VERSION < 3
10798 Py_XDECREF(owned_ref);
10799 #endif
10800 if (!py_result)
10801 return -1;
10802 result = __Pyx_PyObject_IsTrue(py_result);
10803 Py_DECREF(py_result);
10804 return result;
10805 }
10806 return_eq:
10807 #if PY_MAJOR_VERSION < 3
10808 Py_XDECREF(owned_ref);
10809 #endif
10810 return (equals == Py_EQ);
10811 return_ne:
10812 #if PY_MAJOR_VERSION < 3
10813 Py_XDECREF(owned_ref);
10814 #endif
10815 return (equals == Py_NE);
10816 #endif
10817 }
10818
10819 /* fastcall */
10820 #if CYTHON_METH_FASTCALL
10821 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
10822 {
10823 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
10824 for (i = 0; i < n; i++)
10825 {
10826 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
10827 }
10828 for (i = 0; i < n; i++)
10829 {
10830 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
10831 if (unlikely(eq != 0)) {
10832 if (unlikely(eq < 0)) return NULL;
10833 return kwvalues[i];
10834 }
10835 }
10836 return NULL;
10837 }
10838 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
10839 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
10840 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
10841 PyObject *dict;
10842 dict = PyDict_New();
10843 if (unlikely(!dict))
10844 return NULL;
10845 for (i=0; i<nkwargs; i++) {
10846 PyObject *key = PyTuple_GET_ITEM(kwnames, i);
10847 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
10848 goto bad;
10849 }
10850 return dict;
10851 bad:
10852 Py_DECREF(dict);
10853 return NULL;
10854 }
10855 #endif
10856 #endif
10857
10858 /* RaiseDoubleKeywords */
10859 static void __Pyx_RaiseDoubleKeywordsError(
10860 const char* func_name,
10861 PyObject* kw_name)
10862 {
10863 PyErr_Format(PyExc_TypeError,
10864 #if PY_MAJOR_VERSION >= 3
10865 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
10866 #else
10867 "%s() got multiple values for keyword argument '%s'", func_name,
10868 PyString_AsString(kw_name));
10869 #endif
10870 }
10871
10872 /* ParseKeywords */
10873 static int __Pyx_ParseOptionalKeywords(
10874 PyObject *kwds,
10875 PyObject *const *kwvalues,
10876 PyObject **argnames[],
10877 PyObject *kwds2,
10878 PyObject *values[],
10879 Py_ssize_t num_pos_args,
10880 const char* function_name)
10881 {
10882 PyObject *key = 0, *value = 0;
10883 Py_ssize_t pos = 0;
10884 PyObject*** name;
10885 PyObject*** first_kw_arg = argnames + num_pos_args;
10886 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
10887 while (1) {
10888 Py_XDECREF(key); key = NULL;
10889 Py_XDECREF(value); value = NULL;
10890 if (kwds_is_tuple) {
10891 Py_ssize_t size;
10892 #if CYTHON_ASSUME_SAFE_MACROS
10893 size = PyTuple_GET_SIZE(kwds);
10894 #else
10895 size = PyTuple_Size(kwds);
10896 if (size < 0) goto bad;
10897 #endif
10898 if (pos >= size) break;
10899 #if CYTHON_AVOID_BORROWED_REFS
10900 key = __Pyx_PySequence_ITEM(kwds, pos);
10901 if (!key) goto bad;
10902 #elif CYTHON_ASSUME_SAFE_MACROS
10903 key = PyTuple_GET_ITEM(kwds, pos);
10904 #else
10905 key = PyTuple_GetItem(kwds, pos);
10906 if (!key) goto bad;
10907 #endif
10908 value = kwvalues[pos];
10909 pos++;
10910 }
10911 else
10912 {
10913 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
10914 #if CYTHON_AVOID_BORROWED_REFS
10915 Py_INCREF(key);
10916 #endif
10917 }
10918 name = first_kw_arg;
10919 while (*name && (**name != key)) name++;
10920 if (*name) {
10921 values[name-argnames] = value;
10922 #if CYTHON_AVOID_BORROWED_REFS
10923 Py_INCREF(value);
10924 Py_DECREF(key);
10925 #endif
10926 key = NULL;
10927 value = NULL;
10928 continue;
10929 }
10930 #if !CYTHON_AVOID_BORROWED_REFS
10931 Py_INCREF(key);
10932 #endif
10933 Py_INCREF(value);
10934 name = first_kw_arg;
10935 #if PY_MAJOR_VERSION < 3
10936 if (likely(PyString_Check(key))) {
10937 while (*name) {
10938 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
10939 && _PyString_Eq(**name, key)) {
10940 values[name-argnames] = value;
10941 #if CYTHON_AVOID_BORROWED_REFS
10942 value = NULL;
10943 #endif
10944 break;
10945 }
10946 name++;
10947 }
10948 if (*name) continue;
10949 else {
10950 PyObject*** argname = argnames;
10951 while (argname != first_kw_arg) {
10952 if ((**argname == key) || (
10953 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
10954 && _PyString_Eq(**argname, key))) {
10955 goto arg_passed_twice;
10956 }
10957 argname++;
10958 }
10959 }
10960 } else
10961 #endif
10962 if (likely(PyUnicode_Check(key))) {
10963 while (*name) {
10964 int cmp = (
10965 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10966 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10967 #endif
10968 PyUnicode_Compare(**name, key)
10969 );
10970 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10971 if (cmp == 0) {
10972 values[name-argnames] = value;
10973 #if CYTHON_AVOID_BORROWED_REFS
10974 value = NULL;
10975 #endif
10976 break;
10977 }
10978 name++;
10979 }
10980 if (*name) continue;
10981 else {
10982 PyObject*** argname = argnames;
10983 while (argname != first_kw_arg) {
10984 int cmp = (**argname == key) ? 0 :
10985 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
10986 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
10987 #endif
10988 PyUnicode_Compare(**argname, key);
10989 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
10990 if (cmp == 0) goto arg_passed_twice;
10991 argname++;
10992 }
10993 }
10994 } else
10995 goto invalid_keyword_type;
10996 if (kwds2) {
10997 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10998 } else {
10999 goto invalid_keyword;
11000 }
11001 }
11002 Py_XDECREF(key);
11003 Py_XDECREF(value);
11004 return 0;
11005 arg_passed_twice:
11006 __Pyx_RaiseDoubleKeywordsError(function_name, key);
11007 goto bad;
11008 invalid_keyword_type:
11009 PyErr_Format(PyExc_TypeError,
11010 "%.200s() keywords must be strings", function_name);
11011 goto bad;
11012 invalid_keyword:
11013 #if PY_MAJOR_VERSION < 3
11014 PyErr_Format(PyExc_TypeError,
11015 "%.200s() got an unexpected keyword argument '%.200s'",
11016 function_name, PyString_AsString(key));
11017 #else
11018 PyErr_Format(PyExc_TypeError,
11019 "%s() got an unexpected keyword argument '%U'",
11020 function_name, key);
11021 #endif
11022 bad:
11023 Py_XDECREF(key);
11024 Py_XDECREF(value);
11025 return -1;
11026 }
11027
11028 /* RaiseArgTupleInvalid */
11029 static void __Pyx_RaiseArgtupleInvalid(
11030 const char* func_name,
11031 int exact,
11032 Py_ssize_t num_min,
11033 Py_ssize_t num_max,
11034 Py_ssize_t num_found)
11035 {
11036 Py_ssize_t num_expected;
11037 const char *more_or_less;
11038 if (num_found < num_min) {
11039 num_expected = num_min;
11040 more_or_less = "at least";
11041 } else {
11042 num_expected = num_max;
11043 more_or_less = "at most";
11044 }
11045 if (exact) {
11046 more_or_less = "exactly";
11047 }
11048 PyErr_Format(PyExc_TypeError,
11049 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
11050 func_name, more_or_less, num_expected,
11051 (num_expected == 1) ? "" : "s", num_found);
11052 }
11053
11054 /* PyFunctionFastCall */
11055 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
11056 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
11057 PyObject *globals) {
11058 PyFrameObject *f;
11059 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11060 PyObject **fastlocals;
11061 Py_ssize_t i;
11062 PyObject *result;
11063 assert(globals != NULL);
11064 /* XXX Perhaps we should create a specialized
11065 PyFrame_New() that doesn't take locals, but does
11066 take builtins without sanity checking them.
11067 */
11068 assert(tstate != NULL);
11069 f = PyFrame_New(tstate, co, globals, NULL);
11070 if (f == NULL) {
11071 return NULL;
11072 }
11073 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
11074 for (i = 0; i < na; i++) {
11075 Py_INCREF(*args);
11076 fastlocals[i] = *args++;
11077 }
11078 result = PyEval_EvalFrameEx(f,0);
11079 ++tstate->recursion_depth;
11080 Py_DECREF(f);
11081 --tstate->recursion_depth;
11082 return result;
11083 }
11084 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
11085 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
11086 PyObject *globals = PyFunction_GET_GLOBALS(func);
11087 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
11088 PyObject *closure;
11089 #if PY_MAJOR_VERSION >= 3
11090 PyObject *kwdefs;
11091 #endif
11092 PyObject *kwtuple, **k;
11093 PyObject **d;
11094 Py_ssize_t nd;
11095 Py_ssize_t nk;
11096 PyObject *result;
11097 assert(kwargs == NULL || PyDict_Check(kwargs));
11098 nk = kwargs ? PyDict_Size(kwargs) : 0;
11099 #if PY_MAJOR_VERSION < 3
11100 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
11101 return NULL;
11102 }
11103 #else
11104 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
11105 return NULL;
11106 }
11107 #endif
11108 if (
11109 #if PY_MAJOR_VERSION >= 3
11110 co->co_kwonlyargcount == 0 &&
11111 #endif
11112 likely(kwargs == NULL || nk == 0) &&
11113 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
11114 if (argdefs == NULL && co->co_argcount == nargs) {
11115 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
11116 goto done;
11117 }
11118 else if (nargs == 0 && argdefs != NULL
11119 && co->co_argcount == Py_SIZE(argdefs)) {
11120 /* function called with no arguments, but all parameters have
11121 a default value: use default values as arguments .*/
11122 args = &PyTuple_GET_ITEM(argdefs, 0);
11123 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
11124 goto done;
11125 }
11126 }
11127 if (kwargs != NULL) {
11128 Py_ssize_t pos, i;
11129 kwtuple = PyTuple_New(2 * nk);
11130 if (kwtuple == NULL) {
11131 result = NULL;
11132 goto done;
11133 }
11134 k = &PyTuple_GET_ITEM(kwtuple, 0);
11135 pos = i = 0;
11136 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
11137 Py_INCREF(k[i]);
11138 Py_INCREF(k[i+1]);
11139 i += 2;
11140 }
11141 nk = i / 2;
11142 }
11143 else {
11144 kwtuple = NULL;
11145 k = NULL;
11146 }
11147 closure = PyFunction_GET_CLOSURE(func);
11148 #if PY_MAJOR_VERSION >= 3
11149 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
11150 #endif
11151 if (argdefs != NULL) {
11152 d = &PyTuple_GET_ITEM(argdefs, 0);
11153 nd = Py_SIZE(argdefs);
11154 }
11155 else {
11156 d = NULL;
11157 nd = 0;
11158 }
11159 #if PY_MAJOR_VERSION >= 3
11160 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
11161 args, (int)nargs,
11162 k, (int)nk,
11163 d, (int)nd, kwdefs, closure);
11164 #else
11165 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
11166 args, (int)nargs,
11167 k, (int)nk,
11168 d, (int)nd, closure);
11169 #endif
11170 Py_XDECREF(kwtuple);
11171 done:
11172 Py_LeaveRecursiveCall();
11173 return result;
11174 }
11175 #endif
11176
11177 /* PyObjectCall */
11178 #if CYTHON_COMPILING_IN_CPYTHON
11179 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
11180 PyObject *result;
11181 ternaryfunc call = Py_TYPE(func)->tp_call;
11182 if (unlikely(!call))
11183 return PyObject_Call(func, arg, kw);
11184 #if PY_MAJOR_VERSION < 3
11185 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11186 return NULL;
11187 #else
11188 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
11189 return NULL;
11190 #endif
11191 result = (*call)(func, arg, kw);
11192 Py_LeaveRecursiveCall();
11193 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11194 PyErr_SetString(
11195 PyExc_SystemError,
11196 "NULL result without error in PyObject_Call");
11197 }
11198 return result;
11199 }
11200 #endif
11201
11202 /* PyObjectCallMethO */
11203 #if CYTHON_COMPILING_IN_CPYTHON
11204 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
11205 PyObject *self, *result;
11206 PyCFunction cfunc;
11207 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
11208 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
11209 #if PY_MAJOR_VERSION < 3
11210 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
11211 return NULL;
11212 #else
11213 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
11214 return NULL;
11215 #endif
11216 result = cfunc(self, arg);
11217 Py_LeaveRecursiveCall();
11218 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
11219 PyErr_SetString(
11220 PyExc_SystemError,
11221 "NULL result without error in PyObject_Call");
11222 }
11223 return result;
11224 }
11225 #endif
11226
11227 /* PyObjectFastCall */
11228 #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
11229 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
11230 PyObject *argstuple;
11231 PyObject *result = 0;
11232 size_t i;
11233 argstuple = PyTuple_New((Py_ssize_t)nargs);
11234 if (unlikely(!argstuple)) return NULL;
11235 for (i = 0; i < nargs; i++) {
11236 Py_INCREF(args[i]);
11237 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
11238 }
11239 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
11240 bad:
11241 Py_DECREF(argstuple);
11242 return result;
11243 }
11244 #endif
11245 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
11246 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
11247 #if CYTHON_COMPILING_IN_CPYTHON
11248 if (nargs == 0 && kwargs == NULL) {
11249 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
11250 return __Pyx_PyObject_CallMethO(func, NULL);
11251 }
11252 else if (nargs == 1 && kwargs == NULL) {
11253 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
11254 return __Pyx_PyObject_CallMethO(func, args[0]);
11255 }
11256 #endif
11257 #if PY_VERSION_HEX < 0x030800B1
11258 #if CYTHON_FAST_PYCCALL
11259 if (PyCFunction_Check(func)) {
11260 if (kwargs) {
11261 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
11262 } else {
11263 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
11264 }
11265 }
11266 #if PY_VERSION_HEX >= 0x030700A1
11267 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
11268 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
11269 }
11270 #endif
11271 #endif
11272 #if CYTHON_FAST_PYCALL
11273 if (PyFunction_Check(func)) {
11274 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
11275 }
11276 #endif
11277 #endif
11278 if (kwargs == NULL) {
11279 #if CYTHON_VECTORCALL
11280 #if PY_VERSION_HEX < 0x03090000
11281 vectorcallfunc f = _PyVectorcall_Function(func);
11282 #else
11283 vectorcallfunc f = PyVectorcall_Function(func);
11284 #endif
11285 if (f) {
11286 return f(func, args, (size_t)nargs, NULL);
11287 }
11288 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
11289 if (__Pyx_CyFunction_CheckExact(func)) {
11290 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
11291 if (f) return f(func, args, (size_t)nargs, NULL);
11292 }
11293 #endif
11294 }
11295 if (nargs == 0) {
11296 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
11297 }
11298 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
11299 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
11300 #else
11301 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
11302 #endif
11303 }
11304
11305 /* PyObjectCallOneArg */
11306 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
11307 PyObject *args[2] = {NULL, arg};
11308 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
11309 }
11310
11311 /* RaiseException */
11312 #if PY_MAJOR_VERSION < 3
11313 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11314 __Pyx_PyThreadState_declare
11315 CYTHON_UNUSED_VAR(cause);
11316 Py_XINCREF(type);
11317 if (!value || value == Py_None)
11318 value = NULL;
11319 else
11320 Py_INCREF(value);
11321 if (!tb || tb == Py_None)
11322 tb = NULL;
11323 else {
11324 Py_INCREF(tb);
11325 if (!PyTraceBack_Check(tb)) {
11326 PyErr_SetString(PyExc_TypeError,
11327 "raise: arg 3 must be a traceback or None");
11328 goto raise_error;
11329 }
11330 }
11331 if (PyType_Check(type)) {
11332 #if CYTHON_COMPILING_IN_PYPY
11333 if (!value) {
11334 Py_INCREF(Py_None);
11335 value = Py_None;
11336 }
11337 #endif
11338 PyErr_NormalizeException(&type, &value, &tb);
11339 } else {
11340 if (value) {
11341 PyErr_SetString(PyExc_TypeError,
11342 "instance exception may not have a separate value");
11343 goto raise_error;
11344 }
11345 value = type;
11346 type = (PyObject*) Py_TYPE(type);
11347 Py_INCREF(type);
11348 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
11349 PyErr_SetString(PyExc_TypeError,
11350 "raise: exception class must be a subclass of BaseException");
11351 goto raise_error;
11352 }
11353 }
11354 __Pyx_PyThreadState_assign
11355 __Pyx_ErrRestore(type, value, tb);
11356 return;
11357 raise_error:
11358 Py_XDECREF(value);
11359 Py_XDECREF(type);
11360 Py_XDECREF(tb);
11361 return;
11362 }
11363 #else
11364 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
11365 PyObject* owned_instance = NULL;
11366 if (tb == Py_None) {
11367 tb = 0;
11368 } else if (tb && !PyTraceBack_Check(tb)) {
11369 PyErr_SetString(PyExc_TypeError,
11370 "raise: arg 3 must be a traceback or None");
11371 goto bad;
11372 }
11373 if (value == Py_None)
11374 value = 0;
11375 if (PyExceptionInstance_Check(type)) {
11376 if (value) {
11377 PyErr_SetString(PyExc_TypeError,
11378 "instance exception may not have a separate value");
11379 goto bad;
11380 }
11381 value = type;
11382 type = (PyObject*) Py_TYPE(value);
11383 } else if (PyExceptionClass_Check(type)) {
11384 PyObject *instance_class = NULL;
11385 if (value && PyExceptionInstance_Check(value)) {
11386 instance_class = (PyObject*) Py_TYPE(value);
11387 if (instance_class != type) {
11388 int is_subclass = PyObject_IsSubclass(instance_class, type);
11389 if (!is_subclass) {
11390 instance_class = NULL;
11391 } else if (unlikely(is_subclass == -1)) {
11392 goto bad;
11393 } else {
11394 type = instance_class;
11395 }
11396 }
11397 }
11398 if (!instance_class) {
11399 PyObject *args;
11400 if (!value)
11401 args = PyTuple_New(0);
11402 else if (PyTuple_Check(value)) {
11403 Py_INCREF(value);
11404 args = value;
11405 } else
11406 args = PyTuple_Pack(1, value);
11407 if (!args)
11408 goto bad;
11409 owned_instance = PyObject_Call(type, args, NULL);
11410 Py_DECREF(args);
11411 if (!owned_instance)
11412 goto bad;
11413 value = owned_instance;
11414 if (!PyExceptionInstance_Check(value)) {
11415 PyErr_Format(PyExc_TypeError,
11416 "calling %R should have returned an instance of "
11417 "BaseException, not %R",
11418 type, Py_TYPE(value));
11419 goto bad;
11420 }
11421 }
11422 } else {
11423 PyErr_SetString(PyExc_TypeError,
11424 "raise: exception class must be a subclass of BaseException");
11425 goto bad;
11426 }
11427 if (cause) {
11428 PyObject *fixed_cause;
11429 if (cause == Py_None) {
11430 fixed_cause = NULL;
11431 } else if (PyExceptionClass_Check(cause)) {
11432 fixed_cause = PyObject_CallObject(cause, NULL);
11433 if (fixed_cause == NULL)
11434 goto bad;
11435 } else if (PyExceptionInstance_Check(cause)) {
11436 fixed_cause = cause;
11437 Py_INCREF(fixed_cause);
11438 } else {
11439 PyErr_SetString(PyExc_TypeError,
11440 "exception causes must derive from "
11441 "BaseException");
11442 goto bad;
11443 }
11444 PyException_SetCause(value, fixed_cause);
11445 }
11446 PyErr_SetObject(type, value);
11447 if (tb) {
11448 #if PY_VERSION_HEX >= 0x030C00A6
11449 PyException_SetTraceback(value, tb);
11450 #elif CYTHON_FAST_THREAD_STATE
11451 PyThreadState *tstate = __Pyx_PyThreadState_Current;
11452 PyObject* tmp_tb = tstate->curexc_traceback;
11453 if (tb != tmp_tb) {
11454 Py_INCREF(tb);
11455 tstate->curexc_traceback = tb;
11456 Py_XDECREF(tmp_tb);
11457 }
11458 #else
11459 PyObject *tmp_type, *tmp_value, *tmp_tb;
11460 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
11461 Py_INCREF(tb);
11462 PyErr_Restore(tmp_type, tmp_value, tb);
11463 Py_XDECREF(tmp_tb);
11464 #endif
11465 }
11466 bad:
11467 Py_XDECREF(owned_instance);
11468 return;
11469 }
11470 #endif
11471
11472 /* WriteUnraisableException */
11473 static void __Pyx_WriteUnraisable(const char *name, int clineno,
11474 int lineno, const char *filename,
11475 int full_traceback, int nogil) {
11476 PyObject *old_exc, *old_val, *old_tb;
11477 PyObject *ctx;
11478 __Pyx_PyThreadState_declare
11479 #ifdef WITH_THREAD
11480 PyGILState_STATE state;
11481 if (nogil)
11482 state = PyGILState_Ensure();
11483 else state = (PyGILState_STATE)0;
11484 #endif
11485 CYTHON_UNUSED_VAR(clineno);
11486 CYTHON_UNUSED_VAR(lineno);
11487 CYTHON_UNUSED_VAR(filename);
11488 CYTHON_MAYBE_UNUSED_VAR(nogil);
11489 __Pyx_PyThreadState_assign
11490 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
11491 if (full_traceback) {
11492 Py_XINCREF(old_exc);
11493 Py_XINCREF(old_val);
11494 Py_XINCREF(old_tb);
11495 __Pyx_ErrRestore(old_exc, old_val, old_tb);
11496 PyErr_PrintEx(0);
11497 }
11498 #if PY_MAJOR_VERSION < 3
11499 ctx = PyString_FromString(name);
11500 #else
11501 ctx = PyUnicode_FromString(name);
11502 #endif
11503 __Pyx_ErrRestore(old_exc, old_val, old_tb);
11504 if (!ctx) {
11505 PyErr_WriteUnraisable(Py_None);
11506 } else {
11507 PyErr_WriteUnraisable(ctx);
11508 Py_DECREF(ctx);
11509 }
11510 #ifdef WITH_THREAD
11511 if (nogil)
11512 PyGILState_Release(state);
11513 #endif
11514 }
11515
11516 /* Import */
11517 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
11518 PyObject *module = 0;
11519 PyObject *empty_dict = 0;
11520 PyObject *empty_list = 0;
11521 #if PY_MAJOR_VERSION < 3
11522 PyObject *py_import;
11523 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
11524 if (unlikely(!py_import))
11525 goto bad;
11526 if (!from_list) {
11527 empty_list = PyList_New(0);
11528 if (unlikely(!empty_list))
11529 goto bad;
11530 from_list = empty_list;
11531 }
11532 #endif
11533 empty_dict = PyDict_New();
11534 if (unlikely(!empty_dict))
11535 goto bad;
11536 {
11537 #if PY_MAJOR_VERSION >= 3
11538 if (level == -1) {
11539 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
11540 module = PyImport_ImportModuleLevelObject(
11541 name, __pyx_d, empty_dict, from_list, 1);
11542 if (unlikely(!module)) {
11543 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
11544 goto bad;
11545 PyErr_Clear();
11546 }
11547 }
11548 level = 0;
11549 }
11550 #endif
11551 if (!module) {
11552 #if PY_MAJOR_VERSION < 3
11553 PyObject *py_level = PyInt_FromLong(level);
11554 if (unlikely(!py_level))
11555 goto bad;
11556 module = PyObject_CallFunctionObjArgs(py_import,
11557 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
11558 Py_DECREF(py_level);
11559 #else
11560 module = PyImport_ImportModuleLevelObject(
11561 name, __pyx_d, empty_dict, from_list, level);
11562 #endif
11563 }
11564 }
11565 bad:
11566 Py_XDECREF(empty_dict);
11567 Py_XDECREF(empty_list);
11568 #if PY_MAJOR_VERSION < 3
11569 Py_XDECREF(py_import);
11570 #endif
11571 return module;
11572 }
11573
11574 /* ImportDottedModule */
11575 #if PY_MAJOR_VERSION >= 3
11576 static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
11577 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
11578 if (unlikely(PyErr_Occurred())) {
11579 PyErr_Clear();
11580 }
11581 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
11582 partial_name = name;
11583 } else {
11584 slice = PySequence_GetSlice(parts_tuple, 0, count);
11585 if (unlikely(!slice))
11586 goto bad;
11587 sep = PyUnicode_FromStringAndSize(".", 1);
11588 if (unlikely(!sep))
11589 goto bad;
11590 partial_name = PyUnicode_Join(sep, slice);
11591 }
11592 PyErr_Format(
11593 #if PY_MAJOR_VERSION < 3
11594 PyExc_ImportError,
11595 "No module named '%s'", PyString_AS_STRING(partial_name));
11596 #else
11597 #if PY_VERSION_HEX >= 0x030600B1
11598 PyExc_ModuleNotFoundError,
11599 #else
11600 PyExc_ImportError,
11601 #endif
11602 "No module named '%U'", partial_name);
11603 #endif
11604 bad:
11605 Py_XDECREF(sep);
11606 Py_XDECREF(slice);
11607 Py_XDECREF(partial_name);
11608 return NULL;
11609 }
11610 #endif
11611 #if PY_MAJOR_VERSION >= 3
11612 static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
11613 PyObject *imported_module;
11614 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
11615 PyObject *modules = PyImport_GetModuleDict();
11616 if (unlikely(!modules))
11617 return NULL;
11618 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
11619 Py_XINCREF(imported_module);
11620 #else
11621 imported_module = PyImport_GetModule(name);
11622 #endif
11623 return imported_module;
11624 }
11625 #endif
11626 #if PY_MAJOR_VERSION >= 3
11627 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
11628 Py_ssize_t i, nparts;
11629 nparts = PyTuple_GET_SIZE(parts_tuple);
11630 for (i=1; i < nparts && module; i++) {
11631 PyObject *part, *submodule;
11632 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11633 part = PyTuple_GET_ITEM(parts_tuple, i);
11634 #else
11635 part = PySequence_ITEM(parts_tuple, i);
11636 #endif
11637 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
11638 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
11639 Py_DECREF(part);
11640 #endif
11641 Py_DECREF(module);
11642 module = submodule;
11643 }
11644 if (unlikely(!module)) {
11645 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
11646 }
11647 return module;
11648 }
11649 #endif
11650 static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
11651 #if PY_MAJOR_VERSION < 3
11652 PyObject *module, *from_list, *star = __pyx_n_s__3;
11653 CYTHON_UNUSED_VAR(parts_tuple);
11654 from_list = PyList_New(1);
11655 if (unlikely(!from_list))
11656 return NULL;
11657 Py_INCREF(star);
11658 PyList_SET_ITEM(from_list, 0, star);
11659 module = __Pyx_Import(name, from_list, 0);
11660 Py_DECREF(from_list);
11661 return module;
11662 #else
11663 PyObject *imported_module;
11664 PyObject *module = __Pyx_Import(name, NULL, 0);
11665 if (!parts_tuple || unlikely(!module))
11666 return module;
11667 imported_module = __Pyx__ImportDottedModule_Lookup(name);
11668 if (likely(imported_module)) {
11669 Py_DECREF(module);
11670 return imported_module;
11671 }
11672 PyErr_Clear();
11673 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
11674 #endif
11675 }
11676 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
11677 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
11678 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
11679 if (likely(module)) {
11680 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
11681 if (likely(spec)) {
11682 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
11683 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
11684 Py_DECREF(spec);
11685 spec = NULL;
11686 }
11687 Py_XDECREF(unsafe);
11688 }
11689 if (likely(!spec)) {
11690 PyErr_Clear();
11691 return module;
11692 }
11693 Py_DECREF(spec);
11694 Py_DECREF(module);
11695 } else if (PyErr_Occurred()) {
11696 PyErr_Clear();
11697 }
11698 #endif
11699 return __Pyx__ImportDottedModule(name, parts_tuple);
11700 }
11701
11702 /* PyDictVersioning */
11703 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
11704 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
11705 PyObject *dict = Py_TYPE(obj)->tp_dict;
11706 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
11707 }
11708 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
11709 PyObject **dictptr = NULL;
11710 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
11711 if (offset) {
11712 #if CYTHON_COMPILING_IN_CPYTHON
11713 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
11714 #else
11715 dictptr = _PyObject_GetDictPtr(obj);
11716 #endif
11717 }
11718 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
11719 }
11720 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
11721 PyObject *dict = Py_TYPE(obj)->tp_dict;
11722 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
11723 return 0;
11724 return obj_dict_version == __Pyx_get_object_dict_version(obj);
11725 }
11726 #endif
11727
11728 /* GetModuleGlobalName */
11729 #if CYTHON_USE_DICT_VERSIONS
11730 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
11731 #else
11732 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
11733 #endif
11734 {
11735 PyObject *result;
11736 #if !CYTHON_AVOID_BORROWED_REFS
11737 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
11738 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
11739 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11740 if (likely(result)) {
11741 return __Pyx_NewRef(result);
11742 } else if (unlikely(PyErr_Occurred())) {
11743 return NULL;
11744 }
11745 #elif CYTHON_COMPILING_IN_LIMITED_API
11746 if (unlikely(!__pyx_m)) {
11747 return NULL;
11748 }
11749 result = PyObject_GetAttr(__pyx_m, name);
11750 if (likely(result)) {
11751 return result;
11752 }
11753 #else
11754 result = PyDict_GetItem(__pyx_d, name);
11755 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11756 if (likely(result)) {
11757 return __Pyx_NewRef(result);
11758 }
11759 #endif
11760 #else
11761 result = PyObject_GetItem(__pyx_d, name);
11762 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
11763 if (likely(result)) {
11764 return __Pyx_NewRef(result);
11765 }
11766 PyErr_Clear();
11767 #endif
11768 return __Pyx_GetBuiltinName(name);
11769 }
11770
11771 /* PyObjectCall2Args */
11772 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
11773 PyObject *args[3] = {NULL, arg1, arg2};
11774 return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
11775 }
11776
11777 /* PyObjectGetMethod */
11778 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
11779 PyObject *attr;
11780 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
11781 __Pyx_TypeName type_name;
11782 PyTypeObject *tp = Py_TYPE(obj);
11783 PyObject *descr;
11784 descrgetfunc f = NULL;
11785 PyObject **dictptr, *dict;
11786 int meth_found = 0;
11787 assert (*method == NULL);
11788 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
11789 attr = __Pyx_PyObject_GetAttrStr(obj, name);
11790 goto try_unpack;
11791 }
11792 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
11793 return 0;
11794 }
11795 descr = _PyType_Lookup(tp, name);
11796 if (likely(descr != NULL)) {
11797 Py_INCREF(descr);
11798 #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
11799 if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
11800 #elif PY_MAJOR_VERSION >= 3
11801 #ifdef __Pyx_CyFunction_USED
11802 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
11803 #else
11804 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
11805 #endif
11806 #else
11807 #ifdef __Pyx_CyFunction_USED
11808 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
11809 #else
11810 if (likely(PyFunction_Check(descr)))
11811 #endif
11812 #endif
11813 {
11814 meth_found = 1;
11815 } else {
11816 f = Py_TYPE(descr)->tp_descr_get;
11817 if (f != NULL && PyDescr_IsData(descr)) {
11818 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11819 Py_DECREF(descr);
11820 goto try_unpack;
11821 }
11822 }
11823 }
11824 dictptr = _PyObject_GetDictPtr(obj);
11825 if (dictptr != NULL && (dict = *dictptr) != NULL) {
11826 Py_INCREF(dict);
11827 attr = __Pyx_PyDict_GetItemStr(dict, name);
11828 if (attr != NULL) {
11829 Py_INCREF(attr);
11830 Py_DECREF(dict);
11831 Py_XDECREF(descr);
11832 goto try_unpack;
11833 }
11834 Py_DECREF(dict);
11835 }
11836 if (meth_found) {
11837 *method = descr;
11838 return 1;
11839 }
11840 if (f != NULL) {
11841 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
11842 Py_DECREF(descr);
11843 goto try_unpack;
11844 }
11845 if (likely(descr != NULL)) {
11846 *method = descr;
11847 return 0;
11848 }
11849 type_name = __Pyx_PyType_GetName(tp);
11850 PyErr_Format(PyExc_AttributeError,
11851 #if PY_MAJOR_VERSION >= 3
11852 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
11853 type_name, name);
11854 #else
11855 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
11856 type_name, PyString_AS_STRING(name));
11857 #endif
11858 __Pyx_DECREF_TypeName(type_name);
11859 return 0;
11860 #else
11861 attr = __Pyx_PyObject_GetAttrStr(obj, name);
11862 goto try_unpack;
11863 #endif
11864 try_unpack:
11865 #if CYTHON_UNPACK_METHODS
11866 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
11867 PyObject *function = PyMethod_GET_FUNCTION(attr);
11868 Py_INCREF(function);
11869 Py_DECREF(attr);
11870 *method = function;
11871 return 1;
11872 }
11873 #endif
11874 *method = attr;
11875 return 0;
11876 }
11877
11878 /* PyObjectCallMethod1 */
11879 #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
11880 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
11881 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
11882 Py_DECREF(method);
11883 return result;
11884 }
11885 #endif
11886 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
11887 #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
11888 PyObject *args[2] = {obj, arg};
11889 (void) __Pyx_PyObject_GetMethod;
11890 (void) __Pyx_PyObject_CallOneArg;
11891 (void) __Pyx_PyObject_Call2Args;
11892 return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
11893 #else
11894 PyObject *method = NULL, *result;
11895 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11896 if (likely(is_method)) {
11897 result = __Pyx_PyObject_Call2Args(method, obj, arg);
11898 Py_DECREF(method);
11899 return result;
11900 }
11901 if (unlikely(!method)) return NULL;
11902 return __Pyx__PyObject_CallMethod1(method, arg);
11903 #endif
11904 }
11905
11906 /* StringJoin */
11907 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
11908 (void) __Pyx_PyObject_CallMethod1;
11909 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION < 3
11910 return _PyString_Join(sep, values);
11911 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
11912 return _PyBytes_Join(sep, values);
11913 #else
11914 return __Pyx_PyObject_CallMethod1(sep, __pyx_n_s_join, values);
11915 #endif
11916 }
11917
11918 /* KeywordStringCheck */
11919 static int __Pyx_CheckKeywordStrings(
11920 PyObject *kw,
11921 const char* function_name,
11922 int kw_allowed)
11923 {
11924 PyObject* key = 0;
11925 Py_ssize_t pos = 0;
11926 #if CYTHON_COMPILING_IN_PYPY
11927 if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0))
11928 goto invalid_keyword;
11929 return 1;
11930 #else
11931 if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
11932 Py_ssize_t kwsize;
11933 #if CYTHON_ASSUME_SAFE_MACROS
11934 kwsize = PyTuple_GET_SIZE(kw);
11935 #else
11936 kwsize = PyTuple_Size(kw);
11937 if (kwsize < 0) return 0;
11938 #endif
11939 if (unlikely(kwsize == 0))
11940 return 1;
11941 if (!kw_allowed) {
11942 #if CYTHON_ASSUME_SAFE_MACROS
11943 key = PyTuple_GET_ITEM(kw, 0);
11944 #else
11945 key = PyTuple_GetItem(kw, pos);
11946 if (!key) return 0;
11947 #endif
11948 goto invalid_keyword;
11949 }
11950 #if PY_VERSION_HEX < 0x03090000
11951 for (pos = 0; pos < kwsize; pos++) {
11952 #if CYTHON_ASSUME_SAFE_MACROS
11953 key = PyTuple_GET_ITEM(kw, pos);
11954 #else
11955 key = PyTuple_GetItem(kw, pos);
11956 if (!key) return 0;
11957 #endif
11958 if (unlikely(!PyUnicode_Check(key)))
11959 goto invalid_keyword_type;
11960 }
11961 #endif
11962 return 1;
11963 }
11964 while (PyDict_Next(kw, &pos, &key, 0)) {
11965 #if PY_MAJOR_VERSION < 3
11966 if (unlikely(!PyString_Check(key)))
11967 #endif
11968 if (unlikely(!PyUnicode_Check(key)))
11969 goto invalid_keyword_type;
11970 }
11971 if (!kw_allowed && unlikely(key))
11972 goto invalid_keyword;
11973 return 1;
11974 invalid_keyword_type:
11975 PyErr_Format(PyExc_TypeError,
11976 "%.200s() keywords must be strings", function_name);
11977 return 0;
11978 #endif
11979 invalid_keyword:
11980 #if PY_MAJOR_VERSION < 3
11981 PyErr_Format(PyExc_TypeError,
11982 "%.200s() got an unexpected keyword argument '%.200s'",
11983 function_name, PyString_AsString(key));
11984 #else
11985 PyErr_Format(PyExc_TypeError,
11986 "%s() got an unexpected keyword argument '%U'",
11987 function_name, key);
11988 #endif
11989 return 0;
11990 }
11991
11992 /* FixUpExtensionType */
11993 #if CYTHON_USE_TYPE_SPECS
11994 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
11995 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
11996 CYTHON_UNUSED_VAR(spec);
11997 CYTHON_UNUSED_VAR(type);
11998 #else
11999 const PyType_Slot *slot = spec->slots;
12000 while (slot && slot->slot && slot->slot != Py_tp_members)
12001 slot++;
12002 if (slot && slot->slot == Py_tp_members) {
12003 int changed = 0;
12004 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
12005 const
12006 #endif
12007 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
12008 while (memb && memb->name) {
12009 if (memb->name[0] == '_' && memb->name[1] == '_') {
12010 #if PY_VERSION_HEX < 0x030900b1
12011 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
12012 assert(memb->type == T_PYSSIZET);
12013 assert(memb->flags == READONLY);
12014 type->tp_weaklistoffset = memb->offset;
12015 changed = 1;
12016 }
12017 else if (strcmp(memb->name, "__dictoffset__") == 0) {
12018 assert(memb->type == T_PYSSIZET);
12019 assert(memb->flags == READONLY);
12020 type->tp_dictoffset = memb->offset;
12021 changed = 1;
12022 }
12023 #if CYTHON_METH_FASTCALL
12024 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
12025 assert(memb->type == T_PYSSIZET);
12026 assert(memb->flags == READONLY);
12027 #if PY_VERSION_HEX >= 0x030800b4
12028 type->tp_vectorcall_offset = memb->offset;
12029 #else
12030 type->tp_print = (printfunc) memb->offset;
12031 #endif
12032 changed = 1;
12033 }
12034 #endif
12035 #else
12036 if ((0));
12037 #endif
12038 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
12039 else if (strcmp(memb->name, "__module__") == 0) {
12040 PyObject *descr;
12041 assert(memb->type == T_OBJECT);
12042 assert(memb->flags == 0 || memb->flags == READONLY);
12043 descr = PyDescr_NewMember(type, memb);
12044 if (unlikely(!descr))
12045 return -1;
12046 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
12047 Py_DECREF(descr);
12048 return -1;
12049 }
12050 Py_DECREF(descr);
12051 changed = 1;
12052 }
12053 #endif
12054 }
12055 memb++;
12056 }
12057 if (changed)
12058 PyType_Modified(type);
12059 }
12060 #endif
12061 return 0;
12062 }
12063 #endif
12064
12065 /* PyObjectCallNoArg */
12066 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
12067 PyObject *arg[2] = {NULL, NULL};
12068 return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
12069 }
12070
12071 /* PyObjectCallMethod0 */
12072 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
12073 PyObject *method = NULL, *result = NULL;
12074 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
12075 if (likely(is_method)) {
12076 result = __Pyx_PyObject_CallOneArg(method, obj);
12077 Py_DECREF(method);
12078 return result;
12079 }
12080 if (unlikely(!method)) goto bad;
12081 result = __Pyx_PyObject_CallNoArg(method);
12082 Py_DECREF(method);
12083 bad:
12084 return result;
12085 }
12086
12087 /* ValidateBasesTuple */
12088 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
12089 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
12090 Py_ssize_t i, n;
12091 #if CYTHON_ASSUME_SAFE_MACROS
12092 n = PyTuple_GET_SIZE(bases);
12093 #else
12094 n = PyTuple_Size(bases);
12095 if (n < 0) return -1;
12096 #endif
12097 for (i = 1; i < n; i++)
12098 {
12099 #if CYTHON_AVOID_BORROWED_REFS
12100 PyObject *b0 = PySequence_GetItem(bases, i);
12101 if (!b0) return -1;
12102 #elif CYTHON_ASSUME_SAFE_MACROS
12103 PyObject *b0 = PyTuple_GET_ITEM(bases, i);
12104 #else
12105 PyObject *b0 = PyTuple_GetItem(bases, i);
12106 if (!b0) return -1;
12107 #endif
12108 PyTypeObject *b;
12109 #if PY_MAJOR_VERSION < 3
12110 if (PyClass_Check(b0))
12111 {
12112 PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
12113 PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
12114 #if CYTHON_AVOID_BORROWED_REFS
12115 Py_DECREF(b0);
12116 #endif
12117 return -1;
12118 }
12119 #endif
12120 b = (PyTypeObject*) b0;
12121 if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
12122 {
12123 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
12124 PyErr_Format(PyExc_TypeError,
12125 "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
12126 __Pyx_DECREF_TypeName(b_name);
12127 #if CYTHON_AVOID_BORROWED_REFS
12128 Py_DECREF(b0);
12129 #endif
12130 return -1;
12131 }
12132 if (dictoffset == 0)
12133 {
12134 Py_ssize_t b_dictoffset = 0;
12135 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
12136 b_dictoffset = b->tp_dictoffset;
12137 #else
12138 PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
12139 if (!py_b_dictoffset) goto dictoffset_return;
12140 b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
12141 Py_DECREF(py_b_dictoffset);
12142 if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
12143 #endif
12144 if (b_dictoffset) {
12145 {
12146 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
12147 PyErr_Format(PyExc_TypeError,
12148 "extension type '%.200s' has no __dict__ slot, "
12149 "but base type '" __Pyx_FMT_TYPENAME "' has: "
12150 "either add 'cdef dict __dict__' to the extension type "
12151 "or add '__slots__ = [...]' to the base type",
12152 type_name, b_name);
12153 __Pyx_DECREF_TypeName(b_name);
12154 }
12155 #if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY)
12156 dictoffset_return:
12157 #endif
12158 #if CYTHON_AVOID_BORROWED_REFS
12159 Py_DECREF(b0);
12160 #endif
12161 return -1;
12162 }
12163 }
12164 #if CYTHON_AVOID_BORROWED_REFS
12165 Py_DECREF(b0);
12166 #endif
12167 }
12168 return 0;
12169 }
12170 #endif
12171
12172 /* PyType_Ready */
12173 static int __Pyx_PyType_Ready(PyTypeObject *t) {
12174 #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
12175 (void)__Pyx_PyObject_CallMethod0;
12176 #if CYTHON_USE_TYPE_SPECS
12177 (void)__Pyx_validate_bases_tuple;
12178 #endif
12179 return PyType_Ready(t);
12180 #else
12181 int r;
12182 PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
12183 if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
12184 return -1;
12185 #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
12186 {
12187 int gc_was_enabled;
12188 #if PY_VERSION_HEX >= 0x030A00b1
12189 gc_was_enabled = PyGC_Disable();
12190 (void)__Pyx_PyObject_CallMethod0;
12191 #else
12192 PyObject *ret, *py_status;
12193 PyObject *gc = NULL;
12194 #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
12195 gc = PyImport_GetModule(__pyx_kp_u_gc);
12196 #endif
12197 if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
12198 if (unlikely(!gc)) return -1;
12199 py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
12200 if (unlikely(!py_status)) {
12201 Py_DECREF(gc);
12202 return -1;
12203 }
12204 gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
12205 Py_DECREF(py_status);
12206 if (gc_was_enabled > 0) {
12207 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
12208 if (unlikely(!ret)) {
12209 Py_DECREF(gc);
12210 return -1;
12211 }
12212 Py_DECREF(ret);
12213 } else if (unlikely(gc_was_enabled == -1)) {
12214 Py_DECREF(gc);
12215 return -1;
12216 }
12217 #endif
12218 t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
12219 #if PY_VERSION_HEX >= 0x030A0000
12220 t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
12221 #endif
12222 #else
12223 (void)__Pyx_PyObject_CallMethod0;
12224 #endif
12225 r = PyType_Ready(t);
12226 #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
12227 t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
12228 #if PY_VERSION_HEX >= 0x030A00b1
12229 if (gc_was_enabled)
12230 PyGC_Enable();
12231 #else
12232 if (gc_was_enabled) {
12233 PyObject *tp, *v, *tb;
12234 PyErr_Fetch(&tp, &v, &tb);
12235 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
12236 if (likely(ret || r == -1)) {
12237 Py_XDECREF(ret);
12238 PyErr_Restore(tp, v, tb);
12239 } else {
12240 Py_XDECREF(tp);
12241 Py_XDECREF(v);
12242 Py_XDECREF(tb);
12243 r = -1;
12244 }
12245 }
12246 Py_DECREF(gc);
12247 #endif
12248 }
12249 #endif
12250 return r;
12251 #endif
12252 }
12253
12254 /* PyObject_GenericGetAttrNoDict */
12255 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12256 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
12257 __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
12258 PyErr_Format(PyExc_AttributeError,
12259 #if PY_MAJOR_VERSION >= 3
12260 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
12261 type_name, attr_name);
12262 #else
12263 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
12264 type_name, PyString_AS_STRING(attr_name));
12265 #endif
12266 __Pyx_DECREF_TypeName(type_name);
12267 return NULL;
12268 }
12269 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
12270 PyObject *descr;
12271 PyTypeObject *tp = Py_TYPE(obj);
12272 if (unlikely(!PyString_Check(attr_name))) {
12273 return PyObject_GenericGetAttr(obj, attr_name);
12274 }
12275 assert(!tp->tp_dictoffset);
12276 descr = _PyType_Lookup(tp, attr_name);
12277 if (unlikely(!descr)) {
12278 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
12279 }
12280 Py_INCREF(descr);
12281 #if PY_MAJOR_VERSION < 3
12282 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
12283 #endif
12284 {
12285 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
12286 if (unlikely(f)) {
12287 PyObject *res = f(descr, obj, (PyObject *)tp);
12288 Py_DECREF(descr);
12289 return res;
12290 }
12291 }
12292 return descr;
12293 }
12294 #endif
12295
12296 /* PyObject_GenericGetAttr */
12297 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
12298 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
12299 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
12300 return PyObject_GenericGetAttr(obj, attr_name);
12301 }
12302 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
12303 }
12304 #endif
12305
12306 /* SetupReduce */
12307 #if !CYTHON_COMPILING_IN_LIMITED_API
12308 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
12309 int ret;
12310 PyObject *name_attr;
12311 name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name);
12312 if (likely(name_attr)) {
12313 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
12314 } else {
12315 ret = -1;
12316 }
12317 if (unlikely(ret < 0)) {
12318 PyErr_Clear();
12319 ret = 0;
12320 }
12321 Py_XDECREF(name_attr);
12322 return ret;
12323 }
12324 static int __Pyx_setup_reduce(PyObject* type_obj) {
12325 int ret = 0;
12326 PyObject *object_reduce = NULL;
12327 PyObject *object_getstate = NULL;
12328 PyObject *object_reduce_ex = NULL;
12329 PyObject *reduce = NULL;
12330 PyObject *reduce_ex = NULL;
12331 PyObject *reduce_cython = NULL;
12332 PyObject *setstate = NULL;
12333 PyObject *setstate_cython = NULL;
12334 PyObject *getstate = NULL;
12335 #if CYTHON_USE_PYTYPE_LOOKUP
12336 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
12337 #else
12338 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
12339 if (!getstate && PyErr_Occurred()) {
12340 goto __PYX_BAD;
12341 }
12342 #endif
12343 if (getstate) {
12344 #if CYTHON_USE_PYTYPE_LOOKUP
12345 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
12346 #else
12347 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
12348 if (!object_getstate && PyErr_Occurred()) {
12349 goto __PYX_BAD;
12350 }
12351 #endif
12352 if (object_getstate != getstate) {
12353 goto __PYX_GOOD;
12354 }
12355 }
12356 #if CYTHON_USE_PYTYPE_LOOKUP
12357 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12358 #else
12359 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
12360 #endif
12361 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
12362 if (reduce_ex == object_reduce_ex) {
12363 #if CYTHON_USE_PYTYPE_LOOKUP
12364 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12365 #else
12366 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
12367 #endif
12368 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
12369 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
12370 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
12371 if (likely(reduce_cython)) {
12372 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12373 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12374 } else if (reduce == object_reduce || PyErr_Occurred()) {
12375 goto __PYX_BAD;
12376 }
12377 setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate);
12378 if (!setstate) PyErr_Clear();
12379 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
12380 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
12381 if (likely(setstate_cython)) {
12382 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12383 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
12384 } else if (!setstate || PyErr_Occurred()) {
12385 goto __PYX_BAD;
12386 }
12387 }
12388 PyType_Modified((PyTypeObject*)type_obj);
12389 }
12390 }
12391 goto __PYX_GOOD;
12392 __PYX_BAD:
12393 if (!PyErr_Occurred()) {
12394 __Pyx_TypeName type_obj_name =
12395 __Pyx_PyType_GetName((PyTypeObject*)type_obj);
12396 PyErr_Format(PyExc_RuntimeError,
12397 "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
12398 __Pyx_DECREF_TypeName(type_obj_name);
12399 }
12400 ret = -1;
12401 __PYX_GOOD:
12402 #if !CYTHON_USE_PYTYPE_LOOKUP
12403 Py_XDECREF(object_reduce);
12404 Py_XDECREF(object_reduce_ex);
12405 Py_XDECREF(object_getstate);
12406 Py_XDECREF(getstate);
12407 #endif
12408 Py_XDECREF(reduce);
12409 Py_XDECREF(reduce_ex);
12410 Py_XDECREF(reduce_cython);
12411 Py_XDECREF(setstate);
12412 Py_XDECREF(setstate_cython);
12413 return ret;
12414 }
12415 #endif
12416
12417 /* TypeImport */
12418 #ifndef __PYX_HAVE_RT_ImportType_3_0_11
12419 #define __PYX_HAVE_RT_ImportType_3_0_11
12420 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
12421 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
12422 {
12423 PyObject *result = 0;
12424 char warning[200];
12425 Py_ssize_t basicsize;
12426 Py_ssize_t itemsize;
12427 #if CYTHON_COMPILING_IN_LIMITED_API
12428 PyObject *py_basicsize;
12429 PyObject *py_itemsize;
12430 #endif
12431 result = PyObject_GetAttrString(module, class_name);
12432 if (!result)
12433 goto bad;
12434 if (!PyType_Check(result)) {
12435 PyErr_Format(PyExc_TypeError,
12436 "%.200s.%.200s is not a type object",
12437 module_name, class_name);
12438 goto bad;
12439 }
12440 #if !CYTHON_COMPILING_IN_LIMITED_API
12441 basicsize = ((PyTypeObject *)result)->tp_basicsize;
12442 itemsize = ((PyTypeObject *)result)->tp_itemsize;
12443 #else
12444 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
12445 if (!py_basicsize)
12446 goto bad;
12447 basicsize = PyLong_AsSsize_t(py_basicsize);
12448 Py_DECREF(py_basicsize);
12449 py_basicsize = 0;
12450 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
12451 goto bad;
12452 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
12453 if (!py_itemsize)
12454 goto bad;
12455 itemsize = PyLong_AsSsize_t(py_itemsize);
12456 Py_DECREF(py_itemsize);
12457 py_itemsize = 0;
12458 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
12459 goto bad;
12460 #endif
12461 if (itemsize) {
12462 if (size % alignment) {
12463 alignment = size % alignment;
12464 }
12465 if (itemsize < (Py_ssize_t)alignment)
12466 itemsize = (Py_ssize_t)alignment;
12467 }
12468 if ((size_t)(basicsize + itemsize) < size) {
12469 PyErr_Format(PyExc_ValueError,
12470 "%.200s.%.200s size changed, may indicate binary incompatibility. "
12471 "Expected %zd from C header, got %zd from PyObject",
12472 module_name, class_name, size, basicsize+itemsize);
12473 goto bad;
12474 }
12475 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
12476 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
12477 PyErr_Format(PyExc_ValueError,
12478 "%.200s.%.200s size changed, may indicate binary incompatibility. "
12479 "Expected %zd from C header, got %zd-%zd from PyObject",
12480 module_name, class_name, size, basicsize, basicsize+itemsize);
12481 goto bad;
12482 }
12483 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
12484 PyOS_snprintf(warning, sizeof(warning),
12485 "%s.%s size changed, may indicate binary incompatibility. "
12486 "Expected %zd from C header, got %zd from PyObject",
12487 module_name, class_name, size, basicsize);
12488 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
12489 }
12490 return (PyTypeObject *)result;
12491 bad:
12492 Py_XDECREF(result);
12493 return NULL;
12494 }
12495 #endif
12496
12497 /* GetVTable */
12498 static void* __Pyx_GetVtable(PyTypeObject *type) {
12499 void* ptr;
12500 #if CYTHON_COMPILING_IN_LIMITED_API
12501 PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable);
12502 #else
12503 PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable);
12504 #endif
12505 if (!ob)
12506 goto bad;
12507 ptr = PyCapsule_GetPointer(ob, 0);
12508 if (!ptr && !PyErr_Occurred())
12509 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
12510 Py_DECREF(ob);
12511 return ptr;
12512 bad:
12513 Py_XDECREF(ob);
12514 return NULL;
12515 }
12516
12517 /* FetchSharedCythonModule */
12518 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
12519 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
12520 }
12521
12522 /* FetchCommonType */
12523 static int __Pyx_VerifyCachedType(PyObject *cached_type,
12524 const char *name,
12525 Py_ssize_t basicsize,
12526 Py_ssize_t expected_basicsize) {
12527 if (!PyType_Check(cached_type)) {
12528 PyErr_Format(PyExc_TypeError,
12529 "Shared Cython type %.200s is not a type object", name);
12530 return -1;
12531 }
12532 if (basicsize != expected_basicsize) {
12533 PyErr_Format(PyExc_TypeError,
12534 "Shared Cython type %.200s has the wrong size, try recompiling",
12535 name);
12536 return -1;
12537 }
12538 return 0;
12539 }
12540 #if !CYTHON_USE_TYPE_SPECS
12541 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
12542 PyObject* abi_module;
12543 const char* object_name;
12544 PyTypeObject *cached_type = NULL;
12545 abi_module = __Pyx_FetchSharedCythonABIModule();
12546 if (!abi_module) return NULL;
12547 object_name = strrchr(type->tp_name, '.');
12548 object_name = object_name ? object_name+1 : type->tp_name;
12549 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
12550 if (cached_type) {
12551 if (__Pyx_VerifyCachedType(
12552 (PyObject *)cached_type,
12553 object_name,
12554 cached_type->tp_basicsize,
12555 type->tp_basicsize) < 0) {
12556 goto bad;
12557 }
12558 goto done;
12559 }
12560 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12561 PyErr_Clear();
12562 if (PyType_Ready(type) < 0) goto bad;
12563 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
12564 goto bad;
12565 Py_INCREF(type);
12566 cached_type = type;
12567 done:
12568 Py_DECREF(abi_module);
12569 return cached_type;
12570 bad:
12571 Py_XDECREF(cached_type);
12572 cached_type = NULL;
12573 goto done;
12574 }
12575 #else
12576 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
12577 PyObject *abi_module, *cached_type = NULL;
12578 const char* object_name = strrchr(spec->name, '.');
12579 object_name = object_name ? object_name+1 : spec->name;
12580 abi_module = __Pyx_FetchSharedCythonABIModule();
12581 if (!abi_module) return NULL;
12582 cached_type = PyObject_GetAttrString(abi_module, object_name);
12583 if (cached_type) {
12584 Py_ssize_t basicsize;
12585 #if CYTHON_COMPILING_IN_LIMITED_API
12586 PyObject *py_basicsize;
12587 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
12588 if (unlikely(!py_basicsize)) goto bad;
12589 basicsize = PyLong_AsSsize_t(py_basicsize);
12590 Py_DECREF(py_basicsize);
12591 py_basicsize = 0;
12592 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
12593 #else
12594 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
12595 #endif
12596 if (__Pyx_VerifyCachedType(
12597 cached_type,
12598 object_name,
12599 basicsize,
12600 spec->basicsize) < 0) {
12601 goto bad;
12602 }
12603 goto done;
12604 }
12605 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
12606 PyErr_Clear();
12607 CYTHON_UNUSED_VAR(module);
12608 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
12609 if (unlikely(!cached_type)) goto bad;
12610 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
12611 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
12612 done:
12613 Py_DECREF(abi_module);
12614 assert(cached_type == NULL || PyType_Check(cached_type));
12615 return (PyTypeObject *) cached_type;
12616 bad:
12617 Py_XDECREF(cached_type);
12618 cached_type = NULL;
12619 goto done;
12620 }
12621 #endif
12622
12623 /* PyVectorcallFastCallDict */
12624 #if CYTHON_METH_FASTCALL
12625 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
12626 {
12627 PyObject *res = NULL;
12628 PyObject *kwnames;
12629 PyObject **newargs;
12630 PyObject **kwvalues;
12631 Py_ssize_t i, pos;
12632 size_t j;
12633 PyObject *key, *value;
12634 unsigned long keys_are_strings;
12635 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
12636 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
12637 if (unlikely(newargs == NULL)) {
12638 PyErr_NoMemory();
12639 return NULL;
12640 }
12641 for (j = 0; j < nargs; j++) newargs[j] = args[j];
12642 kwnames = PyTuple_New(nkw);
12643 if (unlikely(kwnames == NULL)) {
12644 PyMem_Free(newargs);
12645 return NULL;
12646 }
12647 kwvalues = newargs + nargs;
12648 pos = i = 0;
12649 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
12650 while (PyDict_Next(kw, &pos, &key, &value)) {
12651 keys_are_strings &= Py_TYPE(key)->tp_flags;
12652 Py_INCREF(key);
12653 Py_INCREF(value);
12654 PyTuple_SET_ITEM(kwnames, i, key);
12655 kwvalues[i] = value;
12656 i++;
12657 }
12658 if (unlikely(!keys_are_strings)) {
12659 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
12660 goto cleanup;
12661 }
12662 res = vc(func, newargs, nargs, kwnames);
12663 cleanup:
12664 Py_DECREF(kwnames);
12665 for (i = 0; i < nkw; i++)
12666 Py_DECREF(kwvalues[i]);
12667 PyMem_Free(newargs);
12668 return res;
12669 }
12670 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
12671 {
12672 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
12673 return vc(func, args, nargs, NULL);
12674 }
12675 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
12676 }
12677 #endif
12678
12679 /* CythonFunctionShared */
12680 #if CYTHON_COMPILING_IN_LIMITED_API
12681 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
12682 if (__Pyx_CyFunction_Check(func)) {
12683 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
12684 } else if (PyCFunction_Check(func)) {
12685 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
12686 }
12687 return 0;
12688 }
12689 #else
12690 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
12691 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
12692 }
12693 #endif
12694 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
12695 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
12696 __Pyx_Py_XDECREF_SET(
12697 __Pyx_CyFunction_GetClassObj(f),
12698 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
12699 #else
12700 __Pyx_Py_XDECREF_SET(
12701 ((PyCMethodObject *) (f))->mm_class,
12702 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
12703 #endif
12704 }
12705 static PyObject *
12706 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
12707 {
12708 CYTHON_UNUSED_VAR(closure);
12709 if (unlikely(op->func_doc == NULL)) {
12710 #if CYTHON_COMPILING_IN_LIMITED_API
12711 op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
12712 if (unlikely(!op->func_doc)) return NULL;
12713 #else
12714 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
12715 #if PY_MAJOR_VERSION >= 3
12716 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
12717 #else
12718 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
12719 #endif
12720 if (unlikely(op->func_doc == NULL))
12721 return NULL;
12722 } else {
12723 Py_INCREF(Py_None);
12724 return Py_None;
12725 }
12726 #endif
12727 }
12728 Py_INCREF(op->func_doc);
12729 return op->func_doc;
12730 }
12731 static int
12732 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
12733 {
12734 CYTHON_UNUSED_VAR(context);
12735 if (value == NULL) {
12736 value = Py_None;
12737 }
12738 Py_INCREF(value);
12739 __Pyx_Py_XDECREF_SET(op->func_doc, value);
12740 return 0;
12741 }
12742 static PyObject *
12743 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
12744 {
12745 CYTHON_UNUSED_VAR(context);
12746 if (unlikely(op->func_name == NULL)) {
12747 #if CYTHON_COMPILING_IN_LIMITED_API
12748 op->func_name = PyObject_GetAttrString(op->func, "__name__");
12749 #elif PY_MAJOR_VERSION >= 3
12750 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
12751 #else
12752 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
12753 #endif
12754 if (unlikely(op->func_name == NULL))
12755 return NULL;
12756 }
12757 Py_INCREF(op->func_name);
12758 return op->func_name;
12759 }
12760 static int
12761 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
12762 {
12763 CYTHON_UNUSED_VAR(context);
12764 #if PY_MAJOR_VERSION >= 3
12765 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12766 #else
12767 if (unlikely(value == NULL || !PyString_Check(value)))
12768 #endif
12769 {
12770 PyErr_SetString(PyExc_TypeError,
12771 "__name__ must be set to a string object");
12772 return -1;
12773 }
12774 Py_INCREF(value);
12775 __Pyx_Py_XDECREF_SET(op->func_name, value);
12776 return 0;
12777 }
12778 static PyObject *
12779 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
12780 {
12781 CYTHON_UNUSED_VAR(context);
12782 Py_INCREF(op->func_qualname);
12783 return op->func_qualname;
12784 }
12785 static int
12786 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
12787 {
12788 CYTHON_UNUSED_VAR(context);
12789 #if PY_MAJOR_VERSION >= 3
12790 if (unlikely(value == NULL || !PyUnicode_Check(value)))
12791 #else
12792 if (unlikely(value == NULL || !PyString_Check(value)))
12793 #endif
12794 {
12795 PyErr_SetString(PyExc_TypeError,
12796 "__qualname__ must be set to a string object");
12797 return -1;
12798 }
12799 Py_INCREF(value);
12800 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
12801 return 0;
12802 }
12803 static PyObject *
12804 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
12805 {
12806 CYTHON_UNUSED_VAR(context);
12807 if (unlikely(op->func_dict == NULL)) {
12808 op->func_dict = PyDict_New();
12809 if (unlikely(op->func_dict == NULL))
12810 return NULL;
12811 }
12812 Py_INCREF(op->func_dict);
12813 return op->func_dict;
12814 }
12815 static int
12816 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
12817 {
12818 CYTHON_UNUSED_VAR(context);
12819 if (unlikely(value == NULL)) {
12820 PyErr_SetString(PyExc_TypeError,
12821 "function's dictionary may not be deleted");
12822 return -1;
12823 }
12824 if (unlikely(!PyDict_Check(value))) {
12825 PyErr_SetString(PyExc_TypeError,
12826 "setting function's dictionary to a non-dict");
12827 return -1;
12828 }
12829 Py_INCREF(value);
12830 __Pyx_Py_XDECREF_SET(op->func_dict, value);
12831 return 0;
12832 }
12833 static PyObject *
12834 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
12835 {
12836 CYTHON_UNUSED_VAR(context);
12837 Py_INCREF(op->func_globals);
12838 return op->func_globals;
12839 }
12840 static PyObject *
12841 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
12842 {
12843 CYTHON_UNUSED_VAR(op);
12844 CYTHON_UNUSED_VAR(context);
12845 Py_INCREF(Py_None);
12846 return Py_None;
12847 }
12848 static PyObject *
12849 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
12850 {
12851 PyObject* result = (op->func_code) ? op->func_code : Py_None;
12852 CYTHON_UNUSED_VAR(context);
12853 Py_INCREF(result);
12854 return result;
12855 }
12856 static int
12857 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
12858 int result = 0;
12859 PyObject *res = op->defaults_getter((PyObject *) op);
12860 if (unlikely(!res))
12861 return -1;
12862 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12863 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
12864 Py_INCREF(op->defaults_tuple);
12865 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
12866 Py_INCREF(op->defaults_kwdict);
12867 #else
12868 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
12869 if (unlikely(!op->defaults_tuple)) result = -1;
12870 else {
12871 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
12872 if (unlikely(!op->defaults_kwdict)) result = -1;
12873 }
12874 #endif
12875 Py_DECREF(res);
12876 return result;
12877 }
12878 static int
12879 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
12880 CYTHON_UNUSED_VAR(context);
12881 if (!value) {
12882 value = Py_None;
12883 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
12884 PyErr_SetString(PyExc_TypeError,
12885 "__defaults__ must be set to a tuple object");
12886 return -1;
12887 }
12888 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
12889 "currently affect the values used in function calls", 1);
12890 Py_INCREF(value);
12891 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
12892 return 0;
12893 }
12894 static PyObject *
12895 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
12896 PyObject* result = op->defaults_tuple;
12897 CYTHON_UNUSED_VAR(context);
12898 if (unlikely(!result)) {
12899 if (op->defaults_getter) {
12900 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
12901 result = op->defaults_tuple;
12902 } else {
12903 result = Py_None;
12904 }
12905 }
12906 Py_INCREF(result);
12907 return result;
12908 }
12909 static int
12910 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
12911 CYTHON_UNUSED_VAR(context);
12912 if (!value) {
12913 value = Py_None;
12914 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
12915 PyErr_SetString(PyExc_TypeError,
12916 "__kwdefaults__ must be set to a dict object");
12917 return -1;
12918 }
12919 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
12920 "currently affect the values used in function calls", 1);
12921 Py_INCREF(value);
12922 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
12923 return 0;
12924 }
12925 static PyObject *
12926 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
12927 PyObject* result = op->defaults_kwdict;
12928 CYTHON_UNUSED_VAR(context);
12929 if (unlikely(!result)) {
12930 if (op->defaults_getter) {
12931 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
12932 result = op->defaults_kwdict;
12933 } else {
12934 result = Py_None;
12935 }
12936 }
12937 Py_INCREF(result);
12938 return result;
12939 }
12940 static int
12941 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
12942 CYTHON_UNUSED_VAR(context);
12943 if (!value || value == Py_None) {
12944 value = NULL;
12945 } else if (unlikely(!PyDict_Check(value))) {
12946 PyErr_SetString(PyExc_TypeError,
12947 "__annotations__ must be set to a dict object");
12948 return -1;
12949 }
12950 Py_XINCREF(value);
12951 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
12952 return 0;
12953 }
12954 static PyObject *
12955 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
12956 PyObject* result = op->func_annotations;
12957 CYTHON_UNUSED_VAR(context);
12958 if (unlikely(!result)) {
12959 result = PyDict_New();
12960 if (unlikely(!result)) return NULL;
12961 op->func_annotations = result;
12962 }
12963 Py_INCREF(result);
12964 return result;
12965 }
12966 static PyObject *
12967 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
12968 int is_coroutine;
12969 CYTHON_UNUSED_VAR(context);
12970 if (op->func_is_coroutine) {
12971 return __Pyx_NewRef(op->func_is_coroutine);
12972 }
12973 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
12974 #if PY_VERSION_HEX >= 0x03050000
12975 if (is_coroutine) {
12976 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
12977 fromlist = PyList_New(1);
12978 if (unlikely(!fromlist)) return NULL;
12979 Py_INCREF(marker);
12980 #if CYTHON_ASSUME_SAFE_MACROS
12981 PyList_SET_ITEM(fromlist, 0, marker);
12982 #else
12983 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
12984 Py_DECREF(marker);
12985 Py_DECREF(fromlist);
12986 return NULL;
12987 }
12988 #endif
12989 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
12990 Py_DECREF(fromlist);
12991 if (unlikely(!module)) goto ignore;
12992 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
12993 Py_DECREF(module);
12994 if (likely(op->func_is_coroutine)) {
12995 return __Pyx_NewRef(op->func_is_coroutine);
12996 }
12997 ignore:
12998 PyErr_Clear();
12999 }
13000 #endif
13001 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
13002 return __Pyx_NewRef(op->func_is_coroutine);
13003 }
13004 #if CYTHON_COMPILING_IN_LIMITED_API
13005 static PyObject *
13006 __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
13007 CYTHON_UNUSED_VAR(context);
13008 return PyObject_GetAttrString(op->func, "__module__");
13009 }
13010 static int
13011 __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
13012 CYTHON_UNUSED_VAR(context);
13013 return PyObject_SetAttrString(op->func, "__module__", value);
13014 }
13015 #endif
13016 static PyGetSetDef __pyx_CyFunction_getsets[] = {
13017 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13018 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13019 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13020 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13021 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
13022 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13023 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13024 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13025 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13026 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13027 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13028 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13029 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13030 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13031 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13032 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
13033 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
13034 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
13035 #if CYTHON_COMPILING_IN_LIMITED_API
13036 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
13037 #endif
13038 {0, 0, 0, 0, 0}
13039 };
13040 static PyMemberDef __pyx_CyFunction_members[] = {
13041 #if !CYTHON_COMPILING_IN_LIMITED_API
13042 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
13043 #endif
13044 #if CYTHON_USE_TYPE_SPECS
13045 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
13046 #if CYTHON_METH_FASTCALL
13047 #if CYTHON_BACKPORT_VECTORCALL
13048 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
13049 #else
13050 #if !CYTHON_COMPILING_IN_LIMITED_API
13051 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
13052 #endif
13053 #endif
13054 #endif
13055 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
13056 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
13057 #else
13058 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
13059 #endif
13060 #endif
13061 {0, 0, 0, 0, 0}
13062 };
13063 static PyObject *
13064 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
13065 {
13066 CYTHON_UNUSED_VAR(args);
13067 #if PY_MAJOR_VERSION >= 3
13068 Py_INCREF(m->func_qualname);
13069 return m->func_qualname;
13070 #else
13071 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
13072 #endif
13073 }
13074 static PyMethodDef __pyx_CyFunction_methods[] = {
13075 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
13076 {0, 0, 0, 0}
13077 };
13078 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
13079 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
13080 #else
13081 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
13082 #endif
13083 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
13084 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13085 #if !CYTHON_COMPILING_IN_LIMITED_API
13086 PyCFunctionObject *cf = (PyCFunctionObject*) op;
13087 #endif
13088 if (unlikely(op == NULL))
13089 return NULL;
13090 #if CYTHON_COMPILING_IN_LIMITED_API
13091 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
13092 if (unlikely(!op->func)) return NULL;
13093 #endif
13094 op->flags = flags;
13095 __Pyx_CyFunction_weakreflist(op) = NULL;
13096 #if !CYTHON_COMPILING_IN_LIMITED_API
13097 cf->m_ml = ml;
13098 cf->m_self = (PyObject *) op;
13099 #endif
13100 Py_XINCREF(closure);
13101 op->func_closure = closure;
13102 #if !CYTHON_COMPILING_IN_LIMITED_API
13103 Py_XINCREF(module);
13104 cf->m_module = module;
13105 #endif
13106 op->func_dict = NULL;
13107 op->func_name = NULL;
13108 Py_INCREF(qualname);
13109 op->func_qualname = qualname;
13110 op->func_doc = NULL;
13111 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
13112 op->func_classobj = NULL;
13113 #else
13114 ((PyCMethodObject*)op)->mm_class = NULL;
13115 #endif
13116 op->func_globals = globals;
13117 Py_INCREF(op->func_globals);
13118 Py_XINCREF(code);
13119 op->func_code = code;
13120 op->defaults_pyobjects = 0;
13121 op->defaults_size = 0;
13122 op->defaults = NULL;
13123 op->defaults_tuple = NULL;
13124 op->defaults_kwdict = NULL;
13125 op->defaults_getter = NULL;
13126 op->func_annotations = NULL;
13127 op->func_is_coroutine = NULL;
13128 #if CYTHON_METH_FASTCALL
13129 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
13130 case METH_NOARGS:
13131 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
13132 break;
13133 case METH_O:
13134 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
13135 break;
13136 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
13137 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
13138 break;
13139 case METH_FASTCALL | METH_KEYWORDS:
13140 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
13141 break;
13142 case METH_VARARGS | METH_KEYWORDS:
13143 __Pyx_CyFunction_func_vectorcall(op) = NULL;
13144 break;
13145 default:
13146 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
13147 Py_DECREF(op);
13148 return NULL;
13149 }
13150 #endif
13151 return (PyObject *) op;
13152 }
13153 static int
13154 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
13155 {
13156 Py_CLEAR(m->func_closure);
13157 #if CYTHON_COMPILING_IN_LIMITED_API
13158 Py_CLEAR(m->func);
13159 #else
13160 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
13161 #endif
13162 Py_CLEAR(m->func_dict);
13163 Py_CLEAR(m->func_name);
13164 Py_CLEAR(m->func_qualname);
13165 Py_CLEAR(m->func_doc);
13166 Py_CLEAR(m->func_globals);
13167 Py_CLEAR(m->func_code);
13168 #if !CYTHON_COMPILING_IN_LIMITED_API
13169 #if PY_VERSION_HEX < 0x030900B1
13170 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
13171 #else
13172 {
13173 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
13174 ((PyCMethodObject *) (m))->mm_class = NULL;
13175 Py_XDECREF(cls);
13176 }
13177 #endif
13178 #endif
13179 Py_CLEAR(m->defaults_tuple);
13180 Py_CLEAR(m->defaults_kwdict);
13181 Py_CLEAR(m->func_annotations);
13182 Py_CLEAR(m->func_is_coroutine);
13183 if (m->defaults) {
13184 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13185 int i;
13186 for (i = 0; i < m->defaults_pyobjects; i++)
13187 Py_XDECREF(pydefaults[i]);
13188 PyObject_Free(m->defaults);
13189 m->defaults = NULL;
13190 }
13191 return 0;
13192 }
13193 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
13194 {
13195 if (__Pyx_CyFunction_weakreflist(m) != NULL)
13196 PyObject_ClearWeakRefs((PyObject *) m);
13197 __Pyx_CyFunction_clear(m);
13198 __Pyx_PyHeapTypeObject_GC_Del(m);
13199 }
13200 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13201 {
13202 PyObject_GC_UnTrack(m);
13203 __Pyx__CyFunction_dealloc(m);
13204 }
13205 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13206 {
13207 Py_VISIT(m->func_closure);
13208 #if CYTHON_COMPILING_IN_LIMITED_API
13209 Py_VISIT(m->func);
13210 #else
13211 Py_VISIT(((PyCFunctionObject*)m)->m_module);
13212 #endif
13213 Py_VISIT(m->func_dict);
13214 Py_VISIT(m->func_name);
13215 Py_VISIT(m->func_qualname);
13216 Py_VISIT(m->func_doc);
13217 Py_VISIT(m->func_globals);
13218 Py_VISIT(m->func_code);
13219 #if !CYTHON_COMPILING_IN_LIMITED_API
13220 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
13221 #endif
13222 Py_VISIT(m->defaults_tuple);
13223 Py_VISIT(m->defaults_kwdict);
13224 Py_VISIT(m->func_is_coroutine);
13225 if (m->defaults) {
13226 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13227 int i;
13228 for (i = 0; i < m->defaults_pyobjects; i++)
13229 Py_VISIT(pydefaults[i]);
13230 }
13231 return 0;
13232 }
13233 static PyObject*
13234 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13235 {
13236 #if PY_MAJOR_VERSION >= 3
13237 return PyUnicode_FromFormat("<cyfunction %U at %p>",
13238 op->func_qualname, (void *)op);
13239 #else
13240 return PyString_FromFormat("<cyfunction %s at %p>",
13241 PyString_AsString(op->func_qualname), (void *)op);
13242 #endif
13243 }
13244 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
13245 #if CYTHON_COMPILING_IN_LIMITED_API
13246 PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
13247 PyObject *py_name = NULL;
13248 PyCFunction meth;
13249 int flags;
13250 meth = PyCFunction_GetFunction(f);
13251 if (unlikely(!meth)) return NULL;
13252 flags = PyCFunction_GetFlags(f);
13253 if (unlikely(flags < 0)) return NULL;
13254 #else
13255 PyCFunctionObject* f = (PyCFunctionObject*)func;
13256 PyCFunction meth = f->m_ml->ml_meth;
13257 int flags = f->m_ml->ml_flags;
13258 #endif
13259 Py_ssize_t size;
13260 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
13261 case METH_VARARGS:
13262 if (likely(kw == NULL || PyDict_Size(kw) == 0))
13263 return (*meth)(self, arg);
13264 break;
13265 case METH_VARARGS | METH_KEYWORDS:
13266 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
13267 case METH_NOARGS:
13268 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13269 #if CYTHON_ASSUME_SAFE_MACROS
13270 size = PyTuple_GET_SIZE(arg);
13271 #else
13272 size = PyTuple_Size(arg);
13273 if (unlikely(size < 0)) return NULL;
13274 #endif
13275 if (likely(size == 0))
13276 return (*meth)(self, NULL);
13277 #if CYTHON_COMPILING_IN_LIMITED_API
13278 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
13279 if (!py_name) return NULL;
13280 PyErr_Format(PyExc_TypeError,
13281 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13282 py_name, size);
13283 Py_DECREF(py_name);
13284 #else
13285 PyErr_Format(PyExc_TypeError,
13286 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13287 f->m_ml->ml_name, size);
13288 #endif
13289 return NULL;
13290 }
13291 break;
13292 case METH_O:
13293 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
13294 #if CYTHON_ASSUME_SAFE_MACROS
13295 size = PyTuple_GET_SIZE(arg);
13296 #else
13297 size = PyTuple_Size(arg);
13298 if (unlikely(size < 0)) return NULL;
13299 #endif
13300 if (likely(size == 1)) {
13301 PyObject *result, *arg0;
13302 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13303 arg0 = PyTuple_GET_ITEM(arg, 0);
13304 #else
13305 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
13306 #endif
13307 result = (*meth)(self, arg0);
13308 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
13309 Py_DECREF(arg0);
13310 #endif
13311 return result;
13312 }
13313 #if CYTHON_COMPILING_IN_LIMITED_API
13314 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
13315 if (!py_name) return NULL;
13316 PyErr_Format(PyExc_TypeError,
13317 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13318 py_name, size);
13319 Py_DECREF(py_name);
13320 #else
13321 PyErr_Format(PyExc_TypeError,
13322 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13323 f->m_ml->ml_name, size);
13324 #endif
13325 return NULL;
13326 }
13327 break;
13328 default:
13329 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
13330 return NULL;
13331 }
13332 #if CYTHON_COMPILING_IN_LIMITED_API
13333 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
13334 if (!py_name) return NULL;
13335 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
13336 py_name);
13337 Py_DECREF(py_name);
13338 #else
13339 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13340 f->m_ml->ml_name);
13341 #endif
13342 return NULL;
13343 }
13344 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13345 PyObject *self, *result;
13346 #if CYTHON_COMPILING_IN_LIMITED_API
13347 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
13348 if (unlikely(!self) && PyErr_Occurred()) return NULL;
13349 #else
13350 self = ((PyCFunctionObject*)func)->m_self;
13351 #endif
13352 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
13353 return result;
13354 }
13355 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
13356 PyObject *result;
13357 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
13358 #if CYTHON_METH_FASTCALL
13359 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
13360 if (vc) {
13361 #if CYTHON_ASSUME_SAFE_MACROS
13362 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
13363 #else
13364 (void) &__Pyx_PyVectorcall_FastCallDict;
13365 return PyVectorcall_Call(func, args, kw);
13366 #endif
13367 }
13368 #endif
13369 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13370 Py_ssize_t argc;
13371 PyObject *new_args;
13372 PyObject *self;
13373 #if CYTHON_ASSUME_SAFE_MACROS
13374 argc = PyTuple_GET_SIZE(args);
13375 #else
13376 argc = PyTuple_Size(args);
13377 if (unlikely(!argc) < 0) return NULL;
13378 #endif
13379 new_args = PyTuple_GetSlice(args, 1, argc);
13380 if (unlikely(!new_args))
13381 return NULL;
13382 self = PyTuple_GetItem(args, 0);
13383 if (unlikely(!self)) {
13384 Py_DECREF(new_args);
13385 #if PY_MAJOR_VERSION > 2
13386 PyErr_Format(PyExc_TypeError,
13387 "unbound method %.200S() needs an argument",
13388 cyfunc->func_qualname);
13389 #else
13390 PyErr_SetString(PyExc_TypeError,
13391 "unbound method needs an argument");
13392 #endif
13393 return NULL;
13394 }
13395 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
13396 Py_DECREF(new_args);
13397 } else {
13398 result = __Pyx_CyFunction_Call(func, args, kw);
13399 }
13400 return result;
13401 }
13402 #if CYTHON_METH_FASTCALL
13403 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
13404 {
13405 int ret = 0;
13406 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
13407 if (unlikely(nargs < 1)) {
13408 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
13409 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
13410 return -1;
13411 }
13412 ret = 1;
13413 }
13414 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
13415 PyErr_Format(PyExc_TypeError,
13416 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
13417 return -1;
13418 }
13419 return ret;
13420 }
13421 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13422 {
13423 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13424 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13425 #if CYTHON_BACKPORT_VECTORCALL
13426 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13427 #else
13428 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13429 #endif
13430 PyObject *self;
13431 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
13432 case 1:
13433 self = args[0];
13434 args += 1;
13435 nargs -= 1;
13436 break;
13437 case 0:
13438 self = ((PyCFunctionObject*)cyfunc)->m_self;
13439 break;
13440 default:
13441 return NULL;
13442 }
13443 if (unlikely(nargs != 0)) {
13444 PyErr_Format(PyExc_TypeError,
13445 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
13446 def->ml_name, nargs);
13447 return NULL;
13448 }
13449 return def->ml_meth(self, NULL);
13450 }
13451 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13452 {
13453 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13454 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13455 #if CYTHON_BACKPORT_VECTORCALL
13456 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13457 #else
13458 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13459 #endif
13460 PyObject *self;
13461 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
13462 case 1:
13463 self = args[0];
13464 args += 1;
13465 nargs -= 1;
13466 break;
13467 case 0:
13468 self = ((PyCFunctionObject*)cyfunc)->m_self;
13469 break;
13470 default:
13471 return NULL;
13472 }
13473 if (unlikely(nargs != 1)) {
13474 PyErr_Format(PyExc_TypeError,
13475 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
13476 def->ml_name, nargs);
13477 return NULL;
13478 }
13479 return def->ml_meth(self, args[0]);
13480 }
13481 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13482 {
13483 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13484 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13485 #if CYTHON_BACKPORT_VECTORCALL
13486 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13487 #else
13488 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13489 #endif
13490 PyObject *self;
13491 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
13492 case 1:
13493 self = args[0];
13494 args += 1;
13495 nargs -= 1;
13496 break;
13497 case 0:
13498 self = ((PyCFunctionObject*)cyfunc)->m_self;
13499 break;
13500 default:
13501 return NULL;
13502 }
13503 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
13504 }
13505 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
13506 {
13507 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
13508 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
13509 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
13510 #if CYTHON_BACKPORT_VECTORCALL
13511 Py_ssize_t nargs = (Py_ssize_t)nargsf;
13512 #else
13513 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
13514 #endif
13515 PyObject *self;
13516 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
13517 case 1:
13518 self = args[0];
13519 args += 1;
13520 nargs -= 1;
13521 break;
13522 case 0:
13523 self = ((PyCFunctionObject*)cyfunc)->m_self;
13524 break;
13525 default:
13526 return NULL;
13527 }
13528 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
13529 }
13530 #endif
13531 #if CYTHON_USE_TYPE_SPECS
13532 static PyType_Slot __pyx_CyFunctionType_slots[] = {
13533 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
13534 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
13535 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
13536 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
13537 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
13538 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
13539 {Py_tp_members, (void *)__pyx_CyFunction_members},
13540 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
13541 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
13542 {0, 0},
13543 };
13544 static PyType_Spec __pyx_CyFunctionType_spec = {
13545 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
13546 sizeof(__pyx_CyFunctionObject),
13547 0,
13548 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
13549 Py_TPFLAGS_METHOD_DESCRIPTOR |
13550 #endif
13551 #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
13552 _Py_TPFLAGS_HAVE_VECTORCALL |
13553 #endif
13554 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
13555 __pyx_CyFunctionType_slots
13556 };
13557 #else
13558 static PyTypeObject __pyx_CyFunctionType_type = {
13559 PyVarObject_HEAD_INIT(0, 0)
13560 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
13561 sizeof(__pyx_CyFunctionObject),
13562 0,
13563 (destructor) __Pyx_CyFunction_dealloc,
13564 #if !CYTHON_METH_FASTCALL
13565 0,
13566 #elif CYTHON_BACKPORT_VECTORCALL
13567 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
13568 #else
13569 offsetof(PyCFunctionObject, vectorcall),
13570 #endif
13571 0,
13572 0,
13573 #if PY_MAJOR_VERSION < 3
13574 0,
13575 #else
13576 0,
13577 #endif
13578 (reprfunc) __Pyx_CyFunction_repr,
13579 0,
13580 0,
13581 0,
13582 0,
13583 __Pyx_CyFunction_CallAsMethod,
13584 0,
13585 0,
13586 0,
13587 0,
13588 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
13589 Py_TPFLAGS_METHOD_DESCRIPTOR |
13590 #endif
13591 #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
13592 _Py_TPFLAGS_HAVE_VECTORCALL |
13593 #endif
13594 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
13595 0,
13596 (traverseproc) __Pyx_CyFunction_traverse,
13597 (inquiry) __Pyx_CyFunction_clear,
13598 0,
13599 #if PY_VERSION_HEX < 0x030500A0
13600 offsetof(__pyx_CyFunctionObject, func_weakreflist),
13601 #else
13602 offsetof(PyCFunctionObject, m_weakreflist),
13603 #endif
13604 0,
13605 0,
13606 __pyx_CyFunction_methods,
13607 __pyx_CyFunction_members,
13608 __pyx_CyFunction_getsets,
13609 0,
13610 0,
13611 __Pyx_PyMethod_New,
13612 0,
13613 offsetof(__pyx_CyFunctionObject, func_dict),
13614 0,
13615 0,
13616 0,
13617 0,
13618 0,
13619 0,
13620 0,
13621 0,
13622 0,
13623 0,
13624 0,
13625 0,
13626 #if PY_VERSION_HEX >= 0x030400a1
13627 0,
13628 #endif
13629 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
13630 0,
13631 #endif
13632 #if __PYX_NEED_TP_PRINT_SLOT
13633 0,
13634 #endif
13635 #if PY_VERSION_HEX >= 0x030C0000
13636 0,
13637 #endif
13638 #if PY_VERSION_HEX >= 0x030d00A4
13639 0,
13640 #endif
13641 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
13642 0,
13643 #endif
13644 };
13645 #endif
13646 static int __pyx_CyFunction_init(PyObject *module) {
13647 #if CYTHON_USE_TYPE_SPECS
13648 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
13649 #else
13650 CYTHON_UNUSED_VAR(module);
13651 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
13652 #endif
13653 if (unlikely(__pyx_CyFunctionType == NULL)) {
13654 return -1;
13655 }
13656 return 0;
13657 }
13658 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
13659 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13660 m->defaults = PyObject_Malloc(size);
13661 if (unlikely(!m->defaults))
13662 return PyErr_NoMemory();
13663 memset(m->defaults, 0, size);
13664 m->defaults_pyobjects = pyobjects;
13665 m->defaults_size = size;
13666 return m->defaults;
13667 }
13668 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13669 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13670 m->defaults_tuple = tuple;
13671 Py_INCREF(tuple);
13672 }
13673 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
13674 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13675 m->defaults_kwdict = dict;
13676 Py_INCREF(dict);
13677 }
13678 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
13679 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13680 m->func_annotations = dict;
13681 Py_INCREF(dict);
13682 }
13683
13684 /* CythonFunction */
13685 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
13686 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13687 PyObject *op = __Pyx_CyFunction_Init(
13688 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
13689 ml, flags, qualname, closure, module, globals, code
13690 );
13691 if (likely(op)) {
13692 PyObject_GC_Track(op);
13693 }
13694 return op;
13695 }
13696
13697 /* CLineInTraceback */
13698 #ifndef CYTHON_CLINE_IN_TRACEBACK
13699 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
13700 PyObject *use_cline;
13701 PyObject *ptype, *pvalue, *ptraceback;
13702 #if CYTHON_COMPILING_IN_CPYTHON
13703 PyObject **cython_runtime_dict;
13704 #endif
13705 CYTHON_MAYBE_UNUSED_VAR(tstate);
13706 if (unlikely(!__pyx_cython_runtime)) {
13707 return c_line;
13708 }
13709 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13710 #if CYTHON_COMPILING_IN_CPYTHON
13711 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13712 if (likely(cython_runtime_dict)) {
13713 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13714 use_cline, *cython_runtime_dict,
13715 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13716 } else
13717 #endif
13718 {
13719 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13720 if (use_cline_obj) {
13721 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13722 Py_DECREF(use_cline_obj);
13723 } else {
13724 PyErr_Clear();
13725 use_cline = NULL;
13726 }
13727 }
13728 if (!use_cline) {
13729 c_line = 0;
13730 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13731 }
13732 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13733 c_line = 0;
13734 }
13735 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13736 return c_line;
13737 }
13738 #endif
13739
13740 /* CodeObjectCache */
13741 #if !CYTHON_COMPILING_IN_LIMITED_API
13742 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13743 int start = 0, mid = 0, end = count - 1;
13744 if (end >= 0 && code_line > entries[end].code_line) {
13745 return count;
13746 }
13747 while (start < end) {
13748 mid = start + (end - start) / 2;
13749 if (code_line < entries[mid].code_line) {
13750 end = mid;
13751 } else if (code_line > entries[mid].code_line) {
13752 start = mid + 1;
13753 } else {
13754 return mid;
13755 }
13756 }
13757 if (code_line <= entries[mid].code_line) {
13758 return mid;
13759 } else {
13760 return mid + 1;
13761 }
13762 }
13763 static PyCodeObject *__pyx_find_code_object(int code_line) {
13764 PyCodeObject* code_object;
13765 int pos;
13766 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13767 return NULL;
13768 }
13769 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13770 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13771 return NULL;
13772 }
13773 code_object = __pyx_code_cache.entries[pos].code_object;
13774 Py_INCREF(code_object);
13775 return code_object;
13776 }
13777 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13778 int pos, i;
13779 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13780 if (unlikely(!code_line)) {
13781 return;
13782 }
13783 if (unlikely(!entries)) {
13784 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13785 if (likely(entries)) {
13786 __pyx_code_cache.entries = entries;
13787 __pyx_code_cache.max_count = 64;
13788 __pyx_code_cache.count = 1;
13789 entries[0].code_line = code_line;
13790 entries[0].code_object = code_object;
13791 Py_INCREF(code_object);
13792 }
13793 return;
13794 }
13795 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13796 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13797 PyCodeObject* tmp = entries[pos].code_object;
13798 entries[pos].code_object = code_object;
13799 Py_DECREF(tmp);
13800 return;
13801 }
13802 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13803 int new_max = __pyx_code_cache.max_count + 64;
13804 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13805 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
13806 if (unlikely(!entries)) {
13807 return;
13808 }
13809 __pyx_code_cache.entries = entries;
13810 __pyx_code_cache.max_count = new_max;
13811 }
13812 for (i=__pyx_code_cache.count; i>pos; i--) {
13813 entries[i] = entries[i-1];
13814 }
13815 entries[pos].code_line = code_line;
13816 entries[pos].code_object = code_object;
13817 __pyx_code_cache.count++;
13818 Py_INCREF(code_object);
13819 }
13820 #endif
13821
13822 /* AddTraceback */
13823 #include "compile.h"
13824 #include "frameobject.h"
13825 #include "traceback.h"
13826 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
13827 #ifndef Py_BUILD_CORE
13828 #define Py_BUILD_CORE 1
13829 #endif
13830 #include "internal/pycore_frame.h"
13831 #endif
13832 #if CYTHON_COMPILING_IN_LIMITED_API
13833 static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
13834 PyObject *firstlineno, PyObject *name) {
13835 PyObject *replace = NULL;
13836 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
13837 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
13838 replace = PyObject_GetAttrString(code, "replace");
13839 if (likely(replace)) {
13840 PyObject *result;
13841 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
13842 Py_DECREF(replace);
13843 return result;
13844 }
13845 PyErr_Clear();
13846 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
13847 {
13848 PyObject *compiled = NULL, *result = NULL;
13849 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
13850 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
13851 compiled = Py_CompileString(
13852 "out = type(code)(\n"
13853 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
13854 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
13855 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
13856 " code.co_lnotab)\n", "<dummy>", Py_file_input);
13857 if (!compiled) return NULL;
13858 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
13859 Py_DECREF(compiled);
13860 if (!result) PyErr_Print();
13861 Py_DECREF(result);
13862 result = PyDict_GetItemString(scratch_dict, "out");
13863 if (result) Py_INCREF(result);
13864 return result;
13865 }
13866 #else
13867 return NULL;
13868 #endif
13869 }
13870 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13871 int py_line, const char *filename) {
13872 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
13873 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
13874 PyObject *exc_type, *exc_value, *exc_traceback;
13875 int success = 0;
13876 if (c_line) {
13877 (void) __pyx_cfilenm;
13878 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
13879 }
13880 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
13881 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
13882 if (unlikely(!code_object)) goto bad;
13883 py_py_line = PyLong_FromLong(py_line);
13884 if (unlikely(!py_py_line)) goto bad;
13885 py_funcname = PyUnicode_FromString(funcname);
13886 if (unlikely(!py_funcname)) goto bad;
13887 dict = PyDict_New();
13888 if (unlikely(!dict)) goto bad;
13889 {
13890 PyObject *old_code_object = code_object;
13891 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
13892 Py_DECREF(old_code_object);
13893 }
13894 if (unlikely(!code_object)) goto bad;
13895 getframe = PySys_GetObject("_getframe");
13896 if (unlikely(!getframe)) goto bad;
13897 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
13898 frame = PyEval_EvalCode(code_object, dict, dict);
13899 if (unlikely(!frame) || frame == Py_None) goto bad;
13900 success = 1;
13901 bad:
13902 PyErr_Restore(exc_type, exc_value, exc_traceback);
13903 Py_XDECREF(code_object);
13904 Py_XDECREF(py_py_line);
13905 Py_XDECREF(py_funcname);
13906 Py_XDECREF(dict);
13907 Py_XDECREF(replace);
13908 if (success) {
13909 PyTraceBack_Here(
13910 (struct _frame*)frame);
13911 }
13912 Py_XDECREF(frame);
13913 }
13914 #else
13915 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13916 const char *funcname, int c_line,
13917 int py_line, const char *filename) {
13918 PyCodeObject *py_code = NULL;
13919 PyObject *py_funcname = NULL;
13920 #if PY_MAJOR_VERSION < 3
13921 PyObject *py_srcfile = NULL;
13922 py_srcfile = PyString_FromString(filename);
13923 if (!py_srcfile) goto bad;
13924 #endif
13925 if (c_line) {
13926 #if PY_MAJOR_VERSION < 3
13927 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13928 if (!py_funcname) goto bad;
13929 #else
13930 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13931 if (!py_funcname) goto bad;
13932 funcname = PyUnicode_AsUTF8(py_funcname);
13933 if (!funcname) goto bad;
13934 #endif
13935 }
13936 else {
13937 #if PY_MAJOR_VERSION < 3
13938 py_funcname = PyString_FromString(funcname);
13939 if (!py_funcname) goto bad;
13940 #endif
13941 }
13942 #if PY_MAJOR_VERSION < 3
13943 py_code = __Pyx_PyCode_New(
13944 0,
13945 0,
13946 0,
13947 0,
13948 0,
13949 0,
13950 __pyx_empty_bytes, /*PyObject *code,*/
13951 __pyx_empty_tuple, /*PyObject *consts,*/
13952 __pyx_empty_tuple, /*PyObject *names,*/
13953 __pyx_empty_tuple, /*PyObject *varnames,*/
13954 __pyx_empty_tuple, /*PyObject *freevars,*/
13955 __pyx_empty_tuple, /*PyObject *cellvars,*/
13956 py_srcfile, /*PyObject *filename,*/
13957 py_funcname, /*PyObject *name,*/
13958 py_line,
13959 __pyx_empty_bytes /*PyObject *lnotab*/
13960 );
13961 Py_DECREF(py_srcfile);
13962 #else
13963 py_code = PyCode_NewEmpty(filename, funcname, py_line);
13964 #endif
13965 Py_XDECREF(py_funcname);
13966 return py_code;
13967 bad:
13968 Py_XDECREF(py_funcname);
13969 #if PY_MAJOR_VERSION < 3
13970 Py_XDECREF(py_srcfile);
13971 #endif
13972 return NULL;
13973 }
13974 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13975 int py_line, const char *filename) {
13976 PyCodeObject *py_code = 0;
13977 PyFrameObject *py_frame = 0;
13978 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13979 PyObject *ptype, *pvalue, *ptraceback;
13980 if (c_line) {
13981 c_line = __Pyx_CLineForTraceback(tstate, c_line);
13982 }
13983 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13984 if (!py_code) {
13985 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13986 py_code = __Pyx_CreateCodeObjectForTraceback(
13987 funcname, c_line, py_line, filename);
13988 if (!py_code) {
13989 /* If the code object creation fails, then we should clear the
13990 fetched exception references and propagate the new exception */
13991 Py_XDECREF(ptype);
13992 Py_XDECREF(pvalue);
13993 Py_XDECREF(ptraceback);
13994 goto bad;
13995 }
13996 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13997 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13998 }
13999 py_frame = PyFrame_New(
14000 tstate, /*PyThreadState *tstate,*/
14001 py_code, /*PyCodeObject *code,*/
14002 __pyx_d, /*PyObject *globals,*/
14003 0 /*PyObject *locals*/
14004 );
14005 if (!py_frame) goto bad;
14006 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14007 PyTraceBack_Here(py_frame);
14008 bad:
14009 Py_XDECREF(py_code);
14010 Py_XDECREF(py_frame);
14011 }
14012 #endif
14013
14014 /* CIntFromPyVerify */
14015 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
14016 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
14017 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
14018 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
14019 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
14020 {\
14021 func_type value = func_value;\
14022 if (sizeof(target_type) < sizeof(func_type)) {\
14023 if (unlikely(value != (func_type) (target_type) value)) {\
14024 func_type zero = 0;\
14025 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
14026 return (target_type) -1;\
14027 if (is_unsigned && unlikely(value < zero))\
14028 goto raise_neg_overflow;\
14029 else\
14030 goto raise_overflow;\
14031 }\
14032 }\
14033 return (target_type) value;\
14034 }
14035
14036 /* CIntToPy */
14037 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
14038 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14039 #pragma GCC diagnostic push
14040 #pragma GCC diagnostic ignored "-Wconversion"
14041 #endif
14042 const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
14043 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14044 #pragma GCC diagnostic pop
14045 #endif
14046 const int is_unsigned = neg_one > const_zero;
14047 if (is_unsigned) {
14048 if (sizeof(unsigned int) < sizeof(long)) {
14049 return PyInt_FromLong((long) value);
14050 } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
14051 return PyLong_FromUnsignedLong((unsigned long) value);
14052 #ifdef HAVE_LONG_LONG
14053 } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
14054 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14055 #endif
14056 }
14057 } else {
14058 if (sizeof(unsigned int) <= sizeof(long)) {
14059 return PyInt_FromLong((long) value);
14060 #ifdef HAVE_LONG_LONG
14061 } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
14062 return PyLong_FromLongLong((PY_LONG_LONG) value);
14063 #endif
14064 }
14065 }
14066 {
14067 unsigned char *bytes = (unsigned char *)&value;
14068 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
14069 if (is_unsigned) {
14070 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
14071 } else {
14072 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
14073 }
14074 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
14075 int one = 1; int little = (int)*(unsigned char *)&one;
14076 return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
14077 little, !is_unsigned);
14078 #else
14079 int one = 1; int little = (int)*(unsigned char *)&one;
14080 PyObject *from_bytes, *result = NULL;
14081 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
14082 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
14083 if (!from_bytes) return NULL;
14084 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(unsigned int));
14085 if (!py_bytes) goto limited_bad;
14086 order_str = PyUnicode_FromString(little ? "little" : "big");
14087 if (!order_str) goto limited_bad;
14088 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
14089 if (!arg_tuple) goto limited_bad;
14090 if (!is_unsigned) {
14091 kwds = PyDict_New();
14092 if (!kwds) goto limited_bad;
14093 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
14094 }
14095 result = PyObject_Call(from_bytes, arg_tuple, kwds);
14096 limited_bad:
14097 Py_XDECREF(kwds);
14098 Py_XDECREF(arg_tuple);
14099 Py_XDECREF(order_str);
14100 Py_XDECREF(py_bytes);
14101 Py_XDECREF(from_bytes);
14102 return result;
14103 #endif
14104 }
14105 }
14106
14107 /* CIntFromPy */
14108 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
14109 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14110 #pragma GCC diagnostic push
14111 #pragma GCC diagnostic ignored "-Wconversion"
14112 #endif
14113 const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
14114 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14115 #pragma GCC diagnostic pop
14116 #endif
14117 const int is_unsigned = neg_one > const_zero;
14118 #if PY_MAJOR_VERSION < 3
14119 if (likely(PyInt_Check(x))) {
14120 if ((sizeof(size_t) < sizeof(long))) {
14121 __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
14122 } else {
14123 long val = PyInt_AS_LONG(x);
14124 if (is_unsigned && unlikely(val < 0)) {
14125 goto raise_neg_overflow;
14126 }
14127 return (size_t) val;
14128 }
14129 }
14130 #endif
14131 if (unlikely(!PyLong_Check(x))) {
14132 size_t val;
14133 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14134 if (!tmp) return (size_t) -1;
14135 val = __Pyx_PyInt_As_size_t(tmp);
14136 Py_DECREF(tmp);
14137 return val;
14138 }
14139 if (is_unsigned) {
14140 #if CYTHON_USE_PYLONG_INTERNALS
14141 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
14142 goto raise_neg_overflow;
14143 } else if (__Pyx_PyLong_IsCompact(x)) {
14144 __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
14145 } else {
14146 const digit* digits = __Pyx_PyLong_Digits(x);
14147 assert(__Pyx_PyLong_DigitCount(x) > 1);
14148 switch (__Pyx_PyLong_DigitCount(x)) {
14149 case 2:
14150 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
14151 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14152 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14153 } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) {
14154 return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14155 }
14156 }
14157 break;
14158 case 3:
14159 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
14160 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14161 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14162 } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) {
14163 return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14164 }
14165 }
14166 break;
14167 case 4:
14168 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
14169 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14170 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14171 } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) {
14172 return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
14173 }
14174 }
14175 break;
14176 }
14177 }
14178 #endif
14179 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
14180 if (unlikely(Py_SIZE(x) < 0)) {
14181 goto raise_neg_overflow;
14182 }
14183 #else
14184 {
14185 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14186 if (unlikely(result < 0))
14187 return (size_t) -1;
14188 if (unlikely(result == 1))
14189 goto raise_neg_overflow;
14190 }
14191 #endif
14192 if ((sizeof(size_t) <= sizeof(unsigned long))) {
14193 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
14194 #ifdef HAVE_LONG_LONG
14195 } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) {
14196 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14197 #endif
14198 }
14199 } else {
14200 #if CYTHON_USE_PYLONG_INTERNALS
14201 if (__Pyx_PyLong_IsCompact(x)) {
14202 __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
14203 } else {
14204 const digit* digits = __Pyx_PyLong_Digits(x);
14205 assert(__Pyx_PyLong_DigitCount(x) > 1);
14206 switch (__Pyx_PyLong_SignedDigitCount(x)) {
14207 case -2:
14208 if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) {
14209 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14210 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14211 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14212 return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14213 }
14214 }
14215 break;
14216 case 2:
14217 if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) {
14218 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14219 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14220 } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14221 return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14222 }
14223 }
14224 break;
14225 case -3:
14226 if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) {
14227 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14228 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14229 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14230 return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14231 }
14232 }
14233 break;
14234 case 3:
14235 if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) {
14236 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14237 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14238 } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14239 return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14240 }
14241 }
14242 break;
14243 case -4:
14244 if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) {
14245 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14246 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14247 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
14248 return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14249 }
14250 }
14251 break;
14252 case 4:
14253 if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) {
14254 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14255 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14256 } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) {
14257 return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
14258 }
14259 }
14260 break;
14261 }
14262 }
14263 #endif
14264 if ((sizeof(size_t) <= sizeof(long))) {
14265 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
14266 #ifdef HAVE_LONG_LONG
14267 } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) {
14268 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
14269 #endif
14270 }
14271 }
14272 {
14273 size_t val;
14274 int ret = -1;
14275 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
14276 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
14277 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
14278 if (unlikely(bytes_copied == -1)) {
14279 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
14280 goto raise_overflow;
14281 } else {
14282 ret = 0;
14283 }
14284 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
14285 int one = 1; int is_little = (int)*(unsigned char *)&one;
14286 unsigned char *bytes = (unsigned char *)&val;
14287 ret = _PyLong_AsByteArray((PyLongObject *)x,
14288 bytes, sizeof(val),
14289 is_little, !is_unsigned);
14290 #else
14291 PyObject *v;
14292 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
14293 int bits, remaining_bits, is_negative = 0;
14294 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
14295 if (likely(PyLong_CheckExact(x))) {
14296 v = __Pyx_NewRef(x);
14297 } else {
14298 v = PyNumber_Long(x);
14299 if (unlikely(!v)) return (size_t) -1;
14300 assert(PyLong_CheckExact(v));
14301 }
14302 {
14303 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
14304 if (unlikely(result < 0)) {
14305 Py_DECREF(v);
14306 return (size_t) -1;
14307 }
14308 is_negative = result == 1;
14309 }
14310 if (is_unsigned && unlikely(is_negative)) {
14311 Py_DECREF(v);
14312 goto raise_neg_overflow;
14313 } else if (is_negative) {
14314 stepval = PyNumber_Invert(v);
14315 Py_DECREF(v);
14316 if (unlikely(!stepval))
14317 return (size_t) -1;
14318 } else {
14319 stepval = v;
14320 }
14321 v = NULL;
14322 val = (size_t) 0;
14323 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
14324 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
14325 for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) {
14326 PyObject *tmp, *digit;
14327 long idigit;
14328 digit = PyNumber_And(stepval, mask);
14329 if (unlikely(!digit)) goto done;
14330 idigit = PyLong_AsLong(digit);
14331 Py_DECREF(digit);
14332 if (unlikely(idigit < 0)) goto done;
14333 val |= ((size_t) idigit) << bits;
14334 tmp = PyNumber_Rshift(stepval, shift);
14335 if (unlikely(!tmp)) goto done;
14336 Py_DECREF(stepval); stepval = tmp;
14337 }
14338 Py_DECREF(shift); shift = NULL;
14339 Py_DECREF(mask); mask = NULL;
14340 {
14341 long idigit = PyLong_AsLong(stepval);
14342 if (unlikely(idigit < 0)) goto done;
14343 remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1);
14344 if (unlikely(idigit >= (1L << remaining_bits)))
14345 goto raise_overflow;
14346 val |= ((size_t) idigit) << bits;
14347 }
14348 if (!is_unsigned) {
14349 if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1))))
14350 goto raise_overflow;
14351 if (is_negative)
14352 val = ~val;
14353 }
14354 ret = 0;
14355 done:
14356 Py_XDECREF(shift);
14357 Py_XDECREF(mask);
14358 Py_XDECREF(stepval);
14359 #endif
14360 if (unlikely(ret))
14361 return (size_t) -1;
14362 return val;
14363 }
14364 raise_overflow:
14365 PyErr_SetString(PyExc_OverflowError,
14366 "value too large to convert to size_t");
14367 return (size_t) -1;
14368 raise_neg_overflow:
14369 PyErr_SetString(PyExc_OverflowError,
14370 "can't convert negative value to size_t");
14371 return (size_t) -1;
14372 }
14373
14374 /* CIntToPy */
14375 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
14376 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14377 #pragma GCC diagnostic push
14378 #pragma GCC diagnostic ignored "-Wconversion"
14379 #endif
14380 const int neg_one = (int) -1, const_zero = (int) 0;
14381 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14382 #pragma GCC diagnostic pop
14383 #endif
14384 const int is_unsigned = neg_one > const_zero;
14385 if (is_unsigned) {
14386 if (sizeof(int) < sizeof(long)) {
14387 return PyInt_FromLong((long) value);
14388 } else if (sizeof(int) <= sizeof(unsigned long)) {
14389 return PyLong_FromUnsignedLong((unsigned long) value);
14390 #ifdef HAVE_LONG_LONG
14391 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
14392 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14393 #endif
14394 }
14395 } else {
14396 if (sizeof(int) <= sizeof(long)) {
14397 return PyInt_FromLong((long) value);
14398 #ifdef HAVE_LONG_LONG
14399 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
14400 return PyLong_FromLongLong((PY_LONG_LONG) value);
14401 #endif
14402 }
14403 }
14404 {
14405 unsigned char *bytes = (unsigned char *)&value;
14406 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
14407 if (is_unsigned) {
14408 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
14409 } else {
14410 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
14411 }
14412 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
14413 int one = 1; int little = (int)*(unsigned char *)&one;
14414 return _PyLong_FromByteArray(bytes, sizeof(int),
14415 little, !is_unsigned);
14416 #else
14417 int one = 1; int little = (int)*(unsigned char *)&one;
14418 PyObject *from_bytes, *result = NULL;
14419 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
14420 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
14421 if (!from_bytes) return NULL;
14422 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
14423 if (!py_bytes) goto limited_bad;
14424 order_str = PyUnicode_FromString(little ? "little" : "big");
14425 if (!order_str) goto limited_bad;
14426 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
14427 if (!arg_tuple) goto limited_bad;
14428 if (!is_unsigned) {
14429 kwds = PyDict_New();
14430 if (!kwds) goto limited_bad;
14431 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
14432 }
14433 result = PyObject_Call(from_bytes, arg_tuple, kwds);
14434 limited_bad:
14435 Py_XDECREF(kwds);
14436 Py_XDECREF(arg_tuple);
14437 Py_XDECREF(order_str);
14438 Py_XDECREF(py_bytes);
14439 Py_XDECREF(from_bytes);
14440 return result;
14441 #endif
14442 }
14443 }
14444
14445 /* CIntToPy */
14446 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
14447 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14448 #pragma GCC diagnostic push
14449 #pragma GCC diagnostic ignored "-Wconversion"
14450 #endif
14451 const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
14452 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14453 #pragma GCC diagnostic pop
14454 #endif
14455 const int is_unsigned = neg_one > const_zero;
14456 if (is_unsigned) {
14457 if (sizeof(int64_t) < sizeof(long)) {
14458 return PyInt_FromLong((long) value);
14459 } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
14460 return PyLong_FromUnsignedLong((unsigned long) value);
14461 #ifdef HAVE_LONG_LONG
14462 } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
14463 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14464 #endif
14465 }
14466 } else {
14467 if (sizeof(int64_t) <= sizeof(long)) {
14468 return PyInt_FromLong((long) value);
14469 #ifdef HAVE_LONG_LONG
14470 } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
14471 return PyLong_FromLongLong((PY_LONG_LONG) value);
14472 #endif
14473 }
14474 }
14475 {
14476 unsigned char *bytes = (unsigned char *)&value;
14477 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
14478 if (is_unsigned) {
14479 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
14480 } else {
14481 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
14482 }
14483 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
14484 int one = 1; int little = (int)*(unsigned char *)&one;
14485 return _PyLong_FromByteArray(bytes, sizeof(int64_t),
14486 little, !is_unsigned);
14487 #else
14488 int one = 1; int little = (int)*(unsigned char *)&one;
14489 PyObject *from_bytes, *result = NULL;
14490 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
14491 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
14492 if (!from_bytes) return NULL;
14493 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int64_t));
14494 if (!py_bytes) goto limited_bad;
14495 order_str = PyUnicode_FromString(little ? "little" : "big");
14496 if (!order_str) goto limited_bad;
14497 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
14498 if (!arg_tuple) goto limited_bad;
14499 if (!is_unsigned) {
14500 kwds = PyDict_New();
14501 if (!kwds) goto limited_bad;
14502 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
14503 }
14504 result = PyObject_Call(from_bytes, arg_tuple, kwds);
14505 limited_bad:
14506 Py_XDECREF(kwds);
14507 Py_XDECREF(arg_tuple);
14508 Py_XDECREF(order_str);
14509 Py_XDECREF(py_bytes);
14510 Py_XDECREF(from_bytes);
14511 return result;
14512 #endif
14513 }
14514 }
14515
14516 /* CIntFromPy */
14517 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
14518 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14519 #pragma GCC diagnostic push
14520 #pragma GCC diagnostic ignored "-Wconversion"
14521 #endif
14522 const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
14523 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14524 #pragma GCC diagnostic pop
14525 #endif
14526 const int is_unsigned = neg_one > const_zero;
14527 #if PY_MAJOR_VERSION < 3
14528 if (likely(PyInt_Check(x))) {
14529 if ((sizeof(int64_t) < sizeof(long))) {
14530 __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
14531 } else {
14532 long val = PyInt_AS_LONG(x);
14533 if (is_unsigned && unlikely(val < 0)) {
14534 goto raise_neg_overflow;
14535 }
14536 return (int64_t) val;
14537 }
14538 }
14539 #endif
14540 if (unlikely(!PyLong_Check(x))) {
14541 int64_t val;
14542 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14543 if (!tmp) return (int64_t) -1;
14544 val = __Pyx_PyInt_As_int64_t(tmp);
14545 Py_DECREF(tmp);
14546 return val;
14547 }
14548 if (is_unsigned) {
14549 #if CYTHON_USE_PYLONG_INTERNALS
14550 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
14551 goto raise_neg_overflow;
14552 } else if (__Pyx_PyLong_IsCompact(x)) {
14553 __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
14554 } else {
14555 const digit* digits = __Pyx_PyLong_Digits(x);
14556 assert(__Pyx_PyLong_DigitCount(x) > 1);
14557 switch (__Pyx_PyLong_DigitCount(x)) {
14558 case 2:
14559 if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
14560 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14561 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14562 } else if ((8 * sizeof(int64_t) >= 2 * PyLong_SHIFT)) {
14563 return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
14564 }
14565 }
14566 break;
14567 case 3:
14568 if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
14569 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14570 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14571 } else if ((8 * sizeof(int64_t) >= 3 * PyLong_SHIFT)) {
14572 return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
14573 }
14574 }
14575 break;
14576 case 4:
14577 if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
14578 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14579 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14580 } else if ((8 * sizeof(int64_t) >= 4 * PyLong_SHIFT)) {
14581 return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
14582 }
14583 }
14584 break;
14585 }
14586 }
14587 #endif
14588 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
14589 if (unlikely(Py_SIZE(x) < 0)) {
14590 goto raise_neg_overflow;
14591 }
14592 #else
14593 {
14594 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14595 if (unlikely(result < 0))
14596 return (int64_t) -1;
14597 if (unlikely(result == 1))
14598 goto raise_neg_overflow;
14599 }
14600 #endif
14601 if ((sizeof(int64_t) <= sizeof(unsigned long))) {
14602 __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
14603 #ifdef HAVE_LONG_LONG
14604 } else if ((sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG))) {
14605 __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14606 #endif
14607 }
14608 } else {
14609 #if CYTHON_USE_PYLONG_INTERNALS
14610 if (__Pyx_PyLong_IsCompact(x)) {
14611 __PYX_VERIFY_RETURN_INT(int64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
14612 } else {
14613 const digit* digits = __Pyx_PyLong_Digits(x);
14614 assert(__Pyx_PyLong_DigitCount(x) > 1);
14615 switch (__Pyx_PyLong_SignedDigitCount(x)) {
14616 case -2:
14617 if ((8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT)) {
14618 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14619 __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14620 } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
14621 return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14622 }
14623 }
14624 break;
14625 case 2:
14626 if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
14627 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14628 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14629 } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
14630 return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14631 }
14632 }
14633 break;
14634 case -3:
14635 if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
14636 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14637 __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14638 } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
14639 return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14640 }
14641 }
14642 break;
14643 case 3:
14644 if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
14645 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14646 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14647 } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
14648 return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14649 }
14650 }
14651 break;
14652 case -4:
14653 if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
14654 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14655 __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14656 } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
14657 return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14658 }
14659 }
14660 break;
14661 case 4:
14662 if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
14663 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14664 __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14665 } else if ((8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT)) {
14666 return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
14667 }
14668 }
14669 break;
14670 }
14671 }
14672 #endif
14673 if ((sizeof(int64_t) <= sizeof(long))) {
14674 __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
14675 #ifdef HAVE_LONG_LONG
14676 } else if ((sizeof(int64_t) <= sizeof(PY_LONG_LONG))) {
14677 __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
14678 #endif
14679 }
14680 }
14681 {
14682 int64_t val;
14683 int ret = -1;
14684 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
14685 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
14686 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
14687 if (unlikely(bytes_copied == -1)) {
14688 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
14689 goto raise_overflow;
14690 } else {
14691 ret = 0;
14692 }
14693 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
14694 int one = 1; int is_little = (int)*(unsigned char *)&one;
14695 unsigned char *bytes = (unsigned char *)&val;
14696 ret = _PyLong_AsByteArray((PyLongObject *)x,
14697 bytes, sizeof(val),
14698 is_little, !is_unsigned);
14699 #else
14700 PyObject *v;
14701 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
14702 int bits, remaining_bits, is_negative = 0;
14703 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
14704 if (likely(PyLong_CheckExact(x))) {
14705 v = __Pyx_NewRef(x);
14706 } else {
14707 v = PyNumber_Long(x);
14708 if (unlikely(!v)) return (int64_t) -1;
14709 assert(PyLong_CheckExact(v));
14710 }
14711 {
14712 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
14713 if (unlikely(result < 0)) {
14714 Py_DECREF(v);
14715 return (int64_t) -1;
14716 }
14717 is_negative = result == 1;
14718 }
14719 if (is_unsigned && unlikely(is_negative)) {
14720 Py_DECREF(v);
14721 goto raise_neg_overflow;
14722 } else if (is_negative) {
14723 stepval = PyNumber_Invert(v);
14724 Py_DECREF(v);
14725 if (unlikely(!stepval))
14726 return (int64_t) -1;
14727 } else {
14728 stepval = v;
14729 }
14730 v = NULL;
14731 val = (int64_t) 0;
14732 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
14733 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
14734 for (bits = 0; bits < (int) sizeof(int64_t) * 8 - chunk_size; bits += chunk_size) {
14735 PyObject *tmp, *digit;
14736 long idigit;
14737 digit = PyNumber_And(stepval, mask);
14738 if (unlikely(!digit)) goto done;
14739 idigit = PyLong_AsLong(digit);
14740 Py_DECREF(digit);
14741 if (unlikely(idigit < 0)) goto done;
14742 val |= ((int64_t) idigit) << bits;
14743 tmp = PyNumber_Rshift(stepval, shift);
14744 if (unlikely(!tmp)) goto done;
14745 Py_DECREF(stepval); stepval = tmp;
14746 }
14747 Py_DECREF(shift); shift = NULL;
14748 Py_DECREF(mask); mask = NULL;
14749 {
14750 long idigit = PyLong_AsLong(stepval);
14751 if (unlikely(idigit < 0)) goto done;
14752 remaining_bits = ((int) sizeof(int64_t) * 8) - bits - (is_unsigned ? 0 : 1);
14753 if (unlikely(idigit >= (1L << remaining_bits)))
14754 goto raise_overflow;
14755 val |= ((int64_t) idigit) << bits;
14756 }
14757 if (!is_unsigned) {
14758 if (unlikely(val & (((int64_t) 1) << (sizeof(int64_t) * 8 - 1))))
14759 goto raise_overflow;
14760 if (is_negative)
14761 val = ~val;
14762 }
14763 ret = 0;
14764 done:
14765 Py_XDECREF(shift);
14766 Py_XDECREF(mask);
14767 Py_XDECREF(stepval);
14768 #endif
14769 if (unlikely(ret))
14770 return (int64_t) -1;
14771 return val;
14772 }
14773 raise_overflow:
14774 PyErr_SetString(PyExc_OverflowError,
14775 "value too large to convert to int64_t");
14776 return (int64_t) -1;
14777 raise_neg_overflow:
14778 PyErr_SetString(PyExc_OverflowError,
14779 "can't convert negative value to int64_t");
14780 return (int64_t) -1;
14781 }
14782
14783 /* CIntFromPy */
14784 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
14785 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14786 #pragma GCC diagnostic push
14787 #pragma GCC diagnostic ignored "-Wconversion"
14788 #endif
14789 const int neg_one = (int) -1, const_zero = (int) 0;
14790 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
14791 #pragma GCC diagnostic pop
14792 #endif
14793 const int is_unsigned = neg_one > const_zero;
14794 #if PY_MAJOR_VERSION < 3
14795 if (likely(PyInt_Check(x))) {
14796 if ((sizeof(int) < sizeof(long))) {
14797 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
14798 } else {
14799 long val = PyInt_AS_LONG(x);
14800 if (is_unsigned && unlikely(val < 0)) {
14801 goto raise_neg_overflow;
14802 }
14803 return (int) val;
14804 }
14805 }
14806 #endif
14807 if (unlikely(!PyLong_Check(x))) {
14808 int val;
14809 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14810 if (!tmp) return (int) -1;
14811 val = __Pyx_PyInt_As_int(tmp);
14812 Py_DECREF(tmp);
14813 return val;
14814 }
14815 if (is_unsigned) {
14816 #if CYTHON_USE_PYLONG_INTERNALS
14817 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
14818 goto raise_neg_overflow;
14819 } else if (__Pyx_PyLong_IsCompact(x)) {
14820 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
14821 } else {
14822 const digit* digits = __Pyx_PyLong_Digits(x);
14823 assert(__Pyx_PyLong_DigitCount(x) > 1);
14824 switch (__Pyx_PyLong_DigitCount(x)) {
14825 case 2:
14826 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
14827 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14828 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14829 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
14830 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14831 }
14832 }
14833 break;
14834 case 3:
14835 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
14836 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14837 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14838 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
14839 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14840 }
14841 }
14842 break;
14843 case 4:
14844 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
14845 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14846 __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])))
14847 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
14848 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14849 }
14850 }
14851 break;
14852 }
14853 }
14854 #endif
14855 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
14856 if (unlikely(Py_SIZE(x) < 0)) {
14857 goto raise_neg_overflow;
14858 }
14859 #else
14860 {
14861 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14862 if (unlikely(result < 0))
14863 return (int) -1;
14864 if (unlikely(result == 1))
14865 goto raise_neg_overflow;
14866 }
14867 #endif
14868 if ((sizeof(int) <= sizeof(unsigned long))) {
14869 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
14870 #ifdef HAVE_LONG_LONG
14871 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
14872 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14873 #endif
14874 }
14875 } else {
14876 #if CYTHON_USE_PYLONG_INTERNALS
14877 if (__Pyx_PyLong_IsCompact(x)) {
14878 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
14879 } else {
14880 const digit* digits = __Pyx_PyLong_Digits(x);
14881 assert(__Pyx_PyLong_DigitCount(x) > 1);
14882 switch (__Pyx_PyLong_SignedDigitCount(x)) {
14883 case -2:
14884 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
14885 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14886 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14887 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
14888 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14889 }
14890 }
14891 break;
14892 case 2:
14893 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
14894 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
14895 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14896 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
14897 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14898 }
14899 }
14900 break;
14901 case -3:
14902 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
14903 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14904 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14905 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
14906 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14907 }
14908 }
14909 break;
14910 case 3:
14911 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
14912 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
14913 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14914 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
14915 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14916 }
14917 }
14918 break;
14919 case -4:
14920 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
14921 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14922 __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])))
14923 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
14924 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14925 }
14926 }
14927 break;
14928 case 4:
14929 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
14930 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
14931 __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])))
14932 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
14933 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14934 }
14935 }
14936 break;
14937 }
14938 }
14939 #endif
14940 if ((sizeof(int) <= sizeof(long))) {
14941 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
14942 #ifdef HAVE_LONG_LONG
14943 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
14944 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
14945 #endif
14946 }
14947 }
14948 {
14949 int val;
14950 int ret = -1;
14951 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
14952 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
14953 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
14954 if (unlikely(bytes_copied == -1)) {
14955 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
14956 goto raise_overflow;
14957 } else {
14958 ret = 0;
14959 }
14960 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
14961 int one = 1; int is_little = (int)*(unsigned char *)&one;
14962 unsigned char *bytes = (unsigned char *)&val;
14963 ret = _PyLong_AsByteArray((PyLongObject *)x,
14964 bytes, sizeof(val),
14965 is_little, !is_unsigned);
14966 #else
14967 PyObject *v;
14968 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
14969 int bits, remaining_bits, is_negative = 0;
14970 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
14971 if (likely(PyLong_CheckExact(x))) {
14972 v = __Pyx_NewRef(x);
14973 } else {
14974 v = PyNumber_Long(x);
14975 if (unlikely(!v)) return (int) -1;
14976 assert(PyLong_CheckExact(v));
14977 }
14978 {
14979 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
14980 if (unlikely(result < 0)) {
14981 Py_DECREF(v);
14982 return (int) -1;
14983 }
14984 is_negative = result == 1;
14985 }
14986 if (is_unsigned && unlikely(is_negative)) {
14987 Py_DECREF(v);
14988 goto raise_neg_overflow;
14989 } else if (is_negative) {
14990 stepval = PyNumber_Invert(v);
14991 Py_DECREF(v);
14992 if (unlikely(!stepval))
14993 return (int) -1;
14994 } else {
14995 stepval = v;
14996 }
14997 v = NULL;
14998 val = (int) 0;
14999 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
15000 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
15001 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
15002 PyObject *tmp, *digit;
15003 long idigit;
15004 digit = PyNumber_And(stepval, mask);
15005 if (unlikely(!digit)) goto done;
15006 idigit = PyLong_AsLong(digit);
15007 Py_DECREF(digit);
15008 if (unlikely(idigit < 0)) goto done;
15009 val |= ((int) idigit) << bits;
15010 tmp = PyNumber_Rshift(stepval, shift);
15011 if (unlikely(!tmp)) goto done;
15012 Py_DECREF(stepval); stepval = tmp;
15013 }
15014 Py_DECREF(shift); shift = NULL;
15015 Py_DECREF(mask); mask = NULL;
15016 {
15017 long idigit = PyLong_AsLong(stepval);
15018 if (unlikely(idigit < 0)) goto done;
15019 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
15020 if (unlikely(idigit >= (1L << remaining_bits)))
15021 goto raise_overflow;
15022 val |= ((int) idigit) << bits;
15023 }
15024 if (!is_unsigned) {
15025 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
15026 goto raise_overflow;
15027 if (is_negative)
15028 val = ~val;
15029 }
15030 ret = 0;
15031 done:
15032 Py_XDECREF(shift);
15033 Py_XDECREF(mask);
15034 Py_XDECREF(stepval);
15035 #endif
15036 if (unlikely(ret))
15037 return (int) -1;
15038 return val;
15039 }
15040 raise_overflow:
15041 PyErr_SetString(PyExc_OverflowError,
15042 "value too large to convert to int");
15043 return (int) -1;
15044 raise_neg_overflow:
15045 PyErr_SetString(PyExc_OverflowError,
15046 "can't convert negative value to int");
15047 return (int) -1;
15048 }
15049
15050 /* FormatTypeName */
15051 #if CYTHON_COMPILING_IN_LIMITED_API
15052 static __Pyx_TypeName
15053 __Pyx_PyType_GetName(PyTypeObject* tp)
15054 {
15055 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
15056 __pyx_n_s_name);
15057 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
15058 PyErr_Clear();
15059 Py_XDECREF(name);
15060 name = __Pyx_NewRef(__pyx_n_s__48);
15061 }
15062 return name;
15063 }
15064 #endif
15065
15066 /* CIntToPy */
15067 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
15068 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15069 #pragma GCC diagnostic push
15070 #pragma GCC diagnostic ignored "-Wconversion"
15071 #endif
15072 const long neg_one = (long) -1, const_zero = (long) 0;
15073 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15074 #pragma GCC diagnostic pop
15075 #endif
15076 const int is_unsigned = neg_one > const_zero;
15077 if (is_unsigned) {
15078 if (sizeof(long) < sizeof(long)) {
15079 return PyInt_FromLong((long) value);
15080 } else if (sizeof(long) <= sizeof(unsigned long)) {
15081 return PyLong_FromUnsignedLong((unsigned long) value);
15082 #ifdef HAVE_LONG_LONG
15083 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15084 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15085 #endif
15086 }
15087 } else {
15088 if (sizeof(long) <= sizeof(long)) {
15089 return PyInt_FromLong((long) value);
15090 #ifdef HAVE_LONG_LONG
15091 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15092 return PyLong_FromLongLong((PY_LONG_LONG) value);
15093 #endif
15094 }
15095 }
15096 {
15097 unsigned char *bytes = (unsigned char *)&value;
15098 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
15099 if (is_unsigned) {
15100 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
15101 } else {
15102 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
15103 }
15104 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
15105 int one = 1; int little = (int)*(unsigned char *)&one;
15106 return _PyLong_FromByteArray(bytes, sizeof(long),
15107 little, !is_unsigned);
15108 #else
15109 int one = 1; int little = (int)*(unsigned char *)&one;
15110 PyObject *from_bytes, *result = NULL;
15111 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
15112 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
15113 if (!from_bytes) return NULL;
15114 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
15115 if (!py_bytes) goto limited_bad;
15116 order_str = PyUnicode_FromString(little ? "little" : "big");
15117 if (!order_str) goto limited_bad;
15118 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
15119 if (!arg_tuple) goto limited_bad;
15120 if (!is_unsigned) {
15121 kwds = PyDict_New();
15122 if (!kwds) goto limited_bad;
15123 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
15124 }
15125 result = PyObject_Call(from_bytes, arg_tuple, kwds);
15126 limited_bad:
15127 Py_XDECREF(kwds);
15128 Py_XDECREF(arg_tuple);
15129 Py_XDECREF(order_str);
15130 Py_XDECREF(py_bytes);
15131 Py_XDECREF(from_bytes);
15132 return result;
15133 #endif
15134 }
15135 }
15136
15137 /* CIntFromPy */
15138 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
15139 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15140 #pragma GCC diagnostic push
15141 #pragma GCC diagnostic ignored "-Wconversion"
15142 #endif
15143 const long neg_one = (long) -1, const_zero = (long) 0;
15144 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
15145 #pragma GCC diagnostic pop
15146 #endif
15147 const int is_unsigned = neg_one > const_zero;
15148 #if PY_MAJOR_VERSION < 3
15149 if (likely(PyInt_Check(x))) {
15150 if ((sizeof(long) < sizeof(long))) {
15151 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
15152 } else {
15153 long val = PyInt_AS_LONG(x);
15154 if (is_unsigned && unlikely(val < 0)) {
15155 goto raise_neg_overflow;
15156 }
15157 return (long) val;
15158 }
15159 }
15160 #endif
15161 if (unlikely(!PyLong_Check(x))) {
15162 long val;
15163 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15164 if (!tmp) return (long) -1;
15165 val = __Pyx_PyInt_As_long(tmp);
15166 Py_DECREF(tmp);
15167 return val;
15168 }
15169 if (is_unsigned) {
15170 #if CYTHON_USE_PYLONG_INTERNALS
15171 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
15172 goto raise_neg_overflow;
15173 } else if (__Pyx_PyLong_IsCompact(x)) {
15174 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
15175 } else {
15176 const digit* digits = __Pyx_PyLong_Digits(x);
15177 assert(__Pyx_PyLong_DigitCount(x) > 1);
15178 switch (__Pyx_PyLong_DigitCount(x)) {
15179 case 2:
15180 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
15181 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15182 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15183 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
15184 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15185 }
15186 }
15187 break;
15188 case 3:
15189 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
15190 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15191 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15192 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
15193 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15194 }
15195 }
15196 break;
15197 case 4:
15198 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
15199 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15200 __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])))
15201 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
15202 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15203 }
15204 }
15205 break;
15206 }
15207 }
15208 #endif
15209 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
15210 if (unlikely(Py_SIZE(x) < 0)) {
15211 goto raise_neg_overflow;
15212 }
15213 #else
15214 {
15215 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15216 if (unlikely(result < 0))
15217 return (long) -1;
15218 if (unlikely(result == 1))
15219 goto raise_neg_overflow;
15220 }
15221 #endif
15222 if ((sizeof(long) <= sizeof(unsigned long))) {
15223 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
15224 #ifdef HAVE_LONG_LONG
15225 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
15226 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15227 #endif
15228 }
15229 } else {
15230 #if CYTHON_USE_PYLONG_INTERNALS
15231 if (__Pyx_PyLong_IsCompact(x)) {
15232 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
15233 } else {
15234 const digit* digits = __Pyx_PyLong_Digits(x);
15235 assert(__Pyx_PyLong_DigitCount(x) > 1);
15236 switch (__Pyx_PyLong_SignedDigitCount(x)) {
15237 case -2:
15238 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
15239 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15240 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15241 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15242 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15243 }
15244 }
15245 break;
15246 case 2:
15247 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
15248 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
15249 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15250 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15251 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15252 }
15253 }
15254 break;
15255 case -3:
15256 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
15257 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15258 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15259 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15260 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15261 }
15262 }
15263 break;
15264 case 3:
15265 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
15266 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
15267 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15268 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15269 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15270 }
15271 }
15272 break;
15273 case -4:
15274 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
15275 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15276 __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])))
15277 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
15278 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15279 }
15280 }
15281 break;
15282 case 4:
15283 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
15284 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
15285 __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])))
15286 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
15287 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15288 }
15289 }
15290 break;
15291 }
15292 }
15293 #endif
15294 if ((sizeof(long) <= sizeof(long))) {
15295 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
15296 #ifdef HAVE_LONG_LONG
15297 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
15298 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
15299 #endif
15300 }
15301 }
15302 {
15303 long val;
15304 int ret = -1;
15305 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
15306 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
15307 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
15308 if (unlikely(bytes_copied == -1)) {
15309 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
15310 goto raise_overflow;
15311 } else {
15312 ret = 0;
15313 }
15314 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
15315 int one = 1; int is_little = (int)*(unsigned char *)&one;
15316 unsigned char *bytes = (unsigned char *)&val;
15317 ret = _PyLong_AsByteArray((PyLongObject *)x,
15318 bytes, sizeof(val),
15319 is_little, !is_unsigned);
15320 #else
15321 PyObject *v;
15322 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
15323 int bits, remaining_bits, is_negative = 0;
15324 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
15325 if (likely(PyLong_CheckExact(x))) {
15326 v = __Pyx_NewRef(x);
15327 } else {
15328 v = PyNumber_Long(x);
15329 if (unlikely(!v)) return (long) -1;
15330 assert(PyLong_CheckExact(v));
15331 }
15332 {
15333 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
15334 if (unlikely(result < 0)) {
15335 Py_DECREF(v);
15336 return (long) -1;
15337 }
15338 is_negative = result == 1;
15339 }
15340 if (is_unsigned && unlikely(is_negative)) {
15341 Py_DECREF(v);
15342 goto raise_neg_overflow;
15343 } else if (is_negative) {
15344 stepval = PyNumber_Invert(v);
15345 Py_DECREF(v);
15346 if (unlikely(!stepval))
15347 return (long) -1;
15348 } else {
15349 stepval = v;
15350 }
15351 v = NULL;
15352 val = (long) 0;
15353 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
15354 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
15355 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
15356 PyObject *tmp, *digit;
15357 long idigit;
15358 digit = PyNumber_And(stepval, mask);
15359 if (unlikely(!digit)) goto done;
15360 idigit = PyLong_AsLong(digit);
15361 Py_DECREF(digit);
15362 if (unlikely(idigit < 0)) goto done;
15363 val |= ((long) idigit) << bits;
15364 tmp = PyNumber_Rshift(stepval, shift);
15365 if (unlikely(!tmp)) goto done;
15366 Py_DECREF(stepval); stepval = tmp;
15367 }
15368 Py_DECREF(shift); shift = NULL;
15369 Py_DECREF(mask); mask = NULL;
15370 {
15371 long idigit = PyLong_AsLong(stepval);
15372 if (unlikely(idigit < 0)) goto done;
15373 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
15374 if (unlikely(idigit >= (1L << remaining_bits)))
15375 goto raise_overflow;
15376 val |= ((long) idigit) << bits;
15377 }
15378 if (!is_unsigned) {
15379 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
15380 goto raise_overflow;
15381 if (is_negative)
15382 val = ~val;
15383 }
15384 ret = 0;
15385 done:
15386 Py_XDECREF(shift);
15387 Py_XDECREF(mask);
15388 Py_XDECREF(stepval);
15389 #endif
15390 if (unlikely(ret))
15391 return (long) -1;
15392 return val;
15393 }
15394 raise_overflow:
15395 PyErr_SetString(PyExc_OverflowError,
15396 "value too large to convert to long");
15397 return (long) -1;
15398 raise_neg_overflow:
15399 PyErr_SetString(PyExc_OverflowError,
15400 "can't convert negative value to long");
15401 return (long) -1;
15402 }
15403
15404 /* FastTypeChecks */
15405 #if CYTHON_COMPILING_IN_CPYTHON
15406 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
15407 while (a) {
15408 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
15409 if (a == b)
15410 return 1;
15411 }
15412 return b == &PyBaseObject_Type;
15413 }
15414 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
15415 PyObject *mro;
15416 if (a == b) return 1;
15417 mro = a->tp_mro;
15418 if (likely(mro)) {
15419 Py_ssize_t i, n;
15420 n = PyTuple_GET_SIZE(mro);
15421 for (i = 0; i < n; i++) {
15422 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
15423 return 1;
15424 }
15425 return 0;
15426 }
15427 return __Pyx_InBases(a, b);
15428 }
15429 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
15430 PyObject *mro;
15431 if (cls == a || cls == b) return 1;
15432 mro = cls->tp_mro;
15433 if (likely(mro)) {
15434 Py_ssize_t i, n;
15435 n = PyTuple_GET_SIZE(mro);
15436 for (i = 0; i < n; i++) {
15437 PyObject *base = PyTuple_GET_ITEM(mro, i);
15438 if (base == (PyObject *)a || base == (PyObject *)b)
15439 return 1;
15440 }
15441 return 0;
15442 }
15443 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
15444 }
15445 #if PY_MAJOR_VERSION == 2
15446 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
15447 PyObject *exception, *value, *tb;
15448 int res;
15449 __Pyx_PyThreadState_declare
15450 __Pyx_PyThreadState_assign
15451 __Pyx_ErrFetch(&exception, &value, &tb);
15452 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
15453 if (unlikely(res == -1)) {
15454 PyErr_WriteUnraisable(err);
15455 res = 0;
15456 }
15457 if (!res) {
15458 res = PyObject_IsSubclass(err, exc_type2);
15459 if (unlikely(res == -1)) {
15460 PyErr_WriteUnraisable(err);
15461 res = 0;
15462 }
15463 }
15464 __Pyx_ErrRestore(exception, value, tb);
15465 return res;
15466 }
15467 #else
15468 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
15469 if (exc_type1) {
15470 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
15471 } else {
15472 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
15473 }
15474 }
15475 #endif
15476 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
15477 Py_ssize_t i, n;
15478 assert(PyExceptionClass_Check(exc_type));
15479 n = PyTuple_GET_SIZE(tuple);
15480 #if PY_MAJOR_VERSION >= 3
15481 for (i=0; i<n; i++) {
15482 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
15483 }
15484 #endif
15485 for (i=0; i<n; i++) {
15486 PyObject *t = PyTuple_GET_ITEM(tuple, i);
15487 #if PY_MAJOR_VERSION < 3
15488 if (likely(exc_type == t)) return 1;
15489 #endif
15490 if (likely(PyExceptionClass_Check(t))) {
15491 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
15492 } else {
15493 }
15494 }
15495 return 0;
15496 }
15497 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
15498 if (likely(err == exc_type)) return 1;
15499 if (likely(PyExceptionClass_Check(err))) {
15500 if (likely(PyExceptionClass_Check(exc_type))) {
15501 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
15502 } else if (likely(PyTuple_Check(exc_type))) {
15503 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
15504 } else {
15505 }
15506 }
15507 return PyErr_GivenExceptionMatches(err, exc_type);
15508 }
15509 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
15510 assert(PyExceptionClass_Check(exc_type1));
15511 assert(PyExceptionClass_Check(exc_type2));
15512 if (likely(err == exc_type1 || err == exc_type2)) return 1;
15513 if (likely(PyExceptionClass_Check(err))) {
15514 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
15515 }
15516 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
15517 }
15518 #endif
15519
15520 /* CheckBinaryVersion */
15521 static unsigned long __Pyx_get_runtime_version(void) {
15522 #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
15523 return Py_Version & ~0xFFUL;
15524 #else
15525 const char* rt_version = Py_GetVersion();
15526 unsigned long version = 0;
15527 unsigned long factor = 0x01000000UL;
15528 unsigned int digit = 0;
15529 int i = 0;
15530 while (factor) {
15531 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
15532 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
15533 ++i;
15534 }
15535 version += factor * digit;
15536 if (rt_version[i] != '.')
15537 break;
15538 digit = 0;
15539 factor >>= 8;
15540 ++i;
15541 }
15542 return version;
15543 #endif
15544 }
15545 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
15546 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
15547 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
15548 return 0;
15549 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
15550 return 1;
15551 {
15552 char message[200];
15553 PyOS_snprintf(message, sizeof(message),
15554 "compile time Python version %d.%d "
15555 "of module '%.100s' "
15556 "%s "
15557 "runtime version %d.%d",
15558 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
15559 __Pyx_MODULE_NAME,
15560 (allow_newer) ? "was newer than" : "does not match",
15561 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
15562 );
15563 return PyErr_WarnEx(NULL, message, 1);
15564 }
15565 }
15566
15567 /* FunctionImport */
15568 #ifndef __PYX_HAVE_RT_ImportFunction_3_0_11
15569 #define __PYX_HAVE_RT_ImportFunction_3_0_11
15570 static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
15571 PyObject *d = 0;
15572 PyObject *cobj = 0;
15573 union {
15574 void (*fp)(void);
15575 void *p;
15576 } tmp;
15577 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
15578 if (!d)
15579 goto bad;
15580 cobj = PyDict_GetItemString(d, funcname);
15581 if (!cobj) {
15582 PyErr_Format(PyExc_ImportError,
15583 "%.200s does not export expected C function %.200s",
15584 PyModule_GetName(module), funcname);
15585 goto bad;
15586 }
15587 if (!PyCapsule_IsValid(cobj, sig)) {
15588 PyErr_Format(PyExc_TypeError,
15589 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
15590 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
15591 goto bad;
15592 }
15593 tmp.p = PyCapsule_GetPointer(cobj, sig);
15594 *f = tmp.fp;
15595 if (!(*f))
15596 goto bad;
15597 Py_DECREF(d);
15598 return 0;
15599 bad:
15600 Py_XDECREF(d);
15601 return -1;
15602 }
15603 #endif
15604
15605 /* InitStrings */
15606 #if PY_MAJOR_VERSION >= 3
15607 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
15608 if (t.is_unicode | t.is_str) {
15609 if (t.intern) {
15610 *str = PyUnicode_InternFromString(t.s);
15611 } else if (t.encoding) {
15612 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
15613 } else {
15614 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
15615 }
15616 } else {
15617 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
15618 }
15619 if (!*str)
15620 return -1;
15621 if (PyObject_Hash(*str) == -1)
15622 return -1;
15623 return 0;
15624 }
15625 #endif
15626 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
15627 while (t->p) {
15628 #if PY_MAJOR_VERSION >= 3
15629 __Pyx_InitString(*t, t->p);
15630 #else
15631 if (t->is_unicode) {
15632 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
15633 } else if (t->intern) {
15634 *t->p = PyString_InternFromString(t->s);
15635 } else {
15636 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
15637 }
15638 if (!*t->p)
15639 return -1;
15640 if (PyObject_Hash(*t->p) == -1)
15641 return -1;
15642 #endif
15643 ++t;
15644 }
15645 return 0;
15646 }
15647
15648 #include <string.h>
15649 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
15650 size_t len = strlen(s);
15651 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
15652 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
15653 return -1;
15654 }
15655 return (Py_ssize_t) len;
15656 }
15657 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
15658 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
15659 if (unlikely(len < 0)) return NULL;
15660 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
15661 }
15662 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
15663 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
15664 if (unlikely(len < 0)) return NULL;
15665 return PyByteArray_FromStringAndSize(c_str, len);
15666 }
15667 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
15668 Py_ssize_t ignore;
15669 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
15670 }
15671 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
15672 #if !CYTHON_PEP393_ENABLED
15673 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15674 char* defenc_c;
15675 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
15676 if (!defenc) return NULL;
15677 defenc_c = PyBytes_AS_STRING(defenc);
15678 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15679 {
15680 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
15681 char* c;
15682 for (c = defenc_c; c < end; c++) {
15683 if ((unsigned char) (*c) >= 128) {
15684 PyUnicode_AsASCIIString(o);
15685 return NULL;
15686 }
15687 }
15688 }
15689 #endif
15690 *length = PyBytes_GET_SIZE(defenc);
15691 return defenc_c;
15692 }
15693 #else
15694 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15695 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
15696 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15697 if (likely(PyUnicode_IS_ASCII(o))) {
15698 *length = PyUnicode_GET_LENGTH(o);
15699 return PyUnicode_AsUTF8(o);
15700 } else {
15701 PyUnicode_AsASCIIString(o);
15702 return NULL;
15703 }
15704 #else
15705 return PyUnicode_AsUTF8AndSize(o, length);
15706 #endif
15707 }
15708 #endif
15709 #endif
15710 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15711 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
15712 if (
15713 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15714 __Pyx_sys_getdefaultencoding_not_ascii &&
15715 #endif
15716 PyUnicode_Check(o)) {
15717 return __Pyx_PyUnicode_AsStringAndSize(o, length);
15718 } else
15719 #endif
15720 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
15721 if (PyByteArray_Check(o)) {
15722 *length = PyByteArray_GET_SIZE(o);
15723 return PyByteArray_AS_STRING(o);
15724 } else
15725 #endif
15726 {
15727 char* result;
15728 int r = PyBytes_AsStringAndSize(o, &result, length);
15729 if (unlikely(r < 0)) {
15730 return NULL;
15731 } else {
15732 return result;
15733 }
15734 }
15735 }
15736 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
15737 int is_true = x == Py_True;
15738 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
15739 else return PyObject_IsTrue(x);
15740 }
15741 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
15742 int retval;
15743 if (unlikely(!x)) return -1;
15744 retval = __Pyx_PyObject_IsTrue(x);
15745 Py_DECREF(x);
15746 return retval;
15747 }
15748 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
15749 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
15750 #if PY_MAJOR_VERSION >= 3
15751 if (PyLong_Check(result)) {
15752 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
15753 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
15754 "The ability to return an instance of a strict subclass of int is deprecated, "
15755 "and may be removed in a future version of Python.",
15756 result_type_name)) {
15757 __Pyx_DECREF_TypeName(result_type_name);
15758 Py_DECREF(result);
15759 return NULL;
15760 }
15761 __Pyx_DECREF_TypeName(result_type_name);
15762 return result;
15763 }
15764 #endif
15765 PyErr_Format(PyExc_TypeError,
15766 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
15767 type_name, type_name, result_type_name);
15768 __Pyx_DECREF_TypeName(result_type_name);
15769 Py_DECREF(result);
15770 return NULL;
15771 }
15772 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
15773 #if CYTHON_USE_TYPE_SLOTS
15774 PyNumberMethods *m;
15775 #endif
15776 const char *name = NULL;
15777 PyObject *res = NULL;
15778 #if PY_MAJOR_VERSION < 3
15779 if (likely(PyInt_Check(x) || PyLong_Check(x)))
15780 #else
15781 if (likely(PyLong_Check(x)))
15782 #endif
15783 return __Pyx_NewRef(x);
15784 #if CYTHON_USE_TYPE_SLOTS
15785 m = Py_TYPE(x)->tp_as_number;
15786 #if PY_MAJOR_VERSION < 3
15787 if (m && m->nb_int) {
15788 name = "int";
15789 res = m->nb_int(x);
15790 }
15791 else if (m && m->nb_long) {
15792 name = "long";
15793 res = m->nb_long(x);
15794 }
15795 #else
15796 if (likely(m && m->nb_int)) {
15797 name = "int";
15798 res = m->nb_int(x);
15799 }
15800 #endif
15801 #else
15802 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
15803 res = PyNumber_Int(x);
15804 }
15805 #endif
15806 if (likely(res)) {
15807 #if PY_MAJOR_VERSION < 3
15808 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
15809 #else
15810 if (unlikely(!PyLong_CheckExact(res))) {
15811 #endif
15812 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
15813 }
15814 }
15815 else if (!PyErr_Occurred()) {
15816 PyErr_SetString(PyExc_TypeError,
15817 "an integer is required");
15818 }
15819 return res;
15820 }
15821 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
15822 Py_ssize_t ival;
15823 PyObject *x;
15824 #if PY_MAJOR_VERSION < 3
15825 if (likely(PyInt_CheckExact(b))) {
15826 if (sizeof(Py_ssize_t) >= sizeof(long))
15827 return PyInt_AS_LONG(b);
15828 else
15829 return PyInt_AsSsize_t(b);
15830 }
15831 #endif
15832 if (likely(PyLong_CheckExact(b))) {
15833 #if CYTHON_USE_PYLONG_INTERNALS
15834 if (likely(__Pyx_PyLong_IsCompact(b))) {
15835 return __Pyx_PyLong_CompactValue(b);
15836 } else {
15837 const digit* digits = __Pyx_PyLong_Digits(b);
15838 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
15839 switch (size) {
15840 case 2:
15841 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
15842 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15843 }
15844 break;
15845 case -2:
15846 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
15847 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15848 }
15849 break;
15850 case 3:
15851 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
15852 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15853 }
15854 break;
15855 case -3:
15856 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
15857 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15858 }
15859 break;
15860 case 4:
15861 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
15862 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]));
15863 }
15864 break;
15865 case -4:
15866 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
15867 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]));
15868 }
15869 break;
15870 }
15871 }
15872 #endif
15873 return PyLong_AsSsize_t(b);
15874 }
15875 x = PyNumber_Index(b);
15876 if (!x) return -1;
15877 ival = PyInt_AsSsize_t(x);
15878 Py_DECREF(x);
15879 return ival;
15880 }
15881 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
15882 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
15883 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
15884 #if PY_MAJOR_VERSION < 3
15885 } else if (likely(PyInt_CheckExact(o))) {
15886 return PyInt_AS_LONG(o);
15887 #endif
15888 } else {
15889 Py_ssize_t ival;
15890 PyObject *x;
15891 x = PyNumber_Index(o);
15892 if (!x) return -1;
15893 ival = PyInt_AsLong(x);
15894 Py_DECREF(x);
15895 return ival;
15896 }
15897 }
15898 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
15899 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
15900 }
15901 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
15902 return PyInt_FromSize_t(ival);
15903 }
15904
15905
15906 /* #### Code section: utility_code_pragmas_end ### */
15907 #ifdef _MSC_VER
15908 #pragma warning( pop )
15909 #endif
15910
15911
15912
15913 /* #### Code section: end ### */
15914 #endif /* Py_PYTHON_H */