1 /* Generated by Cython 0.24.1 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8 #error Cython requires Python 2.6+ or Python 3.2+.
9 #else
10 #define CYTHON_ABI "0_24_1"
11 #include <stddef.h>
12 #ifndef offsetof
13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16 #ifndef __stdcall
17 #define __stdcall
18 #endif
19 #ifndef __cdecl
20 #define __cdecl
21 #endif
22 #ifndef __fastcall
23 #define __fastcall
24 #endif
25 #endif
26 #ifndef DL_IMPORT
27 #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30 #define DL_EXPORT(t) t
31 #endif
32 #ifndef PY_LONG_LONG
33 #define PY_LONG_LONG LONG_LONG
34 #endif
35 #ifndef Py_HUGE_VAL
36 #define Py_HUGE_VAL HUGE_VAL
37 #endif
38 #ifdef PYPY_VERSION
39 #define CYTHON_COMPILING_IN_PYPY 1
40 #define CYTHON_COMPILING_IN_CPYTHON 0
41 #else
42 #define CYTHON_COMPILING_IN_PYPY 0
43 #define CYTHON_COMPILING_IN_CPYTHON 1
44 #endif
45 #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
46 #define CYTHON_USE_PYLONG_INTERNALS 1
47 #endif
48 #if CYTHON_USE_PYLONG_INTERNALS
49 #include "longintrepr.h"
50 #undef SHIFT
51 #undef BASE
52 #undef MASK
53 #endif
54 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
55 #define Py_OptimizeFlag 0
56 #endif
57 #define __PYX_BUILD_PY_SSIZE_T "n"
58 #define CYTHON_FORMAT_SSIZE_T "z"
59 #if PY_MAJOR_VERSION < 3
60 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
61 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
62 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
63 #define __Pyx_DefaultClassType PyClass_Type
64 #else
65 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
66 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
67 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
68 #define __Pyx_DefaultClassType PyType_Type
69 #endif
70 #ifndef Py_TPFLAGS_CHECKTYPES
71 #define Py_TPFLAGS_CHECKTYPES 0
72 #endif
73 #ifndef Py_TPFLAGS_HAVE_INDEX
74 #define Py_TPFLAGS_HAVE_INDEX 0
75 #endif
76 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
77 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
78 #endif
79 #ifndef Py_TPFLAGS_HAVE_FINALIZE
80 #define Py_TPFLAGS_HAVE_FINALIZE 0
81 #endif
82 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
83 #define CYTHON_PEP393_ENABLED 1
84 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
85 0 : _PyUnicode_Ready((PyObject *)(op)))
86 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
87 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
88 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
89 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
90 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
91 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
92 #else
93 #define CYTHON_PEP393_ENABLED 0
94 #define __Pyx_PyUnicode_READY(op) (0)
95 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
96 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
97 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
98 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
99 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
100 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
101 #endif
102 #if CYTHON_COMPILING_IN_PYPY
103 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
104 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
105 #else
106 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
107 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
108 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
109 #endif
110 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
111 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
112 #endif
113 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
114 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
115 #endif
116 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
117 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
118 #endif
119 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
120 #define PyObject_Malloc(s) PyMem_Malloc(s)
121 #define PyObject_Free(p) PyMem_Free(p)
122 #define PyObject_Realloc(p) PyMem_Realloc(p)
123 #endif
124 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
125 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
126 #if PY_MAJOR_VERSION >= 3
127 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
128 #else
129 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
130 #endif
131 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
132 #define PyObject_ASCII(o) PyObject_Repr(o)
133 #endif
134 #if PY_MAJOR_VERSION >= 3
135 #define PyBaseString_Type PyUnicode_Type
136 #define PyStringObject PyUnicodeObject
137 #define PyString_Type PyUnicode_Type
138 #define PyString_Check PyUnicode_Check
139 #define PyString_CheckExact PyUnicode_CheckExact
140 #endif
141 #if PY_MAJOR_VERSION >= 3
142 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
143 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
144 #else
145 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
146 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
147 #endif
148 #ifndef PySet_CheckExact
149 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
150 #endif
151 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
152 #if PY_MAJOR_VERSION >= 3
153 #define PyIntObject PyLongObject
154 #define PyInt_Type PyLong_Type
155 #define PyInt_Check(op) PyLong_Check(op)
156 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
157 #define PyInt_FromString PyLong_FromString
158 #define PyInt_FromUnicode PyLong_FromUnicode
159 #define PyInt_FromLong PyLong_FromLong
160 #define PyInt_FromSize_t PyLong_FromSize_t
161 #define PyInt_FromSsize_t PyLong_FromSsize_t
162 #define PyInt_AsLong PyLong_AsLong
163 #define PyInt_AS_LONG PyLong_AS_LONG
164 #define PyInt_AsSsize_t PyLong_AsSsize_t
165 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
166 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
167 #define PyNumber_Int PyNumber_Long
168 #endif
169 #if PY_MAJOR_VERSION >= 3
170 #define PyBoolObject PyLongObject
171 #endif
172 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
173 #ifndef PyUnicode_InternFromString
174 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
175 #endif
176 #endif
177 #if PY_VERSION_HEX < 0x030200A4
178 typedef long Py_hash_t;
179 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
180 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
181 #else
182 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
183 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
184 #endif
185 #if PY_MAJOR_VERSION >= 3
186 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
187 #else
188 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
189 #endif
190 #if PY_VERSION_HEX >= 0x030500B1
191 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
192 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
193 #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
194 typedef struct {
195 unaryfunc am_await;
196 unaryfunc am_aiter;
197 unaryfunc am_anext;
198 } __Pyx_PyAsyncMethodsStruct;
199 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
200 #else
201 #define __Pyx_PyType_AsAsync(obj) NULL
202 #endif
203 #ifndef CYTHON_RESTRICT
204 #if defined(__GNUC__)
205 #define CYTHON_RESTRICT __restrict__
206 #elif defined(_MSC_VER) && _MSC_VER >= 1400
207 #define CYTHON_RESTRICT __restrict
208 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
209 #define CYTHON_RESTRICT restrict
210 #else
211 #define CYTHON_RESTRICT
212 #endif
213 #endif
214 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
215
216 #ifndef CYTHON_INLINE
217 #if defined(__GNUC__)
218 #define CYTHON_INLINE __inline__
219 #elif defined(_MSC_VER)
220 #define CYTHON_INLINE __inline
221 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
222 #define CYTHON_INLINE inline
223 #else
224 #define CYTHON_INLINE
225 #endif
226 #endif
227
228 #if defined(WIN32) || defined(MS_WINDOWS)
229 #define _USE_MATH_DEFINES
230 #endif
231 #include <math.h>
232 #ifdef NAN
233 #define __PYX_NAN() ((float) NAN)
234 #else
__PYX_NAN()235 static CYTHON_INLINE float __PYX_NAN() {
236 float value;
237 memset(&value, 0xFF, sizeof(value));
238 return value;
239 }
240 #endif
241 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
242 #define __Pyx_truncl trunc
243 #else
244 #define __Pyx_truncl truncl
245 #endif
246
247
248 #define __PYX_ERR(f_index, lineno, Ln_error) \
249 { \
250 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
251 }
252
253 #if PY_MAJOR_VERSION >= 3
254 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
255 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
256 #else
257 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
258 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
259 #endif
260
261 #ifndef __PYX_EXTERN_C
262 #ifdef __cplusplus
263 #define __PYX_EXTERN_C extern "C"
264 #else
265 #define __PYX_EXTERN_C extern
266 #endif
267 #endif
268
269 #define __PYX_HAVE__tinycss__speedups
270 #define __PYX_HAVE_API__tinycss__speedups
271 #ifdef _OPENMP
272 #include <omp.h>
273 #endif /* _OPENMP */
274
275 #ifdef PYREX_WITHOUT_ASSERTIONS
276 #define CYTHON_WITHOUT_ASSERTIONS
277 #endif
278
279 #ifndef CYTHON_UNUSED
280 # if defined(__GNUC__)
281 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
282 # define CYTHON_UNUSED __attribute__ ((__unused__))
283 # else
284 # define CYTHON_UNUSED
285 # endif
286 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
287 # define CYTHON_UNUSED __attribute__ ((__unused__))
288 # else
289 # define CYTHON_UNUSED
290 # endif
291 #endif
292 #ifndef CYTHON_NCP_UNUSED
293 # if CYTHON_COMPILING_IN_CPYTHON
294 # define CYTHON_NCP_UNUSED
295 # else
296 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
297 # endif
298 #endif
299 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
300 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
301
302 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
303 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
304 #define __PYX_DEFAULT_STRING_ENCODING ""
305 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
306 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
307 #define __Pyx_uchar_cast(c) ((unsigned char)c)
308 #define __Pyx_long_cast(x) ((long)x)
309 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
310 (sizeof(type) < sizeof(Py_ssize_t)) ||\
311 (sizeof(type) > sizeof(Py_ssize_t) &&\
312 likely(v < (type)PY_SSIZE_T_MAX ||\
313 v == (type)PY_SSIZE_T_MAX) &&\
314 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
315 v == (type)PY_SSIZE_T_MIN))) ||\
316 (sizeof(type) == sizeof(Py_ssize_t) &&\
317 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
318 v == (type)PY_SSIZE_T_MAX))) )
319 #if defined (__cplusplus) && __cplusplus >= 201103L
320 #include <cstdlib>
321 #define __Pyx_sst_abs(value) std::abs(value)
322 #elif SIZEOF_INT >= SIZEOF_SIZE_T
323 #define __Pyx_sst_abs(value) abs(value)
324 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
325 #define __Pyx_sst_abs(value) labs(value)
326 #elif defined (_MSC_VER) && defined (_M_X64)
327 #define __Pyx_sst_abs(value) _abs64(value)
328 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
329 #define __Pyx_sst_abs(value) llabs(value)
330 #elif defined (__GNUC__)
331 #define __Pyx_sst_abs(value) __builtin_llabs(value)
332 #else
333 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
334 #endif
335 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
336 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
337 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
338 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
339 #define __Pyx_PyBytes_FromString PyBytes_FromString
340 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
341 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
342 #if PY_MAJOR_VERSION < 3
343 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
344 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
345 #else
346 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
347 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
348 #endif
349 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
350 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
351 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
352 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
353 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
354 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
355 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
356 #if PY_MAJOR_VERSION < 3
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)357 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
358 {
359 const Py_UNICODE *u_end = u;
360 while (*u_end++) ;
361 return (size_t)(u_end - u - 1);
362 }
363 #else
364 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
365 #endif
366 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
367 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
368 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
369 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
370 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
371 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
372 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
373 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
374 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
375 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
376 #if CYTHON_COMPILING_IN_CPYTHON
377 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
378 #else
379 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
380 #endif
381 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
382 #if PY_MAJOR_VERSION >= 3
383 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
384 #else
385 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
386 #endif
387 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
388 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
389 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)390 static int __Pyx_init_sys_getdefaultencoding_params(void) {
391 PyObject* sys;
392 PyObject* default_encoding = NULL;
393 PyObject* ascii_chars_u = NULL;
394 PyObject* ascii_chars_b = NULL;
395 const char* default_encoding_c;
396 sys = PyImport_ImportModule("sys");
397 if (!sys) goto bad;
398 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
399 Py_DECREF(sys);
400 if (!default_encoding) goto bad;
401 default_encoding_c = PyBytes_AsString(default_encoding);
402 if (!default_encoding_c) goto bad;
403 if (strcmp(default_encoding_c, "ascii") == 0) {
404 __Pyx_sys_getdefaultencoding_not_ascii = 0;
405 } else {
406 char ascii_chars[128];
407 int c;
408 for (c = 0; c < 128; c++) {
409 ascii_chars[c] = c;
410 }
411 __Pyx_sys_getdefaultencoding_not_ascii = 1;
412 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
413 if (!ascii_chars_u) goto bad;
414 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
415 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
416 PyErr_Format(
417 PyExc_ValueError,
418 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
419 default_encoding_c);
420 goto bad;
421 }
422 Py_DECREF(ascii_chars_u);
423 Py_DECREF(ascii_chars_b);
424 }
425 Py_DECREF(default_encoding);
426 return 0;
427 bad:
428 Py_XDECREF(default_encoding);
429 Py_XDECREF(ascii_chars_u);
430 Py_XDECREF(ascii_chars_b);
431 return -1;
432 }
433 #endif
434 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
435 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
436 #else
437 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
438 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
439 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)440 static int __Pyx_init_sys_getdefaultencoding_params(void) {
441 PyObject* sys;
442 PyObject* default_encoding = NULL;
443 char* default_encoding_c;
444 sys = PyImport_ImportModule("sys");
445 if (!sys) goto bad;
446 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
447 Py_DECREF(sys);
448 if (!default_encoding) goto bad;
449 default_encoding_c = PyBytes_AsString(default_encoding);
450 if (!default_encoding_c) goto bad;
451 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
452 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
453 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
454 Py_DECREF(default_encoding);
455 return 0;
456 bad:
457 Py_XDECREF(default_encoding);
458 return -1;
459 }
460 #endif
461 #endif
462
463
464 /* Test for GCC > 2.95 */
465 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
466 #define likely(x) __builtin_expect(!!(x), 1)
467 #define unlikely(x) __builtin_expect(!!(x), 0)
468 #else /* !__GNUC__ or GCC < 2.95 */
469 #define likely(x) (x)
470 #define unlikely(x) (x)
471 #endif /* __GNUC__ */
472
473 static PyObject *__pyx_m;
474 static PyObject *__pyx_d;
475 static PyObject *__pyx_b;
476 static PyObject *__pyx_empty_tuple;
477 static PyObject *__pyx_empty_bytes;
478 static PyObject *__pyx_empty_unicode;
479 static int __pyx_lineno;
480 static int __pyx_clineno = 0;
481 static const char * __pyx_cfilenm= __FILE__;
482 static const char *__pyx_filename;
483
484
485 static const char *__pyx_f[] = {
486 "tinycss/speedups.pyx",
487 };
488
489 /*--- Type declarations ---*/
490 struct __pyx_obj_7tinycss_8speedups_CToken;
491 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr;
492
493 /* "tinycss/speedups.pyx":25
494 *
495 *
496 * cdef class CToken: # <<<<<<<<<<<<<<
497 * """A token built by the Cython speedups. Identical to
498 * :class:`~.token_data.Token`.
499 */
500 struct __pyx_obj_7tinycss_8speedups_CToken {
501 PyObject_HEAD
502 PyObject *type;
503 PyObject *_as_css;
504 PyObject *value;
505 PyObject *unit;
506 Py_ssize_t line;
507 Py_ssize_t column;
508 };
509
510
511 /* "tinycss/speedups.pyx":22
512 *
513 * COMPILED_TOKEN_INDEXES = dict(
514 * (name, i) for i, (name, regexp) in enumerate(COMPILED_TOKEN_REGEXPS)) # <<<<<<<<<<<<<<
515 *
516 *
517 */
518 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr {
519 PyObject_HEAD
520 PyObject *__pyx_v_i;
521 PyObject *__pyx_v_name;
522 PyObject *__pyx_v_regexp;
523 };
524
525
526 /* --- Runtime support code (head) --- */
527 /* Refnanny.proto */
528 #ifndef CYTHON_REFNANNY
529 #define CYTHON_REFNANNY 0
530 #endif
531 #if CYTHON_REFNANNY
532 typedef struct {
533 void (*INCREF)(void*, PyObject*, int);
534 void (*DECREF)(void*, PyObject*, int);
535 void (*GOTREF)(void*, PyObject*, int);
536 void (*GIVEREF)(void*, PyObject*, int);
537 void* (*SetupContext)(const char*, int, const char*);
538 void (*FinishContext)(void**);
539 } __Pyx_RefNannyAPIStruct;
540 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
541 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
542 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
543 #ifdef WITH_THREAD
544 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
545 if (acquire_gil) {\
546 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
547 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
548 PyGILState_Release(__pyx_gilstate_save);\
549 } else {\
550 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
551 }
552 #else
553 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
554 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
555 #endif
556 #define __Pyx_RefNannyFinishContext()\
557 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
558 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
559 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
560 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
561 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
562 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
563 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
564 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
565 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
566 #else
567 #define __Pyx_RefNannyDeclarations
568 #define __Pyx_RefNannySetupContext(name, acquire_gil)
569 #define __Pyx_RefNannyFinishContext()
570 #define __Pyx_INCREF(r) Py_INCREF(r)
571 #define __Pyx_DECREF(r) Py_DECREF(r)
572 #define __Pyx_GOTREF(r)
573 #define __Pyx_GIVEREF(r)
574 #define __Pyx_XINCREF(r) Py_XINCREF(r)
575 #define __Pyx_XDECREF(r) Py_XDECREF(r)
576 #define __Pyx_XGOTREF(r)
577 #define __Pyx_XGIVEREF(r)
578 #endif
579 #define __Pyx_XDECREF_SET(r, v) do {\
580 PyObject *tmp = (PyObject *) r;\
581 r = v; __Pyx_XDECREF(tmp);\
582 } while (0)
583 #define __Pyx_DECREF_SET(r, v) do {\
584 PyObject *tmp = (PyObject *) r;\
585 r = v; __Pyx_DECREF(tmp);\
586 } while (0)
587 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
588 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
589
590 /* PyObjectGetAttrStr.proto */
591 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)592 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
593 PyTypeObject* tp = Py_TYPE(obj);
594 if (likely(tp->tp_getattro))
595 return tp->tp_getattro(obj, attr_name);
596 #if PY_MAJOR_VERSION < 3
597 if (likely(tp->tp_getattr))
598 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
599 #endif
600 return PyObject_GetAttr(obj, attr_name);
601 }
602 #else
603 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
604 #endif
605
606 /* GetBuiltinName.proto */
607 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
608
609 /* GetModuleGlobalName.proto */
610 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
611
612 /* RaiseTooManyValuesToUnpack.proto */
613 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
614
615 /* RaiseNeedMoreValuesToUnpack.proto */
616 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
617
618 /* IterFinish.proto */
619 static CYTHON_INLINE int __Pyx_IterFinish(void);
620
621 /* UnpackItemEndCheck.proto */
622 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
623
624 /* PyIntBinop.proto */
625 #if CYTHON_COMPILING_IN_CPYTHON
626 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
627 #else
628 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
629 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
630 #endif
631
632 /* RaiseArgTupleInvalid.proto */
633 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
634 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
635
636 /* RaiseDoubleKeywords.proto */
637 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
638
639 /* ParseKeywords.proto */
640 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
641 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
642 const char* function_name);
643
644 /* PyObjectCall.proto */
645 #if CYTHON_COMPILING_IN_CPYTHON
646 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
647 #else
648 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
649 #endif
650
651 /* GetItemInt.proto */
652 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
653 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
654 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
655 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
656 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
657 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
658 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
659 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
660 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
661 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
662 int wraparound, int boundscheck);
663 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
664 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
665 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
666 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
667 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
668 int wraparound, int boundscheck);
669 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
670 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
671 int is_list, int wraparound, int boundscheck);
672
673 /* PyUnicodeContains.proto */
__Pyx_PyUnicode_ContainsTF(PyObject * substring,PyObject * text,int eq)674 static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) {
675 int result = PyUnicode_Contains(text, substring);
676 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
677 }
678
679 /* UnicodeAsUCS4.proto */
680 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);
681
682 /* object_ord.proto */
683 #if PY_MAJOR_VERSION >= 3
684 #define __Pyx_PyObject_Ord(c)\
685 (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c))
686 #else
687 #define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c)
688 #endif
689 static long __Pyx__PyObject_Ord(PyObject* c);
690
691 /* PyObjectCallMethO.proto */
692 #if CYTHON_COMPILING_IN_CPYTHON
693 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
694 #endif
695
696 /* PyObjectCallOneArg.proto */
697 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
698
699 /* PyObjectCallNoArg.proto */
700 #if CYTHON_COMPILING_IN_CPYTHON
701 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
702 #else
703 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
704 #endif
705
706 /* None.proto */
707 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
708
709 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)710 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
711 int result = PySequence_Contains(seq, item);
712 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
713 }
714
715 /* SliceObject.proto */
716 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
717 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
718 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
719 int has_cstart, int has_cstop, int wraparound);
720
721 /* ListAppend.proto */
722 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyList_Append(PyObject * list,PyObject * x)723 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
724 PyListObject* L = (PyListObject*) list;
725 Py_ssize_t len = Py_SIZE(list);
726 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
727 Py_INCREF(x);
728 PyList_SET_ITEM(list, len, x);
729 Py_SIZE(list) = len+1;
730 return 0;
731 }
732 return PyList_Append(list, x);
733 }
734 #else
735 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
736 #endif
737
738 /* IncludeStringH.proto */
739 #include <string.h>
740
741 /* Import.proto */
742 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
743
744 /* ImportFrom.proto */
745 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
746
747 /* CodeObjectCache.proto */
748 typedef struct {
749 PyCodeObject* code_object;
750 int code_line;
751 } __Pyx_CodeObjectCacheEntry;
752 struct __Pyx_CodeObjectCache {
753 int count;
754 int max_count;
755 __Pyx_CodeObjectCacheEntry* entries;
756 };
757 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
758 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
759 static PyCodeObject *__pyx_find_code_object(int code_line);
760 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
761
762 /* AddTraceback.proto */
763 static void __Pyx_AddTraceback(const char *funcname, int c_line,
764 int py_line, const char *filename);
765
766 /* CIntToPy.proto */
767 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
768
769 /* CIntToPy.proto */
770 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
771
772 /* CIntFromPy.proto */
773 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
774
775 /* CIntFromPy.proto */
776 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
777
778 /* FetchCommonType.proto */
779 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
780
781 /* PyThreadStateGet.proto */
782 #if CYTHON_COMPILING_IN_CPYTHON
783 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
784 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
785 #else
786 #define __Pyx_PyThreadState_declare
787 #define __Pyx_PyThreadState_assign
788 #endif
789
790 /* PyErrFetchRestore.proto */
791 #if CYTHON_COMPILING_IN_CPYTHON
792 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
793 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
794 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
795 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
796 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
797 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
798 #else
799 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
800 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
801 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
802 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
803 #endif
804
805 /* RaiseException.proto */
806 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
807
808 /* SwapException.proto */
809 #if CYTHON_COMPILING_IN_CPYTHON
810 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
811 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
812 #else
813 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
814 #endif
815
816 /* PyObjectCallMethod1.proto */
817 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
818
819 /* CoroutineBase.proto */
820 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
821 typedef struct {
822 PyObject_HEAD
823 __pyx_coroutine_body_t body;
824 PyObject *closure;
825 PyObject *exc_type;
826 PyObject *exc_value;
827 PyObject *exc_traceback;
828 PyObject *gi_weakreflist;
829 PyObject *classobj;
830 PyObject *yieldfrom;
831 PyObject *gi_name;
832 PyObject *gi_qualname;
833 PyObject *gi_modulename;
834 int resume_label;
835 char is_running;
836 } __pyx_CoroutineObject;
837 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
838 PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
839 PyObject *name, PyObject *qualname, PyObject *module_name);
840 static int __Pyx_Coroutine_clear(PyObject *self);
841 #if 1 || PY_VERSION_HEX < 0x030300B0
842 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
843 #else
844 #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
845 #endif
846
847 /* PatchModuleWithCoroutine.proto */
848 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
849
850 /* PatchGeneratorABC.proto */
851 static int __Pyx_patch_abc(void);
852
853 /* Generator.proto */
854 #define __Pyx_Generator_USED
855 static PyTypeObject *__pyx_GeneratorType = 0;
856 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
857 #define __Pyx_Generator_New(body, closure, name, qualname, module_name)\
858 __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name)
859 static PyObject *__Pyx_Generator_Next(PyObject *self);
860 static int __pyx_Generator_init(void);
861
862 /* CheckBinaryVersion.proto */
863 static int __Pyx_check_binary_version(void);
864
865 /* InitStrings.proto */
866 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
867
868
869 /* Module declarations from 'tinycss.speedups' */
870 static PyTypeObject *__pyx_ptype_7tinycss_8speedups_CToken = 0;
871 static PyTypeObject *__pyx_ptype_7tinycss_8speedups___pyx_scope_struct__genexpr = 0;
872 #define __Pyx_MODULE_NAME "tinycss.speedups"
873 int __pyx_module_is_main_tinycss__speedups = 0;
874
875 /* Implementation of 'tinycss.speedups' */
876 static PyObject *__pyx_builtin_enumerate;
877 static const char __pyx_k_[] = "";
878 static const char __pyx_k__2[] = ":;{}()[]";
879 static const char __pyx_k__4[] = ".";
880 static const char __pyx_k__7[] = "%";
881 static const char __pyx_k__9[] = "\"'";
882 static const char __pyx_k_URI[] = "URI";
883 static const char __pyx_k_end[] = "end";
884 static const char __pyx_k_pos[] = "pos";
885 static const char __pyx_k_HASH[] = "HASH";
886 static const char __pyx_k_args[] = "args";
887 static const char __pyx_k_char[] = "char";
888 static const char __pyx_k_line[] = "line";
889 static const char __pyx_k_main[] = "__main__";
890 static const char __pyx_k_send[] = "send";
891 static const char __pyx_k_test[] = "__test__";
892 static const char __pyx_k_type[] = "type_";
893 static const char __pyx_k_unit[] = "unit";
894 static const char __pyx_k_DELIM[] = "DELIM";
895 static const char __pyx_k_IDENT[] = "IDENT";
896 static const char __pyx_k_close[] = "close";
897 static const char __pyx_k_group[] = "group";
898 static const char __pyx_k_lower[] = "lower";
899 static const char __pyx_k_match[] = "match";
900 static const char __pyx_k_throw[] = "throw";
901 static const char __pyx_k_token[] = "token";
902 static const char __pyx_k_value[] = "value";
903 static const char __pyx_k_NUMBER[] = "NUMBER";
904 static const char __pyx_k_STRING[] = "STRING";
905 static const char __pyx_k_column[] = "column";
906 static const char __pyx_k_format[] = "format";
907 static const char __pyx_k_import[] = "__import__";
908 static const char __pyx_k_length[] = "length";
909 static const char __pyx_k_regexp[] = "regexp";
910 static const char __pyx_k_tokens[] = "tokens";
911 static const char __pyx_k_COMMENT[] = "COMMENT";
912 static const char __pyx_k_INTEGER[] = "INTEGER";
913 static const char __pyx_k_genexpr[] = "genexpr";
914 static const char __pyx_k_FUNCTION[] = "FUNCTION";
915 static const char __pyx_k_n_tokens[] = "n_tokens";
916 static const char __pyx_k_newlines[] = "newlines";
917 static const char __pyx_k_next_pos[] = "next_pos";
918 static const char __pyx_k_ATKEYWORD[] = "ATKEYWORD";
919 static const char __pyx_k_DIMENSION[] = "DIMENSION";
920 static const char __pyx_k_codepoint[] = "codepoint";
921 static const char __pyx_k_css_value[] = "css_value";
922 static const char __pyx_k_enumerate[] = "enumerate";
923 static const char __pyx_k_type_name[] = "type_name";
924 static const char __pyx_k_BAD_STRING[] = "BAD_STRING";
925 static const char __pyx_k_PERCENTAGE[] = "PERCENTAGE";
926 static const char __pyx_k_css_source[] = "css_source";
927 static const char __pyx_k_source_len[] = "source_len";
928 static const char __pyx_k_token_data[] = "token_data";
929 static const char __pyx_k_BAD_COMMENT[] = "BAD_COMMENT";
930 static const char __pyx_k_is_container[] = "is_container";
931 static const char __pyx_k_FIND_NEWLINES[] = "FIND_NEWLINES";
932 static const char __pyx_k_find_newlines[] = "find_newlines";
933 static const char __pyx_k_tokenize_flat[] = "tokenize_flat";
934 static const char __pyx_k_TOKEN_DISPATCH[] = "TOKEN_DISPATCH";
935 static const char __pyx_k_SIMPLE_UNESCAPE[] = "SIMPLE_UNESCAPE";
936 static const char __pyx_k_compiled_tokens[] = "compiled_tokens";
937 static const char __pyx_k_ignore_comments[] = "ignore_comments";
938 static const char __pyx_k_simple_unescape[] = "simple_unescape";
939 static const char __pyx_k_tokens_dispatch[] = "tokens_dispatch";
940 static const char __pyx_k_NEWLINE_UNESCAPE[] = "NEWLINE_UNESCAPE";
941 static const char __pyx_k_UNICODE_UNESCAPE[] = "UNICODE_UNESCAPE";
942 static const char __pyx_k_newline_unescape[] = "newline_unescape";
943 static const char __pyx_k_tinycss_speedups[] = "tinycss.speedups";
944 static const char __pyx_k_unicode_unescape[] = "unicode_unescape";
945 static const char __pyx_k_COMPILED_TOKEN_INDEXES[] = "COMPILED_TOKEN_INDEXES";
946 static const char __pyx_k_COMPILED_TOKEN_REGEXPS[] = "COMPILED_TOKEN_REGEXPS";
947 static const char __pyx_k_compiled_token_indexes[] = "compiled_token_indexes";
948 static const char __pyx_k_home_lize_Informatique_tinycss[] = "/home/lize/Informatique/tinycss/tinycss/speedups.pyx";
949 static const char __pyx_k_tinycss_speedups_Cython_module[] = "\n tinycss.speedups\n ----------------\n\n Cython module for speeding up inner loops.\n\n Right now only :func:`tokenize_flat` has a second implementation.\n\n :copyright: (c) 2010 by Simon Sapin.\n :license: BSD, see LICENSE for more details.\n";
950 static const char __pyx_k_Token_0_type_at_0_line_0_column[] = "<Token {0.type} at {0.line}:{0.column} {0.value!r}{1}>";
951 static PyObject *__pyx_kp_u_;
952 static PyObject *__pyx_n_s_ATKEYWORD;
953 static PyObject *__pyx_n_u_ATKEYWORD;
954 static PyObject *__pyx_n_s_BAD_COMMENT;
955 static PyObject *__pyx_n_u_BAD_COMMENT;
956 static PyObject *__pyx_n_s_BAD_STRING;
957 static PyObject *__pyx_n_u_BAD_STRING;
958 static PyObject *__pyx_n_s_COMMENT;
959 static PyObject *__pyx_n_u_COMMENT;
960 static PyObject *__pyx_n_s_COMPILED_TOKEN_INDEXES;
961 static PyObject *__pyx_n_s_COMPILED_TOKEN_REGEXPS;
962 static PyObject *__pyx_n_s_DELIM;
963 static PyObject *__pyx_n_u_DELIM;
964 static PyObject *__pyx_n_s_DIMENSION;
965 static PyObject *__pyx_n_u_DIMENSION;
966 static PyObject *__pyx_n_s_FIND_NEWLINES;
967 static PyObject *__pyx_n_s_FUNCTION;
968 static PyObject *__pyx_n_u_FUNCTION;
969 static PyObject *__pyx_n_s_HASH;
970 static PyObject *__pyx_n_u_HASH;
971 static PyObject *__pyx_n_s_IDENT;
972 static PyObject *__pyx_n_u_IDENT;
973 static PyObject *__pyx_n_u_INTEGER;
974 static PyObject *__pyx_n_s_NEWLINE_UNESCAPE;
975 static PyObject *__pyx_n_s_NUMBER;
976 static PyObject *__pyx_n_u_NUMBER;
977 static PyObject *__pyx_n_s_PERCENTAGE;
978 static PyObject *__pyx_n_u_PERCENTAGE;
979 static PyObject *__pyx_n_s_SIMPLE_UNESCAPE;
980 static PyObject *__pyx_n_s_STRING;
981 static PyObject *__pyx_n_u_STRING;
982 static PyObject *__pyx_n_s_TOKEN_DISPATCH;
983 static PyObject *__pyx_kp_u_Token_0_type_at_0_line_0_column;
984 static PyObject *__pyx_n_s_UNICODE_UNESCAPE;
985 static PyObject *__pyx_n_s_URI;
986 static PyObject *__pyx_n_u_URI;
987 static PyObject *__pyx_kp_u__2;
988 static PyObject *__pyx_kp_u__4;
989 static PyObject *__pyx_kp_u__7;
990 static PyObject *__pyx_kp_u__9;
991 static PyObject *__pyx_n_s_args;
992 static PyObject *__pyx_n_s_char;
993 static PyObject *__pyx_n_s_close;
994 static PyObject *__pyx_n_s_codepoint;
995 static PyObject *__pyx_n_s_column;
996 static PyObject *__pyx_n_s_compiled_token_indexes;
997 static PyObject *__pyx_n_s_compiled_tokens;
998 static PyObject *__pyx_n_s_css_source;
999 static PyObject *__pyx_n_s_css_value;
1000 static PyObject *__pyx_n_s_end;
1001 static PyObject *__pyx_n_s_enumerate;
1002 static PyObject *__pyx_n_s_find_newlines;
1003 static PyObject *__pyx_n_s_format;
1004 static PyObject *__pyx_n_s_genexpr;
1005 static PyObject *__pyx_n_s_group;
1006 static PyObject *__pyx_kp_s_home_lize_Informatique_tinycss;
1007 static PyObject *__pyx_n_s_ignore_comments;
1008 static PyObject *__pyx_n_s_import;
1009 static PyObject *__pyx_n_s_is_container;
1010 static PyObject *__pyx_n_s_length;
1011 static PyObject *__pyx_n_s_line;
1012 static PyObject *__pyx_n_s_lower;
1013 static PyObject *__pyx_n_s_main;
1014 static PyObject *__pyx_n_s_match;
1015 static PyObject *__pyx_n_s_n_tokens;
1016 static PyObject *__pyx_n_s_newline_unescape;
1017 static PyObject *__pyx_n_s_newlines;
1018 static PyObject *__pyx_n_s_next_pos;
1019 static PyObject *__pyx_n_s_pos;
1020 static PyObject *__pyx_n_s_regexp;
1021 static PyObject *__pyx_n_s_send;
1022 static PyObject *__pyx_n_s_simple_unescape;
1023 static PyObject *__pyx_n_s_source_len;
1024 static PyObject *__pyx_n_s_test;
1025 static PyObject *__pyx_n_s_throw;
1026 static PyObject *__pyx_n_s_tinycss_speedups;
1027 static PyObject *__pyx_n_s_token;
1028 static PyObject *__pyx_n_s_token_data;
1029 static PyObject *__pyx_n_s_tokenize_flat;
1030 static PyObject *__pyx_n_s_tokens;
1031 static PyObject *__pyx_n_s_tokens_dispatch;
1032 static PyObject *__pyx_n_s_type;
1033 static PyObject *__pyx_n_s_type_name;
1034 static PyObject *__pyx_n_s_unicode_unescape;
1035 static PyObject *__pyx_n_s_unit;
1036 static PyObject *__pyx_n_s_value;
1037 static PyObject *__pyx_pf_7tinycss_8speedups_2genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1038 static int __pyx_pf_7tinycss_8speedups_6CToken___init__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_type_, PyObject *__pyx_v_css_value, PyObject *__pyx_v_value, PyObject *__pyx_v_unit, PyObject *__pyx_v_line, PyObject *__pyx_v_column); /* proto */
1039 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_2as_css(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1040 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4__repr__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1041 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4type___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1042 static int __pyx_pf_7tinycss_8speedups_6CToken_4type_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1043 static int __pyx_pf_7tinycss_8speedups_6CToken_4type_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1044 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_7_as_css___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1045 static int __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1046 static int __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1047 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_5value___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1048 static int __pyx_pf_7tinycss_8speedups_6CToken_5value_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1049 static int __pyx_pf_7tinycss_8speedups_6CToken_5value_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1050 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4unit___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1051 static int __pyx_pf_7tinycss_8speedups_6CToken_4unit_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1052 static int __pyx_pf_7tinycss_8speedups_6CToken_4unit_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1053 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4line___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1054 static int __pyx_pf_7tinycss_8speedups_6CToken_4line_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1055 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_6column___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self); /* proto */
1056 static int __pyx_pf_7tinycss_8speedups_6CToken_6column_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1057 static PyObject *__pyx_pf_7tinycss_8speedups_tokenize_flat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_css_source, int __pyx_v_ignore_comments); /* proto */
1058 static PyObject *__pyx_tp_new_7tinycss_8speedups_CToken(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1059 static PyObject *__pyx_tp_new_7tinycss_8speedups___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1060 static PyObject *__pyx_int_0;
1061 static PyObject *__pyx_int_1;
1062 static PyObject *__pyx_int_2;
1063 static PyObject *__pyx_int_neg_1;
1064 static PyObject *__pyx_slice__6;
1065 static PyObject *__pyx_tuple__3;
1066 static PyObject *__pyx_tuple__5;
1067 static PyObject *__pyx_tuple__8;
1068 static PyObject *__pyx_slice__10;
1069 static PyObject *__pyx_slice__11;
1070 static PyObject *__pyx_slice__12;
1071 static PyObject *__pyx_tuple__13;
1072 static PyObject *__pyx_codeobj__14;
1073 static PyObject *__pyx_gb_7tinycss_8speedups_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
1074
1075 /* "tinycss/speedups.pyx":22
1076 *
1077 * COMPILED_TOKEN_INDEXES = dict(
1078 * (name, i) for i, (name, regexp) in enumerate(COMPILED_TOKEN_REGEXPS)) # <<<<<<<<<<<<<<
1079 *
1080 *
1081 */
1082
__pyx_pf_7tinycss_8speedups_2genexpr(CYTHON_UNUSED PyObject * __pyx_self)1083 static PyObject *__pyx_pf_7tinycss_8speedups_2genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
1084 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *__pyx_cur_scope;
1085 PyObject *__pyx_r = NULL;
1086 __Pyx_RefNannyDeclarations
1087 __Pyx_RefNannySetupContext("genexpr", 0);
1088 __pyx_cur_scope = (struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)__pyx_tp_new_7tinycss_8speedups___pyx_scope_struct__genexpr(__pyx_ptype_7tinycss_8speedups___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
1089 if (unlikely(!__pyx_cur_scope)) {
1090 __Pyx_RefNannyFinishContext();
1091 return NULL;
1092 }
1093 __Pyx_GOTREF(__pyx_cur_scope);
1094 {
1095 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7tinycss_8speedups_4generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_tinycss_speedups); if (unlikely(!gen)) __PYX_ERR(0, 22, __pyx_L1_error)
1096 __Pyx_DECREF(__pyx_cur_scope);
1097 __Pyx_RefNannyFinishContext();
1098 return (PyObject *) gen;
1099 }
1100
1101 /* function exit code */
1102 __pyx_L1_error:;
1103 __Pyx_AddTraceback("tinycss.speedups.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
1104 __pyx_r = NULL;
1105 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
1106 __Pyx_XGIVEREF(__pyx_r);
1107 __Pyx_RefNannyFinishContext();
1108 return __pyx_r;
1109 }
1110
__pyx_gb_7tinycss_8speedups_4generator(__pyx_CoroutineObject * __pyx_generator,PyObject * __pyx_sent_value)1111 static PyObject *__pyx_gb_7tinycss_8speedups_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
1112 {
1113 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)__pyx_generator->closure);
1114 PyObject *__pyx_r = NULL;
1115 PyObject *__pyx_t_1 = NULL;
1116 PyObject *__pyx_t_2 = NULL;
1117 PyObject *__pyx_t_3 = NULL;
1118 Py_ssize_t __pyx_t_4;
1119 PyObject *(*__pyx_t_5)(PyObject *);
1120 PyObject *__pyx_t_6 = NULL;
1121 PyObject *__pyx_t_7 = NULL;
1122 PyObject *__pyx_t_8 = NULL;
1123 PyObject *(*__pyx_t_9)(PyObject *);
1124 __Pyx_RefNannyDeclarations
1125 __Pyx_RefNannySetupContext("None", 0);
1126 switch (__pyx_generator->resume_label) {
1127 case 0: goto __pyx_L3_first_run;
1128 default: /* CPython raises the right error here */
1129 __Pyx_RefNannyFinishContext();
1130 return NULL;
1131 }
1132 __pyx_L3_first_run:;
1133 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 22, __pyx_L1_error)
1134 __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 22, __pyx_L1_error)
1135 __Pyx_GOTREF(__pyx_r);
1136 __Pyx_INCREF(__pyx_int_0);
1137 __pyx_t_1 = __pyx_int_0;
1138 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COMPILED_TOKEN_REGEXPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
1139 __Pyx_GOTREF(__pyx_t_2);
1140 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
1141 __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
1142 __pyx_t_5 = NULL;
1143 } else {
1144 __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
1145 __Pyx_GOTREF(__pyx_t_3);
1146 __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
1147 }
1148 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1149 for (;;) {
1150 if (likely(!__pyx_t_5)) {
1151 if (likely(PyList_CheckExact(__pyx_t_3))) {
1152 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
1153 #if CYTHON_COMPILING_IN_CPYTHON
1154 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
1155 #else
1156 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
1157 __Pyx_GOTREF(__pyx_t_2);
1158 #endif
1159 } else {
1160 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
1161 #if CYTHON_COMPILING_IN_CPYTHON
1162 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error)
1163 #else
1164 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
1165 __Pyx_GOTREF(__pyx_t_2);
1166 #endif
1167 }
1168 } else {
1169 __pyx_t_2 = __pyx_t_5(__pyx_t_3);
1170 if (unlikely(!__pyx_t_2)) {
1171 PyObject* exc_type = PyErr_Occurred();
1172 if (exc_type) {
1173 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
1174 else __PYX_ERR(0, 22, __pyx_L1_error)
1175 }
1176 break;
1177 }
1178 __Pyx_GOTREF(__pyx_t_2);
1179 }
1180 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
1181 PyObject* sequence = __pyx_t_2;
1182 #if CYTHON_COMPILING_IN_CPYTHON
1183 Py_ssize_t size = Py_SIZE(sequence);
1184 #else
1185 Py_ssize_t size = PySequence_Size(sequence);
1186 #endif
1187 if (unlikely(size != 2)) {
1188 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
1189 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
1190 __PYX_ERR(0, 22, __pyx_L1_error)
1191 }
1192 #if CYTHON_COMPILING_IN_CPYTHON
1193 if (likely(PyTuple_CheckExact(sequence))) {
1194 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
1195 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
1196 } else {
1197 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
1198 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
1199 }
1200 __Pyx_INCREF(__pyx_t_6);
1201 __Pyx_INCREF(__pyx_t_7);
1202 #else
1203 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
1204 __Pyx_GOTREF(__pyx_t_6);
1205 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error)
1206 __Pyx_GOTREF(__pyx_t_7);
1207 #endif
1208 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1209 } else {
1210 Py_ssize_t index = -1;
1211 __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 22, __pyx_L1_error)
1212 __Pyx_GOTREF(__pyx_t_8);
1213 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1214 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
1215 index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
1216 __Pyx_GOTREF(__pyx_t_6);
1217 index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
1218 __Pyx_GOTREF(__pyx_t_7);
1219 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
1220 __pyx_t_9 = NULL;
1221 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1222 goto __pyx_L7_unpacking_done;
1223 __pyx_L6_unpacking_failed:;
1224 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1225 __pyx_t_9 = NULL;
1226 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
1227 __PYX_ERR(0, 22, __pyx_L1_error)
1228 __pyx_L7_unpacking_done:;
1229 }
1230 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
1231 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_6);
1232 __Pyx_GIVEREF(__pyx_t_6);
1233 __pyx_t_6 = 0;
1234 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_regexp);
1235 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_regexp, __pyx_t_7);
1236 __Pyx_GIVEREF(__pyx_t_7);
1237 __pyx_t_7 = 0;
1238 __Pyx_INCREF(__pyx_t_1);
1239 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
1240 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1);
1241 __Pyx_GIVEREF(__pyx_t_1);
1242 __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
1243 __Pyx_GOTREF(__pyx_t_2);
1244 __Pyx_DECREF(__pyx_t_1);
1245 __pyx_t_1 = __pyx_t_2;
1246 __pyx_t_2 = 0;
1247 if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_name, (PyObject*)__pyx_cur_scope->__pyx_v_i))) __PYX_ERR(0, 22, __pyx_L1_error)
1248 }
1249 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1250 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1251
1252 /* function exit code */
1253 goto __pyx_L0;
1254 __pyx_L1_error:;
1255 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
1256 __Pyx_XDECREF(__pyx_t_1);
1257 __Pyx_XDECREF(__pyx_t_2);
1258 __Pyx_XDECREF(__pyx_t_3);
1259 __Pyx_XDECREF(__pyx_t_6);
1260 __Pyx_XDECREF(__pyx_t_7);
1261 __Pyx_XDECREF(__pyx_t_8);
1262 __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
1263 __pyx_L0:;
1264 __Pyx_XGIVEREF(__pyx_r);
1265 __pyx_generator->resume_label = -1;
1266 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
1267 __Pyx_RefNannyFinishContext();
1268 return __pyx_r;
1269 }
1270
1271 /* "tinycss/speedups.pyx":35
1272 * cdef public Py_ssize_t line, column
1273 *
1274 * def __init__(self, type_, css_value, value, unit, line, column): # <<<<<<<<<<<<<<
1275 * self.type = type_
1276 * self._as_css = css_value
1277 */
1278
1279 /* Python wrapper */
1280 static int __pyx_pw_7tinycss_8speedups_6CToken_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1281 static int __pyx_pw_7tinycss_8speedups_6CToken_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1282 PyObject *__pyx_v_type_ = 0;
1283 PyObject *__pyx_v_css_value = 0;
1284 PyObject *__pyx_v_value = 0;
1285 PyObject *__pyx_v_unit = 0;
1286 PyObject *__pyx_v_line = 0;
1287 PyObject *__pyx_v_column = 0;
1288 int __pyx_r;
1289 __Pyx_RefNannyDeclarations
1290 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1291 {
1292 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_css_value,&__pyx_n_s_value,&__pyx_n_s_unit,&__pyx_n_s_line,&__pyx_n_s_column,0};
1293 PyObject* values[6] = {0,0,0,0,0,0};
1294 if (unlikely(__pyx_kwds)) {
1295 Py_ssize_t kw_args;
1296 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1297 switch (pos_args) {
1298 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1299 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1300 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1301 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1302 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1303 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1304 case 0: break;
1305 default: goto __pyx_L5_argtuple_error;
1306 }
1307 kw_args = PyDict_Size(__pyx_kwds);
1308 switch (pos_args) {
1309 case 0:
1310 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
1311 else goto __pyx_L5_argtuple_error;
1312 case 1:
1313 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_css_value)) != 0)) kw_args--;
1314 else {
1315 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); __PYX_ERR(0, 35, __pyx_L3_error)
1316 }
1317 case 2:
1318 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
1319 else {
1320 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); __PYX_ERR(0, 35, __pyx_L3_error)
1321 }
1322 case 3:
1323 if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_unit)) != 0)) kw_args--;
1324 else {
1325 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); __PYX_ERR(0, 35, __pyx_L3_error)
1326 }
1327 case 4:
1328 if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_line)) != 0)) kw_args--;
1329 else {
1330 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); __PYX_ERR(0, 35, __pyx_L3_error)
1331 }
1332 case 5:
1333 if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_column)) != 0)) kw_args--;
1334 else {
1335 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); __PYX_ERR(0, 35, __pyx_L3_error)
1336 }
1337 }
1338 if (unlikely(kw_args > 0)) {
1339 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
1340 }
1341 } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
1342 goto __pyx_L5_argtuple_error;
1343 } else {
1344 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1345 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1346 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1347 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1348 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1349 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1350 }
1351 __pyx_v_type_ = values[0];
1352 __pyx_v_css_value = values[1];
1353 __pyx_v_value = values[2];
1354 __pyx_v_unit = values[3];
1355 __pyx_v_line = values[4];
1356 __pyx_v_column = values[5];
1357 }
1358 goto __pyx_L4_argument_unpacking_done;
1359 __pyx_L5_argtuple_error:;
1360 __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
1361 __pyx_L3_error:;
1362 __Pyx_AddTraceback("tinycss.speedups.CToken.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1363 __Pyx_RefNannyFinishContext();
1364 return -1;
1365 __pyx_L4_argument_unpacking_done:;
1366 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken___init__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), __pyx_v_type_, __pyx_v_css_value, __pyx_v_value, __pyx_v_unit, __pyx_v_line, __pyx_v_column);
1367
1368 /* function exit code */
1369 __Pyx_RefNannyFinishContext();
1370 return __pyx_r;
1371 }
1372
__pyx_pf_7tinycss_8speedups_6CToken___init__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_type_,PyObject * __pyx_v_css_value,PyObject * __pyx_v_value,PyObject * __pyx_v_unit,PyObject * __pyx_v_line,PyObject * __pyx_v_column)1373 static int __pyx_pf_7tinycss_8speedups_6CToken___init__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_type_, PyObject *__pyx_v_css_value, PyObject *__pyx_v_value, PyObject *__pyx_v_unit, PyObject *__pyx_v_line, PyObject *__pyx_v_column) {
1374 int __pyx_r;
1375 __Pyx_RefNannyDeclarations
1376 Py_ssize_t __pyx_t_1;
1377 __Pyx_RefNannySetupContext("__init__", 0);
1378
1379 /* "tinycss/speedups.pyx":36
1380 *
1381 * def __init__(self, type_, css_value, value, unit, line, column):
1382 * self.type = type_ # <<<<<<<<<<<<<<
1383 * self._as_css = css_value
1384 * self.value = value
1385 */
1386 __Pyx_INCREF(__pyx_v_type_);
1387 __Pyx_GIVEREF(__pyx_v_type_);
1388 __Pyx_GOTREF(__pyx_v_self->type);
1389 __Pyx_DECREF(__pyx_v_self->type);
1390 __pyx_v_self->type = __pyx_v_type_;
1391
1392 /* "tinycss/speedups.pyx":37
1393 * def __init__(self, type_, css_value, value, unit, line, column):
1394 * self.type = type_
1395 * self._as_css = css_value # <<<<<<<<<<<<<<
1396 * self.value = value
1397 * self.unit = unit
1398 */
1399 __Pyx_INCREF(__pyx_v_css_value);
1400 __Pyx_GIVEREF(__pyx_v_css_value);
1401 __Pyx_GOTREF(__pyx_v_self->_as_css);
1402 __Pyx_DECREF(__pyx_v_self->_as_css);
1403 __pyx_v_self->_as_css = __pyx_v_css_value;
1404
1405 /* "tinycss/speedups.pyx":38
1406 * self.type = type_
1407 * self._as_css = css_value
1408 * self.value = value # <<<<<<<<<<<<<<
1409 * self.unit = unit
1410 * self.line = line
1411 */
1412 __Pyx_INCREF(__pyx_v_value);
1413 __Pyx_GIVEREF(__pyx_v_value);
1414 __Pyx_GOTREF(__pyx_v_self->value);
1415 __Pyx_DECREF(__pyx_v_self->value);
1416 __pyx_v_self->value = __pyx_v_value;
1417
1418 /* "tinycss/speedups.pyx":39
1419 * self._as_css = css_value
1420 * self.value = value
1421 * self.unit = unit # <<<<<<<<<<<<<<
1422 * self.line = line
1423 * self.column = column
1424 */
1425 __Pyx_INCREF(__pyx_v_unit);
1426 __Pyx_GIVEREF(__pyx_v_unit);
1427 __Pyx_GOTREF(__pyx_v_self->unit);
1428 __Pyx_DECREF(__pyx_v_self->unit);
1429 __pyx_v_self->unit = __pyx_v_unit;
1430
1431 /* "tinycss/speedups.pyx":40
1432 * self.value = value
1433 * self.unit = unit
1434 * self.line = line # <<<<<<<<<<<<<<
1435 * self.column = column
1436 *
1437 */
1438 __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_line); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L1_error)
1439 __pyx_v_self->line = __pyx_t_1;
1440
1441 /* "tinycss/speedups.pyx":41
1442 * self.unit = unit
1443 * self.line = line
1444 * self.column = column # <<<<<<<<<<<<<<
1445 *
1446 * def as_css(self):
1447 */
1448 __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_column); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L1_error)
1449 __pyx_v_self->column = __pyx_t_1;
1450
1451 /* "tinycss/speedups.pyx":35
1452 * cdef public Py_ssize_t line, column
1453 *
1454 * def __init__(self, type_, css_value, value, unit, line, column): # <<<<<<<<<<<<<<
1455 * self.type = type_
1456 * self._as_css = css_value
1457 */
1458
1459 /* function exit code */
1460 __pyx_r = 0;
1461 goto __pyx_L0;
1462 __pyx_L1_error:;
1463 __Pyx_AddTraceback("tinycss.speedups.CToken.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1464 __pyx_r = -1;
1465 __pyx_L0:;
1466 __Pyx_RefNannyFinishContext();
1467 return __pyx_r;
1468 }
1469
1470 /* "tinycss/speedups.pyx":43
1471 * self.column = column
1472 *
1473 * def as_css(self): # <<<<<<<<<<<<<<
1474 * """
1475 * Return as an Unicode string the CSS representation of the token,
1476 */
1477
1478 /* Python wrapper */
1479 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_3as_css(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1480 static char __pyx_doc_7tinycss_8speedups_6CToken_2as_css[] = "\n Return as an Unicode string the CSS representation of the token,\n as parsed in the source.\n ";
__pyx_pw_7tinycss_8speedups_6CToken_3as_css(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)1481 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_3as_css(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
1482 PyObject *__pyx_r = 0;
1483 __Pyx_RefNannyDeclarations
1484 __Pyx_RefNannySetupContext("as_css (wrapper)", 0);
1485 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_2as_css(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1486
1487 /* function exit code */
1488 __Pyx_RefNannyFinishContext();
1489 return __pyx_r;
1490 }
1491
__pyx_pf_7tinycss_8speedups_6CToken_2as_css(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1492 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_2as_css(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1493 PyObject *__pyx_r = NULL;
1494 __Pyx_RefNannyDeclarations
1495 __Pyx_RefNannySetupContext("as_css", 0);
1496
1497 /* "tinycss/speedups.pyx":48
1498 * as parsed in the source.
1499 * """
1500 * return self._as_css # <<<<<<<<<<<<<<
1501 *
1502 * def __repr__(self):
1503 */
1504 __Pyx_XDECREF(__pyx_r);
1505 __Pyx_INCREF(__pyx_v_self->_as_css);
1506 __pyx_r = __pyx_v_self->_as_css;
1507 goto __pyx_L0;
1508
1509 /* "tinycss/speedups.pyx":43
1510 * self.column = column
1511 *
1512 * def as_css(self): # <<<<<<<<<<<<<<
1513 * """
1514 * Return as an Unicode string the CSS representation of the token,
1515 */
1516
1517 /* function exit code */
1518 __pyx_L0:;
1519 __Pyx_XGIVEREF(__pyx_r);
1520 __Pyx_RefNannyFinishContext();
1521 return __pyx_r;
1522 }
1523
1524 /* "tinycss/speedups.pyx":50
1525 * return self._as_css
1526 *
1527 * def __repr__(self): # <<<<<<<<<<<<<<
1528 * return ('<Token {0.type} at {0.line}:{0.column} {0.value!r}{1}>'
1529 * .format(self, self.unit or ''))
1530 */
1531
1532 /* Python wrapper */
1533 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_5__repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_5__repr__(PyObject * __pyx_v_self)1534 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_5__repr__(PyObject *__pyx_v_self) {
1535 PyObject *__pyx_r = 0;
1536 __Pyx_RefNannyDeclarations
1537 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
1538 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4__repr__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1539
1540 /* function exit code */
1541 __Pyx_RefNannyFinishContext();
1542 return __pyx_r;
1543 }
1544
__pyx_pf_7tinycss_8speedups_6CToken_4__repr__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1545 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4__repr__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1546 PyObject *__pyx_r = NULL;
1547 __Pyx_RefNannyDeclarations
1548 PyObject *__pyx_t_1 = NULL;
1549 PyObject *__pyx_t_2 = NULL;
1550 PyObject *__pyx_t_3 = NULL;
1551 int __pyx_t_4;
1552 PyObject *__pyx_t_5 = NULL;
1553 Py_ssize_t __pyx_t_6;
1554 PyObject *__pyx_t_7 = NULL;
1555 __Pyx_RefNannySetupContext("__repr__", 0);
1556
1557 /* "tinycss/speedups.pyx":51
1558 *
1559 * def __repr__(self):
1560 * return ('<Token {0.type} at {0.line}:{0.column} {0.value!r}{1}>' # <<<<<<<<<<<<<<
1561 * .format(self, self.unit or ''))
1562 *
1563 */
1564 __Pyx_XDECREF(__pyx_r);
1565
1566 /* "tinycss/speedups.pyx":52
1567 * def __repr__(self):
1568 * return ('<Token {0.type} at {0.line}:{0.column} {0.value!r}{1}>'
1569 * .format(self, self.unit or '')) # <<<<<<<<<<<<<<
1570 *
1571 *
1572 */
1573 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Token_0_type_at_0_line_0_column, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
1574 __Pyx_GOTREF(__pyx_t_2);
1575 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->unit); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
1576 if (!__pyx_t_4) {
1577 } else {
1578 __Pyx_INCREF(__pyx_v_self->unit);
1579 __pyx_t_3 = __pyx_v_self->unit;
1580 goto __pyx_L3_bool_binop_done;
1581 }
1582 __Pyx_INCREF(__pyx_kp_u_);
1583 __pyx_t_3 = __pyx_kp_u_;
1584 __pyx_L3_bool_binop_done:;
1585 __pyx_t_5 = NULL;
1586 __pyx_t_6 = 0;
1587 if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
1588 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
1589 if (likely(__pyx_t_5)) {
1590 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1591 __Pyx_INCREF(__pyx_t_5);
1592 __Pyx_INCREF(function);
1593 __Pyx_DECREF_SET(__pyx_t_2, function);
1594 __pyx_t_6 = 1;
1595 }
1596 }
1597 __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error)
1598 __Pyx_GOTREF(__pyx_t_7);
1599 if (__pyx_t_5) {
1600 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
1601 }
1602 __Pyx_INCREF(((PyObject *)__pyx_v_self));
1603 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
1604 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
1605 __Pyx_GIVEREF(__pyx_t_3);
1606 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
1607 __pyx_t_3 = 0;
1608 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
1609 __Pyx_GOTREF(__pyx_t_1);
1610 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1611 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1612 __pyx_r = __pyx_t_1;
1613 __pyx_t_1 = 0;
1614 goto __pyx_L0;
1615
1616 /* "tinycss/speedups.pyx":50
1617 * return self._as_css
1618 *
1619 * def __repr__(self): # <<<<<<<<<<<<<<
1620 * return ('<Token {0.type} at {0.line}:{0.column} {0.value!r}{1}>'
1621 * .format(self, self.unit or ''))
1622 */
1623
1624 /* function exit code */
1625 __pyx_L1_error:;
1626 __Pyx_XDECREF(__pyx_t_1);
1627 __Pyx_XDECREF(__pyx_t_2);
1628 __Pyx_XDECREF(__pyx_t_3);
1629 __Pyx_XDECREF(__pyx_t_5);
1630 __Pyx_XDECREF(__pyx_t_7);
1631 __Pyx_AddTraceback("tinycss.speedups.CToken.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1632 __pyx_r = NULL;
1633 __pyx_L0:;
1634 __Pyx_XGIVEREF(__pyx_r);
1635 __Pyx_RefNannyFinishContext();
1636 return __pyx_r;
1637 }
1638
1639 /* "tinycss/speedups.pyx":32
1640 * is_container = False
1641 *
1642 * cdef public object type, _as_css, value, unit # <<<<<<<<<<<<<<
1643 * cdef public Py_ssize_t line, column
1644 *
1645 */
1646
1647 /* Python wrapper */
1648 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4type_1__get__(PyObject * __pyx_v_self)1649 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4type_1__get__(PyObject *__pyx_v_self) {
1650 PyObject *__pyx_r = 0;
1651 __Pyx_RefNannyDeclarations
1652 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
1653 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4type___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1654
1655 /* function exit code */
1656 __Pyx_RefNannyFinishContext();
1657 return __pyx_r;
1658 }
1659
__pyx_pf_7tinycss_8speedups_6CToken_4type___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1660 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4type___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1661 PyObject *__pyx_r = NULL;
1662 __Pyx_RefNannyDeclarations
1663 __Pyx_RefNannySetupContext("__get__", 0);
1664 __Pyx_XDECREF(__pyx_r);
1665 __Pyx_INCREF(__pyx_v_self->type);
1666 __pyx_r = __pyx_v_self->type;
1667 goto __pyx_L0;
1668
1669 /* function exit code */
1670 __pyx_L0:;
1671 __Pyx_XGIVEREF(__pyx_r);
1672 __Pyx_RefNannyFinishContext();
1673 return __pyx_r;
1674 }
1675
1676 /* Python wrapper */
1677 static int __pyx_pw_7tinycss_8speedups_6CToken_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4type_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)1678 static int __pyx_pw_7tinycss_8speedups_6CToken_4type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
1679 int __pyx_r;
1680 __Pyx_RefNannyDeclarations
1681 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
1682 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4type_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
1683
1684 /* function exit code */
1685 __Pyx_RefNannyFinishContext();
1686 return __pyx_r;
1687 }
1688
__pyx_pf_7tinycss_8speedups_6CToken_4type_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)1689 static int __pyx_pf_7tinycss_8speedups_6CToken_4type_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
1690 int __pyx_r;
1691 __Pyx_RefNannyDeclarations
1692 __Pyx_RefNannySetupContext("__set__", 0);
1693 __Pyx_INCREF(__pyx_v_value);
1694 __Pyx_GIVEREF(__pyx_v_value);
1695 __Pyx_GOTREF(__pyx_v_self->type);
1696 __Pyx_DECREF(__pyx_v_self->type);
1697 __pyx_v_self->type = __pyx_v_value;
1698
1699 /* function exit code */
1700 __pyx_r = 0;
1701 __Pyx_RefNannyFinishContext();
1702 return __pyx_r;
1703 }
1704
1705 /* Python wrapper */
1706 static int __pyx_pw_7tinycss_8speedups_6CToken_4type_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4type_5__del__(PyObject * __pyx_v_self)1707 static int __pyx_pw_7tinycss_8speedups_6CToken_4type_5__del__(PyObject *__pyx_v_self) {
1708 int __pyx_r;
1709 __Pyx_RefNannyDeclarations
1710 __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
1711 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4type_4__del__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1712
1713 /* function exit code */
1714 __Pyx_RefNannyFinishContext();
1715 return __pyx_r;
1716 }
1717
__pyx_pf_7tinycss_8speedups_6CToken_4type_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1718 static int __pyx_pf_7tinycss_8speedups_6CToken_4type_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1719 int __pyx_r;
1720 __Pyx_RefNannyDeclarations
1721 __Pyx_RefNannySetupContext("__del__", 0);
1722 __Pyx_INCREF(Py_None);
1723 __Pyx_GIVEREF(Py_None);
1724 __Pyx_GOTREF(__pyx_v_self->type);
1725 __Pyx_DECREF(__pyx_v_self->type);
1726 __pyx_v_self->type = Py_None;
1727
1728 /* function exit code */
1729 __pyx_r = 0;
1730 __Pyx_RefNannyFinishContext();
1731 return __pyx_r;
1732 }
1733
1734 /* Python wrapper */
1735 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_7_as_css_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_7_as_css_1__get__(PyObject * __pyx_v_self)1736 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_7_as_css_1__get__(PyObject *__pyx_v_self) {
1737 PyObject *__pyx_r = 0;
1738 __Pyx_RefNannyDeclarations
1739 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
1740 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_7_as_css___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1741
1742 /* function exit code */
1743 __Pyx_RefNannyFinishContext();
1744 return __pyx_r;
1745 }
1746
__pyx_pf_7tinycss_8speedups_6CToken_7_as_css___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1747 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_7_as_css___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1748 PyObject *__pyx_r = NULL;
1749 __Pyx_RefNannyDeclarations
1750 __Pyx_RefNannySetupContext("__get__", 0);
1751 __Pyx_XDECREF(__pyx_r);
1752 __Pyx_INCREF(__pyx_v_self->_as_css);
1753 __pyx_r = __pyx_v_self->_as_css;
1754 goto __pyx_L0;
1755
1756 /* function exit code */
1757 __pyx_L0:;
1758 __Pyx_XGIVEREF(__pyx_r);
1759 __Pyx_RefNannyFinishContext();
1760 return __pyx_r;
1761 }
1762
1763 /* Python wrapper */
1764 static int __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_7_as_css_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)1765 static int __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
1766 int __pyx_r;
1767 __Pyx_RefNannyDeclarations
1768 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
1769 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
1770
1771 /* function exit code */
1772 __Pyx_RefNannyFinishContext();
1773 return __pyx_r;
1774 }
1775
__pyx_pf_7tinycss_8speedups_6CToken_7_as_css_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)1776 static int __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
1777 int __pyx_r;
1778 __Pyx_RefNannyDeclarations
1779 __Pyx_RefNannySetupContext("__set__", 0);
1780 __Pyx_INCREF(__pyx_v_value);
1781 __Pyx_GIVEREF(__pyx_v_value);
1782 __Pyx_GOTREF(__pyx_v_self->_as_css);
1783 __Pyx_DECREF(__pyx_v_self->_as_css);
1784 __pyx_v_self->_as_css = __pyx_v_value;
1785
1786 /* function exit code */
1787 __pyx_r = 0;
1788 __Pyx_RefNannyFinishContext();
1789 return __pyx_r;
1790 }
1791
1792 /* Python wrapper */
1793 static int __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_7_as_css_5__del__(PyObject * __pyx_v_self)1794 static int __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_5__del__(PyObject *__pyx_v_self) {
1795 int __pyx_r;
1796 __Pyx_RefNannyDeclarations
1797 __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
1798 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_4__del__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1799
1800 /* function exit code */
1801 __Pyx_RefNannyFinishContext();
1802 return __pyx_r;
1803 }
1804
__pyx_pf_7tinycss_8speedups_6CToken_7_as_css_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1805 static int __pyx_pf_7tinycss_8speedups_6CToken_7_as_css_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1806 int __pyx_r;
1807 __Pyx_RefNannyDeclarations
1808 __Pyx_RefNannySetupContext("__del__", 0);
1809 __Pyx_INCREF(Py_None);
1810 __Pyx_GIVEREF(Py_None);
1811 __Pyx_GOTREF(__pyx_v_self->_as_css);
1812 __Pyx_DECREF(__pyx_v_self->_as_css);
1813 __pyx_v_self->_as_css = Py_None;
1814
1815 /* function exit code */
1816 __pyx_r = 0;
1817 __Pyx_RefNannyFinishContext();
1818 return __pyx_r;
1819 }
1820
1821 /* Python wrapper */
1822 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_5value_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_5value_1__get__(PyObject * __pyx_v_self)1823 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_5value_1__get__(PyObject *__pyx_v_self) {
1824 PyObject *__pyx_r = 0;
1825 __Pyx_RefNannyDeclarations
1826 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
1827 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_5value___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1828
1829 /* function exit code */
1830 __Pyx_RefNannyFinishContext();
1831 return __pyx_r;
1832 }
1833
__pyx_pf_7tinycss_8speedups_6CToken_5value___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1834 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_5value___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1835 PyObject *__pyx_r = NULL;
1836 __Pyx_RefNannyDeclarations
1837 __Pyx_RefNannySetupContext("__get__", 0);
1838 __Pyx_XDECREF(__pyx_r);
1839 __Pyx_INCREF(__pyx_v_self->value);
1840 __pyx_r = __pyx_v_self->value;
1841 goto __pyx_L0;
1842
1843 /* function exit code */
1844 __pyx_L0:;
1845 __Pyx_XGIVEREF(__pyx_r);
1846 __Pyx_RefNannyFinishContext();
1847 return __pyx_r;
1848 }
1849
1850 /* Python wrapper */
1851 static int __pyx_pw_7tinycss_8speedups_6CToken_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_5value_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)1852 static int __pyx_pw_7tinycss_8speedups_6CToken_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
1853 int __pyx_r;
1854 __Pyx_RefNannyDeclarations
1855 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
1856 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_5value_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
1857
1858 /* function exit code */
1859 __Pyx_RefNannyFinishContext();
1860 return __pyx_r;
1861 }
1862
__pyx_pf_7tinycss_8speedups_6CToken_5value_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)1863 static int __pyx_pf_7tinycss_8speedups_6CToken_5value_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
1864 int __pyx_r;
1865 __Pyx_RefNannyDeclarations
1866 __Pyx_RefNannySetupContext("__set__", 0);
1867 __Pyx_INCREF(__pyx_v_value);
1868 __Pyx_GIVEREF(__pyx_v_value);
1869 __Pyx_GOTREF(__pyx_v_self->value);
1870 __Pyx_DECREF(__pyx_v_self->value);
1871 __pyx_v_self->value = __pyx_v_value;
1872
1873 /* function exit code */
1874 __pyx_r = 0;
1875 __Pyx_RefNannyFinishContext();
1876 return __pyx_r;
1877 }
1878
1879 /* Python wrapper */
1880 static int __pyx_pw_7tinycss_8speedups_6CToken_5value_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_5value_5__del__(PyObject * __pyx_v_self)1881 static int __pyx_pw_7tinycss_8speedups_6CToken_5value_5__del__(PyObject *__pyx_v_self) {
1882 int __pyx_r;
1883 __Pyx_RefNannyDeclarations
1884 __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
1885 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_5value_4__del__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1886
1887 /* function exit code */
1888 __Pyx_RefNannyFinishContext();
1889 return __pyx_r;
1890 }
1891
__pyx_pf_7tinycss_8speedups_6CToken_5value_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1892 static int __pyx_pf_7tinycss_8speedups_6CToken_5value_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1893 int __pyx_r;
1894 __Pyx_RefNannyDeclarations
1895 __Pyx_RefNannySetupContext("__del__", 0);
1896 __Pyx_INCREF(Py_None);
1897 __Pyx_GIVEREF(Py_None);
1898 __Pyx_GOTREF(__pyx_v_self->value);
1899 __Pyx_DECREF(__pyx_v_self->value);
1900 __pyx_v_self->value = Py_None;
1901
1902 /* function exit code */
1903 __pyx_r = 0;
1904 __Pyx_RefNannyFinishContext();
1905 return __pyx_r;
1906 }
1907
1908 /* Python wrapper */
1909 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4unit_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4unit_1__get__(PyObject * __pyx_v_self)1910 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4unit_1__get__(PyObject *__pyx_v_self) {
1911 PyObject *__pyx_r = 0;
1912 __Pyx_RefNannyDeclarations
1913 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
1914 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4unit___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1915
1916 /* function exit code */
1917 __Pyx_RefNannyFinishContext();
1918 return __pyx_r;
1919 }
1920
__pyx_pf_7tinycss_8speedups_6CToken_4unit___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1921 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4unit___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1922 PyObject *__pyx_r = NULL;
1923 __Pyx_RefNannyDeclarations
1924 __Pyx_RefNannySetupContext("__get__", 0);
1925 __Pyx_XDECREF(__pyx_r);
1926 __Pyx_INCREF(__pyx_v_self->unit);
1927 __pyx_r = __pyx_v_self->unit;
1928 goto __pyx_L0;
1929
1930 /* function exit code */
1931 __pyx_L0:;
1932 __Pyx_XGIVEREF(__pyx_r);
1933 __Pyx_RefNannyFinishContext();
1934 return __pyx_r;
1935 }
1936
1937 /* Python wrapper */
1938 static int __pyx_pw_7tinycss_8speedups_6CToken_4unit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4unit_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)1939 static int __pyx_pw_7tinycss_8speedups_6CToken_4unit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
1940 int __pyx_r;
1941 __Pyx_RefNannyDeclarations
1942 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
1943 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4unit_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
1944
1945 /* function exit code */
1946 __Pyx_RefNannyFinishContext();
1947 return __pyx_r;
1948 }
1949
__pyx_pf_7tinycss_8speedups_6CToken_4unit_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)1950 static int __pyx_pf_7tinycss_8speedups_6CToken_4unit_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
1951 int __pyx_r;
1952 __Pyx_RefNannyDeclarations
1953 __Pyx_RefNannySetupContext("__set__", 0);
1954 __Pyx_INCREF(__pyx_v_value);
1955 __Pyx_GIVEREF(__pyx_v_value);
1956 __Pyx_GOTREF(__pyx_v_self->unit);
1957 __Pyx_DECREF(__pyx_v_self->unit);
1958 __pyx_v_self->unit = __pyx_v_value;
1959
1960 /* function exit code */
1961 __pyx_r = 0;
1962 __Pyx_RefNannyFinishContext();
1963 return __pyx_r;
1964 }
1965
1966 /* Python wrapper */
1967 static int __pyx_pw_7tinycss_8speedups_6CToken_4unit_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4unit_5__del__(PyObject * __pyx_v_self)1968 static int __pyx_pw_7tinycss_8speedups_6CToken_4unit_5__del__(PyObject *__pyx_v_self) {
1969 int __pyx_r;
1970 __Pyx_RefNannyDeclarations
1971 __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
1972 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4unit_4__del__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
1973
1974 /* function exit code */
1975 __Pyx_RefNannyFinishContext();
1976 return __pyx_r;
1977 }
1978
__pyx_pf_7tinycss_8speedups_6CToken_4unit_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)1979 static int __pyx_pf_7tinycss_8speedups_6CToken_4unit_4__del__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
1980 int __pyx_r;
1981 __Pyx_RefNannyDeclarations
1982 __Pyx_RefNannySetupContext("__del__", 0);
1983 __Pyx_INCREF(Py_None);
1984 __Pyx_GIVEREF(Py_None);
1985 __Pyx_GOTREF(__pyx_v_self->unit);
1986 __Pyx_DECREF(__pyx_v_self->unit);
1987 __pyx_v_self->unit = Py_None;
1988
1989 /* function exit code */
1990 __pyx_r = 0;
1991 __Pyx_RefNannyFinishContext();
1992 return __pyx_r;
1993 }
1994
1995 /* "tinycss/speedups.pyx":33
1996 *
1997 * cdef public object type, _as_css, value, unit
1998 * cdef public Py_ssize_t line, column # <<<<<<<<<<<<<<
1999 *
2000 * def __init__(self, type_, css_value, value, unit, line, column):
2001 */
2002
2003 /* Python wrapper */
2004 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4line_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4line_1__get__(PyObject * __pyx_v_self)2005 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_4line_1__get__(PyObject *__pyx_v_self) {
2006 PyObject *__pyx_r = 0;
2007 __Pyx_RefNannyDeclarations
2008 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2009 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4line___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
2010
2011 /* function exit code */
2012 __Pyx_RefNannyFinishContext();
2013 return __pyx_r;
2014 }
2015
__pyx_pf_7tinycss_8speedups_6CToken_4line___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)2016 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_4line___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
2017 PyObject *__pyx_r = NULL;
2018 __Pyx_RefNannyDeclarations
2019 PyObject *__pyx_t_1 = NULL;
2020 __Pyx_RefNannySetupContext("__get__", 0);
2021 __Pyx_XDECREF(__pyx_r);
2022 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
2023 __Pyx_GOTREF(__pyx_t_1);
2024 __pyx_r = __pyx_t_1;
2025 __pyx_t_1 = 0;
2026 goto __pyx_L0;
2027
2028 /* function exit code */
2029 __pyx_L1_error:;
2030 __Pyx_XDECREF(__pyx_t_1);
2031 __Pyx_AddTraceback("tinycss.speedups.CToken.line.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2032 __pyx_r = NULL;
2033 __pyx_L0:;
2034 __Pyx_XGIVEREF(__pyx_r);
2035 __Pyx_RefNannyFinishContext();
2036 return __pyx_r;
2037 }
2038
2039 /* Python wrapper */
2040 static int __pyx_pw_7tinycss_8speedups_6CToken_4line_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_4line_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)2041 static int __pyx_pw_7tinycss_8speedups_6CToken_4line_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
2042 int __pyx_r;
2043 __Pyx_RefNannyDeclarations
2044 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
2045 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_4line_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
2046
2047 /* function exit code */
2048 __Pyx_RefNannyFinishContext();
2049 return __pyx_r;
2050 }
2051
__pyx_pf_7tinycss_8speedups_6CToken_4line_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)2052 static int __pyx_pf_7tinycss_8speedups_6CToken_4line_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
2053 int __pyx_r;
2054 __Pyx_RefNannyDeclarations
2055 Py_ssize_t __pyx_t_1;
2056 __Pyx_RefNannySetupContext("__set__", 0);
2057 __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L1_error)
2058 __pyx_v_self->line = __pyx_t_1;
2059
2060 /* function exit code */
2061 __pyx_r = 0;
2062 goto __pyx_L0;
2063 __pyx_L1_error:;
2064 __Pyx_AddTraceback("tinycss.speedups.CToken.line.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2065 __pyx_r = -1;
2066 __pyx_L0:;
2067 __Pyx_RefNannyFinishContext();
2068 return __pyx_r;
2069 }
2070
2071 /* Python wrapper */
2072 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_6column_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_6column_1__get__(PyObject * __pyx_v_self)2073 static PyObject *__pyx_pw_7tinycss_8speedups_6CToken_6column_1__get__(PyObject *__pyx_v_self) {
2074 PyObject *__pyx_r = 0;
2075 __Pyx_RefNannyDeclarations
2076 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2077 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_6column___get__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self));
2078
2079 /* function exit code */
2080 __Pyx_RefNannyFinishContext();
2081 return __pyx_r;
2082 }
2083
__pyx_pf_7tinycss_8speedups_6CToken_6column___get__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self)2084 static PyObject *__pyx_pf_7tinycss_8speedups_6CToken_6column___get__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self) {
2085 PyObject *__pyx_r = NULL;
2086 __Pyx_RefNannyDeclarations
2087 PyObject *__pyx_t_1 = NULL;
2088 __Pyx_RefNannySetupContext("__get__", 0);
2089 __Pyx_XDECREF(__pyx_r);
2090 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->column); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
2091 __Pyx_GOTREF(__pyx_t_1);
2092 __pyx_r = __pyx_t_1;
2093 __pyx_t_1 = 0;
2094 goto __pyx_L0;
2095
2096 /* function exit code */
2097 __pyx_L1_error:;
2098 __Pyx_XDECREF(__pyx_t_1);
2099 __Pyx_AddTraceback("tinycss.speedups.CToken.column.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2100 __pyx_r = NULL;
2101 __pyx_L0:;
2102 __Pyx_XGIVEREF(__pyx_r);
2103 __Pyx_RefNannyFinishContext();
2104 return __pyx_r;
2105 }
2106
2107 /* Python wrapper */
2108 static int __pyx_pw_7tinycss_8speedups_6CToken_6column_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_7tinycss_8speedups_6CToken_6column_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)2109 static int __pyx_pw_7tinycss_8speedups_6CToken_6column_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
2110 int __pyx_r;
2111 __Pyx_RefNannyDeclarations
2112 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
2113 __pyx_r = __pyx_pf_7tinycss_8speedups_6CToken_6column_2__set__(((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_v_self), ((PyObject *)__pyx_v_value));
2114
2115 /* function exit code */
2116 __Pyx_RefNannyFinishContext();
2117 return __pyx_r;
2118 }
2119
__pyx_pf_7tinycss_8speedups_6CToken_6column_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken * __pyx_v_self,PyObject * __pyx_v_value)2120 static int __pyx_pf_7tinycss_8speedups_6CToken_6column_2__set__(struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_self, PyObject *__pyx_v_value) {
2121 int __pyx_r;
2122 __Pyx_RefNannyDeclarations
2123 Py_ssize_t __pyx_t_1;
2124 __Pyx_RefNannySetupContext("__set__", 0);
2125 __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L1_error)
2126 __pyx_v_self->column = __pyx_t_1;
2127
2128 /* function exit code */
2129 __pyx_r = 0;
2130 goto __pyx_L0;
2131 __pyx_L1_error:;
2132 __Pyx_AddTraceback("tinycss.speedups.CToken.column.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2133 __pyx_r = -1;
2134 __pyx_L0:;
2135 __Pyx_RefNannyFinishContext();
2136 return __pyx_r;
2137 }
2138
2139 /* "tinycss/speedups.pyx":55
2140 *
2141 *
2142 * def tokenize_flat(css_source, int ignore_comments=1): # <<<<<<<<<<<<<<
2143 * """
2144 * :param css_source:
2145 */
2146
2147 /* Python wrapper */
2148 static PyObject *__pyx_pw_7tinycss_8speedups_1tokenize_flat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2149 static char __pyx_doc_7tinycss_8speedups_tokenize_flat[] = "\n :param css_source:\n CSS as an unicode string\n :param ignore_comments:\n if true (the default) comments will not be included in the\n return value\n :return:\n An iterator of :class:`Token`\n\n ";
2150 static PyMethodDef __pyx_mdef_7tinycss_8speedups_1tokenize_flat = {"tokenize_flat", (PyCFunction)__pyx_pw_7tinycss_8speedups_1tokenize_flat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7tinycss_8speedups_tokenize_flat};
__pyx_pw_7tinycss_8speedups_1tokenize_flat(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2151 static PyObject *__pyx_pw_7tinycss_8speedups_1tokenize_flat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2152 PyObject *__pyx_v_css_source = 0;
2153 int __pyx_v_ignore_comments;
2154 PyObject *__pyx_r = 0;
2155 __Pyx_RefNannyDeclarations
2156 __Pyx_RefNannySetupContext("tokenize_flat (wrapper)", 0);
2157 {
2158 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_css_source,&__pyx_n_s_ignore_comments,0};
2159 PyObject* values[2] = {0,0};
2160 if (unlikely(__pyx_kwds)) {
2161 Py_ssize_t kw_args;
2162 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2163 switch (pos_args) {
2164 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2165 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2166 case 0: break;
2167 default: goto __pyx_L5_argtuple_error;
2168 }
2169 kw_args = PyDict_Size(__pyx_kwds);
2170 switch (pos_args) {
2171 case 0:
2172 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_css_source)) != 0)) kw_args--;
2173 else goto __pyx_L5_argtuple_error;
2174 case 1:
2175 if (kw_args > 0) {
2176 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ignore_comments);
2177 if (value) { values[1] = value; kw_args--; }
2178 }
2179 }
2180 if (unlikely(kw_args > 0)) {
2181 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tokenize_flat") < 0)) __PYX_ERR(0, 55, __pyx_L3_error)
2182 }
2183 } else {
2184 switch (PyTuple_GET_SIZE(__pyx_args)) {
2185 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2186 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2187 break;
2188 default: goto __pyx_L5_argtuple_error;
2189 }
2190 }
2191 __pyx_v_css_source = values[0];
2192 if (values[1]) {
2193 __pyx_v_ignore_comments = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_ignore_comments == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L3_error)
2194 } else {
2195 __pyx_v_ignore_comments = ((int)1);
2196 }
2197 }
2198 goto __pyx_L4_argument_unpacking_done;
2199 __pyx_L5_argtuple_error:;
2200 __Pyx_RaiseArgtupleInvalid("tokenize_flat", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 55, __pyx_L3_error)
2201 __pyx_L3_error:;
2202 __Pyx_AddTraceback("tinycss.speedups.tokenize_flat", __pyx_clineno, __pyx_lineno, __pyx_filename);
2203 __Pyx_RefNannyFinishContext();
2204 return NULL;
2205 __pyx_L4_argument_unpacking_done:;
2206 __pyx_r = __pyx_pf_7tinycss_8speedups_tokenize_flat(__pyx_self, __pyx_v_css_source, __pyx_v_ignore_comments);
2207
2208 /* function exit code */
2209 __Pyx_RefNannyFinishContext();
2210 return __pyx_r;
2211 }
2212
__pyx_pf_7tinycss_8speedups_tokenize_flat(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_css_source,int __pyx_v_ignore_comments)2213 static PyObject *__pyx_pf_7tinycss_8speedups_tokenize_flat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_css_source, int __pyx_v_ignore_comments) {
2214 PyObject *__pyx_v_tokens_dispatch = NULL;
2215 PyObject *__pyx_v_compiled_token_indexes = NULL;
2216 PyObject *__pyx_v_compiled_tokens = NULL;
2217 PyObject *__pyx_v_unicode_unescape = NULL;
2218 PyObject *__pyx_v_newline_unescape = NULL;
2219 PyObject *__pyx_v_simple_unescape = NULL;
2220 PyObject *__pyx_v_find_newlines = NULL;
2221 Py_ssize_t __pyx_v_BAD_COMMENT;
2222 Py_ssize_t __pyx_v_BAD_STRING;
2223 Py_ssize_t __pyx_v_PERCENTAGE;
2224 Py_ssize_t __pyx_v_DIMENSION;
2225 Py_ssize_t __pyx_v_ATKEYWORD;
2226 Py_ssize_t __pyx_v_FUNCTION;
2227 Py_ssize_t __pyx_v_COMMENT;
2228 Py_ssize_t __pyx_v_NUMBER;
2229 Py_ssize_t __pyx_v_STRING;
2230 Py_ssize_t __pyx_v_IDENT;
2231 Py_ssize_t __pyx_v_HASH;
2232 Py_ssize_t __pyx_v_URI;
2233 Py_ssize_t __pyx_v_DELIM;
2234 Py_ssize_t __pyx_v_pos;
2235 Py_ssize_t __pyx_v_line;
2236 Py_ssize_t __pyx_v_column;
2237 Py_ssize_t __pyx_v_source_len;
2238 CYTHON_UNUSED Py_ssize_t __pyx_v_n_tokens;
2239 Py_ssize_t __pyx_v_length;
2240 Py_ssize_t __pyx_v_next_pos;
2241 Py_ssize_t __pyx_v_type_;
2242 struct __pyx_obj_7tinycss_8speedups_CToken *__pyx_v_token = 0;
2243 PyObject *__pyx_v_tokens = NULL;
2244 PyObject *__pyx_v_char = NULL;
2245 PyObject *__pyx_v_type_name = NULL;
2246 PyObject *__pyx_v_css_value = NULL;
2247 long __pyx_v_codepoint;
2248 PyObject *__pyx_v_regexp = NULL;
2249 PyObject *__pyx_v_match = NULL;
2250 PyObject *__pyx_v_unit = NULL;
2251 PyObject *__pyx_v_value = NULL;
2252 PyObject *__pyx_v_newlines = NULL;
2253 PyObject *__pyx_r = NULL;
2254 __Pyx_RefNannyDeclarations
2255 PyObject *__pyx_t_1 = NULL;
2256 Py_ssize_t __pyx_t_2;
2257 int __pyx_t_3;
2258 int __pyx_t_4;
2259 long __pyx_t_5;
2260 long __pyx_t_6;
2261 long __pyx_t_7;
2262 PyObject *__pyx_t_8 = NULL;
2263 PyObject *(*__pyx_t_9)(PyObject *);
2264 PyObject *__pyx_t_10 = NULL;
2265 PyObject *__pyx_t_11 = NULL;
2266 PyObject *__pyx_t_12 = NULL;
2267 PyObject *__pyx_t_13 = NULL;
2268 PyObject *(*__pyx_t_14)(PyObject *);
2269 Py_ssize_t __pyx_t_15;
2270 int __pyx_t_16;
2271 int __pyx_t_17;
2272 __Pyx_RefNannySetupContext("tokenize_flat", 0);
2273
2274 /* "tinycss/speedups.pyx":67
2275 * """
2276 * # Make these local variable to avoid global lookups in the loop
2277 * tokens_dispatch = TOKEN_DISPATCH # <<<<<<<<<<<<<<
2278 * compiled_token_indexes = COMPILED_TOKEN_INDEXES
2279 * compiled_tokens = COMPILED_TOKEN_REGEXPS
2280 */
2281 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_TOKEN_DISPATCH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
2282 __Pyx_GOTREF(__pyx_t_1);
2283 __pyx_v_tokens_dispatch = __pyx_t_1;
2284 __pyx_t_1 = 0;
2285
2286 /* "tinycss/speedups.pyx":68
2287 * # Make these local variable to avoid global lookups in the loop
2288 * tokens_dispatch = TOKEN_DISPATCH
2289 * compiled_token_indexes = COMPILED_TOKEN_INDEXES # <<<<<<<<<<<<<<
2290 * compiled_tokens = COMPILED_TOKEN_REGEXPS
2291 * unicode_unescape = UNICODE_UNESCAPE
2292 */
2293 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_COMPILED_TOKEN_INDEXES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
2294 __Pyx_GOTREF(__pyx_t_1);
2295 __pyx_v_compiled_token_indexes = __pyx_t_1;
2296 __pyx_t_1 = 0;
2297
2298 /* "tinycss/speedups.pyx":69
2299 * tokens_dispatch = TOKEN_DISPATCH
2300 * compiled_token_indexes = COMPILED_TOKEN_INDEXES
2301 * compiled_tokens = COMPILED_TOKEN_REGEXPS # <<<<<<<<<<<<<<
2302 * unicode_unescape = UNICODE_UNESCAPE
2303 * newline_unescape = NEWLINE_UNESCAPE
2304 */
2305 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_COMPILED_TOKEN_REGEXPS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2306 __Pyx_GOTREF(__pyx_t_1);
2307 __pyx_v_compiled_tokens = __pyx_t_1;
2308 __pyx_t_1 = 0;
2309
2310 /* "tinycss/speedups.pyx":70
2311 * compiled_token_indexes = COMPILED_TOKEN_INDEXES
2312 * compiled_tokens = COMPILED_TOKEN_REGEXPS
2313 * unicode_unescape = UNICODE_UNESCAPE # <<<<<<<<<<<<<<
2314 * newline_unescape = NEWLINE_UNESCAPE
2315 * simple_unescape = SIMPLE_UNESCAPE
2316 */
2317 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_UNICODE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2318 __Pyx_GOTREF(__pyx_t_1);
2319 __pyx_v_unicode_unescape = __pyx_t_1;
2320 __pyx_t_1 = 0;
2321
2322 /* "tinycss/speedups.pyx":71
2323 * compiled_tokens = COMPILED_TOKEN_REGEXPS
2324 * unicode_unescape = UNICODE_UNESCAPE
2325 * newline_unescape = NEWLINE_UNESCAPE # <<<<<<<<<<<<<<
2326 * simple_unescape = SIMPLE_UNESCAPE
2327 * find_newlines = FIND_NEWLINES
2328 */
2329 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NEWLINE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2330 __Pyx_GOTREF(__pyx_t_1);
2331 __pyx_v_newline_unescape = __pyx_t_1;
2332 __pyx_t_1 = 0;
2333
2334 /* "tinycss/speedups.pyx":72
2335 * unicode_unescape = UNICODE_UNESCAPE
2336 * newline_unescape = NEWLINE_UNESCAPE
2337 * simple_unescape = SIMPLE_UNESCAPE # <<<<<<<<<<<<<<
2338 * find_newlines = FIND_NEWLINES
2339 *
2340 */
2341 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SIMPLE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
2342 __Pyx_GOTREF(__pyx_t_1);
2343 __pyx_v_simple_unescape = __pyx_t_1;
2344 __pyx_t_1 = 0;
2345
2346 /* "tinycss/speedups.pyx":73
2347 * newline_unescape = NEWLINE_UNESCAPE
2348 * simple_unescape = SIMPLE_UNESCAPE
2349 * find_newlines = FIND_NEWLINES # <<<<<<<<<<<<<<
2350 *
2351 * # Use the integer indexes instead of string markers
2352 */
2353 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_FIND_NEWLINES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
2354 __Pyx_GOTREF(__pyx_t_1);
2355 __pyx_v_find_newlines = __pyx_t_1;
2356 __pyx_t_1 = 0;
2357
2358 /* "tinycss/speedups.pyx":76
2359 *
2360 * # Use the integer indexes instead of string markers
2361 * cdef Py_ssize_t BAD_COMMENT = compiled_token_indexes['BAD_COMMENT'] # <<<<<<<<<<<<<<
2362 * cdef Py_ssize_t BAD_STRING = compiled_token_indexes['BAD_STRING']
2363 * cdef Py_ssize_t PERCENTAGE = compiled_token_indexes['PERCENTAGE']
2364 */
2365 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_BAD_COMMENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2366 __Pyx_GOTREF(__pyx_t_1);
2367 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error)
2368 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2369 __pyx_v_BAD_COMMENT = __pyx_t_2;
2370
2371 /* "tinycss/speedups.pyx":77
2372 * # Use the integer indexes instead of string markers
2373 * cdef Py_ssize_t BAD_COMMENT = compiled_token_indexes['BAD_COMMENT']
2374 * cdef Py_ssize_t BAD_STRING = compiled_token_indexes['BAD_STRING'] # <<<<<<<<<<<<<<
2375 * cdef Py_ssize_t PERCENTAGE = compiled_token_indexes['PERCENTAGE']
2376 * cdef Py_ssize_t DIMENSION = compiled_token_indexes['DIMENSION']
2377 */
2378 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_BAD_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
2379 __Pyx_GOTREF(__pyx_t_1);
2380 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
2381 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2382 __pyx_v_BAD_STRING = __pyx_t_2;
2383
2384 /* "tinycss/speedups.pyx":78
2385 * cdef Py_ssize_t BAD_COMMENT = compiled_token_indexes['BAD_COMMENT']
2386 * cdef Py_ssize_t BAD_STRING = compiled_token_indexes['BAD_STRING']
2387 * cdef Py_ssize_t PERCENTAGE = compiled_token_indexes['PERCENTAGE'] # <<<<<<<<<<<<<<
2388 * cdef Py_ssize_t DIMENSION = compiled_token_indexes['DIMENSION']
2389 * cdef Py_ssize_t ATKEYWORD = compiled_token_indexes['ATKEYWORD']
2390 */
2391 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_PERCENTAGE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2392 __Pyx_GOTREF(__pyx_t_1);
2393 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
2394 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2395 __pyx_v_PERCENTAGE = __pyx_t_2;
2396
2397 /* "tinycss/speedups.pyx":79
2398 * cdef Py_ssize_t BAD_STRING = compiled_token_indexes['BAD_STRING']
2399 * cdef Py_ssize_t PERCENTAGE = compiled_token_indexes['PERCENTAGE']
2400 * cdef Py_ssize_t DIMENSION = compiled_token_indexes['DIMENSION'] # <<<<<<<<<<<<<<
2401 * cdef Py_ssize_t ATKEYWORD = compiled_token_indexes['ATKEYWORD']
2402 * cdef Py_ssize_t FUNCTION = compiled_token_indexes['FUNCTION']
2403 */
2404 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_DIMENSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
2405 __Pyx_GOTREF(__pyx_t_1);
2406 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
2407 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2408 __pyx_v_DIMENSION = __pyx_t_2;
2409
2410 /* "tinycss/speedups.pyx":80
2411 * cdef Py_ssize_t PERCENTAGE = compiled_token_indexes['PERCENTAGE']
2412 * cdef Py_ssize_t DIMENSION = compiled_token_indexes['DIMENSION']
2413 * cdef Py_ssize_t ATKEYWORD = compiled_token_indexes['ATKEYWORD'] # <<<<<<<<<<<<<<
2414 * cdef Py_ssize_t FUNCTION = compiled_token_indexes['FUNCTION']
2415 * cdef Py_ssize_t COMMENT = compiled_token_indexes['COMMENT']
2416 */
2417 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_ATKEYWORD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2418 __Pyx_GOTREF(__pyx_t_1);
2419 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error)
2420 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2421 __pyx_v_ATKEYWORD = __pyx_t_2;
2422
2423 /* "tinycss/speedups.pyx":81
2424 * cdef Py_ssize_t DIMENSION = compiled_token_indexes['DIMENSION']
2425 * cdef Py_ssize_t ATKEYWORD = compiled_token_indexes['ATKEYWORD']
2426 * cdef Py_ssize_t FUNCTION = compiled_token_indexes['FUNCTION'] # <<<<<<<<<<<<<<
2427 * cdef Py_ssize_t COMMENT = compiled_token_indexes['COMMENT']
2428 * cdef Py_ssize_t NUMBER = compiled_token_indexes['NUMBER']
2429 */
2430 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_FUNCTION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
2431 __Pyx_GOTREF(__pyx_t_1);
2432 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
2433 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2434 __pyx_v_FUNCTION = __pyx_t_2;
2435
2436 /* "tinycss/speedups.pyx":82
2437 * cdef Py_ssize_t ATKEYWORD = compiled_token_indexes['ATKEYWORD']
2438 * cdef Py_ssize_t FUNCTION = compiled_token_indexes['FUNCTION']
2439 * cdef Py_ssize_t COMMENT = compiled_token_indexes['COMMENT'] # <<<<<<<<<<<<<<
2440 * cdef Py_ssize_t NUMBER = compiled_token_indexes['NUMBER']
2441 * cdef Py_ssize_t STRING = compiled_token_indexes['STRING']
2442 */
2443 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_COMMENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
2444 __Pyx_GOTREF(__pyx_t_1);
2445 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
2446 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2447 __pyx_v_COMMENT = __pyx_t_2;
2448
2449 /* "tinycss/speedups.pyx":83
2450 * cdef Py_ssize_t FUNCTION = compiled_token_indexes['FUNCTION']
2451 * cdef Py_ssize_t COMMENT = compiled_token_indexes['COMMENT']
2452 * cdef Py_ssize_t NUMBER = compiled_token_indexes['NUMBER'] # <<<<<<<<<<<<<<
2453 * cdef Py_ssize_t STRING = compiled_token_indexes['STRING']
2454 * cdef Py_ssize_t IDENT = compiled_token_indexes['IDENT']
2455 */
2456 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_NUMBER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2457 __Pyx_GOTREF(__pyx_t_1);
2458 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
2459 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2460 __pyx_v_NUMBER = __pyx_t_2;
2461
2462 /* "tinycss/speedups.pyx":84
2463 * cdef Py_ssize_t COMMENT = compiled_token_indexes['COMMENT']
2464 * cdef Py_ssize_t NUMBER = compiled_token_indexes['NUMBER']
2465 * cdef Py_ssize_t STRING = compiled_token_indexes['STRING'] # <<<<<<<<<<<<<<
2466 * cdef Py_ssize_t IDENT = compiled_token_indexes['IDENT']
2467 * cdef Py_ssize_t HASH = compiled_token_indexes['HASH']
2468 */
2469 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
2470 __Pyx_GOTREF(__pyx_t_1);
2471 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
2472 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2473 __pyx_v_STRING = __pyx_t_2;
2474
2475 /* "tinycss/speedups.pyx":85
2476 * cdef Py_ssize_t NUMBER = compiled_token_indexes['NUMBER']
2477 * cdef Py_ssize_t STRING = compiled_token_indexes['STRING']
2478 * cdef Py_ssize_t IDENT = compiled_token_indexes['IDENT'] # <<<<<<<<<<<<<<
2479 * cdef Py_ssize_t HASH = compiled_token_indexes['HASH']
2480 * cdef Py_ssize_t URI = compiled_token_indexes['URI']
2481 */
2482 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_IDENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
2483 __Pyx_GOTREF(__pyx_t_1);
2484 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
2485 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2486 __pyx_v_IDENT = __pyx_t_2;
2487
2488 /* "tinycss/speedups.pyx":86
2489 * cdef Py_ssize_t STRING = compiled_token_indexes['STRING']
2490 * cdef Py_ssize_t IDENT = compiled_token_indexes['IDENT']
2491 * cdef Py_ssize_t HASH = compiled_token_indexes['HASH'] # <<<<<<<<<<<<<<
2492 * cdef Py_ssize_t URI = compiled_token_indexes['URI']
2493 * cdef Py_ssize_t DELIM = -1
2494 */
2495 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_HASH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
2496 __Pyx_GOTREF(__pyx_t_1);
2497 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
2498 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2499 __pyx_v_HASH = __pyx_t_2;
2500
2501 /* "tinycss/speedups.pyx":87
2502 * cdef Py_ssize_t IDENT = compiled_token_indexes['IDENT']
2503 * cdef Py_ssize_t HASH = compiled_token_indexes['HASH']
2504 * cdef Py_ssize_t URI = compiled_token_indexes['URI'] # <<<<<<<<<<<<<<
2505 * cdef Py_ssize_t DELIM = -1
2506 *
2507 */
2508 __pyx_t_1 = PyObject_GetItem(__pyx_v_compiled_token_indexes, __pyx_n_u_URI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
2509 __Pyx_GOTREF(__pyx_t_1);
2510 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
2511 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2512 __pyx_v_URI = __pyx_t_2;
2513
2514 /* "tinycss/speedups.pyx":88
2515 * cdef Py_ssize_t HASH = compiled_token_indexes['HASH']
2516 * cdef Py_ssize_t URI = compiled_token_indexes['URI']
2517 * cdef Py_ssize_t DELIM = -1 # <<<<<<<<<<<<<<
2518 *
2519 * cdef Py_ssize_t pos = 0
2520 */
2521 __pyx_v_DELIM = -1L;
2522
2523 /* "tinycss/speedups.pyx":90
2524 * cdef Py_ssize_t DELIM = -1
2525 *
2526 * cdef Py_ssize_t pos = 0 # <<<<<<<<<<<<<<
2527 * cdef Py_ssize_t line = 1
2528 * cdef Py_ssize_t column = 1
2529 */
2530 __pyx_v_pos = 0;
2531
2532 /* "tinycss/speedups.pyx":91
2533 *
2534 * cdef Py_ssize_t pos = 0
2535 * cdef Py_ssize_t line = 1 # <<<<<<<<<<<<<<
2536 * cdef Py_ssize_t column = 1
2537 * cdef Py_ssize_t source_len = len(css_source)
2538 */
2539 __pyx_v_line = 1;
2540
2541 /* "tinycss/speedups.pyx":92
2542 * cdef Py_ssize_t pos = 0
2543 * cdef Py_ssize_t line = 1
2544 * cdef Py_ssize_t column = 1 # <<<<<<<<<<<<<<
2545 * cdef Py_ssize_t source_len = len(css_source)
2546 * cdef Py_ssize_t n_tokens = len(compiled_tokens)
2547 */
2548 __pyx_v_column = 1;
2549
2550 /* "tinycss/speedups.pyx":93
2551 * cdef Py_ssize_t line = 1
2552 * cdef Py_ssize_t column = 1
2553 * cdef Py_ssize_t source_len = len(css_source) # <<<<<<<<<<<<<<
2554 * cdef Py_ssize_t n_tokens = len(compiled_tokens)
2555 * cdef Py_ssize_t length, next_pos, type_
2556 */
2557 __pyx_t_2 = PyObject_Length(__pyx_v_css_source); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 93, __pyx_L1_error)
2558 __pyx_v_source_len = __pyx_t_2;
2559
2560 /* "tinycss/speedups.pyx":94
2561 * cdef Py_ssize_t column = 1
2562 * cdef Py_ssize_t source_len = len(css_source)
2563 * cdef Py_ssize_t n_tokens = len(compiled_tokens) # <<<<<<<<<<<<<<
2564 * cdef Py_ssize_t length, next_pos, type_
2565 * cdef CToken token
2566 */
2567 __pyx_t_2 = PyObject_Length(__pyx_v_compiled_tokens); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 94, __pyx_L1_error)
2568 __pyx_v_n_tokens = __pyx_t_2;
2569
2570 /* "tinycss/speedups.pyx":98
2571 * cdef CToken token
2572 *
2573 * tokens = [] # <<<<<<<<<<<<<<
2574 * while pos < source_len:
2575 * char = css_source[pos]
2576 */
2577 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
2578 __Pyx_GOTREF(__pyx_t_1);
2579 __pyx_v_tokens = ((PyObject*)__pyx_t_1);
2580 __pyx_t_1 = 0;
2581
2582 /* "tinycss/speedups.pyx":99
2583 *
2584 * tokens = []
2585 * while pos < source_len: # <<<<<<<<<<<<<<
2586 * char = css_source[pos]
2587 * if char in ':;{}()[]':
2588 */
2589 while (1) {
2590 __pyx_t_3 = ((__pyx_v_pos < __pyx_v_source_len) != 0);
2591 if (!__pyx_t_3) break;
2592
2593 /* "tinycss/speedups.pyx":100
2594 * tokens = []
2595 * while pos < source_len:
2596 * char = css_source[pos] # <<<<<<<<<<<<<<
2597 * if char in ':;{}()[]':
2598 * type_ = -1 # not parsed further anyway
2599 */
2600 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_css_source, __pyx_v_pos, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
2601 __Pyx_GOTREF(__pyx_t_1);
2602 __Pyx_XDECREF_SET(__pyx_v_char, __pyx_t_1);
2603 __pyx_t_1 = 0;
2604
2605 /* "tinycss/speedups.pyx":101
2606 * while pos < source_len:
2607 * char = css_source[pos]
2608 * if char in ':;{}()[]': # <<<<<<<<<<<<<<
2609 * type_ = -1 # not parsed further anyway
2610 * type_name = char
2611 */
2612 __pyx_t_3 = (__Pyx_PyUnicode_ContainsTF(__pyx_v_char, __pyx_kp_u__2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
2613 __pyx_t_4 = (__pyx_t_3 != 0);
2614 if (__pyx_t_4) {
2615
2616 /* "tinycss/speedups.pyx":102
2617 * char = css_source[pos]
2618 * if char in ':;{}()[]':
2619 * type_ = -1 # not parsed further anyway # <<<<<<<<<<<<<<
2620 * type_name = char
2621 * css_value = char
2622 */
2623 __pyx_v_type_ = -1L;
2624
2625 /* "tinycss/speedups.pyx":103
2626 * if char in ':;{}()[]':
2627 * type_ = -1 # not parsed further anyway
2628 * type_name = char # <<<<<<<<<<<<<<
2629 * css_value = char
2630 * else:
2631 */
2632 __Pyx_INCREF(__pyx_v_char);
2633 __Pyx_XDECREF_SET(__pyx_v_type_name, __pyx_v_char);
2634
2635 /* "tinycss/speedups.pyx":104
2636 * type_ = -1 # not parsed further anyway
2637 * type_name = char
2638 * css_value = char # <<<<<<<<<<<<<<
2639 * else:
2640 * codepoint = min(ord(char), 160)
2641 */
2642 __Pyx_INCREF(__pyx_v_char);
2643 __Pyx_XDECREF_SET(__pyx_v_css_value, __pyx_v_char);
2644
2645 /* "tinycss/speedups.pyx":101
2646 * while pos < source_len:
2647 * char = css_source[pos]
2648 * if char in ':;{}()[]': # <<<<<<<<<<<<<<
2649 * type_ = -1 # not parsed further anyway
2650 * type_name = char
2651 */
2652 goto __pyx_L5;
2653 }
2654
2655 /* "tinycss/speedups.pyx":106
2656 * css_value = char
2657 * else:
2658 * codepoint = min(ord(char), 160) # <<<<<<<<<<<<<<
2659 * for type_, type_name, regexp in tokens_dispatch[codepoint]:
2660 * match = regexp(css_source, pos)
2661 */
2662 /*else*/ {
2663 __pyx_t_5 = 0xA0;
2664 __pyx_t_6 = __Pyx_PyObject_Ord(__pyx_v_char); if (unlikely(__pyx_t_6 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 106, __pyx_L1_error)
2665 if (((__pyx_t_5 < __pyx_t_6) != 0)) {
2666 __pyx_t_7 = __pyx_t_5;
2667 } else {
2668 __pyx_t_7 = __pyx_t_6;
2669 }
2670 __pyx_v_codepoint = __pyx_t_7;
2671
2672 /* "tinycss/speedups.pyx":107
2673 * else:
2674 * codepoint = min(ord(char), 160)
2675 * for type_, type_name, regexp in tokens_dispatch[codepoint]: # <<<<<<<<<<<<<<
2676 * match = regexp(css_source, pos)
2677 * if match:
2678 */
2679 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_tokens_dispatch, __pyx_v_codepoint, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
2680 __Pyx_GOTREF(__pyx_t_1);
2681 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2682 __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_2 = 0;
2683 __pyx_t_9 = NULL;
2684 } else {
2685 __pyx_t_2 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
2686 __Pyx_GOTREF(__pyx_t_8);
2687 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
2688 }
2689 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2690 for (;;) {
2691 if (likely(!__pyx_t_9)) {
2692 if (likely(PyList_CheckExact(__pyx_t_8))) {
2693 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_8)) break;
2694 #if CYTHON_COMPILING_IN_CPYTHON
2695 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error)
2696 #else
2697 __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
2698 __Pyx_GOTREF(__pyx_t_1);
2699 #endif
2700 } else {
2701 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
2702 #if CYTHON_COMPILING_IN_CPYTHON
2703 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error)
2704 #else
2705 __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
2706 __Pyx_GOTREF(__pyx_t_1);
2707 #endif
2708 }
2709 } else {
2710 __pyx_t_1 = __pyx_t_9(__pyx_t_8);
2711 if (unlikely(!__pyx_t_1)) {
2712 PyObject* exc_type = PyErr_Occurred();
2713 if (exc_type) {
2714 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2715 else __PYX_ERR(0, 107, __pyx_L1_error)
2716 }
2717 break;
2718 }
2719 __Pyx_GOTREF(__pyx_t_1);
2720 }
2721 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
2722 PyObject* sequence = __pyx_t_1;
2723 #if CYTHON_COMPILING_IN_CPYTHON
2724 Py_ssize_t size = Py_SIZE(sequence);
2725 #else
2726 Py_ssize_t size = PySequence_Size(sequence);
2727 #endif
2728 if (unlikely(size != 3)) {
2729 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
2730 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2731 __PYX_ERR(0, 107, __pyx_L1_error)
2732 }
2733 #if CYTHON_COMPILING_IN_CPYTHON
2734 if (likely(PyTuple_CheckExact(sequence))) {
2735 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
2736 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
2737 __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2);
2738 } else {
2739 __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
2740 __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
2741 __pyx_t_12 = PyList_GET_ITEM(sequence, 2);
2742 }
2743 __Pyx_INCREF(__pyx_t_10);
2744 __Pyx_INCREF(__pyx_t_11);
2745 __Pyx_INCREF(__pyx_t_12);
2746 #else
2747 __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
2748 __Pyx_GOTREF(__pyx_t_10);
2749 __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
2750 __Pyx_GOTREF(__pyx_t_11);
2751 __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 107, __pyx_L1_error)
2752 __Pyx_GOTREF(__pyx_t_12);
2753 #endif
2754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2755 } else {
2756 Py_ssize_t index = -1;
2757 __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 107, __pyx_L1_error)
2758 __Pyx_GOTREF(__pyx_t_13);
2759 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2760 __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
2761 index = 0; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
2762 __Pyx_GOTREF(__pyx_t_10);
2763 index = 1; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L8_unpacking_failed;
2764 __Pyx_GOTREF(__pyx_t_11);
2765 index = 2; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L8_unpacking_failed;
2766 __Pyx_GOTREF(__pyx_t_12);
2767 if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 3) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
2768 __pyx_t_14 = NULL;
2769 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2770 goto __pyx_L9_unpacking_done;
2771 __pyx_L8_unpacking_failed:;
2772 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2773 __pyx_t_14 = NULL;
2774 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2775 __PYX_ERR(0, 107, __pyx_L1_error)
2776 __pyx_L9_unpacking_done:;
2777 }
2778 __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
2779 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2780 __pyx_v_type_ = __pyx_t_15;
2781 __Pyx_XDECREF_SET(__pyx_v_type_name, __pyx_t_11);
2782 __pyx_t_11 = 0;
2783 __Pyx_XDECREF_SET(__pyx_v_regexp, __pyx_t_12);
2784 __pyx_t_12 = 0;
2785
2786 /* "tinycss/speedups.pyx":108
2787 * codepoint = min(ord(char), 160)
2788 * for type_, type_name, regexp in tokens_dispatch[codepoint]:
2789 * match = regexp(css_source, pos) # <<<<<<<<<<<<<<
2790 * if match:
2791 * # First match is the longest. See comments on TOKENS above.
2792 */
2793 __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 108, __pyx_L1_error)
2794 __Pyx_GOTREF(__pyx_t_12);
2795 __Pyx_INCREF(__pyx_v_regexp);
2796 __pyx_t_11 = __pyx_v_regexp; __pyx_t_10 = NULL;
2797 __pyx_t_15 = 0;
2798 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
2799 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
2800 if (likely(__pyx_t_10)) {
2801 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
2802 __Pyx_INCREF(__pyx_t_10);
2803 __Pyx_INCREF(function);
2804 __Pyx_DECREF_SET(__pyx_t_11, function);
2805 __pyx_t_15 = 1;
2806 }
2807 }
2808 __pyx_t_13 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 108, __pyx_L1_error)
2809 __Pyx_GOTREF(__pyx_t_13);
2810 if (__pyx_t_10) {
2811 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
2812 }
2813 __Pyx_INCREF(__pyx_v_css_source);
2814 __Pyx_GIVEREF(__pyx_v_css_source);
2815 PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_15, __pyx_v_css_source);
2816 __Pyx_GIVEREF(__pyx_t_12);
2817 PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_15, __pyx_t_12);
2818 __pyx_t_12 = 0;
2819 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
2820 __Pyx_GOTREF(__pyx_t_1);
2821 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2822 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2823 __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_1);
2824 __pyx_t_1 = 0;
2825
2826 /* "tinycss/speedups.pyx":109
2827 * for type_, type_name, regexp in tokens_dispatch[codepoint]:
2828 * match = regexp(css_source, pos)
2829 * if match: # <<<<<<<<<<<<<<
2830 * # First match is the longest. See comments on TOKENS above.
2831 * css_value = match.group()
2832 */
2833 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_match); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
2834 if (__pyx_t_4) {
2835
2836 /* "tinycss/speedups.pyx":111
2837 * if match:
2838 * # First match is the longest. See comments on TOKENS above.
2839 * css_value = match.group() # <<<<<<<<<<<<<<
2840 * break
2841 * else:
2842 */
2843 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 111, __pyx_L1_error)
2844 __Pyx_GOTREF(__pyx_t_11);
2845 __pyx_t_13 = NULL;
2846 if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
2847 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
2848 if (likely(__pyx_t_13)) {
2849 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
2850 __Pyx_INCREF(__pyx_t_13);
2851 __Pyx_INCREF(function);
2852 __Pyx_DECREF_SET(__pyx_t_11, function);
2853 }
2854 }
2855 if (__pyx_t_13) {
2856 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
2857 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2858 } else {
2859 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
2860 }
2861 __Pyx_GOTREF(__pyx_t_1);
2862 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2863 __Pyx_XDECREF_SET(__pyx_v_css_value, __pyx_t_1);
2864 __pyx_t_1 = 0;
2865
2866 /* "tinycss/speedups.pyx":112
2867 * # First match is the longest. See comments on TOKENS above.
2868 * css_value = match.group()
2869 * break # <<<<<<<<<<<<<<
2870 * else:
2871 * # No match.
2872 */
2873 goto __pyx_L7_break;
2874
2875 /* "tinycss/speedups.pyx":109
2876 * for type_, type_name, regexp in tokens_dispatch[codepoint]:
2877 * match = regexp(css_source, pos)
2878 * if match: # <<<<<<<<<<<<<<
2879 * # First match is the longest. See comments on TOKENS above.
2880 * css_value = match.group()
2881 */
2882 }
2883
2884 /* "tinycss/speedups.pyx":107
2885 * else:
2886 * codepoint = min(ord(char), 160)
2887 * for type_, type_name, regexp in tokens_dispatch[codepoint]: # <<<<<<<<<<<<<<
2888 * match = regexp(css_source, pos)
2889 * if match:
2890 */
2891 }
2892 /*else*/ {
2893
2894 /* "tinycss/speedups.pyx":119
2895 * # ... but quotes at the start of a token are always matched
2896 * # by STRING or BAD_STRING. So DELIM is any single character.
2897 * type_ = DELIM # <<<<<<<<<<<<<<
2898 * type_name = 'DELIM'
2899 * css_value = char
2900 */
2901 __pyx_v_type_ = __pyx_v_DELIM;
2902
2903 /* "tinycss/speedups.pyx":120
2904 * # by STRING or BAD_STRING. So DELIM is any single character.
2905 * type_ = DELIM
2906 * type_name = 'DELIM' # <<<<<<<<<<<<<<
2907 * css_value = char
2908 * length = len(css_value)
2909 */
2910 __Pyx_INCREF(__pyx_n_u_DELIM);
2911 __Pyx_XDECREF_SET(__pyx_v_type_name, __pyx_n_u_DELIM);
2912
2913 /* "tinycss/speedups.pyx":121
2914 * type_ = DELIM
2915 * type_name = 'DELIM'
2916 * css_value = char # <<<<<<<<<<<<<<
2917 * length = len(css_value)
2918 * next_pos = pos + length
2919 */
2920 __Pyx_INCREF(__pyx_v_char);
2921 __Pyx_XDECREF_SET(__pyx_v_css_value, __pyx_v_char);
2922 }
2923
2924 /* "tinycss/speedups.pyx":107
2925 * else:
2926 * codepoint = min(ord(char), 160)
2927 * for type_, type_name, regexp in tokens_dispatch[codepoint]: # <<<<<<<<<<<<<<
2928 * match = regexp(css_source, pos)
2929 * if match:
2930 */
2931 __pyx_L7_break:;
2932 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2933 }
2934 __pyx_L5:;
2935
2936 /* "tinycss/speedups.pyx":122
2937 * type_name = 'DELIM'
2938 * css_value = char
2939 * length = len(css_value) # <<<<<<<<<<<<<<
2940 * next_pos = pos + length
2941 *
2942 */
2943 __pyx_t_2 = PyObject_Length(__pyx_v_css_value); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 122, __pyx_L1_error)
2944 __pyx_v_length = __pyx_t_2;
2945
2946 /* "tinycss/speedups.pyx":123
2947 * css_value = char
2948 * length = len(css_value)
2949 * next_pos = pos + length # <<<<<<<<<<<<<<
2950 *
2951 * # A BAD_COMMENT is a comment at EOF. Ignore it too.
2952 */
2953 __pyx_v_next_pos = (__pyx_v_pos + __pyx_v_length);
2954
2955 /* "tinycss/speedups.pyx":126
2956 *
2957 * # A BAD_COMMENT is a comment at EOF. Ignore it too.
2958 * if not (ignore_comments and type_ in (COMMENT, BAD_COMMENT)): # <<<<<<<<<<<<<<
2959 * # Parse numbers, extract strings and URIs, unescape
2960 * unit = None
2961 */
2962 __pyx_t_3 = (__pyx_v_ignore_comments != 0);
2963 if (__pyx_t_3) {
2964 } else {
2965 __pyx_t_4 = __pyx_t_3;
2966 goto __pyx_L13_bool_binop_done;
2967 }
2968 __pyx_t_2 = __pyx_v_type_;
2969 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_COMMENT) != 0);
2970 if (!__pyx_t_16) {
2971 } else {
2972 __pyx_t_3 = __pyx_t_16;
2973 goto __pyx_L15_bool_binop_done;
2974 }
2975 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_BAD_COMMENT) != 0);
2976 __pyx_t_3 = __pyx_t_16;
2977 __pyx_L15_bool_binop_done:;
2978 __pyx_t_16 = (__pyx_t_3 != 0);
2979 __pyx_t_4 = __pyx_t_16;
2980 __pyx_L13_bool_binop_done:;
2981 __pyx_t_16 = ((!__pyx_t_4) != 0);
2982 if (__pyx_t_16) {
2983
2984 /* "tinycss/speedups.pyx":128
2985 * if not (ignore_comments and type_ in (COMMENT, BAD_COMMENT)):
2986 * # Parse numbers, extract strings and URIs, unescape
2987 * unit = None # <<<<<<<<<<<<<<
2988 * if type_ == DIMENSION:
2989 * value = match.group(1)
2990 */
2991 __Pyx_INCREF(Py_None);
2992 __Pyx_XDECREF_SET(__pyx_v_unit, Py_None);
2993
2994 /* "tinycss/speedups.pyx":129
2995 * # Parse numbers, extract strings and URIs, unescape
2996 * unit = None
2997 * if type_ == DIMENSION: # <<<<<<<<<<<<<<
2998 * value = match.group(1)
2999 * value = float(value) if '.' in value else int(value)
3000 */
3001 __pyx_t_16 = ((__pyx_v_type_ == __pyx_v_DIMENSION) != 0);
3002 if (__pyx_t_16) {
3003
3004 /* "tinycss/speedups.pyx":130
3005 * unit = None
3006 * if type_ == DIMENSION:
3007 * value = match.group(1) # <<<<<<<<<<<<<<
3008 * value = float(value) if '.' in value else int(value)
3009 * unit = match.group(2)
3010 */
3011 if (unlikely(!__pyx_v_match)) { __Pyx_RaiseUnboundLocalError("match"); __PYX_ERR(0, 130, __pyx_L1_error) }
3012 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 130, __pyx_L1_error)
3013 __Pyx_GOTREF(__pyx_t_8);
3014 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
3015 __Pyx_GOTREF(__pyx_t_1);
3016 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3017 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
3018 __pyx_t_1 = 0;
3019
3020 /* "tinycss/speedups.pyx":131
3021 * if type_ == DIMENSION:
3022 * value = match.group(1)
3023 * value = float(value) if '.' in value else int(value) # <<<<<<<<<<<<<<
3024 * unit = match.group(2)
3025 * unit = simple_unescape(unit)
3026 */
3027 __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__4, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 131, __pyx_L1_error)
3028 if ((__pyx_t_16 != 0)) {
3029 __pyx_t_8 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)
3030 __Pyx_GOTREF(__pyx_t_8);
3031 __pyx_t_1 = __pyx_t_8;
3032 __pyx_t_8 = 0;
3033 } else {
3034 __pyx_t_8 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)
3035 __Pyx_GOTREF(__pyx_t_8);
3036 __pyx_t_1 = __pyx_t_8;
3037 __pyx_t_8 = 0;
3038 }
3039 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3040 __pyx_t_1 = 0;
3041
3042 /* "tinycss/speedups.pyx":132
3043 * value = match.group(1)
3044 * value = float(value) if '.' in value else int(value)
3045 * unit = match.group(2) # <<<<<<<<<<<<<<
3046 * unit = simple_unescape(unit)
3047 * unit = unicode_unescape(unit)
3048 */
3049 if (unlikely(!__pyx_v_match)) { __Pyx_RaiseUnboundLocalError("match"); __PYX_ERR(0, 132, __pyx_L1_error) }
3050 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
3051 __Pyx_GOTREF(__pyx_t_1);
3052 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
3053 __Pyx_GOTREF(__pyx_t_8);
3054 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3055 __Pyx_DECREF_SET(__pyx_v_unit, __pyx_t_8);
3056 __pyx_t_8 = 0;
3057
3058 /* "tinycss/speedups.pyx":133
3059 * value = float(value) if '.' in value else int(value)
3060 * unit = match.group(2)
3061 * unit = simple_unescape(unit) # <<<<<<<<<<<<<<
3062 * unit = unicode_unescape(unit)
3063 * unit = unit.lower() # normalize
3064 */
3065 __Pyx_INCREF(__pyx_v_simple_unescape);
3066 __pyx_t_1 = __pyx_v_simple_unescape; __pyx_t_11 = NULL;
3067 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
3068 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
3069 if (likely(__pyx_t_11)) {
3070 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3071 __Pyx_INCREF(__pyx_t_11);
3072 __Pyx_INCREF(function);
3073 __Pyx_DECREF_SET(__pyx_t_1, function);
3074 }
3075 }
3076 if (!__pyx_t_11) {
3077 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_unit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
3078 __Pyx_GOTREF(__pyx_t_8);
3079 } else {
3080 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 133, __pyx_L1_error)
3081 __Pyx_GOTREF(__pyx_t_13);
3082 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3083 __Pyx_INCREF(__pyx_v_unit);
3084 __Pyx_GIVEREF(__pyx_v_unit);
3085 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_unit);
3086 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
3087 __Pyx_GOTREF(__pyx_t_8);
3088 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3089 }
3090 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3091 __Pyx_DECREF_SET(__pyx_v_unit, __pyx_t_8);
3092 __pyx_t_8 = 0;
3093
3094 /* "tinycss/speedups.pyx":134
3095 * unit = match.group(2)
3096 * unit = simple_unescape(unit)
3097 * unit = unicode_unescape(unit) # <<<<<<<<<<<<<<
3098 * unit = unit.lower() # normalize
3099 * elif type_ == PERCENTAGE:
3100 */
3101 __Pyx_INCREF(__pyx_v_unicode_unescape);
3102 __pyx_t_1 = __pyx_v_unicode_unescape; __pyx_t_13 = NULL;
3103 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
3104 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
3105 if (likely(__pyx_t_13)) {
3106 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3107 __Pyx_INCREF(__pyx_t_13);
3108 __Pyx_INCREF(function);
3109 __Pyx_DECREF_SET(__pyx_t_1, function);
3110 }
3111 }
3112 if (!__pyx_t_13) {
3113 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_unit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 134, __pyx_L1_error)
3114 __Pyx_GOTREF(__pyx_t_8);
3115 } else {
3116 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 134, __pyx_L1_error)
3117 __Pyx_GOTREF(__pyx_t_11);
3118 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3119 __Pyx_INCREF(__pyx_v_unit);
3120 __Pyx_GIVEREF(__pyx_v_unit);
3121 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_unit);
3122 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 134, __pyx_L1_error)
3123 __Pyx_GOTREF(__pyx_t_8);
3124 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3125 }
3126 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3127 __Pyx_DECREF_SET(__pyx_v_unit, __pyx_t_8);
3128 __pyx_t_8 = 0;
3129
3130 /* "tinycss/speedups.pyx":135
3131 * unit = simple_unescape(unit)
3132 * unit = unicode_unescape(unit)
3133 * unit = unit.lower() # normalize # <<<<<<<<<<<<<<
3134 * elif type_ == PERCENTAGE:
3135 * value = css_value[:-1]
3136 */
3137 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_unit, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
3138 __Pyx_GOTREF(__pyx_t_1);
3139 __pyx_t_11 = NULL;
3140 if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
3141 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
3142 if (likely(__pyx_t_11)) {
3143 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3144 __Pyx_INCREF(__pyx_t_11);
3145 __Pyx_INCREF(function);
3146 __Pyx_DECREF_SET(__pyx_t_1, function);
3147 }
3148 }
3149 if (__pyx_t_11) {
3150 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 135, __pyx_L1_error)
3151 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3152 } else {
3153 __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 135, __pyx_L1_error)
3154 }
3155 __Pyx_GOTREF(__pyx_t_8);
3156 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3157 __Pyx_DECREF_SET(__pyx_v_unit, __pyx_t_8);
3158 __pyx_t_8 = 0;
3159
3160 /* "tinycss/speedups.pyx":129
3161 * # Parse numbers, extract strings and URIs, unescape
3162 * unit = None
3163 * if type_ == DIMENSION: # <<<<<<<<<<<<<<
3164 * value = match.group(1)
3165 * value = float(value) if '.' in value else int(value)
3166 */
3167 goto __pyx_L17;
3168 }
3169
3170 /* "tinycss/speedups.pyx":136
3171 * unit = unicode_unescape(unit)
3172 * unit = unit.lower() # normalize
3173 * elif type_ == PERCENTAGE: # <<<<<<<<<<<<<<
3174 * value = css_value[:-1]
3175 * value = float(value) if '.' in value else int(value)
3176 */
3177 __pyx_t_16 = ((__pyx_v_type_ == __pyx_v_PERCENTAGE) != 0);
3178 if (__pyx_t_16) {
3179
3180 /* "tinycss/speedups.pyx":137
3181 * unit = unit.lower() # normalize
3182 * elif type_ == PERCENTAGE:
3183 * value = css_value[:-1] # <<<<<<<<<<<<<<
3184 * value = float(value) if '.' in value else int(value)
3185 * unit = '%'
3186 */
3187 __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_css_value, 0, -1L, NULL, NULL, &__pyx_slice__6, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error)
3188 __Pyx_GOTREF(__pyx_t_8);
3189 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8);
3190 __pyx_t_8 = 0;
3191
3192 /* "tinycss/speedups.pyx":138
3193 * elif type_ == PERCENTAGE:
3194 * value = css_value[:-1]
3195 * value = float(value) if '.' in value else int(value) # <<<<<<<<<<<<<<
3196 * unit = '%'
3197 * elif type_ == NUMBER:
3198 */
3199 __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__4, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 138, __pyx_L1_error)
3200 if ((__pyx_t_16 != 0)) {
3201 __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
3202 __Pyx_GOTREF(__pyx_t_1);
3203 __pyx_t_8 = __pyx_t_1;
3204 __pyx_t_1 = 0;
3205 } else {
3206 __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
3207 __Pyx_GOTREF(__pyx_t_1);
3208 __pyx_t_8 = __pyx_t_1;
3209 __pyx_t_1 = 0;
3210 }
3211 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
3212 __pyx_t_8 = 0;
3213
3214 /* "tinycss/speedups.pyx":139
3215 * value = css_value[:-1]
3216 * value = float(value) if '.' in value else int(value)
3217 * unit = '%' # <<<<<<<<<<<<<<
3218 * elif type_ == NUMBER:
3219 * value = css_value
3220 */
3221 __Pyx_INCREF(__pyx_kp_u__7);
3222 __Pyx_DECREF_SET(__pyx_v_unit, __pyx_kp_u__7);
3223
3224 /* "tinycss/speedups.pyx":136
3225 * unit = unicode_unescape(unit)
3226 * unit = unit.lower() # normalize
3227 * elif type_ == PERCENTAGE: # <<<<<<<<<<<<<<
3228 * value = css_value[:-1]
3229 * value = float(value) if '.' in value else int(value)
3230 */
3231 goto __pyx_L17;
3232 }
3233
3234 /* "tinycss/speedups.pyx":140
3235 * value = float(value) if '.' in value else int(value)
3236 * unit = '%'
3237 * elif type_ == NUMBER: # <<<<<<<<<<<<<<
3238 * value = css_value
3239 * if '.' in value:
3240 */
3241 __pyx_t_16 = ((__pyx_v_type_ == __pyx_v_NUMBER) != 0);
3242 if (__pyx_t_16) {
3243
3244 /* "tinycss/speedups.pyx":141
3245 * unit = '%'
3246 * elif type_ == NUMBER:
3247 * value = css_value # <<<<<<<<<<<<<<
3248 * if '.' in value:
3249 * value = float(value)
3250 */
3251 __Pyx_INCREF(__pyx_v_css_value);
3252 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_v_css_value);
3253
3254 /* "tinycss/speedups.pyx":142
3255 * elif type_ == NUMBER:
3256 * value = css_value
3257 * if '.' in value: # <<<<<<<<<<<<<<
3258 * value = float(value)
3259 * else:
3260 */
3261 __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__4, __pyx_v_value, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
3262 __pyx_t_4 = (__pyx_t_16 != 0);
3263 if (__pyx_t_4) {
3264
3265 /* "tinycss/speedups.pyx":143
3266 * value = css_value
3267 * if '.' in value:
3268 * value = float(value) # <<<<<<<<<<<<<<
3269 * else:
3270 * value = int(value)
3271 */
3272 __pyx_t_8 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 143, __pyx_L1_error)
3273 __Pyx_GOTREF(__pyx_t_8);
3274 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
3275 __pyx_t_8 = 0;
3276
3277 /* "tinycss/speedups.pyx":142
3278 * elif type_ == NUMBER:
3279 * value = css_value
3280 * if '.' in value: # <<<<<<<<<<<<<<
3281 * value = float(value)
3282 * else:
3283 */
3284 goto __pyx_L18;
3285 }
3286
3287 /* "tinycss/speedups.pyx":145
3288 * value = float(value)
3289 * else:
3290 * value = int(value) # <<<<<<<<<<<<<<
3291 * type_name = 'INTEGER'
3292 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION):
3293 */
3294 /*else*/ {
3295 __pyx_t_8 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 145, __pyx_L1_error)
3296 __Pyx_GOTREF(__pyx_t_8);
3297 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
3298 __pyx_t_8 = 0;
3299
3300 /* "tinycss/speedups.pyx":146
3301 * else:
3302 * value = int(value)
3303 * type_name = 'INTEGER' # <<<<<<<<<<<<<<
3304 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION):
3305 * value = simple_unescape(css_value)
3306 */
3307 __Pyx_INCREF(__pyx_n_u_INTEGER);
3308 __Pyx_DECREF_SET(__pyx_v_type_name, __pyx_n_u_INTEGER);
3309 }
3310 __pyx_L18:;
3311
3312 /* "tinycss/speedups.pyx":140
3313 * value = float(value) if '.' in value else int(value)
3314 * unit = '%'
3315 * elif type_ == NUMBER: # <<<<<<<<<<<<<<
3316 * value = css_value
3317 * if '.' in value:
3318 */
3319 goto __pyx_L17;
3320 }
3321
3322 /* "tinycss/speedups.pyx":147
3323 * value = int(value)
3324 * type_name = 'INTEGER'
3325 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION): # <<<<<<<<<<<<<<
3326 * value = simple_unescape(css_value)
3327 * value = unicode_unescape(value)
3328 */
3329 __pyx_t_2 = __pyx_v_type_;
3330 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_IDENT) != 0);
3331 if (!__pyx_t_16) {
3332 } else {
3333 __pyx_t_4 = __pyx_t_16;
3334 goto __pyx_L19_bool_binop_done;
3335 }
3336 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_ATKEYWORD) != 0);
3337 if (!__pyx_t_16) {
3338 } else {
3339 __pyx_t_4 = __pyx_t_16;
3340 goto __pyx_L19_bool_binop_done;
3341 }
3342 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_HASH) != 0);
3343 if (!__pyx_t_16) {
3344 } else {
3345 __pyx_t_4 = __pyx_t_16;
3346 goto __pyx_L19_bool_binop_done;
3347 }
3348 __pyx_t_16 = ((__pyx_t_2 == __pyx_v_FUNCTION) != 0);
3349 __pyx_t_4 = __pyx_t_16;
3350 __pyx_L19_bool_binop_done:;
3351 __pyx_t_16 = (__pyx_t_4 != 0);
3352 if (__pyx_t_16) {
3353
3354 /* "tinycss/speedups.pyx":148
3355 * type_name = 'INTEGER'
3356 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION):
3357 * value = simple_unescape(css_value) # <<<<<<<<<<<<<<
3358 * value = unicode_unescape(value)
3359 * elif type_ == URI:
3360 */
3361 __Pyx_INCREF(__pyx_v_simple_unescape);
3362 __pyx_t_1 = __pyx_v_simple_unescape; __pyx_t_11 = NULL;
3363 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
3364 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
3365 if (likely(__pyx_t_11)) {
3366 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3367 __Pyx_INCREF(__pyx_t_11);
3368 __Pyx_INCREF(function);
3369 __Pyx_DECREF_SET(__pyx_t_1, function);
3370 }
3371 }
3372 if (!__pyx_t_11) {
3373 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_css_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
3374 __Pyx_GOTREF(__pyx_t_8);
3375 } else {
3376 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 148, __pyx_L1_error)
3377 __Pyx_GOTREF(__pyx_t_13);
3378 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3379 __Pyx_INCREF(__pyx_v_css_value);
3380 __Pyx_GIVEREF(__pyx_v_css_value);
3381 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_css_value);
3382 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
3383 __Pyx_GOTREF(__pyx_t_8);
3384 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3385 }
3386 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3387 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8);
3388 __pyx_t_8 = 0;
3389
3390 /* "tinycss/speedups.pyx":149
3391 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION):
3392 * value = simple_unescape(css_value)
3393 * value = unicode_unescape(value) # <<<<<<<<<<<<<<
3394 * elif type_ == URI:
3395 * value = match.group(1)
3396 */
3397 __Pyx_INCREF(__pyx_v_unicode_unescape);
3398 __pyx_t_1 = __pyx_v_unicode_unescape; __pyx_t_13 = NULL;
3399 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
3400 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
3401 if (likely(__pyx_t_13)) {
3402 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3403 __Pyx_INCREF(__pyx_t_13);
3404 __Pyx_INCREF(function);
3405 __Pyx_DECREF_SET(__pyx_t_1, function);
3406 }
3407 }
3408 if (!__pyx_t_13) {
3409 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error)
3410 __Pyx_GOTREF(__pyx_t_8);
3411 } else {
3412 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 149, __pyx_L1_error)
3413 __Pyx_GOTREF(__pyx_t_11);
3414 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3415 __Pyx_INCREF(__pyx_v_value);
3416 __Pyx_GIVEREF(__pyx_v_value);
3417 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_value);
3418 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error)
3419 __Pyx_GOTREF(__pyx_t_8);
3420 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3421 }
3422 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3423 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
3424 __pyx_t_8 = 0;
3425
3426 /* "tinycss/speedups.pyx":147
3427 * value = int(value)
3428 * type_name = 'INTEGER'
3429 * elif type_ in (IDENT, ATKEYWORD, HASH, FUNCTION): # <<<<<<<<<<<<<<
3430 * value = simple_unescape(css_value)
3431 * value = unicode_unescape(value)
3432 */
3433 goto __pyx_L17;
3434 }
3435
3436 /* "tinycss/speedups.pyx":150
3437 * value = simple_unescape(css_value)
3438 * value = unicode_unescape(value)
3439 * elif type_ == URI: # <<<<<<<<<<<<<<
3440 * value = match.group(1)
3441 * if value and value[0] in '"\'':
3442 */
3443 __pyx_t_16 = ((__pyx_v_type_ == __pyx_v_URI) != 0);
3444 if (__pyx_t_16) {
3445
3446 /* "tinycss/speedups.pyx":151
3447 * value = unicode_unescape(value)
3448 * elif type_ == URI:
3449 * value = match.group(1) # <<<<<<<<<<<<<<
3450 * if value and value[0] in '"\'':
3451 * value = value[1:-1] # Remove quotes
3452 */
3453 if (unlikely(!__pyx_v_match)) { __Pyx_RaiseUnboundLocalError("match"); __PYX_ERR(0, 151, __pyx_L1_error) }
3454 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 151, __pyx_L1_error)
3455 __Pyx_GOTREF(__pyx_t_8);
3456 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
3457 __Pyx_GOTREF(__pyx_t_1);
3458 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3459 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
3460 __pyx_t_1 = 0;
3461
3462 /* "tinycss/speedups.pyx":152
3463 * elif type_ == URI:
3464 * value = match.group(1)
3465 * if value and value[0] in '"\'': # <<<<<<<<<<<<<<
3466 * value = value[1:-1] # Remove quotes
3467 * value = newline_unescape(value)
3468 */
3469 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
3470 if (__pyx_t_4) {
3471 } else {
3472 __pyx_t_16 = __pyx_t_4;
3473 goto __pyx_L24_bool_binop_done;
3474 }
3475 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
3476 __Pyx_GOTREF(__pyx_t_1);
3477 __pyx_t_4 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_1, __pyx_kp_u__9, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
3478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3479 __pyx_t_3 = (__pyx_t_4 != 0);
3480 __pyx_t_16 = __pyx_t_3;
3481 __pyx_L24_bool_binop_done:;
3482 if (__pyx_t_16) {
3483
3484 /* "tinycss/speedups.pyx":153
3485 * value = match.group(1)
3486 * if value and value[0] in '"\'':
3487 * value = value[1:-1] # Remove quotes # <<<<<<<<<<<<<<
3488 * value = newline_unescape(value)
3489 * value = simple_unescape(value)
3490 */
3491 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, -1L, NULL, NULL, &__pyx_slice__10, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
3492 __Pyx_GOTREF(__pyx_t_1);
3493 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3494 __pyx_t_1 = 0;
3495
3496 /* "tinycss/speedups.pyx":154
3497 * if value and value[0] in '"\'':
3498 * value = value[1:-1] # Remove quotes
3499 * value = newline_unescape(value) # <<<<<<<<<<<<<<
3500 * value = simple_unescape(value)
3501 * value = unicode_unescape(value)
3502 */
3503 __Pyx_INCREF(__pyx_v_newline_unescape);
3504 __pyx_t_8 = __pyx_v_newline_unescape; __pyx_t_11 = NULL;
3505 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3506 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
3507 if (likely(__pyx_t_11)) {
3508 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3509 __Pyx_INCREF(__pyx_t_11);
3510 __Pyx_INCREF(function);
3511 __Pyx_DECREF_SET(__pyx_t_8, function);
3512 }
3513 }
3514 if (!__pyx_t_11) {
3515 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
3516 __Pyx_GOTREF(__pyx_t_1);
3517 } else {
3518 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L1_error)
3519 __Pyx_GOTREF(__pyx_t_13);
3520 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3521 __Pyx_INCREF(__pyx_v_value);
3522 __Pyx_GIVEREF(__pyx_v_value);
3523 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_value);
3524 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
3525 __Pyx_GOTREF(__pyx_t_1);
3526 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3527 }
3528 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3529 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3530 __pyx_t_1 = 0;
3531
3532 /* "tinycss/speedups.pyx":152
3533 * elif type_ == URI:
3534 * value = match.group(1)
3535 * if value and value[0] in '"\'': # <<<<<<<<<<<<<<
3536 * value = value[1:-1] # Remove quotes
3537 * value = newline_unescape(value)
3538 */
3539 }
3540
3541 /* "tinycss/speedups.pyx":155
3542 * value = value[1:-1] # Remove quotes
3543 * value = newline_unescape(value)
3544 * value = simple_unescape(value) # <<<<<<<<<<<<<<
3545 * value = unicode_unescape(value)
3546 * elif type_ == STRING:
3547 */
3548 __Pyx_INCREF(__pyx_v_simple_unescape);
3549 __pyx_t_8 = __pyx_v_simple_unescape; __pyx_t_13 = NULL;
3550 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3551 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
3552 if (likely(__pyx_t_13)) {
3553 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3554 __Pyx_INCREF(__pyx_t_13);
3555 __Pyx_INCREF(function);
3556 __Pyx_DECREF_SET(__pyx_t_8, function);
3557 }
3558 }
3559 if (!__pyx_t_13) {
3560 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
3561 __Pyx_GOTREF(__pyx_t_1);
3562 } else {
3563 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 155, __pyx_L1_error)
3564 __Pyx_GOTREF(__pyx_t_11);
3565 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3566 __Pyx_INCREF(__pyx_v_value);
3567 __Pyx_GIVEREF(__pyx_v_value);
3568 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_value);
3569 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
3570 __Pyx_GOTREF(__pyx_t_1);
3571 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3572 }
3573 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3574 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3575 __pyx_t_1 = 0;
3576
3577 /* "tinycss/speedups.pyx":156
3578 * value = newline_unescape(value)
3579 * value = simple_unescape(value)
3580 * value = unicode_unescape(value) # <<<<<<<<<<<<<<
3581 * elif type_ == STRING:
3582 * value = css_value[1:-1] # Remove quotes
3583 */
3584 __Pyx_INCREF(__pyx_v_unicode_unescape);
3585 __pyx_t_8 = __pyx_v_unicode_unescape; __pyx_t_11 = NULL;
3586 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3587 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
3588 if (likely(__pyx_t_11)) {
3589 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3590 __Pyx_INCREF(__pyx_t_11);
3591 __Pyx_INCREF(function);
3592 __Pyx_DECREF_SET(__pyx_t_8, function);
3593 }
3594 }
3595 if (!__pyx_t_11) {
3596 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3597 __Pyx_GOTREF(__pyx_t_1);
3598 } else {
3599 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 156, __pyx_L1_error)
3600 __Pyx_GOTREF(__pyx_t_13);
3601 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3602 __Pyx_INCREF(__pyx_v_value);
3603 __Pyx_GIVEREF(__pyx_v_value);
3604 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_value);
3605 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3606 __Pyx_GOTREF(__pyx_t_1);
3607 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3608 }
3609 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3610 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3611 __pyx_t_1 = 0;
3612
3613 /* "tinycss/speedups.pyx":150
3614 * value = simple_unescape(css_value)
3615 * value = unicode_unescape(value)
3616 * elif type_ == URI: # <<<<<<<<<<<<<<
3617 * value = match.group(1)
3618 * if value and value[0] in '"\'':
3619 */
3620 goto __pyx_L17;
3621 }
3622
3623 /* "tinycss/speedups.pyx":157
3624 * value = simple_unescape(value)
3625 * value = unicode_unescape(value)
3626 * elif type_ == STRING: # <<<<<<<<<<<<<<
3627 * value = css_value[1:-1] # Remove quotes
3628 * value = newline_unescape(value)
3629 */
3630 __pyx_t_16 = ((__pyx_v_type_ == __pyx_v_STRING) != 0);
3631 if (__pyx_t_16) {
3632
3633 /* "tinycss/speedups.pyx":158
3634 * value = unicode_unescape(value)
3635 * elif type_ == STRING:
3636 * value = css_value[1:-1] # Remove quotes # <<<<<<<<<<<<<<
3637 * value = newline_unescape(value)
3638 * value = simple_unescape(value)
3639 */
3640 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_css_value, 1, -1L, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
3641 __Pyx_GOTREF(__pyx_t_1);
3642 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
3643 __pyx_t_1 = 0;
3644
3645 /* "tinycss/speedups.pyx":159
3646 * elif type_ == STRING:
3647 * value = css_value[1:-1] # Remove quotes
3648 * value = newline_unescape(value) # <<<<<<<<<<<<<<
3649 * value = simple_unescape(value)
3650 * value = unicode_unescape(value)
3651 */
3652 __Pyx_INCREF(__pyx_v_newline_unescape);
3653 __pyx_t_8 = __pyx_v_newline_unescape; __pyx_t_13 = NULL;
3654 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3655 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
3656 if (likely(__pyx_t_13)) {
3657 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3658 __Pyx_INCREF(__pyx_t_13);
3659 __Pyx_INCREF(function);
3660 __Pyx_DECREF_SET(__pyx_t_8, function);
3661 }
3662 }
3663 if (!__pyx_t_13) {
3664 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
3665 __Pyx_GOTREF(__pyx_t_1);
3666 } else {
3667 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 159, __pyx_L1_error)
3668 __Pyx_GOTREF(__pyx_t_11);
3669 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3670 __Pyx_INCREF(__pyx_v_value);
3671 __Pyx_GIVEREF(__pyx_v_value);
3672 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_value);
3673 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
3674 __Pyx_GOTREF(__pyx_t_1);
3675 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3676 }
3677 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3678 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3679 __pyx_t_1 = 0;
3680
3681 /* "tinycss/speedups.pyx":160
3682 * value = css_value[1:-1] # Remove quotes
3683 * value = newline_unescape(value)
3684 * value = simple_unescape(value) # <<<<<<<<<<<<<<
3685 * value = unicode_unescape(value)
3686 * # BAD_STRING can only be one of:
3687 */
3688 __Pyx_INCREF(__pyx_v_simple_unescape);
3689 __pyx_t_8 = __pyx_v_simple_unescape; __pyx_t_11 = NULL;
3690 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3691 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
3692 if (likely(__pyx_t_11)) {
3693 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3694 __Pyx_INCREF(__pyx_t_11);
3695 __Pyx_INCREF(function);
3696 __Pyx_DECREF_SET(__pyx_t_8, function);
3697 }
3698 }
3699 if (!__pyx_t_11) {
3700 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3701 __Pyx_GOTREF(__pyx_t_1);
3702 } else {
3703 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 160, __pyx_L1_error)
3704 __Pyx_GOTREF(__pyx_t_13);
3705 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3706 __Pyx_INCREF(__pyx_v_value);
3707 __Pyx_GIVEREF(__pyx_v_value);
3708 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_value);
3709 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3710 __Pyx_GOTREF(__pyx_t_1);
3711 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3712 }
3713 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3714 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3715 __pyx_t_1 = 0;
3716
3717 /* "tinycss/speedups.pyx":161
3718 * value = newline_unescape(value)
3719 * value = simple_unescape(value)
3720 * value = unicode_unescape(value) # <<<<<<<<<<<<<<
3721 * # BAD_STRING can only be one of:
3722 * # * Unclosed string at the end of the stylesheet:
3723 */
3724 __Pyx_INCREF(__pyx_v_unicode_unescape);
3725 __pyx_t_8 = __pyx_v_unicode_unescape; __pyx_t_13 = NULL;
3726 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3727 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
3728 if (likely(__pyx_t_13)) {
3729 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3730 __Pyx_INCREF(__pyx_t_13);
3731 __Pyx_INCREF(function);
3732 __Pyx_DECREF_SET(__pyx_t_8, function);
3733 }
3734 }
3735 if (!__pyx_t_13) {
3736 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3737 __Pyx_GOTREF(__pyx_t_1);
3738 } else {
3739 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 161, __pyx_L1_error)
3740 __Pyx_GOTREF(__pyx_t_11);
3741 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3742 __Pyx_INCREF(__pyx_v_value);
3743 __Pyx_GIVEREF(__pyx_v_value);
3744 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_value);
3745 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3746 __Pyx_GOTREF(__pyx_t_1);
3747 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3748 }
3749 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3750 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3751 __pyx_t_1 = 0;
3752
3753 /* "tinycss/speedups.pyx":157
3754 * value = simple_unescape(value)
3755 * value = unicode_unescape(value)
3756 * elif type_ == STRING: # <<<<<<<<<<<<<<
3757 * value = css_value[1:-1] # Remove quotes
3758 * value = newline_unescape(value)
3759 */
3760 goto __pyx_L17;
3761 }
3762
3763 /* "tinycss/speedups.pyx":170
3764 * # Leave it as a BAD_STRING, dont bother parsing it.
3765 * # See http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
3766 * elif type_ == BAD_STRING and next_pos == source_len: # <<<<<<<<<<<<<<
3767 * type_name = 'STRING'
3768 * value = css_value[1:] # Remove quote
3769 */
3770 __pyx_t_3 = ((__pyx_v_type_ == __pyx_v_BAD_STRING) != 0);
3771 if (__pyx_t_3) {
3772 } else {
3773 __pyx_t_16 = __pyx_t_3;
3774 goto __pyx_L26_bool_binop_done;
3775 }
3776 __pyx_t_3 = ((__pyx_v_next_pos == __pyx_v_source_len) != 0);
3777 __pyx_t_16 = __pyx_t_3;
3778 __pyx_L26_bool_binop_done:;
3779 if (__pyx_t_16) {
3780
3781 /* "tinycss/speedups.pyx":171
3782 * # See http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
3783 * elif type_ == BAD_STRING and next_pos == source_len:
3784 * type_name = 'STRING' # <<<<<<<<<<<<<<
3785 * value = css_value[1:] # Remove quote
3786 * value = newline_unescape(value)
3787 */
3788 __Pyx_INCREF(__pyx_n_u_STRING);
3789 __Pyx_DECREF_SET(__pyx_v_type_name, __pyx_n_u_STRING);
3790
3791 /* "tinycss/speedups.pyx":172
3792 * elif type_ == BAD_STRING and next_pos == source_len:
3793 * type_name = 'STRING'
3794 * value = css_value[1:] # Remove quote # <<<<<<<<<<<<<<
3795 * value = newline_unescape(value)
3796 * value = simple_unescape(value)
3797 */
3798 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_css_value, 1, 0, NULL, NULL, &__pyx_slice__12, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
3799 __Pyx_GOTREF(__pyx_t_1);
3800 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
3801 __pyx_t_1 = 0;
3802
3803 /* "tinycss/speedups.pyx":173
3804 * type_name = 'STRING'
3805 * value = css_value[1:] # Remove quote
3806 * value = newline_unescape(value) # <<<<<<<<<<<<<<
3807 * value = simple_unescape(value)
3808 * value = unicode_unescape(value)
3809 */
3810 __Pyx_INCREF(__pyx_v_newline_unescape);
3811 __pyx_t_8 = __pyx_v_newline_unescape; __pyx_t_11 = NULL;
3812 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3813 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
3814 if (likely(__pyx_t_11)) {
3815 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3816 __Pyx_INCREF(__pyx_t_11);
3817 __Pyx_INCREF(function);
3818 __Pyx_DECREF_SET(__pyx_t_8, function);
3819 }
3820 }
3821 if (!__pyx_t_11) {
3822 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
3823 __Pyx_GOTREF(__pyx_t_1);
3824 } else {
3825 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 173, __pyx_L1_error)
3826 __Pyx_GOTREF(__pyx_t_13);
3827 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3828 __Pyx_INCREF(__pyx_v_value);
3829 __Pyx_GIVEREF(__pyx_v_value);
3830 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_value);
3831 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
3832 __Pyx_GOTREF(__pyx_t_1);
3833 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3834 }
3835 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3836 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3837 __pyx_t_1 = 0;
3838
3839 /* "tinycss/speedups.pyx":174
3840 * value = css_value[1:] # Remove quote
3841 * value = newline_unescape(value)
3842 * value = simple_unescape(value) # <<<<<<<<<<<<<<
3843 * value = unicode_unescape(value)
3844 * else:
3845 */
3846 __Pyx_INCREF(__pyx_v_simple_unescape);
3847 __pyx_t_8 = __pyx_v_simple_unescape; __pyx_t_13 = NULL;
3848 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3849 __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
3850 if (likely(__pyx_t_13)) {
3851 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3852 __Pyx_INCREF(__pyx_t_13);
3853 __Pyx_INCREF(function);
3854 __Pyx_DECREF_SET(__pyx_t_8, function);
3855 }
3856 }
3857 if (!__pyx_t_13) {
3858 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
3859 __Pyx_GOTREF(__pyx_t_1);
3860 } else {
3861 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 174, __pyx_L1_error)
3862 __Pyx_GOTREF(__pyx_t_11);
3863 __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
3864 __Pyx_INCREF(__pyx_v_value);
3865 __Pyx_GIVEREF(__pyx_v_value);
3866 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_value);
3867 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
3868 __Pyx_GOTREF(__pyx_t_1);
3869 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3870 }
3871 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3872 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3873 __pyx_t_1 = 0;
3874
3875 /* "tinycss/speedups.pyx":175
3876 * value = newline_unescape(value)
3877 * value = simple_unescape(value)
3878 * value = unicode_unescape(value) # <<<<<<<<<<<<<<
3879 * else:
3880 * value = css_value
3881 */
3882 __Pyx_INCREF(__pyx_v_unicode_unescape);
3883 __pyx_t_8 = __pyx_v_unicode_unescape; __pyx_t_11 = NULL;
3884 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
3885 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
3886 if (likely(__pyx_t_11)) {
3887 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3888 __Pyx_INCREF(__pyx_t_11);
3889 __Pyx_INCREF(function);
3890 __Pyx_DECREF_SET(__pyx_t_8, function);
3891 }
3892 }
3893 if (!__pyx_t_11) {
3894 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
3895 __Pyx_GOTREF(__pyx_t_1);
3896 } else {
3897 __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 175, __pyx_L1_error)
3898 __Pyx_GOTREF(__pyx_t_13);
3899 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
3900 __Pyx_INCREF(__pyx_v_value);
3901 __Pyx_GIVEREF(__pyx_v_value);
3902 PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_value);
3903 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
3904 __Pyx_GOTREF(__pyx_t_1);
3905 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3906 }
3907 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3908 __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
3909 __pyx_t_1 = 0;
3910
3911 /* "tinycss/speedups.pyx":170
3912 * # Leave it as a BAD_STRING, dont bother parsing it.
3913 * # See http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
3914 * elif type_ == BAD_STRING and next_pos == source_len: # <<<<<<<<<<<<<<
3915 * type_name = 'STRING'
3916 * value = css_value[1:] # Remove quote
3917 */
3918 goto __pyx_L17;
3919 }
3920
3921 /* "tinycss/speedups.pyx":177
3922 * value = unicode_unescape(value)
3923 * else:
3924 * value = css_value # <<<<<<<<<<<<<<
3925 * token = CToken(type_name, css_value, value, unit, line, column)
3926 * tokens.append(token)
3927 */
3928 /*else*/ {
3929 __Pyx_INCREF(__pyx_v_css_value);
3930 __Pyx_XDECREF_SET(__pyx_v_value, __pyx_v_css_value);
3931 }
3932 __pyx_L17:;
3933
3934 /* "tinycss/speedups.pyx":178
3935 * else:
3936 * value = css_value
3937 * token = CToken(type_name, css_value, value, unit, line, column) # <<<<<<<<<<<<<<
3938 * tokens.append(token)
3939 *
3940 */
3941 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
3942 __Pyx_GOTREF(__pyx_t_1);
3943 __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_column); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
3944 __Pyx_GOTREF(__pyx_t_8);
3945 __pyx_t_13 = PyTuple_New(6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 178, __pyx_L1_error)
3946 __Pyx_GOTREF(__pyx_t_13);
3947 __Pyx_INCREF(__pyx_v_type_name);
3948 __Pyx_GIVEREF(__pyx_v_type_name);
3949 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_type_name);
3950 __Pyx_INCREF(__pyx_v_css_value);
3951 __Pyx_GIVEREF(__pyx_v_css_value);
3952 PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_css_value);
3953 __Pyx_INCREF(__pyx_v_value);
3954 __Pyx_GIVEREF(__pyx_v_value);
3955 PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_value);
3956 __Pyx_INCREF(__pyx_v_unit);
3957 __Pyx_GIVEREF(__pyx_v_unit);
3958 PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_v_unit);
3959 __Pyx_GIVEREF(__pyx_t_1);
3960 PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_1);
3961 __Pyx_GIVEREF(__pyx_t_8);
3962 PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_8);
3963 __pyx_t_1 = 0;
3964 __pyx_t_8 = 0;
3965 __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7tinycss_8speedups_CToken), __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
3966 __Pyx_GOTREF(__pyx_t_8);
3967 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3968 __Pyx_XDECREF_SET(__pyx_v_token, ((struct __pyx_obj_7tinycss_8speedups_CToken *)__pyx_t_8));
3969 __pyx_t_8 = 0;
3970
3971 /* "tinycss/speedups.pyx":179
3972 * value = css_value
3973 * token = CToken(type_name, css_value, value, unit, line, column)
3974 * tokens.append(token) # <<<<<<<<<<<<<<
3975 *
3976 * pos = next_pos
3977 */
3978 __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_tokens, ((PyObject *)__pyx_v_token)); if (unlikely(__pyx_t_17 == -1)) __PYX_ERR(0, 179, __pyx_L1_error)
3979
3980 /* "tinycss/speedups.pyx":126
3981 *
3982 * # A BAD_COMMENT is a comment at EOF. Ignore it too.
3983 * if not (ignore_comments and type_ in (COMMENT, BAD_COMMENT)): # <<<<<<<<<<<<<<
3984 * # Parse numbers, extract strings and URIs, unescape
3985 * unit = None
3986 */
3987 }
3988
3989 /* "tinycss/speedups.pyx":181
3990 * tokens.append(token)
3991 *
3992 * pos = next_pos # <<<<<<<<<<<<<<
3993 * newlines = list(find_newlines(css_value))
3994 * if newlines:
3995 */
3996 __pyx_v_pos = __pyx_v_next_pos;
3997
3998 /* "tinycss/speedups.pyx":182
3999 *
4000 * pos = next_pos
4001 * newlines = list(find_newlines(css_value)) # <<<<<<<<<<<<<<
4002 * if newlines:
4003 * line += len(newlines)
4004 */
4005 __Pyx_INCREF(__pyx_v_find_newlines);
4006 __pyx_t_13 = __pyx_v_find_newlines; __pyx_t_1 = NULL;
4007 if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
4008 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
4009 if (likely(__pyx_t_1)) {
4010 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
4011 __Pyx_INCREF(__pyx_t_1);
4012 __Pyx_INCREF(function);
4013 __Pyx_DECREF_SET(__pyx_t_13, function);
4014 }
4015 }
4016 if (!__pyx_t_1) {
4017 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_css_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
4018 __Pyx_GOTREF(__pyx_t_8);
4019 } else {
4020 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 182, __pyx_L1_error)
4021 __Pyx_GOTREF(__pyx_t_11);
4022 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
4023 __Pyx_INCREF(__pyx_v_css_value);
4024 __Pyx_GIVEREF(__pyx_v_css_value);
4025 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_css_value);
4026 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
4027 __Pyx_GOTREF(__pyx_t_8);
4028 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4029 }
4030 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4031 __pyx_t_13 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 182, __pyx_L1_error)
4032 __Pyx_GOTREF(__pyx_t_13);
4033 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4034 __Pyx_XDECREF_SET(__pyx_v_newlines, ((PyObject*)__pyx_t_13));
4035 __pyx_t_13 = 0;
4036
4037 /* "tinycss/speedups.pyx":183
4038 * pos = next_pos
4039 * newlines = list(find_newlines(css_value))
4040 * if newlines: # <<<<<<<<<<<<<<
4041 * line += len(newlines)
4042 * # Add 1 to have lines start at column 1, not 0
4043 */
4044 __pyx_t_16 = (__pyx_v_newlines != Py_None) && (PyList_GET_SIZE(__pyx_v_newlines) != 0);
4045 if (__pyx_t_16) {
4046
4047 /* "tinycss/speedups.pyx":184
4048 * newlines = list(find_newlines(css_value))
4049 * if newlines:
4050 * line += len(newlines) # <<<<<<<<<<<<<<
4051 * # Add 1 to have lines start at column 1, not 0
4052 * column = length - newlines[-1].end() + 1
4053 */
4054 __pyx_t_2 = PyList_GET_SIZE(__pyx_v_newlines); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 184, __pyx_L1_error)
4055 __pyx_v_line = (__pyx_v_line + __pyx_t_2);
4056
4057 /* "tinycss/speedups.pyx":186
4058 * line += len(newlines)
4059 * # Add 1 to have lines start at column 1, not 0
4060 * column = length - newlines[-1].end() + 1 # <<<<<<<<<<<<<<
4061 * else:
4062 * column += length
4063 */
4064 __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 186, __pyx_L1_error)
4065 __Pyx_GOTREF(__pyx_t_13);
4066 __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_newlines, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 186, __pyx_L1_error)
4067 __Pyx_GOTREF(__pyx_t_11);
4068 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
4069 __Pyx_GOTREF(__pyx_t_1);
4070 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4071 __pyx_t_11 = NULL;
4072 if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
4073 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
4074 if (likely(__pyx_t_11)) {
4075 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4076 __Pyx_INCREF(__pyx_t_11);
4077 __Pyx_INCREF(function);
4078 __Pyx_DECREF_SET(__pyx_t_1, function);
4079 }
4080 }
4081 if (__pyx_t_11) {
4082 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
4083 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4084 } else {
4085 __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
4086 }
4087 __Pyx_GOTREF(__pyx_t_8);
4088 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4089 __pyx_t_1 = PyNumber_Subtract(__pyx_t_13, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
4090 __Pyx_GOTREF(__pyx_t_1);
4091 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4092 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4093 __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
4094 __Pyx_GOTREF(__pyx_t_8);
4095 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4096 __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
4097 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4098 __pyx_v_column = __pyx_t_2;
4099
4100 /* "tinycss/speedups.pyx":183
4101 * pos = next_pos
4102 * newlines = list(find_newlines(css_value))
4103 * if newlines: # <<<<<<<<<<<<<<
4104 * line += len(newlines)
4105 * # Add 1 to have lines start at column 1, not 0
4106 */
4107 goto __pyx_L28;
4108 }
4109
4110 /* "tinycss/speedups.pyx":188
4111 * column = length - newlines[-1].end() + 1
4112 * else:
4113 * column += length # <<<<<<<<<<<<<<
4114 * return tokens
4115 */
4116 /*else*/ {
4117 __pyx_v_column = (__pyx_v_column + __pyx_v_length);
4118 }
4119 __pyx_L28:;
4120 }
4121
4122 /* "tinycss/speedups.pyx":189
4123 * else:
4124 * column += length
4125 * return tokens # <<<<<<<<<<<<<<
4126 */
4127 __Pyx_XDECREF(__pyx_r);
4128 __Pyx_INCREF(__pyx_v_tokens);
4129 __pyx_r = __pyx_v_tokens;
4130 goto __pyx_L0;
4131
4132 /* "tinycss/speedups.pyx":55
4133 *
4134 *
4135 * def tokenize_flat(css_source, int ignore_comments=1): # <<<<<<<<<<<<<<
4136 * """
4137 * :param css_source:
4138 */
4139
4140 /* function exit code */
4141 __pyx_L1_error:;
4142 __Pyx_XDECREF(__pyx_t_1);
4143 __Pyx_XDECREF(__pyx_t_8);
4144 __Pyx_XDECREF(__pyx_t_10);
4145 __Pyx_XDECREF(__pyx_t_11);
4146 __Pyx_XDECREF(__pyx_t_12);
4147 __Pyx_XDECREF(__pyx_t_13);
4148 __Pyx_AddTraceback("tinycss.speedups.tokenize_flat", __pyx_clineno, __pyx_lineno, __pyx_filename);
4149 __pyx_r = NULL;
4150 __pyx_L0:;
4151 __Pyx_XDECREF(__pyx_v_tokens_dispatch);
4152 __Pyx_XDECREF(__pyx_v_compiled_token_indexes);
4153 __Pyx_XDECREF(__pyx_v_compiled_tokens);
4154 __Pyx_XDECREF(__pyx_v_unicode_unescape);
4155 __Pyx_XDECREF(__pyx_v_newline_unescape);
4156 __Pyx_XDECREF(__pyx_v_simple_unescape);
4157 __Pyx_XDECREF(__pyx_v_find_newlines);
4158 __Pyx_XDECREF((PyObject *)__pyx_v_token);
4159 __Pyx_XDECREF(__pyx_v_tokens);
4160 __Pyx_XDECREF(__pyx_v_char);
4161 __Pyx_XDECREF(__pyx_v_type_name);
4162 __Pyx_XDECREF(__pyx_v_css_value);
4163 __Pyx_XDECREF(__pyx_v_regexp);
4164 __Pyx_XDECREF(__pyx_v_match);
4165 __Pyx_XDECREF(__pyx_v_unit);
4166 __Pyx_XDECREF(__pyx_v_value);
4167 __Pyx_XDECREF(__pyx_v_newlines);
4168 __Pyx_XGIVEREF(__pyx_r);
4169 __Pyx_RefNannyFinishContext();
4170 return __pyx_r;
4171 }
4172
__pyx_tp_new_7tinycss_8speedups_CToken(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)4173 static PyObject *__pyx_tp_new_7tinycss_8speedups_CToken(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4174 struct __pyx_obj_7tinycss_8speedups_CToken *p;
4175 PyObject *o;
4176 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4177 o = (*t->tp_alloc)(t, 0);
4178 } else {
4179 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4180 }
4181 if (unlikely(!o)) return 0;
4182 p = ((struct __pyx_obj_7tinycss_8speedups_CToken *)o);
4183 p->type = Py_None; Py_INCREF(Py_None);
4184 p->_as_css = Py_None; Py_INCREF(Py_None);
4185 p->value = Py_None; Py_INCREF(Py_None);
4186 p->unit = Py_None; Py_INCREF(Py_None);
4187 return o;
4188 }
4189
__pyx_tp_dealloc_7tinycss_8speedups_CToken(PyObject * o)4190 static void __pyx_tp_dealloc_7tinycss_8speedups_CToken(PyObject *o) {
4191 struct __pyx_obj_7tinycss_8speedups_CToken *p = (struct __pyx_obj_7tinycss_8speedups_CToken *)o;
4192 #if PY_VERSION_HEX >= 0x030400a1
4193 if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
4194 if (PyObject_CallFinalizerFromDealloc(o)) return;
4195 }
4196 #endif
4197 PyObject_GC_UnTrack(o);
4198 Py_CLEAR(p->type);
4199 Py_CLEAR(p->_as_css);
4200 Py_CLEAR(p->value);
4201 Py_CLEAR(p->unit);
4202 (*Py_TYPE(o)->tp_free)(o);
4203 }
4204
__pyx_tp_traverse_7tinycss_8speedups_CToken(PyObject * o,visitproc v,void * a)4205 static int __pyx_tp_traverse_7tinycss_8speedups_CToken(PyObject *o, visitproc v, void *a) {
4206 int e;
4207 struct __pyx_obj_7tinycss_8speedups_CToken *p = (struct __pyx_obj_7tinycss_8speedups_CToken *)o;
4208 if (p->type) {
4209 e = (*v)(p->type, a); if (e) return e;
4210 }
4211 if (p->_as_css) {
4212 e = (*v)(p->_as_css, a); if (e) return e;
4213 }
4214 if (p->value) {
4215 e = (*v)(p->value, a); if (e) return e;
4216 }
4217 if (p->unit) {
4218 e = (*v)(p->unit, a); if (e) return e;
4219 }
4220 return 0;
4221 }
4222
__pyx_tp_clear_7tinycss_8speedups_CToken(PyObject * o)4223 static int __pyx_tp_clear_7tinycss_8speedups_CToken(PyObject *o) {
4224 PyObject* tmp;
4225 struct __pyx_obj_7tinycss_8speedups_CToken *p = (struct __pyx_obj_7tinycss_8speedups_CToken *)o;
4226 tmp = ((PyObject*)p->type);
4227 p->type = Py_None; Py_INCREF(Py_None);
4228 Py_XDECREF(tmp);
4229 tmp = ((PyObject*)p->_as_css);
4230 p->_as_css = Py_None; Py_INCREF(Py_None);
4231 Py_XDECREF(tmp);
4232 tmp = ((PyObject*)p->value);
4233 p->value = Py_None; Py_INCREF(Py_None);
4234 Py_XDECREF(tmp);
4235 tmp = ((PyObject*)p->unit);
4236 p->unit = Py_None; Py_INCREF(Py_None);
4237 Py_XDECREF(tmp);
4238 return 0;
4239 }
4240
__pyx_getprop_7tinycss_8speedups_6CToken_type(PyObject * o,CYTHON_UNUSED void * x)4241 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken_type(PyObject *o, CYTHON_UNUSED void *x) {
4242 return __pyx_pw_7tinycss_8speedups_6CToken_4type_1__get__(o);
4243 }
4244
__pyx_setprop_7tinycss_8speedups_6CToken_type(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4245 static int __pyx_setprop_7tinycss_8speedups_6CToken_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4246 if (v) {
4247 return __pyx_pw_7tinycss_8speedups_6CToken_4type_3__set__(o, v);
4248 }
4249 else {
4250 return __pyx_pw_7tinycss_8speedups_6CToken_4type_5__del__(o);
4251 }
4252 }
4253
__pyx_getprop_7tinycss_8speedups_6CToken__as_css(PyObject * o,CYTHON_UNUSED void * x)4254 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken__as_css(PyObject *o, CYTHON_UNUSED void *x) {
4255 return __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_1__get__(o);
4256 }
4257
__pyx_setprop_7tinycss_8speedups_6CToken__as_css(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4258 static int __pyx_setprop_7tinycss_8speedups_6CToken__as_css(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4259 if (v) {
4260 return __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_3__set__(o, v);
4261 }
4262 else {
4263 return __pyx_pw_7tinycss_8speedups_6CToken_7_as_css_5__del__(o);
4264 }
4265 }
4266
__pyx_getprop_7tinycss_8speedups_6CToken_value(PyObject * o,CYTHON_UNUSED void * x)4267 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken_value(PyObject *o, CYTHON_UNUSED void *x) {
4268 return __pyx_pw_7tinycss_8speedups_6CToken_5value_1__get__(o);
4269 }
4270
__pyx_setprop_7tinycss_8speedups_6CToken_value(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4271 static int __pyx_setprop_7tinycss_8speedups_6CToken_value(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4272 if (v) {
4273 return __pyx_pw_7tinycss_8speedups_6CToken_5value_3__set__(o, v);
4274 }
4275 else {
4276 return __pyx_pw_7tinycss_8speedups_6CToken_5value_5__del__(o);
4277 }
4278 }
4279
__pyx_getprop_7tinycss_8speedups_6CToken_unit(PyObject * o,CYTHON_UNUSED void * x)4280 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken_unit(PyObject *o, CYTHON_UNUSED void *x) {
4281 return __pyx_pw_7tinycss_8speedups_6CToken_4unit_1__get__(o);
4282 }
4283
__pyx_setprop_7tinycss_8speedups_6CToken_unit(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4284 static int __pyx_setprop_7tinycss_8speedups_6CToken_unit(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4285 if (v) {
4286 return __pyx_pw_7tinycss_8speedups_6CToken_4unit_3__set__(o, v);
4287 }
4288 else {
4289 return __pyx_pw_7tinycss_8speedups_6CToken_4unit_5__del__(o);
4290 }
4291 }
4292
__pyx_getprop_7tinycss_8speedups_6CToken_line(PyObject * o,CYTHON_UNUSED void * x)4293 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken_line(PyObject *o, CYTHON_UNUSED void *x) {
4294 return __pyx_pw_7tinycss_8speedups_6CToken_4line_1__get__(o);
4295 }
4296
__pyx_setprop_7tinycss_8speedups_6CToken_line(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4297 static int __pyx_setprop_7tinycss_8speedups_6CToken_line(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4298 if (v) {
4299 return __pyx_pw_7tinycss_8speedups_6CToken_4line_3__set__(o, v);
4300 }
4301 else {
4302 PyErr_SetString(PyExc_NotImplementedError, "__del__");
4303 return -1;
4304 }
4305 }
4306
__pyx_getprop_7tinycss_8speedups_6CToken_column(PyObject * o,CYTHON_UNUSED void * x)4307 static PyObject *__pyx_getprop_7tinycss_8speedups_6CToken_column(PyObject *o, CYTHON_UNUSED void *x) {
4308 return __pyx_pw_7tinycss_8speedups_6CToken_6column_1__get__(o);
4309 }
4310
__pyx_setprop_7tinycss_8speedups_6CToken_column(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)4311 static int __pyx_setprop_7tinycss_8speedups_6CToken_column(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
4312 if (v) {
4313 return __pyx_pw_7tinycss_8speedups_6CToken_6column_3__set__(o, v);
4314 }
4315 else {
4316 PyErr_SetString(PyExc_NotImplementedError, "__del__");
4317 return -1;
4318 }
4319 }
4320
4321 static PyMethodDef __pyx_methods_7tinycss_8speedups_CToken[] = {
4322 {"as_css", (PyCFunction)__pyx_pw_7tinycss_8speedups_6CToken_3as_css, METH_NOARGS, __pyx_doc_7tinycss_8speedups_6CToken_2as_css},
4323 {0, 0, 0, 0}
4324 };
4325
4326 static struct PyGetSetDef __pyx_getsets_7tinycss_8speedups_CToken[] = {
4327 {(char *)"type", __pyx_getprop_7tinycss_8speedups_6CToken_type, __pyx_setprop_7tinycss_8speedups_6CToken_type, (char *)0, 0},
4328 {(char *)"_as_css", __pyx_getprop_7tinycss_8speedups_6CToken__as_css, __pyx_setprop_7tinycss_8speedups_6CToken__as_css, (char *)0, 0},
4329 {(char *)"value", __pyx_getprop_7tinycss_8speedups_6CToken_value, __pyx_setprop_7tinycss_8speedups_6CToken_value, (char *)0, 0},
4330 {(char *)"unit", __pyx_getprop_7tinycss_8speedups_6CToken_unit, __pyx_setprop_7tinycss_8speedups_6CToken_unit, (char *)0, 0},
4331 {(char *)"line", __pyx_getprop_7tinycss_8speedups_6CToken_line, __pyx_setprop_7tinycss_8speedups_6CToken_line, (char *)0, 0},
4332 {(char *)"column", __pyx_getprop_7tinycss_8speedups_6CToken_column, __pyx_setprop_7tinycss_8speedups_6CToken_column, (char *)0, 0},
4333 {0, 0, 0, 0, 0}
4334 };
4335
4336 static PyTypeObject __pyx_type_7tinycss_8speedups_CToken = {
4337 PyVarObject_HEAD_INIT(0, 0)
4338 "tinycss.speedups.CToken", /*tp_name*/
4339 sizeof(struct __pyx_obj_7tinycss_8speedups_CToken), /*tp_basicsize*/
4340 0, /*tp_itemsize*/
4341 __pyx_tp_dealloc_7tinycss_8speedups_CToken, /*tp_dealloc*/
4342 0, /*tp_print*/
4343 0, /*tp_getattr*/
4344 0, /*tp_setattr*/
4345 #if PY_MAJOR_VERSION < 3
4346 0, /*tp_compare*/
4347 #endif
4348 #if PY_MAJOR_VERSION >= 3
4349 0, /*tp_as_async*/
4350 #endif
4351 __pyx_pw_7tinycss_8speedups_6CToken_5__repr__, /*tp_repr*/
4352 0, /*tp_as_number*/
4353 0, /*tp_as_sequence*/
4354 0, /*tp_as_mapping*/
4355 0, /*tp_hash*/
4356 0, /*tp_call*/
4357 0, /*tp_str*/
4358 0, /*tp_getattro*/
4359 0, /*tp_setattro*/
4360 0, /*tp_as_buffer*/
4361 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
4362 "A token built by the Cython speedups. Identical to\n :class:`~.token_data.Token`.\n\n ", /*tp_doc*/
4363 __pyx_tp_traverse_7tinycss_8speedups_CToken, /*tp_traverse*/
4364 __pyx_tp_clear_7tinycss_8speedups_CToken, /*tp_clear*/
4365 0, /*tp_richcompare*/
4366 0, /*tp_weaklistoffset*/
4367 0, /*tp_iter*/
4368 0, /*tp_iternext*/
4369 __pyx_methods_7tinycss_8speedups_CToken, /*tp_methods*/
4370 0, /*tp_members*/
4371 __pyx_getsets_7tinycss_8speedups_CToken, /*tp_getset*/
4372 0, /*tp_base*/
4373 0, /*tp_dict*/
4374 0, /*tp_descr_get*/
4375 0, /*tp_descr_set*/
4376 0, /*tp_dictoffset*/
4377 __pyx_pw_7tinycss_8speedups_6CToken_1__init__, /*tp_init*/
4378 0, /*tp_alloc*/
4379 __pyx_tp_new_7tinycss_8speedups_CToken, /*tp_new*/
4380 0, /*tp_free*/
4381 0, /*tp_is_gc*/
4382 0, /*tp_bases*/
4383 0, /*tp_mro*/
4384 0, /*tp_cache*/
4385 0, /*tp_subclasses*/
4386 0, /*tp_weaklist*/
4387 0, /*tp_del*/
4388 0, /*tp_version_tag*/
4389 #if PY_VERSION_HEX >= 0x030400a1
4390 0, /*tp_finalize*/
4391 #endif
4392 };
4393
4394 static struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *__pyx_freelist_7tinycss_8speedups___pyx_scope_struct__genexpr[8];
4395 static int __pyx_freecount_7tinycss_8speedups___pyx_scope_struct__genexpr = 0;
4396
__pyx_tp_new_7tinycss_8speedups___pyx_scope_struct__genexpr(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)4397 static PyObject *__pyx_tp_new_7tinycss_8speedups___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4398 PyObject *o;
4399 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7tinycss_8speedups___pyx_scope_struct__genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr)))) {
4400 o = (PyObject*)__pyx_freelist_7tinycss_8speedups___pyx_scope_struct__genexpr[--__pyx_freecount_7tinycss_8speedups___pyx_scope_struct__genexpr];
4401 memset(o, 0, sizeof(struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr));
4402 (void) PyObject_INIT(o, t);
4403 PyObject_GC_Track(o);
4404 } else {
4405 o = (*t->tp_alloc)(t, 0);
4406 if (unlikely(!o)) return 0;
4407 }
4408 return o;
4409 }
4410
__pyx_tp_dealloc_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject * o)4411 static void __pyx_tp_dealloc_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject *o) {
4412 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *p = (struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)o;
4413 PyObject_GC_UnTrack(o);
4414 Py_CLEAR(p->__pyx_v_i);
4415 Py_CLEAR(p->__pyx_v_name);
4416 Py_CLEAR(p->__pyx_v_regexp);
4417 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7tinycss_8speedups___pyx_scope_struct__genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr)))) {
4418 __pyx_freelist_7tinycss_8speedups___pyx_scope_struct__genexpr[__pyx_freecount_7tinycss_8speedups___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)o);
4419 } else {
4420 (*Py_TYPE(o)->tp_free)(o);
4421 }
4422 }
4423
__pyx_tp_traverse_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject * o,visitproc v,void * a)4424 static int __pyx_tp_traverse_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
4425 int e;
4426 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *p = (struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)o;
4427 if (p->__pyx_v_i) {
4428 e = (*v)(p->__pyx_v_i, a); if (e) return e;
4429 }
4430 if (p->__pyx_v_name) {
4431 e = (*v)(p->__pyx_v_name, a); if (e) return e;
4432 }
4433 if (p->__pyx_v_regexp) {
4434 e = (*v)(p->__pyx_v_regexp, a); if (e) return e;
4435 }
4436 return 0;
4437 }
4438
__pyx_tp_clear_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject * o)4439 static int __pyx_tp_clear_7tinycss_8speedups___pyx_scope_struct__genexpr(PyObject *o) {
4440 PyObject* tmp;
4441 struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *p = (struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr *)o;
4442 tmp = ((PyObject*)p->__pyx_v_i);
4443 p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
4444 Py_XDECREF(tmp);
4445 tmp = ((PyObject*)p->__pyx_v_name);
4446 p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
4447 Py_XDECREF(tmp);
4448 tmp = ((PyObject*)p->__pyx_v_regexp);
4449 p->__pyx_v_regexp = Py_None; Py_INCREF(Py_None);
4450 Py_XDECREF(tmp);
4451 return 0;
4452 }
4453
4454 static PyTypeObject __pyx_type_7tinycss_8speedups___pyx_scope_struct__genexpr = {
4455 PyVarObject_HEAD_INIT(0, 0)
4456 "tinycss.speedups.__pyx_scope_struct__genexpr", /*tp_name*/
4457 sizeof(struct __pyx_obj_7tinycss_8speedups___pyx_scope_struct__genexpr), /*tp_basicsize*/
4458 0, /*tp_itemsize*/
4459 __pyx_tp_dealloc_7tinycss_8speedups___pyx_scope_struct__genexpr, /*tp_dealloc*/
4460 0, /*tp_print*/
4461 0, /*tp_getattr*/
4462 0, /*tp_setattr*/
4463 #if PY_MAJOR_VERSION < 3
4464 0, /*tp_compare*/
4465 #endif
4466 #if PY_MAJOR_VERSION >= 3
4467 0, /*tp_as_async*/
4468 #endif
4469 0, /*tp_repr*/
4470 0, /*tp_as_number*/
4471 0, /*tp_as_sequence*/
4472 0, /*tp_as_mapping*/
4473 0, /*tp_hash*/
4474 0, /*tp_call*/
4475 0, /*tp_str*/
4476 0, /*tp_getattro*/
4477 0, /*tp_setattro*/
4478 0, /*tp_as_buffer*/
4479 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
4480 0, /*tp_doc*/
4481 __pyx_tp_traverse_7tinycss_8speedups___pyx_scope_struct__genexpr, /*tp_traverse*/
4482 __pyx_tp_clear_7tinycss_8speedups___pyx_scope_struct__genexpr, /*tp_clear*/
4483 0, /*tp_richcompare*/
4484 0, /*tp_weaklistoffset*/
4485 0, /*tp_iter*/
4486 0, /*tp_iternext*/
4487 0, /*tp_methods*/
4488 0, /*tp_members*/
4489 0, /*tp_getset*/
4490 0, /*tp_base*/
4491 0, /*tp_dict*/
4492 0, /*tp_descr_get*/
4493 0, /*tp_descr_set*/
4494 0, /*tp_dictoffset*/
4495 0, /*tp_init*/
4496 0, /*tp_alloc*/
4497 __pyx_tp_new_7tinycss_8speedups___pyx_scope_struct__genexpr, /*tp_new*/
4498 0, /*tp_free*/
4499 0, /*tp_is_gc*/
4500 0, /*tp_bases*/
4501 0, /*tp_mro*/
4502 0, /*tp_cache*/
4503 0, /*tp_subclasses*/
4504 0, /*tp_weaklist*/
4505 0, /*tp_del*/
4506 0, /*tp_version_tag*/
4507 #if PY_VERSION_HEX >= 0x030400a1
4508 0, /*tp_finalize*/
4509 #endif
4510 };
4511
4512 static PyMethodDef __pyx_methods[] = {
4513 {0, 0, 0, 0}
4514 };
4515
4516 #if PY_MAJOR_VERSION >= 3
4517 static struct PyModuleDef __pyx_moduledef = {
4518 #if PY_VERSION_HEX < 0x03020000
4519 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
4520 #else
4521 PyModuleDef_HEAD_INIT,
4522 #endif
4523 "speedups",
4524 __pyx_k_tinycss_speedups_Cython_module, /* m_doc */
4525 -1, /* m_size */
4526 __pyx_methods /* m_methods */,
4527 NULL, /* m_reload */
4528 NULL, /* m_traverse */
4529 NULL, /* m_clear */
4530 NULL /* m_free */
4531 };
4532 #endif
4533
4534 static __Pyx_StringTabEntry __pyx_string_tab[] = {
4535 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
4536 {&__pyx_n_s_ATKEYWORD, __pyx_k_ATKEYWORD, sizeof(__pyx_k_ATKEYWORD), 0, 0, 1, 1},
4537 {&__pyx_n_u_ATKEYWORD, __pyx_k_ATKEYWORD, sizeof(__pyx_k_ATKEYWORD), 0, 1, 0, 1},
4538 {&__pyx_n_s_BAD_COMMENT, __pyx_k_BAD_COMMENT, sizeof(__pyx_k_BAD_COMMENT), 0, 0, 1, 1},
4539 {&__pyx_n_u_BAD_COMMENT, __pyx_k_BAD_COMMENT, sizeof(__pyx_k_BAD_COMMENT), 0, 1, 0, 1},
4540 {&__pyx_n_s_BAD_STRING, __pyx_k_BAD_STRING, sizeof(__pyx_k_BAD_STRING), 0, 0, 1, 1},
4541 {&__pyx_n_u_BAD_STRING, __pyx_k_BAD_STRING, sizeof(__pyx_k_BAD_STRING), 0, 1, 0, 1},
4542 {&__pyx_n_s_COMMENT, __pyx_k_COMMENT, sizeof(__pyx_k_COMMENT), 0, 0, 1, 1},
4543 {&__pyx_n_u_COMMENT, __pyx_k_COMMENT, sizeof(__pyx_k_COMMENT), 0, 1, 0, 1},
4544 {&__pyx_n_s_COMPILED_TOKEN_INDEXES, __pyx_k_COMPILED_TOKEN_INDEXES, sizeof(__pyx_k_COMPILED_TOKEN_INDEXES), 0, 0, 1, 1},
4545 {&__pyx_n_s_COMPILED_TOKEN_REGEXPS, __pyx_k_COMPILED_TOKEN_REGEXPS, sizeof(__pyx_k_COMPILED_TOKEN_REGEXPS), 0, 0, 1, 1},
4546 {&__pyx_n_s_DELIM, __pyx_k_DELIM, sizeof(__pyx_k_DELIM), 0, 0, 1, 1},
4547 {&__pyx_n_u_DELIM, __pyx_k_DELIM, sizeof(__pyx_k_DELIM), 0, 1, 0, 1},
4548 {&__pyx_n_s_DIMENSION, __pyx_k_DIMENSION, sizeof(__pyx_k_DIMENSION), 0, 0, 1, 1},
4549 {&__pyx_n_u_DIMENSION, __pyx_k_DIMENSION, sizeof(__pyx_k_DIMENSION), 0, 1, 0, 1},
4550 {&__pyx_n_s_FIND_NEWLINES, __pyx_k_FIND_NEWLINES, sizeof(__pyx_k_FIND_NEWLINES), 0, 0, 1, 1},
4551 {&__pyx_n_s_FUNCTION, __pyx_k_FUNCTION, sizeof(__pyx_k_FUNCTION), 0, 0, 1, 1},
4552 {&__pyx_n_u_FUNCTION, __pyx_k_FUNCTION, sizeof(__pyx_k_FUNCTION), 0, 1, 0, 1},
4553 {&__pyx_n_s_HASH, __pyx_k_HASH, sizeof(__pyx_k_HASH), 0, 0, 1, 1},
4554 {&__pyx_n_u_HASH, __pyx_k_HASH, sizeof(__pyx_k_HASH), 0, 1, 0, 1},
4555 {&__pyx_n_s_IDENT, __pyx_k_IDENT, sizeof(__pyx_k_IDENT), 0, 0, 1, 1},
4556 {&__pyx_n_u_IDENT, __pyx_k_IDENT, sizeof(__pyx_k_IDENT), 0, 1, 0, 1},
4557 {&__pyx_n_u_INTEGER, __pyx_k_INTEGER, sizeof(__pyx_k_INTEGER), 0, 1, 0, 1},
4558 {&__pyx_n_s_NEWLINE_UNESCAPE, __pyx_k_NEWLINE_UNESCAPE, sizeof(__pyx_k_NEWLINE_UNESCAPE), 0, 0, 1, 1},
4559 {&__pyx_n_s_NUMBER, __pyx_k_NUMBER, sizeof(__pyx_k_NUMBER), 0, 0, 1, 1},
4560 {&__pyx_n_u_NUMBER, __pyx_k_NUMBER, sizeof(__pyx_k_NUMBER), 0, 1, 0, 1},
4561 {&__pyx_n_s_PERCENTAGE, __pyx_k_PERCENTAGE, sizeof(__pyx_k_PERCENTAGE), 0, 0, 1, 1},
4562 {&__pyx_n_u_PERCENTAGE, __pyx_k_PERCENTAGE, sizeof(__pyx_k_PERCENTAGE), 0, 1, 0, 1},
4563 {&__pyx_n_s_SIMPLE_UNESCAPE, __pyx_k_SIMPLE_UNESCAPE, sizeof(__pyx_k_SIMPLE_UNESCAPE), 0, 0, 1, 1},
4564 {&__pyx_n_s_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 0, 1, 1},
4565 {&__pyx_n_u_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 1, 0, 1},
4566 {&__pyx_n_s_TOKEN_DISPATCH, __pyx_k_TOKEN_DISPATCH, sizeof(__pyx_k_TOKEN_DISPATCH), 0, 0, 1, 1},
4567 {&__pyx_kp_u_Token_0_type_at_0_line_0_column, __pyx_k_Token_0_type_at_0_line_0_column, sizeof(__pyx_k_Token_0_type_at_0_line_0_column), 0, 1, 0, 0},
4568 {&__pyx_n_s_UNICODE_UNESCAPE, __pyx_k_UNICODE_UNESCAPE, sizeof(__pyx_k_UNICODE_UNESCAPE), 0, 0, 1, 1},
4569 {&__pyx_n_s_URI, __pyx_k_URI, sizeof(__pyx_k_URI), 0, 0, 1, 1},
4570 {&__pyx_n_u_URI, __pyx_k_URI, sizeof(__pyx_k_URI), 0, 1, 0, 1},
4571 {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
4572 {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
4573 {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0},
4574 {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
4575 {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
4576 {&__pyx_n_s_char, __pyx_k_char, sizeof(__pyx_k_char), 0, 0, 1, 1},
4577 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
4578 {&__pyx_n_s_codepoint, __pyx_k_codepoint, sizeof(__pyx_k_codepoint), 0, 0, 1, 1},
4579 {&__pyx_n_s_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 0, 1, 1},
4580 {&__pyx_n_s_compiled_token_indexes, __pyx_k_compiled_token_indexes, sizeof(__pyx_k_compiled_token_indexes), 0, 0, 1, 1},
4581 {&__pyx_n_s_compiled_tokens, __pyx_k_compiled_tokens, sizeof(__pyx_k_compiled_tokens), 0, 0, 1, 1},
4582 {&__pyx_n_s_css_source, __pyx_k_css_source, sizeof(__pyx_k_css_source), 0, 0, 1, 1},
4583 {&__pyx_n_s_css_value, __pyx_k_css_value, sizeof(__pyx_k_css_value), 0, 0, 1, 1},
4584 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
4585 {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
4586 {&__pyx_n_s_find_newlines, __pyx_k_find_newlines, sizeof(__pyx_k_find_newlines), 0, 0, 1, 1},
4587 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
4588 {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
4589 {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
4590 {&__pyx_kp_s_home_lize_Informatique_tinycss, __pyx_k_home_lize_Informatique_tinycss, sizeof(__pyx_k_home_lize_Informatique_tinycss), 0, 0, 1, 0},
4591 {&__pyx_n_s_ignore_comments, __pyx_k_ignore_comments, sizeof(__pyx_k_ignore_comments), 0, 0, 1, 1},
4592 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4593 {&__pyx_n_s_is_container, __pyx_k_is_container, sizeof(__pyx_k_is_container), 0, 0, 1, 1},
4594 {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
4595 {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
4596 {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
4597 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4598 {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
4599 {&__pyx_n_s_n_tokens, __pyx_k_n_tokens, sizeof(__pyx_k_n_tokens), 0, 0, 1, 1},
4600 {&__pyx_n_s_newline_unescape, __pyx_k_newline_unescape, sizeof(__pyx_k_newline_unescape), 0, 0, 1, 1},
4601 {&__pyx_n_s_newlines, __pyx_k_newlines, sizeof(__pyx_k_newlines), 0, 0, 1, 1},
4602 {&__pyx_n_s_next_pos, __pyx_k_next_pos, sizeof(__pyx_k_next_pos), 0, 0, 1, 1},
4603 {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
4604 {&__pyx_n_s_regexp, __pyx_k_regexp, sizeof(__pyx_k_regexp), 0, 0, 1, 1},
4605 {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
4606 {&__pyx_n_s_simple_unescape, __pyx_k_simple_unescape, sizeof(__pyx_k_simple_unescape), 0, 0, 1, 1},
4607 {&__pyx_n_s_source_len, __pyx_k_source_len, sizeof(__pyx_k_source_len), 0, 0, 1, 1},
4608 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4609 {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
4610 {&__pyx_n_s_tinycss_speedups, __pyx_k_tinycss_speedups, sizeof(__pyx_k_tinycss_speedups), 0, 0, 1, 1},
4611 {&__pyx_n_s_token, __pyx_k_token, sizeof(__pyx_k_token), 0, 0, 1, 1},
4612 {&__pyx_n_s_token_data, __pyx_k_token_data, sizeof(__pyx_k_token_data), 0, 0, 1, 1},
4613 {&__pyx_n_s_tokenize_flat, __pyx_k_tokenize_flat, sizeof(__pyx_k_tokenize_flat), 0, 0, 1, 1},
4614 {&__pyx_n_s_tokens, __pyx_k_tokens, sizeof(__pyx_k_tokens), 0, 0, 1, 1},
4615 {&__pyx_n_s_tokens_dispatch, __pyx_k_tokens_dispatch, sizeof(__pyx_k_tokens_dispatch), 0, 0, 1, 1},
4616 {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
4617 {&__pyx_n_s_type_name, __pyx_k_type_name, sizeof(__pyx_k_type_name), 0, 0, 1, 1},
4618 {&__pyx_n_s_unicode_unescape, __pyx_k_unicode_unescape, sizeof(__pyx_k_unicode_unescape), 0, 0, 1, 1},
4619 {&__pyx_n_s_unit, __pyx_k_unit, sizeof(__pyx_k_unit), 0, 0, 1, 1},
4620 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
4621 {0, 0, 0, 0, 0, 0, 0}
4622 };
__Pyx_InitCachedBuiltins(void)4623 static int __Pyx_InitCachedBuiltins(void) {
4624 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 22, __pyx_L1_error)
4625 return 0;
4626 __pyx_L1_error:;
4627 return -1;
4628 }
4629
__Pyx_InitCachedConstants(void)4630 static int __Pyx_InitCachedConstants(void) {
4631 __Pyx_RefNannyDeclarations
4632 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4633
4634 /* "tinycss/speedups.pyx":130
4635 * unit = None
4636 * if type_ == DIMENSION:
4637 * value = match.group(1) # <<<<<<<<<<<<<<
4638 * value = float(value) if '.' in value else int(value)
4639 * unit = match.group(2)
4640 */
4641 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 130, __pyx_L1_error)
4642 __Pyx_GOTREF(__pyx_tuple__3);
4643 __Pyx_GIVEREF(__pyx_tuple__3);
4644
4645 /* "tinycss/speedups.pyx":132
4646 * value = match.group(1)
4647 * value = float(value) if '.' in value else int(value)
4648 * unit = match.group(2) # <<<<<<<<<<<<<<
4649 * unit = simple_unescape(unit)
4650 * unit = unicode_unescape(unit)
4651 */
4652 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 132, __pyx_L1_error)
4653 __Pyx_GOTREF(__pyx_tuple__5);
4654 __Pyx_GIVEREF(__pyx_tuple__5);
4655
4656 /* "tinycss/speedups.pyx":137
4657 * unit = unit.lower() # normalize
4658 * elif type_ == PERCENTAGE:
4659 * value = css_value[:-1] # <<<<<<<<<<<<<<
4660 * value = float(value) if '.' in value else int(value)
4661 * unit = '%'
4662 */
4663 __pyx_slice__6 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 137, __pyx_L1_error)
4664 __Pyx_GOTREF(__pyx_slice__6);
4665 __Pyx_GIVEREF(__pyx_slice__6);
4666
4667 /* "tinycss/speedups.pyx":151
4668 * value = unicode_unescape(value)
4669 * elif type_ == URI:
4670 * value = match.group(1) # <<<<<<<<<<<<<<
4671 * if value and value[0] in '"\'':
4672 * value = value[1:-1] # Remove quotes
4673 */
4674 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 151, __pyx_L1_error)
4675 __Pyx_GOTREF(__pyx_tuple__8);
4676 __Pyx_GIVEREF(__pyx_tuple__8);
4677
4678 /* "tinycss/speedups.pyx":153
4679 * value = match.group(1)
4680 * if value and value[0] in '"\'':
4681 * value = value[1:-1] # Remove quotes # <<<<<<<<<<<<<<
4682 * value = newline_unescape(value)
4683 * value = simple_unescape(value)
4684 */
4685 __pyx_slice__10 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__10)) __PYX_ERR(0, 153, __pyx_L1_error)
4686 __Pyx_GOTREF(__pyx_slice__10);
4687 __Pyx_GIVEREF(__pyx_slice__10);
4688
4689 /* "tinycss/speedups.pyx":158
4690 * value = unicode_unescape(value)
4691 * elif type_ == STRING:
4692 * value = css_value[1:-1] # Remove quotes # <<<<<<<<<<<<<<
4693 * value = newline_unescape(value)
4694 * value = simple_unescape(value)
4695 */
4696 __pyx_slice__11 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__11)) __PYX_ERR(0, 158, __pyx_L1_error)
4697 __Pyx_GOTREF(__pyx_slice__11);
4698 __Pyx_GIVEREF(__pyx_slice__11);
4699
4700 /* "tinycss/speedups.pyx":172
4701 * elif type_ == BAD_STRING and next_pos == source_len:
4702 * type_name = 'STRING'
4703 * value = css_value[1:] # Remove quote # <<<<<<<<<<<<<<
4704 * value = newline_unescape(value)
4705 * value = simple_unescape(value)
4706 */
4707 __pyx_slice__12 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__12)) __PYX_ERR(0, 172, __pyx_L1_error)
4708 __Pyx_GOTREF(__pyx_slice__12);
4709 __Pyx_GIVEREF(__pyx_slice__12);
4710
4711 /* "tinycss/speedups.pyx":55
4712 *
4713 *
4714 * def tokenize_flat(css_source, int ignore_comments=1): # <<<<<<<<<<<<<<
4715 * """
4716 * :param css_source:
4717 */
4718 __pyx_tuple__13 = PyTuple_Pack(41, __pyx_n_s_css_source, __pyx_n_s_ignore_comments, __pyx_n_s_tokens_dispatch, __pyx_n_s_compiled_token_indexes, __pyx_n_s_compiled_tokens, __pyx_n_s_unicode_unescape, __pyx_n_s_newline_unescape, __pyx_n_s_simple_unescape, __pyx_n_s_find_newlines, __pyx_n_s_BAD_COMMENT, __pyx_n_s_BAD_STRING, __pyx_n_s_PERCENTAGE, __pyx_n_s_DIMENSION, __pyx_n_s_ATKEYWORD, __pyx_n_s_FUNCTION, __pyx_n_s_COMMENT, __pyx_n_s_NUMBER, __pyx_n_s_STRING, __pyx_n_s_IDENT, __pyx_n_s_HASH, __pyx_n_s_URI, __pyx_n_s_DELIM, __pyx_n_s_pos, __pyx_n_s_line, __pyx_n_s_column, __pyx_n_s_source_len, __pyx_n_s_n_tokens, __pyx_n_s_length, __pyx_n_s_next_pos, __pyx_n_s_type, __pyx_n_s_token, __pyx_n_s_tokens, __pyx_n_s_char, __pyx_n_s_type_name, __pyx_n_s_css_value, __pyx_n_s_codepoint, __pyx_n_s_regexp, __pyx_n_s_match, __pyx_n_s_unit, __pyx_n_s_value, __pyx_n_s_newlines); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 55, __pyx_L1_error)
4719 __Pyx_GOTREF(__pyx_tuple__13);
4720 __Pyx_GIVEREF(__pyx_tuple__13);
4721 __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_lize_Informatique_tinycss, __pyx_n_s_tokenize_flat, 55, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 55, __pyx_L1_error)
4722 __Pyx_RefNannyFinishContext();
4723 return 0;
4724 __pyx_L1_error:;
4725 __Pyx_RefNannyFinishContext();
4726 return -1;
4727 }
4728
__Pyx_InitGlobals(void)4729 static int __Pyx_InitGlobals(void) {
4730 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4731 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
4732 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4733 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
4734 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4735 return 0;
4736 __pyx_L1_error:;
4737 return -1;
4738 }
4739
4740 #if PY_MAJOR_VERSION < 3
4741 PyMODINIT_FUNC initspeedups(void); /*proto*/
initspeedups(void)4742 PyMODINIT_FUNC initspeedups(void)
4743 #else
4744 PyMODINIT_FUNC PyInit_speedups(void); /*proto*/
4745 PyMODINIT_FUNC PyInit_speedups(void)
4746 #endif
4747 {
4748 PyObject *__pyx_t_1 = NULL;
4749 PyObject *__pyx_t_2 = NULL;
4750 __Pyx_RefNannyDeclarations
4751 #if CYTHON_REFNANNY
4752 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4753 if (!__Pyx_RefNanny) {
4754 PyErr_Clear();
4755 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4756 if (!__Pyx_RefNanny)
4757 Py_FatalError("failed to import 'refnanny' module");
4758 }
4759 #endif
4760 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_speedups(void)", 0);
4761 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4762 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4763 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4764 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4765 #ifdef __Pyx_CyFunction_USED
4766 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4767 #endif
4768 #ifdef __Pyx_FusedFunction_USED
4769 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4770 #endif
4771 #ifdef __Pyx_Coroutine_USED
4772 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4773 #endif
4774 #ifdef __Pyx_Generator_USED
4775 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4776 #endif
4777 #ifdef __Pyx_StopAsyncIteration_USED
4778 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4779 #endif
4780 /*--- Library function declarations ---*/
4781 /*--- Threads initialization code ---*/
4782 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4783 #ifdef WITH_THREAD /* Python build with threading support? */
4784 PyEval_InitThreads();
4785 #endif
4786 #endif
4787 /*--- Module creation code ---*/
4788 #if PY_MAJOR_VERSION < 3
4789 __pyx_m = Py_InitModule4("speedups", __pyx_methods, __pyx_k_tinycss_speedups_Cython_module, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4790 #else
4791 __pyx_m = PyModule_Create(&__pyx_moduledef);
4792 #endif
4793 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4794 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4795 Py_INCREF(__pyx_d);
4796 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4797 #if CYTHON_COMPILING_IN_PYPY
4798 Py_INCREF(__pyx_b);
4799 #endif
4800 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4801 /*--- Initialize various global constants etc. ---*/
4802 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4803 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4804 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4805 #endif
4806 if (__pyx_module_is_main_tinycss__speedups) {
4807 if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4808 }
4809 #if PY_MAJOR_VERSION >= 3
4810 {
4811 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4812 if (!PyDict_GetItemString(modules, "tinycss.speedups")) {
4813 if (unlikely(PyDict_SetItemString(modules, "tinycss.speedups", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4814 }
4815 }
4816 #endif
4817 /*--- Builtin init code ---*/
4818 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4819 /*--- Constants init code ---*/
4820 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4821 /*--- Global init code ---*/
4822 /*--- Variable export code ---*/
4823 /*--- Function export code ---*/
4824 /*--- Type init code ---*/
4825 if (PyType_Ready(&__pyx_type_7tinycss_8speedups_CToken) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
4826 __pyx_type_7tinycss_8speedups_CToken.tp_print = 0;
4827 if (PyObject_SetAttrString(__pyx_m, "CToken", (PyObject *)&__pyx_type_7tinycss_8speedups_CToken) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
4828 __pyx_ptype_7tinycss_8speedups_CToken = &__pyx_type_7tinycss_8speedups_CToken;
4829 if (PyType_Ready(&__pyx_type_7tinycss_8speedups___pyx_scope_struct__genexpr) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
4830 __pyx_type_7tinycss_8speedups___pyx_scope_struct__genexpr.tp_print = 0;
4831 __pyx_ptype_7tinycss_8speedups___pyx_scope_struct__genexpr = &__pyx_type_7tinycss_8speedups___pyx_scope_struct__genexpr;
4832 /*--- Type import code ---*/
4833 /*--- Variable import code ---*/
4834 /*--- Function import code ---*/
4835 /*--- Execution code ---*/
4836 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4837 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4838 #endif
4839
4840 /* "tinycss/speedups.pyx":17
4841 *
4842 * from .token_data import (
4843 * COMPILED_TOKEN_REGEXPS, UNICODE_UNESCAPE, NEWLINE_UNESCAPE, # <<<<<<<<<<<<<<
4844 * SIMPLE_UNESCAPE, FIND_NEWLINES, TOKEN_DISPATCH)
4845 *
4846 */
4847 __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
4848 __Pyx_GOTREF(__pyx_t_1);
4849 __Pyx_INCREF(__pyx_n_s_COMPILED_TOKEN_REGEXPS);
4850 __Pyx_GIVEREF(__pyx_n_s_COMPILED_TOKEN_REGEXPS);
4851 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_COMPILED_TOKEN_REGEXPS);
4852 __Pyx_INCREF(__pyx_n_s_UNICODE_UNESCAPE);
4853 __Pyx_GIVEREF(__pyx_n_s_UNICODE_UNESCAPE);
4854 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_UNICODE_UNESCAPE);
4855 __Pyx_INCREF(__pyx_n_s_NEWLINE_UNESCAPE);
4856 __Pyx_GIVEREF(__pyx_n_s_NEWLINE_UNESCAPE);
4857 PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_NEWLINE_UNESCAPE);
4858 __Pyx_INCREF(__pyx_n_s_SIMPLE_UNESCAPE);
4859 __Pyx_GIVEREF(__pyx_n_s_SIMPLE_UNESCAPE);
4860 PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_SIMPLE_UNESCAPE);
4861 __Pyx_INCREF(__pyx_n_s_FIND_NEWLINES);
4862 __Pyx_GIVEREF(__pyx_n_s_FIND_NEWLINES);
4863 PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_FIND_NEWLINES);
4864 __Pyx_INCREF(__pyx_n_s_TOKEN_DISPATCH);
4865 __Pyx_GIVEREF(__pyx_n_s_TOKEN_DISPATCH);
4866 PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_TOKEN_DISPATCH);
4867
4868 /* "tinycss/speedups.pyx":16
4869 * from __future__ import unicode_literals
4870 *
4871 * from .token_data import ( # <<<<<<<<<<<<<<
4872 * COMPILED_TOKEN_REGEXPS, UNICODE_UNESCAPE, NEWLINE_UNESCAPE,
4873 * SIMPLE_UNESCAPE, FIND_NEWLINES, TOKEN_DISPATCH)
4874 */
4875 __pyx_t_2 = __Pyx_Import(__pyx_n_s_token_data, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
4876 __Pyx_GOTREF(__pyx_t_2);
4877 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4878 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_COMPILED_TOKEN_REGEXPS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4879 __Pyx_GOTREF(__pyx_t_1);
4880 if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED_TOKEN_REGEXPS, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4881 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4882 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_UNICODE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4883 __Pyx_GOTREF(__pyx_t_1);
4884 if (PyDict_SetItem(__pyx_d, __pyx_n_s_UNICODE_UNESCAPE, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4885 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4886 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_NEWLINE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4887 __Pyx_GOTREF(__pyx_t_1);
4888 if (PyDict_SetItem(__pyx_d, __pyx_n_s_NEWLINE_UNESCAPE, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4889 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4890 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SIMPLE_UNESCAPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4891 __Pyx_GOTREF(__pyx_t_1);
4892 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SIMPLE_UNESCAPE, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
4893 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4894 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_FIND_NEWLINES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4895 __Pyx_GOTREF(__pyx_t_1);
4896 if (PyDict_SetItem(__pyx_d, __pyx_n_s_FIND_NEWLINES, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
4897 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4898 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TOKEN_DISPATCH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4899 __Pyx_GOTREF(__pyx_t_1);
4900 if (PyDict_SetItem(__pyx_d, __pyx_n_s_TOKEN_DISPATCH, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
4901 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4902 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4903
4904 /* "tinycss/speedups.pyx":22
4905 *
4906 * COMPILED_TOKEN_INDEXES = dict(
4907 * (name, i) for i, (name, regexp) in enumerate(COMPILED_TOKEN_REGEXPS)) # <<<<<<<<<<<<<<
4908 *
4909 *
4910 */
4911 __pyx_t_2 = __pyx_pf_7tinycss_8speedups_2genexpr(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
4912 __Pyx_GOTREF(__pyx_t_2);
4913
4914 /* "tinycss/speedups.pyx":21
4915 *
4916 *
4917 * COMPILED_TOKEN_INDEXES = dict( # <<<<<<<<<<<<<<
4918 * (name, i) for i, (name, regexp) in enumerate(COMPILED_TOKEN_REGEXPS))
4919 *
4920 */
4921 __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
4922 __Pyx_GOTREF(__pyx_t_1);
4923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4924 if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPILED_TOKEN_INDEXES, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
4925 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4926
4927 /* "tinycss/speedups.pyx":30
4928 *
4929 * """
4930 * is_container = False # <<<<<<<<<<<<<<
4931 *
4932 * cdef public object type, _as_css, value, unit
4933 */
4934 if (PyDict_SetItem((PyObject *)__pyx_ptype_7tinycss_8speedups_CToken->tp_dict, __pyx_n_s_is_container, Py_False) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
4935 PyType_Modified(__pyx_ptype_7tinycss_8speedups_CToken);
4936
4937 /* "tinycss/speedups.pyx":55
4938 *
4939 *
4940 * def tokenize_flat(css_source, int ignore_comments=1): # <<<<<<<<<<<<<<
4941 * """
4942 * :param css_source:
4943 */
4944 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7tinycss_8speedups_1tokenize_flat, NULL, __pyx_n_s_tinycss_speedups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
4945 __Pyx_GOTREF(__pyx_t_1);
4946 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tokenize_flat, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
4947 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4948
4949 /* "tinycss/speedups.pyx":1
4950 * # coding: utf-8 # <<<<<<<<<<<<<<
4951 * """
4952 * tinycss.speedups
4953 */
4954 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4955 __Pyx_GOTREF(__pyx_t_1);
4956 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4957 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4958
4959 /*--- Wrapped vars code ---*/
4960
4961 goto __pyx_L0;
4962 __pyx_L1_error:;
4963 __Pyx_XDECREF(__pyx_t_1);
4964 __Pyx_XDECREF(__pyx_t_2);
4965 if (__pyx_m) {
4966 if (__pyx_d) {
4967 __Pyx_AddTraceback("init tinycss.speedups", __pyx_clineno, __pyx_lineno, __pyx_filename);
4968 }
4969 Py_DECREF(__pyx_m); __pyx_m = 0;
4970 } else if (!PyErr_Occurred()) {
4971 PyErr_SetString(PyExc_ImportError, "init tinycss.speedups");
4972 }
4973 __pyx_L0:;
4974 __Pyx_RefNannyFinishContext();
4975 #if PY_MAJOR_VERSION < 3
4976 return;
4977 #else
4978 return __pyx_m;
4979 #endif
4980 }
4981
4982 /* --- Runtime support code --- */
4983 /* Refnanny */
4984 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)4985 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4986 PyObject *m = NULL, *p = NULL;
4987 void *r = NULL;
4988 m = PyImport_ImportModule((char *)modname);
4989 if (!m) goto end;
4990 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
4991 if (!p) goto end;
4992 r = PyLong_AsVoidPtr(p);
4993 end:
4994 Py_XDECREF(p);
4995 Py_XDECREF(m);
4996 return (__Pyx_RefNannyAPIStruct *)r;
4997 }
4998 #endif
4999
5000 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)5001 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5002 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5003 if (unlikely(!result)) {
5004 PyErr_Format(PyExc_NameError,
5005 #if PY_MAJOR_VERSION >= 3
5006 "name '%U' is not defined", name);
5007 #else
5008 "name '%.200s' is not defined", PyString_AS_STRING(name));
5009 #endif
5010 }
5011 return result;
5012 }
5013
5014 /* GetModuleGlobalName */
__Pyx_GetModuleGlobalName(PyObject * name)5015 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
5016 PyObject *result;
5017 #if CYTHON_COMPILING_IN_CPYTHON
5018 result = PyDict_GetItem(__pyx_d, name);
5019 if (likely(result)) {
5020 Py_INCREF(result);
5021 } else {
5022 #else
5023 result = PyObject_GetItem(__pyx_d, name);
5024 if (!result) {
5025 PyErr_Clear();
5026 #endif
5027 result = __Pyx_GetBuiltinName(name);
5028 }
5029 return result;
5030 }
5031
5032 /* RaiseTooManyValuesToUnpack */
5033 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
5034 PyErr_Format(PyExc_ValueError,
5035 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
5036 }
5037
5038 /* RaiseNeedMoreValuesToUnpack */
5039 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
5040 PyErr_Format(PyExc_ValueError,
5041 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
5042 index, (index == 1) ? "" : "s");
5043 }
5044
5045 /* IterFinish */
5046 static CYTHON_INLINE int __Pyx_IterFinish(void) {
5047 #if CYTHON_COMPILING_IN_CPYTHON
5048 PyThreadState *tstate = PyThreadState_GET();
5049 PyObject* exc_type = tstate->curexc_type;
5050 if (unlikely(exc_type)) {
5051 if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
5052 PyObject *exc_value, *exc_tb;
5053 exc_value = tstate->curexc_value;
5054 exc_tb = tstate->curexc_traceback;
5055 tstate->curexc_type = 0;
5056 tstate->curexc_value = 0;
5057 tstate->curexc_traceback = 0;
5058 Py_DECREF(exc_type);
5059 Py_XDECREF(exc_value);
5060 Py_XDECREF(exc_tb);
5061 return 0;
5062 } else {
5063 return -1;
5064 }
5065 }
5066 return 0;
5067 #else
5068 if (unlikely(PyErr_Occurred())) {
5069 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
5070 PyErr_Clear();
5071 return 0;
5072 } else {
5073 return -1;
5074 }
5075 }
5076 return 0;
5077 #endif
5078 }
5079
5080 /* UnpackItemEndCheck */
5081 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
5082 if (unlikely(retval)) {
5083 Py_DECREF(retval);
5084 __Pyx_RaiseTooManyValuesError(expected);
5085 return -1;
5086 } else {
5087 return __Pyx_IterFinish();
5088 }
5089 return 0;
5090 }
5091
5092 /* PyIntBinop */
5093 #if CYTHON_COMPILING_IN_CPYTHON
5094 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
5095 #if PY_MAJOR_VERSION < 3
5096 if (likely(PyInt_CheckExact(op1))) {
5097 const long b = intval;
5098 long x;
5099 long a = PyInt_AS_LONG(op1);
5100 x = (long)((unsigned long)a + b);
5101 if (likely((x^a) >= 0 || (x^b) >= 0))
5102 return PyInt_FromLong(x);
5103 return PyLong_Type.tp_as_number->nb_add(op1, op2);
5104 }
5105 #endif
5106 #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
5107 if (likely(PyLong_CheckExact(op1))) {
5108 const long b = intval;
5109 long a, x;
5110 const PY_LONG_LONG llb = intval;
5111 PY_LONG_LONG lla, llx;
5112 const digit* digits = ((PyLongObject*)op1)->ob_digit;
5113 const Py_ssize_t size = Py_SIZE(op1);
5114 if (likely(__Pyx_sst_abs(size) <= 1)) {
5115 a = likely(size) ? digits[0] : 0;
5116 if (size == -1) a = -a;
5117 } else {
5118 switch (size) {
5119 case -2:
5120 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
5121 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5122 break;
5123 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
5124 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5125 goto long_long;
5126 }
5127 case 2:
5128 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
5129 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5130 break;
5131 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
5132 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5133 goto long_long;
5134 }
5135 case -3:
5136 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
5137 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5138 break;
5139 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
5140 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5141 goto long_long;
5142 }
5143 case 3:
5144 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
5145 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5146 break;
5147 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
5148 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5149 goto long_long;
5150 }
5151 case -4:
5152 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
5153 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5154 break;
5155 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
5156 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5157 goto long_long;
5158 }
5159 case 4:
5160 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
5161 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
5162 break;
5163 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
5164 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
5165 goto long_long;
5166 }
5167 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
5168 }
5169 }
5170 x = a + b;
5171 return PyLong_FromLong(x);
5172 long_long:
5173 llx = lla + llb;
5174 return PyLong_FromLongLong(llx);
5175 }
5176 #endif
5177 if (PyFloat_CheckExact(op1)) {
5178 const long b = intval;
5179 double a = PyFloat_AS_DOUBLE(op1);
5180 double result;
5181 PyFPE_START_PROTECT("add", return NULL)
5182 result = ((double)a) + (double)b;
5183 PyFPE_END_PROTECT(result)
5184 return PyFloat_FromDouble(result);
5185 }
5186 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
5187 }
5188 #endif
5189
5190 /* RaiseArgTupleInvalid */
5191 static void __Pyx_RaiseArgtupleInvalid(
5192 const char* func_name,
5193 int exact,
5194 Py_ssize_t num_min,
5195 Py_ssize_t num_max,
5196 Py_ssize_t num_found)
5197 {
5198 Py_ssize_t num_expected;
5199 const char *more_or_less;
5200 if (num_found < num_min) {
5201 num_expected = num_min;
5202 more_or_less = "at least";
5203 } else {
5204 num_expected = num_max;
5205 more_or_less = "at most";
5206 }
5207 if (exact) {
5208 more_or_less = "exactly";
5209 }
5210 PyErr_Format(PyExc_TypeError,
5211 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
5212 func_name, more_or_less, num_expected,
5213 (num_expected == 1) ? "" : "s", num_found);
5214 }
5215
5216 /* RaiseDoubleKeywords */
5217 static void __Pyx_RaiseDoubleKeywordsError(
5218 const char* func_name,
5219 PyObject* kw_name)
5220 {
5221 PyErr_Format(PyExc_TypeError,
5222 #if PY_MAJOR_VERSION >= 3
5223 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5224 #else
5225 "%s() got multiple values for keyword argument '%s'", func_name,
5226 PyString_AsString(kw_name));
5227 #endif
5228 }
5229
5230 /* ParseKeywords */
5231 static int __Pyx_ParseOptionalKeywords(
5232 PyObject *kwds,
5233 PyObject **argnames[],
5234 PyObject *kwds2,
5235 PyObject *values[],
5236 Py_ssize_t num_pos_args,
5237 const char* function_name)
5238 {
5239 PyObject *key = 0, *value = 0;
5240 Py_ssize_t pos = 0;
5241 PyObject*** name;
5242 PyObject*** first_kw_arg = argnames + num_pos_args;
5243 while (PyDict_Next(kwds, &pos, &key, &value)) {
5244 name = first_kw_arg;
5245 while (*name && (**name != key)) name++;
5246 if (*name) {
5247 values[name-argnames] = value;
5248 continue;
5249 }
5250 name = first_kw_arg;
5251 #if PY_MAJOR_VERSION < 3
5252 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
5253 while (*name) {
5254 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
5255 && _PyString_Eq(**name, key)) {
5256 values[name-argnames] = value;
5257 break;
5258 }
5259 name++;
5260 }
5261 if (*name) continue;
5262 else {
5263 PyObject*** argname = argnames;
5264 while (argname != first_kw_arg) {
5265 if ((**argname == key) || (
5266 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
5267 && _PyString_Eq(**argname, key))) {
5268 goto arg_passed_twice;
5269 }
5270 argname++;
5271 }
5272 }
5273 } else
5274 #endif
5275 if (likely(PyUnicode_Check(key))) {
5276 while (*name) {
5277 int cmp = (**name == key) ? 0 :
5278 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5279 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
5280 #endif
5281 PyUnicode_Compare(**name, key);
5282 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5283 if (cmp == 0) {
5284 values[name-argnames] = value;
5285 break;
5286 }
5287 name++;
5288 }
5289 if (*name) continue;
5290 else {
5291 PyObject*** argname = argnames;
5292 while (argname != first_kw_arg) {
5293 int cmp = (**argname == key) ? 0 :
5294 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5295 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
5296 #endif
5297 PyUnicode_Compare(**argname, key);
5298 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5299 if (cmp == 0) goto arg_passed_twice;
5300 argname++;
5301 }
5302 }
5303 } else
5304 goto invalid_keyword_type;
5305 if (kwds2) {
5306 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
5307 } else {
5308 goto invalid_keyword;
5309 }
5310 }
5311 return 0;
5312 arg_passed_twice:
5313 __Pyx_RaiseDoubleKeywordsError(function_name, key);
5314 goto bad;
5315 invalid_keyword_type:
5316 PyErr_Format(PyExc_TypeError,
5317 "%.200s() keywords must be strings", function_name);
5318 goto bad;
5319 invalid_keyword:
5320 PyErr_Format(PyExc_TypeError,
5321 #if PY_MAJOR_VERSION < 3
5322 "%.200s() got an unexpected keyword argument '%.200s'",
5323 function_name, PyString_AsString(key));
5324 #else
5325 "%s() got an unexpected keyword argument '%U'",
5326 function_name, key);
5327 #endif
5328 bad:
5329 return -1;
5330 }
5331
5332 /* PyObjectCall */
5333 #if CYTHON_COMPILING_IN_CPYTHON
5334 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
5335 PyObject *result;
5336 ternaryfunc call = func->ob_type->tp_call;
5337 if (unlikely(!call))
5338 return PyObject_Call(func, arg, kw);
5339 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5340 return NULL;
5341 result = (*call)(func, arg, kw);
5342 Py_LeaveRecursiveCall();
5343 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5344 PyErr_SetString(
5345 PyExc_SystemError,
5346 "NULL result without error in PyObject_Call");
5347 }
5348 return result;
5349 }
5350 #endif
5351
5352 /* GetItemInt */
5353 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
5354 PyObject *r;
5355 if (!j) return NULL;
5356 r = PyObject_GetItem(o, j);
5357 Py_DECREF(j);
5358 return r;
5359 }
5360 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
5361 CYTHON_NCP_UNUSED int wraparound,
5362 CYTHON_NCP_UNUSED int boundscheck) {
5363 #if CYTHON_COMPILING_IN_CPYTHON
5364 if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
5365 if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
5366 PyObject *r = PyList_GET_ITEM(o, i);
5367 Py_INCREF(r);
5368 return r;
5369 }
5370 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5371 #else
5372 return PySequence_GetItem(o, i);
5373 #endif
5374 }
5375 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
5376 CYTHON_NCP_UNUSED int wraparound,
5377 CYTHON_NCP_UNUSED int boundscheck) {
5378 #if CYTHON_COMPILING_IN_CPYTHON
5379 if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
5380 if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
5381 PyObject *r = PyTuple_GET_ITEM(o, i);
5382 Py_INCREF(r);
5383 return r;
5384 }
5385 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5386 #else
5387 return PySequence_GetItem(o, i);
5388 #endif
5389 }
5390 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
5391 CYTHON_NCP_UNUSED int wraparound,
5392 CYTHON_NCP_UNUSED int boundscheck) {
5393 #if CYTHON_COMPILING_IN_CPYTHON
5394 if (is_list || PyList_CheckExact(o)) {
5395 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
5396 if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
5397 PyObject *r = PyList_GET_ITEM(o, n);
5398 Py_INCREF(r);
5399 return r;
5400 }
5401 }
5402 else if (PyTuple_CheckExact(o)) {
5403 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
5404 if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
5405 PyObject *r = PyTuple_GET_ITEM(o, n);
5406 Py_INCREF(r);
5407 return r;
5408 }
5409 } else {
5410 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
5411 if (likely(m && m->sq_item)) {
5412 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
5413 Py_ssize_t l = m->sq_length(o);
5414 if (likely(l >= 0)) {
5415 i += l;
5416 } else {
5417 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
5418 return NULL;
5419 PyErr_Clear();
5420 }
5421 }
5422 return m->sq_item(o, i);
5423 }
5424 }
5425 #else
5426 if (is_list || PySequence_Check(o)) {
5427 return PySequence_GetItem(o, i);
5428 }
5429 #endif
5430 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
5431 }
5432
5433 /* UnicodeAsUCS4 */
5434 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
5435 Py_ssize_t length;
5436 #if CYTHON_PEP393_ENABLED
5437 length = PyUnicode_GET_LENGTH(x);
5438 if (likely(length == 1)) {
5439 return PyUnicode_READ_CHAR(x, 0);
5440 }
5441 #else
5442 length = PyUnicode_GET_SIZE(x);
5443 if (likely(length == 1)) {
5444 return PyUnicode_AS_UNICODE(x)[0];
5445 }
5446 #if Py_UNICODE_SIZE == 2
5447 else if (PyUnicode_GET_SIZE(x) == 2) {
5448 Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
5449 if (high_val >= 0xD800 && high_val <= 0xDBFF) {
5450 Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
5451 if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
5452 return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
5453 }
5454 }
5455 }
5456 #endif
5457 #endif
5458 PyErr_Format(PyExc_ValueError,
5459 "only single character unicode strings can be converted to Py_UCS4, "
5460 "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
5461 return (Py_UCS4)-1;
5462 }
5463
5464 /* object_ord */
5465 static long __Pyx__PyObject_Ord(PyObject* c) {
5466 Py_ssize_t size;
5467 if (PyBytes_Check(c)) {
5468 size = PyBytes_GET_SIZE(c);
5469 if (likely(size == 1)) {
5470 return (unsigned char) PyBytes_AS_STRING(c)[0];
5471 }
5472 #if PY_MAJOR_VERSION < 3
5473 } else if (PyUnicode_Check(c)) {
5474 return (long)__Pyx_PyUnicode_AsPy_UCS4(c);
5475 #endif
5476 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
5477 } else if (PyByteArray_Check(c)) {
5478 size = PyByteArray_GET_SIZE(c);
5479 if (likely(size == 1)) {
5480 return (unsigned char) PyByteArray_AS_STRING(c)[0];
5481 }
5482 #endif
5483 } else {
5484 PyErr_Format(PyExc_TypeError,
5485 "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name);
5486 return (long)(Py_UCS4)-1;
5487 }
5488 PyErr_Format(PyExc_TypeError,
5489 "ord() expected a character, but string of length %zd found", size);
5490 return (long)(Py_UCS4)-1;
5491 }
5492
5493 /* PyObjectCallMethO */
5494 #if CYTHON_COMPILING_IN_CPYTHON
5495 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
5496 PyObject *self, *result;
5497 PyCFunction cfunc;
5498 cfunc = PyCFunction_GET_FUNCTION(func);
5499 self = PyCFunction_GET_SELF(func);
5500 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5501 return NULL;
5502 result = cfunc(self, arg);
5503 Py_LeaveRecursiveCall();
5504 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5505 PyErr_SetString(
5506 PyExc_SystemError,
5507 "NULL result without error in PyObject_Call");
5508 }
5509 return result;
5510 }
5511 #endif
5512
5513 /* PyObjectCallOneArg */
5514 #if CYTHON_COMPILING_IN_CPYTHON
5515 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5516 PyObject *result;
5517 PyObject *args = PyTuple_New(1);
5518 if (unlikely(!args)) return NULL;
5519 Py_INCREF(arg);
5520 PyTuple_SET_ITEM(args, 0, arg);
5521 result = __Pyx_PyObject_Call(func, args, NULL);
5522 Py_DECREF(args);
5523 return result;
5524 }
5525 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5526 #ifdef __Pyx_CyFunction_USED
5527 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
5528 #else
5529 if (likely(PyCFunction_Check(func))) {
5530 #endif
5531 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
5532 return __Pyx_PyObject_CallMethO(func, arg);
5533 }
5534 }
5535 return __Pyx__PyObject_CallOneArg(func, arg);
5536 }
5537 #else
5538 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5539 PyObject *result;
5540 PyObject *args = PyTuple_Pack(1, arg);
5541 if (unlikely(!args)) return NULL;
5542 result = __Pyx_PyObject_Call(func, args, NULL);
5543 Py_DECREF(args);
5544 return result;
5545 }
5546 #endif
5547
5548 /* PyObjectCallNoArg */
5549 #if CYTHON_COMPILING_IN_CPYTHON
5550 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
5551 #ifdef __Pyx_CyFunction_USED
5552 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
5553 #else
5554 if (likely(PyCFunction_Check(func))) {
5555 #endif
5556 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
5557 return __Pyx_PyObject_CallMethO(func, NULL);
5558 }
5559 }
5560 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
5561 }
5562 #endif
5563
5564 /* None */
5565 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
5566 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
5567 }
5568
5569 /* SliceObject */
5570 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
5571 Py_ssize_t cstart, Py_ssize_t cstop,
5572 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
5573 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
5574 #if CYTHON_COMPILING_IN_CPYTHON
5575 PyMappingMethods* mp;
5576 #if PY_MAJOR_VERSION < 3
5577 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
5578 if (likely(ms && ms->sq_slice)) {
5579 if (!has_cstart) {
5580 if (_py_start && (*_py_start != Py_None)) {
5581 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
5582 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
5583 } else
5584 cstart = 0;
5585 }
5586 if (!has_cstop) {
5587 if (_py_stop && (*_py_stop != Py_None)) {
5588 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
5589 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
5590 } else
5591 cstop = PY_SSIZE_T_MAX;
5592 }
5593 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
5594 Py_ssize_t l = ms->sq_length(obj);
5595 if (likely(l >= 0)) {
5596 if (cstop < 0) {
5597 cstop += l;
5598 if (cstop < 0) cstop = 0;
5599 }
5600 if (cstart < 0) {
5601 cstart += l;
5602 if (cstart < 0) cstart = 0;
5603 }
5604 } else {
5605 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
5606 goto bad;
5607 PyErr_Clear();
5608 }
5609 }
5610 return ms->sq_slice(obj, cstart, cstop);
5611 }
5612 #endif
5613 mp = Py_TYPE(obj)->tp_as_mapping;
5614 if (likely(mp && mp->mp_subscript))
5615 #endif
5616 {
5617 PyObject* result;
5618 PyObject *py_slice, *py_start, *py_stop;
5619 if (_py_slice) {
5620 py_slice = *_py_slice;
5621 } else {
5622 PyObject* owned_start = NULL;
5623 PyObject* owned_stop = NULL;
5624 if (_py_start) {
5625 py_start = *_py_start;
5626 } else {
5627 if (has_cstart) {
5628 owned_start = py_start = PyInt_FromSsize_t(cstart);
5629 if (unlikely(!py_start)) goto bad;
5630 } else
5631 py_start = Py_None;
5632 }
5633 if (_py_stop) {
5634 py_stop = *_py_stop;
5635 } else {
5636 if (has_cstop) {
5637 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
5638 if (unlikely(!py_stop)) {
5639 Py_XDECREF(owned_start);
5640 goto bad;
5641 }
5642 } else
5643 py_stop = Py_None;
5644 }
5645 py_slice = PySlice_New(py_start, py_stop, Py_None);
5646 Py_XDECREF(owned_start);
5647 Py_XDECREF(owned_stop);
5648 if (unlikely(!py_slice)) goto bad;
5649 }
5650 #if CYTHON_COMPILING_IN_CPYTHON
5651 result = mp->mp_subscript(obj, py_slice);
5652 #else
5653 result = PyObject_GetItem(obj, py_slice);
5654 #endif
5655 if (!_py_slice) {
5656 Py_DECREF(py_slice);
5657 }
5658 return result;
5659 }
5660 PyErr_Format(PyExc_TypeError,
5661 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
5662 bad:
5663 return NULL;
5664 }
5665
5666 /* Import */
5667 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5668 PyObject *empty_list = 0;
5669 PyObject *module = 0;
5670 PyObject *global_dict = 0;
5671 PyObject *empty_dict = 0;
5672 PyObject *list;
5673 #if PY_VERSION_HEX < 0x03030000
5674 PyObject *py_import;
5675 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5676 if (!py_import)
5677 goto bad;
5678 #endif
5679 if (from_list)
5680 list = from_list;
5681 else {
5682 empty_list = PyList_New(0);
5683 if (!empty_list)
5684 goto bad;
5685 list = empty_list;
5686 }
5687 global_dict = PyModule_GetDict(__pyx_m);
5688 if (!global_dict)
5689 goto bad;
5690 empty_dict = PyDict_New();
5691 if (!empty_dict)
5692 goto bad;
5693 {
5694 #if PY_MAJOR_VERSION >= 3
5695 if (level == -1) {
5696 if (strchr(__Pyx_MODULE_NAME, '.')) {
5697 #if PY_VERSION_HEX < 0x03030000
5698 PyObject *py_level = PyInt_FromLong(1);
5699 if (!py_level)
5700 goto bad;
5701 module = PyObject_CallFunctionObjArgs(py_import,
5702 name, global_dict, empty_dict, list, py_level, NULL);
5703 Py_DECREF(py_level);
5704 #else
5705 module = PyImport_ImportModuleLevelObject(
5706 name, global_dict, empty_dict, list, 1);
5707 #endif
5708 if (!module) {
5709 if (!PyErr_ExceptionMatches(PyExc_ImportError))
5710 goto bad;
5711 PyErr_Clear();
5712 }
5713 }
5714 level = 0;
5715 }
5716 #endif
5717 if (!module) {
5718 #if PY_VERSION_HEX < 0x03030000
5719 PyObject *py_level = PyInt_FromLong(level);
5720 if (!py_level)
5721 goto bad;
5722 module = PyObject_CallFunctionObjArgs(py_import,
5723 name, global_dict, empty_dict, list, py_level, NULL);
5724 Py_DECREF(py_level);
5725 #else
5726 module = PyImport_ImportModuleLevelObject(
5727 name, global_dict, empty_dict, list, level);
5728 #endif
5729 }
5730 }
5731 bad:
5732 #if PY_VERSION_HEX < 0x03030000
5733 Py_XDECREF(py_import);
5734 #endif
5735 Py_XDECREF(empty_list);
5736 Py_XDECREF(empty_dict);
5737 return module;
5738 }
5739
5740 /* ImportFrom */
5741 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
5742 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
5743 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
5744 PyErr_Format(PyExc_ImportError,
5745 #if PY_MAJOR_VERSION < 3
5746 "cannot import name %.230s", PyString_AS_STRING(name));
5747 #else
5748 "cannot import name %S", name);
5749 #endif
5750 }
5751 return value;
5752 }
5753
5754 /* CodeObjectCache */
5755 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5756 int start = 0, mid = 0, end = count - 1;
5757 if (end >= 0 && code_line > entries[end].code_line) {
5758 return count;
5759 }
5760 while (start < end) {
5761 mid = start + (end - start) / 2;
5762 if (code_line < entries[mid].code_line) {
5763 end = mid;
5764 } else if (code_line > entries[mid].code_line) {
5765 start = mid + 1;
5766 } else {
5767 return mid;
5768 }
5769 }
5770 if (code_line <= entries[mid].code_line) {
5771 return mid;
5772 } else {
5773 return mid + 1;
5774 }
5775 }
5776 static PyCodeObject *__pyx_find_code_object(int code_line) {
5777 PyCodeObject* code_object;
5778 int pos;
5779 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5780 return NULL;
5781 }
5782 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5783 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5784 return NULL;
5785 }
5786 code_object = __pyx_code_cache.entries[pos].code_object;
5787 Py_INCREF(code_object);
5788 return code_object;
5789 }
5790 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5791 int pos, i;
5792 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5793 if (unlikely(!code_line)) {
5794 return;
5795 }
5796 if (unlikely(!entries)) {
5797 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5798 if (likely(entries)) {
5799 __pyx_code_cache.entries = entries;
5800 __pyx_code_cache.max_count = 64;
5801 __pyx_code_cache.count = 1;
5802 entries[0].code_line = code_line;
5803 entries[0].code_object = code_object;
5804 Py_INCREF(code_object);
5805 }
5806 return;
5807 }
5808 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5809 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5810 PyCodeObject* tmp = entries[pos].code_object;
5811 entries[pos].code_object = code_object;
5812 Py_DECREF(tmp);
5813 return;
5814 }
5815 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5816 int new_max = __pyx_code_cache.max_count + 64;
5817 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5818 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
5819 if (unlikely(!entries)) {
5820 return;
5821 }
5822 __pyx_code_cache.entries = entries;
5823 __pyx_code_cache.max_count = new_max;
5824 }
5825 for (i=__pyx_code_cache.count; i>pos; i--) {
5826 entries[i] = entries[i-1];
5827 }
5828 entries[pos].code_line = code_line;
5829 entries[pos].code_object = code_object;
5830 __pyx_code_cache.count++;
5831 Py_INCREF(code_object);
5832 }
5833
5834 /* AddTraceback */
5835 #include "compile.h"
5836 #include "frameobject.h"
5837 #include "traceback.h"
5838 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5839 const char *funcname, int c_line,
5840 int py_line, const char *filename) {
5841 PyCodeObject *py_code = 0;
5842 PyObject *py_srcfile = 0;
5843 PyObject *py_funcname = 0;
5844 #if PY_MAJOR_VERSION < 3
5845 py_srcfile = PyString_FromString(filename);
5846 #else
5847 py_srcfile = PyUnicode_FromString(filename);
5848 #endif
5849 if (!py_srcfile) goto bad;
5850 if (c_line) {
5851 #if PY_MAJOR_VERSION < 3
5852 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5853 #else
5854 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5855 #endif
5856 }
5857 else {
5858 #if PY_MAJOR_VERSION < 3
5859 py_funcname = PyString_FromString(funcname);
5860 #else
5861 py_funcname = PyUnicode_FromString(funcname);
5862 #endif
5863 }
5864 if (!py_funcname) goto bad;
5865 py_code = __Pyx_PyCode_New(
5866 0,
5867 0,
5868 0,
5869 0,
5870 0,
5871 __pyx_empty_bytes, /*PyObject *code,*/
5872 __pyx_empty_tuple, /*PyObject *consts,*/
5873 __pyx_empty_tuple, /*PyObject *names,*/
5874 __pyx_empty_tuple, /*PyObject *varnames,*/
5875 __pyx_empty_tuple, /*PyObject *freevars,*/
5876 __pyx_empty_tuple, /*PyObject *cellvars,*/
5877 py_srcfile, /*PyObject *filename,*/
5878 py_funcname, /*PyObject *name,*/
5879 py_line,
5880 __pyx_empty_bytes /*PyObject *lnotab*/
5881 );
5882 Py_DECREF(py_srcfile);
5883 Py_DECREF(py_funcname);
5884 return py_code;
5885 bad:
5886 Py_XDECREF(py_srcfile);
5887 Py_XDECREF(py_funcname);
5888 return NULL;
5889 }
5890 static void __Pyx_AddTraceback(const char *funcname, int c_line,
5891 int py_line, const char *filename) {
5892 PyCodeObject *py_code = 0;
5893 PyFrameObject *py_frame = 0;
5894 py_code = __pyx_find_code_object(c_line ? c_line : py_line);
5895 if (!py_code) {
5896 py_code = __Pyx_CreateCodeObjectForTraceback(
5897 funcname, c_line, py_line, filename);
5898 if (!py_code) goto bad;
5899 __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
5900 }
5901 py_frame = PyFrame_New(
5902 PyThreadState_GET(), /*PyThreadState *tstate,*/
5903 py_code, /*PyCodeObject *code,*/
5904 __pyx_d, /*PyObject *globals,*/
5905 0 /*PyObject *locals*/
5906 );
5907 if (!py_frame) goto bad;
5908 py_frame->f_lineno = py_line;
5909 PyTraceBack_Here(py_frame);
5910 bad:
5911 Py_XDECREF(py_code);
5912 Py_XDECREF(py_frame);
5913 }
5914
5915 /* CIntFromPyVerify */
5916 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
5917 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
5918 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
5919 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
5920 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
5921 {\
5922 func_type value = func_value;\
5923 if (sizeof(target_type) < sizeof(func_type)) {\
5924 if (unlikely(value != (func_type) (target_type) value)) {\
5925 func_type zero = 0;\
5926 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
5927 return (target_type) -1;\
5928 if (is_unsigned && unlikely(value < zero))\
5929 goto raise_neg_overflow;\
5930 else\
5931 goto raise_overflow;\
5932 }\
5933 }\
5934 return (target_type) value;\
5935 }
5936
5937 /* CIntToPy */
5938 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
5939 const long neg_one = (long) -1, const_zero = (long) 0;
5940 const int is_unsigned = neg_one > const_zero;
5941 if (is_unsigned) {
5942 if (sizeof(long) < sizeof(long)) {
5943 return PyInt_FromLong((long) value);
5944 } else if (sizeof(long) <= sizeof(unsigned long)) {
5945 return PyLong_FromUnsignedLong((unsigned long) value);
5946 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
5947 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5948 }
5949 } else {
5950 if (sizeof(long) <= sizeof(long)) {
5951 return PyInt_FromLong((long) value);
5952 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
5953 return PyLong_FromLongLong((PY_LONG_LONG) value);
5954 }
5955 }
5956 {
5957 int one = 1; int little = (int)*(unsigned char *)&one;
5958 unsigned char *bytes = (unsigned char *)&value;
5959 return _PyLong_FromByteArray(bytes, sizeof(long),
5960 little, !is_unsigned);
5961 }
5962 }
5963
5964 /* CIntToPy */
5965 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
5966 const int neg_one = (int) -1, const_zero = (int) 0;
5967 const int is_unsigned = neg_one > const_zero;
5968 if (is_unsigned) {
5969 if (sizeof(int) < sizeof(long)) {
5970 return PyInt_FromLong((long) value);
5971 } else if (sizeof(int) <= sizeof(unsigned long)) {
5972 return PyLong_FromUnsignedLong((unsigned long) value);
5973 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
5974 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5975 }
5976 } else {
5977 if (sizeof(int) <= sizeof(long)) {
5978 return PyInt_FromLong((long) value);
5979 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
5980 return PyLong_FromLongLong((PY_LONG_LONG) value);
5981 }
5982 }
5983 {
5984 int one = 1; int little = (int)*(unsigned char *)&one;
5985 unsigned char *bytes = (unsigned char *)&value;
5986 return _PyLong_FromByteArray(bytes, sizeof(int),
5987 little, !is_unsigned);
5988 }
5989 }
5990
5991 /* CIntFromPy */
5992 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
5993 const int neg_one = (int) -1, const_zero = (int) 0;
5994 const int is_unsigned = neg_one > const_zero;
5995 #if PY_MAJOR_VERSION < 3
5996 if (likely(PyInt_Check(x))) {
5997 if (sizeof(int) < sizeof(long)) {
5998 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
5999 } else {
6000 long val = PyInt_AS_LONG(x);
6001 if (is_unsigned && unlikely(val < 0)) {
6002 goto raise_neg_overflow;
6003 }
6004 return (int) val;
6005 }
6006 } else
6007 #endif
6008 if (likely(PyLong_Check(x))) {
6009 if (is_unsigned) {
6010 #if CYTHON_USE_PYLONG_INTERNALS
6011 const digit* digits = ((PyLongObject*)x)->ob_digit;
6012 switch (Py_SIZE(x)) {
6013 case 0: return (int) 0;
6014 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
6015 case 2:
6016 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6017 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6018 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6019 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
6020 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6021 }
6022 }
6023 break;
6024 case 3:
6025 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6026 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6027 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6028 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
6029 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6030 }
6031 }
6032 break;
6033 case 4:
6034 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6035 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6036 __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])))
6037 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
6038 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6039 }
6040 }
6041 break;
6042 }
6043 #endif
6044 #if CYTHON_COMPILING_IN_CPYTHON
6045 if (unlikely(Py_SIZE(x) < 0)) {
6046 goto raise_neg_overflow;
6047 }
6048 #else
6049 {
6050 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6051 if (unlikely(result < 0))
6052 return (int) -1;
6053 if (unlikely(result == 1))
6054 goto raise_neg_overflow;
6055 }
6056 #endif
6057 if (sizeof(int) <= sizeof(unsigned long)) {
6058 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6059 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6060 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6061 }
6062 } else {
6063 #if CYTHON_USE_PYLONG_INTERNALS
6064 const digit* digits = ((PyLongObject*)x)->ob_digit;
6065 switch (Py_SIZE(x)) {
6066 case 0: return (int) 0;
6067 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
6068 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
6069 case -2:
6070 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
6071 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6072 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6073 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6074 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6075 }
6076 }
6077 break;
6078 case 2:
6079 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6080 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6081 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6082 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6083 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6084 }
6085 }
6086 break;
6087 case -3:
6088 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6089 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6090 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6091 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6092 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6093 }
6094 }
6095 break;
6096 case 3:
6097 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6098 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6099 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6100 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6101 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6102 }
6103 }
6104 break;
6105 case -4:
6106 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6107 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6108 __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])))
6109 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6110 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6111 }
6112 }
6113 break;
6114 case 4:
6115 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6116 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6117 __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])))
6118 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6119 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6120 }
6121 }
6122 break;
6123 }
6124 #endif
6125 if (sizeof(int) <= sizeof(long)) {
6126 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6127 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6128 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6129 }
6130 }
6131 {
6132 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6133 PyErr_SetString(PyExc_RuntimeError,
6134 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6135 #else
6136 int val;
6137 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6138 #if PY_MAJOR_VERSION < 3
6139 if (likely(v) && !PyLong_Check(v)) {
6140 PyObject *tmp = v;
6141 v = PyNumber_Long(tmp);
6142 Py_DECREF(tmp);
6143 }
6144 #endif
6145 if (likely(v)) {
6146 int one = 1; int is_little = (int)*(unsigned char *)&one;
6147 unsigned char *bytes = (unsigned char *)&val;
6148 int ret = _PyLong_AsByteArray((PyLongObject *)v,
6149 bytes, sizeof(val),
6150 is_little, !is_unsigned);
6151 Py_DECREF(v);
6152 if (likely(!ret))
6153 return val;
6154 }
6155 #endif
6156 return (int) -1;
6157 }
6158 } else {
6159 int val;
6160 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6161 if (!tmp) return (int) -1;
6162 val = __Pyx_PyInt_As_int(tmp);
6163 Py_DECREF(tmp);
6164 return val;
6165 }
6166 raise_overflow:
6167 PyErr_SetString(PyExc_OverflowError,
6168 "value too large to convert to int");
6169 return (int) -1;
6170 raise_neg_overflow:
6171 PyErr_SetString(PyExc_OverflowError,
6172 "can't convert negative value to int");
6173 return (int) -1;
6174 }
6175
6176 /* CIntFromPy */
6177 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
6178 const long neg_one = (long) -1, const_zero = (long) 0;
6179 const int is_unsigned = neg_one > const_zero;
6180 #if PY_MAJOR_VERSION < 3
6181 if (likely(PyInt_Check(x))) {
6182 if (sizeof(long) < sizeof(long)) {
6183 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
6184 } else {
6185 long val = PyInt_AS_LONG(x);
6186 if (is_unsigned && unlikely(val < 0)) {
6187 goto raise_neg_overflow;
6188 }
6189 return (long) val;
6190 }
6191 } else
6192 #endif
6193 if (likely(PyLong_Check(x))) {
6194 if (is_unsigned) {
6195 #if CYTHON_USE_PYLONG_INTERNALS
6196 const digit* digits = ((PyLongObject*)x)->ob_digit;
6197 switch (Py_SIZE(x)) {
6198 case 0: return (long) 0;
6199 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
6200 case 2:
6201 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6202 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6203 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6204 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
6205 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6206 }
6207 }
6208 break;
6209 case 3:
6210 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6211 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6212 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6213 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
6214 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6215 }
6216 }
6217 break;
6218 case 4:
6219 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6220 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6221 __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])))
6222 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
6223 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6224 }
6225 }
6226 break;
6227 }
6228 #endif
6229 #if CYTHON_COMPILING_IN_CPYTHON
6230 if (unlikely(Py_SIZE(x) < 0)) {
6231 goto raise_neg_overflow;
6232 }
6233 #else
6234 {
6235 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6236 if (unlikely(result < 0))
6237 return (long) -1;
6238 if (unlikely(result == 1))
6239 goto raise_neg_overflow;
6240 }
6241 #endif
6242 if (sizeof(long) <= sizeof(unsigned long)) {
6243 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6244 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6245 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6246 }
6247 } else {
6248 #if CYTHON_USE_PYLONG_INTERNALS
6249 const digit* digits = ((PyLongObject*)x)->ob_digit;
6250 switch (Py_SIZE(x)) {
6251 case 0: return (long) 0;
6252 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
6253 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
6254 case -2:
6255 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
6256 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6257 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6258 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6259 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6260 }
6261 }
6262 break;
6263 case 2:
6264 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6265 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6266 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6267 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6268 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6269 }
6270 }
6271 break;
6272 case -3:
6273 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6274 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6275 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6276 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6277 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6278 }
6279 }
6280 break;
6281 case 3:
6282 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6283 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6284 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6285 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6286 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6287 }
6288 }
6289 break;
6290 case -4:
6291 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6292 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6293 __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])))
6294 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6295 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6296 }
6297 }
6298 break;
6299 case 4:
6300 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6301 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6302 __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])))
6303 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6304 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6305 }
6306 }
6307 break;
6308 }
6309 #endif
6310 if (sizeof(long) <= sizeof(long)) {
6311 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6312 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6313 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6314 }
6315 }
6316 {
6317 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6318 PyErr_SetString(PyExc_RuntimeError,
6319 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6320 #else
6321 long val;
6322 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6323 #if PY_MAJOR_VERSION < 3
6324 if (likely(v) && !PyLong_Check(v)) {
6325 PyObject *tmp = v;
6326 v = PyNumber_Long(tmp);
6327 Py_DECREF(tmp);
6328 }
6329 #endif
6330 if (likely(v)) {
6331 int one = 1; int is_little = (int)*(unsigned char *)&one;
6332 unsigned char *bytes = (unsigned char *)&val;
6333 int ret = _PyLong_AsByteArray((PyLongObject *)v,
6334 bytes, sizeof(val),
6335 is_little, !is_unsigned);
6336 Py_DECREF(v);
6337 if (likely(!ret))
6338 return val;
6339 }
6340 #endif
6341 return (long) -1;
6342 }
6343 } else {
6344 long val;
6345 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6346 if (!tmp) return (long) -1;
6347 val = __Pyx_PyInt_As_long(tmp);
6348 Py_DECREF(tmp);
6349 return val;
6350 }
6351 raise_overflow:
6352 PyErr_SetString(PyExc_OverflowError,
6353 "value too large to convert to long");
6354 return (long) -1;
6355 raise_neg_overflow:
6356 PyErr_SetString(PyExc_OverflowError,
6357 "can't convert negative value to long");
6358 return (long) -1;
6359 }
6360
6361 /* FetchCommonType */
6362 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
6363 PyObject* fake_module;
6364 PyTypeObject* cached_type = NULL;
6365 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
6366 if (!fake_module) return NULL;
6367 Py_INCREF(fake_module);
6368 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
6369 if (cached_type) {
6370 if (!PyType_Check((PyObject*)cached_type)) {
6371 PyErr_Format(PyExc_TypeError,
6372 "Shared Cython type %.200s is not a type object",
6373 type->tp_name);
6374 goto bad;
6375 }
6376 if (cached_type->tp_basicsize != type->tp_basicsize) {
6377 PyErr_Format(PyExc_TypeError,
6378 "Shared Cython type %.200s has the wrong size, try recompiling",
6379 type->tp_name);
6380 goto bad;
6381 }
6382 } else {
6383 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
6384 PyErr_Clear();
6385 if (PyType_Ready(type) < 0) goto bad;
6386 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
6387 goto bad;
6388 Py_INCREF(type);
6389 cached_type = type;
6390 }
6391 done:
6392 Py_DECREF(fake_module);
6393 return cached_type;
6394 bad:
6395 Py_XDECREF(cached_type);
6396 cached_type = NULL;
6397 goto done;
6398 }
6399
6400 /* PyErrFetchRestore */
6401 #if CYTHON_COMPILING_IN_CPYTHON
6402 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6403 PyObject *tmp_type, *tmp_value, *tmp_tb;
6404 tmp_type = tstate->curexc_type;
6405 tmp_value = tstate->curexc_value;
6406 tmp_tb = tstate->curexc_traceback;
6407 tstate->curexc_type = type;
6408 tstate->curexc_value = value;
6409 tstate->curexc_traceback = tb;
6410 Py_XDECREF(tmp_type);
6411 Py_XDECREF(tmp_value);
6412 Py_XDECREF(tmp_tb);
6413 }
6414 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6415 *type = tstate->curexc_type;
6416 *value = tstate->curexc_value;
6417 *tb = tstate->curexc_traceback;
6418 tstate->curexc_type = 0;
6419 tstate->curexc_value = 0;
6420 tstate->curexc_traceback = 0;
6421 }
6422 #endif
6423
6424 /* RaiseException */
6425 #if PY_MAJOR_VERSION < 3
6426 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6427 CYTHON_UNUSED PyObject *cause) {
6428 __Pyx_PyThreadState_declare
6429 Py_XINCREF(type);
6430 if (!value || value == Py_None)
6431 value = NULL;
6432 else
6433 Py_INCREF(value);
6434 if (!tb || tb == Py_None)
6435 tb = NULL;
6436 else {
6437 Py_INCREF(tb);
6438 if (!PyTraceBack_Check(tb)) {
6439 PyErr_SetString(PyExc_TypeError,
6440 "raise: arg 3 must be a traceback or None");
6441 goto raise_error;
6442 }
6443 }
6444 if (PyType_Check(type)) {
6445 #if CYTHON_COMPILING_IN_PYPY
6446 if (!value) {
6447 Py_INCREF(Py_None);
6448 value = Py_None;
6449 }
6450 #endif
6451 PyErr_NormalizeException(&type, &value, &tb);
6452 } else {
6453 if (value) {
6454 PyErr_SetString(PyExc_TypeError,
6455 "instance exception may not have a separate value");
6456 goto raise_error;
6457 }
6458 value = type;
6459 type = (PyObject*) Py_TYPE(type);
6460 Py_INCREF(type);
6461 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6462 PyErr_SetString(PyExc_TypeError,
6463 "raise: exception class must be a subclass of BaseException");
6464 goto raise_error;
6465 }
6466 }
6467 __Pyx_PyThreadState_assign
6468 __Pyx_ErrRestore(type, value, tb);
6469 return;
6470 raise_error:
6471 Py_XDECREF(value);
6472 Py_XDECREF(type);
6473 Py_XDECREF(tb);
6474 return;
6475 }
6476 #else
6477 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6478 PyObject* owned_instance = NULL;
6479 if (tb == Py_None) {
6480 tb = 0;
6481 } else if (tb && !PyTraceBack_Check(tb)) {
6482 PyErr_SetString(PyExc_TypeError,
6483 "raise: arg 3 must be a traceback or None");
6484 goto bad;
6485 }
6486 if (value == Py_None)
6487 value = 0;
6488 if (PyExceptionInstance_Check(type)) {
6489 if (value) {
6490 PyErr_SetString(PyExc_TypeError,
6491 "instance exception may not have a separate value");
6492 goto bad;
6493 }
6494 value = type;
6495 type = (PyObject*) Py_TYPE(value);
6496 } else if (PyExceptionClass_Check(type)) {
6497 PyObject *instance_class = NULL;
6498 if (value && PyExceptionInstance_Check(value)) {
6499 instance_class = (PyObject*) Py_TYPE(value);
6500 if (instance_class != type) {
6501 int is_subclass = PyObject_IsSubclass(instance_class, type);
6502 if (!is_subclass) {
6503 instance_class = NULL;
6504 } else if (unlikely(is_subclass == -1)) {
6505 goto bad;
6506 } else {
6507 type = instance_class;
6508 }
6509 }
6510 }
6511 if (!instance_class) {
6512 PyObject *args;
6513 if (!value)
6514 args = PyTuple_New(0);
6515 else if (PyTuple_Check(value)) {
6516 Py_INCREF(value);
6517 args = value;
6518 } else
6519 args = PyTuple_Pack(1, value);
6520 if (!args)
6521 goto bad;
6522 owned_instance = PyObject_Call(type, args, NULL);
6523 Py_DECREF(args);
6524 if (!owned_instance)
6525 goto bad;
6526 value = owned_instance;
6527 if (!PyExceptionInstance_Check(value)) {
6528 PyErr_Format(PyExc_TypeError,
6529 "calling %R should have returned an instance of "
6530 "BaseException, not %R",
6531 type, Py_TYPE(value));
6532 goto bad;
6533 }
6534 }
6535 } else {
6536 PyErr_SetString(PyExc_TypeError,
6537 "raise: exception class must be a subclass of BaseException");
6538 goto bad;
6539 }
6540 #if PY_VERSION_HEX >= 0x03030000
6541 if (cause) {
6542 #else
6543 if (cause && cause != Py_None) {
6544 #endif
6545 PyObject *fixed_cause;
6546 if (cause == Py_None) {
6547 fixed_cause = NULL;
6548 } else if (PyExceptionClass_Check(cause)) {
6549 fixed_cause = PyObject_CallObject(cause, NULL);
6550 if (fixed_cause == NULL)
6551 goto bad;
6552 } else if (PyExceptionInstance_Check(cause)) {
6553 fixed_cause = cause;
6554 Py_INCREF(fixed_cause);
6555 } else {
6556 PyErr_SetString(PyExc_TypeError,
6557 "exception causes must derive from "
6558 "BaseException");
6559 goto bad;
6560 }
6561 PyException_SetCause(value, fixed_cause);
6562 }
6563 PyErr_SetObject(type, value);
6564 if (tb) {
6565 #if CYTHON_COMPILING_IN_PYPY
6566 PyObject *tmp_type, *tmp_value, *tmp_tb;
6567 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6568 Py_INCREF(tb);
6569 PyErr_Restore(tmp_type, tmp_value, tb);
6570 Py_XDECREF(tmp_tb);
6571 #else
6572 PyThreadState *tstate = PyThreadState_GET();
6573 PyObject* tmp_tb = tstate->curexc_traceback;
6574 if (tb != tmp_tb) {
6575 Py_INCREF(tb);
6576 tstate->curexc_traceback = tb;
6577 Py_XDECREF(tmp_tb);
6578 }
6579 #endif
6580 }
6581 bad:
6582 Py_XDECREF(owned_instance);
6583 return;
6584 }
6585 #endif
6586
6587 /* SwapException */
6588 #if CYTHON_COMPILING_IN_CPYTHON
6589 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6590 PyObject *tmp_type, *tmp_value, *tmp_tb;
6591 tmp_type = tstate->exc_type;
6592 tmp_value = tstate->exc_value;
6593 tmp_tb = tstate->exc_traceback;
6594 tstate->exc_type = *type;
6595 tstate->exc_value = *value;
6596 tstate->exc_traceback = *tb;
6597 *type = tmp_type;
6598 *value = tmp_value;
6599 *tb = tmp_tb;
6600 }
6601 #else
6602 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
6603 PyObject *tmp_type, *tmp_value, *tmp_tb;
6604 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
6605 PyErr_SetExcInfo(*type, *value, *tb);
6606 *type = tmp_type;
6607 *value = tmp_value;
6608 *tb = tmp_tb;
6609 }
6610 #endif
6611
6612 /* PyObjectCallMethod1 */
6613 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
6614 PyObject *method, *result = NULL;
6615 method = __Pyx_PyObject_GetAttrStr(obj, method_name);
6616 if (unlikely(!method)) goto bad;
6617 #if CYTHON_COMPILING_IN_CPYTHON
6618 if (likely(PyMethod_Check(method))) {
6619 PyObject *self = PyMethod_GET_SELF(method);
6620 if (likely(self)) {
6621 PyObject *args;
6622 PyObject *function = PyMethod_GET_FUNCTION(method);
6623 args = PyTuple_New(2);
6624 if (unlikely(!args)) goto bad;
6625 Py_INCREF(self);
6626 PyTuple_SET_ITEM(args, 0, self);
6627 Py_INCREF(arg);
6628 PyTuple_SET_ITEM(args, 1, arg);
6629 Py_INCREF(function);
6630 Py_DECREF(method); method = NULL;
6631 result = __Pyx_PyObject_Call(function, args, NULL);
6632 Py_DECREF(args);
6633 Py_DECREF(function);
6634 return result;
6635 }
6636 }
6637 #endif
6638 result = __Pyx_PyObject_CallOneArg(method, arg);
6639 bad:
6640 Py_XDECREF(method);
6641 return result;
6642 }
6643
6644 /* CoroutineBase */
6645 #include <structmember.h>
6646 #include <frameobject.h>
6647 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
6648 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
6649 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
6650 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
6651 #if 1 || PY_VERSION_HEX < 0x030300B0
6652 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
6653 PyObject *et, *ev, *tb;
6654 PyObject *value = NULL;
6655 __Pyx_PyThreadState_declare
6656 __Pyx_PyThreadState_assign
6657 __Pyx_ErrFetch(&et, &ev, &tb);
6658 if (!et) {
6659 Py_XDECREF(tb);
6660 Py_XDECREF(ev);
6661 Py_INCREF(Py_None);
6662 *pvalue = Py_None;
6663 return 0;
6664 }
6665 if (likely(et == PyExc_StopIteration)) {
6666 #if PY_VERSION_HEX >= 0x030300A0
6667 if (ev && Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
6668 value = ((PyStopIterationObject *)ev)->value;
6669 Py_INCREF(value);
6670 Py_DECREF(ev);
6671 Py_XDECREF(tb);
6672 Py_DECREF(et);
6673 *pvalue = value;
6674 return 0;
6675 }
6676 #endif
6677 if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
6678 if (!ev) {
6679 Py_INCREF(Py_None);
6680 ev = Py_None;
6681 } else if (PyTuple_Check(ev)) {
6682 if (PyTuple_GET_SIZE(ev) >= 1) {
6683 PyObject *value;
6684 #if CYTHON_COMPILING_IN_CPYTHON
6685 value = PySequence_ITEM(ev, 0);
6686 #else
6687 value = PyTuple_GET_ITEM(ev, 0);
6688 Py_INCREF(value);
6689 #endif
6690 Py_DECREF(ev);
6691 ev = value;
6692 } else {
6693 Py_INCREF(Py_None);
6694 Py_DECREF(ev);
6695 ev = Py_None;
6696 }
6697 }
6698 Py_XDECREF(tb);
6699 Py_DECREF(et);
6700 *pvalue = ev;
6701 return 0;
6702 }
6703 } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
6704 __Pyx_ErrRestore(et, ev, tb);
6705 return -1;
6706 }
6707 PyErr_NormalizeException(&et, &ev, &tb);
6708 if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
6709 __Pyx_ErrRestore(et, ev, tb);
6710 return -1;
6711 }
6712 Py_XDECREF(tb);
6713 Py_DECREF(et);
6714 #if PY_VERSION_HEX >= 0x030300A0
6715 value = ((PyStopIterationObject *)ev)->value;
6716 Py_INCREF(value);
6717 Py_DECREF(ev);
6718 #else
6719 {
6720 PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
6721 Py_DECREF(ev);
6722 if (likely(args)) {
6723 value = PySequence_GetItem(args, 0);
6724 Py_DECREF(args);
6725 }
6726 if (unlikely(!value)) {
6727 __Pyx_ErrRestore(NULL, NULL, NULL);
6728 Py_INCREF(Py_None);
6729 value = Py_None;
6730 }
6731 }
6732 #endif
6733 *pvalue = value;
6734 return 0;
6735 }
6736 #endif
6737 static CYTHON_INLINE
6738 void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
6739 PyObject *exc_type = self->exc_type;
6740 PyObject *exc_value = self->exc_value;
6741 PyObject *exc_traceback = self->exc_traceback;
6742 self->exc_type = NULL;
6743 self->exc_value = NULL;
6744 self->exc_traceback = NULL;
6745 Py_XDECREF(exc_type);
6746 Py_XDECREF(exc_value);
6747 Py_XDECREF(exc_traceback);
6748 }
6749 static CYTHON_INLINE
6750 int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) {
6751 if (unlikely(gen->is_running)) {
6752 PyErr_SetString(PyExc_ValueError,
6753 "generator already executing");
6754 return 1;
6755 }
6756 return 0;
6757 }
6758 static CYTHON_INLINE
6759 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) {
6760 PyObject *retval;
6761 __Pyx_PyThreadState_declare
6762 assert(!self->is_running);
6763 if (unlikely(self->resume_label == 0)) {
6764 if (unlikely(value && value != Py_None)) {
6765 PyErr_SetString(PyExc_TypeError,
6766 "can't send non-None value to a "
6767 "just-started generator");
6768 return NULL;
6769 }
6770 }
6771 if (unlikely(self->resume_label == -1)) {
6772 PyErr_SetNone(PyExc_StopIteration);
6773 return NULL;
6774 }
6775 __Pyx_PyThreadState_assign
6776 if (value) {
6777 #if CYTHON_COMPILING_IN_PYPY
6778 #else
6779 if (self->exc_traceback) {
6780 PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
6781 PyFrameObject *f = tb->tb_frame;
6782 Py_XINCREF(__pyx_tstate->frame);
6783 assert(f->f_back == NULL);
6784 f->f_back = __pyx_tstate->frame;
6785 }
6786 #endif
6787 __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
6788 &self->exc_traceback);
6789 } else {
6790 __Pyx_Coroutine_ExceptionClear(self);
6791 }
6792 self->is_running = 1;
6793 retval = self->body((PyObject *) self, value);
6794 self->is_running = 0;
6795 if (retval) {
6796 __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
6797 &self->exc_traceback);
6798 #if CYTHON_COMPILING_IN_PYPY
6799 #else
6800 if (self->exc_traceback) {
6801 PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
6802 PyFrameObject *f = tb->tb_frame;
6803 Py_CLEAR(f->f_back);
6804 }
6805 #endif
6806 } else {
6807 __Pyx_Coroutine_ExceptionClear(self);
6808 }
6809 return retval;
6810 }
6811 static CYTHON_INLINE
6812 PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) {
6813 if (unlikely(!retval && !PyErr_Occurred())) {
6814 PyErr_SetNone(PyExc_StopIteration);
6815 }
6816 return retval;
6817 }
6818 static CYTHON_INLINE
6819 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
6820 PyObject *ret;
6821 PyObject *val = NULL;
6822 __Pyx_Coroutine_Undelegate(gen);
6823 __Pyx_PyGen_FetchStopIterationValue(&val);
6824 ret = __Pyx_Coroutine_SendEx(gen, val);
6825 Py_XDECREF(val);
6826 return ret;
6827 }
6828 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
6829 PyObject *retval;
6830 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
6831 PyObject *yf = gen->yieldfrom;
6832 if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
6833 return NULL;
6834 if (yf) {
6835 PyObject *ret;
6836 gen->is_running = 1;
6837 #ifdef __Pyx_Generator_USED
6838 if (__Pyx_Generator_CheckExact(yf)) {
6839 ret = __Pyx_Coroutine_Send(yf, value);
6840 } else
6841 #endif
6842 #ifdef __Pyx_Coroutine_USED
6843 if (__Pyx_Coroutine_CheckExact(yf)) {
6844 ret = __Pyx_Coroutine_Send(yf, value);
6845 } else
6846 #endif
6847 {
6848 if (value == Py_None)
6849 ret = Py_TYPE(yf)->tp_iternext(yf);
6850 else
6851 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
6852 }
6853 gen->is_running = 0;
6854 if (likely(ret)) {
6855 return ret;
6856 }
6857 retval = __Pyx_Coroutine_FinishDelegation(gen);
6858 } else {
6859 retval = __Pyx_Coroutine_SendEx(gen, value);
6860 }
6861 return __Pyx_Coroutine_MethodReturn(retval);
6862 }
6863 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
6864 PyObject *retval = NULL;
6865 int err = 0;
6866 #ifdef __Pyx_Generator_USED
6867 if (__Pyx_Generator_CheckExact(yf)) {
6868 retval = __Pyx_Coroutine_Close(yf);
6869 if (!retval)
6870 return -1;
6871 } else
6872 #endif
6873 #ifdef __Pyx_Coroutine_USED
6874 if (__Pyx_Coroutine_CheckExact(yf)) {
6875 retval = __Pyx_Coroutine_Close(yf);
6876 if (!retval)
6877 return -1;
6878 } else
6879 #endif
6880 {
6881 PyObject *meth;
6882 gen->is_running = 1;
6883 meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
6884 if (unlikely(!meth)) {
6885 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
6886 PyErr_WriteUnraisable(yf);
6887 }
6888 PyErr_Clear();
6889 } else {
6890 retval = PyObject_CallFunction(meth, NULL);
6891 Py_DECREF(meth);
6892 if (!retval)
6893 err = -1;
6894 }
6895 gen->is_running = 0;
6896 }
6897 Py_XDECREF(retval);
6898 return err;
6899 }
6900 static PyObject *__Pyx_Generator_Next(PyObject *self) {
6901 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
6902 PyObject *yf = gen->yieldfrom;
6903 if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
6904 return NULL;
6905 if (yf) {
6906 PyObject *ret;
6907 gen->is_running = 1;
6908 ret = Py_TYPE(yf)->tp_iternext(yf);
6909 gen->is_running = 0;
6910 if (likely(ret)) {
6911 return ret;
6912 }
6913 return __Pyx_Coroutine_FinishDelegation(gen);
6914 }
6915 return __Pyx_Coroutine_SendEx(gen, Py_None);
6916 }
6917 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
6918 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
6919 PyObject *retval, *raised_exception;
6920 PyObject *yf = gen->yieldfrom;
6921 int err = 0;
6922 if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
6923 return NULL;
6924 if (yf) {
6925 Py_INCREF(yf);
6926 err = __Pyx_Coroutine_CloseIter(gen, yf);
6927 __Pyx_Coroutine_Undelegate(gen);
6928 Py_DECREF(yf);
6929 }
6930 if (err == 0)
6931 PyErr_SetNone(PyExc_GeneratorExit);
6932 retval = __Pyx_Coroutine_SendEx(gen, NULL);
6933 if (retval) {
6934 Py_DECREF(retval);
6935 PyErr_SetString(PyExc_RuntimeError,
6936 "generator ignored GeneratorExit");
6937 return NULL;
6938 }
6939 raised_exception = PyErr_Occurred();
6940 if (!raised_exception
6941 || raised_exception == PyExc_StopIteration
6942 || raised_exception == PyExc_GeneratorExit
6943 || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
6944 || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
6945 {
6946 if (raised_exception) PyErr_Clear();
6947 Py_INCREF(Py_None);
6948 return Py_None;
6949 }
6950 return NULL;
6951 }
6952 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
6953 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
6954 PyObject *typ;
6955 PyObject *tb = NULL;
6956 PyObject *val = NULL;
6957 PyObject *yf = gen->yieldfrom;
6958 if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
6959 return NULL;
6960 if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
6961 return NULL;
6962 if (yf) {
6963 PyObject *ret;
6964 Py_INCREF(yf);
6965 if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
6966 int err = __Pyx_Coroutine_CloseIter(gen, yf);
6967 Py_DECREF(yf);
6968 __Pyx_Coroutine_Undelegate(gen);
6969 if (err < 0)
6970 return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
6971 goto throw_here;
6972 }
6973 gen->is_running = 1;
6974 #ifdef __Pyx_Generator_USED
6975 if (__Pyx_Generator_CheckExact(yf)) {
6976 ret = __Pyx_Coroutine_Throw(yf, args);
6977 } else
6978 #endif
6979 #ifdef __Pyx_Coroutine_USED
6980 if (__Pyx_Coroutine_CheckExact(yf)) {
6981 ret = __Pyx_Coroutine_Throw(yf, args);
6982 } else
6983 #endif
6984 {
6985 PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
6986 if (unlikely(!meth)) {
6987 Py_DECREF(yf);
6988 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
6989 gen->is_running = 0;
6990 return NULL;
6991 }
6992 PyErr_Clear();
6993 __Pyx_Coroutine_Undelegate(gen);
6994 gen->is_running = 0;
6995 goto throw_here;
6996 }
6997 ret = PyObject_CallObject(meth, args);
6998 Py_DECREF(meth);
6999 }
7000 gen->is_running = 0;
7001 Py_DECREF(yf);
7002 if (!ret) {
7003 ret = __Pyx_Coroutine_FinishDelegation(gen);
7004 }
7005 return __Pyx_Coroutine_MethodReturn(ret);
7006 }
7007 throw_here:
7008 __Pyx_Raise(typ, val, tb, NULL);
7009 return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
7010 }
7011 static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) {
7012 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
7013 Py_VISIT(gen->closure);
7014 Py_VISIT(gen->classobj);
7015 Py_VISIT(gen->yieldfrom);
7016 Py_VISIT(gen->exc_type);
7017 Py_VISIT(gen->exc_value);
7018 Py_VISIT(gen->exc_traceback);
7019 return 0;
7020 }
7021 static int __Pyx_Coroutine_clear(PyObject *self) {
7022 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
7023 Py_CLEAR(gen->closure);
7024 Py_CLEAR(gen->classobj);
7025 Py_CLEAR(gen->yieldfrom);
7026 Py_CLEAR(gen->exc_type);
7027 Py_CLEAR(gen->exc_value);
7028 Py_CLEAR(gen->exc_traceback);
7029 Py_CLEAR(gen->gi_name);
7030 Py_CLEAR(gen->gi_qualname);
7031 return 0;
7032 }
7033 static void __Pyx_Coroutine_dealloc(PyObject *self) {
7034 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
7035 PyObject_GC_UnTrack(gen);
7036 if (gen->gi_weakreflist != NULL)
7037 PyObject_ClearWeakRefs(self);
7038 if (gen->resume_label > 0) {
7039 PyObject_GC_Track(self);
7040 #if PY_VERSION_HEX >= 0x030400a1
7041 if (PyObject_CallFinalizerFromDealloc(self))
7042 #else
7043 Py_TYPE(gen)->tp_del(self);
7044 if (self->ob_refcnt > 0)
7045 #endif
7046 {
7047 return;
7048 }
7049 PyObject_GC_UnTrack(self);
7050 }
7051 __Pyx_Coroutine_clear(self);
7052 PyObject_GC_Del(gen);
7053 }
7054 static void __Pyx_Coroutine_del(PyObject *self) {
7055 PyObject *res;
7056 PyObject *error_type, *error_value, *error_traceback;
7057 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
7058 __Pyx_PyThreadState_declare
7059 if (gen->resume_label <= 0)
7060 return ;
7061 #if PY_VERSION_HEX < 0x030400a1
7062 assert(self->ob_refcnt == 0);
7063 self->ob_refcnt = 1;
7064 #endif
7065 __Pyx_PyThreadState_assign
7066 __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
7067 res = __Pyx_Coroutine_Close(self);
7068 if (res == NULL)
7069 PyErr_WriteUnraisable(self);
7070 else
7071 Py_DECREF(res);
7072 __Pyx_ErrRestore(error_type, error_value, error_traceback);
7073 #if PY_VERSION_HEX < 0x030400a1
7074 assert(self->ob_refcnt > 0);
7075 if (--self->ob_refcnt == 0) {
7076 return;
7077 }
7078 {
7079 Py_ssize_t refcnt = self->ob_refcnt;
7080 _Py_NewReference(self);
7081 self->ob_refcnt = refcnt;
7082 }
7083 #if CYTHON_COMPILING_IN_CPYTHON
7084 assert(PyType_IS_GC(self->ob_type) &&
7085 _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
7086 _Py_DEC_REFTOTAL;
7087 #endif
7088 #ifdef COUNT_ALLOCS
7089 --Py_TYPE(self)->tp_frees;
7090 --Py_TYPE(self)->tp_allocs;
7091 #endif
7092 #endif
7093 }
7094 static PyObject *
7095 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
7096 {
7097 Py_INCREF(self->gi_name);
7098 return self->gi_name;
7099 }
7100 static int
7101 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
7102 {
7103 PyObject *tmp;
7104 #if PY_MAJOR_VERSION >= 3
7105 if (unlikely(value == NULL || !PyUnicode_Check(value))) {
7106 #else
7107 if (unlikely(value == NULL || !PyString_Check(value))) {
7108 #endif
7109 PyErr_SetString(PyExc_TypeError,
7110 "__name__ must be set to a string object");
7111 return -1;
7112 }
7113 tmp = self->gi_name;
7114 Py_INCREF(value);
7115 self->gi_name = value;
7116 Py_XDECREF(tmp);
7117 return 0;
7118 }
7119 static PyObject *
7120 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
7121 {
7122 Py_INCREF(self->gi_qualname);
7123 return self->gi_qualname;
7124 }
7125 static int
7126 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
7127 {
7128 PyObject *tmp;
7129 #if PY_MAJOR_VERSION >= 3
7130 if (unlikely(value == NULL || !PyUnicode_Check(value))) {
7131 #else
7132 if (unlikely(value == NULL || !PyString_Check(value))) {
7133 #endif
7134 PyErr_SetString(PyExc_TypeError,
7135 "__qualname__ must be set to a string object");
7136 return -1;
7137 }
7138 tmp = self->gi_qualname;
7139 Py_INCREF(value);
7140 self->gi_qualname = value;
7141 Py_XDECREF(tmp);
7142 return 0;
7143 }
7144 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
7145 PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure,
7146 PyObject *name, PyObject *qualname, PyObject *module_name) {
7147 __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
7148 if (gen == NULL)
7149 return NULL;
7150 gen->body = body;
7151 gen->closure = closure;
7152 Py_XINCREF(closure);
7153 gen->is_running = 0;
7154 gen->resume_label = 0;
7155 gen->classobj = NULL;
7156 gen->yieldfrom = NULL;
7157 gen->exc_type = NULL;
7158 gen->exc_value = NULL;
7159 gen->exc_traceback = NULL;
7160 gen->gi_weakreflist = NULL;
7161 Py_XINCREF(qualname);
7162 gen->gi_qualname = qualname;
7163 Py_XINCREF(name);
7164 gen->gi_name = name;
7165 Py_XINCREF(module_name);
7166 gen->gi_modulename = module_name;
7167 PyObject_GC_Track(gen);
7168 return gen;
7169 }
7170
7171 /* PatchModuleWithCoroutine */
7172 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
7173 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
7174 int result;
7175 PyObject *globals, *result_obj;
7176 globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
7177 result = PyDict_SetItemString(globals, "_cython_coroutine_type",
7178 #ifdef __Pyx_Coroutine_USED
7179 (PyObject*)__pyx_CoroutineType);
7180 #else
7181 Py_None);
7182 #endif
7183 if (unlikely(result < 0)) goto ignore;
7184 result = PyDict_SetItemString(globals, "_cython_generator_type",
7185 #ifdef __Pyx_Generator_USED
7186 (PyObject*)__pyx_GeneratorType);
7187 #else
7188 Py_None);
7189 #endif
7190 if (unlikely(result < 0)) goto ignore;
7191 if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
7192 if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
7193 result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
7194 if (unlikely(!result_obj)) goto ignore;
7195 Py_DECREF(result_obj);
7196 Py_DECREF(globals);
7197 return module;
7198 ignore:
7199 Py_XDECREF(globals);
7200 PyErr_WriteUnraisable(module);
7201 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
7202 Py_DECREF(module);
7203 module = NULL;
7204 }
7205 #else
7206 py_code++;
7207 #endif
7208 return module;
7209 }
7210
7211 /* PatchGeneratorABC */
7212 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
7213 static PyObject* __Pyx_patch_abc_module(PyObject *module);
7214 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
7215 module = __Pyx_Coroutine_patch_module(
7216 module, ""
7217 "if _cython_generator_type is not None:\n"
7218 " try: Generator = _module.Generator\n"
7219 " except AttributeError: pass\n"
7220 " else: Generator.register(_cython_generator_type)\n"
7221 "if _cython_coroutine_type is not None:\n"
7222 " try: Coroutine = _module.Coroutine\n"
7223 " except AttributeError: pass\n"
7224 " else: Coroutine.register(_cython_coroutine_type)\n"
7225 );
7226 return module;
7227 }
7228 #endif
7229 static int __Pyx_patch_abc(void) {
7230 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
7231 static int abc_patched = 0;
7232 if (!abc_patched) {
7233 PyObject *module;
7234 module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections");
7235 if (!module) {
7236 PyErr_WriteUnraisable(NULL);
7237 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
7238 ((PY_VERSION_HEX >= 0x03030000) ?
7239 "Cython module failed to register with collections.abc module" :
7240 "Cython module failed to register with collections module"), 1) < 0)) {
7241 return -1;
7242 }
7243 } else {
7244 module = __Pyx_patch_abc_module(module);
7245 abc_patched = 1;
7246 if (unlikely(!module))
7247 return -1;
7248 Py_DECREF(module);
7249 }
7250 module = PyImport_ImportModule("backports_abc");
7251 if (module) {
7252 module = __Pyx_patch_abc_module(module);
7253 Py_XDECREF(module);
7254 }
7255 if (!module) {
7256 PyErr_Clear();
7257 }
7258 }
7259 #else
7260 if (0) __Pyx_Coroutine_patch_module(NULL, NULL);
7261 #endif
7262 return 0;
7263 }
7264
7265 /* Generator */
7266 static PyMethodDef __pyx_Generator_methods[] = {
7267 {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
7268 (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
7269 {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
7270 (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
7271 {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
7272 (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
7273 {0, 0, 0, 0}
7274 };
7275 static PyMemberDef __pyx_Generator_memberlist[] = {
7276 {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
7277 {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
7278 (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
7279 {0, 0, 0, 0, 0}
7280 };
7281 static PyGetSetDef __pyx_Generator_getsets[] = {
7282 {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
7283 (char*) PyDoc_STR("name of the generator"), 0},
7284 {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
7285 (char*) PyDoc_STR("qualified name of the generator"), 0},
7286 {0, 0, 0, 0, 0}
7287 };
7288 static PyTypeObject __pyx_GeneratorType_type = {
7289 PyVarObject_HEAD_INIT(0, 0)
7290 "generator",
7291 sizeof(__pyx_CoroutineObject),
7292 0,
7293 (destructor) __Pyx_Coroutine_dealloc,
7294 0,
7295 0,
7296 0,
7297 0,
7298 0,
7299 0,
7300 0,
7301 0,
7302 0,
7303 0,
7304 0,
7305 0,
7306 0,
7307 0,
7308 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
7309 0,
7310 (traverseproc) __Pyx_Coroutine_traverse,
7311 0,
7312 0,
7313 offsetof(__pyx_CoroutineObject, gi_weakreflist),
7314 0,
7315 (iternextfunc) __Pyx_Generator_Next,
7316 __pyx_Generator_methods,
7317 __pyx_Generator_memberlist,
7318 __pyx_Generator_getsets,
7319 0,
7320 0,
7321 0,
7322 0,
7323 0,
7324 0,
7325 0,
7326 0,
7327 0,
7328 0,
7329 0,
7330 0,
7331 0,
7332 0,
7333 0,
7334 #if PY_VERSION_HEX >= 0x030400a1
7335 0,
7336 #else
7337 __Pyx_Coroutine_del,
7338 #endif
7339 0,
7340 #if PY_VERSION_HEX >= 0x030400a1
7341 __Pyx_Coroutine_del,
7342 #endif
7343 };
7344 static int __pyx_Generator_init(void) {
7345 __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
7346 __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
7347 __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
7348 if (unlikely(!__pyx_GeneratorType)) {
7349 return -1;
7350 }
7351 return 0;
7352 }
7353
7354 /* CheckBinaryVersion */
7355 static int __Pyx_check_binary_version(void) {
7356 char ctversion[4], rtversion[4];
7357 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
7358 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
7359 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
7360 char message[200];
7361 PyOS_snprintf(message, sizeof(message),
7362 "compiletime version %s of module '%.100s' "
7363 "does not match runtime version %s",
7364 ctversion, __Pyx_MODULE_NAME, rtversion);
7365 return PyErr_WarnEx(NULL, message, 1);
7366 }
7367 return 0;
7368 }
7369
7370 /* InitStrings */
7371 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
7372 while (t->p) {
7373 #if PY_MAJOR_VERSION < 3
7374 if (t->is_unicode) {
7375 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
7376 } else if (t->intern) {
7377 *t->p = PyString_InternFromString(t->s);
7378 } else {
7379 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
7380 }
7381 #else
7382 if (t->is_unicode | t->is_str) {
7383 if (t->intern) {
7384 *t->p = PyUnicode_InternFromString(t->s);
7385 } else if (t->encoding) {
7386 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
7387 } else {
7388 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
7389 }
7390 } else {
7391 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
7392 }
7393 #endif
7394 if (!*t->p)
7395 return -1;
7396 ++t;
7397 }
7398 return 0;
7399 }
7400
7401 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
7402 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
7403 }
7404 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
7405 Py_ssize_t ignore;
7406 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
7407 }
7408 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7409 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
7410 if (
7411 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7412 __Pyx_sys_getdefaultencoding_not_ascii &&
7413 #endif
7414 PyUnicode_Check(o)) {
7415 #if PY_VERSION_HEX < 0x03030000
7416 char* defenc_c;
7417 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
7418 if (!defenc) return NULL;
7419 defenc_c = PyBytes_AS_STRING(defenc);
7420 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7421 {
7422 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
7423 char* c;
7424 for (c = defenc_c; c < end; c++) {
7425 if ((unsigned char) (*c) >= 128) {
7426 PyUnicode_AsASCIIString(o);
7427 return NULL;
7428 }
7429 }
7430 }
7431 #endif
7432 *length = PyBytes_GET_SIZE(defenc);
7433 return defenc_c;
7434 #else
7435 if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
7436 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7437 if (PyUnicode_IS_ASCII(o)) {
7438 *length = PyUnicode_GET_LENGTH(o);
7439 return PyUnicode_AsUTF8(o);
7440 } else {
7441 PyUnicode_AsASCIIString(o);
7442 return NULL;
7443 }
7444 #else
7445 return PyUnicode_AsUTF8AndSize(o, length);
7446 #endif
7447 #endif
7448 } else
7449 #endif
7450 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
7451 if (PyByteArray_Check(o)) {
7452 *length = PyByteArray_GET_SIZE(o);
7453 return PyByteArray_AS_STRING(o);
7454 } else
7455 #endif
7456 {
7457 char* result;
7458 int r = PyBytes_AsStringAndSize(o, &result, length);
7459 if (unlikely(r < 0)) {
7460 return NULL;
7461 } else {
7462 return result;
7463 }
7464 }
7465 }
7466 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
7467 int is_true = x == Py_True;
7468 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
7469 else return PyObject_IsTrue(x);
7470 }
7471 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
7472 PyNumberMethods *m;
7473 const char *name = NULL;
7474 PyObject *res = NULL;
7475 #if PY_MAJOR_VERSION < 3
7476 if (PyInt_Check(x) || PyLong_Check(x))
7477 #else
7478 if (PyLong_Check(x))
7479 #endif
7480 return __Pyx_NewRef(x);
7481 m = Py_TYPE(x)->tp_as_number;
7482 #if PY_MAJOR_VERSION < 3
7483 if (m && m->nb_int) {
7484 name = "int";
7485 res = PyNumber_Int(x);
7486 }
7487 else if (m && m->nb_long) {
7488 name = "long";
7489 res = PyNumber_Long(x);
7490 }
7491 #else
7492 if (m && m->nb_int) {
7493 name = "int";
7494 res = PyNumber_Long(x);
7495 }
7496 #endif
7497 if (res) {
7498 #if PY_MAJOR_VERSION < 3
7499 if (!PyInt_Check(res) && !PyLong_Check(res)) {
7500 #else
7501 if (!PyLong_Check(res)) {
7502 #endif
7503 PyErr_Format(PyExc_TypeError,
7504 "__%.4s__ returned non-%.4s (type %.200s)",
7505 name, name, Py_TYPE(res)->tp_name);
7506 Py_DECREF(res);
7507 return NULL;
7508 }
7509 }
7510 else if (!PyErr_Occurred()) {
7511 PyErr_SetString(PyExc_TypeError,
7512 "an integer is required");
7513 }
7514 return res;
7515 }
7516 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7517 Py_ssize_t ival;
7518 PyObject *x;
7519 #if PY_MAJOR_VERSION < 3
7520 if (likely(PyInt_CheckExact(b))) {
7521 if (sizeof(Py_ssize_t) >= sizeof(long))
7522 return PyInt_AS_LONG(b);
7523 else
7524 return PyInt_AsSsize_t(x);
7525 }
7526 #endif
7527 if (likely(PyLong_CheckExact(b))) {
7528 #if CYTHON_USE_PYLONG_INTERNALS
7529 const digit* digits = ((PyLongObject*)b)->ob_digit;
7530 const Py_ssize_t size = Py_SIZE(b);
7531 if (likely(__Pyx_sst_abs(size) <= 1)) {
7532 ival = likely(size) ? digits[0] : 0;
7533 if (size == -1) ival = -ival;
7534 return ival;
7535 } else {
7536 switch (size) {
7537 case 2:
7538 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7539 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7540 }
7541 break;
7542 case -2:
7543 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7544 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7545 }
7546 break;
7547 case 3:
7548 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7549 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7550 }
7551 break;
7552 case -3:
7553 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7554 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7555 }
7556 break;
7557 case 4:
7558 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7559 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]));
7560 }
7561 break;
7562 case -4:
7563 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7564 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]));
7565 }
7566 break;
7567 }
7568 }
7569 #endif
7570 return PyLong_AsSsize_t(b);
7571 }
7572 x = PyNumber_Index(b);
7573 if (!x) return -1;
7574 ival = PyInt_AsSsize_t(x);
7575 Py_DECREF(x);
7576 return ival;
7577 }
7578 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
7579 return PyInt_FromSize_t(ival);
7580 }
7581
7582
7583 #endif /* Py_PYTHON_H */
7584