1 /* Generated by Cython 0.29.24 */
2
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_24"
13 #define CYTHON_HEX_VERSION 0x001D18F0
14 #define CYTHON_FUTURE_DIVISION 1
15 #include <stddef.h>
16 #ifndef offsetof
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20 #ifndef __stdcall
21 #define __stdcall
22 #endif
23 #ifndef __cdecl
24 #define __cdecl
25 #endif
26 #ifndef __fastcall
27 #define __fastcall
28 #endif
29 #endif
30 #ifndef DL_IMPORT
31 #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34 #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
40 #endif
41 #endif
42 #ifndef PY_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46 #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
61 #endif
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89 #define CYTHON_COMPILING_IN_PYPY 0
90 #define CYTHON_COMPILING_IN_PYSTON 1
91 #define CYTHON_COMPILING_IN_CPYTHON 0
92 #ifndef CYTHON_USE_TYPE_SLOTS
93 #define CYTHON_USE_TYPE_SLOTS 1
94 #endif
95 #undef CYTHON_USE_PYTYPE_LOOKUP
96 #define CYTHON_USE_PYTYPE_LOOKUP 0
97 #undef CYTHON_USE_ASYNC_SLOTS
98 #define CYTHON_USE_ASYNC_SLOTS 0
99 #undef CYTHON_USE_PYLIST_INTERNALS
100 #define CYTHON_USE_PYLIST_INTERNALS 0
101 #ifndef CYTHON_USE_UNICODE_INTERNALS
102 #define CYTHON_USE_UNICODE_INTERNALS 1
103 #endif
104 #undef CYTHON_USE_UNICODE_WRITER
105 #define CYTHON_USE_UNICODE_WRITER 0
106 #undef CYTHON_USE_PYLONG_INTERNALS
107 #define CYTHON_USE_PYLONG_INTERNALS 0
108 #ifndef CYTHON_AVOID_BORROWED_REFS
109 #define CYTHON_AVOID_BORROWED_REFS 0
110 #endif
111 #ifndef CYTHON_ASSUME_SAFE_MACROS
112 #define CYTHON_ASSUME_SAFE_MACROS 1
113 #endif
114 #ifndef CYTHON_UNPACK_METHODS
115 #define CYTHON_UNPACK_METHODS 1
116 #endif
117 #undef CYTHON_FAST_THREAD_STATE
118 #define CYTHON_FAST_THREAD_STATE 0
119 #undef CYTHON_FAST_PYCALL
120 #define CYTHON_FAST_PYCALL 0
121 #undef CYTHON_PEP489_MULTI_PHASE_INIT
122 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123 #undef CYTHON_USE_TP_FINALIZE
124 #define CYTHON_USE_TP_FINALIZE 0
125 #undef CYTHON_USE_DICT_VERSIONS
126 #define CYTHON_USE_DICT_VERSIONS 0
127 #undef CYTHON_USE_EXC_INFO_STACK
128 #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130 #define CYTHON_COMPILING_IN_PYPY 0
131 #define CYTHON_COMPILING_IN_PYSTON 0
132 #define CYTHON_COMPILING_IN_CPYTHON 1
133 #ifndef CYTHON_USE_TYPE_SLOTS
134 #define CYTHON_USE_TYPE_SLOTS 1
135 #endif
136 #if PY_VERSION_HEX < 0x02070000
137 #undef CYTHON_USE_PYTYPE_LOOKUP
138 #define CYTHON_USE_PYTYPE_LOOKUP 0
139 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140 #define CYTHON_USE_PYTYPE_LOOKUP 1
141 #endif
142 #if PY_MAJOR_VERSION < 3
143 #undef CYTHON_USE_ASYNC_SLOTS
144 #define CYTHON_USE_ASYNC_SLOTS 0
145 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146 #define CYTHON_USE_ASYNC_SLOTS 1
147 #endif
148 #if PY_VERSION_HEX < 0x02070000
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152 #define CYTHON_USE_PYLONG_INTERNALS 1
153 #endif
154 #ifndef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 1
156 #endif
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
159 #endif
160 #if PY_VERSION_HEX < 0x030300F0
161 #undef CYTHON_USE_UNICODE_WRITER
162 #define CYTHON_USE_UNICODE_WRITER 0
163 #elif !defined(CYTHON_USE_UNICODE_WRITER)
164 #define CYTHON_USE_UNICODE_WRITER 1
165 #endif
166 #ifndef CYTHON_AVOID_BORROWED_REFS
167 #define CYTHON_AVOID_BORROWED_REFS 0
168 #endif
169 #ifndef CYTHON_ASSUME_SAFE_MACROS
170 #define CYTHON_ASSUME_SAFE_MACROS 1
171 #endif
172 #ifndef CYTHON_UNPACK_METHODS
173 #define CYTHON_UNPACK_METHODS 1
174 #endif
175 #ifndef CYTHON_FAST_THREAD_STATE
176 #define CYTHON_FAST_THREAD_STATE 1
177 #endif
178 #ifndef CYTHON_FAST_PYCALL
179 #define CYTHON_FAST_PYCALL 1
180 #endif
181 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183 #endif
184 #ifndef CYTHON_USE_TP_FINALIZE
185 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186 #endif
187 #ifndef CYTHON_USE_DICT_VERSIONS
188 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189 #endif
190 #ifndef CYTHON_USE_EXC_INFO_STACK
191 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192 #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198 #include "longintrepr.h"
199 #undef SHIFT
200 #undef BASE
201 #undef MASK
202 #ifdef SIZEOF_VOID_P
203 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204 #endif
205 #endif
206 #ifndef __has_attribute
207 #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210 #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213 #if defined(__GNUC__)
214 #define CYTHON_RESTRICT __restrict__
215 #elif defined(_MSC_VER) && _MSC_VER >= 1400
216 #define CYTHON_RESTRICT __restrict
217 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218 #define CYTHON_RESTRICT restrict
219 #else
220 #define CYTHON_RESTRICT
221 #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 # define CYTHON_UNUSED __attribute__ ((__unused__))
227 # else
228 # define CYTHON_UNUSED
229 # endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 # define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 # define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)238 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 # else
240 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 # endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 # define CYTHON_NCP_UNUSED
246 # else
247 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252 #ifndef _MSC_STDINT_H_
253 #if _MSC_VER < 1300
254 typedef unsigned char uint8_t;
255 typedef unsigned int uint32_t;
256 #else
257 typedef unsigned __int8 uint8_t;
258 typedef unsigned __int32 uint32_t;
259 #endif
260 #endif
261 #else
262 #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265 #if defined(__cplusplus) && __cplusplus >= 201103L
266 #if __has_cpp_attribute(fallthrough)
267 #define CYTHON_FALLTHROUGH [[fallthrough]]
268 #elif __has_cpp_attribute(clang::fallthrough)
269 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270 #elif __has_cpp_attribute(gnu::fallthrough)
271 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272 #endif
273 #endif
274 #ifndef CYTHON_FALLTHROUGH
275 #if __has_attribute(fallthrough)
276 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277 #else
278 #define CYTHON_FALLTHROUGH
279 #endif
280 #endif
281 #if defined(__clang__ ) && defined(__apple_build_version__)
282 #if __apple_build_version__ < 7000000
283 #undef CYTHON_FALLTHROUGH
284 #define CYTHON_FALLTHROUGH
285 #endif
286 #endif
287 #endif
288
289 #ifndef CYTHON_INLINE
290 #if defined(__clang__)
291 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292 #elif defined(__GNUC__)
293 #define CYTHON_INLINE __inline__
294 #elif defined(_MSC_VER)
295 #define CYTHON_INLINE __inline
296 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297 #define CYTHON_INLINE inline
298 #else
299 #define CYTHON_INLINE
300 #endif
301 #endif
302
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304 #define Py_OptimizeFlag 0
305 #endif
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312 #define __Pyx_DefaultClassType PyClass_Type
313 #else
314 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
318 #else
319 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
321 #endif
322 #define __Pyx_DefaultClassType PyType_Type
323 #endif
324 #ifndef Py_TPFLAGS_CHECKTYPES
325 #define Py_TPFLAGS_CHECKTYPES 0
326 #endif
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328 #define Py_TPFLAGS_HAVE_INDEX 0
329 #endif
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
332 #endif
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334 #define Py_TPFLAGS_HAVE_FINALIZE 0
335 #endif
336 #ifndef METH_STACKLESS
337 #define METH_STACKLESS 0
338 #endif
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340 #ifndef METH_FASTCALL
341 #define METH_FASTCALL 0x80
342 #endif
343 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
344 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
345 Py_ssize_t nargs, PyObject *kwnames);
346 #else
347 #define __Pyx_PyCFunctionFast _PyCFunctionFast
348 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
349 #endif
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
353 #else
354 #define __Pyx_PyFastCFunction_Check(func) 0
355 #endif
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357 #define PyObject_Malloc(s) PyMem_Malloc(s)
358 #define PyObject_Free(p) PyMem_Free(p)
359 #define PyObject_Realloc(p) PyMem_Realloc(p)
360 #endif
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
363 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
364 #define PyMem_RawFree(p) PyMem_Free(p)
365 #endif
366 #if CYTHON_COMPILING_IN_PYSTON
367 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
368 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
369 #else
370 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
371 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
372 #endif
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374 #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378 #define __Pyx_PyThreadState_Current PyThreadState_GET()
379 #else
380 #define __Pyx_PyThreadState_Current _PyThreadState_Current
381 #endif
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)386 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
387 *key = PyThread_create_key();
388 return 0;
389 }
PyThread_tss_alloc(void)390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
391 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
392 *key = Py_tss_NEEDS_INIT;
393 return key;
394 }
PyThread_tss_free(Py_tss_t * key)395 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
396 PyObject_Free(key);
397 }
PyThread_tss_is_created(Py_tss_t * key)398 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
399 return *key != Py_tss_NEEDS_INIT;
400 }
PyThread_tss_delete(Py_tss_t * key)401 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
402 PyThread_delete_key(*key);
403 *key = Py_tss_NEEDS_INIT;
404 }
PyThread_tss_set(Py_tss_t * key,void * value)405 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
406 return PyThread_set_key_value(*key, value);
407 }
PyThread_tss_get(Py_tss_t * key)408 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
409 return PyThread_get_key_value(*key);
410 }
411 #endif
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
414 #else
415 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
416 #endif
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
420 #else
421 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
422 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
426 #else
427 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
428 #endif
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430 #define CYTHON_PEP393_ENABLED 1
431 #if defined(PyUnicode_IS_READY)
432 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
433 0 : _PyUnicode_Ready((PyObject *)(op)))
434 #else
435 #define __Pyx_PyUnicode_READY(op) (0)
436 #endif
437 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
438 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
439 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
440 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
441 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
442 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
443 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
444 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
445 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
446 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
447 #else
448 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
449 #endif
450 #else
451 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
452 #endif
453 #else
454 #define CYTHON_PEP393_ENABLED 0
455 #define PyUnicode_1BYTE_KIND 1
456 #define PyUnicode_2BYTE_KIND 2
457 #define PyUnicode_4BYTE_KIND 4
458 #define __Pyx_PyUnicode_READY(op) (0)
459 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY
469 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
471 #else
472 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
475 #endif
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
478 #endif
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
484 #endif
485 #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))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
489 #else
490 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
491 #endif
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493 #define PyObject_ASCII(o) PyObject_Repr(o)
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496 #define PyBaseString_Type PyUnicode_Type
497 #define PyStringObject PyUnicodeObject
498 #define PyString_Type PyUnicode_Type
499 #define PyString_Check PyUnicode_Check
500 #define PyString_CheckExact PyUnicode_CheckExact
501 #ifndef PyObject_Unicode
502 #define PyObject_Unicode PyObject_Str
503 #endif
504 #endif
505 #if PY_MAJOR_VERSION >= 3
506 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
508 #else
509 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
511 #endif
512 #ifndef PySet_CheckExact
513 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
514 #endif
515 #if PY_VERSION_HEX >= 0x030900A4
516 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
517 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
518 #else
519 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
520 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
521 #endif
522 #if CYTHON_ASSUME_SAFE_MACROS
523 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
524 #else
525 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
526 #endif
527 #if PY_MAJOR_VERSION >= 3
528 #define PyIntObject PyLongObject
529 #define PyInt_Type PyLong_Type
530 #define PyInt_Check(op) PyLong_Check(op)
531 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
532 #define PyInt_FromString PyLong_FromString
533 #define PyInt_FromUnicode PyLong_FromUnicode
534 #define PyInt_FromLong PyLong_FromLong
535 #define PyInt_FromSize_t PyLong_FromSize_t
536 #define PyInt_FromSsize_t PyLong_FromSsize_t
537 #define PyInt_AsLong PyLong_AsLong
538 #define PyInt_AS_LONG PyLong_AS_LONG
539 #define PyInt_AsSsize_t PyLong_AsSsize_t
540 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
541 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
542 #define PyNumber_Int PyNumber_Long
543 #endif
544 #if PY_MAJOR_VERSION >= 3
545 #define PyBoolObject PyLongObject
546 #endif
547 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
548 #ifndef PyUnicode_InternFromString
549 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
550 #endif
551 #endif
552 #if PY_VERSION_HEX < 0x030200A4
553 typedef long Py_hash_t;
554 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
555 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
556 #else
557 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
558 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
559 #endif
560 #if PY_MAJOR_VERSION >= 3
561 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
562 #else
563 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
564 #endif
565 #if CYTHON_USE_ASYNC_SLOTS
566 #if PY_VERSION_HEX >= 0x030500B1
567 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
568 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
569 #else
570 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
571 #endif
572 #else
573 #define __Pyx_PyType_AsAsync(obj) NULL
574 #endif
575 #ifndef __Pyx_PyAsyncMethodsStruct
576 typedef struct {
577 unaryfunc am_await;
578 unaryfunc am_aiter;
579 unaryfunc am_anext;
580 } __Pyx_PyAsyncMethodsStruct;
581 #endif
582
583 #if defined(WIN32) || defined(MS_WINDOWS)
584 #define _USE_MATH_DEFINES
585 #endif
586 #include <math.h>
587 #ifdef NAN
588 #define __PYX_NAN() ((float) NAN)
589 #else
__PYX_NAN()590 static CYTHON_INLINE float __PYX_NAN() {
591 float value;
592 memset(&value, 0xFF, sizeof(value));
593 return value;
594 }
595 #endif
596 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
597 #define __Pyx_truncl trunc
598 #else
599 #define __Pyx_truncl truncl
600 #endif
601
602 #define __PYX_MARK_ERR_POS(f_index, lineno) \
603 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
604 #define __PYX_ERR(f_index, lineno, Ln_error) \
605 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
606
607 #ifndef __PYX_EXTERN_C
608 #ifdef __cplusplus
609 #define __PYX_EXTERN_C extern "C"
610 #else
611 #define __PYX_EXTERN_C extern
612 #endif
613 #endif
614
615 #define __PYX_HAVE__yarl___quoting_c
616 #define __PYX_HAVE_API__yarl___quoting_c
617 /* Early includes */
618 #include <stdint.h>
619 #include <string.h>
620 #include <stdio.h>
621 #ifdef _OPENMP
622 #include <omp.h>
623 #endif /* _OPENMP */
624
625 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
626 #define CYTHON_WITHOUT_ASSERTIONS
627 #endif
628
629 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
630 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
631
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
633 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
635 #define __PYX_DEFAULT_STRING_ENCODING ""
636 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
637 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
638 #define __Pyx_uchar_cast(c) ((unsigned char)c)
639 #define __Pyx_long_cast(x) ((long)x)
640 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
641 (sizeof(type) < sizeof(Py_ssize_t)) ||\
642 (sizeof(type) > sizeof(Py_ssize_t) &&\
643 likely(v < (type)PY_SSIZE_T_MAX ||\
644 v == (type)PY_SSIZE_T_MAX) &&\
645 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
646 v == (type)PY_SSIZE_T_MIN))) ||\
647 (sizeof(type) == sizeof(Py_ssize_t) &&\
648 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
649 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)650 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
651 return (size_t) i < (size_t) limit;
652 }
653 #if defined (__cplusplus) && __cplusplus >= 201103L
654 #include <cstdlib>
655 #define __Pyx_sst_abs(value) std::abs(value)
656 #elif SIZEOF_INT >= SIZEOF_SIZE_T
657 #define __Pyx_sst_abs(value) abs(value)
658 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
659 #define __Pyx_sst_abs(value) labs(value)
660 #elif defined (_MSC_VER)
661 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
662 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
663 #define __Pyx_sst_abs(value) llabs(value)
664 #elif defined (__GNUC__)
665 #define __Pyx_sst_abs(value) __builtin_llabs(value)
666 #else
667 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
668 #endif
669 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
670 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
671 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
672 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
673 #define __Pyx_PyBytes_FromString PyBytes_FromString
674 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
675 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
676 #if PY_MAJOR_VERSION < 3
677 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
678 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
679 #else
680 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
681 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
682 #endif
683 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
695 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
696 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
697 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
698 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)699 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
700 const Py_UNICODE *u_end = u;
701 while (*u_end++) ;
702 return (size_t)(u_end - u - 1);
703 }
704 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
705 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
706 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
707 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
708 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
709 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
710 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
711 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
712 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
713 #define __Pyx_PySequence_Tuple(obj)\
714 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
715 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
716 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
717 #if CYTHON_ASSUME_SAFE_MACROS
718 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
719 #else
720 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
721 #endif
722 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
723 #if PY_MAJOR_VERSION >= 3
724 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
725 #else
726 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
727 #endif
728 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
729 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
730 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)731 static int __Pyx_init_sys_getdefaultencoding_params(void) {
732 PyObject* sys;
733 PyObject* default_encoding = NULL;
734 PyObject* ascii_chars_u = NULL;
735 PyObject* ascii_chars_b = NULL;
736 const char* default_encoding_c;
737 sys = PyImport_ImportModule("sys");
738 if (!sys) goto bad;
739 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
740 Py_DECREF(sys);
741 if (!default_encoding) goto bad;
742 default_encoding_c = PyBytes_AsString(default_encoding);
743 if (!default_encoding_c) goto bad;
744 if (strcmp(default_encoding_c, "ascii") == 0) {
745 __Pyx_sys_getdefaultencoding_not_ascii = 0;
746 } else {
747 char ascii_chars[128];
748 int c;
749 for (c = 0; c < 128; c++) {
750 ascii_chars[c] = c;
751 }
752 __Pyx_sys_getdefaultencoding_not_ascii = 1;
753 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
754 if (!ascii_chars_u) goto bad;
755 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
756 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
757 PyErr_Format(
758 PyExc_ValueError,
759 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
760 default_encoding_c);
761 goto bad;
762 }
763 Py_DECREF(ascii_chars_u);
764 Py_DECREF(ascii_chars_b);
765 }
766 Py_DECREF(default_encoding);
767 return 0;
768 bad:
769 Py_XDECREF(default_encoding);
770 Py_XDECREF(ascii_chars_u);
771 Py_XDECREF(ascii_chars_b);
772 return -1;
773 }
774 #endif
775 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
776 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
777 #else
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
779 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
780 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)781 static int __Pyx_init_sys_getdefaultencoding_params(void) {
782 PyObject* sys;
783 PyObject* default_encoding = NULL;
784 char* default_encoding_c;
785 sys = PyImport_ImportModule("sys");
786 if (!sys) goto bad;
787 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
788 Py_DECREF(sys);
789 if (!default_encoding) goto bad;
790 default_encoding_c = PyBytes_AsString(default_encoding);
791 if (!default_encoding_c) goto bad;
792 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
793 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
794 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
795 Py_DECREF(default_encoding);
796 return 0;
797 bad:
798 Py_XDECREF(default_encoding);
799 return -1;
800 }
801 #endif
802 #endif
803
804
805 /* Test for GCC > 2.95 */
806 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
807 #define likely(x) __builtin_expect(!!(x), 1)
808 #define unlikely(x) __builtin_expect(!!(x), 0)
809 #else /* !__GNUC__ or GCC < 2.95 */
810 #define likely(x) (x)
811 #define unlikely(x) (x)
812 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)813 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
814
815 static PyObject *__pyx_m = NULL;
816 static PyObject *__pyx_d;
817 static PyObject *__pyx_b;
818 static PyObject *__pyx_cython_runtime = NULL;
819 static PyObject *__pyx_empty_tuple;
820 static PyObject *__pyx_empty_bytes;
821 static PyObject *__pyx_empty_unicode;
822 static int __pyx_lineno;
823 static int __pyx_clineno = 0;
824 static const char * __pyx_cfilenm= __FILE__;
825 static const char *__pyx_filename;
826
827
828 static const char *__pyx_f[] = {
829 "yarl/_quoting_c.pyx",
830 "stringsource",
831 "type.pxd",
832 };
833
834 /*--- Type declarations ---*/
835 struct __pyx_obj_4yarl_10_quoting_c__Quoter;
836 struct __pyx_obj_4yarl_10_quoting_c__Unquoter;
837 struct __pyx_t_4yarl_10_quoting_c_Writer;
838
839 /* "yarl/_quoting_c.pyx":79
840 * # ----------------- writer ---------------------------
841 *
842 * cdef struct Writer: # <<<<<<<<<<<<<<
843 * char *buf
844 * Py_ssize_t size
845 */
846 struct __pyx_t_4yarl_10_quoting_c_Writer {
847 char *buf;
848 Py_ssize_t size;
849 Py_ssize_t pos;
850 int changed;
851 };
852
853 /* "yarl/_quoting_c.pyx":169
854 *
855 *
856 * cdef class _Quoter: # <<<<<<<<<<<<<<
857 * cdef bint _qs
858 * cdef bint _requote
859 */
860 struct __pyx_obj_4yarl_10_quoting_c__Quoter {
861 PyObject_HEAD
862 struct __pyx_vtabstruct_4yarl_10_quoting_c__Quoter *__pyx_vtab;
863 int _qs;
864 int _requote;
865 uint8_t _safe_table[16];
866 uint8_t _protected_table[16];
867 };
868
869
870 /* "yarl/_quoting_c.pyx":271
871 *
872 *
873 * cdef class _Unquoter: # <<<<<<<<<<<<<<
874 * cdef str _unsafe
875 * cdef bint _qs
876 */
877 struct __pyx_obj_4yarl_10_quoting_c__Unquoter {
878 PyObject_HEAD
879 struct __pyx_vtabstruct_4yarl_10_quoting_c__Unquoter *__pyx_vtab;
880 PyObject *_unsafe;
881 int _qs;
882 struct __pyx_obj_4yarl_10_quoting_c__Quoter *_quoter;
883 struct __pyx_obj_4yarl_10_quoting_c__Quoter *_qs_quoter;
884 };
885
886
887
888 /* "yarl/_quoting_c.pyx":169
889 *
890 *
891 * cdef class _Quoter: # <<<<<<<<<<<<<<
892 * cdef bint _qs
893 * cdef bint _requote
894 */
895
896 struct __pyx_vtabstruct_4yarl_10_quoting_c__Quoter {
897 PyObject *(*_do_quote)(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, PyObject *, struct __pyx_t_4yarl_10_quoting_c_Writer *);
898 int (*_write)(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, struct __pyx_t_4yarl_10_quoting_c_Writer *, Py_UCS4);
899 };
900 static struct __pyx_vtabstruct_4yarl_10_quoting_c__Quoter *__pyx_vtabptr_4yarl_10_quoting_c__Quoter;
901 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c_7_Quoter__write(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, struct __pyx_t_4yarl_10_quoting_c_Writer *, Py_UCS4);
902
903
904 /* "yarl/_quoting_c.pyx":271
905 *
906 *
907 * cdef class _Unquoter: # <<<<<<<<<<<<<<
908 * cdef str _unsafe
909 * cdef bint _qs
910 */
911
912 struct __pyx_vtabstruct_4yarl_10_quoting_c__Unquoter {
913 PyObject *(*_do_unquote)(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *, PyObject *);
914 };
915 static struct __pyx_vtabstruct_4yarl_10_quoting_c__Unquoter *__pyx_vtabptr_4yarl_10_quoting_c__Unquoter;
916
917 /* --- Runtime support code (head) --- */
918 /* Refnanny.proto */
919 #ifndef CYTHON_REFNANNY
920 #define CYTHON_REFNANNY 0
921 #endif
922 #if CYTHON_REFNANNY
923 typedef struct {
924 void (*INCREF)(void*, PyObject*, int);
925 void (*DECREF)(void*, PyObject*, int);
926 void (*GOTREF)(void*, PyObject*, int);
927 void (*GIVEREF)(void*, PyObject*, int);
928 void* (*SetupContext)(const char*, int, const char*);
929 void (*FinishContext)(void**);
930 } __Pyx_RefNannyAPIStruct;
931 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
932 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
933 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
934 #ifdef WITH_THREAD
935 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
936 if (acquire_gil) {\
937 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
938 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
939 PyGILState_Release(__pyx_gilstate_save);\
940 } else {\
941 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
942 }
943 #else
944 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
945 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
946 #endif
947 #define __Pyx_RefNannyFinishContext()\
948 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
949 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
950 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
951 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
952 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
953 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
954 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
955 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
956 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
957 #else
958 #define __Pyx_RefNannyDeclarations
959 #define __Pyx_RefNannySetupContext(name, acquire_gil)
960 #define __Pyx_RefNannyFinishContext()
961 #define __Pyx_INCREF(r) Py_INCREF(r)
962 #define __Pyx_DECREF(r) Py_DECREF(r)
963 #define __Pyx_GOTREF(r)
964 #define __Pyx_GIVEREF(r)
965 #define __Pyx_XINCREF(r) Py_XINCREF(r)
966 #define __Pyx_XDECREF(r) Py_XDECREF(r)
967 #define __Pyx_XGOTREF(r)
968 #define __Pyx_XGIVEREF(r)
969 #endif
970 #define __Pyx_XDECREF_SET(r, v) do {\
971 PyObject *tmp = (PyObject *) r;\
972 r = v; __Pyx_XDECREF(tmp);\
973 } while (0)
974 #define __Pyx_DECREF_SET(r, v) do {\
975 PyObject *tmp = (PyObject *) r;\
976 r = v; __Pyx_DECREF(tmp);\
977 } while (0)
978 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
979 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
980
981 /* PyObjectGetAttrStr.proto */
982 #if CYTHON_USE_TYPE_SLOTS
983 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
984 #else
985 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
986 #endif
987
988 /* GetBuiltinName.proto */
989 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
990
991 /* PyThreadStateGet.proto */
992 #if CYTHON_FAST_THREAD_STATE
993 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
994 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
995 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
996 #else
997 #define __Pyx_PyThreadState_declare
998 #define __Pyx_PyThreadState_assign
999 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1000 #endif
1001
1002 /* PyErrFetchRestore.proto */
1003 #if CYTHON_FAST_THREAD_STATE
1004 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1005 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1006 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1007 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1008 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1009 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1010 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1011 #if CYTHON_COMPILING_IN_CPYTHON
1012 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1013 #else
1014 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1015 #endif
1016 #else
1017 #define __Pyx_PyErr_Clear() PyErr_Clear()
1018 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1019 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1020 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1021 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1022 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1023 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1024 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1025 #endif
1026
1027 /* WriteUnraisableException.proto */
1028 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1029 int lineno, const char *filename,
1030 int full_traceback, int nogil);
1031
1032 /* RaiseDoubleKeywords.proto */
1033 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1034
1035 /* ParseKeywords.proto */
1036 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1037 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1038 const char* function_name);
1039
1040 /* RaiseArgTupleInvalid.proto */
1041 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1042 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1043
1044 /* ArgTypeTest.proto */
1045 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1046 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1047 __Pyx__ArgTypeTest(obj, type, name, exact))
1048 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1049
1050 /* unicode_iter.proto */
1051 static CYTHON_INLINE int __Pyx_init_unicode_iteration(
1052 PyObject* ustring, Py_ssize_t *length, void** data, int *kind);
1053
1054 /* PyObjectCall.proto */
1055 #if CYTHON_COMPILING_IN_CPYTHON
1056 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1057 #else
1058 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1059 #endif
1060
1061 /* RaiseException.proto */
1062 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1063
1064 /* PyCFunctionFastCall.proto */
1065 #if CYTHON_FAST_PYCCALL
1066 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1067 #else
1068 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1069 #endif
1070
1071 /* PyFunctionFastCall.proto */
1072 #if CYTHON_FAST_PYCALL
1073 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1074 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1075 #if 1 || PY_VERSION_HEX < 0x030600B1
1076 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1077 #else
1078 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1079 #endif
1080 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1081 (sizeof(char [1 - 2*!(cond)]) - 1)
1082 #ifndef Py_MEMBER_SIZE
1083 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1084 #endif
1085 static size_t __pyx_pyframe_localsplus_offset = 0;
1086 #include "frameobject.h"
1087 #define __Pxy_PyFrame_Initialize_Offsets()\
1088 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1089 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1090 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1091 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1092 #endif
1093
1094 /* PyObjectCallMethO.proto */
1095 #if CYTHON_COMPILING_IN_CPYTHON
1096 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1097 #endif
1098
1099 /* PyObjectCallOneArg.proto */
1100 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1101
1102 /* GetException.proto */
1103 #if CYTHON_FAST_THREAD_STATE
1104 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1105 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1106 #else
1107 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1108 #endif
1109
1110 /* SwapException.proto */
1111 #if CYTHON_FAST_THREAD_STATE
1112 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1113 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1114 #else
1115 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1116 #endif
1117
1118 /* GetTopmostException.proto */
1119 #if CYTHON_USE_EXC_INFO_STACK
1120 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1121 #endif
1122
1123 /* SaveResetException.proto */
1124 #if CYTHON_FAST_THREAD_STATE
1125 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1126 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1127 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1128 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1129 #else
1130 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1131 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1132 #endif
1133
1134 /* GetItemIntUnicode.proto */
1135 #define __Pyx_GetItemInt_Unicode(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1136 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1137 __Pyx_GetItemInt_Unicode_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1138 (PyErr_SetString(PyExc_IndexError, "string index out of range"), (Py_UCS4)-1))
1139 static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
1140 int wraparound, int boundscheck);
1141
1142 /* ReRaiseException.proto */
1143 static CYTHON_INLINE void __Pyx_ReraiseException(void);
1144
1145 /* PyErrExceptionMatches.proto */
1146 #if CYTHON_FAST_THREAD_STATE
1147 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1148 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1149 #else
1150 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1151 #endif
1152
1153 /* GetAttr.proto */
1154 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1155
1156 /* GetAttr3.proto */
1157 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1158
1159 /* PyDictVersioning.proto */
1160 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1161 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1162 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1163 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1164 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1165 (cache_var) = (value);
1166 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1167 static PY_UINT64_T __pyx_dict_version = 0;\
1168 static PyObject *__pyx_dict_cached_value = NULL;\
1169 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1170 (VAR) = __pyx_dict_cached_value;\
1171 } else {\
1172 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1173 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1174 }\
1175 }
1176 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1177 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1178 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1179 #else
1180 #define __PYX_GET_DICT_VERSION(dict) (0)
1181 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1182 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1183 #endif
1184
1185 /* GetModuleGlobalName.proto */
1186 #if CYTHON_USE_DICT_VERSIONS
1187 #define __Pyx_GetModuleGlobalName(var, name) {\
1188 static PY_UINT64_T __pyx_dict_version = 0;\
1189 static PyObject *__pyx_dict_cached_value = NULL;\
1190 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1191 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1192 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1193 }
1194 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1195 PY_UINT64_T __pyx_dict_version;\
1196 PyObject *__pyx_dict_cached_value;\
1197 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1198 }
1199 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1200 #else
1201 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1202 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1203 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1204 #endif
1205
1206 /* PyObjectCallNoArg.proto */
1207 #if CYTHON_COMPILING_IN_CPYTHON
1208 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1209 #else
1210 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1211 #endif
1212
1213 /* ListAppend.proto */
1214 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1215 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1216 PyListObject* L = (PyListObject*) list;
1217 Py_ssize_t len = Py_SIZE(list);
1218 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1219 Py_INCREF(x);
1220 PyList_SET_ITEM(list, len, x);
1221 __Pyx_SET_SIZE(list, len + 1);
1222 return 0;
1223 }
1224 return PyList_Append(list, x);
1225 }
1226 #else
1227 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1228 #endif
1229
1230 /* PyUnicode_Substring.proto */
1231 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
1232 PyObject* text, Py_ssize_t start, Py_ssize_t stop);
1233
1234 /* PyUnicodeContains.proto */
__Pyx_PyUnicode_ContainsTF(PyObject * substring,PyObject * text,int eq)1235 static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
1236 int result = PyUnicode_Contains(text, substring);
1237 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1238 }
1239
1240 /* PyObjectCall2Args.proto */
1241 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1242
1243 /* SliceObject.proto */
1244 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1245 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1246 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1247 int has_cstart, int has_cstop, int wraparound);
1248
1249 /* Import.proto */
1250 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1251
1252 /* ImportFrom.proto */
1253 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1254
1255 /* GetItemInt.proto */
1256 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1257 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1258 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1259 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1260 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1261 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1262 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1263 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1264 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1265 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1266 int wraparound, int boundscheck);
1267 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1268 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1269 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1270 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1271 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1272 int wraparound, int boundscheck);
1273 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1274 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1275 int is_list, int wraparound, int boundscheck);
1276
1277 /* IncludeStringH.proto */
1278 #include <string.h>
1279
1280 /* HasAttr.proto */
1281 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1282
1283 /* ExtTypeTest.proto */
1284 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1285
1286 /* PyObject_GenericGetAttrNoDict.proto */
1287 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1288 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1289 #else
1290 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1291 #endif
1292
1293 /* PyObject_GenericGetAttr.proto */
1294 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1295 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1296 #else
1297 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1298 #endif
1299
1300 /* SetVTable.proto */
1301 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1302
1303 /* PyObjectGetAttrStrNoError.proto */
1304 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1305
1306 /* SetupReduce.proto */
1307 static int __Pyx_setup_reduce(PyObject* type_obj);
1308
1309 /* TypeImport.proto */
1310 #ifndef __PYX_HAVE_RT_ImportType_proto
1311 #define __PYX_HAVE_RT_ImportType_proto
1312 enum __Pyx_ImportType_CheckSize {
1313 __Pyx_ImportType_CheckSize_Error = 0,
1314 __Pyx_ImportType_CheckSize_Warn = 1,
1315 __Pyx_ImportType_CheckSize_Ignore = 2
1316 };
1317 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1318 #endif
1319
1320 /* CLineInTraceback.proto */
1321 #ifdef CYTHON_CLINE_IN_TRACEBACK
1322 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1323 #else
1324 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1325 #endif
1326
1327 /* CodeObjectCache.proto */
1328 typedef struct {
1329 PyCodeObject* code_object;
1330 int code_line;
1331 } __Pyx_CodeObjectCacheEntry;
1332 struct __Pyx_CodeObjectCache {
1333 int count;
1334 int max_count;
1335 __Pyx_CodeObjectCacheEntry* entries;
1336 };
1337 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1338 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1339 static PyCodeObject *__pyx_find_code_object(int code_line);
1340 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1341
1342 /* AddTraceback.proto */
1343 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1344 int py_line, const char *filename);
1345
1346 /* GCCDiagnostics.proto */
1347 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1348 #define __Pyx_HAS_GCC_DIAGNOSTIC
1349 #endif
1350
1351 /* PyUCS4InUnicode.proto */
1352 static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character);
1353
1354 /* UnicodeAsUCS4.proto */
1355 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);
1356
1357 /* CIntFromPy.proto */
1358 static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *);
1359
1360 /* CIntFromPy.proto */
1361 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
1362
1363 /* CIntFromPy.proto */
1364 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1365
1366 /* CIntToPy.proto */
1367 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1368
1369 /* CIntToPy.proto */
1370 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1371
1372 /* ObjectAsUCS4.proto */
1373 #define __Pyx_PyObject_AsPy_UCS4(x)\
1374 (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x))
1375 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*);
1376
1377 /* CIntFromPy.proto */
1378 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1379
1380 /* FastTypeChecks.proto */
1381 #if CYTHON_COMPILING_IN_CPYTHON
1382 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1383 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1384 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1385 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1386 #else
1387 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1388 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1389 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1390 #endif
1391 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1392
1393 /* CheckBinaryVersion.proto */
1394 static int __Pyx_check_binary_version(void);
1395
1396 /* InitStrings.proto */
1397 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1398
1399 static PyObject *__pyx_f_4yarl_10_quoting_c_7_Quoter__do_quote(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_val, struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer); /* proto*/
1400 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c_7_Quoter__write(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer, Py_UCS4 __pyx_v_ch); /* proto*/
1401 static PyObject *__pyx_f_4yarl_10_quoting_c_9_Unquoter__do_unquote(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_val); /* proto*/
1402
1403 /* Module declarations from 'libc.stdint' */
1404
1405 /* Module declarations from 'libc.string' */
1406
1407 /* Module declarations from 'libc.stdio' */
1408
1409 /* Module declarations from '__builtin__' */
1410
1411 /* Module declarations from 'cpython.type' */
1412 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1413
1414 /* Module declarations from 'cpython' */
1415
1416 /* Module declarations from 'cpython.object' */
1417
1418 /* Module declarations from 'cpython.exc' */
1419
1420 /* Module declarations from 'cpython.mem' */
1421
1422 /* Module declarations from 'cpython.unicode' */
1423
1424 /* Module declarations from 'yarl._quoting_c' */
1425 static PyTypeObject *__pyx_ptype_4yarl_10_quoting_c__Quoter = 0;
1426 static PyTypeObject *__pyx_ptype_4yarl_10_quoting_c__Unquoter = 0;
1427 static PyObject *__pyx_v_4yarl_10_quoting_c_GEN_DELIMS = 0;
1428 static PyObject *__pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS = 0;
1429 static PyObject *__pyx_v_4yarl_10_quoting_c_SUB_DELIMS = 0;
1430 static PyObject *__pyx_v_4yarl_10_quoting_c_RESERVED = 0;
1431 static PyObject *__pyx_v_4yarl_10_quoting_c_UNRESERVED = 0;
1432 static PyObject *__pyx_v_4yarl_10_quoting_c_ALLOWED = 0;
1433 static PyObject *__pyx_v_4yarl_10_quoting_c_QS = 0;
1434 static char __pyx_v_4yarl_10_quoting_c_BUFFER[0x2000];
1435 static uint8_t __pyx_v_4yarl_10_quoting_c_ALLOWED_TABLE[16];
1436 static uint8_t __pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE[16];
1437 static CYTHON_INLINE Py_UCS4 __pyx_f_4yarl_10_quoting_c__to_hex(uint8_t); /*proto*/
1438 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__from_hex(Py_UCS4); /*proto*/
1439 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__is_lower_hex(Py_UCS4); /*proto*/
1440 static CYTHON_INLINE Py_UCS4 __pyx_f_4yarl_10_quoting_c__restore_ch(Py_UCS4, Py_UCS4); /*proto*/
1441 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c_bit_at(uint8_t *, uint64_t); /*proto*/
1442 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c_set_bit(uint8_t *, uint64_t); /*proto*/
1443 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c__init_writer(struct __pyx_t_4yarl_10_quoting_c_Writer *); /*proto*/
1444 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c__release_writer(struct __pyx_t_4yarl_10_quoting_c_Writer *); /*proto*/
1445 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_char(struct __pyx_t_4yarl_10_quoting_c_Writer *, Py_UCS4, int); /*proto*/
1446 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_pct(struct __pyx_t_4yarl_10_quoting_c_Writer *, uint8_t, int); /*proto*/
1447 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_utf8(struct __pyx_t_4yarl_10_quoting_c_Writer *, Py_UCS4); /*proto*/
1448 static PyObject *__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Quoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, PyObject *); /*proto*/
1449 static PyObject *__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Unquoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *, PyObject *); /*proto*/
1450 static int __Pyx_carray_from_py_uint8_t(PyObject *, uint8_t *, Py_ssize_t); /*proto*/
1451 #define __Pyx_MODULE_NAME "yarl._quoting_c"
1452 extern int __pyx_module_is_main_yarl___quoting_c;
1453 int __pyx_module_is_main_yarl___quoting_c = 0;
1454
1455 /* Implementation of 'yarl._quoting_c' */
1456 static PyObject *__pyx_builtin_range;
1457 static PyObject *__pyx_builtin_chr;
1458 static PyObject *__pyx_builtin_ValueError;
1459 static PyObject *__pyx_builtin_TypeError;
1460 static PyObject *__pyx_builtin_UnicodeDecodeError;
1461 static PyObject *__pyx_builtin_hex;
1462 static PyObject *__pyx_builtin_OverflowError;
1463 static PyObject *__pyx_builtin_enumerate;
1464 static PyObject *__pyx_builtin_IndexError;
1465 static const char __pyx_k_[] = "";
1466 static const char __pyx_k_i[] = "i";
1467 static const char __pyx_k__4[] = "+=&;";
1468 static const char __pyx_k__5[] = "+";
1469 static const char __pyx_k__6[] = " ";
1470 static const char __pyx_k__7[] = "%";
1471 static const char __pyx_k__9[] = ":/?#[]@";
1472 static const char __pyx_k_qs[] = "qs";
1473 static const char __pyx_k__10[] = "!$'()*,";
1474 static const char __pyx_k__11[] = "+?=;";
1475 static const char __pyx_k__12[] = "-._~";
1476 static const char __pyx_k__13[] = "+&=;";
1477 static const char __pyx_k_chr[] = "chr";
1478 static const char __pyx_k_hex[] = "hex";
1479 static const char __pyx_k_new[] = "__new__";
1480 static const char __pyx_k_val[] = "val";
1481 static const char __pyx_k_dict[] = "__dict__";
1482 static const char __pyx_k_main[] = "__main__";
1483 static const char __pyx_k_name[] = "__name__";
1484 static const char __pyx_k_safe[] = "safe";
1485 static const char __pyx_k_test[] = "__test__";
1486 static const char __pyx_k_range[] = "range";
1487 static const char __pyx_k_upper[] = "upper";
1488 static const char __pyx_k_Quoter[] = "_Quoter";
1489 static const char __pyx_k_digits[] = "digits";
1490 static const char __pyx_k_import[] = "__import__";
1491 static const char __pyx_k_pickle[] = "pickle";
1492 static const char __pyx_k_reduce[] = "__reduce__";
1493 static const char __pyx_k_string[] = "string";
1494 static const char __pyx_k_unsafe[] = "unsafe";
1495 static const char __pyx_k_update[] = "update";
1496 static const char __pyx_k_requote[] = "requote";
1497 static const char __pyx_k_Unquoter[] = "_Unquoter";
1498 static const char __pyx_k_getstate[] = "__getstate__";
1499 static const char __pyx_k_pyx_type[] = "__pyx_type";
1500 static const char __pyx_k_setstate[] = "__setstate__";
1501 static const char __pyx_k_TypeError[] = "TypeError";
1502 static const char __pyx_k_enumerate[] = "enumerate";
1503 static const char __pyx_k_protected[] = "protected";
1504 static const char __pyx_k_pyx_state[] = "__pyx_state";
1505 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1506 static const char __pyx_k_IndexError[] = "IndexError";
1507 static const char __pyx_k_ValueError[] = "ValueError";
1508 static const char __pyx_k_pyx_result[] = "__pyx_result";
1509 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1510 static const char __pyx_k_PickleError[] = "PickleError";
1511 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
1512 static const char __pyx_k_stringsource[] = "stringsource";
1513 static const char __pyx_k_OverflowError[] = "OverflowError";
1514 static const char __pyx_k_ascii_letters[] = "ascii_letters";
1515 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1516 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
1517 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1518 static const char __pyx_k_yarl__quoting_c[] = "yarl._quoting_c";
1519 static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
1520 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1521 static const char __pyx_k_pyx_unpickle__Quoter[] = "__pyx_unpickle__Quoter";
1522 static const char __pyx_k_Argument_should_be_str[] = "Argument should be str";
1523 static const char __pyx_k_pyx_unpickle__Unquoter[] = "__pyx_unpickle__Unquoter";
1524 static const char __pyx_k_Incompatible_checksums_s_vs_0x27[] = "Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))";
1525 static const char __pyx_k_Incompatible_checksums_s_vs_0xe9[] = "Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))";
1526 static const char __pyx_k_Only_safe_symbols_with_ORD_128_a[] = "Only safe symbols with ORD < 128 are allowed";
1527 static PyObject *__pyx_kp_u_;
1528 static PyObject *__pyx_kp_u_Argument_should_be_str;
1529 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x27;
1530 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xe9;
1531 static PyObject *__pyx_n_s_IndexError;
1532 static PyObject *__pyx_kp_u_Only_safe_symbols_with_ORD_128_a;
1533 static PyObject *__pyx_n_s_OverflowError;
1534 static PyObject *__pyx_n_s_PickleError;
1535 static PyObject *__pyx_n_s_Quoter;
1536 static PyObject *__pyx_n_s_TypeError;
1537 static PyObject *__pyx_n_s_UnicodeDecodeError;
1538 static PyObject *__pyx_n_s_Unquoter;
1539 static PyObject *__pyx_n_s_ValueError;
1540 static PyObject *__pyx_kp_u__10;
1541 static PyObject *__pyx_kp_u__11;
1542 static PyObject *__pyx_kp_u__12;
1543 static PyObject *__pyx_kp_u__13;
1544 static PyObject *__pyx_kp_u__4;
1545 static PyObject *__pyx_kp_u__5;
1546 static PyObject *__pyx_kp_u__6;
1547 static PyObject *__pyx_kp_u__7;
1548 static PyObject *__pyx_kp_u__9;
1549 static PyObject *__pyx_n_s_ascii_letters;
1550 static PyObject *__pyx_n_s_chr;
1551 static PyObject *__pyx_n_s_cline_in_traceback;
1552 static PyObject *__pyx_n_s_dict;
1553 static PyObject *__pyx_n_s_digits;
1554 static PyObject *__pyx_n_s_enumerate;
1555 static PyObject *__pyx_n_s_getstate;
1556 static PyObject *__pyx_n_s_hex;
1557 static PyObject *__pyx_n_s_i;
1558 static PyObject *__pyx_n_s_import;
1559 static PyObject *__pyx_n_s_main;
1560 static PyObject *__pyx_n_s_name;
1561 static PyObject *__pyx_n_s_new;
1562 static PyObject *__pyx_n_s_pickle;
1563 static PyObject *__pyx_n_s_protected;
1564 static PyObject *__pyx_n_s_pyx_PickleError;
1565 static PyObject *__pyx_n_s_pyx_checksum;
1566 static PyObject *__pyx_n_s_pyx_result;
1567 static PyObject *__pyx_n_s_pyx_state;
1568 static PyObject *__pyx_n_s_pyx_type;
1569 static PyObject *__pyx_n_s_pyx_unpickle__Quoter;
1570 static PyObject *__pyx_n_s_pyx_unpickle__Unquoter;
1571 static PyObject *__pyx_n_s_pyx_vtable;
1572 static PyObject *__pyx_n_s_qs;
1573 static PyObject *__pyx_n_s_range;
1574 static PyObject *__pyx_n_s_reduce;
1575 static PyObject *__pyx_n_s_reduce_cython;
1576 static PyObject *__pyx_n_s_reduce_ex;
1577 static PyObject *__pyx_n_s_requote;
1578 static PyObject *__pyx_n_s_safe;
1579 static PyObject *__pyx_n_s_setstate;
1580 static PyObject *__pyx_n_s_setstate_cython;
1581 static PyObject *__pyx_n_s_string;
1582 static PyObject *__pyx_kp_s_stringsource;
1583 static PyObject *__pyx_n_s_test;
1584 static PyObject *__pyx_n_s_unsafe;
1585 static PyObject *__pyx_n_s_update;
1586 static PyObject *__pyx_n_s_upper;
1587 static PyObject *__pyx_n_s_val;
1588 static PyObject *__pyx_n_s_yarl__quoting_c;
1589 static int __pyx_pf_4yarl_10_quoting_c_7_Quoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_safe, PyObject *__pyx_v_protected, int __pyx_v_qs, int __pyx_v_requote); /* proto */
1590 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1591 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self); /* proto */
1592 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1593 static int __pyx_pf_4yarl_10_quoting_c_9_Unquoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_unsafe, PyObject *__pyx_v_qs); /* proto */
1594 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1595 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self); /* proto */
1596 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
1597 static PyObject *__pyx_pf_4yarl_10_quoting_c___pyx_unpickle__Quoter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1598 static PyObject *__pyx_pf_4yarl_10_quoting_c_2__pyx_unpickle__Unquoter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
1599 static PyObject *__pyx_tp_new_4yarl_10_quoting_c__Quoter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1600 static PyObject *__pyx_tp_new_4yarl_10_quoting_c__Unquoter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1601 static PyObject *__pyx_int_2;
1602 static PyObject *__pyx_int_41310077;
1603 static PyObject *__pyx_int_244432181;
1604 static PyObject *__pyx_slice__8;
1605 static PyObject *__pyx_tuple__2;
1606 static PyObject *__pyx_tuple__3;
1607 static PyObject *__pyx_tuple__14;
1608 static PyObject *__pyx_tuple__16;
1609 static PyObject *__pyx_codeobj__15;
1610 static PyObject *__pyx_codeobj__17;
1611 /* Late includes */
1612
1613 /* "yarl/_quoting_c.pyx":23
1614 * cdef char BUFFER[BUF_SIZE]
1615 *
1616 * cdef inline Py_UCS4 _to_hex(uint8_t v): # <<<<<<<<<<<<<<
1617 * if v < 10:
1618 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30
1619 */
1620
__pyx_f_4yarl_10_quoting_c__to_hex(uint8_t __pyx_v_v)1621 static CYTHON_INLINE Py_UCS4 __pyx_f_4yarl_10_quoting_c__to_hex(uint8_t __pyx_v_v) {
1622 Py_UCS4 __pyx_r;
1623 __Pyx_RefNannyDeclarations
1624 int __pyx_t_1;
1625 __Pyx_RefNannySetupContext("_to_hex", 0);
1626
1627 /* "yarl/_quoting_c.pyx":24
1628 *
1629 * cdef inline Py_UCS4 _to_hex(uint8_t v):
1630 * if v < 10: # <<<<<<<<<<<<<<
1631 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30
1632 * else:
1633 */
1634 __pyx_t_1 = ((__pyx_v_v < 10) != 0);
1635 if (__pyx_t_1) {
1636
1637 /* "yarl/_quoting_c.pyx":25
1638 * cdef inline Py_UCS4 _to_hex(uint8_t v):
1639 * if v < 10:
1640 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30 # <<<<<<<<<<<<<<
1641 * else:
1642 * return <Py_UCS4>(v+0x41-10) # ord('A') == 0x41
1643 */
1644 __pyx_r = ((Py_UCS4)(__pyx_v_v + 0x30));
1645 goto __pyx_L0;
1646
1647 /* "yarl/_quoting_c.pyx":24
1648 *
1649 * cdef inline Py_UCS4 _to_hex(uint8_t v):
1650 * if v < 10: # <<<<<<<<<<<<<<
1651 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30
1652 * else:
1653 */
1654 }
1655
1656 /* "yarl/_quoting_c.pyx":27
1657 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30
1658 * else:
1659 * return <Py_UCS4>(v+0x41-10) # ord('A') == 0x41 # <<<<<<<<<<<<<<
1660 *
1661 *
1662 */
1663 /*else*/ {
1664 __pyx_r = ((Py_UCS4)((__pyx_v_v + 0x41) - 10));
1665 goto __pyx_L0;
1666 }
1667
1668 /* "yarl/_quoting_c.pyx":23
1669 * cdef char BUFFER[BUF_SIZE]
1670 *
1671 * cdef inline Py_UCS4 _to_hex(uint8_t v): # <<<<<<<<<<<<<<
1672 * if v < 10:
1673 * return <Py_UCS4>(v+0x30) # ord('0') == 0x30
1674 */
1675
1676 /* function exit code */
1677 __pyx_L0:;
1678 __Pyx_RefNannyFinishContext();
1679 return __pyx_r;
1680 }
1681
1682 /* "yarl/_quoting_c.pyx":30
1683 *
1684 *
1685 * cdef inline int _from_hex(Py_UCS4 v): # <<<<<<<<<<<<<<
1686 * if '0' <= v <= '9':
1687 * return <int>(v) - 0x30 # ord('0') == 0x30
1688 */
1689
__pyx_f_4yarl_10_quoting_c__from_hex(Py_UCS4 __pyx_v_v)1690 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__from_hex(Py_UCS4 __pyx_v_v) {
1691 int __pyx_r;
1692 __Pyx_RefNannyDeclarations
1693 int __pyx_t_1;
1694 int __pyx_t_2;
1695 __Pyx_RefNannySetupContext("_from_hex", 0);
1696
1697 /* "yarl/_quoting_c.pyx":31
1698 *
1699 * cdef inline int _from_hex(Py_UCS4 v):
1700 * if '0' <= v <= '9': # <<<<<<<<<<<<<<
1701 * return <int>(v) - 0x30 # ord('0') == 0x30
1702 * elif 'A' <= v <= 'F':
1703 */
1704 __pyx_t_1 = (48 <= __pyx_v_v);
1705 if (__pyx_t_1) {
1706 __pyx_t_1 = (__pyx_v_v <= 57);
1707 }
1708 __pyx_t_2 = (__pyx_t_1 != 0);
1709 if (__pyx_t_2) {
1710
1711 /* "yarl/_quoting_c.pyx":32
1712 * cdef inline int _from_hex(Py_UCS4 v):
1713 * if '0' <= v <= '9':
1714 * return <int>(v) - 0x30 # ord('0') == 0x30 # <<<<<<<<<<<<<<
1715 * elif 'A' <= v <= 'F':
1716 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1717 */
1718 __pyx_r = (((int)__pyx_v_v) - 0x30);
1719 goto __pyx_L0;
1720
1721 /* "yarl/_quoting_c.pyx":31
1722 *
1723 * cdef inline int _from_hex(Py_UCS4 v):
1724 * if '0' <= v <= '9': # <<<<<<<<<<<<<<
1725 * return <int>(v) - 0x30 # ord('0') == 0x30
1726 * elif 'A' <= v <= 'F':
1727 */
1728 }
1729
1730 /* "yarl/_quoting_c.pyx":33
1731 * if '0' <= v <= '9':
1732 * return <int>(v) - 0x30 # ord('0') == 0x30
1733 * elif 'A' <= v <= 'F': # <<<<<<<<<<<<<<
1734 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1735 * elif 'a' <= v <= 'f':
1736 */
1737 __pyx_t_2 = (65 <= __pyx_v_v);
1738 if (__pyx_t_2) {
1739 __pyx_t_2 = (__pyx_v_v <= 70);
1740 }
1741 __pyx_t_1 = (__pyx_t_2 != 0);
1742 if (__pyx_t_1) {
1743
1744 /* "yarl/_quoting_c.pyx":34
1745 * return <int>(v) - 0x30 # ord('0') == 0x30
1746 * elif 'A' <= v <= 'F':
1747 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41 # <<<<<<<<<<<<<<
1748 * elif 'a' <= v <= 'f':
1749 * return <int>(v) - 0x61 + 10 # ord('a') == 0x61
1750 */
1751 __pyx_r = ((((int)__pyx_v_v) - 0x41) + 10);
1752 goto __pyx_L0;
1753
1754 /* "yarl/_quoting_c.pyx":33
1755 * if '0' <= v <= '9':
1756 * return <int>(v) - 0x30 # ord('0') == 0x30
1757 * elif 'A' <= v <= 'F': # <<<<<<<<<<<<<<
1758 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1759 * elif 'a' <= v <= 'f':
1760 */
1761 }
1762
1763 /* "yarl/_quoting_c.pyx":35
1764 * elif 'A' <= v <= 'F':
1765 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1766 * elif 'a' <= v <= 'f': # <<<<<<<<<<<<<<
1767 * return <int>(v) - 0x61 + 10 # ord('a') == 0x61
1768 * else:
1769 */
1770 __pyx_t_1 = (97 <= __pyx_v_v);
1771 if (__pyx_t_1) {
1772 __pyx_t_1 = (__pyx_v_v <= 0x66);
1773 }
1774 __pyx_t_2 = (__pyx_t_1 != 0);
1775 if (__pyx_t_2) {
1776
1777 /* "yarl/_quoting_c.pyx":36
1778 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1779 * elif 'a' <= v <= 'f':
1780 * return <int>(v) - 0x61 + 10 # ord('a') == 0x61 # <<<<<<<<<<<<<<
1781 * else:
1782 * return -1
1783 */
1784 __pyx_r = ((((int)__pyx_v_v) - 0x61) + 10);
1785 goto __pyx_L0;
1786
1787 /* "yarl/_quoting_c.pyx":35
1788 * elif 'A' <= v <= 'F':
1789 * return <int>(v) - 0x41 + 10 # ord('A') == 0x41
1790 * elif 'a' <= v <= 'f': # <<<<<<<<<<<<<<
1791 * return <int>(v) - 0x61 + 10 # ord('a') == 0x61
1792 * else:
1793 */
1794 }
1795
1796 /* "yarl/_quoting_c.pyx":38
1797 * return <int>(v) - 0x61 + 10 # ord('a') == 0x61
1798 * else:
1799 * return -1 # <<<<<<<<<<<<<<
1800 *
1801 *
1802 */
1803 /*else*/ {
1804 __pyx_r = -1;
1805 goto __pyx_L0;
1806 }
1807
1808 /* "yarl/_quoting_c.pyx":30
1809 *
1810 *
1811 * cdef inline int _from_hex(Py_UCS4 v): # <<<<<<<<<<<<<<
1812 * if '0' <= v <= '9':
1813 * return <int>(v) - 0x30 # ord('0') == 0x30
1814 */
1815
1816 /* function exit code */
1817 __pyx_L0:;
1818 __Pyx_RefNannyFinishContext();
1819 return __pyx_r;
1820 }
1821
1822 /* "yarl/_quoting_c.pyx":41
1823 *
1824 *
1825 * cdef inline int _is_lower_hex(Py_UCS4 v): # <<<<<<<<<<<<<<
1826 * return 'a' <= v <= 'f'
1827 *
1828 */
1829
__pyx_f_4yarl_10_quoting_c__is_lower_hex(Py_UCS4 __pyx_v_v)1830 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__is_lower_hex(Py_UCS4 __pyx_v_v) {
1831 int __pyx_r;
1832 __Pyx_RefNannyDeclarations
1833 int __pyx_t_1;
1834 __Pyx_RefNannySetupContext("_is_lower_hex", 0);
1835
1836 /* "yarl/_quoting_c.pyx":42
1837 *
1838 * cdef inline int _is_lower_hex(Py_UCS4 v):
1839 * return 'a' <= v <= 'f' # <<<<<<<<<<<<<<
1840 *
1841 *
1842 */
1843 __pyx_t_1 = (97 <= __pyx_v_v);
1844 if (__pyx_t_1) {
1845 __pyx_t_1 = (__pyx_v_v <= 0x66);
1846 }
1847 __pyx_r = __pyx_t_1;
1848 goto __pyx_L0;
1849
1850 /* "yarl/_quoting_c.pyx":41
1851 *
1852 *
1853 * cdef inline int _is_lower_hex(Py_UCS4 v): # <<<<<<<<<<<<<<
1854 * return 'a' <= v <= 'f'
1855 *
1856 */
1857
1858 /* function exit code */
1859 __pyx_L0:;
1860 __Pyx_RefNannyFinishContext();
1861 return __pyx_r;
1862 }
1863
1864 /* "yarl/_quoting_c.pyx":45
1865 *
1866 *
1867 * cdef inline Py_UCS4 _restore_ch(Py_UCS4 d1, Py_UCS4 d2): # <<<<<<<<<<<<<<
1868 * cdef int digit1 = _from_hex(d1)
1869 * if digit1 < 0:
1870 */
1871
__pyx_f_4yarl_10_quoting_c__restore_ch(Py_UCS4 __pyx_v_d1,Py_UCS4 __pyx_v_d2)1872 static CYTHON_INLINE Py_UCS4 __pyx_f_4yarl_10_quoting_c__restore_ch(Py_UCS4 __pyx_v_d1, Py_UCS4 __pyx_v_d2) {
1873 int __pyx_v_digit1;
1874 int __pyx_v_digit2;
1875 Py_UCS4 __pyx_r;
1876 __Pyx_RefNannyDeclarations
1877 int __pyx_t_1;
1878 __Pyx_RefNannySetupContext("_restore_ch", 0);
1879
1880 /* "yarl/_quoting_c.pyx":46
1881 *
1882 * cdef inline Py_UCS4 _restore_ch(Py_UCS4 d1, Py_UCS4 d2):
1883 * cdef int digit1 = _from_hex(d1) # <<<<<<<<<<<<<<
1884 * if digit1 < 0:
1885 * return <Py_UCS4>-1
1886 */
1887 __pyx_v_digit1 = __pyx_f_4yarl_10_quoting_c__from_hex(__pyx_v_d1);
1888
1889 /* "yarl/_quoting_c.pyx":47
1890 * cdef inline Py_UCS4 _restore_ch(Py_UCS4 d1, Py_UCS4 d2):
1891 * cdef int digit1 = _from_hex(d1)
1892 * if digit1 < 0: # <<<<<<<<<<<<<<
1893 * return <Py_UCS4>-1
1894 * cdef int digit2 = _from_hex(d2)
1895 */
1896 __pyx_t_1 = ((__pyx_v_digit1 < 0) != 0);
1897 if (__pyx_t_1) {
1898
1899 /* "yarl/_quoting_c.pyx":48
1900 * cdef int digit1 = _from_hex(d1)
1901 * if digit1 < 0:
1902 * return <Py_UCS4>-1 # <<<<<<<<<<<<<<
1903 * cdef int digit2 = _from_hex(d2)
1904 * if digit2 < 0:
1905 */
1906 __pyx_r = ((Py_UCS4)-1L);
1907 goto __pyx_L0;
1908
1909 /* "yarl/_quoting_c.pyx":47
1910 * cdef inline Py_UCS4 _restore_ch(Py_UCS4 d1, Py_UCS4 d2):
1911 * cdef int digit1 = _from_hex(d1)
1912 * if digit1 < 0: # <<<<<<<<<<<<<<
1913 * return <Py_UCS4>-1
1914 * cdef int digit2 = _from_hex(d2)
1915 */
1916 }
1917
1918 /* "yarl/_quoting_c.pyx":49
1919 * if digit1 < 0:
1920 * return <Py_UCS4>-1
1921 * cdef int digit2 = _from_hex(d2) # <<<<<<<<<<<<<<
1922 * if digit2 < 0:
1923 * return <Py_UCS4>-1
1924 */
1925 __pyx_v_digit2 = __pyx_f_4yarl_10_quoting_c__from_hex(__pyx_v_d2);
1926
1927 /* "yarl/_quoting_c.pyx":50
1928 * return <Py_UCS4>-1
1929 * cdef int digit2 = _from_hex(d2)
1930 * if digit2 < 0: # <<<<<<<<<<<<<<
1931 * return <Py_UCS4>-1
1932 * return <Py_UCS4>(digit1 << 4 | digit2)
1933 */
1934 __pyx_t_1 = ((__pyx_v_digit2 < 0) != 0);
1935 if (__pyx_t_1) {
1936
1937 /* "yarl/_quoting_c.pyx":51
1938 * cdef int digit2 = _from_hex(d2)
1939 * if digit2 < 0:
1940 * return <Py_UCS4>-1 # <<<<<<<<<<<<<<
1941 * return <Py_UCS4>(digit1 << 4 | digit2)
1942 *
1943 */
1944 __pyx_r = ((Py_UCS4)-1L);
1945 goto __pyx_L0;
1946
1947 /* "yarl/_quoting_c.pyx":50
1948 * return <Py_UCS4>-1
1949 * cdef int digit2 = _from_hex(d2)
1950 * if digit2 < 0: # <<<<<<<<<<<<<<
1951 * return <Py_UCS4>-1
1952 * return <Py_UCS4>(digit1 << 4 | digit2)
1953 */
1954 }
1955
1956 /* "yarl/_quoting_c.pyx":52
1957 * if digit2 < 0:
1958 * return <Py_UCS4>-1
1959 * return <Py_UCS4>(digit1 << 4 | digit2) # <<<<<<<<<<<<<<
1960 *
1961 *
1962 */
1963 __pyx_r = ((Py_UCS4)((__pyx_v_digit1 << 4) | __pyx_v_digit2));
1964 goto __pyx_L0;
1965
1966 /* "yarl/_quoting_c.pyx":45
1967 *
1968 *
1969 * cdef inline Py_UCS4 _restore_ch(Py_UCS4 d1, Py_UCS4 d2): # <<<<<<<<<<<<<<
1970 * cdef int digit1 = _from_hex(d1)
1971 * if digit1 < 0:
1972 */
1973
1974 /* function exit code */
1975 __pyx_L0:;
1976 __Pyx_RefNannyFinishContext();
1977 return __pyx_r;
1978 }
1979
1980 /* "yarl/_quoting_c.pyx":59
1981 *
1982 *
1983 * cdef inline bint bit_at(uint8_t array[], uint64_t ch): # <<<<<<<<<<<<<<
1984 * return array[ch >> 3] & (1 << (ch & 7))
1985 *
1986 */
1987
__pyx_f_4yarl_10_quoting_c_bit_at(uint8_t * __pyx_v_array,uint64_t __pyx_v_ch)1988 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c_bit_at(uint8_t *__pyx_v_array, uint64_t __pyx_v_ch) {
1989 int __pyx_r;
1990 __Pyx_RefNannyDeclarations
1991 __Pyx_RefNannySetupContext("bit_at", 0);
1992
1993 /* "yarl/_quoting_c.pyx":60
1994 *
1995 * cdef inline bint bit_at(uint8_t array[], uint64_t ch):
1996 * return array[ch >> 3] & (1 << (ch & 7)) # <<<<<<<<<<<<<<
1997 *
1998 *
1999 */
2000 __pyx_r = ((__pyx_v_array[(__pyx_v_ch >> 3)]) & (1 << (__pyx_v_ch & 7)));
2001 goto __pyx_L0;
2002
2003 /* "yarl/_quoting_c.pyx":59
2004 *
2005 *
2006 * cdef inline bint bit_at(uint8_t array[], uint64_t ch): # <<<<<<<<<<<<<<
2007 * return array[ch >> 3] & (1 << (ch & 7))
2008 *
2009 */
2010
2011 /* function exit code */
2012 __pyx_L0:;
2013 __Pyx_RefNannyFinishContext();
2014 return __pyx_r;
2015 }
2016
2017 /* "yarl/_quoting_c.pyx":63
2018 *
2019 *
2020 * cdef inline void set_bit(uint8_t array[], uint64_t ch): # <<<<<<<<<<<<<<
2021 * array[ch >> 3] |= (1 << (ch & 7))
2022 *
2023 */
2024
__pyx_f_4yarl_10_quoting_c_set_bit(uint8_t * __pyx_v_array,uint64_t __pyx_v_ch)2025 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c_set_bit(uint8_t *__pyx_v_array, uint64_t __pyx_v_ch) {
2026 __Pyx_RefNannyDeclarations
2027 uint64_t __pyx_t_1;
2028 __Pyx_RefNannySetupContext("set_bit", 0);
2029
2030 /* "yarl/_quoting_c.pyx":64
2031 *
2032 * cdef inline void set_bit(uint8_t array[], uint64_t ch):
2033 * array[ch >> 3] |= (1 << (ch & 7)) # <<<<<<<<<<<<<<
2034 *
2035 *
2036 */
2037 __pyx_t_1 = (__pyx_v_ch >> 3);
2038 (__pyx_v_array[__pyx_t_1]) = ((__pyx_v_array[__pyx_t_1]) | (1 << (__pyx_v_ch & 7)));
2039
2040 /* "yarl/_quoting_c.pyx":63
2041 *
2042 *
2043 * cdef inline void set_bit(uint8_t array[], uint64_t ch): # <<<<<<<<<<<<<<
2044 * array[ch >> 3] |= (1 << (ch & 7))
2045 *
2046 */
2047
2048 /* function exit code */
2049 __Pyx_RefNannyFinishContext();
2050 }
2051
2052 /* "yarl/_quoting_c.pyx":86
2053 *
2054 *
2055 * cdef inline void _init_writer(Writer* writer): # <<<<<<<<<<<<<<
2056 * writer.buf = &BUFFER[0]
2057 * writer.size = BUF_SIZE
2058 */
2059
__pyx_f_4yarl_10_quoting_c__init_writer(struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer)2060 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c__init_writer(struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer) {
2061 __Pyx_RefNannyDeclarations
2062 __Pyx_RefNannySetupContext("_init_writer", 0);
2063
2064 /* "yarl/_quoting_c.pyx":87
2065 *
2066 * cdef inline void _init_writer(Writer* writer):
2067 * writer.buf = &BUFFER[0] # <<<<<<<<<<<<<<
2068 * writer.size = BUF_SIZE
2069 * writer.pos = 0
2070 */
2071 __pyx_v_writer->buf = (&(__pyx_v_4yarl_10_quoting_c_BUFFER[0]));
2072
2073 /* "yarl/_quoting_c.pyx":88
2074 * cdef inline void _init_writer(Writer* writer):
2075 * writer.buf = &BUFFER[0]
2076 * writer.size = BUF_SIZE # <<<<<<<<<<<<<<
2077 * writer.pos = 0
2078 * writer.changed = 0
2079 */
2080 __pyx_v_writer->size = 0x2000;
2081
2082 /* "yarl/_quoting_c.pyx":89
2083 * writer.buf = &BUFFER[0]
2084 * writer.size = BUF_SIZE
2085 * writer.pos = 0 # <<<<<<<<<<<<<<
2086 * writer.changed = 0
2087 *
2088 */
2089 __pyx_v_writer->pos = 0;
2090
2091 /* "yarl/_quoting_c.pyx":90
2092 * writer.size = BUF_SIZE
2093 * writer.pos = 0
2094 * writer.changed = 0 # <<<<<<<<<<<<<<
2095 *
2096 *
2097 */
2098 __pyx_v_writer->changed = 0;
2099
2100 /* "yarl/_quoting_c.pyx":86
2101 *
2102 *
2103 * cdef inline void _init_writer(Writer* writer): # <<<<<<<<<<<<<<
2104 * writer.buf = &BUFFER[0]
2105 * writer.size = BUF_SIZE
2106 */
2107
2108 /* function exit code */
2109 __Pyx_RefNannyFinishContext();
2110 }
2111
2112 /* "yarl/_quoting_c.pyx":93
2113 *
2114 *
2115 * cdef inline void _release_writer(Writer* writer): # <<<<<<<<<<<<<<
2116 * if writer.buf != BUFFER:
2117 * PyMem_Free(writer.buf)
2118 */
2119
__pyx_f_4yarl_10_quoting_c__release_writer(struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer)2120 static CYTHON_INLINE void __pyx_f_4yarl_10_quoting_c__release_writer(struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer) {
2121 __Pyx_RefNannyDeclarations
2122 int __pyx_t_1;
2123 __Pyx_RefNannySetupContext("_release_writer", 0);
2124
2125 /* "yarl/_quoting_c.pyx":94
2126 *
2127 * cdef inline void _release_writer(Writer* writer):
2128 * if writer.buf != BUFFER: # <<<<<<<<<<<<<<
2129 * PyMem_Free(writer.buf)
2130 *
2131 */
2132 __pyx_t_1 = ((__pyx_v_writer->buf != __pyx_v_4yarl_10_quoting_c_BUFFER) != 0);
2133 if (__pyx_t_1) {
2134
2135 /* "yarl/_quoting_c.pyx":95
2136 * cdef inline void _release_writer(Writer* writer):
2137 * if writer.buf != BUFFER:
2138 * PyMem_Free(writer.buf) # <<<<<<<<<<<<<<
2139 *
2140 *
2141 */
2142 PyMem_Free(__pyx_v_writer->buf);
2143
2144 /* "yarl/_quoting_c.pyx":94
2145 *
2146 * cdef inline void _release_writer(Writer* writer):
2147 * if writer.buf != BUFFER: # <<<<<<<<<<<<<<
2148 * PyMem_Free(writer.buf)
2149 *
2150 */
2151 }
2152
2153 /* "yarl/_quoting_c.pyx":93
2154 *
2155 *
2156 * cdef inline void _release_writer(Writer* writer): # <<<<<<<<<<<<<<
2157 * if writer.buf != BUFFER:
2158 * PyMem_Free(writer.buf)
2159 */
2160
2161 /* function exit code */
2162 __Pyx_RefNannyFinishContext();
2163 }
2164
2165 /* "yarl/_quoting_c.pyx":98
2166 *
2167 *
2168 * cdef inline int _write_char(Writer* writer, Py_UCS4 ch, bint changed): # <<<<<<<<<<<<<<
2169 * cdef char * buf
2170 * cdef Py_ssize_t size
2171 */
2172
__pyx_f_4yarl_10_quoting_c__write_char(struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer,Py_UCS4 __pyx_v_ch,int __pyx_v_changed)2173 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_char(struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer, Py_UCS4 __pyx_v_ch, int __pyx_v_changed) {
2174 char *__pyx_v_buf;
2175 Py_ssize_t __pyx_v_size;
2176 int __pyx_r;
2177 __Pyx_RefNannyDeclarations
2178 int __pyx_t_1;
2179 PyObject *__pyx_t_2;
2180 int __pyx_lineno = 0;
2181 const char *__pyx_filename = NULL;
2182 int __pyx_clineno = 0;
2183 __Pyx_RefNannySetupContext("_write_char", 0);
2184
2185 /* "yarl/_quoting_c.pyx":102
2186 * cdef Py_ssize_t size
2187 *
2188 * if writer.pos == writer.size: # <<<<<<<<<<<<<<
2189 * # reallocate
2190 * size = writer.size + BUF_SIZE
2191 */
2192 __pyx_t_1 = ((__pyx_v_writer->pos == __pyx_v_writer->size) != 0);
2193 if (__pyx_t_1) {
2194
2195 /* "yarl/_quoting_c.pyx":104
2196 * if writer.pos == writer.size:
2197 * # reallocate
2198 * size = writer.size + BUF_SIZE # <<<<<<<<<<<<<<
2199 * if writer.buf == BUFFER:
2200 * buf = <char*>PyMem_Malloc(size)
2201 */
2202 __pyx_v_size = (__pyx_v_writer->size + 0x2000);
2203
2204 /* "yarl/_quoting_c.pyx":105
2205 * # reallocate
2206 * size = writer.size + BUF_SIZE
2207 * if writer.buf == BUFFER: # <<<<<<<<<<<<<<
2208 * buf = <char*>PyMem_Malloc(size)
2209 * if buf == NULL:
2210 */
2211 __pyx_t_1 = ((__pyx_v_writer->buf == __pyx_v_4yarl_10_quoting_c_BUFFER) != 0);
2212 if (__pyx_t_1) {
2213
2214 /* "yarl/_quoting_c.pyx":106
2215 * size = writer.size + BUF_SIZE
2216 * if writer.buf == BUFFER:
2217 * buf = <char*>PyMem_Malloc(size) # <<<<<<<<<<<<<<
2218 * if buf == NULL:
2219 * PyErr_NoMemory()
2220 */
2221 __pyx_v_buf = ((char *)PyMem_Malloc(__pyx_v_size));
2222
2223 /* "yarl/_quoting_c.pyx":107
2224 * if writer.buf == BUFFER:
2225 * buf = <char*>PyMem_Malloc(size)
2226 * if buf == NULL: # <<<<<<<<<<<<<<
2227 * PyErr_NoMemory()
2228 * return -1
2229 */
2230 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
2231 if (__pyx_t_1) {
2232
2233 /* "yarl/_quoting_c.pyx":108
2234 * buf = <char*>PyMem_Malloc(size)
2235 * if buf == NULL:
2236 * PyErr_NoMemory() # <<<<<<<<<<<<<<
2237 * return -1
2238 * memcpy(buf, writer.buf, writer.size)
2239 */
2240 __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == ((PyObject *)NULL))) __PYX_ERR(0, 108, __pyx_L1_error)
2241
2242 /* "yarl/_quoting_c.pyx":109
2243 * if buf == NULL:
2244 * PyErr_NoMemory()
2245 * return -1 # <<<<<<<<<<<<<<
2246 * memcpy(buf, writer.buf, writer.size)
2247 * else:
2248 */
2249 __pyx_r = -1;
2250 goto __pyx_L0;
2251
2252 /* "yarl/_quoting_c.pyx":107
2253 * if writer.buf == BUFFER:
2254 * buf = <char*>PyMem_Malloc(size)
2255 * if buf == NULL: # <<<<<<<<<<<<<<
2256 * PyErr_NoMemory()
2257 * return -1
2258 */
2259 }
2260
2261 /* "yarl/_quoting_c.pyx":110
2262 * PyErr_NoMemory()
2263 * return -1
2264 * memcpy(buf, writer.buf, writer.size) # <<<<<<<<<<<<<<
2265 * else:
2266 * buf = <char*>PyMem_Realloc(writer.buf, size)
2267 */
2268 (void)(memcpy(__pyx_v_buf, __pyx_v_writer->buf, __pyx_v_writer->size));
2269
2270 /* "yarl/_quoting_c.pyx":105
2271 * # reallocate
2272 * size = writer.size + BUF_SIZE
2273 * if writer.buf == BUFFER: # <<<<<<<<<<<<<<
2274 * buf = <char*>PyMem_Malloc(size)
2275 * if buf == NULL:
2276 */
2277 goto __pyx_L4;
2278 }
2279
2280 /* "yarl/_quoting_c.pyx":112
2281 * memcpy(buf, writer.buf, writer.size)
2282 * else:
2283 * buf = <char*>PyMem_Realloc(writer.buf, size) # <<<<<<<<<<<<<<
2284 * if buf == NULL:
2285 * PyErr_NoMemory()
2286 */
2287 /*else*/ {
2288 __pyx_v_buf = ((char *)PyMem_Realloc(__pyx_v_writer->buf, __pyx_v_size));
2289
2290 /* "yarl/_quoting_c.pyx":113
2291 * else:
2292 * buf = <char*>PyMem_Realloc(writer.buf, size)
2293 * if buf == NULL: # <<<<<<<<<<<<<<
2294 * PyErr_NoMemory()
2295 * return -1
2296 */
2297 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
2298 if (__pyx_t_1) {
2299
2300 /* "yarl/_quoting_c.pyx":114
2301 * buf = <char*>PyMem_Realloc(writer.buf, size)
2302 * if buf == NULL:
2303 * PyErr_NoMemory() # <<<<<<<<<<<<<<
2304 * return -1
2305 * writer.buf = buf
2306 */
2307 __pyx_t_2 = PyErr_NoMemory(); if (unlikely(__pyx_t_2 == ((PyObject *)NULL))) __PYX_ERR(0, 114, __pyx_L1_error)
2308
2309 /* "yarl/_quoting_c.pyx":115
2310 * if buf == NULL:
2311 * PyErr_NoMemory()
2312 * return -1 # <<<<<<<<<<<<<<
2313 * writer.buf = buf
2314 * writer.size = size
2315 */
2316 __pyx_r = -1;
2317 goto __pyx_L0;
2318
2319 /* "yarl/_quoting_c.pyx":113
2320 * else:
2321 * buf = <char*>PyMem_Realloc(writer.buf, size)
2322 * if buf == NULL: # <<<<<<<<<<<<<<
2323 * PyErr_NoMemory()
2324 * return -1
2325 */
2326 }
2327 }
2328 __pyx_L4:;
2329
2330 /* "yarl/_quoting_c.pyx":116
2331 * PyErr_NoMemory()
2332 * return -1
2333 * writer.buf = buf # <<<<<<<<<<<<<<
2334 * writer.size = size
2335 * writer.buf[writer.pos] = <char>ch
2336 */
2337 __pyx_v_writer->buf = __pyx_v_buf;
2338
2339 /* "yarl/_quoting_c.pyx":117
2340 * return -1
2341 * writer.buf = buf
2342 * writer.size = size # <<<<<<<<<<<<<<
2343 * writer.buf[writer.pos] = <char>ch
2344 * writer.pos += 1
2345 */
2346 __pyx_v_writer->size = __pyx_v_size;
2347
2348 /* "yarl/_quoting_c.pyx":102
2349 * cdef Py_ssize_t size
2350 *
2351 * if writer.pos == writer.size: # <<<<<<<<<<<<<<
2352 * # reallocate
2353 * size = writer.size + BUF_SIZE
2354 */
2355 }
2356
2357 /* "yarl/_quoting_c.pyx":118
2358 * writer.buf = buf
2359 * writer.size = size
2360 * writer.buf[writer.pos] = <char>ch # <<<<<<<<<<<<<<
2361 * writer.pos += 1
2362 * writer.changed |= changed
2363 */
2364 (__pyx_v_writer->buf[__pyx_v_writer->pos]) = ((char)__pyx_v_ch);
2365
2366 /* "yarl/_quoting_c.pyx":119
2367 * writer.size = size
2368 * writer.buf[writer.pos] = <char>ch
2369 * writer.pos += 1 # <<<<<<<<<<<<<<
2370 * writer.changed |= changed
2371 * return 0
2372 */
2373 __pyx_v_writer->pos = (__pyx_v_writer->pos + 1);
2374
2375 /* "yarl/_quoting_c.pyx":120
2376 * writer.buf[writer.pos] = <char>ch
2377 * writer.pos += 1
2378 * writer.changed |= changed # <<<<<<<<<<<<<<
2379 * return 0
2380 *
2381 */
2382 __pyx_v_writer->changed = (__pyx_v_writer->changed | __pyx_v_changed);
2383
2384 /* "yarl/_quoting_c.pyx":121
2385 * writer.pos += 1
2386 * writer.changed |= changed
2387 * return 0 # <<<<<<<<<<<<<<
2388 *
2389 *
2390 */
2391 __pyx_r = 0;
2392 goto __pyx_L0;
2393
2394 /* "yarl/_quoting_c.pyx":98
2395 *
2396 *
2397 * cdef inline int _write_char(Writer* writer, Py_UCS4 ch, bint changed): # <<<<<<<<<<<<<<
2398 * cdef char * buf
2399 * cdef Py_ssize_t size
2400 */
2401
2402 /* function exit code */
2403 __pyx_L1_error:;
2404 __Pyx_WriteUnraisable("yarl._quoting_c._write_char", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
2405 __pyx_r = 0;
2406 __pyx_L0:;
2407 __Pyx_RefNannyFinishContext();
2408 return __pyx_r;
2409 }
2410
2411 /* "yarl/_quoting_c.pyx":124
2412 *
2413 *
2414 * cdef inline int _write_pct(Writer* writer, uint8_t ch, bint changed): # <<<<<<<<<<<<<<
2415 * if _write_char(writer, '%', changed) < 0:
2416 * return -1
2417 */
2418
__pyx_f_4yarl_10_quoting_c__write_pct(struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer,uint8_t __pyx_v_ch,int __pyx_v_changed)2419 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_pct(struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer, uint8_t __pyx_v_ch, int __pyx_v_changed) {
2420 int __pyx_r;
2421 __Pyx_RefNannyDeclarations
2422 int __pyx_t_1;
2423 __Pyx_RefNannySetupContext("_write_pct", 0);
2424
2425 /* "yarl/_quoting_c.pyx":125
2426 *
2427 * cdef inline int _write_pct(Writer* writer, uint8_t ch, bint changed):
2428 * if _write_char(writer, '%', changed) < 0: # <<<<<<<<<<<<<<
2429 * return -1
2430 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0:
2431 */
2432 __pyx_t_1 = ((__pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, 37, __pyx_v_changed) < 0) != 0);
2433 if (__pyx_t_1) {
2434
2435 /* "yarl/_quoting_c.pyx":126
2436 * cdef inline int _write_pct(Writer* writer, uint8_t ch, bint changed):
2437 * if _write_char(writer, '%', changed) < 0:
2438 * return -1 # <<<<<<<<<<<<<<
2439 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0:
2440 * return -1
2441 */
2442 __pyx_r = -1;
2443 goto __pyx_L0;
2444
2445 /* "yarl/_quoting_c.pyx":125
2446 *
2447 * cdef inline int _write_pct(Writer* writer, uint8_t ch, bint changed):
2448 * if _write_char(writer, '%', changed) < 0: # <<<<<<<<<<<<<<
2449 * return -1
2450 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0:
2451 */
2452 }
2453
2454 /* "yarl/_quoting_c.pyx":127
2455 * if _write_char(writer, '%', changed) < 0:
2456 * return -1
2457 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0: # <<<<<<<<<<<<<<
2458 * return -1
2459 * return _write_char(writer, _to_hex(<uint8_t>ch & 0x0f), changed)
2460 */
2461 __pyx_t_1 = ((__pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, __pyx_f_4yarl_10_quoting_c__to_hex((((uint8_t)__pyx_v_ch) >> 4)), __pyx_v_changed) < 0) != 0);
2462 if (__pyx_t_1) {
2463
2464 /* "yarl/_quoting_c.pyx":128
2465 * return -1
2466 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0:
2467 * return -1 # <<<<<<<<<<<<<<
2468 * return _write_char(writer, _to_hex(<uint8_t>ch & 0x0f), changed)
2469 *
2470 */
2471 __pyx_r = -1;
2472 goto __pyx_L0;
2473
2474 /* "yarl/_quoting_c.pyx":127
2475 * if _write_char(writer, '%', changed) < 0:
2476 * return -1
2477 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0: # <<<<<<<<<<<<<<
2478 * return -1
2479 * return _write_char(writer, _to_hex(<uint8_t>ch & 0x0f), changed)
2480 */
2481 }
2482
2483 /* "yarl/_quoting_c.pyx":129
2484 * if _write_char(writer, _to_hex(<uint8_t>ch >> 4), changed) < 0:
2485 * return -1
2486 * return _write_char(writer, _to_hex(<uint8_t>ch & 0x0f), changed) # <<<<<<<<<<<<<<
2487 *
2488 *
2489 */
2490 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, __pyx_f_4yarl_10_quoting_c__to_hex((((uint8_t)__pyx_v_ch) & 0x0f)), __pyx_v_changed);
2491 goto __pyx_L0;
2492
2493 /* "yarl/_quoting_c.pyx":124
2494 *
2495 *
2496 * cdef inline int _write_pct(Writer* writer, uint8_t ch, bint changed): # <<<<<<<<<<<<<<
2497 * if _write_char(writer, '%', changed) < 0:
2498 * return -1
2499 */
2500
2501 /* function exit code */
2502 __pyx_L0:;
2503 __Pyx_RefNannyFinishContext();
2504 return __pyx_r;
2505 }
2506
2507 /* "yarl/_quoting_c.pyx":132
2508 *
2509 *
2510 * cdef inline int _write_utf8(Writer* writer, Py_UCS4 symbol): # <<<<<<<<<<<<<<
2511 * cdef uint64_t utf = <uint64_t> symbol
2512 *
2513 */
2514
__pyx_f_4yarl_10_quoting_c__write_utf8(struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer,Py_UCS4 __pyx_v_symbol)2515 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c__write_utf8(struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer, Py_UCS4 __pyx_v_symbol) {
2516 uint64_t __pyx_v_utf;
2517 int __pyx_r;
2518 __Pyx_RefNannyDeclarations
2519 int __pyx_t_1;
2520 int __pyx_t_2;
2521 __Pyx_RefNannySetupContext("_write_utf8", 0);
2522
2523 /* "yarl/_quoting_c.pyx":133
2524 *
2525 * cdef inline int _write_utf8(Writer* writer, Py_UCS4 symbol):
2526 * cdef uint64_t utf = <uint64_t> symbol # <<<<<<<<<<<<<<
2527 *
2528 * if utf < 0x80:
2529 */
2530 __pyx_v_utf = ((uint64_t)__pyx_v_symbol);
2531
2532 /* "yarl/_quoting_c.pyx":135
2533 * cdef uint64_t utf = <uint64_t> symbol
2534 *
2535 * if utf < 0x80: # <<<<<<<<<<<<<<
2536 * return _write_pct(writer, <uint8_t>utf, True)
2537 * elif utf < 0x800:
2538 */
2539 __pyx_t_1 = ((__pyx_v_utf < 0x80) != 0);
2540 if (__pyx_t_1) {
2541
2542 /* "yarl/_quoting_c.pyx":136
2543 *
2544 * if utf < 0x80:
2545 * return _write_pct(writer, <uint8_t>utf, True) # <<<<<<<<<<<<<<
2546 * elif utf < 0x800:
2547 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0:
2548 */
2549 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)__pyx_v_utf), 1);
2550 goto __pyx_L0;
2551
2552 /* "yarl/_quoting_c.pyx":135
2553 * cdef uint64_t utf = <uint64_t> symbol
2554 *
2555 * if utf < 0x80: # <<<<<<<<<<<<<<
2556 * return _write_pct(writer, <uint8_t>utf, True)
2557 * elif utf < 0x800:
2558 */
2559 }
2560
2561 /* "yarl/_quoting_c.pyx":137
2562 * if utf < 0x80:
2563 * return _write_pct(writer, <uint8_t>utf, True)
2564 * elif utf < 0x800: # <<<<<<<<<<<<<<
2565 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0:
2566 * return -1
2567 */
2568 __pyx_t_1 = ((__pyx_v_utf < 0x800) != 0);
2569 if (__pyx_t_1) {
2570
2571 /* "yarl/_quoting_c.pyx":138
2572 * return _write_pct(writer, <uint8_t>utf, True)
2573 * elif utf < 0x800:
2574 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0: # <<<<<<<<<<<<<<
2575 * return -1
2576 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2577 */
2578 __pyx_t_1 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0xc0 | (__pyx_v_utf >> 6))), 1) < 0) != 0);
2579 if (__pyx_t_1) {
2580
2581 /* "yarl/_quoting_c.pyx":139
2582 * elif utf < 0x800:
2583 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0:
2584 * return -1 # <<<<<<<<<<<<<<
2585 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2586 * elif 0xD800 <= utf <= 0xDFFF:
2587 */
2588 __pyx_r = -1;
2589 goto __pyx_L0;
2590
2591 /* "yarl/_quoting_c.pyx":138
2592 * return _write_pct(writer, <uint8_t>utf, True)
2593 * elif utf < 0x800:
2594 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0: # <<<<<<<<<<<<<<
2595 * return -1
2596 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2597 */
2598 }
2599
2600 /* "yarl/_quoting_c.pyx":140
2601 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0:
2602 * return -1
2603 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True) # <<<<<<<<<<<<<<
2604 * elif 0xD800 <= utf <= 0xDFFF:
2605 * # surogate pair, ignored
2606 */
2607 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | (__pyx_v_utf & 0x3f))), 1);
2608 goto __pyx_L0;
2609
2610 /* "yarl/_quoting_c.pyx":137
2611 * if utf < 0x80:
2612 * return _write_pct(writer, <uint8_t>utf, True)
2613 * elif utf < 0x800: # <<<<<<<<<<<<<<
2614 * if _write_pct(writer, <uint8_t>(0xc0 | (utf >> 6)), True) < 0:
2615 * return -1
2616 */
2617 }
2618
2619 /* "yarl/_quoting_c.pyx":141
2620 * return -1
2621 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2622 * elif 0xD800 <= utf <= 0xDFFF: # <<<<<<<<<<<<<<
2623 * # surogate pair, ignored
2624 * return 0
2625 */
2626 __pyx_t_1 = (0xD800 <= __pyx_v_utf);
2627 if (__pyx_t_1) {
2628 __pyx_t_1 = (__pyx_v_utf <= 0xDFFF);
2629 }
2630 __pyx_t_2 = (__pyx_t_1 != 0);
2631 if (__pyx_t_2) {
2632
2633 /* "yarl/_quoting_c.pyx":143
2634 * elif 0xD800 <= utf <= 0xDFFF:
2635 * # surogate pair, ignored
2636 * return 0 # <<<<<<<<<<<<<<
2637 * elif utf < 0x10000:
2638 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2639 */
2640 __pyx_r = 0;
2641 goto __pyx_L0;
2642
2643 /* "yarl/_quoting_c.pyx":141
2644 * return -1
2645 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2646 * elif 0xD800 <= utf <= 0xDFFF: # <<<<<<<<<<<<<<
2647 * # surogate pair, ignored
2648 * return 0
2649 */
2650 }
2651
2652 /* "yarl/_quoting_c.pyx":144
2653 * # surogate pair, ignored
2654 * return 0
2655 * elif utf < 0x10000: # <<<<<<<<<<<<<<
2656 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2657 * return -1
2658 */
2659 __pyx_t_2 = ((__pyx_v_utf < 0x10000) != 0);
2660 if (__pyx_t_2) {
2661
2662 /* "yarl/_quoting_c.pyx":145
2663 * return 0
2664 * elif utf < 0x10000:
2665 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0: # <<<<<<<<<<<<<<
2666 * return -1
2667 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2668 */
2669 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0xe0 | (__pyx_v_utf >> 12))), 1) < 0) != 0);
2670 if (__pyx_t_2) {
2671
2672 /* "yarl/_quoting_c.pyx":146
2673 * elif utf < 0x10000:
2674 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2675 * return -1 # <<<<<<<<<<<<<<
2676 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2677 * True) < 0:
2678 */
2679 __pyx_r = -1;
2680 goto __pyx_L0;
2681
2682 /* "yarl/_quoting_c.pyx":145
2683 * return 0
2684 * elif utf < 0x10000:
2685 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0: # <<<<<<<<<<<<<<
2686 * return -1
2687 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2688 */
2689 }
2690
2691 /* "yarl/_quoting_c.pyx":148
2692 * return -1
2693 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2694 * True) < 0: # <<<<<<<<<<<<<<
2695 * return -1
2696 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2697 */
2698 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | ((__pyx_v_utf >> 6) & 0x3f))), 1) < 0) != 0);
2699
2700 /* "yarl/_quoting_c.pyx":147
2701 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2702 * return -1
2703 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)), # <<<<<<<<<<<<<<
2704 * True) < 0:
2705 * return -1
2706 */
2707 if (__pyx_t_2) {
2708
2709 /* "yarl/_quoting_c.pyx":149
2710 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2711 * True) < 0:
2712 * return -1 # <<<<<<<<<<<<<<
2713 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2714 * elif utf > 0x10FFFF:
2715 */
2716 __pyx_r = -1;
2717 goto __pyx_L0;
2718
2719 /* "yarl/_quoting_c.pyx":147
2720 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2721 * return -1
2722 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)), # <<<<<<<<<<<<<<
2723 * True) < 0:
2724 * return -1
2725 */
2726 }
2727
2728 /* "yarl/_quoting_c.pyx":150
2729 * True) < 0:
2730 * return -1
2731 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True) # <<<<<<<<<<<<<<
2732 * elif utf > 0x10FFFF:
2733 * # symbol is too large
2734 */
2735 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | (__pyx_v_utf & 0x3f))), 1);
2736 goto __pyx_L0;
2737
2738 /* "yarl/_quoting_c.pyx":144
2739 * # surogate pair, ignored
2740 * return 0
2741 * elif utf < 0x10000: # <<<<<<<<<<<<<<
2742 * if _write_pct(writer, <uint8_t>(0xe0 | (utf >> 12)), True) < 0:
2743 * return -1
2744 */
2745 }
2746
2747 /* "yarl/_quoting_c.pyx":151
2748 * return -1
2749 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2750 * elif utf > 0x10FFFF: # <<<<<<<<<<<<<<
2751 * # symbol is too large
2752 * return 0
2753 */
2754 __pyx_t_2 = ((__pyx_v_utf > 0x10FFFF) != 0);
2755 if (__pyx_t_2) {
2756
2757 /* "yarl/_quoting_c.pyx":153
2758 * elif utf > 0x10FFFF:
2759 * # symbol is too large
2760 * return 0 # <<<<<<<<<<<<<<
2761 * else:
2762 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0:
2763 */
2764 __pyx_r = 0;
2765 goto __pyx_L0;
2766
2767 /* "yarl/_quoting_c.pyx":151
2768 * return -1
2769 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2770 * elif utf > 0x10FFFF: # <<<<<<<<<<<<<<
2771 * # symbol is too large
2772 * return 0
2773 */
2774 }
2775
2776 /* "yarl/_quoting_c.pyx":155
2777 * return 0
2778 * else:
2779 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0: # <<<<<<<<<<<<<<
2780 * return -1
2781 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)),
2782 */
2783 /*else*/ {
2784 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0xf0 | (__pyx_v_utf >> 18))), 1) < 0) != 0);
2785 if (__pyx_t_2) {
2786
2787 /* "yarl/_quoting_c.pyx":156
2788 * else:
2789 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0:
2790 * return -1 # <<<<<<<<<<<<<<
2791 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)),
2792 * True) < 0:
2793 */
2794 __pyx_r = -1;
2795 goto __pyx_L0;
2796
2797 /* "yarl/_quoting_c.pyx":155
2798 * return 0
2799 * else:
2800 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0: # <<<<<<<<<<<<<<
2801 * return -1
2802 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)),
2803 */
2804 }
2805
2806 /* "yarl/_quoting_c.pyx":158
2807 * return -1
2808 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)),
2809 * True) < 0: # <<<<<<<<<<<<<<
2810 * return -1
2811 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2812 */
2813 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | ((__pyx_v_utf >> 12) & 0x3f))), 1) < 0) != 0);
2814
2815 /* "yarl/_quoting_c.pyx":157
2816 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0:
2817 * return -1
2818 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)), # <<<<<<<<<<<<<<
2819 * True) < 0:
2820 * return -1
2821 */
2822 if (__pyx_t_2) {
2823
2824 /* "yarl/_quoting_c.pyx":159
2825 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)),
2826 * True) < 0:
2827 * return -1 # <<<<<<<<<<<<<<
2828 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2829 * True) < 0:
2830 */
2831 __pyx_r = -1;
2832 goto __pyx_L0;
2833
2834 /* "yarl/_quoting_c.pyx":157
2835 * if _write_pct(writer, <uint8_t>(0xf0 | (utf >> 18)), True) < 0:
2836 * return -1
2837 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 12) & 0x3f)), # <<<<<<<<<<<<<<
2838 * True) < 0:
2839 * return -1
2840 */
2841 }
2842
2843 /* "yarl/_quoting_c.pyx":161
2844 * return -1
2845 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2846 * True) < 0: # <<<<<<<<<<<<<<
2847 * return -1
2848 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2849 */
2850 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | ((__pyx_v_utf >> 6) & 0x3f))), 1) < 0) != 0);
2851
2852 /* "yarl/_quoting_c.pyx":160
2853 * True) < 0:
2854 * return -1
2855 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)), # <<<<<<<<<<<<<<
2856 * True) < 0:
2857 * return -1
2858 */
2859 if (__pyx_t_2) {
2860
2861 /* "yarl/_quoting_c.pyx":162
2862 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)),
2863 * True) < 0:
2864 * return -1 # <<<<<<<<<<<<<<
2865 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True)
2866 *
2867 */
2868 __pyx_r = -1;
2869 goto __pyx_L0;
2870
2871 /* "yarl/_quoting_c.pyx":160
2872 * True) < 0:
2873 * return -1
2874 * if _write_pct(writer, <uint8_t>(0x80 | ((utf >> 6) & 0x3f)), # <<<<<<<<<<<<<<
2875 * True) < 0:
2876 * return -1
2877 */
2878 }
2879
2880 /* "yarl/_quoting_c.pyx":163
2881 * True) < 0:
2882 * return -1
2883 * return _write_pct(writer, <uint8_t>(0x80 | (utf & 0x3f)), True) # <<<<<<<<<<<<<<
2884 *
2885 *
2886 */
2887 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, ((uint8_t)(0x80 | (__pyx_v_utf & 0x3f))), 1);
2888 goto __pyx_L0;
2889 }
2890
2891 /* "yarl/_quoting_c.pyx":132
2892 *
2893 *
2894 * cdef inline int _write_utf8(Writer* writer, Py_UCS4 symbol): # <<<<<<<<<<<<<<
2895 * cdef uint64_t utf = <uint64_t> symbol
2896 *
2897 */
2898
2899 /* function exit code */
2900 __pyx_L0:;
2901 __Pyx_RefNannyFinishContext();
2902 return __pyx_r;
2903 }
2904
2905 /* "yarl/_quoting_c.pyx":176
2906 * cdef uint8_t _protected_table[16]
2907 *
2908 * def __init__( # <<<<<<<<<<<<<<
2909 * self, *, str safe='', str protected='', bint qs=False, bint requote=True,
2910 * ):
2911 */
2912
2913 /* Python wrapper */
2914 static int __pyx_pw_4yarl_10_quoting_c_7_Quoter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4yarl_10_quoting_c_7_Quoter_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2915 static int __pyx_pw_4yarl_10_quoting_c_7_Quoter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2916 PyObject *__pyx_v_safe = 0;
2917 PyObject *__pyx_v_protected = 0;
2918 int __pyx_v_qs;
2919 int __pyx_v_requote;
2920 int __pyx_lineno = 0;
2921 const char *__pyx_filename = NULL;
2922 int __pyx_clineno = 0;
2923 int __pyx_r;
2924 __Pyx_RefNannyDeclarations
2925 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2926 {
2927 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_safe,&__pyx_n_s_protected,&__pyx_n_s_qs,&__pyx_n_s_requote,0};
2928 PyObject* values[4] = {0,0,0,0};
2929 values[0] = ((PyObject*)__pyx_kp_u_);
2930 values[1] = ((PyObject*)__pyx_kp_u_);
2931 if (unlikely(__pyx_kwds)) {
2932 Py_ssize_t kw_args;
2933 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2934 switch (pos_args) {
2935 case 0: break;
2936 default: goto __pyx_L5_argtuple_error;
2937 }
2938 kw_args = PyDict_Size(__pyx_kwds);
2939 if (kw_args > 0 && likely(kw_args <= 4)) {
2940 Py_ssize_t index;
2941 for (index = 0; index < 4 && kw_args > 0; index++) {
2942 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
2943 if (value) { values[index] = value; kw_args--; }
2944 }
2945 }
2946 if (unlikely(kw_args > 0)) {
2947 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) __PYX_ERR(0, 176, __pyx_L3_error)
2948 }
2949 } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
2950 goto __pyx_L5_argtuple_error;
2951 } else {
2952 }
2953 __pyx_v_safe = ((PyObject*)values[0]);
2954 __pyx_v_protected = ((PyObject*)values[1]);
2955 if (values[2]) {
2956 __pyx_v_qs = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_qs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L3_error)
2957 } else {
2958
2959 /* "yarl/_quoting_c.pyx":177
2960 *
2961 * def __init__(
2962 * self, *, str safe='', str protected='', bint qs=False, bint requote=True, # <<<<<<<<<<<<<<
2963 * ):
2964 * cdef Py_UCS4 ch
2965 */
2966 __pyx_v_qs = ((int)0);
2967 }
2968 if (values[3]) {
2969 __pyx_v_requote = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_requote == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L3_error)
2970 } else {
2971 __pyx_v_requote = ((int)1);
2972 }
2973 }
2974 goto __pyx_L4_argument_unpacking_done;
2975 __pyx_L5_argtuple_error:;
2976 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 176, __pyx_L3_error)
2977 __pyx_L3_error:;
2978 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2979 __Pyx_RefNannyFinishContext();
2980 return -1;
2981 __pyx_L4_argument_unpacking_done:;
2982 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_safe), (&PyUnicode_Type), 1, "safe", 1))) __PYX_ERR(0, 177, __pyx_L1_error)
2983 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_protected), (&PyUnicode_Type), 1, "protected", 1))) __PYX_ERR(0, 177, __pyx_L1_error)
2984 __pyx_r = __pyx_pf_4yarl_10_quoting_c_7_Quoter___init__(((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_v_self), __pyx_v_safe, __pyx_v_protected, __pyx_v_qs, __pyx_v_requote);
2985
2986 /* "yarl/_quoting_c.pyx":176
2987 * cdef uint8_t _protected_table[16]
2988 *
2989 * def __init__( # <<<<<<<<<<<<<<
2990 * self, *, str safe='', str protected='', bint qs=False, bint requote=True,
2991 * ):
2992 */
2993
2994 /* function exit code */
2995 goto __pyx_L0;
2996 __pyx_L1_error:;
2997 __pyx_r = -1;
2998 __pyx_L0:;
2999 __Pyx_RefNannyFinishContext();
3000 return __pyx_r;
3001 }
3002
__pyx_pf_4yarl_10_quoting_c_7_Quoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self,PyObject * __pyx_v_safe,PyObject * __pyx_v_protected,int __pyx_v_qs,int __pyx_v_requote)3003 static int __pyx_pf_4yarl_10_quoting_c_7_Quoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_safe, PyObject *__pyx_v_protected, int __pyx_v_qs, int __pyx_v_requote) {
3004 Py_UCS4 __pyx_v_ch;
3005 int __pyx_r;
3006 __Pyx_RefNannyDeclarations
3007 int __pyx_t_1;
3008 PyObject *__pyx_t_2 = NULL;
3009 Py_ssize_t __pyx_t_3;
3010 Py_ssize_t __pyx_t_4;
3011 void *__pyx_t_5;
3012 int __pyx_t_6;
3013 int __pyx_t_7;
3014 Py_ssize_t __pyx_t_8;
3015 PyObject *__pyx_t_9 = NULL;
3016 int __pyx_lineno = 0;
3017 const char *__pyx_filename = NULL;
3018 int __pyx_clineno = 0;
3019 __Pyx_RefNannySetupContext("__init__", 0);
3020
3021 /* "yarl/_quoting_c.pyx":181
3022 * cdef Py_UCS4 ch
3023 *
3024 * self._qs = qs # <<<<<<<<<<<<<<
3025 * self._requote = requote
3026 *
3027 */
3028 __pyx_v_self->_qs = __pyx_v_qs;
3029
3030 /* "yarl/_quoting_c.pyx":182
3031 *
3032 * self._qs = qs
3033 * self._requote = requote # <<<<<<<<<<<<<<
3034 *
3035 * if not self._qs:
3036 */
3037 __pyx_v_self->_requote = __pyx_v_requote;
3038
3039 /* "yarl/_quoting_c.pyx":184
3040 * self._requote = requote
3041 *
3042 * if not self._qs: # <<<<<<<<<<<<<<
3043 * memcpy(self._safe_table,
3044 * ALLOWED_NOTQS_TABLE,
3045 */
3046 __pyx_t_1 = ((!(__pyx_v_self->_qs != 0)) != 0);
3047 if (__pyx_t_1) {
3048
3049 /* "yarl/_quoting_c.pyx":185
3050 *
3051 * if not self._qs:
3052 * memcpy(self._safe_table, # <<<<<<<<<<<<<<
3053 * ALLOWED_NOTQS_TABLE,
3054 * sizeof(self._safe_table))
3055 */
3056 (void)(memcpy(__pyx_v_self->_safe_table, __pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE, (sizeof(__pyx_v_self->_safe_table))));
3057
3058 /* "yarl/_quoting_c.pyx":184
3059 * self._requote = requote
3060 *
3061 * if not self._qs: # <<<<<<<<<<<<<<
3062 * memcpy(self._safe_table,
3063 * ALLOWED_NOTQS_TABLE,
3064 */
3065 goto __pyx_L3;
3066 }
3067
3068 /* "yarl/_quoting_c.pyx":189
3069 * sizeof(self._safe_table))
3070 * else:
3071 * memcpy(self._safe_table, # <<<<<<<<<<<<<<
3072 * ALLOWED_TABLE,
3073 * sizeof(self._safe_table))
3074 */
3075 /*else*/ {
3076
3077 /* "yarl/_quoting_c.pyx":191
3078 * memcpy(self._safe_table,
3079 * ALLOWED_TABLE,
3080 * sizeof(self._safe_table)) # <<<<<<<<<<<<<<
3081 * for ch in safe:
3082 * if ord(ch) > 127:
3083 */
3084 (void)(memcpy(__pyx_v_self->_safe_table, __pyx_v_4yarl_10_quoting_c_ALLOWED_TABLE, (sizeof(__pyx_v_self->_safe_table))));
3085 }
3086 __pyx_L3:;
3087
3088 /* "yarl/_quoting_c.pyx":192
3089 * ALLOWED_TABLE,
3090 * sizeof(self._safe_table))
3091 * for ch in safe: # <<<<<<<<<<<<<<
3092 * if ord(ch) > 127:
3093 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3094 */
3095 if (unlikely(__pyx_v_safe == Py_None)) {
3096 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
3097 __PYX_ERR(0, 192, __pyx_L1_error)
3098 }
3099 __Pyx_INCREF(__pyx_v_safe);
3100 __pyx_t_2 = __pyx_v_safe;
3101 __pyx_t_7 = __Pyx_init_unicode_iteration(__pyx_t_2, (&__pyx_t_4), (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 192, __pyx_L1_error)
3102 for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_4; __pyx_t_8++) {
3103 __pyx_t_3 = __pyx_t_8;
3104 __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_6, __pyx_t_5, __pyx_t_3);
3105
3106 /* "yarl/_quoting_c.pyx":193
3107 * sizeof(self._safe_table))
3108 * for ch in safe:
3109 * if ord(ch) > 127: # <<<<<<<<<<<<<<
3110 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3111 * set_bit(self._safe_table, ch)
3112 */
3113 __pyx_t_1 = ((((long)__pyx_v_ch) > 0x7F) != 0);
3114 if (unlikely(__pyx_t_1)) {
3115
3116 /* "yarl/_quoting_c.pyx":194
3117 * for ch in safe:
3118 * if ord(ch) > 127:
3119 * raise ValueError("Only safe symbols with ORD < 128 are allowed") # <<<<<<<<<<<<<<
3120 * set_bit(self._safe_table, ch)
3121 *
3122 */
3123 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error)
3124 __Pyx_GOTREF(__pyx_t_9);
3125 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
3126 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3127 __PYX_ERR(0, 194, __pyx_L1_error)
3128
3129 /* "yarl/_quoting_c.pyx":193
3130 * sizeof(self._safe_table))
3131 * for ch in safe:
3132 * if ord(ch) > 127: # <<<<<<<<<<<<<<
3133 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3134 * set_bit(self._safe_table, ch)
3135 */
3136 }
3137
3138 /* "yarl/_quoting_c.pyx":195
3139 * if ord(ch) > 127:
3140 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3141 * set_bit(self._safe_table, ch) # <<<<<<<<<<<<<<
3142 *
3143 * memset(self._protected_table, 0, sizeof(self._protected_table))
3144 */
3145 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_self->_safe_table, __pyx_v_ch);
3146 }
3147 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3148
3149 /* "yarl/_quoting_c.pyx":197
3150 * set_bit(self._safe_table, ch)
3151 *
3152 * memset(self._protected_table, 0, sizeof(self._protected_table)) # <<<<<<<<<<<<<<
3153 * for ch in protected:
3154 * if ord(ch) > 127:
3155 */
3156 (void)(memset(__pyx_v_self->_protected_table, 0, (sizeof(__pyx_v_self->_protected_table))));
3157
3158 /* "yarl/_quoting_c.pyx":198
3159 *
3160 * memset(self._protected_table, 0, sizeof(self._protected_table))
3161 * for ch in protected: # <<<<<<<<<<<<<<
3162 * if ord(ch) > 127:
3163 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3164 */
3165 if (unlikely(__pyx_v_protected == Py_None)) {
3166 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
3167 __PYX_ERR(0, 198, __pyx_L1_error)
3168 }
3169 __Pyx_INCREF(__pyx_v_protected);
3170 __pyx_t_2 = __pyx_v_protected;
3171 __pyx_t_7 = __Pyx_init_unicode_iteration(__pyx_t_2, (&__pyx_t_3), (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 198, __pyx_L1_error)
3172 for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_3; __pyx_t_8++) {
3173 __pyx_t_4 = __pyx_t_8;
3174 __pyx_v_ch = __Pyx_PyUnicode_READ(__pyx_t_6, __pyx_t_5, __pyx_t_4);
3175
3176 /* "yarl/_quoting_c.pyx":199
3177 * memset(self._protected_table, 0, sizeof(self._protected_table))
3178 * for ch in protected:
3179 * if ord(ch) > 127: # <<<<<<<<<<<<<<
3180 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3181 * set_bit(self._safe_table, ch)
3182 */
3183 __pyx_t_1 = ((((long)__pyx_v_ch) > 0x7F) != 0);
3184 if (unlikely(__pyx_t_1)) {
3185
3186 /* "yarl/_quoting_c.pyx":200
3187 * for ch in protected:
3188 * if ord(ch) > 127:
3189 * raise ValueError("Only safe symbols with ORD < 128 are allowed") # <<<<<<<<<<<<<<
3190 * set_bit(self._safe_table, ch)
3191 * set_bit(self._protected_table, ch)
3192 */
3193 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error)
3194 __Pyx_GOTREF(__pyx_t_9);
3195 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
3196 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3197 __PYX_ERR(0, 200, __pyx_L1_error)
3198
3199 /* "yarl/_quoting_c.pyx":199
3200 * memset(self._protected_table, 0, sizeof(self._protected_table))
3201 * for ch in protected:
3202 * if ord(ch) > 127: # <<<<<<<<<<<<<<
3203 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3204 * set_bit(self._safe_table, ch)
3205 */
3206 }
3207
3208 /* "yarl/_quoting_c.pyx":201
3209 * if ord(ch) > 127:
3210 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3211 * set_bit(self._safe_table, ch) # <<<<<<<<<<<<<<
3212 * set_bit(self._protected_table, ch)
3213 *
3214 */
3215 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_self->_safe_table, __pyx_v_ch);
3216
3217 /* "yarl/_quoting_c.pyx":202
3218 * raise ValueError("Only safe symbols with ORD < 128 are allowed")
3219 * set_bit(self._safe_table, ch)
3220 * set_bit(self._protected_table, ch) # <<<<<<<<<<<<<<
3221 *
3222 * def __call__(self, val):
3223 */
3224 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_self->_protected_table, __pyx_v_ch);
3225 }
3226 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3227
3228 /* "yarl/_quoting_c.pyx":176
3229 * cdef uint8_t _protected_table[16]
3230 *
3231 * def __init__( # <<<<<<<<<<<<<<
3232 * self, *, str safe='', str protected='', bint qs=False, bint requote=True,
3233 * ):
3234 */
3235
3236 /* function exit code */
3237 __pyx_r = 0;
3238 goto __pyx_L0;
3239 __pyx_L1_error:;
3240 __Pyx_XDECREF(__pyx_t_2);
3241 __Pyx_XDECREF(__pyx_t_9);
3242 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3243 __pyx_r = -1;
3244 __pyx_L0:;
3245 __Pyx_RefNannyFinishContext();
3246 return __pyx_r;
3247 }
3248
3249 /* "yarl/_quoting_c.pyx":204
3250 * set_bit(self._protected_table, ch)
3251 *
3252 * def __call__(self, val): # <<<<<<<<<<<<<<
3253 * cdef Writer writer
3254 * if val is None:
3255 */
3256
3257 /* Python wrapper */
3258 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4yarl_10_quoting_c_7_Quoter_3__call__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3259 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3260 PyObject *__pyx_v_val = 0;
3261 int __pyx_lineno = 0;
3262 const char *__pyx_filename = NULL;
3263 int __pyx_clineno = 0;
3264 PyObject *__pyx_r = 0;
3265 __Pyx_RefNannyDeclarations
3266 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
3267 {
3268 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_val,0};
3269 PyObject* values[1] = {0};
3270 if (unlikely(__pyx_kwds)) {
3271 Py_ssize_t kw_args;
3272 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3273 switch (pos_args) {
3274 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3275 CYTHON_FALLTHROUGH;
3276 case 0: break;
3277 default: goto __pyx_L5_argtuple_error;
3278 }
3279 kw_args = PyDict_Size(__pyx_kwds);
3280 switch (pos_args) {
3281 case 0:
3282 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
3283 else goto __pyx_L5_argtuple_error;
3284 }
3285 if (unlikely(kw_args > 0)) {
3286 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 204, __pyx_L3_error)
3287 }
3288 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
3289 goto __pyx_L5_argtuple_error;
3290 } else {
3291 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3292 }
3293 __pyx_v_val = values[0];
3294 }
3295 goto __pyx_L4_argument_unpacking_done;
3296 __pyx_L5_argtuple_error:;
3297 __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 204, __pyx_L3_error)
3298 __pyx_L3_error:;
3299 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3300 __Pyx_RefNannyFinishContext();
3301 return NULL;
3302 __pyx_L4_argument_unpacking_done:;
3303 __pyx_r = __pyx_pf_4yarl_10_quoting_c_7_Quoter_2__call__(((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_v_self), __pyx_v_val);
3304
3305 /* function exit code */
3306 __Pyx_RefNannyFinishContext();
3307 return __pyx_r;
3308 }
3309
__pyx_pf_4yarl_10_quoting_c_7_Quoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self,PyObject * __pyx_v_val)3310 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_val) {
3311 struct __pyx_t_4yarl_10_quoting_c_Writer __pyx_v_writer;
3312 PyObject *__pyx_r = NULL;
3313 __Pyx_RefNannyDeclarations
3314 int __pyx_t_1;
3315 int __pyx_t_2;
3316 PyObject *__pyx_t_3 = NULL;
3317 int __pyx_t_4;
3318 int __pyx_t_5;
3319 char const *__pyx_t_6;
3320 PyObject *__pyx_t_7 = NULL;
3321 PyObject *__pyx_t_8 = NULL;
3322 PyObject *__pyx_t_9 = NULL;
3323 PyObject *__pyx_t_10 = NULL;
3324 PyObject *__pyx_t_11 = NULL;
3325 PyObject *__pyx_t_12 = NULL;
3326 int __pyx_lineno = 0;
3327 const char *__pyx_filename = NULL;
3328 int __pyx_clineno = 0;
3329 __Pyx_RefNannySetupContext("__call__", 0);
3330 __Pyx_INCREF(__pyx_v_val);
3331
3332 /* "yarl/_quoting_c.pyx":206
3333 * def __call__(self, val):
3334 * cdef Writer writer
3335 * if val is None: # <<<<<<<<<<<<<<
3336 * return None
3337 * if type(val) is not str:
3338 */
3339 __pyx_t_1 = (__pyx_v_val == Py_None);
3340 __pyx_t_2 = (__pyx_t_1 != 0);
3341 if (__pyx_t_2) {
3342
3343 /* "yarl/_quoting_c.pyx":207
3344 * cdef Writer writer
3345 * if val is None:
3346 * return None # <<<<<<<<<<<<<<
3347 * if type(val) is not str:
3348 * if isinstance(val, str):
3349 */
3350 __Pyx_XDECREF(__pyx_r);
3351 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3352 goto __pyx_L0;
3353
3354 /* "yarl/_quoting_c.pyx":206
3355 * def __call__(self, val):
3356 * cdef Writer writer
3357 * if val is None: # <<<<<<<<<<<<<<
3358 * return None
3359 * if type(val) is not str:
3360 */
3361 }
3362
3363 /* "yarl/_quoting_c.pyx":208
3364 * if val is None:
3365 * return None
3366 * if type(val) is not str: # <<<<<<<<<<<<<<
3367 * if isinstance(val, str):
3368 * # derived from str
3369 */
3370 __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_val)) != ((PyObject *)(&PyUnicode_Type)));
3371 __pyx_t_1 = (__pyx_t_2 != 0);
3372 if (__pyx_t_1) {
3373
3374 /* "yarl/_quoting_c.pyx":209
3375 * return None
3376 * if type(val) is not str:
3377 * if isinstance(val, str): # <<<<<<<<<<<<<<
3378 * # derived from str
3379 * val = str(val)
3380 */
3381 __pyx_t_1 = PyUnicode_Check(__pyx_v_val);
3382 __pyx_t_2 = (__pyx_t_1 != 0);
3383 if (likely(__pyx_t_2)) {
3384
3385 /* "yarl/_quoting_c.pyx":211
3386 * if isinstance(val, str):
3387 * # derived from str
3388 * val = str(val) # <<<<<<<<<<<<<<
3389 * else:
3390 * raise TypeError("Argument should be str")
3391 */
3392 __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
3393 __Pyx_GOTREF(__pyx_t_3);
3394 __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_3);
3395 __pyx_t_3 = 0;
3396
3397 /* "yarl/_quoting_c.pyx":209
3398 * return None
3399 * if type(val) is not str:
3400 * if isinstance(val, str): # <<<<<<<<<<<<<<
3401 * # derived from str
3402 * val = str(val)
3403 */
3404 goto __pyx_L5;
3405 }
3406
3407 /* "yarl/_quoting_c.pyx":213
3408 * val = str(val)
3409 * else:
3410 * raise TypeError("Argument should be str") # <<<<<<<<<<<<<<
3411 * _init_writer(&writer)
3412 * try:
3413 */
3414 /*else*/ {
3415 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
3416 __Pyx_GOTREF(__pyx_t_3);
3417 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3418 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3419 __PYX_ERR(0, 213, __pyx_L1_error)
3420 }
3421 __pyx_L5:;
3422
3423 /* "yarl/_quoting_c.pyx":208
3424 * if val is None:
3425 * return None
3426 * if type(val) is not str: # <<<<<<<<<<<<<<
3427 * if isinstance(val, str):
3428 * # derived from str
3429 */
3430 }
3431
3432 /* "yarl/_quoting_c.pyx":214
3433 * else:
3434 * raise TypeError("Argument should be str")
3435 * _init_writer(&writer) # <<<<<<<<<<<<<<
3436 * try:
3437 * return self._do_quote(<str>val, &writer)
3438 */
3439 __pyx_f_4yarl_10_quoting_c__init_writer((&__pyx_v_writer));
3440
3441 /* "yarl/_quoting_c.pyx":215
3442 * raise TypeError("Argument should be str")
3443 * _init_writer(&writer)
3444 * try: # <<<<<<<<<<<<<<
3445 * return self._do_quote(<str>val, &writer)
3446 * finally:
3447 */
3448 /*try:*/ {
3449
3450 /* "yarl/_quoting_c.pyx":216
3451 * _init_writer(&writer)
3452 * try:
3453 * return self._do_quote(<str>val, &writer) # <<<<<<<<<<<<<<
3454 * finally:
3455 * _release_writer(&writer)
3456 */
3457 __Pyx_XDECREF(__pyx_r);
3458 __pyx_t_3 = ((struct __pyx_vtabstruct_4yarl_10_quoting_c__Quoter *)__pyx_v_self->__pyx_vtab)->_do_quote(__pyx_v_self, ((PyObject*)__pyx_v_val), (&__pyx_v_writer)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L7_error)
3459 __Pyx_GOTREF(__pyx_t_3);
3460 __pyx_r = __pyx_t_3;
3461 __pyx_t_3 = 0;
3462 goto __pyx_L6_return;
3463 }
3464
3465 /* "yarl/_quoting_c.pyx":218
3466 * return self._do_quote(<str>val, &writer)
3467 * finally:
3468 * _release_writer(&writer) # <<<<<<<<<<<<<<
3469 *
3470 * cdef str _do_quote(self, str val, Writer *writer):
3471 */
3472 /*finally:*/ {
3473 __pyx_L7_error:;
3474 /*exception exit:*/{
3475 __Pyx_PyThreadState_declare
3476 __Pyx_PyThreadState_assign
3477 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
3478 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3479 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
3480 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
3481 __Pyx_XGOTREF(__pyx_t_7);
3482 __Pyx_XGOTREF(__pyx_t_8);
3483 __Pyx_XGOTREF(__pyx_t_9);
3484 __Pyx_XGOTREF(__pyx_t_10);
3485 __Pyx_XGOTREF(__pyx_t_11);
3486 __Pyx_XGOTREF(__pyx_t_12);
3487 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
3488 {
3489 __pyx_f_4yarl_10_quoting_c__release_writer((&__pyx_v_writer));
3490 }
3491 if (PY_MAJOR_VERSION >= 3) {
3492 __Pyx_XGIVEREF(__pyx_t_10);
3493 __Pyx_XGIVEREF(__pyx_t_11);
3494 __Pyx_XGIVEREF(__pyx_t_12);
3495 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
3496 }
3497 __Pyx_XGIVEREF(__pyx_t_7);
3498 __Pyx_XGIVEREF(__pyx_t_8);
3499 __Pyx_XGIVEREF(__pyx_t_9);
3500 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
3501 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
3502 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
3503 goto __pyx_L1_error;
3504 }
3505 __pyx_L6_return: {
3506 __pyx_t_12 = __pyx_r;
3507 __pyx_r = 0;
3508 __pyx_f_4yarl_10_quoting_c__release_writer((&__pyx_v_writer));
3509 __pyx_r = __pyx_t_12;
3510 __pyx_t_12 = 0;
3511 goto __pyx_L0;
3512 }
3513 }
3514
3515 /* "yarl/_quoting_c.pyx":204
3516 * set_bit(self._protected_table, ch)
3517 *
3518 * def __call__(self, val): # <<<<<<<<<<<<<<
3519 * cdef Writer writer
3520 * if val is None:
3521 */
3522
3523 /* function exit code */
3524 __pyx_L1_error:;
3525 __Pyx_XDECREF(__pyx_t_3);
3526 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3527 __pyx_r = NULL;
3528 __pyx_L0:;
3529 __Pyx_XDECREF(__pyx_v_val);
3530 __Pyx_XGIVEREF(__pyx_r);
3531 __Pyx_RefNannyFinishContext();
3532 return __pyx_r;
3533 }
3534
3535 /* "yarl/_quoting_c.pyx":220
3536 * _release_writer(&writer)
3537 *
3538 * cdef str _do_quote(self, str val, Writer *writer): # <<<<<<<<<<<<<<
3539 * cdef Py_UCS4 ch
3540 * cdef int changed
3541 */
3542
__pyx_f_4yarl_10_quoting_c_7_Quoter__do_quote(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self,PyObject * __pyx_v_val,struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer)3543 static PyObject *__pyx_f_4yarl_10_quoting_c_7_Quoter__do_quote(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v_val, struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer) {
3544 Py_UCS4 __pyx_v_ch;
3545 int __pyx_v_changed;
3546 int __pyx_v_idx;
3547 int __pyx_v_length;
3548 PyObject *__pyx_r = NULL;
3549 __Pyx_RefNannyDeclarations
3550 Py_ssize_t __pyx_t_1;
3551 int __pyx_t_2;
3552 Py_UCS4 __pyx_t_3;
3553 int __pyx_t_4;
3554 long __pyx_t_5;
3555 Py_UCS4 __pyx_t_6;
3556 int __pyx_t_7;
3557 int __pyx_t_8;
3558 PyObject *__pyx_t_9 = NULL;
3559 int __pyx_lineno = 0;
3560 const char *__pyx_filename = NULL;
3561 int __pyx_clineno = 0;
3562 __Pyx_RefNannySetupContext("_do_quote", 0);
3563
3564 /* "yarl/_quoting_c.pyx":223
3565 * cdef Py_UCS4 ch
3566 * cdef int changed
3567 * cdef int idx = 0 # <<<<<<<<<<<<<<
3568 * cdef int length = len(val)
3569 *
3570 */
3571 __pyx_v_idx = 0;
3572
3573 /* "yarl/_quoting_c.pyx":224
3574 * cdef int changed
3575 * cdef int idx = 0
3576 * cdef int length = len(val) # <<<<<<<<<<<<<<
3577 *
3578 * while idx < length:
3579 */
3580 if (unlikely(__pyx_v_val == Py_None)) {
3581 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
3582 __PYX_ERR(0, 224, __pyx_L1_error)
3583 }
3584 __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_val); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
3585 __pyx_v_length = __pyx_t_1;
3586
3587 /* "yarl/_quoting_c.pyx":226
3588 * cdef int length = len(val)
3589 *
3590 * while idx < length: # <<<<<<<<<<<<<<
3591 * ch = val[idx]
3592 * idx += 1
3593 */
3594 while (1) {
3595 __pyx_t_2 = ((__pyx_v_idx < __pyx_v_length) != 0);
3596 if (!__pyx_t_2) break;
3597
3598 /* "yarl/_quoting_c.pyx":227
3599 *
3600 * while idx < length:
3601 * ch = val[idx] # <<<<<<<<<<<<<<
3602 * idx += 1
3603 * if ch == '%' and self._requote and idx <= length - 2:
3604 */
3605 __pyx_t_3 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == (Py_UCS4)-1)) __PYX_ERR(0, 227, __pyx_L1_error)
3606 __pyx_v_ch = __pyx_t_3;
3607
3608 /* "yarl/_quoting_c.pyx":228
3609 * while idx < length:
3610 * ch = val[idx]
3611 * idx += 1 # <<<<<<<<<<<<<<
3612 * if ch == '%' and self._requote and idx <= length - 2:
3613 * ch = _restore_ch(val[idx], val[idx + 1])
3614 */
3615 __pyx_v_idx = (__pyx_v_idx + 1);
3616
3617 /* "yarl/_quoting_c.pyx":229
3618 * ch = val[idx]
3619 * idx += 1
3620 * if ch == '%' and self._requote and idx <= length - 2: # <<<<<<<<<<<<<<
3621 * ch = _restore_ch(val[idx], val[idx + 1])
3622 * if ch != <Py_UCS4>-1:
3623 */
3624 __pyx_t_4 = ((__pyx_v_ch == 37) != 0);
3625 if (__pyx_t_4) {
3626 } else {
3627 __pyx_t_2 = __pyx_t_4;
3628 goto __pyx_L6_bool_binop_done;
3629 }
3630 __pyx_t_4 = (__pyx_v_self->_requote != 0);
3631 if (__pyx_t_4) {
3632 } else {
3633 __pyx_t_2 = __pyx_t_4;
3634 goto __pyx_L6_bool_binop_done;
3635 }
3636 __pyx_t_4 = ((__pyx_v_idx <= (__pyx_v_length - 2)) != 0);
3637 __pyx_t_2 = __pyx_t_4;
3638 __pyx_L6_bool_binop_done:;
3639 if (__pyx_t_2) {
3640
3641 /* "yarl/_quoting_c.pyx":230
3642 * idx += 1
3643 * if ch == '%' and self._requote and idx <= length - 2:
3644 * ch = _restore_ch(val[idx], val[idx + 1]) # <<<<<<<<<<<<<<
3645 * if ch != <Py_UCS4>-1:
3646 * idx += 2
3647 */
3648 __pyx_t_3 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_v_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == (Py_UCS4)-1)) __PYX_ERR(0, 230, __pyx_L1_error)
3649 __pyx_t_5 = (__pyx_v_idx + 1);
3650 __pyx_t_6 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_6 == (Py_UCS4)-1)) __PYX_ERR(0, 230, __pyx_L1_error)
3651 __pyx_v_ch = __pyx_f_4yarl_10_quoting_c__restore_ch(__pyx_t_3, __pyx_t_6);
3652
3653 /* "yarl/_quoting_c.pyx":231
3654 * if ch == '%' and self._requote and idx <= length - 2:
3655 * ch = _restore_ch(val[idx], val[idx + 1])
3656 * if ch != <Py_UCS4>-1: # <<<<<<<<<<<<<<
3657 * idx += 2
3658 * if ch < 128:
3659 */
3660 __pyx_t_2 = ((__pyx_v_ch != ((Py_UCS4)-1L)) != 0);
3661 if (__pyx_t_2) {
3662
3663 /* "yarl/_quoting_c.pyx":232
3664 * ch = _restore_ch(val[idx], val[idx + 1])
3665 * if ch != <Py_UCS4>-1:
3666 * idx += 2 # <<<<<<<<<<<<<<
3667 * if ch < 128:
3668 * if bit_at(self._protected_table, ch):
3669 */
3670 __pyx_v_idx = (__pyx_v_idx + 2);
3671
3672 /* "yarl/_quoting_c.pyx":233
3673 * if ch != <Py_UCS4>-1:
3674 * idx += 2
3675 * if ch < 128: # <<<<<<<<<<<<<<
3676 * if bit_at(self._protected_table, ch):
3677 * if _write_pct(writer, ch, True) < 0:
3678 */
3679 __pyx_t_2 = ((__pyx_v_ch < 0x80) != 0);
3680 if (__pyx_t_2) {
3681
3682 /* "yarl/_quoting_c.pyx":234
3683 * idx += 2
3684 * if ch < 128:
3685 * if bit_at(self._protected_table, ch): # <<<<<<<<<<<<<<
3686 * if _write_pct(writer, ch, True) < 0:
3687 * raise
3688 */
3689 __pyx_t_2 = (__pyx_f_4yarl_10_quoting_c_bit_at(__pyx_v_self->_protected_table, __pyx_v_ch) != 0);
3690 if (__pyx_t_2) {
3691
3692 /* "yarl/_quoting_c.pyx":235
3693 * if ch < 128:
3694 * if bit_at(self._protected_table, ch):
3695 * if _write_pct(writer, ch, True) < 0: # <<<<<<<<<<<<<<
3696 * raise
3697 * continue
3698 */
3699 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, __pyx_v_ch, 1) < 0) != 0);
3700 if (unlikely(__pyx_t_2)) {
3701
3702 /* "yarl/_quoting_c.pyx":236
3703 * if bit_at(self._protected_table, ch):
3704 * if _write_pct(writer, ch, True) < 0:
3705 * raise # <<<<<<<<<<<<<<
3706 * continue
3707 *
3708 */
3709 __Pyx_ReraiseException(); __PYX_ERR(0, 236, __pyx_L1_error)
3710
3711 /* "yarl/_quoting_c.pyx":235
3712 * if ch < 128:
3713 * if bit_at(self._protected_table, ch):
3714 * if _write_pct(writer, ch, True) < 0: # <<<<<<<<<<<<<<
3715 * raise
3716 * continue
3717 */
3718 }
3719
3720 /* "yarl/_quoting_c.pyx":237
3721 * if _write_pct(writer, ch, True) < 0:
3722 * raise
3723 * continue # <<<<<<<<<<<<<<
3724 *
3725 * if bit_at(self._safe_table, ch):
3726 */
3727 goto __pyx_L3_continue;
3728
3729 /* "yarl/_quoting_c.pyx":234
3730 * idx += 2
3731 * if ch < 128:
3732 * if bit_at(self._protected_table, ch): # <<<<<<<<<<<<<<
3733 * if _write_pct(writer, ch, True) < 0:
3734 * raise
3735 */
3736 }
3737
3738 /* "yarl/_quoting_c.pyx":239
3739 * continue
3740 *
3741 * if bit_at(self._safe_table, ch): # <<<<<<<<<<<<<<
3742 * if _write_char(writer, ch, True) < 0:
3743 * raise
3744 */
3745 __pyx_t_2 = (__pyx_f_4yarl_10_quoting_c_bit_at(__pyx_v_self->_safe_table, __pyx_v_ch) != 0);
3746 if (__pyx_t_2) {
3747
3748 /* "yarl/_quoting_c.pyx":240
3749 *
3750 * if bit_at(self._safe_table, ch):
3751 * if _write_char(writer, ch, True) < 0: # <<<<<<<<<<<<<<
3752 * raise
3753 * continue
3754 */
3755 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, __pyx_v_ch, 1) < 0) != 0);
3756 if (unlikely(__pyx_t_2)) {
3757
3758 /* "yarl/_quoting_c.pyx":241
3759 * if bit_at(self._safe_table, ch):
3760 * if _write_char(writer, ch, True) < 0:
3761 * raise # <<<<<<<<<<<<<<
3762 * continue
3763 *
3764 */
3765 __Pyx_ReraiseException(); __PYX_ERR(0, 241, __pyx_L1_error)
3766
3767 /* "yarl/_quoting_c.pyx":240
3768 *
3769 * if bit_at(self._safe_table, ch):
3770 * if _write_char(writer, ch, True) < 0: # <<<<<<<<<<<<<<
3771 * raise
3772 * continue
3773 */
3774 }
3775
3776 /* "yarl/_quoting_c.pyx":242
3777 * if _write_char(writer, ch, True) < 0:
3778 * raise
3779 * continue # <<<<<<<<<<<<<<
3780 *
3781 * changed = (_is_lower_hex(val[idx - 2]) or
3782 */
3783 goto __pyx_L3_continue;
3784
3785 /* "yarl/_quoting_c.pyx":239
3786 * continue
3787 *
3788 * if bit_at(self._safe_table, ch): # <<<<<<<<<<<<<<
3789 * if _write_char(writer, ch, True) < 0:
3790 * raise
3791 */
3792 }
3793
3794 /* "yarl/_quoting_c.pyx":233
3795 * if ch != <Py_UCS4>-1:
3796 * idx += 2
3797 * if ch < 128: # <<<<<<<<<<<<<<
3798 * if bit_at(self._protected_table, ch):
3799 * if _write_pct(writer, ch, True) < 0:
3800 */
3801 }
3802
3803 /* "yarl/_quoting_c.pyx":244
3804 * continue
3805 *
3806 * changed = (_is_lower_hex(val[idx - 2]) or # <<<<<<<<<<<<<<
3807 * _is_lower_hex(val[idx - 1]))
3808 * if _write_pct(writer, ch, changed) < 0:
3809 */
3810 __pyx_t_5 = (__pyx_v_idx - 2);
3811 __pyx_t_6 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_6 == (Py_UCS4)-1)) __PYX_ERR(0, 244, __pyx_L1_error)
3812 __pyx_t_8 = __pyx_f_4yarl_10_quoting_c__is_lower_hex(__pyx_t_6);
3813 if (!__pyx_t_8) {
3814 } else {
3815 __pyx_t_7 = __pyx_t_8;
3816 goto __pyx_L15_bool_binop_done;
3817 }
3818
3819 /* "yarl/_quoting_c.pyx":245
3820 *
3821 * changed = (_is_lower_hex(val[idx - 2]) or
3822 * _is_lower_hex(val[idx - 1])) # <<<<<<<<<<<<<<
3823 * if _write_pct(writer, ch, changed) < 0:
3824 * raise
3825 */
3826 __pyx_t_5 = (__pyx_v_idx - 1);
3827 __pyx_t_6 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_6 == (Py_UCS4)-1)) __PYX_ERR(0, 245, __pyx_L1_error)
3828 __pyx_t_8 = __pyx_f_4yarl_10_quoting_c__is_lower_hex(__pyx_t_6);
3829 __pyx_t_7 = __pyx_t_8;
3830 __pyx_L15_bool_binop_done:;
3831 __pyx_v_changed = __pyx_t_7;
3832
3833 /* "yarl/_quoting_c.pyx":246
3834 * changed = (_is_lower_hex(val[idx - 2]) or
3835 * _is_lower_hex(val[idx - 1]))
3836 * if _write_pct(writer, ch, changed) < 0: # <<<<<<<<<<<<<<
3837 * raise
3838 * continue
3839 */
3840 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c__write_pct(__pyx_v_writer, __pyx_v_ch, __pyx_v_changed) < 0) != 0);
3841 if (unlikely(__pyx_t_2)) {
3842
3843 /* "yarl/_quoting_c.pyx":247
3844 * _is_lower_hex(val[idx - 1]))
3845 * if _write_pct(writer, ch, changed) < 0:
3846 * raise # <<<<<<<<<<<<<<
3847 * continue
3848 * else:
3849 */
3850 __Pyx_ReraiseException(); __PYX_ERR(0, 247, __pyx_L1_error)
3851
3852 /* "yarl/_quoting_c.pyx":246
3853 * changed = (_is_lower_hex(val[idx - 2]) or
3854 * _is_lower_hex(val[idx - 1]))
3855 * if _write_pct(writer, ch, changed) < 0: # <<<<<<<<<<<<<<
3856 * raise
3857 * continue
3858 */
3859 }
3860
3861 /* "yarl/_quoting_c.pyx":248
3862 * if _write_pct(writer, ch, changed) < 0:
3863 * raise
3864 * continue # <<<<<<<<<<<<<<
3865 * else:
3866 * ch = '%'
3867 */
3868 goto __pyx_L3_continue;
3869
3870 /* "yarl/_quoting_c.pyx":231
3871 * if ch == '%' and self._requote and idx <= length - 2:
3872 * ch = _restore_ch(val[idx], val[idx + 1])
3873 * if ch != <Py_UCS4>-1: # <<<<<<<<<<<<<<
3874 * idx += 2
3875 * if ch < 128:
3876 */
3877 }
3878
3879 /* "yarl/_quoting_c.pyx":250
3880 * continue
3881 * else:
3882 * ch = '%' # <<<<<<<<<<<<<<
3883 *
3884 * if self._write(writer, ch) < 0:
3885 */
3886 /*else*/ {
3887 __pyx_v_ch = 37;
3888 }
3889
3890 /* "yarl/_quoting_c.pyx":229
3891 * ch = val[idx]
3892 * idx += 1
3893 * if ch == '%' and self._requote and idx <= length - 2: # <<<<<<<<<<<<<<
3894 * ch = _restore_ch(val[idx], val[idx + 1])
3895 * if ch != <Py_UCS4>-1:
3896 */
3897 }
3898
3899 /* "yarl/_quoting_c.pyx":252
3900 * ch = '%'
3901 *
3902 * if self._write(writer, ch) < 0: # <<<<<<<<<<<<<<
3903 * raise
3904 *
3905 */
3906 __pyx_t_2 = ((__pyx_f_4yarl_10_quoting_c_7_Quoter__write(__pyx_v_self, __pyx_v_writer, __pyx_v_ch) < 0) != 0);
3907 if (unlikely(__pyx_t_2)) {
3908
3909 /* "yarl/_quoting_c.pyx":253
3910 *
3911 * if self._write(writer, ch) < 0:
3912 * raise # <<<<<<<<<<<<<<
3913 *
3914 * if not writer.changed:
3915 */
3916 __Pyx_ReraiseException(); __PYX_ERR(0, 253, __pyx_L1_error)
3917
3918 /* "yarl/_quoting_c.pyx":252
3919 * ch = '%'
3920 *
3921 * if self._write(writer, ch) < 0: # <<<<<<<<<<<<<<
3922 * raise
3923 *
3924 */
3925 }
3926 __pyx_L3_continue:;
3927 }
3928
3929 /* "yarl/_quoting_c.pyx":255
3930 * raise
3931 *
3932 * if not writer.changed: # <<<<<<<<<<<<<<
3933 * return val
3934 * else:
3935 */
3936 __pyx_t_2 = ((!(__pyx_v_writer->changed != 0)) != 0);
3937 if (__pyx_t_2) {
3938
3939 /* "yarl/_quoting_c.pyx":256
3940 *
3941 * if not writer.changed:
3942 * return val # <<<<<<<<<<<<<<
3943 * else:
3944 * return PyUnicode_DecodeASCII(writer.buf, writer.pos, "strict")
3945 */
3946 __Pyx_XDECREF(__pyx_r);
3947 __Pyx_INCREF(__pyx_v_val);
3948 __pyx_r = __pyx_v_val;
3949 goto __pyx_L0;
3950
3951 /* "yarl/_quoting_c.pyx":255
3952 * raise
3953 *
3954 * if not writer.changed: # <<<<<<<<<<<<<<
3955 * return val
3956 * else:
3957 */
3958 }
3959
3960 /* "yarl/_quoting_c.pyx":258
3961 * return val
3962 * else:
3963 * return PyUnicode_DecodeASCII(writer.buf, writer.pos, "strict") # <<<<<<<<<<<<<<
3964 *
3965 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch):
3966 */
3967 /*else*/ {
3968 __Pyx_XDECREF(__pyx_r);
3969 __pyx_t_9 = PyUnicode_DecodeASCII(__pyx_v_writer->buf, __pyx_v_writer->pos, ((char *)"strict")); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 258, __pyx_L1_error)
3970 __Pyx_GOTREF(__pyx_t_9);
3971 __pyx_r = ((PyObject*)__pyx_t_9);
3972 __pyx_t_9 = 0;
3973 goto __pyx_L0;
3974 }
3975
3976 /* "yarl/_quoting_c.pyx":220
3977 * _release_writer(&writer)
3978 *
3979 * cdef str _do_quote(self, str val, Writer *writer): # <<<<<<<<<<<<<<
3980 * cdef Py_UCS4 ch
3981 * cdef int changed
3982 */
3983
3984 /* function exit code */
3985 __pyx_L1_error:;
3986 __Pyx_XDECREF(__pyx_t_9);
3987 __Pyx_AddTraceback("yarl._quoting_c._Quoter._do_quote", __pyx_clineno, __pyx_lineno, __pyx_filename);
3988 __pyx_r = 0;
3989 __pyx_L0:;
3990 __Pyx_XGIVEREF(__pyx_r);
3991 __Pyx_RefNannyFinishContext();
3992 return __pyx_r;
3993 }
3994
3995 /* "yarl/_quoting_c.pyx":260
3996 * return PyUnicode_DecodeASCII(writer.buf, writer.pos, "strict")
3997 *
3998 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch): # <<<<<<<<<<<<<<
3999 * if self._qs:
4000 * if ch == ' ':
4001 */
4002
__pyx_f_4yarl_10_quoting_c_7_Quoter__write(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self,struct __pyx_t_4yarl_10_quoting_c_Writer * __pyx_v_writer,Py_UCS4 __pyx_v_ch)4003 static CYTHON_INLINE int __pyx_f_4yarl_10_quoting_c_7_Quoter__write(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, struct __pyx_t_4yarl_10_quoting_c_Writer *__pyx_v_writer, Py_UCS4 __pyx_v_ch) {
4004 int __pyx_r;
4005 __Pyx_RefNannyDeclarations
4006 int __pyx_t_1;
4007 int __pyx_t_2;
4008 __Pyx_RefNannySetupContext("_write", 0);
4009
4010 /* "yarl/_quoting_c.pyx":261
4011 *
4012 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch):
4013 * if self._qs: # <<<<<<<<<<<<<<
4014 * if ch == ' ':
4015 * return _write_char(writer, '+', True)
4016 */
4017 __pyx_t_1 = (__pyx_v_self->_qs != 0);
4018 if (__pyx_t_1) {
4019
4020 /* "yarl/_quoting_c.pyx":262
4021 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch):
4022 * if self._qs:
4023 * if ch == ' ': # <<<<<<<<<<<<<<
4024 * return _write_char(writer, '+', True)
4025 *
4026 */
4027 __pyx_t_1 = ((__pyx_v_ch == 32) != 0);
4028 if (__pyx_t_1) {
4029
4030 /* "yarl/_quoting_c.pyx":263
4031 * if self._qs:
4032 * if ch == ' ':
4033 * return _write_char(writer, '+', True) # <<<<<<<<<<<<<<
4034 *
4035 * if ch < 128 and bit_at(self._safe_table, ch):
4036 */
4037 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, 43, 1);
4038 goto __pyx_L0;
4039
4040 /* "yarl/_quoting_c.pyx":262
4041 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch):
4042 * if self._qs:
4043 * if ch == ' ': # <<<<<<<<<<<<<<
4044 * return _write_char(writer, '+', True)
4045 *
4046 */
4047 }
4048
4049 /* "yarl/_quoting_c.pyx":261
4050 *
4051 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch):
4052 * if self._qs: # <<<<<<<<<<<<<<
4053 * if ch == ' ':
4054 * return _write_char(writer, '+', True)
4055 */
4056 }
4057
4058 /* "yarl/_quoting_c.pyx":265
4059 * return _write_char(writer, '+', True)
4060 *
4061 * if ch < 128 and bit_at(self._safe_table, ch): # <<<<<<<<<<<<<<
4062 * return _write_char(writer, ch, False)
4063 *
4064 */
4065 __pyx_t_2 = ((__pyx_v_ch < 0x80) != 0);
4066 if (__pyx_t_2) {
4067 } else {
4068 __pyx_t_1 = __pyx_t_2;
4069 goto __pyx_L6_bool_binop_done;
4070 }
4071 __pyx_t_2 = (__pyx_f_4yarl_10_quoting_c_bit_at(__pyx_v_self->_safe_table, __pyx_v_ch) != 0);
4072 __pyx_t_1 = __pyx_t_2;
4073 __pyx_L6_bool_binop_done:;
4074 if (__pyx_t_1) {
4075
4076 /* "yarl/_quoting_c.pyx":266
4077 *
4078 * if ch < 128 and bit_at(self._safe_table, ch):
4079 * return _write_char(writer, ch, False) # <<<<<<<<<<<<<<
4080 *
4081 * return _write_utf8(writer, ch)
4082 */
4083 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_char(__pyx_v_writer, __pyx_v_ch, 0);
4084 goto __pyx_L0;
4085
4086 /* "yarl/_quoting_c.pyx":265
4087 * return _write_char(writer, '+', True)
4088 *
4089 * if ch < 128 and bit_at(self._safe_table, ch): # <<<<<<<<<<<<<<
4090 * return _write_char(writer, ch, False)
4091 *
4092 */
4093 }
4094
4095 /* "yarl/_quoting_c.pyx":268
4096 * return _write_char(writer, ch, False)
4097 *
4098 * return _write_utf8(writer, ch) # <<<<<<<<<<<<<<
4099 *
4100 *
4101 */
4102 __pyx_r = __pyx_f_4yarl_10_quoting_c__write_utf8(__pyx_v_writer, __pyx_v_ch);
4103 goto __pyx_L0;
4104
4105 /* "yarl/_quoting_c.pyx":260
4106 * return PyUnicode_DecodeASCII(writer.buf, writer.pos, "strict")
4107 *
4108 * cdef inline int _write(self, Writer *writer, Py_UCS4 ch): # <<<<<<<<<<<<<<
4109 * if self._qs:
4110 * if ch == ' ':
4111 */
4112
4113 /* function exit code */
4114 __pyx_L0:;
4115 __Pyx_RefNannyFinishContext();
4116 return __pyx_r;
4117 }
4118
4119 /* "(tree fragment)":1
4120 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4121 * cdef tuple state
4122 * cdef object _dict
4123 */
4124
4125 /* Python wrapper */
4126 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4yarl_10_quoting_c_7_Quoter_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4127 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4128 PyObject *__pyx_r = 0;
4129 __Pyx_RefNannyDeclarations
4130 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4131 __pyx_r = __pyx_pf_4yarl_10_quoting_c_7_Quoter_4__reduce_cython__(((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_v_self));
4132
4133 /* function exit code */
4134 __Pyx_RefNannyFinishContext();
4135 return __pyx_r;
4136 }
4137
__pyx_pf_4yarl_10_quoting_c_7_Quoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self)4138 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self) {
4139 PyObject *__pyx_v_state = 0;
4140 PyObject *__pyx_v__dict = 0;
4141 int __pyx_v_use_setstate;
4142 PyObject *__pyx_r = NULL;
4143 __Pyx_RefNannyDeclarations
4144 PyObject *__pyx_t_1 = NULL;
4145 PyObject *__pyx_t_2 = NULL;
4146 PyObject *__pyx_t_3 = NULL;
4147 PyObject *__pyx_t_4 = NULL;
4148 PyObject *__pyx_t_5 = NULL;
4149 int __pyx_t_6;
4150 int __pyx_t_7;
4151 int __pyx_lineno = 0;
4152 const char *__pyx_filename = NULL;
4153 int __pyx_clineno = 0;
4154 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4155
4156 /* "(tree fragment)":5
4157 * cdef object _dict
4158 * cdef bint use_setstate
4159 * state = (self._protected_table, self._qs, self._requote, self._safe_table) # <<<<<<<<<<<<<<
4160 * _dict = getattr(self, '__dict__', None)
4161 * if _dict is not None:
4162 */
4163 __pyx_t_1 = __Pyx_PyObject_FromCString(__pyx_v_self->_protected_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
4164 __Pyx_GOTREF(__pyx_t_1);
4165 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->_qs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
4166 __Pyx_GOTREF(__pyx_t_2);
4167 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->_requote); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
4168 __Pyx_GOTREF(__pyx_t_3);
4169 __pyx_t_4 = __Pyx_PyObject_FromCString(__pyx_v_self->_safe_table); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
4170 __Pyx_GOTREF(__pyx_t_4);
4171 __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error)
4172 __Pyx_GOTREF(__pyx_t_5);
4173 __Pyx_GIVEREF(__pyx_t_1);
4174 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
4175 __Pyx_GIVEREF(__pyx_t_2);
4176 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
4177 __Pyx_GIVEREF(__pyx_t_3);
4178 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
4179 __Pyx_GIVEREF(__pyx_t_4);
4180 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
4181 __pyx_t_1 = 0;
4182 __pyx_t_2 = 0;
4183 __pyx_t_3 = 0;
4184 __pyx_t_4 = 0;
4185 __pyx_v_state = ((PyObject*)__pyx_t_5);
4186 __pyx_t_5 = 0;
4187
4188 /* "(tree fragment)":6
4189 * cdef bint use_setstate
4190 * state = (self._protected_table, self._qs, self._requote, self._safe_table)
4191 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
4192 * if _dict is not None:
4193 * state += (_dict,)
4194 */
4195 __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error)
4196 __Pyx_GOTREF(__pyx_t_5);
4197 __pyx_v__dict = __pyx_t_5;
4198 __pyx_t_5 = 0;
4199
4200 /* "(tree fragment)":7
4201 * state = (self._protected_table, self._qs, self._requote, self._safe_table)
4202 * _dict = getattr(self, '__dict__', None)
4203 * if _dict is not None: # <<<<<<<<<<<<<<
4204 * state += (_dict,)
4205 * use_setstate = True
4206 */
4207 __pyx_t_6 = (__pyx_v__dict != Py_None);
4208 __pyx_t_7 = (__pyx_t_6 != 0);
4209 if (__pyx_t_7) {
4210
4211 /* "(tree fragment)":8
4212 * _dict = getattr(self, '__dict__', None)
4213 * if _dict is not None:
4214 * state += (_dict,) # <<<<<<<<<<<<<<
4215 * use_setstate = True
4216 * else:
4217 */
4218 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8, __pyx_L1_error)
4219 __Pyx_GOTREF(__pyx_t_5);
4220 __Pyx_INCREF(__pyx_v__dict);
4221 __Pyx_GIVEREF(__pyx_v__dict);
4222 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict);
4223 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
4224 __Pyx_GOTREF(__pyx_t_4);
4225 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4226 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
4227 __pyx_t_4 = 0;
4228
4229 /* "(tree fragment)":9
4230 * if _dict is not None:
4231 * state += (_dict,)
4232 * use_setstate = True # <<<<<<<<<<<<<<
4233 * else:
4234 * use_setstate = False
4235 */
4236 __pyx_v_use_setstate = 1;
4237
4238 /* "(tree fragment)":7
4239 * state = (self._protected_table, self._qs, self._requote, self._safe_table)
4240 * _dict = getattr(self, '__dict__', None)
4241 * if _dict is not None: # <<<<<<<<<<<<<<
4242 * state += (_dict,)
4243 * use_setstate = True
4244 */
4245 goto __pyx_L3;
4246 }
4247
4248 /* "(tree fragment)":11
4249 * use_setstate = True
4250 * else:
4251 * use_setstate = False # <<<<<<<<<<<<<<
4252 * if use_setstate:
4253 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, None), state
4254 */
4255 /*else*/ {
4256 __pyx_v_use_setstate = 0;
4257 }
4258 __pyx_L3:;
4259
4260 /* "(tree fragment)":12
4261 * else:
4262 * use_setstate = False
4263 * if use_setstate: # <<<<<<<<<<<<<<
4264 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, None), state
4265 * else:
4266 */
4267 __pyx_t_7 = (__pyx_v_use_setstate != 0);
4268 if (__pyx_t_7) {
4269
4270 /* "(tree fragment)":13
4271 * use_setstate = False
4272 * if use_setstate:
4273 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, None), state # <<<<<<<<<<<<<<
4274 * else:
4275 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, state)
4276 */
4277 __Pyx_XDECREF(__pyx_r);
4278 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle__Quoter); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
4279 __Pyx_GOTREF(__pyx_t_4);
4280 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
4281 __Pyx_GOTREF(__pyx_t_5);
4282 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4283 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4284 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4285 __Pyx_INCREF(__pyx_int_244432181);
4286 __Pyx_GIVEREF(__pyx_int_244432181);
4287 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_244432181);
4288 __Pyx_INCREF(Py_None);
4289 __Pyx_GIVEREF(Py_None);
4290 PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
4291 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
4292 __Pyx_GOTREF(__pyx_t_3);
4293 __Pyx_GIVEREF(__pyx_t_4);
4294 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
4295 __Pyx_GIVEREF(__pyx_t_5);
4296 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
4297 __Pyx_INCREF(__pyx_v_state);
4298 __Pyx_GIVEREF(__pyx_v_state);
4299 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
4300 __pyx_t_4 = 0;
4301 __pyx_t_5 = 0;
4302 __pyx_r = __pyx_t_3;
4303 __pyx_t_3 = 0;
4304 goto __pyx_L0;
4305
4306 /* "(tree fragment)":12
4307 * else:
4308 * use_setstate = False
4309 * if use_setstate: # <<<<<<<<<<<<<<
4310 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, None), state
4311 * else:
4312 */
4313 }
4314
4315 /* "(tree fragment)":15
4316 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, None), state
4317 * else:
4318 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, state) # <<<<<<<<<<<<<<
4319 * def __setstate_cython__(self, __pyx_state):
4320 * __pyx_unpickle__Quoter__set_state(self, __pyx_state)
4321 */
4322 /*else*/ {
4323 __Pyx_XDECREF(__pyx_r);
4324 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle__Quoter); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
4325 __Pyx_GOTREF(__pyx_t_3);
4326 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
4327 __Pyx_GOTREF(__pyx_t_5);
4328 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4329 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4330 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4331 __Pyx_INCREF(__pyx_int_244432181);
4332 __Pyx_GIVEREF(__pyx_int_244432181);
4333 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_244432181);
4334 __Pyx_INCREF(__pyx_v_state);
4335 __Pyx_GIVEREF(__pyx_v_state);
4336 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
4337 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
4338 __Pyx_GOTREF(__pyx_t_4);
4339 __Pyx_GIVEREF(__pyx_t_3);
4340 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4341 __Pyx_GIVEREF(__pyx_t_5);
4342 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
4343 __pyx_t_3 = 0;
4344 __pyx_t_5 = 0;
4345 __pyx_r = __pyx_t_4;
4346 __pyx_t_4 = 0;
4347 goto __pyx_L0;
4348 }
4349
4350 /* "(tree fragment)":1
4351 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
4352 * cdef tuple state
4353 * cdef object _dict
4354 */
4355
4356 /* function exit code */
4357 __pyx_L1_error:;
4358 __Pyx_XDECREF(__pyx_t_1);
4359 __Pyx_XDECREF(__pyx_t_2);
4360 __Pyx_XDECREF(__pyx_t_3);
4361 __Pyx_XDECREF(__pyx_t_4);
4362 __Pyx_XDECREF(__pyx_t_5);
4363 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4364 __pyx_r = NULL;
4365 __pyx_L0:;
4366 __Pyx_XDECREF(__pyx_v_state);
4367 __Pyx_XDECREF(__pyx_v__dict);
4368 __Pyx_XGIVEREF(__pyx_r);
4369 __Pyx_RefNannyFinishContext();
4370 return __pyx_r;
4371 }
4372
4373 /* "(tree fragment)":16
4374 * else:
4375 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, state)
4376 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4377 * __pyx_unpickle__Quoter__set_state(self, __pyx_state)
4378 */
4379
4380 /* Python wrapper */
4381 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4yarl_10_quoting_c_7_Quoter_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4382 static PyObject *__pyx_pw_4yarl_10_quoting_c_7_Quoter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4383 PyObject *__pyx_r = 0;
4384 __Pyx_RefNannyDeclarations
4385 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4386 __pyx_r = __pyx_pf_4yarl_10_quoting_c_7_Quoter_6__setstate_cython__(((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4387
4388 /* function exit code */
4389 __Pyx_RefNannyFinishContext();
4390 return __pyx_r;
4391 }
4392
__pyx_pf_4yarl_10_quoting_c_7_Quoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v_self,PyObject * __pyx_v___pyx_state)4393 static PyObject *__pyx_pf_4yarl_10_quoting_c_7_Quoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4394 PyObject *__pyx_r = NULL;
4395 __Pyx_RefNannyDeclarations
4396 PyObject *__pyx_t_1 = NULL;
4397 int __pyx_lineno = 0;
4398 const char *__pyx_filename = NULL;
4399 int __pyx_clineno = 0;
4400 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4401
4402 /* "(tree fragment)":17
4403 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, state)
4404 * def __setstate_cython__(self, __pyx_state):
4405 * __pyx_unpickle__Quoter__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
4406 */
4407 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
4408 __pyx_t_1 = __pyx_f_4yarl_10_quoting_c___pyx_unpickle__Quoter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
4409 __Pyx_GOTREF(__pyx_t_1);
4410 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4411
4412 /* "(tree fragment)":16
4413 * else:
4414 * return __pyx_unpickle__Quoter, (type(self), 0xe91bd35, state)
4415 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
4416 * __pyx_unpickle__Quoter__set_state(self, __pyx_state)
4417 */
4418
4419 /* function exit code */
4420 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4421 goto __pyx_L0;
4422 __pyx_L1_error:;
4423 __Pyx_XDECREF(__pyx_t_1);
4424 __Pyx_AddTraceback("yarl._quoting_c._Quoter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4425 __pyx_r = NULL;
4426 __pyx_L0:;
4427 __Pyx_XGIVEREF(__pyx_r);
4428 __Pyx_RefNannyFinishContext();
4429 return __pyx_r;
4430 }
4431
4432 /* "yarl/_quoting_c.pyx":277
4433 * cdef _Quoter _qs_quoter
4434 *
4435 * def __init__(self, *, unsafe='', qs=False): # <<<<<<<<<<<<<<
4436 * self._unsafe = unsafe
4437 * self._qs = qs
4438 */
4439
4440 /* Python wrapper */
4441 static int __pyx_pw_4yarl_10_quoting_c_9_Unquoter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4yarl_10_quoting_c_9_Unquoter_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4442 static int __pyx_pw_4yarl_10_quoting_c_9_Unquoter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4443 PyObject *__pyx_v_unsafe = 0;
4444 PyObject *__pyx_v_qs = 0;
4445 int __pyx_lineno = 0;
4446 const char *__pyx_filename = NULL;
4447 int __pyx_clineno = 0;
4448 int __pyx_r;
4449 __Pyx_RefNannyDeclarations
4450 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4451 {
4452 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unsafe,&__pyx_n_s_qs,0};
4453 PyObject* values[2] = {0,0};
4454 values[0] = ((PyObject *)__pyx_kp_u_);
4455 values[1] = ((PyObject *)Py_False);
4456 if (unlikely(__pyx_kwds)) {
4457 Py_ssize_t kw_args;
4458 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4459 switch (pos_args) {
4460 case 0: break;
4461 default: goto __pyx_L5_argtuple_error;
4462 }
4463 kw_args = PyDict_Size(__pyx_kwds);
4464 if (kw_args > 0 && likely(kw_args <= 2)) {
4465 Py_ssize_t index;
4466 for (index = 0; index < 2 && kw_args > 0; index++) {
4467 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
4468 if (value) { values[index] = value; kw_args--; }
4469 }
4470 }
4471 if (unlikely(kw_args > 0)) {
4472 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "__init__") < 0)) __PYX_ERR(0, 277, __pyx_L3_error)
4473 }
4474 } else if (PyTuple_GET_SIZE(__pyx_args) != 0) {
4475 goto __pyx_L5_argtuple_error;
4476 } else {
4477 }
4478 __pyx_v_unsafe = values[0];
4479 __pyx_v_qs = values[1];
4480 }
4481 goto __pyx_L4_argument_unpacking_done;
4482 __pyx_L5_argtuple_error:;
4483 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 277, __pyx_L3_error)
4484 __pyx_L3_error:;
4485 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4486 __Pyx_RefNannyFinishContext();
4487 return -1;
4488 __pyx_L4_argument_unpacking_done:;
4489 __pyx_r = __pyx_pf_4yarl_10_quoting_c_9_Unquoter___init__(((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)__pyx_v_self), __pyx_v_unsafe, __pyx_v_qs);
4490
4491 /* function exit code */
4492 __Pyx_RefNannyFinishContext();
4493 return __pyx_r;
4494 }
4495
__pyx_pf_4yarl_10_quoting_c_9_Unquoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v_self,PyObject * __pyx_v_unsafe,PyObject * __pyx_v_qs)4496 static int __pyx_pf_4yarl_10_quoting_c_9_Unquoter___init__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_unsafe, PyObject *__pyx_v_qs) {
4497 int __pyx_r;
4498 __Pyx_RefNannyDeclarations
4499 PyObject *__pyx_t_1 = NULL;
4500 int __pyx_t_2;
4501 PyObject *__pyx_t_3 = NULL;
4502 int __pyx_lineno = 0;
4503 const char *__pyx_filename = NULL;
4504 int __pyx_clineno = 0;
4505 __Pyx_RefNannySetupContext("__init__", 0);
4506
4507 /* "yarl/_quoting_c.pyx":278
4508 *
4509 * def __init__(self, *, unsafe='', qs=False):
4510 * self._unsafe = unsafe # <<<<<<<<<<<<<<
4511 * self._qs = qs
4512 * self._quoter = _Quoter()
4513 */
4514 if (!(likely(PyUnicode_CheckExact(__pyx_v_unsafe))||((__pyx_v_unsafe) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_unsafe)->tp_name), 0))) __PYX_ERR(0, 278, __pyx_L1_error)
4515 __pyx_t_1 = __pyx_v_unsafe;
4516 __Pyx_INCREF(__pyx_t_1);
4517 __Pyx_GIVEREF(__pyx_t_1);
4518 __Pyx_GOTREF(__pyx_v_self->_unsafe);
4519 __Pyx_DECREF(__pyx_v_self->_unsafe);
4520 __pyx_v_self->_unsafe = ((PyObject*)__pyx_t_1);
4521 __pyx_t_1 = 0;
4522
4523 /* "yarl/_quoting_c.pyx":279
4524 * def __init__(self, *, unsafe='', qs=False):
4525 * self._unsafe = unsafe
4526 * self._qs = qs # <<<<<<<<<<<<<<
4527 * self._quoter = _Quoter()
4528 * self._qs_quoter = _Quoter(qs=True)
4529 */
4530 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_qs); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error)
4531 __pyx_v_self->_qs = __pyx_t_2;
4532
4533 /* "yarl/_quoting_c.pyx":280
4534 * self._unsafe = unsafe
4535 * self._qs = qs
4536 * self._quoter = _Quoter() # <<<<<<<<<<<<<<
4537 * self._qs_quoter = _Quoter(qs=True)
4538 *
4539 */
4540 __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4yarl_10_quoting_c__Quoter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error)
4541 __Pyx_GOTREF(__pyx_t_1);
4542 __Pyx_GIVEREF(__pyx_t_1);
4543 __Pyx_GOTREF(__pyx_v_self->_quoter);
4544 __Pyx_DECREF(((PyObject *)__pyx_v_self->_quoter));
4545 __pyx_v_self->_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_t_1);
4546 __pyx_t_1 = 0;
4547
4548 /* "yarl/_quoting_c.pyx":281
4549 * self._qs = qs
4550 * self._quoter = _Quoter()
4551 * self._qs_quoter = _Quoter(qs=True) # <<<<<<<<<<<<<<
4552 *
4553 * def __call__(self, val):
4554 */
4555 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
4556 __Pyx_GOTREF(__pyx_t_1);
4557 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_qs, Py_True) < 0) __PYX_ERR(0, 281, __pyx_L1_error)
4558 __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4yarl_10_quoting_c__Quoter), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
4559 __Pyx_GOTREF(__pyx_t_3);
4560 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4561 __Pyx_GIVEREF(__pyx_t_3);
4562 __Pyx_GOTREF(__pyx_v_self->_qs_quoter);
4563 __Pyx_DECREF(((PyObject *)__pyx_v_self->_qs_quoter));
4564 __pyx_v_self->_qs_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_t_3);
4565 __pyx_t_3 = 0;
4566
4567 /* "yarl/_quoting_c.pyx":277
4568 * cdef _Quoter _qs_quoter
4569 *
4570 * def __init__(self, *, unsafe='', qs=False): # <<<<<<<<<<<<<<
4571 * self._unsafe = unsafe
4572 * self._qs = qs
4573 */
4574
4575 /* function exit code */
4576 __pyx_r = 0;
4577 goto __pyx_L0;
4578 __pyx_L1_error:;
4579 __Pyx_XDECREF(__pyx_t_1);
4580 __Pyx_XDECREF(__pyx_t_3);
4581 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4582 __pyx_r = -1;
4583 __pyx_L0:;
4584 __Pyx_RefNannyFinishContext();
4585 return __pyx_r;
4586 }
4587
4588 /* "yarl/_quoting_c.pyx":283
4589 * self._qs_quoter = _Quoter(qs=True)
4590 *
4591 * def __call__(self, val): # <<<<<<<<<<<<<<
4592 * if val is None:
4593 * return None
4594 */
4595
4596 /* Python wrapper */
4597 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4yarl_10_quoting_c_9_Unquoter_3__call__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4598 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4599 PyObject *__pyx_v_val = 0;
4600 int __pyx_lineno = 0;
4601 const char *__pyx_filename = NULL;
4602 int __pyx_clineno = 0;
4603 PyObject *__pyx_r = 0;
4604 __Pyx_RefNannyDeclarations
4605 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
4606 {
4607 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_val,0};
4608 PyObject* values[1] = {0};
4609 if (unlikely(__pyx_kwds)) {
4610 Py_ssize_t kw_args;
4611 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4612 switch (pos_args) {
4613 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4614 CYTHON_FALLTHROUGH;
4615 case 0: break;
4616 default: goto __pyx_L5_argtuple_error;
4617 }
4618 kw_args = PyDict_Size(__pyx_kwds);
4619 switch (pos_args) {
4620 case 0:
4621 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
4622 else goto __pyx_L5_argtuple_error;
4623 }
4624 if (unlikely(kw_args > 0)) {
4625 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 283, __pyx_L3_error)
4626 }
4627 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4628 goto __pyx_L5_argtuple_error;
4629 } else {
4630 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4631 }
4632 __pyx_v_val = values[0];
4633 }
4634 goto __pyx_L4_argument_unpacking_done;
4635 __pyx_L5_argtuple_error:;
4636 __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 283, __pyx_L3_error)
4637 __pyx_L3_error:;
4638 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4639 __Pyx_RefNannyFinishContext();
4640 return NULL;
4641 __pyx_L4_argument_unpacking_done:;
4642 __pyx_r = __pyx_pf_4yarl_10_quoting_c_9_Unquoter_2__call__(((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)__pyx_v_self), __pyx_v_val);
4643
4644 /* function exit code */
4645 __Pyx_RefNannyFinishContext();
4646 return __pyx_r;
4647 }
4648
__pyx_pf_4yarl_10_quoting_c_9_Unquoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v_self,PyObject * __pyx_v_val)4649 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_2__call__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_val) {
4650 PyObject *__pyx_r = NULL;
4651 __Pyx_RefNannyDeclarations
4652 int __pyx_t_1;
4653 int __pyx_t_2;
4654 PyObject *__pyx_t_3 = NULL;
4655 int __pyx_lineno = 0;
4656 const char *__pyx_filename = NULL;
4657 int __pyx_clineno = 0;
4658 __Pyx_RefNannySetupContext("__call__", 0);
4659 __Pyx_INCREF(__pyx_v_val);
4660
4661 /* "yarl/_quoting_c.pyx":284
4662 *
4663 * def __call__(self, val):
4664 * if val is None: # <<<<<<<<<<<<<<
4665 * return None
4666 * if type(val) is not str:
4667 */
4668 __pyx_t_1 = (__pyx_v_val == Py_None);
4669 __pyx_t_2 = (__pyx_t_1 != 0);
4670 if (__pyx_t_2) {
4671
4672 /* "yarl/_quoting_c.pyx":285
4673 * def __call__(self, val):
4674 * if val is None:
4675 * return None # <<<<<<<<<<<<<<
4676 * if type(val) is not str:
4677 * if isinstance(val, str):
4678 */
4679 __Pyx_XDECREF(__pyx_r);
4680 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4681 goto __pyx_L0;
4682
4683 /* "yarl/_quoting_c.pyx":284
4684 *
4685 * def __call__(self, val):
4686 * if val is None: # <<<<<<<<<<<<<<
4687 * return None
4688 * if type(val) is not str:
4689 */
4690 }
4691
4692 /* "yarl/_quoting_c.pyx":286
4693 * if val is None:
4694 * return None
4695 * if type(val) is not str: # <<<<<<<<<<<<<<
4696 * if isinstance(val, str):
4697 * # derived from str
4698 */
4699 __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_val)) != ((PyObject *)(&PyUnicode_Type)));
4700 __pyx_t_1 = (__pyx_t_2 != 0);
4701 if (__pyx_t_1) {
4702
4703 /* "yarl/_quoting_c.pyx":287
4704 * return None
4705 * if type(val) is not str:
4706 * if isinstance(val, str): # <<<<<<<<<<<<<<
4707 * # derived from str
4708 * val = str(val)
4709 */
4710 __pyx_t_1 = PyUnicode_Check(__pyx_v_val);
4711 __pyx_t_2 = (__pyx_t_1 != 0);
4712 if (likely(__pyx_t_2)) {
4713
4714 /* "yarl/_quoting_c.pyx":289
4715 * if isinstance(val, str):
4716 * # derived from str
4717 * val = str(val) # <<<<<<<<<<<<<<
4718 * else:
4719 * raise TypeError("Argument should be str")
4720 */
4721 __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
4722 __Pyx_GOTREF(__pyx_t_3);
4723 __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_3);
4724 __pyx_t_3 = 0;
4725
4726 /* "yarl/_quoting_c.pyx":287
4727 * return None
4728 * if type(val) is not str:
4729 * if isinstance(val, str): # <<<<<<<<<<<<<<
4730 * # derived from str
4731 * val = str(val)
4732 */
4733 goto __pyx_L5;
4734 }
4735
4736 /* "yarl/_quoting_c.pyx":291
4737 * val = str(val)
4738 * else:
4739 * raise TypeError("Argument should be str") # <<<<<<<<<<<<<<
4740 * return self._do_unquote(<str>val)
4741 *
4742 */
4743 /*else*/ {
4744 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
4745 __Pyx_GOTREF(__pyx_t_3);
4746 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4747 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4748 __PYX_ERR(0, 291, __pyx_L1_error)
4749 }
4750 __pyx_L5:;
4751
4752 /* "yarl/_quoting_c.pyx":286
4753 * if val is None:
4754 * return None
4755 * if type(val) is not str: # <<<<<<<<<<<<<<
4756 * if isinstance(val, str):
4757 * # derived from str
4758 */
4759 }
4760
4761 /* "yarl/_quoting_c.pyx":292
4762 * else:
4763 * raise TypeError("Argument should be str")
4764 * return self._do_unquote(<str>val) # <<<<<<<<<<<<<<
4765 *
4766 * cdef str _do_unquote(self, str val):
4767 */
4768 __Pyx_XDECREF(__pyx_r);
4769 __pyx_t_3 = ((struct __pyx_vtabstruct_4yarl_10_quoting_c__Unquoter *)__pyx_v_self->__pyx_vtab)->_do_unquote(__pyx_v_self, ((PyObject*)__pyx_v_val)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
4770 __Pyx_GOTREF(__pyx_t_3);
4771 __pyx_r = __pyx_t_3;
4772 __pyx_t_3 = 0;
4773 goto __pyx_L0;
4774
4775 /* "yarl/_quoting_c.pyx":283
4776 * self._qs_quoter = _Quoter(qs=True)
4777 *
4778 * def __call__(self, val): # <<<<<<<<<<<<<<
4779 * if val is None:
4780 * return None
4781 */
4782
4783 /* function exit code */
4784 __pyx_L1_error:;
4785 __Pyx_XDECREF(__pyx_t_3);
4786 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4787 __pyx_r = NULL;
4788 __pyx_L0:;
4789 __Pyx_XDECREF(__pyx_v_val);
4790 __Pyx_XGIVEREF(__pyx_r);
4791 __Pyx_RefNannyFinishContext();
4792 return __pyx_r;
4793 }
4794
4795 /* "yarl/_quoting_c.pyx":294
4796 * return self._do_unquote(<str>val)
4797 *
4798 * cdef str _do_unquote(self, str val): # <<<<<<<<<<<<<<
4799 * if len(val) == 0:
4800 * return val
4801 */
4802
__pyx_f_4yarl_10_quoting_c_9_Unquoter__do_unquote(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v_self,PyObject * __pyx_v_val)4803 static PyObject *__pyx_f_4yarl_10_quoting_c_9_Unquoter__do_unquote(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v_val) {
4804 PyObject *__pyx_v_ret = 0;
4805 char __pyx_v_buffer[4];
4806 Py_ssize_t __pyx_v_buflen;
4807 Py_ssize_t __pyx_v_consumed;
4808 PyObject *__pyx_v_unquoted = 0;
4809 Py_UCS4 __pyx_v_ch;
4810 Py_ssize_t __pyx_v_idx;
4811 Py_ssize_t __pyx_v_length;
4812 Py_ssize_t __pyx_v_start_pct;
4813 PyObject *__pyx_v_h = NULL;
4814 PyObject *__pyx_r = NULL;
4815 __Pyx_RefNannyDeclarations
4816 Py_ssize_t __pyx_t_1;
4817 int __pyx_t_2;
4818 PyObject *__pyx_t_3 = NULL;
4819 Py_UCS4 __pyx_t_4;
4820 int __pyx_t_5;
4821 Py_UCS4 __pyx_t_6;
4822 PyObject *__pyx_t_7 = NULL;
4823 PyObject *__pyx_t_8 = NULL;
4824 PyObject *__pyx_t_9 = NULL;
4825 int __pyx_t_10;
4826 PyObject *__pyx_t_11 = NULL;
4827 PyObject *__pyx_t_12 = NULL;
4828 PyObject *__pyx_t_13 = NULL;
4829 int __pyx_t_14;
4830 PyObject *__pyx_t_15 = NULL;
4831 PyObject *__pyx_t_16 = NULL;
4832 PyObject *__pyx_t_17 = NULL;
4833 PyObject *__pyx_t_18 = NULL;
4834 PyObject *__pyx_t_19 = NULL;
4835 PyObject *__pyx_t_20 = NULL;
4836 int __pyx_t_21;
4837 PyObject *(*__pyx_t_22)(PyObject *);
4838 int __pyx_lineno = 0;
4839 const char *__pyx_filename = NULL;
4840 int __pyx_clineno = 0;
4841 __Pyx_RefNannySetupContext("_do_unquote", 0);
4842
4843 /* "yarl/_quoting_c.pyx":295
4844 *
4845 * cdef str _do_unquote(self, str val):
4846 * if len(val) == 0: # <<<<<<<<<<<<<<
4847 * return val
4848 * cdef list ret = []
4849 */
4850 if (unlikely(__pyx_v_val == Py_None)) {
4851 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
4852 __PYX_ERR(0, 295, __pyx_L1_error)
4853 }
4854 __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_val); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 295, __pyx_L1_error)
4855 __pyx_t_2 = ((__pyx_t_1 == 0) != 0);
4856 if (__pyx_t_2) {
4857
4858 /* "yarl/_quoting_c.pyx":296
4859 * cdef str _do_unquote(self, str val):
4860 * if len(val) == 0:
4861 * return val # <<<<<<<<<<<<<<
4862 * cdef list ret = []
4863 * cdef char buffer[4]
4864 */
4865 __Pyx_XDECREF(__pyx_r);
4866 __Pyx_INCREF(__pyx_v_val);
4867 __pyx_r = __pyx_v_val;
4868 goto __pyx_L0;
4869
4870 /* "yarl/_quoting_c.pyx":295
4871 *
4872 * cdef str _do_unquote(self, str val):
4873 * if len(val) == 0: # <<<<<<<<<<<<<<
4874 * return val
4875 * cdef list ret = []
4876 */
4877 }
4878
4879 /* "yarl/_quoting_c.pyx":297
4880 * if len(val) == 0:
4881 * return val
4882 * cdef list ret = [] # <<<<<<<<<<<<<<
4883 * cdef char buffer[4]
4884 * cdef Py_ssize_t buflen = 0
4885 */
4886 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
4887 __Pyx_GOTREF(__pyx_t_3);
4888 __pyx_v_ret = ((PyObject*)__pyx_t_3);
4889 __pyx_t_3 = 0;
4890
4891 /* "yarl/_quoting_c.pyx":299
4892 * cdef list ret = []
4893 * cdef char buffer[4]
4894 * cdef Py_ssize_t buflen = 0 # <<<<<<<<<<<<<<
4895 * cdef Py_ssize_t consumed
4896 * cdef str unquoted
4897 */
4898 __pyx_v_buflen = 0;
4899
4900 /* "yarl/_quoting_c.pyx":302
4901 * cdef Py_ssize_t consumed
4902 * cdef str unquoted
4903 * cdef Py_UCS4 ch = 0 # <<<<<<<<<<<<<<
4904 * cdef Py_ssize_t idx = 0
4905 * cdef Py_ssize_t length = len(val)
4906 */
4907 __pyx_v_ch = 0;
4908
4909 /* "yarl/_quoting_c.pyx":303
4910 * cdef str unquoted
4911 * cdef Py_UCS4 ch = 0
4912 * cdef Py_ssize_t idx = 0 # <<<<<<<<<<<<<<
4913 * cdef Py_ssize_t length = len(val)
4914 * cdef Py_ssize_t start_pct
4915 */
4916 __pyx_v_idx = 0;
4917
4918 /* "yarl/_quoting_c.pyx":304
4919 * cdef Py_UCS4 ch = 0
4920 * cdef Py_ssize_t idx = 0
4921 * cdef Py_ssize_t length = len(val) # <<<<<<<<<<<<<<
4922 * cdef Py_ssize_t start_pct
4923 *
4924 */
4925 if (unlikely(__pyx_v_val == Py_None)) {
4926 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
4927 __PYX_ERR(0, 304, __pyx_L1_error)
4928 }
4929 __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_val); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 304, __pyx_L1_error)
4930 __pyx_v_length = __pyx_t_1;
4931
4932 /* "yarl/_quoting_c.pyx":307
4933 * cdef Py_ssize_t start_pct
4934 *
4935 * while idx < length: # <<<<<<<<<<<<<<
4936 * ch = val[idx]
4937 * idx += 1
4938 */
4939 while (1) {
4940 __pyx_t_2 = ((__pyx_v_idx < __pyx_v_length) != 0);
4941 if (!__pyx_t_2) break;
4942
4943 /* "yarl/_quoting_c.pyx":308
4944 *
4945 * while idx < length:
4946 * ch = val[idx] # <<<<<<<<<<<<<<
4947 * idx += 1
4948 * if ch == '%' and idx <= length - 2:
4949 */
4950 __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_v_idx, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 308, __pyx_L1_error)
4951 __pyx_v_ch = __pyx_t_4;
4952
4953 /* "yarl/_quoting_c.pyx":309
4954 * while idx < length:
4955 * ch = val[idx]
4956 * idx += 1 # <<<<<<<<<<<<<<
4957 * if ch == '%' and idx <= length - 2:
4958 * ch = _restore_ch(val[idx], val[idx + 1])
4959 */
4960 __pyx_v_idx = (__pyx_v_idx + 1);
4961
4962 /* "yarl/_quoting_c.pyx":310
4963 * ch = val[idx]
4964 * idx += 1
4965 * if ch == '%' and idx <= length - 2: # <<<<<<<<<<<<<<
4966 * ch = _restore_ch(val[idx], val[idx + 1])
4967 * if ch != <Py_UCS4>-1:
4968 */
4969 __pyx_t_5 = ((__pyx_v_ch == 37) != 0);
4970 if (__pyx_t_5) {
4971 } else {
4972 __pyx_t_2 = __pyx_t_5;
4973 goto __pyx_L7_bool_binop_done;
4974 }
4975 __pyx_t_5 = ((__pyx_v_idx <= (__pyx_v_length - 2)) != 0);
4976 __pyx_t_2 = __pyx_t_5;
4977 __pyx_L7_bool_binop_done:;
4978 if (__pyx_t_2) {
4979
4980 /* "yarl/_quoting_c.pyx":311
4981 * idx += 1
4982 * if ch == '%' and idx <= length - 2:
4983 * ch = _restore_ch(val[idx], val[idx + 1]) # <<<<<<<<<<<<<<
4984 * if ch != <Py_UCS4>-1:
4985 * idx += 2
4986 */
4987 __pyx_t_4 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_v_idx, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_4 == (Py_UCS4)-1)) __PYX_ERR(0, 311, __pyx_L1_error)
4988 __pyx_t_1 = (__pyx_v_idx + 1);
4989 __pyx_t_6 = __Pyx_GetItemInt_Unicode(__pyx_v_val, __pyx_t_1, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_6 == (Py_UCS4)-1)) __PYX_ERR(0, 311, __pyx_L1_error)
4990 __pyx_v_ch = __pyx_f_4yarl_10_quoting_c__restore_ch(__pyx_t_4, __pyx_t_6);
4991
4992 /* "yarl/_quoting_c.pyx":312
4993 * if ch == '%' and idx <= length - 2:
4994 * ch = _restore_ch(val[idx], val[idx + 1])
4995 * if ch != <Py_UCS4>-1: # <<<<<<<<<<<<<<
4996 * idx += 2
4997 * assert buflen < 4
4998 */
4999 __pyx_t_2 = ((__pyx_v_ch != ((Py_UCS4)-1L)) != 0);
5000 if (__pyx_t_2) {
5001
5002 /* "yarl/_quoting_c.pyx":313
5003 * ch = _restore_ch(val[idx], val[idx + 1])
5004 * if ch != <Py_UCS4>-1:
5005 * idx += 2 # <<<<<<<<<<<<<<
5006 * assert buflen < 4
5007 * buffer[buflen] = ch
5008 */
5009 __pyx_v_idx = (__pyx_v_idx + 2);
5010
5011 /* "yarl/_quoting_c.pyx":314
5012 * if ch != <Py_UCS4>-1:
5013 * idx += 2
5014 * assert buflen < 4 # <<<<<<<<<<<<<<
5015 * buffer[buflen] = ch
5016 * buflen += 1
5017 */
5018 #ifndef CYTHON_WITHOUT_ASSERTIONS
5019 if (unlikely(!Py_OptimizeFlag)) {
5020 if (unlikely(!((__pyx_v_buflen < 4) != 0))) {
5021 PyErr_SetNone(PyExc_AssertionError);
5022 __PYX_ERR(0, 314, __pyx_L1_error)
5023 }
5024 }
5025 #endif
5026
5027 /* "yarl/_quoting_c.pyx":315
5028 * idx += 2
5029 * assert buflen < 4
5030 * buffer[buflen] = ch # <<<<<<<<<<<<<<
5031 * buflen += 1
5032 * try:
5033 */
5034 (__pyx_v_buffer[__pyx_v_buflen]) = __pyx_v_ch;
5035
5036 /* "yarl/_quoting_c.pyx":316
5037 * assert buflen < 4
5038 * buffer[buflen] = ch
5039 * buflen += 1 # <<<<<<<<<<<<<<
5040 * try:
5041 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5042 */
5043 __pyx_v_buflen = (__pyx_v_buflen + 1);
5044
5045 /* "yarl/_quoting_c.pyx":317
5046 * buffer[buflen] = ch
5047 * buflen += 1
5048 * try: # <<<<<<<<<<<<<<
5049 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5050 * NULL, &consumed)
5051 */
5052 {
5053 __Pyx_PyThreadState_declare
5054 __Pyx_PyThreadState_assign
5055 __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
5056 __Pyx_XGOTREF(__pyx_t_7);
5057 __Pyx_XGOTREF(__pyx_t_8);
5058 __Pyx_XGOTREF(__pyx_t_9);
5059 /*try:*/ {
5060
5061 /* "yarl/_quoting_c.pyx":318
5062 * buflen += 1
5063 * try:
5064 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen, # <<<<<<<<<<<<<<
5065 * NULL, &consumed)
5066 * except UnicodeDecodeError:
5067 */
5068 __pyx_t_3 = PyUnicode_DecodeUTF8Stateful(__pyx_v_buffer, __pyx_v_buflen, NULL, (&__pyx_v_consumed)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L10_error)
5069 __Pyx_GOTREF(__pyx_t_3);
5070 __Pyx_XDECREF_SET(__pyx_v_unquoted, ((PyObject*)__pyx_t_3));
5071 __pyx_t_3 = 0;
5072
5073 /* "yarl/_quoting_c.pyx":317
5074 * buffer[buflen] = ch
5075 * buflen += 1
5076 * try: # <<<<<<<<<<<<<<
5077 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5078 * NULL, &consumed)
5079 */
5080 }
5081 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5082 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5083 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5084 goto __pyx_L17_try_end;
5085 __pyx_L10_error:;
5086 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5087
5088 /* "yarl/_quoting_c.pyx":320
5089 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5090 * NULL, &consumed)
5091 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
5092 * start_pct = idx - buflen * 3
5093 * buffer[0] = ch
5094 */
5095 __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
5096 if (__pyx_t_10) {
5097 __Pyx_AddTraceback("yarl._quoting_c._Unquoter._do_unquote", __pyx_clineno, __pyx_lineno, __pyx_filename);
5098 if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_12) < 0) __PYX_ERR(0, 320, __pyx_L12_except_error)
5099 __Pyx_GOTREF(__pyx_t_3);
5100 __Pyx_GOTREF(__pyx_t_11);
5101 __Pyx_GOTREF(__pyx_t_12);
5102
5103 /* "yarl/_quoting_c.pyx":321
5104 * NULL, &consumed)
5105 * except UnicodeDecodeError:
5106 * start_pct = idx - buflen * 3 # <<<<<<<<<<<<<<
5107 * buffer[0] = ch
5108 * buflen = 1
5109 */
5110 __pyx_v_start_pct = (__pyx_v_idx - (__pyx_v_buflen * 3));
5111
5112 /* "yarl/_quoting_c.pyx":322
5113 * except UnicodeDecodeError:
5114 * start_pct = idx - buflen * 3
5115 * buffer[0] = ch # <<<<<<<<<<<<<<
5116 * buflen = 1
5117 * ret.append(val[start_pct : idx - 3])
5118 */
5119 (__pyx_v_buffer[0]) = __pyx_v_ch;
5120
5121 /* "yarl/_quoting_c.pyx":323
5122 * start_pct = idx - buflen * 3
5123 * buffer[0] = ch
5124 * buflen = 1 # <<<<<<<<<<<<<<
5125 * ret.append(val[start_pct : idx - 3])
5126 * try:
5127 */
5128 __pyx_v_buflen = 1;
5129
5130 /* "yarl/_quoting_c.pyx":324
5131 * buffer[0] = ch
5132 * buflen = 1
5133 * ret.append(val[start_pct : idx - 3]) # <<<<<<<<<<<<<<
5134 * try:
5135 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5136 */
5137 if (unlikely(__pyx_v_val == Py_None)) {
5138 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5139 __PYX_ERR(0, 324, __pyx_L12_except_error)
5140 }
5141 __pyx_t_13 = __Pyx_PyUnicode_Substring(__pyx_v_val, __pyx_v_start_pct, (__pyx_v_idx - 3)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 324, __pyx_L12_except_error)
5142 __Pyx_GOTREF(__pyx_t_13);
5143 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_13); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 324, __pyx_L12_except_error)
5144 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5145
5146 /* "yarl/_quoting_c.pyx":325
5147 * buflen = 1
5148 * ret.append(val[start_pct : idx - 3])
5149 * try: # <<<<<<<<<<<<<<
5150 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5151 * NULL, &consumed)
5152 */
5153 {
5154 __Pyx_PyThreadState_declare
5155 __Pyx_PyThreadState_assign
5156 __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
5157 __Pyx_XGOTREF(__pyx_t_15);
5158 __Pyx_XGOTREF(__pyx_t_16);
5159 __Pyx_XGOTREF(__pyx_t_17);
5160 /*try:*/ {
5161
5162 /* "yarl/_quoting_c.pyx":326
5163 * ret.append(val[start_pct : idx - 3])
5164 * try:
5165 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen, # <<<<<<<<<<<<<<
5166 * NULL, &consumed)
5167 * except UnicodeDecodeError:
5168 */
5169 __pyx_t_13 = PyUnicode_DecodeUTF8Stateful(__pyx_v_buffer, __pyx_v_buflen, NULL, (&__pyx_v_consumed)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 326, __pyx_L20_error)
5170 __Pyx_GOTREF(__pyx_t_13);
5171 __Pyx_XDECREF_SET(__pyx_v_unquoted, ((PyObject*)__pyx_t_13));
5172 __pyx_t_13 = 0;
5173
5174 /* "yarl/_quoting_c.pyx":325
5175 * buflen = 1
5176 * ret.append(val[start_pct : idx - 3])
5177 * try: # <<<<<<<<<<<<<<
5178 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5179 * NULL, &consumed)
5180 */
5181 }
5182 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
5183 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
5184 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
5185 goto __pyx_L27_try_end;
5186 __pyx_L20_error:;
5187 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
5188
5189 /* "yarl/_quoting_c.pyx":328
5190 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5191 * NULL, &consumed)
5192 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
5193 * buflen = 0
5194 * ret.append(val[idx - 3 : idx])
5195 */
5196 __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
5197 if (__pyx_t_10) {
5198 __Pyx_AddTraceback("yarl._quoting_c._Unquoter._do_unquote", __pyx_clineno, __pyx_lineno, __pyx_filename);
5199 if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_18, &__pyx_t_19) < 0) __PYX_ERR(0, 328, __pyx_L22_except_error)
5200 __Pyx_GOTREF(__pyx_t_13);
5201 __Pyx_GOTREF(__pyx_t_18);
5202 __Pyx_GOTREF(__pyx_t_19);
5203
5204 /* "yarl/_quoting_c.pyx":329
5205 * NULL, &consumed)
5206 * except UnicodeDecodeError:
5207 * buflen = 0 # <<<<<<<<<<<<<<
5208 * ret.append(val[idx - 3 : idx])
5209 * continue
5210 */
5211 __pyx_v_buflen = 0;
5212
5213 /* "yarl/_quoting_c.pyx":330
5214 * except UnicodeDecodeError:
5215 * buflen = 0
5216 * ret.append(val[idx - 3 : idx]) # <<<<<<<<<<<<<<
5217 * continue
5218 * if not unquoted:
5219 */
5220 if (unlikely(__pyx_v_val == Py_None)) {
5221 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5222 __PYX_ERR(0, 330, __pyx_L22_except_error)
5223 }
5224 __pyx_t_20 = __Pyx_PyUnicode_Substring(__pyx_v_val, (__pyx_v_idx - 3), __pyx_v_idx); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 330, __pyx_L22_except_error)
5225 __Pyx_GOTREF(__pyx_t_20);
5226 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_20); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 330, __pyx_L22_except_error)
5227 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5228
5229 /* "yarl/_quoting_c.pyx":331
5230 * buflen = 0
5231 * ret.append(val[idx - 3 : idx])
5232 * continue # <<<<<<<<<<<<<<
5233 * if not unquoted:
5234 * assert consumed == 0
5235 */
5236 goto __pyx_L29_except_continue;
5237 __pyx_L29_except_continue:;
5238 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5239 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5240 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5241 goto __pyx_L26_try_continue;
5242 }
5243 goto __pyx_L22_except_error;
5244 __pyx_L22_except_error:;
5245
5246 /* "yarl/_quoting_c.pyx":325
5247 * buflen = 1
5248 * ret.append(val[start_pct : idx - 3])
5249 * try: # <<<<<<<<<<<<<<
5250 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5251 * NULL, &consumed)
5252 */
5253 __Pyx_XGIVEREF(__pyx_t_15);
5254 __Pyx_XGIVEREF(__pyx_t_16);
5255 __Pyx_XGIVEREF(__pyx_t_17);
5256 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
5257 goto __pyx_L12_except_error;
5258 __pyx_L26_try_continue:;
5259 __Pyx_XGIVEREF(__pyx_t_15);
5260 __Pyx_XGIVEREF(__pyx_t_16);
5261 __Pyx_XGIVEREF(__pyx_t_17);
5262 __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
5263 goto __pyx_L19_except_continue;
5264 __pyx_L27_try_end:;
5265 }
5266 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5267 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
5268 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
5269 goto __pyx_L11_exception_handled;
5270 __pyx_L19_except_continue:;
5271 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5272 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5273 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5274 goto __pyx_L16_try_continue;
5275 }
5276 goto __pyx_L12_except_error;
5277 __pyx_L12_except_error:;
5278
5279 /* "yarl/_quoting_c.pyx":317
5280 * buffer[buflen] = ch
5281 * buflen += 1
5282 * try: # <<<<<<<<<<<<<<
5283 * unquoted = PyUnicode_DecodeUTF8Stateful(buffer, buflen,
5284 * NULL, &consumed)
5285 */
5286 __Pyx_XGIVEREF(__pyx_t_7);
5287 __Pyx_XGIVEREF(__pyx_t_8);
5288 __Pyx_XGIVEREF(__pyx_t_9);
5289 __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
5290 goto __pyx_L1_error;
5291 __pyx_L16_try_continue:;
5292 __Pyx_XGIVEREF(__pyx_t_7);
5293 __Pyx_XGIVEREF(__pyx_t_8);
5294 __Pyx_XGIVEREF(__pyx_t_9);
5295 __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
5296 goto __pyx_L4_continue;
5297 __pyx_L11_exception_handled:;
5298 __Pyx_XGIVEREF(__pyx_t_7);
5299 __Pyx_XGIVEREF(__pyx_t_8);
5300 __Pyx_XGIVEREF(__pyx_t_9);
5301 __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
5302 __pyx_L17_try_end:;
5303 }
5304
5305 /* "yarl/_quoting_c.pyx":332
5306 * ret.append(val[idx - 3 : idx])
5307 * continue
5308 * if not unquoted: # <<<<<<<<<<<<<<
5309 * assert consumed == 0
5310 * continue
5311 */
5312 __pyx_t_2 = (__pyx_v_unquoted != Py_None)&&(__Pyx_PyUnicode_IS_TRUE(__pyx_v_unquoted) != 0);
5313 __pyx_t_5 = ((!__pyx_t_2) != 0);
5314 if (__pyx_t_5) {
5315
5316 /* "yarl/_quoting_c.pyx":333
5317 * continue
5318 * if not unquoted:
5319 * assert consumed == 0 # <<<<<<<<<<<<<<
5320 * continue
5321 * assert consumed == buflen
5322 */
5323 #ifndef CYTHON_WITHOUT_ASSERTIONS
5324 if (unlikely(!Py_OptimizeFlag)) {
5325 if (unlikely(!((__pyx_v_consumed == 0) != 0))) {
5326 PyErr_SetNone(PyExc_AssertionError);
5327 __PYX_ERR(0, 333, __pyx_L1_error)
5328 }
5329 }
5330 #endif
5331
5332 /* "yarl/_quoting_c.pyx":334
5333 * if not unquoted:
5334 * assert consumed == 0
5335 * continue # <<<<<<<<<<<<<<
5336 * assert consumed == buflen
5337 * buflen = 0
5338 */
5339 goto __pyx_L4_continue;
5340
5341 /* "yarl/_quoting_c.pyx":332
5342 * ret.append(val[idx - 3 : idx])
5343 * continue
5344 * if not unquoted: # <<<<<<<<<<<<<<
5345 * assert consumed == 0
5346 * continue
5347 */
5348 }
5349
5350 /* "yarl/_quoting_c.pyx":335
5351 * assert consumed == 0
5352 * continue
5353 * assert consumed == buflen # <<<<<<<<<<<<<<
5354 * buflen = 0
5355 * if self._qs and unquoted in '+=&;':
5356 */
5357 #ifndef CYTHON_WITHOUT_ASSERTIONS
5358 if (unlikely(!Py_OptimizeFlag)) {
5359 if (unlikely(!((__pyx_v_consumed == __pyx_v_buflen) != 0))) {
5360 PyErr_SetNone(PyExc_AssertionError);
5361 __PYX_ERR(0, 335, __pyx_L1_error)
5362 }
5363 }
5364 #endif
5365
5366 /* "yarl/_quoting_c.pyx":336
5367 * continue
5368 * assert consumed == buflen
5369 * buflen = 0 # <<<<<<<<<<<<<<
5370 * if self._qs and unquoted in '+=&;':
5371 * ret.append(self._qs_quoter(unquoted))
5372 */
5373 __pyx_v_buflen = 0;
5374
5375 /* "yarl/_quoting_c.pyx":337
5376 * assert consumed == buflen
5377 * buflen = 0
5378 * if self._qs and unquoted in '+=&;': # <<<<<<<<<<<<<<
5379 * ret.append(self._qs_quoter(unquoted))
5380 * elif unquoted in self._unsafe:
5381 */
5382 __pyx_t_2 = (__pyx_v_self->_qs != 0);
5383 if (__pyx_t_2) {
5384 } else {
5385 __pyx_t_5 = __pyx_t_2;
5386 goto __pyx_L32_bool_binop_done;
5387 }
5388 __pyx_t_2 = (__Pyx_PyUnicode_ContainsTF(__pyx_v_unquoted, __pyx_kp_u__4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 337, __pyx_L1_error)
5389 __pyx_t_21 = (__pyx_t_2 != 0);
5390 __pyx_t_5 = __pyx_t_21;
5391 __pyx_L32_bool_binop_done:;
5392 if (__pyx_t_5) {
5393
5394 /* "yarl/_quoting_c.pyx":338
5395 * buflen = 0
5396 * if self._qs and unquoted in '+=&;':
5397 * ret.append(self._qs_quoter(unquoted)) # <<<<<<<<<<<<<<
5398 * elif unquoted in self._unsafe:
5399 * ret.append(self._quoter(unquoted))
5400 */
5401 __Pyx_INCREF(((PyObject *)__pyx_v_self->_qs_quoter));
5402 __pyx_t_11 = ((PyObject *)__pyx_v_self->_qs_quoter); __pyx_t_3 = NULL;
5403 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
5404 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
5405 if (likely(__pyx_t_3)) {
5406 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
5407 __Pyx_INCREF(__pyx_t_3);
5408 __Pyx_INCREF(function);
5409 __Pyx_DECREF_SET(__pyx_t_11, function);
5410 }
5411 }
5412 __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_3, __pyx_v_unquoted) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_unquoted);
5413 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5414 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L1_error)
5415 __Pyx_GOTREF(__pyx_t_12);
5416 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5417 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 338, __pyx_L1_error)
5418 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5419
5420 /* "yarl/_quoting_c.pyx":337
5421 * assert consumed == buflen
5422 * buflen = 0
5423 * if self._qs and unquoted in '+=&;': # <<<<<<<<<<<<<<
5424 * ret.append(self._qs_quoter(unquoted))
5425 * elif unquoted in self._unsafe:
5426 */
5427 goto __pyx_L31;
5428 }
5429
5430 /* "yarl/_quoting_c.pyx":339
5431 * if self._qs and unquoted in '+=&;':
5432 * ret.append(self._qs_quoter(unquoted))
5433 * elif unquoted in self._unsafe: # <<<<<<<<<<<<<<
5434 * ret.append(self._quoter(unquoted))
5435 * else:
5436 */
5437 if (unlikely(__pyx_v_self->_unsafe == Py_None)) {
5438 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
5439 __PYX_ERR(0, 339, __pyx_L1_error)
5440 }
5441 __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_v_unquoted, __pyx_v_self->_unsafe, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 339, __pyx_L1_error)
5442 __pyx_t_21 = (__pyx_t_5 != 0);
5443 if (__pyx_t_21) {
5444
5445 /* "yarl/_quoting_c.pyx":340
5446 * ret.append(self._qs_quoter(unquoted))
5447 * elif unquoted in self._unsafe:
5448 * ret.append(self._quoter(unquoted)) # <<<<<<<<<<<<<<
5449 * else:
5450 * ret.append(unquoted)
5451 */
5452 __Pyx_INCREF(((PyObject *)__pyx_v_self->_quoter));
5453 __pyx_t_11 = ((PyObject *)__pyx_v_self->_quoter); __pyx_t_3 = NULL;
5454 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
5455 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
5456 if (likely(__pyx_t_3)) {
5457 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
5458 __Pyx_INCREF(__pyx_t_3);
5459 __Pyx_INCREF(function);
5460 __Pyx_DECREF_SET(__pyx_t_11, function);
5461 }
5462 }
5463 __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_3, __pyx_v_unquoted) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_unquoted);
5464 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5465 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 340, __pyx_L1_error)
5466 __Pyx_GOTREF(__pyx_t_12);
5467 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5468 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 340, __pyx_L1_error)
5469 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5470
5471 /* "yarl/_quoting_c.pyx":339
5472 * if self._qs and unquoted in '+=&;':
5473 * ret.append(self._qs_quoter(unquoted))
5474 * elif unquoted in self._unsafe: # <<<<<<<<<<<<<<
5475 * ret.append(self._quoter(unquoted))
5476 * else:
5477 */
5478 goto __pyx_L31;
5479 }
5480
5481 /* "yarl/_quoting_c.pyx":342
5482 * ret.append(self._quoter(unquoted))
5483 * else:
5484 * ret.append(unquoted) # <<<<<<<<<<<<<<
5485 * continue
5486 * else:
5487 */
5488 /*else*/ {
5489 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_unquoted); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 342, __pyx_L1_error)
5490 }
5491 __pyx_L31:;
5492
5493 /* "yarl/_quoting_c.pyx":343
5494 * else:
5495 * ret.append(unquoted)
5496 * continue # <<<<<<<<<<<<<<
5497 * else:
5498 * ch = '%'
5499 */
5500 goto __pyx_L4_continue;
5501
5502 /* "yarl/_quoting_c.pyx":312
5503 * if ch == '%' and idx <= length - 2:
5504 * ch = _restore_ch(val[idx], val[idx + 1])
5505 * if ch != <Py_UCS4>-1: # <<<<<<<<<<<<<<
5506 * idx += 2
5507 * assert buflen < 4
5508 */
5509 }
5510
5511 /* "yarl/_quoting_c.pyx":345
5512 * continue
5513 * else:
5514 * ch = '%' # <<<<<<<<<<<<<<
5515 *
5516 * if buflen:
5517 */
5518 /*else*/ {
5519 __pyx_v_ch = 37;
5520 }
5521
5522 /* "yarl/_quoting_c.pyx":310
5523 * ch = val[idx]
5524 * idx += 1
5525 * if ch == '%' and idx <= length - 2: # <<<<<<<<<<<<<<
5526 * ch = _restore_ch(val[idx], val[idx + 1])
5527 * if ch != <Py_UCS4>-1:
5528 */
5529 }
5530
5531 /* "yarl/_quoting_c.pyx":347
5532 * ch = '%'
5533 *
5534 * if buflen: # <<<<<<<<<<<<<<
5535 * start_pct = idx - 1 - buflen * 3
5536 * ret.append(val[start_pct : idx - 1])
5537 */
5538 __pyx_t_21 = (__pyx_v_buflen != 0);
5539 if (__pyx_t_21) {
5540
5541 /* "yarl/_quoting_c.pyx":348
5542 *
5543 * if buflen:
5544 * start_pct = idx - 1 - buflen * 3 # <<<<<<<<<<<<<<
5545 * ret.append(val[start_pct : idx - 1])
5546 * buflen = 0
5547 */
5548 __pyx_v_start_pct = ((__pyx_v_idx - 1) - (__pyx_v_buflen * 3));
5549
5550 /* "yarl/_quoting_c.pyx":349
5551 * if buflen:
5552 * start_pct = idx - 1 - buflen * 3
5553 * ret.append(val[start_pct : idx - 1]) # <<<<<<<<<<<<<<
5554 * buflen = 0
5555 *
5556 */
5557 if (unlikely(__pyx_v_val == Py_None)) {
5558 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5559 __PYX_ERR(0, 349, __pyx_L1_error)
5560 }
5561 __pyx_t_12 = __Pyx_PyUnicode_Substring(__pyx_v_val, __pyx_v_start_pct, (__pyx_v_idx - 1)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 349, __pyx_L1_error)
5562 __Pyx_GOTREF(__pyx_t_12);
5563 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 349, __pyx_L1_error)
5564 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5565
5566 /* "yarl/_quoting_c.pyx":350
5567 * start_pct = idx - 1 - buflen * 3
5568 * ret.append(val[start_pct : idx - 1])
5569 * buflen = 0 # <<<<<<<<<<<<<<
5570 *
5571 * if ch == '+':
5572 */
5573 __pyx_v_buflen = 0;
5574
5575 /* "yarl/_quoting_c.pyx":347
5576 * ch = '%'
5577 *
5578 * if buflen: # <<<<<<<<<<<<<<
5579 * start_pct = idx - 1 - buflen * 3
5580 * ret.append(val[start_pct : idx - 1])
5581 */
5582 }
5583
5584 /* "yarl/_quoting_c.pyx":352
5585 * buflen = 0
5586 *
5587 * if ch == '+': # <<<<<<<<<<<<<<
5588 * if not self._qs or ch in self._unsafe:
5589 * ret.append('+')
5590 */
5591 __pyx_t_21 = ((__pyx_v_ch == 43) != 0);
5592 if (__pyx_t_21) {
5593
5594 /* "yarl/_quoting_c.pyx":353
5595 *
5596 * if ch == '+':
5597 * if not self._qs or ch in self._unsafe: # <<<<<<<<<<<<<<
5598 * ret.append('+')
5599 * else:
5600 */
5601 __pyx_t_5 = ((!(__pyx_v_self->_qs != 0)) != 0);
5602 if (!__pyx_t_5) {
5603 } else {
5604 __pyx_t_21 = __pyx_t_5;
5605 goto __pyx_L37_bool_binop_done;
5606 }
5607 if (unlikely(__pyx_v_self->_unsafe == Py_None)) {
5608 PyErr_SetString(PyExc_TypeError, "argument of type 'NoneType' is not iterable");
5609 __PYX_ERR(0, 353, __pyx_L1_error)
5610 }
5611 __pyx_t_5 = ((__Pyx_UnicodeContainsUCS4(__pyx_v_self->_unsafe, __pyx_v_ch)) != 0);
5612 __pyx_t_21 = __pyx_t_5;
5613 __pyx_L37_bool_binop_done:;
5614 if (__pyx_t_21) {
5615
5616 /* "yarl/_quoting_c.pyx":354
5617 * if ch == '+':
5618 * if not self._qs or ch in self._unsafe:
5619 * ret.append('+') # <<<<<<<<<<<<<<
5620 * else:
5621 * ret.append(' ')
5622 */
5623 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_kp_u__5); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 354, __pyx_L1_error)
5624
5625 /* "yarl/_quoting_c.pyx":353
5626 *
5627 * if ch == '+':
5628 * if not self._qs or ch in self._unsafe: # <<<<<<<<<<<<<<
5629 * ret.append('+')
5630 * else:
5631 */
5632 goto __pyx_L36;
5633 }
5634
5635 /* "yarl/_quoting_c.pyx":356
5636 * ret.append('+')
5637 * else:
5638 * ret.append(' ') # <<<<<<<<<<<<<<
5639 * continue
5640 *
5641 */
5642 /*else*/ {
5643 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_kp_u__6); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 356, __pyx_L1_error)
5644 }
5645 __pyx_L36:;
5646
5647 /* "yarl/_quoting_c.pyx":357
5648 * else:
5649 * ret.append(' ')
5650 * continue # <<<<<<<<<<<<<<
5651 *
5652 * if ch in self._unsafe:
5653 */
5654 goto __pyx_L4_continue;
5655
5656 /* "yarl/_quoting_c.pyx":352
5657 * buflen = 0
5658 *
5659 * if ch == '+': # <<<<<<<<<<<<<<
5660 * if not self._qs or ch in self._unsafe:
5661 * ret.append('+')
5662 */
5663 }
5664
5665 /* "yarl/_quoting_c.pyx":359
5666 * continue
5667 *
5668 * if ch in self._unsafe: # <<<<<<<<<<<<<<
5669 * ret.append('%')
5670 * h = hex(ord(ch)).upper()[2:]
5671 */
5672 if (unlikely(__pyx_v_self->_unsafe == Py_None)) {
5673 PyErr_SetString(PyExc_TypeError, "argument of type 'NoneType' is not iterable");
5674 __PYX_ERR(0, 359, __pyx_L1_error)
5675 }
5676 __pyx_t_21 = ((__Pyx_UnicodeContainsUCS4(__pyx_v_self->_unsafe, __pyx_v_ch)) != 0);
5677 if (__pyx_t_21) {
5678
5679 /* "yarl/_quoting_c.pyx":360
5680 *
5681 * if ch in self._unsafe:
5682 * ret.append('%') # <<<<<<<<<<<<<<
5683 * h = hex(ord(ch)).upper()[2:]
5684 * for ch in h:
5685 */
5686 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_kp_u__7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 360, __pyx_L1_error)
5687
5688 /* "yarl/_quoting_c.pyx":361
5689 * if ch in self._unsafe:
5690 * ret.append('%')
5691 * h = hex(ord(ch)).upper()[2:] # <<<<<<<<<<<<<<
5692 * for ch in h:
5693 * ret.append(ch)
5694 */
5695 __pyx_t_11 = __Pyx_PyInt_From_long(((long)__pyx_v_ch)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
5696 __Pyx_GOTREF(__pyx_t_11);
5697 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
5698 __Pyx_GOTREF(__pyx_t_3);
5699 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5700 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_upper); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
5701 __Pyx_GOTREF(__pyx_t_11);
5702 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5703 __pyx_t_3 = NULL;
5704 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
5705 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
5706 if (likely(__pyx_t_3)) {
5707 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
5708 __Pyx_INCREF(__pyx_t_3);
5709 __Pyx_INCREF(function);
5710 __Pyx_DECREF_SET(__pyx_t_11, function);
5711 }
5712 }
5713 __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
5714 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5715 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 361, __pyx_L1_error)
5716 __Pyx_GOTREF(__pyx_t_12);
5717 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5718 __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_t_12, 2, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
5719 __Pyx_GOTREF(__pyx_t_11);
5720 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5721 __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_11);
5722 __pyx_t_11 = 0;
5723
5724 /* "yarl/_quoting_c.pyx":362
5725 * ret.append('%')
5726 * h = hex(ord(ch)).upper()[2:]
5727 * for ch in h: # <<<<<<<<<<<<<<
5728 * ret.append(ch)
5729 * continue
5730 */
5731 if (likely(PyList_CheckExact(__pyx_v_h)) || PyTuple_CheckExact(__pyx_v_h)) {
5732 __pyx_t_11 = __pyx_v_h; __Pyx_INCREF(__pyx_t_11); __pyx_t_1 = 0;
5733 __pyx_t_22 = NULL;
5734 } else {
5735 __pyx_t_1 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_h); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 362, __pyx_L1_error)
5736 __Pyx_GOTREF(__pyx_t_11);
5737 __pyx_t_22 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 362, __pyx_L1_error)
5738 }
5739 for (;;) {
5740 if (likely(!__pyx_t_22)) {
5741 if (likely(PyList_CheckExact(__pyx_t_11))) {
5742 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_11)) break;
5743 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5744 __pyx_t_12 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_1); __Pyx_INCREF(__pyx_t_12); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
5745 #else
5746 __pyx_t_12 = PySequence_ITEM(__pyx_t_11, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 362, __pyx_L1_error)
5747 __Pyx_GOTREF(__pyx_t_12);
5748 #endif
5749 } else {
5750 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
5751 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5752 __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_1); __Pyx_INCREF(__pyx_t_12); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
5753 #else
5754 __pyx_t_12 = PySequence_ITEM(__pyx_t_11, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 362, __pyx_L1_error)
5755 __Pyx_GOTREF(__pyx_t_12);
5756 #endif
5757 }
5758 } else {
5759 __pyx_t_12 = __pyx_t_22(__pyx_t_11);
5760 if (unlikely(!__pyx_t_12)) {
5761 PyObject* exc_type = PyErr_Occurred();
5762 if (exc_type) {
5763 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5764 else __PYX_ERR(0, 362, __pyx_L1_error)
5765 }
5766 break;
5767 }
5768 __Pyx_GOTREF(__pyx_t_12);
5769 }
5770 __pyx_t_6 = __Pyx_PyObject_AsPy_UCS4(__pyx_t_12); if (unlikely((__pyx_t_6 == (Py_UCS4)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error)
5771 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5772 __pyx_v_ch = __pyx_t_6;
5773
5774 /* "yarl/_quoting_c.pyx":363
5775 * h = hex(ord(ch)).upper()[2:]
5776 * for ch in h:
5777 * ret.append(ch) # <<<<<<<<<<<<<<
5778 * continue
5779 *
5780 */
5781 __pyx_t_12 = PyUnicode_FromOrdinal(__pyx_v_ch); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 363, __pyx_L1_error)
5782 __Pyx_GOTREF(__pyx_t_12);
5783 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_12); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 363, __pyx_L1_error)
5784 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5785
5786 /* "yarl/_quoting_c.pyx":362
5787 * ret.append('%')
5788 * h = hex(ord(ch)).upper()[2:]
5789 * for ch in h: # <<<<<<<<<<<<<<
5790 * ret.append(ch)
5791 * continue
5792 */
5793 }
5794 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5795
5796 /* "yarl/_quoting_c.pyx":364
5797 * for ch in h:
5798 * ret.append(ch)
5799 * continue # <<<<<<<<<<<<<<
5800 *
5801 * ret.append(ch)
5802 */
5803 goto __pyx_L4_continue;
5804
5805 /* "yarl/_quoting_c.pyx":359
5806 * continue
5807 *
5808 * if ch in self._unsafe: # <<<<<<<<<<<<<<
5809 * ret.append('%')
5810 * h = hex(ord(ch)).upper()[2:]
5811 */
5812 }
5813
5814 /* "yarl/_quoting_c.pyx":366
5815 * continue
5816 *
5817 * ret.append(ch) # <<<<<<<<<<<<<<
5818 *
5819 * if buflen:
5820 */
5821 __pyx_t_11 = PyUnicode_FromOrdinal(__pyx_v_ch); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 366, __pyx_L1_error)
5822 __Pyx_GOTREF(__pyx_t_11);
5823 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_11); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 366, __pyx_L1_error)
5824 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5825 __pyx_L4_continue:;
5826 }
5827
5828 /* "yarl/_quoting_c.pyx":368
5829 * ret.append(ch)
5830 *
5831 * if buflen: # <<<<<<<<<<<<<<
5832 * ret.append(val[length - buflen * 3 : length])
5833 *
5834 */
5835 __pyx_t_21 = (__pyx_v_buflen != 0);
5836 if (__pyx_t_21) {
5837
5838 /* "yarl/_quoting_c.pyx":369
5839 *
5840 * if buflen:
5841 * ret.append(val[length - buflen * 3 : length]) # <<<<<<<<<<<<<<
5842 *
5843 * return ''.join(ret)
5844 */
5845 if (unlikely(__pyx_v_val == Py_None)) {
5846 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5847 __PYX_ERR(0, 369, __pyx_L1_error)
5848 }
5849 __pyx_t_11 = __Pyx_PyUnicode_Substring(__pyx_v_val, (__pyx_v_length - (__pyx_v_buflen * 3)), __pyx_v_length); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 369, __pyx_L1_error)
5850 __Pyx_GOTREF(__pyx_t_11);
5851 __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_11); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 369, __pyx_L1_error)
5852 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5853
5854 /* "yarl/_quoting_c.pyx":368
5855 * ret.append(ch)
5856 *
5857 * if buflen: # <<<<<<<<<<<<<<
5858 * ret.append(val[length - buflen * 3 : length])
5859 *
5860 */
5861 }
5862
5863 /* "yarl/_quoting_c.pyx":371
5864 * ret.append(val[length - buflen * 3 : length])
5865 *
5866 * return ''.join(ret) # <<<<<<<<<<<<<<
5867 */
5868 __Pyx_XDECREF(__pyx_r);
5869 __pyx_t_11 = PyUnicode_Join(__pyx_kp_u_, __pyx_v_ret); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 371, __pyx_L1_error)
5870 __Pyx_GOTREF(__pyx_t_11);
5871 __pyx_r = ((PyObject*)__pyx_t_11);
5872 __pyx_t_11 = 0;
5873 goto __pyx_L0;
5874
5875 /* "yarl/_quoting_c.pyx":294
5876 * return self._do_unquote(<str>val)
5877 *
5878 * cdef str _do_unquote(self, str val): # <<<<<<<<<<<<<<
5879 * if len(val) == 0:
5880 * return val
5881 */
5882
5883 /* function exit code */
5884 __pyx_L1_error:;
5885 __Pyx_XDECREF(__pyx_t_3);
5886 __Pyx_XDECREF(__pyx_t_11);
5887 __Pyx_XDECREF(__pyx_t_12);
5888 __Pyx_XDECREF(__pyx_t_13);
5889 __Pyx_XDECREF(__pyx_t_18);
5890 __Pyx_XDECREF(__pyx_t_19);
5891 __Pyx_XDECREF(__pyx_t_20);
5892 __Pyx_AddTraceback("yarl._quoting_c._Unquoter._do_unquote", __pyx_clineno, __pyx_lineno, __pyx_filename);
5893 __pyx_r = 0;
5894 __pyx_L0:;
5895 __Pyx_XDECREF(__pyx_v_ret);
5896 __Pyx_XDECREF(__pyx_v_unquoted);
5897 __Pyx_XDECREF(__pyx_v_h);
5898 __Pyx_XGIVEREF(__pyx_r);
5899 __Pyx_RefNannyFinishContext();
5900 return __pyx_r;
5901 }
5902
5903 /* "(tree fragment)":1
5904 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5905 * cdef tuple state
5906 * cdef object _dict
5907 */
5908
5909 /* Python wrapper */
5910 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4yarl_10_quoting_c_9_Unquoter_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5911 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5912 PyObject *__pyx_r = 0;
5913 __Pyx_RefNannyDeclarations
5914 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5915 __pyx_r = __pyx_pf_4yarl_10_quoting_c_9_Unquoter_4__reduce_cython__(((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)__pyx_v_self));
5916
5917 /* function exit code */
5918 __Pyx_RefNannyFinishContext();
5919 return __pyx_r;
5920 }
5921
__pyx_pf_4yarl_10_quoting_c_9_Unquoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v_self)5922 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_4__reduce_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self) {
5923 PyObject *__pyx_v_state = 0;
5924 PyObject *__pyx_v__dict = 0;
5925 int __pyx_v_use_setstate;
5926 PyObject *__pyx_r = NULL;
5927 __Pyx_RefNannyDeclarations
5928 PyObject *__pyx_t_1 = NULL;
5929 PyObject *__pyx_t_2 = NULL;
5930 int __pyx_t_3;
5931 int __pyx_t_4;
5932 int __pyx_t_5;
5933 PyObject *__pyx_t_6 = NULL;
5934 int __pyx_lineno = 0;
5935 const char *__pyx_filename = NULL;
5936 int __pyx_clineno = 0;
5937 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5938
5939 /* "(tree fragment)":5
5940 * cdef object _dict
5941 * cdef bint use_setstate
5942 * state = (self._qs, self._qs_quoter, self._quoter, self._unsafe) # <<<<<<<<<<<<<<
5943 * _dict = getattr(self, '__dict__', None)
5944 * if _dict is not None:
5945 */
5946 __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_qs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
5947 __Pyx_GOTREF(__pyx_t_1);
5948 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5949 __Pyx_GOTREF(__pyx_t_2);
5950 __Pyx_GIVEREF(__pyx_t_1);
5951 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5952 __Pyx_INCREF(((PyObject *)__pyx_v_self->_qs_quoter));
5953 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_qs_quoter));
5954 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_qs_quoter));
5955 __Pyx_INCREF(((PyObject *)__pyx_v_self->_quoter));
5956 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_quoter));
5957 PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->_quoter));
5958 __Pyx_INCREF(__pyx_v_self->_unsafe);
5959 __Pyx_GIVEREF(__pyx_v_self->_unsafe);
5960 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->_unsafe);
5961 __pyx_t_1 = 0;
5962 __pyx_v_state = ((PyObject*)__pyx_t_2);
5963 __pyx_t_2 = 0;
5964
5965 /* "(tree fragment)":6
5966 * cdef bint use_setstate
5967 * state = (self._qs, self._qs_quoter, self._quoter, self._unsafe)
5968 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
5969 * if _dict is not None:
5970 * state += (_dict,)
5971 */
5972 __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
5973 __Pyx_GOTREF(__pyx_t_2);
5974 __pyx_v__dict = __pyx_t_2;
5975 __pyx_t_2 = 0;
5976
5977 /* "(tree fragment)":7
5978 * state = (self._qs, self._qs_quoter, self._quoter, self._unsafe)
5979 * _dict = getattr(self, '__dict__', None)
5980 * if _dict is not None: # <<<<<<<<<<<<<<
5981 * state += (_dict,)
5982 * use_setstate = True
5983 */
5984 __pyx_t_3 = (__pyx_v__dict != Py_None);
5985 __pyx_t_4 = (__pyx_t_3 != 0);
5986 if (__pyx_t_4) {
5987
5988 /* "(tree fragment)":8
5989 * _dict = getattr(self, '__dict__', None)
5990 * if _dict is not None:
5991 * state += (_dict,) # <<<<<<<<<<<<<<
5992 * use_setstate = True
5993 * else:
5994 */
5995 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error)
5996 __Pyx_GOTREF(__pyx_t_2);
5997 __Pyx_INCREF(__pyx_v__dict);
5998 __Pyx_GIVEREF(__pyx_v__dict);
5999 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v__dict);
6000 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
6001 __Pyx_GOTREF(__pyx_t_1);
6002 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6003 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_1));
6004 __pyx_t_1 = 0;
6005
6006 /* "(tree fragment)":9
6007 * if _dict is not None:
6008 * state += (_dict,)
6009 * use_setstate = True # <<<<<<<<<<<<<<
6010 * else:
6011 * use_setstate = self._qs_quoter is not None or self._quoter is not None or self._unsafe is not None
6012 */
6013 __pyx_v_use_setstate = 1;
6014
6015 /* "(tree fragment)":7
6016 * state = (self._qs, self._qs_quoter, self._quoter, self._unsafe)
6017 * _dict = getattr(self, '__dict__', None)
6018 * if _dict is not None: # <<<<<<<<<<<<<<
6019 * state += (_dict,)
6020 * use_setstate = True
6021 */
6022 goto __pyx_L3;
6023 }
6024
6025 /* "(tree fragment)":11
6026 * use_setstate = True
6027 * else:
6028 * use_setstate = self._qs_quoter is not None or self._quoter is not None or self._unsafe is not None # <<<<<<<<<<<<<<
6029 * if use_setstate:
6030 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, None), state
6031 */
6032 /*else*/ {
6033 __pyx_t_3 = (((PyObject *)__pyx_v_self->_qs_quoter) != Py_None);
6034 __pyx_t_5 = (__pyx_t_3 != 0);
6035 if (!__pyx_t_5) {
6036 } else {
6037 __pyx_t_4 = __pyx_t_5;
6038 goto __pyx_L4_bool_binop_done;
6039 }
6040 __pyx_t_5 = (((PyObject *)__pyx_v_self->_quoter) != Py_None);
6041 __pyx_t_3 = (__pyx_t_5 != 0);
6042 if (!__pyx_t_3) {
6043 } else {
6044 __pyx_t_4 = __pyx_t_3;
6045 goto __pyx_L4_bool_binop_done;
6046 }
6047 __pyx_t_3 = (__pyx_v_self->_unsafe != ((PyObject*)Py_None));
6048 __pyx_t_5 = (__pyx_t_3 != 0);
6049 __pyx_t_4 = __pyx_t_5;
6050 __pyx_L4_bool_binop_done:;
6051 __pyx_v_use_setstate = __pyx_t_4;
6052 }
6053 __pyx_L3:;
6054
6055 /* "(tree fragment)":12
6056 * else:
6057 * use_setstate = self._qs_quoter is not None or self._quoter is not None or self._unsafe is not None
6058 * if use_setstate: # <<<<<<<<<<<<<<
6059 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, None), state
6060 * else:
6061 */
6062 __pyx_t_4 = (__pyx_v_use_setstate != 0);
6063 if (__pyx_t_4) {
6064
6065 /* "(tree fragment)":13
6066 * use_setstate = self._qs_quoter is not None or self._quoter is not None or self._unsafe is not None
6067 * if use_setstate:
6068 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, None), state # <<<<<<<<<<<<<<
6069 * else:
6070 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, state)
6071 */
6072 __Pyx_XDECREF(__pyx_r);
6073 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pyx_unpickle__Unquoter); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
6074 __Pyx_GOTREF(__pyx_t_1);
6075 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
6076 __Pyx_GOTREF(__pyx_t_2);
6077 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6078 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6079 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6080 __Pyx_INCREF(__pyx_int_41310077);
6081 __Pyx_GIVEREF(__pyx_int_41310077);
6082 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_41310077);
6083 __Pyx_INCREF(Py_None);
6084 __Pyx_GIVEREF(Py_None);
6085 PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
6086 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
6087 __Pyx_GOTREF(__pyx_t_6);
6088 __Pyx_GIVEREF(__pyx_t_1);
6089 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
6090 __Pyx_GIVEREF(__pyx_t_2);
6091 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
6092 __Pyx_INCREF(__pyx_v_state);
6093 __Pyx_GIVEREF(__pyx_v_state);
6094 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
6095 __pyx_t_1 = 0;
6096 __pyx_t_2 = 0;
6097 __pyx_r = __pyx_t_6;
6098 __pyx_t_6 = 0;
6099 goto __pyx_L0;
6100
6101 /* "(tree fragment)":12
6102 * else:
6103 * use_setstate = self._qs_quoter is not None or self._quoter is not None or self._unsafe is not None
6104 * if use_setstate: # <<<<<<<<<<<<<<
6105 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, None), state
6106 * else:
6107 */
6108 }
6109
6110 /* "(tree fragment)":15
6111 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, None), state
6112 * else:
6113 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, state) # <<<<<<<<<<<<<<
6114 * def __setstate_cython__(self, __pyx_state):
6115 * __pyx_unpickle__Unquoter__set_state(self, __pyx_state)
6116 */
6117 /*else*/ {
6118 __Pyx_XDECREF(__pyx_r);
6119 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle__Unquoter); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error)
6120 __Pyx_GOTREF(__pyx_t_6);
6121 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
6122 __Pyx_GOTREF(__pyx_t_2);
6123 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6124 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6125 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
6126 __Pyx_INCREF(__pyx_int_41310077);
6127 __Pyx_GIVEREF(__pyx_int_41310077);
6128 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_41310077);
6129 __Pyx_INCREF(__pyx_v_state);
6130 __Pyx_GIVEREF(__pyx_v_state);
6131 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
6132 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
6133 __Pyx_GOTREF(__pyx_t_1);
6134 __Pyx_GIVEREF(__pyx_t_6);
6135 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
6136 __Pyx_GIVEREF(__pyx_t_2);
6137 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
6138 __pyx_t_6 = 0;
6139 __pyx_t_2 = 0;
6140 __pyx_r = __pyx_t_1;
6141 __pyx_t_1 = 0;
6142 goto __pyx_L0;
6143 }
6144
6145 /* "(tree fragment)":1
6146 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
6147 * cdef tuple state
6148 * cdef object _dict
6149 */
6150
6151 /* function exit code */
6152 __pyx_L1_error:;
6153 __Pyx_XDECREF(__pyx_t_1);
6154 __Pyx_XDECREF(__pyx_t_2);
6155 __Pyx_XDECREF(__pyx_t_6);
6156 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6157 __pyx_r = NULL;
6158 __pyx_L0:;
6159 __Pyx_XDECREF(__pyx_v_state);
6160 __Pyx_XDECREF(__pyx_v__dict);
6161 __Pyx_XGIVEREF(__pyx_r);
6162 __Pyx_RefNannyFinishContext();
6163 return __pyx_r;
6164 }
6165
6166 /* "(tree fragment)":16
6167 * else:
6168 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, state)
6169 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
6170 * __pyx_unpickle__Unquoter__set_state(self, __pyx_state)
6171 */
6172
6173 /* Python wrapper */
6174 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4yarl_10_quoting_c_9_Unquoter_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)6175 static PyObject *__pyx_pw_4yarl_10_quoting_c_9_Unquoter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6176 PyObject *__pyx_r = 0;
6177 __Pyx_RefNannyDeclarations
6178 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
6179 __pyx_r = __pyx_pf_4yarl_10_quoting_c_9_Unquoter_6__setstate_cython__(((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6180
6181 /* function exit code */
6182 __Pyx_RefNannyFinishContext();
6183 return __pyx_r;
6184 }
6185
__pyx_pf_4yarl_10_quoting_c_9_Unquoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v_self,PyObject * __pyx_v___pyx_state)6186 static PyObject *__pyx_pf_4yarl_10_quoting_c_9_Unquoter_6__setstate_cython__(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6187 PyObject *__pyx_r = NULL;
6188 __Pyx_RefNannyDeclarations
6189 PyObject *__pyx_t_1 = NULL;
6190 int __pyx_lineno = 0;
6191 const char *__pyx_filename = NULL;
6192 int __pyx_clineno = 0;
6193 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6194
6195 /* "(tree fragment)":17
6196 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, state)
6197 * def __setstate_cython__(self, __pyx_state):
6198 * __pyx_unpickle__Unquoter__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
6199 */
6200 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
6201 __pyx_t_1 = __pyx_f_4yarl_10_quoting_c___pyx_unpickle__Unquoter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
6202 __Pyx_GOTREF(__pyx_t_1);
6203 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6204
6205 /* "(tree fragment)":16
6206 * else:
6207 * return __pyx_unpickle__Unquoter, (type(self), 0x276577d, state)
6208 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
6209 * __pyx_unpickle__Unquoter__set_state(self, __pyx_state)
6210 */
6211
6212 /* function exit code */
6213 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6214 goto __pyx_L0;
6215 __pyx_L1_error:;
6216 __Pyx_XDECREF(__pyx_t_1);
6217 __Pyx_AddTraceback("yarl._quoting_c._Unquoter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6218 __pyx_r = NULL;
6219 __pyx_L0:;
6220 __Pyx_XGIVEREF(__pyx_r);
6221 __Pyx_RefNannyFinishContext();
6222 return __pyx_r;
6223 }
6224
6225 /* "(tree fragment)":1
6226 * def __pyx_unpickle__Quoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
6227 * cdef object __pyx_PickleError
6228 * cdef object __pyx_result
6229 */
6230
6231 /* Python wrapper */
6232 static PyObject *__pyx_pw_4yarl_10_quoting_c_1__pyx_unpickle__Quoter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6233 static PyMethodDef __pyx_mdef_4yarl_10_quoting_c_1__pyx_unpickle__Quoter = {"__pyx_unpickle__Quoter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4yarl_10_quoting_c_1__pyx_unpickle__Quoter, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4yarl_10_quoting_c_1__pyx_unpickle__Quoter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6234 static PyObject *__pyx_pw_4yarl_10_quoting_c_1__pyx_unpickle__Quoter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6235 PyObject *__pyx_v___pyx_type = 0;
6236 long __pyx_v___pyx_checksum;
6237 PyObject *__pyx_v___pyx_state = 0;
6238 int __pyx_lineno = 0;
6239 const char *__pyx_filename = NULL;
6240 int __pyx_clineno = 0;
6241 PyObject *__pyx_r = 0;
6242 __Pyx_RefNannyDeclarations
6243 __Pyx_RefNannySetupContext("__pyx_unpickle__Quoter (wrapper)", 0);
6244 {
6245 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
6246 PyObject* values[3] = {0,0,0};
6247 if (unlikely(__pyx_kwds)) {
6248 Py_ssize_t kw_args;
6249 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6250 switch (pos_args) {
6251 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6252 CYTHON_FALLTHROUGH;
6253 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6254 CYTHON_FALLTHROUGH;
6255 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6256 CYTHON_FALLTHROUGH;
6257 case 0: break;
6258 default: goto __pyx_L5_argtuple_error;
6259 }
6260 kw_args = PyDict_Size(__pyx_kwds);
6261 switch (pos_args) {
6262 case 0:
6263 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
6264 else goto __pyx_L5_argtuple_error;
6265 CYTHON_FALLTHROUGH;
6266 case 1:
6267 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
6268 else {
6269 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Quoter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
6270 }
6271 CYTHON_FALLTHROUGH;
6272 case 2:
6273 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
6274 else {
6275 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Quoter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
6276 }
6277 }
6278 if (unlikely(kw_args > 0)) {
6279 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__Quoter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
6280 }
6281 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6282 goto __pyx_L5_argtuple_error;
6283 } else {
6284 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6285 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6286 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6287 }
6288 __pyx_v___pyx_type = values[0];
6289 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
6290 __pyx_v___pyx_state = values[2];
6291 }
6292 goto __pyx_L4_argument_unpacking_done;
6293 __pyx_L5_argtuple_error:;
6294 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Quoter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
6295 __pyx_L3_error:;
6296 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Quoter", __pyx_clineno, __pyx_lineno, __pyx_filename);
6297 __Pyx_RefNannyFinishContext();
6298 return NULL;
6299 __pyx_L4_argument_unpacking_done:;
6300 __pyx_r = __pyx_pf_4yarl_10_quoting_c___pyx_unpickle__Quoter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
6301
6302 /* function exit code */
6303 __Pyx_RefNannyFinishContext();
6304 return __pyx_r;
6305 }
6306
__pyx_pf_4yarl_10_quoting_c___pyx_unpickle__Quoter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)6307 static PyObject *__pyx_pf_4yarl_10_quoting_c___pyx_unpickle__Quoter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
6308 PyObject *__pyx_v___pyx_PickleError = 0;
6309 PyObject *__pyx_v___pyx_result = 0;
6310 PyObject *__pyx_r = NULL;
6311 __Pyx_RefNannyDeclarations
6312 int __pyx_t_1;
6313 PyObject *__pyx_t_2 = NULL;
6314 PyObject *__pyx_t_3 = NULL;
6315 PyObject *__pyx_t_4 = NULL;
6316 PyObject *__pyx_t_5 = NULL;
6317 int __pyx_t_6;
6318 int __pyx_lineno = 0;
6319 const char *__pyx_filename = NULL;
6320 int __pyx_clineno = 0;
6321 __Pyx_RefNannySetupContext("__pyx_unpickle__Quoter", 0);
6322
6323 /* "(tree fragment)":4
6324 * cdef object __pyx_PickleError
6325 * cdef object __pyx_result
6326 * if __pyx_checksum != 0xe91bd35: # <<<<<<<<<<<<<<
6327 * from pickle import PickleError as __pyx_PickleError
6328 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6329 */
6330 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xe91bd35) != 0);
6331 if (__pyx_t_1) {
6332
6333 /* "(tree fragment)":5
6334 * cdef object __pyx_result
6335 * if __pyx_checksum != 0xe91bd35:
6336 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
6337 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6338 * __pyx_result = _Quoter.__new__(__pyx_type)
6339 */
6340 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
6341 __Pyx_GOTREF(__pyx_t_2);
6342 __Pyx_INCREF(__pyx_n_s_PickleError);
6343 __Pyx_GIVEREF(__pyx_n_s_PickleError);
6344 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
6345 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
6346 __Pyx_GOTREF(__pyx_t_3);
6347 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6348 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
6349 __Pyx_GOTREF(__pyx_t_2);
6350 __Pyx_INCREF(__pyx_t_2);
6351 __pyx_v___pyx_PickleError = __pyx_t_2;
6352 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6353 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6354
6355 /* "(tree fragment)":6
6356 * if __pyx_checksum != 0xe91bd35:
6357 * from pickle import PickleError as __pyx_PickleError
6358 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum) # <<<<<<<<<<<<<<
6359 * __pyx_result = _Quoter.__new__(__pyx_type)
6360 * if __pyx_state is not None:
6361 */
6362 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
6363 __Pyx_GOTREF(__pyx_t_2);
6364 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xe9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
6365 __Pyx_GOTREF(__pyx_t_4);
6366 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6367 __Pyx_INCREF(__pyx_v___pyx_PickleError);
6368 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
6369 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6370 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
6371 if (likely(__pyx_t_5)) {
6372 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6373 __Pyx_INCREF(__pyx_t_5);
6374 __Pyx_INCREF(function);
6375 __Pyx_DECREF_SET(__pyx_t_2, function);
6376 }
6377 }
6378 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
6379 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6380 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6381 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
6382 __Pyx_GOTREF(__pyx_t_3);
6383 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6384 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6385 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6386 __PYX_ERR(1, 6, __pyx_L1_error)
6387
6388 /* "(tree fragment)":4
6389 * cdef object __pyx_PickleError
6390 * cdef object __pyx_result
6391 * if __pyx_checksum != 0xe91bd35: # <<<<<<<<<<<<<<
6392 * from pickle import PickleError as __pyx_PickleError
6393 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6394 */
6395 }
6396
6397 /* "(tree fragment)":7
6398 * from pickle import PickleError as __pyx_PickleError
6399 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6400 * __pyx_result = _Quoter.__new__(__pyx_type) # <<<<<<<<<<<<<<
6401 * if __pyx_state is not None:
6402 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6403 */
6404 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4yarl_10_quoting_c__Quoter), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
6405 __Pyx_GOTREF(__pyx_t_2);
6406 __pyx_t_4 = NULL;
6407 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6408 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
6409 if (likely(__pyx_t_4)) {
6410 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6411 __Pyx_INCREF(__pyx_t_4);
6412 __Pyx_INCREF(function);
6413 __Pyx_DECREF_SET(__pyx_t_2, function);
6414 }
6415 }
6416 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
6417 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6418 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
6419 __Pyx_GOTREF(__pyx_t_3);
6420 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6421 __pyx_v___pyx_result = __pyx_t_3;
6422 __pyx_t_3 = 0;
6423
6424 /* "(tree fragment)":8
6425 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6426 * __pyx_result = _Quoter.__new__(__pyx_type)
6427 * if __pyx_state is not None: # <<<<<<<<<<<<<<
6428 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6429 * return __pyx_result
6430 */
6431 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
6432 __pyx_t_6 = (__pyx_t_1 != 0);
6433 if (__pyx_t_6) {
6434
6435 /* "(tree fragment)":9
6436 * __pyx_result = _Quoter.__new__(__pyx_type)
6437 * if __pyx_state is not None:
6438 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
6439 * return __pyx_result
6440 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state):
6441 */
6442 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
6443 __pyx_t_3 = __pyx_f_4yarl_10_quoting_c___pyx_unpickle__Quoter__set_state(((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
6444 __Pyx_GOTREF(__pyx_t_3);
6445 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6446
6447 /* "(tree fragment)":8
6448 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xe91bd35 = (_protected_table, _qs, _requote, _safe_table))" % __pyx_checksum)
6449 * __pyx_result = _Quoter.__new__(__pyx_type)
6450 * if __pyx_state is not None: # <<<<<<<<<<<<<<
6451 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6452 * return __pyx_result
6453 */
6454 }
6455
6456 /* "(tree fragment)":10
6457 * if __pyx_state is not None:
6458 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6459 * return __pyx_result # <<<<<<<<<<<<<<
6460 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state):
6461 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6462 */
6463 __Pyx_XDECREF(__pyx_r);
6464 __Pyx_INCREF(__pyx_v___pyx_result);
6465 __pyx_r = __pyx_v___pyx_result;
6466 goto __pyx_L0;
6467
6468 /* "(tree fragment)":1
6469 * def __pyx_unpickle__Quoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
6470 * cdef object __pyx_PickleError
6471 * cdef object __pyx_result
6472 */
6473
6474 /* function exit code */
6475 __pyx_L1_error:;
6476 __Pyx_XDECREF(__pyx_t_2);
6477 __Pyx_XDECREF(__pyx_t_3);
6478 __Pyx_XDECREF(__pyx_t_4);
6479 __Pyx_XDECREF(__pyx_t_5);
6480 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Quoter", __pyx_clineno, __pyx_lineno, __pyx_filename);
6481 __pyx_r = NULL;
6482 __pyx_L0:;
6483 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
6484 __Pyx_XDECREF(__pyx_v___pyx_result);
6485 __Pyx_XGIVEREF(__pyx_r);
6486 __Pyx_RefNannyFinishContext();
6487 return __pyx_r;
6488 }
6489
6490 /* "(tree fragment)":11
6491 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6492 * return __pyx_result
6493 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
6494 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6495 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6496 */
6497
__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Quoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Quoter * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)6498 static PyObject *__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Quoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Quoter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
6499 PyObject *__pyx_r = NULL;
6500 __Pyx_RefNannyDeclarations
6501 PyObject *__pyx_t_1 = NULL;
6502 uint8_t __pyx_t_2[16];
6503 int __pyx_t_3;
6504 Py_ssize_t __pyx_t_4;
6505 int __pyx_t_5;
6506 int __pyx_t_6;
6507 PyObject *__pyx_t_7 = NULL;
6508 PyObject *__pyx_t_8 = NULL;
6509 PyObject *__pyx_t_9 = NULL;
6510 int __pyx_lineno = 0;
6511 const char *__pyx_filename = NULL;
6512 int __pyx_clineno = 0;
6513 __Pyx_RefNannySetupContext("__pyx_unpickle__Quoter__set_state", 0);
6514
6515 /* "(tree fragment)":12
6516 * return __pyx_result
6517 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state):
6518 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3] # <<<<<<<<<<<<<<
6519 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6520 * __pyx_result.__dict__.update(__pyx_state[4])
6521 */
6522 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6523 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6524 __PYX_ERR(1, 12, __pyx_L1_error)
6525 }
6526 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6527 __Pyx_GOTREF(__pyx_t_1);
6528 if (unlikely(__Pyx_carray_from_py_uint8_t(__pyx_t_1, __pyx_t_2, 16) < 0)) __PYX_ERR(1, 12, __pyx_L1_error)
6529 memcpy(&(__pyx_v___pyx_result->_protected_table[0]), __pyx_t_2, sizeof(__pyx_v___pyx_result->_protected_table[0]) * (16));
6530 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6531 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6532 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6533 __PYX_ERR(1, 12, __pyx_L1_error)
6534 }
6535 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6536 __Pyx_GOTREF(__pyx_t_1);
6537 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
6538 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6539 __pyx_v___pyx_result->_qs = __pyx_t_3;
6540 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6541 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6542 __PYX_ERR(1, 12, __pyx_L1_error)
6543 }
6544 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6545 __Pyx_GOTREF(__pyx_t_1);
6546 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
6547 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6548 __pyx_v___pyx_result->_requote = __pyx_t_3;
6549 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6550 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6551 __PYX_ERR(1, 12, __pyx_L1_error)
6552 }
6553 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6554 __Pyx_GOTREF(__pyx_t_1);
6555 if (unlikely(__Pyx_carray_from_py_uint8_t(__pyx_t_1, __pyx_t_2, 16) < 0)) __PYX_ERR(1, 12, __pyx_L1_error)
6556 memcpy(&(__pyx_v___pyx_result->_safe_table[0]), __pyx_t_2, sizeof(__pyx_v___pyx_result->_safe_table[0]) * (16));
6557 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6558
6559 /* "(tree fragment)":13
6560 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state):
6561 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6562 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
6563 * __pyx_result.__dict__.update(__pyx_state[4])
6564 */
6565 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6566 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
6567 __PYX_ERR(1, 13, __pyx_L1_error)
6568 }
6569 __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
6570 __pyx_t_5 = ((__pyx_t_4 > 4) != 0);
6571 if (__pyx_t_5) {
6572 } else {
6573 __pyx_t_3 = __pyx_t_5;
6574 goto __pyx_L4_bool_binop_done;
6575 }
6576 __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
6577 __pyx_t_6 = (__pyx_t_5 != 0);
6578 __pyx_t_3 = __pyx_t_6;
6579 __pyx_L4_bool_binop_done:;
6580 if (__pyx_t_3) {
6581
6582 /* "(tree fragment)":14
6583 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6584 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6585 * __pyx_result.__dict__.update(__pyx_state[4]) # <<<<<<<<<<<<<<
6586 */
6587 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
6588 __Pyx_GOTREF(__pyx_t_7);
6589 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
6590 __Pyx_GOTREF(__pyx_t_8);
6591 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6592 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6593 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6594 __PYX_ERR(1, 14, __pyx_L1_error)
6595 }
6596 __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
6597 __Pyx_GOTREF(__pyx_t_7);
6598 __pyx_t_9 = NULL;
6599 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
6600 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
6601 if (likely(__pyx_t_9)) {
6602 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
6603 __Pyx_INCREF(__pyx_t_9);
6604 __Pyx_INCREF(function);
6605 __Pyx_DECREF_SET(__pyx_t_8, function);
6606 }
6607 }
6608 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7);
6609 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6610 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6611 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
6612 __Pyx_GOTREF(__pyx_t_1);
6613 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6614 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6615
6616 /* "(tree fragment)":13
6617 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state):
6618 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6619 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
6620 * __pyx_result.__dict__.update(__pyx_state[4])
6621 */
6622 }
6623
6624 /* "(tree fragment)":11
6625 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
6626 * return __pyx_result
6627 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
6628 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
6629 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6630 */
6631
6632 /* function exit code */
6633 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6634 goto __pyx_L0;
6635 __pyx_L1_error:;
6636 __Pyx_XDECREF(__pyx_t_1);
6637 __Pyx_XDECREF(__pyx_t_7);
6638 __Pyx_XDECREF(__pyx_t_8);
6639 __Pyx_XDECREF(__pyx_t_9);
6640 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Quoter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
6641 __pyx_r = 0;
6642 __pyx_L0:;
6643 __Pyx_XGIVEREF(__pyx_r);
6644 __Pyx_RefNannyFinishContext();
6645 return __pyx_r;
6646 }
6647
6648 /* "(tree fragment)":1
6649 * def __pyx_unpickle__Unquoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
6650 * cdef object __pyx_PickleError
6651 * cdef object __pyx_result
6652 */
6653
6654 /* Python wrapper */
6655 static PyObject *__pyx_pw_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6656 static PyMethodDef __pyx_mdef_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter = {"__pyx_unpickle__Unquoter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6657 static PyObject *__pyx_pw_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6658 PyObject *__pyx_v___pyx_type = 0;
6659 long __pyx_v___pyx_checksum;
6660 PyObject *__pyx_v___pyx_state = 0;
6661 int __pyx_lineno = 0;
6662 const char *__pyx_filename = NULL;
6663 int __pyx_clineno = 0;
6664 PyObject *__pyx_r = 0;
6665 __Pyx_RefNannyDeclarations
6666 __Pyx_RefNannySetupContext("__pyx_unpickle__Unquoter (wrapper)", 0);
6667 {
6668 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
6669 PyObject* values[3] = {0,0,0};
6670 if (unlikely(__pyx_kwds)) {
6671 Py_ssize_t kw_args;
6672 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6673 switch (pos_args) {
6674 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6675 CYTHON_FALLTHROUGH;
6676 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6677 CYTHON_FALLTHROUGH;
6678 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6679 CYTHON_FALLTHROUGH;
6680 case 0: break;
6681 default: goto __pyx_L5_argtuple_error;
6682 }
6683 kw_args = PyDict_Size(__pyx_kwds);
6684 switch (pos_args) {
6685 case 0:
6686 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
6687 else goto __pyx_L5_argtuple_error;
6688 CYTHON_FALLTHROUGH;
6689 case 1:
6690 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
6691 else {
6692 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Unquoter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
6693 }
6694 CYTHON_FALLTHROUGH;
6695 case 2:
6696 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
6697 else {
6698 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Unquoter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
6699 }
6700 }
6701 if (unlikely(kw_args > 0)) {
6702 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle__Unquoter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
6703 }
6704 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6705 goto __pyx_L5_argtuple_error;
6706 } else {
6707 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6708 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6709 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6710 }
6711 __pyx_v___pyx_type = values[0];
6712 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
6713 __pyx_v___pyx_state = values[2];
6714 }
6715 goto __pyx_L4_argument_unpacking_done;
6716 __pyx_L5_argtuple_error:;
6717 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle__Unquoter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
6718 __pyx_L3_error:;
6719 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Unquoter", __pyx_clineno, __pyx_lineno, __pyx_filename);
6720 __Pyx_RefNannyFinishContext();
6721 return NULL;
6722 __pyx_L4_argument_unpacking_done:;
6723 __pyx_r = __pyx_pf_4yarl_10_quoting_c_2__pyx_unpickle__Unquoter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
6724
6725 /* function exit code */
6726 __Pyx_RefNannyFinishContext();
6727 return __pyx_r;
6728 }
6729
__pyx_pf_4yarl_10_quoting_c_2__pyx_unpickle__Unquoter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)6730 static PyObject *__pyx_pf_4yarl_10_quoting_c_2__pyx_unpickle__Unquoter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
6731 PyObject *__pyx_v___pyx_PickleError = 0;
6732 PyObject *__pyx_v___pyx_result = 0;
6733 PyObject *__pyx_r = NULL;
6734 __Pyx_RefNannyDeclarations
6735 int __pyx_t_1;
6736 PyObject *__pyx_t_2 = NULL;
6737 PyObject *__pyx_t_3 = NULL;
6738 PyObject *__pyx_t_4 = NULL;
6739 PyObject *__pyx_t_5 = NULL;
6740 int __pyx_t_6;
6741 int __pyx_lineno = 0;
6742 const char *__pyx_filename = NULL;
6743 int __pyx_clineno = 0;
6744 __Pyx_RefNannySetupContext("__pyx_unpickle__Unquoter", 0);
6745
6746 /* "(tree fragment)":4
6747 * cdef object __pyx_PickleError
6748 * cdef object __pyx_result
6749 * if __pyx_checksum != 0x276577d: # <<<<<<<<<<<<<<
6750 * from pickle import PickleError as __pyx_PickleError
6751 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6752 */
6753 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x276577d) != 0);
6754 if (__pyx_t_1) {
6755
6756 /* "(tree fragment)":5
6757 * cdef object __pyx_result
6758 * if __pyx_checksum != 0x276577d:
6759 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
6760 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6761 * __pyx_result = _Unquoter.__new__(__pyx_type)
6762 */
6763 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
6764 __Pyx_GOTREF(__pyx_t_2);
6765 __Pyx_INCREF(__pyx_n_s_PickleError);
6766 __Pyx_GIVEREF(__pyx_n_s_PickleError);
6767 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
6768 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
6769 __Pyx_GOTREF(__pyx_t_3);
6770 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6771 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
6772 __Pyx_GOTREF(__pyx_t_2);
6773 __Pyx_INCREF(__pyx_t_2);
6774 __pyx_v___pyx_PickleError = __pyx_t_2;
6775 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6776 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6777
6778 /* "(tree fragment)":6
6779 * if __pyx_checksum != 0x276577d:
6780 * from pickle import PickleError as __pyx_PickleError
6781 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum) # <<<<<<<<<<<<<<
6782 * __pyx_result = _Unquoter.__new__(__pyx_type)
6783 * if __pyx_state is not None:
6784 */
6785 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
6786 __Pyx_GOTREF(__pyx_t_2);
6787 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x27, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
6788 __Pyx_GOTREF(__pyx_t_4);
6789 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6790 __Pyx_INCREF(__pyx_v___pyx_PickleError);
6791 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
6792 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6793 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
6794 if (likely(__pyx_t_5)) {
6795 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6796 __Pyx_INCREF(__pyx_t_5);
6797 __Pyx_INCREF(function);
6798 __Pyx_DECREF_SET(__pyx_t_2, function);
6799 }
6800 }
6801 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
6802 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6803 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6804 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
6805 __Pyx_GOTREF(__pyx_t_3);
6806 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6807 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6808 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6809 __PYX_ERR(1, 6, __pyx_L1_error)
6810
6811 /* "(tree fragment)":4
6812 * cdef object __pyx_PickleError
6813 * cdef object __pyx_result
6814 * if __pyx_checksum != 0x276577d: # <<<<<<<<<<<<<<
6815 * from pickle import PickleError as __pyx_PickleError
6816 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6817 */
6818 }
6819
6820 /* "(tree fragment)":7
6821 * from pickle import PickleError as __pyx_PickleError
6822 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6823 * __pyx_result = _Unquoter.__new__(__pyx_type) # <<<<<<<<<<<<<<
6824 * if __pyx_state is not None:
6825 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
6826 */
6827 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4yarl_10_quoting_c__Unquoter), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
6828 __Pyx_GOTREF(__pyx_t_2);
6829 __pyx_t_4 = NULL;
6830 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
6831 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
6832 if (likely(__pyx_t_4)) {
6833 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6834 __Pyx_INCREF(__pyx_t_4);
6835 __Pyx_INCREF(function);
6836 __Pyx_DECREF_SET(__pyx_t_2, function);
6837 }
6838 }
6839 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
6840 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6841 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
6842 __Pyx_GOTREF(__pyx_t_3);
6843 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6844 __pyx_v___pyx_result = __pyx_t_3;
6845 __pyx_t_3 = 0;
6846
6847 /* "(tree fragment)":8
6848 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6849 * __pyx_result = _Unquoter.__new__(__pyx_type)
6850 * if __pyx_state is not None: # <<<<<<<<<<<<<<
6851 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
6852 * return __pyx_result
6853 */
6854 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
6855 __pyx_t_6 = (__pyx_t_1 != 0);
6856 if (__pyx_t_6) {
6857
6858 /* "(tree fragment)":9
6859 * __pyx_result = _Unquoter.__new__(__pyx_type)
6860 * if __pyx_state is not None:
6861 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
6862 * return __pyx_result
6863 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state):
6864 */
6865 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
6866 __pyx_t_3 = __pyx_f_4yarl_10_quoting_c___pyx_unpickle__Unquoter__set_state(((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
6867 __Pyx_GOTREF(__pyx_t_3);
6868 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6869
6870 /* "(tree fragment)":8
6871 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x276577d = (_qs, _qs_quoter, _quoter, _unsafe))" % __pyx_checksum)
6872 * __pyx_result = _Unquoter.__new__(__pyx_type)
6873 * if __pyx_state is not None: # <<<<<<<<<<<<<<
6874 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
6875 * return __pyx_result
6876 */
6877 }
6878
6879 /* "(tree fragment)":10
6880 * if __pyx_state is not None:
6881 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
6882 * return __pyx_result # <<<<<<<<<<<<<<
6883 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state):
6884 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
6885 */
6886 __Pyx_XDECREF(__pyx_r);
6887 __Pyx_INCREF(__pyx_v___pyx_result);
6888 __pyx_r = __pyx_v___pyx_result;
6889 goto __pyx_L0;
6890
6891 /* "(tree fragment)":1
6892 * def __pyx_unpickle__Unquoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
6893 * cdef object __pyx_PickleError
6894 * cdef object __pyx_result
6895 */
6896
6897 /* function exit code */
6898 __pyx_L1_error:;
6899 __Pyx_XDECREF(__pyx_t_2);
6900 __Pyx_XDECREF(__pyx_t_3);
6901 __Pyx_XDECREF(__pyx_t_4);
6902 __Pyx_XDECREF(__pyx_t_5);
6903 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Unquoter", __pyx_clineno, __pyx_lineno, __pyx_filename);
6904 __pyx_r = NULL;
6905 __pyx_L0:;
6906 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
6907 __Pyx_XDECREF(__pyx_v___pyx_result);
6908 __Pyx_XGIVEREF(__pyx_r);
6909 __Pyx_RefNannyFinishContext();
6910 return __pyx_r;
6911 }
6912
6913 /* "(tree fragment)":11
6914 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
6915 * return __pyx_result
6916 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
6917 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
6918 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6919 */
6920
__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Unquoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Unquoter * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)6921 static PyObject *__pyx_f_4yarl_10_quoting_c___pyx_unpickle__Unquoter__set_state(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
6922 PyObject *__pyx_r = NULL;
6923 __Pyx_RefNannyDeclarations
6924 PyObject *__pyx_t_1 = NULL;
6925 int __pyx_t_2;
6926 Py_ssize_t __pyx_t_3;
6927 int __pyx_t_4;
6928 int __pyx_t_5;
6929 PyObject *__pyx_t_6 = NULL;
6930 PyObject *__pyx_t_7 = NULL;
6931 PyObject *__pyx_t_8 = NULL;
6932 int __pyx_lineno = 0;
6933 const char *__pyx_filename = NULL;
6934 int __pyx_clineno = 0;
6935 __Pyx_RefNannySetupContext("__pyx_unpickle__Unquoter__set_state", 0);
6936
6937 /* "(tree fragment)":12
6938 * return __pyx_result
6939 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state):
6940 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3] # <<<<<<<<<<<<<<
6941 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
6942 * __pyx_result.__dict__.update(__pyx_state[4])
6943 */
6944 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6945 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6946 __PYX_ERR(1, 12, __pyx_L1_error)
6947 }
6948 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6949 __Pyx_GOTREF(__pyx_t_1);
6950 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
6951 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6952 __pyx_v___pyx_result->_qs = __pyx_t_2;
6953 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6954 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6955 __PYX_ERR(1, 12, __pyx_L1_error)
6956 }
6957 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6958 __Pyx_GOTREF(__pyx_t_1);
6959 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4yarl_10_quoting_c__Quoter))))) __PYX_ERR(1, 12, __pyx_L1_error)
6960 __Pyx_GIVEREF(__pyx_t_1);
6961 __Pyx_GOTREF(__pyx_v___pyx_result->_qs_quoter);
6962 __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->_qs_quoter));
6963 __pyx_v___pyx_result->_qs_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_t_1);
6964 __pyx_t_1 = 0;
6965 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6966 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6967 __PYX_ERR(1, 12, __pyx_L1_error)
6968 }
6969 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6970 __Pyx_GOTREF(__pyx_t_1);
6971 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4yarl_10_quoting_c__Quoter))))) __PYX_ERR(1, 12, __pyx_L1_error)
6972 __Pyx_GIVEREF(__pyx_t_1);
6973 __Pyx_GOTREF(__pyx_v___pyx_result->_quoter);
6974 __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->_quoter));
6975 __pyx_v___pyx_result->_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)__pyx_t_1);
6976 __pyx_t_1 = 0;
6977 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6978 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6979 __PYX_ERR(1, 12, __pyx_L1_error)
6980 }
6981 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
6982 __Pyx_GOTREF(__pyx_t_1);
6983 if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
6984 __Pyx_GIVEREF(__pyx_t_1);
6985 __Pyx_GOTREF(__pyx_v___pyx_result->_unsafe);
6986 __Pyx_DECREF(__pyx_v___pyx_result->_unsafe);
6987 __pyx_v___pyx_result->_unsafe = ((PyObject*)__pyx_t_1);
6988 __pyx_t_1 = 0;
6989
6990 /* "(tree fragment)":13
6991 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state):
6992 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
6993 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
6994 * __pyx_result.__dict__.update(__pyx_state[4])
6995 */
6996 if (unlikely(__pyx_v___pyx_state == Py_None)) {
6997 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
6998 __PYX_ERR(1, 13, __pyx_L1_error)
6999 }
7000 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
7001 __pyx_t_4 = ((__pyx_t_3 > 4) != 0);
7002 if (__pyx_t_4) {
7003 } else {
7004 __pyx_t_2 = __pyx_t_4;
7005 goto __pyx_L4_bool_binop_done;
7006 }
7007 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
7008 __pyx_t_5 = (__pyx_t_4 != 0);
7009 __pyx_t_2 = __pyx_t_5;
7010 __pyx_L4_bool_binop_done:;
7011 if (__pyx_t_2) {
7012
7013 /* "(tree fragment)":14
7014 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
7015 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
7016 * __pyx_result.__dict__.update(__pyx_state[4]) # <<<<<<<<<<<<<<
7017 */
7018 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
7019 __Pyx_GOTREF(__pyx_t_6);
7020 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
7021 __Pyx_GOTREF(__pyx_t_7);
7022 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7023 if (unlikely(__pyx_v___pyx_state == Py_None)) {
7024 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7025 __PYX_ERR(1, 14, __pyx_L1_error)
7026 }
7027 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
7028 __Pyx_GOTREF(__pyx_t_6);
7029 __pyx_t_8 = NULL;
7030 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
7031 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
7032 if (likely(__pyx_t_8)) {
7033 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
7034 __Pyx_INCREF(__pyx_t_8);
7035 __Pyx_INCREF(function);
7036 __Pyx_DECREF_SET(__pyx_t_7, function);
7037 }
7038 }
7039 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
7040 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7041 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7042 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
7043 __Pyx_GOTREF(__pyx_t_1);
7044 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7045 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7046
7047 /* "(tree fragment)":13
7048 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state):
7049 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
7050 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
7051 * __pyx_result.__dict__.update(__pyx_state[4])
7052 */
7053 }
7054
7055 /* "(tree fragment)":11
7056 * __pyx_unpickle__Unquoter__set_state(<_Unquoter> __pyx_result, __pyx_state)
7057 * return __pyx_result
7058 * cdef __pyx_unpickle__Unquoter__set_state(_Unquoter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
7059 * __pyx_result._qs = __pyx_state[0]; __pyx_result._qs_quoter = __pyx_state[1]; __pyx_result._quoter = __pyx_state[2]; __pyx_result._unsafe = __pyx_state[3]
7060 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
7061 */
7062
7063 /* function exit code */
7064 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7065 goto __pyx_L0;
7066 __pyx_L1_error:;
7067 __Pyx_XDECREF(__pyx_t_1);
7068 __Pyx_XDECREF(__pyx_t_6);
7069 __Pyx_XDECREF(__pyx_t_7);
7070 __Pyx_XDECREF(__pyx_t_8);
7071 __Pyx_AddTraceback("yarl._quoting_c.__pyx_unpickle__Unquoter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
7072 __pyx_r = 0;
7073 __pyx_L0:;
7074 __Pyx_XGIVEREF(__pyx_r);
7075 __Pyx_RefNannyFinishContext();
7076 return __pyx_r;
7077 }
7078
7079 /* "carray.from_py":77
7080 *
7081 * @cname("__Pyx_carray_from_py_uint8_t")
7082 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<<
7083 * cdef Py_ssize_t i = length
7084 * try:
7085 */
7086
__Pyx_carray_from_py_uint8_t(PyObject * __pyx_v_o,uint8_t * __pyx_v_v,Py_ssize_t __pyx_v_length)7087 static int __Pyx_carray_from_py_uint8_t(PyObject *__pyx_v_o, uint8_t *__pyx_v_v, Py_ssize_t __pyx_v_length) {
7088 Py_ssize_t __pyx_v_i;
7089 PyObject *__pyx_v_item = NULL;
7090 int __pyx_r;
7091 __Pyx_RefNannyDeclarations
7092 PyObject *__pyx_t_1 = NULL;
7093 PyObject *__pyx_t_2 = NULL;
7094 PyObject *__pyx_t_3 = NULL;
7095 Py_ssize_t __pyx_t_4;
7096 int __pyx_t_5;
7097 int __pyx_t_6;
7098 PyObject *__pyx_t_7 = NULL;
7099 Py_ssize_t __pyx_t_8;
7100 PyObject *(*__pyx_t_9)(PyObject *);
7101 PyObject *__pyx_t_10 = NULL;
7102 uint8_t __pyx_t_11;
7103 char const *__pyx_t_12;
7104 int __pyx_lineno = 0;
7105 const char *__pyx_filename = NULL;
7106 int __pyx_clineno = 0;
7107 __Pyx_RefNannySetupContext("__Pyx_carray_from_py_uint8_t", 0);
7108
7109 /* "carray.from_py":78
7110 * @cname("__Pyx_carray_from_py_uint8_t")
7111 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1:
7112 * cdef Py_ssize_t i = length # <<<<<<<<<<<<<<
7113 * try:
7114 * i = len(o)
7115 */
7116 __pyx_v_i = __pyx_v_length;
7117
7118 /* "carray.from_py":79
7119 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1:
7120 * cdef Py_ssize_t i = length
7121 * try: # <<<<<<<<<<<<<<
7122 * i = len(o)
7123 * except (TypeError, OverflowError):
7124 */
7125 {
7126 __Pyx_PyThreadState_declare
7127 __Pyx_PyThreadState_assign
7128 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7129 __Pyx_XGOTREF(__pyx_t_1);
7130 __Pyx_XGOTREF(__pyx_t_2);
7131 __Pyx_XGOTREF(__pyx_t_3);
7132 /*try:*/ {
7133
7134 /* "carray.from_py":80
7135 * cdef Py_ssize_t i = length
7136 * try:
7137 * i = len(o) # <<<<<<<<<<<<<<
7138 * except (TypeError, OverflowError):
7139 * pass
7140 */
7141 __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L3_error)
7142 __pyx_v_i = __pyx_t_4;
7143
7144 /* "carray.from_py":79
7145 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1:
7146 * cdef Py_ssize_t i = length
7147 * try: # <<<<<<<<<<<<<<
7148 * i = len(o)
7149 * except (TypeError, OverflowError):
7150 */
7151 }
7152 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7153 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7154 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7155 goto __pyx_L8_try_end;
7156 __pyx_L3_error:;
7157
7158 /* "carray.from_py":81
7159 * try:
7160 * i = len(o)
7161 * except (TypeError, OverflowError): # <<<<<<<<<<<<<<
7162 * pass
7163 * if i == length:
7164 */
7165 __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
7166 if (__pyx_t_5) {
7167 __Pyx_ErrRestore(0,0,0);
7168 goto __pyx_L4_exception_handled;
7169 }
7170 goto __pyx_L5_except_error;
7171 __pyx_L5_except_error:;
7172
7173 /* "carray.from_py":79
7174 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1:
7175 * cdef Py_ssize_t i = length
7176 * try: # <<<<<<<<<<<<<<
7177 * i = len(o)
7178 * except (TypeError, OverflowError):
7179 */
7180 __Pyx_XGIVEREF(__pyx_t_1);
7181 __Pyx_XGIVEREF(__pyx_t_2);
7182 __Pyx_XGIVEREF(__pyx_t_3);
7183 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7184 goto __pyx_L1_error;
7185 __pyx_L4_exception_handled:;
7186 __Pyx_XGIVEREF(__pyx_t_1);
7187 __Pyx_XGIVEREF(__pyx_t_2);
7188 __Pyx_XGIVEREF(__pyx_t_3);
7189 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7190 __pyx_L8_try_end:;
7191 }
7192
7193 /* "carray.from_py":83
7194 * except (TypeError, OverflowError):
7195 * pass
7196 * if i == length: # <<<<<<<<<<<<<<
7197 * for i, item in enumerate(o):
7198 * if i >= length:
7199 */
7200 __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0);
7201 if (__pyx_t_6) {
7202
7203 /* "carray.from_py":84
7204 * pass
7205 * if i == length:
7206 * for i, item in enumerate(o): # <<<<<<<<<<<<<<
7207 * if i >= length:
7208 * break
7209 */
7210 __pyx_t_4 = 0;
7211 if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
7212 __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0;
7213 __pyx_t_9 = NULL;
7214 } else {
7215 __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 84, __pyx_L1_error)
7216 __Pyx_GOTREF(__pyx_t_7);
7217 __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 84, __pyx_L1_error)
7218 }
7219 for (;;) {
7220 if (likely(!__pyx_t_9)) {
7221 if (likely(PyList_CheckExact(__pyx_t_7))) {
7222 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break;
7223 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7224 __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error)
7225 #else
7226 __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error)
7227 __Pyx_GOTREF(__pyx_t_10);
7228 #endif
7229 } else {
7230 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
7231 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7232 __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error)
7233 #else
7234 __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error)
7235 __Pyx_GOTREF(__pyx_t_10);
7236 #endif
7237 }
7238 } else {
7239 __pyx_t_10 = __pyx_t_9(__pyx_t_7);
7240 if (unlikely(!__pyx_t_10)) {
7241 PyObject* exc_type = PyErr_Occurred();
7242 if (exc_type) {
7243 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7244 else __PYX_ERR(1, 84, __pyx_L1_error)
7245 }
7246 break;
7247 }
7248 __Pyx_GOTREF(__pyx_t_10);
7249 }
7250 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10);
7251 __pyx_t_10 = 0;
7252 __pyx_v_i = __pyx_t_4;
7253 __pyx_t_4 = (__pyx_t_4 + 1);
7254
7255 /* "carray.from_py":85
7256 * if i == length:
7257 * for i, item in enumerate(o):
7258 * if i >= length: # <<<<<<<<<<<<<<
7259 * break
7260 * v[i] = item
7261 */
7262 __pyx_t_6 = ((__pyx_v_i >= __pyx_v_length) != 0);
7263 if (__pyx_t_6) {
7264
7265 /* "carray.from_py":86
7266 * for i, item in enumerate(o):
7267 * if i >= length:
7268 * break # <<<<<<<<<<<<<<
7269 * v[i] = item
7270 * else:
7271 */
7272 goto __pyx_L11_break;
7273
7274 /* "carray.from_py":85
7275 * if i == length:
7276 * for i, item in enumerate(o):
7277 * if i >= length: # <<<<<<<<<<<<<<
7278 * break
7279 * v[i] = item
7280 */
7281 }
7282
7283 /* "carray.from_py":87
7284 * if i >= length:
7285 * break
7286 * v[i] = item # <<<<<<<<<<<<<<
7287 * else:
7288 * i += 1 # convert index to length
7289 */
7290 __pyx_t_11 = __Pyx_PyInt_As_uint8_t(__pyx_v_item); if (unlikely((__pyx_t_11 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 87, __pyx_L1_error)
7291 (__pyx_v_v[__pyx_v_i]) = __pyx_t_11;
7292
7293 /* "carray.from_py":84
7294 * pass
7295 * if i == length:
7296 * for i, item in enumerate(o): # <<<<<<<<<<<<<<
7297 * if i >= length:
7298 * break
7299 */
7300 }
7301 /*else*/ {
7302
7303 /* "carray.from_py":89
7304 * v[i] = item
7305 * else:
7306 * i += 1 # convert index to length # <<<<<<<<<<<<<<
7307 * if i == length:
7308 * return 0
7309 */
7310 __pyx_v_i = (__pyx_v_i + 1);
7311
7312 /* "carray.from_py":90
7313 * else:
7314 * i += 1 # convert index to length
7315 * if i == length: # <<<<<<<<<<<<<<
7316 * return 0
7317 *
7318 */
7319 __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0);
7320 if (__pyx_t_6) {
7321
7322 /* "carray.from_py":91
7323 * i += 1 # convert index to length
7324 * if i == length:
7325 * return 0 # <<<<<<<<<<<<<<
7326 *
7327 * PyErr_Format(
7328 */
7329 __pyx_r = 0;
7330 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7331 goto __pyx_L0;
7332
7333 /* "carray.from_py":90
7334 * else:
7335 * i += 1 # convert index to length
7336 * if i == length: # <<<<<<<<<<<<<<
7337 * return 0
7338 *
7339 */
7340 }
7341 }
7342
7343 /* "carray.from_py":84
7344 * pass
7345 * if i == length:
7346 * for i, item in enumerate(o): # <<<<<<<<<<<<<<
7347 * if i >= length:
7348 * break
7349 */
7350 __pyx_L11_break:;
7351 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7352
7353 /* "carray.from_py":83
7354 * except (TypeError, OverflowError):
7355 * pass
7356 * if i == length: # <<<<<<<<<<<<<<
7357 * for i, item in enumerate(o):
7358 * if i >= length:
7359 */
7360 }
7361
7362 /* "carray.from_py":96
7363 * IndexError,
7364 * ("too many values found during array assignment, expected %zd"
7365 * if i >= length else # <<<<<<<<<<<<<<
7366 * "not enough values found during array assignment, expected %zd, got %zd"),
7367 * length, i)
7368 */
7369 if (((__pyx_v_i >= __pyx_v_length) != 0)) {
7370 __pyx_t_12 = ((char const *)"too many values found during array assignment, expected %zd");
7371 } else {
7372 __pyx_t_12 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd");
7373 }
7374
7375 /* "carray.from_py":93
7376 * return 0
7377 *
7378 * PyErr_Format( # <<<<<<<<<<<<<<
7379 * IndexError,
7380 * ("too many values found during array assignment, expected %zd"
7381 */
7382 __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 93, __pyx_L1_error)
7383 __Pyx_GOTREF(__pyx_t_7);
7384 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7385
7386 /* "carray.from_py":77
7387 *
7388 * @cname("__Pyx_carray_from_py_uint8_t")
7389 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<<
7390 * cdef Py_ssize_t i = length
7391 * try:
7392 */
7393
7394 /* function exit code */
7395 __pyx_r = 0;
7396 goto __pyx_L0;
7397 __pyx_L1_error:;
7398 __Pyx_XDECREF(__pyx_t_7);
7399 __Pyx_XDECREF(__pyx_t_10);
7400 __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_uint8_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
7401 __pyx_r = -1;
7402 __pyx_L0:;
7403 __Pyx_XDECREF(__pyx_v_item);
7404 __Pyx_RefNannyFinishContext();
7405 return __pyx_r;
7406 }
7407 static struct __pyx_vtabstruct_4yarl_10_quoting_c__Quoter __pyx_vtable_4yarl_10_quoting_c__Quoter;
7408
__pyx_tp_new_4yarl_10_quoting_c__Quoter(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)7409 static PyObject *__pyx_tp_new_4yarl_10_quoting_c__Quoter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
7410 struct __pyx_obj_4yarl_10_quoting_c__Quoter *p;
7411 PyObject *o;
7412 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
7413 o = (*t->tp_alloc)(t, 0);
7414 } else {
7415 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
7416 }
7417 if (unlikely(!o)) return 0;
7418 p = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)o);
7419 p->__pyx_vtab = __pyx_vtabptr_4yarl_10_quoting_c__Quoter;
7420 return o;
7421 }
7422
__pyx_tp_dealloc_4yarl_10_quoting_c__Quoter(PyObject * o)7423 static void __pyx_tp_dealloc_4yarl_10_quoting_c__Quoter(PyObject *o) {
7424 #if CYTHON_USE_TP_FINALIZE
7425 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
7426 if (PyObject_CallFinalizerFromDealloc(o)) return;
7427 }
7428 #endif
7429 (*Py_TYPE(o)->tp_free)(o);
7430 }
7431
7432 static PyMethodDef __pyx_methods_4yarl_10_quoting_c__Quoter[] = {
7433 {"__reduce_cython__", (PyCFunction)__pyx_pw_4yarl_10_quoting_c_7_Quoter_5__reduce_cython__, METH_NOARGS, 0},
7434 {"__setstate_cython__", (PyCFunction)__pyx_pw_4yarl_10_quoting_c_7_Quoter_7__setstate_cython__, METH_O, 0},
7435 {0, 0, 0, 0}
7436 };
7437
7438 static PyTypeObject __pyx_type_4yarl_10_quoting_c__Quoter = {
7439 PyVarObject_HEAD_INIT(0, 0)
7440 "yarl._quoting_c._Quoter", /*tp_name*/
7441 sizeof(struct __pyx_obj_4yarl_10_quoting_c__Quoter), /*tp_basicsize*/
7442 0, /*tp_itemsize*/
7443 __pyx_tp_dealloc_4yarl_10_quoting_c__Quoter, /*tp_dealloc*/
7444 #if PY_VERSION_HEX < 0x030800b4
7445 0, /*tp_print*/
7446 #endif
7447 #if PY_VERSION_HEX >= 0x030800b4
7448 0, /*tp_vectorcall_offset*/
7449 #endif
7450 0, /*tp_getattr*/
7451 0, /*tp_setattr*/
7452 #if PY_MAJOR_VERSION < 3
7453 0, /*tp_compare*/
7454 #endif
7455 #if PY_MAJOR_VERSION >= 3
7456 0, /*tp_as_async*/
7457 #endif
7458 0, /*tp_repr*/
7459 0, /*tp_as_number*/
7460 0, /*tp_as_sequence*/
7461 0, /*tp_as_mapping*/
7462 0, /*tp_hash*/
7463 __pyx_pw_4yarl_10_quoting_c_7_Quoter_3__call__, /*tp_call*/
7464 0, /*tp_str*/
7465 0, /*tp_getattro*/
7466 0, /*tp_setattro*/
7467 0, /*tp_as_buffer*/
7468 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
7469 0, /*tp_doc*/
7470 0, /*tp_traverse*/
7471 0, /*tp_clear*/
7472 0, /*tp_richcompare*/
7473 0, /*tp_weaklistoffset*/
7474 0, /*tp_iter*/
7475 0, /*tp_iternext*/
7476 __pyx_methods_4yarl_10_quoting_c__Quoter, /*tp_methods*/
7477 0, /*tp_members*/
7478 0, /*tp_getset*/
7479 0, /*tp_base*/
7480 0, /*tp_dict*/
7481 0, /*tp_descr_get*/
7482 0, /*tp_descr_set*/
7483 0, /*tp_dictoffset*/
7484 __pyx_pw_4yarl_10_quoting_c_7_Quoter_1__init__, /*tp_init*/
7485 0, /*tp_alloc*/
7486 __pyx_tp_new_4yarl_10_quoting_c__Quoter, /*tp_new*/
7487 0, /*tp_free*/
7488 0, /*tp_is_gc*/
7489 0, /*tp_bases*/
7490 0, /*tp_mro*/
7491 0, /*tp_cache*/
7492 0, /*tp_subclasses*/
7493 0, /*tp_weaklist*/
7494 0, /*tp_del*/
7495 0, /*tp_version_tag*/
7496 #if PY_VERSION_HEX >= 0x030400a1
7497 0, /*tp_finalize*/
7498 #endif
7499 #if PY_VERSION_HEX >= 0x030800b1
7500 0, /*tp_vectorcall*/
7501 #endif
7502 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
7503 0, /*tp_print*/
7504 #endif
7505 };
7506 static struct __pyx_vtabstruct_4yarl_10_quoting_c__Unquoter __pyx_vtable_4yarl_10_quoting_c__Unquoter;
7507
__pyx_tp_new_4yarl_10_quoting_c__Unquoter(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)7508 static PyObject *__pyx_tp_new_4yarl_10_quoting_c__Unquoter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
7509 struct __pyx_obj_4yarl_10_quoting_c__Unquoter *p;
7510 PyObject *o;
7511 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
7512 o = (*t->tp_alloc)(t, 0);
7513 } else {
7514 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
7515 }
7516 if (unlikely(!o)) return 0;
7517 p = ((struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)o);
7518 p->__pyx_vtab = __pyx_vtabptr_4yarl_10_quoting_c__Unquoter;
7519 p->_unsafe = ((PyObject*)Py_None); Py_INCREF(Py_None);
7520 p->_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)Py_None); Py_INCREF(Py_None);
7521 p->_qs_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)Py_None); Py_INCREF(Py_None);
7522 return o;
7523 }
7524
__pyx_tp_dealloc_4yarl_10_quoting_c__Unquoter(PyObject * o)7525 static void __pyx_tp_dealloc_4yarl_10_quoting_c__Unquoter(PyObject *o) {
7526 struct __pyx_obj_4yarl_10_quoting_c__Unquoter *p = (struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)o;
7527 #if CYTHON_USE_TP_FINALIZE
7528 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
7529 if (PyObject_CallFinalizerFromDealloc(o)) return;
7530 }
7531 #endif
7532 PyObject_GC_UnTrack(o);
7533 Py_CLEAR(p->_unsafe);
7534 Py_CLEAR(p->_quoter);
7535 Py_CLEAR(p->_qs_quoter);
7536 (*Py_TYPE(o)->tp_free)(o);
7537 }
7538
__pyx_tp_traverse_4yarl_10_quoting_c__Unquoter(PyObject * o,visitproc v,void * a)7539 static int __pyx_tp_traverse_4yarl_10_quoting_c__Unquoter(PyObject *o, visitproc v, void *a) {
7540 int e;
7541 struct __pyx_obj_4yarl_10_quoting_c__Unquoter *p = (struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)o;
7542 if (p->_quoter) {
7543 e = (*v)(((PyObject *)p->_quoter), a); if (e) return e;
7544 }
7545 if (p->_qs_quoter) {
7546 e = (*v)(((PyObject *)p->_qs_quoter), a); if (e) return e;
7547 }
7548 return 0;
7549 }
7550
__pyx_tp_clear_4yarl_10_quoting_c__Unquoter(PyObject * o)7551 static int __pyx_tp_clear_4yarl_10_quoting_c__Unquoter(PyObject *o) {
7552 PyObject* tmp;
7553 struct __pyx_obj_4yarl_10_quoting_c__Unquoter *p = (struct __pyx_obj_4yarl_10_quoting_c__Unquoter *)o;
7554 tmp = ((PyObject*)p->_quoter);
7555 p->_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)Py_None); Py_INCREF(Py_None);
7556 Py_XDECREF(tmp);
7557 tmp = ((PyObject*)p->_qs_quoter);
7558 p->_qs_quoter = ((struct __pyx_obj_4yarl_10_quoting_c__Quoter *)Py_None); Py_INCREF(Py_None);
7559 Py_XDECREF(tmp);
7560 return 0;
7561 }
7562
7563 static PyMethodDef __pyx_methods_4yarl_10_quoting_c__Unquoter[] = {
7564 {"__reduce_cython__", (PyCFunction)__pyx_pw_4yarl_10_quoting_c_9_Unquoter_5__reduce_cython__, METH_NOARGS, 0},
7565 {"__setstate_cython__", (PyCFunction)__pyx_pw_4yarl_10_quoting_c_9_Unquoter_7__setstate_cython__, METH_O, 0},
7566 {0, 0, 0, 0}
7567 };
7568
7569 static PyTypeObject __pyx_type_4yarl_10_quoting_c__Unquoter = {
7570 PyVarObject_HEAD_INIT(0, 0)
7571 "yarl._quoting_c._Unquoter", /*tp_name*/
7572 sizeof(struct __pyx_obj_4yarl_10_quoting_c__Unquoter), /*tp_basicsize*/
7573 0, /*tp_itemsize*/
7574 __pyx_tp_dealloc_4yarl_10_quoting_c__Unquoter, /*tp_dealloc*/
7575 #if PY_VERSION_HEX < 0x030800b4
7576 0, /*tp_print*/
7577 #endif
7578 #if PY_VERSION_HEX >= 0x030800b4
7579 0, /*tp_vectorcall_offset*/
7580 #endif
7581 0, /*tp_getattr*/
7582 0, /*tp_setattr*/
7583 #if PY_MAJOR_VERSION < 3
7584 0, /*tp_compare*/
7585 #endif
7586 #if PY_MAJOR_VERSION >= 3
7587 0, /*tp_as_async*/
7588 #endif
7589 0, /*tp_repr*/
7590 0, /*tp_as_number*/
7591 0, /*tp_as_sequence*/
7592 0, /*tp_as_mapping*/
7593 0, /*tp_hash*/
7594 __pyx_pw_4yarl_10_quoting_c_9_Unquoter_3__call__, /*tp_call*/
7595 0, /*tp_str*/
7596 0, /*tp_getattro*/
7597 0, /*tp_setattro*/
7598 0, /*tp_as_buffer*/
7599 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
7600 0, /*tp_doc*/
7601 __pyx_tp_traverse_4yarl_10_quoting_c__Unquoter, /*tp_traverse*/
7602 __pyx_tp_clear_4yarl_10_quoting_c__Unquoter, /*tp_clear*/
7603 0, /*tp_richcompare*/
7604 0, /*tp_weaklistoffset*/
7605 0, /*tp_iter*/
7606 0, /*tp_iternext*/
7607 __pyx_methods_4yarl_10_quoting_c__Unquoter, /*tp_methods*/
7608 0, /*tp_members*/
7609 0, /*tp_getset*/
7610 0, /*tp_base*/
7611 0, /*tp_dict*/
7612 0, /*tp_descr_get*/
7613 0, /*tp_descr_set*/
7614 0, /*tp_dictoffset*/
7615 __pyx_pw_4yarl_10_quoting_c_9_Unquoter_1__init__, /*tp_init*/
7616 0, /*tp_alloc*/
7617 __pyx_tp_new_4yarl_10_quoting_c__Unquoter, /*tp_new*/
7618 0, /*tp_free*/
7619 0, /*tp_is_gc*/
7620 0, /*tp_bases*/
7621 0, /*tp_mro*/
7622 0, /*tp_cache*/
7623 0, /*tp_subclasses*/
7624 0, /*tp_weaklist*/
7625 0, /*tp_del*/
7626 0, /*tp_version_tag*/
7627 #if PY_VERSION_HEX >= 0x030400a1
7628 0, /*tp_finalize*/
7629 #endif
7630 #if PY_VERSION_HEX >= 0x030800b1
7631 0, /*tp_vectorcall*/
7632 #endif
7633 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
7634 0, /*tp_print*/
7635 #endif
7636 };
7637
7638 static PyMethodDef __pyx_methods[] = {
7639 {0, 0, 0, 0}
7640 };
7641
7642 #if PY_MAJOR_VERSION >= 3
7643 #if CYTHON_PEP489_MULTI_PHASE_INIT
7644 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
7645 static int __pyx_pymod_exec__quoting_c(PyObject* module); /*proto*/
7646 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
7647 {Py_mod_create, (void*)__pyx_pymod_create},
7648 {Py_mod_exec, (void*)__pyx_pymod_exec__quoting_c},
7649 {0, NULL}
7650 };
7651 #endif
7652
7653 static struct PyModuleDef __pyx_moduledef = {
7654 PyModuleDef_HEAD_INIT,
7655 "_quoting_c",
7656 0, /* m_doc */
7657 #if CYTHON_PEP489_MULTI_PHASE_INIT
7658 0, /* m_size */
7659 #else
7660 -1, /* m_size */
7661 #endif
7662 __pyx_methods /* m_methods */,
7663 #if CYTHON_PEP489_MULTI_PHASE_INIT
7664 __pyx_moduledef_slots, /* m_slots */
7665 #else
7666 NULL, /* m_reload */
7667 #endif
7668 NULL, /* m_traverse */
7669 NULL, /* m_clear */
7670 NULL /* m_free */
7671 };
7672 #endif
7673 #ifndef CYTHON_SMALL_CODE
7674 #if defined(__clang__)
7675 #define CYTHON_SMALL_CODE
7676 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
7677 #define CYTHON_SMALL_CODE __attribute__((cold))
7678 #else
7679 #define CYTHON_SMALL_CODE
7680 #endif
7681 #endif
7682
7683 static __Pyx_StringTabEntry __pyx_string_tab[] = {
7684 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
7685 {&__pyx_kp_u_Argument_should_be_str, __pyx_k_Argument_should_be_str, sizeof(__pyx_k_Argument_should_be_str), 0, 1, 0, 0},
7686 {&__pyx_kp_s_Incompatible_checksums_s_vs_0x27, __pyx_k_Incompatible_checksums_s_vs_0x27, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x27), 0, 0, 1, 0},
7687 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xe9, __pyx_k_Incompatible_checksums_s_vs_0xe9, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xe9), 0, 0, 1, 0},
7688 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
7689 {&__pyx_kp_u_Only_safe_symbols_with_ORD_128_a, __pyx_k_Only_safe_symbols_with_ORD_128_a, sizeof(__pyx_k_Only_safe_symbols_with_ORD_128_a), 0, 1, 0, 0},
7690 {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
7691 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
7692 {&__pyx_n_s_Quoter, __pyx_k_Quoter, sizeof(__pyx_k_Quoter), 0, 0, 1, 1},
7693 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
7694 {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
7695 {&__pyx_n_s_Unquoter, __pyx_k_Unquoter, sizeof(__pyx_k_Unquoter), 0, 0, 1, 1},
7696 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
7697 {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
7698 {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
7699 {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
7700 {&__pyx_kp_u__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0, 0},
7701 {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
7702 {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0},
7703 {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0},
7704 {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0},
7705 {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
7706 {&__pyx_n_s_ascii_letters, __pyx_k_ascii_letters, sizeof(__pyx_k_ascii_letters), 0, 0, 1, 1},
7707 {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
7708 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
7709 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
7710 {&__pyx_n_s_digits, __pyx_k_digits, sizeof(__pyx_k_digits), 0, 0, 1, 1},
7711 {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
7712 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
7713 {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1},
7714 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
7715 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
7716 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
7717 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
7718 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
7719 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
7720 {&__pyx_n_s_protected, __pyx_k_protected, sizeof(__pyx_k_protected), 0, 0, 1, 1},
7721 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
7722 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
7723 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
7724 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
7725 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
7726 {&__pyx_n_s_pyx_unpickle__Quoter, __pyx_k_pyx_unpickle__Quoter, sizeof(__pyx_k_pyx_unpickle__Quoter), 0, 0, 1, 1},
7727 {&__pyx_n_s_pyx_unpickle__Unquoter, __pyx_k_pyx_unpickle__Unquoter, sizeof(__pyx_k_pyx_unpickle__Unquoter), 0, 0, 1, 1},
7728 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
7729 {&__pyx_n_s_qs, __pyx_k_qs, sizeof(__pyx_k_qs), 0, 0, 1, 1},
7730 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
7731 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
7732 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
7733 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
7734 {&__pyx_n_s_requote, __pyx_k_requote, sizeof(__pyx_k_requote), 0, 0, 1, 1},
7735 {&__pyx_n_s_safe, __pyx_k_safe, sizeof(__pyx_k_safe), 0, 0, 1, 1},
7736 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
7737 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
7738 {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
7739 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
7740 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
7741 {&__pyx_n_s_unsafe, __pyx_k_unsafe, sizeof(__pyx_k_unsafe), 0, 0, 1, 1},
7742 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
7743 {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
7744 {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
7745 {&__pyx_n_s_yarl__quoting_c, __pyx_k_yarl__quoting_c, sizeof(__pyx_k_yarl__quoting_c), 0, 0, 1, 1},
7746 {0, 0, 0, 0, 0, 0, 0}
7747 };
__Pyx_InitCachedBuiltins(void)7748 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
7749 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 70, __pyx_L1_error)
7750 __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 71, __pyx_L1_error)
7751 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 194, __pyx_L1_error)
7752 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 213, __pyx_L1_error)
7753 __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 320, __pyx_L1_error)
7754 __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 361, __pyx_L1_error)
7755 __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 81, __pyx_L1_error)
7756 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 84, __pyx_L1_error)
7757 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 94, __pyx_L1_error)
7758 return 0;
7759 __pyx_L1_error:;
7760 return -1;
7761 }
7762
__Pyx_InitCachedConstants(void)7763 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
7764 __Pyx_RefNannyDeclarations
7765 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
7766
7767 /* "yarl/_quoting_c.pyx":194
7768 * for ch in safe:
7769 * if ord(ch) > 127:
7770 * raise ValueError("Only safe symbols with ORD < 128 are allowed") # <<<<<<<<<<<<<<
7771 * set_bit(self._safe_table, ch)
7772 *
7773 */
7774 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Only_safe_symbols_with_ORD_128_a); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 194, __pyx_L1_error)
7775 __Pyx_GOTREF(__pyx_tuple__2);
7776 __Pyx_GIVEREF(__pyx_tuple__2);
7777
7778 /* "yarl/_quoting_c.pyx":213
7779 * val = str(val)
7780 * else:
7781 * raise TypeError("Argument should be str") # <<<<<<<<<<<<<<
7782 * _init_writer(&writer)
7783 * try:
7784 */
7785 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Argument_should_be_str); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 213, __pyx_L1_error)
7786 __Pyx_GOTREF(__pyx_tuple__3);
7787 __Pyx_GIVEREF(__pyx_tuple__3);
7788
7789 /* "yarl/_quoting_c.pyx":361
7790 * if ch in self._unsafe:
7791 * ret.append('%')
7792 * h = hex(ord(ch)).upper()[2:] # <<<<<<<<<<<<<<
7793 * for ch in h:
7794 * ret.append(ch)
7795 */
7796 __pyx_slice__8 = PySlice_New(__pyx_int_2, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 361, __pyx_L1_error)
7797 __Pyx_GOTREF(__pyx_slice__8);
7798 __Pyx_GIVEREF(__pyx_slice__8);
7799
7800 /* "(tree fragment)":1
7801 * def __pyx_unpickle__Quoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
7802 * cdef object __pyx_PickleError
7803 * cdef object __pyx_result
7804 */
7805 __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 1, __pyx_L1_error)
7806 __Pyx_GOTREF(__pyx_tuple__14);
7807 __Pyx_GIVEREF(__pyx_tuple__14);
7808 __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Quoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(1, 1, __pyx_L1_error)
7809 __pyx_tuple__16 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 1, __pyx_L1_error)
7810 __Pyx_GOTREF(__pyx_tuple__16);
7811 __Pyx_GIVEREF(__pyx_tuple__16);
7812 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle__Unquoter, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(1, 1, __pyx_L1_error)
7813 __Pyx_RefNannyFinishContext();
7814 return 0;
7815 __pyx_L1_error:;
7816 __Pyx_RefNannyFinishContext();
7817 return -1;
7818 }
7819
__Pyx_InitGlobals(void)7820 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
7821 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
7822 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
7823 __pyx_int_41310077 = PyInt_FromLong(41310077L); if (unlikely(!__pyx_int_41310077)) __PYX_ERR(0, 1, __pyx_L1_error)
7824 __pyx_int_244432181 = PyInt_FromLong(244432181L); if (unlikely(!__pyx_int_244432181)) __PYX_ERR(0, 1, __pyx_L1_error)
7825 return 0;
7826 __pyx_L1_error:;
7827 return -1;
7828 }
7829
7830 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
7831 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
7832 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
7833 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
7834 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
7835 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
7836 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
7837
__Pyx_modinit_global_init_code(void)7838 static int __Pyx_modinit_global_init_code(void) {
7839 __Pyx_RefNannyDeclarations
7840 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
7841 /*--- Global init code ---*/
7842 __pyx_v_4yarl_10_quoting_c_GEN_DELIMS = ((PyObject*)Py_None); Py_INCREF(Py_None);
7843 __pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS = ((PyObject*)Py_None); Py_INCREF(Py_None);
7844 __pyx_v_4yarl_10_quoting_c_SUB_DELIMS = ((PyObject*)Py_None); Py_INCREF(Py_None);
7845 __pyx_v_4yarl_10_quoting_c_RESERVED = ((PyObject*)Py_None); Py_INCREF(Py_None);
7846 __pyx_v_4yarl_10_quoting_c_UNRESERVED = ((PyObject*)Py_None); Py_INCREF(Py_None);
7847 __pyx_v_4yarl_10_quoting_c_ALLOWED = ((PyObject*)Py_None); Py_INCREF(Py_None);
7848 __pyx_v_4yarl_10_quoting_c_QS = ((PyObject*)Py_None); Py_INCREF(Py_None);
7849 __Pyx_RefNannyFinishContext();
7850 return 0;
7851 }
7852
__Pyx_modinit_variable_export_code(void)7853 static int __Pyx_modinit_variable_export_code(void) {
7854 __Pyx_RefNannyDeclarations
7855 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
7856 /*--- Variable export code ---*/
7857 __Pyx_RefNannyFinishContext();
7858 return 0;
7859 }
7860
__Pyx_modinit_function_export_code(void)7861 static int __Pyx_modinit_function_export_code(void) {
7862 __Pyx_RefNannyDeclarations
7863 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
7864 /*--- Function export code ---*/
7865 __Pyx_RefNannyFinishContext();
7866 return 0;
7867 }
7868
__Pyx_modinit_type_init_code(void)7869 static int __Pyx_modinit_type_init_code(void) {
7870 __Pyx_RefNannyDeclarations
7871 int __pyx_lineno = 0;
7872 const char *__pyx_filename = NULL;
7873 int __pyx_clineno = 0;
7874 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
7875 /*--- Type init code ---*/
7876 __pyx_vtabptr_4yarl_10_quoting_c__Quoter = &__pyx_vtable_4yarl_10_quoting_c__Quoter;
7877 __pyx_vtable_4yarl_10_quoting_c__Quoter._do_quote = (PyObject *(*)(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, PyObject *, struct __pyx_t_4yarl_10_quoting_c_Writer *))__pyx_f_4yarl_10_quoting_c_7_Quoter__do_quote;
7878 __pyx_vtable_4yarl_10_quoting_c__Quoter._write = (int (*)(struct __pyx_obj_4yarl_10_quoting_c__Quoter *, struct __pyx_t_4yarl_10_quoting_c_Writer *, Py_UCS4))__pyx_f_4yarl_10_quoting_c_7_Quoter__write;
7879 if (PyType_Ready(&__pyx_type_4yarl_10_quoting_c__Quoter) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
7880 #if PY_VERSION_HEX < 0x030800B1
7881 __pyx_type_4yarl_10_quoting_c__Quoter.tp_print = 0;
7882 #endif
7883 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4yarl_10_quoting_c__Quoter.tp_dictoffset && __pyx_type_4yarl_10_quoting_c__Quoter.tp_getattro == PyObject_GenericGetAttr)) {
7884 __pyx_type_4yarl_10_quoting_c__Quoter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
7885 }
7886 if (__Pyx_SetVtable(__pyx_type_4yarl_10_quoting_c__Quoter.tp_dict, __pyx_vtabptr_4yarl_10_quoting_c__Quoter) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
7887 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Quoter, (PyObject *)&__pyx_type_4yarl_10_quoting_c__Quoter) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
7888 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4yarl_10_quoting_c__Quoter) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
7889 __pyx_ptype_4yarl_10_quoting_c__Quoter = &__pyx_type_4yarl_10_quoting_c__Quoter;
7890 __pyx_vtabptr_4yarl_10_quoting_c__Unquoter = &__pyx_vtable_4yarl_10_quoting_c__Unquoter;
7891 __pyx_vtable_4yarl_10_quoting_c__Unquoter._do_unquote = (PyObject *(*)(struct __pyx_obj_4yarl_10_quoting_c__Unquoter *, PyObject *))__pyx_f_4yarl_10_quoting_c_9_Unquoter__do_unquote;
7892 if (PyType_Ready(&__pyx_type_4yarl_10_quoting_c__Unquoter) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
7893 #if PY_VERSION_HEX < 0x030800B1
7894 __pyx_type_4yarl_10_quoting_c__Unquoter.tp_print = 0;
7895 #endif
7896 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4yarl_10_quoting_c__Unquoter.tp_dictoffset && __pyx_type_4yarl_10_quoting_c__Unquoter.tp_getattro == PyObject_GenericGetAttr)) {
7897 __pyx_type_4yarl_10_quoting_c__Unquoter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
7898 }
7899 if (__Pyx_SetVtable(__pyx_type_4yarl_10_quoting_c__Unquoter.tp_dict, __pyx_vtabptr_4yarl_10_quoting_c__Unquoter) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
7900 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Unquoter, (PyObject *)&__pyx_type_4yarl_10_quoting_c__Unquoter) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
7901 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4yarl_10_quoting_c__Unquoter) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
7902 __pyx_ptype_4yarl_10_quoting_c__Unquoter = &__pyx_type_4yarl_10_quoting_c__Unquoter;
7903 __Pyx_RefNannyFinishContext();
7904 return 0;
7905 __pyx_L1_error:;
7906 __Pyx_RefNannyFinishContext();
7907 return -1;
7908 }
7909
__Pyx_modinit_type_import_code(void)7910 static int __Pyx_modinit_type_import_code(void) {
7911 __Pyx_RefNannyDeclarations
7912 PyObject *__pyx_t_1 = NULL;
7913 int __pyx_lineno = 0;
7914 const char *__pyx_filename = NULL;
7915 int __pyx_clineno = 0;
7916 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
7917 /*--- Type import code ---*/
7918 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
7919 __Pyx_GOTREF(__pyx_t_1);
7920 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
7921 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
7922 sizeof(PyTypeObject),
7923 #else
7924 sizeof(PyHeapTypeObject),
7925 #endif
7926 __Pyx_ImportType_CheckSize_Warn);
7927 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
7928 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7929 __Pyx_RefNannyFinishContext();
7930 return 0;
7931 __pyx_L1_error:;
7932 __Pyx_XDECREF(__pyx_t_1);
7933 __Pyx_RefNannyFinishContext();
7934 return -1;
7935 }
7936
__Pyx_modinit_variable_import_code(void)7937 static int __Pyx_modinit_variable_import_code(void) {
7938 __Pyx_RefNannyDeclarations
7939 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
7940 /*--- Variable import code ---*/
7941 __Pyx_RefNannyFinishContext();
7942 return 0;
7943 }
7944
__Pyx_modinit_function_import_code(void)7945 static int __Pyx_modinit_function_import_code(void) {
7946 __Pyx_RefNannyDeclarations
7947 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
7948 /*--- Function import code ---*/
7949 __Pyx_RefNannyFinishContext();
7950 return 0;
7951 }
7952
7953
7954 #ifndef CYTHON_NO_PYINIT_EXPORT
7955 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
7956 #elif PY_MAJOR_VERSION < 3
7957 #ifdef __cplusplus
7958 #define __Pyx_PyMODINIT_FUNC extern "C" void
7959 #else
7960 #define __Pyx_PyMODINIT_FUNC void
7961 #endif
7962 #else
7963 #ifdef __cplusplus
7964 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
7965 #else
7966 #define __Pyx_PyMODINIT_FUNC PyObject *
7967 #endif
7968 #endif
7969
7970
7971 #if PY_MAJOR_VERSION < 3
7972 __Pyx_PyMODINIT_FUNC init_quoting_c(void) CYTHON_SMALL_CODE; /*proto*/
init_quoting_c(void)7973 __Pyx_PyMODINIT_FUNC init_quoting_c(void)
7974 #else
7975 __Pyx_PyMODINIT_FUNC PyInit__quoting_c(void) CYTHON_SMALL_CODE; /*proto*/
7976 __Pyx_PyMODINIT_FUNC PyInit__quoting_c(void)
7977 #if CYTHON_PEP489_MULTI_PHASE_INIT
7978 {
7979 return PyModuleDef_Init(&__pyx_moduledef);
7980 }
7981 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
7982 #if PY_VERSION_HEX >= 0x030700A1
7983 static PY_INT64_T main_interpreter_id = -1;
7984 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
7985 if (main_interpreter_id == -1) {
7986 main_interpreter_id = current_id;
7987 return (unlikely(current_id == -1)) ? -1 : 0;
7988 } else if (unlikely(main_interpreter_id != current_id))
7989 #else
7990 static PyInterpreterState *main_interpreter = NULL;
7991 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
7992 if (!main_interpreter) {
7993 main_interpreter = current_interpreter;
7994 } else if (unlikely(main_interpreter != current_interpreter))
7995 #endif
7996 {
7997 PyErr_SetString(
7998 PyExc_ImportError,
7999 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
8000 return -1;
8001 }
8002 return 0;
8003 }
8004 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) {
8005 PyObject *value = PyObject_GetAttrString(spec, from_name);
8006 int result = 0;
8007 if (likely(value)) {
8008 if (allow_none || value != Py_None) {
8009 result = PyDict_SetItemString(moddict, to_name, value);
8010 }
8011 Py_DECREF(value);
8012 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
8013 PyErr_Clear();
8014 } else {
8015 result = -1;
8016 }
8017 return result;
8018 }
8019 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
8020 PyObject *module = NULL, *moddict, *modname;
8021 if (__Pyx_check_single_interpreter())
8022 return NULL;
8023 if (__pyx_m)
8024 return __Pyx_NewRef(__pyx_m);
8025 modname = PyObject_GetAttrString(spec, "name");
8026 if (unlikely(!modname)) goto bad;
8027 module = PyModule_NewObject(modname);
8028 Py_DECREF(modname);
8029 if (unlikely(!module)) goto bad;
8030 moddict = PyModule_GetDict(module);
8031 if (unlikely(!moddict)) goto bad;
8032 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
8033 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
8034 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
8035 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
8036 return module;
8037 bad:
8038 Py_XDECREF(module);
8039 return NULL;
8040 }
8041
8042
8043 static CYTHON_SMALL_CODE int __pyx_pymod_exec__quoting_c(PyObject *__pyx_pyinit_module)
8044 #endif
8045 #endif
8046 {
8047 PyObject *__pyx_t_1 = NULL;
8048 PyObject *__pyx_t_2 = NULL;
8049 PyObject *__pyx_t_3 = NULL;
8050 long __pyx_t_4;
8051 int __pyx_t_5;
8052 int __pyx_t_6;
8053 uint64_t __pyx_t_7;
8054 int __pyx_lineno = 0;
8055 const char *__pyx_filename = NULL;
8056 int __pyx_clineno = 0;
8057 __Pyx_RefNannyDeclarations
8058 #if CYTHON_PEP489_MULTI_PHASE_INIT
8059 if (__pyx_m) {
8060 if (__pyx_m == __pyx_pyinit_module) return 0;
8061 PyErr_SetString(PyExc_RuntimeError, "Module '_quoting_c' has already been imported. Re-initialisation is not supported.");
8062 return -1;
8063 }
8064 #elif PY_MAJOR_VERSION >= 3
8065 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
8066 #endif
8067 #if CYTHON_REFNANNY
8068 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8069 if (!__Pyx_RefNanny) {
8070 PyErr_Clear();
8071 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8072 if (!__Pyx_RefNanny)
8073 Py_FatalError("failed to import 'refnanny' module");
8074 }
8075 #endif
8076 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__quoting_c(void)", 0);
8077 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8078 #ifdef __Pxy_PyFrame_Initialize_Offsets
8079 __Pxy_PyFrame_Initialize_Offsets();
8080 #endif
8081 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
8082 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
8083 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
8084 #ifdef __Pyx_CyFunction_USED
8085 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8086 #endif
8087 #ifdef __Pyx_FusedFunction_USED
8088 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8089 #endif
8090 #ifdef __Pyx_Coroutine_USED
8091 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8092 #endif
8093 #ifdef __Pyx_Generator_USED
8094 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8095 #endif
8096 #ifdef __Pyx_AsyncGen_USED
8097 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8098 #endif
8099 #ifdef __Pyx_StopAsyncIteration_USED
8100 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8101 #endif
8102 /*--- Library function declarations ---*/
8103 /*--- Threads initialization code ---*/
8104 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
8105 PyEval_InitThreads();
8106 #endif
8107 /*--- Module creation code ---*/
8108 #if CYTHON_PEP489_MULTI_PHASE_INIT
8109 __pyx_m = __pyx_pyinit_module;
8110 Py_INCREF(__pyx_m);
8111 #else
8112 #if PY_MAJOR_VERSION < 3
8113 __pyx_m = Py_InitModule4("_quoting_c", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
8114 #else
8115 __pyx_m = PyModule_Create(&__pyx_moduledef);
8116 #endif
8117 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
8118 #endif
8119 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
8120 Py_INCREF(__pyx_d);
8121 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
8122 Py_INCREF(__pyx_b);
8123 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
8124 Py_INCREF(__pyx_cython_runtime);
8125 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8126 /*--- Initialize various global constants etc. ---*/
8127 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8128 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
8129 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8130 #endif
8131 if (__pyx_module_is_main_yarl___quoting_c) {
8132 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8133 }
8134 #if PY_MAJOR_VERSION >= 3
8135 {
8136 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
8137 if (!PyDict_GetItemString(modules, "yarl._quoting_c")) {
8138 if (unlikely(PyDict_SetItemString(modules, "yarl._quoting_c", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8139 }
8140 }
8141 #endif
8142 /*--- Builtin init code ---*/
8143 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8144 /*--- Constants init code ---*/
8145 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8146 /*--- Global type/function init code ---*/
8147 (void)__Pyx_modinit_global_init_code();
8148 (void)__Pyx_modinit_variable_export_code();
8149 (void)__Pyx_modinit_function_export_code();
8150 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8151 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8152 (void)__Pyx_modinit_variable_import_code();
8153 (void)__Pyx_modinit_function_import_code();
8154 /*--- Execution code ---*/
8155 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
8156 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8157 #endif
8158
8159 /* "yarl/_quoting_c.pyx":10
8160 * from cpython.unicode cimport PyUnicode_DecodeASCII, PyUnicode_DecodeUTF8Stateful
8161 *
8162 * from string import ascii_letters, digits # <<<<<<<<<<<<<<
8163 *
8164 * cdef str GEN_DELIMS = ":/?#[]@"
8165 */
8166 __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
8167 __Pyx_GOTREF(__pyx_t_1);
8168 __Pyx_INCREF(__pyx_n_s_ascii_letters);
8169 __Pyx_GIVEREF(__pyx_n_s_ascii_letters);
8170 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ascii_letters);
8171 __Pyx_INCREF(__pyx_n_s_digits);
8172 __Pyx_GIVEREF(__pyx_n_s_digits);
8173 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_digits);
8174 __pyx_t_2 = __Pyx_Import(__pyx_n_s_string, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
8175 __Pyx_GOTREF(__pyx_t_2);
8176 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8177 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ascii_letters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
8178 __Pyx_GOTREF(__pyx_t_1);
8179 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ascii_letters, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
8180 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8181 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_digits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
8182 __Pyx_GOTREF(__pyx_t_1);
8183 if (PyDict_SetItem(__pyx_d, __pyx_n_s_digits, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
8184 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8185 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8186
8187 /* "yarl/_quoting_c.pyx":12
8188 * from string import ascii_letters, digits
8189 *
8190 * cdef str GEN_DELIMS = ":/?#[]@" # <<<<<<<<<<<<<<
8191 * cdef str SUB_DELIMS_WITHOUT_QS = "!$'()*,"
8192 * cdef str SUB_DELIMS = SUB_DELIMS_WITHOUT_QS + '+?=;'
8193 */
8194 __Pyx_INCREF(__pyx_kp_u__9);
8195 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_GEN_DELIMS);
8196 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_GEN_DELIMS, __pyx_kp_u__9);
8197 __Pyx_GIVEREF(__pyx_kp_u__9);
8198
8199 /* "yarl/_quoting_c.pyx":13
8200 *
8201 * cdef str GEN_DELIMS = ":/?#[]@"
8202 * cdef str SUB_DELIMS_WITHOUT_QS = "!$'()*," # <<<<<<<<<<<<<<
8203 * cdef str SUB_DELIMS = SUB_DELIMS_WITHOUT_QS + '+?=;'
8204 * cdef str RESERVED = GEN_DELIMS + SUB_DELIMS
8205 */
8206 __Pyx_INCREF(__pyx_kp_u__10);
8207 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS);
8208 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS, __pyx_kp_u__10);
8209 __Pyx_GIVEREF(__pyx_kp_u__10);
8210
8211 /* "yarl/_quoting_c.pyx":14
8212 * cdef str GEN_DELIMS = ":/?#[]@"
8213 * cdef str SUB_DELIMS_WITHOUT_QS = "!$'()*,"
8214 * cdef str SUB_DELIMS = SUB_DELIMS_WITHOUT_QS + '+?=;' # <<<<<<<<<<<<<<
8215 * cdef str RESERVED = GEN_DELIMS + SUB_DELIMS
8216 * cdef str UNRESERVED = ascii_letters + digits + '-._~'
8217 */
8218 __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS, __pyx_kp_u__11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
8219 __Pyx_GOTREF(__pyx_t_2);
8220 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_SUB_DELIMS);
8221 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_SUB_DELIMS, ((PyObject*)__pyx_t_2));
8222 __Pyx_GIVEREF(__pyx_t_2);
8223 __pyx_t_2 = 0;
8224
8225 /* "yarl/_quoting_c.pyx":15
8226 * cdef str SUB_DELIMS_WITHOUT_QS = "!$'()*,"
8227 * cdef str SUB_DELIMS = SUB_DELIMS_WITHOUT_QS + '+?=;'
8228 * cdef str RESERVED = GEN_DELIMS + SUB_DELIMS # <<<<<<<<<<<<<<
8229 * cdef str UNRESERVED = ascii_letters + digits + '-._~'
8230 * cdef str ALLOWED = UNRESERVED + SUB_DELIMS_WITHOUT_QS
8231 */
8232 __pyx_t_2 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_4yarl_10_quoting_c_GEN_DELIMS, __pyx_v_4yarl_10_quoting_c_SUB_DELIMS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
8233 __Pyx_GOTREF(__pyx_t_2);
8234 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_RESERVED);
8235 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_RESERVED, ((PyObject*)__pyx_t_2));
8236 __Pyx_GIVEREF(__pyx_t_2);
8237 __pyx_t_2 = 0;
8238
8239 /* "yarl/_quoting_c.pyx":16
8240 * cdef str SUB_DELIMS = SUB_DELIMS_WITHOUT_QS + '+?=;'
8241 * cdef str RESERVED = GEN_DELIMS + SUB_DELIMS
8242 * cdef str UNRESERVED = ascii_letters + digits + '-._~' # <<<<<<<<<<<<<<
8243 * cdef str ALLOWED = UNRESERVED + SUB_DELIMS_WITHOUT_QS
8244 * cdef str QS = '+&=;'
8245 */
8246 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ascii_letters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
8247 __Pyx_GOTREF(__pyx_t_2);
8248 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_digits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
8249 __Pyx_GOTREF(__pyx_t_1);
8250 __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
8251 __Pyx_GOTREF(__pyx_t_3);
8252 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8253 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8254 __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_kp_u__12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
8255 __Pyx_GOTREF(__pyx_t_1);
8256 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8257 if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 16, __pyx_L1_error)
8258 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_UNRESERVED);
8259 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_UNRESERVED, ((PyObject*)__pyx_t_1));
8260 __Pyx_GIVEREF(__pyx_t_1);
8261 __pyx_t_1 = 0;
8262
8263 /* "yarl/_quoting_c.pyx":17
8264 * cdef str RESERVED = GEN_DELIMS + SUB_DELIMS
8265 * cdef str UNRESERVED = ascii_letters + digits + '-._~'
8266 * cdef str ALLOWED = UNRESERVED + SUB_DELIMS_WITHOUT_QS # <<<<<<<<<<<<<<
8267 * cdef str QS = '+&=;'
8268 *
8269 */
8270 __pyx_t_1 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_4yarl_10_quoting_c_UNRESERVED, __pyx_v_4yarl_10_quoting_c_SUB_DELIMS_WITHOUT_QS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
8271 __Pyx_GOTREF(__pyx_t_1);
8272 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_ALLOWED);
8273 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_ALLOWED, ((PyObject*)__pyx_t_1));
8274 __Pyx_GIVEREF(__pyx_t_1);
8275 __pyx_t_1 = 0;
8276
8277 /* "yarl/_quoting_c.pyx":18
8278 * cdef str UNRESERVED = ascii_letters + digits + '-._~'
8279 * cdef str ALLOWED = UNRESERVED + SUB_DELIMS_WITHOUT_QS
8280 * cdef str QS = '+&=;' # <<<<<<<<<<<<<<
8281 *
8282 * DEF BUF_SIZE = 8 * 1024 # 8KiB
8283 */
8284 __Pyx_INCREF(__pyx_kp_u__13);
8285 __Pyx_XGOTREF(__pyx_v_4yarl_10_quoting_c_QS);
8286 __Pyx_DECREF_SET(__pyx_v_4yarl_10_quoting_c_QS, __pyx_kp_u__13);
8287 __Pyx_GIVEREF(__pyx_kp_u__13);
8288
8289 /* "yarl/_quoting_c.pyx":67
8290 *
8291 *
8292 * memset(ALLOWED_TABLE, 0, sizeof(ALLOWED_TABLE)) # <<<<<<<<<<<<<<
8293 * memset(ALLOWED_NOTQS_TABLE, 0, sizeof(ALLOWED_NOTQS_TABLE))
8294 *
8295 */
8296 (void)(memset(__pyx_v_4yarl_10_quoting_c_ALLOWED_TABLE, 0, (sizeof(__pyx_v_4yarl_10_quoting_c_ALLOWED_TABLE))));
8297
8298 /* "yarl/_quoting_c.pyx":68
8299 *
8300 * memset(ALLOWED_TABLE, 0, sizeof(ALLOWED_TABLE))
8301 * memset(ALLOWED_NOTQS_TABLE, 0, sizeof(ALLOWED_NOTQS_TABLE)) # <<<<<<<<<<<<<<
8302 *
8303 * for i in range(128):
8304 */
8305 (void)(memset(__pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE, 0, (sizeof(__pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE))));
8306
8307 /* "yarl/_quoting_c.pyx":70
8308 * memset(ALLOWED_NOTQS_TABLE, 0, sizeof(ALLOWED_NOTQS_TABLE))
8309 *
8310 * for i in range(128): # <<<<<<<<<<<<<<
8311 * if chr(i) in ALLOWED:
8312 * set_bit(ALLOWED_TABLE, i)
8313 */
8314 for (__pyx_t_4 = 0; __pyx_t_4 < 0x80; __pyx_t_4+=1) {
8315 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
8316 __Pyx_GOTREF(__pyx_t_1);
8317 if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
8318 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8319
8320 /* "yarl/_quoting_c.pyx":71
8321 *
8322 * for i in range(128):
8323 * if chr(i) in ALLOWED: # <<<<<<<<<<<<<<
8324 * set_bit(ALLOWED_TABLE, i)
8325 * set_bit(ALLOWED_NOTQS_TABLE, i)
8326 */
8327 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
8328 __Pyx_GOTREF(__pyx_t_1);
8329 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
8330 __Pyx_GOTREF(__pyx_t_3);
8331 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8332 if (unlikely(__pyx_v_4yarl_10_quoting_c_ALLOWED == Py_None)) {
8333 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8334 __PYX_ERR(0, 71, __pyx_L1_error)
8335 }
8336 __pyx_t_5 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_3, __pyx_v_4yarl_10_quoting_c_ALLOWED, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 71, __pyx_L1_error)
8337 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8338 __pyx_t_6 = (__pyx_t_5 != 0);
8339 if (__pyx_t_6) {
8340
8341 /* "yarl/_quoting_c.pyx":72
8342 * for i in range(128):
8343 * if chr(i) in ALLOWED:
8344 * set_bit(ALLOWED_TABLE, i) # <<<<<<<<<<<<<<
8345 * set_bit(ALLOWED_NOTQS_TABLE, i)
8346 * if chr(i) in QS:
8347 */
8348 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
8349 __Pyx_GOTREF(__pyx_t_3);
8350 __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
8351 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8352 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_4yarl_10_quoting_c_ALLOWED_TABLE, __pyx_t_7);
8353
8354 /* "yarl/_quoting_c.pyx":73
8355 * if chr(i) in ALLOWED:
8356 * set_bit(ALLOWED_TABLE, i)
8357 * set_bit(ALLOWED_NOTQS_TABLE, i) # <<<<<<<<<<<<<<
8358 * if chr(i) in QS:
8359 * set_bit(ALLOWED_NOTQS_TABLE, i)
8360 */
8361 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
8362 __Pyx_GOTREF(__pyx_t_3);
8363 __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error)
8364 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8365 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE, __pyx_t_7);
8366
8367 /* "yarl/_quoting_c.pyx":71
8368 *
8369 * for i in range(128):
8370 * if chr(i) in ALLOWED: # <<<<<<<<<<<<<<
8371 * set_bit(ALLOWED_TABLE, i)
8372 * set_bit(ALLOWED_NOTQS_TABLE, i)
8373 */
8374 }
8375
8376 /* "yarl/_quoting_c.pyx":74
8377 * set_bit(ALLOWED_TABLE, i)
8378 * set_bit(ALLOWED_NOTQS_TABLE, i)
8379 * if chr(i) in QS: # <<<<<<<<<<<<<<
8380 * set_bit(ALLOWED_NOTQS_TABLE, i)
8381 *
8382 */
8383 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
8384 __Pyx_GOTREF(__pyx_t_3);
8385 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
8386 __Pyx_GOTREF(__pyx_t_1);
8387 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8388 if (unlikely(__pyx_v_4yarl_10_quoting_c_QS == Py_None)) {
8389 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8390 __PYX_ERR(0, 74, __pyx_L1_error)
8391 }
8392 __pyx_t_6 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_1, __pyx_v_4yarl_10_quoting_c_QS, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 74, __pyx_L1_error)
8393 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8394 __pyx_t_5 = (__pyx_t_6 != 0);
8395 if (__pyx_t_5) {
8396
8397 /* "yarl/_quoting_c.pyx":75
8398 * set_bit(ALLOWED_NOTQS_TABLE, i)
8399 * if chr(i) in QS:
8400 * set_bit(ALLOWED_NOTQS_TABLE, i) # <<<<<<<<<<<<<<
8401 *
8402 * # ----------------- writer ---------------------------
8403 */
8404 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
8405 __Pyx_GOTREF(__pyx_t_1);
8406 __pyx_t_7 = __Pyx_PyInt_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
8407 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8408 __pyx_f_4yarl_10_quoting_c_set_bit(__pyx_v_4yarl_10_quoting_c_ALLOWED_NOTQS_TABLE, __pyx_t_7);
8409
8410 /* "yarl/_quoting_c.pyx":74
8411 * set_bit(ALLOWED_TABLE, i)
8412 * set_bit(ALLOWED_NOTQS_TABLE, i)
8413 * if chr(i) in QS: # <<<<<<<<<<<<<<
8414 * set_bit(ALLOWED_NOTQS_TABLE, i)
8415 *
8416 */
8417 }
8418 }
8419
8420 /* "(tree fragment)":1
8421 * def __pyx_unpickle__Quoter(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
8422 * cdef object __pyx_PickleError
8423 * cdef object __pyx_result
8424 */
8425 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4yarl_10_quoting_c_1__pyx_unpickle__Quoter, NULL, __pyx_n_s_yarl__quoting_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
8426 __Pyx_GOTREF(__pyx_t_1);
8427 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__Quoter, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
8428 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8429
8430 /* "(tree fragment)":11
8431 * __pyx_unpickle__Quoter__set_state(<_Quoter> __pyx_result, __pyx_state)
8432 * return __pyx_result
8433 * cdef __pyx_unpickle__Quoter__set_state(_Quoter __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
8434 * __pyx_result._protected_table = __pyx_state[0]; __pyx_result._qs = __pyx_state[1]; __pyx_result._requote = __pyx_state[2]; __pyx_result._safe_table = __pyx_state[3]
8435 * if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
8436 */
8437 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4yarl_10_quoting_c_3__pyx_unpickle__Unquoter, NULL, __pyx_n_s_yarl__quoting_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
8438 __Pyx_GOTREF(__pyx_t_1);
8439 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle__Unquoter, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
8440 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8441
8442 /* "yarl/_quoting_c.pyx":1
8443 * # cython: language_level=3 # <<<<<<<<<<<<<<
8444 *
8445 * from libc.stdint cimport uint8_t, uint64_t
8446 */
8447 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
8448 __Pyx_GOTREF(__pyx_t_1);
8449 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8450 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8451
8452 /* "carray.from_py":77
8453 *
8454 * @cname("__Pyx_carray_from_py_uint8_t")
8455 * cdef int __Pyx_carray_from_py_uint8_t(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<<
8456 * cdef Py_ssize_t i = length
8457 * try:
8458 */
8459
8460 /*--- Wrapped vars code ---*/
8461
8462 goto __pyx_L0;
8463 __pyx_L1_error:;
8464 __Pyx_XDECREF(__pyx_t_1);
8465 __Pyx_XDECREF(__pyx_t_2);
8466 __Pyx_XDECREF(__pyx_t_3);
8467 if (__pyx_m) {
8468 if (__pyx_d) {
8469 __Pyx_AddTraceback("init yarl._quoting_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
8470 }
8471 Py_CLEAR(__pyx_m);
8472 } else if (!PyErr_Occurred()) {
8473 PyErr_SetString(PyExc_ImportError, "init yarl._quoting_c");
8474 }
8475 __pyx_L0:;
8476 __Pyx_RefNannyFinishContext();
8477 #if CYTHON_PEP489_MULTI_PHASE_INIT
8478 return (__pyx_m != NULL) ? 0 : -1;
8479 #elif PY_MAJOR_VERSION >= 3
8480 return __pyx_m;
8481 #else
8482 return;
8483 #endif
8484 }
8485
8486 /* --- Runtime support code --- */
8487 /* Refnanny */
8488 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)8489 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
8490 PyObject *m = NULL, *p = NULL;
8491 void *r = NULL;
8492 m = PyImport_ImportModule(modname);
8493 if (!m) goto end;
8494 p = PyObject_GetAttrString(m, "RefNannyAPI");
8495 if (!p) goto end;
8496 r = PyLong_AsVoidPtr(p);
8497 end:
8498 Py_XDECREF(p);
8499 Py_XDECREF(m);
8500 return (__Pyx_RefNannyAPIStruct *)r;
8501 }
8502 #endif
8503
8504 /* PyObjectGetAttrStr */
8505 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)8506 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
8507 PyTypeObject* tp = Py_TYPE(obj);
8508 if (likely(tp->tp_getattro))
8509 return tp->tp_getattro(obj, attr_name);
8510 #if PY_MAJOR_VERSION < 3
8511 if (likely(tp->tp_getattr))
8512 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
8513 #endif
8514 return PyObject_GetAttr(obj, attr_name);
8515 }
8516 #endif
8517
8518 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)8519 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
8520 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
8521 if (unlikely(!result)) {
8522 PyErr_Format(PyExc_NameError,
8523 #if PY_MAJOR_VERSION >= 3
8524 "name '%U' is not defined", name);
8525 #else
8526 "name '%.200s' is not defined", PyString_AS_STRING(name));
8527 #endif
8528 }
8529 return result;
8530 }
8531
8532 /* PyErrFetchRestore */
8533 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)8534 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
8535 PyObject *tmp_type, *tmp_value, *tmp_tb;
8536 tmp_type = tstate->curexc_type;
8537 tmp_value = tstate->curexc_value;
8538 tmp_tb = tstate->curexc_traceback;
8539 tstate->curexc_type = type;
8540 tstate->curexc_value = value;
8541 tstate->curexc_traceback = tb;
8542 Py_XDECREF(tmp_type);
8543 Py_XDECREF(tmp_value);
8544 Py_XDECREF(tmp_tb);
8545 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8546 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
8547 *type = tstate->curexc_type;
8548 *value = tstate->curexc_value;
8549 *tb = tstate->curexc_traceback;
8550 tstate->curexc_type = 0;
8551 tstate->curexc_value = 0;
8552 tstate->curexc_traceback = 0;
8553 }
8554 #endif
8555
8556 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)8557 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
8558 CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
8559 int full_traceback, CYTHON_UNUSED int nogil) {
8560 PyObject *old_exc, *old_val, *old_tb;
8561 PyObject *ctx;
8562 __Pyx_PyThreadState_declare
8563 #ifdef WITH_THREAD
8564 PyGILState_STATE state;
8565 if (nogil)
8566 state = PyGILState_Ensure();
8567 #ifdef _MSC_VER
8568 else state = (PyGILState_STATE)-1;
8569 #endif
8570 #endif
8571 __Pyx_PyThreadState_assign
8572 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
8573 if (full_traceback) {
8574 Py_XINCREF(old_exc);
8575 Py_XINCREF(old_val);
8576 Py_XINCREF(old_tb);
8577 __Pyx_ErrRestore(old_exc, old_val, old_tb);
8578 PyErr_PrintEx(1);
8579 }
8580 #if PY_MAJOR_VERSION < 3
8581 ctx = PyString_FromString(name);
8582 #else
8583 ctx = PyUnicode_FromString(name);
8584 #endif
8585 __Pyx_ErrRestore(old_exc, old_val, old_tb);
8586 if (!ctx) {
8587 PyErr_WriteUnraisable(Py_None);
8588 } else {
8589 PyErr_WriteUnraisable(ctx);
8590 Py_DECREF(ctx);
8591 }
8592 #ifdef WITH_THREAD
8593 if (nogil)
8594 PyGILState_Release(state);
8595 #endif
8596 }
8597
8598 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)8599 static void __Pyx_RaiseDoubleKeywordsError(
8600 const char* func_name,
8601 PyObject* kw_name)
8602 {
8603 PyErr_Format(PyExc_TypeError,
8604 #if PY_MAJOR_VERSION >= 3
8605 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
8606 #else
8607 "%s() got multiple values for keyword argument '%s'", func_name,
8608 PyString_AsString(kw_name));
8609 #endif
8610 }
8611
8612 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)8613 static int __Pyx_ParseOptionalKeywords(
8614 PyObject *kwds,
8615 PyObject **argnames[],
8616 PyObject *kwds2,
8617 PyObject *values[],
8618 Py_ssize_t num_pos_args,
8619 const char* function_name)
8620 {
8621 PyObject *key = 0, *value = 0;
8622 Py_ssize_t pos = 0;
8623 PyObject*** name;
8624 PyObject*** first_kw_arg = argnames + num_pos_args;
8625 while (PyDict_Next(kwds, &pos, &key, &value)) {
8626 name = first_kw_arg;
8627 while (*name && (**name != key)) name++;
8628 if (*name) {
8629 values[name-argnames] = value;
8630 continue;
8631 }
8632 name = first_kw_arg;
8633 #if PY_MAJOR_VERSION < 3
8634 if (likely(PyString_Check(key))) {
8635 while (*name) {
8636 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
8637 && _PyString_Eq(**name, key)) {
8638 values[name-argnames] = value;
8639 break;
8640 }
8641 name++;
8642 }
8643 if (*name) continue;
8644 else {
8645 PyObject*** argname = argnames;
8646 while (argname != first_kw_arg) {
8647 if ((**argname == key) || (
8648 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
8649 && _PyString_Eq(**argname, key))) {
8650 goto arg_passed_twice;
8651 }
8652 argname++;
8653 }
8654 }
8655 } else
8656 #endif
8657 if (likely(PyUnicode_Check(key))) {
8658 while (*name) {
8659 int cmp = (**name == key) ? 0 :
8660 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8661 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
8662 #endif
8663 PyUnicode_Compare(**name, key);
8664 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8665 if (cmp == 0) {
8666 values[name-argnames] = value;
8667 break;
8668 }
8669 name++;
8670 }
8671 if (*name) continue;
8672 else {
8673 PyObject*** argname = argnames;
8674 while (argname != first_kw_arg) {
8675 int cmp = (**argname == key) ? 0 :
8676 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8677 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
8678 #endif
8679 PyUnicode_Compare(**argname, key);
8680 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8681 if (cmp == 0) goto arg_passed_twice;
8682 argname++;
8683 }
8684 }
8685 } else
8686 goto invalid_keyword_type;
8687 if (kwds2) {
8688 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
8689 } else {
8690 goto invalid_keyword;
8691 }
8692 }
8693 return 0;
8694 arg_passed_twice:
8695 __Pyx_RaiseDoubleKeywordsError(function_name, key);
8696 goto bad;
8697 invalid_keyword_type:
8698 PyErr_Format(PyExc_TypeError,
8699 "%.200s() keywords must be strings", function_name);
8700 goto bad;
8701 invalid_keyword:
8702 PyErr_Format(PyExc_TypeError,
8703 #if PY_MAJOR_VERSION < 3
8704 "%.200s() got an unexpected keyword argument '%.200s'",
8705 function_name, PyString_AsString(key));
8706 #else
8707 "%s() got an unexpected keyword argument '%U'",
8708 function_name, key);
8709 #endif
8710 bad:
8711 return -1;
8712 }
8713
8714 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)8715 static void __Pyx_RaiseArgtupleInvalid(
8716 const char* func_name,
8717 int exact,
8718 Py_ssize_t num_min,
8719 Py_ssize_t num_max,
8720 Py_ssize_t num_found)
8721 {
8722 Py_ssize_t num_expected;
8723 const char *more_or_less;
8724 if (num_found < num_min) {
8725 num_expected = num_min;
8726 more_or_less = "at least";
8727 } else {
8728 num_expected = num_max;
8729 more_or_less = "at most";
8730 }
8731 if (exact) {
8732 more_or_less = "exactly";
8733 }
8734 PyErr_Format(PyExc_TypeError,
8735 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
8736 func_name, more_or_less, num_expected,
8737 (num_expected == 1) ? "" : "s", num_found);
8738 }
8739
8740 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)8741 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
8742 {
8743 if (unlikely(!type)) {
8744 PyErr_SetString(PyExc_SystemError, "Missing type object");
8745 return 0;
8746 }
8747 else if (exact) {
8748 #if PY_MAJOR_VERSION == 2
8749 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
8750 #endif
8751 }
8752 else {
8753 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
8754 }
8755 PyErr_Format(PyExc_TypeError,
8756 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
8757 name, type->tp_name, Py_TYPE(obj)->tp_name);
8758 return 0;
8759 }
8760
8761 /* unicode_iter */
__Pyx_init_unicode_iteration(PyObject * ustring,Py_ssize_t * length,void ** data,int * kind)8762 static CYTHON_INLINE int __Pyx_init_unicode_iteration(
8763 PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
8764 #if CYTHON_PEP393_ENABLED
8765 if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
8766 *kind = PyUnicode_KIND(ustring);
8767 *length = PyUnicode_GET_LENGTH(ustring);
8768 *data = PyUnicode_DATA(ustring);
8769 #else
8770 *kind = 0;
8771 *length = PyUnicode_GET_SIZE(ustring);
8772 *data = (void*)PyUnicode_AS_UNICODE(ustring);
8773 #endif
8774 return 0;
8775 }
8776
8777 /* PyObjectCall */
8778 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)8779 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
8780 PyObject *result;
8781 ternaryfunc call = Py_TYPE(func)->tp_call;
8782 if (unlikely(!call))
8783 return PyObject_Call(func, arg, kw);
8784 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
8785 return NULL;
8786 result = (*call)(func, arg, kw);
8787 Py_LeaveRecursiveCall();
8788 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
8789 PyErr_SetString(
8790 PyExc_SystemError,
8791 "NULL result without error in PyObject_Call");
8792 }
8793 return result;
8794 }
8795 #endif
8796
8797 /* RaiseException */
8798 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)8799 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
8800 CYTHON_UNUSED PyObject *cause) {
8801 __Pyx_PyThreadState_declare
8802 Py_XINCREF(type);
8803 if (!value || value == Py_None)
8804 value = NULL;
8805 else
8806 Py_INCREF(value);
8807 if (!tb || tb == Py_None)
8808 tb = NULL;
8809 else {
8810 Py_INCREF(tb);
8811 if (!PyTraceBack_Check(tb)) {
8812 PyErr_SetString(PyExc_TypeError,
8813 "raise: arg 3 must be a traceback or None");
8814 goto raise_error;
8815 }
8816 }
8817 if (PyType_Check(type)) {
8818 #if CYTHON_COMPILING_IN_PYPY
8819 if (!value) {
8820 Py_INCREF(Py_None);
8821 value = Py_None;
8822 }
8823 #endif
8824 PyErr_NormalizeException(&type, &value, &tb);
8825 } else {
8826 if (value) {
8827 PyErr_SetString(PyExc_TypeError,
8828 "instance exception may not have a separate value");
8829 goto raise_error;
8830 }
8831 value = type;
8832 type = (PyObject*) Py_TYPE(type);
8833 Py_INCREF(type);
8834 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
8835 PyErr_SetString(PyExc_TypeError,
8836 "raise: exception class must be a subclass of BaseException");
8837 goto raise_error;
8838 }
8839 }
8840 __Pyx_PyThreadState_assign
8841 __Pyx_ErrRestore(type, value, tb);
8842 return;
8843 raise_error:
8844 Py_XDECREF(value);
8845 Py_XDECREF(type);
8846 Py_XDECREF(tb);
8847 return;
8848 }
8849 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)8850 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
8851 PyObject* owned_instance = NULL;
8852 if (tb == Py_None) {
8853 tb = 0;
8854 } else if (tb && !PyTraceBack_Check(tb)) {
8855 PyErr_SetString(PyExc_TypeError,
8856 "raise: arg 3 must be a traceback or None");
8857 goto bad;
8858 }
8859 if (value == Py_None)
8860 value = 0;
8861 if (PyExceptionInstance_Check(type)) {
8862 if (value) {
8863 PyErr_SetString(PyExc_TypeError,
8864 "instance exception may not have a separate value");
8865 goto bad;
8866 }
8867 value = type;
8868 type = (PyObject*) Py_TYPE(value);
8869 } else if (PyExceptionClass_Check(type)) {
8870 PyObject *instance_class = NULL;
8871 if (value && PyExceptionInstance_Check(value)) {
8872 instance_class = (PyObject*) Py_TYPE(value);
8873 if (instance_class != type) {
8874 int is_subclass = PyObject_IsSubclass(instance_class, type);
8875 if (!is_subclass) {
8876 instance_class = NULL;
8877 } else if (unlikely(is_subclass == -1)) {
8878 goto bad;
8879 } else {
8880 type = instance_class;
8881 }
8882 }
8883 }
8884 if (!instance_class) {
8885 PyObject *args;
8886 if (!value)
8887 args = PyTuple_New(0);
8888 else if (PyTuple_Check(value)) {
8889 Py_INCREF(value);
8890 args = value;
8891 } else
8892 args = PyTuple_Pack(1, value);
8893 if (!args)
8894 goto bad;
8895 owned_instance = PyObject_Call(type, args, NULL);
8896 Py_DECREF(args);
8897 if (!owned_instance)
8898 goto bad;
8899 value = owned_instance;
8900 if (!PyExceptionInstance_Check(value)) {
8901 PyErr_Format(PyExc_TypeError,
8902 "calling %R should have returned an instance of "
8903 "BaseException, not %R",
8904 type, Py_TYPE(value));
8905 goto bad;
8906 }
8907 }
8908 } else {
8909 PyErr_SetString(PyExc_TypeError,
8910 "raise: exception class must be a subclass of BaseException");
8911 goto bad;
8912 }
8913 if (cause) {
8914 PyObject *fixed_cause;
8915 if (cause == Py_None) {
8916 fixed_cause = NULL;
8917 } else if (PyExceptionClass_Check(cause)) {
8918 fixed_cause = PyObject_CallObject(cause, NULL);
8919 if (fixed_cause == NULL)
8920 goto bad;
8921 } else if (PyExceptionInstance_Check(cause)) {
8922 fixed_cause = cause;
8923 Py_INCREF(fixed_cause);
8924 } else {
8925 PyErr_SetString(PyExc_TypeError,
8926 "exception causes must derive from "
8927 "BaseException");
8928 goto bad;
8929 }
8930 PyException_SetCause(value, fixed_cause);
8931 }
8932 PyErr_SetObject(type, value);
8933 if (tb) {
8934 #if CYTHON_COMPILING_IN_PYPY
8935 PyObject *tmp_type, *tmp_value, *tmp_tb;
8936 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
8937 Py_INCREF(tb);
8938 PyErr_Restore(tmp_type, tmp_value, tb);
8939 Py_XDECREF(tmp_tb);
8940 #else
8941 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8942 PyObject* tmp_tb = tstate->curexc_traceback;
8943 if (tb != tmp_tb) {
8944 Py_INCREF(tb);
8945 tstate->curexc_traceback = tb;
8946 Py_XDECREF(tmp_tb);
8947 }
8948 #endif
8949 }
8950 bad:
8951 Py_XDECREF(owned_instance);
8952 return;
8953 }
8954 #endif
8955
8956 /* PyCFunctionFastCall */
8957 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)8958 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
8959 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
8960 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
8961 PyObject *self = PyCFunction_GET_SELF(func);
8962 int flags = PyCFunction_GET_FLAGS(func);
8963 assert(PyCFunction_Check(func));
8964 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
8965 assert(nargs >= 0);
8966 assert(nargs == 0 || args != NULL);
8967 /* _PyCFunction_FastCallDict() must not be called with an exception set,
8968 because it may clear it (directly or indirectly) and so the
8969 caller loses its exception */
8970 assert(!PyErr_Occurred());
8971 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
8972 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
8973 } else {
8974 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
8975 }
8976 }
8977 #endif
8978
8979 /* PyFunctionFastCall */
8980 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)8981 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
8982 PyObject *globals) {
8983 PyFrameObject *f;
8984 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8985 PyObject **fastlocals;
8986 Py_ssize_t i;
8987 PyObject *result;
8988 assert(globals != NULL);
8989 /* XXX Perhaps we should create a specialized
8990 PyFrame_New() that doesn't take locals, but does
8991 take builtins without sanity checking them.
8992 */
8993 assert(tstate != NULL);
8994 f = PyFrame_New(tstate, co, globals, NULL);
8995 if (f == NULL) {
8996 return NULL;
8997 }
8998 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
8999 for (i = 0; i < na; i++) {
9000 Py_INCREF(*args);
9001 fastlocals[i] = *args++;
9002 }
9003 result = PyEval_EvalFrameEx(f,0);
9004 ++tstate->recursion_depth;
9005 Py_DECREF(f);
9006 --tstate->recursion_depth;
9007 return result;
9008 }
9009 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)9010 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
9011 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
9012 PyObject *globals = PyFunction_GET_GLOBALS(func);
9013 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
9014 PyObject *closure;
9015 #if PY_MAJOR_VERSION >= 3
9016 PyObject *kwdefs;
9017 #endif
9018 PyObject *kwtuple, **k;
9019 PyObject **d;
9020 Py_ssize_t nd;
9021 Py_ssize_t nk;
9022 PyObject *result;
9023 assert(kwargs == NULL || PyDict_Check(kwargs));
9024 nk = kwargs ? PyDict_Size(kwargs) : 0;
9025 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
9026 return NULL;
9027 }
9028 if (
9029 #if PY_MAJOR_VERSION >= 3
9030 co->co_kwonlyargcount == 0 &&
9031 #endif
9032 likely(kwargs == NULL || nk == 0) &&
9033 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
9034 if (argdefs == NULL && co->co_argcount == nargs) {
9035 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
9036 goto done;
9037 }
9038 else if (nargs == 0 && argdefs != NULL
9039 && co->co_argcount == Py_SIZE(argdefs)) {
9040 /* function called with no arguments, but all parameters have
9041 a default value: use default values as arguments .*/
9042 args = &PyTuple_GET_ITEM(argdefs, 0);
9043 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
9044 goto done;
9045 }
9046 }
9047 if (kwargs != NULL) {
9048 Py_ssize_t pos, i;
9049 kwtuple = PyTuple_New(2 * nk);
9050 if (kwtuple == NULL) {
9051 result = NULL;
9052 goto done;
9053 }
9054 k = &PyTuple_GET_ITEM(kwtuple, 0);
9055 pos = i = 0;
9056 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
9057 Py_INCREF(k[i]);
9058 Py_INCREF(k[i+1]);
9059 i += 2;
9060 }
9061 nk = i / 2;
9062 }
9063 else {
9064 kwtuple = NULL;
9065 k = NULL;
9066 }
9067 closure = PyFunction_GET_CLOSURE(func);
9068 #if PY_MAJOR_VERSION >= 3
9069 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
9070 #endif
9071 if (argdefs != NULL) {
9072 d = &PyTuple_GET_ITEM(argdefs, 0);
9073 nd = Py_SIZE(argdefs);
9074 }
9075 else {
9076 d = NULL;
9077 nd = 0;
9078 }
9079 #if PY_MAJOR_VERSION >= 3
9080 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
9081 args, (int)nargs,
9082 k, (int)nk,
9083 d, (int)nd, kwdefs, closure);
9084 #else
9085 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
9086 args, (int)nargs,
9087 k, (int)nk,
9088 d, (int)nd, closure);
9089 #endif
9090 Py_XDECREF(kwtuple);
9091 done:
9092 Py_LeaveRecursiveCall();
9093 return result;
9094 }
9095 #endif
9096 #endif
9097
9098 /* PyObjectCallMethO */
9099 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)9100 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
9101 PyObject *self, *result;
9102 PyCFunction cfunc;
9103 cfunc = PyCFunction_GET_FUNCTION(func);
9104 self = PyCFunction_GET_SELF(func);
9105 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
9106 return NULL;
9107 result = cfunc(self, arg);
9108 Py_LeaveRecursiveCall();
9109 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9110 PyErr_SetString(
9111 PyExc_SystemError,
9112 "NULL result without error in PyObject_Call");
9113 }
9114 return result;
9115 }
9116 #endif
9117
9118 /* PyObjectCallOneArg */
9119 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)9120 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9121 PyObject *result;
9122 PyObject *args = PyTuple_New(1);
9123 if (unlikely(!args)) return NULL;
9124 Py_INCREF(arg);
9125 PyTuple_SET_ITEM(args, 0, arg);
9126 result = __Pyx_PyObject_Call(func, args, NULL);
9127 Py_DECREF(args);
9128 return result;
9129 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9130 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9131 #if CYTHON_FAST_PYCALL
9132 if (PyFunction_Check(func)) {
9133 return __Pyx_PyFunction_FastCall(func, &arg, 1);
9134 }
9135 #endif
9136 if (likely(PyCFunction_Check(func))) {
9137 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
9138 return __Pyx_PyObject_CallMethO(func, arg);
9139 #if CYTHON_FAST_PYCCALL
9140 } else if (__Pyx_PyFastCFunction_Check(func)) {
9141 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
9142 #endif
9143 }
9144 }
9145 return __Pyx__PyObject_CallOneArg(func, arg);
9146 }
9147 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9148 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9149 PyObject *result;
9150 PyObject *args = PyTuple_Pack(1, arg);
9151 if (unlikely(!args)) return NULL;
9152 result = __Pyx_PyObject_Call(func, args, NULL);
9153 Py_DECREF(args);
9154 return result;
9155 }
9156 #endif
9157
9158 /* GetException */
9159 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9160 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
9161 #else
9162 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
9163 #endif
9164 {
9165 PyObject *local_type, *local_value, *local_tb;
9166 #if CYTHON_FAST_THREAD_STATE
9167 PyObject *tmp_type, *tmp_value, *tmp_tb;
9168 local_type = tstate->curexc_type;
9169 local_value = tstate->curexc_value;
9170 local_tb = tstate->curexc_traceback;
9171 tstate->curexc_type = 0;
9172 tstate->curexc_value = 0;
9173 tstate->curexc_traceback = 0;
9174 #else
9175 PyErr_Fetch(&local_type, &local_value, &local_tb);
9176 #endif
9177 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
9178 #if CYTHON_FAST_THREAD_STATE
9179 if (unlikely(tstate->curexc_type))
9180 #else
9181 if (unlikely(PyErr_Occurred()))
9182 #endif
9183 goto bad;
9184 #if PY_MAJOR_VERSION >= 3
9185 if (local_tb) {
9186 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
9187 goto bad;
9188 }
9189 #endif
9190 Py_XINCREF(local_tb);
9191 Py_XINCREF(local_type);
9192 Py_XINCREF(local_value);
9193 *type = local_type;
9194 *value = local_value;
9195 *tb = local_tb;
9196 #if CYTHON_FAST_THREAD_STATE
9197 #if CYTHON_USE_EXC_INFO_STACK
9198 {
9199 _PyErr_StackItem *exc_info = tstate->exc_info;
9200 tmp_type = exc_info->exc_type;
9201 tmp_value = exc_info->exc_value;
9202 tmp_tb = exc_info->exc_traceback;
9203 exc_info->exc_type = local_type;
9204 exc_info->exc_value = local_value;
9205 exc_info->exc_traceback = local_tb;
9206 }
9207 #else
9208 tmp_type = tstate->exc_type;
9209 tmp_value = tstate->exc_value;
9210 tmp_tb = tstate->exc_traceback;
9211 tstate->exc_type = local_type;
9212 tstate->exc_value = local_value;
9213 tstate->exc_traceback = local_tb;
9214 #endif
9215 Py_XDECREF(tmp_type);
9216 Py_XDECREF(tmp_value);
9217 Py_XDECREF(tmp_tb);
9218 #else
9219 PyErr_SetExcInfo(local_type, local_value, local_tb);
9220 #endif
9221 return 0;
9222 bad:
9223 *type = 0;
9224 *value = 0;
9225 *tb = 0;
9226 Py_XDECREF(local_type);
9227 Py_XDECREF(local_value);
9228 Py_XDECREF(local_tb);
9229 return -1;
9230 }
9231
9232 /* SwapException */
9233 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9234 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9235 PyObject *tmp_type, *tmp_value, *tmp_tb;
9236 #if CYTHON_USE_EXC_INFO_STACK
9237 _PyErr_StackItem *exc_info = tstate->exc_info;
9238 tmp_type = exc_info->exc_type;
9239 tmp_value = exc_info->exc_value;
9240 tmp_tb = exc_info->exc_traceback;
9241 exc_info->exc_type = *type;
9242 exc_info->exc_value = *value;
9243 exc_info->exc_traceback = *tb;
9244 #else
9245 tmp_type = tstate->exc_type;
9246 tmp_value = tstate->exc_value;
9247 tmp_tb = tstate->exc_traceback;
9248 tstate->exc_type = *type;
9249 tstate->exc_value = *value;
9250 tstate->exc_traceback = *tb;
9251 #endif
9252 *type = tmp_type;
9253 *value = tmp_value;
9254 *tb = tmp_tb;
9255 }
9256 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)9257 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
9258 PyObject *tmp_type, *tmp_value, *tmp_tb;
9259 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
9260 PyErr_SetExcInfo(*type, *value, *tb);
9261 *type = tmp_type;
9262 *value = tmp_value;
9263 *tb = tmp_tb;
9264 }
9265 #endif
9266
9267 /* GetTopmostException */
9268 #if CYTHON_USE_EXC_INFO_STACK
9269 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)9270 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
9271 {
9272 _PyErr_StackItem *exc_info = tstate->exc_info;
9273 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
9274 exc_info->previous_item != NULL)
9275 {
9276 exc_info = exc_info->previous_item;
9277 }
9278 return exc_info;
9279 }
9280 #endif
9281
9282 /* SaveResetException */
9283 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9284 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9285 #if CYTHON_USE_EXC_INFO_STACK
9286 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
9287 *type = exc_info->exc_type;
9288 *value = exc_info->exc_value;
9289 *tb = exc_info->exc_traceback;
9290 #else
9291 *type = tstate->exc_type;
9292 *value = tstate->exc_value;
9293 *tb = tstate->exc_traceback;
9294 #endif
9295 Py_XINCREF(*type);
9296 Py_XINCREF(*value);
9297 Py_XINCREF(*tb);
9298 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)9299 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9300 PyObject *tmp_type, *tmp_value, *tmp_tb;
9301 #if CYTHON_USE_EXC_INFO_STACK
9302 _PyErr_StackItem *exc_info = tstate->exc_info;
9303 tmp_type = exc_info->exc_type;
9304 tmp_value = exc_info->exc_value;
9305 tmp_tb = exc_info->exc_traceback;
9306 exc_info->exc_type = type;
9307 exc_info->exc_value = value;
9308 exc_info->exc_traceback = tb;
9309 #else
9310 tmp_type = tstate->exc_type;
9311 tmp_value = tstate->exc_value;
9312 tmp_tb = tstate->exc_traceback;
9313 tstate->exc_type = type;
9314 tstate->exc_value = value;
9315 tstate->exc_traceback = tb;
9316 #endif
9317 Py_XDECREF(tmp_type);
9318 Py_XDECREF(tmp_value);
9319 Py_XDECREF(tmp_tb);
9320 }
9321 #endif
9322
9323 /* GetItemIntUnicode */
__Pyx_GetItemInt_Unicode_Fast(PyObject * ustring,Py_ssize_t i,int wraparound,int boundscheck)9324 static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i,
9325 int wraparound, int boundscheck) {
9326 Py_ssize_t length;
9327 if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return (Py_UCS4)-1;
9328 if (wraparound | boundscheck) {
9329 length = __Pyx_PyUnicode_GET_LENGTH(ustring);
9330 if (wraparound & unlikely(i < 0)) i += length;
9331 if ((!boundscheck) || likely(__Pyx_is_valid_index(i, length))) {
9332 return __Pyx_PyUnicode_READ_CHAR(ustring, i);
9333 } else {
9334 PyErr_SetString(PyExc_IndexError, "string index out of range");
9335 return (Py_UCS4)-1;
9336 }
9337 } else {
9338 return __Pyx_PyUnicode_READ_CHAR(ustring, i);
9339 }
9340 }
9341
9342 /* ReRaiseException */
__Pyx_ReraiseException(void)9343 static CYTHON_INLINE void __Pyx_ReraiseException(void) {
9344 PyObject *type = NULL, *value = NULL, *tb = NULL;
9345 #if CYTHON_FAST_THREAD_STATE
9346 PyThreadState *tstate = PyThreadState_GET();
9347 #if CYTHON_USE_EXC_INFO_STACK
9348 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
9349 type = exc_info->exc_type;
9350 value = exc_info->exc_value;
9351 tb = exc_info->exc_traceback;
9352 #else
9353 type = tstate->exc_type;
9354 value = tstate->exc_value;
9355 tb = tstate->exc_traceback;
9356 #endif
9357 #else
9358 PyErr_GetExcInfo(&type, &value, &tb);
9359 #endif
9360 if (!type || type == Py_None) {
9361 #if !CYTHON_FAST_THREAD_STATE
9362 Py_XDECREF(type);
9363 Py_XDECREF(value);
9364 Py_XDECREF(tb);
9365 #endif
9366 PyErr_SetString(PyExc_RuntimeError,
9367 "No active exception to reraise");
9368 } else {
9369 #if CYTHON_FAST_THREAD_STATE
9370 Py_INCREF(type);
9371 Py_XINCREF(value);
9372 Py_XINCREF(tb);
9373 #endif
9374 PyErr_Restore(type, value, tb);
9375 }
9376 }
9377
9378 /* PyErrExceptionMatches */
9379 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)9380 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9381 Py_ssize_t i, n;
9382 n = PyTuple_GET_SIZE(tuple);
9383 #if PY_MAJOR_VERSION >= 3
9384 for (i=0; i<n; i++) {
9385 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9386 }
9387 #endif
9388 for (i=0; i<n; i++) {
9389 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
9390 }
9391 return 0;
9392 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)9393 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
9394 PyObject *exc_type = tstate->curexc_type;
9395 if (exc_type == err) return 1;
9396 if (unlikely(!exc_type)) return 0;
9397 if (unlikely(PyTuple_Check(err)))
9398 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
9399 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
9400 }
9401 #endif
9402
9403 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)9404 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
9405 #if CYTHON_USE_TYPE_SLOTS
9406 #if PY_MAJOR_VERSION >= 3
9407 if (likely(PyUnicode_Check(n)))
9408 #else
9409 if (likely(PyString_Check(n)))
9410 #endif
9411 return __Pyx_PyObject_GetAttrStr(o, n);
9412 #endif
9413 return PyObject_GetAttr(o, n);
9414 }
9415
9416 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)9417 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
9418 __Pyx_PyThreadState_declare
9419 __Pyx_PyThreadState_assign
9420 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
9421 return NULL;
9422 __Pyx_PyErr_Clear();
9423 Py_INCREF(d);
9424 return d;
9425 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)9426 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
9427 PyObject *r = __Pyx_GetAttr(o, n);
9428 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
9429 }
9430
9431 /* PyDictVersioning */
9432 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)9433 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
9434 PyObject *dict = Py_TYPE(obj)->tp_dict;
9435 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
9436 }
__Pyx_get_object_dict_version(PyObject * obj)9437 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
9438 PyObject **dictptr = NULL;
9439 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
9440 if (offset) {
9441 #if CYTHON_COMPILING_IN_CPYTHON
9442 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
9443 #else
9444 dictptr = _PyObject_GetDictPtr(obj);
9445 #endif
9446 }
9447 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
9448 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)9449 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
9450 PyObject *dict = Py_TYPE(obj)->tp_dict;
9451 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
9452 return 0;
9453 return obj_dict_version == __Pyx_get_object_dict_version(obj);
9454 }
9455 #endif
9456
9457 /* GetModuleGlobalName */
9458 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)9459 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
9460 #else
9461 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
9462 #endif
9463 {
9464 PyObject *result;
9465 #if !CYTHON_AVOID_BORROWED_REFS
9466 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
9467 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
9468 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9469 if (likely(result)) {
9470 return __Pyx_NewRef(result);
9471 } else if (unlikely(PyErr_Occurred())) {
9472 return NULL;
9473 }
9474 #else
9475 result = PyDict_GetItem(__pyx_d, name);
9476 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9477 if (likely(result)) {
9478 return __Pyx_NewRef(result);
9479 }
9480 #endif
9481 #else
9482 result = PyObject_GetItem(__pyx_d, name);
9483 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9484 if (likely(result)) {
9485 return __Pyx_NewRef(result);
9486 }
9487 PyErr_Clear();
9488 #endif
9489 return __Pyx_GetBuiltinName(name);
9490 }
9491
9492 /* PyObjectCallNoArg */
9493 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)9494 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
9495 #if CYTHON_FAST_PYCALL
9496 if (PyFunction_Check(func)) {
9497 return __Pyx_PyFunction_FastCall(func, NULL, 0);
9498 }
9499 #endif
9500 #ifdef __Pyx_CyFunction_USED
9501 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
9502 #else
9503 if (likely(PyCFunction_Check(func)))
9504 #endif
9505 {
9506 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
9507 return __Pyx_PyObject_CallMethO(func, NULL);
9508 }
9509 }
9510 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
9511 }
9512 #endif
9513
9514 /* PyUnicode_Substring */
__Pyx_PyUnicode_Substring(PyObject * text,Py_ssize_t start,Py_ssize_t stop)9515 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
9516 PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
9517 Py_ssize_t length;
9518 if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL;
9519 length = __Pyx_PyUnicode_GET_LENGTH(text);
9520 if (start < 0) {
9521 start += length;
9522 if (start < 0)
9523 start = 0;
9524 }
9525 if (stop < 0)
9526 stop += length;
9527 else if (stop > length)
9528 stop = length;
9529 if (stop <= start)
9530 return __Pyx_NewRef(__pyx_empty_unicode);
9531 #if CYTHON_PEP393_ENABLED
9532 return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
9533 PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
9534 #else
9535 return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(text)+start, stop-start);
9536 #endif
9537 }
9538
9539 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)9540 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
9541 PyObject *args, *result = NULL;
9542 #if CYTHON_FAST_PYCALL
9543 if (PyFunction_Check(function)) {
9544 PyObject *args[2] = {arg1, arg2};
9545 return __Pyx_PyFunction_FastCall(function, args, 2);
9546 }
9547 #endif
9548 #if CYTHON_FAST_PYCCALL
9549 if (__Pyx_PyFastCFunction_Check(function)) {
9550 PyObject *args[2] = {arg1, arg2};
9551 return __Pyx_PyCFunction_FastCall(function, args, 2);
9552 }
9553 #endif
9554 args = PyTuple_New(2);
9555 if (unlikely(!args)) goto done;
9556 Py_INCREF(arg1);
9557 PyTuple_SET_ITEM(args, 0, arg1);
9558 Py_INCREF(arg2);
9559 PyTuple_SET_ITEM(args, 1, arg2);
9560 Py_INCREF(function);
9561 result = __Pyx_PyObject_Call(function, args, NULL);
9562 Py_DECREF(args);
9563 Py_DECREF(function);
9564 done:
9565 return result;
9566 }
9567
9568 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)9569 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
9570 Py_ssize_t cstart, Py_ssize_t cstop,
9571 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
9572 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
9573 #if CYTHON_USE_TYPE_SLOTS
9574 PyMappingMethods* mp;
9575 #if PY_MAJOR_VERSION < 3
9576 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
9577 if (likely(ms && ms->sq_slice)) {
9578 if (!has_cstart) {
9579 if (_py_start && (*_py_start != Py_None)) {
9580 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
9581 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
9582 } else
9583 cstart = 0;
9584 }
9585 if (!has_cstop) {
9586 if (_py_stop && (*_py_stop != Py_None)) {
9587 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
9588 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
9589 } else
9590 cstop = PY_SSIZE_T_MAX;
9591 }
9592 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
9593 Py_ssize_t l = ms->sq_length(obj);
9594 if (likely(l >= 0)) {
9595 if (cstop < 0) {
9596 cstop += l;
9597 if (cstop < 0) cstop = 0;
9598 }
9599 if (cstart < 0) {
9600 cstart += l;
9601 if (cstart < 0) cstart = 0;
9602 }
9603 } else {
9604 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
9605 goto bad;
9606 PyErr_Clear();
9607 }
9608 }
9609 return ms->sq_slice(obj, cstart, cstop);
9610 }
9611 #endif
9612 mp = Py_TYPE(obj)->tp_as_mapping;
9613 if (likely(mp && mp->mp_subscript))
9614 #endif
9615 {
9616 PyObject* result;
9617 PyObject *py_slice, *py_start, *py_stop;
9618 if (_py_slice) {
9619 py_slice = *_py_slice;
9620 } else {
9621 PyObject* owned_start = NULL;
9622 PyObject* owned_stop = NULL;
9623 if (_py_start) {
9624 py_start = *_py_start;
9625 } else {
9626 if (has_cstart) {
9627 owned_start = py_start = PyInt_FromSsize_t(cstart);
9628 if (unlikely(!py_start)) goto bad;
9629 } else
9630 py_start = Py_None;
9631 }
9632 if (_py_stop) {
9633 py_stop = *_py_stop;
9634 } else {
9635 if (has_cstop) {
9636 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
9637 if (unlikely(!py_stop)) {
9638 Py_XDECREF(owned_start);
9639 goto bad;
9640 }
9641 } else
9642 py_stop = Py_None;
9643 }
9644 py_slice = PySlice_New(py_start, py_stop, Py_None);
9645 Py_XDECREF(owned_start);
9646 Py_XDECREF(owned_stop);
9647 if (unlikely(!py_slice)) goto bad;
9648 }
9649 #if CYTHON_USE_TYPE_SLOTS
9650 result = mp->mp_subscript(obj, py_slice);
9651 #else
9652 result = PyObject_GetItem(obj, py_slice);
9653 #endif
9654 if (!_py_slice) {
9655 Py_DECREF(py_slice);
9656 }
9657 return result;
9658 }
9659 PyErr_Format(PyExc_TypeError,
9660 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
9661 bad:
9662 return NULL;
9663 }
9664
9665 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)9666 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
9667 PyObject *empty_list = 0;
9668 PyObject *module = 0;
9669 PyObject *global_dict = 0;
9670 PyObject *empty_dict = 0;
9671 PyObject *list;
9672 #if PY_MAJOR_VERSION < 3
9673 PyObject *py_import;
9674 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
9675 if (!py_import)
9676 goto bad;
9677 #endif
9678 if (from_list)
9679 list = from_list;
9680 else {
9681 empty_list = PyList_New(0);
9682 if (!empty_list)
9683 goto bad;
9684 list = empty_list;
9685 }
9686 global_dict = PyModule_GetDict(__pyx_m);
9687 if (!global_dict)
9688 goto bad;
9689 empty_dict = PyDict_New();
9690 if (!empty_dict)
9691 goto bad;
9692 {
9693 #if PY_MAJOR_VERSION >= 3
9694 if (level == -1) {
9695 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
9696 module = PyImport_ImportModuleLevelObject(
9697 name, global_dict, empty_dict, list, 1);
9698 if (!module) {
9699 if (!PyErr_ExceptionMatches(PyExc_ImportError))
9700 goto bad;
9701 PyErr_Clear();
9702 }
9703 }
9704 level = 0;
9705 }
9706 #endif
9707 if (!module) {
9708 #if PY_MAJOR_VERSION < 3
9709 PyObject *py_level = PyInt_FromLong(level);
9710 if (!py_level)
9711 goto bad;
9712 module = PyObject_CallFunctionObjArgs(py_import,
9713 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
9714 Py_DECREF(py_level);
9715 #else
9716 module = PyImport_ImportModuleLevelObject(
9717 name, global_dict, empty_dict, list, level);
9718 #endif
9719 }
9720 }
9721 bad:
9722 #if PY_MAJOR_VERSION < 3
9723 Py_XDECREF(py_import);
9724 #endif
9725 Py_XDECREF(empty_list);
9726 Py_XDECREF(empty_dict);
9727 return module;
9728 }
9729
9730 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)9731 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
9732 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
9733 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
9734 PyErr_Format(PyExc_ImportError,
9735 #if PY_MAJOR_VERSION < 3
9736 "cannot import name %.230s", PyString_AS_STRING(name));
9737 #else
9738 "cannot import name %S", name);
9739 #endif
9740 }
9741 return value;
9742 }
9743
9744 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)9745 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
9746 PyObject *r;
9747 if (!j) return NULL;
9748 r = PyObject_GetItem(o, j);
9749 Py_DECREF(j);
9750 return r;
9751 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)9752 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
9753 CYTHON_NCP_UNUSED int wraparound,
9754 CYTHON_NCP_UNUSED int boundscheck) {
9755 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9756 Py_ssize_t wrapped_i = i;
9757 if (wraparound & unlikely(i < 0)) {
9758 wrapped_i += PyList_GET_SIZE(o);
9759 }
9760 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
9761 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
9762 Py_INCREF(r);
9763 return r;
9764 }
9765 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9766 #else
9767 return PySequence_GetItem(o, i);
9768 #endif
9769 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)9770 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
9771 CYTHON_NCP_UNUSED int wraparound,
9772 CYTHON_NCP_UNUSED int boundscheck) {
9773 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9774 Py_ssize_t wrapped_i = i;
9775 if (wraparound & unlikely(i < 0)) {
9776 wrapped_i += PyTuple_GET_SIZE(o);
9777 }
9778 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
9779 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
9780 Py_INCREF(r);
9781 return r;
9782 }
9783 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9784 #else
9785 return PySequence_GetItem(o, i);
9786 #endif
9787 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)9788 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
9789 CYTHON_NCP_UNUSED int wraparound,
9790 CYTHON_NCP_UNUSED int boundscheck) {
9791 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
9792 if (is_list || PyList_CheckExact(o)) {
9793 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
9794 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
9795 PyObject *r = PyList_GET_ITEM(o, n);
9796 Py_INCREF(r);
9797 return r;
9798 }
9799 }
9800 else if (PyTuple_CheckExact(o)) {
9801 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
9802 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
9803 PyObject *r = PyTuple_GET_ITEM(o, n);
9804 Py_INCREF(r);
9805 return r;
9806 }
9807 } else {
9808 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
9809 if (likely(m && m->sq_item)) {
9810 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
9811 Py_ssize_t l = m->sq_length(o);
9812 if (likely(l >= 0)) {
9813 i += l;
9814 } else {
9815 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
9816 return NULL;
9817 PyErr_Clear();
9818 }
9819 }
9820 return m->sq_item(o, i);
9821 }
9822 }
9823 #else
9824 if (is_list || PySequence_Check(o)) {
9825 return PySequence_GetItem(o, i);
9826 }
9827 #endif
9828 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9829 }
9830
9831 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)9832 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
9833 PyObject *r;
9834 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
9835 PyErr_SetString(PyExc_TypeError,
9836 "hasattr(): attribute name must be string");
9837 return -1;
9838 }
9839 r = __Pyx_GetAttr(o, n);
9840 if (unlikely(!r)) {
9841 PyErr_Clear();
9842 return 0;
9843 } else {
9844 Py_DECREF(r);
9845 return 1;
9846 }
9847 }
9848
9849 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)9850 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
9851 if (unlikely(!type)) {
9852 PyErr_SetString(PyExc_SystemError, "Missing type object");
9853 return 0;
9854 }
9855 if (likely(__Pyx_TypeCheck(obj, type)))
9856 return 1;
9857 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
9858 Py_TYPE(obj)->tp_name, type->tp_name);
9859 return 0;
9860 }
9861
9862 /* PyObject_GenericGetAttrNoDict */
9863 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)9864 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
9865 PyErr_Format(PyExc_AttributeError,
9866 #if PY_MAJOR_VERSION >= 3
9867 "'%.50s' object has no attribute '%U'",
9868 tp->tp_name, attr_name);
9869 #else
9870 "'%.50s' object has no attribute '%.400s'",
9871 tp->tp_name, PyString_AS_STRING(attr_name));
9872 #endif
9873 return NULL;
9874 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)9875 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
9876 PyObject *descr;
9877 PyTypeObject *tp = Py_TYPE(obj);
9878 if (unlikely(!PyString_Check(attr_name))) {
9879 return PyObject_GenericGetAttr(obj, attr_name);
9880 }
9881 assert(!tp->tp_dictoffset);
9882 descr = _PyType_Lookup(tp, attr_name);
9883 if (unlikely(!descr)) {
9884 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
9885 }
9886 Py_INCREF(descr);
9887 #if PY_MAJOR_VERSION < 3
9888 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
9889 #endif
9890 {
9891 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
9892 if (unlikely(f)) {
9893 PyObject *res = f(descr, obj, (PyObject *)tp);
9894 Py_DECREF(descr);
9895 return res;
9896 }
9897 }
9898 return descr;
9899 }
9900 #endif
9901
9902 /* PyObject_GenericGetAttr */
9903 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)9904 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
9905 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
9906 return PyObject_GenericGetAttr(obj, attr_name);
9907 }
9908 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
9909 }
9910 #endif
9911
9912 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)9913 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
9914 #if PY_VERSION_HEX >= 0x02070000
9915 PyObject *ob = PyCapsule_New(vtable, 0, 0);
9916 #else
9917 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
9918 #endif
9919 if (!ob)
9920 goto bad;
9921 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
9922 goto bad;
9923 Py_DECREF(ob);
9924 return 0;
9925 bad:
9926 Py_XDECREF(ob);
9927 return -1;
9928 }
9929
9930 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)9931 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
9932 __Pyx_PyThreadState_declare
9933 __Pyx_PyThreadState_assign
9934 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
9935 __Pyx_PyErr_Clear();
9936 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)9937 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
9938 PyObject *result;
9939 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
9940 PyTypeObject* tp = Py_TYPE(obj);
9941 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
9942 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
9943 }
9944 #endif
9945 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
9946 if (unlikely(!result)) {
9947 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
9948 }
9949 return result;
9950 }
9951
9952 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)9953 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
9954 int ret;
9955 PyObject *name_attr;
9956 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
9957 if (likely(name_attr)) {
9958 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
9959 } else {
9960 ret = -1;
9961 }
9962 if (unlikely(ret < 0)) {
9963 PyErr_Clear();
9964 ret = 0;
9965 }
9966 Py_XDECREF(name_attr);
9967 return ret;
9968 }
__Pyx_setup_reduce(PyObject * type_obj)9969 static int __Pyx_setup_reduce(PyObject* type_obj) {
9970 int ret = 0;
9971 PyObject *object_reduce = NULL;
9972 PyObject *object_reduce_ex = NULL;
9973 PyObject *reduce = NULL;
9974 PyObject *reduce_ex = NULL;
9975 PyObject *reduce_cython = NULL;
9976 PyObject *setstate = NULL;
9977 PyObject *setstate_cython = NULL;
9978 #if CYTHON_USE_PYTYPE_LOOKUP
9979 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
9980 #else
9981 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
9982 #endif
9983 #if CYTHON_USE_PYTYPE_LOOKUP
9984 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
9985 #else
9986 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
9987 #endif
9988 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
9989 if (reduce_ex == object_reduce_ex) {
9990 #if CYTHON_USE_PYTYPE_LOOKUP
9991 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
9992 #else
9993 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
9994 #endif
9995 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
9996 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
9997 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
9998 if (likely(reduce_cython)) {
9999 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
10000 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
10001 } else if (reduce == object_reduce || PyErr_Occurred()) {
10002 goto __PYX_BAD;
10003 }
10004 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
10005 if (!setstate) PyErr_Clear();
10006 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
10007 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
10008 if (likely(setstate_cython)) {
10009 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
10010 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
10011 } else if (!setstate || PyErr_Occurred()) {
10012 goto __PYX_BAD;
10013 }
10014 }
10015 PyType_Modified((PyTypeObject*)type_obj);
10016 }
10017 }
10018 goto __PYX_GOOD;
10019 __PYX_BAD:
10020 if (!PyErr_Occurred())
10021 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
10022 ret = -1;
10023 __PYX_GOOD:
10024 #if !CYTHON_USE_PYTYPE_LOOKUP
10025 Py_XDECREF(object_reduce);
10026 Py_XDECREF(object_reduce_ex);
10027 #endif
10028 Py_XDECREF(reduce);
10029 Py_XDECREF(reduce_ex);
10030 Py_XDECREF(reduce_cython);
10031 Py_XDECREF(setstate);
10032 Py_XDECREF(setstate_cython);
10033 return ret;
10034 }
10035
10036 /* TypeImport */
10037 #ifndef __PYX_HAVE_RT_ImportType
10038 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)10039 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
10040 size_t size, enum __Pyx_ImportType_CheckSize check_size)
10041 {
10042 PyObject *result = 0;
10043 char warning[200];
10044 Py_ssize_t basicsize;
10045 #ifdef Py_LIMITED_API
10046 PyObject *py_basicsize;
10047 #endif
10048 result = PyObject_GetAttrString(module, class_name);
10049 if (!result)
10050 goto bad;
10051 if (!PyType_Check(result)) {
10052 PyErr_Format(PyExc_TypeError,
10053 "%.200s.%.200s is not a type object",
10054 module_name, class_name);
10055 goto bad;
10056 }
10057 #ifndef Py_LIMITED_API
10058 basicsize = ((PyTypeObject *)result)->tp_basicsize;
10059 #else
10060 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
10061 if (!py_basicsize)
10062 goto bad;
10063 basicsize = PyLong_AsSsize_t(py_basicsize);
10064 Py_DECREF(py_basicsize);
10065 py_basicsize = 0;
10066 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
10067 goto bad;
10068 #endif
10069 if ((size_t)basicsize < size) {
10070 PyErr_Format(PyExc_ValueError,
10071 "%.200s.%.200s size changed, may indicate binary incompatibility. "
10072 "Expected %zd from C header, got %zd from PyObject",
10073 module_name, class_name, size, basicsize);
10074 goto bad;
10075 }
10076 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
10077 PyErr_Format(PyExc_ValueError,
10078 "%.200s.%.200s size changed, may indicate binary incompatibility. "
10079 "Expected %zd from C header, got %zd from PyObject",
10080 module_name, class_name, size, basicsize);
10081 goto bad;
10082 }
10083 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
10084 PyOS_snprintf(warning, sizeof(warning),
10085 "%s.%s size changed, may indicate binary incompatibility. "
10086 "Expected %zd from C header, got %zd from PyObject",
10087 module_name, class_name, size, basicsize);
10088 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
10089 }
10090 return (PyTypeObject *)result;
10091 bad:
10092 Py_XDECREF(result);
10093 return NULL;
10094 }
10095 #endif
10096
10097 /* CLineInTraceback */
10098 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)10099 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
10100 PyObject *use_cline;
10101 PyObject *ptype, *pvalue, *ptraceback;
10102 #if CYTHON_COMPILING_IN_CPYTHON
10103 PyObject **cython_runtime_dict;
10104 #endif
10105 if (unlikely(!__pyx_cython_runtime)) {
10106 return c_line;
10107 }
10108 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
10109 #if CYTHON_COMPILING_IN_CPYTHON
10110 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
10111 if (likely(cython_runtime_dict)) {
10112 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
10113 use_cline, *cython_runtime_dict,
10114 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
10115 } else
10116 #endif
10117 {
10118 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
10119 if (use_cline_obj) {
10120 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
10121 Py_DECREF(use_cline_obj);
10122 } else {
10123 PyErr_Clear();
10124 use_cline = NULL;
10125 }
10126 }
10127 if (!use_cline) {
10128 c_line = 0;
10129 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
10130 }
10131 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
10132 c_line = 0;
10133 }
10134 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
10135 return c_line;
10136 }
10137 #endif
10138
10139 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)10140 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
10141 int start = 0, mid = 0, end = count - 1;
10142 if (end >= 0 && code_line > entries[end].code_line) {
10143 return count;
10144 }
10145 while (start < end) {
10146 mid = start + (end - start) / 2;
10147 if (code_line < entries[mid].code_line) {
10148 end = mid;
10149 } else if (code_line > entries[mid].code_line) {
10150 start = mid + 1;
10151 } else {
10152 return mid;
10153 }
10154 }
10155 if (code_line <= entries[mid].code_line) {
10156 return mid;
10157 } else {
10158 return mid + 1;
10159 }
10160 }
__pyx_find_code_object(int code_line)10161 static PyCodeObject *__pyx_find_code_object(int code_line) {
10162 PyCodeObject* code_object;
10163 int pos;
10164 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
10165 return NULL;
10166 }
10167 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10168 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
10169 return NULL;
10170 }
10171 code_object = __pyx_code_cache.entries[pos].code_object;
10172 Py_INCREF(code_object);
10173 return code_object;
10174 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)10175 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
10176 int pos, i;
10177 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10178 if (unlikely(!code_line)) {
10179 return;
10180 }
10181 if (unlikely(!entries)) {
10182 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
10183 if (likely(entries)) {
10184 __pyx_code_cache.entries = entries;
10185 __pyx_code_cache.max_count = 64;
10186 __pyx_code_cache.count = 1;
10187 entries[0].code_line = code_line;
10188 entries[0].code_object = code_object;
10189 Py_INCREF(code_object);
10190 }
10191 return;
10192 }
10193 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10194 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
10195 PyCodeObject* tmp = entries[pos].code_object;
10196 entries[pos].code_object = code_object;
10197 Py_DECREF(tmp);
10198 return;
10199 }
10200 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
10201 int new_max = __pyx_code_cache.max_count + 64;
10202 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
10203 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
10204 if (unlikely(!entries)) {
10205 return;
10206 }
10207 __pyx_code_cache.entries = entries;
10208 __pyx_code_cache.max_count = new_max;
10209 }
10210 for (i=__pyx_code_cache.count; i>pos; i--) {
10211 entries[i] = entries[i-1];
10212 }
10213 entries[pos].code_line = code_line;
10214 entries[pos].code_object = code_object;
10215 __pyx_code_cache.count++;
10216 Py_INCREF(code_object);
10217 }
10218
10219 /* AddTraceback */
10220 #include "compile.h"
10221 #include "frameobject.h"
10222 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)10223 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
10224 const char *funcname, int c_line,
10225 int py_line, const char *filename) {
10226 PyCodeObject *py_code = 0;
10227 PyObject *py_srcfile = 0;
10228 PyObject *py_funcname = 0;
10229 #if PY_MAJOR_VERSION < 3
10230 py_srcfile = PyString_FromString(filename);
10231 #else
10232 py_srcfile = PyUnicode_FromString(filename);
10233 #endif
10234 if (!py_srcfile) goto bad;
10235 if (c_line) {
10236 #if PY_MAJOR_VERSION < 3
10237 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10238 #else
10239 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10240 #endif
10241 }
10242 else {
10243 #if PY_MAJOR_VERSION < 3
10244 py_funcname = PyString_FromString(funcname);
10245 #else
10246 py_funcname = PyUnicode_FromString(funcname);
10247 #endif
10248 }
10249 if (!py_funcname) goto bad;
10250 py_code = __Pyx_PyCode_New(
10251 0,
10252 0,
10253 0,
10254 0,
10255 0,
10256 __pyx_empty_bytes, /*PyObject *code,*/
10257 __pyx_empty_tuple, /*PyObject *consts,*/
10258 __pyx_empty_tuple, /*PyObject *names,*/
10259 __pyx_empty_tuple, /*PyObject *varnames,*/
10260 __pyx_empty_tuple, /*PyObject *freevars,*/
10261 __pyx_empty_tuple, /*PyObject *cellvars,*/
10262 py_srcfile, /*PyObject *filename,*/
10263 py_funcname, /*PyObject *name,*/
10264 py_line,
10265 __pyx_empty_bytes /*PyObject *lnotab*/
10266 );
10267 Py_DECREF(py_srcfile);
10268 Py_DECREF(py_funcname);
10269 return py_code;
10270 bad:
10271 Py_XDECREF(py_srcfile);
10272 Py_XDECREF(py_funcname);
10273 return NULL;
10274 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)10275 static void __Pyx_AddTraceback(const char *funcname, int c_line,
10276 int py_line, const char *filename) {
10277 PyCodeObject *py_code = 0;
10278 PyFrameObject *py_frame = 0;
10279 PyThreadState *tstate = __Pyx_PyThreadState_Current;
10280 if (c_line) {
10281 c_line = __Pyx_CLineForTraceback(tstate, c_line);
10282 }
10283 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
10284 if (!py_code) {
10285 py_code = __Pyx_CreateCodeObjectForTraceback(
10286 funcname, c_line, py_line, filename);
10287 if (!py_code) goto bad;
10288 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
10289 }
10290 py_frame = PyFrame_New(
10291 tstate, /*PyThreadState *tstate,*/
10292 py_code, /*PyCodeObject *code,*/
10293 __pyx_d, /*PyObject *globals,*/
10294 0 /*PyObject *locals*/
10295 );
10296 if (!py_frame) goto bad;
10297 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
10298 PyTraceBack_Here(py_frame);
10299 bad:
10300 Py_XDECREF(py_code);
10301 Py_XDECREF(py_frame);
10302 }
10303
10304 /* CIntFromPyVerify */
10305 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
10306 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
10307 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
10308 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
10309 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
10310 {\
10311 func_type value = func_value;\
10312 if (sizeof(target_type) < sizeof(func_type)) {\
10313 if (unlikely(value != (func_type) (target_type) value)) {\
10314 func_type zero = 0;\
10315 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
10316 return (target_type) -1;\
10317 if (is_unsigned && unlikely(value < zero))\
10318 goto raise_neg_overflow;\
10319 else\
10320 goto raise_overflow;\
10321 }\
10322 }\
10323 return (target_type) value;\
10324 }
10325
10326 /* PyUCS4InUnicode */
10327 #if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
10328 #if PY_VERSION_HEX < 0x03090000
10329 #define __Pyx_PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(op)
10330 #define __Pyx_PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(op)
10331 #else
10332 #define __Pyx_PyUnicode_AS_UNICODE(op) (((PyASCIIObject *)(op))->wstr)
10333 #define __Pyx_PyUnicode_GET_SIZE(op) ((PyCompactUnicodeObject *)(op))->wstr_length
10334 #endif
10335 #if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
__Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE * buffer,Py_ssize_t length,Py_UCS4 character)10336 static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) {
10337 Py_UNICODE high_val, low_val;
10338 Py_UNICODE* pos;
10339 high_val = (Py_UNICODE) (0xD800 | (((character - 0x10000) >> 10) & ((1<<10)-1)));
10340 low_val = (Py_UNICODE) (0xDC00 | ( (character - 0x10000) & ((1<<10)-1)));
10341 for (pos=buffer; pos < buffer+length-1; pos++) {
10342 if (unlikely((high_val == pos[0]) & (low_val == pos[1]))) return 1;
10343 }
10344 return 0;
10345 }
10346 #endif
__Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE * buffer,Py_ssize_t length,Py_UCS4 character)10347 static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) {
10348 Py_UNICODE uchar;
10349 Py_UNICODE* pos;
10350 uchar = (Py_UNICODE) character;
10351 for (pos=buffer; pos < buffer+length; pos++) {
10352 if (unlikely(uchar == pos[0])) return 1;
10353 }
10354 return 0;
10355 }
10356 #endif
__Pyx_UnicodeContainsUCS4(PyObject * unicode,Py_UCS4 character)10357 static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) {
10358 #if CYTHON_PEP393_ENABLED
10359 const int kind = PyUnicode_KIND(unicode);
10360 #ifdef PyUnicode_WCHAR_KIND
10361 if (likely(kind != PyUnicode_WCHAR_KIND))
10362 #endif
10363 {
10364 Py_ssize_t i;
10365 const void* udata = PyUnicode_DATA(unicode);
10366 const Py_ssize_t length = PyUnicode_GET_LENGTH(unicode);
10367 for (i=0; i < length; i++) {
10368 if (unlikely(character == PyUnicode_READ(kind, udata, i))) return 1;
10369 }
10370 return 0;
10371 }
10372 #elif PY_VERSION_HEX >= 0x03090000
10373 #error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings.
10374 #elif !defined(PyUnicode_AS_UNICODE)
10375 #error Cannot use "UChar in Unicode" in Python < 3.9 without Py_UNICODE support.
10376 #endif
10377 #if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
10378 #if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
10379 if ((sizeof(Py_UNICODE) == 2) && unlikely(character > 65535)) {
10380 return __Pyx_PyUnicodeBufferContainsUCS4_SP(
10381 __Pyx_PyUnicode_AS_UNICODE(unicode),
10382 __Pyx_PyUnicode_GET_SIZE(unicode),
10383 character);
10384 } else
10385 #endif
10386 {
10387 return __Pyx_PyUnicodeBufferContainsUCS4_BMP(
10388 __Pyx_PyUnicode_AS_UNICODE(unicode),
10389 __Pyx_PyUnicode_GET_SIZE(unicode),
10390 character);
10391 }
10392 #endif
10393 }
10394
10395 /* UnicodeAsUCS4 */
__Pyx_PyUnicode_AsPy_UCS4(PyObject * x)10396 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
10397 Py_ssize_t length;
10398 #if CYTHON_PEP393_ENABLED
10399 length = PyUnicode_GET_LENGTH(x);
10400 if (likely(length == 1)) {
10401 return PyUnicode_READ_CHAR(x, 0);
10402 }
10403 #else
10404 length = PyUnicode_GET_SIZE(x);
10405 if (likely(length == 1)) {
10406 return PyUnicode_AS_UNICODE(x)[0];
10407 }
10408 #if Py_UNICODE_SIZE == 2
10409 else if (PyUnicode_GET_SIZE(x) == 2) {
10410 Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
10411 if (high_val >= 0xD800 && high_val <= 0xDBFF) {
10412 Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
10413 if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
10414 return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
10415 }
10416 }
10417 }
10418 #endif
10419 #endif
10420 PyErr_Format(PyExc_ValueError,
10421 "only single character unicode strings can be converted to Py_UCS4, "
10422 "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
10423 return (Py_UCS4)-1;
10424 }
10425
10426 /* CIntFromPy */
__Pyx_PyInt_As_uint8_t(PyObject * x)10427 static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) {
10428 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10429 #pragma GCC diagnostic push
10430 #pragma GCC diagnostic ignored "-Wconversion"
10431 #endif
10432 const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0;
10433 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10434 #pragma GCC diagnostic pop
10435 #endif
10436 const int is_unsigned = neg_one > const_zero;
10437 #if PY_MAJOR_VERSION < 3
10438 if (likely(PyInt_Check(x))) {
10439 if (sizeof(uint8_t) < sizeof(long)) {
10440 __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x))
10441 } else {
10442 long val = PyInt_AS_LONG(x);
10443 if (is_unsigned && unlikely(val < 0)) {
10444 goto raise_neg_overflow;
10445 }
10446 return (uint8_t) val;
10447 }
10448 } else
10449 #endif
10450 if (likely(PyLong_Check(x))) {
10451 if (is_unsigned) {
10452 #if CYTHON_USE_PYLONG_INTERNALS
10453 const digit* digits = ((PyLongObject*)x)->ob_digit;
10454 switch (Py_SIZE(x)) {
10455 case 0: return (uint8_t) 0;
10456 case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0])
10457 case 2:
10458 if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) {
10459 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10460 __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10461 } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) {
10462 return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
10463 }
10464 }
10465 break;
10466 case 3:
10467 if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) {
10468 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10469 __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10470 } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) {
10471 return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
10472 }
10473 }
10474 break;
10475 case 4:
10476 if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) {
10477 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10478 __PYX_VERIFY_RETURN_INT(uint8_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])))
10479 } else if (8 * sizeof(uint8_t) >= 4 * PyLong_SHIFT) {
10480 return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
10481 }
10482 }
10483 break;
10484 }
10485 #endif
10486 #if CYTHON_COMPILING_IN_CPYTHON
10487 if (unlikely(Py_SIZE(x) < 0)) {
10488 goto raise_neg_overflow;
10489 }
10490 #else
10491 {
10492 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10493 if (unlikely(result < 0))
10494 return (uint8_t) -1;
10495 if (unlikely(result == 1))
10496 goto raise_neg_overflow;
10497 }
10498 #endif
10499 if (sizeof(uint8_t) <= sizeof(unsigned long)) {
10500 __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x))
10501 #ifdef HAVE_LONG_LONG
10502 } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
10503 __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10504 #endif
10505 }
10506 } else {
10507 #if CYTHON_USE_PYLONG_INTERNALS
10508 const digit* digits = ((PyLongObject*)x)->ob_digit;
10509 switch (Py_SIZE(x)) {
10510 case 0: return (uint8_t) 0;
10511 case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0]))
10512 case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0])
10513 case -2:
10514 if (8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT) {
10515 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10516 __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10517 } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
10518 return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10519 }
10520 }
10521 break;
10522 case 2:
10523 if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) {
10524 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10525 __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10526 } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
10527 return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10528 }
10529 }
10530 break;
10531 case -3:
10532 if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
10533 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10534 __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10535 } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
10536 return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10537 }
10538 }
10539 break;
10540 case 3:
10541 if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) {
10542 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10543 __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10544 } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
10545 return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10546 }
10547 }
10548 break;
10549 case -4:
10550 if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
10551 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10552 __PYX_VERIFY_RETURN_INT(uint8_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])))
10553 } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) {
10554 return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10555 }
10556 }
10557 break;
10558 case 4:
10559 if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) {
10560 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10561 __PYX_VERIFY_RETURN_INT(uint8_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])))
10562 } else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) {
10563 return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
10564 }
10565 }
10566 break;
10567 }
10568 #endif
10569 if (sizeof(uint8_t) <= sizeof(long)) {
10570 __PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x))
10571 #ifdef HAVE_LONG_LONG
10572 } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) {
10573 __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x))
10574 #endif
10575 }
10576 }
10577 {
10578 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10579 PyErr_SetString(PyExc_RuntimeError,
10580 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10581 #else
10582 uint8_t val;
10583 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10584 #if PY_MAJOR_VERSION < 3
10585 if (likely(v) && !PyLong_Check(v)) {
10586 PyObject *tmp = v;
10587 v = PyNumber_Long(tmp);
10588 Py_DECREF(tmp);
10589 }
10590 #endif
10591 if (likely(v)) {
10592 int one = 1; int is_little = (int)*(unsigned char *)&one;
10593 unsigned char *bytes = (unsigned char *)&val;
10594 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10595 bytes, sizeof(val),
10596 is_little, !is_unsigned);
10597 Py_DECREF(v);
10598 if (likely(!ret))
10599 return val;
10600 }
10601 #endif
10602 return (uint8_t) -1;
10603 }
10604 } else {
10605 uint8_t val;
10606 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10607 if (!tmp) return (uint8_t) -1;
10608 val = __Pyx_PyInt_As_uint8_t(tmp);
10609 Py_DECREF(tmp);
10610 return val;
10611 }
10612 raise_overflow:
10613 PyErr_SetString(PyExc_OverflowError,
10614 "value too large to convert to uint8_t");
10615 return (uint8_t) -1;
10616 raise_neg_overflow:
10617 PyErr_SetString(PyExc_OverflowError,
10618 "can't convert negative value to uint8_t");
10619 return (uint8_t) -1;
10620 }
10621
10622 /* CIntFromPy */
__Pyx_PyInt_As_uint64_t(PyObject * x)10623 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
10624 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10625 #pragma GCC diagnostic push
10626 #pragma GCC diagnostic ignored "-Wconversion"
10627 #endif
10628 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
10629 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10630 #pragma GCC diagnostic pop
10631 #endif
10632 const int is_unsigned = neg_one > const_zero;
10633 #if PY_MAJOR_VERSION < 3
10634 if (likely(PyInt_Check(x))) {
10635 if (sizeof(uint64_t) < sizeof(long)) {
10636 __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
10637 } else {
10638 long val = PyInt_AS_LONG(x);
10639 if (is_unsigned && unlikely(val < 0)) {
10640 goto raise_neg_overflow;
10641 }
10642 return (uint64_t) val;
10643 }
10644 } else
10645 #endif
10646 if (likely(PyLong_Check(x))) {
10647 if (is_unsigned) {
10648 #if CYTHON_USE_PYLONG_INTERNALS
10649 const digit* digits = ((PyLongObject*)x)->ob_digit;
10650 switch (Py_SIZE(x)) {
10651 case 0: return (uint64_t) 0;
10652 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
10653 case 2:
10654 if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
10655 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10656 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10657 } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
10658 return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
10659 }
10660 }
10661 break;
10662 case 3:
10663 if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
10664 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10665 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10666 } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
10667 return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
10668 }
10669 }
10670 break;
10671 case 4:
10672 if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
10673 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10674 __PYX_VERIFY_RETURN_INT(uint64_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])))
10675 } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
10676 return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
10677 }
10678 }
10679 break;
10680 }
10681 #endif
10682 #if CYTHON_COMPILING_IN_CPYTHON
10683 if (unlikely(Py_SIZE(x) < 0)) {
10684 goto raise_neg_overflow;
10685 }
10686 #else
10687 {
10688 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10689 if (unlikely(result < 0))
10690 return (uint64_t) -1;
10691 if (unlikely(result == 1))
10692 goto raise_neg_overflow;
10693 }
10694 #endif
10695 if (sizeof(uint64_t) <= sizeof(unsigned long)) {
10696 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
10697 #ifdef HAVE_LONG_LONG
10698 } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
10699 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10700 #endif
10701 }
10702 } else {
10703 #if CYTHON_USE_PYLONG_INTERNALS
10704 const digit* digits = ((PyLongObject*)x)->ob_digit;
10705 switch (Py_SIZE(x)) {
10706 case 0: return (uint64_t) 0;
10707 case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
10708 case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0])
10709 case -2:
10710 if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
10711 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10712 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10713 } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
10714 return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10715 }
10716 }
10717 break;
10718 case 2:
10719 if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
10720 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10721 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10722 } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
10723 return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10724 }
10725 }
10726 break;
10727 case -3:
10728 if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
10729 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10730 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10731 } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
10732 return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10733 }
10734 }
10735 break;
10736 case 3:
10737 if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
10738 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10739 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10740 } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
10741 return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10742 }
10743 }
10744 break;
10745 case -4:
10746 if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
10747 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10748 __PYX_VERIFY_RETURN_INT(uint64_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])))
10749 } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
10750 return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10751 }
10752 }
10753 break;
10754 case 4:
10755 if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
10756 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10757 __PYX_VERIFY_RETURN_INT(uint64_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])))
10758 } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
10759 return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
10760 }
10761 }
10762 break;
10763 }
10764 #endif
10765 if (sizeof(uint64_t) <= sizeof(long)) {
10766 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
10767 #ifdef HAVE_LONG_LONG
10768 } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
10769 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
10770 #endif
10771 }
10772 }
10773 {
10774 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10775 PyErr_SetString(PyExc_RuntimeError,
10776 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10777 #else
10778 uint64_t val;
10779 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10780 #if PY_MAJOR_VERSION < 3
10781 if (likely(v) && !PyLong_Check(v)) {
10782 PyObject *tmp = v;
10783 v = PyNumber_Long(tmp);
10784 Py_DECREF(tmp);
10785 }
10786 #endif
10787 if (likely(v)) {
10788 int one = 1; int is_little = (int)*(unsigned char *)&one;
10789 unsigned char *bytes = (unsigned char *)&val;
10790 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10791 bytes, sizeof(val),
10792 is_little, !is_unsigned);
10793 Py_DECREF(v);
10794 if (likely(!ret))
10795 return val;
10796 }
10797 #endif
10798 return (uint64_t) -1;
10799 }
10800 } else {
10801 uint64_t val;
10802 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10803 if (!tmp) return (uint64_t) -1;
10804 val = __Pyx_PyInt_As_uint64_t(tmp);
10805 Py_DECREF(tmp);
10806 return val;
10807 }
10808 raise_overflow:
10809 PyErr_SetString(PyExc_OverflowError,
10810 "value too large to convert to uint64_t");
10811 return (uint64_t) -1;
10812 raise_neg_overflow:
10813 PyErr_SetString(PyExc_OverflowError,
10814 "can't convert negative value to uint64_t");
10815 return (uint64_t) -1;
10816 }
10817
10818 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)10819 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
10820 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10821 #pragma GCC diagnostic push
10822 #pragma GCC diagnostic ignored "-Wconversion"
10823 #endif
10824 const long neg_one = (long) -1, const_zero = (long) 0;
10825 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
10826 #pragma GCC diagnostic pop
10827 #endif
10828 const int is_unsigned = neg_one > const_zero;
10829 #if PY_MAJOR_VERSION < 3
10830 if (likely(PyInt_Check(x))) {
10831 if (sizeof(long) < sizeof(long)) {
10832 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
10833 } else {
10834 long val = PyInt_AS_LONG(x);
10835 if (is_unsigned && unlikely(val < 0)) {
10836 goto raise_neg_overflow;
10837 }
10838 return (long) val;
10839 }
10840 } else
10841 #endif
10842 if (likely(PyLong_Check(x))) {
10843 if (is_unsigned) {
10844 #if CYTHON_USE_PYLONG_INTERNALS
10845 const digit* digits = ((PyLongObject*)x)->ob_digit;
10846 switch (Py_SIZE(x)) {
10847 case 0: return (long) 0;
10848 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
10849 case 2:
10850 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10851 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10852 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10853 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
10854 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10855 }
10856 }
10857 break;
10858 case 3:
10859 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10860 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10861 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10862 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
10863 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10864 }
10865 }
10866 break;
10867 case 4:
10868 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10869 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10870 __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])))
10871 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
10872 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10873 }
10874 }
10875 break;
10876 }
10877 #endif
10878 #if CYTHON_COMPILING_IN_CPYTHON
10879 if (unlikely(Py_SIZE(x) < 0)) {
10880 goto raise_neg_overflow;
10881 }
10882 #else
10883 {
10884 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10885 if (unlikely(result < 0))
10886 return (long) -1;
10887 if (unlikely(result == 1))
10888 goto raise_neg_overflow;
10889 }
10890 #endif
10891 if (sizeof(long) <= sizeof(unsigned long)) {
10892 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
10893 #ifdef HAVE_LONG_LONG
10894 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10895 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10896 #endif
10897 }
10898 } else {
10899 #if CYTHON_USE_PYLONG_INTERNALS
10900 const digit* digits = ((PyLongObject*)x)->ob_digit;
10901 switch (Py_SIZE(x)) {
10902 case 0: return (long) 0;
10903 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
10904 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
10905 case -2:
10906 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
10907 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10908 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10909 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10910 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10911 }
10912 }
10913 break;
10914 case 2:
10915 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10916 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10917 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10918 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10919 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10920 }
10921 }
10922 break;
10923 case -3:
10924 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10925 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10926 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10927 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10928 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10929 }
10930 }
10931 break;
10932 case 3:
10933 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10934 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10935 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10936 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10937 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10938 }
10939 }
10940 break;
10941 case -4:
10942 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10943 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10944 __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])))
10945 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10946 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10947 }
10948 }
10949 break;
10950 case 4:
10951 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10952 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10953 __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])))
10954 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10955 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10956 }
10957 }
10958 break;
10959 }
10960 #endif
10961 if (sizeof(long) <= sizeof(long)) {
10962 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
10963 #ifdef HAVE_LONG_LONG
10964 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10965 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
10966 #endif
10967 }
10968 }
10969 {
10970 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10971 PyErr_SetString(PyExc_RuntimeError,
10972 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10973 #else
10974 long val;
10975 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10976 #if PY_MAJOR_VERSION < 3
10977 if (likely(v) && !PyLong_Check(v)) {
10978 PyObject *tmp = v;
10979 v = PyNumber_Long(tmp);
10980 Py_DECREF(tmp);
10981 }
10982 #endif
10983 if (likely(v)) {
10984 int one = 1; int is_little = (int)*(unsigned char *)&one;
10985 unsigned char *bytes = (unsigned char *)&val;
10986 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10987 bytes, sizeof(val),
10988 is_little, !is_unsigned);
10989 Py_DECREF(v);
10990 if (likely(!ret))
10991 return val;
10992 }
10993 #endif
10994 return (long) -1;
10995 }
10996 } else {
10997 long val;
10998 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10999 if (!tmp) return (long) -1;
11000 val = __Pyx_PyInt_As_long(tmp);
11001 Py_DECREF(tmp);
11002 return val;
11003 }
11004 raise_overflow:
11005 PyErr_SetString(PyExc_OverflowError,
11006 "value too large to convert to long");
11007 return (long) -1;
11008 raise_neg_overflow:
11009 PyErr_SetString(PyExc_OverflowError,
11010 "can't convert negative value to long");
11011 return (long) -1;
11012 }
11013
11014 /* CIntToPy */
__Pyx_PyInt_From_int(int value)11015 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
11016 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11017 #pragma GCC diagnostic push
11018 #pragma GCC diagnostic ignored "-Wconversion"
11019 #endif
11020 const int neg_one = (int) -1, const_zero = (int) 0;
11021 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11022 #pragma GCC diagnostic pop
11023 #endif
11024 const int is_unsigned = neg_one > const_zero;
11025 if (is_unsigned) {
11026 if (sizeof(int) < sizeof(long)) {
11027 return PyInt_FromLong((long) value);
11028 } else if (sizeof(int) <= sizeof(unsigned long)) {
11029 return PyLong_FromUnsignedLong((unsigned long) value);
11030 #ifdef HAVE_LONG_LONG
11031 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
11032 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11033 #endif
11034 }
11035 } else {
11036 if (sizeof(int) <= sizeof(long)) {
11037 return PyInt_FromLong((long) value);
11038 #ifdef HAVE_LONG_LONG
11039 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
11040 return PyLong_FromLongLong((PY_LONG_LONG) value);
11041 #endif
11042 }
11043 }
11044 {
11045 int one = 1; int little = (int)*(unsigned char *)&one;
11046 unsigned char *bytes = (unsigned char *)&value;
11047 return _PyLong_FromByteArray(bytes, sizeof(int),
11048 little, !is_unsigned);
11049 }
11050 }
11051
11052 /* CIntToPy */
__Pyx_PyInt_From_long(long value)11053 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
11054 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11055 #pragma GCC diagnostic push
11056 #pragma GCC diagnostic ignored "-Wconversion"
11057 #endif
11058 const long neg_one = (long) -1, const_zero = (long) 0;
11059 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11060 #pragma GCC diagnostic pop
11061 #endif
11062 const int is_unsigned = neg_one > const_zero;
11063 if (is_unsigned) {
11064 if (sizeof(long) < sizeof(long)) {
11065 return PyInt_FromLong((long) value);
11066 } else if (sizeof(long) <= sizeof(unsigned long)) {
11067 return PyLong_FromUnsignedLong((unsigned long) value);
11068 #ifdef HAVE_LONG_LONG
11069 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
11070 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11071 #endif
11072 }
11073 } else {
11074 if (sizeof(long) <= sizeof(long)) {
11075 return PyInt_FromLong((long) value);
11076 #ifdef HAVE_LONG_LONG
11077 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
11078 return PyLong_FromLongLong((PY_LONG_LONG) value);
11079 #endif
11080 }
11081 }
11082 {
11083 int one = 1; int little = (int)*(unsigned char *)&one;
11084 unsigned char *bytes = (unsigned char *)&value;
11085 return _PyLong_FromByteArray(bytes, sizeof(long),
11086 little, !is_unsigned);
11087 }
11088 }
11089
11090 /* ObjectAsUCS4 */
__Pyx__PyObject_AsPy_UCS4_raise_error(long ival)11091 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) {
11092 if (ival < 0) {
11093 if (!PyErr_Occurred())
11094 PyErr_SetString(PyExc_OverflowError,
11095 "cannot convert negative value to Py_UCS4");
11096 } else {
11097 PyErr_SetString(PyExc_OverflowError,
11098 "value too large to convert to Py_UCS4");
11099 }
11100 return (Py_UCS4)-1;
11101 }
__Pyx__PyObject_AsPy_UCS4(PyObject * x)11102 static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) {
11103 long ival;
11104 ival = __Pyx_PyInt_As_long(x);
11105 if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) {
11106 return __Pyx__PyObject_AsPy_UCS4_raise_error(ival);
11107 }
11108 return (Py_UCS4)ival;
11109 }
11110
11111 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)11112 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
11113 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11114 #pragma GCC diagnostic push
11115 #pragma GCC diagnostic ignored "-Wconversion"
11116 #endif
11117 const int neg_one = (int) -1, const_zero = (int) 0;
11118 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
11119 #pragma GCC diagnostic pop
11120 #endif
11121 const int is_unsigned = neg_one > const_zero;
11122 #if PY_MAJOR_VERSION < 3
11123 if (likely(PyInt_Check(x))) {
11124 if (sizeof(int) < sizeof(long)) {
11125 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
11126 } else {
11127 long val = PyInt_AS_LONG(x);
11128 if (is_unsigned && unlikely(val < 0)) {
11129 goto raise_neg_overflow;
11130 }
11131 return (int) val;
11132 }
11133 } else
11134 #endif
11135 if (likely(PyLong_Check(x))) {
11136 if (is_unsigned) {
11137 #if CYTHON_USE_PYLONG_INTERNALS
11138 const digit* digits = ((PyLongObject*)x)->ob_digit;
11139 switch (Py_SIZE(x)) {
11140 case 0: return (int) 0;
11141 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
11142 case 2:
11143 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11144 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11145 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11146 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
11147 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11148 }
11149 }
11150 break;
11151 case 3:
11152 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11153 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11154 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11155 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
11156 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11157 }
11158 }
11159 break;
11160 case 4:
11161 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11162 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11163 __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])))
11164 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
11165 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11166 }
11167 }
11168 break;
11169 }
11170 #endif
11171 #if CYTHON_COMPILING_IN_CPYTHON
11172 if (unlikely(Py_SIZE(x) < 0)) {
11173 goto raise_neg_overflow;
11174 }
11175 #else
11176 {
11177 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11178 if (unlikely(result < 0))
11179 return (int) -1;
11180 if (unlikely(result == 1))
11181 goto raise_neg_overflow;
11182 }
11183 #endif
11184 if (sizeof(int) <= sizeof(unsigned long)) {
11185 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
11186 #ifdef HAVE_LONG_LONG
11187 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
11188 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11189 #endif
11190 }
11191 } else {
11192 #if CYTHON_USE_PYLONG_INTERNALS
11193 const digit* digits = ((PyLongObject*)x)->ob_digit;
11194 switch (Py_SIZE(x)) {
11195 case 0: return (int) 0;
11196 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
11197 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
11198 case -2:
11199 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
11200 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11201 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11202 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11203 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11204 }
11205 }
11206 break;
11207 case 2:
11208 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11209 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11210 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11211 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11212 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11213 }
11214 }
11215 break;
11216 case -3:
11217 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11218 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11219 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11220 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11221 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11222 }
11223 }
11224 break;
11225 case 3:
11226 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11227 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11228 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11229 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11230 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11231 }
11232 }
11233 break;
11234 case -4:
11235 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11236 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11237 __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])))
11238 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11239 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11240 }
11241 }
11242 break;
11243 case 4:
11244 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11245 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11246 __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])))
11247 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11248 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11249 }
11250 }
11251 break;
11252 }
11253 #endif
11254 if (sizeof(int) <= sizeof(long)) {
11255 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
11256 #ifdef HAVE_LONG_LONG
11257 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
11258 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
11259 #endif
11260 }
11261 }
11262 {
11263 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11264 PyErr_SetString(PyExc_RuntimeError,
11265 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11266 #else
11267 int val;
11268 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11269 #if PY_MAJOR_VERSION < 3
11270 if (likely(v) && !PyLong_Check(v)) {
11271 PyObject *tmp = v;
11272 v = PyNumber_Long(tmp);
11273 Py_DECREF(tmp);
11274 }
11275 #endif
11276 if (likely(v)) {
11277 int one = 1; int is_little = (int)*(unsigned char *)&one;
11278 unsigned char *bytes = (unsigned char *)&val;
11279 int ret = _PyLong_AsByteArray((PyLongObject *)v,
11280 bytes, sizeof(val),
11281 is_little, !is_unsigned);
11282 Py_DECREF(v);
11283 if (likely(!ret))
11284 return val;
11285 }
11286 #endif
11287 return (int) -1;
11288 }
11289 } else {
11290 int val;
11291 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11292 if (!tmp) return (int) -1;
11293 val = __Pyx_PyInt_As_int(tmp);
11294 Py_DECREF(tmp);
11295 return val;
11296 }
11297 raise_overflow:
11298 PyErr_SetString(PyExc_OverflowError,
11299 "value too large to convert to int");
11300 return (int) -1;
11301 raise_neg_overflow:
11302 PyErr_SetString(PyExc_OverflowError,
11303 "can't convert negative value to int");
11304 return (int) -1;
11305 }
11306
11307 /* FastTypeChecks */
11308 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)11309 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
11310 while (a) {
11311 a = a->tp_base;
11312 if (a == b)
11313 return 1;
11314 }
11315 return b == &PyBaseObject_Type;
11316 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)11317 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
11318 PyObject *mro;
11319 if (a == b) return 1;
11320 mro = a->tp_mro;
11321 if (likely(mro)) {
11322 Py_ssize_t i, n;
11323 n = PyTuple_GET_SIZE(mro);
11324 for (i = 0; i < n; i++) {
11325 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
11326 return 1;
11327 }
11328 return 0;
11329 }
11330 return __Pyx_InBases(a, b);
11331 }
11332 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)11333 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
11334 PyObject *exception, *value, *tb;
11335 int res;
11336 __Pyx_PyThreadState_declare
11337 __Pyx_PyThreadState_assign
11338 __Pyx_ErrFetch(&exception, &value, &tb);
11339 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
11340 if (unlikely(res == -1)) {
11341 PyErr_WriteUnraisable(err);
11342 res = 0;
11343 }
11344 if (!res) {
11345 res = PyObject_IsSubclass(err, exc_type2);
11346 if (unlikely(res == -1)) {
11347 PyErr_WriteUnraisable(err);
11348 res = 0;
11349 }
11350 }
11351 __Pyx_ErrRestore(exception, value, tb);
11352 return res;
11353 }
11354 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)11355 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
11356 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
11357 if (!res) {
11358 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
11359 }
11360 return res;
11361 }
11362 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)11363 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
11364 Py_ssize_t i, n;
11365 assert(PyExceptionClass_Check(exc_type));
11366 n = PyTuple_GET_SIZE(tuple);
11367 #if PY_MAJOR_VERSION >= 3
11368 for (i=0; i<n; i++) {
11369 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
11370 }
11371 #endif
11372 for (i=0; i<n; i++) {
11373 PyObject *t = PyTuple_GET_ITEM(tuple, i);
11374 #if PY_MAJOR_VERSION < 3
11375 if (likely(exc_type == t)) return 1;
11376 #endif
11377 if (likely(PyExceptionClass_Check(t))) {
11378 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
11379 } else {
11380 }
11381 }
11382 return 0;
11383 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)11384 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
11385 if (likely(err == exc_type)) return 1;
11386 if (likely(PyExceptionClass_Check(err))) {
11387 if (likely(PyExceptionClass_Check(exc_type))) {
11388 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
11389 } else if (likely(PyTuple_Check(exc_type))) {
11390 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
11391 } else {
11392 }
11393 }
11394 return PyErr_GivenExceptionMatches(err, exc_type);
11395 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)11396 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
11397 assert(PyExceptionClass_Check(exc_type1));
11398 assert(PyExceptionClass_Check(exc_type2));
11399 if (likely(err == exc_type1 || err == exc_type2)) return 1;
11400 if (likely(PyExceptionClass_Check(err))) {
11401 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
11402 }
11403 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
11404 }
11405 #endif
11406
11407 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)11408 static int __Pyx_check_binary_version(void) {
11409 char ctversion[4], rtversion[4];
11410 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
11411 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
11412 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
11413 char message[200];
11414 PyOS_snprintf(message, sizeof(message),
11415 "compiletime version %s of module '%.100s' "
11416 "does not match runtime version %s",
11417 ctversion, __Pyx_MODULE_NAME, rtversion);
11418 return PyErr_WarnEx(NULL, message, 1);
11419 }
11420 return 0;
11421 }
11422
11423 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)11424 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
11425 while (t->p) {
11426 #if PY_MAJOR_VERSION < 3
11427 if (t->is_unicode) {
11428 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
11429 } else if (t->intern) {
11430 *t->p = PyString_InternFromString(t->s);
11431 } else {
11432 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
11433 }
11434 #else
11435 if (t->is_unicode | t->is_str) {
11436 if (t->intern) {
11437 *t->p = PyUnicode_InternFromString(t->s);
11438 } else if (t->encoding) {
11439 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
11440 } else {
11441 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
11442 }
11443 } else {
11444 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
11445 }
11446 #endif
11447 if (!*t->p)
11448 return -1;
11449 if (PyObject_Hash(*t->p) == -1)
11450 return -1;
11451 ++t;
11452 }
11453 return 0;
11454 }
11455
__Pyx_PyUnicode_FromString(const char * c_str)11456 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
11457 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
11458 }
__Pyx_PyObject_AsString(PyObject * o)11459 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
11460 Py_ssize_t ignore;
11461 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
11462 }
11463 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
11464 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)11465 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11466 char* defenc_c;
11467 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
11468 if (!defenc) return NULL;
11469 defenc_c = PyBytes_AS_STRING(defenc);
11470 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11471 {
11472 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
11473 char* c;
11474 for (c = defenc_c; c < end; c++) {
11475 if ((unsigned char) (*c) >= 128) {
11476 PyUnicode_AsASCIIString(o);
11477 return NULL;
11478 }
11479 }
11480 }
11481 #endif
11482 *length = PyBytes_GET_SIZE(defenc);
11483 return defenc_c;
11484 }
11485 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)11486 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11487 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
11488 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11489 if (likely(PyUnicode_IS_ASCII(o))) {
11490 *length = PyUnicode_GET_LENGTH(o);
11491 return PyUnicode_AsUTF8(o);
11492 } else {
11493 PyUnicode_AsASCIIString(o);
11494 return NULL;
11495 }
11496 #else
11497 return PyUnicode_AsUTF8AndSize(o, length);
11498 #endif
11499 }
11500 #endif
11501 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)11502 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11503 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
11504 if (
11505 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11506 __Pyx_sys_getdefaultencoding_not_ascii &&
11507 #endif
11508 PyUnicode_Check(o)) {
11509 return __Pyx_PyUnicode_AsStringAndSize(o, length);
11510 } else
11511 #endif
11512 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
11513 if (PyByteArray_Check(o)) {
11514 *length = PyByteArray_GET_SIZE(o);
11515 return PyByteArray_AS_STRING(o);
11516 } else
11517 #endif
11518 {
11519 char* result;
11520 int r = PyBytes_AsStringAndSize(o, &result, length);
11521 if (unlikely(r < 0)) {
11522 return NULL;
11523 } else {
11524 return result;
11525 }
11526 }
11527 }
__Pyx_PyObject_IsTrue(PyObject * x)11528 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
11529 int is_true = x == Py_True;
11530 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
11531 else return PyObject_IsTrue(x);
11532 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)11533 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
11534 int retval;
11535 if (unlikely(!x)) return -1;
11536 retval = __Pyx_PyObject_IsTrue(x);
11537 Py_DECREF(x);
11538 return retval;
11539 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)11540 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
11541 #if PY_MAJOR_VERSION >= 3
11542 if (PyLong_Check(result)) {
11543 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
11544 "__int__ returned non-int (type %.200s). "
11545 "The ability to return an instance of a strict subclass of int "
11546 "is deprecated, and may be removed in a future version of Python.",
11547 Py_TYPE(result)->tp_name)) {
11548 Py_DECREF(result);
11549 return NULL;
11550 }
11551 return result;
11552 }
11553 #endif
11554 PyErr_Format(PyExc_TypeError,
11555 "__%.4s__ returned non-%.4s (type %.200s)",
11556 type_name, type_name, Py_TYPE(result)->tp_name);
11557 Py_DECREF(result);
11558 return NULL;
11559 }
__Pyx_PyNumber_IntOrLong(PyObject * x)11560 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
11561 #if CYTHON_USE_TYPE_SLOTS
11562 PyNumberMethods *m;
11563 #endif
11564 const char *name = NULL;
11565 PyObject *res = NULL;
11566 #if PY_MAJOR_VERSION < 3
11567 if (likely(PyInt_Check(x) || PyLong_Check(x)))
11568 #else
11569 if (likely(PyLong_Check(x)))
11570 #endif
11571 return __Pyx_NewRef(x);
11572 #if CYTHON_USE_TYPE_SLOTS
11573 m = Py_TYPE(x)->tp_as_number;
11574 #if PY_MAJOR_VERSION < 3
11575 if (m && m->nb_int) {
11576 name = "int";
11577 res = m->nb_int(x);
11578 }
11579 else if (m && m->nb_long) {
11580 name = "long";
11581 res = m->nb_long(x);
11582 }
11583 #else
11584 if (likely(m && m->nb_int)) {
11585 name = "int";
11586 res = m->nb_int(x);
11587 }
11588 #endif
11589 #else
11590 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
11591 res = PyNumber_Int(x);
11592 }
11593 #endif
11594 if (likely(res)) {
11595 #if PY_MAJOR_VERSION < 3
11596 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
11597 #else
11598 if (unlikely(!PyLong_CheckExact(res))) {
11599 #endif
11600 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
11601 }
11602 }
11603 else if (!PyErr_Occurred()) {
11604 PyErr_SetString(PyExc_TypeError,
11605 "an integer is required");
11606 }
11607 return res;
11608 }
11609 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
11610 Py_ssize_t ival;
11611 PyObject *x;
11612 #if PY_MAJOR_VERSION < 3
11613 if (likely(PyInt_CheckExact(b))) {
11614 if (sizeof(Py_ssize_t) >= sizeof(long))
11615 return PyInt_AS_LONG(b);
11616 else
11617 return PyInt_AsSsize_t(b);
11618 }
11619 #endif
11620 if (likely(PyLong_CheckExact(b))) {
11621 #if CYTHON_USE_PYLONG_INTERNALS
11622 const digit* digits = ((PyLongObject*)b)->ob_digit;
11623 const Py_ssize_t size = Py_SIZE(b);
11624 if (likely(__Pyx_sst_abs(size) <= 1)) {
11625 ival = likely(size) ? digits[0] : 0;
11626 if (size == -1) ival = -ival;
11627 return ival;
11628 } else {
11629 switch (size) {
11630 case 2:
11631 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11632 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11633 }
11634 break;
11635 case -2:
11636 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11637 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11638 }
11639 break;
11640 case 3:
11641 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11642 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11643 }
11644 break;
11645 case -3:
11646 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11647 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11648 }
11649 break;
11650 case 4:
11651 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11652 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]));
11653 }
11654 break;
11655 case -4:
11656 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11657 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]));
11658 }
11659 break;
11660 }
11661 }
11662 #endif
11663 return PyLong_AsSsize_t(b);
11664 }
11665 x = PyNumber_Index(b);
11666 if (!x) return -1;
11667 ival = PyInt_AsSsize_t(x);
11668 Py_DECREF(x);
11669 return ival;
11670 }
11671 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
11672 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
11673 }
11674 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11675 return PyInt_FromSize_t(ival);
11676 }
11677
11678
11679 #endif /* Py_PYTHON_H */
11680