1 /* Generated by Cython 0.29.18 */
3 /* BEGIN: Cython Metadata
8 "CYTHON_CLINE_IN_TRACEBACK",
12 "extra_compile_args": [
16 "/usr/include/libxml2",
20 "name": "lxml.html.diff",
22 "src/lxml/html/diff.py"
25 "module_name": "lxml.html.diff"
27 END: Cython Metadata */
29 #define PY_SSIZE_T_CLEAN
32 #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34 #error Cython requires Python 2.6+ or Python 3.3+.
36 #define CYTHON_ABI "0_29_18"
37 #define CYTHON_HEX_VERSION 0x001D12F0
38 #define CYTHON_FUTURE_DIVISION 1
41 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
55 #define DL_IMPORT(t) t
58 #define DL_EXPORT(t) t
61 #ifndef HAVE_LONG_LONG
62 #if PY_VERSION_HEX >= 0x02070000
63 #define HAVE_LONG_LONG
67 #define PY_LONG_LONG LONG_LONG
70 #define Py_HUGE_VAL HUGE_VAL
73 #define CYTHON_COMPILING_IN_PYPY 1
74 #define CYTHON_COMPILING_IN_PYSTON 0
75 #define CYTHON_COMPILING_IN_CPYTHON 0
76 #undef CYTHON_USE_TYPE_SLOTS
77 #define CYTHON_USE_TYPE_SLOTS 0
78 #undef CYTHON_USE_PYTYPE_LOOKUP
79 #define CYTHON_USE_PYTYPE_LOOKUP 0
80 #if PY_VERSION_HEX < 0x03050000
81 #undef CYTHON_USE_ASYNC_SLOTS
82 #define CYTHON_USE_ASYNC_SLOTS 0
83 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84 #define CYTHON_USE_ASYNC_SLOTS 1
86 #undef CYTHON_USE_PYLIST_INTERNALS
87 #define CYTHON_USE_PYLIST_INTERNALS 0
88 #undef CYTHON_USE_UNICODE_INTERNALS
89 #define CYTHON_USE_UNICODE_INTERNALS 0
90 #undef CYTHON_USE_UNICODE_WRITER
91 #define CYTHON_USE_UNICODE_WRITER 0
92 #undef CYTHON_USE_PYLONG_INTERNALS
93 #define CYTHON_USE_PYLONG_INTERNALS 0
94 #undef CYTHON_AVOID_BORROWED_REFS
95 #define CYTHON_AVOID_BORROWED_REFS 1
96 #undef CYTHON_ASSUME_SAFE_MACROS
97 #define CYTHON_ASSUME_SAFE_MACROS 0
98 #undef CYTHON_UNPACK_METHODS
99 #define CYTHON_UNPACK_METHODS 0
100 #undef CYTHON_FAST_THREAD_STATE
101 #define CYTHON_FAST_THREAD_STATE 0
102 #undef CYTHON_FAST_PYCALL
103 #define CYTHON_FAST_PYCALL 0
104 #undef CYTHON_PEP489_MULTI_PHASE_INIT
105 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106 #undef CYTHON_USE_TP_FINALIZE
107 #define CYTHON_USE_TP_FINALIZE 0
108 #undef CYTHON_USE_DICT_VERSIONS
109 #define CYTHON_USE_DICT_VERSIONS 0
110 #undef CYTHON_USE_EXC_INFO_STACK
111 #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113 #define CYTHON_COMPILING_IN_PYPY 0
114 #define CYTHON_COMPILING_IN_PYSTON 1
115 #define CYTHON_COMPILING_IN_CPYTHON 0
116 #ifndef CYTHON_USE_TYPE_SLOTS
117 #define CYTHON_USE_TYPE_SLOTS 1
119 #undef CYTHON_USE_PYTYPE_LOOKUP
120 #define CYTHON_USE_PYTYPE_LOOKUP 0
121 #undef CYTHON_USE_ASYNC_SLOTS
122 #define CYTHON_USE_ASYNC_SLOTS 0
123 #undef CYTHON_USE_PYLIST_INTERNALS
124 #define CYTHON_USE_PYLIST_INTERNALS 0
125 #ifndef CYTHON_USE_UNICODE_INTERNALS
126 #define CYTHON_USE_UNICODE_INTERNALS 1
128 #undef CYTHON_USE_UNICODE_WRITER
129 #define CYTHON_USE_UNICODE_WRITER 0
130 #undef CYTHON_USE_PYLONG_INTERNALS
131 #define CYTHON_USE_PYLONG_INTERNALS 0
132 #ifndef CYTHON_AVOID_BORROWED_REFS
133 #define CYTHON_AVOID_BORROWED_REFS 0
135 #ifndef CYTHON_ASSUME_SAFE_MACROS
136 #define CYTHON_ASSUME_SAFE_MACROS 1
138 #ifndef CYTHON_UNPACK_METHODS
139 #define CYTHON_UNPACK_METHODS 1
141 #undef CYTHON_FAST_THREAD_STATE
142 #define CYTHON_FAST_THREAD_STATE 0
143 #undef CYTHON_FAST_PYCALL
144 #define CYTHON_FAST_PYCALL 0
145 #undef CYTHON_PEP489_MULTI_PHASE_INIT
146 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147 #undef CYTHON_USE_TP_FINALIZE
148 #define CYTHON_USE_TP_FINALIZE 0
149 #undef CYTHON_USE_DICT_VERSIONS
150 #define CYTHON_USE_DICT_VERSIONS 0
151 #undef CYTHON_USE_EXC_INFO_STACK
152 #define CYTHON_USE_EXC_INFO_STACK 0
154 #define CYTHON_COMPILING_IN_PYPY 0
155 #define CYTHON_COMPILING_IN_PYSTON 0
156 #define CYTHON_COMPILING_IN_CPYTHON 1
157 #ifndef CYTHON_USE_TYPE_SLOTS
158 #define CYTHON_USE_TYPE_SLOTS 1
160 #if PY_VERSION_HEX < 0x02070000
161 #undef CYTHON_USE_PYTYPE_LOOKUP
162 #define CYTHON_USE_PYTYPE_LOOKUP 0
163 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164 #define CYTHON_USE_PYTYPE_LOOKUP 1
166 #if PY_MAJOR_VERSION < 3
167 #undef CYTHON_USE_ASYNC_SLOTS
168 #define CYTHON_USE_ASYNC_SLOTS 0
169 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170 #define CYTHON_USE_ASYNC_SLOTS 1
172 #if PY_VERSION_HEX < 0x02070000
173 #undef CYTHON_USE_PYLONG_INTERNALS
174 #define CYTHON_USE_PYLONG_INTERNALS 0
175 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176 #define CYTHON_USE_PYLONG_INTERNALS 1
178 #ifndef CYTHON_USE_PYLIST_INTERNALS
179 #define CYTHON_USE_PYLIST_INTERNALS 1
181 #ifndef CYTHON_USE_UNICODE_INTERNALS
182 #define CYTHON_USE_UNICODE_INTERNALS 1
184 #if PY_VERSION_HEX < 0x030300F0
185 #undef CYTHON_USE_UNICODE_WRITER
186 #define CYTHON_USE_UNICODE_WRITER 0
187 #elif !defined(CYTHON_USE_UNICODE_WRITER)
188 #define CYTHON_USE_UNICODE_WRITER 1
190 #ifndef CYTHON_AVOID_BORROWED_REFS
191 #define CYTHON_AVOID_BORROWED_REFS 0
193 #ifndef CYTHON_ASSUME_SAFE_MACROS
194 #define CYTHON_ASSUME_SAFE_MACROS 1
196 #ifndef CYTHON_UNPACK_METHODS
197 #define CYTHON_UNPACK_METHODS 1
199 #ifndef CYTHON_FAST_THREAD_STATE
200 #define CYTHON_FAST_THREAD_STATE 1
202 #ifndef CYTHON_FAST_PYCALL
203 #define CYTHON_FAST_PYCALL 1
205 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
208 #ifndef CYTHON_USE_TP_FINALIZE
209 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
211 #ifndef CYTHON_USE_DICT_VERSIONS
212 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
214 #ifndef CYTHON_USE_EXC_INFO_STACK
215 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
221 #if CYTHON_USE_PYLONG_INTERNALS
222 #include "longintrepr.h"
227 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
230 #ifndef __has_attribute
231 #define __has_attribute(x) 0
233 #ifndef __has_cpp_attribute
234 #define __has_cpp_attribute(x) 0
236 #ifndef CYTHON_RESTRICT
237 #if defined(__GNUC__)
238 #define CYTHON_RESTRICT __restrict__
239 #elif defined(_MSC_VER) && _MSC_VER >= 1400
240 #define CYTHON_RESTRICT __restrict
241 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242 #define CYTHON_RESTRICT restrict
244 #define CYTHON_RESTRICT
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 # define CYTHON_UNUSED __attribute__ ((__unused__))
252 # define CYTHON_UNUSED
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 # define CYTHON_UNUSED __attribute__ ((__unused__))
257 # define CYTHON_UNUSED
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 # if defined(__cplusplus)
262 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
264 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 # define CYTHON_NCP_UNUSED
271 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
276 #ifndef _MSC_STDINT_H_
278 typedef unsigned char uint8_t;
279 typedef unsigned int uint32_t;
281 typedef unsigned __int8 uint8_t;
282 typedef unsigned __int32 uint32_t;
288 #ifndef CYTHON_FALLTHROUGH
289 #if defined(__cplusplus) && __cplusplus >= 201103L
290 #if __has_cpp_attribute(fallthrough)
291 #define CYTHON_FALLTHROUGH [[fallthrough]]
292 #elif __has_cpp_attribute(clang::fallthrough)
293 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294 #elif __has_cpp_attribute(gnu::fallthrough)
295 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
298 #ifndef CYTHON_FALLTHROUGH
299 #if __has_attribute(fallthrough)
300 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
302 #define CYTHON_FALLTHROUGH
305 #if defined(__clang__ ) && defined(__apple_build_version__)
306 #if __apple_build_version__ < 7000000
307 #undef CYTHON_FALLTHROUGH
308 #define CYTHON_FALLTHROUGH
313 #ifndef CYTHON_INLINE
314 #if defined(__clang__)
315 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
316 #elif defined(__GNUC__)
317 #define CYTHON_INLINE __inline__
318 #elif defined(_MSC_VER)
319 #define CYTHON_INLINE __inline
320 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
321 #define CYTHON_INLINE inline
323 #define CYTHON_INLINE
327 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
328 #define Py_OptimizeFlag 0
330 #define __PYX_BUILD_PY_SSIZE_T "n"
331 #define CYTHON_FORMAT_SSIZE_T "z"
332 #if PY_MAJOR_VERSION < 3
333 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
334 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
335 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
336 #define __Pyx_DefaultClassType PyClass_Type
338 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
339 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
340 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
343 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
344 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
346 #define __Pyx_DefaultClassType PyType_Type
348 #ifndef Py_TPFLAGS_CHECKTYPES
349 #define Py_TPFLAGS_CHECKTYPES 0
351 #ifndef Py_TPFLAGS_HAVE_INDEX
352 #define Py_TPFLAGS_HAVE_INDEX 0
354 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
355 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
357 #ifndef Py_TPFLAGS_HAVE_FINALIZE
358 #define Py_TPFLAGS_HAVE_FINALIZE 0
360 #ifndef METH_STACKLESS
361 #define METH_STACKLESS 0
363 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
364 #ifndef METH_FASTCALL
365 #define METH_FASTCALL 0x80
367 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
368 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
369 Py_ssize_t nargs, PyObject *kwnames);
371 #define __Pyx_PyCFunctionFast _PyCFunctionFast
372 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
374 #if CYTHON_FAST_PYCCALL
375 #define __Pyx_PyFastCFunction_Check(func)\
376 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
378 #define __Pyx_PyFastCFunction_Check(func) 0
380 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
381 #define PyObject_Malloc(s) PyMem_Malloc(s)
382 #define PyObject_Free(p) PyMem_Free(p)
383 #define PyObject_Realloc(p) PyMem_Realloc(p)
385 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
386 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
387 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
388 #define PyMem_RawFree(p) PyMem_Free(p)
390 #if CYTHON_COMPILING_IN_PYSTON
391 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
392 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
394 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
395 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
397 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
398 #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #elif PY_VERSION_HEX >= 0x03060000
400 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
401 #elif PY_VERSION_HEX >= 0x03000000
402 #define __Pyx_PyThreadState_Current PyThreadState_GET()
404 #define __Pyx_PyThreadState_Current _PyThreadState_Current
406 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
407 #include "pythread.h"
408 #define Py_tss_NEEDS_INIT 0
409 typedef int Py_tss_t;
410 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
411 *key = PyThread_create_key();
414 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
415 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
416 *key = Py_tss_NEEDS_INIT;
419 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
422 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
423 return *key != Py_tss_NEEDS_INIT;
425 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
426 PyThread_delete_key(*key);
427 *key = Py_tss_NEEDS_INIT;
429 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
430 return PyThread_set_key_value(*key, value);
432 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
433 return PyThread_get_key_value(*key);
436 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
437 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
439 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
441 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
442 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
443 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
445 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
446 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
448 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
449 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
451 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
453 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
454 #define CYTHON_PEP393_ENABLED 1
455 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
456 0 : _PyUnicode_Ready((PyObject *)(op)))
457 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
458 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
459 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
460 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
461 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
462 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
463 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
464 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
466 #define CYTHON_PEP393_ENABLED 0
467 #define PyUnicode_1BYTE_KIND 1
468 #define PyUnicode_2BYTE_KIND 2
469 #define PyUnicode_4BYTE_KIND 4
470 #define __Pyx_PyUnicode_READY(op) (0)
471 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
472 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
473 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
474 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
475 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
476 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
477 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
478 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
480 #if CYTHON_COMPILING_IN_PYPY
481 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
482 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
484 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
485 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
486 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
488 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
489 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
491 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
492 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
494 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
495 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
497 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
498 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
499 #if PY_MAJOR_VERSION >= 3
500 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
502 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
504 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
505 #define PyObject_ASCII(o) PyObject_Repr(o)
507 #if PY_MAJOR_VERSION >= 3
508 #define PyBaseString_Type PyUnicode_Type
509 #define PyStringObject PyUnicodeObject
510 #define PyString_Type PyUnicode_Type
511 #define PyString_Check PyUnicode_Check
512 #define PyString_CheckExact PyUnicode_CheckExact
513 #ifndef PyObject_Unicode
514 #define PyObject_Unicode PyObject_Str
517 #if PY_MAJOR_VERSION >= 3
518 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
519 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
521 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
522 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
524 #ifndef PySet_CheckExact
525 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
527 #if CYTHON_ASSUME_SAFE_MACROS
528 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
530 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
532 #if PY_MAJOR_VERSION >= 3
533 #define PyIntObject PyLongObject
534 #define PyInt_Type PyLong_Type
535 #define PyInt_Check(op) PyLong_Check(op)
536 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
537 #define PyInt_FromString PyLong_FromString
538 #define PyInt_FromUnicode PyLong_FromUnicode
539 #define PyInt_FromLong PyLong_FromLong
540 #define PyInt_FromSize_t PyLong_FromSize_t
541 #define PyInt_FromSsize_t PyLong_FromSsize_t
542 #define PyInt_AsLong PyLong_AsLong
543 #define PyInt_AS_LONG PyLong_AS_LONG
544 #define PyInt_AsSsize_t PyLong_AsSsize_t
545 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
546 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
547 #define PyNumber_Int PyNumber_Long
549 #if PY_MAJOR_VERSION >= 3
550 #define PyBoolObject PyLongObject
552 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
553 #ifndef PyUnicode_InternFromString
554 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
557 #if PY_VERSION_HEX < 0x030200A4
558 typedef long Py_hash_t;
559 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
560 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
562 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
563 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
565 #if PY_MAJOR_VERSION >= 3
566 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
568 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
570 #if CYTHON_USE_ASYNC_SLOTS
571 #if PY_VERSION_HEX >= 0x030500B1
572 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
573 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
575 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
578 #define __Pyx_PyType_AsAsync(obj) NULL
580 #ifndef __Pyx_PyAsyncMethodsStruct
585 } __Pyx_PyAsyncMethodsStruct;
588 #if defined(WIN32) || defined(MS_WINDOWS)
589 #define _USE_MATH_DEFINESg
593 #define __PYX_NAN() ((float) NAN)
595 static CYTHON_INLINE float __PYX_NAN() {
597 memset(&value, 0xFF, sizeof(value));
601 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
602 #define __Pyx_truncl trunc
604 #define __Pyx_truncl truncl
607 #define __PYX_MARK_ERR_POS(f_index, lineno) \
608 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
609 #define __PYX_ERR(f_index, lineno, Ln_error) \
610 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
612 #ifndef __PYX_EXTERN_C
614 #define __PYX_EXTERN_C extern "C"
616 #define __PYX_EXTERN_C extern
620 #define __PYX_HAVE__lxml__html__diff
621 #define __PYX_HAVE_API__lxml__html__diff
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
643 (sizeof(type) < sizeof(Py_ssize_t)) ||\
644 (sizeof(type) > sizeof(Py_ssize_t) &&\
645 likely(v < (type)PY_SSIZE_T_MAX ||\
646 v == (type)PY_SSIZE_T_MAX) &&\
647 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648 v == (type)PY_SSIZE_T_MIN))) ||\
649 (sizeof(type) == sizeof(Py_ssize_t) &&\
650 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651 v == (type)PY_SSIZE_T_MAX))) )
652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653 return (size_t) i < (size_t) limit;
655 #if defined (__cplusplus) && __cplusplus >= 201103L
657 #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659 #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661 #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665 #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667 #define __Pyx_sst_abs(value) __builtin_llabs(value)
669 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
680 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
682 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
683 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
685 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702 const Py_UNICODE *u_end = u;
704 return (size_t)(u_end - u - 1);
706 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
735 PyObject* default_encoding = NULL;
736 PyObject* ascii_chars_u = NULL;
737 PyObject* ascii_chars_b = NULL;
738 const char* default_encoding_c;
739 sys = PyImport_ImportModule("sys");
741 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
743 if (!default_encoding) goto bad;
744 default_encoding_c = PyBytes_AsString(default_encoding);
745 if (!default_encoding_c) goto bad;
746 if (strcmp(default_encoding_c, "ascii") == 0) {
747 __Pyx_sys_getdefaultencoding_not_ascii = 0;
749 char ascii_chars[128];
751 for (c = 0; c < 128; c++) {
754 __Pyx_sys_getdefaultencoding_not_ascii = 1;
755 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756 if (!ascii_chars_u) goto bad;
757 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
761 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
765 Py_DECREF(ascii_chars_u);
766 Py_DECREF(ascii_chars_b);
768 Py_DECREF(default_encoding);
771 Py_XDECREF(default_encoding);
772 Py_XDECREF(ascii_chars_u);
773 Py_XDECREF(ascii_chars_b);
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
785 PyObject* default_encoding = NULL;
786 char* default_encoding_c;
787 sys = PyImport_ImportModule("sys");
789 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
791 if (!default_encoding) goto bad;
792 default_encoding_c = PyBytes_AsString(default_encoding);
793 if (!default_encoding_c) goto bad;
794 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797 Py_DECREF(default_encoding);
800 Py_XDECREF(default_encoding);
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809 #define likely(x) __builtin_expect(!!(x), 1)
810 #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812 #define likely(x) (x)
813 #define unlikely(x) (x)
814 #endif /* __GNUC__ */
815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
830 static const char *__pyx_f[] = {
831 "src/lxml/html/diff.py",
834 /*--- Type declarations ---*/
835 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens;
836 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens;
837 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el;
838 struct __pyx_defaults;
839 typedef struct __pyx_defaults __pyx_defaults;
840 struct __pyx_defaults {
841 PyObject *__pyx_arg_markup;
844 /* "lxml/html/diff.py":137
845 * tokens[-1] = merged
847 * def markup_serialize_tokens(tokens, markup_func): # <<<<<<<<<<<<<<
849 * Serialize the list of tokens into a list of text chunks, calling
851 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens {
853 PyObject *__pyx_v_html;
854 PyObject *__pyx_v_markup_func;
855 PyObject *__pyx_v_post;
856 PyObject *__pyx_v_pre;
857 PyObject *__pyx_v_token;
858 PyObject *__pyx_v_tokens;
860 Py_ssize_t __pyx_t_1;
861 PyObject *(*__pyx_t_2)(PyObject *);
863 Py_ssize_t __pyx_t_4;
864 PyObject *(*__pyx_t_5)(PyObject *);
868 /* "lxml/html/diff.py":219
871 * def expand_tokens(tokens, equal=False): # <<<<<<<<<<<<<<
872 * """Given a list of tokens, return a generator of the chunks of
873 * text for the data in the tokens.
875 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens {
877 PyObject *__pyx_v_equal;
878 PyObject *__pyx_v_post;
879 PyObject *__pyx_v_pre;
880 PyObject *__pyx_v_token;
881 PyObject *__pyx_v_tokens;
883 Py_ssize_t __pyx_t_1;
884 PyObject *(*__pyx_t_2)(PyObject *);
886 Py_ssize_t __pyx_t_4;
887 PyObject *(*__pyx_t_5)(PyObject *);
891 /* "lxml/html/diff.py":684
894 * def flatten_el(el, include_hrefs, skip_tag=False): # <<<<<<<<<<<<<<
895 * """ Takes an lxml element el, and generates all the text chunks for
896 * that tag. Each start tag is a chunk, each word is a chunk, and each
898 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el {
900 PyObject *__pyx_v_child;
901 PyObject *__pyx_v_el;
902 PyObject *__pyx_v_end_words;
903 PyObject *__pyx_v_include_hrefs;
904 PyObject *__pyx_v_item;
905 PyObject *__pyx_v_skip_tag;
906 PyObject *__pyx_v_start_words;
907 PyObject *__pyx_v_word;
909 Py_ssize_t __pyx_t_1;
910 PyObject *(*__pyx_t_2)(PyObject *);
912 Py_ssize_t __pyx_t_4;
913 PyObject *(*__pyx_t_5)(PyObject *);
917 /* --- Runtime support code (head) --- */
919 #ifndef CYTHON_REFNANNY
920 #define CYTHON_REFNANNY 0
924 void (*INCREF)(void*, PyObject*, int);
925 void (*DECREF)(void*, PyObject*, int);
926 void (*GOTREF)(void*, PyObject*, int);
927 void (*GIVEREF)(void*, PyObject*, int);
928 void* (*SetupContext)(const char*, int, const char*);
929 void (*FinishContext)(void**);
930 } __Pyx_RefNannyAPIStruct;
931 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
932 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
933 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
935 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
937 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
938 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
939 PyGILState_Release(__pyx_gilstate_save);\
941 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
944 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
945 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
947 #define __Pyx_RefNannyFinishContext()\
948 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
949 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
950 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
951 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
952 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
953 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
954 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
955 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
956 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
958 #define __Pyx_RefNannyDeclarations
959 #define __Pyx_RefNannySetupContext(name, acquire_gil)
960 #define __Pyx_RefNannyFinishContext()
961 #define __Pyx_INCREF(r) Py_INCREF(r)
962 #define __Pyx_DECREF(r) Py_DECREF(r)
963 #define __Pyx_GOTREF(r)
964 #define __Pyx_GIVEREF(r)
965 #define __Pyx_XINCREF(r) Py_XINCREF(r)
966 #define __Pyx_XDECREF(r) Py_XDECREF(r)
967 #define __Pyx_XGOTREF(r)
968 #define __Pyx_XGIVEREF(r)
970 #define __Pyx_XDECREF_SET(r, v) do {\
971 PyObject *tmp = (PyObject *) r;\
972 r = v; __Pyx_XDECREF(tmp);\
974 #define __Pyx_DECREF_SET(r, v) do {\
975 PyObject *tmp = (PyObject *) r;\
976 r = v; __Pyx_DECREF(tmp);\
978 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
979 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
981 /* PyObjectGetAttrStr.proto */
982 #if CYTHON_USE_TYPE_SLOTS
983 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
985 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
988 /* GetBuiltinName.proto */
989 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
991 /* RaiseArgTupleInvalid.proto */
992 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
993 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
995 /* RaiseDoubleKeywords.proto */
996 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
998 /* ParseKeywords.proto */
999 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1000 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1001 const char* function_name);
1003 /* PyDictVersioning.proto */
1004 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1005 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1006 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1007 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1008 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1009 (cache_var) = (value);
1010 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1011 static PY_UINT64_T __pyx_dict_version = 0;\
1012 static PyObject *__pyx_dict_cached_value = NULL;\
1013 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1014 (VAR) = __pyx_dict_cached_value;\
1016 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1017 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1020 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1021 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1022 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1024 #define __PYX_GET_DICT_VERSION(dict) (0)
1025 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1026 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1029 /* GetModuleGlobalName.proto */
1030 #if CYTHON_USE_DICT_VERSIONS
1031 #define __Pyx_GetModuleGlobalName(var, name) {\
1032 static PY_UINT64_T __pyx_dict_version = 0;\
1033 static PyObject *__pyx_dict_cached_value = NULL;\
1034 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1035 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1036 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1038 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1039 PY_UINT64_T __pyx_dict_version;\
1040 PyObject *__pyx_dict_cached_value;\
1041 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1043 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1045 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1046 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1047 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1050 /* PyCFunctionFastCall.proto */
1051 #if CYTHON_FAST_PYCCALL
1052 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1054 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1057 /* PyFunctionFastCall.proto */
1058 #if CYTHON_FAST_PYCALL
1059 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1060 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1061 #if 1 || PY_VERSION_HEX < 0x030600B1
1062 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1064 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1066 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1067 (sizeof(char [1 - 2*!(cond)]) - 1)
1068 #ifndef Py_MEMBER_SIZE
1069 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1071 static size_t __pyx_pyframe_localsplus_offset = 0;
1072 #include "frameobject.h"
1073 #define __Pxy_PyFrame_Initialize_Offsets()\
1074 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1075 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1076 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1077 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1080 /* PyObjectCall.proto */
1081 #if CYTHON_COMPILING_IN_CPYTHON
1082 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1084 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1087 /* PyObjectCall2Args.proto */
1088 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1090 /* PyObjectCallMethO.proto */
1091 #if CYTHON_COMPILING_IN_CPYTHON
1092 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1095 /* PyObjectCallOneArg.proto */
1096 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1098 /* PyObjectFormatAndDecref.proto */
1099 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
1100 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);
1102 /* IncludeStringH.proto */
1105 /* JoinPyUnicode.proto */
1106 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
1109 /* RaiseTooManyValuesToUnpack.proto */
1110 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1112 /* RaiseNeedMoreValuesToUnpack.proto */
1113 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1115 /* IterFinish.proto */
1116 static CYTHON_INLINE int __Pyx_IterFinish(void);
1118 /* UnpackItemEndCheck.proto */
1119 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1121 /* ListCompAppend.proto */
1122 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1123 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1124 PyListObject* L = (PyListObject*) list;
1125 Py_ssize_t len = Py_SIZE(list);
1126 if (likely(L->allocated > len)) {
1128 PyList_SET_ITEM(list, len, x);
1129 Py_SIZE(list) = len+1;
1132 return PyList_Append(list, x);
1135 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1138 /* GetItemInt.proto */
1139 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1140 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1141 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1142 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1143 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1144 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1145 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1146 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1147 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1148 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1149 int wraparound, int boundscheck);
1150 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1151 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1152 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1153 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1154 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1155 int wraparound, int boundscheck);
1156 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1157 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1158 int is_list, int wraparound, int boundscheck);
1160 /* SliceTupleAndList.proto */
1161 #if CYTHON_COMPILING_IN_CPYTHON
1162 static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
1163 static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
1165 #define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
1166 #define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop)
1169 /* PyObjectCallNoArg.proto */
1170 #if CYTHON_COMPILING_IN_CPYTHON
1171 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1173 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1176 /* PyObjectSetAttrStr.proto */
1177 #if CYTHON_USE_TYPE_SLOTS
1178 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1179 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1181 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1182 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1185 /* BytesEquals.proto */
1186 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1188 /* UnicodeEquals.proto */
1189 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1191 /* SliceObject.proto */
1192 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1193 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1194 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1195 int has_cstart, int has_cstop, int wraparound);
1197 /* ListAppend.proto */
1198 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1199 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1200 PyListObject* L = (PyListObject*) list;
1201 Py_ssize_t len = Py_SIZE(list);
1202 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1204 PyList_SET_ITEM(list, len, x);
1205 Py_SIZE(list) = len+1;
1208 return PyList_Append(list, x);
1211 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1214 /* PyObjectGetMethod.proto */
1215 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1217 /* PyObjectCallMethod1.proto */
1218 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1221 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1223 /* SetItemInt.proto */
1224 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1225 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1226 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1227 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1228 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1229 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1230 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1231 int is_list, int wraparound, int boundscheck);
1233 /* GetTopmostException.proto */
1234 #if CYTHON_USE_EXC_INFO_STACK
1235 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1238 /* PyThreadStateGet.proto */
1239 #if CYTHON_FAST_THREAD_STATE
1240 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1241 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1242 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1244 #define __Pyx_PyThreadState_declare
1245 #define __Pyx_PyThreadState_assign
1246 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1249 /* SaveResetException.proto */
1250 #if CYTHON_FAST_THREAD_STATE
1251 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1252 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1253 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1254 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1256 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1257 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1260 /* PyErrFetchRestore.proto */
1261 #if CYTHON_FAST_THREAD_STATE
1262 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1263 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1264 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1265 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1266 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1267 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1268 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1269 #if CYTHON_COMPILING_IN_CPYTHON
1270 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1272 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1275 #define __Pyx_PyErr_Clear() PyErr_Clear()
1276 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1277 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1278 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1279 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1280 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1281 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1282 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1285 /* FastTypeChecks.proto */
1286 #if CYTHON_COMPILING_IN_CPYTHON
1287 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1288 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1289 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1290 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1292 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1293 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1294 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1296 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1298 /* GetException.proto */
1299 #if CYTHON_FAST_THREAD_STATE
1300 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1301 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1303 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1306 /* PySequenceContains.proto */
1307 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1308 int result = PySequence_Contains(seq, item);
1309 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1312 /* PyObjectCallMethod0.proto */
1313 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1316 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
1317 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1318 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
1319 #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
1320 __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
1322 #define __Pyx_PyList_Pop(L) __Pyx__PyObject_Pop(L)
1323 #define __Pyx_PyObject_Pop(L) __Pyx__PyObject_Pop(L)
1326 /* UnpackUnboundCMethod.proto */
1329 PyObject **method_name;
1333 } __Pyx_CachedCFunction;
1335 /* CallUnboundCMethod0.proto */
1336 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1337 #if CYTHON_COMPILING_IN_CPYTHON
1338 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1339 (likely((cfunc)->func) ?\
1340 (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
1341 (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1342 (PY_VERSION_HEX >= 0x030700A0 ?\
1343 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1344 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1345 (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1346 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1347 (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1348 ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1349 __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1350 __Pyx__CallUnboundCMethod0(cfunc, self))
1352 #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
1355 /* ListExtend.proto */
1356 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1357 #if CYTHON_COMPILING_IN_CPYTHON
1358 PyObject* none = _PyList_Extend((PyListObject*)L, v);
1359 if (unlikely(!none))
1364 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1368 /* PyErrExceptionMatches.proto */
1369 #if CYTHON_FAST_THREAD_STATE
1370 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1371 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1373 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1376 /* RaiseException.proto */
1377 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1379 /* PyIntBinop.proto */
1380 #if !CYTHON_COMPILING_IN_PYPY
1381 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1383 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1384 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1387 /* pop_index.proto */
1388 static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix);
1389 static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix);
1390 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1391 static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix);
1392 #define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
1393 (likely(PyList_CheckExact(L) && __Pyx_fits_Py_ssize_t(ix, type, is_signed))) ?\
1394 __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
1395 (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
1396 __Pyx__PyObject_PopIndex(L, py_ix)))
1397 #define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
1398 __Pyx_fits_Py_ssize_t(ix, type, is_signed) ?\
1399 __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
1400 (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
1401 __Pyx__PyObject_PopIndex(L, py_ix)))
1403 #define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)\
1404 __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)
1405 #define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
1406 (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
1407 __Pyx__PyObject_PopIndex(L, py_ix))
1410 /* RaiseNoneIterError.proto */
1411 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1413 /* UnpackTupleError.proto */
1414 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1416 /* UnpackTuple2.proto */
1417 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1418 (likely(is_tuple || PyTuple_Check(tuple)) ?\
1419 (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1420 __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1421 (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1422 __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1423 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1424 PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1425 static int __Pyx_unpack_tuple2_generic(
1426 PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1428 /* dict_iter.proto */
1429 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1430 Py_ssize_t* p_orig_length, int* p_is_dict);
1431 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1432 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1434 /* SliceObject.proto */
1435 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1436 __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1437 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1438 PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1439 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1440 int has_cstart, int has_cstop, int wraparound);
1442 /* PyIntCompare.proto */
1443 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1445 /* PyIntBinop.proto */
1446 #if !CYTHON_COMPILING_IN_PYPY
1447 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1449 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
1450 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1453 /* ObjectGetItem.proto */
1454 #if CYTHON_USE_TYPE_SLOTS
1455 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1457 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1460 /* PyIntBinop.proto */
1461 #if !CYTHON_COMPILING_IN_PYPY
1462 static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1464 #define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
1465 (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
1468 /* PyObject_GenericGetAttrNoDict.proto */
1469 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1470 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1472 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1476 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1478 /* ImportFrom.proto */
1479 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1481 /* FetchCommonType.proto */
1482 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1484 /* CythonFunctionShared.proto */
1485 #define __Pyx_CyFunction_USED 1
1486 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1487 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1488 #define __Pyx_CYFUNCTION_CCLASS 0x04
1489 #define __Pyx_CyFunction_GetClosure(f)\
1490 (((__pyx_CyFunctionObject *) (f))->func_closure)
1491 #define __Pyx_CyFunction_GetClassObj(f)\
1492 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1493 #define __Pyx_CyFunction_Defaults(type, f)\
1494 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1495 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1496 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1498 PyCFunctionObject func;
1499 #if PY_VERSION_HEX < 0x030500A0
1500 PyObject *func_weakreflist;
1502 PyObject *func_dict;
1503 PyObject *func_name;
1504 PyObject *func_qualname;
1506 PyObject *func_globals;
1507 PyObject *func_code;
1508 PyObject *func_closure;
1509 PyObject *func_classobj;
1511 int defaults_pyobjects;
1512 size_t defaults_size; // used by FusedFunction for copying defaults
1514 PyObject *defaults_tuple;
1515 PyObject *defaults_kwdict;
1516 PyObject *(*defaults_getter)(PyObject *);
1517 PyObject *func_annotations;
1518 } __pyx_CyFunctionObject;
1519 static PyTypeObject *__pyx_CyFunctionType = 0;
1520 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1521 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1522 int flags, PyObject* qualname,
1524 PyObject *module, PyObject *globals,
1526 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1529 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1531 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1533 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1535 static int __pyx_CyFunction_init(void);
1537 /* CythonFunction.proto */
1538 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1539 int flags, PyObject* qualname,
1541 PyObject *module, PyObject *globals,
1544 /* CalculateMetaclass.proto */
1545 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1547 /* Py3ClassCreate.proto */
1548 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1549 PyObject *mkw, PyObject *modname, PyObject *doc);
1550 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1551 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1553 /* SetNameInClass.proto */
1554 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1555 #define __Pyx_SetNameInClass(ns, name, value)\
1556 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1557 #elif CYTHON_COMPILING_IN_CPYTHON
1558 #define __Pyx_SetNameInClass(ns, name, value)\
1559 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1561 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1564 /* RegisterModuleCleanup.proto */
1565 static void __pyx_module_cleanup(PyObject *self);
1566 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
1567 static int __Pyx_RegisterCleanup(void);
1569 #define __Pyx_RegisterCleanup() (0)
1572 /* CLineInTraceback.proto */
1573 #ifdef CYTHON_CLINE_IN_TRACEBACK
1574 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1576 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1579 /* CodeObjectCache.proto */
1581 PyCodeObject* code_object;
1583 } __Pyx_CodeObjectCacheEntry;
1584 struct __Pyx_CodeObjectCache {
1587 __Pyx_CodeObjectCacheEntry* entries;
1589 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1590 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1591 static PyCodeObject *__pyx_find_code_object(int code_line);
1592 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1594 /* AddTraceback.proto */
1595 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1596 int py_line, const char *filename);
1598 /* CIntToPy.proto */
1599 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1601 /* CIntFromPy.proto */
1602 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1604 /* CIntFromPy.proto */
1605 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1607 /* SwapException.proto */
1608 #if CYTHON_FAST_THREAD_STATE
1609 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1610 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1612 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1615 /* CoroutineBase.proto */
1616 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
1617 #if CYTHON_USE_EXC_INFO_STACK
1618 #define __Pyx_ExcInfoStruct _PyErr_StackItem
1622 PyObject *exc_value;
1623 PyObject *exc_traceback;
1624 } __Pyx_ExcInfoStruct;
1628 __pyx_coroutine_body_t body;
1630 __Pyx_ExcInfoStruct gi_exc_state;
1631 PyObject *gi_weakreflist;
1633 PyObject *yieldfrom;
1635 PyObject *gi_qualname;
1636 PyObject *gi_modulename;
1640 } __pyx_CoroutineObject;
1641 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
1642 PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1643 PyObject *name, PyObject *qualname, PyObject *module_name);
1644 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
1645 __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1646 PyObject *name, PyObject *qualname, PyObject *module_name);
1647 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
1648 static int __Pyx_Coroutine_clear(PyObject *self);
1649 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
1650 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
1651 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
1652 #if CYTHON_USE_EXC_INFO_STACK
1653 #define __Pyx_Coroutine_SwapException(self)
1654 #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
1656 #define __Pyx_Coroutine_SwapException(self) {\
1657 __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
1658 __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
1660 #define __Pyx_Coroutine_ResetAndClearException(self) {\
1661 __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
1662 (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
1665 #if CYTHON_FAST_THREAD_STATE
1666 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1667 __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
1669 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1670 __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
1672 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
1673 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
1675 /* PatchModuleWithCoroutine.proto */
1676 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
1678 /* PatchGeneratorABC.proto */
1679 static int __Pyx_patch_abc(void);
1681 /* Generator.proto */
1682 #define __Pyx_Generator_USED
1683 static PyTypeObject *__pyx_GeneratorType = 0;
1684 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
1685 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
1686 __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
1687 static PyObject *__Pyx_Generator_Next(PyObject *self);
1688 static int __pyx_Generator_init(void);
1690 /* CheckBinaryVersion.proto */
1691 static int __Pyx_check_binary_version(void);
1693 /* InitStrings.proto */
1694 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1697 /* Module declarations from 'lxml.html.diff' */
1698 static PyTypeObject *__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens = 0;
1699 static PyTypeObject *__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens = 0;
1700 static PyTypeObject *__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el = 0;
1701 #define __Pyx_MODULE_NAME "lxml.html.diff"
1702 extern int __pyx_module_is_main_lxml__html__diff;
1703 int __pyx_module_is_main_lxml__html__diff = 0;
1705 /* Implementation of 'lxml.html.diff' */
1706 static PyObject *__pyx_builtin_ImportError;
1707 static PyObject *__pyx_builtin_NameError;
1708 static PyObject *__pyx_builtin_zip;
1709 static PyObject *__pyx_builtin_ValueError;
1710 static const char __pyx_k_[] = "\">";
1711 static const char __pyx_k_I[] = "I";
1712 static const char __pyx_k_S[] = "S";
1713 static const char __pyx_k_U[] = "U";
1714 static const char __pyx_k_a[] = "a";
1715 static const char __pyx_k_b[] = "b";
1716 static const char __pyx_k_p[] = "p";
1717 static const char __pyx_k_s[] = "s";
1718 static const char __pyx_k__2[] = "";
1719 static const char __pyx_k__6[] = " ";
1720 static const char __pyx_k__8[] = "<";
1721 static const char __pyx_k__9[] = "/";
1722 static const char __pyx_k_br[] = "br";
1723 static const char __pyx_k_dd[] = "dd";
1724 static const char __pyx_k_dl[] = "dl";
1725 static const char __pyx_k_dt[] = "dt";
1726 static const char __pyx_k_el[] = "el";
1727 static const char __pyx_k_h1[] = "h1";
1728 static const char __pyx_k_h2[] = "h2";
1729 static const char __pyx_k_h3[] = "h3";
1730 static const char __pyx_k_h4[] = "h4";
1731 static const char __pyx_k_h5[] = "h5";
1732 static const char __pyx_k_h6[] = "h6";
1733 static const char __pyx_k_hr[] = "hr";
1734 static const char __pyx_k_i1[] = "i1";
1735 static const char __pyx_k_i2[] = "i2";
1736 static const char __pyx_k_j1[] = "j1";
1737 static const char __pyx_k_j2[] = "j2";
1738 static const char __pyx_k_li[] = "li";
1739 static const char __pyx_k_of[] = " of ";
1740 static const char __pyx_k_ol[] = "ol";
1741 static const char __pyx_k_re[] = "re";
1742 static const char __pyx_k_td[] = "td";
1743 static const char __pyx_k_th[] = "th";
1744 static const char __pyx_k_tr[] = "tr";
1745 static const char __pyx_k_ul[] = "ul";
1746 static const char __pyx_k_S_s[] = "\\S+(?:\\s+|$)";
1747 static const char __pyx_k__10[] = "<>/";
1748 static const char __pyx_k__11[] = "<>";
1749 static const char __pyx_k__12[] = "</";
1750 static const char __pyx_k__13[] = ", ";
1751 static const char __pyx_k__14[] = ")";
1752 static const char __pyx_k__15[] = ": ";
1753 static const char __pyx_k__18[] = "=\"";
1754 static const char __pyx_k__19[] = "\"";
1755 static const char __pyx_k__20[] = ">";
1756 static const char __pyx_k_all[] = "__all__";
1757 static const char __pyx_k_cgi[] = "cgi";
1758 static const char __pyx_k_cls[] = "cls";
1759 static const char __pyx_k_col[] = "col";
1760 static const char __pyx_k_del[] = "<del>";
1761 static const char __pyx_k_dir[] = "dir";
1762 static const char __pyx_k_div[] = "div";
1763 static const char __pyx_k_doc[] = "doc";
1764 static const char __pyx_k_end[] = "end";
1765 static const char __pyx_k_get[] = "get";
1766 static const char __pyx_k_img[] = "img";
1767 static const char __pyx_k_ins[] = "<ins>";
1768 static const char __pyx_k_new[] = "__new__";
1769 static const char __pyx_k_obj[] = "obj";
1770 static const char __pyx_k_pop[] = "pop";
1771 static const char __pyx_k_pos[] = "pos";
1772 static const char __pyx_k_pre[] = "pre";
1773 static const char __pyx_k_src[] = "src";
1774 static const char __pyx_k_sub[] = "sub";
1775 static const char __pyx_k_tag[] = "tag";
1776 static const char __pyx_k_tok[] = "tok";
1777 static const char __pyx_k_zip[] = "zip";
1778 static const char __pyx_k_area[] = "area";
1779 static const char __pyx_k_args[] = "args";
1780 static const char __pyx_k_base[] = "base";
1781 static const char __pyx_k_body[] = "<body.*?>";
1782 static const char __pyx_k_data[] = "data";
1783 static const char __pyx_k_dest[] = "dest";
1784 static const char __pyx_k_find[] = "find";
1785 static const char __pyx_k_form[] = "form";
1786 static const char __pyx_k_href[] = "href";
1787 static const char __pyx_k_html[] = "html";
1788 static const char __pyx_k_item[] = "item";
1789 static const char __pyx_k_last[] = "last";
1790 static const char __pyx_k_link[] = "link";
1791 static const char __pyx_k_lxml[] = "lxml";
1792 static const char __pyx_k_main[] = "__main__";
1793 static const char __pyx_k_menu[] = "menu";
1794 static const char __pyx_k_meta[] = "meta";
1795 static const char __pyx_k_name[] = "__name__";
1796 static const char __pyx_k_next[] = "next";
1797 static const char __pyx_k_pos2[] = "pos2";
1798 static const char __pyx_k_post[] = "post";
1799 static const char __pyx_k_repr[] = "__repr__";
1800 static const char __pyx_k_self[] = "self";
1801 static const char __pyx_k_send[] = "send";
1802 static const char __pyx_k_size[] = "size";
1803 static const char __pyx_k_span[] = "</span>";
1804 static const char __pyx_k_tail[] = "tail";
1805 static const char __pyx_k_test[] = "__test__";
1806 static const char __pyx_k_text[] = "text";
1807 static const char __pyx_k_word[] = "word";
1808 static const char __pyx_k_child[] = "child";
1809 static const char __pyx_k_chunk[] = "chunk";
1810 static const char __pyx_k_close[] = "close";
1811 static const char __pyx_k_del_2[] = "</del> ";
1812 static const char __pyx_k_del_3[] = "del";
1813 static const char __pyx_k_doc_2[] = "__doc__";
1814 static const char __pyx_k_equal[] = "equal";
1815 static const char __pyx_k_etree[] = "etree";
1816 static const char __pyx_k_extra[] = "extra";
1817 static const char __pyx_k_index[] = "index";
1818 static const char __pyx_k_input[] = "input";
1819 static const char __pyx_k_ins_2[] = "</ins> ";
1820 static const char __pyx_k_ins_3[] = "ins";
1821 static const char __pyx_k_items[] = "items";
1822 static const char __pyx_k_match[] = "match";
1823 static const char __pyx_k_param[] = "param";
1824 static const char __pyx_k_rfind[] = "rfind";
1825 static const char __pyx_k_split[] = "split";
1826 static const char __pyx_k_start[] = "start";
1827 static const char __pyx_k_strip[] = "strip";
1828 static const char __pyx_k_t_n_r[] = "[ \\t\\n\\r]$";
1829 static const char __pyx_k_table[] = "table";
1830 static const char __pyx_k_tbody[] = "tbody";
1831 static const char __pyx_k_tfoot[] = "tfoot";
1832 static const char __pyx_k_thead[] = "thead";
1833 static const char __pyx_k_throw[] = "throw";
1834 static const char __pyx_k_token[] = "token";
1835 static const char __pyx_k_value[] = "value";
1836 static const char __pyx_k_words[] = "words";
1837 static const char __pyx_k_xpath[] = "xpath";
1838 static const char __pyx_k_Link_s[] = " Link: %s";
1839 static const char __pyx_k_actual[] = "actual";
1840 static const char __pyx_k_append[] = "append";
1841 static const char __pyx_k_attrib[] = "attrib";
1842 static const char __pyx_k_body_2[] = "</body.*?>";
1843 static const char __pyx_k_center[] = "center";
1844 static const char __pyx_k_chunks[] = ", chunks=";
1845 static const char __pyx_k_delete[] = "delete";
1846 static const char __pyx_k_endtag[] = "endtag";
1847 static const char __pyx_k_eq_new[] = "eq_new";
1848 static const char __pyx_k_eq_old[] = "eq_old";
1849 static const char __pyx_k_escape[] = "escape";
1850 static const char __pyx_k_extend[] = "extend";
1851 static const char __pyx_k_import[] = "__import__";
1852 static const char __pyx_k_insert[] = "insert";
1853 static const char __pyx_k_main_2[] = "main";
1854 static const char __pyx_k_markup[] = "markup";
1855 static const char __pyx_k_merged[] = "merged";
1856 static const char __pyx_k_method[] = "method";
1857 static const char __pyx_k_module[] = "__module__";
1858 static const char __pyx_k_name_2[] = "name";
1859 static const char __pyx_k_parent[] = "parent";
1860 static const char __pyx_k_result[] = ", result=";
1861 static const char __pyx_k_rstrip[] = "rstrip";
1862 static const char __pyx_k_search[] = "search";
1863 static const char __pyx_k_tokens[] = "tokens";
1864 static const char __pyx_k_DEL_END[] = "DEL_END";
1865 static const char __pyx_k_Element[] = "Element";
1866 static const char __pyx_k_address[] = "address";
1867 static const char __pyx_k_body_el[] = "body_el";
1868 static const char __pyx_k_body_re[] = "_body_re";
1869 static const char __pyx_k_cleanup[] = "cleanup";
1870 static const char __pyx_k_command[] = "command";
1871 static const char __pyx_k_compile[] = "compile";
1872 static const char __pyx_k_difflib[] = "difflib";
1873 static const char __pyx_k_doclist[] = "doclist";
1874 static const char __pyx_k_end_tag[] = "end_tag";
1875 static const char __pyx_k_findall[] = "findall";
1876 static const char __pyx_k_finding[] = "finding";
1877 static const char __pyx_k_ins_del[] = "</?(ins|del).*?>";
1878 static const char __pyx_k_is_word[] = "is_word";
1879 static const char __pyx_k_isindex[] = "isindex";
1880 static const char __pyx_k_prepare[] = "__prepare__";
1881 static const char __pyx_k_replace[] = "replace";
1882 static const char __pyx_k_src_tok[] = "src_tok";
1883 static const char __pyx_k_t_n_r_2[] = "^[ \\t\\n\\r]";
1884 static const char __pyx_k_token_2[] = "token(";
1885 static const char __pyx_k_unicode[] = "_unicode";
1886 static const char __pyx_k_version[] = "version";
1887 static const char __pyx_k_balanced[] = "balanced";
1888 static const char __pyx_k_basefont[] = "basefont";
1889 static const char __pyx_k_chunks_2[] = "chunks";
1890 static const char __pyx_k_commands[] = "commands";
1891 static const char __pyx_k_cur_word[] = "cur_word";
1892 static const char __pyx_k_dest_tok[] = "dest_tok";
1893 static const char __pyx_k_drop_tag[] = "drop_tag";
1894 static const char __pyx_k_encoding[] = "encoding";
1895 static const char __pyx_k_endswith[] = "endswith";
1896 static const char __pyx_k_fieldset[] = "fieldset";
1897 static const char __pyx_k_frameset[] = "frameset";
1898 static const char __pyx_k_htmldiff[] = "htmldiff";
1899 static const char __pyx_k_new_html[] = "new_html";
1900 static const char __pyx_k_noframes[] = "noframes";
1901 static const char __pyx_k_noscript[] = "noscript";
1902 static const char __pyx_k_old_html[] = "old_html";
1903 static const char __pyx_k_pre_tags[] = "pre_tags";
1904 static const char __pyx_k_previous[] = "previous";
1905 static const char __pyx_k_qualname[] = "__qualname__";
1906 static const char __pyx_k_result_2[] = "result";
1907 static const char __pyx_k_skip_tag[] = "skip_tag";
1908 static const char __pyx_k_tail_tag[] = "tail_tag";
1909 static const char __pyx_k_text_tag[] = "text_tag";
1910 static const char __pyx_k_tokenize[] = "tokenize";
1911 static const char __pyx_k_tostring[] = "tostring";
1912 static const char __pyx_k_DEL_START[] = "DEL_START";
1913 static const char __pyx_k_NameError[] = "NameError";
1914 static const char __pyx_k_NoDeletes[] = "NoDeletes";
1915 static const char __pyx_k_child_tag[] = "child_tag";
1916 static const char __pyx_k_end_words[] = "end_words";
1917 static const char __pyx_k_getparent[] = "getparent";
1918 static const char __pyx_k_html_repr[] = "html_repr";
1919 static const char __pyx_k_iselement[] = "iselement";
1920 static const char __pyx_k_lxml_html[] = "lxml.html";
1921 static const char __pyx_k_metaclass[] = "__metaclass__";
1922 static const char __pyx_k_post_tags[] = "post_tags";
1923 static const char __pyx_k_start_tag[] = "start_tag";
1924 static const char __pyx_k_tag_accum[] = "tag_accum";
1925 static const char __pyx_k_tag_stack[] = "tag_stack";
1926 static const char __pyx_k_tag_token[] = "tag_token(";
1927 static const char __pyx_k_threshold[] = "threshold";
1928 static const char __pyx_k_tokenlist[] = "tokenlist";
1929 static const char __pyx_k_ValueError[] = "ValueError";
1930 static const char __pyx_k_annotation[] = "annotation";
1931 static const char __pyx_k_basestring[] = "basestring";
1932 static const char __pyx_k_blockquote[] = "blockquote";
1933 static const char __pyx_k_cur_tokens[] = "cur_tokens";
1934 static const char __pyx_k_del_chunks[] = "del_chunks";
1935 static const char __pyx_k_del_tokens[] = "del_tokens";
1936 static const char __pyx_k_empty_tags[] = "empty_tags";
1937 static const char __pyx_k_flatten_el[] = "flatten_el";
1938 static const char __pyx_k_href_token[] = "href_token";
1939 static const char __pyx_k_ins_chunks[] = "ins_chunks";
1940 static const char __pyx_k_ins_del_re[] = "_ins_del_re";
1941 static const char __pyx_k_ins_tokens[] = "ins_tokens";
1942 static const char __pyx_k_is_end_tag[] = "is_end_tag";
1943 static const char __pyx_k_parse_html[] = "parse_html";
1944 static const char __pyx_k_pre_delete[] = "pre_delete";
1945 static const char __pyx_k_pre_tags_2[] = ", pre_tags=";
1946 static const char __pyx_k_skip_outer[] = "skip_outer";
1947 static const char __pyx_k_span_title[] = "<span title=\"";
1948 static const char __pyx_k_startswith[] = "startswith";
1949 static const char __pyx_k_token_html[] = "token.html";
1950 static const char __pyx_k_tokens_new[] = "tokens_new";
1951 static const char __pyx_k_tokens_old[] = "tokens_old";
1952 static const char __pyx_k_ImportError[] = "ImportError";
1953 static const char __pyx_k_diffcommand[] = "_diffcommand";
1954 static const char __pyx_k_end_body_re[] = "_end_body_re";
1955 static const char __pyx_k_get_opcodes[] = "get_opcodes";
1956 static const char __pyx_k_getchildren[] = "getchildren";
1957 static const char __pyx_k_html_escape[] = "html_escape";
1958 static const char __pyx_k_html_repr_2[] = ", html_repr=";
1959 static const char __pyx_k_markup_func[] = "markup_func";
1960 static const char __pyx_k_post_delete[] = "post_delete";
1961 static const char __pyx_k_post_tags_2[] = ", post_tags=";
1962 static const char __pyx_k_split_words[] = "split_words";
1963 static const char __pyx_k_start_words[] = "start_words";
1964 static const char __pyx_k_tag_token_2[] = "tag_token";
1965 static const char __pyx_k_token___new[] = "token.__new__";
1966 static const char __pyx_k_children_tag[] = "children_tag";
1967 static const char __pyx_k_cleanup_html[] = "cleanup_html";
1968 static const char __pyx_k_finding_name[] = "finding_name";
1969 static const char __pyx_k_fixup_chunks[] = "fixup_chunks";
1970 static const char __pyx_k_html1_tokens[] = "html1_tokens";
1971 static const char __pyx_k_html2_tokens[] = "html2_tokens";
1972 static const char __pyx_k_is_start_tag[] = "is_start_tag";
1973 static const char __pyx_k_merge_delete[] = "merge_delete";
1974 static const char __pyx_k_merge_insert[] = "merge_insert";
1975 static const char __pyx_k_split_delete[] = "split_delete";
1976 static const char __pyx_k_token___repr[] = "token.__repr__";
1977 static const char __pyx_k_create_parent[] = "create_parent";
1978 static const char __pyx_k_expand_tokens[] = "expand_tokens";
1979 static const char __pyx_k_html_annotate[] = "html_annotate";
1980 static const char __pyx_k_include_hrefs[] = "include_hrefs";
1981 static const char __pyx_k_cleanup_delete[] = "cleanup_delete";
1982 static const char __pyx_k_default_markup[] = "default_markup";
1983 static const char __pyx_k_lxml_html_diff[] = "lxml.html.diff";
1984 static const char __pyx_k_split_words_re[] = "split_words_re";
1985 static const char __pyx_k_tag_token_html[] = "tag_token.html";
1986 static const char __pyx_k_unbalanced_end[] = "unbalanced_end";
1987 static const char __pyx_k_SequenceMatcher[] = "SequenceMatcher";
1988 static const char __pyx_k_compress_tokens[] = "compress_tokens";
1989 static const char __pyx_k_hide_when_equal[] = "hide_when_equal";
1990 static const char __pyx_k_href_token_html[] = "href_token.html";
1991 static const char __pyx_k_htmldiff_tokens[] = "htmldiff_tokens";
1992 static const char __pyx_k_new_html_tokens[] = "new_html_tokens";
1993 static const char __pyx_k_old_html_tokens[] = "old_html_tokens";
1994 static const char __pyx_k_stripped_length[] = "stripped_length";
1995 static const char __pyx_k_tag_token___new[] = "tag_token.__new__";
1996 static const char __pyx_k_block_level_tags[] = "block_level_tags";
1997 static const char __pyx_k_copy_annotations[] = "copy_annotations";
1998 static const char __pyx_k_split_unbalanced[] = "split_unbalanced";
1999 static const char __pyx_k_tag_token___repr[] = "tag_token.__repr__";
2000 static const char __pyx_k_unbalanced_start[] = "unbalanced_start";
2001 static const char __pyx_k_end_whitespace_re[] = "end_whitespace_re";
2002 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2003 static const char __pyx_k_fixup_ins_del_tags[] = "fixup_ins_del_tags";
2004 static const char __pyx_k_tokenize_annotated[] = "tokenize_annotated";
2005 static const char __pyx_k_compress_merge_back[] = "compress_merge_back";
2006 static const char __pyx_k_fragment_fromstring[] = "fragment_fromstring";
2007 static const char __pyx_k_get_matching_blocks[] = "get_matching_blocks";
2008 static const char __pyx_k_start_whitespace_re[] = "start_whitespace_re";
2009 static const char __pyx_k_trailing_whitespace[] = "trailing_whitespace";
2010 static const char __pyx_k_Weird_state_cur_word[] = "Weird state, cur_word=";
2011 static const char __pyx_k_descendant_or_self_s[] = "descendant-or-self::%s";
2012 static const char __pyx_k_fixup_ins_del_tags_2[] = "_fixup_ins_del_tags";
2013 static const char __pyx_k_move_el_inside_block[] = "_move_el_inside_block";
2014 static const char __pyx_k_html_annotate_line_35[] = "html_annotate (line 35)";
2015 static const char __pyx_k_locate_unbalanced_end[] = "locate_unbalanced_end";
2016 static const char __pyx_k_src_lxml_html_diff_py[] = "src/lxml/html/diff.py";
2017 static const char __pyx_k_trailing_whitespace_2[] = ", trailing_whitespace=";
2018 static const char __pyx_k_merge_element_contents[] = "_merge_element_contents";
2019 static const char __pyx_k_Unexpected_delete_tag_r[] = "Unexpected delete tag: %r";
2020 static const char __pyx_k_locate_unbalanced_start[] = "locate_unbalanced_start";
2021 static const char __pyx_k_markup_serialize_tokens[] = "markup_serialize_tokens";
2022 static const char __pyx_k_serialize_html_fragment[] = "serialize_html_fragment";
2023 static const char __pyx_k_contains_block_level_tag[] = "_contains_block_level_tag";
2024 static const char __pyx_k_split_trailing_whitespace[] = "split_trailing_whitespace";
2025 static const char __pyx_k_InsensitiveSequenceMatcher[] = "InsensitiveSequenceMatcher";
2026 static const char __pyx_k_block_level_container_tags[] = "block_level_container_tags";
2027 static const char __pyx_k_doclist_should_be_ordered_from[] = "\n doclist should be ordered from oldest to newest, like::\n\n >>> version1 = 'Hello World'\n >>> version2 = 'Goodbye World'\n >>> print(html_annotate([(version1, 'version 1'),\n ... (version2, 'version 2')]))\n <span title=\"version 2\">Goodbye</span> <span title=\"version 1\">World</span>\n\n The documents must be *fragments* (str/UTF8 or unicode), not\n complete documents\n\n The markup argument is a function to markup the spans of words.\n This function is called like markup('Hello', 'version 2'), and\n returns HTML. The first argument is text and never includes any\n markup. The default uses a span with a title:\n\n >>> print(default_markup('Some Text', 'by Joe'))\n <span title=\"by Joe\">Some Text</span>\n ";
2028 static const char __pyx_k_Acts_like_SequenceMatcher_but_t[] = "\n Acts like SequenceMatcher, but tries not to find very small equal\n blocks amidst large spans of changes\n ";
2029 static const char __pyx_k_Raised_when_the_document_no_lon[] = " Raised when the document no longer contains any pending deletes\n (DEL_START/DEL_END) ";
2030 static const char __pyx_k_Represents_a_diffable_token_gen[] = " Represents a diffable token, generally a word that is displayed to\n the user. Opening tags are attached to this token when they are\n adjacent (pre_tags) and closing tags that follow the word\n (post_tags). Some exceptions occur when there are empty tags\n adjacent to a word, so there may be close tags in pre_tags, or\n open tags in post_tags.\n\n We also keep track of whether the word was originally followed by\n whitespace, even though we do not want to treat the word as\n equivalent to a similar word that does not have a trailing\n space.";
2031 static const char __pyx_k_Represents_a_token_that_is_actu[] = " Represents a token that is actually a tag. Currently this is just\n the <img> tag, which takes up visible space just like a word but\n is only represented in a document by a tag. ";
2032 static const char __pyx_k_Represents_the_href_in_an_ancho[] = " Represents the href in an anchor tag. Unlike other words, we only\n show the href when it changes. ";
2033 static const char __pyx_k_html_annotate_merge_annotations[] = "html_annotate_merge_annotations";
2034 static const char __pyx_k_pre_delete_and_post_delete_impl[] = " pre_delete and post_delete implicitly point to a place in the\n document (where the two were split). This moves that point (by\n popping items from one and pushing them onto the other). It moves\n the point to try to find a place where unbalanced_start applies.\n\n As an example::\n\n >>> unbalanced_start = ['<div>']\n >>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>']\n >>> pre, post = doc[:3], doc[3:]\n >>> pre, post\n (['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>'])\n >>> locate_unbalanced_start(unbalanced_start, pre, post)\n >>> pre, post\n (['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>'])\n\n As you can see, we moved the point so that the dangling <div> that\n we found will be effectively replaced by the div in the original\n document. If this doesn't work out, we just throw away\n unbalanced_start without doing anything.\n ";
2035 static const char __pyx_k_InsensitiveSequenceMatcher_get_m[] = "InsensitiveSequenceMatcher.get_matching_blocks";
2036 static const char __pyx_k_You_should_pass_in_an_element_no[] = "You should pass in an element, not a string like %r";
2037 static const char __pyx_k_locate_unbalanced_start_line_365[] = "locate_unbalanced_start (line 365)";
2038 static PyObject *__pyx_kp_u_;
2039 static PyObject *__pyx_kp_s_Acts_like_SequenceMatcher_but_t;
2040 static PyObject *__pyx_n_s_DEL_END;
2041 static PyObject *__pyx_n_s_DEL_START;
2042 static PyObject *__pyx_n_s_Element;
2043 static PyObject *__pyx_n_s_I;
2044 static PyObject *__pyx_n_s_ImportError;
2045 static PyObject *__pyx_n_s_InsensitiveSequenceMatcher;
2046 static PyObject *__pyx_n_s_InsensitiveSequenceMatcher_get_m;
2047 static PyObject *__pyx_kp_u_Link_s;
2048 static PyObject *__pyx_n_s_NameError;
2049 static PyObject *__pyx_n_s_NoDeletes;
2050 static PyObject *__pyx_kp_s_Raised_when_the_document_no_lon;
2051 static PyObject *__pyx_kp_s_Represents_a_diffable_token_gen;
2052 static PyObject *__pyx_kp_s_Represents_a_token_that_is_actu;
2053 static PyObject *__pyx_kp_s_Represents_the_href_in_an_ancho;
2054 static PyObject *__pyx_n_s_S;
2055 static PyObject *__pyx_kp_u_S_s;
2056 static PyObject *__pyx_n_s_SequenceMatcher;
2057 static PyObject *__pyx_n_s_U;
2058 static PyObject *__pyx_kp_u_Unexpected_delete_tag_r;
2059 static PyObject *__pyx_n_s_ValueError;
2060 static PyObject *__pyx_kp_u_Weird_state_cur_word;
2061 static PyObject *__pyx_kp_u_You_should_pass_in_an_element_no;
2062 static PyObject *__pyx_kp_u__10;
2063 static PyObject *__pyx_kp_u__11;
2064 static PyObject *__pyx_kp_u__12;
2065 static PyObject *__pyx_kp_u__13;
2066 static PyObject *__pyx_kp_u__14;
2067 static PyObject *__pyx_kp_u__15;
2068 static PyObject *__pyx_kp_u__18;
2069 static PyObject *__pyx_kp_u__19;
2070 static PyObject *__pyx_kp_u__2;
2071 static PyObject *__pyx_kp_u__20;
2072 static PyObject *__pyx_kp_u__6;
2073 static PyObject *__pyx_kp_u__8;
2074 static PyObject *__pyx_kp_u__9;
2075 static PyObject *__pyx_n_s_a;
2076 static PyObject *__pyx_n_u_a;
2077 static PyObject *__pyx_n_s_actual;
2078 static PyObject *__pyx_n_u_address;
2079 static PyObject *__pyx_n_s_all;
2080 static PyObject *__pyx_n_s_annotation;
2081 static PyObject *__pyx_n_s_append;
2082 static PyObject *__pyx_n_u_area;
2083 static PyObject *__pyx_n_s_args;
2084 static PyObject *__pyx_n_s_attrib;
2085 static PyObject *__pyx_n_s_b;
2086 static PyObject *__pyx_n_s_balanced;
2087 static PyObject *__pyx_n_u_base;
2088 static PyObject *__pyx_n_u_basefont;
2089 static PyObject *__pyx_n_s_basestring;
2090 static PyObject *__pyx_n_s_block_level_container_tags;
2091 static PyObject *__pyx_n_s_block_level_tags;
2092 static PyObject *__pyx_n_u_blockquote;
2093 static PyObject *__pyx_kp_u_body;
2094 static PyObject *__pyx_kp_u_body_2;
2095 static PyObject *__pyx_n_s_body_el;
2096 static PyObject *__pyx_n_s_body_re;
2097 static PyObject *__pyx_n_u_br;
2098 static PyObject *__pyx_n_u_center;
2099 static PyObject *__pyx_n_s_cgi;
2100 static PyObject *__pyx_n_s_child;
2101 static PyObject *__pyx_n_s_child_tag;
2102 static PyObject *__pyx_n_s_children_tag;
2103 static PyObject *__pyx_n_s_chunk;
2104 static PyObject *__pyx_kp_u_chunks;
2105 static PyObject *__pyx_n_s_chunks_2;
2106 static PyObject *__pyx_n_s_cleanup;
2107 static PyObject *__pyx_n_s_cleanup_delete;
2108 static PyObject *__pyx_n_s_cleanup_html;
2109 static PyObject *__pyx_n_s_cline_in_traceback;
2110 static PyObject *__pyx_n_s_close;
2111 static PyObject *__pyx_n_s_cls;
2112 static PyObject *__pyx_n_u_col;
2113 static PyObject *__pyx_n_s_command;
2114 static PyObject *__pyx_n_s_commands;
2115 static PyObject *__pyx_n_s_compile;
2116 static PyObject *__pyx_n_s_compress_merge_back;
2117 static PyObject *__pyx_n_s_compress_tokens;
2118 static PyObject *__pyx_n_s_contains_block_level_tag;
2119 static PyObject *__pyx_n_s_copy_annotations;
2120 static PyObject *__pyx_n_s_create_parent;
2121 static PyObject *__pyx_n_s_cur_tokens;
2122 static PyObject *__pyx_n_s_cur_word;
2123 static PyObject *__pyx_n_s_data;
2124 static PyObject *__pyx_n_u_dd;
2125 static PyObject *__pyx_n_s_default_markup;
2126 static PyObject *__pyx_kp_u_del;
2127 static PyObject *__pyx_kp_u_del_2;
2128 static PyObject *__pyx_n_u_del_3;
2129 static PyObject *__pyx_n_s_del_chunks;
2130 static PyObject *__pyx_n_s_del_tokens;
2131 static PyObject *__pyx_n_s_delete;
2132 static PyObject *__pyx_n_u_delete;
2133 static PyObject *__pyx_kp_u_descendant_or_self_s;
2134 static PyObject *__pyx_n_s_dest;
2135 static PyObject *__pyx_n_s_dest_tok;
2136 static PyObject *__pyx_n_s_diffcommand;
2137 static PyObject *__pyx_n_s_difflib;
2138 static PyObject *__pyx_n_u_dir;
2139 static PyObject *__pyx_n_u_div;
2140 static PyObject *__pyx_n_u_dl;
2141 static PyObject *__pyx_n_s_doc;
2142 static PyObject *__pyx_n_s_doc_2;
2143 static PyObject *__pyx_n_s_doclist;
2144 static PyObject *__pyx_kp_u_doclist_should_be_ordered_from;
2145 static PyObject *__pyx_n_s_drop_tag;
2146 static PyObject *__pyx_n_u_dt;
2147 static PyObject *__pyx_n_s_el;
2148 static PyObject *__pyx_n_s_empty_tags;
2149 static PyObject *__pyx_n_s_encoding;
2150 static PyObject *__pyx_n_s_end;
2151 static PyObject *__pyx_n_s_end_body_re;
2152 static PyObject *__pyx_n_s_end_tag;
2153 static PyObject *__pyx_n_s_end_whitespace_re;
2154 static PyObject *__pyx_n_s_end_words;
2155 static PyObject *__pyx_n_s_endswith;
2156 static PyObject *__pyx_n_s_endtag;
2157 static PyObject *__pyx_n_s_eq_new;
2158 static PyObject *__pyx_n_s_eq_old;
2159 static PyObject *__pyx_n_s_equal;
2160 static PyObject *__pyx_n_u_equal;
2161 static PyObject *__pyx_n_s_escape;
2162 static PyObject *__pyx_n_s_etree;
2163 static PyObject *__pyx_n_s_expand_tokens;
2164 static PyObject *__pyx_n_s_extend;
2165 static PyObject *__pyx_n_s_extra;
2166 static PyObject *__pyx_n_u_fieldset;
2167 static PyObject *__pyx_n_s_find;
2168 static PyObject *__pyx_n_s_findall;
2169 static PyObject *__pyx_n_s_finding;
2170 static PyObject *__pyx_n_s_finding_name;
2171 static PyObject *__pyx_n_s_fixup_chunks;
2172 static PyObject *__pyx_n_s_fixup_ins_del_tags;
2173 static PyObject *__pyx_n_s_fixup_ins_del_tags_2;
2174 static PyObject *__pyx_n_s_flatten_el;
2175 static PyObject *__pyx_n_u_form;
2176 static PyObject *__pyx_n_s_fragment_fromstring;
2177 static PyObject *__pyx_n_u_frameset;
2178 static PyObject *__pyx_n_s_get;
2179 static PyObject *__pyx_n_s_get_matching_blocks;
2180 static PyObject *__pyx_n_s_get_opcodes;
2181 static PyObject *__pyx_n_s_getchildren;
2182 static PyObject *__pyx_n_s_getparent;
2183 static PyObject *__pyx_n_u_h1;
2184 static PyObject *__pyx_n_u_h2;
2185 static PyObject *__pyx_n_u_h3;
2186 static PyObject *__pyx_n_u_h4;
2187 static PyObject *__pyx_n_u_h5;
2188 static PyObject *__pyx_n_u_h6;
2189 static PyObject *__pyx_n_s_hide_when_equal;
2190 static PyObject *__pyx_n_u_hr;
2191 static PyObject *__pyx_n_s_href;
2192 static PyObject *__pyx_n_u_href;
2193 static PyObject *__pyx_n_s_href_token;
2194 static PyObject *__pyx_n_s_href_token_html;
2195 static PyObject *__pyx_n_s_html;
2196 static PyObject *__pyx_n_u_html;
2197 static PyObject *__pyx_n_s_html1_tokens;
2198 static PyObject *__pyx_n_s_html2_tokens;
2199 static PyObject *__pyx_n_s_html_annotate;
2200 static PyObject *__pyx_n_u_html_annotate;
2201 static PyObject *__pyx_kp_u_html_annotate_line_35;
2202 static PyObject *__pyx_n_s_html_annotate_merge_annotations;
2203 static PyObject *__pyx_n_s_html_escape;
2204 static PyObject *__pyx_n_s_html_repr;
2205 static PyObject *__pyx_kp_u_html_repr_2;
2206 static PyObject *__pyx_n_s_htmldiff;
2207 static PyObject *__pyx_n_u_htmldiff;
2208 static PyObject *__pyx_n_s_htmldiff_tokens;
2209 static PyObject *__pyx_n_s_i1;
2210 static PyObject *__pyx_n_s_i2;
2211 static PyObject *__pyx_n_u_img;
2212 static PyObject *__pyx_n_s_import;
2213 static PyObject *__pyx_n_s_include_hrefs;
2214 static PyObject *__pyx_n_s_index;
2215 static PyObject *__pyx_n_u_input;
2216 static PyObject *__pyx_kp_u_ins;
2217 static PyObject *__pyx_kp_u_ins_2;
2218 static PyObject *__pyx_n_u_ins_3;
2219 static PyObject *__pyx_n_s_ins_chunks;
2220 static PyObject *__pyx_kp_u_ins_del;
2221 static PyObject *__pyx_n_s_ins_del_re;
2222 static PyObject *__pyx_n_s_ins_tokens;
2223 static PyObject *__pyx_n_s_insert;
2224 static PyObject *__pyx_n_u_insert;
2225 static PyObject *__pyx_n_s_is_end_tag;
2226 static PyObject *__pyx_n_s_is_start_tag;
2227 static PyObject *__pyx_n_s_is_word;
2228 static PyObject *__pyx_n_s_iselement;
2229 static PyObject *__pyx_n_u_isindex;
2230 static PyObject *__pyx_n_s_item;
2231 static PyObject *__pyx_n_s_items;
2232 static PyObject *__pyx_n_s_j1;
2233 static PyObject *__pyx_n_s_j2;
2234 static PyObject *__pyx_n_s_last;
2235 static PyObject *__pyx_n_u_li;
2236 static PyObject *__pyx_n_u_link;
2237 static PyObject *__pyx_n_s_locate_unbalanced_end;
2238 static PyObject *__pyx_n_s_locate_unbalanced_start;
2239 static PyObject *__pyx_kp_u_locate_unbalanced_start_line_365;
2240 static PyObject *__pyx_n_s_lxml;
2241 static PyObject *__pyx_n_s_lxml_html;
2242 static PyObject *__pyx_n_s_lxml_html_diff;
2243 static PyObject *__pyx_n_s_main;
2244 static PyObject *__pyx_n_u_main;
2245 static PyObject *__pyx_n_s_main_2;
2246 static PyObject *__pyx_n_s_markup;
2247 static PyObject *__pyx_n_s_markup_func;
2248 static PyObject *__pyx_n_s_markup_serialize_tokens;
2249 static PyObject *__pyx_n_s_match;
2250 static PyObject *__pyx_n_u_menu;
2251 static PyObject *__pyx_n_s_merge_delete;
2252 static PyObject *__pyx_n_s_merge_element_contents;
2253 static PyObject *__pyx_n_s_merge_insert;
2254 static PyObject *__pyx_n_s_merged;
2255 static PyObject *__pyx_n_u_meta;
2256 static PyObject *__pyx_n_s_metaclass;
2257 static PyObject *__pyx_n_s_method;
2258 static PyObject *__pyx_n_s_module;
2259 static PyObject *__pyx_n_s_move_el_inside_block;
2260 static PyObject *__pyx_n_s_name;
2261 static PyObject *__pyx_n_s_name_2;
2262 static PyObject *__pyx_n_s_new;
2263 static PyObject *__pyx_n_s_new_html;
2264 static PyObject *__pyx_n_s_new_html_tokens;
2265 static PyObject *__pyx_n_s_next;
2266 static PyObject *__pyx_n_u_noframes;
2267 static PyObject *__pyx_n_u_noscript;
2268 static PyObject *__pyx_n_s_obj;
2269 static PyObject *__pyx_kp_u_of;
2270 static PyObject *__pyx_n_u_ol;
2271 static PyObject *__pyx_n_s_old_html;
2272 static PyObject *__pyx_n_s_old_html_tokens;
2273 static PyObject *__pyx_n_u_p;
2274 static PyObject *__pyx_n_u_param;
2275 static PyObject *__pyx_n_s_parent;
2276 static PyObject *__pyx_n_s_parse_html;
2277 static PyObject *__pyx_n_s_pop;
2278 static PyObject *__pyx_n_s_pos;
2279 static PyObject *__pyx_n_s_pos2;
2280 static PyObject *__pyx_n_s_post;
2281 static PyObject *__pyx_n_s_post_delete;
2282 static PyObject *__pyx_n_s_post_tags;
2283 static PyObject *__pyx_kp_u_post_tags_2;
2284 static PyObject *__pyx_n_s_pre;
2285 static PyObject *__pyx_n_u_pre;
2286 static PyObject *__pyx_n_s_pre_delete;
2287 static PyObject *__pyx_kp_u_pre_delete_and_post_delete_impl;
2288 static PyObject *__pyx_n_s_pre_tags;
2289 static PyObject *__pyx_kp_u_pre_tags_2;
2290 static PyObject *__pyx_n_s_prepare;
2291 static PyObject *__pyx_n_s_previous;
2292 static PyObject *__pyx_n_s_qualname;
2293 static PyObject *__pyx_n_s_re;
2294 static PyObject *__pyx_n_s_replace;
2295 static PyObject *__pyx_n_u_replace;
2296 static PyObject *__pyx_n_s_repr;
2297 static PyObject *__pyx_kp_u_result;
2298 static PyObject *__pyx_n_s_result_2;
2299 static PyObject *__pyx_n_s_rfind;
2300 static PyObject *__pyx_n_s_rstrip;
2301 static PyObject *__pyx_n_s_s;
2302 static PyObject *__pyx_n_s_search;
2303 static PyObject *__pyx_n_s_self;
2304 static PyObject *__pyx_n_s_send;
2305 static PyObject *__pyx_n_s_serialize_html_fragment;
2306 static PyObject *__pyx_n_s_size;
2307 static PyObject *__pyx_n_s_skip_outer;
2308 static PyObject *__pyx_n_s_skip_tag;
2309 static PyObject *__pyx_kp_u_span;
2310 static PyObject *__pyx_kp_u_span_title;
2311 static PyObject *__pyx_n_s_split;
2312 static PyObject *__pyx_n_s_split_delete;
2313 static PyObject *__pyx_n_s_split_trailing_whitespace;
2314 static PyObject *__pyx_n_s_split_unbalanced;
2315 static PyObject *__pyx_n_s_split_words;
2316 static PyObject *__pyx_n_s_split_words_re;
2317 static PyObject *__pyx_n_s_src;
2318 static PyObject *__pyx_n_u_src;
2319 static PyObject *__pyx_kp_s_src_lxml_html_diff_py;
2320 static PyObject *__pyx_n_s_src_tok;
2321 static PyObject *__pyx_n_s_start;
2322 static PyObject *__pyx_n_s_start_tag;
2323 static PyObject *__pyx_n_s_start_whitespace_re;
2324 static PyObject *__pyx_n_s_start_words;
2325 static PyObject *__pyx_n_s_startswith;
2326 static PyObject *__pyx_n_s_strip;
2327 static PyObject *__pyx_n_s_stripped_length;
2328 static PyObject *__pyx_n_s_sub;
2329 static PyObject *__pyx_kp_u_t_n_r;
2330 static PyObject *__pyx_kp_u_t_n_r_2;
2331 static PyObject *__pyx_n_u_table;
2332 static PyObject *__pyx_n_s_tag;
2333 static PyObject *__pyx_n_s_tag_accum;
2334 static PyObject *__pyx_n_s_tag_stack;
2335 static PyObject *__pyx_kp_u_tag_token;
2336 static PyObject *__pyx_n_s_tag_token_2;
2337 static PyObject *__pyx_n_s_tag_token___new;
2338 static PyObject *__pyx_n_s_tag_token___repr;
2339 static PyObject *__pyx_n_s_tag_token_html;
2340 static PyObject *__pyx_n_s_tail;
2341 static PyObject *__pyx_n_s_tail_tag;
2342 static PyObject *__pyx_n_u_tbody;
2343 static PyObject *__pyx_n_u_td;
2344 static PyObject *__pyx_n_s_test;
2345 static PyObject *__pyx_n_s_text;
2346 static PyObject *__pyx_n_s_text_tag;
2347 static PyObject *__pyx_n_u_tfoot;
2348 static PyObject *__pyx_n_u_th;
2349 static PyObject *__pyx_n_u_thead;
2350 static PyObject *__pyx_n_s_threshold;
2351 static PyObject *__pyx_n_s_throw;
2352 static PyObject *__pyx_n_s_tok;
2353 static PyObject *__pyx_n_s_token;
2354 static PyObject *__pyx_kp_u_token_2;
2355 static PyObject *__pyx_n_s_token___new;
2356 static PyObject *__pyx_n_s_token___repr;
2357 static PyObject *__pyx_n_s_token_html;
2358 static PyObject *__pyx_n_s_tokenize;
2359 static PyObject *__pyx_n_s_tokenize_annotated;
2360 static PyObject *__pyx_n_s_tokenlist;
2361 static PyObject *__pyx_n_s_tokens;
2362 static PyObject *__pyx_n_s_tokens_new;
2363 static PyObject *__pyx_n_s_tokens_old;
2364 static PyObject *__pyx_n_s_tostring;
2365 static PyObject *__pyx_n_u_tr;
2366 static PyObject *__pyx_n_s_trailing_whitespace;
2367 static PyObject *__pyx_kp_u_trailing_whitespace_2;
2368 static PyObject *__pyx_n_u_ul;
2369 static PyObject *__pyx_n_s_unbalanced_end;
2370 static PyObject *__pyx_n_s_unbalanced_start;
2371 static PyObject *__pyx_n_s_unicode;
2372 static PyObject *__pyx_n_s_value;
2373 static PyObject *__pyx_n_s_version;
2374 static PyObject *__pyx_n_s_word;
2375 static PyObject *__pyx_n_s_words;
2376 static PyObject *__pyx_n_s_xpath;
2377 static PyObject *__pyx_n_s_zip;
2378 static PyObject *__pyx_pf_4lxml_4html_4diff_default_markup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_version); /* proto */
2379 static PyObject *__pyx_pf_4lxml_4html_4diff_75__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
2380 static PyObject *__pyx_pf_4lxml_4html_4diff_2html_annotate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doclist, PyObject *__pyx_v_markup); /* proto */
2381 static PyObject *__pyx_pf_4lxml_4html_4diff_4tokenize_annotated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doc, PyObject *__pyx_v_annotation); /* proto */
2382 static PyObject *__pyx_pf_4lxml_4html_4diff_6html_annotate_merge_annotations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens_old, PyObject *__pyx_v_tokens_new); /* proto */
2383 static PyObject *__pyx_pf_4lxml_4html_4diff_8copy_annotations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_src, PyObject *__pyx_v_dest); /* proto */
2384 static PyObject *__pyx_pf_4lxml_4html_4diff_10compress_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens); /* proto */
2385 static PyObject *__pyx_pf_4lxml_4html_4diff_12compress_merge_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_tok); /* proto */
2386 static PyObject *__pyx_pf_4lxml_4html_4diff_14markup_serialize_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_markup_func); /* proto */
2387 static PyObject *__pyx_pf_4lxml_4html_4diff_17htmldiff(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_old_html, PyObject *__pyx_v_new_html); /* proto */
2388 static PyObject *__pyx_pf_4lxml_4html_4diff_19htmldiff_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html1_tokens, PyObject *__pyx_v_html2_tokens); /* proto */
2389 static PyObject *__pyx_pf_4lxml_4html_4diff_21expand_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_equal); /* proto */
2390 static PyObject *__pyx_pf_4lxml_4html_4diff_24merge_insert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ins_chunks, PyObject *__pyx_v_doc); /* proto */
2391 static PyObject *__pyx_pf_4lxml_4html_4diff_26merge_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_del_chunks, PyObject *__pyx_v_doc); /* proto */
2392 static PyObject *__pyx_pf_4lxml_4html_4diff_28cleanup_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks); /* proto */
2393 static PyObject *__pyx_pf_4lxml_4html_4diff_30split_unbalanced(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks); /* proto */
2394 static PyObject *__pyx_pf_4lxml_4html_4diff_32split_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks); /* proto */
2395 static PyObject *__pyx_pf_4lxml_4html_4diff_34locate_unbalanced_start(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_unbalanced_start, PyObject *__pyx_v_pre_delete, PyObject *__pyx_v_post_delete); /* proto */
2396 static PyObject *__pyx_pf_4lxml_4html_4diff_36locate_unbalanced_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_unbalanced_end, PyObject *__pyx_v_pre_delete, PyObject *__pyx_v_post_delete); /* proto */
2397 static PyObject *__pyx_pf_4lxml_4html_4diff_5token___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_text, PyObject *__pyx_v_pre_tags, PyObject *__pyx_v_post_tags, PyObject *__pyx_v_trailing_whitespace); /* proto */
2398 static PyObject *__pyx_pf_4lxml_4html_4diff_5token_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2399 static PyObject *__pyx_pf_4lxml_4html_4diff_5token_4html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2400 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_tag, PyObject *__pyx_v_data, PyObject *__pyx_v_html_repr, PyObject *__pyx_v_pre_tags, PyObject *__pyx_v_post_tags, PyObject *__pyx_v_trailing_whitespace); /* proto */
2401 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2402 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token_4html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2403 static PyObject *__pyx_pf_4lxml_4html_4diff_10href_token_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2404 static PyObject *__pyx_pf_4lxml_4html_4diff_38tokenize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html, PyObject *__pyx_v_include_hrefs); /* proto */
2405 static PyObject *__pyx_pf_4lxml_4html_4diff_40parse_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html, PyObject *__pyx_v_cleanup); /* proto */
2406 static PyObject *__pyx_pf_4lxml_4html_4diff_42cleanup_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html); /* proto */
2407 static PyObject *__pyx_pf_4lxml_4html_4diff_44split_trailing_whitespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_word); /* proto */
2408 static PyObject *__pyx_pf_4lxml_4html_4diff_46fixup_chunks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks); /* proto */
2409 static PyObject *__pyx_pf_4lxml_4html_4diff_48flatten_el(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_include_hrefs, PyObject *__pyx_v_skip_tag); /* proto */
2410 static PyObject *__pyx_pf_4lxml_4html_4diff_51split_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */
2411 static PyObject *__pyx_pf_4lxml_4html_4diff_53start_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el); /* proto */
2412 static PyObject *__pyx_pf_4lxml_4html_4diff_55end_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el); /* proto */
2413 static PyObject *__pyx_pf_4lxml_4html_4diff_57is_word(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok); /* proto */
2414 static PyObject *__pyx_pf_4lxml_4html_4diff_59is_end_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok); /* proto */
2415 static PyObject *__pyx_pf_4lxml_4html_4diff_61is_start_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok); /* proto */
2416 static PyObject *__pyx_pf_4lxml_4html_4diff_63fixup_ins_del_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html); /* proto */
2417 static PyObject *__pyx_pf_4lxml_4html_4diff_65serialize_html_fragment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_skip_outer); /* proto */
2418 static PyObject *__pyx_pf_4lxml_4html_4diff_67_fixup_ins_del_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doc); /* proto */
2419 static PyObject *__pyx_pf_4lxml_4html_4diff_69_contains_block_level_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el); /* proto */
2420 static PyObject *__pyx_pf_4lxml_4html_4diff_71_move_el_inside_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_tag); /* proto */
2421 static PyObject *__pyx_pf_4lxml_4html_4diff_73_merge_element_contents(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el); /* proto */
2422 static PyObject *__pyx_pf_4lxml_4html_4diff_26InsensitiveSequenceMatcher_get_matching_blocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2423 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2424 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2425 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2426 static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
2427 static PyObject *__pyx_int_0;
2428 static PyObject *__pyx_int_1;
2429 static PyObject *__pyx_int_2;
2430 static PyObject *__pyx_int_4;
2431 static PyObject *__pyx_int_neg_1;
2432 static PyObject *__pyx_slice__3;
2433 static PyObject *__pyx_slice__7;
2434 static PyObject *__pyx_slice__22;
2435 static PyObject *__pyx_tuple__16;
2436 static PyObject *__pyx_tuple__21;
2437 static PyObject *__pyx_tuple__23;
2438 static PyObject *__pyx_tuple__25;
2439 static PyObject *__pyx_tuple__27;
2440 static PyObject *__pyx_tuple__29;
2441 static PyObject *__pyx_tuple__31;
2442 static PyObject *__pyx_tuple__33;
2443 static PyObject *__pyx_tuple__35;
2444 static PyObject *__pyx_tuple__37;
2445 static PyObject *__pyx_tuple__38;
2446 static PyObject *__pyx_tuple__40;
2447 static PyObject *__pyx_tuple__42;
2448 static PyObject *__pyx_tuple__43;
2449 static PyObject *__pyx_tuple__44;
2450 static PyObject *__pyx_tuple__46;
2451 static PyObject *__pyx_tuple__48;
2452 static PyObject *__pyx_tuple__50;
2453 static PyObject *__pyx_tuple__52;
2454 static PyObject *__pyx_tuple__54;
2455 static PyObject *__pyx_tuple__56;
2456 static PyObject *__pyx_tuple__58;
2457 static PyObject *__pyx_tuple__60;
2458 static PyObject *__pyx_tuple__61;
2459 static PyObject *__pyx_tuple__63;
2460 static PyObject *__pyx_tuple__65;
2461 static PyObject *__pyx_tuple__67;
2462 static PyObject *__pyx_tuple__68;
2463 static PyObject *__pyx_tuple__70;
2464 static PyObject *__pyx_tuple__72;
2465 static PyObject *__pyx_tuple__74;
2466 static PyObject *__pyx_tuple__76;
2467 static PyObject *__pyx_tuple__77;
2468 static PyObject *__pyx_tuple__79;
2469 static PyObject *__pyx_tuple__80;
2470 static PyObject *__pyx_tuple__82;
2471 static PyObject *__pyx_tuple__83;
2472 static PyObject *__pyx_tuple__85;
2473 static PyObject *__pyx_tuple__87;
2474 static PyObject *__pyx_tuple__88;
2475 static PyObject *__pyx_tuple__89;
2476 static PyObject *__pyx_tuple__90;
2477 static PyObject *__pyx_tuple__91;
2478 static PyObject *__pyx_tuple__92;
2479 static PyObject *__pyx_tuple__94;
2480 static PyObject *__pyx_tuple__95;
2481 static PyObject *__pyx_tuple__97;
2482 static PyObject *__pyx_tuple__99;
2483 static PyObject *__pyx_codeobj__4;
2484 static PyObject *__pyx_codeobj__5;
2485 static PyObject *__pyx_tuple__101;
2486 static PyObject *__pyx_tuple__103;
2487 static PyObject *__pyx_tuple__105;
2488 static PyObject *__pyx_tuple__107;
2489 static PyObject *__pyx_tuple__109;
2490 static PyObject *__pyx_tuple__110;
2491 static PyObject *__pyx_tuple__112;
2492 static PyObject *__pyx_tuple__114;
2493 static PyObject *__pyx_tuple__116;
2494 static PyObject *__pyx_tuple__118;
2495 static PyObject *__pyx_codeobj__17;
2496 static PyObject *__pyx_codeobj__24;
2497 static PyObject *__pyx_codeobj__26;
2498 static PyObject *__pyx_codeobj__28;
2499 static PyObject *__pyx_codeobj__30;
2500 static PyObject *__pyx_codeobj__32;
2501 static PyObject *__pyx_codeobj__34;
2502 static PyObject *__pyx_codeobj__36;
2503 static PyObject *__pyx_codeobj__39;
2504 static PyObject *__pyx_codeobj__41;
2505 static PyObject *__pyx_codeobj__45;
2506 static PyObject *__pyx_codeobj__47;
2507 static PyObject *__pyx_codeobj__49;
2508 static PyObject *__pyx_codeobj__51;
2509 static PyObject *__pyx_codeobj__53;
2510 static PyObject *__pyx_codeobj__55;
2511 static PyObject *__pyx_codeobj__57;
2512 static PyObject *__pyx_codeobj__59;
2513 static PyObject *__pyx_codeobj__62;
2514 static PyObject *__pyx_codeobj__64;
2515 static PyObject *__pyx_codeobj__66;
2516 static PyObject *__pyx_codeobj__69;
2517 static PyObject *__pyx_codeobj__71;
2518 static PyObject *__pyx_codeobj__73;
2519 static PyObject *__pyx_codeobj__75;
2520 static PyObject *__pyx_codeobj__78;
2521 static PyObject *__pyx_codeobj__81;
2522 static PyObject *__pyx_codeobj__84;
2523 static PyObject *__pyx_codeobj__86;
2524 static PyObject *__pyx_codeobj__93;
2525 static PyObject *__pyx_codeobj__96;
2526 static PyObject *__pyx_codeobj__98;
2527 static PyObject *__pyx_codeobj__100;
2528 static PyObject *__pyx_codeobj__102;
2529 static PyObject *__pyx_codeobj__104;
2530 static PyObject *__pyx_codeobj__106;
2531 static PyObject *__pyx_codeobj__108;
2532 static PyObject *__pyx_codeobj__111;
2533 static PyObject *__pyx_codeobj__113;
2534 static PyObject *__pyx_codeobj__115;
2535 static PyObject *__pyx_codeobj__117;
2536 static PyObject *__pyx_codeobj__119;
2539 /* "lxml/html/diff.py":31
2540 * ############################################################
2542 * def default_markup(text, version): # <<<<<<<<<<<<<<
2543 * return '<span title="%s">%s</span>' % (
2544 * html_escape(_unicode(version), 1), text)
2547 /* Python wrapper */
2548 static PyObject *__pyx_pw_4lxml_4html_4diff_1default_markup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2549 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_1default_markup = {"default_markup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_1default_markup, METH_VARARGS|METH_KEYWORDS, 0};
2550 static PyObject *__pyx_pw_4lxml_4html_4diff_1default_markup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2551 PyObject *__pyx_v_text = 0;
2552 PyObject *__pyx_v_version = 0;
2553 int __pyx_lineno = 0;
2554 const char *__pyx_filename = NULL;
2555 int __pyx_clineno = 0;
2556 PyObject *__pyx_r = 0;
2557 __Pyx_RefNannyDeclarations
2558 __Pyx_RefNannySetupContext("default_markup (wrapper)", 0);
2560 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_version,0};
2561 PyObject* values[2] = {0,0};
2562 if (unlikely(__pyx_kwds)) {
2564 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2566 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2568 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2571 default: goto __pyx_L5_argtuple_error;
2573 kw_args = PyDict_Size(__pyx_kwds);
2576 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
2577 else goto __pyx_L5_argtuple_error;
2580 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_version)) != 0)) kw_args--;
2582 __Pyx_RaiseArgtupleInvalid("default_markup", 1, 2, 2, 1); __PYX_ERR(0, 31, __pyx_L3_error)
2585 if (unlikely(kw_args > 0)) {
2586 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_markup") < 0)) __PYX_ERR(0, 31, __pyx_L3_error)
2588 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2589 goto __pyx_L5_argtuple_error;
2591 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2592 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2594 __pyx_v_text = values[0];
2595 __pyx_v_version = values[1];
2597 goto __pyx_L4_argument_unpacking_done;
2598 __pyx_L5_argtuple_error:;
2599 __Pyx_RaiseArgtupleInvalid("default_markup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 31, __pyx_L3_error)
2601 __Pyx_AddTraceback("lxml.html.diff.default_markup", __pyx_clineno, __pyx_lineno, __pyx_filename);
2602 __Pyx_RefNannyFinishContext();
2604 __pyx_L4_argument_unpacking_done:;
2605 __pyx_r = __pyx_pf_4lxml_4html_4diff_default_markup(__pyx_self, __pyx_v_text, __pyx_v_version);
2607 /* function exit code */
2608 __Pyx_RefNannyFinishContext();
2612 static PyObject *__pyx_pf_4lxml_4html_4diff_default_markup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_version) {
2613 PyObject *__pyx_r = NULL;
2614 __Pyx_RefNannyDeclarations
2615 PyObject *__pyx_t_1 = NULL;
2616 Py_ssize_t __pyx_t_2;
2618 PyObject *__pyx_t_4 = NULL;
2619 PyObject *__pyx_t_5 = NULL;
2620 PyObject *__pyx_t_6 = NULL;
2621 PyObject *__pyx_t_7 = NULL;
2622 PyObject *__pyx_t_8 = NULL;
2624 int __pyx_lineno = 0;
2625 const char *__pyx_filename = NULL;
2626 int __pyx_clineno = 0;
2627 __Pyx_RefNannySetupContext("default_markup", 0);
2629 /* "lxml/html/diff.py":32
2631 * def default_markup(text, version):
2632 * return '<span title="%s">%s</span>' % ( # <<<<<<<<<<<<<<
2633 * html_escape(_unicode(version), 1), text)
2636 __Pyx_XDECREF(__pyx_r);
2637 __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
2638 __Pyx_GOTREF(__pyx_t_1);
2641 __Pyx_INCREF(__pyx_kp_u_span_title);
2643 __Pyx_GIVEREF(__pyx_kp_u_span_title);
2644 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_span_title);
2646 /* "lxml/html/diff.py":33
2647 * def default_markup(text, version):
2648 * return '<span title="%s">%s</span>' % (
2649 * html_escape(_unicode(version), 1), text) # <<<<<<<<<<<<<<
2651 * def html_annotate(doclist, markup=default_markup):
2653 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_html_escape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error)
2654 __Pyx_GOTREF(__pyx_t_5);
2655 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error)
2656 __Pyx_GOTREF(__pyx_t_7);
2658 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
2659 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
2660 if (likely(__pyx_t_8)) {
2661 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2662 __Pyx_INCREF(__pyx_t_8);
2663 __Pyx_INCREF(function);
2664 __Pyx_DECREF_SET(__pyx_t_7, function);
2667 __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_version) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_version);
2668 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2669 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 33, __pyx_L1_error)
2670 __Pyx_GOTREF(__pyx_t_6);
2671 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2674 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
2675 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
2676 if (likely(__pyx_t_7)) {
2677 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2678 __Pyx_INCREF(__pyx_t_7);
2679 __Pyx_INCREF(function);
2680 __Pyx_DECREF_SET(__pyx_t_5, function);
2684 #if CYTHON_FAST_PYCALL
2685 if (PyFunction_Check(__pyx_t_5)) {
2686 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_1};
2687 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error)
2688 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2689 __Pyx_GOTREF(__pyx_t_4);
2690 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2693 #if CYTHON_FAST_PYCCALL
2694 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
2695 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_1};
2696 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error)
2697 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2698 __Pyx_GOTREF(__pyx_t_4);
2699 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2703 __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 33, __pyx_L1_error)
2704 __Pyx_GOTREF(__pyx_t_8);
2706 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
2708 __Pyx_GIVEREF(__pyx_t_6);
2709 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_6);
2710 __Pyx_INCREF(__pyx_int_1);
2711 __Pyx_GIVEREF(__pyx_int_1);
2712 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_int_1);
2714 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error)
2715 __Pyx_GOTREF(__pyx_t_4);
2716 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2718 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2719 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error)
2720 __Pyx_GOTREF(__pyx_t_5);
2721 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2722 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
2723 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
2724 __Pyx_GIVEREF(__pyx_t_5);
2725 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
2727 __Pyx_INCREF(__pyx_kp_u_);
2729 __Pyx_GIVEREF(__pyx_kp_u_);
2730 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_);
2731 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_text), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error)
2732 __Pyx_GOTREF(__pyx_t_5);
2733 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
2734 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
2735 __Pyx_GIVEREF(__pyx_t_5);
2736 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
2738 __Pyx_INCREF(__pyx_kp_u_span);
2740 __Pyx_GIVEREF(__pyx_kp_u_span);
2741 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_span);
2743 /* "lxml/html/diff.py":32
2745 * def default_markup(text, version):
2746 * return '<span title="%s">%s</span>' % ( # <<<<<<<<<<<<<<
2747 * html_escape(_unicode(version), 1), text)
2750 __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error)
2751 __Pyx_GOTREF(__pyx_t_5);
2752 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2753 __pyx_r = __pyx_t_5;
2757 /* "lxml/html/diff.py":31
2758 * ############################################################
2760 * def default_markup(text, version): # <<<<<<<<<<<<<<
2761 * return '<span title="%s">%s</span>' % (
2762 * html_escape(_unicode(version), 1), text)
2765 /* function exit code */
2767 __Pyx_XDECREF(__pyx_t_1);
2768 __Pyx_XDECREF(__pyx_t_4);
2769 __Pyx_XDECREF(__pyx_t_5);
2770 __Pyx_XDECREF(__pyx_t_6);
2771 __Pyx_XDECREF(__pyx_t_7);
2772 __Pyx_XDECREF(__pyx_t_8);
2773 __Pyx_AddTraceback("lxml.html.diff.default_markup", __pyx_clineno, __pyx_lineno, __pyx_filename);
2776 __Pyx_XGIVEREF(__pyx_r);
2777 __Pyx_RefNannyFinishContext();
2781 /* "lxml/html/diff.py":35
2782 * html_escape(_unicode(version), 1), text)
2784 * def html_annotate(doclist, markup=default_markup): # <<<<<<<<<<<<<<
2786 * doclist should be ordered from oldest to newest, like::
2789 static PyObject *__pyx_pf_4lxml_4html_4diff_75__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
2790 PyObject *__pyx_r = NULL;
2791 __Pyx_RefNannyDeclarations
2792 PyObject *__pyx_t_1 = NULL;
2793 PyObject *__pyx_t_2 = NULL;
2794 int __pyx_lineno = 0;
2795 const char *__pyx_filename = NULL;
2796 int __pyx_clineno = 0;
2797 __Pyx_RefNannySetupContext("__defaults__", 0);
2798 __Pyx_XDECREF(__pyx_r);
2799 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
2800 __Pyx_GOTREF(__pyx_t_1);
2801 __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_markup);
2802 __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_markup);
2803 PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_markup);
2804 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
2805 __Pyx_GOTREF(__pyx_t_2);
2806 __Pyx_GIVEREF(__pyx_t_1);
2807 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
2808 __Pyx_INCREF(Py_None);
2809 __Pyx_GIVEREF(Py_None);
2810 PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
2812 __pyx_r = __pyx_t_2;
2816 /* function exit code */
2818 __Pyx_XDECREF(__pyx_t_1);
2819 __Pyx_XDECREF(__pyx_t_2);
2820 __Pyx_AddTraceback("lxml.html.diff.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2823 __Pyx_XGIVEREF(__pyx_r);
2824 __Pyx_RefNannyFinishContext();
2828 /* Python wrapper */
2829 static PyObject *__pyx_pw_4lxml_4html_4diff_3html_annotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2830 static char __pyx_doc_4lxml_4html_4diff_2html_annotate[] = "\n doclist should be ordered from oldest to newest, like::\n\n >>> version1 = 'Hello World'\n >>> version2 = 'Goodbye World'\n >>> print(html_annotate([(version1, 'version 1'),\n ... (version2, 'version 2')]))\n <span title=\"version 2\">Goodbye</span> <span title=\"version 1\">World</span>\n\n The documents must be *fragments* (str/UTF8 or unicode), not\n complete documents\n\n The markup argument is a function to markup the spans of words.\n This function is called like markup('Hello', 'version 2'), and\n returns HTML. The first argument is text and never includes any\n markup. The default uses a span with a title:\n\n >>> print(default_markup('Some Text', 'by Joe'))\n <span title=\"by Joe\">Some Text</span>\n ";
2831 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_3html_annotate = {"html_annotate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_3html_annotate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_2html_annotate};
2832 static PyObject *__pyx_pw_4lxml_4html_4diff_3html_annotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2833 PyObject *__pyx_v_doclist = 0;
2834 PyObject *__pyx_v_markup = 0;
2835 int __pyx_lineno = 0;
2836 const char *__pyx_filename = NULL;
2837 int __pyx_clineno = 0;
2838 PyObject *__pyx_r = 0;
2839 __Pyx_RefNannyDeclarations
2840 __Pyx_RefNannySetupContext("html_annotate (wrapper)", 0);
2842 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doclist,&__pyx_n_s_markup,0};
2843 PyObject* values[2] = {0,0};
2844 __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
2845 values[1] = __pyx_dynamic_args->__pyx_arg_markup;
2846 if (unlikely(__pyx_kwds)) {
2848 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2850 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2852 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2855 default: goto __pyx_L5_argtuple_error;
2857 kw_args = PyDict_Size(__pyx_kwds);
2860 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_doclist)) != 0)) kw_args--;
2861 else goto __pyx_L5_argtuple_error;
2865 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_markup);
2866 if (value) { values[1] = value; kw_args--; }
2869 if (unlikely(kw_args > 0)) {
2870 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "html_annotate") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
2873 switch (PyTuple_GET_SIZE(__pyx_args)) {
2874 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2876 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2878 default: goto __pyx_L5_argtuple_error;
2881 __pyx_v_doclist = values[0];
2882 __pyx_v_markup = values[1];
2884 goto __pyx_L4_argument_unpacking_done;
2885 __pyx_L5_argtuple_error:;
2886 __Pyx_RaiseArgtupleInvalid("html_annotate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
2888 __Pyx_AddTraceback("lxml.html.diff.html_annotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
2889 __Pyx_RefNannyFinishContext();
2891 __pyx_L4_argument_unpacking_done:;
2892 __pyx_r = __pyx_pf_4lxml_4html_4diff_2html_annotate(__pyx_self, __pyx_v_doclist, __pyx_v_markup);
2894 /* function exit code */
2895 __Pyx_RefNannyFinishContext();
2899 static PyObject *__pyx_pf_4lxml_4html_4diff_2html_annotate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doclist, PyObject *__pyx_v_markup) {
2900 PyObject *__pyx_v_tokenlist = NULL;
2901 PyObject *__pyx_v_cur_tokens = NULL;
2902 PyObject *__pyx_v_tokens = NULL;
2903 PyObject *__pyx_v_result = NULL;
2904 PyObject *__pyx_7genexpr__pyx_v_doc = NULL;
2905 PyObject *__pyx_7genexpr__pyx_v_version = NULL;
2906 PyObject *__pyx_r = NULL;
2907 __Pyx_RefNannyDeclarations
2908 PyObject *__pyx_t_1 = NULL;
2909 PyObject *__pyx_t_2 = NULL;
2910 Py_ssize_t __pyx_t_3;
2911 PyObject *(*__pyx_t_4)(PyObject *);
2912 PyObject *__pyx_t_5 = NULL;
2913 PyObject *__pyx_t_6 = NULL;
2914 PyObject *__pyx_t_7 = NULL;
2915 PyObject *__pyx_t_8 = NULL;
2916 PyObject *(*__pyx_t_9)(PyObject *);
2918 int __pyx_lineno = 0;
2919 const char *__pyx_filename = NULL;
2920 int __pyx_clineno = 0;
2921 __Pyx_RefNannySetupContext("html_annotate", 0);
2923 /* "lxml/html/diff.py":61
2924 * # appeared in the document; the annotation attached to the token
2925 * # is the version where it first appeared.
2926 * tokenlist = [tokenize_annotated(doc, version) # <<<<<<<<<<<<<<
2927 * for doc, version in doclist]
2928 * cur_tokens = tokenlist[0]
2930 { /* enter inner scope */
2931 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L5_error)
2932 __Pyx_GOTREF(__pyx_t_1);
2934 /* "lxml/html/diff.py":62
2935 * # is the version where it first appeared.
2936 * tokenlist = [tokenize_annotated(doc, version)
2937 * for doc, version in doclist] # <<<<<<<<<<<<<<
2938 * cur_tokens = tokenlist[0]
2939 * for tokens in tokenlist[1:]:
2941 if (likely(PyList_CheckExact(__pyx_v_doclist)) || PyTuple_CheckExact(__pyx_v_doclist)) {
2942 __pyx_t_2 = __pyx_v_doclist; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
2945 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_doclist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L5_error)
2946 __Pyx_GOTREF(__pyx_t_2);
2947 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L5_error)
2950 if (likely(!__pyx_t_4)) {
2951 if (likely(PyList_CheckExact(__pyx_t_2))) {
2952 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
2953 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2954 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L5_error)
2956 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L5_error)
2957 __Pyx_GOTREF(__pyx_t_5);
2960 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
2961 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2962 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L5_error)
2964 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L5_error)
2965 __Pyx_GOTREF(__pyx_t_5);
2969 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
2970 if (unlikely(!__pyx_t_5)) {
2971 PyObject* exc_type = PyErr_Occurred();
2973 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2974 else __PYX_ERR(0, 62, __pyx_L5_error)
2978 __Pyx_GOTREF(__pyx_t_5);
2980 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
2981 PyObject* sequence = __pyx_t_5;
2982 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2983 if (unlikely(size != 2)) {
2984 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2985 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2986 __PYX_ERR(0, 62, __pyx_L5_error)
2988 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2989 if (likely(PyTuple_CheckExact(sequence))) {
2990 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
2991 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
2993 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
2994 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
2996 __Pyx_INCREF(__pyx_t_6);
2997 __Pyx_INCREF(__pyx_t_7);
2999 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L5_error)
3000 __Pyx_GOTREF(__pyx_t_6);
3001 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L5_error)
3002 __Pyx_GOTREF(__pyx_t_7);
3004 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3006 Py_ssize_t index = -1;
3007 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L5_error)
3008 __Pyx_GOTREF(__pyx_t_8);
3009 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3010 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
3011 index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
3012 __Pyx_GOTREF(__pyx_t_6);
3013 index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
3014 __Pyx_GOTREF(__pyx_t_7);
3015 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 62, __pyx_L5_error)
3017 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3018 goto __pyx_L9_unpacking_done;
3019 __pyx_L8_unpacking_failed:;
3020 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3022 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3023 __PYX_ERR(0, 62, __pyx_L5_error)
3024 __pyx_L9_unpacking_done:;
3026 __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_doc, __pyx_t_6);
3028 __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_version, __pyx_t_7);
3031 /* "lxml/html/diff.py":61
3032 * # appeared in the document; the annotation attached to the token
3033 * # is the version where it first appeared.
3034 * tokenlist = [tokenize_annotated(doc, version) # <<<<<<<<<<<<<<
3035 * for doc, version in doclist]
3036 * cur_tokens = tokenlist[0]
3038 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tokenize_annotated); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 61, __pyx_L5_error)
3039 __Pyx_GOTREF(__pyx_t_7);
3042 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
3043 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
3044 if (likely(__pyx_t_6)) {
3045 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
3046 __Pyx_INCREF(__pyx_t_6);
3047 __Pyx_INCREF(function);
3048 __Pyx_DECREF_SET(__pyx_t_7, function);
3052 #if CYTHON_FAST_PYCALL
3053 if (PyFunction_Check(__pyx_t_7)) {
3054 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_7genexpr__pyx_v_doc, __pyx_7genexpr__pyx_v_version};
3055 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L5_error)
3056 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3057 __Pyx_GOTREF(__pyx_t_5);
3060 #if CYTHON_FAST_PYCCALL
3061 if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
3062 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_7genexpr__pyx_v_doc, __pyx_7genexpr__pyx_v_version};
3063 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L5_error)
3064 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3065 __Pyx_GOTREF(__pyx_t_5);
3069 __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L5_error)
3070 __Pyx_GOTREF(__pyx_t_8);
3072 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
3074 __Pyx_INCREF(__pyx_7genexpr__pyx_v_doc);
3075 __Pyx_GIVEREF(__pyx_7genexpr__pyx_v_doc);
3076 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_7genexpr__pyx_v_doc);
3077 __Pyx_INCREF(__pyx_7genexpr__pyx_v_version);
3078 __Pyx_GIVEREF(__pyx_7genexpr__pyx_v_version);
3079 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_7genexpr__pyx_v_version);
3080 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L5_error)
3081 __Pyx_GOTREF(__pyx_t_5);
3082 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3084 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3085 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 61, __pyx_L5_error)
3086 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3088 /* "lxml/html/diff.py":62
3089 * # is the version where it first appeared.
3090 * tokenlist = [tokenize_annotated(doc, version)
3091 * for doc, version in doclist] # <<<<<<<<<<<<<<
3092 * cur_tokens = tokenlist[0]
3093 * for tokens in tokenlist[1:]:
3096 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3097 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_doc); __pyx_7genexpr__pyx_v_doc = 0;
3098 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_version); __pyx_7genexpr__pyx_v_version = 0;
3099 goto __pyx_L10_exit_scope;
3101 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_doc); __pyx_7genexpr__pyx_v_doc = 0;
3102 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_version); __pyx_7genexpr__pyx_v_version = 0;
3103 goto __pyx_L1_error;
3104 __pyx_L10_exit_scope:;
3105 } /* exit inner scope */
3106 __pyx_v_tokenlist = ((PyObject*)__pyx_t_1);
3109 /* "lxml/html/diff.py":63
3110 * tokenlist = [tokenize_annotated(doc, version)
3111 * for doc, version in doclist]
3112 * cur_tokens = tokenlist[0] # <<<<<<<<<<<<<<
3113 * for tokens in tokenlist[1:]:
3114 * html_annotate_merge_annotations(cur_tokens, tokens)
3116 __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_tokenlist, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
3117 __Pyx_GOTREF(__pyx_t_1);
3118 __pyx_v_cur_tokens = __pyx_t_1;
3121 /* "lxml/html/diff.py":64
3122 * for doc, version in doclist]
3123 * cur_tokens = tokenlist[0]
3124 * for tokens in tokenlist[1:]: # <<<<<<<<<<<<<<
3125 * html_annotate_merge_annotations(cur_tokens, tokens)
3126 * cur_tokens = tokens
3128 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_tokenlist, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3129 __Pyx_GOTREF(__pyx_t_1);
3130 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
3131 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3133 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
3134 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3135 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 64, __pyx_L1_error)
3137 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3138 __Pyx_GOTREF(__pyx_t_1);
3140 __Pyx_XDECREF_SET(__pyx_v_tokens, __pyx_t_1);
3143 /* "lxml/html/diff.py":65
3144 * cur_tokens = tokenlist[0]
3145 * for tokens in tokenlist[1:]:
3146 * html_annotate_merge_annotations(cur_tokens, tokens) # <<<<<<<<<<<<<<
3147 * cur_tokens = tokens
3150 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_html_annotate_merge_annotations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
3151 __Pyx_GOTREF(__pyx_t_5);
3154 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3155 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
3156 if (likely(__pyx_t_7)) {
3157 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3158 __Pyx_INCREF(__pyx_t_7);
3159 __Pyx_INCREF(function);
3160 __Pyx_DECREF_SET(__pyx_t_5, function);
3164 #if CYTHON_FAST_PYCALL
3165 if (PyFunction_Check(__pyx_t_5)) {
3166 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_cur_tokens, __pyx_v_tokens};
3167 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
3168 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3169 __Pyx_GOTREF(__pyx_t_1);
3172 #if CYTHON_FAST_PYCCALL
3173 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
3174 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_cur_tokens, __pyx_v_tokens};
3175 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
3176 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3177 __Pyx_GOTREF(__pyx_t_1);
3181 __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 65, __pyx_L1_error)
3182 __Pyx_GOTREF(__pyx_t_8);
3184 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
3186 __Pyx_INCREF(__pyx_v_cur_tokens);
3187 __Pyx_GIVEREF(__pyx_v_cur_tokens);
3188 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_cur_tokens);
3189 __Pyx_INCREF(__pyx_v_tokens);
3190 __Pyx_GIVEREF(__pyx_v_tokens);
3191 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_tokens);
3192 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
3193 __Pyx_GOTREF(__pyx_t_1);
3194 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3196 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3197 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3199 /* "lxml/html/diff.py":66
3200 * for tokens in tokenlist[1:]:
3201 * html_annotate_merge_annotations(cur_tokens, tokens)
3202 * cur_tokens = tokens # <<<<<<<<<<<<<<
3204 * # After we've tracked all the tokens, we can combine spans of text
3206 __Pyx_INCREF(__pyx_v_tokens);
3207 __Pyx_DECREF_SET(__pyx_v_cur_tokens, __pyx_v_tokens);
3209 /* "lxml/html/diff.py":64
3210 * for doc, version in doclist]
3211 * cur_tokens = tokenlist[0]
3212 * for tokens in tokenlist[1:]: # <<<<<<<<<<<<<<
3213 * html_annotate_merge_annotations(cur_tokens, tokens)
3214 * cur_tokens = tokens
3217 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3219 /* "lxml/html/diff.py":70
3220 * # After we've tracked all the tokens, we can combine spans of text
3221 * # that are adjacent and have the same annotation
3222 * cur_tokens = compress_tokens(cur_tokens) # <<<<<<<<<<<<<<
3223 * # And finally add markup
3224 * result = markup_serialize_tokens(cur_tokens, markup)
3226 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_compress_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
3227 __Pyx_GOTREF(__pyx_t_1);
3229 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3230 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
3231 if (likely(__pyx_t_5)) {
3232 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3233 __Pyx_INCREF(__pyx_t_5);
3234 __Pyx_INCREF(function);
3235 __Pyx_DECREF_SET(__pyx_t_1, function);
3238 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_cur_tokens) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_cur_tokens);
3239 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3240 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3241 __Pyx_GOTREF(__pyx_t_2);
3242 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3243 __Pyx_DECREF_SET(__pyx_v_cur_tokens, __pyx_t_2);
3246 /* "lxml/html/diff.py":72
3247 * cur_tokens = compress_tokens(cur_tokens)
3248 * # And finally add markup
3249 * result = markup_serialize_tokens(cur_tokens, markup) # <<<<<<<<<<<<<<
3250 * return ''.join(result).strip()
3253 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_markup_serialize_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
3254 __Pyx_GOTREF(__pyx_t_1);
3257 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3258 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
3259 if (likely(__pyx_t_5)) {
3260 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3261 __Pyx_INCREF(__pyx_t_5);
3262 __Pyx_INCREF(function);
3263 __Pyx_DECREF_SET(__pyx_t_1, function);
3267 #if CYTHON_FAST_PYCALL
3268 if (PyFunction_Check(__pyx_t_1)) {
3269 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_cur_tokens, __pyx_v_markup};
3270 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
3271 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3272 __Pyx_GOTREF(__pyx_t_2);
3275 #if CYTHON_FAST_PYCCALL
3276 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3277 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_cur_tokens, __pyx_v_markup};
3278 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
3279 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3280 __Pyx_GOTREF(__pyx_t_2);
3284 __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error)
3285 __Pyx_GOTREF(__pyx_t_8);
3287 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
3289 __Pyx_INCREF(__pyx_v_cur_tokens);
3290 __Pyx_GIVEREF(__pyx_v_cur_tokens);
3291 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_cur_tokens);
3292 __Pyx_INCREF(__pyx_v_markup);
3293 __Pyx_GIVEREF(__pyx_v_markup);
3294 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_markup);
3295 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
3296 __Pyx_GOTREF(__pyx_t_2);
3297 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3299 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3300 __pyx_v_result = __pyx_t_2;
3303 /* "lxml/html/diff.py":73
3304 * # And finally add markup
3305 * result = markup_serialize_tokens(cur_tokens, markup)
3306 * return ''.join(result).strip() # <<<<<<<<<<<<<<
3308 * def tokenize_annotated(doc, annotation):
3310 __Pyx_XDECREF(__pyx_r);
3311 __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__2, __pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
3312 __Pyx_GOTREF(__pyx_t_1);
3313 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_strip); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error)
3314 __Pyx_GOTREF(__pyx_t_8);
3315 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3317 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
3318 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
3319 if (likely(__pyx_t_1)) {
3320 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3321 __Pyx_INCREF(__pyx_t_1);
3322 __Pyx_INCREF(function);
3323 __Pyx_DECREF_SET(__pyx_t_8, function);
3326 __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
3327 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3328 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
3329 __Pyx_GOTREF(__pyx_t_2);
3330 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3331 __pyx_r = __pyx_t_2;
3335 /* "lxml/html/diff.py":35
3336 * html_escape(_unicode(version), 1), text)
3338 * def html_annotate(doclist, markup=default_markup): # <<<<<<<<<<<<<<
3340 * doclist should be ordered from oldest to newest, like::
3343 /* function exit code */
3345 __Pyx_XDECREF(__pyx_t_1);
3346 __Pyx_XDECREF(__pyx_t_2);
3347 __Pyx_XDECREF(__pyx_t_5);
3348 __Pyx_XDECREF(__pyx_t_6);
3349 __Pyx_XDECREF(__pyx_t_7);
3350 __Pyx_XDECREF(__pyx_t_8);
3351 __Pyx_AddTraceback("lxml.html.diff.html_annotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
3354 __Pyx_XDECREF(__pyx_v_tokenlist);
3355 __Pyx_XDECREF(__pyx_v_cur_tokens);
3356 __Pyx_XDECREF(__pyx_v_tokens);
3357 __Pyx_XDECREF(__pyx_v_result);
3358 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_doc);
3359 __Pyx_XDECREF(__pyx_7genexpr__pyx_v_version);
3360 __Pyx_XGIVEREF(__pyx_r);
3361 __Pyx_RefNannyFinishContext();
3365 /* "lxml/html/diff.py":75
3366 * return ''.join(result).strip()
3368 * def tokenize_annotated(doc, annotation): # <<<<<<<<<<<<<<
3369 * """Tokenize a document and add an annotation attribute to each token
3373 /* Python wrapper */
3374 static PyObject *__pyx_pw_4lxml_4html_4diff_5tokenize_annotated(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3375 static char __pyx_doc_4lxml_4html_4diff_4tokenize_annotated[] = "Tokenize a document and add an annotation attribute to each token\n ";
3376 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_5tokenize_annotated = {"tokenize_annotated", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_5tokenize_annotated, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_4tokenize_annotated};
3377 static PyObject *__pyx_pw_4lxml_4html_4diff_5tokenize_annotated(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3378 PyObject *__pyx_v_doc = 0;
3379 PyObject *__pyx_v_annotation = 0;
3380 int __pyx_lineno = 0;
3381 const char *__pyx_filename = NULL;
3382 int __pyx_clineno = 0;
3383 PyObject *__pyx_r = 0;
3384 __Pyx_RefNannyDeclarations
3385 __Pyx_RefNannySetupContext("tokenize_annotated (wrapper)", 0);
3387 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_doc,&__pyx_n_s_annotation,0};
3388 PyObject* values[2] = {0,0};
3389 if (unlikely(__pyx_kwds)) {
3391 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3393 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3395 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3398 default: goto __pyx_L5_argtuple_error;
3400 kw_args = PyDict_Size(__pyx_kwds);
3403 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_doc)) != 0)) kw_args--;
3404 else goto __pyx_L5_argtuple_error;
3407 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_annotation)) != 0)) kw_args--;
3409 __Pyx_RaiseArgtupleInvalid("tokenize_annotated", 1, 2, 2, 1); __PYX_ERR(0, 75, __pyx_L3_error)
3412 if (unlikely(kw_args > 0)) {
3413 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tokenize_annotated") < 0)) __PYX_ERR(0, 75, __pyx_L3_error)
3415 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3416 goto __pyx_L5_argtuple_error;
3418 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3419 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3421 __pyx_v_doc = values[0];
3422 __pyx_v_annotation = values[1];
3424 goto __pyx_L4_argument_unpacking_done;
3425 __pyx_L5_argtuple_error:;
3426 __Pyx_RaiseArgtupleInvalid("tokenize_annotated", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 75, __pyx_L3_error)
3428 __Pyx_AddTraceback("lxml.html.diff.tokenize_annotated", __pyx_clineno, __pyx_lineno, __pyx_filename);
3429 __Pyx_RefNannyFinishContext();
3431 __pyx_L4_argument_unpacking_done:;
3432 __pyx_r = __pyx_pf_4lxml_4html_4diff_4tokenize_annotated(__pyx_self, __pyx_v_doc, __pyx_v_annotation);
3434 /* function exit code */
3435 __Pyx_RefNannyFinishContext();
3439 static PyObject *__pyx_pf_4lxml_4html_4diff_4tokenize_annotated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doc, PyObject *__pyx_v_annotation) {
3440 PyObject *__pyx_v_tokens = NULL;
3441 PyObject *__pyx_v_tok = NULL;
3442 PyObject *__pyx_r = NULL;
3443 __Pyx_RefNannyDeclarations
3444 PyObject *__pyx_t_1 = NULL;
3445 PyObject *__pyx_t_2 = NULL;
3446 PyObject *__pyx_t_3 = NULL;
3447 PyObject *__pyx_t_4 = NULL;
3448 Py_ssize_t __pyx_t_5;
3449 PyObject *(*__pyx_t_6)(PyObject *);
3450 int __pyx_lineno = 0;
3451 const char *__pyx_filename = NULL;
3452 int __pyx_clineno = 0;
3453 __Pyx_RefNannySetupContext("tokenize_annotated", 0);
3455 /* "lxml/html/diff.py":78
3456 * """Tokenize a document and add an annotation attribute to each token
3458 * tokens = tokenize(doc, include_hrefs=False) # <<<<<<<<<<<<<<
3459 * for tok in tokens:
3460 * tok.annotation = annotation
3462 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_tokenize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
3463 __Pyx_GOTREF(__pyx_t_1);
3464 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
3465 __Pyx_GOTREF(__pyx_t_2);
3466 __Pyx_INCREF(__pyx_v_doc);
3467 __Pyx_GIVEREF(__pyx_v_doc);
3468 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_doc);
3469 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
3470 __Pyx_GOTREF(__pyx_t_3);
3471 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_include_hrefs, Py_False) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
3472 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
3473 __Pyx_GOTREF(__pyx_t_4);
3474 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3475 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3476 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3477 __pyx_v_tokens = __pyx_t_4;
3480 /* "lxml/html/diff.py":79
3482 * tokens = tokenize(doc, include_hrefs=False)
3483 * for tok in tokens: # <<<<<<<<<<<<<<
3484 * tok.annotation = annotation
3487 if (likely(PyList_CheckExact(__pyx_v_tokens)) || PyTuple_CheckExact(__pyx_v_tokens)) {
3488 __pyx_t_4 = __pyx_v_tokens; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
3491 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tokens); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
3492 __Pyx_GOTREF(__pyx_t_4);
3493 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error)
3496 if (likely(!__pyx_t_6)) {
3497 if (likely(PyList_CheckExact(__pyx_t_4))) {
3498 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
3499 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3500 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
3502 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
3503 __Pyx_GOTREF(__pyx_t_3);
3506 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
3507 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3508 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
3510 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
3511 __Pyx_GOTREF(__pyx_t_3);
3515 __pyx_t_3 = __pyx_t_6(__pyx_t_4);
3516 if (unlikely(!__pyx_t_3)) {
3517 PyObject* exc_type = PyErr_Occurred();
3519 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3520 else __PYX_ERR(0, 79, __pyx_L1_error)
3524 __Pyx_GOTREF(__pyx_t_3);
3526 __Pyx_XDECREF_SET(__pyx_v_tok, __pyx_t_3);
3529 /* "lxml/html/diff.py":80
3530 * tokens = tokenize(doc, include_hrefs=False)
3531 * for tok in tokens:
3532 * tok.annotation = annotation # <<<<<<<<<<<<<<
3536 if (__Pyx_PyObject_SetAttrStr(__pyx_v_tok, __pyx_n_s_annotation, __pyx_v_annotation) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
3538 /* "lxml/html/diff.py":79
3540 * tokens = tokenize(doc, include_hrefs=False)
3541 * for tok in tokens: # <<<<<<<<<<<<<<
3542 * tok.annotation = annotation
3546 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3548 /* "lxml/html/diff.py":81
3549 * for tok in tokens:
3550 * tok.annotation = annotation
3551 * return tokens # <<<<<<<<<<<<<<
3553 * def html_annotate_merge_annotations(tokens_old, tokens_new):
3555 __Pyx_XDECREF(__pyx_r);
3556 __Pyx_INCREF(__pyx_v_tokens);
3557 __pyx_r = __pyx_v_tokens;
3560 /* "lxml/html/diff.py":75
3561 * return ''.join(result).strip()
3563 * def tokenize_annotated(doc, annotation): # <<<<<<<<<<<<<<
3564 * """Tokenize a document and add an annotation attribute to each token
3568 /* function exit code */
3570 __Pyx_XDECREF(__pyx_t_1);
3571 __Pyx_XDECREF(__pyx_t_2);
3572 __Pyx_XDECREF(__pyx_t_3);
3573 __Pyx_XDECREF(__pyx_t_4);
3574 __Pyx_AddTraceback("lxml.html.diff.tokenize_annotated", __pyx_clineno, __pyx_lineno, __pyx_filename);
3577 __Pyx_XDECREF(__pyx_v_tokens);
3578 __Pyx_XDECREF(__pyx_v_tok);
3579 __Pyx_XGIVEREF(__pyx_r);
3580 __Pyx_RefNannyFinishContext();
3584 /* "lxml/html/diff.py":83
3587 * def html_annotate_merge_annotations(tokens_old, tokens_new): # <<<<<<<<<<<<<<
3588 * """Merge the annotations from tokens_old into tokens_new, when the
3589 * tokens in the new document already existed in the old document.
3592 /* Python wrapper */
3593 static PyObject *__pyx_pw_4lxml_4html_4diff_7html_annotate_merge_annotations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3594 static char __pyx_doc_4lxml_4html_4diff_6html_annotate_merge_annotations[] = "Merge the annotations from tokens_old into tokens_new, when the\n tokens in the new document already existed in the old document.\n ";
3595 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_7html_annotate_merge_annotations = {"html_annotate_merge_annotations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_7html_annotate_merge_annotations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_6html_annotate_merge_annotations};
3596 static PyObject *__pyx_pw_4lxml_4html_4diff_7html_annotate_merge_annotations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3597 PyObject *__pyx_v_tokens_old = 0;
3598 PyObject *__pyx_v_tokens_new = 0;
3599 int __pyx_lineno = 0;
3600 const char *__pyx_filename = NULL;
3601 int __pyx_clineno = 0;
3602 PyObject *__pyx_r = 0;
3603 __Pyx_RefNannyDeclarations
3604 __Pyx_RefNannySetupContext("html_annotate_merge_annotations (wrapper)", 0);
3606 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tokens_old,&__pyx_n_s_tokens_new,0};
3607 PyObject* values[2] = {0,0};
3608 if (unlikely(__pyx_kwds)) {
3610 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3612 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3614 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3617 default: goto __pyx_L5_argtuple_error;
3619 kw_args = PyDict_Size(__pyx_kwds);
3622 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tokens_old)) != 0)) kw_args--;
3623 else goto __pyx_L5_argtuple_error;
3626 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tokens_new)) != 0)) kw_args--;
3628 __Pyx_RaiseArgtupleInvalid("html_annotate_merge_annotations", 1, 2, 2, 1); __PYX_ERR(0, 83, __pyx_L3_error)
3631 if (unlikely(kw_args > 0)) {
3632 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "html_annotate_merge_annotations") < 0)) __PYX_ERR(0, 83, __pyx_L3_error)
3634 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3635 goto __pyx_L5_argtuple_error;
3637 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3638 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3640 __pyx_v_tokens_old = values[0];
3641 __pyx_v_tokens_new = values[1];
3643 goto __pyx_L4_argument_unpacking_done;
3644 __pyx_L5_argtuple_error:;
3645 __Pyx_RaiseArgtupleInvalid("html_annotate_merge_annotations", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error)
3647 __Pyx_AddTraceback("lxml.html.diff.html_annotate_merge_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
3648 __Pyx_RefNannyFinishContext();
3650 __pyx_L4_argument_unpacking_done:;
3651 __pyx_r = __pyx_pf_4lxml_4html_4diff_6html_annotate_merge_annotations(__pyx_self, __pyx_v_tokens_old, __pyx_v_tokens_new);
3653 /* function exit code */
3654 __Pyx_RefNannyFinishContext();
3658 static PyObject *__pyx_pf_4lxml_4html_4diff_6html_annotate_merge_annotations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens_old, PyObject *__pyx_v_tokens_new) {
3659 PyObject *__pyx_v_s = NULL;
3660 PyObject *__pyx_v_commands = NULL;
3661 PyObject *__pyx_v_command = NULL;
3662 PyObject *__pyx_v_i1 = NULL;
3663 PyObject *__pyx_v_i2 = NULL;
3664 PyObject *__pyx_v_j1 = NULL;
3665 PyObject *__pyx_v_j2 = NULL;
3666 PyObject *__pyx_v_eq_old = NULL;
3667 PyObject *__pyx_v_eq_new = NULL;
3668 PyObject *__pyx_r = NULL;
3669 __Pyx_RefNannyDeclarations
3670 PyObject *__pyx_t_1 = NULL;
3671 PyObject *__pyx_t_2 = NULL;
3672 PyObject *__pyx_t_3 = NULL;
3673 Py_ssize_t __pyx_t_4;
3674 PyObject *(*__pyx_t_5)(PyObject *);
3675 PyObject *__pyx_t_6 = NULL;
3676 PyObject *__pyx_t_7 = NULL;
3677 PyObject *__pyx_t_8 = NULL;
3678 PyObject *__pyx_t_9 = NULL;
3679 PyObject *__pyx_t_10 = NULL;
3680 PyObject *(*__pyx_t_11)(PyObject *);
3683 int __pyx_lineno = 0;
3684 const char *__pyx_filename = NULL;
3685 int __pyx_clineno = 0;
3686 __Pyx_RefNannySetupContext("html_annotate_merge_annotations", 0);
3688 /* "lxml/html/diff.py":87
3689 * tokens in the new document already existed in the old document.
3691 * s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new) # <<<<<<<<<<<<<<
3692 * commands = s.get_opcodes()
3695 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_InsensitiveSequenceMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
3696 __Pyx_GOTREF(__pyx_t_1);
3697 __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
3698 __Pyx_GOTREF(__pyx_t_2);
3699 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_a, __pyx_v_tokens_old) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
3700 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_v_tokens_new) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
3701 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
3702 __Pyx_GOTREF(__pyx_t_3);
3703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3704 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3705 __pyx_v_s = __pyx_t_3;
3708 /* "lxml/html/diff.py":88
3710 * s = InsensitiveSequenceMatcher(a=tokens_old, b=tokens_new)
3711 * commands = s.get_opcodes() # <<<<<<<<<<<<<<
3713 * for command, i1, i2, j1, j2 in commands:
3715 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_get_opcodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
3716 __Pyx_GOTREF(__pyx_t_2);
3718 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3719 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3720 if (likely(__pyx_t_1)) {
3721 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3722 __Pyx_INCREF(__pyx_t_1);
3723 __Pyx_INCREF(function);
3724 __Pyx_DECREF_SET(__pyx_t_2, function);
3727 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3728 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3729 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
3730 __Pyx_GOTREF(__pyx_t_3);
3731 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3732 __pyx_v_commands = __pyx_t_3;
3735 /* "lxml/html/diff.py":90
3736 * commands = s.get_opcodes()
3738 * for command, i1, i2, j1, j2 in commands: # <<<<<<<<<<<<<<
3739 * if command == 'equal':
3740 * eq_old = tokens_old[i1:i2]
3742 if (likely(PyList_CheckExact(__pyx_v_commands)) || PyTuple_CheckExact(__pyx_v_commands)) {
3743 __pyx_t_3 = __pyx_v_commands; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
3746 __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_commands); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
3747 __Pyx_GOTREF(__pyx_t_3);
3748 __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
3751 if (likely(!__pyx_t_5)) {
3752 if (likely(PyList_CheckExact(__pyx_t_3))) {
3753 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
3754 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3755 __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, 90, __pyx_L1_error)
3757 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
3758 __Pyx_GOTREF(__pyx_t_2);
3761 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3762 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3763 __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, 90, __pyx_L1_error)
3765 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
3766 __Pyx_GOTREF(__pyx_t_2);
3770 __pyx_t_2 = __pyx_t_5(__pyx_t_3);
3771 if (unlikely(!__pyx_t_2)) {
3772 PyObject* exc_type = PyErr_Occurred();
3774 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3775 else __PYX_ERR(0, 90, __pyx_L1_error)
3779 __Pyx_GOTREF(__pyx_t_2);
3781 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3782 PyObject* sequence = __pyx_t_2;
3783 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3784 if (unlikely(size != 5)) {
3785 if (size > 5) __Pyx_RaiseTooManyValuesError(5);
3786 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3787 __PYX_ERR(0, 90, __pyx_L1_error)
3789 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3790 if (likely(PyTuple_CheckExact(sequence))) {
3791 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
3792 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
3793 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
3794 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3);
3795 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4);
3797 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3798 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
3799 __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
3800 __pyx_t_8 = PyList_GET_ITEM(sequence, 3);
3801 __pyx_t_9 = PyList_GET_ITEM(sequence, 4);
3803 __Pyx_INCREF(__pyx_t_1);
3804 __Pyx_INCREF(__pyx_t_6);
3805 __Pyx_INCREF(__pyx_t_7);
3806 __Pyx_INCREF(__pyx_t_8);
3807 __Pyx_INCREF(__pyx_t_9);
3811 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
3812 for (i=0; i < 5; i++) {
3813 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 90, __pyx_L1_error)
3819 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3821 Py_ssize_t index = -1;
3822 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
3823 __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 90, __pyx_L1_error)
3824 __Pyx_GOTREF(__pyx_t_10);
3825 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3826 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
3827 for (index=0; index < 5; index++) {
3828 PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
3830 *(temps[index]) = item;
3832 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 5) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
3834 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3835 goto __pyx_L6_unpacking_done;
3836 __pyx_L5_unpacking_failed:;
3837 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3839 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3840 __PYX_ERR(0, 90, __pyx_L1_error)
3841 __pyx_L6_unpacking_done:;
3843 __Pyx_XDECREF_SET(__pyx_v_command, __pyx_t_1);
3845 __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_6);
3847 __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_7);
3849 __Pyx_XDECREF_SET(__pyx_v_j1, __pyx_t_8);
3851 __Pyx_XDECREF_SET(__pyx_v_j2, __pyx_t_9);
3854 /* "lxml/html/diff.py":91
3856 * for command, i1, i2, j1, j2 in commands:
3857 * if command == 'equal': # <<<<<<<<<<<<<<
3858 * eq_old = tokens_old[i1:i2]
3859 * eq_new = tokens_new[j1:j2]
3861 __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_equal, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 91, __pyx_L1_error)
3864 /* "lxml/html/diff.py":92
3865 * for command, i1, i2, j1, j2 in commands:
3866 * if command == 'equal':
3867 * eq_old = tokens_old[i1:i2] # <<<<<<<<<<<<<<
3868 * eq_new = tokens_new[j1:j2]
3869 * copy_annotations(eq_old, eq_new)
3871 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_tokens_old, 0, 0, &__pyx_v_i1, &__pyx_v_i2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
3872 __Pyx_GOTREF(__pyx_t_2);
3873 __Pyx_XDECREF_SET(__pyx_v_eq_old, __pyx_t_2);
3876 /* "lxml/html/diff.py":93
3877 * if command == 'equal':
3878 * eq_old = tokens_old[i1:i2]
3879 * eq_new = tokens_new[j1:j2] # <<<<<<<<<<<<<<
3880 * copy_annotations(eq_old, eq_new)
3883 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_tokens_new, 0, 0, &__pyx_v_j1, &__pyx_v_j2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
3884 __Pyx_GOTREF(__pyx_t_2);
3885 __Pyx_XDECREF_SET(__pyx_v_eq_new, __pyx_t_2);
3888 /* "lxml/html/diff.py":94
3889 * eq_old = tokens_old[i1:i2]
3890 * eq_new = tokens_new[j1:j2]
3891 * copy_annotations(eq_old, eq_new) # <<<<<<<<<<<<<<
3893 * def copy_annotations(src, dest):
3895 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_copy_annotations); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error)
3896 __Pyx_GOTREF(__pyx_t_9);
3899 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
3900 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
3901 if (likely(__pyx_t_8)) {
3902 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
3903 __Pyx_INCREF(__pyx_t_8);
3904 __Pyx_INCREF(function);
3905 __Pyx_DECREF_SET(__pyx_t_9, function);
3909 #if CYTHON_FAST_PYCALL
3910 if (PyFunction_Check(__pyx_t_9)) {
3911 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_eq_old, __pyx_v_eq_new};
3912 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
3913 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3914 __Pyx_GOTREF(__pyx_t_2);
3917 #if CYTHON_FAST_PYCCALL
3918 if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
3919 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_eq_old, __pyx_v_eq_new};
3920 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
3921 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3922 __Pyx_GOTREF(__pyx_t_2);
3926 __pyx_t_7 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L1_error)
3927 __Pyx_GOTREF(__pyx_t_7);
3929 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
3931 __Pyx_INCREF(__pyx_v_eq_old);
3932 __Pyx_GIVEREF(__pyx_v_eq_old);
3933 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_13, __pyx_v_eq_old);
3934 __Pyx_INCREF(__pyx_v_eq_new);
3935 __Pyx_GIVEREF(__pyx_v_eq_new);
3936 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_13, __pyx_v_eq_new);
3937 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
3938 __Pyx_GOTREF(__pyx_t_2);
3939 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3941 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3942 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3944 /* "lxml/html/diff.py":91
3946 * for command, i1, i2, j1, j2 in commands:
3947 * if command == 'equal': # <<<<<<<<<<<<<<
3948 * eq_old = tokens_old[i1:i2]
3949 * eq_new = tokens_new[j1:j2]
3953 /* "lxml/html/diff.py":90
3954 * commands = s.get_opcodes()
3956 * for command, i1, i2, j1, j2 in commands: # <<<<<<<<<<<<<<
3957 * if command == 'equal':
3958 * eq_old = tokens_old[i1:i2]
3961 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3963 /* "lxml/html/diff.py":83
3966 * def html_annotate_merge_annotations(tokens_old, tokens_new): # <<<<<<<<<<<<<<
3967 * """Merge the annotations from tokens_old into tokens_new, when the
3968 * tokens in the new document already existed in the old document.
3971 /* function exit code */
3972 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3975 __Pyx_XDECREF(__pyx_t_1);
3976 __Pyx_XDECREF(__pyx_t_2);
3977 __Pyx_XDECREF(__pyx_t_3);
3978 __Pyx_XDECREF(__pyx_t_6);
3979 __Pyx_XDECREF(__pyx_t_7);
3980 __Pyx_XDECREF(__pyx_t_8);
3981 __Pyx_XDECREF(__pyx_t_9);
3982 __Pyx_XDECREF(__pyx_t_10);
3983 __Pyx_AddTraceback("lxml.html.diff.html_annotate_merge_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
3986 __Pyx_XDECREF(__pyx_v_s);
3987 __Pyx_XDECREF(__pyx_v_commands);
3988 __Pyx_XDECREF(__pyx_v_command);
3989 __Pyx_XDECREF(__pyx_v_i1);
3990 __Pyx_XDECREF(__pyx_v_i2);
3991 __Pyx_XDECREF(__pyx_v_j1);
3992 __Pyx_XDECREF(__pyx_v_j2);
3993 __Pyx_XDECREF(__pyx_v_eq_old);
3994 __Pyx_XDECREF(__pyx_v_eq_new);
3995 __Pyx_XGIVEREF(__pyx_r);
3996 __Pyx_RefNannyFinishContext();
4000 /* "lxml/html/diff.py":96
4001 * copy_annotations(eq_old, eq_new)
4003 * def copy_annotations(src, dest): # <<<<<<<<<<<<<<
4005 * Copy annotations from the tokens listed in src to the tokens in dest
4008 /* Python wrapper */
4009 static PyObject *__pyx_pw_4lxml_4html_4diff_9copy_annotations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4010 static char __pyx_doc_4lxml_4html_4diff_8copy_annotations[] = "\n Copy annotations from the tokens listed in src to the tokens in dest\n ";
4011 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_9copy_annotations = {"copy_annotations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_9copy_annotations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_8copy_annotations};
4012 static PyObject *__pyx_pw_4lxml_4html_4diff_9copy_annotations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4013 PyObject *__pyx_v_src = 0;
4014 PyObject *__pyx_v_dest = 0;
4015 int __pyx_lineno = 0;
4016 const char *__pyx_filename = NULL;
4017 int __pyx_clineno = 0;
4018 PyObject *__pyx_r = 0;
4019 __Pyx_RefNannyDeclarations
4020 __Pyx_RefNannySetupContext("copy_annotations (wrapper)", 0);
4022 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src,&__pyx_n_s_dest,0};
4023 PyObject* values[2] = {0,0};
4024 if (unlikely(__pyx_kwds)) {
4026 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4028 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4030 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4033 default: goto __pyx_L5_argtuple_error;
4035 kw_args = PyDict_Size(__pyx_kwds);
4038 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--;
4039 else goto __pyx_L5_argtuple_error;
4042 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
4044 __Pyx_RaiseArgtupleInvalid("copy_annotations", 1, 2, 2, 1); __PYX_ERR(0, 96, __pyx_L3_error)
4047 if (unlikely(kw_args > 0)) {
4048 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_annotations") < 0)) __PYX_ERR(0, 96, __pyx_L3_error)
4050 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4051 goto __pyx_L5_argtuple_error;
4053 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4054 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4056 __pyx_v_src = values[0];
4057 __pyx_v_dest = values[1];
4059 goto __pyx_L4_argument_unpacking_done;
4060 __pyx_L5_argtuple_error:;
4061 __Pyx_RaiseArgtupleInvalid("copy_annotations", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 96, __pyx_L3_error)
4063 __Pyx_AddTraceback("lxml.html.diff.copy_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
4064 __Pyx_RefNannyFinishContext();
4066 __pyx_L4_argument_unpacking_done:;
4067 __pyx_r = __pyx_pf_4lxml_4html_4diff_8copy_annotations(__pyx_self, __pyx_v_src, __pyx_v_dest);
4069 /* function exit code */
4070 __Pyx_RefNannyFinishContext();
4074 static PyObject *__pyx_pf_4lxml_4html_4diff_8copy_annotations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_src, PyObject *__pyx_v_dest) {
4075 PyObject *__pyx_v_src_tok = NULL;
4076 PyObject *__pyx_v_dest_tok = NULL;
4077 PyObject *__pyx_r = NULL;
4078 __Pyx_RefNannyDeclarations
4079 Py_ssize_t __pyx_t_1;
4080 Py_ssize_t __pyx_t_2;
4081 PyObject *__pyx_t_3 = NULL;
4082 PyObject *__pyx_t_4 = NULL;
4083 PyObject *(*__pyx_t_5)(PyObject *);
4084 PyObject *__pyx_t_6 = NULL;
4085 PyObject *__pyx_t_7 = NULL;
4086 PyObject *__pyx_t_8 = NULL;
4087 PyObject *(*__pyx_t_9)(PyObject *);
4088 int __pyx_lineno = 0;
4089 const char *__pyx_filename = NULL;
4090 int __pyx_clineno = 0;
4091 __Pyx_RefNannySetupContext("copy_annotations", 0);
4093 /* "lxml/html/diff.py":100
4094 * Copy annotations from the tokens listed in src to the tokens in dest
4096 * assert len(src) == len(dest) # <<<<<<<<<<<<<<
4097 * for src_tok, dest_tok in zip(src, dest):
4098 * dest_tok.annotation = src_tok.annotation
4100 #ifndef CYTHON_WITHOUT_ASSERTIONS
4101 if (unlikely(!Py_OptimizeFlag)) {
4102 __pyx_t_1 = PyObject_Length(__pyx_v_src); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 100, __pyx_L1_error)
4103 __pyx_t_2 = PyObject_Length(__pyx_v_dest); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 100, __pyx_L1_error)
4104 if (unlikely(!((__pyx_t_1 == __pyx_t_2) != 0))) {
4105 PyErr_SetNone(PyExc_AssertionError);
4106 __PYX_ERR(0, 100, __pyx_L1_error)
4111 /* "lxml/html/diff.py":101
4113 * assert len(src) == len(dest)
4114 * for src_tok, dest_tok in zip(src, dest): # <<<<<<<<<<<<<<
4115 * dest_tok.annotation = src_tok.annotation
4118 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
4119 __Pyx_GOTREF(__pyx_t_3);
4120 __Pyx_INCREF(__pyx_v_src);
4121 __Pyx_GIVEREF(__pyx_v_src);
4122 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_src);
4123 __Pyx_INCREF(__pyx_v_dest);
4124 __Pyx_GIVEREF(__pyx_v_dest);
4125 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dest);
4126 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
4127 __Pyx_GOTREF(__pyx_t_4);
4128 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4129 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
4130 __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
4133 __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
4134 __Pyx_GOTREF(__pyx_t_3);
4135 __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
4137 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4139 if (likely(!__pyx_t_5)) {
4140 if (likely(PyList_CheckExact(__pyx_t_3))) {
4141 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
4142 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4143 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
4145 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
4146 __Pyx_GOTREF(__pyx_t_4);
4149 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
4150 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4151 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
4153 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
4154 __Pyx_GOTREF(__pyx_t_4);
4158 __pyx_t_4 = __pyx_t_5(__pyx_t_3);
4159 if (unlikely(!__pyx_t_4)) {
4160 PyObject* exc_type = PyErr_Occurred();
4162 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4163 else __PYX_ERR(0, 101, __pyx_L1_error)
4167 __Pyx_GOTREF(__pyx_t_4);
4169 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
4170 PyObject* sequence = __pyx_t_4;
4171 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4172 if (unlikely(size != 2)) {
4173 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4174 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4175 __PYX_ERR(0, 101, __pyx_L1_error)
4177 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4178 if (likely(PyTuple_CheckExact(sequence))) {
4179 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
4180 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
4182 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
4183 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
4185 __Pyx_INCREF(__pyx_t_6);
4186 __Pyx_INCREF(__pyx_t_7);
4188 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
4189 __Pyx_GOTREF(__pyx_t_6);
4190 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error)
4191 __Pyx_GOTREF(__pyx_t_7);
4193 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4195 Py_ssize_t index = -1;
4196 __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 101, __pyx_L1_error)
4197 __Pyx_GOTREF(__pyx_t_8);
4198 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4199 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
4200 index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
4201 __Pyx_GOTREF(__pyx_t_6);
4202 index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
4203 __Pyx_GOTREF(__pyx_t_7);
4204 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
4206 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4207 goto __pyx_L6_unpacking_done;
4208 __pyx_L5_unpacking_failed:;
4209 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4211 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4212 __PYX_ERR(0, 101, __pyx_L1_error)
4213 __pyx_L6_unpacking_done:;
4215 __Pyx_XDECREF_SET(__pyx_v_src_tok, __pyx_t_6);
4217 __Pyx_XDECREF_SET(__pyx_v_dest_tok, __pyx_t_7);
4220 /* "lxml/html/diff.py":102
4221 * assert len(src) == len(dest)
4222 * for src_tok, dest_tok in zip(src, dest):
4223 * dest_tok.annotation = src_tok.annotation # <<<<<<<<<<<<<<
4225 * def compress_tokens(tokens):
4227 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_src_tok, __pyx_n_s_annotation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
4228 __Pyx_GOTREF(__pyx_t_4);
4229 if (__Pyx_PyObject_SetAttrStr(__pyx_v_dest_tok, __pyx_n_s_annotation, __pyx_t_4) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
4230 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4232 /* "lxml/html/diff.py":101
4234 * assert len(src) == len(dest)
4235 * for src_tok, dest_tok in zip(src, dest): # <<<<<<<<<<<<<<
4236 * dest_tok.annotation = src_tok.annotation
4240 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4242 /* "lxml/html/diff.py":96
4243 * copy_annotations(eq_old, eq_new)
4245 * def copy_annotations(src, dest): # <<<<<<<<<<<<<<
4247 * Copy annotations from the tokens listed in src to the tokens in dest
4250 /* function exit code */
4251 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4254 __Pyx_XDECREF(__pyx_t_3);
4255 __Pyx_XDECREF(__pyx_t_4);
4256 __Pyx_XDECREF(__pyx_t_6);
4257 __Pyx_XDECREF(__pyx_t_7);
4258 __Pyx_XDECREF(__pyx_t_8);
4259 __Pyx_AddTraceback("lxml.html.diff.copy_annotations", __pyx_clineno, __pyx_lineno, __pyx_filename);
4262 __Pyx_XDECREF(__pyx_v_src_tok);
4263 __Pyx_XDECREF(__pyx_v_dest_tok);
4264 __Pyx_XGIVEREF(__pyx_r);
4265 __Pyx_RefNannyFinishContext();
4269 /* "lxml/html/diff.py":104
4270 * dest_tok.annotation = src_tok.annotation
4272 * def compress_tokens(tokens): # <<<<<<<<<<<<<<
4274 * Combine adjacent tokens when there is no HTML between the tokens,
4277 /* Python wrapper */
4278 static PyObject *__pyx_pw_4lxml_4html_4diff_11compress_tokens(PyObject *__pyx_self, PyObject *__pyx_v_tokens); /*proto*/
4279 static char __pyx_doc_4lxml_4html_4diff_10compress_tokens[] = "\n Combine adjacent tokens when there is no HTML between the tokens, \n and they share an annotation\n ";
4280 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_11compress_tokens = {"compress_tokens", (PyCFunction)__pyx_pw_4lxml_4html_4diff_11compress_tokens, METH_O, __pyx_doc_4lxml_4html_4diff_10compress_tokens};
4281 static PyObject *__pyx_pw_4lxml_4html_4diff_11compress_tokens(PyObject *__pyx_self, PyObject *__pyx_v_tokens) {
4282 PyObject *__pyx_r = 0;
4283 __Pyx_RefNannyDeclarations
4284 __Pyx_RefNannySetupContext("compress_tokens (wrapper)", 0);
4285 __pyx_r = __pyx_pf_4lxml_4html_4diff_10compress_tokens(__pyx_self, ((PyObject *)__pyx_v_tokens));
4287 /* function exit code */
4288 __Pyx_RefNannyFinishContext();
4292 static PyObject *__pyx_pf_4lxml_4html_4diff_10compress_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens) {
4293 PyObject *__pyx_v_result = NULL;
4294 PyObject *__pyx_v_tok = NULL;
4295 PyObject *__pyx_r = NULL;
4296 __Pyx_RefNannyDeclarations
4297 PyObject *__pyx_t_1 = NULL;
4298 PyObject *__pyx_t_2 = NULL;
4299 Py_ssize_t __pyx_t_3;
4300 PyObject *(*__pyx_t_4)(PyObject *);
4302 PyObject *__pyx_t_6 = NULL;
4305 PyObject *__pyx_t_9 = NULL;
4307 PyObject *__pyx_t_11 = NULL;
4309 int __pyx_lineno = 0;
4310 const char *__pyx_filename = NULL;
4311 int __pyx_clineno = 0;
4312 __Pyx_RefNannySetupContext("compress_tokens", 0);
4314 /* "lxml/html/diff.py":109
4315 * and they share an annotation
4317 * result = [tokens[0]] # <<<<<<<<<<<<<<
4318 * for tok in tokens[1:]:
4319 * if (not result[-1].post_tags and
4321 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_tokens, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
4322 __Pyx_GOTREF(__pyx_t_1);
4323 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
4324 __Pyx_GOTREF(__pyx_t_2);
4325 __Pyx_GIVEREF(__pyx_t_1);
4326 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4328 __pyx_v_result = ((PyObject*)__pyx_t_2);
4331 /* "lxml/html/diff.py":110
4333 * result = [tokens[0]]
4334 * for tok in tokens[1:]: # <<<<<<<<<<<<<<
4335 * if (not result[-1].post_tags and
4336 * not tok.pre_tags and
4338 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_tokens, 1, 0, NULL, NULL, &__pyx_slice__3, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
4339 __Pyx_GOTREF(__pyx_t_2);
4340 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
4341 __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
4344 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
4345 __Pyx_GOTREF(__pyx_t_1);
4346 __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
4348 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4350 if (likely(!__pyx_t_4)) {
4351 if (likely(PyList_CheckExact(__pyx_t_1))) {
4352 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
4353 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4354 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
4356 __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
4357 __Pyx_GOTREF(__pyx_t_2);
4360 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4361 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4362 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
4364 __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
4365 __Pyx_GOTREF(__pyx_t_2);
4369 __pyx_t_2 = __pyx_t_4(__pyx_t_1);
4370 if (unlikely(!__pyx_t_2)) {
4371 PyObject* exc_type = PyErr_Occurred();
4373 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4374 else __PYX_ERR(0, 110, __pyx_L1_error)
4378 __Pyx_GOTREF(__pyx_t_2);
4380 __Pyx_XDECREF_SET(__pyx_v_tok, __pyx_t_2);
4383 /* "lxml/html/diff.py":111
4384 * result = [tokens[0]]
4385 * for tok in tokens[1:]:
4386 * if (not result[-1].post_tags and # <<<<<<<<<<<<<<
4387 * not tok.pre_tags and
4388 * result[-1].annotation == tok.annotation):
4390 __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_result, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
4391 __Pyx_GOTREF(__pyx_t_2);
4392 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error)
4393 __Pyx_GOTREF(__pyx_t_6);
4394 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4395 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
4396 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4397 __pyx_t_8 = ((!__pyx_t_7) != 0);
4400 __pyx_t_5 = __pyx_t_8;
4401 goto __pyx_L6_bool_binop_done;
4404 /* "lxml/html/diff.py":112
4405 * for tok in tokens[1:]:
4406 * if (not result[-1].post_tags and
4407 * not tok.pre_tags and # <<<<<<<<<<<<<<
4408 * result[-1].annotation == tok.annotation):
4409 * compress_merge_back(result, tok)
4411 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
4412 __Pyx_GOTREF(__pyx_t_6);
4413 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
4414 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4415 __pyx_t_7 = ((!__pyx_t_8) != 0);
4418 __pyx_t_5 = __pyx_t_7;
4419 goto __pyx_L6_bool_binop_done;
4422 /* "lxml/html/diff.py":113
4423 * if (not result[-1].post_tags and
4424 * not tok.pre_tags and
4425 * result[-1].annotation == tok.annotation): # <<<<<<<<<<<<<<
4426 * compress_merge_back(result, tok)
4429 __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_result, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error)
4430 __Pyx_GOTREF(__pyx_t_6);
4431 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_annotation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
4432 __Pyx_GOTREF(__pyx_t_2);
4433 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4434 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_annotation); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error)
4435 __Pyx_GOTREF(__pyx_t_6);
4436 __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error)
4437 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4438 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4439 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 113, __pyx_L1_error)
4440 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4441 __pyx_t_5 = __pyx_t_7;
4442 __pyx_L6_bool_binop_done:;
4444 /* "lxml/html/diff.py":111
4445 * result = [tokens[0]]
4446 * for tok in tokens[1:]:
4447 * if (not result[-1].post_tags and # <<<<<<<<<<<<<<
4448 * not tok.pre_tags and
4449 * result[-1].annotation == tok.annotation):
4453 /* "lxml/html/diff.py":114
4454 * not tok.pre_tags and
4455 * result[-1].annotation == tok.annotation):
4456 * compress_merge_back(result, tok) # <<<<<<<<<<<<<<
4458 * result.append(tok)
4460 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_compress_merge_back); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error)
4461 __Pyx_GOTREF(__pyx_t_6);
4464 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4465 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
4466 if (likely(__pyx_t_2)) {
4467 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4468 __Pyx_INCREF(__pyx_t_2);
4469 __Pyx_INCREF(function);
4470 __Pyx_DECREF_SET(__pyx_t_6, function);
4474 #if CYTHON_FAST_PYCALL
4475 if (PyFunction_Check(__pyx_t_6)) {
4476 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_result, __pyx_v_tok};
4477 __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error)
4478 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4479 __Pyx_GOTREF(__pyx_t_9);
4482 #if CYTHON_FAST_PYCCALL
4483 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
4484 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_result, __pyx_v_tok};
4485 __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error)
4486 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4487 __Pyx_GOTREF(__pyx_t_9);
4491 __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L1_error)
4492 __Pyx_GOTREF(__pyx_t_11);
4494 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
4496 __Pyx_INCREF(__pyx_v_result);
4497 __Pyx_GIVEREF(__pyx_v_result);
4498 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_result);
4499 __Pyx_INCREF(__pyx_v_tok);
4500 __Pyx_GIVEREF(__pyx_v_tok);
4501 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_v_tok);
4502 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error)
4503 __Pyx_GOTREF(__pyx_t_9);
4504 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4506 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4507 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4509 /* "lxml/html/diff.py":111
4510 * result = [tokens[0]]
4511 * for tok in tokens[1:]:
4512 * if (not result[-1].post_tags and # <<<<<<<<<<<<<<
4513 * not tok.pre_tags and
4514 * result[-1].annotation == tok.annotation):
4519 /* "lxml/html/diff.py":116
4520 * compress_merge_back(result, tok)
4522 * result.append(tok) # <<<<<<<<<<<<<<
4527 __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_tok); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error)
4531 /* "lxml/html/diff.py":110
4533 * result = [tokens[0]]
4534 * for tok in tokens[1:]: # <<<<<<<<<<<<<<
4535 * if (not result[-1].post_tags and
4536 * not tok.pre_tags and
4539 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4541 /* "lxml/html/diff.py":117
4543 * result.append(tok)
4544 * return result # <<<<<<<<<<<<<<
4546 * def compress_merge_back(tokens, tok):
4548 __Pyx_XDECREF(__pyx_r);
4549 __Pyx_INCREF(__pyx_v_result);
4550 __pyx_r = __pyx_v_result;
4553 /* "lxml/html/diff.py":104
4554 * dest_tok.annotation = src_tok.annotation
4556 * def compress_tokens(tokens): # <<<<<<<<<<<<<<
4558 * Combine adjacent tokens when there is no HTML between the tokens,
4561 /* function exit code */
4563 __Pyx_XDECREF(__pyx_t_1);
4564 __Pyx_XDECREF(__pyx_t_2);
4565 __Pyx_XDECREF(__pyx_t_6);
4566 __Pyx_XDECREF(__pyx_t_9);
4567 __Pyx_XDECREF(__pyx_t_11);
4568 __Pyx_AddTraceback("lxml.html.diff.compress_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
4571 __Pyx_XDECREF(__pyx_v_result);
4572 __Pyx_XDECREF(__pyx_v_tok);
4573 __Pyx_XGIVEREF(__pyx_r);
4574 __Pyx_RefNannyFinishContext();
4578 /* "lxml/html/diff.py":119
4581 * def compress_merge_back(tokens, tok): # <<<<<<<<<<<<<<
4582 * """ Merge tok into the last element of tokens (modifying the list of
4583 * tokens in-place). """
4586 /* Python wrapper */
4587 static PyObject *__pyx_pw_4lxml_4html_4diff_13compress_merge_back(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4588 static char __pyx_doc_4lxml_4html_4diff_12compress_merge_back[] = " Merge tok into the last element of tokens (modifying the list of\n tokens in-place). ";
4589 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_13compress_merge_back = {"compress_merge_back", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_13compress_merge_back, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_12compress_merge_back};
4590 static PyObject *__pyx_pw_4lxml_4html_4diff_13compress_merge_back(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4591 PyObject *__pyx_v_tokens = 0;
4592 PyObject *__pyx_v_tok = 0;
4593 int __pyx_lineno = 0;
4594 const char *__pyx_filename = NULL;
4595 int __pyx_clineno = 0;
4596 PyObject *__pyx_r = 0;
4597 __Pyx_RefNannyDeclarations
4598 __Pyx_RefNannySetupContext("compress_merge_back (wrapper)", 0);
4600 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tokens,&__pyx_n_s_tok,0};
4601 PyObject* values[2] = {0,0};
4602 if (unlikely(__pyx_kwds)) {
4604 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4606 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4608 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4611 default: goto __pyx_L5_argtuple_error;
4613 kw_args = PyDict_Size(__pyx_kwds);
4616 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tokens)) != 0)) kw_args--;
4617 else goto __pyx_L5_argtuple_error;
4620 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tok)) != 0)) kw_args--;
4622 __Pyx_RaiseArgtupleInvalid("compress_merge_back", 1, 2, 2, 1); __PYX_ERR(0, 119, __pyx_L3_error)
4625 if (unlikely(kw_args > 0)) {
4626 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress_merge_back") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
4628 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4629 goto __pyx_L5_argtuple_error;
4631 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4632 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4634 __pyx_v_tokens = values[0];
4635 __pyx_v_tok = values[1];
4637 goto __pyx_L4_argument_unpacking_done;
4638 __pyx_L5_argtuple_error:;
4639 __Pyx_RaiseArgtupleInvalid("compress_merge_back", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error)
4641 __Pyx_AddTraceback("lxml.html.diff.compress_merge_back", __pyx_clineno, __pyx_lineno, __pyx_filename);
4642 __Pyx_RefNannyFinishContext();
4644 __pyx_L4_argument_unpacking_done:;
4645 __pyx_r = __pyx_pf_4lxml_4html_4diff_12compress_merge_back(__pyx_self, __pyx_v_tokens, __pyx_v_tok);
4647 /* function exit code */
4648 __Pyx_RefNannyFinishContext();
4652 static PyObject *__pyx_pf_4lxml_4html_4diff_12compress_merge_back(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_tok) {
4653 PyObject *__pyx_v_last = NULL;
4654 PyObject *__pyx_v_text = NULL;
4655 PyObject *__pyx_v_merged = NULL;
4656 PyObject *__pyx_r = NULL;
4657 __Pyx_RefNannyDeclarations
4658 PyObject *__pyx_t_1 = NULL;
4663 PyObject *__pyx_t_6 = NULL;
4664 PyObject *__pyx_t_7 = NULL;
4665 PyObject *__pyx_t_8 = NULL;
4666 int __pyx_lineno = 0;
4667 const char *__pyx_filename = NULL;
4668 int __pyx_clineno = 0;
4669 __Pyx_RefNannySetupContext("compress_merge_back", 0);
4671 /* "lxml/html/diff.py":122
4672 * """ Merge tok into the last element of tokens (modifying the list of
4673 * tokens in-place). """
4674 * last = tokens[-1] # <<<<<<<<<<<<<<
4675 * if type(last) is not token or type(tok) is not token:
4676 * tokens.append(tok)
4678 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_tokens, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
4679 __Pyx_GOTREF(__pyx_t_1);
4680 __pyx_v_last = __pyx_t_1;
4683 /* "lxml/html/diff.py":123
4684 * tokens in-place). """
4686 * if type(last) is not token or type(tok) is not token: # <<<<<<<<<<<<<<
4687 * tokens.append(tok)
4690 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
4691 __Pyx_GOTREF(__pyx_t_1);
4692 __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_last)) != __pyx_t_1);
4693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4694 __pyx_t_4 = (__pyx_t_3 != 0);
4697 __pyx_t_2 = __pyx_t_4;
4698 goto __pyx_L4_bool_binop_done;
4700 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
4701 __Pyx_GOTREF(__pyx_t_1);
4702 __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_tok)) != __pyx_t_1);
4703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4704 __pyx_t_3 = (__pyx_t_4 != 0);
4705 __pyx_t_2 = __pyx_t_3;
4706 __pyx_L4_bool_binop_done:;
4709 /* "lxml/html/diff.py":124
4711 * if type(last) is not token or type(tok) is not token:
4712 * tokens.append(tok) # <<<<<<<<<<<<<<
4714 * text = _unicode(last)
4716 __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_tokens, __pyx_v_tok); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 124, __pyx_L1_error)
4718 /* "lxml/html/diff.py":123
4719 * tokens in-place). """
4721 * if type(last) is not token or type(tok) is not token: # <<<<<<<<<<<<<<
4722 * tokens.append(tok)
4728 /* "lxml/html/diff.py":126
4729 * tokens.append(tok)
4731 * text = _unicode(last) # <<<<<<<<<<<<<<
4732 * if last.trailing_whitespace:
4733 * text += last.trailing_whitespace
4736 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
4737 __Pyx_GOTREF(__pyx_t_6);
4739 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4740 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
4741 if (likely(__pyx_t_7)) {
4742 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4743 __Pyx_INCREF(__pyx_t_7);
4744 __Pyx_INCREF(function);
4745 __Pyx_DECREF_SET(__pyx_t_6, function);
4748 __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_last) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_last);
4749 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4750 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4751 __Pyx_GOTREF(__pyx_t_1);
4752 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4753 __pyx_v_text = __pyx_t_1;
4756 /* "lxml/html/diff.py":127
4758 * text = _unicode(last)
4759 * if last.trailing_whitespace: # <<<<<<<<<<<<<<
4760 * text += last.trailing_whitespace
4763 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_last, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
4764 __Pyx_GOTREF(__pyx_t_1);
4765 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
4766 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4769 /* "lxml/html/diff.py":128
4770 * text = _unicode(last)
4771 * if last.trailing_whitespace:
4772 * text += last.trailing_whitespace # <<<<<<<<<<<<<<
4774 * merged = token(text,
4776 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_last, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
4777 __Pyx_GOTREF(__pyx_t_1);
4778 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
4779 __Pyx_GOTREF(__pyx_t_6);
4780 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4781 __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_6);
4784 /* "lxml/html/diff.py":127
4786 * text = _unicode(last)
4787 * if last.trailing_whitespace: # <<<<<<<<<<<<<<
4788 * text += last.trailing_whitespace
4793 /* "lxml/html/diff.py":129
4794 * if last.trailing_whitespace:
4795 * text += last.trailing_whitespace
4796 * text += tok # <<<<<<<<<<<<<<
4797 * merged = token(text,
4798 * pre_tags=last.pre_tags,
4800 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_v_tok); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
4801 __Pyx_GOTREF(__pyx_t_6);
4802 __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_6);
4805 /* "lxml/html/diff.py":130
4806 * text += last.trailing_whitespace
4808 * merged = token(text, # <<<<<<<<<<<<<<
4809 * pre_tags=last.pre_tags,
4810 * post_tags=tok.post_tags,
4812 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_token); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 130, __pyx_L1_error)
4813 __Pyx_GOTREF(__pyx_t_6);
4814 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
4815 __Pyx_GOTREF(__pyx_t_1);
4816 __Pyx_INCREF(__pyx_v_text);
4817 __Pyx_GIVEREF(__pyx_v_text);
4818 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_text);
4820 /* "lxml/html/diff.py":131
4822 * merged = token(text,
4823 * pre_tags=last.pre_tags, # <<<<<<<<<<<<<<
4824 * post_tags=tok.post_tags,
4825 * trailing_whitespace=tok.trailing_whitespace)
4827 __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error)
4828 __Pyx_GOTREF(__pyx_t_7);
4829 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_last, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)
4830 __Pyx_GOTREF(__pyx_t_8);
4831 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_pre_tags, __pyx_t_8) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
4832 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4834 /* "lxml/html/diff.py":132
4835 * merged = token(text,
4836 * pre_tags=last.pre_tags,
4837 * post_tags=tok.post_tags, # <<<<<<<<<<<<<<
4838 * trailing_whitespace=tok.trailing_whitespace)
4839 * merged.annotation = last.annotation
4841 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
4842 __Pyx_GOTREF(__pyx_t_8);
4843 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_post_tags, __pyx_t_8) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
4844 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4846 /* "lxml/html/diff.py":133
4847 * pre_tags=last.pre_tags,
4848 * post_tags=tok.post_tags,
4849 * trailing_whitespace=tok.trailing_whitespace) # <<<<<<<<<<<<<<
4850 * merged.annotation = last.annotation
4851 * tokens[-1] = merged
4853 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
4854 __Pyx_GOTREF(__pyx_t_8);
4855 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_trailing_whitespace, __pyx_t_8) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
4856 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4858 /* "lxml/html/diff.py":130
4859 * text += last.trailing_whitespace
4861 * merged = token(text, # <<<<<<<<<<<<<<
4862 * pre_tags=last.pre_tags,
4863 * post_tags=tok.post_tags,
4865 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 130, __pyx_L1_error)
4866 __Pyx_GOTREF(__pyx_t_8);
4867 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4868 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4869 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4870 __pyx_v_merged = __pyx_t_8;
4873 /* "lxml/html/diff.py":134
4874 * post_tags=tok.post_tags,
4875 * trailing_whitespace=tok.trailing_whitespace)
4876 * merged.annotation = last.annotation # <<<<<<<<<<<<<<
4877 * tokens[-1] = merged
4880 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_last, __pyx_n_s_annotation); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 134, __pyx_L1_error)
4881 __Pyx_GOTREF(__pyx_t_8);
4882 if (__Pyx_PyObject_SetAttrStr(__pyx_v_merged, __pyx_n_s_annotation, __pyx_t_8) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
4883 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4885 /* "lxml/html/diff.py":135
4886 * trailing_whitespace=tok.trailing_whitespace)
4887 * merged.annotation = last.annotation
4888 * tokens[-1] = merged # <<<<<<<<<<<<<<
4890 * def markup_serialize_tokens(tokens, markup_func):
4892 if (unlikely(__Pyx_SetItemInt(__pyx_v_tokens, -1L, __pyx_v_merged, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 135, __pyx_L1_error)
4896 /* "lxml/html/diff.py":119
4899 * def compress_merge_back(tokens, tok): # <<<<<<<<<<<<<<
4900 * """ Merge tok into the last element of tokens (modifying the list of
4901 * tokens in-place). """
4904 /* function exit code */
4905 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4908 __Pyx_XDECREF(__pyx_t_1);
4909 __Pyx_XDECREF(__pyx_t_6);
4910 __Pyx_XDECREF(__pyx_t_7);
4911 __Pyx_XDECREF(__pyx_t_8);
4912 __Pyx_AddTraceback("lxml.html.diff.compress_merge_back", __pyx_clineno, __pyx_lineno, __pyx_filename);
4915 __Pyx_XDECREF(__pyx_v_last);
4916 __Pyx_XDECREF(__pyx_v_text);
4917 __Pyx_XDECREF(__pyx_v_merged);
4918 __Pyx_XGIVEREF(__pyx_r);
4919 __Pyx_RefNannyFinishContext();
4922 static PyObject *__pyx_gb_4lxml_4html_4diff_16generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
4924 /* "lxml/html/diff.py":137
4925 * tokens[-1] = merged
4927 * def markup_serialize_tokens(tokens, markup_func): # <<<<<<<<<<<<<<
4929 * Serialize the list of tokens into a list of text chunks, calling
4932 /* Python wrapper */
4933 static PyObject *__pyx_pw_4lxml_4html_4diff_15markup_serialize_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4934 static char __pyx_doc_4lxml_4html_4diff_14markup_serialize_tokens[] = "\n Serialize the list of tokens into a list of text chunks, calling\n markup_func around text to add annotations.\n ";
4935 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_15markup_serialize_tokens = {"markup_serialize_tokens", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_15markup_serialize_tokens, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_14markup_serialize_tokens};
4936 static PyObject *__pyx_pw_4lxml_4html_4diff_15markup_serialize_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4937 PyObject *__pyx_v_tokens = 0;
4938 PyObject *__pyx_v_markup_func = 0;
4939 int __pyx_lineno = 0;
4940 const char *__pyx_filename = NULL;
4941 int __pyx_clineno = 0;
4942 PyObject *__pyx_r = 0;
4943 __Pyx_RefNannyDeclarations
4944 __Pyx_RefNannySetupContext("markup_serialize_tokens (wrapper)", 0);
4946 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tokens,&__pyx_n_s_markup_func,0};
4947 PyObject* values[2] = {0,0};
4948 if (unlikely(__pyx_kwds)) {
4950 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4952 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4954 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4957 default: goto __pyx_L5_argtuple_error;
4959 kw_args = PyDict_Size(__pyx_kwds);
4962 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tokens)) != 0)) kw_args--;
4963 else goto __pyx_L5_argtuple_error;
4966 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_markup_func)) != 0)) kw_args--;
4968 __Pyx_RaiseArgtupleInvalid("markup_serialize_tokens", 1, 2, 2, 1); __PYX_ERR(0, 137, __pyx_L3_error)
4971 if (unlikely(kw_args > 0)) {
4972 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "markup_serialize_tokens") < 0)) __PYX_ERR(0, 137, __pyx_L3_error)
4974 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4975 goto __pyx_L5_argtuple_error;
4977 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4978 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4980 __pyx_v_tokens = values[0];
4981 __pyx_v_markup_func = values[1];
4983 goto __pyx_L4_argument_unpacking_done;
4984 __pyx_L5_argtuple_error:;
4985 __Pyx_RaiseArgtupleInvalid("markup_serialize_tokens", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error)
4987 __Pyx_AddTraceback("lxml.html.diff.markup_serialize_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
4988 __Pyx_RefNannyFinishContext();
4990 __pyx_L4_argument_unpacking_done:;
4991 __pyx_r = __pyx_pf_4lxml_4html_4diff_14markup_serialize_tokens(__pyx_self, __pyx_v_tokens, __pyx_v_markup_func);
4993 /* function exit code */
4994 __Pyx_RefNannyFinishContext();
4998 static PyObject *__pyx_pf_4lxml_4html_4diff_14markup_serialize_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_markup_func) {
4999 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *__pyx_cur_scope;
5000 PyObject *__pyx_r = NULL;
5001 __Pyx_RefNannyDeclarations
5002 int __pyx_lineno = 0;
5003 const char *__pyx_filename = NULL;
5004 int __pyx_clineno = 0;
5005 __Pyx_RefNannySetupContext("markup_serialize_tokens", 0);
5006 __pyx_cur_scope = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens(__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens, __pyx_empty_tuple, NULL);
5007 if (unlikely(!__pyx_cur_scope)) {
5008 __pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)Py_None);
5009 __Pyx_INCREF(Py_None);
5010 __PYX_ERR(0, 137, __pyx_L1_error)
5012 __Pyx_GOTREF(__pyx_cur_scope);
5014 __pyx_cur_scope->__pyx_v_tokens = __pyx_v_tokens;
5015 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tokens);
5016 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tokens);
5017 __pyx_cur_scope->__pyx_v_markup_func = __pyx_v_markup_func;
5018 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_markup_func);
5019 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_markup_func);
5021 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_4html_4diff_16generator, __pyx_codeobj__4, (PyObject *) __pyx_cur_scope, __pyx_n_s_markup_serialize_tokens, __pyx_n_s_markup_serialize_tokens, __pyx_n_s_lxml_html_diff); if (unlikely(!gen)) __PYX_ERR(0, 137, __pyx_L1_error)
5022 __Pyx_DECREF(__pyx_cur_scope);
5023 __Pyx_RefNannyFinishContext();
5024 return (PyObject *) gen;
5027 /* function exit code */
5029 __Pyx_AddTraceback("lxml.html.diff.markup_serialize_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
5031 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
5032 __Pyx_XGIVEREF(__pyx_r);
5033 __Pyx_RefNannyFinishContext();
5037 static PyObject *__pyx_gb_4lxml_4html_4diff_16generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
5039 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *__pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)__pyx_generator->closure);
5040 PyObject *__pyx_r = NULL;
5041 PyObject *__pyx_t_1 = NULL;
5042 Py_ssize_t __pyx_t_2;
5043 PyObject *(*__pyx_t_3)(PyObject *);
5044 PyObject *__pyx_t_4 = NULL;
5045 PyObject *__pyx_t_5 = NULL;
5046 Py_ssize_t __pyx_t_6;
5047 PyObject *(*__pyx_t_7)(PyObject *);
5048 PyObject *__pyx_t_8 = NULL;
5049 PyObject *__pyx_t_9 = NULL;
5051 PyObject *__pyx_t_11 = NULL;
5053 int __pyx_lineno = 0;
5054 const char *__pyx_filename = NULL;
5055 int __pyx_clineno = 0;
5056 __Pyx_RefNannyDeclarations
5057 __Pyx_RefNannySetupContext("markup_serialize_tokens", 0);
5058 switch (__pyx_generator->resume_label) {
5059 case 0: goto __pyx_L3_first_run;
5060 case 1: goto __pyx_L8_resume_from_yield;
5061 case 2: goto __pyx_L10_resume_from_yield;
5062 case 3: goto __pyx_L13_resume_from_yield;
5063 default: /* CPython raises the right error here */
5064 __Pyx_RefNannyFinishContext();
5067 __pyx_L3_first_run:;
5068 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 137, __pyx_L1_error)
5070 /* "lxml/html/diff.py":142
5071 * markup_func around text to add annotations.
5073 * for token in tokens: # <<<<<<<<<<<<<<
5074 * for pre in token.pre_tags:
5077 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_tokens)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_tokens)) {
5078 __pyx_t_1 = __pyx_cur_scope->__pyx_v_tokens; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
5081 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
5082 __Pyx_GOTREF(__pyx_t_1);
5083 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
5086 if (likely(!__pyx_t_3)) {
5087 if (likely(PyList_CheckExact(__pyx_t_1))) {
5088 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
5089 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5090 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
5092 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
5093 __Pyx_GOTREF(__pyx_t_4);
5096 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
5097 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5098 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
5100 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
5101 __Pyx_GOTREF(__pyx_t_4);
5105 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
5106 if (unlikely(!__pyx_t_4)) {
5107 PyObject* exc_type = PyErr_Occurred();
5109 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5110 else __PYX_ERR(0, 142, __pyx_L1_error)
5114 __Pyx_GOTREF(__pyx_t_4);
5116 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_token);
5117 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_token, __pyx_t_4);
5118 __Pyx_GIVEREF(__pyx_t_4);
5121 /* "lxml/html/diff.py":143
5123 * for token in tokens:
5124 * for pre in token.pre_tags: # <<<<<<<<<<<<<<
5126 * html = token.html()
5128 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
5129 __Pyx_GOTREF(__pyx_t_4);
5130 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
5131 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
5134 __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error)
5135 __Pyx_GOTREF(__pyx_t_5);
5136 __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error)
5138 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5140 if (likely(!__pyx_t_7)) {
5141 if (likely(PyList_CheckExact(__pyx_t_5))) {
5142 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
5143 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5144 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 143, __pyx_L1_error)
5146 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
5147 __Pyx_GOTREF(__pyx_t_4);
5150 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
5151 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5152 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 143, __pyx_L1_error)
5154 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
5155 __Pyx_GOTREF(__pyx_t_4);
5159 __pyx_t_4 = __pyx_t_7(__pyx_t_5);
5160 if (unlikely(!__pyx_t_4)) {
5161 PyObject* exc_type = PyErr_Occurred();
5163 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5164 else __PYX_ERR(0, 143, __pyx_L1_error)
5168 __Pyx_GOTREF(__pyx_t_4);
5170 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pre);
5171 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pre, __pyx_t_4);
5172 __Pyx_GIVEREF(__pyx_t_4);
5175 /* "lxml/html/diff.py":144
5176 * for token in tokens:
5177 * for pre in token.pre_tags:
5178 * yield pre # <<<<<<<<<<<<<<
5179 * html = token.html()
5180 * html = markup_func(html, token.annotation)
5182 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pre);
5183 __pyx_r = __pyx_cur_scope->__pyx_v_pre;
5184 __Pyx_XGIVEREF(__pyx_t_1);
5185 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5186 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5187 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5188 __Pyx_XGIVEREF(__pyx_t_5);
5189 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
5190 __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
5191 __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
5192 __Pyx_XGIVEREF(__pyx_r);
5193 __Pyx_RefNannyFinishContext();
5194 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5195 /* return from generator, yielding value */
5196 __pyx_generator->resume_label = 1;
5198 __pyx_L8_resume_from_yield:;
5199 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5200 __pyx_cur_scope->__pyx_t_0 = 0;
5201 __Pyx_XGOTREF(__pyx_t_1);
5202 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5203 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5204 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
5205 __pyx_cur_scope->__pyx_t_3 = 0;
5206 __Pyx_XGOTREF(__pyx_t_5);
5207 __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
5208 __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
5209 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 144, __pyx_L1_error)
5211 /* "lxml/html/diff.py":143
5213 * for token in tokens:
5214 * for pre in token.pre_tags: # <<<<<<<<<<<<<<
5216 * html = token.html()
5219 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5221 /* "lxml/html/diff.py":145
5222 * for pre in token.pre_tags:
5224 * html = token.html() # <<<<<<<<<<<<<<
5225 * html = markup_func(html, token.annotation)
5226 * if token.trailing_whitespace:
5228 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_html); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
5229 __Pyx_GOTREF(__pyx_t_4);
5231 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5232 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
5233 if (likely(__pyx_t_8)) {
5234 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5235 __Pyx_INCREF(__pyx_t_8);
5236 __Pyx_INCREF(function);
5237 __Pyx_DECREF_SET(__pyx_t_4, function);
5240 __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
5241 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5242 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error)
5243 __Pyx_GOTREF(__pyx_t_5);
5244 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5245 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_html);
5246 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_html, __pyx_t_5);
5247 __Pyx_GIVEREF(__pyx_t_5);
5250 /* "lxml/html/diff.py":146
5252 * html = token.html()
5253 * html = markup_func(html, token.annotation) # <<<<<<<<<<<<<<
5254 * if token.trailing_whitespace:
5255 * html += token.trailing_whitespace
5257 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_annotation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
5258 __Pyx_GOTREF(__pyx_t_4);
5259 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_markup_func);
5260 __pyx_t_8 = __pyx_cur_scope->__pyx_v_markup_func; __pyx_t_9 = NULL;
5262 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5263 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
5264 if (likely(__pyx_t_9)) {
5265 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5266 __Pyx_INCREF(__pyx_t_9);
5267 __Pyx_INCREF(function);
5268 __Pyx_DECREF_SET(__pyx_t_8, function);
5272 #if CYTHON_FAST_PYCALL
5273 if (PyFunction_Check(__pyx_t_8)) {
5274 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_html, __pyx_t_4};
5275 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error)
5276 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5277 __Pyx_GOTREF(__pyx_t_5);
5278 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5281 #if CYTHON_FAST_PYCCALL
5282 if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5283 PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_html, __pyx_t_4};
5284 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error)
5285 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5286 __Pyx_GOTREF(__pyx_t_5);
5287 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5291 __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error)
5292 __Pyx_GOTREF(__pyx_t_11);
5294 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
5296 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_html);
5297 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_html);
5298 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_cur_scope->__pyx_v_html);
5299 __Pyx_GIVEREF(__pyx_t_4);
5300 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4);
5302 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error)
5303 __Pyx_GOTREF(__pyx_t_5);
5304 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5306 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5307 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_html);
5308 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_html, __pyx_t_5);
5309 __Pyx_GIVEREF(__pyx_t_5);
5312 /* "lxml/html/diff.py":147
5313 * html = token.html()
5314 * html = markup_func(html, token.annotation)
5315 * if token.trailing_whitespace: # <<<<<<<<<<<<<<
5316 * html += token.trailing_whitespace
5319 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error)
5320 __Pyx_GOTREF(__pyx_t_5);
5321 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 147, __pyx_L1_error)
5322 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5325 /* "lxml/html/diff.py":148
5326 * html = markup_func(html, token.annotation)
5327 * if token.trailing_whitespace:
5328 * html += token.trailing_whitespace # <<<<<<<<<<<<<<
5330 * for post in token.post_tags:
5332 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
5333 __Pyx_GOTREF(__pyx_t_5);
5334 __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_html, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
5335 __Pyx_GOTREF(__pyx_t_8);
5336 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5337 __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_html);
5338 __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_html, __pyx_t_8);
5339 __Pyx_GIVEREF(__pyx_t_8);
5342 /* "lxml/html/diff.py":147
5343 * html = token.html()
5344 * html = markup_func(html, token.annotation)
5345 * if token.trailing_whitespace: # <<<<<<<<<<<<<<
5346 * html += token.trailing_whitespace
5351 /* "lxml/html/diff.py":149
5352 * if token.trailing_whitespace:
5353 * html += token.trailing_whitespace
5354 * yield html # <<<<<<<<<<<<<<
5355 * for post in token.post_tags:
5358 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_html);
5359 __pyx_r = __pyx_cur_scope->__pyx_v_html;
5360 __Pyx_XGIVEREF(__pyx_t_1);
5361 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5362 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5363 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5364 __Pyx_XGIVEREF(__pyx_r);
5365 __Pyx_RefNannyFinishContext();
5366 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5367 /* return from generator, yielding value */
5368 __pyx_generator->resume_label = 2;
5370 __pyx_L10_resume_from_yield:;
5371 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5372 __pyx_cur_scope->__pyx_t_0 = 0;
5373 __Pyx_XGOTREF(__pyx_t_1);
5374 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5375 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5376 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 149, __pyx_L1_error)
5378 /* "lxml/html/diff.py":150
5379 * html += token.trailing_whitespace
5381 * for post in token.post_tags: # <<<<<<<<<<<<<<
5385 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
5386 __Pyx_GOTREF(__pyx_t_8);
5387 if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
5388 __pyx_t_5 = __pyx_t_8; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
5391 __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 150, __pyx_L1_error)
5392 __Pyx_GOTREF(__pyx_t_5);
5393 __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
5395 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5397 if (likely(!__pyx_t_7)) {
5398 if (likely(PyList_CheckExact(__pyx_t_5))) {
5399 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
5400 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5401 __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
5403 __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
5404 __Pyx_GOTREF(__pyx_t_8);
5407 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
5408 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5409 __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
5411 __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
5412 __Pyx_GOTREF(__pyx_t_8);
5416 __pyx_t_8 = __pyx_t_7(__pyx_t_5);
5417 if (unlikely(!__pyx_t_8)) {
5418 PyObject* exc_type = PyErr_Occurred();
5420 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5421 else __PYX_ERR(0, 150, __pyx_L1_error)
5425 __Pyx_GOTREF(__pyx_t_8);
5427 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_post);
5428 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_post, __pyx_t_8);
5429 __Pyx_GIVEREF(__pyx_t_8);
5432 /* "lxml/html/diff.py":151
5434 * for post in token.post_tags:
5435 * yield post # <<<<<<<<<<<<<<
5439 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_post);
5440 __pyx_r = __pyx_cur_scope->__pyx_v_post;
5441 __Pyx_XGIVEREF(__pyx_t_1);
5442 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
5443 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
5444 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
5445 __Pyx_XGIVEREF(__pyx_t_5);
5446 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
5447 __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
5448 __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
5449 __Pyx_XGIVEREF(__pyx_r);
5450 __Pyx_RefNannyFinishContext();
5451 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5452 /* return from generator, yielding value */
5453 __pyx_generator->resume_label = 3;
5455 __pyx_L13_resume_from_yield:;
5456 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
5457 __pyx_cur_scope->__pyx_t_0 = 0;
5458 __Pyx_XGOTREF(__pyx_t_1);
5459 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
5460 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
5461 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
5462 __pyx_cur_scope->__pyx_t_3 = 0;
5463 __Pyx_XGOTREF(__pyx_t_5);
5464 __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
5465 __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
5466 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 151, __pyx_L1_error)
5468 /* "lxml/html/diff.py":150
5469 * html += token.trailing_whitespace
5471 * for post in token.post_tags: # <<<<<<<<<<<<<<
5476 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5478 /* "lxml/html/diff.py":142
5479 * markup_func around text to add annotations.
5481 * for token in tokens: # <<<<<<<<<<<<<<
5482 * for pre in token.pre_tags:
5486 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5487 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5489 /* "lxml/html/diff.py":137
5490 * tokens[-1] = merged
5492 * def markup_serialize_tokens(tokens, markup_func): # <<<<<<<<<<<<<<
5494 * Serialize the list of tokens into a list of text chunks, calling
5497 /* function exit code */
5498 PyErr_SetNone(PyExc_StopIteration);
5501 __Pyx_XDECREF(__pyx_t_1);
5502 __Pyx_XDECREF(__pyx_t_4);
5503 __Pyx_XDECREF(__pyx_t_5);
5504 __Pyx_XDECREF(__pyx_t_8);
5505 __Pyx_XDECREF(__pyx_t_9);
5506 __Pyx_XDECREF(__pyx_t_11);
5507 __Pyx_AddTraceback("markup_serialize_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
5509 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
5510 #if !CYTHON_USE_EXC_INFO_STACK
5511 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
5513 __pyx_generator->resume_label = -1;
5514 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
5515 __Pyx_RefNannyFinishContext();
5519 /* "lxml/html/diff.py":158
5520 * ############################################################
5522 * def htmldiff(old_html, new_html): # <<<<<<<<<<<<<<
5523 * ## FIXME: this should take parsed documents too, and use their body
5524 * ## or other content.
5527 /* Python wrapper */
5528 static PyObject *__pyx_pw_4lxml_4html_4diff_18htmldiff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5529 static char __pyx_doc_4lxml_4html_4diff_17htmldiff[] = " Do a diff of the old and new document. The documents are HTML\n *fragments* (str/UTF8 or unicode), they are not complete documents\n (i.e., no <html> tag).\n\n Returns HTML with <ins> and <del> tags added around the\n appropriate text. \n\n Markup is generally ignored, with the markup from new_html\n preserved, and possibly some markup from old_html (though it is\n considered acceptable to lose some of the old markup). Only the\n words in the HTML are diffed. The exception is <img> tags, which\n are treated like words, and the href attribute of <a> tags, which\n are noted inside the tag itself when there are changes.\n ";
5530 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_18htmldiff = {"htmldiff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_18htmldiff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_17htmldiff};
5531 static PyObject *__pyx_pw_4lxml_4html_4diff_18htmldiff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5532 PyObject *__pyx_v_old_html = 0;
5533 PyObject *__pyx_v_new_html = 0;
5534 int __pyx_lineno = 0;
5535 const char *__pyx_filename = NULL;
5536 int __pyx_clineno = 0;
5537 PyObject *__pyx_r = 0;
5538 __Pyx_RefNannyDeclarations
5539 __Pyx_RefNannySetupContext("htmldiff (wrapper)", 0);
5541 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_html,&__pyx_n_s_new_html,0};
5542 PyObject* values[2] = {0,0};
5543 if (unlikely(__pyx_kwds)) {
5545 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5547 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5549 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5552 default: goto __pyx_L5_argtuple_error;
5554 kw_args = PyDict_Size(__pyx_kwds);
5557 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_html)) != 0)) kw_args--;
5558 else goto __pyx_L5_argtuple_error;
5561 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_html)) != 0)) kw_args--;
5563 __Pyx_RaiseArgtupleInvalid("htmldiff", 1, 2, 2, 1); __PYX_ERR(0, 158, __pyx_L3_error)
5566 if (unlikely(kw_args > 0)) {
5567 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "htmldiff") < 0)) __PYX_ERR(0, 158, __pyx_L3_error)
5569 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5570 goto __pyx_L5_argtuple_error;
5572 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5573 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5575 __pyx_v_old_html = values[0];
5576 __pyx_v_new_html = values[1];
5578 goto __pyx_L4_argument_unpacking_done;
5579 __pyx_L5_argtuple_error:;
5580 __Pyx_RaiseArgtupleInvalid("htmldiff", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 158, __pyx_L3_error)
5582 __Pyx_AddTraceback("lxml.html.diff.htmldiff", __pyx_clineno, __pyx_lineno, __pyx_filename);
5583 __Pyx_RefNannyFinishContext();
5585 __pyx_L4_argument_unpacking_done:;
5586 __pyx_r = __pyx_pf_4lxml_4html_4diff_17htmldiff(__pyx_self, __pyx_v_old_html, __pyx_v_new_html);
5588 /* function exit code */
5589 __Pyx_RefNannyFinishContext();
5593 static PyObject *__pyx_pf_4lxml_4html_4diff_17htmldiff(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_old_html, PyObject *__pyx_v_new_html) {
5594 PyObject *__pyx_v_old_html_tokens = NULL;
5595 PyObject *__pyx_v_new_html_tokens = NULL;
5596 PyObject *__pyx_v_result = NULL;
5597 PyObject *__pyx_r = NULL;
5598 __Pyx_RefNannyDeclarations
5599 PyObject *__pyx_t_1 = NULL;
5600 PyObject *__pyx_t_2 = NULL;
5601 PyObject *__pyx_t_3 = NULL;
5603 PyObject *__pyx_t_5 = NULL;
5604 int __pyx_lineno = 0;
5605 const char *__pyx_filename = NULL;
5606 int __pyx_clineno = 0;
5607 __Pyx_RefNannySetupContext("htmldiff", 0);
5609 /* "lxml/html/diff.py":175
5610 * are noted inside the tag itself when there are changes.
5612 * old_html_tokens = tokenize(old_html) # <<<<<<<<<<<<<<
5613 * new_html_tokens = tokenize(new_html)
5614 * result = htmldiff_tokens(old_html_tokens, new_html_tokens)
5616 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tokenize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
5617 __Pyx_GOTREF(__pyx_t_2);
5619 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5620 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5621 if (likely(__pyx_t_3)) {
5622 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5623 __Pyx_INCREF(__pyx_t_3);
5624 __Pyx_INCREF(function);
5625 __Pyx_DECREF_SET(__pyx_t_2, function);
5628 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_old_html) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_old_html);
5629 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5630 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
5631 __Pyx_GOTREF(__pyx_t_1);
5632 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5633 __pyx_v_old_html_tokens = __pyx_t_1;
5636 /* "lxml/html/diff.py":176
5638 * old_html_tokens = tokenize(old_html)
5639 * new_html_tokens = tokenize(new_html) # <<<<<<<<<<<<<<
5640 * result = htmldiff_tokens(old_html_tokens, new_html_tokens)
5641 * result = ''.join(result).strip()
5643 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tokenize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
5644 __Pyx_GOTREF(__pyx_t_2);
5646 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5647 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5648 if (likely(__pyx_t_3)) {
5649 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5650 __Pyx_INCREF(__pyx_t_3);
5651 __Pyx_INCREF(function);
5652 __Pyx_DECREF_SET(__pyx_t_2, function);
5655 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_new_html) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_new_html);
5656 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5657 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
5658 __Pyx_GOTREF(__pyx_t_1);
5659 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5660 __pyx_v_new_html_tokens = __pyx_t_1;
5663 /* "lxml/html/diff.py":177
5664 * old_html_tokens = tokenize(old_html)
5665 * new_html_tokens = tokenize(new_html)
5666 * result = htmldiff_tokens(old_html_tokens, new_html_tokens) # <<<<<<<<<<<<<<
5667 * result = ''.join(result).strip()
5668 * return fixup_ins_del_tags(result)
5670 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_htmldiff_tokens); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
5671 __Pyx_GOTREF(__pyx_t_2);
5674 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5675 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5676 if (likely(__pyx_t_3)) {
5677 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5678 __Pyx_INCREF(__pyx_t_3);
5679 __Pyx_INCREF(function);
5680 __Pyx_DECREF_SET(__pyx_t_2, function);
5684 #if CYTHON_FAST_PYCALL
5685 if (PyFunction_Check(__pyx_t_2)) {
5686 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_old_html_tokens, __pyx_v_new_html_tokens};
5687 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5688 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5689 __Pyx_GOTREF(__pyx_t_1);
5692 #if CYTHON_FAST_PYCCALL
5693 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
5694 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_old_html_tokens, __pyx_v_new_html_tokens};
5695 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5696 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5697 __Pyx_GOTREF(__pyx_t_1);
5701 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
5702 __Pyx_GOTREF(__pyx_t_5);
5704 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
5706 __Pyx_INCREF(__pyx_v_old_html_tokens);
5707 __Pyx_GIVEREF(__pyx_v_old_html_tokens);
5708 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_old_html_tokens);
5709 __Pyx_INCREF(__pyx_v_new_html_tokens);
5710 __Pyx_GIVEREF(__pyx_v_new_html_tokens);
5711 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_new_html_tokens);
5712 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5713 __Pyx_GOTREF(__pyx_t_1);
5714 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5716 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5717 __pyx_v_result = __pyx_t_1;
5720 /* "lxml/html/diff.py":178
5721 * new_html_tokens = tokenize(new_html)
5722 * result = htmldiff_tokens(old_html_tokens, new_html_tokens)
5723 * result = ''.join(result).strip() # <<<<<<<<<<<<<<
5724 * return fixup_ins_del_tags(result)
5727 __pyx_t_2 = PyUnicode_Join(__pyx_kp_u__2, __pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
5728 __Pyx_GOTREF(__pyx_t_2);
5729 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
5730 __Pyx_GOTREF(__pyx_t_5);
5731 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5733 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5734 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
5735 if (likely(__pyx_t_2)) {
5736 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5737 __Pyx_INCREF(__pyx_t_2);
5738 __Pyx_INCREF(function);
5739 __Pyx_DECREF_SET(__pyx_t_5, function);
5742 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
5743 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5744 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5745 __Pyx_GOTREF(__pyx_t_1);
5746 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5747 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1);
5750 /* "lxml/html/diff.py":179
5751 * result = htmldiff_tokens(old_html_tokens, new_html_tokens)
5752 * result = ''.join(result).strip()
5753 * return fixup_ins_del_tags(result) # <<<<<<<<<<<<<<
5755 * def htmldiff_tokens(html1_tokens, html2_tokens):
5757 __Pyx_XDECREF(__pyx_r);
5758 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_fixup_ins_del_tags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error)
5759 __Pyx_GOTREF(__pyx_t_5);
5761 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5762 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
5763 if (likely(__pyx_t_2)) {
5764 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5765 __Pyx_INCREF(__pyx_t_2);
5766 __Pyx_INCREF(function);
5767 __Pyx_DECREF_SET(__pyx_t_5, function);
5770 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_result) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_result);
5771 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5772 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
5773 __Pyx_GOTREF(__pyx_t_1);
5774 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5775 __pyx_r = __pyx_t_1;
5779 /* "lxml/html/diff.py":158
5780 * ############################################################
5782 * def htmldiff(old_html, new_html): # <<<<<<<<<<<<<<
5783 * ## FIXME: this should take parsed documents too, and use their body
5784 * ## or other content.
5787 /* function exit code */
5789 __Pyx_XDECREF(__pyx_t_1);
5790 __Pyx_XDECREF(__pyx_t_2);
5791 __Pyx_XDECREF(__pyx_t_3);
5792 __Pyx_XDECREF(__pyx_t_5);
5793 __Pyx_AddTraceback("lxml.html.diff.htmldiff", __pyx_clineno, __pyx_lineno, __pyx_filename);
5796 __Pyx_XDECREF(__pyx_v_old_html_tokens);
5797 __Pyx_XDECREF(__pyx_v_new_html_tokens);
5798 __Pyx_XDECREF(__pyx_v_result);
5799 __Pyx_XGIVEREF(__pyx_r);
5800 __Pyx_RefNannyFinishContext();
5804 /* "lxml/html/diff.py":181
5805 * return fixup_ins_del_tags(result)
5807 * def htmldiff_tokens(html1_tokens, html2_tokens): # <<<<<<<<<<<<<<
5808 * """ Does a diff on the tokens themselves, returning a list of text
5809 * chunks (not tokens).
5812 /* Python wrapper */
5813 static PyObject *__pyx_pw_4lxml_4html_4diff_20htmldiff_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5814 static char __pyx_doc_4lxml_4html_4diff_19htmldiff_tokens[] = " Does a diff on the tokens themselves, returning a list of text\n chunks (not tokens).\n ";
5815 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_20htmldiff_tokens = {"htmldiff_tokens", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_20htmldiff_tokens, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_19htmldiff_tokens};
5816 static PyObject *__pyx_pw_4lxml_4html_4diff_20htmldiff_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5817 PyObject *__pyx_v_html1_tokens = 0;
5818 PyObject *__pyx_v_html2_tokens = 0;
5819 int __pyx_lineno = 0;
5820 const char *__pyx_filename = NULL;
5821 int __pyx_clineno = 0;
5822 PyObject *__pyx_r = 0;
5823 __Pyx_RefNannyDeclarations
5824 __Pyx_RefNannySetupContext("htmldiff_tokens (wrapper)", 0);
5826 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_html1_tokens,&__pyx_n_s_html2_tokens,0};
5827 PyObject* values[2] = {0,0};
5828 if (unlikely(__pyx_kwds)) {
5830 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5832 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5834 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5837 default: goto __pyx_L5_argtuple_error;
5839 kw_args = PyDict_Size(__pyx_kwds);
5842 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_html1_tokens)) != 0)) kw_args--;
5843 else goto __pyx_L5_argtuple_error;
5846 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_html2_tokens)) != 0)) kw_args--;
5848 __Pyx_RaiseArgtupleInvalid("htmldiff_tokens", 1, 2, 2, 1); __PYX_ERR(0, 181, __pyx_L3_error)
5851 if (unlikely(kw_args > 0)) {
5852 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "htmldiff_tokens") < 0)) __PYX_ERR(0, 181, __pyx_L3_error)
5854 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5855 goto __pyx_L5_argtuple_error;
5857 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5858 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5860 __pyx_v_html1_tokens = values[0];
5861 __pyx_v_html2_tokens = values[1];
5863 goto __pyx_L4_argument_unpacking_done;
5864 __pyx_L5_argtuple_error:;
5865 __Pyx_RaiseArgtupleInvalid("htmldiff_tokens", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 181, __pyx_L3_error)
5867 __Pyx_AddTraceback("lxml.html.diff.htmldiff_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
5868 __Pyx_RefNannyFinishContext();
5870 __pyx_L4_argument_unpacking_done:;
5871 __pyx_r = __pyx_pf_4lxml_4html_4diff_19htmldiff_tokens(__pyx_self, __pyx_v_html1_tokens, __pyx_v_html2_tokens);
5873 /* function exit code */
5874 __Pyx_RefNannyFinishContext();
5878 static PyObject *__pyx_pf_4lxml_4html_4diff_19htmldiff_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html1_tokens, PyObject *__pyx_v_html2_tokens) {
5879 PyObject *__pyx_v_s = NULL;
5880 PyObject *__pyx_v_commands = NULL;
5881 PyObject *__pyx_v_result = NULL;
5882 PyObject *__pyx_v_command = NULL;
5883 PyObject *__pyx_v_i1 = NULL;
5884 PyObject *__pyx_v_i2 = NULL;
5885 PyObject *__pyx_v_j1 = NULL;
5886 PyObject *__pyx_v_j2 = NULL;
5887 PyObject *__pyx_v_ins_tokens = NULL;
5888 PyObject *__pyx_v_del_tokens = NULL;
5889 PyObject *__pyx_r = NULL;
5890 __Pyx_RefNannyDeclarations
5891 PyObject *__pyx_t_1 = NULL;
5892 PyObject *__pyx_t_2 = NULL;
5893 PyObject *__pyx_t_3 = NULL;
5894 Py_ssize_t __pyx_t_4;
5895 PyObject *(*__pyx_t_5)(PyObject *);
5896 PyObject *__pyx_t_6 = NULL;
5897 PyObject *__pyx_t_7 = NULL;
5898 PyObject *__pyx_t_8 = NULL;
5899 PyObject *__pyx_t_9 = NULL;
5900 PyObject *__pyx_t_10 = NULL;
5901 PyObject *(*__pyx_t_11)(PyObject *);
5905 int __pyx_lineno = 0;
5906 const char *__pyx_filename = NULL;
5907 int __pyx_clineno = 0;
5908 __Pyx_RefNannySetupContext("htmldiff_tokens", 0);
5910 /* "lxml/html/diff.py":198
5911 * # fuzzy where in the new document the old text would have gone.
5912 * # Again we just do a best effort attempt.
5913 * s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens) # <<<<<<<<<<<<<<
5914 * commands = s.get_opcodes()
5917 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_InsensitiveSequenceMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
5918 __Pyx_GOTREF(__pyx_t_1);
5919 __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
5920 __Pyx_GOTREF(__pyx_t_2);
5921 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_a, __pyx_v_html1_tokens) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
5922 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_v_html2_tokens) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
5923 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
5924 __Pyx_GOTREF(__pyx_t_3);
5925 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5926 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5927 __pyx_v_s = __pyx_t_3;
5930 /* "lxml/html/diff.py":199
5931 * # Again we just do a best effort attempt.
5932 * s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens)
5933 * commands = s.get_opcodes() # <<<<<<<<<<<<<<
5935 * for command, i1, i2, j1, j2 in commands:
5937 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_get_opcodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
5938 __Pyx_GOTREF(__pyx_t_2);
5940 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5941 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
5942 if (likely(__pyx_t_1)) {
5943 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5944 __Pyx_INCREF(__pyx_t_1);
5945 __Pyx_INCREF(function);
5946 __Pyx_DECREF_SET(__pyx_t_2, function);
5949 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5950 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5951 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
5952 __Pyx_GOTREF(__pyx_t_3);
5953 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5954 __pyx_v_commands = __pyx_t_3;
5957 /* "lxml/html/diff.py":200
5958 * s = InsensitiveSequenceMatcher(a=html1_tokens, b=html2_tokens)
5959 * commands = s.get_opcodes()
5960 * result = [] # <<<<<<<<<<<<<<
5961 * for command, i1, i2, j1, j2 in commands:
5962 * if command == 'equal':
5964 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
5965 __Pyx_GOTREF(__pyx_t_3);
5966 __pyx_v_result = __pyx_t_3;
5969 /* "lxml/html/diff.py":201
5970 * commands = s.get_opcodes()
5972 * for command, i1, i2, j1, j2 in commands: # <<<<<<<<<<<<<<
5973 * if command == 'equal':
5974 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
5976 if (likely(PyList_CheckExact(__pyx_v_commands)) || PyTuple_CheckExact(__pyx_v_commands)) {
5977 __pyx_t_3 = __pyx_v_commands; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
5980 __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_commands); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
5981 __Pyx_GOTREF(__pyx_t_3);
5982 __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
5985 if (likely(!__pyx_t_5)) {
5986 if (likely(PyList_CheckExact(__pyx_t_3))) {
5987 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
5988 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5989 __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, 201, __pyx_L1_error)
5991 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
5992 __Pyx_GOTREF(__pyx_t_2);
5995 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
5996 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5997 __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, 201, __pyx_L1_error)
5999 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
6000 __Pyx_GOTREF(__pyx_t_2);
6004 __pyx_t_2 = __pyx_t_5(__pyx_t_3);
6005 if (unlikely(!__pyx_t_2)) {
6006 PyObject* exc_type = PyErr_Occurred();
6008 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6009 else __PYX_ERR(0, 201, __pyx_L1_error)
6013 __Pyx_GOTREF(__pyx_t_2);
6015 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
6016 PyObject* sequence = __pyx_t_2;
6017 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6018 if (unlikely(size != 5)) {
6019 if (size > 5) __Pyx_RaiseTooManyValuesError(5);
6020 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6021 __PYX_ERR(0, 201, __pyx_L1_error)
6023 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6024 if (likely(PyTuple_CheckExact(sequence))) {
6025 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
6026 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
6027 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
6028 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3);
6029 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4);
6031 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
6032 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
6033 __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
6034 __pyx_t_8 = PyList_GET_ITEM(sequence, 3);
6035 __pyx_t_9 = PyList_GET_ITEM(sequence, 4);
6037 __Pyx_INCREF(__pyx_t_1);
6038 __Pyx_INCREF(__pyx_t_6);
6039 __Pyx_INCREF(__pyx_t_7);
6040 __Pyx_INCREF(__pyx_t_8);
6041 __Pyx_INCREF(__pyx_t_9);
6045 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
6046 for (i=0; i < 5; i++) {
6047 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 201, __pyx_L1_error)
6053 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6055 Py_ssize_t index = -1;
6056 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
6057 __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error)
6058 __Pyx_GOTREF(__pyx_t_10);
6059 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6060 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
6061 for (index=0; index < 5; index++) {
6062 PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
6064 *(temps[index]) = item;
6066 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 5) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
6068 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6069 goto __pyx_L6_unpacking_done;
6070 __pyx_L5_unpacking_failed:;
6071 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6073 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6074 __PYX_ERR(0, 201, __pyx_L1_error)
6075 __pyx_L6_unpacking_done:;
6077 __Pyx_XDECREF_SET(__pyx_v_command, __pyx_t_1);
6079 __Pyx_XDECREF_SET(__pyx_v_i1, __pyx_t_6);
6081 __Pyx_XDECREF_SET(__pyx_v_i2, __pyx_t_7);
6083 __Pyx_XDECREF_SET(__pyx_v_j1, __pyx_t_8);
6085 __Pyx_XDECREF_SET(__pyx_v_j2, __pyx_t_9);
6088 /* "lxml/html/diff.py":202
6090 * for command, i1, i2, j1, j2 in commands:
6091 * if command == 'equal': # <<<<<<<<<<<<<<
6092 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6095 __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_equal, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
6098 /* "lxml/html/diff.py":203
6099 * for command, i1, i2, j1, j2 in commands:
6100 * if command == 'equal':
6101 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True)) # <<<<<<<<<<<<<<
6103 * if command == 'insert' or command == 'replace':
6105 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_extend); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 203, __pyx_L1_error)
6106 __Pyx_GOTREF(__pyx_t_9);
6107 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_expand_tokens); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error)
6108 __Pyx_GOTREF(__pyx_t_8);
6109 __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_html2_tokens, 0, 0, &__pyx_v_j1, &__pyx_v_j2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error)
6110 __Pyx_GOTREF(__pyx_t_7);
6111 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
6112 __Pyx_GOTREF(__pyx_t_6);
6113 __Pyx_GIVEREF(__pyx_t_7);
6114 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
6116 __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error)
6117 __Pyx_GOTREF(__pyx_t_7);
6118 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_equal, Py_True) < 0) __PYX_ERR(0, 203, __pyx_L1_error)
6119 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
6120 __Pyx_GOTREF(__pyx_t_1);
6121 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6122 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6123 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6125 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
6126 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
6127 if (likely(__pyx_t_7)) {
6128 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6129 __Pyx_INCREF(__pyx_t_7);
6130 __Pyx_INCREF(function);
6131 __Pyx_DECREF_SET(__pyx_t_9, function);
6134 __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1);
6135 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6136 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6137 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
6138 __Pyx_GOTREF(__pyx_t_2);
6139 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6140 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6142 /* "lxml/html/diff.py":204
6143 * if command == 'equal':
6144 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6145 * continue # <<<<<<<<<<<<<<
6146 * if command == 'insert' or command == 'replace':
6147 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6149 goto __pyx_L3_continue;
6151 /* "lxml/html/diff.py":202
6153 * for command, i1, i2, j1, j2 in commands:
6154 * if command == 'equal': # <<<<<<<<<<<<<<
6155 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6160 /* "lxml/html/diff.py":205
6161 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6163 * if command == 'insert' or command == 'replace': # <<<<<<<<<<<<<<
6164 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6165 * merge_insert(ins_tokens, result)
6167 __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_insert, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
6170 __pyx_t_12 = __pyx_t_13;
6171 goto __pyx_L9_bool_binop_done;
6173 __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_replace, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
6174 __pyx_t_12 = __pyx_t_13;
6175 __pyx_L9_bool_binop_done:;
6178 /* "lxml/html/diff.py":206
6180 * if command == 'insert' or command == 'replace':
6181 * ins_tokens = expand_tokens(html2_tokens[j1:j2]) # <<<<<<<<<<<<<<
6182 * merge_insert(ins_tokens, result)
6183 * if command == 'delete' or command == 'replace':
6185 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_expand_tokens); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 206, __pyx_L1_error)
6186 __Pyx_GOTREF(__pyx_t_9);
6187 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_html2_tokens, 0, 0, &__pyx_v_j1, &__pyx_v_j2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
6188 __Pyx_GOTREF(__pyx_t_1);
6190 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6191 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
6192 if (likely(__pyx_t_7)) {
6193 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6194 __Pyx_INCREF(__pyx_t_7);
6195 __Pyx_INCREF(function);
6196 __Pyx_DECREF_SET(__pyx_t_9, function);
6199 __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1);
6200 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6201 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6202 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
6203 __Pyx_GOTREF(__pyx_t_2);
6204 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6205 __Pyx_XDECREF_SET(__pyx_v_ins_tokens, __pyx_t_2);
6208 /* "lxml/html/diff.py":207
6209 * if command == 'insert' or command == 'replace':
6210 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6211 * merge_insert(ins_tokens, result) # <<<<<<<<<<<<<<
6212 * if command == 'delete' or command == 'replace':
6213 * del_tokens = expand_tokens(html1_tokens[i1:i2])
6215 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_merge_insert); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 207, __pyx_L1_error)
6216 __Pyx_GOTREF(__pyx_t_9);
6219 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6220 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
6221 if (likely(__pyx_t_1)) {
6222 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6223 __Pyx_INCREF(__pyx_t_1);
6224 __Pyx_INCREF(function);
6225 __Pyx_DECREF_SET(__pyx_t_9, function);
6229 #if CYTHON_FAST_PYCALL
6230 if (PyFunction_Check(__pyx_t_9)) {
6231 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_ins_tokens, __pyx_v_result};
6232 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
6233 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6234 __Pyx_GOTREF(__pyx_t_2);
6237 #if CYTHON_FAST_PYCCALL
6238 if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
6239 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_ins_tokens, __pyx_v_result};
6240 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
6241 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6242 __Pyx_GOTREF(__pyx_t_2);
6246 __pyx_t_7 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error)
6247 __Pyx_GOTREF(__pyx_t_7);
6249 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
6251 __Pyx_INCREF(__pyx_v_ins_tokens);
6252 __Pyx_GIVEREF(__pyx_v_ins_tokens);
6253 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_14, __pyx_v_ins_tokens);
6254 __Pyx_INCREF(__pyx_v_result);
6255 __Pyx_GIVEREF(__pyx_v_result);
6256 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_14, __pyx_v_result);
6257 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
6258 __Pyx_GOTREF(__pyx_t_2);
6259 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6261 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6262 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6264 /* "lxml/html/diff.py":205
6265 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6267 * if command == 'insert' or command == 'replace': # <<<<<<<<<<<<<<
6268 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6269 * merge_insert(ins_tokens, result)
6273 /* "lxml/html/diff.py":208
6274 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6275 * merge_insert(ins_tokens, result)
6276 * if command == 'delete' or command == 'replace': # <<<<<<<<<<<<<<
6277 * del_tokens = expand_tokens(html1_tokens[i1:i2])
6278 * merge_delete(del_tokens, result)
6280 __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_delete, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
6283 __pyx_t_12 = __pyx_t_13;
6284 goto __pyx_L12_bool_binop_done;
6286 __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_command, __pyx_n_u_replace, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
6287 __pyx_t_12 = __pyx_t_13;
6288 __pyx_L12_bool_binop_done:;
6291 /* "lxml/html/diff.py":209
6292 * merge_insert(ins_tokens, result)
6293 * if command == 'delete' or command == 'replace':
6294 * del_tokens = expand_tokens(html1_tokens[i1:i2]) # <<<<<<<<<<<<<<
6295 * merge_delete(del_tokens, result)
6296 * # If deletes were inserted directly as <del> then we'd have an
6298 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_expand_tokens); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error)
6299 __Pyx_GOTREF(__pyx_t_9);
6300 __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_html1_tokens, 0, 0, &__pyx_v_i1, &__pyx_v_i2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error)
6301 __Pyx_GOTREF(__pyx_t_7);
6303 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6304 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
6305 if (likely(__pyx_t_1)) {
6306 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6307 __Pyx_INCREF(__pyx_t_1);
6308 __Pyx_INCREF(function);
6309 __Pyx_DECREF_SET(__pyx_t_9, function);
6312 __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
6313 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6314 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6315 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
6316 __Pyx_GOTREF(__pyx_t_2);
6317 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6318 __Pyx_XDECREF_SET(__pyx_v_del_tokens, __pyx_t_2);
6321 /* "lxml/html/diff.py":210
6322 * if command == 'delete' or command == 'replace':
6323 * del_tokens = expand_tokens(html1_tokens[i1:i2])
6324 * merge_delete(del_tokens, result) # <<<<<<<<<<<<<<
6325 * # If deletes were inserted directly as <del> then we'd have an
6326 * # invalid document at this point. Instead we put in special
6328 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_merge_delete); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 210, __pyx_L1_error)
6329 __Pyx_GOTREF(__pyx_t_9);
6332 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
6333 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
6334 if (likely(__pyx_t_7)) {
6335 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6336 __Pyx_INCREF(__pyx_t_7);
6337 __Pyx_INCREF(function);
6338 __Pyx_DECREF_SET(__pyx_t_9, function);
6342 #if CYTHON_FAST_PYCALL
6343 if (PyFunction_Check(__pyx_t_9)) {
6344 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_del_tokens, __pyx_v_result};
6345 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
6346 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6347 __Pyx_GOTREF(__pyx_t_2);
6350 #if CYTHON_FAST_PYCCALL
6351 if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
6352 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_del_tokens, __pyx_v_result};
6353 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
6354 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6355 __Pyx_GOTREF(__pyx_t_2);
6359 __pyx_t_1 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
6360 __Pyx_GOTREF(__pyx_t_1);
6362 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __pyx_t_7 = NULL;
6364 __Pyx_INCREF(__pyx_v_del_tokens);
6365 __Pyx_GIVEREF(__pyx_v_del_tokens);
6366 PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_14, __pyx_v_del_tokens);
6367 __Pyx_INCREF(__pyx_v_result);
6368 __Pyx_GIVEREF(__pyx_v_result);
6369 PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_14, __pyx_v_result);
6370 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
6371 __Pyx_GOTREF(__pyx_t_2);
6372 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6374 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6377 /* "lxml/html/diff.py":208
6378 * ins_tokens = expand_tokens(html2_tokens[j1:j2])
6379 * merge_insert(ins_tokens, result)
6380 * if command == 'delete' or command == 'replace': # <<<<<<<<<<<<<<
6381 * del_tokens = expand_tokens(html1_tokens[i1:i2])
6382 * merge_delete(del_tokens, result)
6386 /* "lxml/html/diff.py":201
6387 * commands = s.get_opcodes()
6389 * for command, i1, i2, j1, j2 in commands: # <<<<<<<<<<<<<<
6390 * if command == 'equal':
6391 * result.extend(expand_tokens(html2_tokens[j1:j2], equal=True))
6395 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6397 /* "lxml/html/diff.py":215
6398 * # markers, and when the complete diffed document has been created
6399 * # we try to move the deletes around and resolve any problems.
6400 * result = cleanup_delete(result) # <<<<<<<<<<<<<<
6404 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cleanup_delete); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
6405 __Pyx_GOTREF(__pyx_t_2);
6407 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6408 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
6409 if (likely(__pyx_t_9)) {
6410 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6411 __Pyx_INCREF(__pyx_t_9);
6412 __Pyx_INCREF(function);
6413 __Pyx_DECREF_SET(__pyx_t_2, function);
6416 __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_v_result) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_result);
6417 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6418 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
6419 __Pyx_GOTREF(__pyx_t_3);
6420 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6421 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
6424 /* "lxml/html/diff.py":217
6425 * result = cleanup_delete(result)
6427 * return result # <<<<<<<<<<<<<<
6429 * def expand_tokens(tokens, equal=False):
6431 __Pyx_XDECREF(__pyx_r);
6432 __Pyx_INCREF(__pyx_v_result);
6433 __pyx_r = __pyx_v_result;
6436 /* "lxml/html/diff.py":181
6437 * return fixup_ins_del_tags(result)
6439 * def htmldiff_tokens(html1_tokens, html2_tokens): # <<<<<<<<<<<<<<
6440 * """ Does a diff on the tokens themselves, returning a list of text
6441 * chunks (not tokens).
6444 /* function exit code */
6446 __Pyx_XDECREF(__pyx_t_1);
6447 __Pyx_XDECREF(__pyx_t_2);
6448 __Pyx_XDECREF(__pyx_t_3);
6449 __Pyx_XDECREF(__pyx_t_6);
6450 __Pyx_XDECREF(__pyx_t_7);
6451 __Pyx_XDECREF(__pyx_t_8);
6452 __Pyx_XDECREF(__pyx_t_9);
6453 __Pyx_XDECREF(__pyx_t_10);
6454 __Pyx_AddTraceback("lxml.html.diff.htmldiff_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
6457 __Pyx_XDECREF(__pyx_v_s);
6458 __Pyx_XDECREF(__pyx_v_commands);
6459 __Pyx_XDECREF(__pyx_v_result);
6460 __Pyx_XDECREF(__pyx_v_command);
6461 __Pyx_XDECREF(__pyx_v_i1);
6462 __Pyx_XDECREF(__pyx_v_i2);
6463 __Pyx_XDECREF(__pyx_v_j1);
6464 __Pyx_XDECREF(__pyx_v_j2);
6465 __Pyx_XDECREF(__pyx_v_ins_tokens);
6466 __Pyx_XDECREF(__pyx_v_del_tokens);
6467 __Pyx_XGIVEREF(__pyx_r);
6468 __Pyx_RefNannyFinishContext();
6471 static PyObject *__pyx_gb_4lxml_4html_4diff_23generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
6473 /* "lxml/html/diff.py":219
6476 * def expand_tokens(tokens, equal=False): # <<<<<<<<<<<<<<
6477 * """Given a list of tokens, return a generator of the chunks of
6478 * text for the data in the tokens.
6481 /* Python wrapper */
6482 static PyObject *__pyx_pw_4lxml_4html_4diff_22expand_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6483 static char __pyx_doc_4lxml_4html_4diff_21expand_tokens[] = "Given a list of tokens, return a generator of the chunks of\n text for the data in the tokens.\n ";
6484 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_22expand_tokens = {"expand_tokens", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_22expand_tokens, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_21expand_tokens};
6485 static PyObject *__pyx_pw_4lxml_4html_4diff_22expand_tokens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6486 PyObject *__pyx_v_tokens = 0;
6487 PyObject *__pyx_v_equal = 0;
6488 int __pyx_lineno = 0;
6489 const char *__pyx_filename = NULL;
6490 int __pyx_clineno = 0;
6491 PyObject *__pyx_r = 0;
6492 __Pyx_RefNannyDeclarations
6493 __Pyx_RefNannySetupContext("expand_tokens (wrapper)", 0);
6495 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tokens,&__pyx_n_s_equal,0};
6496 PyObject* values[2] = {0,0};
6497 values[1] = ((PyObject *)((PyObject *)Py_False));
6498 if (unlikely(__pyx_kwds)) {
6500 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6502 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6504 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6507 default: goto __pyx_L5_argtuple_error;
6509 kw_args = PyDict_Size(__pyx_kwds);
6512 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tokens)) != 0)) kw_args--;
6513 else goto __pyx_L5_argtuple_error;
6517 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_equal);
6518 if (value) { values[1] = value; kw_args--; }
6521 if (unlikely(kw_args > 0)) {
6522 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "expand_tokens") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6525 switch (PyTuple_GET_SIZE(__pyx_args)) {
6526 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6528 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6530 default: goto __pyx_L5_argtuple_error;
6533 __pyx_v_tokens = values[0];
6534 __pyx_v_equal = values[1];
6536 goto __pyx_L4_argument_unpacking_done;
6537 __pyx_L5_argtuple_error:;
6538 __Pyx_RaiseArgtupleInvalid("expand_tokens", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6540 __Pyx_AddTraceback("lxml.html.diff.expand_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
6541 __Pyx_RefNannyFinishContext();
6543 __pyx_L4_argument_unpacking_done:;
6544 __pyx_r = __pyx_pf_4lxml_4html_4diff_21expand_tokens(__pyx_self, __pyx_v_tokens, __pyx_v_equal);
6546 /* function exit code */
6547 __Pyx_RefNannyFinishContext();
6551 static PyObject *__pyx_pf_4lxml_4html_4diff_21expand_tokens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tokens, PyObject *__pyx_v_equal) {
6552 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *__pyx_cur_scope;
6553 PyObject *__pyx_r = NULL;
6554 __Pyx_RefNannyDeclarations
6555 int __pyx_lineno = 0;
6556 const char *__pyx_filename = NULL;
6557 int __pyx_clineno = 0;
6558 __Pyx_RefNannySetupContext("expand_tokens", 0);
6559 __pyx_cur_scope = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens(__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens, __pyx_empty_tuple, NULL);
6560 if (unlikely(!__pyx_cur_scope)) {
6561 __pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)Py_None);
6562 __Pyx_INCREF(Py_None);
6563 __PYX_ERR(0, 219, __pyx_L1_error)
6565 __Pyx_GOTREF(__pyx_cur_scope);
6567 __pyx_cur_scope->__pyx_v_tokens = __pyx_v_tokens;
6568 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_tokens);
6569 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_tokens);
6570 __pyx_cur_scope->__pyx_v_equal = __pyx_v_equal;
6571 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_equal);
6572 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_equal);
6574 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_4html_4diff_23generator1, __pyx_codeobj__5, (PyObject *) __pyx_cur_scope, __pyx_n_s_expand_tokens, __pyx_n_s_expand_tokens, __pyx_n_s_lxml_html_diff); if (unlikely(!gen)) __PYX_ERR(0, 219, __pyx_L1_error)
6575 __Pyx_DECREF(__pyx_cur_scope);
6576 __Pyx_RefNannyFinishContext();
6577 return (PyObject *) gen;
6580 /* function exit code */
6582 __Pyx_AddTraceback("lxml.html.diff.expand_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
6584 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6585 __Pyx_XGIVEREF(__pyx_r);
6586 __Pyx_RefNannyFinishContext();
6590 static PyObject *__pyx_gb_4lxml_4html_4diff_23generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
6592 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *__pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)__pyx_generator->closure);
6593 PyObject *__pyx_r = NULL;
6594 PyObject *__pyx_t_1 = NULL;
6595 Py_ssize_t __pyx_t_2;
6596 PyObject *(*__pyx_t_3)(PyObject *);
6597 PyObject *__pyx_t_4 = NULL;
6598 PyObject *__pyx_t_5 = NULL;
6599 Py_ssize_t __pyx_t_6;
6600 PyObject *(*__pyx_t_7)(PyObject *);
6604 PyObject *__pyx_t_11 = NULL;
6605 int __pyx_lineno = 0;
6606 const char *__pyx_filename = NULL;
6607 int __pyx_clineno = 0;
6608 __Pyx_RefNannyDeclarations
6609 __Pyx_RefNannySetupContext("expand_tokens", 0);
6610 switch (__pyx_generator->resume_label) {
6611 case 0: goto __pyx_L3_first_run;
6612 case 1: goto __pyx_L8_resume_from_yield;
6613 case 2: goto __pyx_L13_resume_from_yield;
6614 case 3: goto __pyx_L14_resume_from_yield;
6615 case 4: goto __pyx_L17_resume_from_yield;
6616 default: /* CPython raises the right error here */
6617 __Pyx_RefNannyFinishContext();
6620 __pyx_L3_first_run:;
6621 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 219, __pyx_L1_error)
6623 /* "lxml/html/diff.py":223
6624 * text for the data in the tokens.
6626 * for token in tokens: # <<<<<<<<<<<<<<
6627 * for pre in token.pre_tags:
6630 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_tokens)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_tokens)) {
6631 __pyx_t_1 = __pyx_cur_scope->__pyx_v_tokens; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6634 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_tokens); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
6635 __Pyx_GOTREF(__pyx_t_1);
6636 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
6639 if (likely(!__pyx_t_3)) {
6640 if (likely(PyList_CheckExact(__pyx_t_1))) {
6641 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
6642 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6643 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
6645 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
6646 __Pyx_GOTREF(__pyx_t_4);
6649 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6650 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6651 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
6653 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
6654 __Pyx_GOTREF(__pyx_t_4);
6658 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
6659 if (unlikely(!__pyx_t_4)) {
6660 PyObject* exc_type = PyErr_Occurred();
6662 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6663 else __PYX_ERR(0, 223, __pyx_L1_error)
6667 __Pyx_GOTREF(__pyx_t_4);
6669 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_token);
6670 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_token, __pyx_t_4);
6671 __Pyx_GIVEREF(__pyx_t_4);
6674 /* "lxml/html/diff.py":224
6676 * for token in tokens:
6677 * for pre in token.pre_tags: # <<<<<<<<<<<<<<
6679 * if not equal or not token.hide_when_equal:
6681 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
6682 __Pyx_GOTREF(__pyx_t_4);
6683 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
6684 __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
6687 __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error)
6688 __Pyx_GOTREF(__pyx_t_5);
6689 __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
6691 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6693 if (likely(!__pyx_t_7)) {
6694 if (likely(PyList_CheckExact(__pyx_t_5))) {
6695 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
6696 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6697 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error)
6699 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
6700 __Pyx_GOTREF(__pyx_t_4);
6703 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
6704 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6705 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error)
6707 __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
6708 __Pyx_GOTREF(__pyx_t_4);
6712 __pyx_t_4 = __pyx_t_7(__pyx_t_5);
6713 if (unlikely(!__pyx_t_4)) {
6714 PyObject* exc_type = PyErr_Occurred();
6716 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6717 else __PYX_ERR(0, 224, __pyx_L1_error)
6721 __Pyx_GOTREF(__pyx_t_4);
6723 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pre);
6724 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pre, __pyx_t_4);
6725 __Pyx_GIVEREF(__pyx_t_4);
6728 /* "lxml/html/diff.py":225
6729 * for token in tokens:
6730 * for pre in token.pre_tags:
6731 * yield pre # <<<<<<<<<<<<<<
6732 * if not equal or not token.hide_when_equal:
6733 * if token.trailing_whitespace:
6735 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pre);
6736 __pyx_r = __pyx_cur_scope->__pyx_v_pre;
6737 __Pyx_XGIVEREF(__pyx_t_1);
6738 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6739 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6740 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6741 __Pyx_XGIVEREF(__pyx_t_5);
6742 __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
6743 __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
6744 __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
6745 __Pyx_XGIVEREF(__pyx_r);
6746 __Pyx_RefNannyFinishContext();
6747 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6748 /* return from generator, yielding value */
6749 __pyx_generator->resume_label = 1;
6751 __pyx_L8_resume_from_yield:;
6752 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6753 __pyx_cur_scope->__pyx_t_0 = 0;
6754 __Pyx_XGOTREF(__pyx_t_1);
6755 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6756 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6757 __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
6758 __pyx_cur_scope->__pyx_t_3 = 0;
6759 __Pyx_XGOTREF(__pyx_t_5);
6760 __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
6761 __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
6762 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 225, __pyx_L1_error)
6764 /* "lxml/html/diff.py":224
6766 * for token in tokens:
6767 * for pre in token.pre_tags: # <<<<<<<<<<<<<<
6769 * if not equal or not token.hide_when_equal:
6772 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6774 /* "lxml/html/diff.py":226
6775 * for pre in token.pre_tags:
6777 * if not equal or not token.hide_when_equal: # <<<<<<<<<<<<<<
6778 * if token.trailing_whitespace:
6779 * yield token.html() + token.trailing_whitespace
6781 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_equal); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 226, __pyx_L1_error)
6782 __pyx_t_10 = ((!__pyx_t_9) != 0);
6785 __pyx_t_8 = __pyx_t_10;
6786 goto __pyx_L10_bool_binop_done;
6788 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_hide_when_equal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
6789 __Pyx_GOTREF(__pyx_t_5);
6790 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 226, __pyx_L1_error)
6791 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6792 __pyx_t_9 = ((!__pyx_t_10) != 0);
6793 __pyx_t_8 = __pyx_t_9;
6794 __pyx_L10_bool_binop_done:;
6797 /* "lxml/html/diff.py":227
6799 * if not equal or not token.hide_when_equal:
6800 * if token.trailing_whitespace: # <<<<<<<<<<<<<<
6801 * yield token.html() + token.trailing_whitespace
6804 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
6805 __Pyx_GOTREF(__pyx_t_5);
6806 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 227, __pyx_L1_error)
6807 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6810 /* "lxml/html/diff.py":228
6811 * if not equal or not token.hide_when_equal:
6812 * if token.trailing_whitespace:
6813 * yield token.html() + token.trailing_whitespace # <<<<<<<<<<<<<<
6815 * yield token.html()
6817 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_html); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
6818 __Pyx_GOTREF(__pyx_t_4);
6820 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
6821 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
6822 if (likely(__pyx_t_11)) {
6823 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6824 __Pyx_INCREF(__pyx_t_11);
6825 __Pyx_INCREF(function);
6826 __Pyx_DECREF_SET(__pyx_t_4, function);
6829 __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
6830 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
6831 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error)
6832 __Pyx_GOTREF(__pyx_t_5);
6833 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6834 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
6835 __Pyx_GOTREF(__pyx_t_4);
6836 __pyx_t_11 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 228, __pyx_L1_error)
6837 __Pyx_GOTREF(__pyx_t_11);
6838 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6839 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6840 __pyx_r = __pyx_t_11;
6842 __Pyx_XGIVEREF(__pyx_t_1);
6843 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6844 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6845 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6846 __Pyx_XGIVEREF(__pyx_r);
6847 __Pyx_RefNannyFinishContext();
6848 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6849 /* return from generator, yielding value */
6850 __pyx_generator->resume_label = 2;
6852 __pyx_L13_resume_from_yield:;
6853 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6854 __pyx_cur_scope->__pyx_t_0 = 0;
6855 __Pyx_XGOTREF(__pyx_t_1);
6856 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6857 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6858 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 228, __pyx_L1_error)
6860 /* "lxml/html/diff.py":227
6862 * if not equal or not token.hide_when_equal:
6863 * if token.trailing_whitespace: # <<<<<<<<<<<<<<
6864 * yield token.html() + token.trailing_whitespace
6870 /* "lxml/html/diff.py":230
6871 * yield token.html() + token.trailing_whitespace
6873 * yield token.html() # <<<<<<<<<<<<<<
6874 * for post in token.post_tags:
6878 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_html); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
6879 __Pyx_GOTREF(__pyx_t_4);
6881 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
6882 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
6883 if (likely(__pyx_t_5)) {
6884 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6885 __Pyx_INCREF(__pyx_t_5);
6886 __Pyx_INCREF(function);
6887 __Pyx_DECREF_SET(__pyx_t_4, function);
6890 __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
6891 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6892 if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 230, __pyx_L1_error)
6893 __Pyx_GOTREF(__pyx_t_11);
6894 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6895 __pyx_r = __pyx_t_11;
6897 __Pyx_XGIVEREF(__pyx_t_1);
6898 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6899 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6900 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6901 __Pyx_XGIVEREF(__pyx_r);
6902 __Pyx_RefNannyFinishContext();
6903 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
6904 /* return from generator, yielding value */
6905 __pyx_generator->resume_label = 3;
6907 __pyx_L14_resume_from_yield:;
6908 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
6909 __pyx_cur_scope->__pyx_t_0 = 0;
6910 __Pyx_XGOTREF(__pyx_t_1);
6911 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
6912 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
6913 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 230, __pyx_L1_error)
6917 /* "lxml/html/diff.py":226
6918 * for pre in token.pre_tags:
6920 * if not equal or not token.hide_when_equal: # <<<<<<<<<<<<<<
6921 * if token.trailing_whitespace:
6922 * yield token.html() + token.trailing_whitespace
6926 /* "lxml/html/diff.py":231
6928 * yield token.html()
6929 * for post in token.post_tags: # <<<<<<<<<<<<<<
6933 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_token, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error)
6934 __Pyx_GOTREF(__pyx_t_11);
6935 if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
6936 __pyx_t_4 = __pyx_t_11; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
6939 __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error)
6940 __Pyx_GOTREF(__pyx_t_4);
6941 __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
6943 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6945 if (likely(!__pyx_t_7)) {
6946 if (likely(PyList_CheckExact(__pyx_t_4))) {
6947 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
6948 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6949 __pyx_t_11 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_11); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
6951 __pyx_t_11 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error)
6952 __Pyx_GOTREF(__pyx_t_11);
6955 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
6956 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6957 __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_11); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
6959 __pyx_t_11 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error)
6960 __Pyx_GOTREF(__pyx_t_11);
6964 __pyx_t_11 = __pyx_t_7(__pyx_t_4);
6965 if (unlikely(!__pyx_t_11)) {
6966 PyObject* exc_type = PyErr_Occurred();
6968 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6969 else __PYX_ERR(0, 231, __pyx_L1_error)
6973 __Pyx_GOTREF(__pyx_t_11);
6975 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_post);
6976 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_post, __pyx_t_11);
6977 __Pyx_GIVEREF(__pyx_t_11);
6980 /* "lxml/html/diff.py":232
6981 * yield token.html()
6982 * for post in token.post_tags:
6983 * yield post # <<<<<<<<<<<<<<
6985 * def merge_insert(ins_chunks, doc):
6987 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_post);
6988 __pyx_r = __pyx_cur_scope->__pyx_v_post;
6989 __Pyx_XGIVEREF(__pyx_t_1);
6990 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
6991 __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
6992 __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
6993 __Pyx_XGIVEREF(__pyx_t_4);
6994 __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
6995 __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
6996 __pyx_cur_scope->__pyx_t_5 = __pyx_t_7;
6997 __Pyx_XGIVEREF(__pyx_r);
6998 __Pyx_RefNannyFinishContext();
6999 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
7000 /* return from generator, yielding value */
7001 __pyx_generator->resume_label = 4;
7003 __pyx_L17_resume_from_yield:;
7004 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
7005 __pyx_cur_scope->__pyx_t_0 = 0;
7006 __Pyx_XGOTREF(__pyx_t_1);
7007 __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
7008 __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
7009 __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
7010 __pyx_cur_scope->__pyx_t_3 = 0;
7011 __Pyx_XGOTREF(__pyx_t_4);
7012 __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
7013 __pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
7014 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 232, __pyx_L1_error)
7016 /* "lxml/html/diff.py":231
7018 * yield token.html()
7019 * for post in token.post_tags: # <<<<<<<<<<<<<<
7024 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7026 /* "lxml/html/diff.py":223
7027 * text for the data in the tokens.
7029 * for token in tokens: # <<<<<<<<<<<<<<
7030 * for pre in token.pre_tags:
7034 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7035 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
7037 /* "lxml/html/diff.py":219
7040 * def expand_tokens(tokens, equal=False): # <<<<<<<<<<<<<<
7041 * """Given a list of tokens, return a generator of the chunks of
7042 * text for the data in the tokens.
7045 /* function exit code */
7046 PyErr_SetNone(PyExc_StopIteration);
7049 __Pyx_XDECREF(__pyx_t_1);
7050 __Pyx_XDECREF(__pyx_t_4);
7051 __Pyx_XDECREF(__pyx_t_5);
7052 __Pyx_XDECREF(__pyx_t_11);
7053 __Pyx_AddTraceback("expand_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename);
7055 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
7056 #if !CYTHON_USE_EXC_INFO_STACK
7057 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
7059 __pyx_generator->resume_label = -1;
7060 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
7061 __Pyx_RefNannyFinishContext();
7065 /* "lxml/html/diff.py":234
7068 * def merge_insert(ins_chunks, doc): # <<<<<<<<<<<<<<
7069 * """ doc is the already-handled document (as a list of text chunks);
7070 * here we add <ins>ins_chunks</ins> to the end of that. """
7073 /* Python wrapper */
7074 static PyObject *__pyx_pw_4lxml_4html_4diff_25merge_insert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7075 static char __pyx_doc_4lxml_4html_4diff_24merge_insert[] = " doc is the already-handled document (as a list of text chunks);\n here we add <ins>ins_chunks</ins> to the end of that. ";
7076 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_25merge_insert = {"merge_insert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_25merge_insert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_24merge_insert};
7077 static PyObject *__pyx_pw_4lxml_4html_4diff_25merge_insert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7078 PyObject *__pyx_v_ins_chunks = 0;
7079 PyObject *__pyx_v_doc = 0;
7080 int __pyx_lineno = 0;
7081 const char *__pyx_filename = NULL;
7082 int __pyx_clineno = 0;
7083 PyObject *__pyx_r = 0;
7084 __Pyx_RefNannyDeclarations
7085 __Pyx_RefNannySetupContext("merge_insert (wrapper)", 0);
7087 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ins_chunks,&__pyx_n_s_doc,0};
7088 PyObject* values[2] = {0,0};
7089 if (unlikely(__pyx_kwds)) {
7091 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7093 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7095 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7098 default: goto __pyx_L5_argtuple_error;
7100 kw_args = PyDict_Size(__pyx_kwds);
7103 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ins_chunks)) != 0)) kw_args--;
7104 else goto __pyx_L5_argtuple_error;
7107 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_doc)) != 0)) kw_args--;
7109 __Pyx_RaiseArgtupleInvalid("merge_insert", 1, 2, 2, 1); __PYX_ERR(0, 234, __pyx_L3_error)
7112 if (unlikely(kw_args > 0)) {
7113 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_insert") < 0)) __PYX_ERR(0, 234, __pyx_L3_error)
7115 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7116 goto __pyx_L5_argtuple_error;
7118 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7119 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7121 __pyx_v_ins_chunks = values[0];
7122 __pyx_v_doc = values[1];
7124 goto __pyx_L4_argument_unpacking_done;
7125 __pyx_L5_argtuple_error:;
7126 __Pyx_RaiseArgtupleInvalid("merge_insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 234, __pyx_L3_error)
7128 __Pyx_AddTraceback("lxml.html.diff.merge_insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
7129 __Pyx_RefNannyFinishContext();
7131 __pyx_L4_argument_unpacking_done:;
7132 __pyx_r = __pyx_pf_4lxml_4html_4diff_24merge_insert(__pyx_self, __pyx_v_ins_chunks, __pyx_v_doc);
7134 /* function exit code */
7135 __Pyx_RefNannyFinishContext();
7139 static PyObject *__pyx_pf_4lxml_4html_4diff_24merge_insert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ins_chunks, PyObject *__pyx_v_doc) {
7140 PyObject *__pyx_v_unbalanced_start = NULL;
7141 PyObject *__pyx_v_balanced = NULL;
7142 PyObject *__pyx_v_unbalanced_end = NULL;
7143 PyObject *__pyx_r = NULL;
7144 __Pyx_RefNannyDeclarations
7145 PyObject *__pyx_t_1 = NULL;
7146 PyObject *__pyx_t_2 = NULL;
7147 PyObject *__pyx_t_3 = NULL;
7148 PyObject *__pyx_t_4 = NULL;
7149 PyObject *__pyx_t_5 = NULL;
7150 PyObject *(*__pyx_t_6)(PyObject *);
7154 Py_ssize_t __pyx_t_10;
7156 int __pyx_lineno = 0;
7157 const char *__pyx_filename = NULL;
7158 int __pyx_clineno = 0;
7159 __Pyx_RefNannySetupContext("merge_insert", 0);
7161 /* "lxml/html/diff.py":240
7162 * # (we assume there is accompanying markup later or earlier in the
7163 * # document), we only put <ins> around the balanced portion.
7164 * unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks) # <<<<<<<<<<<<<<
7165 * doc.extend(unbalanced_start)
7166 * if doc and not doc[-1].endswith(' '):
7168 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_split_unbalanced); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
7169 __Pyx_GOTREF(__pyx_t_2);
7171 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7172 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7173 if (likely(__pyx_t_3)) {
7174 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7175 __Pyx_INCREF(__pyx_t_3);
7176 __Pyx_INCREF(function);
7177 __Pyx_DECREF_SET(__pyx_t_2, function);
7180 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_ins_chunks) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ins_chunks);
7181 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7182 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
7183 __Pyx_GOTREF(__pyx_t_1);
7184 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7185 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
7186 PyObject* sequence = __pyx_t_1;
7187 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7188 if (unlikely(size != 3)) {
7189 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
7190 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7191 __PYX_ERR(0, 240, __pyx_L1_error)
7193 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7194 if (likely(PyTuple_CheckExact(sequence))) {
7195 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
7196 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
7197 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
7199 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
7200 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
7201 __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
7203 __Pyx_INCREF(__pyx_t_2);
7204 __Pyx_INCREF(__pyx_t_3);
7205 __Pyx_INCREF(__pyx_t_4);
7207 __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
7208 __Pyx_GOTREF(__pyx_t_2);
7209 __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
7210 __Pyx_GOTREF(__pyx_t_3);
7211 __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
7212 __Pyx_GOTREF(__pyx_t_4);
7214 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7216 Py_ssize_t index = -1;
7217 __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
7218 __Pyx_GOTREF(__pyx_t_5);
7219 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7220 __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
7221 index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
7222 __Pyx_GOTREF(__pyx_t_2);
7223 index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
7224 __Pyx_GOTREF(__pyx_t_3);
7225 index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
7226 __Pyx_GOTREF(__pyx_t_4);
7227 if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
7229 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7230 goto __pyx_L4_unpacking_done;
7231 __pyx_L3_unpacking_failed:;
7232 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7234 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7235 __PYX_ERR(0, 240, __pyx_L1_error)
7236 __pyx_L4_unpacking_done:;
7238 __pyx_v_unbalanced_start = __pyx_t_2;
7240 __pyx_v_balanced = __pyx_t_3;
7242 __pyx_v_unbalanced_end = __pyx_t_4;
7245 /* "lxml/html/diff.py":241
7246 * # document), we only put <ins> around the balanced portion.
7247 * unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks)
7248 * doc.extend(unbalanced_start) # <<<<<<<<<<<<<<
7249 * if doc and not doc[-1].endswith(' '):
7250 * # Fix up the case where the word before the insert didn't end with
7252 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
7253 __Pyx_GOTREF(__pyx_t_4);
7255 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7256 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
7257 if (likely(__pyx_t_3)) {
7258 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7259 __Pyx_INCREF(__pyx_t_3);
7260 __Pyx_INCREF(function);
7261 __Pyx_DECREF_SET(__pyx_t_4, function);
7264 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_unbalanced_start) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_unbalanced_start);
7265 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7266 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
7267 __Pyx_GOTREF(__pyx_t_1);
7268 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7269 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7271 /* "lxml/html/diff.py":242
7272 * unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks)
7273 * doc.extend(unbalanced_start)
7274 * if doc and not doc[-1].endswith(' '): # <<<<<<<<<<<<<<
7275 * # Fix up the case where the word before the insert didn't end with
7278 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_doc); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
7281 __pyx_t_7 = __pyx_t_8;
7282 goto __pyx_L6_bool_binop_done;
7284 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_doc, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
7285 __Pyx_GOTREF(__pyx_t_4);
7286 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_endswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
7287 __Pyx_GOTREF(__pyx_t_3);
7288 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7290 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7291 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7292 if (likely(__pyx_t_4)) {
7293 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7294 __Pyx_INCREF(__pyx_t_4);
7295 __Pyx_INCREF(function);
7296 __Pyx_DECREF_SET(__pyx_t_3, function);
7299 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__6);
7300 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7301 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
7302 __Pyx_GOTREF(__pyx_t_1);
7303 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7304 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
7305 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7306 __pyx_t_9 = ((!__pyx_t_8) != 0);
7307 __pyx_t_7 = __pyx_t_9;
7308 __pyx_L6_bool_binop_done:;
7311 /* "lxml/html/diff.py":245
7312 * # Fix up the case where the word before the insert didn't end with
7314 * doc[-1] += ' ' # <<<<<<<<<<<<<<
7315 * doc.append('<ins>')
7316 * if balanced and balanced[-1].endswith(' '):
7319 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_doc, __pyx_t_10, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
7320 __Pyx_GOTREF(__pyx_t_1);
7321 __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_kp_u__6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
7322 __Pyx_GOTREF(__pyx_t_3);
7323 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7324 if (unlikely(__Pyx_SetItemInt(__pyx_v_doc, __pyx_t_10, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 245, __pyx_L1_error)
7325 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7327 /* "lxml/html/diff.py":242
7328 * unbalanced_start, balanced, unbalanced_end = split_unbalanced(ins_chunks)
7329 * doc.extend(unbalanced_start)
7330 * if doc and not doc[-1].endswith(' '): # <<<<<<<<<<<<<<
7331 * # Fix up the case where the word before the insert didn't end with
7336 /* "lxml/html/diff.py":246
7339 * doc.append('<ins>') # <<<<<<<<<<<<<<
7340 * if balanced and balanced[-1].endswith(' '):
7341 * # We move space outside of </ins>
7343 __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_kp_u_ins); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 246, __pyx_L1_error)
7345 /* "lxml/html/diff.py":247
7347 * doc.append('<ins>')
7348 * if balanced and balanced[-1].endswith(' '): # <<<<<<<<<<<<<<
7349 * # We move space outside of </ins>
7350 * balanced[-1] = balanced[-1][:-1]
7352 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_balanced); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7355 __pyx_t_7 = __pyx_t_9;
7356 goto __pyx_L9_bool_binop_done;
7358 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_balanced, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
7359 __Pyx_GOTREF(__pyx_t_1);
7360 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
7361 __Pyx_GOTREF(__pyx_t_4);
7362 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7364 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7365 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
7366 if (likely(__pyx_t_1)) {
7367 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7368 __Pyx_INCREF(__pyx_t_1);
7369 __Pyx_INCREF(function);
7370 __Pyx_DECREF_SET(__pyx_t_4, function);
7373 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__6);
7374 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7375 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
7376 __Pyx_GOTREF(__pyx_t_3);
7377 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7378 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
7379 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7380 __pyx_t_7 = __pyx_t_9;
7381 __pyx_L9_bool_binop_done:;
7384 /* "lxml/html/diff.py":249
7385 * if balanced and balanced[-1].endswith(' '):
7386 * # We move space outside of </ins>
7387 * balanced[-1] = balanced[-1][:-1] # <<<<<<<<<<<<<<
7388 * doc.extend(balanced)
7389 * doc.append('</ins> ')
7391 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_balanced, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
7392 __Pyx_GOTREF(__pyx_t_3);
7393 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, -1L, NULL, NULL, &__pyx_slice__7, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
7394 __Pyx_GOTREF(__pyx_t_4);
7395 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7396 if (unlikely(__Pyx_SetItemInt(__pyx_v_balanced, -1L, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 249, __pyx_L1_error)
7397 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7399 /* "lxml/html/diff.py":247
7401 * doc.append('<ins>')
7402 * if balanced and balanced[-1].endswith(' '): # <<<<<<<<<<<<<<
7403 * # We move space outside of </ins>
7404 * balanced[-1] = balanced[-1][:-1]
7408 /* "lxml/html/diff.py":250
7409 * # We move space outside of </ins>
7410 * balanced[-1] = balanced[-1][:-1]
7411 * doc.extend(balanced) # <<<<<<<<<<<<<<
7412 * doc.append('</ins> ')
7413 * doc.extend(unbalanced_end)
7415 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
7416 __Pyx_GOTREF(__pyx_t_3);
7418 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7419 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
7420 if (likely(__pyx_t_1)) {
7421 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7422 __Pyx_INCREF(__pyx_t_1);
7423 __Pyx_INCREF(function);
7424 __Pyx_DECREF_SET(__pyx_t_3, function);
7427 __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_balanced) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_balanced);
7428 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7429 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
7430 __Pyx_GOTREF(__pyx_t_4);
7431 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7432 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7434 /* "lxml/html/diff.py":251
7435 * balanced[-1] = balanced[-1][:-1]
7436 * doc.extend(balanced)
7437 * doc.append('</ins> ') # <<<<<<<<<<<<<<
7438 * doc.extend(unbalanced_end)
7441 __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_kp_u_ins_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 251, __pyx_L1_error)
7443 /* "lxml/html/diff.py":252
7444 * doc.extend(balanced)
7445 * doc.append('</ins> ')
7446 * doc.extend(unbalanced_end) # <<<<<<<<<<<<<<
7448 * # These are sentinals to represent the start and end of a <del>
7450 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
7451 __Pyx_GOTREF(__pyx_t_3);
7453 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7454 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
7455 if (likely(__pyx_t_1)) {
7456 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7457 __Pyx_INCREF(__pyx_t_1);
7458 __Pyx_INCREF(function);
7459 __Pyx_DECREF_SET(__pyx_t_3, function);
7462 __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_unbalanced_end) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_unbalanced_end);
7463 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7464 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 252, __pyx_L1_error)
7465 __Pyx_GOTREF(__pyx_t_4);
7466 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7467 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7469 /* "lxml/html/diff.py":234
7472 * def merge_insert(ins_chunks, doc): # <<<<<<<<<<<<<<
7473 * """ doc is the already-handled document (as a list of text chunks);
7474 * here we add <ins>ins_chunks</ins> to the end of that. """
7477 /* function exit code */
7478 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7481 __Pyx_XDECREF(__pyx_t_1);
7482 __Pyx_XDECREF(__pyx_t_2);
7483 __Pyx_XDECREF(__pyx_t_3);
7484 __Pyx_XDECREF(__pyx_t_4);
7485 __Pyx_XDECREF(__pyx_t_5);
7486 __Pyx_AddTraceback("lxml.html.diff.merge_insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
7489 __Pyx_XDECREF(__pyx_v_unbalanced_start);
7490 __Pyx_XDECREF(__pyx_v_balanced);
7491 __Pyx_XDECREF(__pyx_v_unbalanced_end);
7492 __Pyx_XGIVEREF(__pyx_r);
7493 __Pyx_RefNannyFinishContext();
7497 /* "lxml/html/diff.py":266
7498 * (DEL_START/DEL_END) """
7500 * def merge_delete(del_chunks, doc): # <<<<<<<<<<<<<<
7501 * """ Adds the text chunks in del_chunks to the document doc (another
7502 * list of text chunks) with marker to show it is a delete.
7505 /* Python wrapper */
7506 static PyObject *__pyx_pw_4lxml_4html_4diff_27merge_delete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7507 static char __pyx_doc_4lxml_4html_4diff_26merge_delete[] = " Adds the text chunks in del_chunks to the document doc (another\n list of text chunks) with marker to show it is a delete.\n cleanup_delete later resolves these markers into <del> tags.";
7508 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_27merge_delete = {"merge_delete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_27merge_delete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_26merge_delete};
7509 static PyObject *__pyx_pw_4lxml_4html_4diff_27merge_delete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7510 PyObject *__pyx_v_del_chunks = 0;
7511 PyObject *__pyx_v_doc = 0;
7512 int __pyx_lineno = 0;
7513 const char *__pyx_filename = NULL;
7514 int __pyx_clineno = 0;
7515 PyObject *__pyx_r = 0;
7516 __Pyx_RefNannyDeclarations
7517 __Pyx_RefNannySetupContext("merge_delete (wrapper)", 0);
7519 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_del_chunks,&__pyx_n_s_doc,0};
7520 PyObject* values[2] = {0,0};
7521 if (unlikely(__pyx_kwds)) {
7523 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7525 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7527 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7530 default: goto __pyx_L5_argtuple_error;
7532 kw_args = PyDict_Size(__pyx_kwds);
7535 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_del_chunks)) != 0)) kw_args--;
7536 else goto __pyx_L5_argtuple_error;
7539 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_doc)) != 0)) kw_args--;
7541 __Pyx_RaiseArgtupleInvalid("merge_delete", 1, 2, 2, 1); __PYX_ERR(0, 266, __pyx_L3_error)
7544 if (unlikely(kw_args > 0)) {
7545 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_delete") < 0)) __PYX_ERR(0, 266, __pyx_L3_error)
7547 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7548 goto __pyx_L5_argtuple_error;
7550 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7551 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7553 __pyx_v_del_chunks = values[0];
7554 __pyx_v_doc = values[1];
7556 goto __pyx_L4_argument_unpacking_done;
7557 __pyx_L5_argtuple_error:;
7558 __Pyx_RaiseArgtupleInvalid("merge_delete", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 266, __pyx_L3_error)
7560 __Pyx_AddTraceback("lxml.html.diff.merge_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
7561 __Pyx_RefNannyFinishContext();
7563 __pyx_L4_argument_unpacking_done:;
7564 __pyx_r = __pyx_pf_4lxml_4html_4diff_26merge_delete(__pyx_self, __pyx_v_del_chunks, __pyx_v_doc);
7566 /* function exit code */
7567 __Pyx_RefNannyFinishContext();
7571 static PyObject *__pyx_pf_4lxml_4html_4diff_26merge_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_del_chunks, PyObject *__pyx_v_doc) {
7572 PyObject *__pyx_r = NULL;
7573 __Pyx_RefNannyDeclarations
7574 PyObject *__pyx_t_1 = NULL;
7576 PyObject *__pyx_t_3 = NULL;
7577 PyObject *__pyx_t_4 = NULL;
7578 int __pyx_lineno = 0;
7579 const char *__pyx_filename = NULL;
7580 int __pyx_clineno = 0;
7581 __Pyx_RefNannySetupContext("merge_delete", 0);
7583 /* "lxml/html/diff.py":270
7584 * list of text chunks) with marker to show it is a delete.
7585 * cleanup_delete later resolves these markers into <del> tags."""
7586 * doc.append(DEL_START) # <<<<<<<<<<<<<<
7587 * doc.extend(del_chunks)
7588 * doc.append(DEL_END)
7590 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DEL_START); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
7591 __Pyx_GOTREF(__pyx_t_1);
7592 __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 270, __pyx_L1_error)
7593 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7595 /* "lxml/html/diff.py":271
7596 * cleanup_delete later resolves these markers into <del> tags."""
7597 * doc.append(DEL_START)
7598 * doc.extend(del_chunks) # <<<<<<<<<<<<<<
7599 * doc.append(DEL_END)
7602 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error)
7603 __Pyx_GOTREF(__pyx_t_3);
7605 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7606 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7607 if (likely(__pyx_t_4)) {
7608 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7609 __Pyx_INCREF(__pyx_t_4);
7610 __Pyx_INCREF(function);
7611 __Pyx_DECREF_SET(__pyx_t_3, function);
7614 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_del_chunks) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_del_chunks);
7615 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7616 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
7617 __Pyx_GOTREF(__pyx_t_1);
7618 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7619 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7621 /* "lxml/html/diff.py":272
7622 * doc.append(DEL_START)
7623 * doc.extend(del_chunks)
7624 * doc.append(DEL_END) # <<<<<<<<<<<<<<
7626 * def cleanup_delete(chunks):
7628 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DEL_END); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
7629 __Pyx_GOTREF(__pyx_t_1);
7630 __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 272, __pyx_L1_error)
7631 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7633 /* "lxml/html/diff.py":266
7634 * (DEL_START/DEL_END) """
7636 * def merge_delete(del_chunks, doc): # <<<<<<<<<<<<<<
7637 * """ Adds the text chunks in del_chunks to the document doc (another
7638 * list of text chunks) with marker to show it is a delete.
7641 /* function exit code */
7642 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7645 __Pyx_XDECREF(__pyx_t_1);
7646 __Pyx_XDECREF(__pyx_t_3);
7647 __Pyx_XDECREF(__pyx_t_4);
7648 __Pyx_AddTraceback("lxml.html.diff.merge_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
7651 __Pyx_XGIVEREF(__pyx_r);
7652 __Pyx_RefNannyFinishContext();
7656 /* "lxml/html/diff.py":274
7657 * doc.append(DEL_END)
7659 * def cleanup_delete(chunks): # <<<<<<<<<<<<<<
7660 * """ Cleans up any DEL_START/DEL_END markers in the document, replacing
7661 * them with <del></del>. To do this while keeping the document
7664 /* Python wrapper */
7665 static PyObject *__pyx_pw_4lxml_4html_4diff_29cleanup_delete(PyObject *__pyx_self, PyObject *__pyx_v_chunks); /*proto*/
7666 static char __pyx_doc_4lxml_4html_4diff_28cleanup_delete[] = " Cleans up any DEL_START/DEL_END markers in the document, replacing\n them with <del></del>. To do this while keeping the document\n valid, it may need to drop some tags (either start or end tags).\n\n It may also move the del into adjacent tags to try to move it to a\n similar location where it was originally located (e.g., moving a\n delete into preceding <div> tag, if the del looks like (DEL_START,\n 'Text</div>', DEL_END)";
7667 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_29cleanup_delete = {"cleanup_delete", (PyCFunction)__pyx_pw_4lxml_4html_4diff_29cleanup_delete, METH_O, __pyx_doc_4lxml_4html_4diff_28cleanup_delete};
7668 static PyObject *__pyx_pw_4lxml_4html_4diff_29cleanup_delete(PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
7669 PyObject *__pyx_r = 0;
7670 __Pyx_RefNannyDeclarations
7671 __Pyx_RefNannySetupContext("cleanup_delete (wrapper)", 0);
7672 __pyx_r = __pyx_pf_4lxml_4html_4diff_28cleanup_delete(__pyx_self, ((PyObject *)__pyx_v_chunks));
7674 /* function exit code */
7675 __Pyx_RefNannyFinishContext();
7679 static PyObject *__pyx_pf_4lxml_4html_4diff_28cleanup_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
7680 PyObject *__pyx_v_pre_delete = NULL;
7681 PyObject *__pyx_v_delete = NULL;
7682 PyObject *__pyx_v_post_delete = NULL;
7683 PyObject *__pyx_v_unbalanced_start = NULL;
7684 PyObject *__pyx_v_balanced = NULL;
7685 PyObject *__pyx_v_unbalanced_end = NULL;
7686 PyObject *__pyx_v_doc = NULL;
7687 PyObject *__pyx_r = NULL;
7688 __Pyx_RefNannyDeclarations
7689 PyObject *__pyx_t_1 = NULL;
7690 PyObject *__pyx_t_2 = NULL;
7691 PyObject *__pyx_t_3 = NULL;
7692 PyObject *__pyx_t_4 = NULL;
7693 PyObject *__pyx_t_5 = NULL;
7694 PyObject *__pyx_t_6 = NULL;
7695 PyObject *__pyx_t_7 = NULL;
7696 PyObject *__pyx_t_8 = NULL;
7697 PyObject *(*__pyx_t_9)(PyObject *);
7702 Py_ssize_t __pyx_t_14;
7704 int __pyx_lineno = 0;
7705 const char *__pyx_filename = NULL;
7706 int __pyx_clineno = 0;
7707 __Pyx_RefNannySetupContext("cleanup_delete", 0);
7708 __Pyx_INCREF(__pyx_v_chunks);
7710 /* "lxml/html/diff.py":283
7711 * delete into preceding <div> tag, if the del looks like (DEL_START,
7712 * 'Text</div>', DEL_END)"""
7713 * while 1: # <<<<<<<<<<<<<<
7714 * # Find a pending DEL_START/DEL_END, splitting the document
7715 * # into stuff-preceding-DEL_START, stuff-inside, and
7719 /* "lxml/html/diff.py":287
7720 * # into stuff-preceding-DEL_START, stuff-inside, and
7721 * # stuff-following-DEL_END
7722 * try: # <<<<<<<<<<<<<<
7723 * pre_delete, delete, post_delete = split_delete(chunks)
7727 __Pyx_PyThreadState_declare
7728 __Pyx_PyThreadState_assign
7729 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7730 __Pyx_XGOTREF(__pyx_t_1);
7731 __Pyx_XGOTREF(__pyx_t_2);
7732 __Pyx_XGOTREF(__pyx_t_3);
7735 /* "lxml/html/diff.py":288
7736 * # stuff-following-DEL_END
7738 * pre_delete, delete, post_delete = split_delete(chunks) # <<<<<<<<<<<<<<
7740 * # Nothing found, we've cleaned up the entire doc
7742 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_split_delete); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L5_error)
7743 __Pyx_GOTREF(__pyx_t_5);
7745 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7746 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7747 if (likely(__pyx_t_6)) {
7748 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7749 __Pyx_INCREF(__pyx_t_6);
7750 __Pyx_INCREF(function);
7751 __Pyx_DECREF_SET(__pyx_t_5, function);
7754 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_chunks) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_chunks);
7755 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7756 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L5_error)
7757 __Pyx_GOTREF(__pyx_t_4);
7758 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7759 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
7760 PyObject* sequence = __pyx_t_4;
7761 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7762 if (unlikely(size != 3)) {
7763 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
7764 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7765 __PYX_ERR(0, 288, __pyx_L5_error)
7767 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7768 if (likely(PyTuple_CheckExact(sequence))) {
7769 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
7770 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
7771 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
7773 __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
7774 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
7775 __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
7777 __Pyx_INCREF(__pyx_t_5);
7778 __Pyx_INCREF(__pyx_t_6);
7779 __Pyx_INCREF(__pyx_t_7);
7781 __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L5_error)
7782 __Pyx_GOTREF(__pyx_t_5);
7783 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L5_error)
7784 __Pyx_GOTREF(__pyx_t_6);
7785 __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L5_error)
7786 __Pyx_GOTREF(__pyx_t_7);
7788 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7790 Py_ssize_t index = -1;
7791 __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L5_error)
7792 __Pyx_GOTREF(__pyx_t_8);
7793 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7794 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
7795 index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
7796 __Pyx_GOTREF(__pyx_t_5);
7797 index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L13_unpacking_failed;
7798 __Pyx_GOTREF(__pyx_t_6);
7799 index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L13_unpacking_failed;
7800 __Pyx_GOTREF(__pyx_t_7);
7801 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 288, __pyx_L5_error)
7803 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7804 goto __pyx_L14_unpacking_done;
7805 __pyx_L13_unpacking_failed:;
7806 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7808 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7809 __PYX_ERR(0, 288, __pyx_L5_error)
7810 __pyx_L14_unpacking_done:;
7812 __Pyx_XDECREF_SET(__pyx_v_pre_delete, __pyx_t_5);
7814 __Pyx_XDECREF_SET(__pyx_v_delete, __pyx_t_6);
7816 __Pyx_XDECREF_SET(__pyx_v_post_delete, __pyx_t_7);
7819 /* "lxml/html/diff.py":287
7820 * # into stuff-preceding-DEL_START, stuff-inside, and
7821 * # stuff-following-DEL_END
7822 * try: # <<<<<<<<<<<<<<
7823 * pre_delete, delete, post_delete = split_delete(chunks)
7827 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7828 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7829 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7830 goto __pyx_L12_try_end;
7832 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7833 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7834 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7835 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7836 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7838 /* "lxml/html/diff.py":289
7840 * pre_delete, delete, post_delete = split_delete(chunks)
7841 * except NoDeletes: # <<<<<<<<<<<<<<
7842 * # Nothing found, we've cleaned up the entire doc
7845 __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_7, &__pyx_t_6);
7846 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_NoDeletes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L7_except_error)
7847 __Pyx_GOTREF(__pyx_t_5);
7848 __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_5);
7849 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7850 __Pyx_ErrRestore(__pyx_t_4, __pyx_t_7, __pyx_t_6);
7851 __pyx_t_4 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0;
7853 __Pyx_AddTraceback("lxml.html.diff.cleanup_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
7854 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 289, __pyx_L7_except_error)
7855 __Pyx_GOTREF(__pyx_t_6);
7856 __Pyx_GOTREF(__pyx_t_7);
7857 __Pyx_GOTREF(__pyx_t_4);
7859 /* "lxml/html/diff.py":291
7861 * # Nothing found, we've cleaned up the entire doc
7862 * break # <<<<<<<<<<<<<<
7863 * # The stuff-inside-DEL_START/END may not be well balanced
7864 * # markup. First we figure out what unbalanced portions there are:
7866 goto __pyx_L15_except_break;
7867 __pyx_L15_except_break:;
7868 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7869 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7870 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7871 goto __pyx_L10_try_break;
7873 goto __pyx_L7_except_error;
7874 __pyx_L7_except_error:;
7876 /* "lxml/html/diff.py":287
7877 * # into stuff-preceding-DEL_START, stuff-inside, and
7878 * # stuff-following-DEL_END
7879 * try: # <<<<<<<<<<<<<<
7880 * pre_delete, delete, post_delete = split_delete(chunks)
7883 __Pyx_XGIVEREF(__pyx_t_1);
7884 __Pyx_XGIVEREF(__pyx_t_2);
7885 __Pyx_XGIVEREF(__pyx_t_3);
7886 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7887 goto __pyx_L1_error;
7888 __pyx_L10_try_break:;
7889 __Pyx_XGIVEREF(__pyx_t_1);
7890 __Pyx_XGIVEREF(__pyx_t_2);
7891 __Pyx_XGIVEREF(__pyx_t_3);
7892 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7893 goto __pyx_L4_break;
7897 /* "lxml/html/diff.py":294
7898 * # The stuff-inside-DEL_START/END may not be well balanced
7899 * # markup. First we figure out what unbalanced portions there are:
7900 * unbalanced_start, balanced, unbalanced_end = split_unbalanced(delete) # <<<<<<<<<<<<<<
7901 * # Then we move the span forward and/or backward based on these
7902 * # unbalanced portions:
7904 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_split_unbalanced); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error)
7905 __Pyx_GOTREF(__pyx_t_7);
7907 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
7908 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
7909 if (likely(__pyx_t_6)) {
7910 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
7911 __Pyx_INCREF(__pyx_t_6);
7912 __Pyx_INCREF(function);
7913 __Pyx_DECREF_SET(__pyx_t_7, function);
7916 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_delete) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_delete);
7917 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7918 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error)
7919 __Pyx_GOTREF(__pyx_t_4);
7920 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7921 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
7922 PyObject* sequence = __pyx_t_4;
7923 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7924 if (unlikely(size != 3)) {
7925 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
7926 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7927 __PYX_ERR(0, 294, __pyx_L1_error)
7929 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7930 if (likely(PyTuple_CheckExact(sequence))) {
7931 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
7932 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
7933 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
7935 __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
7936 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
7937 __pyx_t_5 = PyList_GET_ITEM(sequence, 2);
7939 __Pyx_INCREF(__pyx_t_7);
7940 __Pyx_INCREF(__pyx_t_6);
7941 __Pyx_INCREF(__pyx_t_5);
7943 __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error)
7944 __Pyx_GOTREF(__pyx_t_7);
7945 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 294, __pyx_L1_error)
7946 __Pyx_GOTREF(__pyx_t_6);
7947 __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 294, __pyx_L1_error)
7948 __Pyx_GOTREF(__pyx_t_5);
7950 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7952 Py_ssize_t index = -1;
7953 __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error)
7954 __Pyx_GOTREF(__pyx_t_8);
7955 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7956 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
7957 index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L17_unpacking_failed;
7958 __Pyx_GOTREF(__pyx_t_7);
7959 index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L17_unpacking_failed;
7960 __Pyx_GOTREF(__pyx_t_6);
7961 index = 2; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L17_unpacking_failed;
7962 __Pyx_GOTREF(__pyx_t_5);
7963 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
7965 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7966 goto __pyx_L18_unpacking_done;
7967 __pyx_L17_unpacking_failed:;
7968 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7970 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7971 __PYX_ERR(0, 294, __pyx_L1_error)
7972 __pyx_L18_unpacking_done:;
7974 __Pyx_XDECREF_SET(__pyx_v_unbalanced_start, __pyx_t_7);
7976 __Pyx_XDECREF_SET(__pyx_v_balanced, __pyx_t_6);
7978 __Pyx_XDECREF_SET(__pyx_v_unbalanced_end, __pyx_t_5);
7981 /* "lxml/html/diff.py":297
7982 * # Then we move the span forward and/or backward based on these
7983 * # unbalanced portions:
7984 * locate_unbalanced_start(unbalanced_start, pre_delete, post_delete) # <<<<<<<<<<<<<<
7985 * locate_unbalanced_end(unbalanced_end, pre_delete, post_delete)
7988 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_locate_unbalanced_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 297, __pyx_L1_error)
7989 __Pyx_GOTREF(__pyx_t_5);
7992 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7993 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7994 if (likely(__pyx_t_6)) {
7995 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7996 __Pyx_INCREF(__pyx_t_6);
7997 __Pyx_INCREF(function);
7998 __Pyx_DECREF_SET(__pyx_t_5, function);
8002 #if CYTHON_FAST_PYCALL
8003 if (PyFunction_Check(__pyx_t_5)) {
8004 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_unbalanced_start, __pyx_v_pre_delete, __pyx_v_post_delete};
8005 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
8006 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8007 __Pyx_GOTREF(__pyx_t_4);
8010 #if CYTHON_FAST_PYCCALL
8011 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8012 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_unbalanced_start, __pyx_v_pre_delete, __pyx_v_post_delete};
8013 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
8014 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8015 __Pyx_GOTREF(__pyx_t_4);
8019 __pyx_t_7 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L1_error)
8020 __Pyx_GOTREF(__pyx_t_7);
8022 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
8024 __Pyx_INCREF(__pyx_v_unbalanced_start);
8025 __Pyx_GIVEREF(__pyx_v_unbalanced_start);
8026 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_v_unbalanced_start);
8027 __Pyx_INCREF(__pyx_v_pre_delete);
8028 __Pyx_GIVEREF(__pyx_v_pre_delete);
8029 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_v_pre_delete);
8030 __Pyx_INCREF(__pyx_v_post_delete);
8031 __Pyx_GIVEREF(__pyx_v_post_delete);
8032 PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_10, __pyx_v_post_delete);
8033 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
8034 __Pyx_GOTREF(__pyx_t_4);
8035 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8037 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8038 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8040 /* "lxml/html/diff.py":298
8041 * # unbalanced portions:
8042 * locate_unbalanced_start(unbalanced_start, pre_delete, post_delete)
8043 * locate_unbalanced_end(unbalanced_end, pre_delete, post_delete) # <<<<<<<<<<<<<<
8045 * if doc and not doc[-1].endswith(' '):
8047 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_locate_unbalanced_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 298, __pyx_L1_error)
8048 __Pyx_GOTREF(__pyx_t_5);
8051 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8052 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
8053 if (likely(__pyx_t_7)) {
8054 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8055 __Pyx_INCREF(__pyx_t_7);
8056 __Pyx_INCREF(function);
8057 __Pyx_DECREF_SET(__pyx_t_5, function);
8061 #if CYTHON_FAST_PYCALL
8062 if (PyFunction_Check(__pyx_t_5)) {
8063 PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_unbalanced_end, __pyx_v_pre_delete, __pyx_v_post_delete};
8064 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
8065 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8066 __Pyx_GOTREF(__pyx_t_4);
8069 #if CYTHON_FAST_PYCCALL
8070 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8071 PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_unbalanced_end, __pyx_v_pre_delete, __pyx_v_post_delete};
8072 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
8073 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8074 __Pyx_GOTREF(__pyx_t_4);
8078 __pyx_t_6 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
8079 __Pyx_GOTREF(__pyx_t_6);
8081 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
8083 __Pyx_INCREF(__pyx_v_unbalanced_end);
8084 __Pyx_GIVEREF(__pyx_v_unbalanced_end);
8085 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_v_unbalanced_end);
8086 __Pyx_INCREF(__pyx_v_pre_delete);
8087 __Pyx_GIVEREF(__pyx_v_pre_delete);
8088 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_v_pre_delete);
8089 __Pyx_INCREF(__pyx_v_post_delete);
8090 __Pyx_GIVEREF(__pyx_v_post_delete);
8091 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_10, __pyx_v_post_delete);
8092 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
8093 __Pyx_GOTREF(__pyx_t_4);
8094 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8096 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8097 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8099 /* "lxml/html/diff.py":299
8100 * locate_unbalanced_start(unbalanced_start, pre_delete, post_delete)
8101 * locate_unbalanced_end(unbalanced_end, pre_delete, post_delete)
8102 * doc = pre_delete # <<<<<<<<<<<<<<
8103 * if doc and not doc[-1].endswith(' '):
8104 * # Fix up case where the word before us didn't have a trailing space
8106 __Pyx_INCREF(__pyx_v_pre_delete);
8107 __Pyx_XDECREF_SET(__pyx_v_doc, __pyx_v_pre_delete);
8109 /* "lxml/html/diff.py":300
8110 * locate_unbalanced_end(unbalanced_end, pre_delete, post_delete)
8112 * if doc and not doc[-1].endswith(' '): # <<<<<<<<<<<<<<
8113 * # Fix up case where the word before us didn't have a trailing space
8116 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_doc); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
8119 __pyx_t_11 = __pyx_t_12;
8120 goto __pyx_L20_bool_binop_done;
8122 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_doc, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error)
8123 __Pyx_GOTREF(__pyx_t_5);
8124 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_endswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L1_error)
8125 __Pyx_GOTREF(__pyx_t_6);
8126 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8128 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
8129 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
8130 if (likely(__pyx_t_5)) {
8131 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8132 __Pyx_INCREF(__pyx_t_5);
8133 __Pyx_INCREF(function);
8134 __Pyx_DECREF_SET(__pyx_t_6, function);
8137 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_u__6) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u__6);
8138 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8139 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
8140 __Pyx_GOTREF(__pyx_t_4);
8141 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8142 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
8143 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8144 __pyx_t_13 = ((!__pyx_t_12) != 0);
8145 __pyx_t_11 = __pyx_t_13;
8146 __pyx_L20_bool_binop_done:;
8149 /* "lxml/html/diff.py":302
8150 * if doc and not doc[-1].endswith(' '):
8151 * # Fix up case where the word before us didn't have a trailing space
8152 * doc[-1] += ' ' # <<<<<<<<<<<<<<
8153 * doc.append('<del>')
8154 * if balanced and balanced[-1].endswith(' '):
8157 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_doc, __pyx_t_14, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
8158 __Pyx_GOTREF(__pyx_t_4);
8159 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_kp_u__6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error)
8160 __Pyx_GOTREF(__pyx_t_6);
8161 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8162 if (unlikely(__Pyx_SetItemInt(__pyx_v_doc, __pyx_t_14, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 302, __pyx_L1_error)
8163 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8165 /* "lxml/html/diff.py":300
8166 * locate_unbalanced_end(unbalanced_end, pre_delete, post_delete)
8168 * if doc and not doc[-1].endswith(' '): # <<<<<<<<<<<<<<
8169 * # Fix up case where the word before us didn't have a trailing space
8174 /* "lxml/html/diff.py":303
8175 * # Fix up case where the word before us didn't have a trailing space
8177 * doc.append('<del>') # <<<<<<<<<<<<<<
8178 * if balanced and balanced[-1].endswith(' '):
8179 * # We move space outside of </del>
8181 __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_kp_u_del); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 303, __pyx_L1_error)
8183 /* "lxml/html/diff.py":304
8185 * doc.append('<del>')
8186 * if balanced and balanced[-1].endswith(' '): # <<<<<<<<<<<<<<
8187 * # We move space outside of </del>
8188 * balanced[-1] = balanced[-1][:-1]
8190 __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_balanced); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
8193 __pyx_t_11 = __pyx_t_13;
8194 goto __pyx_L23_bool_binop_done;
8196 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_balanced, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error)
8197 __Pyx_GOTREF(__pyx_t_4);
8198 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L1_error)
8199 __Pyx_GOTREF(__pyx_t_5);
8200 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8202 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8203 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
8204 if (likely(__pyx_t_4)) {
8205 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8206 __Pyx_INCREF(__pyx_t_4);
8207 __Pyx_INCREF(function);
8208 __Pyx_DECREF_SET(__pyx_t_5, function);
8211 __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_u__6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__6);
8212 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8213 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 304, __pyx_L1_error)
8214 __Pyx_GOTREF(__pyx_t_6);
8215 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8216 __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
8217 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8218 __pyx_t_11 = __pyx_t_13;
8219 __pyx_L23_bool_binop_done:;
8222 /* "lxml/html/diff.py":306
8223 * if balanced and balanced[-1].endswith(' '):
8224 * # We move space outside of </del>
8225 * balanced[-1] = balanced[-1][:-1] # <<<<<<<<<<<<<<
8226 * doc.extend(balanced)
8227 * doc.append('</del> ')
8229 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_balanced, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 306, __pyx_L1_error)
8230 __Pyx_GOTREF(__pyx_t_6);
8231 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_6, 0, -1L, NULL, NULL, &__pyx_slice__7, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error)
8232 __Pyx_GOTREF(__pyx_t_5);
8233 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8234 if (unlikely(__Pyx_SetItemInt(__pyx_v_balanced, -1L, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 306, __pyx_L1_error)
8235 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8237 /* "lxml/html/diff.py":304
8239 * doc.append('<del>')
8240 * if balanced and balanced[-1].endswith(' '): # <<<<<<<<<<<<<<
8241 * # We move space outside of </del>
8242 * balanced[-1] = balanced[-1][:-1]
8246 /* "lxml/html/diff.py":307
8247 * # We move space outside of </del>
8248 * balanced[-1] = balanced[-1][:-1]
8249 * doc.extend(balanced) # <<<<<<<<<<<<<<
8250 * doc.append('</del> ')
8251 * doc.extend(post_delete)
8253 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error)
8254 __Pyx_GOTREF(__pyx_t_6);
8256 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
8257 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8258 if (likely(__pyx_t_4)) {
8259 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8260 __Pyx_INCREF(__pyx_t_4);
8261 __Pyx_INCREF(function);
8262 __Pyx_DECREF_SET(__pyx_t_6, function);
8265 __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_balanced) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_balanced);
8266 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8267 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
8268 __Pyx_GOTREF(__pyx_t_5);
8269 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8270 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8272 /* "lxml/html/diff.py":308
8273 * balanced[-1] = balanced[-1][:-1]
8274 * doc.extend(balanced)
8275 * doc.append('</del> ') # <<<<<<<<<<<<<<
8276 * doc.extend(post_delete)
8279 __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_doc, __pyx_kp_u_del_2); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 308, __pyx_L1_error)
8281 /* "lxml/html/diff.py":309
8282 * doc.extend(balanced)
8283 * doc.append('</del> ')
8284 * doc.extend(post_delete) # <<<<<<<<<<<<<<
8288 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 309, __pyx_L1_error)
8289 __Pyx_GOTREF(__pyx_t_6);
8291 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
8292 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8293 if (likely(__pyx_t_4)) {
8294 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8295 __Pyx_INCREF(__pyx_t_4);
8296 __Pyx_INCREF(function);
8297 __Pyx_DECREF_SET(__pyx_t_6, function);
8300 __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_post_delete) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_post_delete);
8301 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8302 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L1_error)
8303 __Pyx_GOTREF(__pyx_t_5);
8304 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8305 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8307 /* "lxml/html/diff.py":310
8308 * doc.append('</del> ')
8309 * doc.extend(post_delete)
8310 * chunks = doc # <<<<<<<<<<<<<<
8314 __Pyx_INCREF(__pyx_v_doc);
8315 __Pyx_DECREF_SET(__pyx_v_chunks, __pyx_v_doc);
8319 /* "lxml/html/diff.py":311
8320 * doc.extend(post_delete)
8322 * return chunks # <<<<<<<<<<<<<<
8324 * def split_unbalanced(chunks):
8326 __Pyx_XDECREF(__pyx_r);
8327 __Pyx_INCREF(__pyx_v_chunks);
8328 __pyx_r = __pyx_v_chunks;
8331 /* "lxml/html/diff.py":274
8332 * doc.append(DEL_END)
8334 * def cleanup_delete(chunks): # <<<<<<<<<<<<<<
8335 * """ Cleans up any DEL_START/DEL_END markers in the document, replacing
8336 * them with <del></del>. To do this while keeping the document
8339 /* function exit code */
8341 __Pyx_XDECREF(__pyx_t_4);
8342 __Pyx_XDECREF(__pyx_t_5);
8343 __Pyx_XDECREF(__pyx_t_6);
8344 __Pyx_XDECREF(__pyx_t_7);
8345 __Pyx_XDECREF(__pyx_t_8);
8346 __Pyx_AddTraceback("lxml.html.diff.cleanup_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
8349 __Pyx_XDECREF(__pyx_v_pre_delete);
8350 __Pyx_XDECREF(__pyx_v_delete);
8351 __Pyx_XDECREF(__pyx_v_post_delete);
8352 __Pyx_XDECREF(__pyx_v_unbalanced_start);
8353 __Pyx_XDECREF(__pyx_v_balanced);
8354 __Pyx_XDECREF(__pyx_v_unbalanced_end);
8355 __Pyx_XDECREF(__pyx_v_doc);
8356 __Pyx_XDECREF(__pyx_v_chunks);
8357 __Pyx_XGIVEREF(__pyx_r);
8358 __Pyx_RefNannyFinishContext();
8362 /* "lxml/html/diff.py":313
8365 * def split_unbalanced(chunks): # <<<<<<<<<<<<<<
8366 * """Return (unbalanced_start, balanced, unbalanced_end), where each is
8367 * a list of text and tag chunks.
8370 /* Python wrapper */
8371 static PyObject *__pyx_pw_4lxml_4html_4diff_31split_unbalanced(PyObject *__pyx_self, PyObject *__pyx_v_chunks); /*proto*/
8372 static char __pyx_doc_4lxml_4html_4diff_30split_unbalanced[] = "Return (unbalanced_start, balanced, unbalanced_end), where each is\n a list of text and tag chunks.\n\n unbalanced_start is a list of all the tags that are opened, but\n not closed in this span. Similarly, unbalanced_end is a list of\n tags that are closed but were not opened. Extracting these might\n mean some reordering of the chunks.";
8373 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_31split_unbalanced = {"split_unbalanced", (PyCFunction)__pyx_pw_4lxml_4html_4diff_31split_unbalanced, METH_O, __pyx_doc_4lxml_4html_4diff_30split_unbalanced};
8374 static PyObject *__pyx_pw_4lxml_4html_4diff_31split_unbalanced(PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
8375 PyObject *__pyx_r = 0;
8376 __Pyx_RefNannyDeclarations
8377 __Pyx_RefNannySetupContext("split_unbalanced (wrapper)", 0);
8378 __pyx_r = __pyx_pf_4lxml_4html_4diff_30split_unbalanced(__pyx_self, ((PyObject *)__pyx_v_chunks));
8380 /* function exit code */
8381 __Pyx_RefNannyFinishContext();
8385 static PyObject *__pyx_pf_4lxml_4html_4diff_30split_unbalanced(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
8386 PyObject *__pyx_v_start = NULL;
8387 PyObject *__pyx_v_end = NULL;
8388 PyObject *__pyx_v_tag_stack = NULL;
8389 PyObject *__pyx_v_balanced = NULL;
8390 PyObject *__pyx_v_chunk = NULL;
8391 PyObject *__pyx_v_endtag = NULL;
8392 PyObject *__pyx_v_name = NULL;
8393 PyObject *__pyx_v_pos = NULL;
8394 PyObject *__pyx_v_tag = NULL;
8395 CYTHON_UNUSED PyObject *__pyx_8genexpr1__pyx_v_name = NULL;
8396 CYTHON_UNUSED PyObject *__pyx_8genexpr1__pyx_v_pos = NULL;
8397 PyObject *__pyx_8genexpr1__pyx_v_tag = NULL;
8398 CYTHON_UNUSED PyObject *__pyx_8genexpr2__pyx_v_name = NULL;
8399 CYTHON_UNUSED PyObject *__pyx_8genexpr2__pyx_v_pos = NULL;
8400 PyObject *__pyx_8genexpr2__pyx_v_chunk = NULL;
8401 PyObject *__pyx_8genexpr3__pyx_v_chunk = NULL;
8402 PyObject *__pyx_r = NULL;
8403 __Pyx_RefNannyDeclarations
8404 PyObject *__pyx_t_1 = NULL;
8405 Py_ssize_t __pyx_t_2;
8406 PyObject *(*__pyx_t_3)(PyObject *);
8407 PyObject *__pyx_t_4 = NULL;
8408 PyObject *__pyx_t_5 = NULL;
8409 PyObject *__pyx_t_6 = NULL;
8413 PyObject *__pyx_t_10 = NULL;
8414 PyObject *__pyx_t_11 = NULL;
8415 PyObject *(*__pyx_t_12)(PyObject *);
8416 Py_ssize_t __pyx_t_13;
8417 PyObject *__pyx_t_14 = NULL;
8418 PyObject *__pyx_t_15 = NULL;
8419 int __pyx_lineno = 0;
8420 const char *__pyx_filename = NULL;
8421 int __pyx_clineno = 0;
8422 __Pyx_RefNannySetupContext("split_unbalanced", 0);
8424 /* "lxml/html/diff.py":321
8425 * tags that are closed but were not opened. Extracting these might
8426 * mean some reordering of the chunks."""
8427 * start = [] # <<<<<<<<<<<<<<
8431 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
8432 __Pyx_GOTREF(__pyx_t_1);
8433 __pyx_v_start = ((PyObject*)__pyx_t_1);
8436 /* "lxml/html/diff.py":322
8437 * mean some reordering of the chunks."""
8439 * end = [] # <<<<<<<<<<<<<<
8443 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
8444 __Pyx_GOTREF(__pyx_t_1);
8445 __pyx_v_end = ((PyObject*)__pyx_t_1);
8448 /* "lxml/html/diff.py":323
8451 * tag_stack = [] # <<<<<<<<<<<<<<
8453 * for chunk in chunks:
8455 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
8456 __Pyx_GOTREF(__pyx_t_1);
8457 __pyx_v_tag_stack = ((PyObject*)__pyx_t_1);
8460 /* "lxml/html/diff.py":324
8463 * balanced = [] # <<<<<<<<<<<<<<
8464 * for chunk in chunks:
8465 * if not chunk.startswith('<'):
8467 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error)
8468 __Pyx_GOTREF(__pyx_t_1);
8469 __pyx_v_balanced = ((PyObject*)__pyx_t_1);
8472 /* "lxml/html/diff.py":325
8475 * for chunk in chunks: # <<<<<<<<<<<<<<
8476 * if not chunk.startswith('<'):
8477 * balanced.append(chunk)
8479 if (likely(PyList_CheckExact(__pyx_v_chunks)) || PyTuple_CheckExact(__pyx_v_chunks)) {
8480 __pyx_t_1 = __pyx_v_chunks; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8483 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
8484 __Pyx_GOTREF(__pyx_t_1);
8485 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
8488 if (likely(!__pyx_t_3)) {
8489 if (likely(PyList_CheckExact(__pyx_t_1))) {
8490 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
8491 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8492 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 325, __pyx_L1_error)
8494 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
8495 __Pyx_GOTREF(__pyx_t_4);
8498 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8499 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8500 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 325, __pyx_L1_error)
8502 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
8503 __Pyx_GOTREF(__pyx_t_4);
8507 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
8508 if (unlikely(!__pyx_t_4)) {
8509 PyObject* exc_type = PyErr_Occurred();
8511 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8512 else __PYX_ERR(0, 325, __pyx_L1_error)
8516 __Pyx_GOTREF(__pyx_t_4);
8518 __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_4);
8521 /* "lxml/html/diff.py":326
8523 * for chunk in chunks:
8524 * if not chunk.startswith('<'): # <<<<<<<<<<<<<<
8525 * balanced.append(chunk)
8528 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error)
8529 __Pyx_GOTREF(__pyx_t_5);
8531 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8532 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8533 if (likely(__pyx_t_6)) {
8534 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8535 __Pyx_INCREF(__pyx_t_6);
8536 __Pyx_INCREF(function);
8537 __Pyx_DECREF_SET(__pyx_t_5, function);
8540 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__8);
8541 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8542 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
8543 __Pyx_GOTREF(__pyx_t_4);
8544 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8545 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 326, __pyx_L1_error)
8546 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8547 __pyx_t_8 = ((!__pyx_t_7) != 0);
8550 /* "lxml/html/diff.py":327
8551 * for chunk in chunks:
8552 * if not chunk.startswith('<'):
8553 * balanced.append(chunk) # <<<<<<<<<<<<<<
8555 * endtag = chunk[1] == '/'
8557 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_balanced, __pyx_v_chunk); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 327, __pyx_L1_error)
8559 /* "lxml/html/diff.py":328
8560 * if not chunk.startswith('<'):
8561 * balanced.append(chunk)
8562 * continue # <<<<<<<<<<<<<<
8563 * endtag = chunk[1] == '/'
8564 * name = chunk.split()[0].strip('<>/')
8566 goto __pyx_L3_continue;
8568 /* "lxml/html/diff.py":326
8570 * for chunk in chunks:
8571 * if not chunk.startswith('<'): # <<<<<<<<<<<<<<
8572 * balanced.append(chunk)
8577 /* "lxml/html/diff.py":329
8578 * balanced.append(chunk)
8580 * endtag = chunk[1] == '/' # <<<<<<<<<<<<<<
8581 * name = chunk.split()[0].strip('<>/')
8582 * if name in empty_tags:
8584 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_chunk, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
8585 __Pyx_GOTREF(__pyx_t_4);
8586 __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_kp_u__9, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 329, __pyx_L1_error)
8587 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8588 __Pyx_XDECREF_SET(__pyx_v_endtag, __pyx_t_5);
8591 /* "lxml/html/diff.py":330
8593 * endtag = chunk[1] == '/'
8594 * name = chunk.split()[0].strip('<>/') # <<<<<<<<<<<<<<
8595 * if name in empty_tags:
8596 * balanced.append(chunk)
8598 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_split); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
8599 __Pyx_GOTREF(__pyx_t_6);
8601 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
8602 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
8603 if (likely(__pyx_t_10)) {
8604 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8605 __Pyx_INCREF(__pyx_t_10);
8606 __Pyx_INCREF(function);
8607 __Pyx_DECREF_SET(__pyx_t_6, function);
8610 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
8611 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8612 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
8613 __Pyx_GOTREF(__pyx_t_4);
8614 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8615 __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
8616 __Pyx_GOTREF(__pyx_t_6);
8617 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8618 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)
8619 __Pyx_GOTREF(__pyx_t_4);
8620 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8622 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
8623 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
8624 if (likely(__pyx_t_6)) {
8625 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8626 __Pyx_INCREF(__pyx_t_6);
8627 __Pyx_INCREF(function);
8628 __Pyx_DECREF_SET(__pyx_t_4, function);
8631 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_kp_u__10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__10);
8632 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8633 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
8634 __Pyx_GOTREF(__pyx_t_5);
8635 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8636 __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
8639 /* "lxml/html/diff.py":331
8640 * endtag = chunk[1] == '/'
8641 * name = chunk.split()[0].strip('<>/')
8642 * if name in empty_tags: # <<<<<<<<<<<<<<
8643 * balanced.append(chunk)
8646 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_empty_tags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
8647 __Pyx_GOTREF(__pyx_t_5);
8648 __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_5, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
8649 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8650 __pyx_t_7 = (__pyx_t_8 != 0);
8653 /* "lxml/html/diff.py":332
8654 * name = chunk.split()[0].strip('<>/')
8655 * if name in empty_tags:
8656 * balanced.append(chunk) # <<<<<<<<<<<<<<
8660 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_balanced, __pyx_v_chunk); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 332, __pyx_L1_error)
8662 /* "lxml/html/diff.py":333
8663 * if name in empty_tags:
8664 * balanced.append(chunk)
8665 * continue # <<<<<<<<<<<<<<
8667 * if tag_stack and tag_stack[-1][0] == name:
8669 goto __pyx_L3_continue;
8671 /* "lxml/html/diff.py":331
8672 * endtag = chunk[1] == '/'
8673 * name = chunk.split()[0].strip('<>/')
8674 * if name in empty_tags: # <<<<<<<<<<<<<<
8675 * balanced.append(chunk)
8680 /* "lxml/html/diff.py":334
8681 * balanced.append(chunk)
8683 * if endtag: # <<<<<<<<<<<<<<
8684 * if tag_stack and tag_stack[-1][0] == name:
8685 * balanced.append(chunk)
8687 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_endtag); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
8690 /* "lxml/html/diff.py":335
8693 * if tag_stack and tag_stack[-1][0] == name: # <<<<<<<<<<<<<<
8694 * balanced.append(chunk)
8695 * name, pos, tag = tag_stack.pop()
8697 __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_tag_stack) != 0);
8700 __pyx_t_7 = __pyx_t_8;
8701 goto __pyx_L9_bool_binop_done;
8703 __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_tag_stack, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
8704 __Pyx_GOTREF(__pyx_t_5);
8705 __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
8706 __Pyx_GOTREF(__pyx_t_4);
8707 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8708 __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
8709 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8710 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 335, __pyx_L1_error)
8711 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8712 __pyx_t_7 = __pyx_t_8;
8713 __pyx_L9_bool_binop_done:;
8716 /* "lxml/html/diff.py":336
8718 * if tag_stack and tag_stack[-1][0] == name:
8719 * balanced.append(chunk) # <<<<<<<<<<<<<<
8720 * name, pos, tag = tag_stack.pop()
8721 * balanced[pos] = tag
8723 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_balanced, __pyx_v_chunk); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 336, __pyx_L1_error)
8725 /* "lxml/html/diff.py":337
8726 * if tag_stack and tag_stack[-1][0] == name:
8727 * balanced.append(chunk)
8728 * name, pos, tag = tag_stack.pop() # <<<<<<<<<<<<<<
8729 * balanced[pos] = tag
8732 __pyx_t_5 = __Pyx_PyList_Pop(__pyx_v_tag_stack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
8733 __Pyx_GOTREF(__pyx_t_5);
8734 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
8735 PyObject* sequence = __pyx_t_5;
8736 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8737 if (unlikely(size != 3)) {
8738 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
8739 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8740 __PYX_ERR(0, 337, __pyx_L1_error)
8742 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8743 if (likely(PyTuple_CheckExact(sequence))) {
8744 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
8745 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
8746 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
8748 __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
8749 __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
8750 __pyx_t_10 = PyList_GET_ITEM(sequence, 2);
8752 __Pyx_INCREF(__pyx_t_4);
8753 __Pyx_INCREF(__pyx_t_6);
8754 __Pyx_INCREF(__pyx_t_10);
8756 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
8757 __Pyx_GOTREF(__pyx_t_4);
8758 __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
8759 __Pyx_GOTREF(__pyx_t_6);
8760 __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 337, __pyx_L1_error)
8761 __Pyx_GOTREF(__pyx_t_10);
8763 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8765 Py_ssize_t index = -1;
8766 __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 337, __pyx_L1_error)
8767 __Pyx_GOTREF(__pyx_t_11);
8768 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8769 __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
8770 index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
8771 __Pyx_GOTREF(__pyx_t_4);
8772 index = 1; __pyx_t_6 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
8773 __Pyx_GOTREF(__pyx_t_6);
8774 index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
8775 __Pyx_GOTREF(__pyx_t_10);
8776 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) __PYX_ERR(0, 337, __pyx_L1_error)
8778 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8779 goto __pyx_L12_unpacking_done;
8780 __pyx_L11_unpacking_failed:;
8781 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8783 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
8784 __PYX_ERR(0, 337, __pyx_L1_error)
8785 __pyx_L12_unpacking_done:;
8787 __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_4);
8789 __Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_6);
8791 __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_10);
8794 /* "lxml/html/diff.py":338
8795 * balanced.append(chunk)
8796 * name, pos, tag = tag_stack.pop()
8797 * balanced[pos] = tag # <<<<<<<<<<<<<<
8799 * start.extend([tag for name, pos, tag in tag_stack])
8801 if (unlikely(PyObject_SetItem(__pyx_v_balanced, __pyx_v_pos, __pyx_v_tag) < 0)) __PYX_ERR(0, 338, __pyx_L1_error)
8803 /* "lxml/html/diff.py":335
8806 * if tag_stack and tag_stack[-1][0] == name: # <<<<<<<<<<<<<<
8807 * balanced.append(chunk)
8808 * name, pos, tag = tag_stack.pop()
8813 /* "lxml/html/diff.py":339
8814 * name, pos, tag = tag_stack.pop()
8815 * balanced[pos] = tag
8816 * elif tag_stack: # <<<<<<<<<<<<<<
8817 * start.extend([tag for name, pos, tag in tag_stack])
8820 __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_tag_stack) != 0);
8823 /* "lxml/html/diff.py":340
8824 * balanced[pos] = tag
8826 * start.extend([tag for name, pos, tag in tag_stack]) # <<<<<<<<<<<<<<
8830 { /* enter inner scope */
8831 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 340, __pyx_L15_error)
8832 __Pyx_GOTREF(__pyx_t_5);
8833 __pyx_t_10 = __pyx_v_tag_stack; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
8835 if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
8836 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8837 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_6); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 340, __pyx_L15_error)
8839 __pyx_t_6 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L15_error)
8840 __Pyx_GOTREF(__pyx_t_6);
8842 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
8843 PyObject* sequence = __pyx_t_6;
8844 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8845 if (unlikely(size != 3)) {
8846 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
8847 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8848 __PYX_ERR(0, 340, __pyx_L15_error)
8850 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8851 if (likely(PyTuple_CheckExact(sequence))) {
8852 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
8853 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
8854 __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2);
8856 __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
8857 __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
8858 __pyx_t_14 = PyList_GET_ITEM(sequence, 2);
8860 __Pyx_INCREF(__pyx_t_4);
8861 __Pyx_INCREF(__pyx_t_11);
8862 __Pyx_INCREF(__pyx_t_14);
8864 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L15_error)
8865 __Pyx_GOTREF(__pyx_t_4);
8866 __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 340, __pyx_L15_error)
8867 __Pyx_GOTREF(__pyx_t_11);
8868 __pyx_t_14 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 340, __pyx_L15_error)
8869 __Pyx_GOTREF(__pyx_t_14);
8871 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8873 Py_ssize_t index = -1;
8874 __pyx_t_15 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 340, __pyx_L15_error)
8875 __Pyx_GOTREF(__pyx_t_15);
8876 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8877 __pyx_t_12 = Py_TYPE(__pyx_t_15)->tp_iternext;
8878 index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed;
8879 __Pyx_GOTREF(__pyx_t_4);
8880 index = 1; __pyx_t_11 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed;
8881 __Pyx_GOTREF(__pyx_t_11);
8882 index = 2; __pyx_t_14 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L18_unpacking_failed;
8883 __Pyx_GOTREF(__pyx_t_14);
8884 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_15), 3) < 0) __PYX_ERR(0, 340, __pyx_L15_error)
8886 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8887 goto __pyx_L19_unpacking_done;
8888 __pyx_L18_unpacking_failed:;
8889 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8891 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
8892 __PYX_ERR(0, 340, __pyx_L15_error)
8893 __pyx_L19_unpacking_done:;
8895 __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_name, __pyx_t_4);
8897 __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_pos, __pyx_t_11);
8899 __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_tag, __pyx_t_14);
8901 if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_8genexpr1__pyx_v_tag))) __PYX_ERR(0, 340, __pyx_L15_error)
8903 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8904 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_name); __pyx_8genexpr1__pyx_v_name = 0;
8905 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_pos); __pyx_8genexpr1__pyx_v_pos = 0;
8906 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_tag); __pyx_8genexpr1__pyx_v_tag = 0;
8907 goto __pyx_L20_exit_scope;
8909 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_name); __pyx_8genexpr1__pyx_v_name = 0;
8910 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_pos); __pyx_8genexpr1__pyx_v_pos = 0;
8911 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_tag); __pyx_8genexpr1__pyx_v_tag = 0;
8912 goto __pyx_L1_error;
8913 __pyx_L20_exit_scope:;
8914 } /* exit inner scope */
8915 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_start, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 340, __pyx_L1_error)
8916 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8918 /* "lxml/html/diff.py":341
8920 * start.extend([tag for name, pos, tag in tag_stack])
8921 * tag_stack = [] # <<<<<<<<<<<<<<
8925 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error)
8926 __Pyx_GOTREF(__pyx_t_5);
8927 __Pyx_DECREF_SET(__pyx_v_tag_stack, ((PyObject*)__pyx_t_5));
8930 /* "lxml/html/diff.py":342
8931 * start.extend([tag for name, pos, tag in tag_stack])
8933 * end.append(chunk) # <<<<<<<<<<<<<<
8937 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_end, __pyx_v_chunk); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 342, __pyx_L1_error)
8939 /* "lxml/html/diff.py":339
8940 * name, pos, tag = tag_stack.pop()
8941 * balanced[pos] = tag
8942 * elif tag_stack: # <<<<<<<<<<<<<<
8943 * start.extend([tag for name, pos, tag in tag_stack])
8949 /* "lxml/html/diff.py":344
8952 * end.append(chunk) # <<<<<<<<<<<<<<
8954 * tag_stack.append((name, len(balanced), chunk))
8957 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_end, __pyx_v_chunk); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 344, __pyx_L1_error)
8961 /* "lxml/html/diff.py":334
8962 * balanced.append(chunk)
8964 * if endtag: # <<<<<<<<<<<<<<
8965 * if tag_stack and tag_stack[-1][0] == name:
8966 * balanced.append(chunk)
8971 /* "lxml/html/diff.py":346
8974 * tag_stack.append((name, len(balanced), chunk)) # <<<<<<<<<<<<<<
8975 * balanced.append(None)
8979 __pyx_t_13 = PyList_GET_SIZE(__pyx_v_balanced); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 346, __pyx_L1_error)
8980 __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error)
8981 __Pyx_GOTREF(__pyx_t_5);
8982 __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error)
8983 __Pyx_GOTREF(__pyx_t_10);
8984 __Pyx_INCREF(__pyx_v_name);
8985 __Pyx_GIVEREF(__pyx_v_name);
8986 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_name);
8987 __Pyx_GIVEREF(__pyx_t_5);
8988 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
8989 __Pyx_INCREF(__pyx_v_chunk);
8990 __Pyx_GIVEREF(__pyx_v_chunk);
8991 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_chunk);
8993 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_tag_stack, __pyx_t_10); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 346, __pyx_L1_error)
8994 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8996 /* "lxml/html/diff.py":347
8998 * tag_stack.append((name, len(balanced), chunk))
8999 * balanced.append(None) # <<<<<<<<<<<<<<
9001 * [chunk for name, pos, chunk in tag_stack])
9003 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_balanced, Py_None); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 347, __pyx_L1_error)
9007 /* "lxml/html/diff.py":325
9010 * for chunk in chunks: # <<<<<<<<<<<<<<
9011 * if not chunk.startswith('<'):
9012 * balanced.append(chunk)
9016 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9018 /* "lxml/html/diff.py":348
9019 * tag_stack.append((name, len(balanced), chunk))
9020 * balanced.append(None)
9021 * start.extend( # <<<<<<<<<<<<<<
9022 * [chunk for name, pos, chunk in tag_stack])
9023 * balanced = [chunk for chunk in balanced if chunk is not None]
9025 { /* enter inner scope */
9027 /* "lxml/html/diff.py":349
9028 * balanced.append(None)
9030 * [chunk for name, pos, chunk in tag_stack]) # <<<<<<<<<<<<<<
9031 * balanced = [chunk for chunk in balanced if chunk is not None]
9032 * return start, balanced, end
9034 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L23_error)
9035 __Pyx_GOTREF(__pyx_t_1);
9036 __pyx_t_10 = __pyx_v_tag_stack; __Pyx_INCREF(__pyx_t_10); __pyx_t_2 = 0;
9038 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_10)) break;
9039 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9040 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 349, __pyx_L23_error)
9042 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 349, __pyx_L23_error)
9043 __Pyx_GOTREF(__pyx_t_5);
9045 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
9046 PyObject* sequence = __pyx_t_5;
9047 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9048 if (unlikely(size != 3)) {
9049 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
9050 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9051 __PYX_ERR(0, 349, __pyx_L23_error)
9053 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9054 if (likely(PyTuple_CheckExact(sequence))) {
9055 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
9056 __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
9057 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
9059 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
9060 __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
9061 __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
9063 __Pyx_INCREF(__pyx_t_6);
9064 __Pyx_INCREF(__pyx_t_14);
9065 __Pyx_INCREF(__pyx_t_11);
9067 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 349, __pyx_L23_error)
9068 __Pyx_GOTREF(__pyx_t_6);
9069 __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 349, __pyx_L23_error)
9070 __Pyx_GOTREF(__pyx_t_14);
9071 __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 349, __pyx_L23_error)
9072 __Pyx_GOTREF(__pyx_t_11);
9074 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9076 Py_ssize_t index = -1;
9077 __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 349, __pyx_L23_error)
9078 __Pyx_GOTREF(__pyx_t_4);
9079 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9080 __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext;
9081 index = 0; __pyx_t_6 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L26_unpacking_failed;
9082 __Pyx_GOTREF(__pyx_t_6);
9083 index = 1; __pyx_t_14 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_14)) goto __pyx_L26_unpacking_failed;
9084 __Pyx_GOTREF(__pyx_t_14);
9085 index = 2; __pyx_t_11 = __pyx_t_12(__pyx_t_4); if (unlikely(!__pyx_t_11)) goto __pyx_L26_unpacking_failed;
9086 __Pyx_GOTREF(__pyx_t_11);
9087 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_4), 3) < 0) __PYX_ERR(0, 349, __pyx_L23_error)
9089 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9090 goto __pyx_L27_unpacking_done;
9091 __pyx_L26_unpacking_failed:;
9092 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9094 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
9095 __PYX_ERR(0, 349, __pyx_L23_error)
9096 __pyx_L27_unpacking_done:;
9098 __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_name, __pyx_t_6);
9100 __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_pos, __pyx_t_14);
9102 __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_chunk, __pyx_t_11);
9104 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_chunk))) __PYX_ERR(0, 349, __pyx_L23_error)
9106 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9107 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_chunk); __pyx_8genexpr2__pyx_v_chunk = 0;
9108 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_name); __pyx_8genexpr2__pyx_v_name = 0;
9109 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_pos); __pyx_8genexpr2__pyx_v_pos = 0;
9110 goto __pyx_L28_exit_scope;
9112 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_chunk); __pyx_8genexpr2__pyx_v_chunk = 0;
9113 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_name); __pyx_8genexpr2__pyx_v_name = 0;
9114 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_pos); __pyx_8genexpr2__pyx_v_pos = 0;
9115 goto __pyx_L1_error;
9116 __pyx_L28_exit_scope:;
9117 } /* exit inner scope */
9119 /* "lxml/html/diff.py":348
9120 * tag_stack.append((name, len(balanced), chunk))
9121 * balanced.append(None)
9122 * start.extend( # <<<<<<<<<<<<<<
9123 * [chunk for name, pos, chunk in tag_stack])
9124 * balanced = [chunk for chunk in balanced if chunk is not None]
9126 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_start, __pyx_t_1); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error)
9127 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9129 /* "lxml/html/diff.py":350
9131 * [chunk for name, pos, chunk in tag_stack])
9132 * balanced = [chunk for chunk in balanced if chunk is not None] # <<<<<<<<<<<<<<
9133 * return start, balanced, end
9136 { /* enter inner scope */
9137 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L31_error)
9138 __Pyx_GOTREF(__pyx_t_1);
9139 __pyx_t_10 = __pyx_v_balanced; __Pyx_INCREF(__pyx_t_10); __pyx_t_2 = 0;
9141 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_10)) break;
9142 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9143 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 350, __pyx_L31_error)
9145 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L31_error)
9146 __Pyx_GOTREF(__pyx_t_5);
9148 __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_chunk, __pyx_t_5);
9150 __pyx_t_7 = (__pyx_8genexpr3__pyx_v_chunk != Py_None);
9151 __pyx_t_8 = (__pyx_t_7 != 0);
9153 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr3__pyx_v_chunk))) __PYX_ERR(0, 350, __pyx_L31_error)
9156 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9157 __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_chunk); __pyx_8genexpr3__pyx_v_chunk = 0;
9158 goto __pyx_L35_exit_scope;
9160 __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_chunk); __pyx_8genexpr3__pyx_v_chunk = 0;
9161 goto __pyx_L1_error;
9162 __pyx_L35_exit_scope:;
9163 } /* exit inner scope */
9164 __Pyx_DECREF_SET(__pyx_v_balanced, ((PyObject*)__pyx_t_1));
9167 /* "lxml/html/diff.py":351
9168 * [chunk for name, pos, chunk in tag_stack])
9169 * balanced = [chunk for chunk in balanced if chunk is not None]
9170 * return start, balanced, end # <<<<<<<<<<<<<<
9172 * def split_delete(chunks):
9174 __Pyx_XDECREF(__pyx_r);
9175 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
9176 __Pyx_GOTREF(__pyx_t_1);
9177 __Pyx_INCREF(__pyx_v_start);
9178 __Pyx_GIVEREF(__pyx_v_start);
9179 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_start);
9180 __Pyx_INCREF(__pyx_v_balanced);
9181 __Pyx_GIVEREF(__pyx_v_balanced);
9182 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_balanced);
9183 __Pyx_INCREF(__pyx_v_end);
9184 __Pyx_GIVEREF(__pyx_v_end);
9185 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
9186 __pyx_r = __pyx_t_1;
9190 /* "lxml/html/diff.py":313
9193 * def split_unbalanced(chunks): # <<<<<<<<<<<<<<
9194 * """Return (unbalanced_start, balanced, unbalanced_end), where each is
9195 * a list of text and tag chunks.
9198 /* function exit code */
9200 __Pyx_XDECREF(__pyx_t_1);
9201 __Pyx_XDECREF(__pyx_t_4);
9202 __Pyx_XDECREF(__pyx_t_5);
9203 __Pyx_XDECREF(__pyx_t_6);
9204 __Pyx_XDECREF(__pyx_t_10);
9205 __Pyx_XDECREF(__pyx_t_11);
9206 __Pyx_XDECREF(__pyx_t_14);
9207 __Pyx_XDECREF(__pyx_t_15);
9208 __Pyx_AddTraceback("lxml.html.diff.split_unbalanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
9211 __Pyx_XDECREF(__pyx_v_start);
9212 __Pyx_XDECREF(__pyx_v_end);
9213 __Pyx_XDECREF(__pyx_v_tag_stack);
9214 __Pyx_XDECREF(__pyx_v_balanced);
9215 __Pyx_XDECREF(__pyx_v_chunk);
9216 __Pyx_XDECREF(__pyx_v_endtag);
9217 __Pyx_XDECREF(__pyx_v_name);
9218 __Pyx_XDECREF(__pyx_v_pos);
9219 __Pyx_XDECREF(__pyx_v_tag);
9220 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_name);
9221 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_pos);
9222 __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_tag);
9223 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_name);
9224 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_pos);
9225 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_chunk);
9226 __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_chunk);
9227 __Pyx_XGIVEREF(__pyx_r);
9228 __Pyx_RefNannyFinishContext();
9232 /* "lxml/html/diff.py":353
9233 * return start, balanced, end
9235 * def split_delete(chunks): # <<<<<<<<<<<<<<
9236 * """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
9237 * stuff_after_DEL_END). Returns the first case found (there may be
9240 /* Python wrapper */
9241 static PyObject *__pyx_pw_4lxml_4html_4diff_33split_delete(PyObject *__pyx_self, PyObject *__pyx_v_chunks); /*proto*/
9242 static char __pyx_doc_4lxml_4html_4diff_32split_delete[] = " Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,\n stuff_after_DEL_END). Returns the first case found (there may be\n more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if\n there's no DEL_START found. ";
9243 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_33split_delete = {"split_delete", (PyCFunction)__pyx_pw_4lxml_4html_4diff_33split_delete, METH_O, __pyx_doc_4lxml_4html_4diff_32split_delete};
9244 static PyObject *__pyx_pw_4lxml_4html_4diff_33split_delete(PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
9245 PyObject *__pyx_r = 0;
9246 __Pyx_RefNannyDeclarations
9247 __Pyx_RefNannySetupContext("split_delete (wrapper)", 0);
9248 __pyx_r = __pyx_pf_4lxml_4html_4diff_32split_delete(__pyx_self, ((PyObject *)__pyx_v_chunks));
9250 /* function exit code */
9251 __Pyx_RefNannyFinishContext();
9255 static PyObject *__pyx_pf_4lxml_4html_4diff_32split_delete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
9256 PyObject *__pyx_v_pos = NULL;
9257 PyObject *__pyx_v_pos2 = NULL;
9258 PyObject *__pyx_r = NULL;
9259 __Pyx_RefNannyDeclarations
9260 PyObject *__pyx_t_1 = NULL;
9261 PyObject *__pyx_t_2 = NULL;
9262 PyObject *__pyx_t_3 = NULL;
9263 PyObject *__pyx_t_4 = NULL;
9264 PyObject *__pyx_t_5 = NULL;
9265 PyObject *__pyx_t_6 = NULL;
9266 PyObject *__pyx_t_7 = NULL;
9268 int __pyx_lineno = 0;
9269 const char *__pyx_filename = NULL;
9270 int __pyx_clineno = 0;
9271 __Pyx_RefNannySetupContext("split_delete", 0);
9273 /* "lxml/html/diff.py":358
9274 * more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
9275 * there's no DEL_START found. """
9276 * try: # <<<<<<<<<<<<<<
9277 * pos = chunks.index(DEL_START)
9278 * except ValueError:
9281 __Pyx_PyThreadState_declare
9282 __Pyx_PyThreadState_assign
9283 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
9284 __Pyx_XGOTREF(__pyx_t_1);
9285 __Pyx_XGOTREF(__pyx_t_2);
9286 __Pyx_XGOTREF(__pyx_t_3);
9289 /* "lxml/html/diff.py":359
9290 * there's no DEL_START found. """
9292 * pos = chunks.index(DEL_START) # <<<<<<<<<<<<<<
9293 * except ValueError:
9296 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunks, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L3_error)
9297 __Pyx_GOTREF(__pyx_t_5);
9298 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DEL_START); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L3_error)
9299 __Pyx_GOTREF(__pyx_t_6);
9301 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9302 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9303 if (likely(__pyx_t_7)) {
9304 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9305 __Pyx_INCREF(__pyx_t_7);
9306 __Pyx_INCREF(function);
9307 __Pyx_DECREF_SET(__pyx_t_5, function);
9310 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
9311 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9312 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9313 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L3_error)
9314 __Pyx_GOTREF(__pyx_t_4);
9315 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9316 __pyx_v_pos = __pyx_t_4;
9319 /* "lxml/html/diff.py":358
9320 * more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
9321 * there's no DEL_START found. """
9322 * try: # <<<<<<<<<<<<<<
9323 * pos = chunks.index(DEL_START)
9324 * except ValueError:
9327 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9328 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9329 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9330 goto __pyx_L8_try_end;
9332 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9333 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9334 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9335 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9337 /* "lxml/html/diff.py":360
9339 * pos = chunks.index(DEL_START)
9340 * except ValueError: # <<<<<<<<<<<<<<
9342 * pos2 = chunks.index(DEL_END)
9344 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
9346 __Pyx_AddTraceback("lxml.html.diff.split_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
9347 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 360, __pyx_L5_except_error)
9348 __Pyx_GOTREF(__pyx_t_4);
9349 __Pyx_GOTREF(__pyx_t_5);
9350 __Pyx_GOTREF(__pyx_t_6);
9352 /* "lxml/html/diff.py":361
9353 * pos = chunks.index(DEL_START)
9354 * except ValueError:
9355 * raise NoDeletes # <<<<<<<<<<<<<<
9356 * pos2 = chunks.index(DEL_END)
9357 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
9359 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_NoDeletes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 361, __pyx_L5_except_error)
9360 __Pyx_GOTREF(__pyx_t_7);
9361 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
9362 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9363 __PYX_ERR(0, 361, __pyx_L5_except_error)
9365 goto __pyx_L5_except_error;
9366 __pyx_L5_except_error:;
9368 /* "lxml/html/diff.py":358
9369 * more DEL_STARTs in stuff_after_DEL_END). Raises NoDeletes if
9370 * there's no DEL_START found. """
9371 * try: # <<<<<<<<<<<<<<
9372 * pos = chunks.index(DEL_START)
9373 * except ValueError:
9375 __Pyx_XGIVEREF(__pyx_t_1);
9376 __Pyx_XGIVEREF(__pyx_t_2);
9377 __Pyx_XGIVEREF(__pyx_t_3);
9378 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
9379 goto __pyx_L1_error;
9383 /* "lxml/html/diff.py":362
9384 * except ValueError:
9386 * pos2 = chunks.index(DEL_END) # <<<<<<<<<<<<<<
9387 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
9390 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunks, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
9391 __Pyx_GOTREF(__pyx_t_5);
9392 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DEL_END); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error)
9393 __Pyx_GOTREF(__pyx_t_4);
9395 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9396 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9397 if (likely(__pyx_t_7)) {
9398 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9399 __Pyx_INCREF(__pyx_t_7);
9400 __Pyx_INCREF(function);
9401 __Pyx_DECREF_SET(__pyx_t_5, function);
9404 __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
9405 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9406 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9407 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 362, __pyx_L1_error)
9408 __Pyx_GOTREF(__pyx_t_6);
9409 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9410 __pyx_v_pos2 = __pyx_t_6;
9413 /* "lxml/html/diff.py":363
9415 * pos2 = chunks.index(DEL_END)
9416 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:] # <<<<<<<<<<<<<<
9418 * def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete):
9420 __Pyx_XDECREF(__pyx_r);
9421 __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_chunks, 0, 0, NULL, &__pyx_v_pos, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error)
9422 __Pyx_GOTREF(__pyx_t_6);
9423 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_pos, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
9424 __Pyx_GOTREF(__pyx_t_5);
9425 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_chunks, 0, 0, &__pyx_t_5, &__pyx_v_pos2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error)
9426 __Pyx_GOTREF(__pyx_t_4);
9427 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9428 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_pos2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
9429 __Pyx_GOTREF(__pyx_t_5);
9430 __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_chunks, 0, 0, &__pyx_t_5, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 363, __pyx_L1_error)
9431 __Pyx_GOTREF(__pyx_t_7);
9432 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9433 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
9434 __Pyx_GOTREF(__pyx_t_5);
9435 __Pyx_GIVEREF(__pyx_t_6);
9436 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
9437 __Pyx_GIVEREF(__pyx_t_4);
9438 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
9439 __Pyx_GIVEREF(__pyx_t_7);
9440 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
9444 __pyx_r = __pyx_t_5;
9448 /* "lxml/html/diff.py":353
9449 * return start, balanced, end
9451 * def split_delete(chunks): # <<<<<<<<<<<<<<
9452 * """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
9453 * stuff_after_DEL_END). Returns the first case found (there may be
9456 /* function exit code */
9458 __Pyx_XDECREF(__pyx_t_4);
9459 __Pyx_XDECREF(__pyx_t_5);
9460 __Pyx_XDECREF(__pyx_t_6);
9461 __Pyx_XDECREF(__pyx_t_7);
9462 __Pyx_AddTraceback("lxml.html.diff.split_delete", __pyx_clineno, __pyx_lineno, __pyx_filename);
9465 __Pyx_XDECREF(__pyx_v_pos);
9466 __Pyx_XDECREF(__pyx_v_pos2);
9467 __Pyx_XGIVEREF(__pyx_r);
9468 __Pyx_RefNannyFinishContext();
9472 /* "lxml/html/diff.py":365
9473 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
9475 * def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): # <<<<<<<<<<<<<<
9476 * """ pre_delete and post_delete implicitly point to a place in the
9477 * document (where the two were split). This moves that point (by
9480 /* Python wrapper */
9481 static PyObject *__pyx_pw_4lxml_4html_4diff_35locate_unbalanced_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9482 static char __pyx_doc_4lxml_4html_4diff_34locate_unbalanced_start[] = " pre_delete and post_delete implicitly point to a place in the\n document (where the two were split). This moves that point (by\n popping items from one and pushing them onto the other). It moves\n the point to try to find a place where unbalanced_start applies.\n\n As an example::\n\n >>> unbalanced_start = ['<div>']\n >>> doc = ['<p>', 'Text', '</p>', '<div>', 'More Text', '</div>']\n >>> pre, post = doc[:3], doc[3:]\n >>> pre, post\n (['<p>', 'Text', '</p>'], ['<div>', 'More Text', '</div>'])\n >>> locate_unbalanced_start(unbalanced_start, pre, post)\n >>> pre, post\n (['<p>', 'Text', '</p>', '<div>'], ['More Text', '</div>'])\n\n As you can see, we moved the point so that the dangling <div> that\n we found will be effectively replaced by the div in the original\n document. If this doesn't work out, we just throw away\n unbalanced_start without doing anything.\n ";
9483 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_35locate_unbalanced_start = {"locate_unbalanced_start", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_35locate_unbalanced_start, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_34locate_unbalanced_start};
9484 static PyObject *__pyx_pw_4lxml_4html_4diff_35locate_unbalanced_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9485 PyObject *__pyx_v_unbalanced_start = 0;
9486 PyObject *__pyx_v_pre_delete = 0;
9487 PyObject *__pyx_v_post_delete = 0;
9488 int __pyx_lineno = 0;
9489 const char *__pyx_filename = NULL;
9490 int __pyx_clineno = 0;
9491 PyObject *__pyx_r = 0;
9492 __Pyx_RefNannyDeclarations
9493 __Pyx_RefNannySetupContext("locate_unbalanced_start (wrapper)", 0);
9495 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unbalanced_start,&__pyx_n_s_pre_delete,&__pyx_n_s_post_delete,0};
9496 PyObject* values[3] = {0,0,0};
9497 if (unlikely(__pyx_kwds)) {
9499 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9501 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9503 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9505 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9508 default: goto __pyx_L5_argtuple_error;
9510 kw_args = PyDict_Size(__pyx_kwds);
9513 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unbalanced_start)) != 0)) kw_args--;
9514 else goto __pyx_L5_argtuple_error;
9517 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_delete)) != 0)) kw_args--;
9519 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_start", 1, 3, 3, 1); __PYX_ERR(0, 365, __pyx_L3_error)
9523 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_post_delete)) != 0)) kw_args--;
9525 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_start", 1, 3, 3, 2); __PYX_ERR(0, 365, __pyx_L3_error)
9528 if (unlikely(kw_args > 0)) {
9529 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate_unbalanced_start") < 0)) __PYX_ERR(0, 365, __pyx_L3_error)
9531 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
9532 goto __pyx_L5_argtuple_error;
9534 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9535 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9536 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9538 __pyx_v_unbalanced_start = values[0];
9539 __pyx_v_pre_delete = values[1];
9540 __pyx_v_post_delete = values[2];
9542 goto __pyx_L4_argument_unpacking_done;
9543 __pyx_L5_argtuple_error:;
9544 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_start", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 365, __pyx_L3_error)
9546 __Pyx_AddTraceback("lxml.html.diff.locate_unbalanced_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
9547 __Pyx_RefNannyFinishContext();
9549 __pyx_L4_argument_unpacking_done:;
9550 __pyx_r = __pyx_pf_4lxml_4html_4diff_34locate_unbalanced_start(__pyx_self, __pyx_v_unbalanced_start, __pyx_v_pre_delete, __pyx_v_post_delete);
9552 /* function exit code */
9553 __Pyx_RefNannyFinishContext();
9557 static PyObject *__pyx_pf_4lxml_4html_4diff_34locate_unbalanced_start(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_unbalanced_start, PyObject *__pyx_v_pre_delete, PyObject *__pyx_v_post_delete) {
9558 PyObject *__pyx_v_finding = NULL;
9559 PyObject *__pyx_v_finding_name = NULL;
9560 PyObject *__pyx_v_next = NULL;
9561 PyObject *__pyx_v_name = NULL;
9562 PyObject *__pyx_r = NULL;
9563 __Pyx_RefNannyDeclarations
9566 PyObject *__pyx_t_3 = NULL;
9567 PyObject *__pyx_t_4 = NULL;
9568 PyObject *__pyx_t_5 = NULL;
9569 PyObject *__pyx_t_6 = NULL;
9572 int __pyx_lineno = 0;
9573 const char *__pyx_filename = NULL;
9574 int __pyx_clineno = 0;
9575 __Pyx_RefNannySetupContext("locate_unbalanced_start", 0);
9577 /* "lxml/html/diff.py":387
9578 * unbalanced_start without doing anything.
9580 * while 1: # <<<<<<<<<<<<<<
9581 * if not unbalanced_start:
9582 * # We have totally succeeded in finding the position
9586 /* "lxml/html/diff.py":388
9589 * if not unbalanced_start: # <<<<<<<<<<<<<<
9590 * # We have totally succeeded in finding the position
9593 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_unbalanced_start); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
9594 __pyx_t_2 = ((!__pyx_t_1) != 0);
9597 /* "lxml/html/diff.py":390
9598 * if not unbalanced_start:
9599 * # We have totally succeeded in finding the position
9600 * break # <<<<<<<<<<<<<<
9601 * finding = unbalanced_start[0]
9602 * finding_name = finding.split()[0].strip('<>')
9604 goto __pyx_L4_break;
9606 /* "lxml/html/diff.py":388
9609 * if not unbalanced_start: # <<<<<<<<<<<<<<
9610 * # We have totally succeeded in finding the position
9615 /* "lxml/html/diff.py":391
9616 * # We have totally succeeded in finding the position
9618 * finding = unbalanced_start[0] # <<<<<<<<<<<<<<
9619 * finding_name = finding.split()[0].strip('<>')
9620 * if not post_delete:
9622 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_unbalanced_start, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
9623 __Pyx_GOTREF(__pyx_t_3);
9624 __Pyx_XDECREF_SET(__pyx_v_finding, __pyx_t_3);
9627 /* "lxml/html/diff.py":392
9629 * finding = unbalanced_start[0]
9630 * finding_name = finding.split()[0].strip('<>') # <<<<<<<<<<<<<<
9631 * if not post_delete:
9634 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_finding, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L1_error)
9635 __Pyx_GOTREF(__pyx_t_5);
9637 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9638 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9639 if (likely(__pyx_t_6)) {
9640 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9641 __Pyx_INCREF(__pyx_t_6);
9642 __Pyx_INCREF(function);
9643 __Pyx_DECREF_SET(__pyx_t_5, function);
9646 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
9647 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9648 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error)
9649 __Pyx_GOTREF(__pyx_t_4);
9650 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9651 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L1_error)
9652 __Pyx_GOTREF(__pyx_t_5);
9653 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9654 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error)
9655 __Pyx_GOTREF(__pyx_t_4);
9656 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9658 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9659 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9660 if (likely(__pyx_t_5)) {
9661 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9662 __Pyx_INCREF(__pyx_t_5);
9663 __Pyx_INCREF(function);
9664 __Pyx_DECREF_SET(__pyx_t_4, function);
9667 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__11) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__11);
9668 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9669 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
9670 __Pyx_GOTREF(__pyx_t_3);
9671 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9672 __Pyx_XDECREF_SET(__pyx_v_finding_name, __pyx_t_3);
9675 /* "lxml/html/diff.py":393
9676 * finding = unbalanced_start[0]
9677 * finding_name = finding.split()[0].strip('<>')
9678 * if not post_delete: # <<<<<<<<<<<<<<
9680 * next = post_delete[0]
9682 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_post_delete); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 393, __pyx_L1_error)
9683 __pyx_t_1 = ((!__pyx_t_2) != 0);
9686 /* "lxml/html/diff.py":394
9687 * finding_name = finding.split()[0].strip('<>')
9688 * if not post_delete:
9689 * break # <<<<<<<<<<<<<<
9690 * next = post_delete[0]
9691 * if next is DEL_START or not next.startswith('<'):
9693 goto __pyx_L4_break;
9695 /* "lxml/html/diff.py":393
9696 * finding = unbalanced_start[0]
9697 * finding_name = finding.split()[0].strip('<>')
9698 * if not post_delete: # <<<<<<<<<<<<<<
9700 * next = post_delete[0]
9704 /* "lxml/html/diff.py":395
9705 * if not post_delete:
9707 * next = post_delete[0] # <<<<<<<<<<<<<<
9708 * if next is DEL_START or not next.startswith('<'):
9709 * # Reached a word, we can't move the delete text forward
9711 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_post_delete, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
9712 __Pyx_GOTREF(__pyx_t_3);
9713 __Pyx_XDECREF_SET(__pyx_v_next, __pyx_t_3);
9716 /* "lxml/html/diff.py":396
9718 * next = post_delete[0]
9719 * if next is DEL_START or not next.startswith('<'): # <<<<<<<<<<<<<<
9720 * # Reached a word, we can't move the delete text forward
9723 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DEL_START); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
9724 __Pyx_GOTREF(__pyx_t_3);
9725 __pyx_t_2 = (__pyx_v_next == __pyx_t_3);
9726 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9727 __pyx_t_7 = (__pyx_t_2 != 0);
9730 __pyx_t_1 = __pyx_t_7;
9731 goto __pyx_L8_bool_binop_done;
9733 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_next, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error)
9734 __Pyx_GOTREF(__pyx_t_4);
9736 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9737 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9738 if (likely(__pyx_t_5)) {
9739 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9740 __Pyx_INCREF(__pyx_t_5);
9741 __Pyx_INCREF(function);
9742 __Pyx_DECREF_SET(__pyx_t_4, function);
9745 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__8);
9746 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9747 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
9748 __Pyx_GOTREF(__pyx_t_3);
9749 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9750 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 396, __pyx_L1_error)
9751 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9752 __pyx_t_2 = ((!__pyx_t_7) != 0);
9753 __pyx_t_1 = __pyx_t_2;
9754 __pyx_L8_bool_binop_done:;
9757 /* "lxml/html/diff.py":398
9758 * if next is DEL_START or not next.startswith('<'):
9759 * # Reached a word, we can't move the delete text forward
9760 * break # <<<<<<<<<<<<<<
9761 * if next[1] == '/':
9762 * # Reached a closing tag, can we go further? Maybe not...
9764 goto __pyx_L4_break;
9766 /* "lxml/html/diff.py":396
9768 * next = post_delete[0]
9769 * if next is DEL_START or not next.startswith('<'): # <<<<<<<<<<<<<<
9770 * # Reached a word, we can't move the delete text forward
9775 /* "lxml/html/diff.py":399
9776 * # Reached a word, we can't move the delete text forward
9778 * if next[1] == '/': # <<<<<<<<<<<<<<
9779 * # Reached a closing tag, can we go further? Maybe not...
9782 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_next, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
9783 __Pyx_GOTREF(__pyx_t_3);
9784 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u__9, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
9785 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9788 /* "lxml/html/diff.py":401
9789 * if next[1] == '/':
9790 * # Reached a closing tag, can we go further? Maybe not...
9791 * break # <<<<<<<<<<<<<<
9792 * name = next.split()[0].strip('<>')
9795 goto __pyx_L4_break;
9797 /* "lxml/html/diff.py":399
9798 * # Reached a word, we can't move the delete text forward
9800 * if next[1] == '/': # <<<<<<<<<<<<<<
9801 * # Reached a closing tag, can we go further? Maybe not...
9806 /* "lxml/html/diff.py":402
9807 * # Reached a closing tag, can we go further? Maybe not...
9809 * name = next.split()[0].strip('<>') # <<<<<<<<<<<<<<
9811 * # Can't move into an insert
9813 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_next, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error)
9814 __Pyx_GOTREF(__pyx_t_5);
9816 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9817 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9818 if (likely(__pyx_t_6)) {
9819 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9820 __Pyx_INCREF(__pyx_t_6);
9821 __Pyx_INCREF(function);
9822 __Pyx_DECREF_SET(__pyx_t_5, function);
9825 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
9826 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9827 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error)
9828 __Pyx_GOTREF(__pyx_t_4);
9829 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9830 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error)
9831 __Pyx_GOTREF(__pyx_t_5);
9832 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9833 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error)
9834 __Pyx_GOTREF(__pyx_t_4);
9835 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9837 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9838 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9839 if (likely(__pyx_t_5)) {
9840 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9841 __Pyx_INCREF(__pyx_t_5);
9842 __Pyx_INCREF(function);
9843 __Pyx_DECREF_SET(__pyx_t_4, function);
9846 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__11) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__11);
9847 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9848 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
9849 __Pyx_GOTREF(__pyx_t_3);
9850 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9851 __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3);
9854 /* "lxml/html/diff.py":403
9856 * name = next.split()[0].strip('<>')
9857 * if name == 'ins': # <<<<<<<<<<<<<<
9858 * # Can't move into an insert
9861 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_ins_3, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 403, __pyx_L1_error)
9864 /* "lxml/html/diff.py":405
9866 * # Can't move into an insert
9867 * break # <<<<<<<<<<<<<<
9868 * assert name != 'del', (
9869 * "Unexpected delete tag: %r" % next)
9871 goto __pyx_L4_break;
9873 /* "lxml/html/diff.py":403
9875 * name = next.split()[0].strip('<>')
9876 * if name == 'ins': # <<<<<<<<<<<<<<
9877 * # Can't move into an insert
9882 /* "lxml/html/diff.py":406
9883 * # Can't move into an insert
9885 * assert name != 'del', ( # <<<<<<<<<<<<<<
9886 * "Unexpected delete tag: %r" % next)
9887 * if name == finding_name:
9889 #ifndef CYTHON_WITHOUT_ASSERTIONS
9890 if (unlikely(!Py_OptimizeFlag)) {
9891 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_del_3, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 406, __pyx_L1_error)
9892 if (unlikely(!__pyx_t_1)) {
9894 /* "lxml/html/diff.py":407
9896 * assert name != 'del', (
9897 * "Unexpected delete tag: %r" % next) # <<<<<<<<<<<<<<
9898 * if name == finding_name:
9899 * unbalanced_start.pop(0)
9901 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Unexpected_delete_tag_r, __pyx_v_next); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
9902 __Pyx_GOTREF(__pyx_t_3);
9903 PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
9904 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9905 __PYX_ERR(0, 406, __pyx_L1_error)
9910 /* "lxml/html/diff.py":408
9911 * assert name != 'del', (
9912 * "Unexpected delete tag: %r" % next)
9913 * if name == finding_name: # <<<<<<<<<<<<<<
9914 * unbalanced_start.pop(0)
9915 * pre_delete.append(post_delete.pop(0))
9917 __pyx_t_3 = PyObject_RichCompare(__pyx_v_name, __pyx_v_finding_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
9918 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 408, __pyx_L1_error)
9919 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9922 /* "lxml/html/diff.py":409
9923 * "Unexpected delete tag: %r" % next)
9924 * if name == finding_name:
9925 * unbalanced_start.pop(0) # <<<<<<<<<<<<<<
9926 * pre_delete.append(post_delete.pop(0))
9929 __pyx_t_3 = __Pyx_PyObject_PopIndex(__pyx_v_unbalanced_start, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
9930 __Pyx_GOTREF(__pyx_t_3);
9931 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9933 /* "lxml/html/diff.py":410
9934 * if name == finding_name:
9935 * unbalanced_start.pop(0)
9936 * pre_delete.append(post_delete.pop(0)) # <<<<<<<<<<<<<<
9938 * # Found a tag that doesn't match
9940 __pyx_t_3 = __Pyx_PyObject_PopIndex(__pyx_v_post_delete, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error)
9941 __Pyx_GOTREF(__pyx_t_3);
9942 __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_pre_delete, __pyx_t_3); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 410, __pyx_L1_error)
9943 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9945 /* "lxml/html/diff.py":408
9946 * assert name != 'del', (
9947 * "Unexpected delete tag: %r" % next)
9948 * if name == finding_name: # <<<<<<<<<<<<<<
9949 * unbalanced_start.pop(0)
9950 * pre_delete.append(post_delete.pop(0))
9955 /* "lxml/html/diff.py":413
9957 * # Found a tag that doesn't match
9958 * break # <<<<<<<<<<<<<<
9960 * def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete):
9963 goto __pyx_L4_break;
9969 /* "lxml/html/diff.py":365
9970 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
9972 * def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): # <<<<<<<<<<<<<<
9973 * """ pre_delete and post_delete implicitly point to a place in the
9974 * document (where the two were split). This moves that point (by
9977 /* function exit code */
9978 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9981 __Pyx_XDECREF(__pyx_t_3);
9982 __Pyx_XDECREF(__pyx_t_4);
9983 __Pyx_XDECREF(__pyx_t_5);
9984 __Pyx_XDECREF(__pyx_t_6);
9985 __Pyx_AddTraceback("lxml.html.diff.locate_unbalanced_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
9988 __Pyx_XDECREF(__pyx_v_finding);
9989 __Pyx_XDECREF(__pyx_v_finding_name);
9990 __Pyx_XDECREF(__pyx_v_next);
9991 __Pyx_XDECREF(__pyx_v_name);
9992 __Pyx_XGIVEREF(__pyx_r);
9993 __Pyx_RefNannyFinishContext();
9997 /* "lxml/html/diff.py":415
10000 * def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): # <<<<<<<<<<<<<<
10001 * """ like locate_unbalanced_start, except handling end tags and
10002 * possibly moving the point earlier in the document. """
10005 /* Python wrapper */
10006 static PyObject *__pyx_pw_4lxml_4html_4diff_37locate_unbalanced_end(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10007 static char __pyx_doc_4lxml_4html_4diff_36locate_unbalanced_end[] = " like locate_unbalanced_start, except handling end tags and\n possibly moving the point earlier in the document. ";
10008 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_37locate_unbalanced_end = {"locate_unbalanced_end", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_37locate_unbalanced_end, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_36locate_unbalanced_end};
10009 static PyObject *__pyx_pw_4lxml_4html_4diff_37locate_unbalanced_end(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10010 PyObject *__pyx_v_unbalanced_end = 0;
10011 PyObject *__pyx_v_pre_delete = 0;
10012 PyObject *__pyx_v_post_delete = 0;
10013 int __pyx_lineno = 0;
10014 const char *__pyx_filename = NULL;
10015 int __pyx_clineno = 0;
10016 PyObject *__pyx_r = 0;
10017 __Pyx_RefNannyDeclarations
10018 __Pyx_RefNannySetupContext("locate_unbalanced_end (wrapper)", 0);
10020 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unbalanced_end,&__pyx_n_s_pre_delete,&__pyx_n_s_post_delete,0};
10021 PyObject* values[3] = {0,0,0};
10022 if (unlikely(__pyx_kwds)) {
10023 Py_ssize_t kw_args;
10024 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10025 switch (pos_args) {
10026 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10027 CYTHON_FALLTHROUGH;
10028 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10029 CYTHON_FALLTHROUGH;
10030 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10031 CYTHON_FALLTHROUGH;
10033 default: goto __pyx_L5_argtuple_error;
10035 kw_args = PyDict_Size(__pyx_kwds);
10036 switch (pos_args) {
10038 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unbalanced_end)) != 0)) kw_args--;
10039 else goto __pyx_L5_argtuple_error;
10040 CYTHON_FALLTHROUGH;
10042 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_delete)) != 0)) kw_args--;
10044 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_end", 1, 3, 3, 1); __PYX_ERR(0, 415, __pyx_L3_error)
10046 CYTHON_FALLTHROUGH;
10048 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_post_delete)) != 0)) kw_args--;
10050 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_end", 1, 3, 3, 2); __PYX_ERR(0, 415, __pyx_L3_error)
10053 if (unlikely(kw_args > 0)) {
10054 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate_unbalanced_end") < 0)) __PYX_ERR(0, 415, __pyx_L3_error)
10056 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
10057 goto __pyx_L5_argtuple_error;
10059 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10060 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10061 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10063 __pyx_v_unbalanced_end = values[0];
10064 __pyx_v_pre_delete = values[1];
10065 __pyx_v_post_delete = values[2];
10067 goto __pyx_L4_argument_unpacking_done;
10068 __pyx_L5_argtuple_error:;
10069 __Pyx_RaiseArgtupleInvalid("locate_unbalanced_end", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 415, __pyx_L3_error)
10071 __Pyx_AddTraceback("lxml.html.diff.locate_unbalanced_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
10072 __Pyx_RefNannyFinishContext();
10074 __pyx_L4_argument_unpacking_done:;
10075 __pyx_r = __pyx_pf_4lxml_4html_4diff_36locate_unbalanced_end(__pyx_self, __pyx_v_unbalanced_end, __pyx_v_pre_delete, __pyx_v_post_delete);
10077 /* function exit code */
10078 __Pyx_RefNannyFinishContext();
10082 static PyObject *__pyx_pf_4lxml_4html_4diff_36locate_unbalanced_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_unbalanced_end, PyObject *__pyx_v_pre_delete, PyObject *__pyx_v_post_delete) {
10083 PyObject *__pyx_v_finding = NULL;
10084 PyObject *__pyx_v_finding_name = NULL;
10085 PyObject *__pyx_v_next = NULL;
10086 PyObject *__pyx_v_name = NULL;
10087 PyObject *__pyx_r = NULL;
10088 __Pyx_RefNannyDeclarations
10091 PyObject *__pyx_t_3 = NULL;
10092 PyObject *__pyx_t_4 = NULL;
10093 PyObject *__pyx_t_5 = NULL;
10094 PyObject *__pyx_t_6 = NULL;
10097 PyObject *__pyx_t_9 = NULL;
10098 int __pyx_lineno = 0;
10099 const char *__pyx_filename = NULL;
10100 int __pyx_clineno = 0;
10101 __Pyx_RefNannySetupContext("locate_unbalanced_end", 0);
10103 /* "lxml/html/diff.py":418
10104 * """ like locate_unbalanced_start, except handling end tags and
10105 * possibly moving the point earlier in the document. """
10106 * while 1: # <<<<<<<<<<<<<<
10107 * if not unbalanced_end:
10112 /* "lxml/html/diff.py":419
10113 * possibly moving the point earlier in the document. """
10115 * if not unbalanced_end: # <<<<<<<<<<<<<<
10119 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_unbalanced_end); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 419, __pyx_L1_error)
10120 __pyx_t_2 = ((!__pyx_t_1) != 0);
10123 /* "lxml/html/diff.py":421
10124 * if not unbalanced_end:
10126 * break # <<<<<<<<<<<<<<
10127 * finding = unbalanced_end[-1]
10128 * finding_name = finding.split()[0].strip('<>/')
10130 goto __pyx_L4_break;
10132 /* "lxml/html/diff.py":419
10133 * possibly moving the point earlier in the document. """
10135 * if not unbalanced_end: # <<<<<<<<<<<<<<
10141 /* "lxml/html/diff.py":422
10144 * finding = unbalanced_end[-1] # <<<<<<<<<<<<<<
10145 * finding_name = finding.split()[0].strip('<>/')
10146 * if not pre_delete:
10148 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_unbalanced_end, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
10149 __Pyx_GOTREF(__pyx_t_3);
10150 __Pyx_XDECREF_SET(__pyx_v_finding, __pyx_t_3);
10153 /* "lxml/html/diff.py":423
10155 * finding = unbalanced_end[-1]
10156 * finding_name = finding.split()[0].strip('<>/') # <<<<<<<<<<<<<<
10157 * if not pre_delete:
10160 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_finding, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
10161 __Pyx_GOTREF(__pyx_t_5);
10163 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10164 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
10165 if (likely(__pyx_t_6)) {
10166 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10167 __Pyx_INCREF(__pyx_t_6);
10168 __Pyx_INCREF(function);
10169 __Pyx_DECREF_SET(__pyx_t_5, function);
10172 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
10173 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10174 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
10175 __Pyx_GOTREF(__pyx_t_4);
10176 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10177 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
10178 __Pyx_GOTREF(__pyx_t_5);
10179 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10180 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
10181 __Pyx_GOTREF(__pyx_t_4);
10182 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10184 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
10185 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
10186 if (likely(__pyx_t_5)) {
10187 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10188 __Pyx_INCREF(__pyx_t_5);
10189 __Pyx_INCREF(function);
10190 __Pyx_DECREF_SET(__pyx_t_4, function);
10193 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__10);
10194 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10195 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
10196 __Pyx_GOTREF(__pyx_t_3);
10197 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10198 __Pyx_XDECREF_SET(__pyx_v_finding_name, __pyx_t_3);
10201 /* "lxml/html/diff.py":424
10202 * finding = unbalanced_end[-1]
10203 * finding_name = finding.split()[0].strip('<>/')
10204 * if not pre_delete: # <<<<<<<<<<<<<<
10206 * next = pre_delete[-1]
10208 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pre_delete); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 424, __pyx_L1_error)
10209 __pyx_t_1 = ((!__pyx_t_2) != 0);
10212 /* "lxml/html/diff.py":425
10213 * finding_name = finding.split()[0].strip('<>/')
10214 * if not pre_delete:
10215 * break # <<<<<<<<<<<<<<
10216 * next = pre_delete[-1]
10217 * if next is DEL_END or not next.startswith('</'):
10219 goto __pyx_L4_break;
10221 /* "lxml/html/diff.py":424
10222 * finding = unbalanced_end[-1]
10223 * finding_name = finding.split()[0].strip('<>/')
10224 * if not pre_delete: # <<<<<<<<<<<<<<
10226 * next = pre_delete[-1]
10230 /* "lxml/html/diff.py":426
10231 * if not pre_delete:
10233 * next = pre_delete[-1] # <<<<<<<<<<<<<<
10234 * if next is DEL_END or not next.startswith('</'):
10235 * # A word or a start tag
10237 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pre_delete, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
10238 __Pyx_GOTREF(__pyx_t_3);
10239 __Pyx_XDECREF_SET(__pyx_v_next, __pyx_t_3);
10242 /* "lxml/html/diff.py":427
10244 * next = pre_delete[-1]
10245 * if next is DEL_END or not next.startswith('</'): # <<<<<<<<<<<<<<
10246 * # A word or a start tag
10249 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_DEL_END); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
10250 __Pyx_GOTREF(__pyx_t_3);
10251 __pyx_t_2 = (__pyx_v_next == __pyx_t_3);
10252 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10253 __pyx_t_7 = (__pyx_t_2 != 0);
10256 __pyx_t_1 = __pyx_t_7;
10257 goto __pyx_L8_bool_binop_done;
10259 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_next, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error)
10260 __Pyx_GOTREF(__pyx_t_4);
10262 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
10263 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
10264 if (likely(__pyx_t_5)) {
10265 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10266 __Pyx_INCREF(__pyx_t_5);
10267 __Pyx_INCREF(function);
10268 __Pyx_DECREF_SET(__pyx_t_4, function);
10271 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__12) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__12);
10272 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10273 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
10274 __Pyx_GOTREF(__pyx_t_3);
10275 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10276 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 427, __pyx_L1_error)
10277 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10278 __pyx_t_2 = ((!__pyx_t_7) != 0);
10279 __pyx_t_1 = __pyx_t_2;
10280 __pyx_L8_bool_binop_done:;
10283 /* "lxml/html/diff.py":429
10284 * if next is DEL_END or not next.startswith('</'):
10285 * # A word or a start tag
10286 * break # <<<<<<<<<<<<<<
10287 * name = next.split()[0].strip('<>/')
10288 * if name == 'ins' or name == 'del':
10290 goto __pyx_L4_break;
10292 /* "lxml/html/diff.py":427
10294 * next = pre_delete[-1]
10295 * if next is DEL_END or not next.startswith('</'): # <<<<<<<<<<<<<<
10296 * # A word or a start tag
10301 /* "lxml/html/diff.py":430
10302 * # A word or a start tag
10304 * name = next.split()[0].strip('<>/') # <<<<<<<<<<<<<<
10305 * if name == 'ins' or name == 'del':
10306 * # Can't move into an insert or delete
10308 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_next, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
10309 __Pyx_GOTREF(__pyx_t_5);
10311 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10312 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
10313 if (likely(__pyx_t_6)) {
10314 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10315 __Pyx_INCREF(__pyx_t_6);
10316 __Pyx_INCREF(function);
10317 __Pyx_DECREF_SET(__pyx_t_5, function);
10320 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
10321 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10322 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error)
10323 __Pyx_GOTREF(__pyx_t_4);
10324 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10325 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
10326 __Pyx_GOTREF(__pyx_t_5);
10327 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10328 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error)
10329 __Pyx_GOTREF(__pyx_t_4);
10330 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10332 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
10333 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
10334 if (likely(__pyx_t_5)) {
10335 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10336 __Pyx_INCREF(__pyx_t_5);
10337 __Pyx_INCREF(function);
10338 __Pyx_DECREF_SET(__pyx_t_4, function);
10341 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u__10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__10);
10342 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10343 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
10344 __Pyx_GOTREF(__pyx_t_3);
10345 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10346 __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3);
10349 /* "lxml/html/diff.py":431
10351 * name = next.split()[0].strip('<>/')
10352 * if name == 'ins' or name == 'del': # <<<<<<<<<<<<<<
10353 * # Can't move into an insert or delete
10356 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_ins_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 431, __pyx_L1_error)
10359 __pyx_t_1 = __pyx_t_2;
10360 goto __pyx_L11_bool_binop_done;
10362 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_del_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 431, __pyx_L1_error)
10363 __pyx_t_1 = __pyx_t_2;
10364 __pyx_L11_bool_binop_done:;
10367 /* "lxml/html/diff.py":433
10368 * if name == 'ins' or name == 'del':
10369 * # Can't move into an insert or delete
10370 * break # <<<<<<<<<<<<<<
10371 * if name == finding_name:
10372 * unbalanced_end.pop()
10374 goto __pyx_L4_break;
10376 /* "lxml/html/diff.py":431
10378 * name = next.split()[0].strip('<>/')
10379 * if name == 'ins' or name == 'del': # <<<<<<<<<<<<<<
10380 * # Can't move into an insert or delete
10385 /* "lxml/html/diff.py":434
10386 * # Can't move into an insert or delete
10388 * if name == finding_name: # <<<<<<<<<<<<<<
10389 * unbalanced_end.pop()
10390 * post_delete.insert(0, pre_delete.pop())
10392 __pyx_t_3 = PyObject_RichCompare(__pyx_v_name, __pyx_v_finding_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
10393 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 434, __pyx_L1_error)
10394 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10397 /* "lxml/html/diff.py":435
10399 * if name == finding_name:
10400 * unbalanced_end.pop() # <<<<<<<<<<<<<<
10401 * post_delete.insert(0, pre_delete.pop())
10404 __pyx_t_3 = __Pyx_PyObject_Pop(__pyx_v_unbalanced_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 435, __pyx_L1_error)
10405 __Pyx_GOTREF(__pyx_t_3);
10406 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10408 /* "lxml/html/diff.py":436
10409 * if name == finding_name:
10410 * unbalanced_end.pop()
10411 * post_delete.insert(0, pre_delete.pop()) # <<<<<<<<<<<<<<
10413 * # Found a tag that doesn't match
10415 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_post_delete, __pyx_n_s_insert); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error)
10416 __Pyx_GOTREF(__pyx_t_4);
10417 __pyx_t_5 = __Pyx_PyObject_Pop(__pyx_v_pre_delete); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
10418 __Pyx_GOTREF(__pyx_t_5);
10421 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
10422 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
10423 if (likely(__pyx_t_6)) {
10424 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10425 __Pyx_INCREF(__pyx_t_6);
10426 __Pyx_INCREF(function);
10427 __Pyx_DECREF_SET(__pyx_t_4, function);
10431 #if CYTHON_FAST_PYCALL
10432 if (PyFunction_Check(__pyx_t_4)) {
10433 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_int_0, __pyx_t_5};
10434 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
10435 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10436 __Pyx_GOTREF(__pyx_t_3);
10437 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10440 #if CYTHON_FAST_PYCCALL
10441 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
10442 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_int_0, __pyx_t_5};
10443 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
10444 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10445 __Pyx_GOTREF(__pyx_t_3);
10446 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10450 __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 436, __pyx_L1_error)
10451 __Pyx_GOTREF(__pyx_t_9);
10453 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
10455 __Pyx_INCREF(__pyx_int_0);
10456 __Pyx_GIVEREF(__pyx_int_0);
10457 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_int_0);
10458 __Pyx_GIVEREF(__pyx_t_5);
10459 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
10461 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
10462 __Pyx_GOTREF(__pyx_t_3);
10463 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10465 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10466 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10468 /* "lxml/html/diff.py":434
10469 * # Can't move into an insert or delete
10471 * if name == finding_name: # <<<<<<<<<<<<<<
10472 * unbalanced_end.pop()
10473 * post_delete.insert(0, pre_delete.pop())
10478 /* "lxml/html/diff.py":439
10480 * # Found a tag that doesn't match
10481 * break # <<<<<<<<<<<<<<
10483 * class token(_unicode):
10486 goto __pyx_L4_break;
10492 /* "lxml/html/diff.py":415
10495 * def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): # <<<<<<<<<<<<<<
10496 * """ like locate_unbalanced_start, except handling end tags and
10497 * possibly moving the point earlier in the document. """
10500 /* function exit code */
10501 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10504 __Pyx_XDECREF(__pyx_t_3);
10505 __Pyx_XDECREF(__pyx_t_4);
10506 __Pyx_XDECREF(__pyx_t_5);
10507 __Pyx_XDECREF(__pyx_t_6);
10508 __Pyx_XDECREF(__pyx_t_9);
10509 __Pyx_AddTraceback("lxml.html.diff.locate_unbalanced_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
10512 __Pyx_XDECREF(__pyx_v_finding);
10513 __Pyx_XDECREF(__pyx_v_finding_name);
10514 __Pyx_XDECREF(__pyx_v_next);
10515 __Pyx_XDECREF(__pyx_v_name);
10516 __Pyx_XGIVEREF(__pyx_r);
10517 __Pyx_RefNannyFinishContext();
10521 /* "lxml/html/diff.py":458
10522 * hide_when_equal = False
10524 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): # <<<<<<<<<<<<<<
10525 * obj = _unicode.__new__(cls, text)
10529 /* Python wrapper */
10530 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10531 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_5token_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_5token_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
10532 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10533 PyObject *__pyx_v_cls = 0;
10534 PyObject *__pyx_v_text = 0;
10535 PyObject *__pyx_v_pre_tags = 0;
10536 PyObject *__pyx_v_post_tags = 0;
10537 PyObject *__pyx_v_trailing_whitespace = 0;
10538 int __pyx_lineno = 0;
10539 const char *__pyx_filename = NULL;
10540 int __pyx_clineno = 0;
10541 PyObject *__pyx_r = 0;
10542 __Pyx_RefNannyDeclarations
10543 __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
10545 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_text,&__pyx_n_s_pre_tags,&__pyx_n_s_post_tags,&__pyx_n_s_trailing_whitespace,0};
10546 PyObject* values[5] = {0,0,0,0,0};
10547 values[2] = ((PyObject *)((PyObject *)Py_None));
10548 values[3] = ((PyObject *)((PyObject *)Py_None));
10549 values[4] = ((PyObject *)((PyObject*)__pyx_kp_u__2));
10550 if (unlikely(__pyx_kwds)) {
10551 Py_ssize_t kw_args;
10552 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10553 switch (pos_args) {
10554 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10555 CYTHON_FALLTHROUGH;
10556 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10557 CYTHON_FALLTHROUGH;
10558 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10559 CYTHON_FALLTHROUGH;
10560 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10561 CYTHON_FALLTHROUGH;
10562 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10563 CYTHON_FALLTHROUGH;
10565 default: goto __pyx_L5_argtuple_error;
10567 kw_args = PyDict_Size(__pyx_kwds);
10568 switch (pos_args) {
10570 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
10571 else goto __pyx_L5_argtuple_error;
10572 CYTHON_FALLTHROUGH;
10574 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text)) != 0)) kw_args--;
10576 __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 5, 1); __PYX_ERR(0, 458, __pyx_L3_error)
10578 CYTHON_FALLTHROUGH;
10581 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_tags);
10582 if (value) { values[2] = value; kw_args--; }
10584 CYTHON_FALLTHROUGH;
10587 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_post_tags);
10588 if (value) { values[3] = value; kw_args--; }
10590 CYTHON_FALLTHROUGH;
10593 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trailing_whitespace);
10594 if (value) { values[4] = value; kw_args--; }
10597 if (unlikely(kw_args > 0)) {
10598 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 458, __pyx_L3_error)
10601 switch (PyTuple_GET_SIZE(__pyx_args)) {
10602 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10603 CYTHON_FALLTHROUGH;
10604 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10605 CYTHON_FALLTHROUGH;
10606 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10607 CYTHON_FALLTHROUGH;
10608 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10609 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10611 default: goto __pyx_L5_argtuple_error;
10614 __pyx_v_cls = values[0];
10615 __pyx_v_text = values[1];
10616 __pyx_v_pre_tags = values[2];
10617 __pyx_v_post_tags = values[3];
10618 __pyx_v_trailing_whitespace = values[4];
10620 goto __pyx_L4_argument_unpacking_done;
10621 __pyx_L5_argtuple_error:;
10622 __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 458, __pyx_L3_error)
10624 __Pyx_AddTraceback("lxml.html.diff.token.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10625 __Pyx_RefNannyFinishContext();
10627 __pyx_L4_argument_unpacking_done:;
10628 __pyx_r = __pyx_pf_4lxml_4html_4diff_5token___new__(__pyx_self, __pyx_v_cls, __pyx_v_text, __pyx_v_pre_tags, __pyx_v_post_tags, __pyx_v_trailing_whitespace);
10630 /* function exit code */
10631 __Pyx_RefNannyFinishContext();
10635 static PyObject *__pyx_pf_4lxml_4html_4diff_5token___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_text, PyObject *__pyx_v_pre_tags, PyObject *__pyx_v_post_tags, PyObject *__pyx_v_trailing_whitespace) {
10636 PyObject *__pyx_v_obj = NULL;
10637 PyObject *__pyx_r = NULL;
10638 __Pyx_RefNannyDeclarations
10639 PyObject *__pyx_t_1 = NULL;
10640 PyObject *__pyx_t_2 = NULL;
10641 PyObject *__pyx_t_3 = NULL;
10643 PyObject *__pyx_t_5 = NULL;
10646 int __pyx_lineno = 0;
10647 const char *__pyx_filename = NULL;
10648 int __pyx_clineno = 0;
10649 __Pyx_RefNannySetupContext("__new__", 0);
10651 /* "lxml/html/diff.py":459
10653 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""):
10654 * obj = _unicode.__new__(cls, text) # <<<<<<<<<<<<<<
10656 * if pre_tags is not None:
10658 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error)
10659 __Pyx_GOTREF(__pyx_t_2);
10660 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error)
10661 __Pyx_GOTREF(__pyx_t_3);
10662 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10665 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10666 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
10667 if (likely(__pyx_t_2)) {
10668 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10669 __Pyx_INCREF(__pyx_t_2);
10670 __Pyx_INCREF(function);
10671 __Pyx_DECREF_SET(__pyx_t_3, function);
10675 #if CYTHON_FAST_PYCALL
10676 if (PyFunction_Check(__pyx_t_3)) {
10677 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_cls, __pyx_v_text};
10678 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
10679 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10680 __Pyx_GOTREF(__pyx_t_1);
10683 #if CYTHON_FAST_PYCCALL
10684 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
10685 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_cls, __pyx_v_text};
10686 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
10687 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10688 __Pyx_GOTREF(__pyx_t_1);
10692 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
10693 __Pyx_GOTREF(__pyx_t_5);
10695 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
10697 __Pyx_INCREF(__pyx_v_cls);
10698 __Pyx_GIVEREF(__pyx_v_cls);
10699 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_cls);
10700 __Pyx_INCREF(__pyx_v_text);
10701 __Pyx_GIVEREF(__pyx_v_text);
10702 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_text);
10703 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
10704 __Pyx_GOTREF(__pyx_t_1);
10705 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10707 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10708 __pyx_v_obj = __pyx_t_1;
10711 /* "lxml/html/diff.py":461
10712 * obj = _unicode.__new__(cls, text)
10714 * if pre_tags is not None: # <<<<<<<<<<<<<<
10715 * obj.pre_tags = pre_tags
10718 __pyx_t_6 = (__pyx_v_pre_tags != Py_None);
10719 __pyx_t_7 = (__pyx_t_6 != 0);
10722 /* "lxml/html/diff.py":462
10724 * if pre_tags is not None:
10725 * obj.pre_tags = pre_tags # <<<<<<<<<<<<<<
10727 * obj.pre_tags = []
10729 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_pre_tags, __pyx_v_pre_tags) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
10731 /* "lxml/html/diff.py":461
10732 * obj = _unicode.__new__(cls, text)
10734 * if pre_tags is not None: # <<<<<<<<<<<<<<
10735 * obj.pre_tags = pre_tags
10741 /* "lxml/html/diff.py":464
10742 * obj.pre_tags = pre_tags
10744 * obj.pre_tags = [] # <<<<<<<<<<<<<<
10746 * if post_tags is not None:
10749 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error)
10750 __Pyx_GOTREF(__pyx_t_1);
10751 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_pre_tags, __pyx_t_1) < 0) __PYX_ERR(0, 464, __pyx_L1_error)
10752 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10756 /* "lxml/html/diff.py":466
10757 * obj.pre_tags = []
10759 * if post_tags is not None: # <<<<<<<<<<<<<<
10760 * obj.post_tags = post_tags
10763 __pyx_t_7 = (__pyx_v_post_tags != Py_None);
10764 __pyx_t_6 = (__pyx_t_7 != 0);
10767 /* "lxml/html/diff.py":467
10769 * if post_tags is not None:
10770 * obj.post_tags = post_tags # <<<<<<<<<<<<<<
10772 * obj.post_tags = []
10774 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_post_tags, __pyx_v_post_tags) < 0) __PYX_ERR(0, 467, __pyx_L1_error)
10776 /* "lxml/html/diff.py":466
10777 * obj.pre_tags = []
10779 * if post_tags is not None: # <<<<<<<<<<<<<<
10780 * obj.post_tags = post_tags
10786 /* "lxml/html/diff.py":469
10787 * obj.post_tags = post_tags
10789 * obj.post_tags = [] # <<<<<<<<<<<<<<
10791 * obj.trailing_whitespace = trailing_whitespace
10794 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
10795 __Pyx_GOTREF(__pyx_t_1);
10796 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_post_tags, __pyx_t_1) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
10797 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10801 /* "lxml/html/diff.py":471
10802 * obj.post_tags = []
10804 * obj.trailing_whitespace = trailing_whitespace # <<<<<<<<<<<<<<
10808 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_trailing_whitespace, __pyx_v_trailing_whitespace) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
10810 /* "lxml/html/diff.py":473
10811 * obj.trailing_whitespace = trailing_whitespace
10813 * return obj # <<<<<<<<<<<<<<
10815 * def __repr__(self):
10817 __Pyx_XDECREF(__pyx_r);
10818 __Pyx_INCREF(__pyx_v_obj);
10819 __pyx_r = __pyx_v_obj;
10822 /* "lxml/html/diff.py":458
10823 * hide_when_equal = False
10825 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): # <<<<<<<<<<<<<<
10826 * obj = _unicode.__new__(cls, text)
10830 /* function exit code */
10832 __Pyx_XDECREF(__pyx_t_1);
10833 __Pyx_XDECREF(__pyx_t_2);
10834 __Pyx_XDECREF(__pyx_t_3);
10835 __Pyx_XDECREF(__pyx_t_5);
10836 __Pyx_AddTraceback("lxml.html.diff.token.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10839 __Pyx_XDECREF(__pyx_v_obj);
10840 __Pyx_XGIVEREF(__pyx_r);
10841 __Pyx_RefNannyFinishContext();
10845 /* "lxml/html/diff.py":475
10848 * def __repr__(self): # <<<<<<<<<<<<<<
10849 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags,
10850 * self.post_tags, self.trailing_whitespace)
10853 /* Python wrapper */
10854 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
10855 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_5token_3__repr__ = {"__repr__", (PyCFunction)__pyx_pw_4lxml_4html_4diff_5token_3__repr__, METH_O, 0};
10856 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
10857 PyObject *__pyx_r = 0;
10858 __Pyx_RefNannyDeclarations
10859 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
10860 __pyx_r = __pyx_pf_4lxml_4html_4diff_5token_2__repr__(__pyx_self, ((PyObject *)__pyx_v_self));
10862 /* function exit code */
10863 __Pyx_RefNannyFinishContext();
10867 static PyObject *__pyx_pf_4lxml_4html_4diff_5token_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
10868 PyObject *__pyx_r = NULL;
10869 __Pyx_RefNannyDeclarations
10870 PyObject *__pyx_t_1 = NULL;
10871 Py_ssize_t __pyx_t_2;
10873 PyObject *__pyx_t_4 = NULL;
10874 PyObject *__pyx_t_5 = NULL;
10875 PyObject *__pyx_t_6 = NULL;
10876 int __pyx_lineno = 0;
10877 const char *__pyx_filename = NULL;
10878 int __pyx_clineno = 0;
10879 __Pyx_RefNannySetupContext("__repr__", 0);
10881 /* "lxml/html/diff.py":476
10883 * def __repr__(self):
10884 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags, # <<<<<<<<<<<<<<
10885 * self.post_tags, self.trailing_whitespace)
10888 __Pyx_XDECREF(__pyx_r);
10889 __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
10890 __Pyx_GOTREF(__pyx_t_1);
10893 __Pyx_INCREF(__pyx_kp_u_token_2);
10895 __Pyx_GIVEREF(__pyx_kp_u_token_2);
10896 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_token_2);
10897 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error)
10898 __Pyx_GOTREF(__pyx_t_5);
10899 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_repr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error)
10900 __Pyx_GOTREF(__pyx_t_6);
10901 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10903 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
10904 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
10905 if (likely(__pyx_t_5)) {
10906 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
10907 __Pyx_INCREF(__pyx_t_5);
10908 __Pyx_INCREF(function);
10909 __Pyx_DECREF_SET(__pyx_t_6, function);
10912 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_self);
10913 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10914 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
10915 __Pyx_GOTREF(__pyx_t_4);
10916 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10917 __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error)
10918 __Pyx_GOTREF(__pyx_t_6);
10919 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10920 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_3;
10921 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
10922 __Pyx_GIVEREF(__pyx_t_6);
10923 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
10925 __Pyx_INCREF(__pyx_kp_u__13);
10927 __Pyx_GIVEREF(__pyx_kp_u__13);
10928 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__13);
10929 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error)
10930 __Pyx_GOTREF(__pyx_t_6);
10931 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_6), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
10932 __Pyx_GOTREF(__pyx_t_4);
10933 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10934 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
10935 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
10936 __Pyx_GIVEREF(__pyx_t_4);
10937 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
10939 __Pyx_INCREF(__pyx_kp_u__13);
10941 __Pyx_GIVEREF(__pyx_kp_u__13);
10942 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__13);
10944 /* "lxml/html/diff.py":477
10945 * def __repr__(self):
10946 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags,
10947 * self.post_tags, self.trailing_whitespace) # <<<<<<<<<<<<<<
10951 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
10952 __Pyx_GOTREF(__pyx_t_4);
10953 __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error)
10954 __Pyx_GOTREF(__pyx_t_6);
10955 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10956 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_3;
10957 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
10958 __Pyx_GIVEREF(__pyx_t_6);
10959 PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_6);
10961 __Pyx_INCREF(__pyx_kp_u__13);
10963 __Pyx_GIVEREF(__pyx_kp_u__13);
10964 PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__13);
10965 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error)
10966 __Pyx_GOTREF(__pyx_t_6);
10967 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_6), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
10968 __Pyx_GOTREF(__pyx_t_4);
10969 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10970 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
10971 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
10972 __Pyx_GIVEREF(__pyx_t_4);
10973 PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
10975 __Pyx_INCREF(__pyx_kp_u__14);
10977 __Pyx_GIVEREF(__pyx_kp_u__14);
10978 PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u__14);
10980 /* "lxml/html/diff.py":476
10982 * def __repr__(self):
10983 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags, # <<<<<<<<<<<<<<
10984 * self.post_tags, self.trailing_whitespace)
10987 __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
10988 __Pyx_GOTREF(__pyx_t_4);
10989 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10990 __pyx_r = __pyx_t_4;
10994 /* "lxml/html/diff.py":475
10997 * def __repr__(self): # <<<<<<<<<<<<<<
10998 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags,
10999 * self.post_tags, self.trailing_whitespace)
11002 /* function exit code */
11004 __Pyx_XDECREF(__pyx_t_1);
11005 __Pyx_XDECREF(__pyx_t_4);
11006 __Pyx_XDECREF(__pyx_t_5);
11007 __Pyx_XDECREF(__pyx_t_6);
11008 __Pyx_AddTraceback("lxml.html.diff.token.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11011 __Pyx_XGIVEREF(__pyx_r);
11012 __Pyx_RefNannyFinishContext();
11016 /* "lxml/html/diff.py":479
11017 * self.post_tags, self.trailing_whitespace)
11019 * def html(self): # <<<<<<<<<<<<<<
11020 * return _unicode(self)
11024 /* Python wrapper */
11025 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_5html(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
11026 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_5token_5html = {"html", (PyCFunction)__pyx_pw_4lxml_4html_4diff_5token_5html, METH_O, 0};
11027 static PyObject *__pyx_pw_4lxml_4html_4diff_5token_5html(PyObject *__pyx_self, PyObject *__pyx_v_self) {
11028 PyObject *__pyx_r = 0;
11029 __Pyx_RefNannyDeclarations
11030 __Pyx_RefNannySetupContext("html (wrapper)", 0);
11031 __pyx_r = __pyx_pf_4lxml_4html_4diff_5token_4html(__pyx_self, ((PyObject *)__pyx_v_self));
11033 /* function exit code */
11034 __Pyx_RefNannyFinishContext();
11038 static PyObject *__pyx_pf_4lxml_4html_4diff_5token_4html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11039 PyObject *__pyx_r = NULL;
11040 __Pyx_RefNannyDeclarations
11041 PyObject *__pyx_t_1 = NULL;
11042 PyObject *__pyx_t_2 = NULL;
11043 PyObject *__pyx_t_3 = NULL;
11044 int __pyx_lineno = 0;
11045 const char *__pyx_filename = NULL;
11046 int __pyx_clineno = 0;
11047 __Pyx_RefNannySetupContext("html", 0);
11049 /* "lxml/html/diff.py":480
11052 * return _unicode(self) # <<<<<<<<<<<<<<
11054 * class tag_token(token):
11056 __Pyx_XDECREF(__pyx_r);
11057 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
11058 __Pyx_GOTREF(__pyx_t_2);
11060 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11061 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11062 if (likely(__pyx_t_3)) {
11063 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11064 __Pyx_INCREF(__pyx_t_3);
11065 __Pyx_INCREF(function);
11066 __Pyx_DECREF_SET(__pyx_t_2, function);
11069 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self);
11070 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11071 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
11072 __Pyx_GOTREF(__pyx_t_1);
11073 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11074 __pyx_r = __pyx_t_1;
11078 /* "lxml/html/diff.py":479
11079 * self.post_tags, self.trailing_whitespace)
11081 * def html(self): # <<<<<<<<<<<<<<
11082 * return _unicode(self)
11086 /* function exit code */
11088 __Pyx_XDECREF(__pyx_t_1);
11089 __Pyx_XDECREF(__pyx_t_2);
11090 __Pyx_XDECREF(__pyx_t_3);
11091 __Pyx_AddTraceback("lxml.html.diff.token.html", __pyx_clineno, __pyx_lineno, __pyx_filename);
11094 __Pyx_XGIVEREF(__pyx_r);
11095 __Pyx_RefNannyFinishContext();
11099 /* "lxml/html/diff.py":488
11100 * is only represented in a document by a tag. """
11102 * def __new__(cls, tag, data, html_repr, pre_tags=None, # <<<<<<<<<<<<<<
11103 * post_tags=None, trailing_whitespace=""):
11104 * obj = token.__new__(cls, "%s: %s" % (type, data),
11107 /* Python wrapper */
11108 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11109 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_9tag_token_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_9tag_token_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
11110 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11111 PyObject *__pyx_v_cls = 0;
11112 PyObject *__pyx_v_tag = 0;
11113 PyObject *__pyx_v_data = 0;
11114 PyObject *__pyx_v_html_repr = 0;
11115 PyObject *__pyx_v_pre_tags = 0;
11116 PyObject *__pyx_v_post_tags = 0;
11117 PyObject *__pyx_v_trailing_whitespace = 0;
11118 int __pyx_lineno = 0;
11119 const char *__pyx_filename = NULL;
11120 int __pyx_clineno = 0;
11121 PyObject *__pyx_r = 0;
11122 __Pyx_RefNannyDeclarations
11123 __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
11125 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_tag,&__pyx_n_s_data,&__pyx_n_s_html_repr,&__pyx_n_s_pre_tags,&__pyx_n_s_post_tags,&__pyx_n_s_trailing_whitespace,0};
11126 PyObject* values[7] = {0,0,0,0,0,0,0};
11127 values[4] = ((PyObject *)((PyObject *)Py_None));
11129 /* "lxml/html/diff.py":489
11131 * def __new__(cls, tag, data, html_repr, pre_tags=None,
11132 * post_tags=None, trailing_whitespace=""): # <<<<<<<<<<<<<<
11133 * obj = token.__new__(cls, "%s: %s" % (type, data),
11134 * pre_tags=pre_tags,
11136 values[5] = ((PyObject *)((PyObject *)Py_None));
11137 values[6] = ((PyObject *)((PyObject*)__pyx_kp_u__2));
11138 if (unlikely(__pyx_kwds)) {
11139 Py_ssize_t kw_args;
11140 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11141 switch (pos_args) {
11142 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11143 CYTHON_FALLTHROUGH;
11144 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11145 CYTHON_FALLTHROUGH;
11146 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11147 CYTHON_FALLTHROUGH;
11148 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11149 CYTHON_FALLTHROUGH;
11150 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11151 CYTHON_FALLTHROUGH;
11152 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11153 CYTHON_FALLTHROUGH;
11154 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11155 CYTHON_FALLTHROUGH;
11157 default: goto __pyx_L5_argtuple_error;
11159 kw_args = PyDict_Size(__pyx_kwds);
11160 switch (pos_args) {
11162 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
11163 else goto __pyx_L5_argtuple_error;
11164 CYTHON_FALLTHROUGH;
11166 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tag)) != 0)) kw_args--;
11168 __Pyx_RaiseArgtupleInvalid("__new__", 0, 4, 7, 1); __PYX_ERR(0, 488, __pyx_L3_error)
11170 CYTHON_FALLTHROUGH;
11172 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
11174 __Pyx_RaiseArgtupleInvalid("__new__", 0, 4, 7, 2); __PYX_ERR(0, 488, __pyx_L3_error)
11176 CYTHON_FALLTHROUGH;
11178 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_html_repr)) != 0)) kw_args--;
11180 __Pyx_RaiseArgtupleInvalid("__new__", 0, 4, 7, 3); __PYX_ERR(0, 488, __pyx_L3_error)
11182 CYTHON_FALLTHROUGH;
11185 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_tags);
11186 if (value) { values[4] = value; kw_args--; }
11188 CYTHON_FALLTHROUGH;
11191 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_post_tags);
11192 if (value) { values[5] = value; kw_args--; }
11194 CYTHON_FALLTHROUGH;
11197 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trailing_whitespace);
11198 if (value) { values[6] = value; kw_args--; }
11201 if (unlikely(kw_args > 0)) {
11202 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 488, __pyx_L3_error)
11205 switch (PyTuple_GET_SIZE(__pyx_args)) {
11206 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11207 CYTHON_FALLTHROUGH;
11208 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11209 CYTHON_FALLTHROUGH;
11210 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11211 CYTHON_FALLTHROUGH;
11212 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11213 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11214 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11215 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11217 default: goto __pyx_L5_argtuple_error;
11220 __pyx_v_cls = values[0];
11221 __pyx_v_tag = values[1];
11222 __pyx_v_data = values[2];
11223 __pyx_v_html_repr = values[3];
11224 __pyx_v_pre_tags = values[4];
11225 __pyx_v_post_tags = values[5];
11226 __pyx_v_trailing_whitespace = values[6];
11228 goto __pyx_L4_argument_unpacking_done;
11229 __pyx_L5_argtuple_error:;
11230 __Pyx_RaiseArgtupleInvalid("__new__", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 488, __pyx_L3_error)
11232 __Pyx_AddTraceback("lxml.html.diff.tag_token.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11233 __Pyx_RefNannyFinishContext();
11235 __pyx_L4_argument_unpacking_done:;
11236 __pyx_r = __pyx_pf_4lxml_4html_4diff_9tag_token___new__(__pyx_self, __pyx_v_cls, __pyx_v_tag, __pyx_v_data, __pyx_v_html_repr, __pyx_v_pre_tags, __pyx_v_post_tags, __pyx_v_trailing_whitespace);
11238 /* "lxml/html/diff.py":488
11239 * is only represented in a document by a tag. """
11241 * def __new__(cls, tag, data, html_repr, pre_tags=None, # <<<<<<<<<<<<<<
11242 * post_tags=None, trailing_whitespace=""):
11243 * obj = token.__new__(cls, "%s: %s" % (type, data),
11246 /* function exit code */
11247 __Pyx_RefNannyFinishContext();
11251 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_tag, PyObject *__pyx_v_data, PyObject *__pyx_v_html_repr, PyObject *__pyx_v_pre_tags, PyObject *__pyx_v_post_tags, PyObject *__pyx_v_trailing_whitespace) {
11252 PyObject *__pyx_v_obj = NULL;
11253 PyObject *__pyx_r = NULL;
11254 __Pyx_RefNannyDeclarations
11255 PyObject *__pyx_t_1 = NULL;
11256 PyObject *__pyx_t_2 = NULL;
11257 Py_ssize_t __pyx_t_3;
11259 PyObject *__pyx_t_5 = NULL;
11260 PyObject *__pyx_t_6 = NULL;
11261 int __pyx_lineno = 0;
11262 const char *__pyx_filename = NULL;
11263 int __pyx_clineno = 0;
11264 __Pyx_RefNannySetupContext("__new__", 0);
11266 /* "lxml/html/diff.py":490
11267 * def __new__(cls, tag, data, html_repr, pre_tags=None,
11268 * post_tags=None, trailing_whitespace=""):
11269 * obj = token.__new__(cls, "%s: %s" % (type, data), # <<<<<<<<<<<<<<
11270 * pre_tags=pre_tags,
11271 * post_tags=post_tags,
11273 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
11274 __Pyx_GOTREF(__pyx_t_1);
11275 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
11276 __Pyx_GOTREF(__pyx_t_2);
11277 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11278 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
11279 __Pyx_GOTREF(__pyx_t_1);
11282 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(((PyObject *)(&PyType_Type))), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
11283 __Pyx_GOTREF(__pyx_t_5);
11284 __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
11285 __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
11286 __Pyx_GIVEREF(__pyx_t_5);
11287 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
11289 __Pyx_INCREF(__pyx_kp_u__15);
11291 __Pyx_GIVEREF(__pyx_kp_u__15);
11292 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__15);
11293 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_data), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
11294 __Pyx_GOTREF(__pyx_t_5);
11295 __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
11296 __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
11297 __Pyx_GIVEREF(__pyx_t_5);
11298 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
11300 __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
11301 __Pyx_GOTREF(__pyx_t_5);
11302 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11303 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
11304 __Pyx_GOTREF(__pyx_t_1);
11305 __Pyx_INCREF(__pyx_v_cls);
11306 __Pyx_GIVEREF(__pyx_v_cls);
11307 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_cls);
11308 __Pyx_GIVEREF(__pyx_t_5);
11309 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
11312 /* "lxml/html/diff.py":491
11313 * post_tags=None, trailing_whitespace=""):
11314 * obj = token.__new__(cls, "%s: %s" % (type, data),
11315 * pre_tags=pre_tags, # <<<<<<<<<<<<<<
11316 * post_tags=post_tags,
11317 * trailing_whitespace=trailing_whitespace)
11319 __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error)
11320 __Pyx_GOTREF(__pyx_t_5);
11321 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_pre_tags, __pyx_v_pre_tags) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
11323 /* "lxml/html/diff.py":492
11324 * obj = token.__new__(cls, "%s: %s" % (type, data),
11325 * pre_tags=pre_tags,
11326 * post_tags=post_tags, # <<<<<<<<<<<<<<
11327 * trailing_whitespace=trailing_whitespace)
11330 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_post_tags, __pyx_v_post_tags) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
11332 /* "lxml/html/diff.py":493
11333 * pre_tags=pre_tags,
11334 * post_tags=post_tags,
11335 * trailing_whitespace=trailing_whitespace) # <<<<<<<<<<<<<<
11339 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_trailing_whitespace, __pyx_v_trailing_whitespace) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
11341 /* "lxml/html/diff.py":490
11342 * def __new__(cls, tag, data, html_repr, pre_tags=None,
11343 * post_tags=None, trailing_whitespace=""):
11344 * obj = token.__new__(cls, "%s: %s" % (type, data), # <<<<<<<<<<<<<<
11345 * pre_tags=pre_tags,
11346 * post_tags=post_tags,
11348 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error)
11349 __Pyx_GOTREF(__pyx_t_6);
11350 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11351 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11352 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11353 __pyx_v_obj = __pyx_t_6;
11356 /* "lxml/html/diff.py":494
11357 * post_tags=post_tags,
11358 * trailing_whitespace=trailing_whitespace)
11359 * obj.tag = tag # <<<<<<<<<<<<<<
11361 * obj.html_repr = html_repr
11363 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_tag, __pyx_v_tag) < 0) __PYX_ERR(0, 494, __pyx_L1_error)
11365 /* "lxml/html/diff.py":495
11366 * trailing_whitespace=trailing_whitespace)
11368 * obj.data = data # <<<<<<<<<<<<<<
11369 * obj.html_repr = html_repr
11372 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_data, __pyx_v_data) < 0) __PYX_ERR(0, 495, __pyx_L1_error)
11374 /* "lxml/html/diff.py":496
11377 * obj.html_repr = html_repr # <<<<<<<<<<<<<<
11381 if (__Pyx_PyObject_SetAttrStr(__pyx_v_obj, __pyx_n_s_html_repr, __pyx_v_html_repr) < 0) __PYX_ERR(0, 496, __pyx_L1_error)
11383 /* "lxml/html/diff.py":497
11385 * obj.html_repr = html_repr
11386 * return obj # <<<<<<<<<<<<<<
11388 * def __repr__(self):
11390 __Pyx_XDECREF(__pyx_r);
11391 __Pyx_INCREF(__pyx_v_obj);
11392 __pyx_r = __pyx_v_obj;
11395 /* "lxml/html/diff.py":488
11396 * is only represented in a document by a tag. """
11398 * def __new__(cls, tag, data, html_repr, pre_tags=None, # <<<<<<<<<<<<<<
11399 * post_tags=None, trailing_whitespace=""):
11400 * obj = token.__new__(cls, "%s: %s" % (type, data),
11403 /* function exit code */
11405 __Pyx_XDECREF(__pyx_t_1);
11406 __Pyx_XDECREF(__pyx_t_2);
11407 __Pyx_XDECREF(__pyx_t_5);
11408 __Pyx_XDECREF(__pyx_t_6);
11409 __Pyx_AddTraceback("lxml.html.diff.tag_token.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11412 __Pyx_XDECREF(__pyx_v_obj);
11413 __Pyx_XGIVEREF(__pyx_r);
11414 __Pyx_RefNannyFinishContext();
11418 /* "lxml/html/diff.py":499
11421 * def __repr__(self): # <<<<<<<<<<<<<<
11422 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
11426 /* Python wrapper */
11427 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
11428 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_9tag_token_3__repr__ = {"__repr__", (PyCFunction)__pyx_pw_4lxml_4html_4diff_9tag_token_3__repr__, METH_O, 0};
11429 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
11430 PyObject *__pyx_r = 0;
11431 __Pyx_RefNannyDeclarations
11432 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
11433 __pyx_r = __pyx_pf_4lxml_4html_4diff_9tag_token_2__repr__(__pyx_self, ((PyObject *)__pyx_v_self));
11435 /* function exit code */
11436 __Pyx_RefNannyFinishContext();
11440 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11441 PyObject *__pyx_r = NULL;
11442 __Pyx_RefNannyDeclarations
11443 PyObject *__pyx_t_1 = NULL;
11444 Py_ssize_t __pyx_t_2;
11446 PyObject *__pyx_t_4 = NULL;
11447 PyObject *__pyx_t_5 = NULL;
11448 int __pyx_lineno = 0;
11449 const char *__pyx_filename = NULL;
11450 int __pyx_clineno = 0;
11451 __Pyx_RefNannySetupContext("__repr__", 0);
11453 /* "lxml/html/diff.py":500
11455 * def __repr__(self):
11456 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % ( # <<<<<<<<<<<<<<
11460 __Pyx_XDECREF(__pyx_r);
11461 __pyx_t_1 = PyTuple_New(13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
11462 __Pyx_GOTREF(__pyx_t_1);
11465 __Pyx_INCREF(__pyx_kp_u_tag_token);
11467 __Pyx_GIVEREF(__pyx_kp_u_tag_token);
11468 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_tag_token);
11470 /* "lxml/html/diff.py":501
11471 * def __repr__(self):
11472 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
11473 * self.tag, # <<<<<<<<<<<<<<
11477 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error)
11478 __Pyx_GOTREF(__pyx_t_4);
11479 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error)
11480 __Pyx_GOTREF(__pyx_t_5);
11481 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11482 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
11483 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
11484 __Pyx_GIVEREF(__pyx_t_5);
11485 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
11487 __Pyx_INCREF(__pyx_kp_u__13);
11489 __Pyx_GIVEREF(__pyx_kp_u__13);
11490 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__13);
11492 /* "lxml/html/diff.py":502
11493 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
11495 * self.data, # <<<<<<<<<<<<<<
11499 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error)
11500 __Pyx_GOTREF(__pyx_t_5);
11501 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error)
11502 __Pyx_GOTREF(__pyx_t_4);
11503 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11504 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
11505 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
11506 __Pyx_GIVEREF(__pyx_t_4);
11507 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
11509 __Pyx_INCREF(__pyx_kp_u_html_repr_2);
11511 __Pyx_GIVEREF(__pyx_kp_u_html_repr_2);
11512 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_html_repr_2);
11514 /* "lxml/html/diff.py":503
11517 * self.html_repr, # <<<<<<<<<<<<<<
11521 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_html_repr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
11522 __Pyx_GOTREF(__pyx_t_4);
11523 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __pyx_L1_error)
11524 __Pyx_GOTREF(__pyx_t_5);
11525 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11526 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
11527 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
11528 __Pyx_GIVEREF(__pyx_t_5);
11529 PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
11531 __Pyx_INCREF(__pyx_kp_u_post_tags_2);
11533 __Pyx_GIVEREF(__pyx_kp_u_post_tags_2);
11534 PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_post_tags_2);
11536 /* "lxml/html/diff.py":504
11539 * self.pre_tags, # <<<<<<<<<<<<<<
11541 * self.trailing_whitespace)
11543 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pre_tags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error)
11544 __Pyx_GOTREF(__pyx_t_5);
11545 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
11546 __Pyx_GOTREF(__pyx_t_4);
11547 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11548 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
11549 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
11550 __Pyx_GIVEREF(__pyx_t_4);
11551 PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
11553 __Pyx_INCREF(__pyx_kp_u_pre_tags_2);
11555 __Pyx_GIVEREF(__pyx_kp_u_pre_tags_2);
11556 PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u_pre_tags_2);
11558 /* "lxml/html/diff.py":505
11561 * self.post_tags, # <<<<<<<<<<<<<<
11562 * self.trailing_whitespace)
11565 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
11566 __Pyx_GOTREF(__pyx_t_4);
11567 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 505, __pyx_L1_error)
11568 __Pyx_GOTREF(__pyx_t_5);
11569 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11570 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
11571 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
11572 __Pyx_GIVEREF(__pyx_t_5);
11573 PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_t_5);
11575 __Pyx_INCREF(__pyx_kp_u_trailing_whitespace_2);
11577 __Pyx_GIVEREF(__pyx_kp_u_trailing_whitespace_2);
11578 PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_kp_u_trailing_whitespace_2);
11580 /* "lxml/html/diff.py":506
11583 * self.trailing_whitespace) # <<<<<<<<<<<<<<
11585 * return self.html_repr
11587 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_trailing_whitespace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 506, __pyx_L1_error)
11588 __Pyx_GOTREF(__pyx_t_5);
11589 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error)
11590 __Pyx_GOTREF(__pyx_t_4);
11591 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11592 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
11593 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
11594 __Pyx_GIVEREF(__pyx_t_4);
11595 PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_t_4);
11597 __Pyx_INCREF(__pyx_kp_u__14);
11599 __Pyx_GIVEREF(__pyx_kp_u__14);
11600 PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_kp_u__14);
11602 /* "lxml/html/diff.py":500
11604 * def __repr__(self):
11605 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % ( # <<<<<<<<<<<<<<
11609 __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 13, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 500, __pyx_L1_error)
11610 __Pyx_GOTREF(__pyx_t_4);
11611 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11612 __pyx_r = __pyx_t_4;
11616 /* "lxml/html/diff.py":499
11619 * def __repr__(self): # <<<<<<<<<<<<<<
11620 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
11624 /* function exit code */
11626 __Pyx_XDECREF(__pyx_t_1);
11627 __Pyx_XDECREF(__pyx_t_4);
11628 __Pyx_XDECREF(__pyx_t_5);
11629 __Pyx_AddTraceback("lxml.html.diff.tag_token.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11632 __Pyx_XGIVEREF(__pyx_r);
11633 __Pyx_RefNannyFinishContext();
11637 /* "lxml/html/diff.py":507
11639 * self.trailing_whitespace)
11640 * def html(self): # <<<<<<<<<<<<<<
11641 * return self.html_repr
11645 /* Python wrapper */
11646 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_5html(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
11647 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_9tag_token_5html = {"html", (PyCFunction)__pyx_pw_4lxml_4html_4diff_9tag_token_5html, METH_O, 0};
11648 static PyObject *__pyx_pw_4lxml_4html_4diff_9tag_token_5html(PyObject *__pyx_self, PyObject *__pyx_v_self) {
11649 PyObject *__pyx_r = 0;
11650 __Pyx_RefNannyDeclarations
11651 __Pyx_RefNannySetupContext("html (wrapper)", 0);
11652 __pyx_r = __pyx_pf_4lxml_4html_4diff_9tag_token_4html(__pyx_self, ((PyObject *)__pyx_v_self));
11654 /* function exit code */
11655 __Pyx_RefNannyFinishContext();
11659 static PyObject *__pyx_pf_4lxml_4html_4diff_9tag_token_4html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11660 PyObject *__pyx_r = NULL;
11661 __Pyx_RefNannyDeclarations
11662 PyObject *__pyx_t_1 = NULL;
11663 int __pyx_lineno = 0;
11664 const char *__pyx_filename = NULL;
11665 int __pyx_clineno = 0;
11666 __Pyx_RefNannySetupContext("html", 0);
11668 /* "lxml/html/diff.py":508
11669 * self.trailing_whitespace)
11671 * return self.html_repr # <<<<<<<<<<<<<<
11673 * class href_token(token):
11675 __Pyx_XDECREF(__pyx_r);
11676 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_html_repr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
11677 __Pyx_GOTREF(__pyx_t_1);
11678 __pyx_r = __pyx_t_1;
11682 /* "lxml/html/diff.py":507
11684 * self.trailing_whitespace)
11685 * def html(self): # <<<<<<<<<<<<<<
11686 * return self.html_repr
11690 /* function exit code */
11692 __Pyx_XDECREF(__pyx_t_1);
11693 __Pyx_AddTraceback("lxml.html.diff.tag_token.html", __pyx_clineno, __pyx_lineno, __pyx_filename);
11696 __Pyx_XGIVEREF(__pyx_r);
11697 __Pyx_RefNannyFinishContext();
11701 /* "lxml/html/diff.py":517
11702 * hide_when_equal = True
11704 * def html(self): # <<<<<<<<<<<<<<
11705 * return ' Link: %s' % self
11709 /* Python wrapper */
11710 static PyObject *__pyx_pw_4lxml_4html_4diff_10href_token_1html(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
11711 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_10href_token_1html = {"html", (PyCFunction)__pyx_pw_4lxml_4html_4diff_10href_token_1html, METH_O, 0};
11712 static PyObject *__pyx_pw_4lxml_4html_4diff_10href_token_1html(PyObject *__pyx_self, PyObject *__pyx_v_self) {
11713 PyObject *__pyx_r = 0;
11714 __Pyx_RefNannyDeclarations
11715 __Pyx_RefNannySetupContext("html (wrapper)", 0);
11716 __pyx_r = __pyx_pf_4lxml_4html_4diff_10href_token_html(__pyx_self, ((PyObject *)__pyx_v_self));
11718 /* function exit code */
11719 __Pyx_RefNannyFinishContext();
11723 static PyObject *__pyx_pf_4lxml_4html_4diff_10href_token_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11724 PyObject *__pyx_r = NULL;
11725 __Pyx_RefNannyDeclarations
11726 PyObject *__pyx_t_1 = NULL;
11727 int __pyx_lineno = 0;
11728 const char *__pyx_filename = NULL;
11729 int __pyx_clineno = 0;
11730 __Pyx_RefNannySetupContext("html", 0);
11732 /* "lxml/html/diff.py":518
11735 * return ' Link: %s' % self # <<<<<<<<<<<<<<
11737 * def tokenize(html, include_hrefs=True):
11739 __Pyx_XDECREF(__pyx_r);
11740 __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Link_s, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error)
11741 __Pyx_GOTREF(__pyx_t_1);
11742 __pyx_r = __pyx_t_1;
11746 /* "lxml/html/diff.py":517
11747 * hide_when_equal = True
11749 * def html(self): # <<<<<<<<<<<<<<
11750 * return ' Link: %s' % self
11754 /* function exit code */
11756 __Pyx_XDECREF(__pyx_t_1);
11757 __Pyx_AddTraceback("lxml.html.diff.href_token.html", __pyx_clineno, __pyx_lineno, __pyx_filename);
11760 __Pyx_XGIVEREF(__pyx_r);
11761 __Pyx_RefNannyFinishContext();
11765 /* "lxml/html/diff.py":520
11766 * return ' Link: %s' % self
11768 * def tokenize(html, include_hrefs=True): # <<<<<<<<<<<<<<
11770 * Parse the given HTML and returns token objects (words with attached tags).
11773 /* Python wrapper */
11774 static PyObject *__pyx_pw_4lxml_4html_4diff_39tokenize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11775 static char __pyx_doc_4lxml_4html_4diff_38tokenize[] = "\n Parse the given HTML and returns token objects (words with attached tags).\n\n This parses only the content of a page; anything in the head is\n ignored, and the <head> and <body> elements are themselves\n optional. The content is then parsed by lxml, which ensures the\n validity of the resulting parsed document (though lxml may make\n incorrect guesses when the markup is particular bad).\n\n <ins> and <del> tags are also eliminated from the document, as\n that gets confusing.\n\n If include_hrefs is true, then the href attribute of <a> tags is\n included as a special kind of diffable token.";
11776 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_39tokenize = {"tokenize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_39tokenize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_38tokenize};
11777 static PyObject *__pyx_pw_4lxml_4html_4diff_39tokenize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11778 PyObject *__pyx_v_html = 0;
11779 PyObject *__pyx_v_include_hrefs = 0;
11780 int __pyx_lineno = 0;
11781 const char *__pyx_filename = NULL;
11782 int __pyx_clineno = 0;
11783 PyObject *__pyx_r = 0;
11784 __Pyx_RefNannyDeclarations
11785 __Pyx_RefNannySetupContext("tokenize (wrapper)", 0);
11787 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_html,&__pyx_n_s_include_hrefs,0};
11788 PyObject* values[2] = {0,0};
11789 values[1] = ((PyObject *)((PyObject *)Py_True));
11790 if (unlikely(__pyx_kwds)) {
11791 Py_ssize_t kw_args;
11792 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11793 switch (pos_args) {
11794 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11795 CYTHON_FALLTHROUGH;
11796 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11797 CYTHON_FALLTHROUGH;
11799 default: goto __pyx_L5_argtuple_error;
11801 kw_args = PyDict_Size(__pyx_kwds);
11802 switch (pos_args) {
11804 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_html)) != 0)) kw_args--;
11805 else goto __pyx_L5_argtuple_error;
11806 CYTHON_FALLTHROUGH;
11809 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_hrefs);
11810 if (value) { values[1] = value; kw_args--; }
11813 if (unlikely(kw_args > 0)) {
11814 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tokenize") < 0)) __PYX_ERR(0, 520, __pyx_L3_error)
11817 switch (PyTuple_GET_SIZE(__pyx_args)) {
11818 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11819 CYTHON_FALLTHROUGH;
11820 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11822 default: goto __pyx_L5_argtuple_error;
11825 __pyx_v_html = values[0];
11826 __pyx_v_include_hrefs = values[1];
11828 goto __pyx_L4_argument_unpacking_done;
11829 __pyx_L5_argtuple_error:;
11830 __Pyx_RaiseArgtupleInvalid("tokenize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 520, __pyx_L3_error)
11832 __Pyx_AddTraceback("lxml.html.diff.tokenize", __pyx_clineno, __pyx_lineno, __pyx_filename);
11833 __Pyx_RefNannyFinishContext();
11835 __pyx_L4_argument_unpacking_done:;
11836 __pyx_r = __pyx_pf_4lxml_4html_4diff_38tokenize(__pyx_self, __pyx_v_html, __pyx_v_include_hrefs);
11838 /* function exit code */
11839 __Pyx_RefNannyFinishContext();
11843 static PyObject *__pyx_pf_4lxml_4html_4diff_38tokenize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html, PyObject *__pyx_v_include_hrefs) {
11844 PyObject *__pyx_v_body_el = NULL;
11845 PyObject *__pyx_v_chunks = NULL;
11846 PyObject *__pyx_r = NULL;
11847 __Pyx_RefNannyDeclarations
11848 PyObject *__pyx_t_1 = NULL;
11849 PyObject *__pyx_t_2 = NULL;
11850 PyObject *__pyx_t_3 = NULL;
11852 PyObject *__pyx_t_5 = NULL;
11853 int __pyx_lineno = 0;
11854 const char *__pyx_filename = NULL;
11855 int __pyx_clineno = 0;
11856 __Pyx_RefNannySetupContext("tokenize", 0);
11858 /* "lxml/html/diff.py":535
11859 * If include_hrefs is true, then the href attribute of <a> tags is
11860 * included as a special kind of diffable token."""
11861 * if etree.iselement(html): # <<<<<<<<<<<<<<
11865 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_etree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
11866 __Pyx_GOTREF(__pyx_t_2);
11867 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_iselement); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
11868 __Pyx_GOTREF(__pyx_t_3);
11869 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11871 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11872 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
11873 if (likely(__pyx_t_2)) {
11874 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11875 __Pyx_INCREF(__pyx_t_2);
11876 __Pyx_INCREF(function);
11877 __Pyx_DECREF_SET(__pyx_t_3, function);
11880 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_html) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_html);
11881 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11882 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
11883 __Pyx_GOTREF(__pyx_t_1);
11884 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11885 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 535, __pyx_L1_error)
11886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11889 /* "lxml/html/diff.py":536
11890 * included as a special kind of diffable token."""
11891 * if etree.iselement(html):
11892 * body_el = html # <<<<<<<<<<<<<<
11894 * body_el = parse_html(html, cleanup=True)
11896 __Pyx_INCREF(__pyx_v_html);
11897 __pyx_v_body_el = __pyx_v_html;
11899 /* "lxml/html/diff.py":535
11900 * If include_hrefs is true, then the href attribute of <a> tags is
11901 * included as a special kind of diffable token."""
11902 * if etree.iselement(html): # <<<<<<<<<<<<<<
11909 /* "lxml/html/diff.py":538
11912 * body_el = parse_html(html, cleanup=True) # <<<<<<<<<<<<<<
11913 * # Then we split the document into text chunks for each tag, word, and end tag:
11914 * chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs)
11917 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_parse_html); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
11918 __Pyx_GOTREF(__pyx_t_1);
11919 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error)
11920 __Pyx_GOTREF(__pyx_t_3);
11921 __Pyx_INCREF(__pyx_v_html);
11922 __Pyx_GIVEREF(__pyx_v_html);
11923 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_html);
11924 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
11925 __Pyx_GOTREF(__pyx_t_2);
11926 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cleanup, Py_True) < 0) __PYX_ERR(0, 538, __pyx_L1_error)
11927 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
11928 __Pyx_GOTREF(__pyx_t_5);
11929 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11930 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11931 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11932 __pyx_v_body_el = __pyx_t_5;
11937 /* "lxml/html/diff.py":540
11938 * body_el = parse_html(html, cleanup=True)
11939 * # Then we split the document into text chunks for each tag, word, and end tag:
11940 * chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs) # <<<<<<<<<<<<<<
11941 * # Finally re-joining them into token objects:
11942 * return fixup_chunks(chunks)
11944 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_flatten_el); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
11945 __Pyx_GOTREF(__pyx_t_5);
11946 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error)
11947 __Pyx_GOTREF(__pyx_t_2);
11948 __Pyx_INCREF(__pyx_v_body_el);
11949 __Pyx_GIVEREF(__pyx_v_body_el);
11950 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_body_el);
11951 __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error)
11952 __Pyx_GOTREF(__pyx_t_3);
11953 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_skip_tag, Py_True) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
11954 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_include_hrefs, __pyx_v_include_hrefs) < 0) __PYX_ERR(0, 540, __pyx_L1_error)
11955 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
11956 __Pyx_GOTREF(__pyx_t_1);
11957 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11958 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11959 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11960 __pyx_v_chunks = __pyx_t_1;
11963 /* "lxml/html/diff.py":542
11964 * chunks = flatten_el(body_el, skip_tag=True, include_hrefs=include_hrefs)
11965 * # Finally re-joining them into token objects:
11966 * return fixup_chunks(chunks) # <<<<<<<<<<<<<<
11968 * def parse_html(html, cleanup=True):
11970 __Pyx_XDECREF(__pyx_r);
11971 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_fixup_chunks); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
11972 __Pyx_GOTREF(__pyx_t_3);
11974 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11975 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
11976 if (likely(__pyx_t_2)) {
11977 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11978 __Pyx_INCREF(__pyx_t_2);
11979 __Pyx_INCREF(function);
11980 __Pyx_DECREF_SET(__pyx_t_3, function);
11983 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_chunks) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_chunks);
11984 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11985 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
11986 __Pyx_GOTREF(__pyx_t_1);
11987 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11988 __pyx_r = __pyx_t_1;
11992 /* "lxml/html/diff.py":520
11993 * return ' Link: %s' % self
11995 * def tokenize(html, include_hrefs=True): # <<<<<<<<<<<<<<
11997 * Parse the given HTML and returns token objects (words with attached tags).
12000 /* function exit code */
12002 __Pyx_XDECREF(__pyx_t_1);
12003 __Pyx_XDECREF(__pyx_t_2);
12004 __Pyx_XDECREF(__pyx_t_3);
12005 __Pyx_XDECREF(__pyx_t_5);
12006 __Pyx_AddTraceback("lxml.html.diff.tokenize", __pyx_clineno, __pyx_lineno, __pyx_filename);
12009 __Pyx_XDECREF(__pyx_v_body_el);
12010 __Pyx_XDECREF(__pyx_v_chunks);
12011 __Pyx_XGIVEREF(__pyx_r);
12012 __Pyx_RefNannyFinishContext();
12016 /* "lxml/html/diff.py":544
12017 * return fixup_chunks(chunks)
12019 * def parse_html(html, cleanup=True): # <<<<<<<<<<<<<<
12021 * Parses an HTML fragment, returning an lxml element. Note that the HTML will be
12024 /* Python wrapper */
12025 static PyObject *__pyx_pw_4lxml_4html_4diff_41parse_html(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12026 static char __pyx_doc_4lxml_4html_4diff_40parse_html[] = "\n Parses an HTML fragment, returning an lxml element. Note that the HTML will be\n wrapped in a <div> tag that was not in the original document.\n\n If cleanup is true, make sure there's no <head> or <body>, and get\n rid of any <ins> and <del> tags.\n ";
12027 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_41parse_html = {"parse_html", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_41parse_html, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_40parse_html};
12028 static PyObject *__pyx_pw_4lxml_4html_4diff_41parse_html(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12029 PyObject *__pyx_v_html = 0;
12030 PyObject *__pyx_v_cleanup = 0;
12031 int __pyx_lineno = 0;
12032 const char *__pyx_filename = NULL;
12033 int __pyx_clineno = 0;
12034 PyObject *__pyx_r = 0;
12035 __Pyx_RefNannyDeclarations
12036 __Pyx_RefNannySetupContext("parse_html (wrapper)", 0);
12038 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_html,&__pyx_n_s_cleanup,0};
12039 PyObject* values[2] = {0,0};
12040 values[1] = ((PyObject *)((PyObject *)Py_True));
12041 if (unlikely(__pyx_kwds)) {
12042 Py_ssize_t kw_args;
12043 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12044 switch (pos_args) {
12045 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12046 CYTHON_FALLTHROUGH;
12047 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12048 CYTHON_FALLTHROUGH;
12050 default: goto __pyx_L5_argtuple_error;
12052 kw_args = PyDict_Size(__pyx_kwds);
12053 switch (pos_args) {
12055 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_html)) != 0)) kw_args--;
12056 else goto __pyx_L5_argtuple_error;
12057 CYTHON_FALLTHROUGH;
12060 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cleanup);
12061 if (value) { values[1] = value; kw_args--; }
12064 if (unlikely(kw_args > 0)) {
12065 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parse_html") < 0)) __PYX_ERR(0, 544, __pyx_L3_error)
12068 switch (PyTuple_GET_SIZE(__pyx_args)) {
12069 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12070 CYTHON_FALLTHROUGH;
12071 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12073 default: goto __pyx_L5_argtuple_error;
12076 __pyx_v_html = values[0];
12077 __pyx_v_cleanup = values[1];
12079 goto __pyx_L4_argument_unpacking_done;
12080 __pyx_L5_argtuple_error:;
12081 __Pyx_RaiseArgtupleInvalid("parse_html", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 544, __pyx_L3_error)
12083 __Pyx_AddTraceback("lxml.html.diff.parse_html", __pyx_clineno, __pyx_lineno, __pyx_filename);
12084 __Pyx_RefNannyFinishContext();
12086 __pyx_L4_argument_unpacking_done:;
12087 __pyx_r = __pyx_pf_4lxml_4html_4diff_40parse_html(__pyx_self, __pyx_v_html, __pyx_v_cleanup);
12089 /* function exit code */
12090 __Pyx_RefNannyFinishContext();
12094 static PyObject *__pyx_pf_4lxml_4html_4diff_40parse_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html, PyObject *__pyx_v_cleanup) {
12095 PyObject *__pyx_r = NULL;
12096 __Pyx_RefNannyDeclarations
12098 PyObject *__pyx_t_2 = NULL;
12099 PyObject *__pyx_t_3 = NULL;
12100 PyObject *__pyx_t_4 = NULL;
12101 PyObject *__pyx_t_5 = NULL;
12102 int __pyx_lineno = 0;
12103 const char *__pyx_filename = NULL;
12104 int __pyx_clineno = 0;
12105 __Pyx_RefNannySetupContext("parse_html", 0);
12106 __Pyx_INCREF(__pyx_v_html);
12108 /* "lxml/html/diff.py":552
12109 * rid of any <ins> and <del> tags.
12111 * if cleanup: # <<<<<<<<<<<<<<
12112 * # This removes any extra markup or structure like <head>:
12113 * html = cleanup_html(html)
12115 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cleanup); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 552, __pyx_L1_error)
12118 /* "lxml/html/diff.py":554
12120 * # This removes any extra markup or structure like <head>:
12121 * html = cleanup_html(html) # <<<<<<<<<<<<<<
12122 * return fragment_fromstring(html, create_parent=True)
12125 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cleanup_html); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error)
12126 __Pyx_GOTREF(__pyx_t_3);
12128 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
12129 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
12130 if (likely(__pyx_t_4)) {
12131 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12132 __Pyx_INCREF(__pyx_t_4);
12133 __Pyx_INCREF(function);
12134 __Pyx_DECREF_SET(__pyx_t_3, function);
12137 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_html) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_html);
12138 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12139 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error)
12140 __Pyx_GOTREF(__pyx_t_2);
12141 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12142 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_2);
12145 /* "lxml/html/diff.py":552
12146 * rid of any <ins> and <del> tags.
12148 * if cleanup: # <<<<<<<<<<<<<<
12149 * # This removes any extra markup or structure like <head>:
12150 * html = cleanup_html(html)
12154 /* "lxml/html/diff.py":555
12155 * # This removes any extra markup or structure like <head>:
12156 * html = cleanup_html(html)
12157 * return fragment_fromstring(html, create_parent=True) # <<<<<<<<<<<<<<
12159 * _body_re = re.compile(r'<body.*?>', re.I|re.S)
12161 __Pyx_XDECREF(__pyx_r);
12162 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_fragment_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error)
12163 __Pyx_GOTREF(__pyx_t_2);
12164 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error)
12165 __Pyx_GOTREF(__pyx_t_3);
12166 __Pyx_INCREF(__pyx_v_html);
12167 __Pyx_GIVEREF(__pyx_v_html);
12168 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_html);
12169 __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error)
12170 __Pyx_GOTREF(__pyx_t_4);
12171 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_create_parent, Py_True) < 0) __PYX_ERR(0, 555, __pyx_L1_error)
12172 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error)
12173 __Pyx_GOTREF(__pyx_t_5);
12174 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12175 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12176 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12177 __pyx_r = __pyx_t_5;
12181 /* "lxml/html/diff.py":544
12182 * return fixup_chunks(chunks)
12184 * def parse_html(html, cleanup=True): # <<<<<<<<<<<<<<
12186 * Parses an HTML fragment, returning an lxml element. Note that the HTML will be
12189 /* function exit code */
12191 __Pyx_XDECREF(__pyx_t_2);
12192 __Pyx_XDECREF(__pyx_t_3);
12193 __Pyx_XDECREF(__pyx_t_4);
12194 __Pyx_XDECREF(__pyx_t_5);
12195 __Pyx_AddTraceback("lxml.html.diff.parse_html", __pyx_clineno, __pyx_lineno, __pyx_filename);
12198 __Pyx_XDECREF(__pyx_v_html);
12199 __Pyx_XGIVEREF(__pyx_r);
12200 __Pyx_RefNannyFinishContext();
12204 /* "lxml/html/diff.py":561
12205 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
12207 * def cleanup_html(html): # <<<<<<<<<<<<<<
12208 * """ This 'cleans' the HTML, meaning that any page structure is removed
12209 * (only the contents of <body> are used, if there is any <body).
12212 /* Python wrapper */
12213 static PyObject *__pyx_pw_4lxml_4html_4diff_43cleanup_html(PyObject *__pyx_self, PyObject *__pyx_v_html); /*proto*/
12214 static char __pyx_doc_4lxml_4html_4diff_42cleanup_html[] = " This 'cleans' the HTML, meaning that any page structure is removed\n (only the contents of <body> are used, if there is any <body).\n Also <ins> and <del> tags are removed. ";
12215 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_43cleanup_html = {"cleanup_html", (PyCFunction)__pyx_pw_4lxml_4html_4diff_43cleanup_html, METH_O, __pyx_doc_4lxml_4html_4diff_42cleanup_html};
12216 static PyObject *__pyx_pw_4lxml_4html_4diff_43cleanup_html(PyObject *__pyx_self, PyObject *__pyx_v_html) {
12217 PyObject *__pyx_r = 0;
12218 __Pyx_RefNannyDeclarations
12219 __Pyx_RefNannySetupContext("cleanup_html (wrapper)", 0);
12220 __pyx_r = __pyx_pf_4lxml_4html_4diff_42cleanup_html(__pyx_self, ((PyObject *)__pyx_v_html));
12222 /* function exit code */
12223 __Pyx_RefNannyFinishContext();
12227 static PyObject *__pyx_pf_4lxml_4html_4diff_42cleanup_html(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html) {
12228 PyObject *__pyx_v_match = NULL;
12229 PyObject *__pyx_r = NULL;
12230 __Pyx_RefNannyDeclarations
12231 PyObject *__pyx_t_1 = NULL;
12232 PyObject *__pyx_t_2 = NULL;
12233 PyObject *__pyx_t_3 = NULL;
12236 PyObject *__pyx_t_6 = NULL;
12237 int __pyx_lineno = 0;
12238 const char *__pyx_filename = NULL;
12239 int __pyx_clineno = 0;
12240 __Pyx_RefNannySetupContext("cleanup_html", 0);
12241 __Pyx_INCREF(__pyx_v_html);
12243 /* "lxml/html/diff.py":565
12244 * (only the contents of <body> are used, if there is any <body).
12245 * Also <ins> and <del> tags are removed. """
12246 * match = _body_re.search(html) # <<<<<<<<<<<<<<
12248 * html = html[match.end():]
12250 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_body_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
12251 __Pyx_GOTREF(__pyx_t_2);
12252 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
12253 __Pyx_GOTREF(__pyx_t_3);
12254 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12256 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
12257 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
12258 if (likely(__pyx_t_2)) {
12259 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12260 __Pyx_INCREF(__pyx_t_2);
12261 __Pyx_INCREF(function);
12262 __Pyx_DECREF_SET(__pyx_t_3, function);
12265 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_html) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_html);
12266 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12267 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
12268 __Pyx_GOTREF(__pyx_t_1);
12269 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12270 __pyx_v_match = __pyx_t_1;
12273 /* "lxml/html/diff.py":566
12274 * Also <ins> and <del> tags are removed. """
12275 * match = _body_re.search(html)
12276 * if match: # <<<<<<<<<<<<<<
12277 * html = html[match.end():]
12278 * match = _end_body_re.search(html)
12280 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_match); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 566, __pyx_L1_error)
12283 /* "lxml/html/diff.py":567
12284 * match = _body_re.search(html)
12286 * html = html[match.end():] # <<<<<<<<<<<<<<
12287 * match = _end_body_re.search(html)
12290 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
12291 __Pyx_GOTREF(__pyx_t_3);
12293 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
12294 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
12295 if (likely(__pyx_t_2)) {
12296 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12297 __Pyx_INCREF(__pyx_t_2);
12298 __Pyx_INCREF(function);
12299 __Pyx_DECREF_SET(__pyx_t_3, function);
12302 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
12303 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12304 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
12305 __Pyx_GOTREF(__pyx_t_1);
12306 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12307 __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_html, 0, 0, &__pyx_t_1, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
12308 __Pyx_GOTREF(__pyx_t_3);
12309 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12310 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_3);
12313 /* "lxml/html/diff.py":566
12314 * Also <ins> and <del> tags are removed. """
12315 * match = _body_re.search(html)
12316 * if match: # <<<<<<<<<<<<<<
12317 * html = html[match.end():]
12318 * match = _end_body_re.search(html)
12322 /* "lxml/html/diff.py":568
12324 * html = html[match.end():]
12325 * match = _end_body_re.search(html) # <<<<<<<<<<<<<<
12327 * html = html[:match.start()]
12329 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_end_body_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
12330 __Pyx_GOTREF(__pyx_t_1);
12331 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error)
12332 __Pyx_GOTREF(__pyx_t_2);
12333 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12335 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
12336 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12337 if (likely(__pyx_t_1)) {
12338 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12339 __Pyx_INCREF(__pyx_t_1);
12340 __Pyx_INCREF(function);
12341 __Pyx_DECREF_SET(__pyx_t_2, function);
12344 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_html) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_html);
12345 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12346 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error)
12347 __Pyx_GOTREF(__pyx_t_3);
12348 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12349 __Pyx_DECREF_SET(__pyx_v_match, __pyx_t_3);
12352 /* "lxml/html/diff.py":569
12353 * html = html[match.end():]
12354 * match = _end_body_re.search(html)
12355 * if match: # <<<<<<<<<<<<<<
12356 * html = html[:match.start()]
12357 * html = _ins_del_re.sub('', html)
12359 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_match); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 569, __pyx_L1_error)
12362 /* "lxml/html/diff.py":570
12363 * match = _end_body_re.search(html)
12365 * html = html[:match.start()] # <<<<<<<<<<<<<<
12366 * html = _ins_del_re.sub('', html)
12369 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
12370 __Pyx_GOTREF(__pyx_t_2);
12372 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12373 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12374 if (likely(__pyx_t_1)) {
12375 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12376 __Pyx_INCREF(__pyx_t_1);
12377 __Pyx_INCREF(function);
12378 __Pyx_DECREF_SET(__pyx_t_2, function);
12381 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12382 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12383 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
12384 __Pyx_GOTREF(__pyx_t_3);
12385 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12386 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_html, 0, 0, NULL, &__pyx_t_3, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
12387 __Pyx_GOTREF(__pyx_t_2);
12388 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12389 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_2);
12392 /* "lxml/html/diff.py":569
12393 * html = html[match.end():]
12394 * match = _end_body_re.search(html)
12395 * if match: # <<<<<<<<<<<<<<
12396 * html = html[:match.start()]
12397 * html = _ins_del_re.sub('', html)
12401 /* "lxml/html/diff.py":571
12403 * html = html[:match.start()]
12404 * html = _ins_del_re.sub('', html) # <<<<<<<<<<<<<<
12408 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ins_del_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error)
12409 __Pyx_GOTREF(__pyx_t_3);
12410 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sub); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
12411 __Pyx_GOTREF(__pyx_t_1);
12412 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12415 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12416 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
12417 if (likely(__pyx_t_3)) {
12418 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12419 __Pyx_INCREF(__pyx_t_3);
12420 __Pyx_INCREF(function);
12421 __Pyx_DECREF_SET(__pyx_t_1, function);
12425 #if CYTHON_FAST_PYCALL
12426 if (PyFunction_Check(__pyx_t_1)) {
12427 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u__2, __pyx_v_html};
12428 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
12429 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12430 __Pyx_GOTREF(__pyx_t_2);
12433 #if CYTHON_FAST_PYCCALL
12434 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12435 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u__2, __pyx_v_html};
12436 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
12437 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12438 __Pyx_GOTREF(__pyx_t_2);
12442 __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 571, __pyx_L1_error)
12443 __Pyx_GOTREF(__pyx_t_6);
12445 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
12447 __Pyx_INCREF(__pyx_kp_u__2);
12448 __Pyx_GIVEREF(__pyx_kp_u__2);
12449 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_u__2);
12450 __Pyx_INCREF(__pyx_v_html);
12451 __Pyx_GIVEREF(__pyx_v_html);
12452 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_html);
12453 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
12454 __Pyx_GOTREF(__pyx_t_2);
12455 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12457 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12458 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_2);
12461 /* "lxml/html/diff.py":572
12462 * html = html[:match.start()]
12463 * html = _ins_del_re.sub('', html)
12464 * return html # <<<<<<<<<<<<<<
12468 __Pyx_XDECREF(__pyx_r);
12469 __Pyx_INCREF(__pyx_v_html);
12470 __pyx_r = __pyx_v_html;
12473 /* "lxml/html/diff.py":561
12474 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
12476 * def cleanup_html(html): # <<<<<<<<<<<<<<
12477 * """ This 'cleans' the HTML, meaning that any page structure is removed
12478 * (only the contents of <body> are used, if there is any <body).
12481 /* function exit code */
12483 __Pyx_XDECREF(__pyx_t_1);
12484 __Pyx_XDECREF(__pyx_t_2);
12485 __Pyx_XDECREF(__pyx_t_3);
12486 __Pyx_XDECREF(__pyx_t_6);
12487 __Pyx_AddTraceback("lxml.html.diff.cleanup_html", __pyx_clineno, __pyx_lineno, __pyx_filename);
12490 __Pyx_XDECREF(__pyx_v_match);
12491 __Pyx_XDECREF(__pyx_v_html);
12492 __Pyx_XGIVEREF(__pyx_r);
12493 __Pyx_RefNannyFinishContext();
12497 /* "lxml/html/diff.py":577
12498 * end_whitespace_re = re.compile(r'[ \t\n\r]$')
12500 * def split_trailing_whitespace(word): # <<<<<<<<<<<<<<
12502 * This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
12505 /* Python wrapper */
12506 static PyObject *__pyx_pw_4lxml_4html_4diff_45split_trailing_whitespace(PyObject *__pyx_self, PyObject *__pyx_v_word); /*proto*/
12507 static char __pyx_doc_4lxml_4html_4diff_44split_trailing_whitespace[] = "\n This function takes a word, such as 'test\n\n' and returns ('test','\n\n')\n ";
12508 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_45split_trailing_whitespace = {"split_trailing_whitespace", (PyCFunction)__pyx_pw_4lxml_4html_4diff_45split_trailing_whitespace, METH_O, __pyx_doc_4lxml_4html_4diff_44split_trailing_whitespace};
12509 static PyObject *__pyx_pw_4lxml_4html_4diff_45split_trailing_whitespace(PyObject *__pyx_self, PyObject *__pyx_v_word) {
12510 PyObject *__pyx_r = 0;
12511 __Pyx_RefNannyDeclarations
12512 __Pyx_RefNannySetupContext("split_trailing_whitespace (wrapper)", 0);
12513 __pyx_r = __pyx_pf_4lxml_4html_4diff_44split_trailing_whitespace(__pyx_self, ((PyObject *)__pyx_v_word));
12515 /* function exit code */
12516 __Pyx_RefNannyFinishContext();
12520 static PyObject *__pyx_pf_4lxml_4html_4diff_44split_trailing_whitespace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_word) {
12521 Py_ssize_t __pyx_v_stripped_length;
12522 PyObject *__pyx_r = NULL;
12523 __Pyx_RefNannyDeclarations
12524 PyObject *__pyx_t_1 = NULL;
12525 PyObject *__pyx_t_2 = NULL;
12526 PyObject *__pyx_t_3 = NULL;
12527 Py_ssize_t __pyx_t_4;
12528 int __pyx_lineno = 0;
12529 const char *__pyx_filename = NULL;
12530 int __pyx_clineno = 0;
12531 __Pyx_RefNannySetupContext("split_trailing_whitespace", 0);
12533 /* "lxml/html/diff.py":581
12534 * This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
12536 * stripped_length = len(word.rstrip()) # <<<<<<<<<<<<<<
12537 * return word[0:stripped_length], word[stripped_length:]
12540 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
12541 __Pyx_GOTREF(__pyx_t_2);
12543 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12544 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
12545 if (likely(__pyx_t_3)) {
12546 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12547 __Pyx_INCREF(__pyx_t_3);
12548 __Pyx_INCREF(function);
12549 __Pyx_DECREF_SET(__pyx_t_2, function);
12552 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12553 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12554 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
12555 __Pyx_GOTREF(__pyx_t_1);
12556 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12557 __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 581, __pyx_L1_error)
12558 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12559 __pyx_v_stripped_length = __pyx_t_4;
12561 /* "lxml/html/diff.py":582
12563 * stripped_length = len(word.rstrip())
12564 * return word[0:stripped_length], word[stripped_length:] # <<<<<<<<<<<<<<
12568 __Pyx_XDECREF(__pyx_r);
12569 __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_word, 0, __pyx_v_stripped_length, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
12570 __Pyx_GOTREF(__pyx_t_1);
12571 __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_word, __pyx_v_stripped_length, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
12572 __Pyx_GOTREF(__pyx_t_2);
12573 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error)
12574 __Pyx_GOTREF(__pyx_t_3);
12575 __Pyx_GIVEREF(__pyx_t_1);
12576 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
12577 __Pyx_GIVEREF(__pyx_t_2);
12578 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
12581 __pyx_r = __pyx_t_3;
12585 /* "lxml/html/diff.py":577
12586 * end_whitespace_re = re.compile(r'[ \t\n\r]$')
12588 * def split_trailing_whitespace(word): # <<<<<<<<<<<<<<
12590 * This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
12593 /* function exit code */
12595 __Pyx_XDECREF(__pyx_t_1);
12596 __Pyx_XDECREF(__pyx_t_2);
12597 __Pyx_XDECREF(__pyx_t_3);
12598 __Pyx_AddTraceback("lxml.html.diff.split_trailing_whitespace", __pyx_clineno, __pyx_lineno, __pyx_filename);
12601 __Pyx_XGIVEREF(__pyx_r);
12602 __Pyx_RefNannyFinishContext();
12606 /* "lxml/html/diff.py":585
12609 * def fixup_chunks(chunks): # <<<<<<<<<<<<<<
12611 * This function takes a list of chunks and produces a list of tokens.
12614 /* Python wrapper */
12615 static PyObject *__pyx_pw_4lxml_4html_4diff_47fixup_chunks(PyObject *__pyx_self, PyObject *__pyx_v_chunks); /*proto*/
12616 static char __pyx_doc_4lxml_4html_4diff_46fixup_chunks[] = "\n This function takes a list of chunks and produces a list of tokens.\n ";
12617 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_47fixup_chunks = {"fixup_chunks", (PyCFunction)__pyx_pw_4lxml_4html_4diff_47fixup_chunks, METH_O, __pyx_doc_4lxml_4html_4diff_46fixup_chunks};
12618 static PyObject *__pyx_pw_4lxml_4html_4diff_47fixup_chunks(PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
12619 PyObject *__pyx_r = 0;
12620 __Pyx_RefNannyDeclarations
12621 __Pyx_RefNannySetupContext("fixup_chunks (wrapper)", 0);
12622 __pyx_r = __pyx_pf_4lxml_4html_4diff_46fixup_chunks(__pyx_self, ((PyObject *)__pyx_v_chunks));
12624 /* function exit code */
12625 __Pyx_RefNannyFinishContext();
12629 static PyObject *__pyx_pf_4lxml_4html_4diff_46fixup_chunks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chunks) {
12630 PyObject *__pyx_v_tag_accum = NULL;
12631 PyObject *__pyx_v_cur_word = NULL;
12632 PyObject *__pyx_v_result = NULL;
12633 PyObject *__pyx_v_chunk = NULL;
12634 PyObject *__pyx_v_src = NULL;
12635 PyObject *__pyx_v_tag = NULL;
12636 PyObject *__pyx_v_trailing_whitespace = NULL;
12637 PyObject *__pyx_v_href = NULL;
12638 PyObject *__pyx_r = NULL;
12639 __Pyx_RefNannyDeclarations
12640 PyObject *__pyx_t_1 = NULL;
12641 Py_ssize_t __pyx_t_2;
12642 PyObject *(*__pyx_t_3)(PyObject *);
12643 PyObject *__pyx_t_4 = NULL;
12646 PyObject *__pyx_t_7 = NULL;
12647 PyObject *__pyx_t_8 = NULL;
12648 PyObject *__pyx_t_9 = NULL;
12649 PyObject *(*__pyx_t_10)(PyObject *);
12651 Py_ssize_t __pyx_t_12;
12652 Py_UCS4 __pyx_t_13;
12653 int __pyx_lineno = 0;
12654 const char *__pyx_filename = NULL;
12655 int __pyx_clineno = 0;
12656 __Pyx_RefNannySetupContext("fixup_chunks", 0);
12658 /* "lxml/html/diff.py":589
12659 * This function takes a list of chunks and produces a list of tokens.
12661 * tag_accum = [] # <<<<<<<<<<<<<<
12665 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error)
12666 __Pyx_GOTREF(__pyx_t_1);
12667 __pyx_v_tag_accum = ((PyObject*)__pyx_t_1);
12670 /* "lxml/html/diff.py":590
12673 * cur_word = None # <<<<<<<<<<<<<<
12675 * for chunk in chunks:
12677 __Pyx_INCREF(Py_None);
12678 __pyx_v_cur_word = Py_None;
12680 /* "lxml/html/diff.py":591
12683 * result = [] # <<<<<<<<<<<<<<
12684 * for chunk in chunks:
12685 * if isinstance(chunk, tuple):
12687 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
12688 __Pyx_GOTREF(__pyx_t_1);
12689 __pyx_v_result = ((PyObject*)__pyx_t_1);
12692 /* "lxml/html/diff.py":592
12695 * for chunk in chunks: # <<<<<<<<<<<<<<
12696 * if isinstance(chunk, tuple):
12697 * if chunk[0] == 'img':
12699 if (likely(PyList_CheckExact(__pyx_v_chunks)) || PyTuple_CheckExact(__pyx_v_chunks)) {
12700 __pyx_t_1 = __pyx_v_chunks; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
12703 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error)
12704 __Pyx_GOTREF(__pyx_t_1);
12705 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
12708 if (likely(!__pyx_t_3)) {
12709 if (likely(PyList_CheckExact(__pyx_t_1))) {
12710 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
12711 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12712 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
12714 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
12715 __Pyx_GOTREF(__pyx_t_4);
12718 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
12719 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12720 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
12722 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
12723 __Pyx_GOTREF(__pyx_t_4);
12727 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
12728 if (unlikely(!__pyx_t_4)) {
12729 PyObject* exc_type = PyErr_Occurred();
12731 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12732 else __PYX_ERR(0, 592, __pyx_L1_error)
12736 __Pyx_GOTREF(__pyx_t_4);
12738 __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_4);
12741 /* "lxml/html/diff.py":593
12743 * for chunk in chunks:
12744 * if isinstance(chunk, tuple): # <<<<<<<<<<<<<<
12745 * if chunk[0] == 'img':
12748 __pyx_t_5 = PyTuple_Check(__pyx_v_chunk);
12749 __pyx_t_6 = (__pyx_t_5 != 0);
12752 /* "lxml/html/diff.py":594
12753 * for chunk in chunks:
12754 * if isinstance(chunk, tuple):
12755 * if chunk[0] == 'img': # <<<<<<<<<<<<<<
12757 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12759 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_chunk, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error)
12760 __Pyx_GOTREF(__pyx_t_4);
12761 __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_img, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 594, __pyx_L1_error)
12762 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12765 /* "lxml/html/diff.py":595
12766 * if isinstance(chunk, tuple):
12767 * if chunk[0] == 'img':
12768 * src = chunk[1] # <<<<<<<<<<<<<<
12769 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12770 * cur_word = tag_token('img', src, html_repr=tag,
12772 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_chunk, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error)
12773 __Pyx_GOTREF(__pyx_t_4);
12774 __Pyx_XDECREF_SET(__pyx_v_src, __pyx_t_4);
12777 /* "lxml/html/diff.py":596
12778 * if chunk[0] == 'img':
12780 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2]) # <<<<<<<<<<<<<<
12781 * cur_word = tag_token('img', src, html_repr=tag,
12782 * pre_tags=tag_accum,
12784 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_split_trailing_whitespace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 596, __pyx_L1_error)
12785 __Pyx_GOTREF(__pyx_t_7);
12786 __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_chunk, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 596, __pyx_L1_error)
12787 __Pyx_GOTREF(__pyx_t_8);
12789 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
12790 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
12791 if (likely(__pyx_t_9)) {
12792 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
12793 __Pyx_INCREF(__pyx_t_9);
12794 __Pyx_INCREF(function);
12795 __Pyx_DECREF_SET(__pyx_t_7, function);
12798 __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
12799 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12800 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12801 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
12802 __Pyx_GOTREF(__pyx_t_4);
12803 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12804 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
12805 PyObject* sequence = __pyx_t_4;
12806 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
12807 if (unlikely(size != 2)) {
12808 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
12809 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
12810 __PYX_ERR(0, 596, __pyx_L1_error)
12812 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12813 if (likely(PyTuple_CheckExact(sequence))) {
12814 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
12815 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
12817 __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
12818 __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
12820 __Pyx_INCREF(__pyx_t_7);
12821 __Pyx_INCREF(__pyx_t_8);
12823 __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 596, __pyx_L1_error)
12824 __Pyx_GOTREF(__pyx_t_7);
12825 __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 596, __pyx_L1_error)
12826 __Pyx_GOTREF(__pyx_t_8);
12828 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12830 Py_ssize_t index = -1;
12831 __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 596, __pyx_L1_error)
12832 __Pyx_GOTREF(__pyx_t_9);
12833 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12834 __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
12835 index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
12836 __Pyx_GOTREF(__pyx_t_7);
12837 index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
12838 __Pyx_GOTREF(__pyx_t_8);
12839 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 596, __pyx_L1_error)
12841 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12842 goto __pyx_L8_unpacking_done;
12843 __pyx_L7_unpacking_failed:;
12844 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12846 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
12847 __PYX_ERR(0, 596, __pyx_L1_error)
12848 __pyx_L8_unpacking_done:;
12850 __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_7);
12852 __Pyx_XDECREF_SET(__pyx_v_trailing_whitespace, __pyx_t_8);
12855 /* "lxml/html/diff.py":597
12857 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12858 * cur_word = tag_token('img', src, html_repr=tag, # <<<<<<<<<<<<<<
12859 * pre_tags=tag_accum,
12860 * trailing_whitespace=trailing_whitespace)
12862 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_tag_token_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
12863 __Pyx_GOTREF(__pyx_t_4);
12864 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error)
12865 __Pyx_GOTREF(__pyx_t_8);
12866 __Pyx_INCREF(__pyx_n_u_img);
12867 __Pyx_GIVEREF(__pyx_n_u_img);
12868 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_img);
12869 __Pyx_INCREF(__pyx_v_src);
12870 __Pyx_GIVEREF(__pyx_v_src);
12871 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_src);
12872 __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 597, __pyx_L1_error)
12873 __Pyx_GOTREF(__pyx_t_7);
12874 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_html_repr, __pyx_v_tag) < 0) __PYX_ERR(0, 597, __pyx_L1_error)
12876 /* "lxml/html/diff.py":598
12877 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12878 * cur_word = tag_token('img', src, html_repr=tag,
12879 * pre_tags=tag_accum, # <<<<<<<<<<<<<<
12880 * trailing_whitespace=trailing_whitespace)
12883 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_pre_tags, __pyx_v_tag_accum) < 0) __PYX_ERR(0, 597, __pyx_L1_error)
12885 /* "lxml/html/diff.py":599
12886 * cur_word = tag_token('img', src, html_repr=tag,
12887 * pre_tags=tag_accum,
12888 * trailing_whitespace=trailing_whitespace) # <<<<<<<<<<<<<<
12890 * result.append(cur_word)
12892 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_trailing_whitespace, __pyx_v_trailing_whitespace) < 0) __PYX_ERR(0, 597, __pyx_L1_error)
12894 /* "lxml/html/diff.py":597
12896 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12897 * cur_word = tag_token('img', src, html_repr=tag, # <<<<<<<<<<<<<<
12898 * pre_tags=tag_accum,
12899 * trailing_whitespace=trailing_whitespace)
12901 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 597, __pyx_L1_error)
12902 __Pyx_GOTREF(__pyx_t_9);
12903 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12904 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12905 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12906 __Pyx_DECREF_SET(__pyx_v_cur_word, __pyx_t_9);
12909 /* "lxml/html/diff.py":600
12910 * pre_tags=tag_accum,
12911 * trailing_whitespace=trailing_whitespace)
12912 * tag_accum = [] # <<<<<<<<<<<<<<
12913 * result.append(cur_word)
12916 __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 600, __pyx_L1_error)
12917 __Pyx_GOTREF(__pyx_t_9);
12918 __Pyx_DECREF_SET(__pyx_v_tag_accum, ((PyObject*)__pyx_t_9));
12921 /* "lxml/html/diff.py":601
12922 * trailing_whitespace=trailing_whitespace)
12924 * result.append(cur_word) # <<<<<<<<<<<<<<
12926 * elif chunk[0] == 'href':
12928 __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_cur_word); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 601, __pyx_L1_error)
12930 /* "lxml/html/diff.py":594
12931 * for chunk in chunks:
12932 * if isinstance(chunk, tuple):
12933 * if chunk[0] == 'img': # <<<<<<<<<<<<<<
12935 * tag, trailing_whitespace = split_trailing_whitespace(chunk[2])
12940 /* "lxml/html/diff.py":603
12941 * result.append(cur_word)
12943 * elif chunk[0] == 'href': # <<<<<<<<<<<<<<
12945 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ")
12947 __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_chunk, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 603, __pyx_L1_error)
12948 __Pyx_GOTREF(__pyx_t_9);
12949 __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_9, __pyx_n_u_href, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 603, __pyx_L1_error)
12950 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12953 /* "lxml/html/diff.py":604
12955 * elif chunk[0] == 'href':
12956 * href = chunk[1] # <<<<<<<<<<<<<<
12957 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ")
12960 __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_chunk, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 604, __pyx_L1_error)
12961 __Pyx_GOTREF(__pyx_t_9);
12962 __Pyx_XDECREF_SET(__pyx_v_href, __pyx_t_9);
12965 /* "lxml/html/diff.py":605
12966 * elif chunk[0] == 'href':
12968 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ") # <<<<<<<<<<<<<<
12970 * result.append(cur_word)
12972 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_href_token); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 605, __pyx_L1_error)
12973 __Pyx_GOTREF(__pyx_t_9);
12974 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 605, __pyx_L1_error)
12975 __Pyx_GOTREF(__pyx_t_7);
12976 __Pyx_INCREF(__pyx_v_href);
12977 __Pyx_GIVEREF(__pyx_v_href);
12978 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_href);
12979 __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 605, __pyx_L1_error)
12980 __Pyx_GOTREF(__pyx_t_8);
12981 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_pre_tags, __pyx_v_tag_accum) < 0) __PYX_ERR(0, 605, __pyx_L1_error)
12982 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_trailing_whitespace, __pyx_kp_u__6) < 0) __PYX_ERR(0, 605, __pyx_L1_error)
12983 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error)
12984 __Pyx_GOTREF(__pyx_t_4);
12985 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12986 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12987 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12988 __Pyx_DECREF_SET(__pyx_v_cur_word, __pyx_t_4);
12991 /* "lxml/html/diff.py":606
12993 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ")
12994 * tag_accum = [] # <<<<<<<<<<<<<<
12995 * result.append(cur_word)
12998 __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 606, __pyx_L1_error)
12999 __Pyx_GOTREF(__pyx_t_4);
13000 __Pyx_DECREF_SET(__pyx_v_tag_accum, ((PyObject*)__pyx_t_4));
13003 /* "lxml/html/diff.py":607
13004 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ")
13006 * result.append(cur_word) # <<<<<<<<<<<<<<
13010 __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_cur_word); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 607, __pyx_L1_error)
13012 /* "lxml/html/diff.py":603
13013 * result.append(cur_word)
13015 * elif chunk[0] == 'href': # <<<<<<<<<<<<<<
13017 * cur_word = href_token(href, pre_tags=tag_accum, trailing_whitespace=" ")
13022 /* "lxml/html/diff.py":608
13024 * result.append(cur_word)
13025 * continue # <<<<<<<<<<<<<<
13027 * if is_word(chunk):
13029 goto __pyx_L3_continue;
13031 /* "lxml/html/diff.py":593
13033 * for chunk in chunks:
13034 * if isinstance(chunk, tuple): # <<<<<<<<<<<<<<
13035 * if chunk[0] == 'img':
13040 /* "lxml/html/diff.py":610
13043 * if is_word(chunk): # <<<<<<<<<<<<<<
13044 * chunk, trailing_whitespace = split_trailing_whitespace(chunk)
13045 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace)
13047 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_is_word); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 610, __pyx_L1_error)
13048 __Pyx_GOTREF(__pyx_t_8);
13050 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
13051 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
13052 if (likely(__pyx_t_7)) {
13053 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
13054 __Pyx_INCREF(__pyx_t_7);
13055 __Pyx_INCREF(function);
13056 __Pyx_DECREF_SET(__pyx_t_8, function);
13059 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_chunk) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_chunk);
13060 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13061 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error)
13062 __Pyx_GOTREF(__pyx_t_4);
13063 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13064 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 610, __pyx_L1_error)
13065 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13068 /* "lxml/html/diff.py":611
13070 * if is_word(chunk):
13071 * chunk, trailing_whitespace = split_trailing_whitespace(chunk) # <<<<<<<<<<<<<<
13072 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace)
13075 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_split_trailing_whitespace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error)
13076 __Pyx_GOTREF(__pyx_t_8);
13078 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
13079 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
13080 if (likely(__pyx_t_7)) {
13081 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
13082 __Pyx_INCREF(__pyx_t_7);
13083 __Pyx_INCREF(function);
13084 __Pyx_DECREF_SET(__pyx_t_8, function);
13087 __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_chunk) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_chunk);
13088 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13089 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
13090 __Pyx_GOTREF(__pyx_t_4);
13091 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13092 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
13093 PyObject* sequence = __pyx_t_4;
13094 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13095 if (unlikely(size != 2)) {
13096 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13097 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13098 __PYX_ERR(0, 611, __pyx_L1_error)
13100 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13101 if (likely(PyTuple_CheckExact(sequence))) {
13102 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
13103 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
13105 __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
13106 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
13108 __Pyx_INCREF(__pyx_t_8);
13109 __Pyx_INCREF(__pyx_t_7);
13111 __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 611, __pyx_L1_error)
13112 __Pyx_GOTREF(__pyx_t_8);
13113 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
13114 __Pyx_GOTREF(__pyx_t_7);
13116 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13118 Py_ssize_t index = -1;
13119 __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 611, __pyx_L1_error)
13120 __Pyx_GOTREF(__pyx_t_9);
13121 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13122 __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
13123 index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L10_unpacking_failed;
13124 __Pyx_GOTREF(__pyx_t_8);
13125 index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L10_unpacking_failed;
13126 __Pyx_GOTREF(__pyx_t_7);
13127 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 611, __pyx_L1_error)
13129 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13130 goto __pyx_L11_unpacking_done;
13131 __pyx_L10_unpacking_failed:;
13132 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13134 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13135 __PYX_ERR(0, 611, __pyx_L1_error)
13136 __pyx_L11_unpacking_done:;
13138 __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_t_8);
13140 __Pyx_XDECREF_SET(__pyx_v_trailing_whitespace, __pyx_t_7);
13143 /* "lxml/html/diff.py":612
13144 * if is_word(chunk):
13145 * chunk, trailing_whitespace = split_trailing_whitespace(chunk)
13146 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace) # <<<<<<<<<<<<<<
13148 * result.append(cur_word)
13150 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_token); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
13151 __Pyx_GOTREF(__pyx_t_4);
13152 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 612, __pyx_L1_error)
13153 __Pyx_GOTREF(__pyx_t_7);
13154 __Pyx_INCREF(__pyx_v_chunk);
13155 __Pyx_GIVEREF(__pyx_v_chunk);
13156 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chunk);
13157 __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 612, __pyx_L1_error)
13158 __Pyx_GOTREF(__pyx_t_8);
13159 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_pre_tags, __pyx_v_tag_accum) < 0) __PYX_ERR(0, 612, __pyx_L1_error)
13160 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_trailing_whitespace, __pyx_v_trailing_whitespace) < 0) __PYX_ERR(0, 612, __pyx_L1_error)
13161 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 612, __pyx_L1_error)
13162 __Pyx_GOTREF(__pyx_t_9);
13163 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13164 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13165 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13166 __Pyx_DECREF_SET(__pyx_v_cur_word, __pyx_t_9);
13169 /* "lxml/html/diff.py":613
13170 * chunk, trailing_whitespace = split_trailing_whitespace(chunk)
13171 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace)
13172 * tag_accum = [] # <<<<<<<<<<<<<<
13173 * result.append(cur_word)
13176 __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 613, __pyx_L1_error)
13177 __Pyx_GOTREF(__pyx_t_9);
13178 __Pyx_DECREF_SET(__pyx_v_tag_accum, ((PyObject*)__pyx_t_9));
13181 /* "lxml/html/diff.py":614
13182 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace)
13184 * result.append(cur_word) # <<<<<<<<<<<<<<
13186 * elif is_start_tag(chunk):
13188 __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_cur_word); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 614, __pyx_L1_error)
13190 /* "lxml/html/diff.py":610
13193 * if is_word(chunk): # <<<<<<<<<<<<<<
13194 * chunk, trailing_whitespace = split_trailing_whitespace(chunk)
13195 * cur_word = token(chunk, pre_tags=tag_accum, trailing_whitespace=trailing_whitespace)
13200 /* "lxml/html/diff.py":616
13201 * result.append(cur_word)
13203 * elif is_start_tag(chunk): # <<<<<<<<<<<<<<
13204 * tag_accum.append(chunk)
13207 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_is_start_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 616, __pyx_L1_error)
13208 __Pyx_GOTREF(__pyx_t_8);
13210 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
13211 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
13212 if (likely(__pyx_t_7)) {
13213 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
13214 __Pyx_INCREF(__pyx_t_7);
13215 __Pyx_INCREF(function);
13216 __Pyx_DECREF_SET(__pyx_t_8, function);
13219 __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_chunk) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_chunk);
13220 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13221 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 616, __pyx_L1_error)
13222 __Pyx_GOTREF(__pyx_t_9);
13223 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13224 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 616, __pyx_L1_error)
13225 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13228 /* "lxml/html/diff.py":617
13230 * elif is_start_tag(chunk):
13231 * tag_accum.append(chunk) # <<<<<<<<<<<<<<
13233 * elif is_end_tag(chunk):
13235 __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_tag_accum, __pyx_v_chunk); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 617, __pyx_L1_error)
13237 /* "lxml/html/diff.py":616
13238 * result.append(cur_word)
13240 * elif is_start_tag(chunk): # <<<<<<<<<<<<<<
13241 * tag_accum.append(chunk)
13247 /* "lxml/html/diff.py":619
13248 * tag_accum.append(chunk)
13250 * elif is_end_tag(chunk): # <<<<<<<<<<<<<<
13252 * tag_accum.append(chunk)
13254 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_is_end_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 619, __pyx_L1_error)
13255 __Pyx_GOTREF(__pyx_t_8);
13257 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
13258 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
13259 if (likely(__pyx_t_7)) {
13260 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
13261 __Pyx_INCREF(__pyx_t_7);
13262 __Pyx_INCREF(function);
13263 __Pyx_DECREF_SET(__pyx_t_8, function);
13266 __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_chunk) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_chunk);
13267 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13268 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 619, __pyx_L1_error)
13269 __Pyx_GOTREF(__pyx_t_9);
13270 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13271 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 619, __pyx_L1_error)
13272 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13275 /* "lxml/html/diff.py":620
13277 * elif is_end_tag(chunk):
13278 * if tag_accum: # <<<<<<<<<<<<<<
13279 * tag_accum.append(chunk)
13282 __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_tag_accum) != 0);
13285 /* "lxml/html/diff.py":621
13286 * elif is_end_tag(chunk):
13288 * tag_accum.append(chunk) # <<<<<<<<<<<<<<
13290 * assert cur_word, (
13292 __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_tag_accum, __pyx_v_chunk); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 621, __pyx_L1_error)
13294 /* "lxml/html/diff.py":620
13296 * elif is_end_tag(chunk):
13297 * if tag_accum: # <<<<<<<<<<<<<<
13298 * tag_accum.append(chunk)
13304 /* "lxml/html/diff.py":623
13305 * tag_accum.append(chunk)
13307 * assert cur_word, ( # <<<<<<<<<<<<<<
13308 * "Weird state, cur_word=%r, result=%r, chunks=%r of %r"
13309 * % (cur_word, result, chunk, chunks))
13312 #ifndef CYTHON_WITHOUT_ASSERTIONS
13313 if (unlikely(!Py_OptimizeFlag)) {
13314 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_cur_word); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13315 if (unlikely(!__pyx_t_6)) {
13317 /* "lxml/html/diff.py":624
13319 * assert cur_word, (
13320 * "Weird state, cur_word=%r, result=%r, chunks=%r of %r" # <<<<<<<<<<<<<<
13321 * % (cur_word, result, chunk, chunks))
13322 * cur_word.post_tags.append(chunk)
13324 __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 624, __pyx_L1_error)
13325 __Pyx_GOTREF(__pyx_t_9);
13328 __Pyx_INCREF(__pyx_kp_u_Weird_state_cur_word);
13330 __Pyx_GIVEREF(__pyx_kp_u_Weird_state_cur_word);
13331 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_Weird_state_cur_word);
13333 /* "lxml/html/diff.py":625
13334 * assert cur_word, (
13335 * "Weird state, cur_word=%r, result=%r, chunks=%r of %r"
13336 * % (cur_word, result, chunk, chunks)) # <<<<<<<<<<<<<<
13337 * cur_word.post_tags.append(chunk)
13340 __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_cur_word), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 625, __pyx_L1_error)
13341 __Pyx_GOTREF(__pyx_t_8);
13342 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_13;
13343 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
13344 __Pyx_GIVEREF(__pyx_t_8);
13345 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
13347 __Pyx_INCREF(__pyx_kp_u_result);
13349 __Pyx_GIVEREF(__pyx_kp_u_result);
13350 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_result);
13351 __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_result), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 625, __pyx_L1_error)
13352 __Pyx_GOTREF(__pyx_t_8);
13353 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_13;
13354 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
13355 __Pyx_GIVEREF(__pyx_t_8);
13356 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8);
13358 __Pyx_INCREF(__pyx_kp_u_chunks);
13360 __Pyx_GIVEREF(__pyx_kp_u_chunks);
13361 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_kp_u_chunks);
13362 __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_chunk), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 625, __pyx_L1_error)
13363 __Pyx_GOTREF(__pyx_t_8);
13364 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_13;
13365 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
13366 __Pyx_GIVEREF(__pyx_t_8);
13367 PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_8);
13369 __Pyx_INCREF(__pyx_kp_u_of);
13371 __Pyx_GIVEREF(__pyx_kp_u_of);
13372 PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_kp_u_of);
13373 __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_chunks), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 625, __pyx_L1_error)
13374 __Pyx_GOTREF(__pyx_t_8);
13375 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_13;
13376 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
13377 __Pyx_GIVEREF(__pyx_t_8);
13378 PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_8);
13381 /* "lxml/html/diff.py":624
13383 * assert cur_word, (
13384 * "Weird state, cur_word=%r, result=%r, chunks=%r of %r" # <<<<<<<<<<<<<<
13385 * % (cur_word, result, chunk, chunks))
13386 * cur_word.post_tags.append(chunk)
13388 __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_9, 8, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 624, __pyx_L1_error)
13389 __Pyx_GOTREF(__pyx_t_8);
13390 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13391 PyErr_SetObject(PyExc_AssertionError, __pyx_t_8);
13392 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13393 __PYX_ERR(0, 623, __pyx_L1_error)
13398 /* "lxml/html/diff.py":626
13399 * "Weird state, cur_word=%r, result=%r, chunks=%r of %r"
13400 * % (cur_word, result, chunk, chunks))
13401 * cur_word.post_tags.append(chunk) # <<<<<<<<<<<<<<
13405 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_word, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 626, __pyx_L1_error)
13406 __Pyx_GOTREF(__pyx_t_8);
13407 __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_v_chunk); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 626, __pyx_L1_error)
13408 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13412 /* "lxml/html/diff.py":619
13413 * tag_accum.append(chunk)
13415 * elif is_end_tag(chunk): # <<<<<<<<<<<<<<
13417 * tag_accum.append(chunk)
13422 /* "lxml/html/diff.py":628
13423 * cur_word.post_tags.append(chunk)
13425 * assert False # <<<<<<<<<<<<<<
13430 #ifndef CYTHON_WITHOUT_ASSERTIONS
13431 if (unlikely(!Py_OptimizeFlag)) {
13432 if (unlikely(!0)) {
13433 PyErr_SetNone(PyExc_AssertionError);
13434 __PYX_ERR(0, 628, __pyx_L1_error)
13441 /* "lxml/html/diff.py":592
13444 * for chunk in chunks: # <<<<<<<<<<<<<<
13445 * if isinstance(chunk, tuple):
13446 * if chunk[0] == 'img':
13448 __pyx_L3_continue:;
13450 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13452 /* "lxml/html/diff.py":630
13455 * if not result: # <<<<<<<<<<<<<<
13456 * return [token('', pre_tags=tag_accum)]
13459 __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_result) != 0);
13460 __pyx_t_5 = ((!__pyx_t_6) != 0);
13463 /* "lxml/html/diff.py":631
13466 * return [token('', pre_tags=tag_accum)] # <<<<<<<<<<<<<<
13468 * result[-1].post_tags.extend(tag_accum)
13470 __Pyx_XDECREF(__pyx_r);
13471 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
13472 __Pyx_GOTREF(__pyx_t_1);
13473 __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 631, __pyx_L1_error)
13474 __Pyx_GOTREF(__pyx_t_8);
13475 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_pre_tags, __pyx_v_tag_accum) < 0) __PYX_ERR(0, 631, __pyx_L1_error)
13476 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__16, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
13477 __Pyx_GOTREF(__pyx_t_9);
13478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13479 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13480 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 631, __pyx_L1_error)
13481 __Pyx_GOTREF(__pyx_t_8);
13482 __Pyx_GIVEREF(__pyx_t_9);
13483 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
13485 __pyx_r = __pyx_t_8;
13489 /* "lxml/html/diff.py":630
13492 * if not result: # <<<<<<<<<<<<<<
13493 * return [token('', pre_tags=tag_accum)]
13498 /* "lxml/html/diff.py":633
13499 * return [token('', pre_tags=tag_accum)]
13501 * result[-1].post_tags.extend(tag_accum) # <<<<<<<<<<<<<<
13506 __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_result, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 633, __pyx_L1_error)
13507 __Pyx_GOTREF(__pyx_t_9);
13508 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_post_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
13509 __Pyx_GOTREF(__pyx_t_1);
13510 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13511 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_extend); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 633, __pyx_L1_error)
13512 __Pyx_GOTREF(__pyx_t_9);
13513 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13515 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
13516 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
13517 if (likely(__pyx_t_1)) {
13518 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
13519 __Pyx_INCREF(__pyx_t_1);
13520 __Pyx_INCREF(function);
13521 __Pyx_DECREF_SET(__pyx_t_9, function);
13524 __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_1, __pyx_v_tag_accum) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_tag_accum);
13525 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
13526 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 633, __pyx_L1_error)
13527 __Pyx_GOTREF(__pyx_t_8);
13528 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13529 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13532 /* "lxml/html/diff.py":635
13533 * result[-1].post_tags.extend(tag_accum)
13535 * return result # <<<<<<<<<<<<<<
13539 __Pyx_XDECREF(__pyx_r);
13540 __Pyx_INCREF(__pyx_v_result);
13541 __pyx_r = __pyx_v_result;
13544 /* "lxml/html/diff.py":585
13547 * def fixup_chunks(chunks): # <<<<<<<<<<<<<<
13549 * This function takes a list of chunks and produces a list of tokens.
13552 /* function exit code */
13554 __Pyx_XDECREF(__pyx_t_1);
13555 __Pyx_XDECREF(__pyx_t_4);
13556 __Pyx_XDECREF(__pyx_t_7);
13557 __Pyx_XDECREF(__pyx_t_8);
13558 __Pyx_XDECREF(__pyx_t_9);
13559 __Pyx_AddTraceback("lxml.html.diff.fixup_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename);
13562 __Pyx_XDECREF(__pyx_v_tag_accum);
13563 __Pyx_XDECREF(__pyx_v_cur_word);
13564 __Pyx_XDECREF(__pyx_v_result);
13565 __Pyx_XDECREF(__pyx_v_chunk);
13566 __Pyx_XDECREF(__pyx_v_src);
13567 __Pyx_XDECREF(__pyx_v_tag);
13568 __Pyx_XDECREF(__pyx_v_trailing_whitespace);
13569 __Pyx_XDECREF(__pyx_v_href);
13570 __Pyx_XGIVEREF(__pyx_r);
13571 __Pyx_RefNannyFinishContext();
13574 static PyObject *__pyx_gb_4lxml_4html_4diff_50generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
13576 /* "lxml/html/diff.py":684
13579 * def flatten_el(el, include_hrefs, skip_tag=False): # <<<<<<<<<<<<<<
13580 * """ Takes an lxml element el, and generates all the text chunks for
13581 * that tag. Each start tag is a chunk, each word is a chunk, and each
13584 /* Python wrapper */
13585 static PyObject *__pyx_pw_4lxml_4html_4diff_49flatten_el(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13586 static char __pyx_doc_4lxml_4html_4diff_48flatten_el[] = " Takes an lxml element el, and generates all the text chunks for\n that tag. Each start tag is a chunk, each word is a chunk, and each\n end tag is a chunk.\n\n If skip_tag is true, then the outermost container tag is\n not returned (just its contents).";
13587 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_49flatten_el = {"flatten_el", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_49flatten_el, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_48flatten_el};
13588 static PyObject *__pyx_pw_4lxml_4html_4diff_49flatten_el(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13589 PyObject *__pyx_v_el = 0;
13590 PyObject *__pyx_v_include_hrefs = 0;
13591 PyObject *__pyx_v_skip_tag = 0;
13592 int __pyx_lineno = 0;
13593 const char *__pyx_filename = NULL;
13594 int __pyx_clineno = 0;
13595 PyObject *__pyx_r = 0;
13596 __Pyx_RefNannyDeclarations
13597 __Pyx_RefNannySetupContext("flatten_el (wrapper)", 0);
13599 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_el,&__pyx_n_s_include_hrefs,&__pyx_n_s_skip_tag,0};
13600 PyObject* values[3] = {0,0,0};
13601 values[2] = ((PyObject *)((PyObject *)Py_False));
13602 if (unlikely(__pyx_kwds)) {
13603 Py_ssize_t kw_args;
13604 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13605 switch (pos_args) {
13606 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13607 CYTHON_FALLTHROUGH;
13608 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13609 CYTHON_FALLTHROUGH;
13610 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13611 CYTHON_FALLTHROUGH;
13613 default: goto __pyx_L5_argtuple_error;
13615 kw_args = PyDict_Size(__pyx_kwds);
13616 switch (pos_args) {
13618 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el)) != 0)) kw_args--;
13619 else goto __pyx_L5_argtuple_error;
13620 CYTHON_FALLTHROUGH;
13622 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_hrefs)) != 0)) kw_args--;
13624 __Pyx_RaiseArgtupleInvalid("flatten_el", 0, 2, 3, 1); __PYX_ERR(0, 684, __pyx_L3_error)
13626 CYTHON_FALLTHROUGH;
13629 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip_tag);
13630 if (value) { values[2] = value; kw_args--; }
13633 if (unlikely(kw_args > 0)) {
13634 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_el") < 0)) __PYX_ERR(0, 684, __pyx_L3_error)
13637 switch (PyTuple_GET_SIZE(__pyx_args)) {
13638 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13639 CYTHON_FALLTHROUGH;
13640 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13641 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13643 default: goto __pyx_L5_argtuple_error;
13646 __pyx_v_el = values[0];
13647 __pyx_v_include_hrefs = values[1];
13648 __pyx_v_skip_tag = values[2];
13650 goto __pyx_L4_argument_unpacking_done;
13651 __pyx_L5_argtuple_error:;
13652 __Pyx_RaiseArgtupleInvalid("flatten_el", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 684, __pyx_L3_error)
13654 __Pyx_AddTraceback("lxml.html.diff.flatten_el", __pyx_clineno, __pyx_lineno, __pyx_filename);
13655 __Pyx_RefNannyFinishContext();
13657 __pyx_L4_argument_unpacking_done:;
13658 __pyx_r = __pyx_pf_4lxml_4html_4diff_48flatten_el(__pyx_self, __pyx_v_el, __pyx_v_include_hrefs, __pyx_v_skip_tag);
13660 /* function exit code */
13661 __Pyx_RefNannyFinishContext();
13665 static PyObject *__pyx_pf_4lxml_4html_4diff_48flatten_el(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_include_hrefs, PyObject *__pyx_v_skip_tag) {
13666 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *__pyx_cur_scope;
13667 PyObject *__pyx_r = NULL;
13668 __Pyx_RefNannyDeclarations
13669 int __pyx_lineno = 0;
13670 const char *__pyx_filename = NULL;
13671 int __pyx_clineno = 0;
13672 __Pyx_RefNannySetupContext("flatten_el", 0);
13673 __pyx_cur_scope = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el(__pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el, __pyx_empty_tuple, NULL);
13674 if (unlikely(!__pyx_cur_scope)) {
13675 __pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)Py_None);
13676 __Pyx_INCREF(Py_None);
13677 __PYX_ERR(0, 684, __pyx_L1_error)
13679 __Pyx_GOTREF(__pyx_cur_scope);
13681 __pyx_cur_scope->__pyx_v_el = __pyx_v_el;
13682 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_el);
13683 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_el);
13684 __pyx_cur_scope->__pyx_v_include_hrefs = __pyx_v_include_hrefs;
13685 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_include_hrefs);
13686 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_include_hrefs);
13687 __pyx_cur_scope->__pyx_v_skip_tag = __pyx_v_skip_tag;
13688 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_skip_tag);
13689 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_skip_tag);
13691 __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_4lxml_4html_4diff_50generator2, __pyx_codeobj__17, (PyObject *) __pyx_cur_scope, __pyx_n_s_flatten_el, __pyx_n_s_flatten_el, __pyx_n_s_lxml_html_diff); if (unlikely(!gen)) __PYX_ERR(0, 684, __pyx_L1_error)
13692 __Pyx_DECREF(__pyx_cur_scope);
13693 __Pyx_RefNannyFinishContext();
13694 return (PyObject *) gen;
13697 /* function exit code */
13699 __Pyx_AddTraceback("lxml.html.diff.flatten_el", __pyx_clineno, __pyx_lineno, __pyx_filename);
13701 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
13702 __Pyx_XGIVEREF(__pyx_r);
13703 __Pyx_RefNannyFinishContext();
13707 static PyObject *__pyx_gb_4lxml_4html_4diff_50generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
13709 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *__pyx_cur_scope = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)__pyx_generator->closure);
13710 PyObject *__pyx_r = NULL;
13713 PyObject *__pyx_t_3 = NULL;
13714 PyObject *__pyx_t_4 = NULL;
13715 PyObject *__pyx_t_5 = NULL;
13716 PyObject *__pyx_t_6 = NULL;
13718 Py_ssize_t __pyx_t_8;
13719 PyObject *(*__pyx_t_9)(PyObject *);
13720 PyObject *__pyx_t_10 = NULL;
13721 Py_ssize_t __pyx_t_11;
13722 PyObject *(*__pyx_t_12)(PyObject *);
13723 int __pyx_lineno = 0;
13724 const char *__pyx_filename = NULL;
13725 int __pyx_clineno = 0;
13726 __Pyx_RefNannyDeclarations
13727 __Pyx_RefNannySetupContext("flatten_el", 0);
13728 switch (__pyx_generator->resume_label) {
13729 case 0: goto __pyx_L3_first_run;
13730 case 1: goto __pyx_L6_resume_from_yield;
13731 case 2: goto __pyx_L7_resume_from_yield;
13732 case 3: goto __pyx_L15_resume_from_yield;
13733 case 4: goto __pyx_L20_resume_from_yield;
13734 case 5: goto __pyx_L25_resume_from_yield;
13735 case 6: goto __pyx_L27_resume_from_yield;
13736 case 7: goto __pyx_L30_resume_from_yield;
13737 default: /* CPython raises the right error here */
13738 __Pyx_RefNannyFinishContext();
13741 __pyx_L3_first_run:;
13742 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 684, __pyx_L1_error)
13744 /* "lxml/html/diff.py":691
13745 * If skip_tag is true, then the outermost container tag is
13746 * not returned (just its contents)."""
13747 * if not skip_tag: # <<<<<<<<<<<<<<
13748 * if el.tag == 'img':
13749 * yield ('img', el.get('src'), start_tag(el))
13751 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_skip_tag); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 691, __pyx_L1_error)
13752 __pyx_t_2 = ((!__pyx_t_1) != 0);
13755 /* "lxml/html/diff.py":692
13756 * not returned (just its contents)."""
13758 * if el.tag == 'img': # <<<<<<<<<<<<<<
13759 * yield ('img', el.get('src'), start_tag(el))
13762 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __pyx_L1_error)
13763 __Pyx_GOTREF(__pyx_t_3);
13764 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_img, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 692, __pyx_L1_error)
13765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13768 /* "lxml/html/diff.py":693
13770 * if el.tag == 'img':
13771 * yield ('img', el.get('src'), start_tag(el)) # <<<<<<<<<<<<<<
13773 * yield start_tag(el)
13775 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 693, __pyx_L1_error)
13776 __Pyx_GOTREF(__pyx_t_4);
13778 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
13779 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
13780 if (likely(__pyx_t_5)) {
13781 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13782 __Pyx_INCREF(__pyx_t_5);
13783 __Pyx_INCREF(function);
13784 __Pyx_DECREF_SET(__pyx_t_4, function);
13787 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_u_src) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_src);
13788 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13789 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
13790 __Pyx_GOTREF(__pyx_t_3);
13791 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13792 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_start_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 693, __pyx_L1_error)
13793 __Pyx_GOTREF(__pyx_t_5);
13795 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
13796 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
13797 if (likely(__pyx_t_6)) {
13798 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13799 __Pyx_INCREF(__pyx_t_6);
13800 __Pyx_INCREF(function);
13801 __Pyx_DECREF_SET(__pyx_t_5, function);
13804 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_v_el) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_el);
13805 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13806 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 693, __pyx_L1_error)
13807 __Pyx_GOTREF(__pyx_t_4);
13808 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13809 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 693, __pyx_L1_error)
13810 __Pyx_GOTREF(__pyx_t_5);
13811 __Pyx_INCREF(__pyx_n_u_img);
13812 __Pyx_GIVEREF(__pyx_n_u_img);
13813 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_img);
13814 __Pyx_GIVEREF(__pyx_t_3);
13815 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
13816 __Pyx_GIVEREF(__pyx_t_4);
13817 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
13820 __pyx_r = __pyx_t_5;
13822 __Pyx_XGIVEREF(__pyx_r);
13823 __Pyx_RefNannyFinishContext();
13824 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
13825 /* return from generator, yielding value */
13826 __pyx_generator->resume_label = 1;
13828 __pyx_L6_resume_from_yield:;
13829 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 693, __pyx_L1_error)
13831 /* "lxml/html/diff.py":692
13832 * not returned (just its contents)."""
13834 * if el.tag == 'img': # <<<<<<<<<<<<<<
13835 * yield ('img', el.get('src'), start_tag(el))
13841 /* "lxml/html/diff.py":695
13842 * yield ('img', el.get('src'), start_tag(el))
13844 * yield start_tag(el) # <<<<<<<<<<<<<<
13845 * if el.tag in empty_tags and not el.text and not len(el) and not el.tail:
13849 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_start_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error)
13850 __Pyx_GOTREF(__pyx_t_4);
13852 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
13853 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
13854 if (likely(__pyx_t_3)) {
13855 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
13856 __Pyx_INCREF(__pyx_t_3);
13857 __Pyx_INCREF(function);
13858 __Pyx_DECREF_SET(__pyx_t_4, function);
13861 __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_cur_scope->__pyx_v_el) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_el);
13862 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13863 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 695, __pyx_L1_error)
13864 __Pyx_GOTREF(__pyx_t_5);
13865 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13866 __pyx_r = __pyx_t_5;
13868 __Pyx_XGIVEREF(__pyx_r);
13869 __Pyx_RefNannyFinishContext();
13870 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
13871 /* return from generator, yielding value */
13872 __pyx_generator->resume_label = 2;
13874 __pyx_L7_resume_from_yield:;
13875 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 695, __pyx_L1_error)
13879 /* "lxml/html/diff.py":691
13880 * If skip_tag is true, then the outermost container tag is
13881 * not returned (just its contents)."""
13882 * if not skip_tag: # <<<<<<<<<<<<<<
13883 * if el.tag == 'img':
13884 * yield ('img', el.get('src'), start_tag(el))
13888 /* "lxml/html/diff.py":696
13890 * yield start_tag(el)
13891 * if el.tag in empty_tags and not el.text and not len(el) and not el.tail: # <<<<<<<<<<<<<<
13893 * start_words = split_words(el.text)
13895 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error)
13896 __Pyx_GOTREF(__pyx_t_5);
13897 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_empty_tags); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
13898 __Pyx_GOTREF(__pyx_t_4);
13899 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 696, __pyx_L1_error)
13900 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13901 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13902 __pyx_t_7 = (__pyx_t_1 != 0);
13905 __pyx_t_2 = __pyx_t_7;
13906 goto __pyx_L9_bool_binop_done;
13908 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
13909 __Pyx_GOTREF(__pyx_t_4);
13910 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 696, __pyx_L1_error)
13911 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13912 __pyx_t_1 = ((!__pyx_t_7) != 0);
13915 __pyx_t_2 = __pyx_t_1;
13916 goto __pyx_L9_bool_binop_done;
13918 __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_el); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 696, __pyx_L1_error)
13919 __pyx_t_1 = ((!(__pyx_t_8 != 0)) != 0);
13922 __pyx_t_2 = __pyx_t_1;
13923 goto __pyx_L9_bool_binop_done;
13925 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error)
13926 __Pyx_GOTREF(__pyx_t_4);
13927 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 696, __pyx_L1_error)
13928 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13929 __pyx_t_7 = ((!__pyx_t_1) != 0);
13930 __pyx_t_2 = __pyx_t_7;
13931 __pyx_L9_bool_binop_done:;
13934 /* "lxml/html/diff.py":697
13935 * yield start_tag(el)
13936 * if el.tag in empty_tags and not el.text and not len(el) and not el.tail:
13937 * return # <<<<<<<<<<<<<<
13938 * start_words = split_words(el.text)
13939 * for word in start_words:
13941 __Pyx_XDECREF(__pyx_r);
13945 /* "lxml/html/diff.py":696
13947 * yield start_tag(el)
13948 * if el.tag in empty_tags and not el.text and not len(el) and not el.tail: # <<<<<<<<<<<<<<
13950 * start_words = split_words(el.text)
13954 /* "lxml/html/diff.py":698
13955 * if el.tag in empty_tags and not el.text and not len(el) and not el.tail:
13957 * start_words = split_words(el.text) # <<<<<<<<<<<<<<
13958 * for word in start_words:
13959 * yield html_escape(word)
13961 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_split_words); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error)
13962 __Pyx_GOTREF(__pyx_t_5);
13963 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
13964 __Pyx_GOTREF(__pyx_t_3);
13966 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
13967 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
13968 if (likely(__pyx_t_6)) {
13969 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13970 __Pyx_INCREF(__pyx_t_6);
13971 __Pyx_INCREF(function);
13972 __Pyx_DECREF_SET(__pyx_t_5, function);
13975 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
13976 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13977 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13978 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
13979 __Pyx_GOTREF(__pyx_t_4);
13980 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13981 __Pyx_GIVEREF(__pyx_t_4);
13982 __pyx_cur_scope->__pyx_v_start_words = __pyx_t_4;
13985 /* "lxml/html/diff.py":699
13987 * start_words = split_words(el.text)
13988 * for word in start_words: # <<<<<<<<<<<<<<
13989 * yield html_escape(word)
13992 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_start_words)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_start_words)) {
13993 __pyx_t_4 = __pyx_cur_scope->__pyx_v_start_words; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
13996 __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_start_words); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
13997 __Pyx_GOTREF(__pyx_t_4);
13998 __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 699, __pyx_L1_error)
14001 if (likely(!__pyx_t_9)) {
14002 if (likely(PyList_CheckExact(__pyx_t_4))) {
14003 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
14004 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14005 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 699, __pyx_L1_error)
14007 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
14008 __Pyx_GOTREF(__pyx_t_5);
14011 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
14012 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14013 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 699, __pyx_L1_error)
14015 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
14016 __Pyx_GOTREF(__pyx_t_5);
14020 __pyx_t_5 = __pyx_t_9(__pyx_t_4);
14021 if (unlikely(!__pyx_t_5)) {
14022 PyObject* exc_type = PyErr_Occurred();
14024 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14025 else __PYX_ERR(0, 699, __pyx_L1_error)
14029 __Pyx_GOTREF(__pyx_t_5);
14031 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
14032 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_5);
14033 __Pyx_GIVEREF(__pyx_t_5);
14036 /* "lxml/html/diff.py":700
14037 * start_words = split_words(el.text)
14038 * for word in start_words:
14039 * yield html_escape(word) # <<<<<<<<<<<<<<
14041 * for item in flatten_el(child, include_hrefs=include_hrefs):
14043 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_html_escape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
14044 __Pyx_GOTREF(__pyx_t_3);
14046 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14047 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
14048 if (likely(__pyx_t_6)) {
14049 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14050 __Pyx_INCREF(__pyx_t_6);
14051 __Pyx_INCREF(function);
14052 __Pyx_DECREF_SET(__pyx_t_3, function);
14055 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_cur_scope->__pyx_v_word) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_word);
14056 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14057 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
14058 __Pyx_GOTREF(__pyx_t_5);
14059 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14060 __pyx_r = __pyx_t_5;
14062 __Pyx_XGIVEREF(__pyx_t_4);
14063 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
14064 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
14065 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
14066 __Pyx_XGIVEREF(__pyx_r);
14067 __Pyx_RefNannyFinishContext();
14068 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14069 /* return from generator, yielding value */
14070 __pyx_generator->resume_label = 3;
14072 __pyx_L15_resume_from_yield:;
14073 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
14074 __pyx_cur_scope->__pyx_t_0 = 0;
14075 __Pyx_XGOTREF(__pyx_t_4);
14076 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
14077 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
14078 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 700, __pyx_L1_error)
14080 /* "lxml/html/diff.py":699
14082 * start_words = split_words(el.text)
14083 * for word in start_words: # <<<<<<<<<<<<<<
14084 * yield html_escape(word)
14088 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14090 /* "lxml/html/diff.py":701
14091 * for word in start_words:
14092 * yield html_escape(word)
14093 * for child in el: # <<<<<<<<<<<<<<
14094 * for item in flatten_el(child, include_hrefs=include_hrefs):
14097 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_el)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_el)) {
14098 __pyx_t_4 = __pyx_cur_scope->__pyx_v_el; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
14101 __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_el); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 701, __pyx_L1_error)
14102 __Pyx_GOTREF(__pyx_t_4);
14103 __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 701, __pyx_L1_error)
14106 if (likely(!__pyx_t_9)) {
14107 if (likely(PyList_CheckExact(__pyx_t_4))) {
14108 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
14109 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14110 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 701, __pyx_L1_error)
14112 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L1_error)
14113 __Pyx_GOTREF(__pyx_t_5);
14116 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
14117 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14118 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 701, __pyx_L1_error)
14120 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L1_error)
14121 __Pyx_GOTREF(__pyx_t_5);
14125 __pyx_t_5 = __pyx_t_9(__pyx_t_4);
14126 if (unlikely(!__pyx_t_5)) {
14127 PyObject* exc_type = PyErr_Occurred();
14129 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14130 else __PYX_ERR(0, 701, __pyx_L1_error)
14134 __Pyx_GOTREF(__pyx_t_5);
14136 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_child);
14137 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_child, __pyx_t_5);
14138 __Pyx_GIVEREF(__pyx_t_5);
14141 /* "lxml/html/diff.py":702
14142 * yield html_escape(word)
14144 * for item in flatten_el(child, include_hrefs=include_hrefs): # <<<<<<<<<<<<<<
14146 * if el.tag == 'a' and el.get('href') and include_hrefs:
14148 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_flatten_el); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error)
14149 __Pyx_GOTREF(__pyx_t_5);
14150 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error)
14151 __Pyx_GOTREF(__pyx_t_3);
14152 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_child);
14153 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_child);
14154 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_child);
14155 __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error)
14156 __Pyx_GOTREF(__pyx_t_6);
14157 if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_include_hrefs, __pyx_cur_scope->__pyx_v_include_hrefs) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
14158 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 702, __pyx_L1_error)
14159 __Pyx_GOTREF(__pyx_t_10);
14160 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14161 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14162 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14163 if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
14164 __pyx_t_6 = __pyx_t_10; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
14167 __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error)
14168 __Pyx_GOTREF(__pyx_t_6);
14169 __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 702, __pyx_L1_error)
14171 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14173 if (likely(!__pyx_t_12)) {
14174 if (likely(PyList_CheckExact(__pyx_t_6))) {
14175 if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
14176 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14177 __pyx_t_10 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_10); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 702, __pyx_L1_error)
14179 __pyx_t_10 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 702, __pyx_L1_error)
14180 __Pyx_GOTREF(__pyx_t_10);
14183 if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
14184 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14185 __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_10); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 702, __pyx_L1_error)
14187 __pyx_t_10 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 702, __pyx_L1_error)
14188 __Pyx_GOTREF(__pyx_t_10);
14192 __pyx_t_10 = __pyx_t_12(__pyx_t_6);
14193 if (unlikely(!__pyx_t_10)) {
14194 PyObject* exc_type = PyErr_Occurred();
14196 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14197 else __PYX_ERR(0, 702, __pyx_L1_error)
14201 __Pyx_GOTREF(__pyx_t_10);
14203 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_item);
14204 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_item, __pyx_t_10);
14205 __Pyx_GIVEREF(__pyx_t_10);
14208 /* "lxml/html/diff.py":703
14210 * for item in flatten_el(child, include_hrefs=include_hrefs):
14211 * yield item # <<<<<<<<<<<<<<
14212 * if el.tag == 'a' and el.get('href') and include_hrefs:
14213 * yield ('href', el.get('href'))
14215 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_item);
14216 __pyx_r = __pyx_cur_scope->__pyx_v_item;
14217 __Pyx_XGIVEREF(__pyx_t_4);
14218 __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
14219 __Pyx_XGIVEREF(__pyx_t_6);
14220 __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
14221 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
14222 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
14223 __pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
14224 __pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
14225 __Pyx_XGIVEREF(__pyx_r);
14226 __Pyx_RefNannyFinishContext();
14227 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14228 /* return from generator, yielding value */
14229 __pyx_generator->resume_label = 4;
14231 __pyx_L20_resume_from_yield:;
14232 __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
14233 __pyx_cur_scope->__pyx_t_0 = 0;
14234 __Pyx_XGOTREF(__pyx_t_4);
14235 __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
14236 __pyx_cur_scope->__pyx_t_3 = 0;
14237 __Pyx_XGOTREF(__pyx_t_6);
14238 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
14239 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
14240 __pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
14241 __pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
14242 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 703, __pyx_L1_error)
14244 /* "lxml/html/diff.py":702
14245 * yield html_escape(word)
14247 * for item in flatten_el(child, include_hrefs=include_hrefs): # <<<<<<<<<<<<<<
14249 * if el.tag == 'a' and el.get('href') and include_hrefs:
14252 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14254 /* "lxml/html/diff.py":701
14255 * for word in start_words:
14256 * yield html_escape(word)
14257 * for child in el: # <<<<<<<<<<<<<<
14258 * for item in flatten_el(child, include_hrefs=include_hrefs):
14262 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14264 /* "lxml/html/diff.py":704
14265 * for item in flatten_el(child, include_hrefs=include_hrefs):
14267 * if el.tag == 'a' and el.get('href') and include_hrefs: # <<<<<<<<<<<<<<
14268 * yield ('href', el.get('href'))
14271 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error)
14272 __Pyx_GOTREF(__pyx_t_4);
14273 __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_a, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
14274 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14277 __pyx_t_2 = __pyx_t_7;
14278 goto __pyx_L22_bool_binop_done;
14280 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 704, __pyx_L1_error)
14281 __Pyx_GOTREF(__pyx_t_6);
14283 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
14284 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
14285 if (likely(__pyx_t_10)) {
14286 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
14287 __Pyx_INCREF(__pyx_t_10);
14288 __Pyx_INCREF(function);
14289 __Pyx_DECREF_SET(__pyx_t_6, function);
14292 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_n_u_href) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_u_href);
14293 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14294 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error)
14295 __Pyx_GOTREF(__pyx_t_4);
14296 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14297 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
14298 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14301 __pyx_t_2 = __pyx_t_7;
14302 goto __pyx_L22_bool_binop_done;
14304 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_include_hrefs); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
14305 __pyx_t_2 = __pyx_t_7;
14306 __pyx_L22_bool_binop_done:;
14309 /* "lxml/html/diff.py":705
14311 * if el.tag == 'a' and el.get('href') and include_hrefs:
14312 * yield ('href', el.get('href')) # <<<<<<<<<<<<<<
14314 * yield end_tag(el)
14316 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L1_error)
14317 __Pyx_GOTREF(__pyx_t_6);
14319 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
14320 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
14321 if (likely(__pyx_t_10)) {
14322 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
14323 __Pyx_INCREF(__pyx_t_10);
14324 __Pyx_INCREF(function);
14325 __Pyx_DECREF_SET(__pyx_t_6, function);
14328 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_n_u_href) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_u_href);
14329 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14330 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error)
14331 __Pyx_GOTREF(__pyx_t_4);
14332 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14333 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L1_error)
14334 __Pyx_GOTREF(__pyx_t_6);
14335 __Pyx_INCREF(__pyx_n_u_href);
14336 __Pyx_GIVEREF(__pyx_n_u_href);
14337 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_href);
14338 __Pyx_GIVEREF(__pyx_t_4);
14339 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
14341 __pyx_r = __pyx_t_6;
14343 __Pyx_XGIVEREF(__pyx_r);
14344 __Pyx_RefNannyFinishContext();
14345 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14346 /* return from generator, yielding value */
14347 __pyx_generator->resume_label = 5;
14349 __pyx_L25_resume_from_yield:;
14350 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 705, __pyx_L1_error)
14352 /* "lxml/html/diff.py":704
14353 * for item in flatten_el(child, include_hrefs=include_hrefs):
14355 * if el.tag == 'a' and el.get('href') and include_hrefs: # <<<<<<<<<<<<<<
14356 * yield ('href', el.get('href'))
14361 /* "lxml/html/diff.py":706
14362 * if el.tag == 'a' and el.get('href') and include_hrefs:
14363 * yield ('href', el.get('href'))
14364 * if not skip_tag: # <<<<<<<<<<<<<<
14365 * yield end_tag(el)
14366 * end_words = split_words(el.tail)
14368 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_skip_tag); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 706, __pyx_L1_error)
14369 __pyx_t_7 = ((!__pyx_t_2) != 0);
14372 /* "lxml/html/diff.py":707
14373 * yield ('href', el.get('href'))
14375 * yield end_tag(el) # <<<<<<<<<<<<<<
14376 * end_words = split_words(el.tail)
14377 * for word in end_words:
14379 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_end_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error)
14380 __Pyx_GOTREF(__pyx_t_4);
14382 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14383 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
14384 if (likely(__pyx_t_10)) {
14385 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14386 __Pyx_INCREF(__pyx_t_10);
14387 __Pyx_INCREF(function);
14388 __Pyx_DECREF_SET(__pyx_t_4, function);
14391 __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_cur_scope->__pyx_v_el) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_el);
14392 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14393 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 707, __pyx_L1_error)
14394 __Pyx_GOTREF(__pyx_t_6);
14395 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14396 __pyx_r = __pyx_t_6;
14398 __Pyx_XGIVEREF(__pyx_r);
14399 __Pyx_RefNannyFinishContext();
14400 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14401 /* return from generator, yielding value */
14402 __pyx_generator->resume_label = 6;
14404 __pyx_L27_resume_from_yield:;
14405 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 707, __pyx_L1_error)
14407 /* "lxml/html/diff.py":708
14409 * yield end_tag(el)
14410 * end_words = split_words(el.tail) # <<<<<<<<<<<<<<
14411 * for word in end_words:
14412 * yield html_escape(word)
14414 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_split_words); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
14415 __Pyx_GOTREF(__pyx_t_4);
14416 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 708, __pyx_L1_error)
14417 __Pyx_GOTREF(__pyx_t_10);
14419 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14420 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
14421 if (likely(__pyx_t_3)) {
14422 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14423 __Pyx_INCREF(__pyx_t_3);
14424 __Pyx_INCREF(function);
14425 __Pyx_DECREF_SET(__pyx_t_4, function);
14428 __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10);
14429 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14430 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14431 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 708, __pyx_L1_error)
14432 __Pyx_GOTREF(__pyx_t_6);
14433 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14434 __Pyx_GIVEREF(__pyx_t_6);
14435 __pyx_cur_scope->__pyx_v_end_words = __pyx_t_6;
14438 /* "lxml/html/diff.py":709
14439 * yield end_tag(el)
14440 * end_words = split_words(el.tail)
14441 * for word in end_words: # <<<<<<<<<<<<<<
14442 * yield html_escape(word)
14445 if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_end_words)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_end_words)) {
14446 __pyx_t_6 = __pyx_cur_scope->__pyx_v_end_words; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
14449 __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_end_words); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error)
14450 __Pyx_GOTREF(__pyx_t_6);
14451 __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 709, __pyx_L1_error)
14454 if (likely(!__pyx_t_9)) {
14455 if (likely(PyList_CheckExact(__pyx_t_6))) {
14456 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
14457 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14458 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 709, __pyx_L1_error)
14460 __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
14461 __Pyx_GOTREF(__pyx_t_4);
14464 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
14465 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14466 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 709, __pyx_L1_error)
14468 __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
14469 __Pyx_GOTREF(__pyx_t_4);
14473 __pyx_t_4 = __pyx_t_9(__pyx_t_6);
14474 if (unlikely(!__pyx_t_4)) {
14475 PyObject* exc_type = PyErr_Occurred();
14477 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14478 else __PYX_ERR(0, 709, __pyx_L1_error)
14482 __Pyx_GOTREF(__pyx_t_4);
14484 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word);
14485 __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word, __pyx_t_4);
14486 __Pyx_GIVEREF(__pyx_t_4);
14489 /* "lxml/html/diff.py":710
14490 * end_words = split_words(el.tail)
14491 * for word in end_words:
14492 * yield html_escape(word) # <<<<<<<<<<<<<<
14494 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U)
14496 __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_html_escape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 710, __pyx_L1_error)
14497 __Pyx_GOTREF(__pyx_t_10);
14499 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
14500 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
14501 if (likely(__pyx_t_3)) {
14502 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
14503 __Pyx_INCREF(__pyx_t_3);
14504 __Pyx_INCREF(function);
14505 __Pyx_DECREF_SET(__pyx_t_10, function);
14508 __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_3, __pyx_cur_scope->__pyx_v_word) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_cur_scope->__pyx_v_word);
14509 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14510 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error)
14511 __Pyx_GOTREF(__pyx_t_4);
14512 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14513 __pyx_r = __pyx_t_4;
14515 __Pyx_XGIVEREF(__pyx_t_6);
14516 __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
14517 __pyx_cur_scope->__pyx_t_1 = __pyx_t_8;
14518 __pyx_cur_scope->__pyx_t_2 = __pyx_t_9;
14519 __Pyx_XGIVEREF(__pyx_r);
14520 __Pyx_RefNannyFinishContext();
14521 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14522 /* return from generator, yielding value */
14523 __pyx_generator->resume_label = 7;
14525 __pyx_L30_resume_from_yield:;
14526 __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
14527 __pyx_cur_scope->__pyx_t_0 = 0;
14528 __Pyx_XGOTREF(__pyx_t_6);
14529 __pyx_t_8 = __pyx_cur_scope->__pyx_t_1;
14530 __pyx_t_9 = __pyx_cur_scope->__pyx_t_2;
14531 if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 710, __pyx_L1_error)
14533 /* "lxml/html/diff.py":709
14534 * yield end_tag(el)
14535 * end_words = split_words(el.tail)
14536 * for word in end_words: # <<<<<<<<<<<<<<
14537 * yield html_escape(word)
14541 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14543 /* "lxml/html/diff.py":706
14544 * if el.tag == 'a' and el.get('href') and include_hrefs:
14545 * yield ('href', el.get('href'))
14546 * if not skip_tag: # <<<<<<<<<<<<<<
14547 * yield end_tag(el)
14548 * end_words = split_words(el.tail)
14551 CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
14553 /* "lxml/html/diff.py":684
14556 * def flatten_el(el, include_hrefs, skip_tag=False): # <<<<<<<<<<<<<<
14557 * """ Takes an lxml element el, and generates all the text chunks for
14558 * that tag. Each start tag is a chunk, each word is a chunk, and each
14561 /* function exit code */
14562 PyErr_SetNone(PyExc_StopIteration);
14565 __Pyx_XDECREF(__pyx_t_3);
14566 __Pyx_XDECREF(__pyx_t_4);
14567 __Pyx_XDECREF(__pyx_t_5);
14568 __Pyx_XDECREF(__pyx_t_6);
14569 __Pyx_XDECREF(__pyx_t_10);
14570 __Pyx_AddTraceback("flatten_el", __pyx_clineno, __pyx_lineno, __pyx_filename);
14572 __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
14573 #if !CYTHON_USE_EXC_INFO_STACK
14574 __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
14576 __pyx_generator->resume_label = -1;
14577 __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
14578 __Pyx_RefNannyFinishContext();
14582 /* "lxml/html/diff.py":714
14583 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U)
14585 * def split_words(text): # <<<<<<<<<<<<<<
14586 * """ Splits some text into words. Includes trailing whitespace
14587 * on each word when appropriate. """
14590 /* Python wrapper */
14591 static PyObject *__pyx_pw_4lxml_4html_4diff_52split_words(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/
14592 static char __pyx_doc_4lxml_4html_4diff_51split_words[] = " Splits some text into words. Includes trailing whitespace\n on each word when appropriate. ";
14593 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_52split_words = {"split_words", (PyCFunction)__pyx_pw_4lxml_4html_4diff_52split_words, METH_O, __pyx_doc_4lxml_4html_4diff_51split_words};
14594 static PyObject *__pyx_pw_4lxml_4html_4diff_52split_words(PyObject *__pyx_self, PyObject *__pyx_v_text) {
14595 PyObject *__pyx_r = 0;
14596 __Pyx_RefNannyDeclarations
14597 __Pyx_RefNannySetupContext("split_words (wrapper)", 0);
14598 __pyx_r = __pyx_pf_4lxml_4html_4diff_51split_words(__pyx_self, ((PyObject *)__pyx_v_text));
14600 /* function exit code */
14601 __Pyx_RefNannyFinishContext();
14605 static PyObject *__pyx_pf_4lxml_4html_4diff_51split_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) {
14606 PyObject *__pyx_v_words = NULL;
14607 PyObject *__pyx_r = NULL;
14608 __Pyx_RefNannyDeclarations
14612 PyObject *__pyx_t_4 = NULL;
14613 PyObject *__pyx_t_5 = NULL;
14614 PyObject *__pyx_t_6 = NULL;
14615 int __pyx_lineno = 0;
14616 const char *__pyx_filename = NULL;
14617 int __pyx_clineno = 0;
14618 __Pyx_RefNannySetupContext("split_words", 0);
14620 /* "lxml/html/diff.py":717
14621 * """ Splits some text into words. Includes trailing whitespace
14622 * on each word when appropriate. """
14623 * if not text or not text.strip(): # <<<<<<<<<<<<<<
14627 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 717, __pyx_L1_error)
14628 __pyx_t_3 = ((!__pyx_t_2) != 0);
14631 __pyx_t_1 = __pyx_t_3;
14632 goto __pyx_L4_bool_binop_done;
14634 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L1_error)
14635 __Pyx_GOTREF(__pyx_t_5);
14637 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
14638 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
14639 if (likely(__pyx_t_6)) {
14640 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
14641 __Pyx_INCREF(__pyx_t_6);
14642 __Pyx_INCREF(function);
14643 __Pyx_DECREF_SET(__pyx_t_5, function);
14646 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
14647 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14648 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L1_error)
14649 __Pyx_GOTREF(__pyx_t_4);
14650 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14651 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 717, __pyx_L1_error)
14652 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14653 __pyx_t_2 = ((!__pyx_t_3) != 0);
14654 __pyx_t_1 = __pyx_t_2;
14655 __pyx_L4_bool_binop_done:;
14658 /* "lxml/html/diff.py":718
14659 * on each word when appropriate. """
14660 * if not text or not text.strip():
14661 * return [] # <<<<<<<<<<<<<<
14663 * words = split_words_re.findall(text)
14665 __Pyx_XDECREF(__pyx_r);
14666 __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 718, __pyx_L1_error)
14667 __Pyx_GOTREF(__pyx_t_4);
14668 __pyx_r = __pyx_t_4;
14672 /* "lxml/html/diff.py":717
14673 * """ Splits some text into words. Includes trailing whitespace
14674 * on each word when appropriate. """
14675 * if not text or not text.strip(): # <<<<<<<<<<<<<<
14681 /* "lxml/html/diff.py":720
14684 * words = split_words_re.findall(text) # <<<<<<<<<<<<<<
14688 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_split_words_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 720, __pyx_L1_error)
14689 __Pyx_GOTREF(__pyx_t_5);
14690 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_findall); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 720, __pyx_L1_error)
14691 __Pyx_GOTREF(__pyx_t_6);
14692 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14694 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
14695 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
14696 if (likely(__pyx_t_5)) {
14697 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
14698 __Pyx_INCREF(__pyx_t_5);
14699 __Pyx_INCREF(function);
14700 __Pyx_DECREF_SET(__pyx_t_6, function);
14703 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_text) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_text);
14704 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14705 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 720, __pyx_L1_error)
14706 __Pyx_GOTREF(__pyx_t_4);
14707 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14708 __pyx_v_words = __pyx_t_4;
14711 /* "lxml/html/diff.py":721
14713 * words = split_words_re.findall(text)
14714 * return words # <<<<<<<<<<<<<<
14716 * start_whitespace_re = re.compile(r'^[ \t\n\r]')
14718 __Pyx_XDECREF(__pyx_r);
14719 __Pyx_INCREF(__pyx_v_words);
14720 __pyx_r = __pyx_v_words;
14723 /* "lxml/html/diff.py":714
14724 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U)
14726 * def split_words(text): # <<<<<<<<<<<<<<
14727 * """ Splits some text into words. Includes trailing whitespace
14728 * on each word when appropriate. """
14731 /* function exit code */
14733 __Pyx_XDECREF(__pyx_t_4);
14734 __Pyx_XDECREF(__pyx_t_5);
14735 __Pyx_XDECREF(__pyx_t_6);
14736 __Pyx_AddTraceback("lxml.html.diff.split_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
14739 __Pyx_XDECREF(__pyx_v_words);
14740 __Pyx_XGIVEREF(__pyx_r);
14741 __Pyx_RefNannyFinishContext();
14745 /* "lxml/html/diff.py":725
14746 * start_whitespace_re = re.compile(r'^[ \t\n\r]')
14748 * def start_tag(el): # <<<<<<<<<<<<<<
14750 * The text representation of the start tag for a tag.
14753 /* Python wrapper */
14754 static PyObject *__pyx_pw_4lxml_4html_4diff_54start_tag(PyObject *__pyx_self, PyObject *__pyx_v_el); /*proto*/
14755 static char __pyx_doc_4lxml_4html_4diff_53start_tag[] = "\n The text representation of the start tag for a tag.\n ";
14756 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_54start_tag = {"start_tag", (PyCFunction)__pyx_pw_4lxml_4html_4diff_54start_tag, METH_O, __pyx_doc_4lxml_4html_4diff_53start_tag};
14757 static PyObject *__pyx_pw_4lxml_4html_4diff_54start_tag(PyObject *__pyx_self, PyObject *__pyx_v_el) {
14758 PyObject *__pyx_r = 0;
14759 __Pyx_RefNannyDeclarations
14760 __Pyx_RefNannySetupContext("start_tag (wrapper)", 0);
14761 __pyx_r = __pyx_pf_4lxml_4html_4diff_53start_tag(__pyx_self, ((PyObject *)__pyx_v_el));
14763 /* function exit code */
14764 __Pyx_RefNannyFinishContext();
14768 static PyObject *__pyx_pf_4lxml_4html_4diff_53start_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el) {
14769 PyObject *__pyx_8genexpr4__pyx_v_name = NULL;
14770 PyObject *__pyx_8genexpr4__pyx_v_value = NULL;
14771 PyObject *__pyx_r = NULL;
14772 __Pyx_RefNannyDeclarations
14773 PyObject *__pyx_t_1 = NULL;
14774 Py_ssize_t __pyx_t_2;
14776 PyObject *__pyx_t_4 = NULL;
14777 PyObject *__pyx_t_5 = NULL;
14778 Py_ssize_t __pyx_t_6;
14779 Py_ssize_t __pyx_t_7;
14781 PyObject *__pyx_t_9 = NULL;
14782 PyObject *__pyx_t_10 = NULL;
14784 Py_ssize_t __pyx_t_12;
14785 Py_UCS4 __pyx_t_13;
14786 PyObject *__pyx_t_14 = NULL;
14787 PyObject *__pyx_t_15 = NULL;
14788 PyObject *__pyx_t_16 = NULL;
14789 int __pyx_lineno = 0;
14790 const char *__pyx_filename = NULL;
14791 int __pyx_clineno = 0;
14792 __Pyx_RefNannySetupContext("start_tag", 0);
14794 /* "lxml/html/diff.py":729
14795 * The text representation of the start tag for a tag.
14797 * return '<%s%s>' % ( # <<<<<<<<<<<<<<
14798 * el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True))
14799 * for name, value in el.attrib.items()]))
14801 __Pyx_XDECREF(__pyx_r);
14802 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)
14803 __Pyx_GOTREF(__pyx_t_1);
14806 __Pyx_INCREF(__pyx_kp_u__8);
14808 __Pyx_GIVEREF(__pyx_kp_u__8);
14809 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__8);
14811 /* "lxml/html/diff.py":730
14813 * return '<%s%s>' % (
14814 * el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True)) # <<<<<<<<<<<<<<
14815 * for name, value in el.attrib.items()]))
14818 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error)
14819 __Pyx_GOTREF(__pyx_t_4);
14820 __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L1_error)
14821 __Pyx_GOTREF(__pyx_t_5);
14822 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14823 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3;
14824 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
14825 __Pyx_GIVEREF(__pyx_t_5);
14826 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
14828 { /* enter inner scope */
14829 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L5_error)
14830 __Pyx_GOTREF(__pyx_t_5);
14832 /* "lxml/html/diff.py":731
14833 * return '<%s%s>' % (
14834 * el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True))
14835 * for name, value in el.attrib.items()])) # <<<<<<<<<<<<<<
14840 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_attrib); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 731, __pyx_L5_error)
14841 __Pyx_GOTREF(__pyx_t_9);
14842 if (unlikely(__pyx_t_9 == Py_None)) {
14843 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
14844 __PYX_ERR(0, 731, __pyx_L5_error)
14846 __pyx_t_10 = __Pyx_dict_iterator(__pyx_t_9, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L5_error)
14847 __Pyx_GOTREF(__pyx_t_10);
14848 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14849 __Pyx_XDECREF(__pyx_t_4);
14850 __pyx_t_4 = __pyx_t_10;
14853 __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_7, &__pyx_t_6, &__pyx_t_10, &__pyx_t_9, NULL, __pyx_t_8);
14854 if (unlikely(__pyx_t_11 == 0)) break;
14855 if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 731, __pyx_L5_error)
14856 __Pyx_GOTREF(__pyx_t_10);
14857 __Pyx_GOTREF(__pyx_t_9);
14858 __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_name, __pyx_t_10);
14860 __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_value, __pyx_t_9);
14863 /* "lxml/html/diff.py":730
14865 * return '<%s%s>' % (
14866 * el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True)) # <<<<<<<<<<<<<<
14867 * for name, value in el.attrib.items()]))
14870 __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 730, __pyx_L5_error)
14871 __Pyx_GOTREF(__pyx_t_9);
14874 __Pyx_INCREF(__pyx_kp_u__6);
14876 __Pyx_GIVEREF(__pyx_kp_u__6);
14877 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u__6);
14878 __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_8genexpr4__pyx_v_name), __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L5_error)
14879 __Pyx_GOTREF(__pyx_t_10);
14880 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_13;
14881 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
14882 __Pyx_GIVEREF(__pyx_t_10);
14883 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
14885 __Pyx_INCREF(__pyx_kp_u__18);
14887 __Pyx_GIVEREF(__pyx_kp_u__18);
14888 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u__18);
14889 __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_html_escape); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 730, __pyx_L5_error)
14890 __Pyx_GOTREF(__pyx_t_14);
14893 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
14894 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
14895 if (likely(__pyx_t_15)) {
14896 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
14897 __Pyx_INCREF(__pyx_t_15);
14898 __Pyx_INCREF(function);
14899 __Pyx_DECREF_SET(__pyx_t_14, function);
14903 #if CYTHON_FAST_PYCALL
14904 if (PyFunction_Check(__pyx_t_14)) {
14905 PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_8genexpr4__pyx_v_value, Py_True};
14906 __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L5_error)
14907 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
14908 __Pyx_GOTREF(__pyx_t_10);
14911 #if CYTHON_FAST_PYCCALL
14912 if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
14913 PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_8genexpr4__pyx_v_value, Py_True};
14914 __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L5_error)
14915 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
14916 __Pyx_GOTREF(__pyx_t_10);
14920 __pyx_t_16 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 730, __pyx_L5_error)
14921 __Pyx_GOTREF(__pyx_t_16);
14923 __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
14925 __Pyx_INCREF(__pyx_8genexpr4__pyx_v_value);
14926 __Pyx_GIVEREF(__pyx_8genexpr4__pyx_v_value);
14927 PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_11, __pyx_8genexpr4__pyx_v_value);
14928 __Pyx_INCREF(Py_True);
14929 __Pyx_GIVEREF(Py_True);
14930 PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_11, Py_True);
14931 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L5_error)
14932 __Pyx_GOTREF(__pyx_t_10);
14933 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
14935 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
14936 __pyx_t_14 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_10), __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 730, __pyx_L5_error)
14937 __Pyx_GOTREF(__pyx_t_14);
14938 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14939 __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_14) : __pyx_t_13;
14940 __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_14);
14941 __Pyx_GIVEREF(__pyx_t_14);
14942 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_14);
14944 __Pyx_INCREF(__pyx_kp_u__19);
14946 __Pyx_GIVEREF(__pyx_kp_u__19);
14947 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_kp_u__19);
14948 __pyx_t_14 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 730, __pyx_L5_error)
14949 __Pyx_GOTREF(__pyx_t_14);
14950 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14951 if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 730, __pyx_L5_error)
14952 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
14954 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14955 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_name); __pyx_8genexpr4__pyx_v_name = 0;
14956 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_value); __pyx_8genexpr4__pyx_v_value = 0;
14957 goto __pyx_L8_exit_scope;
14959 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_name); __pyx_8genexpr4__pyx_v_name = 0;
14960 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_value); __pyx_8genexpr4__pyx_v_value = 0;
14961 goto __pyx_L1_error;
14962 __pyx_L8_exit_scope:;
14963 } /* exit inner scope */
14964 __pyx_t_4 = PyUnicode_Join(__pyx_kp_u__2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error)
14965 __Pyx_GOTREF(__pyx_t_4);
14966 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14967 __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
14968 __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
14969 __Pyx_GIVEREF(__pyx_t_4);
14970 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
14972 __Pyx_INCREF(__pyx_kp_u__20);
14974 __Pyx_GIVEREF(__pyx_kp_u__20);
14975 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__20);
14977 /* "lxml/html/diff.py":729
14978 * The text representation of the start tag for a tag.
14980 * return '<%s%s>' % ( # <<<<<<<<<<<<<<
14981 * el.tag, ''.join([' %s="%s"' % (name, html_escape(value, True))
14982 * for name, value in el.attrib.items()]))
14984 __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L1_error)
14985 __Pyx_GOTREF(__pyx_t_4);
14986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14987 __pyx_r = __pyx_t_4;
14991 /* "lxml/html/diff.py":725
14992 * start_whitespace_re = re.compile(r'^[ \t\n\r]')
14994 * def start_tag(el): # <<<<<<<<<<<<<<
14996 * The text representation of the start tag for a tag.
14999 /* function exit code */
15001 __Pyx_XDECREF(__pyx_t_1);
15002 __Pyx_XDECREF(__pyx_t_4);
15003 __Pyx_XDECREF(__pyx_t_5);
15004 __Pyx_XDECREF(__pyx_t_9);
15005 __Pyx_XDECREF(__pyx_t_10);
15006 __Pyx_XDECREF(__pyx_t_14);
15007 __Pyx_XDECREF(__pyx_t_15);
15008 __Pyx_XDECREF(__pyx_t_16);
15009 __Pyx_AddTraceback("lxml.html.diff.start_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
15012 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_name);
15013 __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_value);
15014 __Pyx_XGIVEREF(__pyx_r);
15015 __Pyx_RefNannyFinishContext();
15019 /* "lxml/html/diff.py":733
15020 * for name, value in el.attrib.items()]))
15022 * def end_tag(el): # <<<<<<<<<<<<<<
15023 * """ The text representation of an end tag for a tag. Includes
15024 * trailing whitespace when appropriate. """
15027 /* Python wrapper */
15028 static PyObject *__pyx_pw_4lxml_4html_4diff_56end_tag(PyObject *__pyx_self, PyObject *__pyx_v_el); /*proto*/
15029 static char __pyx_doc_4lxml_4html_4diff_55end_tag[] = " The text representation of an end tag for a tag. Includes\n trailing whitespace when appropriate. ";
15030 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_56end_tag = {"end_tag", (PyCFunction)__pyx_pw_4lxml_4html_4diff_56end_tag, METH_O, __pyx_doc_4lxml_4html_4diff_55end_tag};
15031 static PyObject *__pyx_pw_4lxml_4html_4diff_56end_tag(PyObject *__pyx_self, PyObject *__pyx_v_el) {
15032 PyObject *__pyx_r = 0;
15033 __Pyx_RefNannyDeclarations
15034 __Pyx_RefNannySetupContext("end_tag (wrapper)", 0);
15035 __pyx_r = __pyx_pf_4lxml_4html_4diff_55end_tag(__pyx_self, ((PyObject *)__pyx_v_el));
15037 /* function exit code */
15038 __Pyx_RefNannyFinishContext();
15042 static PyObject *__pyx_pf_4lxml_4html_4diff_55end_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el) {
15043 PyObject *__pyx_v_extra = NULL;
15044 PyObject *__pyx_r = NULL;
15045 __Pyx_RefNannyDeclarations
15047 PyObject *__pyx_t_2 = NULL;
15049 PyObject *__pyx_t_4 = NULL;
15050 PyObject *__pyx_t_5 = NULL;
15051 PyObject *__pyx_t_6 = NULL;
15052 Py_ssize_t __pyx_t_7;
15054 int __pyx_lineno = 0;
15055 const char *__pyx_filename = NULL;
15056 int __pyx_clineno = 0;
15057 __Pyx_RefNannySetupContext("end_tag", 0);
15059 /* "lxml/html/diff.py":736
15060 * """ The text representation of an end tag for a tag. Includes
15061 * trailing whitespace when appropriate. """
15062 * if el.tail and start_whitespace_re.search(el.tail): # <<<<<<<<<<<<<<
15066 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error)
15067 __Pyx_GOTREF(__pyx_t_2);
15068 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 736, __pyx_L1_error)
15069 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15072 __pyx_t_1 = __pyx_t_3;
15073 goto __pyx_L4_bool_binop_done;
15075 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_start_whitespace_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error)
15076 __Pyx_GOTREF(__pyx_t_4);
15077 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error)
15078 __Pyx_GOTREF(__pyx_t_5);
15079 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15080 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error)
15081 __Pyx_GOTREF(__pyx_t_4);
15083 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
15084 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
15085 if (likely(__pyx_t_6)) {
15086 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
15087 __Pyx_INCREF(__pyx_t_6);
15088 __Pyx_INCREF(function);
15089 __Pyx_DECREF_SET(__pyx_t_5, function);
15092 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
15093 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
15094 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15095 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error)
15096 __Pyx_GOTREF(__pyx_t_2);
15097 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15098 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 736, __pyx_L1_error)
15099 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15100 __pyx_t_1 = __pyx_t_3;
15101 __pyx_L4_bool_binop_done:;
15104 /* "lxml/html/diff.py":737
15105 * trailing whitespace when appropriate. """
15106 * if el.tail and start_whitespace_re.search(el.tail):
15107 * extra = ' ' # <<<<<<<<<<<<<<
15111 __Pyx_INCREF(__pyx_kp_u__6);
15112 __pyx_v_extra = __pyx_kp_u__6;
15114 /* "lxml/html/diff.py":736
15115 * """ The text representation of an end tag for a tag. Includes
15116 * trailing whitespace when appropriate. """
15117 * if el.tail and start_whitespace_re.search(el.tail): # <<<<<<<<<<<<<<
15124 /* "lxml/html/diff.py":739
15127 * extra = '' # <<<<<<<<<<<<<<
15128 * return '</%s>%s' % (el.tag, extra)
15132 __Pyx_INCREF(__pyx_kp_u__2);
15133 __pyx_v_extra = __pyx_kp_u__2;
15137 /* "lxml/html/diff.py":740
15140 * return '</%s>%s' % (el.tag, extra) # <<<<<<<<<<<<<<
15142 * def is_word(tok):
15144 __Pyx_XDECREF(__pyx_r);
15145 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
15146 __Pyx_GOTREF(__pyx_t_2);
15149 __Pyx_INCREF(__pyx_kp_u__12);
15151 __Pyx_GIVEREF(__pyx_kp_u__12);
15152 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__12);
15153 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
15154 __Pyx_GOTREF(__pyx_t_5);
15155 __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
15156 __Pyx_GOTREF(__pyx_t_4);
15157 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15158 __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_8;
15159 __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
15160 __Pyx_GIVEREF(__pyx_t_4);
15161 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
15163 __Pyx_INCREF(__pyx_kp_u__20);
15165 __Pyx_GIVEREF(__pyx_kp_u__20);
15166 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__20);
15167 __Pyx_INCREF(__pyx_v_extra);
15168 __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_extra) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_v_extra) : __pyx_t_8;
15169 __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_v_extra);
15170 __Pyx_GIVEREF(__pyx_v_extra);
15171 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_extra);
15172 __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
15173 __Pyx_GOTREF(__pyx_t_4);
15174 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15175 __pyx_r = __pyx_t_4;
15179 /* "lxml/html/diff.py":733
15180 * for name, value in el.attrib.items()]))
15182 * def end_tag(el): # <<<<<<<<<<<<<<
15183 * """ The text representation of an end tag for a tag. Includes
15184 * trailing whitespace when appropriate. """
15187 /* function exit code */
15189 __Pyx_XDECREF(__pyx_t_2);
15190 __Pyx_XDECREF(__pyx_t_4);
15191 __Pyx_XDECREF(__pyx_t_5);
15192 __Pyx_XDECREF(__pyx_t_6);
15193 __Pyx_AddTraceback("lxml.html.diff.end_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
15196 __Pyx_XDECREF(__pyx_v_extra);
15197 __Pyx_XGIVEREF(__pyx_r);
15198 __Pyx_RefNannyFinishContext();
15202 /* "lxml/html/diff.py":742
15203 * return '</%s>%s' % (el.tag, extra)
15205 * def is_word(tok): # <<<<<<<<<<<<<<
15206 * return not tok.startswith('<')
15210 /* Python wrapper */
15211 static PyObject *__pyx_pw_4lxml_4html_4diff_58is_word(PyObject *__pyx_self, PyObject *__pyx_v_tok); /*proto*/
15212 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_58is_word = {"is_word", (PyCFunction)__pyx_pw_4lxml_4html_4diff_58is_word, METH_O, 0};
15213 static PyObject *__pyx_pw_4lxml_4html_4diff_58is_word(PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15214 PyObject *__pyx_r = 0;
15215 __Pyx_RefNannyDeclarations
15216 __Pyx_RefNannySetupContext("is_word (wrapper)", 0);
15217 __pyx_r = __pyx_pf_4lxml_4html_4diff_57is_word(__pyx_self, ((PyObject *)__pyx_v_tok));
15219 /* function exit code */
15220 __Pyx_RefNannyFinishContext();
15224 static PyObject *__pyx_pf_4lxml_4html_4diff_57is_word(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15225 PyObject *__pyx_r = NULL;
15226 __Pyx_RefNannyDeclarations
15227 PyObject *__pyx_t_1 = NULL;
15228 PyObject *__pyx_t_2 = NULL;
15229 PyObject *__pyx_t_3 = NULL;
15231 int __pyx_lineno = 0;
15232 const char *__pyx_filename = NULL;
15233 int __pyx_clineno = 0;
15234 __Pyx_RefNannySetupContext("is_word", 0);
15236 /* "lxml/html/diff.py":743
15238 * def is_word(tok):
15239 * return not tok.startswith('<') # <<<<<<<<<<<<<<
15241 * def is_end_tag(tok):
15243 __Pyx_XDECREF(__pyx_r);
15244 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
15245 __Pyx_GOTREF(__pyx_t_2);
15247 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
15248 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
15249 if (likely(__pyx_t_3)) {
15250 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15251 __Pyx_INCREF(__pyx_t_3);
15252 __Pyx_INCREF(function);
15253 __Pyx_DECREF_SET(__pyx_t_2, function);
15256 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__8);
15257 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15258 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
15259 __Pyx_GOTREF(__pyx_t_1);
15260 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15261 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 743, __pyx_L1_error)
15262 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15263 __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
15264 __Pyx_GOTREF(__pyx_t_1);
15265 __pyx_r = __pyx_t_1;
15269 /* "lxml/html/diff.py":742
15270 * return '</%s>%s' % (el.tag, extra)
15272 * def is_word(tok): # <<<<<<<<<<<<<<
15273 * return not tok.startswith('<')
15277 /* function exit code */
15279 __Pyx_XDECREF(__pyx_t_1);
15280 __Pyx_XDECREF(__pyx_t_2);
15281 __Pyx_XDECREF(__pyx_t_3);
15282 __Pyx_AddTraceback("lxml.html.diff.is_word", __pyx_clineno, __pyx_lineno, __pyx_filename);
15285 __Pyx_XGIVEREF(__pyx_r);
15286 __Pyx_RefNannyFinishContext();
15290 /* "lxml/html/diff.py":745
15291 * return not tok.startswith('<')
15293 * def is_end_tag(tok): # <<<<<<<<<<<<<<
15294 * return tok.startswith('</')
15298 /* Python wrapper */
15299 static PyObject *__pyx_pw_4lxml_4html_4diff_60is_end_tag(PyObject *__pyx_self, PyObject *__pyx_v_tok); /*proto*/
15300 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_60is_end_tag = {"is_end_tag", (PyCFunction)__pyx_pw_4lxml_4html_4diff_60is_end_tag, METH_O, 0};
15301 static PyObject *__pyx_pw_4lxml_4html_4diff_60is_end_tag(PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15302 PyObject *__pyx_r = 0;
15303 __Pyx_RefNannyDeclarations
15304 __Pyx_RefNannySetupContext("is_end_tag (wrapper)", 0);
15305 __pyx_r = __pyx_pf_4lxml_4html_4diff_59is_end_tag(__pyx_self, ((PyObject *)__pyx_v_tok));
15307 /* function exit code */
15308 __Pyx_RefNannyFinishContext();
15312 static PyObject *__pyx_pf_4lxml_4html_4diff_59is_end_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15313 PyObject *__pyx_r = NULL;
15314 __Pyx_RefNannyDeclarations
15315 PyObject *__pyx_t_1 = NULL;
15316 PyObject *__pyx_t_2 = NULL;
15317 PyObject *__pyx_t_3 = NULL;
15318 int __pyx_lineno = 0;
15319 const char *__pyx_filename = NULL;
15320 int __pyx_clineno = 0;
15321 __Pyx_RefNannySetupContext("is_end_tag", 0);
15323 /* "lxml/html/diff.py":746
15325 * def is_end_tag(tok):
15326 * return tok.startswith('</') # <<<<<<<<<<<<<<
15328 * def is_start_tag(tok):
15330 __Pyx_XDECREF(__pyx_r);
15331 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
15332 __Pyx_GOTREF(__pyx_t_2);
15334 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
15335 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
15336 if (likely(__pyx_t_3)) {
15337 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15338 __Pyx_INCREF(__pyx_t_3);
15339 __Pyx_INCREF(function);
15340 __Pyx_DECREF_SET(__pyx_t_2, function);
15343 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u__12) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__12);
15344 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15345 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
15346 __Pyx_GOTREF(__pyx_t_1);
15347 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15348 __pyx_r = __pyx_t_1;
15352 /* "lxml/html/diff.py":745
15353 * return not tok.startswith('<')
15355 * def is_end_tag(tok): # <<<<<<<<<<<<<<
15356 * return tok.startswith('</')
15360 /* function exit code */
15362 __Pyx_XDECREF(__pyx_t_1);
15363 __Pyx_XDECREF(__pyx_t_2);
15364 __Pyx_XDECREF(__pyx_t_3);
15365 __Pyx_AddTraceback("lxml.html.diff.is_end_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
15368 __Pyx_XGIVEREF(__pyx_r);
15369 __Pyx_RefNannyFinishContext();
15373 /* "lxml/html/diff.py":748
15374 * return tok.startswith('</')
15376 * def is_start_tag(tok): # <<<<<<<<<<<<<<
15377 * return tok.startswith('<') and not tok.startswith('</')
15381 /* Python wrapper */
15382 static PyObject *__pyx_pw_4lxml_4html_4diff_62is_start_tag(PyObject *__pyx_self, PyObject *__pyx_v_tok); /*proto*/
15383 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_62is_start_tag = {"is_start_tag", (PyCFunction)__pyx_pw_4lxml_4html_4diff_62is_start_tag, METH_O, 0};
15384 static PyObject *__pyx_pw_4lxml_4html_4diff_62is_start_tag(PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15385 PyObject *__pyx_r = 0;
15386 __Pyx_RefNannyDeclarations
15387 __Pyx_RefNannySetupContext("is_start_tag (wrapper)", 0);
15388 __pyx_r = __pyx_pf_4lxml_4html_4diff_61is_start_tag(__pyx_self, ((PyObject *)__pyx_v_tok));
15390 /* function exit code */
15391 __Pyx_RefNannyFinishContext();
15395 static PyObject *__pyx_pf_4lxml_4html_4diff_61is_start_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tok) {
15396 PyObject *__pyx_r = NULL;
15397 __Pyx_RefNannyDeclarations
15398 PyObject *__pyx_t_1 = NULL;
15399 PyObject *__pyx_t_2 = NULL;
15400 PyObject *__pyx_t_3 = NULL;
15401 PyObject *__pyx_t_4 = NULL;
15404 int __pyx_lineno = 0;
15405 const char *__pyx_filename = NULL;
15406 int __pyx_clineno = 0;
15407 __Pyx_RefNannySetupContext("is_start_tag", 0);
15409 /* "lxml/html/diff.py":749
15411 * def is_start_tag(tok):
15412 * return tok.startswith('<') and not tok.startswith('</') # <<<<<<<<<<<<<<
15414 * def fixup_ins_del_tags(html):
15416 __Pyx_XDECREF(__pyx_r);
15417 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error)
15418 __Pyx_GOTREF(__pyx_t_3);
15420 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15421 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15422 if (likely(__pyx_t_4)) {
15423 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15424 __Pyx_INCREF(__pyx_t_4);
15425 __Pyx_INCREF(function);
15426 __Pyx_DECREF_SET(__pyx_t_3, function);
15429 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__8);
15430 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15431 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
15432 __Pyx_GOTREF(__pyx_t_2);
15433 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15434 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 749, __pyx_L1_error)
15436 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15438 __Pyx_INCREF(__pyx_t_2);
15439 __pyx_t_1 = __pyx_t_2;
15440 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15441 goto __pyx_L3_bool_binop_done;
15443 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tok, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error)
15444 __Pyx_GOTREF(__pyx_t_3);
15446 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
15447 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15448 if (likely(__pyx_t_4)) {
15449 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15450 __Pyx_INCREF(__pyx_t_4);
15451 __Pyx_INCREF(function);
15452 __Pyx_DECREF_SET(__pyx_t_3, function);
15455 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u__12) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u__12);
15456 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15457 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
15458 __Pyx_GOTREF(__pyx_t_2);
15459 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15460 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 749, __pyx_L1_error)
15461 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15462 __pyx_t_6 = (!__pyx_t_5);
15463 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
15464 __Pyx_GOTREF(__pyx_t_2);
15465 __pyx_t_1 = __pyx_t_2;
15467 __pyx_L3_bool_binop_done:;
15468 __pyx_r = __pyx_t_1;
15472 /* "lxml/html/diff.py":748
15473 * return tok.startswith('</')
15475 * def is_start_tag(tok): # <<<<<<<<<<<<<<
15476 * return tok.startswith('<') and not tok.startswith('</')
15480 /* function exit code */
15482 __Pyx_XDECREF(__pyx_t_1);
15483 __Pyx_XDECREF(__pyx_t_2);
15484 __Pyx_XDECREF(__pyx_t_3);
15485 __Pyx_XDECREF(__pyx_t_4);
15486 __Pyx_AddTraceback("lxml.html.diff.is_start_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
15489 __Pyx_XGIVEREF(__pyx_r);
15490 __Pyx_RefNannyFinishContext();
15494 /* "lxml/html/diff.py":751
15495 * return tok.startswith('<') and not tok.startswith('</')
15497 * def fixup_ins_del_tags(html): # <<<<<<<<<<<<<<
15498 * """ Given an html string, move any <ins> or <del> tags inside of any
15499 * block-level elements, e.g. transform <ins><p>word</p></ins> to
15502 /* Python wrapper */
15503 static PyObject *__pyx_pw_4lxml_4html_4diff_64fixup_ins_del_tags(PyObject *__pyx_self, PyObject *__pyx_v_html); /*proto*/
15504 static char __pyx_doc_4lxml_4html_4diff_63fixup_ins_del_tags[] = " Given an html string, move any <ins> or <del> tags inside of any\n block-level elements, e.g. transform <ins><p>word</p></ins> to\n <p><ins>word</ins></p> ";
15505 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_64fixup_ins_del_tags = {"fixup_ins_del_tags", (PyCFunction)__pyx_pw_4lxml_4html_4diff_64fixup_ins_del_tags, METH_O, __pyx_doc_4lxml_4html_4diff_63fixup_ins_del_tags};
15506 static PyObject *__pyx_pw_4lxml_4html_4diff_64fixup_ins_del_tags(PyObject *__pyx_self, PyObject *__pyx_v_html) {
15507 PyObject *__pyx_r = 0;
15508 __Pyx_RefNannyDeclarations
15509 __Pyx_RefNannySetupContext("fixup_ins_del_tags (wrapper)", 0);
15510 __pyx_r = __pyx_pf_4lxml_4html_4diff_63fixup_ins_del_tags(__pyx_self, ((PyObject *)__pyx_v_html));
15512 /* function exit code */
15513 __Pyx_RefNannyFinishContext();
15517 static PyObject *__pyx_pf_4lxml_4html_4diff_63fixup_ins_del_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_html) {
15518 PyObject *__pyx_v_doc = NULL;
15519 PyObject *__pyx_r = NULL;
15520 __Pyx_RefNannyDeclarations
15521 PyObject *__pyx_t_1 = NULL;
15522 PyObject *__pyx_t_2 = NULL;
15523 PyObject *__pyx_t_3 = NULL;
15524 PyObject *__pyx_t_4 = NULL;
15525 int __pyx_lineno = 0;
15526 const char *__pyx_filename = NULL;
15527 int __pyx_clineno = 0;
15528 __Pyx_RefNannySetupContext("fixup_ins_del_tags", 0);
15529 __Pyx_INCREF(__pyx_v_html);
15531 /* "lxml/html/diff.py":755
15532 * block-level elements, e.g. transform <ins><p>word</p></ins> to
15533 * <p><ins>word</ins></p> """
15534 * doc = parse_html(html, cleanup=False) # <<<<<<<<<<<<<<
15535 * _fixup_ins_del_tags(doc)
15536 * html = serialize_html_fragment(doc, skip_outer=True)
15538 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_parse_html); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error)
15539 __Pyx_GOTREF(__pyx_t_1);
15540 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error)
15541 __Pyx_GOTREF(__pyx_t_2);
15542 __Pyx_INCREF(__pyx_v_html);
15543 __Pyx_GIVEREF(__pyx_v_html);
15544 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_html);
15545 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error)
15546 __Pyx_GOTREF(__pyx_t_3);
15547 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_cleanup, Py_False) < 0) __PYX_ERR(0, 755, __pyx_L1_error)
15548 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error)
15549 __Pyx_GOTREF(__pyx_t_4);
15550 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15551 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15552 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15553 __pyx_v_doc = __pyx_t_4;
15556 /* "lxml/html/diff.py":756
15557 * <p><ins>word</ins></p> """
15558 * doc = parse_html(html, cleanup=False)
15559 * _fixup_ins_del_tags(doc) # <<<<<<<<<<<<<<
15560 * html = serialize_html_fragment(doc, skip_outer=True)
15563 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_fixup_ins_del_tags_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
15564 __Pyx_GOTREF(__pyx_t_3);
15566 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15567 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
15568 if (likely(__pyx_t_2)) {
15569 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15570 __Pyx_INCREF(__pyx_t_2);
15571 __Pyx_INCREF(function);
15572 __Pyx_DECREF_SET(__pyx_t_3, function);
15575 __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_doc) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_doc);
15576 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15577 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)
15578 __Pyx_GOTREF(__pyx_t_4);
15579 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15580 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15582 /* "lxml/html/diff.py":757
15583 * doc = parse_html(html, cleanup=False)
15584 * _fixup_ins_del_tags(doc)
15585 * html = serialize_html_fragment(doc, skip_outer=True) # <<<<<<<<<<<<<<
15589 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_serialize_html_fragment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L1_error)
15590 __Pyx_GOTREF(__pyx_t_4);
15591 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 757, __pyx_L1_error)
15592 __Pyx_GOTREF(__pyx_t_3);
15593 __Pyx_INCREF(__pyx_v_doc);
15594 __Pyx_GIVEREF(__pyx_v_doc);
15595 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_doc);
15596 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
15597 __Pyx_GOTREF(__pyx_t_2);
15598 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_skip_outer, Py_True) < 0) __PYX_ERR(0, 757, __pyx_L1_error)
15599 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error)
15600 __Pyx_GOTREF(__pyx_t_1);
15601 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15602 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15603 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15604 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_1);
15607 /* "lxml/html/diff.py":758
15608 * _fixup_ins_del_tags(doc)
15609 * html = serialize_html_fragment(doc, skip_outer=True)
15610 * return html # <<<<<<<<<<<<<<
15612 * def serialize_html_fragment(el, skip_outer=False):
15614 __Pyx_XDECREF(__pyx_r);
15615 __Pyx_INCREF(__pyx_v_html);
15616 __pyx_r = __pyx_v_html;
15619 /* "lxml/html/diff.py":751
15620 * return tok.startswith('<') and not tok.startswith('</')
15622 * def fixup_ins_del_tags(html): # <<<<<<<<<<<<<<
15623 * """ Given an html string, move any <ins> or <del> tags inside of any
15624 * block-level elements, e.g. transform <ins><p>word</p></ins> to
15627 /* function exit code */
15629 __Pyx_XDECREF(__pyx_t_1);
15630 __Pyx_XDECREF(__pyx_t_2);
15631 __Pyx_XDECREF(__pyx_t_3);
15632 __Pyx_XDECREF(__pyx_t_4);
15633 __Pyx_AddTraceback("lxml.html.diff.fixup_ins_del_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
15636 __Pyx_XDECREF(__pyx_v_doc);
15637 __Pyx_XDECREF(__pyx_v_html);
15638 __Pyx_XGIVEREF(__pyx_r);
15639 __Pyx_RefNannyFinishContext();
15643 /* "lxml/html/diff.py":760
15646 * def serialize_html_fragment(el, skip_outer=False): # <<<<<<<<<<<<<<
15647 * """ Serialize a single lxml element as HTML. The serialized form
15648 * includes the elements tail.
15651 /* Python wrapper */
15652 static PyObject *__pyx_pw_4lxml_4html_4diff_66serialize_html_fragment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15653 static char __pyx_doc_4lxml_4html_4diff_65serialize_html_fragment[] = " Serialize a single lxml element as HTML. The serialized form\n includes the elements tail. \n\n If skip_outer is true, then don't serialize the outermost tag\n ";
15654 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_66serialize_html_fragment = {"serialize_html_fragment", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_66serialize_html_fragment, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_65serialize_html_fragment};
15655 static PyObject *__pyx_pw_4lxml_4html_4diff_66serialize_html_fragment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15656 PyObject *__pyx_v_el = 0;
15657 PyObject *__pyx_v_skip_outer = 0;
15658 int __pyx_lineno = 0;
15659 const char *__pyx_filename = NULL;
15660 int __pyx_clineno = 0;
15661 PyObject *__pyx_r = 0;
15662 __Pyx_RefNannyDeclarations
15663 __Pyx_RefNannySetupContext("serialize_html_fragment (wrapper)", 0);
15665 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_el,&__pyx_n_s_skip_outer,0};
15666 PyObject* values[2] = {0,0};
15667 values[1] = ((PyObject *)((PyObject *)Py_False));
15668 if (unlikely(__pyx_kwds)) {
15669 Py_ssize_t kw_args;
15670 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15671 switch (pos_args) {
15672 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15673 CYTHON_FALLTHROUGH;
15674 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15675 CYTHON_FALLTHROUGH;
15677 default: goto __pyx_L5_argtuple_error;
15679 kw_args = PyDict_Size(__pyx_kwds);
15680 switch (pos_args) {
15682 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el)) != 0)) kw_args--;
15683 else goto __pyx_L5_argtuple_error;
15684 CYTHON_FALLTHROUGH;
15687 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip_outer);
15688 if (value) { values[1] = value; kw_args--; }
15691 if (unlikely(kw_args > 0)) {
15692 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "serialize_html_fragment") < 0)) __PYX_ERR(0, 760, __pyx_L3_error)
15695 switch (PyTuple_GET_SIZE(__pyx_args)) {
15696 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15697 CYTHON_FALLTHROUGH;
15698 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15700 default: goto __pyx_L5_argtuple_error;
15703 __pyx_v_el = values[0];
15704 __pyx_v_skip_outer = values[1];
15706 goto __pyx_L4_argument_unpacking_done;
15707 __pyx_L5_argtuple_error:;
15708 __Pyx_RaiseArgtupleInvalid("serialize_html_fragment", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 760, __pyx_L3_error)
15710 __Pyx_AddTraceback("lxml.html.diff.serialize_html_fragment", __pyx_clineno, __pyx_lineno, __pyx_filename);
15711 __Pyx_RefNannyFinishContext();
15713 __pyx_L4_argument_unpacking_done:;
15714 __pyx_r = __pyx_pf_4lxml_4html_4diff_65serialize_html_fragment(__pyx_self, __pyx_v_el, __pyx_v_skip_outer);
15716 /* function exit code */
15717 __Pyx_RefNannyFinishContext();
15721 static PyObject *__pyx_pf_4lxml_4html_4diff_65serialize_html_fragment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_skip_outer) {
15722 PyObject *__pyx_v_html = NULL;
15723 PyObject *__pyx_r = NULL;
15724 __Pyx_RefNannyDeclarations
15725 PyObject *__pyx_t_1 = NULL;
15727 PyObject *__pyx_t_3 = NULL;
15728 PyObject *__pyx_t_4 = NULL;
15729 PyObject *__pyx_t_5 = NULL;
15730 int __pyx_lineno = 0;
15731 const char *__pyx_filename = NULL;
15732 int __pyx_clineno = 0;
15733 __Pyx_RefNannySetupContext("serialize_html_fragment", 0);
15735 /* "lxml/html/diff.py":766
15736 * If skip_outer is true, then don't serialize the outermost tag
15738 * assert not isinstance(el, basestring), ( # <<<<<<<<<<<<<<
15739 * "You should pass in an element, not a string like %r" % el)
15740 * html = etree.tostring(el, method="html", encoding=_unicode)
15742 #ifndef CYTHON_WITHOUT_ASSERTIONS
15743 if (unlikely(!Py_OptimizeFlag)) {
15744 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_basestring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
15745 __Pyx_GOTREF(__pyx_t_1);
15746 __pyx_t_2 = PyObject_IsInstance(__pyx_v_el, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 766, __pyx_L1_error)
15747 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15748 if (unlikely(!((!(__pyx_t_2 != 0)) != 0))) {
15750 /* "lxml/html/diff.py":767
15752 * assert not isinstance(el, basestring), (
15753 * "You should pass in an element, not a string like %r" % el) # <<<<<<<<<<<<<<
15754 * html = etree.tostring(el, method="html", encoding=_unicode)
15757 __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_You_should_pass_in_an_element_no, __pyx_v_el); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
15758 __Pyx_GOTREF(__pyx_t_1);
15759 PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
15760 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15761 __PYX_ERR(0, 766, __pyx_L1_error)
15766 /* "lxml/html/diff.py":768
15767 * assert not isinstance(el, basestring), (
15768 * "You should pass in an element, not a string like %r" % el)
15769 * html = etree.tostring(el, method="html", encoding=_unicode) # <<<<<<<<<<<<<<
15771 * # Get rid of the extra starting tag:
15773 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
15774 __Pyx_GOTREF(__pyx_t_1);
15775 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
15776 __Pyx_GOTREF(__pyx_t_3);
15777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15778 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
15779 __Pyx_GOTREF(__pyx_t_1);
15780 __Pyx_INCREF(__pyx_v_el);
15781 __Pyx_GIVEREF(__pyx_v_el);
15782 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_el);
15783 __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 768, __pyx_L1_error)
15784 __Pyx_GOTREF(__pyx_t_4);
15785 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_method, __pyx_n_u_html) < 0) __PYX_ERR(0, 768, __pyx_L1_error)
15786 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 768, __pyx_L1_error)
15787 __Pyx_GOTREF(__pyx_t_5);
15788 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_encoding, __pyx_t_5) < 0) __PYX_ERR(0, 768, __pyx_L1_error)
15789 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15790 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 768, __pyx_L1_error)
15791 __Pyx_GOTREF(__pyx_t_5);
15792 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15793 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15794 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15795 __pyx_v_html = __pyx_t_5;
15798 /* "lxml/html/diff.py":769
15799 * "You should pass in an element, not a string like %r" % el)
15800 * html = etree.tostring(el, method="html", encoding=_unicode)
15801 * if skip_outer: # <<<<<<<<<<<<<<
15802 * # Get rid of the extra starting tag:
15803 * html = html[html.find('>')+1:]
15805 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_skip_outer); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 769, __pyx_L1_error)
15808 /* "lxml/html/diff.py":771
15810 * # Get rid of the extra starting tag:
15811 * html = html[html.find('>')+1:] # <<<<<<<<<<<<<<
15812 * # Get rid of the extra end tag:
15813 * html = html[:html.rfind('<')]
15815 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_html, __pyx_n_s_find); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
15816 __Pyx_GOTREF(__pyx_t_4);
15818 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
15819 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
15820 if (likely(__pyx_t_1)) {
15821 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15822 __Pyx_INCREF(__pyx_t_1);
15823 __Pyx_INCREF(function);
15824 __Pyx_DECREF_SET(__pyx_t_4, function);
15827 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u__20) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__20);
15828 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15829 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
15830 __Pyx_GOTREF(__pyx_t_5);
15831 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15832 __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
15833 __Pyx_GOTREF(__pyx_t_4);
15834 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15835 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_html, 0, 0, &__pyx_t_4, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
15836 __Pyx_GOTREF(__pyx_t_5);
15837 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15838 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_5);
15841 /* "lxml/html/diff.py":773
15842 * html = html[html.find('>')+1:]
15843 * # Get rid of the extra end tag:
15844 * html = html[:html.rfind('<')] # <<<<<<<<<<<<<<
15845 * return html.strip()
15848 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_html, __pyx_n_s_rfind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error)
15849 __Pyx_GOTREF(__pyx_t_4);
15851 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
15852 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
15853 if (likely(__pyx_t_1)) {
15854 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15855 __Pyx_INCREF(__pyx_t_1);
15856 __Pyx_INCREF(function);
15857 __Pyx_DECREF_SET(__pyx_t_4, function);
15860 __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u__8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u__8);
15861 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15862 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L1_error)
15863 __Pyx_GOTREF(__pyx_t_5);
15864 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15865 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_html, 0, 0, NULL, &__pyx_t_5, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error)
15866 __Pyx_GOTREF(__pyx_t_4);
15867 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15868 __Pyx_DECREF_SET(__pyx_v_html, __pyx_t_4);
15871 /* "lxml/html/diff.py":774
15872 * # Get rid of the extra end tag:
15873 * html = html[:html.rfind('<')]
15874 * return html.strip() # <<<<<<<<<<<<<<
15878 __Pyx_XDECREF(__pyx_r);
15879 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_html, __pyx_n_s_strip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error)
15880 __Pyx_GOTREF(__pyx_t_5);
15882 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
15883 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
15884 if (likely(__pyx_t_1)) {
15885 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
15886 __Pyx_INCREF(__pyx_t_1);
15887 __Pyx_INCREF(function);
15888 __Pyx_DECREF_SET(__pyx_t_5, function);
15891 __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
15892 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15893 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error)
15894 __Pyx_GOTREF(__pyx_t_4);
15895 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15896 __pyx_r = __pyx_t_4;
15900 /* "lxml/html/diff.py":769
15901 * "You should pass in an element, not a string like %r" % el)
15902 * html = etree.tostring(el, method="html", encoding=_unicode)
15903 * if skip_outer: # <<<<<<<<<<<<<<
15904 * # Get rid of the extra starting tag:
15905 * html = html[html.find('>')+1:]
15909 /* "lxml/html/diff.py":776
15910 * return html.strip()
15912 * return html # <<<<<<<<<<<<<<
15914 * def _fixup_ins_del_tags(doc):
15917 __Pyx_XDECREF(__pyx_r);
15918 __Pyx_INCREF(__pyx_v_html);
15919 __pyx_r = __pyx_v_html;
15923 /* "lxml/html/diff.py":760
15926 * def serialize_html_fragment(el, skip_outer=False): # <<<<<<<<<<<<<<
15927 * """ Serialize a single lxml element as HTML. The serialized form
15928 * includes the elements tail.
15931 /* function exit code */
15933 __Pyx_XDECREF(__pyx_t_1);
15934 __Pyx_XDECREF(__pyx_t_3);
15935 __Pyx_XDECREF(__pyx_t_4);
15936 __Pyx_XDECREF(__pyx_t_5);
15937 __Pyx_AddTraceback("lxml.html.diff.serialize_html_fragment", __pyx_clineno, __pyx_lineno, __pyx_filename);
15940 __Pyx_XDECREF(__pyx_v_html);
15941 __Pyx_XGIVEREF(__pyx_r);
15942 __Pyx_RefNannyFinishContext();
15946 /* "lxml/html/diff.py":778
15949 * def _fixup_ins_del_tags(doc): # <<<<<<<<<<<<<<
15950 * """fixup_ins_del_tags that works on an lxml document in-place
15954 /* Python wrapper */
15955 static PyObject *__pyx_pw_4lxml_4html_4diff_68_fixup_ins_del_tags(PyObject *__pyx_self, PyObject *__pyx_v_doc); /*proto*/
15956 static char __pyx_doc_4lxml_4html_4diff_67_fixup_ins_del_tags[] = "fixup_ins_del_tags that works on an lxml document in-place\n ";
15957 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_68_fixup_ins_del_tags = {"_fixup_ins_del_tags", (PyCFunction)__pyx_pw_4lxml_4html_4diff_68_fixup_ins_del_tags, METH_O, __pyx_doc_4lxml_4html_4diff_67_fixup_ins_del_tags};
15958 static PyObject *__pyx_pw_4lxml_4html_4diff_68_fixup_ins_del_tags(PyObject *__pyx_self, PyObject *__pyx_v_doc) {
15959 PyObject *__pyx_r = 0;
15960 __Pyx_RefNannyDeclarations
15961 __Pyx_RefNannySetupContext("_fixup_ins_del_tags (wrapper)", 0);
15962 __pyx_r = __pyx_pf_4lxml_4html_4diff_67_fixup_ins_del_tags(__pyx_self, ((PyObject *)__pyx_v_doc));
15964 /* function exit code */
15965 __Pyx_RefNannyFinishContext();
15969 static PyObject *__pyx_pf_4lxml_4html_4diff_67_fixup_ins_del_tags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_doc) {
15970 PyObject *__pyx_v_tag = NULL;
15971 PyObject *__pyx_v_el = NULL;
15972 PyObject *__pyx_r = NULL;
15973 __Pyx_RefNannyDeclarations
15974 PyObject *__pyx_t_1 = NULL;
15975 Py_ssize_t __pyx_t_2;
15976 PyObject *__pyx_t_3 = NULL;
15977 PyObject *__pyx_t_4 = NULL;
15978 PyObject *__pyx_t_5 = NULL;
15979 PyObject *__pyx_t_6 = NULL;
15980 Py_ssize_t __pyx_t_7;
15981 PyObject *(*__pyx_t_8)(PyObject *);
15984 PyObject *__pyx_t_11 = NULL;
15985 int __pyx_lineno = 0;
15986 const char *__pyx_filename = NULL;
15987 int __pyx_clineno = 0;
15988 __Pyx_RefNannySetupContext("_fixup_ins_del_tags", 0);
15990 /* "lxml/html/diff.py":781
15991 * """fixup_ins_del_tags that works on an lxml document in-place
15993 * for tag in ['ins', 'del']: # <<<<<<<<<<<<<<
15994 * for el in doc.xpath('descendant-or-self::%s' % tag):
15995 * if not _contains_block_level_tag(el):
15997 __pyx_t_1 = __pyx_tuple__21; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
15999 if (__pyx_t_2 >= 2) break;
16000 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16001 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 781, __pyx_L1_error)
16003 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error)
16004 __Pyx_GOTREF(__pyx_t_3);
16006 __Pyx_XDECREF_SET(__pyx_v_tag, ((PyObject*)__pyx_t_3));
16009 /* "lxml/html/diff.py":782
16011 * for tag in ['ins', 'del']:
16012 * for el in doc.xpath('descendant-or-self::%s' % tag): # <<<<<<<<<<<<<<
16013 * if not _contains_block_level_tag(el):
16016 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_doc, __pyx_n_s_xpath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
16017 __Pyx_GOTREF(__pyx_t_4);
16018 __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_descendant_or_self_s, __pyx_v_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 782, __pyx_L1_error)
16019 __Pyx_GOTREF(__pyx_t_5);
16021 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
16022 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
16023 if (likely(__pyx_t_6)) {
16024 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16025 __Pyx_INCREF(__pyx_t_6);
16026 __Pyx_INCREF(function);
16027 __Pyx_DECREF_SET(__pyx_t_4, function);
16030 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
16031 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16032 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16033 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
16034 __Pyx_GOTREF(__pyx_t_3);
16035 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16036 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
16037 __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
16040 __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
16041 __Pyx_GOTREF(__pyx_t_4);
16042 __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 782, __pyx_L1_error)
16044 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16046 if (likely(!__pyx_t_8)) {
16047 if (likely(PyList_CheckExact(__pyx_t_4))) {
16048 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
16049 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16050 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 782, __pyx_L1_error)
16052 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
16053 __Pyx_GOTREF(__pyx_t_3);
16056 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
16057 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16058 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 782, __pyx_L1_error)
16060 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
16061 __Pyx_GOTREF(__pyx_t_3);
16065 __pyx_t_3 = __pyx_t_8(__pyx_t_4);
16066 if (unlikely(!__pyx_t_3)) {
16067 PyObject* exc_type = PyErr_Occurred();
16069 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
16070 else __PYX_ERR(0, 782, __pyx_L1_error)
16074 __Pyx_GOTREF(__pyx_t_3);
16076 __Pyx_XDECREF_SET(__pyx_v_el, __pyx_t_3);
16079 /* "lxml/html/diff.py":783
16080 * for tag in ['ins', 'del']:
16081 * for el in doc.xpath('descendant-or-self::%s' % tag):
16082 * if not _contains_block_level_tag(el): # <<<<<<<<<<<<<<
16084 * _move_el_inside_block(el, tag=tag)
16086 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_contains_block_level_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)
16087 __Pyx_GOTREF(__pyx_t_5);
16089 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
16090 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
16091 if (likely(__pyx_t_6)) {
16092 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16093 __Pyx_INCREF(__pyx_t_6);
16094 __Pyx_INCREF(function);
16095 __Pyx_DECREF_SET(__pyx_t_5, function);
16098 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_el) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_el);
16099 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16100 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L1_error)
16101 __Pyx_GOTREF(__pyx_t_3);
16102 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16103 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 783, __pyx_L1_error)
16104 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16105 __pyx_t_10 = ((!__pyx_t_9) != 0);
16108 /* "lxml/html/diff.py":784
16109 * for el in doc.xpath('descendant-or-self::%s' % tag):
16110 * if not _contains_block_level_tag(el):
16111 * continue # <<<<<<<<<<<<<<
16112 * _move_el_inside_block(el, tag=tag)
16115 goto __pyx_L5_continue;
16117 /* "lxml/html/diff.py":783
16118 * for tag in ['ins', 'del']:
16119 * for el in doc.xpath('descendant-or-self::%s' % tag):
16120 * if not _contains_block_level_tag(el): # <<<<<<<<<<<<<<
16122 * _move_el_inside_block(el, tag=tag)
16126 /* "lxml/html/diff.py":785
16127 * if not _contains_block_level_tag(el):
16129 * _move_el_inside_block(el, tag=tag) # <<<<<<<<<<<<<<
16131 * #_merge_element_contents(el)
16133 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_move_el_inside_block); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L1_error)
16134 __Pyx_GOTREF(__pyx_t_3);
16135 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 785, __pyx_L1_error)
16136 __Pyx_GOTREF(__pyx_t_5);
16137 __Pyx_INCREF(__pyx_v_el);
16138 __Pyx_GIVEREF(__pyx_v_el);
16139 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_el);
16140 __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L1_error)
16141 __Pyx_GOTREF(__pyx_t_6);
16142 if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tag, __pyx_v_tag) < 0) __PYX_ERR(0, 785, __pyx_L1_error)
16143 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 785, __pyx_L1_error)
16144 __Pyx_GOTREF(__pyx_t_11);
16145 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16146 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16147 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16148 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
16150 /* "lxml/html/diff.py":786
16152 * _move_el_inside_block(el, tag=tag)
16153 * el.drop_tag() # <<<<<<<<<<<<<<
16154 * #_merge_element_contents(el)
16157 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_drop_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 786, __pyx_L1_error)
16158 __Pyx_GOTREF(__pyx_t_6);
16160 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
16161 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
16162 if (likely(__pyx_t_5)) {
16163 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
16164 __Pyx_INCREF(__pyx_t_5);
16165 __Pyx_INCREF(function);
16166 __Pyx_DECREF_SET(__pyx_t_6, function);
16169 __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
16170 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16171 if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 786, __pyx_L1_error)
16172 __Pyx_GOTREF(__pyx_t_11);
16173 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16174 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
16176 /* "lxml/html/diff.py":782
16178 * for tag in ['ins', 'del']:
16179 * for el in doc.xpath('descendant-or-self::%s' % tag): # <<<<<<<<<<<<<<
16180 * if not _contains_block_level_tag(el):
16183 __pyx_L5_continue:;
16185 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16187 /* "lxml/html/diff.py":781
16188 * """fixup_ins_del_tags that works on an lxml document in-place
16190 * for tag in ['ins', 'del']: # <<<<<<<<<<<<<<
16191 * for el in doc.xpath('descendant-or-self::%s' % tag):
16192 * if not _contains_block_level_tag(el):
16195 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16197 /* "lxml/html/diff.py":778
16200 * def _fixup_ins_del_tags(doc): # <<<<<<<<<<<<<<
16201 * """fixup_ins_del_tags that works on an lxml document in-place
16205 /* function exit code */
16206 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16209 __Pyx_XDECREF(__pyx_t_1);
16210 __Pyx_XDECREF(__pyx_t_3);
16211 __Pyx_XDECREF(__pyx_t_4);
16212 __Pyx_XDECREF(__pyx_t_5);
16213 __Pyx_XDECREF(__pyx_t_6);
16214 __Pyx_XDECREF(__pyx_t_11);
16215 __Pyx_AddTraceback("lxml.html.diff._fixup_ins_del_tags", __pyx_clineno, __pyx_lineno, __pyx_filename);
16218 __Pyx_XDECREF(__pyx_v_tag);
16219 __Pyx_XDECREF(__pyx_v_el);
16220 __Pyx_XGIVEREF(__pyx_r);
16221 __Pyx_RefNannyFinishContext();
16225 /* "lxml/html/diff.py":789
16226 * #_merge_element_contents(el)
16228 * def _contains_block_level_tag(el): # <<<<<<<<<<<<<<
16229 * """True if the element contains any block-level elements, like <p>, <td>, etc.
16233 /* Python wrapper */
16234 static PyObject *__pyx_pw_4lxml_4html_4diff_70_contains_block_level_tag(PyObject *__pyx_self, PyObject *__pyx_v_el); /*proto*/
16235 static char __pyx_doc_4lxml_4html_4diff_69_contains_block_level_tag[] = "True if the element contains any block-level elements, like <p>, <td>, etc.\n ";
16236 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_70_contains_block_level_tag = {"_contains_block_level_tag", (PyCFunction)__pyx_pw_4lxml_4html_4diff_70_contains_block_level_tag, METH_O, __pyx_doc_4lxml_4html_4diff_69_contains_block_level_tag};
16237 static PyObject *__pyx_pw_4lxml_4html_4diff_70_contains_block_level_tag(PyObject *__pyx_self, PyObject *__pyx_v_el) {
16238 PyObject *__pyx_r = 0;
16239 __Pyx_RefNannyDeclarations
16240 __Pyx_RefNannySetupContext("_contains_block_level_tag (wrapper)", 0);
16241 __pyx_r = __pyx_pf_4lxml_4html_4diff_69_contains_block_level_tag(__pyx_self, ((PyObject *)__pyx_v_el));
16243 /* function exit code */
16244 __Pyx_RefNannyFinishContext();
16248 static PyObject *__pyx_pf_4lxml_4html_4diff_69_contains_block_level_tag(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el) {
16249 PyObject *__pyx_v_child = NULL;
16250 PyObject *__pyx_r = NULL;
16251 __Pyx_RefNannyDeclarations
16253 PyObject *__pyx_t_2 = NULL;
16254 PyObject *__pyx_t_3 = NULL;
16257 Py_ssize_t __pyx_t_6;
16258 PyObject *(*__pyx_t_7)(PyObject *);
16259 PyObject *__pyx_t_8 = NULL;
16260 PyObject *__pyx_t_9 = NULL;
16261 int __pyx_lineno = 0;
16262 const char *__pyx_filename = NULL;
16263 int __pyx_clineno = 0;
16264 __Pyx_RefNannySetupContext("_contains_block_level_tag", 0);
16266 /* "lxml/html/diff.py":792
16267 * """True if the element contains any block-level elements, like <p>, <td>, etc.
16269 * if el.tag in block_level_tags or el.tag in block_level_container_tags: # <<<<<<<<<<<<<<
16273 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error)
16274 __Pyx_GOTREF(__pyx_t_2);
16275 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_block_level_tags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error)
16276 __Pyx_GOTREF(__pyx_t_3);
16277 __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 792, __pyx_L1_error)
16278 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16279 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16280 __pyx_t_5 = (__pyx_t_4 != 0);
16283 __pyx_t_1 = __pyx_t_5;
16284 goto __pyx_L4_bool_binop_done;
16286 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error)
16287 __Pyx_GOTREF(__pyx_t_3);
16288 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_block_level_container_tags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error)
16289 __Pyx_GOTREF(__pyx_t_2);
16290 __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 792, __pyx_L1_error)
16291 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16292 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16293 __pyx_t_4 = (__pyx_t_5 != 0);
16294 __pyx_t_1 = __pyx_t_4;
16295 __pyx_L4_bool_binop_done:;
16298 /* "lxml/html/diff.py":793
16300 * if el.tag in block_level_tags or el.tag in block_level_container_tags:
16301 * return True # <<<<<<<<<<<<<<
16303 * if _contains_block_level_tag(child):
16305 __Pyx_XDECREF(__pyx_r);
16306 __Pyx_INCREF(Py_True);
16310 /* "lxml/html/diff.py":792
16311 * """True if the element contains any block-level elements, like <p>, <td>, etc.
16313 * if el.tag in block_level_tags or el.tag in block_level_container_tags: # <<<<<<<<<<<<<<
16319 /* "lxml/html/diff.py":794
16320 * if el.tag in block_level_tags or el.tag in block_level_container_tags:
16322 * for child in el: # <<<<<<<<<<<<<<
16323 * if _contains_block_level_tag(child):
16326 if (likely(PyList_CheckExact(__pyx_v_el)) || PyTuple_CheckExact(__pyx_v_el)) {
16327 __pyx_t_2 = __pyx_v_el; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
16330 __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_el); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
16331 __Pyx_GOTREF(__pyx_t_2);
16332 __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 794, __pyx_L1_error)
16335 if (likely(!__pyx_t_7)) {
16336 if (likely(PyList_CheckExact(__pyx_t_2))) {
16337 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
16338 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16339 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
16341 __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L1_error)
16342 __Pyx_GOTREF(__pyx_t_3);
16345 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
16346 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16347 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
16349 __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L1_error)
16350 __Pyx_GOTREF(__pyx_t_3);
16354 __pyx_t_3 = __pyx_t_7(__pyx_t_2);
16355 if (unlikely(!__pyx_t_3)) {
16356 PyObject* exc_type = PyErr_Occurred();
16358 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
16359 else __PYX_ERR(0, 794, __pyx_L1_error)
16363 __Pyx_GOTREF(__pyx_t_3);
16365 __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_3);
16368 /* "lxml/html/diff.py":795
16371 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
16375 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_contains_block_level_tag); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 795, __pyx_L1_error)
16376 __Pyx_GOTREF(__pyx_t_8);
16378 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
16379 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
16380 if (likely(__pyx_t_9)) {
16381 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
16382 __Pyx_INCREF(__pyx_t_9);
16383 __Pyx_INCREF(function);
16384 __Pyx_DECREF_SET(__pyx_t_8, function);
16387 __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_child) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_child);
16388 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
16389 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error)
16390 __Pyx_GOTREF(__pyx_t_3);
16391 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16392 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 795, __pyx_L1_error)
16393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16396 /* "lxml/html/diff.py":796
16398 * if _contains_block_level_tag(child):
16399 * return True # <<<<<<<<<<<<<<
16403 __Pyx_XDECREF(__pyx_r);
16404 __Pyx_INCREF(Py_True);
16406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16409 /* "lxml/html/diff.py":795
16412 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
16418 /* "lxml/html/diff.py":794
16419 * if el.tag in block_level_tags or el.tag in block_level_container_tags:
16421 * for child in el: # <<<<<<<<<<<<<<
16422 * if _contains_block_level_tag(child):
16426 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16428 /* "lxml/html/diff.py":797
16429 * if _contains_block_level_tag(child):
16431 * return False # <<<<<<<<<<<<<<
16433 * def _move_el_inside_block(el, tag):
16435 __Pyx_XDECREF(__pyx_r);
16436 __Pyx_INCREF(Py_False);
16437 __pyx_r = Py_False;
16440 /* "lxml/html/diff.py":789
16441 * #_merge_element_contents(el)
16443 * def _contains_block_level_tag(el): # <<<<<<<<<<<<<<
16444 * """True if the element contains any block-level elements, like <p>, <td>, etc.
16448 /* function exit code */
16450 __Pyx_XDECREF(__pyx_t_2);
16451 __Pyx_XDECREF(__pyx_t_3);
16452 __Pyx_XDECREF(__pyx_t_8);
16453 __Pyx_XDECREF(__pyx_t_9);
16454 __Pyx_AddTraceback("lxml.html.diff._contains_block_level_tag", __pyx_clineno, __pyx_lineno, __pyx_filename);
16457 __Pyx_XDECREF(__pyx_v_child);
16458 __Pyx_XGIVEREF(__pyx_r);
16459 __Pyx_RefNannyFinishContext();
16463 /* "lxml/html/diff.py":799
16466 * def _move_el_inside_block(el, tag): # <<<<<<<<<<<<<<
16467 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
16468 * and moves them inside any block-level tags. """
16471 /* Python wrapper */
16472 static PyObject *__pyx_pw_4lxml_4html_4diff_72_move_el_inside_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16473 static char __pyx_doc_4lxml_4html_4diff_71_move_el_inside_block[] = " helper for _fixup_ins_del_tags; actually takes the <ins> etc tags\n and moves them inside any block-level tags. ";
16474 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_72_move_el_inside_block = {"_move_el_inside_block", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4lxml_4html_4diff_72_move_el_inside_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4lxml_4html_4diff_71_move_el_inside_block};
16475 static PyObject *__pyx_pw_4lxml_4html_4diff_72_move_el_inside_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16476 PyObject *__pyx_v_el = 0;
16477 PyObject *__pyx_v_tag = 0;
16478 int __pyx_lineno = 0;
16479 const char *__pyx_filename = NULL;
16480 int __pyx_clineno = 0;
16481 PyObject *__pyx_r = 0;
16482 __Pyx_RefNannyDeclarations
16483 __Pyx_RefNannySetupContext("_move_el_inside_block (wrapper)", 0);
16485 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_el,&__pyx_n_s_tag,0};
16486 PyObject* values[2] = {0,0};
16487 if (unlikely(__pyx_kwds)) {
16488 Py_ssize_t kw_args;
16489 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16490 switch (pos_args) {
16491 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16492 CYTHON_FALLTHROUGH;
16493 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16494 CYTHON_FALLTHROUGH;
16496 default: goto __pyx_L5_argtuple_error;
16498 kw_args = PyDict_Size(__pyx_kwds);
16499 switch (pos_args) {
16501 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el)) != 0)) kw_args--;
16502 else goto __pyx_L5_argtuple_error;
16503 CYTHON_FALLTHROUGH;
16505 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tag)) != 0)) kw_args--;
16507 __Pyx_RaiseArgtupleInvalid("_move_el_inside_block", 1, 2, 2, 1); __PYX_ERR(0, 799, __pyx_L3_error)
16510 if (unlikely(kw_args > 0)) {
16511 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_move_el_inside_block") < 0)) __PYX_ERR(0, 799, __pyx_L3_error)
16513 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
16514 goto __pyx_L5_argtuple_error;
16516 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16517 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16519 __pyx_v_el = values[0];
16520 __pyx_v_tag = values[1];
16522 goto __pyx_L4_argument_unpacking_done;
16523 __pyx_L5_argtuple_error:;
16524 __Pyx_RaiseArgtupleInvalid("_move_el_inside_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 799, __pyx_L3_error)
16526 __Pyx_AddTraceback("lxml.html.diff._move_el_inside_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
16527 __Pyx_RefNannyFinishContext();
16529 __pyx_L4_argument_unpacking_done:;
16530 __pyx_r = __pyx_pf_4lxml_4html_4diff_71_move_el_inside_block(__pyx_self, __pyx_v_el, __pyx_v_tag);
16532 /* function exit code */
16533 __Pyx_RefNannyFinishContext();
16537 static PyObject *__pyx_pf_4lxml_4html_4diff_71_move_el_inside_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el, PyObject *__pyx_v_tag) {
16538 PyObject *__pyx_v_child = NULL;
16539 PyObject *__pyx_v_children_tag = NULL;
16540 PyObject *__pyx_v_tail_tag = NULL;
16541 PyObject *__pyx_v_child_tag = NULL;
16542 PyObject *__pyx_v_text_tag = NULL;
16543 PyObject *__pyx_r = NULL;
16544 __Pyx_RefNannyDeclarations
16545 PyObject *__pyx_t_1 = NULL;
16546 Py_ssize_t __pyx_t_2;
16547 PyObject *(*__pyx_t_3)(PyObject *);
16548 PyObject *__pyx_t_4 = NULL;
16549 PyObject *__pyx_t_5 = NULL;
16550 PyObject *__pyx_t_6 = NULL;
16552 PyObject *__pyx_t_8 = NULL;
16554 PyObject *__pyx_t_10 = NULL;
16556 int __pyx_lineno = 0;
16557 const char *__pyx_filename = NULL;
16558 int __pyx_clineno = 0;
16559 __Pyx_RefNannySetupContext("_move_el_inside_block", 0);
16561 /* "lxml/html/diff.py":802
16562 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
16563 * and moves them inside any block-level tags. """
16564 * for child in el: # <<<<<<<<<<<<<<
16565 * if _contains_block_level_tag(child):
16568 if (likely(PyList_CheckExact(__pyx_v_el)) || PyTuple_CheckExact(__pyx_v_el)) {
16569 __pyx_t_1 = __pyx_v_el; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
16572 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_el); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
16573 __Pyx_GOTREF(__pyx_t_1);
16574 __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error)
16577 if (likely(!__pyx_t_3)) {
16578 if (likely(PyList_CheckExact(__pyx_t_1))) {
16579 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
16580 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16581 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 802, __pyx_L1_error)
16583 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error)
16584 __Pyx_GOTREF(__pyx_t_4);
16587 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
16588 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16589 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 802, __pyx_L1_error)
16591 __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error)
16592 __Pyx_GOTREF(__pyx_t_4);
16596 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
16597 if (unlikely(!__pyx_t_4)) {
16598 PyObject* exc_type = PyErr_Occurred();
16600 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
16601 else __PYX_ERR(0, 802, __pyx_L1_error)
16605 __Pyx_GOTREF(__pyx_t_4);
16607 __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_4);
16610 /* "lxml/html/diff.py":803
16611 * and moves them inside any block-level tags. """
16613 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
16617 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_contains_block_level_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 803, __pyx_L1_error)
16618 __Pyx_GOTREF(__pyx_t_5);
16620 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
16621 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
16622 if (likely(__pyx_t_6)) {
16623 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16624 __Pyx_INCREF(__pyx_t_6);
16625 __Pyx_INCREF(function);
16626 __Pyx_DECREF_SET(__pyx_t_5, function);
16629 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_child) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_child);
16630 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16631 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 803, __pyx_L1_error)
16632 __Pyx_GOTREF(__pyx_t_4);
16633 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16634 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 803, __pyx_L1_error)
16635 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16638 /* "lxml/html/diff.py":804
16640 * if _contains_block_level_tag(child):
16641 * break # <<<<<<<<<<<<<<
16643 * # No block-level tags in any child
16645 goto __pyx_L4_break;
16647 /* "lxml/html/diff.py":803
16648 * and moves them inside any block-level tags. """
16650 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
16656 /* "lxml/html/diff.py":802
16657 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
16658 * and moves them inside any block-level tags. """
16659 * for child in el: # <<<<<<<<<<<<<<
16660 * if _contains_block_level_tag(child):
16666 /* "lxml/html/diff.py":807
16668 * # No block-level tags in any child
16669 * children_tag = etree.Element(tag) # <<<<<<<<<<<<<<
16670 * children_tag.text = el.text
16673 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_etree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L1_error)
16674 __Pyx_GOTREF(__pyx_t_5);
16675 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Element); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 807, __pyx_L1_error)
16676 __Pyx_GOTREF(__pyx_t_6);
16677 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16679 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
16680 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
16681 if (likely(__pyx_t_5)) {
16682 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
16683 __Pyx_INCREF(__pyx_t_5);
16684 __Pyx_INCREF(function);
16685 __Pyx_DECREF_SET(__pyx_t_6, function);
16688 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_tag);
16689 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16690 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 807, __pyx_L1_error)
16691 __Pyx_GOTREF(__pyx_t_4);
16692 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16693 __pyx_v_children_tag = __pyx_t_4;
16696 /* "lxml/html/diff.py":808
16697 * # No block-level tags in any child
16698 * children_tag = etree.Element(tag)
16699 * children_tag.text = el.text # <<<<<<<<<<<<<<
16701 * children_tag.extend(list(el))
16703 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error)
16704 __Pyx_GOTREF(__pyx_t_4);
16705 if (__Pyx_PyObject_SetAttrStr(__pyx_v_children_tag, __pyx_n_s_text, __pyx_t_4) < 0) __PYX_ERR(0, 808, __pyx_L1_error)
16706 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16708 /* "lxml/html/diff.py":809
16709 * children_tag = etree.Element(tag)
16710 * children_tag.text = el.text
16711 * el.text = None # <<<<<<<<<<<<<<
16712 * children_tag.extend(list(el))
16713 * el[:] = [children_tag]
16715 if (__Pyx_PyObject_SetAttrStr(__pyx_v_el, __pyx_n_s_text, Py_None) < 0) __PYX_ERR(0, 809, __pyx_L1_error)
16717 /* "lxml/html/diff.py":810
16718 * children_tag.text = el.text
16720 * children_tag.extend(list(el)) # <<<<<<<<<<<<<<
16721 * el[:] = [children_tag]
16724 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_children_tag, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 810, __pyx_L1_error)
16725 __Pyx_GOTREF(__pyx_t_6);
16726 __pyx_t_5 = PySequence_List(__pyx_v_el); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error)
16727 __Pyx_GOTREF(__pyx_t_5);
16729 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
16730 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
16731 if (likely(__pyx_t_8)) {
16732 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
16733 __Pyx_INCREF(__pyx_t_8);
16734 __Pyx_INCREF(function);
16735 __Pyx_DECREF_SET(__pyx_t_6, function);
16738 __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
16739 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
16740 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16741 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error)
16742 __Pyx_GOTREF(__pyx_t_4);
16743 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16744 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16746 /* "lxml/html/diff.py":811
16748 * children_tag.extend(list(el))
16749 * el[:] = [children_tag] # <<<<<<<<<<<<<<
16751 * for child in list(el):
16753 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 811, __pyx_L1_error)
16754 __Pyx_GOTREF(__pyx_t_4);
16755 __Pyx_INCREF(__pyx_v_children_tag);
16756 __Pyx_GIVEREF(__pyx_v_children_tag);
16757 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_children_tag);
16758 if (__Pyx_PyObject_SetSlice(__pyx_v_el, __pyx_t_4, 0, 0, NULL, NULL, &__pyx_slice__22, 0, 0, 1) < 0) __PYX_ERR(0, 811, __pyx_L1_error)
16759 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16761 /* "lxml/html/diff.py":812
16762 * children_tag.extend(list(el))
16763 * el[:] = [children_tag]
16764 * return # <<<<<<<<<<<<<<
16765 * for child in list(el):
16766 * if _contains_block_level_tag(child):
16768 __Pyx_XDECREF(__pyx_r);
16769 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16770 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16774 /* "lxml/html/diff.py":802
16775 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
16776 * and moves them inside any block-level tags. """
16777 * for child in el: # <<<<<<<<<<<<<<
16778 * if _contains_block_level_tag(child):
16782 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16784 /* "lxml/html/diff.py":813
16785 * el[:] = [children_tag]
16787 * for child in list(el): # <<<<<<<<<<<<<<
16788 * if _contains_block_level_tag(child):
16789 * _move_el_inside_block(child, tag)
16791 __pyx_t_1 = PySequence_List(__pyx_v_el); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
16792 __Pyx_GOTREF(__pyx_t_1);
16793 __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
16794 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16796 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
16797 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16798 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 813, __pyx_L1_error)
16800 __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
16801 __Pyx_GOTREF(__pyx_t_1);
16803 __Pyx_DECREF_SET(__pyx_v_child, __pyx_t_1);
16806 /* "lxml/html/diff.py":814
16808 * for child in list(el):
16809 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
16810 * _move_el_inside_block(child, tag)
16813 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_contains_block_level_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L1_error)
16814 __Pyx_GOTREF(__pyx_t_6);
16816 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
16817 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
16818 if (likely(__pyx_t_5)) {
16819 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
16820 __Pyx_INCREF(__pyx_t_5);
16821 __Pyx_INCREF(function);
16822 __Pyx_DECREF_SET(__pyx_t_6, function);
16825 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_child) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_child);
16826 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16827 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
16828 __Pyx_GOTREF(__pyx_t_1);
16829 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16830 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 814, __pyx_L1_error)
16831 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16834 /* "lxml/html/diff.py":815
16835 * for child in list(el):
16836 * if _contains_block_level_tag(child):
16837 * _move_el_inside_block(child, tag) # <<<<<<<<<<<<<<
16839 * tail_tag = etree.Element(tag)
16841 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_move_el_inside_block); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 815, __pyx_L1_error)
16842 __Pyx_GOTREF(__pyx_t_6);
16845 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
16846 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
16847 if (likely(__pyx_t_5)) {
16848 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
16849 __Pyx_INCREF(__pyx_t_5);
16850 __Pyx_INCREF(function);
16851 __Pyx_DECREF_SET(__pyx_t_6, function);
16855 #if CYTHON_FAST_PYCALL
16856 if (PyFunction_Check(__pyx_t_6)) {
16857 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_child, __pyx_v_tag};
16858 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
16859 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16860 __Pyx_GOTREF(__pyx_t_1);
16863 #if CYTHON_FAST_PYCCALL
16864 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
16865 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_child, __pyx_v_tag};
16866 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
16867 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16868 __Pyx_GOTREF(__pyx_t_1);
16872 __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 815, __pyx_L1_error)
16873 __Pyx_GOTREF(__pyx_t_8);
16875 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
16877 __Pyx_INCREF(__pyx_v_child);
16878 __Pyx_GIVEREF(__pyx_v_child);
16879 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_v_child);
16880 __Pyx_INCREF(__pyx_v_tag);
16881 __Pyx_GIVEREF(__pyx_v_tag);
16882 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_v_tag);
16883 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
16884 __Pyx_GOTREF(__pyx_t_1);
16885 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16887 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16888 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16890 /* "lxml/html/diff.py":816
16891 * if _contains_block_level_tag(child):
16892 * _move_el_inside_block(child, tag)
16893 * if child.tail: # <<<<<<<<<<<<<<
16894 * tail_tag = etree.Element(tag)
16895 * tail_tag.text = child.tail
16897 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
16898 __Pyx_GOTREF(__pyx_t_1);
16899 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 816, __pyx_L1_error)
16900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16903 /* "lxml/html/diff.py":817
16904 * _move_el_inside_block(child, tag)
16906 * tail_tag = etree.Element(tag) # <<<<<<<<<<<<<<
16907 * tail_tag.text = child.tail
16908 * child.tail = None
16910 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_etree); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error)
16911 __Pyx_GOTREF(__pyx_t_6);
16912 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Element); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 817, __pyx_L1_error)
16913 __Pyx_GOTREF(__pyx_t_8);
16914 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16916 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
16917 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
16918 if (likely(__pyx_t_6)) {
16919 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
16920 __Pyx_INCREF(__pyx_t_6);
16921 __Pyx_INCREF(function);
16922 __Pyx_DECREF_SET(__pyx_t_8, function);
16925 __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_tag);
16926 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16927 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error)
16928 __Pyx_GOTREF(__pyx_t_1);
16929 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16930 __Pyx_XDECREF_SET(__pyx_v_tail_tag, __pyx_t_1);
16933 /* "lxml/html/diff.py":818
16935 * tail_tag = etree.Element(tag)
16936 * tail_tag.text = child.tail # <<<<<<<<<<<<<<
16937 * child.tail = None
16938 * el.insert(el.index(child)+1, tail_tag)
16940 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error)
16941 __Pyx_GOTREF(__pyx_t_1);
16942 if (__Pyx_PyObject_SetAttrStr(__pyx_v_tail_tag, __pyx_n_s_text, __pyx_t_1) < 0) __PYX_ERR(0, 818, __pyx_L1_error)
16943 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16945 /* "lxml/html/diff.py":819
16946 * tail_tag = etree.Element(tag)
16947 * tail_tag.text = child.tail
16948 * child.tail = None # <<<<<<<<<<<<<<
16949 * el.insert(el.index(child)+1, tail_tag)
16952 if (__Pyx_PyObject_SetAttrStr(__pyx_v_child, __pyx_n_s_tail, Py_None) < 0) __PYX_ERR(0, 819, __pyx_L1_error)
16954 /* "lxml/html/diff.py":820
16955 * tail_tag.text = child.tail
16956 * child.tail = None
16957 * el.insert(el.index(child)+1, tail_tag) # <<<<<<<<<<<<<<
16959 * child_tag = etree.Element(tag)
16961 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_insert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 820, __pyx_L1_error)
16962 __Pyx_GOTREF(__pyx_t_8);
16963 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error)
16964 __Pyx_GOTREF(__pyx_t_5);
16966 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
16967 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
16968 if (likely(__pyx_t_10)) {
16969 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16970 __Pyx_INCREF(__pyx_t_10);
16971 __Pyx_INCREF(function);
16972 __Pyx_DECREF_SET(__pyx_t_5, function);
16975 __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_child) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_child);
16976 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
16977 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 820, __pyx_L1_error)
16978 __Pyx_GOTREF(__pyx_t_6);
16979 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16980 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error)
16981 __Pyx_GOTREF(__pyx_t_5);
16982 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
16985 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
16986 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
16987 if (likely(__pyx_t_6)) {
16988 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
16989 __Pyx_INCREF(__pyx_t_6);
16990 __Pyx_INCREF(function);
16991 __Pyx_DECREF_SET(__pyx_t_8, function);
16995 #if CYTHON_FAST_PYCALL
16996 if (PyFunction_Check(__pyx_t_8)) {
16997 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_tail_tag};
16998 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
16999 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17000 __Pyx_GOTREF(__pyx_t_1);
17001 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17004 #if CYTHON_FAST_PYCCALL
17005 if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
17006 PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_v_tail_tag};
17007 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
17008 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17009 __Pyx_GOTREF(__pyx_t_1);
17010 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17014 __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 820, __pyx_L1_error)
17015 __Pyx_GOTREF(__pyx_t_10);
17017 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
17019 __Pyx_GIVEREF(__pyx_t_5);
17020 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
17021 __Pyx_INCREF(__pyx_v_tail_tag);
17022 __Pyx_GIVEREF(__pyx_v_tail_tag);
17023 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_tail_tag);
17025 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
17026 __Pyx_GOTREF(__pyx_t_1);
17027 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17029 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
17030 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17032 /* "lxml/html/diff.py":816
17033 * if _contains_block_level_tag(child):
17034 * _move_el_inside_block(child, tag)
17035 * if child.tail: # <<<<<<<<<<<<<<
17036 * tail_tag = etree.Element(tag)
17037 * tail_tag.text = child.tail
17041 /* "lxml/html/diff.py":814
17043 * for child in list(el):
17044 * if _contains_block_level_tag(child): # <<<<<<<<<<<<<<
17045 * _move_el_inside_block(child, tag)
17051 /* "lxml/html/diff.py":822
17052 * el.insert(el.index(child)+1, tail_tag)
17054 * child_tag = etree.Element(tag) # <<<<<<<<<<<<<<
17055 * el.replace(child, child_tag)
17056 * child_tag.append(child)
17059 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_etree); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 822, __pyx_L1_error)
17060 __Pyx_GOTREF(__pyx_t_8);
17061 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Element); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 822, __pyx_L1_error)
17062 __Pyx_GOTREF(__pyx_t_10);
17063 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
17065 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
17066 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
17067 if (likely(__pyx_t_8)) {
17068 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
17069 __Pyx_INCREF(__pyx_t_8);
17070 __Pyx_INCREF(function);
17071 __Pyx_DECREF_SET(__pyx_t_10, function);
17074 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_tag);
17075 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17076 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)
17077 __Pyx_GOTREF(__pyx_t_1);
17078 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17079 __Pyx_XDECREF_SET(__pyx_v_child_tag, __pyx_t_1);
17082 /* "lxml/html/diff.py":823
17084 * child_tag = etree.Element(tag)
17085 * el.replace(child, child_tag) # <<<<<<<<<<<<<<
17086 * child_tag.append(child)
17089 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_replace); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 823, __pyx_L1_error)
17090 __Pyx_GOTREF(__pyx_t_10);
17093 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
17094 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
17095 if (likely(__pyx_t_8)) {
17096 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
17097 __Pyx_INCREF(__pyx_t_8);
17098 __Pyx_INCREF(function);
17099 __Pyx_DECREF_SET(__pyx_t_10, function);
17103 #if CYTHON_FAST_PYCALL
17104 if (PyFunction_Check(__pyx_t_10)) {
17105 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_child, __pyx_v_child_tag};
17106 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
17107 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17108 __Pyx_GOTREF(__pyx_t_1);
17111 #if CYTHON_FAST_PYCCALL
17112 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
17113 PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_child, __pyx_v_child_tag};
17114 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
17115 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17116 __Pyx_GOTREF(__pyx_t_1);
17120 __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
17121 __Pyx_GOTREF(__pyx_t_5);
17123 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
17125 __Pyx_INCREF(__pyx_v_child);
17126 __Pyx_GIVEREF(__pyx_v_child);
17127 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_child);
17128 __Pyx_INCREF(__pyx_v_child_tag);
17129 __Pyx_GIVEREF(__pyx_v_child_tag);
17130 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_v_child_tag);
17131 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
17132 __Pyx_GOTREF(__pyx_t_1);
17133 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17135 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17136 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17138 /* "lxml/html/diff.py":824
17139 * child_tag = etree.Element(tag)
17140 * el.replace(child, child_tag)
17141 * child_tag.append(child) # <<<<<<<<<<<<<<
17143 * text_tag = etree.Element(tag)
17145 __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_child_tag, __pyx_v_child); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 824, __pyx_L1_error)
17149 /* "lxml/html/diff.py":813
17150 * el[:] = [children_tag]
17152 * for child in list(el): # <<<<<<<<<<<<<<
17153 * if _contains_block_level_tag(child):
17154 * _move_el_inside_block(child, tag)
17157 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17159 /* "lxml/html/diff.py":825
17160 * el.replace(child, child_tag)
17161 * child_tag.append(child)
17162 * if el.text: # <<<<<<<<<<<<<<
17163 * text_tag = etree.Element(tag)
17164 * text_tag.text = el.text
17166 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 825, __pyx_L1_error)
17167 __Pyx_GOTREF(__pyx_t_4);
17168 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 825, __pyx_L1_error)
17169 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17172 /* "lxml/html/diff.py":826
17173 * child_tag.append(child)
17175 * text_tag = etree.Element(tag) # <<<<<<<<<<<<<<
17176 * text_tag.text = el.text
17179 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
17180 __Pyx_GOTREF(__pyx_t_1);
17181 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Element); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 826, __pyx_L1_error)
17182 __Pyx_GOTREF(__pyx_t_10);
17183 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17185 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
17186 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
17187 if (likely(__pyx_t_1)) {
17188 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
17189 __Pyx_INCREF(__pyx_t_1);
17190 __Pyx_INCREF(function);
17191 __Pyx_DECREF_SET(__pyx_t_10, function);
17194 __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_1, __pyx_v_tag) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_tag);
17195 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
17196 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error)
17197 __Pyx_GOTREF(__pyx_t_4);
17198 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17199 __pyx_v_text_tag = __pyx_t_4;
17202 /* "lxml/html/diff.py":827
17204 * text_tag = etree.Element(tag)
17205 * text_tag.text = el.text # <<<<<<<<<<<<<<
17207 * el.insert(0, text_tag)
17209 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error)
17210 __Pyx_GOTREF(__pyx_t_4);
17211 if (__Pyx_PyObject_SetAttrStr(__pyx_v_text_tag, __pyx_n_s_text, __pyx_t_4) < 0) __PYX_ERR(0, 827, __pyx_L1_error)
17212 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17214 /* "lxml/html/diff.py":828
17215 * text_tag = etree.Element(tag)
17216 * text_tag.text = el.text
17217 * el.text = None # <<<<<<<<<<<<<<
17218 * el.insert(0, text_tag)
17221 if (__Pyx_PyObject_SetAttrStr(__pyx_v_el, __pyx_n_s_text, Py_None) < 0) __PYX_ERR(0, 828, __pyx_L1_error)
17223 /* "lxml/html/diff.py":829
17224 * text_tag.text = el.text
17226 * el.insert(0, text_tag) # <<<<<<<<<<<<<<
17228 * def _merge_element_contents(el):
17230 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_insert); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 829, __pyx_L1_error)
17231 __Pyx_GOTREF(__pyx_t_10);
17234 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
17235 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
17236 if (likely(__pyx_t_1)) {
17237 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
17238 __Pyx_INCREF(__pyx_t_1);
17239 __Pyx_INCREF(function);
17240 __Pyx_DECREF_SET(__pyx_t_10, function);
17244 #if CYTHON_FAST_PYCALL
17245 if (PyFunction_Check(__pyx_t_10)) {
17246 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_0, __pyx_v_text_tag};
17247 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
17248 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
17249 __Pyx_GOTREF(__pyx_t_4);
17252 #if CYTHON_FAST_PYCCALL
17253 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
17254 PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_0, __pyx_v_text_tag};
17255 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
17256 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
17257 __Pyx_GOTREF(__pyx_t_4);
17261 __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error)
17262 __Pyx_GOTREF(__pyx_t_5);
17264 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
17266 __Pyx_INCREF(__pyx_int_0);
17267 __Pyx_GIVEREF(__pyx_int_0);
17268 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_int_0);
17269 __Pyx_INCREF(__pyx_v_text_tag);
17270 __Pyx_GIVEREF(__pyx_v_text_tag);
17271 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_v_text_tag);
17272 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
17273 __Pyx_GOTREF(__pyx_t_4);
17274 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17276 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17277 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17279 /* "lxml/html/diff.py":825
17280 * el.replace(child, child_tag)
17281 * child_tag.append(child)
17282 * if el.text: # <<<<<<<<<<<<<<
17283 * text_tag = etree.Element(tag)
17284 * text_tag.text = el.text
17288 /* "lxml/html/diff.py":799
17291 * def _move_el_inside_block(el, tag): # <<<<<<<<<<<<<<
17292 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
17293 * and moves them inside any block-level tags. """
17296 /* function exit code */
17297 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17300 __Pyx_XDECREF(__pyx_t_1);
17301 __Pyx_XDECREF(__pyx_t_4);
17302 __Pyx_XDECREF(__pyx_t_5);
17303 __Pyx_XDECREF(__pyx_t_6);
17304 __Pyx_XDECREF(__pyx_t_8);
17305 __Pyx_XDECREF(__pyx_t_10);
17306 __Pyx_AddTraceback("lxml.html.diff._move_el_inside_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
17309 __Pyx_XDECREF(__pyx_v_child);
17310 __Pyx_XDECREF(__pyx_v_children_tag);
17311 __Pyx_XDECREF(__pyx_v_tail_tag);
17312 __Pyx_XDECREF(__pyx_v_child_tag);
17313 __Pyx_XDECREF(__pyx_v_text_tag);
17314 __Pyx_XGIVEREF(__pyx_r);
17315 __Pyx_RefNannyFinishContext();
17319 /* "lxml/html/diff.py":831
17320 * el.insert(0, text_tag)
17322 * def _merge_element_contents(el): # <<<<<<<<<<<<<<
17324 * Removes an element, but merges its contents into its place, e.g.,
17327 /* Python wrapper */
17328 static PyObject *__pyx_pw_4lxml_4html_4diff_74_merge_element_contents(PyObject *__pyx_self, PyObject *__pyx_v_el); /*proto*/
17329 static char __pyx_doc_4lxml_4html_4diff_73_merge_element_contents[] = "\n Removes an element, but merges its contents into its place, e.g.,\n given <p>Hi <i>there!</i></p>, if you remove the <i> element you get\n <p>Hi there!</p>\n ";
17330 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_74_merge_element_contents = {"_merge_element_contents", (PyCFunction)__pyx_pw_4lxml_4html_4diff_74_merge_element_contents, METH_O, __pyx_doc_4lxml_4html_4diff_73_merge_element_contents};
17331 static PyObject *__pyx_pw_4lxml_4html_4diff_74_merge_element_contents(PyObject *__pyx_self, PyObject *__pyx_v_el) {
17332 PyObject *__pyx_r = 0;
17333 __Pyx_RefNannyDeclarations
17334 __Pyx_RefNannySetupContext("_merge_element_contents (wrapper)", 0);
17335 __pyx_r = __pyx_pf_4lxml_4html_4diff_73_merge_element_contents(__pyx_self, ((PyObject *)__pyx_v_el));
17337 /* function exit code */
17338 __Pyx_RefNannyFinishContext();
17342 static PyObject *__pyx_pf_4lxml_4html_4diff_73_merge_element_contents(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_el) {
17343 PyObject *__pyx_v_parent = NULL;
17344 PyObject *__pyx_v_text = NULL;
17345 PyObject *__pyx_v_index = NULL;
17346 PyObject *__pyx_v_previous = NULL;
17347 PyObject *__pyx_r = NULL;
17348 __Pyx_RefNannyDeclarations
17349 PyObject *__pyx_t_1 = NULL;
17350 PyObject *__pyx_t_2 = NULL;
17351 PyObject *__pyx_t_3 = NULL;
17353 Py_ssize_t __pyx_t_5;
17354 PyObject *__pyx_t_6 = NULL;
17356 int __pyx_lineno = 0;
17357 const char *__pyx_filename = NULL;
17358 int __pyx_clineno = 0;
17359 __Pyx_RefNannySetupContext("_merge_element_contents", 0);
17361 /* "lxml/html/diff.py":837
17364 * parent = el.getparent() # <<<<<<<<<<<<<<
17365 * text = el.text or ''
17368 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_getparent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error)
17369 __Pyx_GOTREF(__pyx_t_2);
17371 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
17372 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
17373 if (likely(__pyx_t_3)) {
17374 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17375 __Pyx_INCREF(__pyx_t_3);
17376 __Pyx_INCREF(function);
17377 __Pyx_DECREF_SET(__pyx_t_2, function);
17380 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
17381 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
17382 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error)
17383 __Pyx_GOTREF(__pyx_t_1);
17384 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17385 __pyx_v_parent = __pyx_t_1;
17388 /* "lxml/html/diff.py":838
17390 * parent = el.getparent()
17391 * text = el.text or '' # <<<<<<<<<<<<<<
17395 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error)
17396 __Pyx_GOTREF(__pyx_t_2);
17397 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 838, __pyx_L1_error)
17399 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17401 __Pyx_INCREF(__pyx_t_2);
17402 __pyx_t_1 = __pyx_t_2;
17403 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17404 goto __pyx_L3_bool_binop_done;
17406 __Pyx_INCREF(__pyx_kp_u__2);
17407 __pyx_t_1 = __pyx_kp_u__2;
17408 __pyx_L3_bool_binop_done:;
17409 __pyx_v_text = __pyx_t_1;
17412 /* "lxml/html/diff.py":839
17413 * parent = el.getparent()
17414 * text = el.text or ''
17415 * if el.tail: # <<<<<<<<<<<<<<
17419 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error)
17420 __Pyx_GOTREF(__pyx_t_1);
17421 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 839, __pyx_L1_error)
17422 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17425 /* "lxml/html/diff.py":840
17426 * text = el.text or ''
17428 * if not len(el): # <<<<<<<<<<<<<<
17432 __pyx_t_5 = PyObject_Length(__pyx_v_el); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 840, __pyx_L1_error)
17433 __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
17436 /* "lxml/html/diff.py":841
17439 * text += el.tail # <<<<<<<<<<<<<<
17443 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
17444 __Pyx_GOTREF(__pyx_t_1);
17445 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_text, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
17446 __Pyx_GOTREF(__pyx_t_2);
17447 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17448 __Pyx_DECREF_SET(__pyx_v_text, __pyx_t_2);
17451 /* "lxml/html/diff.py":840
17452 * text = el.text or ''
17454 * if not len(el): # <<<<<<<<<<<<<<
17461 /* "lxml/html/diff.py":843
17464 * if el[-1].tail: # <<<<<<<<<<<<<<
17465 * el[-1].tail += el.tail
17469 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_el, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
17470 __Pyx_GOTREF(__pyx_t_2);
17471 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
17472 __Pyx_GOTREF(__pyx_t_1);
17473 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17474 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 843, __pyx_L1_error)
17475 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17478 /* "lxml/html/diff.py":844
17481 * el[-1].tail += el.tail # <<<<<<<<<<<<<<
17483 * el[-1].tail = el.tail
17485 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_el, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
17486 __Pyx_GOTREF(__pyx_t_1);
17487 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tail); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
17488 __Pyx_GOTREF(__pyx_t_2);
17489 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 844, __pyx_L1_error)
17490 __Pyx_GOTREF(__pyx_t_3);
17491 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L1_error)
17492 __Pyx_GOTREF(__pyx_t_6);
17493 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17494 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17495 if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_tail, __pyx_t_6) < 0) __PYX_ERR(0, 844, __pyx_L1_error)
17496 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17497 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17499 /* "lxml/html/diff.py":843
17502 * if el[-1].tail: # <<<<<<<<<<<<<<
17503 * el[-1].tail += el.tail
17509 /* "lxml/html/diff.py":846
17510 * el[-1].tail += el.tail
17512 * el[-1].tail = el.tail # <<<<<<<<<<<<<<
17513 * index = parent.index(el)
17517 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_tail); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error)
17518 __Pyx_GOTREF(__pyx_t_1);
17519 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_el, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 846, __pyx_L1_error)
17520 __Pyx_GOTREF(__pyx_t_6);
17521 if (__Pyx_PyObject_SetAttrStr(__pyx_t_6, __pyx_n_s_tail, __pyx_t_1) < 0) __PYX_ERR(0, 846, __pyx_L1_error)
17522 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17523 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17529 /* "lxml/html/diff.py":839
17530 * parent = el.getparent()
17531 * text = el.text or ''
17532 * if el.tail: # <<<<<<<<<<<<<<
17538 /* "lxml/html/diff.py":847
17540 * el[-1].tail = el.tail
17541 * index = parent.index(el) # <<<<<<<<<<<<<<
17545 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parent, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error)
17546 __Pyx_GOTREF(__pyx_t_1);
17548 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
17549 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
17550 if (likely(__pyx_t_3)) {
17551 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
17552 __Pyx_INCREF(__pyx_t_3);
17553 __Pyx_INCREF(function);
17554 __Pyx_DECREF_SET(__pyx_t_1, function);
17557 __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_el) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_el);
17558 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
17559 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 847, __pyx_L1_error)
17560 __Pyx_GOTREF(__pyx_t_6);
17561 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17562 __pyx_v_index = __pyx_t_6;
17565 /* "lxml/html/diff.py":848
17566 * el[-1].tail = el.tail
17567 * index = parent.index(el)
17568 * if text: # <<<<<<<<<<<<<<
17572 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 848, __pyx_L1_error)
17575 /* "lxml/html/diff.py":849
17576 * index = parent.index(el)
17578 * if index == 0: # <<<<<<<<<<<<<<
17582 __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_index, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 849, __pyx_L1_error)
17583 __Pyx_GOTREF(__pyx_t_6);
17584 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 849, __pyx_L1_error)
17585 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17588 /* "lxml/html/diff.py":850
17591 * previous = None # <<<<<<<<<<<<<<
17593 * previous = parent[index-1]
17595 __Pyx_INCREF(Py_None);
17596 __pyx_v_previous = Py_None;
17598 /* "lxml/html/diff.py":849
17599 * index = parent.index(el)
17601 * if index == 0: # <<<<<<<<<<<<<<
17608 /* "lxml/html/diff.py":852
17611 * previous = parent[index-1] # <<<<<<<<<<<<<<
17612 * if previous is None:
17616 __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error)
17617 __Pyx_GOTREF(__pyx_t_6);
17618 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_parent, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error)
17619 __Pyx_GOTREF(__pyx_t_1);
17620 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17621 __pyx_v_previous = __pyx_t_1;
17626 /* "lxml/html/diff.py":853
17628 * previous = parent[index-1]
17629 * if previous is None: # <<<<<<<<<<<<<<
17631 * parent.text += text
17633 __pyx_t_4 = (__pyx_v_previous == Py_None);
17634 __pyx_t_7 = (__pyx_t_4 != 0);
17637 /* "lxml/html/diff.py":854
17638 * previous = parent[index-1]
17639 * if previous is None:
17640 * if parent.text: # <<<<<<<<<<<<<<
17641 * parent.text += text
17644 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parent, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
17645 __Pyx_GOTREF(__pyx_t_1);
17646 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 854, __pyx_L1_error)
17647 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17650 /* "lxml/html/diff.py":855
17651 * if previous is None:
17653 * parent.text += text # <<<<<<<<<<<<<<
17655 * parent.text = text
17657 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_parent, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
17658 __Pyx_GOTREF(__pyx_t_1);
17659 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_text); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 855, __pyx_L1_error)
17660 __Pyx_GOTREF(__pyx_t_6);
17661 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17662 if (__Pyx_PyObject_SetAttrStr(__pyx_v_parent, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 855, __pyx_L1_error)
17663 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17665 /* "lxml/html/diff.py":854
17666 * previous = parent[index-1]
17667 * if previous is None:
17668 * if parent.text: # <<<<<<<<<<<<<<
17669 * parent.text += text
17675 /* "lxml/html/diff.py":857
17676 * parent.text += text
17678 * parent.text = text # <<<<<<<<<<<<<<
17680 * if previous.tail:
17683 if (__Pyx_PyObject_SetAttrStr(__pyx_v_parent, __pyx_n_s_text, __pyx_v_text) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
17687 /* "lxml/html/diff.py":853
17689 * previous = parent[index-1]
17690 * if previous is None: # <<<<<<<<<<<<<<
17692 * parent.text += text
17697 /* "lxml/html/diff.py":859
17698 * parent.text = text
17700 * if previous.tail: # <<<<<<<<<<<<<<
17701 * previous.tail += text
17705 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_previous, __pyx_n_s_tail); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 859, __pyx_L1_error)
17706 __Pyx_GOTREF(__pyx_t_6);
17707 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 859, __pyx_L1_error)
17708 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17711 /* "lxml/html/diff.py":860
17713 * if previous.tail:
17714 * previous.tail += text # <<<<<<<<<<<<<<
17716 * previous.tail = text
17718 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_previous, __pyx_n_s_tail); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 860, __pyx_L1_error)
17719 __Pyx_GOTREF(__pyx_t_6);
17720 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
17721 __Pyx_GOTREF(__pyx_t_1);
17722 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17723 if (__Pyx_PyObject_SetAttrStr(__pyx_v_previous, __pyx_n_s_tail, __pyx_t_1) < 0) __PYX_ERR(0, 860, __pyx_L1_error)
17724 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17726 /* "lxml/html/diff.py":859
17727 * parent.text = text
17729 * if previous.tail: # <<<<<<<<<<<<<<
17730 * previous.tail += text
17736 /* "lxml/html/diff.py":862
17737 * previous.tail += text
17739 * previous.tail = text # <<<<<<<<<<<<<<
17740 * parent[index:index+1] = el.getchildren()
17744 if (__Pyx_PyObject_SetAttrStr(__pyx_v_previous, __pyx_n_s_tail, __pyx_v_text) < 0) __PYX_ERR(0, 862, __pyx_L1_error)
17750 /* "lxml/html/diff.py":848
17751 * el[-1].tail = el.tail
17752 * index = parent.index(el)
17753 * if text: # <<<<<<<<<<<<<<
17759 /* "lxml/html/diff.py":863
17761 * previous.tail = text
17762 * parent[index:index+1] = el.getchildren() # <<<<<<<<<<<<<<
17764 * class InsensitiveSequenceMatcher(difflib.SequenceMatcher):
17766 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_getchildren); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
17767 __Pyx_GOTREF(__pyx_t_6);
17769 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
17770 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
17771 if (likely(__pyx_t_3)) {
17772 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
17773 __Pyx_INCREF(__pyx_t_3);
17774 __Pyx_INCREF(function);
17775 __Pyx_DECREF_SET(__pyx_t_6, function);
17778 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
17779 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
17780 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
17781 __Pyx_GOTREF(__pyx_t_1);
17782 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17783 __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
17784 __Pyx_GOTREF(__pyx_t_6);
17785 if (__Pyx_PyObject_SetSlice(__pyx_v_parent, __pyx_t_1, 0, 0, &__pyx_v_index, &__pyx_t_6, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
17786 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17787 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17789 /* "lxml/html/diff.py":831
17790 * el.insert(0, text_tag)
17792 * def _merge_element_contents(el): # <<<<<<<<<<<<<<
17794 * Removes an element, but merges its contents into its place, e.g.,
17797 /* function exit code */
17798 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17801 __Pyx_XDECREF(__pyx_t_1);
17802 __Pyx_XDECREF(__pyx_t_2);
17803 __Pyx_XDECREF(__pyx_t_3);
17804 __Pyx_XDECREF(__pyx_t_6);
17805 __Pyx_AddTraceback("lxml.html.diff._merge_element_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17808 __Pyx_XDECREF(__pyx_v_parent);
17809 __Pyx_XDECREF(__pyx_v_text);
17810 __Pyx_XDECREF(__pyx_v_index);
17811 __Pyx_XDECREF(__pyx_v_previous);
17812 __Pyx_XGIVEREF(__pyx_r);
17813 __Pyx_RefNannyFinishContext();
17817 /* "lxml/html/diff.py":873
17820 * def get_matching_blocks(self): # <<<<<<<<<<<<<<
17821 * size = min(len(self.b), len(self.b))
17822 * threshold = min(self.threshold, size / 4)
17825 /* Python wrapper */
17826 static PyObject *__pyx_pw_4lxml_4html_4diff_26InsensitiveSequenceMatcher_1get_matching_blocks(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
17827 static PyMethodDef __pyx_mdef_4lxml_4html_4diff_26InsensitiveSequenceMatcher_1get_matching_blocks = {"get_matching_blocks", (PyCFunction)__pyx_pw_4lxml_4html_4diff_26InsensitiveSequenceMatcher_1get_matching_blocks, METH_O, 0};
17828 static PyObject *__pyx_pw_4lxml_4html_4diff_26InsensitiveSequenceMatcher_1get_matching_blocks(PyObject *__pyx_self, PyObject *__pyx_v_self) {
17829 PyObject *__pyx_r = 0;
17830 __Pyx_RefNannyDeclarations
17831 __Pyx_RefNannySetupContext("get_matching_blocks (wrapper)", 0);
17832 __pyx_r = __pyx_pf_4lxml_4html_4diff_26InsensitiveSequenceMatcher_get_matching_blocks(__pyx_self, ((PyObject *)__pyx_v_self));
17834 /* function exit code */
17835 __Pyx_RefNannyFinishContext();
17839 static PyObject *__pyx_pf_4lxml_4html_4diff_26InsensitiveSequenceMatcher_get_matching_blocks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
17840 PyObject *__pyx_v_size = NULL;
17841 PyObject *__pyx_v_threshold = NULL;
17842 PyObject *__pyx_v_actual = NULL;
17843 PyObject *__pyx_8genexpr5__pyx_v_item = NULL;
17844 PyObject *__pyx_r = NULL;
17845 __Pyx_RefNannyDeclarations
17846 PyObject *__pyx_t_1 = NULL;
17847 Py_ssize_t __pyx_t_2;
17848 Py_ssize_t __pyx_t_3;
17849 Py_ssize_t __pyx_t_4;
17850 PyObject *__pyx_t_5 = NULL;
17851 PyObject *__pyx_t_6 = NULL;
17852 PyObject *__pyx_t_7 = NULL;
17854 PyObject *(*__pyx_t_9)(PyObject *);
17857 int __pyx_lineno = 0;
17858 const char *__pyx_filename = NULL;
17859 int __pyx_clineno = 0;
17860 __Pyx_RefNannySetupContext("get_matching_blocks", 0);
17862 /* "lxml/html/diff.py":874
17864 * def get_matching_blocks(self):
17865 * size = min(len(self.b), len(self.b)) # <<<<<<<<<<<<<<
17866 * threshold = min(self.threshold, size / 4)
17867 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
17869 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
17870 __Pyx_GOTREF(__pyx_t_1);
17871 __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 874, __pyx_L1_error)
17872 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17873 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
17874 __Pyx_GOTREF(__pyx_t_1);
17875 __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 874, __pyx_L1_error)
17876 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17877 if (((__pyx_t_2 < __pyx_t_3) != 0)) {
17878 __pyx_t_4 = __pyx_t_2;
17880 __pyx_t_4 = __pyx_t_3;
17882 __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
17883 __Pyx_GOTREF(__pyx_t_1);
17884 __pyx_v_size = __pyx_t_1;
17887 /* "lxml/html/diff.py":875
17888 * def get_matching_blocks(self):
17889 * size = min(len(self.b), len(self.b))
17890 * threshold = min(self.threshold, size / 4) # <<<<<<<<<<<<<<
17891 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
17892 * return [item for item in actual
17894 __pyx_t_1 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_size, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
17895 __Pyx_GOTREF(__pyx_t_1);
17896 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_threshold); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 875, __pyx_L1_error)
17897 __Pyx_GOTREF(__pyx_t_5);
17898 __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error)
17899 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 875, __pyx_L1_error)
17900 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17902 __Pyx_INCREF(__pyx_t_1);
17903 __pyx_t_6 = __pyx_t_1;
17905 __Pyx_INCREF(__pyx_t_5);
17906 __pyx_t_6 = __pyx_t_5;
17908 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17909 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17910 __pyx_t_1 = __pyx_t_6;
17911 __Pyx_INCREF(__pyx_t_1);
17912 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17913 __pyx_v_threshold = __pyx_t_1;
17916 /* "lxml/html/diff.py":876
17917 * size = min(len(self.b), len(self.b))
17918 * threshold = min(self.threshold, size / 4)
17919 * actual = difflib.SequenceMatcher.get_matching_blocks(self) # <<<<<<<<<<<<<<
17920 * return [item for item in actual
17921 * if item[2] > threshold
17923 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_difflib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error)
17924 __Pyx_GOTREF(__pyx_t_6);
17925 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_SequenceMatcher); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 876, __pyx_L1_error)
17926 __Pyx_GOTREF(__pyx_t_5);
17927 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17928 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_matching_blocks); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error)
17929 __Pyx_GOTREF(__pyx_t_6);
17930 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17932 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
17933 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
17934 if (likely(__pyx_t_5)) {
17935 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
17936 __Pyx_INCREF(__pyx_t_5);
17937 __Pyx_INCREF(function);
17938 __Pyx_DECREF_SET(__pyx_t_6, function);
17941 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_self);
17942 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17943 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
17944 __Pyx_GOTREF(__pyx_t_1);
17945 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17946 __pyx_v_actual = __pyx_t_1;
17949 /* "lxml/html/diff.py":877
17950 * threshold = min(self.threshold, size / 4)
17951 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
17952 * return [item for item in actual # <<<<<<<<<<<<<<
17953 * if item[2] > threshold
17956 __Pyx_XDECREF(__pyx_r);
17957 { /* enter inner scope */
17958 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L5_error)
17959 __Pyx_GOTREF(__pyx_t_1);
17960 if (likely(PyList_CheckExact(__pyx_v_actual)) || PyTuple_CheckExact(__pyx_v_actual)) {
17961 __pyx_t_6 = __pyx_v_actual; __Pyx_INCREF(__pyx_t_6); __pyx_t_4 = 0;
17964 __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_actual); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 877, __pyx_L5_error)
17965 __Pyx_GOTREF(__pyx_t_6);
17966 __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 877, __pyx_L5_error)
17969 if (likely(!__pyx_t_9)) {
17970 if (likely(PyList_CheckExact(__pyx_t_6))) {
17971 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
17972 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17973 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 877, __pyx_L5_error)
17975 __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L5_error)
17976 __Pyx_GOTREF(__pyx_t_5);
17979 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
17980 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17981 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 877, __pyx_L5_error)
17983 __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 877, __pyx_L5_error)
17984 __Pyx_GOTREF(__pyx_t_5);
17988 __pyx_t_5 = __pyx_t_9(__pyx_t_6);
17989 if (unlikely(!__pyx_t_5)) {
17990 PyObject* exc_type = PyErr_Occurred();
17992 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
17993 else __PYX_ERR(0, 877, __pyx_L5_error)
17997 __Pyx_GOTREF(__pyx_t_5);
17999 __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_item, __pyx_t_5);
18002 /* "lxml/html/diff.py":878
18003 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
18004 * return [item for item in actual
18005 * if item[2] > threshold # <<<<<<<<<<<<<<
18009 __pyx_t_5 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_item, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L5_error)
18010 __Pyx_GOTREF(__pyx_t_5);
18011 __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_v_threshold, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 878, __pyx_L5_error)
18012 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18013 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 878, __pyx_L5_error)
18014 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18017 __pyx_t_8 = __pyx_t_10;
18018 goto __pyx_L9_bool_binop_done;
18021 /* "lxml/html/diff.py":879
18022 * return [item for item in actual
18023 * if item[2] > threshold
18024 * or not item[2]] # <<<<<<<<<<<<<<
18026 * if __name__ == '__main__':
18028 __pyx_t_7 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_item, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 879, __pyx_L5_error)
18029 __Pyx_GOTREF(__pyx_t_7);
18030 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 879, __pyx_L5_error)
18031 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18032 __pyx_t_11 = ((!__pyx_t_10) != 0);
18033 __pyx_t_8 = __pyx_t_11;
18034 __pyx_L9_bool_binop_done:;
18036 /* "lxml/html/diff.py":878
18037 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
18038 * return [item for item in actual
18039 * if item[2] > threshold # <<<<<<<<<<<<<<
18045 /* "lxml/html/diff.py":877
18046 * threshold = min(self.threshold, size / 4)
18047 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
18048 * return [item for item in actual # <<<<<<<<<<<<<<
18049 * if item[2] > threshold
18052 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr5__pyx_v_item))) __PYX_ERR(0, 877, __pyx_L5_error)
18054 /* "lxml/html/diff.py":878
18055 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
18056 * return [item for item in actual
18057 * if item[2] > threshold # <<<<<<<<<<<<<<
18063 /* "lxml/html/diff.py":877
18064 * threshold = min(self.threshold, size / 4)
18065 * actual = difflib.SequenceMatcher.get_matching_blocks(self)
18066 * return [item for item in actual # <<<<<<<<<<<<<<
18067 * if item[2] > threshold
18071 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18072 __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_item); __pyx_8genexpr5__pyx_v_item = 0;
18073 goto __pyx_L11_exit_scope;
18075 __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_item); __pyx_8genexpr5__pyx_v_item = 0;
18076 goto __pyx_L1_error;
18077 __pyx_L11_exit_scope:;
18078 } /* exit inner scope */
18079 __pyx_r = __pyx_t_1;
18083 /* "lxml/html/diff.py":873
18086 * def get_matching_blocks(self): # <<<<<<<<<<<<<<
18087 * size = min(len(self.b), len(self.b))
18088 * threshold = min(self.threshold, size / 4)
18091 /* function exit code */
18093 __Pyx_XDECREF(__pyx_t_1);
18094 __Pyx_XDECREF(__pyx_t_5);
18095 __Pyx_XDECREF(__pyx_t_6);
18096 __Pyx_XDECREF(__pyx_t_7);
18097 __Pyx_AddTraceback("lxml.html.diff.InsensitiveSequenceMatcher.get_matching_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
18100 __Pyx_XDECREF(__pyx_v_size);
18101 __Pyx_XDECREF(__pyx_v_threshold);
18102 __Pyx_XDECREF(__pyx_v_actual);
18103 __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_item);
18104 __Pyx_XGIVEREF(__pyx_r);
18105 __Pyx_RefNannyFinishContext();
18109 static struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens[8];
18110 static int __pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens = 0;
18112 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18114 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens)))) {
18115 o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens];
18116 memset(o, 0, sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens));
18117 (void) PyObject_INIT(o, t);
18118 PyObject_GC_Track(o);
18120 o = (*t->tp_alloc)(t, 0);
18121 if (unlikely(!o)) return 0;
18126 static void __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens(PyObject *o) {
18127 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)o;
18128 PyObject_GC_UnTrack(o);
18129 Py_CLEAR(p->__pyx_v_html);
18130 Py_CLEAR(p->__pyx_v_markup_func);
18131 Py_CLEAR(p->__pyx_v_post);
18132 Py_CLEAR(p->__pyx_v_pre);
18133 Py_CLEAR(p->__pyx_v_token);
18134 Py_CLEAR(p->__pyx_v_tokens);
18135 Py_CLEAR(p->__pyx_t_0);
18136 Py_CLEAR(p->__pyx_t_3);
18137 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens)))) {
18138 __pyx_freelist_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens[__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens++] = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)o);
18140 (*Py_TYPE(o)->tp_free)(o);
18144 static int __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens(PyObject *o, visitproc v, void *a) {
18146 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens *)o;
18147 if (p->__pyx_v_html) {
18148 e = (*v)(p->__pyx_v_html, a); if (e) return e;
18150 if (p->__pyx_v_markup_func) {
18151 e = (*v)(p->__pyx_v_markup_func, a); if (e) return e;
18153 if (p->__pyx_v_post) {
18154 e = (*v)(p->__pyx_v_post, a); if (e) return e;
18156 if (p->__pyx_v_pre) {
18157 e = (*v)(p->__pyx_v_pre, a); if (e) return e;
18159 if (p->__pyx_v_token) {
18160 e = (*v)(p->__pyx_v_token, a); if (e) return e;
18162 if (p->__pyx_v_tokens) {
18163 e = (*v)(p->__pyx_v_tokens, a); if (e) return e;
18165 if (p->__pyx_t_0) {
18166 e = (*v)(p->__pyx_t_0, a); if (e) return e;
18168 if (p->__pyx_t_3) {
18169 e = (*v)(p->__pyx_t_3, a); if (e) return e;
18174 static PyTypeObject __pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens = {
18175 PyVarObject_HEAD_INIT(0, 0)
18176 "lxml.html.diff.__pyx_scope_struct__markup_serialize_tokens", /*tp_name*/
18177 sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens), /*tp_basicsize*/
18179 __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens, /*tp_dealloc*/
18180 #if PY_VERSION_HEX < 0x030800b4
18183 #if PY_VERSION_HEX >= 0x030800b4
18184 0, /*tp_vectorcall_offset*/
18188 #if PY_MAJOR_VERSION < 3
18191 #if PY_MAJOR_VERSION >= 3
18195 0, /*tp_as_number*/
18196 0, /*tp_as_sequence*/
18197 0, /*tp_as_mapping*/
18203 0, /*tp_as_buffer*/
18204 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18206 __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens, /*tp_traverse*/
18208 0, /*tp_richcompare*/
18209 0, /*tp_weaklistoffset*/
18217 0, /*tp_descr_get*/
18218 0, /*tp_descr_set*/
18219 0, /*tp_dictoffset*/
18222 __pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens, /*tp_new*/
18228 0, /*tp_subclasses*/
18231 0, /*tp_version_tag*/
18232 #if PY_VERSION_HEX >= 0x030400a1
18235 #if PY_VERSION_HEX >= 0x030800b1
18236 0, /*tp_vectorcall*/
18238 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18243 static struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens[8];
18244 static int __pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens = 0;
18246 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18248 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens)))) {
18249 o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens];
18250 memset(o, 0, sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens));
18251 (void) PyObject_INIT(o, t);
18252 PyObject_GC_Track(o);
18254 o = (*t->tp_alloc)(t, 0);
18255 if (unlikely(!o)) return 0;
18260 static void __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens(PyObject *o) {
18261 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)o;
18262 PyObject_GC_UnTrack(o);
18263 Py_CLEAR(p->__pyx_v_equal);
18264 Py_CLEAR(p->__pyx_v_post);
18265 Py_CLEAR(p->__pyx_v_pre);
18266 Py_CLEAR(p->__pyx_v_token);
18267 Py_CLEAR(p->__pyx_v_tokens);
18268 Py_CLEAR(p->__pyx_t_0);
18269 Py_CLEAR(p->__pyx_t_3);
18270 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens)))) {
18271 __pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens[__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens++] = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)o);
18273 (*Py_TYPE(o)->tp_free)(o);
18277 static int __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens(PyObject *o, visitproc v, void *a) {
18279 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens *)o;
18280 if (p->__pyx_v_equal) {
18281 e = (*v)(p->__pyx_v_equal, a); if (e) return e;
18283 if (p->__pyx_v_post) {
18284 e = (*v)(p->__pyx_v_post, a); if (e) return e;
18286 if (p->__pyx_v_pre) {
18287 e = (*v)(p->__pyx_v_pre, a); if (e) return e;
18289 if (p->__pyx_v_token) {
18290 e = (*v)(p->__pyx_v_token, a); if (e) return e;
18292 if (p->__pyx_v_tokens) {
18293 e = (*v)(p->__pyx_v_tokens, a); if (e) return e;
18295 if (p->__pyx_t_0) {
18296 e = (*v)(p->__pyx_t_0, a); if (e) return e;
18298 if (p->__pyx_t_3) {
18299 e = (*v)(p->__pyx_t_3, a); if (e) return e;
18304 static PyTypeObject __pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens = {
18305 PyVarObject_HEAD_INIT(0, 0)
18306 "lxml.html.diff.__pyx_scope_struct_1_expand_tokens", /*tp_name*/
18307 sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens), /*tp_basicsize*/
18309 __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens, /*tp_dealloc*/
18310 #if PY_VERSION_HEX < 0x030800b4
18313 #if PY_VERSION_HEX >= 0x030800b4
18314 0, /*tp_vectorcall_offset*/
18318 #if PY_MAJOR_VERSION < 3
18321 #if PY_MAJOR_VERSION >= 3
18325 0, /*tp_as_number*/
18326 0, /*tp_as_sequence*/
18327 0, /*tp_as_mapping*/
18333 0, /*tp_as_buffer*/
18334 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18336 __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens, /*tp_traverse*/
18338 0, /*tp_richcompare*/
18339 0, /*tp_weaklistoffset*/
18347 0, /*tp_descr_get*/
18348 0, /*tp_descr_set*/
18349 0, /*tp_dictoffset*/
18352 __pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens, /*tp_new*/
18358 0, /*tp_subclasses*/
18361 0, /*tp_version_tag*/
18362 #if PY_VERSION_HEX >= 0x030400a1
18365 #if PY_VERSION_HEX >= 0x030800b1
18366 0, /*tp_vectorcall*/
18368 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18373 static struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el[8];
18374 static int __pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el = 0;
18376 static PyObject *__pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18378 if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el)))) {
18379 o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el];
18380 memset(o, 0, sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el));
18381 (void) PyObject_INIT(o, t);
18382 PyObject_GC_Track(o);
18384 o = (*t->tp_alloc)(t, 0);
18385 if (unlikely(!o)) return 0;
18390 static void __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el(PyObject *o) {
18391 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)o;
18392 PyObject_GC_UnTrack(o);
18393 Py_CLEAR(p->__pyx_v_child);
18394 Py_CLEAR(p->__pyx_v_el);
18395 Py_CLEAR(p->__pyx_v_end_words);
18396 Py_CLEAR(p->__pyx_v_include_hrefs);
18397 Py_CLEAR(p->__pyx_v_item);
18398 Py_CLEAR(p->__pyx_v_skip_tag);
18399 Py_CLEAR(p->__pyx_v_start_words);
18400 Py_CLEAR(p->__pyx_v_word);
18401 Py_CLEAR(p->__pyx_t_0);
18402 Py_CLEAR(p->__pyx_t_3);
18403 if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el)))) {
18404 __pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el[__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el++] = ((struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)o);
18406 (*Py_TYPE(o)->tp_free)(o);
18410 static int __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el(PyObject *o, visitproc v, void *a) {
18412 struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *p = (struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el *)o;
18413 if (p->__pyx_v_child) {
18414 e = (*v)(p->__pyx_v_child, a); if (e) return e;
18416 if (p->__pyx_v_el) {
18417 e = (*v)(p->__pyx_v_el, a); if (e) return e;
18419 if (p->__pyx_v_end_words) {
18420 e = (*v)(p->__pyx_v_end_words, a); if (e) return e;
18422 if (p->__pyx_v_include_hrefs) {
18423 e = (*v)(p->__pyx_v_include_hrefs, a); if (e) return e;
18425 if (p->__pyx_v_item) {
18426 e = (*v)(p->__pyx_v_item, a); if (e) return e;
18428 if (p->__pyx_v_skip_tag) {
18429 e = (*v)(p->__pyx_v_skip_tag, a); if (e) return e;
18431 if (p->__pyx_v_start_words) {
18432 e = (*v)(p->__pyx_v_start_words, a); if (e) return e;
18434 if (p->__pyx_v_word) {
18435 e = (*v)(p->__pyx_v_word, a); if (e) return e;
18437 if (p->__pyx_t_0) {
18438 e = (*v)(p->__pyx_t_0, a); if (e) return e;
18440 if (p->__pyx_t_3) {
18441 e = (*v)(p->__pyx_t_3, a); if (e) return e;
18446 static PyTypeObject __pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el = {
18447 PyVarObject_HEAD_INIT(0, 0)
18448 "lxml.html.diff.__pyx_scope_struct_2_flatten_el", /*tp_name*/
18449 sizeof(struct __pyx_obj_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el), /*tp_basicsize*/
18451 __pyx_tp_dealloc_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el, /*tp_dealloc*/
18452 #if PY_VERSION_HEX < 0x030800b4
18455 #if PY_VERSION_HEX >= 0x030800b4
18456 0, /*tp_vectorcall_offset*/
18460 #if PY_MAJOR_VERSION < 3
18463 #if PY_MAJOR_VERSION >= 3
18467 0, /*tp_as_number*/
18468 0, /*tp_as_sequence*/
18469 0, /*tp_as_mapping*/
18475 0, /*tp_as_buffer*/
18476 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18478 __pyx_tp_traverse_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el, /*tp_traverse*/
18480 0, /*tp_richcompare*/
18481 0, /*tp_weaklistoffset*/
18489 0, /*tp_descr_get*/
18490 0, /*tp_descr_set*/
18491 0, /*tp_dictoffset*/
18494 __pyx_tp_new_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el, /*tp_new*/
18500 0, /*tp_subclasses*/
18503 0, /*tp_version_tag*/
18504 #if PY_VERSION_HEX >= 0x030400a1
18507 #if PY_VERSION_HEX >= 0x030800b1
18508 0, /*tp_vectorcall*/
18510 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18515 static PyMethodDef __pyx_methods[] = {
18519 #if PY_MAJOR_VERSION >= 3
18520 #if CYTHON_PEP489_MULTI_PHASE_INIT
18521 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
18522 static int __pyx_pymod_exec_diff(PyObject* module); /*proto*/
18523 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
18524 {Py_mod_create, (void*)__pyx_pymod_create},
18525 {Py_mod_exec, (void*)__pyx_pymod_exec_diff},
18530 static struct PyModuleDef __pyx_moduledef = {
18531 PyModuleDef_HEAD_INIT,
18534 #if CYTHON_PEP489_MULTI_PHASE_INIT
18539 __pyx_methods /* m_methods */,
18540 #if CYTHON_PEP489_MULTI_PHASE_INIT
18541 __pyx_moduledef_slots, /* m_slots */
18543 NULL, /* m_reload */
18545 NULL, /* m_traverse */
18546 NULL, /* m_clear */
18547 (freefunc)__pyx_module_cleanup /* m_free */
18550 #ifndef CYTHON_SMALL_CODE
18551 #if defined(__clang__)
18552 #define CYTHON_SMALL_CODE
18553 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
18554 #define CYTHON_SMALL_CODE __attribute__((cold))
18556 #define CYTHON_SMALL_CODE
18560 static __Pyx_StringTabEntry __pyx_string_tab[] = {
18561 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
18562 {&__pyx_kp_s_Acts_like_SequenceMatcher_but_t, __pyx_k_Acts_like_SequenceMatcher_but_t, sizeof(__pyx_k_Acts_like_SequenceMatcher_but_t), 0, 0, 1, 0},
18563 {&__pyx_n_s_DEL_END, __pyx_k_DEL_END, sizeof(__pyx_k_DEL_END), 0, 0, 1, 1},
18564 {&__pyx_n_s_DEL_START, __pyx_k_DEL_START, sizeof(__pyx_k_DEL_START), 0, 0, 1, 1},
18565 {&__pyx_n_s_Element, __pyx_k_Element, sizeof(__pyx_k_Element), 0, 0, 1, 1},
18566 {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
18567 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
18568 {&__pyx_n_s_InsensitiveSequenceMatcher, __pyx_k_InsensitiveSequenceMatcher, sizeof(__pyx_k_InsensitiveSequenceMatcher), 0, 0, 1, 1},
18569 {&__pyx_n_s_InsensitiveSequenceMatcher_get_m, __pyx_k_InsensitiveSequenceMatcher_get_m, sizeof(__pyx_k_InsensitiveSequenceMatcher_get_m), 0, 0, 1, 1},
18570 {&__pyx_kp_u_Link_s, __pyx_k_Link_s, sizeof(__pyx_k_Link_s), 0, 1, 0, 0},
18571 {&__pyx_n_s_NameError, __pyx_k_NameError, sizeof(__pyx_k_NameError), 0, 0, 1, 1},
18572 {&__pyx_n_s_NoDeletes, __pyx_k_NoDeletes, sizeof(__pyx_k_NoDeletes), 0, 0, 1, 1},
18573 {&__pyx_kp_s_Raised_when_the_document_no_lon, __pyx_k_Raised_when_the_document_no_lon, sizeof(__pyx_k_Raised_when_the_document_no_lon), 0, 0, 1, 0},
18574 {&__pyx_kp_s_Represents_a_diffable_token_gen, __pyx_k_Represents_a_diffable_token_gen, sizeof(__pyx_k_Represents_a_diffable_token_gen), 0, 0, 1, 0},
18575 {&__pyx_kp_s_Represents_a_token_that_is_actu, __pyx_k_Represents_a_token_that_is_actu, sizeof(__pyx_k_Represents_a_token_that_is_actu), 0, 0, 1, 0},
18576 {&__pyx_kp_s_Represents_the_href_in_an_ancho, __pyx_k_Represents_the_href_in_an_ancho, sizeof(__pyx_k_Represents_the_href_in_an_ancho), 0, 0, 1, 0},
18577 {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1},
18578 {&__pyx_kp_u_S_s, __pyx_k_S_s, sizeof(__pyx_k_S_s), 0, 1, 0, 0},
18579 {&__pyx_n_s_SequenceMatcher, __pyx_k_SequenceMatcher, sizeof(__pyx_k_SequenceMatcher), 0, 0, 1, 1},
18580 {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1},
18581 {&__pyx_kp_u_Unexpected_delete_tag_r, __pyx_k_Unexpected_delete_tag_r, sizeof(__pyx_k_Unexpected_delete_tag_r), 0, 1, 0, 0},
18582 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
18583 {&__pyx_kp_u_Weird_state_cur_word, __pyx_k_Weird_state_cur_word, sizeof(__pyx_k_Weird_state_cur_word), 0, 1, 0, 0},
18584 {&__pyx_kp_u_You_should_pass_in_an_element_no, __pyx_k_You_should_pass_in_an_element_no, sizeof(__pyx_k_You_should_pass_in_an_element_no), 0, 1, 0, 0},
18585 {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
18586 {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
18587 {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
18588 {&__pyx_kp_u__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 1, 0, 0},
18589 {&__pyx_kp_u__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 1, 0, 0},
18590 {&__pyx_kp_u__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0, 0},
18591 {&__pyx_kp_u__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 1, 0, 0},
18592 {&__pyx_kp_u__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 1, 0, 0},
18593 {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
18594 {&__pyx_kp_u__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 1, 0, 0},
18595 {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0},
18596 {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
18597 {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
18598 {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
18599 {&__pyx_n_u_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 1, 0, 1},
18600 {&__pyx_n_s_actual, __pyx_k_actual, sizeof(__pyx_k_actual), 0, 0, 1, 1},
18601 {&__pyx_n_u_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 1, 0, 1},
18602 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
18603 {&__pyx_n_s_annotation, __pyx_k_annotation, sizeof(__pyx_k_annotation), 0, 0, 1, 1},
18604 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
18605 {&__pyx_n_u_area, __pyx_k_area, sizeof(__pyx_k_area), 0, 1, 0, 1},
18606 {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
18607 {&__pyx_n_s_attrib, __pyx_k_attrib, sizeof(__pyx_k_attrib), 0, 0, 1, 1},
18608 {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
18609 {&__pyx_n_s_balanced, __pyx_k_balanced, sizeof(__pyx_k_balanced), 0, 0, 1, 1},
18610 {&__pyx_n_u_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 1, 0, 1},
18611 {&__pyx_n_u_basefont, __pyx_k_basefont, sizeof(__pyx_k_basefont), 0, 1, 0, 1},
18612 {&__pyx_n_s_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 0, 0, 1, 1},
18613 {&__pyx_n_s_block_level_container_tags, __pyx_k_block_level_container_tags, sizeof(__pyx_k_block_level_container_tags), 0, 0, 1, 1},
18614 {&__pyx_n_s_block_level_tags, __pyx_k_block_level_tags, sizeof(__pyx_k_block_level_tags), 0, 0, 1, 1},
18615 {&__pyx_n_u_blockquote, __pyx_k_blockquote, sizeof(__pyx_k_blockquote), 0, 1, 0, 1},
18616 {&__pyx_kp_u_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 1, 0, 0},
18617 {&__pyx_kp_u_body_2, __pyx_k_body_2, sizeof(__pyx_k_body_2), 0, 1, 0, 0},
18618 {&__pyx_n_s_body_el, __pyx_k_body_el, sizeof(__pyx_k_body_el), 0, 0, 1, 1},
18619 {&__pyx_n_s_body_re, __pyx_k_body_re, sizeof(__pyx_k_body_re), 0, 0, 1, 1},
18620 {&__pyx_n_u_br, __pyx_k_br, sizeof(__pyx_k_br), 0, 1, 0, 1},
18621 {&__pyx_n_u_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 1, 0, 1},
18622 {&__pyx_n_s_cgi, __pyx_k_cgi, sizeof(__pyx_k_cgi), 0, 0, 1, 1},
18623 {&__pyx_n_s_child, __pyx_k_child, sizeof(__pyx_k_child), 0, 0, 1, 1},
18624 {&__pyx_n_s_child_tag, __pyx_k_child_tag, sizeof(__pyx_k_child_tag), 0, 0, 1, 1},
18625 {&__pyx_n_s_children_tag, __pyx_k_children_tag, sizeof(__pyx_k_children_tag), 0, 0, 1, 1},
18626 {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1},
18627 {&__pyx_kp_u_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 1, 0, 0},
18628 {&__pyx_n_s_chunks_2, __pyx_k_chunks_2, sizeof(__pyx_k_chunks_2), 0, 0, 1, 1},
18629 {&__pyx_n_s_cleanup, __pyx_k_cleanup, sizeof(__pyx_k_cleanup), 0, 0, 1, 1},
18630 {&__pyx_n_s_cleanup_delete, __pyx_k_cleanup_delete, sizeof(__pyx_k_cleanup_delete), 0, 0, 1, 1},
18631 {&__pyx_n_s_cleanup_html, __pyx_k_cleanup_html, sizeof(__pyx_k_cleanup_html), 0, 0, 1, 1},
18632 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
18633 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
18634 {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
18635 {&__pyx_n_u_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 1, 0, 1},
18636 {&__pyx_n_s_command, __pyx_k_command, sizeof(__pyx_k_command), 0, 0, 1, 1},
18637 {&__pyx_n_s_commands, __pyx_k_commands, sizeof(__pyx_k_commands), 0, 0, 1, 1},
18638 {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
18639 {&__pyx_n_s_compress_merge_back, __pyx_k_compress_merge_back, sizeof(__pyx_k_compress_merge_back), 0, 0, 1, 1},
18640 {&__pyx_n_s_compress_tokens, __pyx_k_compress_tokens, sizeof(__pyx_k_compress_tokens), 0, 0, 1, 1},
18641 {&__pyx_n_s_contains_block_level_tag, __pyx_k_contains_block_level_tag, sizeof(__pyx_k_contains_block_level_tag), 0, 0, 1, 1},
18642 {&__pyx_n_s_copy_annotations, __pyx_k_copy_annotations, sizeof(__pyx_k_copy_annotations), 0, 0, 1, 1},
18643 {&__pyx_n_s_create_parent, __pyx_k_create_parent, sizeof(__pyx_k_create_parent), 0, 0, 1, 1},
18644 {&__pyx_n_s_cur_tokens, __pyx_k_cur_tokens, sizeof(__pyx_k_cur_tokens), 0, 0, 1, 1},
18645 {&__pyx_n_s_cur_word, __pyx_k_cur_word, sizeof(__pyx_k_cur_word), 0, 0, 1, 1},
18646 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
18647 {&__pyx_n_u_dd, __pyx_k_dd, sizeof(__pyx_k_dd), 0, 1, 0, 1},
18648 {&__pyx_n_s_default_markup, __pyx_k_default_markup, sizeof(__pyx_k_default_markup), 0, 0, 1, 1},
18649 {&__pyx_kp_u_del, __pyx_k_del, sizeof(__pyx_k_del), 0, 1, 0, 0},
18650 {&__pyx_kp_u_del_2, __pyx_k_del_2, sizeof(__pyx_k_del_2), 0, 1, 0, 0},
18651 {&__pyx_n_u_del_3, __pyx_k_del_3, sizeof(__pyx_k_del_3), 0, 1, 0, 1},
18652 {&__pyx_n_s_del_chunks, __pyx_k_del_chunks, sizeof(__pyx_k_del_chunks), 0, 0, 1, 1},
18653 {&__pyx_n_s_del_tokens, __pyx_k_del_tokens, sizeof(__pyx_k_del_tokens), 0, 0, 1, 1},
18654 {&__pyx_n_s_delete, __pyx_k_delete, sizeof(__pyx_k_delete), 0, 0, 1, 1},
18655 {&__pyx_n_u_delete, __pyx_k_delete, sizeof(__pyx_k_delete), 0, 1, 0, 1},
18656 {&__pyx_kp_u_descendant_or_self_s, __pyx_k_descendant_or_self_s, sizeof(__pyx_k_descendant_or_self_s), 0, 1, 0, 0},
18657 {&__pyx_n_s_dest, __pyx_k_dest, sizeof(__pyx_k_dest), 0, 0, 1, 1},
18658 {&__pyx_n_s_dest_tok, __pyx_k_dest_tok, sizeof(__pyx_k_dest_tok), 0, 0, 1, 1},
18659 {&__pyx_n_s_diffcommand, __pyx_k_diffcommand, sizeof(__pyx_k_diffcommand), 0, 0, 1, 1},
18660 {&__pyx_n_s_difflib, __pyx_k_difflib, sizeof(__pyx_k_difflib), 0, 0, 1, 1},
18661 {&__pyx_n_u_dir, __pyx_k_dir, sizeof(__pyx_k_dir), 0, 1, 0, 1},
18662 {&__pyx_n_u_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 1, 0, 1},
18663 {&__pyx_n_u_dl, __pyx_k_dl, sizeof(__pyx_k_dl), 0, 1, 0, 1},
18664 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
18665 {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1},
18666 {&__pyx_n_s_doclist, __pyx_k_doclist, sizeof(__pyx_k_doclist), 0, 0, 1, 1},
18667 {&__pyx_kp_u_doclist_should_be_ordered_from, __pyx_k_doclist_should_be_ordered_from, sizeof(__pyx_k_doclist_should_be_ordered_from), 0, 1, 0, 0},
18668 {&__pyx_n_s_drop_tag, __pyx_k_drop_tag, sizeof(__pyx_k_drop_tag), 0, 0, 1, 1},
18669 {&__pyx_n_u_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 1, 0, 1},
18670 {&__pyx_n_s_el, __pyx_k_el, sizeof(__pyx_k_el), 0, 0, 1, 1},
18671 {&__pyx_n_s_empty_tags, __pyx_k_empty_tags, sizeof(__pyx_k_empty_tags), 0, 0, 1, 1},
18672 {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
18673 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
18674 {&__pyx_n_s_end_body_re, __pyx_k_end_body_re, sizeof(__pyx_k_end_body_re), 0, 0, 1, 1},
18675 {&__pyx_n_s_end_tag, __pyx_k_end_tag, sizeof(__pyx_k_end_tag), 0, 0, 1, 1},
18676 {&__pyx_n_s_end_whitespace_re, __pyx_k_end_whitespace_re, sizeof(__pyx_k_end_whitespace_re), 0, 0, 1, 1},
18677 {&__pyx_n_s_end_words, __pyx_k_end_words, sizeof(__pyx_k_end_words), 0, 0, 1, 1},
18678 {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
18679 {&__pyx_n_s_endtag, __pyx_k_endtag, sizeof(__pyx_k_endtag), 0, 0, 1, 1},
18680 {&__pyx_n_s_eq_new, __pyx_k_eq_new, sizeof(__pyx_k_eq_new), 0, 0, 1, 1},
18681 {&__pyx_n_s_eq_old, __pyx_k_eq_old, sizeof(__pyx_k_eq_old), 0, 0, 1, 1},
18682 {&__pyx_n_s_equal, __pyx_k_equal, sizeof(__pyx_k_equal), 0, 0, 1, 1},
18683 {&__pyx_n_u_equal, __pyx_k_equal, sizeof(__pyx_k_equal), 0, 1, 0, 1},
18684 {&__pyx_n_s_escape, __pyx_k_escape, sizeof(__pyx_k_escape), 0, 0, 1, 1},
18685 {&__pyx_n_s_etree, __pyx_k_etree, sizeof(__pyx_k_etree), 0, 0, 1, 1},
18686 {&__pyx_n_s_expand_tokens, __pyx_k_expand_tokens, sizeof(__pyx_k_expand_tokens), 0, 0, 1, 1},
18687 {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
18688 {&__pyx_n_s_extra, __pyx_k_extra, sizeof(__pyx_k_extra), 0, 0, 1, 1},
18689 {&__pyx_n_u_fieldset, __pyx_k_fieldset, sizeof(__pyx_k_fieldset), 0, 1, 0, 1},
18690 {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
18691 {&__pyx_n_s_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 0, 0, 1, 1},
18692 {&__pyx_n_s_finding, __pyx_k_finding, sizeof(__pyx_k_finding), 0, 0, 1, 1},
18693 {&__pyx_n_s_finding_name, __pyx_k_finding_name, sizeof(__pyx_k_finding_name), 0, 0, 1, 1},
18694 {&__pyx_n_s_fixup_chunks, __pyx_k_fixup_chunks, sizeof(__pyx_k_fixup_chunks), 0, 0, 1, 1},
18695 {&__pyx_n_s_fixup_ins_del_tags, __pyx_k_fixup_ins_del_tags, sizeof(__pyx_k_fixup_ins_del_tags), 0, 0, 1, 1},
18696 {&__pyx_n_s_fixup_ins_del_tags_2, __pyx_k_fixup_ins_del_tags_2, sizeof(__pyx_k_fixup_ins_del_tags_2), 0, 0, 1, 1},
18697 {&__pyx_n_s_flatten_el, __pyx_k_flatten_el, sizeof(__pyx_k_flatten_el), 0, 0, 1, 1},
18698 {&__pyx_n_u_form, __pyx_k_form, sizeof(__pyx_k_form), 0, 1, 0, 1},
18699 {&__pyx_n_s_fragment_fromstring, __pyx_k_fragment_fromstring, sizeof(__pyx_k_fragment_fromstring), 0, 0, 1, 1},
18700 {&__pyx_n_u_frameset, __pyx_k_frameset, sizeof(__pyx_k_frameset), 0, 1, 0, 1},
18701 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
18702 {&__pyx_n_s_get_matching_blocks, __pyx_k_get_matching_blocks, sizeof(__pyx_k_get_matching_blocks), 0, 0, 1, 1},
18703 {&__pyx_n_s_get_opcodes, __pyx_k_get_opcodes, sizeof(__pyx_k_get_opcodes), 0, 0, 1, 1},
18704 {&__pyx_n_s_getchildren, __pyx_k_getchildren, sizeof(__pyx_k_getchildren), 0, 0, 1, 1},
18705 {&__pyx_n_s_getparent, __pyx_k_getparent, sizeof(__pyx_k_getparent), 0, 0, 1, 1},
18706 {&__pyx_n_u_h1, __pyx_k_h1, sizeof(__pyx_k_h1), 0, 1, 0, 1},
18707 {&__pyx_n_u_h2, __pyx_k_h2, sizeof(__pyx_k_h2), 0, 1, 0, 1},
18708 {&__pyx_n_u_h3, __pyx_k_h3, sizeof(__pyx_k_h3), 0, 1, 0, 1},
18709 {&__pyx_n_u_h4, __pyx_k_h4, sizeof(__pyx_k_h4), 0, 1, 0, 1},
18710 {&__pyx_n_u_h5, __pyx_k_h5, sizeof(__pyx_k_h5), 0, 1, 0, 1},
18711 {&__pyx_n_u_h6, __pyx_k_h6, sizeof(__pyx_k_h6), 0, 1, 0, 1},
18712 {&__pyx_n_s_hide_when_equal, __pyx_k_hide_when_equal, sizeof(__pyx_k_hide_when_equal), 0, 0, 1, 1},
18713 {&__pyx_n_u_hr, __pyx_k_hr, sizeof(__pyx_k_hr), 0, 1, 0, 1},
18714 {&__pyx_n_s_href, __pyx_k_href, sizeof(__pyx_k_href), 0, 0, 1, 1},
18715 {&__pyx_n_u_href, __pyx_k_href, sizeof(__pyx_k_href), 0, 1, 0, 1},
18716 {&__pyx_n_s_href_token, __pyx_k_href_token, sizeof(__pyx_k_href_token), 0, 0, 1, 1},
18717 {&__pyx_n_s_href_token_html, __pyx_k_href_token_html, sizeof(__pyx_k_href_token_html), 0, 0, 1, 1},
18718 {&__pyx_n_s_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 0, 1, 1},
18719 {&__pyx_n_u_html, __pyx_k_html, sizeof(__pyx_k_html), 0, 1, 0, 1},
18720 {&__pyx_n_s_html1_tokens, __pyx_k_html1_tokens, sizeof(__pyx_k_html1_tokens), 0, 0, 1, 1},
18721 {&__pyx_n_s_html2_tokens, __pyx_k_html2_tokens, sizeof(__pyx_k_html2_tokens), 0, 0, 1, 1},
18722 {&__pyx_n_s_html_annotate, __pyx_k_html_annotate, sizeof(__pyx_k_html_annotate), 0, 0, 1, 1},
18723 {&__pyx_n_u_html_annotate, __pyx_k_html_annotate, sizeof(__pyx_k_html_annotate), 0, 1, 0, 1},
18724 {&__pyx_kp_u_html_annotate_line_35, __pyx_k_html_annotate_line_35, sizeof(__pyx_k_html_annotate_line_35), 0, 1, 0, 0},
18725 {&__pyx_n_s_html_annotate_merge_annotations, __pyx_k_html_annotate_merge_annotations, sizeof(__pyx_k_html_annotate_merge_annotations), 0, 0, 1, 1},
18726 {&__pyx_n_s_html_escape, __pyx_k_html_escape, sizeof(__pyx_k_html_escape), 0, 0, 1, 1},
18727 {&__pyx_n_s_html_repr, __pyx_k_html_repr, sizeof(__pyx_k_html_repr), 0, 0, 1, 1},
18728 {&__pyx_kp_u_html_repr_2, __pyx_k_html_repr_2, sizeof(__pyx_k_html_repr_2), 0, 1, 0, 0},
18729 {&__pyx_n_s_htmldiff, __pyx_k_htmldiff, sizeof(__pyx_k_htmldiff), 0, 0, 1, 1},
18730 {&__pyx_n_u_htmldiff, __pyx_k_htmldiff, sizeof(__pyx_k_htmldiff), 0, 1, 0, 1},
18731 {&__pyx_n_s_htmldiff_tokens, __pyx_k_htmldiff_tokens, sizeof(__pyx_k_htmldiff_tokens), 0, 0, 1, 1},
18732 {&__pyx_n_s_i1, __pyx_k_i1, sizeof(__pyx_k_i1), 0, 0, 1, 1},
18733 {&__pyx_n_s_i2, __pyx_k_i2, sizeof(__pyx_k_i2), 0, 0, 1, 1},
18734 {&__pyx_n_u_img, __pyx_k_img, sizeof(__pyx_k_img), 0, 1, 0, 1},
18735 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
18736 {&__pyx_n_s_include_hrefs, __pyx_k_include_hrefs, sizeof(__pyx_k_include_hrefs), 0, 0, 1, 1},
18737 {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
18738 {&__pyx_n_u_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 1, 0, 1},
18739 {&__pyx_kp_u_ins, __pyx_k_ins, sizeof(__pyx_k_ins), 0, 1, 0, 0},
18740 {&__pyx_kp_u_ins_2, __pyx_k_ins_2, sizeof(__pyx_k_ins_2), 0, 1, 0, 0},
18741 {&__pyx_n_u_ins_3, __pyx_k_ins_3, sizeof(__pyx_k_ins_3), 0, 1, 0, 1},
18742 {&__pyx_n_s_ins_chunks, __pyx_k_ins_chunks, sizeof(__pyx_k_ins_chunks), 0, 0, 1, 1},
18743 {&__pyx_kp_u_ins_del, __pyx_k_ins_del, sizeof(__pyx_k_ins_del), 0, 1, 0, 0},
18744 {&__pyx_n_s_ins_del_re, __pyx_k_ins_del_re, sizeof(__pyx_k_ins_del_re), 0, 0, 1, 1},
18745 {&__pyx_n_s_ins_tokens, __pyx_k_ins_tokens, sizeof(__pyx_k_ins_tokens), 0, 0, 1, 1},
18746 {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
18747 {&__pyx_n_u_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 1, 0, 1},
18748 {&__pyx_n_s_is_end_tag, __pyx_k_is_end_tag, sizeof(__pyx_k_is_end_tag), 0, 0, 1, 1},
18749 {&__pyx_n_s_is_start_tag, __pyx_k_is_start_tag, sizeof(__pyx_k_is_start_tag), 0, 0, 1, 1},
18750 {&__pyx_n_s_is_word, __pyx_k_is_word, sizeof(__pyx_k_is_word), 0, 0, 1, 1},
18751 {&__pyx_n_s_iselement, __pyx_k_iselement, sizeof(__pyx_k_iselement), 0, 0, 1, 1},
18752 {&__pyx_n_u_isindex, __pyx_k_isindex, sizeof(__pyx_k_isindex), 0, 1, 0, 1},
18753 {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1},
18754 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
18755 {&__pyx_n_s_j1, __pyx_k_j1, sizeof(__pyx_k_j1), 0, 0, 1, 1},
18756 {&__pyx_n_s_j2, __pyx_k_j2, sizeof(__pyx_k_j2), 0, 0, 1, 1},
18757 {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
18758 {&__pyx_n_u_li, __pyx_k_li, sizeof(__pyx_k_li), 0, 1, 0, 1},
18759 {&__pyx_n_u_link, __pyx_k_link, sizeof(__pyx_k_link), 0, 1, 0, 1},
18760 {&__pyx_n_s_locate_unbalanced_end, __pyx_k_locate_unbalanced_end, sizeof(__pyx_k_locate_unbalanced_end), 0, 0, 1, 1},
18761 {&__pyx_n_s_locate_unbalanced_start, __pyx_k_locate_unbalanced_start, sizeof(__pyx_k_locate_unbalanced_start), 0, 0, 1, 1},
18762 {&__pyx_kp_u_locate_unbalanced_start_line_365, __pyx_k_locate_unbalanced_start_line_365, sizeof(__pyx_k_locate_unbalanced_start_line_365), 0, 1, 0, 0},
18763 {&__pyx_n_s_lxml, __pyx_k_lxml, sizeof(__pyx_k_lxml), 0, 0, 1, 1},
18764 {&__pyx_n_s_lxml_html, __pyx_k_lxml_html, sizeof(__pyx_k_lxml_html), 0, 0, 1, 1},
18765 {&__pyx_n_s_lxml_html_diff, __pyx_k_lxml_html_diff, sizeof(__pyx_k_lxml_html_diff), 0, 0, 1, 1},
18766 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
18767 {&__pyx_n_u_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 1, 0, 1},
18768 {&__pyx_n_s_main_2, __pyx_k_main_2, sizeof(__pyx_k_main_2), 0, 0, 1, 1},
18769 {&__pyx_n_s_markup, __pyx_k_markup, sizeof(__pyx_k_markup), 0, 0, 1, 1},
18770 {&__pyx_n_s_markup_func, __pyx_k_markup_func, sizeof(__pyx_k_markup_func), 0, 0, 1, 1},
18771 {&__pyx_n_s_markup_serialize_tokens, __pyx_k_markup_serialize_tokens, sizeof(__pyx_k_markup_serialize_tokens), 0, 0, 1, 1},
18772 {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
18773 {&__pyx_n_u_menu, __pyx_k_menu, sizeof(__pyx_k_menu), 0, 1, 0, 1},
18774 {&__pyx_n_s_merge_delete, __pyx_k_merge_delete, sizeof(__pyx_k_merge_delete), 0, 0, 1, 1},
18775 {&__pyx_n_s_merge_element_contents, __pyx_k_merge_element_contents, sizeof(__pyx_k_merge_element_contents), 0, 0, 1, 1},
18776 {&__pyx_n_s_merge_insert, __pyx_k_merge_insert, sizeof(__pyx_k_merge_insert), 0, 0, 1, 1},
18777 {&__pyx_n_s_merged, __pyx_k_merged, sizeof(__pyx_k_merged), 0, 0, 1, 1},
18778 {&__pyx_n_u_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 1, 0, 1},
18779 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
18780 {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
18781 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
18782 {&__pyx_n_s_move_el_inside_block, __pyx_k_move_el_inside_block, sizeof(__pyx_k_move_el_inside_block), 0, 0, 1, 1},
18783 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
18784 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
18785 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
18786 {&__pyx_n_s_new_html, __pyx_k_new_html, sizeof(__pyx_k_new_html), 0, 0, 1, 1},
18787 {&__pyx_n_s_new_html_tokens, __pyx_k_new_html_tokens, sizeof(__pyx_k_new_html_tokens), 0, 0, 1, 1},
18788 {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
18789 {&__pyx_n_u_noframes, __pyx_k_noframes, sizeof(__pyx_k_noframes), 0, 1, 0, 1},
18790 {&__pyx_n_u_noscript, __pyx_k_noscript, sizeof(__pyx_k_noscript), 0, 1, 0, 1},
18791 {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
18792 {&__pyx_kp_u_of, __pyx_k_of, sizeof(__pyx_k_of), 0, 1, 0, 0},
18793 {&__pyx_n_u_ol, __pyx_k_ol, sizeof(__pyx_k_ol), 0, 1, 0, 1},
18794 {&__pyx_n_s_old_html, __pyx_k_old_html, sizeof(__pyx_k_old_html), 0, 0, 1, 1},
18795 {&__pyx_n_s_old_html_tokens, __pyx_k_old_html_tokens, sizeof(__pyx_k_old_html_tokens), 0, 0, 1, 1},
18796 {&__pyx_n_u_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 1, 0, 1},
18797 {&__pyx_n_u_param, __pyx_k_param, sizeof(__pyx_k_param), 0, 1, 0, 1},
18798 {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
18799 {&__pyx_n_s_parse_html, __pyx_k_parse_html, sizeof(__pyx_k_parse_html), 0, 0, 1, 1},
18800 {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
18801 {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
18802 {&__pyx_n_s_pos2, __pyx_k_pos2, sizeof(__pyx_k_pos2), 0, 0, 1, 1},
18803 {&__pyx_n_s_post, __pyx_k_post, sizeof(__pyx_k_post), 0, 0, 1, 1},
18804 {&__pyx_n_s_post_delete, __pyx_k_post_delete, sizeof(__pyx_k_post_delete), 0, 0, 1, 1},
18805 {&__pyx_n_s_post_tags, __pyx_k_post_tags, sizeof(__pyx_k_post_tags), 0, 0, 1, 1},
18806 {&__pyx_kp_u_post_tags_2, __pyx_k_post_tags_2, sizeof(__pyx_k_post_tags_2), 0, 1, 0, 0},
18807 {&__pyx_n_s_pre, __pyx_k_pre, sizeof(__pyx_k_pre), 0, 0, 1, 1},
18808 {&__pyx_n_u_pre, __pyx_k_pre, sizeof(__pyx_k_pre), 0, 1, 0, 1},
18809 {&__pyx_n_s_pre_delete, __pyx_k_pre_delete, sizeof(__pyx_k_pre_delete), 0, 0, 1, 1},
18810 {&__pyx_kp_u_pre_delete_and_post_delete_impl, __pyx_k_pre_delete_and_post_delete_impl, sizeof(__pyx_k_pre_delete_and_post_delete_impl), 0, 1, 0, 0},
18811 {&__pyx_n_s_pre_tags, __pyx_k_pre_tags, sizeof(__pyx_k_pre_tags), 0, 0, 1, 1},
18812 {&__pyx_kp_u_pre_tags_2, __pyx_k_pre_tags_2, sizeof(__pyx_k_pre_tags_2), 0, 1, 0, 0},
18813 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
18814 {&__pyx_n_s_previous, __pyx_k_previous, sizeof(__pyx_k_previous), 0, 0, 1, 1},
18815 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
18816 {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
18817 {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
18818 {&__pyx_n_u_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 1, 0, 1},
18819 {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
18820 {&__pyx_kp_u_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 1, 0, 0},
18821 {&__pyx_n_s_result_2, __pyx_k_result_2, sizeof(__pyx_k_result_2), 0, 0, 1, 1},
18822 {&__pyx_n_s_rfind, __pyx_k_rfind, sizeof(__pyx_k_rfind), 0, 0, 1, 1},
18823 {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1},
18824 {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
18825 {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
18826 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
18827 {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
18828 {&__pyx_n_s_serialize_html_fragment, __pyx_k_serialize_html_fragment, sizeof(__pyx_k_serialize_html_fragment), 0, 0, 1, 1},
18829 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
18830 {&__pyx_n_s_skip_outer, __pyx_k_skip_outer, sizeof(__pyx_k_skip_outer), 0, 0, 1, 1},
18831 {&__pyx_n_s_skip_tag, __pyx_k_skip_tag, sizeof(__pyx_k_skip_tag), 0, 0, 1, 1},
18832 {&__pyx_kp_u_span, __pyx_k_span, sizeof(__pyx_k_span), 0, 1, 0, 0},
18833 {&__pyx_kp_u_span_title, __pyx_k_span_title, sizeof(__pyx_k_span_title), 0, 1, 0, 0},
18834 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
18835 {&__pyx_n_s_split_delete, __pyx_k_split_delete, sizeof(__pyx_k_split_delete), 0, 0, 1, 1},
18836 {&__pyx_n_s_split_trailing_whitespace, __pyx_k_split_trailing_whitespace, sizeof(__pyx_k_split_trailing_whitespace), 0, 0, 1, 1},
18837 {&__pyx_n_s_split_unbalanced, __pyx_k_split_unbalanced, sizeof(__pyx_k_split_unbalanced), 0, 0, 1, 1},
18838 {&__pyx_n_s_split_words, __pyx_k_split_words, sizeof(__pyx_k_split_words), 0, 0, 1, 1},
18839 {&__pyx_n_s_split_words_re, __pyx_k_split_words_re, sizeof(__pyx_k_split_words_re), 0, 0, 1, 1},
18840 {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1},
18841 {&__pyx_n_u_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 1, 0, 1},
18842 {&__pyx_kp_s_src_lxml_html_diff_py, __pyx_k_src_lxml_html_diff_py, sizeof(__pyx_k_src_lxml_html_diff_py), 0, 0, 1, 0},
18843 {&__pyx_n_s_src_tok, __pyx_k_src_tok, sizeof(__pyx_k_src_tok), 0, 0, 1, 1},
18844 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
18845 {&__pyx_n_s_start_tag, __pyx_k_start_tag, sizeof(__pyx_k_start_tag), 0, 0, 1, 1},
18846 {&__pyx_n_s_start_whitespace_re, __pyx_k_start_whitespace_re, sizeof(__pyx_k_start_whitespace_re), 0, 0, 1, 1},
18847 {&__pyx_n_s_start_words, __pyx_k_start_words, sizeof(__pyx_k_start_words), 0, 0, 1, 1},
18848 {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
18849 {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
18850 {&__pyx_n_s_stripped_length, __pyx_k_stripped_length, sizeof(__pyx_k_stripped_length), 0, 0, 1, 1},
18851 {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1},
18852 {&__pyx_kp_u_t_n_r, __pyx_k_t_n_r, sizeof(__pyx_k_t_n_r), 0, 1, 0, 0},
18853 {&__pyx_kp_u_t_n_r_2, __pyx_k_t_n_r_2, sizeof(__pyx_k_t_n_r_2), 0, 1, 0, 0},
18854 {&__pyx_n_u_table, __pyx_k_table, sizeof(__pyx_k_table), 0, 1, 0, 1},
18855 {&__pyx_n_s_tag, __pyx_k_tag, sizeof(__pyx_k_tag), 0, 0, 1, 1},
18856 {&__pyx_n_s_tag_accum, __pyx_k_tag_accum, sizeof(__pyx_k_tag_accum), 0, 0, 1, 1},
18857 {&__pyx_n_s_tag_stack, __pyx_k_tag_stack, sizeof(__pyx_k_tag_stack), 0, 0, 1, 1},
18858 {&__pyx_kp_u_tag_token, __pyx_k_tag_token, sizeof(__pyx_k_tag_token), 0, 1, 0, 0},
18859 {&__pyx_n_s_tag_token_2, __pyx_k_tag_token_2, sizeof(__pyx_k_tag_token_2), 0, 0, 1, 1},
18860 {&__pyx_n_s_tag_token___new, __pyx_k_tag_token___new, sizeof(__pyx_k_tag_token___new), 0, 0, 1, 1},
18861 {&__pyx_n_s_tag_token___repr, __pyx_k_tag_token___repr, sizeof(__pyx_k_tag_token___repr), 0, 0, 1, 1},
18862 {&__pyx_n_s_tag_token_html, __pyx_k_tag_token_html, sizeof(__pyx_k_tag_token_html), 0, 0, 1, 1},
18863 {&__pyx_n_s_tail, __pyx_k_tail, sizeof(__pyx_k_tail), 0, 0, 1, 1},
18864 {&__pyx_n_s_tail_tag, __pyx_k_tail_tag, sizeof(__pyx_k_tail_tag), 0, 0, 1, 1},
18865 {&__pyx_n_u_tbody, __pyx_k_tbody, sizeof(__pyx_k_tbody), 0, 1, 0, 1},
18866 {&__pyx_n_u_td, __pyx_k_td, sizeof(__pyx_k_td), 0, 1, 0, 1},
18867 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
18868 {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
18869 {&__pyx_n_s_text_tag, __pyx_k_text_tag, sizeof(__pyx_k_text_tag), 0, 0, 1, 1},
18870 {&__pyx_n_u_tfoot, __pyx_k_tfoot, sizeof(__pyx_k_tfoot), 0, 1, 0, 1},
18871 {&__pyx_n_u_th, __pyx_k_th, sizeof(__pyx_k_th), 0, 1, 0, 1},
18872 {&__pyx_n_u_thead, __pyx_k_thead, sizeof(__pyx_k_thead), 0, 1, 0, 1},
18873 {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1},
18874 {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
18875 {&__pyx_n_s_tok, __pyx_k_tok, sizeof(__pyx_k_tok), 0, 0, 1, 1},
18876 {&__pyx_n_s_token, __pyx_k_token, sizeof(__pyx_k_token), 0, 0, 1, 1},
18877 {&__pyx_kp_u_token_2, __pyx_k_token_2, sizeof(__pyx_k_token_2), 0, 1, 0, 0},
18878 {&__pyx_n_s_token___new, __pyx_k_token___new, sizeof(__pyx_k_token___new), 0, 0, 1, 1},
18879 {&__pyx_n_s_token___repr, __pyx_k_token___repr, sizeof(__pyx_k_token___repr), 0, 0, 1, 1},
18880 {&__pyx_n_s_token_html, __pyx_k_token_html, sizeof(__pyx_k_token_html), 0, 0, 1, 1},
18881 {&__pyx_n_s_tokenize, __pyx_k_tokenize, sizeof(__pyx_k_tokenize), 0, 0, 1, 1},
18882 {&__pyx_n_s_tokenize_annotated, __pyx_k_tokenize_annotated, sizeof(__pyx_k_tokenize_annotated), 0, 0, 1, 1},
18883 {&__pyx_n_s_tokenlist, __pyx_k_tokenlist, sizeof(__pyx_k_tokenlist), 0, 0, 1, 1},
18884 {&__pyx_n_s_tokens, __pyx_k_tokens, sizeof(__pyx_k_tokens), 0, 0, 1, 1},
18885 {&__pyx_n_s_tokens_new, __pyx_k_tokens_new, sizeof(__pyx_k_tokens_new), 0, 0, 1, 1},
18886 {&__pyx_n_s_tokens_old, __pyx_k_tokens_old, sizeof(__pyx_k_tokens_old), 0, 0, 1, 1},
18887 {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
18888 {&__pyx_n_u_tr, __pyx_k_tr, sizeof(__pyx_k_tr), 0, 1, 0, 1},
18889 {&__pyx_n_s_trailing_whitespace, __pyx_k_trailing_whitespace, sizeof(__pyx_k_trailing_whitespace), 0, 0, 1, 1},
18890 {&__pyx_kp_u_trailing_whitespace_2, __pyx_k_trailing_whitespace_2, sizeof(__pyx_k_trailing_whitespace_2), 0, 1, 0, 0},
18891 {&__pyx_n_u_ul, __pyx_k_ul, sizeof(__pyx_k_ul), 0, 1, 0, 1},
18892 {&__pyx_n_s_unbalanced_end, __pyx_k_unbalanced_end, sizeof(__pyx_k_unbalanced_end), 0, 0, 1, 1},
18893 {&__pyx_n_s_unbalanced_start, __pyx_k_unbalanced_start, sizeof(__pyx_k_unbalanced_start), 0, 0, 1, 1},
18894 {&__pyx_n_s_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 0, 1, 1},
18895 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
18896 {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
18897 {&__pyx_n_s_word, __pyx_k_word, sizeof(__pyx_k_word), 0, 0, 1, 1},
18898 {&__pyx_n_s_words, __pyx_k_words, sizeof(__pyx_k_words), 0, 0, 1, 1},
18899 {&__pyx_n_s_xpath, __pyx_k_xpath, sizeof(__pyx_k_xpath), 0, 0, 1, 1},
18900 {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
18901 {0, 0, 0, 0, 0, 0, 0}
18903 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
18904 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 14, __pyx_L1_error)
18905 __pyx_builtin_NameError = __Pyx_GetBuiltinName(__pyx_n_s_NameError); if (!__pyx_builtin_NameError) __PYX_ERR(0, 18, __pyx_L1_error)
18906 __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 101, __pyx_L1_error)
18907 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 360, __pyx_L1_error)
18913 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
18914 __Pyx_RefNannyDeclarations
18915 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
18917 /* "lxml/html/diff.py":110
18919 * result = [tokens[0]]
18920 * for tok in tokens[1:]: # <<<<<<<<<<<<<<
18921 * if (not result[-1].post_tags and
18922 * not tok.pre_tags and
18924 __pyx_slice__3 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 110, __pyx_L1_error)
18925 __Pyx_GOTREF(__pyx_slice__3);
18926 __Pyx_GIVEREF(__pyx_slice__3);
18928 /* "lxml/html/diff.py":249
18929 * if balanced and balanced[-1].endswith(' '):
18930 * # We move space outside of </ins>
18931 * balanced[-1] = balanced[-1][:-1] # <<<<<<<<<<<<<<
18932 * doc.extend(balanced)
18933 * doc.append('</ins> ')
18935 __pyx_slice__7 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 249, __pyx_L1_error)
18936 __Pyx_GOTREF(__pyx_slice__7);
18937 __Pyx_GIVEREF(__pyx_slice__7);
18939 /* "lxml/html/diff.py":631
18942 * return [token('', pre_tags=tag_accum)] # <<<<<<<<<<<<<<
18944 * result[-1].post_tags.extend(tag_accum)
18946 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 631, __pyx_L1_error)
18947 __Pyx_GOTREF(__pyx_tuple__16);
18948 __Pyx_GIVEREF(__pyx_tuple__16);
18950 /* "lxml/html/diff.py":781
18951 * """fixup_ins_del_tags that works on an lxml document in-place
18953 * for tag in ['ins', 'del']: # <<<<<<<<<<<<<<
18954 * for el in doc.xpath('descendant-or-self::%s' % tag):
18955 * if not _contains_block_level_tag(el):
18957 __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_u_ins_3, __pyx_n_u_del_3); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 781, __pyx_L1_error)
18958 __Pyx_GOTREF(__pyx_tuple__21);
18959 __Pyx_GIVEREF(__pyx_tuple__21);
18961 /* "lxml/html/diff.py":811
18963 * children_tag.extend(list(el))
18964 * el[:] = [children_tag] # <<<<<<<<<<<<<<
18966 * for child in list(el):
18968 __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(0, 811, __pyx_L1_error)
18969 __Pyx_GOTREF(__pyx_slice__22);
18970 __Pyx_GIVEREF(__pyx_slice__22);
18972 /* "lxml/html/diff.py":31
18973 * ############################################################
18975 * def default_markup(text, version): # <<<<<<<<<<<<<<
18976 * return '<span title="%s">%s</span>' % (
18977 * html_escape(_unicode(version), 1), text)
18979 __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_text, __pyx_n_s_version); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 31, __pyx_L1_error)
18980 __Pyx_GOTREF(__pyx_tuple__23);
18981 __Pyx_GIVEREF(__pyx_tuple__23);
18982 __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_default_markup, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 31, __pyx_L1_error)
18984 /* "lxml/html/diff.py":35
18985 * html_escape(_unicode(version), 1), text)
18987 * def html_annotate(doclist, markup=default_markup): # <<<<<<<<<<<<<<
18989 * doclist should be ordered from oldest to newest, like::
18991 __pyx_tuple__25 = PyTuple_Pack(8, __pyx_n_s_doclist, __pyx_n_s_markup, __pyx_n_s_tokenlist, __pyx_n_s_cur_tokens, __pyx_n_s_tokens, __pyx_n_s_result_2, __pyx_n_s_doc, __pyx_n_s_version); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 35, __pyx_L1_error)
18992 __Pyx_GOTREF(__pyx_tuple__25);
18993 __Pyx_GIVEREF(__pyx_tuple__25);
18994 __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_html_annotate, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 35, __pyx_L1_error)
18996 /* "lxml/html/diff.py":75
18997 * return ''.join(result).strip()
18999 * def tokenize_annotated(doc, annotation): # <<<<<<<<<<<<<<
19000 * """Tokenize a document and add an annotation attribute to each token
19003 __pyx_tuple__27 = PyTuple_Pack(4, __pyx_n_s_doc, __pyx_n_s_annotation, __pyx_n_s_tokens, __pyx_n_s_tok); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 75, __pyx_L1_error)
19004 __Pyx_GOTREF(__pyx_tuple__27);
19005 __Pyx_GIVEREF(__pyx_tuple__27);
19006 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_tokenize_annotated, 75, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 75, __pyx_L1_error)
19008 /* "lxml/html/diff.py":83
19011 * def html_annotate_merge_annotations(tokens_old, tokens_new): # <<<<<<<<<<<<<<
19012 * """Merge the annotations from tokens_old into tokens_new, when the
19013 * tokens in the new document already existed in the old document.
19015 __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_tokens_old, __pyx_n_s_tokens_new, __pyx_n_s_s, __pyx_n_s_commands, __pyx_n_s_command, __pyx_n_s_i1, __pyx_n_s_i2, __pyx_n_s_j1, __pyx_n_s_j2, __pyx_n_s_eq_old, __pyx_n_s_eq_new); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 83, __pyx_L1_error)
19016 __Pyx_GOTREF(__pyx_tuple__29);
19017 __Pyx_GIVEREF(__pyx_tuple__29);
19018 __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_html_annotate_merge_annotations, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 83, __pyx_L1_error)
19020 /* "lxml/html/diff.py":96
19021 * copy_annotations(eq_old, eq_new)
19023 * def copy_annotations(src, dest): # <<<<<<<<<<<<<<
19025 * Copy annotations from the tokens listed in src to the tokens in dest
19027 __pyx_tuple__31 = PyTuple_Pack(4, __pyx_n_s_src, __pyx_n_s_dest, __pyx_n_s_src_tok, __pyx_n_s_dest_tok); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 96, __pyx_L1_error)
19028 __Pyx_GOTREF(__pyx_tuple__31);
19029 __Pyx_GIVEREF(__pyx_tuple__31);
19030 __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_copy_annotations, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 96, __pyx_L1_error)
19032 /* "lxml/html/diff.py":104
19033 * dest_tok.annotation = src_tok.annotation
19035 * def compress_tokens(tokens): # <<<<<<<<<<<<<<
19037 * Combine adjacent tokens when there is no HTML between the tokens,
19039 __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_tokens, __pyx_n_s_result_2, __pyx_n_s_tok); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 104, __pyx_L1_error)
19040 __Pyx_GOTREF(__pyx_tuple__33);
19041 __Pyx_GIVEREF(__pyx_tuple__33);
19042 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_compress_tokens, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 104, __pyx_L1_error)
19044 /* "lxml/html/diff.py":119
19047 * def compress_merge_back(tokens, tok): # <<<<<<<<<<<<<<
19048 * """ Merge tok into the last element of tokens (modifying the list of
19049 * tokens in-place). """
19051 __pyx_tuple__35 = PyTuple_Pack(5, __pyx_n_s_tokens, __pyx_n_s_tok, __pyx_n_s_last, __pyx_n_s_text, __pyx_n_s_merged); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 119, __pyx_L1_error)
19052 __Pyx_GOTREF(__pyx_tuple__35);
19053 __Pyx_GIVEREF(__pyx_tuple__35);
19054 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_compress_merge_back, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 119, __pyx_L1_error)
19056 /* "lxml/html/diff.py":137
19057 * tokens[-1] = merged
19059 * def markup_serialize_tokens(tokens, markup_func): # <<<<<<<<<<<<<<
19061 * Serialize the list of tokens into a list of text chunks, calling
19063 __pyx_tuple__37 = PyTuple_Pack(6, __pyx_n_s_tokens, __pyx_n_s_markup_func, __pyx_n_s_token, __pyx_n_s_pre, __pyx_n_s_html, __pyx_n_s_post); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 137, __pyx_L1_error)
19064 __Pyx_GOTREF(__pyx_tuple__37);
19065 __Pyx_GIVEREF(__pyx_tuple__37);
19066 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_markup_serialize_tokens, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 137, __pyx_L1_error)
19068 /* "lxml/html/diff.py":158
19069 * ############################################################
19071 * def htmldiff(old_html, new_html): # <<<<<<<<<<<<<<
19072 * ## FIXME: this should take parsed documents too, and use their body
19073 * ## or other content.
19075 __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_old_html, __pyx_n_s_new_html, __pyx_n_s_old_html_tokens, __pyx_n_s_new_html_tokens, __pyx_n_s_result_2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 158, __pyx_L1_error)
19076 __Pyx_GOTREF(__pyx_tuple__38);
19077 __Pyx_GIVEREF(__pyx_tuple__38);
19078 __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_htmldiff, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 158, __pyx_L1_error)
19080 /* "lxml/html/diff.py":181
19081 * return fixup_ins_del_tags(result)
19083 * def htmldiff_tokens(html1_tokens, html2_tokens): # <<<<<<<<<<<<<<
19084 * """ Does a diff on the tokens themselves, returning a list of text
19085 * chunks (not tokens).
19087 __pyx_tuple__40 = PyTuple_Pack(12, __pyx_n_s_html1_tokens, __pyx_n_s_html2_tokens, __pyx_n_s_s, __pyx_n_s_commands, __pyx_n_s_result_2, __pyx_n_s_command, __pyx_n_s_i1, __pyx_n_s_i2, __pyx_n_s_j1, __pyx_n_s_j2, __pyx_n_s_ins_tokens, __pyx_n_s_del_tokens); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 181, __pyx_L1_error)
19088 __Pyx_GOTREF(__pyx_tuple__40);
19089 __Pyx_GIVEREF(__pyx_tuple__40);
19090 __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_htmldiff_tokens, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 181, __pyx_L1_error)
19092 /* "lxml/html/diff.py":219
19095 * def expand_tokens(tokens, equal=False): # <<<<<<<<<<<<<<
19096 * """Given a list of tokens, return a generator of the chunks of
19097 * text for the data in the tokens.
19099 __pyx_tuple__42 = PyTuple_Pack(5, __pyx_n_s_tokens, __pyx_n_s_equal, __pyx_n_s_token, __pyx_n_s_pre, __pyx_n_s_post); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 219, __pyx_L1_error)
19100 __Pyx_GOTREF(__pyx_tuple__42);
19101 __Pyx_GIVEREF(__pyx_tuple__42);
19102 __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_expand_tokens, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 219, __pyx_L1_error)
19103 __pyx_tuple__43 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 219, __pyx_L1_error)
19104 __Pyx_GOTREF(__pyx_tuple__43);
19105 __Pyx_GIVEREF(__pyx_tuple__43);
19107 /* "lxml/html/diff.py":234
19110 * def merge_insert(ins_chunks, doc): # <<<<<<<<<<<<<<
19111 * """ doc is the already-handled document (as a list of text chunks);
19112 * here we add <ins>ins_chunks</ins> to the end of that. """
19114 __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_ins_chunks, __pyx_n_s_doc, __pyx_n_s_unbalanced_start, __pyx_n_s_balanced, __pyx_n_s_unbalanced_end); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 234, __pyx_L1_error)
19115 __Pyx_GOTREF(__pyx_tuple__44);
19116 __Pyx_GIVEREF(__pyx_tuple__44);
19117 __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_merge_insert, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 234, __pyx_L1_error)
19119 /* "lxml/html/diff.py":266
19120 * (DEL_START/DEL_END) """
19122 * def merge_delete(del_chunks, doc): # <<<<<<<<<<<<<<
19123 * """ Adds the text chunks in del_chunks to the document doc (another
19124 * list of text chunks) with marker to show it is a delete.
19126 __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_del_chunks, __pyx_n_s_doc); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 266, __pyx_L1_error)
19127 __Pyx_GOTREF(__pyx_tuple__46);
19128 __Pyx_GIVEREF(__pyx_tuple__46);
19129 __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_merge_delete, 266, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 266, __pyx_L1_error)
19131 /* "lxml/html/diff.py":274
19132 * doc.append(DEL_END)
19134 * def cleanup_delete(chunks): # <<<<<<<<<<<<<<
19135 * """ Cleans up any DEL_START/DEL_END markers in the document, replacing
19136 * them with <del></del>. To do this while keeping the document
19138 __pyx_tuple__48 = PyTuple_Pack(8, __pyx_n_s_chunks_2, __pyx_n_s_pre_delete, __pyx_n_s_delete, __pyx_n_s_post_delete, __pyx_n_s_unbalanced_start, __pyx_n_s_balanced, __pyx_n_s_unbalanced_end, __pyx_n_s_doc); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 274, __pyx_L1_error)
19139 __Pyx_GOTREF(__pyx_tuple__48);
19140 __Pyx_GIVEREF(__pyx_tuple__48);
19141 __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_cleanup_delete, 274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 274, __pyx_L1_error)
19143 /* "lxml/html/diff.py":313
19146 * def split_unbalanced(chunks): # <<<<<<<<<<<<<<
19147 * """Return (unbalanced_start, balanced, unbalanced_end), where each is
19148 * a list of text and tag chunks.
19150 __pyx_tuple__50 = PyTuple_Pack(17, __pyx_n_s_chunks_2, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_tag_stack, __pyx_n_s_balanced, __pyx_n_s_chunk, __pyx_n_s_endtag, __pyx_n_s_name_2, __pyx_n_s_pos, __pyx_n_s_tag, __pyx_n_s_name_2, __pyx_n_s_pos, __pyx_n_s_tag, __pyx_n_s_name_2, __pyx_n_s_pos, __pyx_n_s_chunk, __pyx_n_s_chunk); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 313, __pyx_L1_error)
19151 __Pyx_GOTREF(__pyx_tuple__50);
19152 __Pyx_GIVEREF(__pyx_tuple__50);
19153 __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_split_unbalanced, 313, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 313, __pyx_L1_error)
19155 /* "lxml/html/diff.py":353
19156 * return start, balanced, end
19158 * def split_delete(chunks): # <<<<<<<<<<<<<<
19159 * """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
19160 * stuff_after_DEL_END). Returns the first case found (there may be
19162 __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_chunks_2, __pyx_n_s_pos, __pyx_n_s_pos2); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 353, __pyx_L1_error)
19163 __Pyx_GOTREF(__pyx_tuple__52);
19164 __Pyx_GIVEREF(__pyx_tuple__52);
19165 __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_split_delete, 353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 353, __pyx_L1_error)
19167 /* "lxml/html/diff.py":365
19168 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
19170 * def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): # <<<<<<<<<<<<<<
19171 * """ pre_delete and post_delete implicitly point to a place in the
19172 * document (where the two were split). This moves that point (by
19174 __pyx_tuple__54 = PyTuple_Pack(7, __pyx_n_s_unbalanced_start, __pyx_n_s_pre_delete, __pyx_n_s_post_delete, __pyx_n_s_finding, __pyx_n_s_finding_name, __pyx_n_s_next, __pyx_n_s_name_2); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 365, __pyx_L1_error)
19175 __Pyx_GOTREF(__pyx_tuple__54);
19176 __Pyx_GIVEREF(__pyx_tuple__54);
19177 __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_locate_unbalanced_start, 365, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 365, __pyx_L1_error)
19179 /* "lxml/html/diff.py":415
19182 * def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): # <<<<<<<<<<<<<<
19183 * """ like locate_unbalanced_start, except handling end tags and
19184 * possibly moving the point earlier in the document. """
19186 __pyx_tuple__56 = PyTuple_Pack(7, __pyx_n_s_unbalanced_end, __pyx_n_s_pre_delete, __pyx_n_s_post_delete, __pyx_n_s_finding, __pyx_n_s_finding_name, __pyx_n_s_next, __pyx_n_s_name_2); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 415, __pyx_L1_error)
19187 __Pyx_GOTREF(__pyx_tuple__56);
19188 __Pyx_GIVEREF(__pyx_tuple__56);
19189 __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_locate_unbalanced_end, 415, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 415, __pyx_L1_error)
19191 /* "lxml/html/diff.py":458
19192 * hide_when_equal = False
19194 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): # <<<<<<<<<<<<<<
19195 * obj = _unicode.__new__(cls, text)
19198 __pyx_tuple__58 = PyTuple_Pack(6, __pyx_n_s_cls, __pyx_n_s_text, __pyx_n_s_pre_tags, __pyx_n_s_post_tags, __pyx_n_s_trailing_whitespace, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 458, __pyx_L1_error)
19199 __Pyx_GOTREF(__pyx_tuple__58);
19200 __Pyx_GIVEREF(__pyx_tuple__58);
19201 __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_new, 458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 458, __pyx_L1_error)
19202 __pyx_tuple__60 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject*)__pyx_kp_u__2)); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 458, __pyx_L1_error)
19203 __Pyx_GOTREF(__pyx_tuple__60);
19204 __Pyx_GIVEREF(__pyx_tuple__60);
19206 /* "lxml/html/diff.py":475
19209 * def __repr__(self): # <<<<<<<<<<<<<<
19210 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags,
19211 * self.post_tags, self.trailing_whitespace)
19213 __pyx_tuple__61 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 475, __pyx_L1_error)
19214 __Pyx_GOTREF(__pyx_tuple__61);
19215 __Pyx_GIVEREF(__pyx_tuple__61);
19216 __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_repr, 475, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 475, __pyx_L1_error)
19218 /* "lxml/html/diff.py":479
19219 * self.post_tags, self.trailing_whitespace)
19221 * def html(self): # <<<<<<<<<<<<<<
19222 * return _unicode(self)
19225 __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 479, __pyx_L1_error)
19226 __Pyx_GOTREF(__pyx_tuple__63);
19227 __Pyx_GIVEREF(__pyx_tuple__63);
19228 __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_html, 479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 479, __pyx_L1_error)
19230 /* "lxml/html/diff.py":488
19231 * is only represented in a document by a tag. """
19233 * def __new__(cls, tag, data, html_repr, pre_tags=None, # <<<<<<<<<<<<<<
19234 * post_tags=None, trailing_whitespace=""):
19235 * obj = token.__new__(cls, "%s: %s" % (type, data),
19237 __pyx_tuple__65 = PyTuple_Pack(8, __pyx_n_s_cls, __pyx_n_s_tag, __pyx_n_s_data, __pyx_n_s_html_repr, __pyx_n_s_pre_tags, __pyx_n_s_post_tags, __pyx_n_s_trailing_whitespace, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 488, __pyx_L1_error)
19238 __Pyx_GOTREF(__pyx_tuple__65);
19239 __Pyx_GIVEREF(__pyx_tuple__65);
19240 __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_new, 488, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 488, __pyx_L1_error)
19241 __pyx_tuple__67 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject*)__pyx_kp_u__2)); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 488, __pyx_L1_error)
19242 __Pyx_GOTREF(__pyx_tuple__67);
19243 __Pyx_GIVEREF(__pyx_tuple__67);
19245 /* "lxml/html/diff.py":499
19248 * def __repr__(self): # <<<<<<<<<<<<<<
19249 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
19252 __pyx_tuple__68 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 499, __pyx_L1_error)
19253 __Pyx_GOTREF(__pyx_tuple__68);
19254 __Pyx_GIVEREF(__pyx_tuple__68);
19255 __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_repr, 499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 499, __pyx_L1_error)
19257 /* "lxml/html/diff.py":507
19259 * self.trailing_whitespace)
19260 * def html(self): # <<<<<<<<<<<<<<
19261 * return self.html_repr
19264 __pyx_tuple__70 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 507, __pyx_L1_error)
19265 __Pyx_GOTREF(__pyx_tuple__70);
19266 __Pyx_GIVEREF(__pyx_tuple__70);
19267 __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_html, 507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 507, __pyx_L1_error)
19269 /* "lxml/html/diff.py":517
19270 * hide_when_equal = True
19272 * def html(self): # <<<<<<<<<<<<<<
19273 * return ' Link: %s' % self
19276 __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 517, __pyx_L1_error)
19277 __Pyx_GOTREF(__pyx_tuple__72);
19278 __Pyx_GIVEREF(__pyx_tuple__72);
19279 __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_html, 517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 517, __pyx_L1_error)
19281 /* "lxml/html/diff.py":520
19282 * return ' Link: %s' % self
19284 * def tokenize(html, include_hrefs=True): # <<<<<<<<<<<<<<
19286 * Parse the given HTML and returns token objects (words with attached tags).
19288 __pyx_tuple__74 = PyTuple_Pack(4, __pyx_n_s_html, __pyx_n_s_include_hrefs, __pyx_n_s_body_el, __pyx_n_s_chunks_2); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 520, __pyx_L1_error)
19289 __Pyx_GOTREF(__pyx_tuple__74);
19290 __Pyx_GIVEREF(__pyx_tuple__74);
19291 __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_tokenize, 520, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 520, __pyx_L1_error)
19292 __pyx_tuple__76 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 520, __pyx_L1_error)
19293 __Pyx_GOTREF(__pyx_tuple__76);
19294 __Pyx_GIVEREF(__pyx_tuple__76);
19296 /* "lxml/html/diff.py":544
19297 * return fixup_chunks(chunks)
19299 * def parse_html(html, cleanup=True): # <<<<<<<<<<<<<<
19301 * Parses an HTML fragment, returning an lxml element. Note that the HTML will be
19303 __pyx_tuple__77 = PyTuple_Pack(2, __pyx_n_s_html, __pyx_n_s_cleanup); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 544, __pyx_L1_error)
19304 __Pyx_GOTREF(__pyx_tuple__77);
19305 __Pyx_GIVEREF(__pyx_tuple__77);
19306 __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_parse_html, 544, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 544, __pyx_L1_error)
19307 __pyx_tuple__79 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 544, __pyx_L1_error)
19308 __Pyx_GOTREF(__pyx_tuple__79);
19309 __Pyx_GIVEREF(__pyx_tuple__79);
19311 /* "lxml/html/diff.py":561
19312 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
19314 * def cleanup_html(html): # <<<<<<<<<<<<<<
19315 * """ This 'cleans' the HTML, meaning that any page structure is removed
19316 * (only the contents of <body> are used, if there is any <body).
19318 __pyx_tuple__80 = PyTuple_Pack(2, __pyx_n_s_html, __pyx_n_s_match); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 561, __pyx_L1_error)
19319 __Pyx_GOTREF(__pyx_tuple__80);
19320 __Pyx_GIVEREF(__pyx_tuple__80);
19321 __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_cleanup_html, 561, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 561, __pyx_L1_error)
19323 /* "lxml/html/diff.py":575
19326 * end_whitespace_re = re.compile(r'[ \t\n\r]$') # <<<<<<<<<<<<<<
19328 * def split_trailing_whitespace(word):
19330 __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_u_t_n_r); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 575, __pyx_L1_error)
19331 __Pyx_GOTREF(__pyx_tuple__82);
19332 __Pyx_GIVEREF(__pyx_tuple__82);
19334 /* "lxml/html/diff.py":577
19335 * end_whitespace_re = re.compile(r'[ \t\n\r]$')
19337 * def split_trailing_whitespace(word): # <<<<<<<<<<<<<<
19339 * This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
19341 __pyx_tuple__83 = PyTuple_Pack(2, __pyx_n_s_word, __pyx_n_s_stripped_length); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 577, __pyx_L1_error)
19342 __Pyx_GOTREF(__pyx_tuple__83);
19343 __Pyx_GIVEREF(__pyx_tuple__83);
19344 __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_split_trailing_whitespace, 577, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 577, __pyx_L1_error)
19346 /* "lxml/html/diff.py":585
19349 * def fixup_chunks(chunks): # <<<<<<<<<<<<<<
19351 * This function takes a list of chunks and produces a list of tokens.
19353 __pyx_tuple__85 = PyTuple_Pack(9, __pyx_n_s_chunks_2, __pyx_n_s_tag_accum, __pyx_n_s_cur_word, __pyx_n_s_result_2, __pyx_n_s_chunk, __pyx_n_s_src, __pyx_n_s_tag, __pyx_n_s_trailing_whitespace, __pyx_n_s_href); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 585, __pyx_L1_error)
19354 __Pyx_GOTREF(__pyx_tuple__85);
19355 __Pyx_GIVEREF(__pyx_tuple__85);
19356 __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_fixup_chunks, 585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 585, __pyx_L1_error)
19358 /* "lxml/html/diff.py":640
19359 * # All the tags in HTML that don't require end tags:
19361 * 'param', 'img', 'area', 'br', 'basefont', 'input', # <<<<<<<<<<<<<<
19362 * 'base', 'meta', 'link', 'col')
19365 __pyx_tuple__87 = PyTuple_Pack(10, __pyx_n_u_param, __pyx_n_u_img, __pyx_n_u_area, __pyx_n_u_br, __pyx_n_u_basefont, __pyx_n_u_input, __pyx_n_u_base, __pyx_n_u_meta, __pyx_n_u_link, __pyx_n_u_col); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 640, __pyx_L1_error)
19366 __Pyx_GOTREF(__pyx_tuple__87);
19367 __Pyx_GIVEREF(__pyx_tuple__87);
19369 /* "lxml/html/diff.py":644
19371 * block_level_tags = (
19372 * 'address', # <<<<<<<<<<<<<<
19376 __pyx_tuple__88 = PyTuple_Pack(24, __pyx_n_u_address, __pyx_n_u_blockquote, __pyx_n_u_center, __pyx_n_u_dir, __pyx_n_u_div, __pyx_n_u_dl, __pyx_n_u_fieldset, __pyx_n_u_form, __pyx_n_u_h1, __pyx_n_u_h2, __pyx_n_u_h3, __pyx_n_u_h4, __pyx_n_u_h5, __pyx_n_u_h6, __pyx_n_u_hr, __pyx_n_u_isindex, __pyx_n_u_menu, __pyx_n_u_noframes, __pyx_n_u_noscript, __pyx_n_u_ol, __pyx_n_u_p, __pyx_n_u_pre, __pyx_n_u_table, __pyx_n_u_ul); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 644, __pyx_L1_error)
19377 __Pyx_GOTREF(__pyx_tuple__88);
19378 __Pyx_GIVEREF(__pyx_tuple__88);
19380 /* "lxml/html/diff.py":671
19382 * block_level_container_tags = (
19383 * 'dd', # <<<<<<<<<<<<<<
19387 __pyx_tuple__89 = PyTuple_Pack(10, __pyx_n_u_dd, __pyx_n_u_dt, __pyx_n_u_frameset, __pyx_n_u_li, __pyx_n_u_tbody, __pyx_n_u_td, __pyx_n_u_tfoot, __pyx_n_u_th, __pyx_n_u_thead, __pyx_n_u_tr); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 671, __pyx_L1_error)
19388 __Pyx_GOTREF(__pyx_tuple__89);
19389 __Pyx_GIVEREF(__pyx_tuple__89);
19391 /* "lxml/html/diff.py":684
19394 * def flatten_el(el, include_hrefs, skip_tag=False): # <<<<<<<<<<<<<<
19395 * """ Takes an lxml element el, and generates all the text chunks for
19396 * that tag. Each start tag is a chunk, each word is a chunk, and each
19398 __pyx_tuple__90 = PyTuple_Pack(8, __pyx_n_s_el, __pyx_n_s_include_hrefs, __pyx_n_s_skip_tag, __pyx_n_s_start_words, __pyx_n_s_word, __pyx_n_s_child, __pyx_n_s_item, __pyx_n_s_end_words); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 684, __pyx_L1_error)
19399 __Pyx_GOTREF(__pyx_tuple__90);
19400 __Pyx_GIVEREF(__pyx_tuple__90);
19401 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_flatten_el, 684, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 684, __pyx_L1_error)
19402 __pyx_tuple__91 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 684, __pyx_L1_error)
19403 __Pyx_GOTREF(__pyx_tuple__91);
19404 __Pyx_GIVEREF(__pyx_tuple__91);
19406 /* "lxml/html/diff.py":714
19407 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U)
19409 * def split_words(text): # <<<<<<<<<<<<<<
19410 * """ Splits some text into words. Includes trailing whitespace
19411 * on each word when appropriate. """
19413 __pyx_tuple__92 = PyTuple_Pack(2, __pyx_n_s_text, __pyx_n_s_words); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 714, __pyx_L1_error)
19414 __Pyx_GOTREF(__pyx_tuple__92);
19415 __Pyx_GIVEREF(__pyx_tuple__92);
19416 __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_split_words, 714, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 714, __pyx_L1_error)
19418 /* "lxml/html/diff.py":723
19421 * start_whitespace_re = re.compile(r'^[ \t\n\r]') # <<<<<<<<<<<<<<
19423 * def start_tag(el):
19425 __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_u_t_n_r_2); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 723, __pyx_L1_error)
19426 __Pyx_GOTREF(__pyx_tuple__94);
19427 __Pyx_GIVEREF(__pyx_tuple__94);
19429 /* "lxml/html/diff.py":725
19430 * start_whitespace_re = re.compile(r'^[ \t\n\r]')
19432 * def start_tag(el): # <<<<<<<<<<<<<<
19434 * The text representation of the start tag for a tag.
19436 __pyx_tuple__95 = PyTuple_Pack(3, __pyx_n_s_el, __pyx_n_s_name_2, __pyx_n_s_value); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 725, __pyx_L1_error)
19437 __Pyx_GOTREF(__pyx_tuple__95);
19438 __Pyx_GIVEREF(__pyx_tuple__95);
19439 __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_start_tag, 725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 725, __pyx_L1_error)
19441 /* "lxml/html/diff.py":733
19442 * for name, value in el.attrib.items()]))
19444 * def end_tag(el): # <<<<<<<<<<<<<<
19445 * """ The text representation of an end tag for a tag. Includes
19446 * trailing whitespace when appropriate. """
19448 __pyx_tuple__97 = PyTuple_Pack(2, __pyx_n_s_el, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 733, __pyx_L1_error)
19449 __Pyx_GOTREF(__pyx_tuple__97);
19450 __Pyx_GIVEREF(__pyx_tuple__97);
19451 __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_end_tag, 733, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 733, __pyx_L1_error)
19453 /* "lxml/html/diff.py":742
19454 * return '</%s>%s' % (el.tag, extra)
19456 * def is_word(tok): # <<<<<<<<<<<<<<
19457 * return not tok.startswith('<')
19460 __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_tok); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 742, __pyx_L1_error)
19461 __Pyx_GOTREF(__pyx_tuple__99);
19462 __Pyx_GIVEREF(__pyx_tuple__99);
19463 __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_is_word, 742, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 742, __pyx_L1_error)
19465 /* "lxml/html/diff.py":745
19466 * return not tok.startswith('<')
19468 * def is_end_tag(tok): # <<<<<<<<<<<<<<
19469 * return tok.startswith('</')
19472 __pyx_tuple__101 = PyTuple_Pack(1, __pyx_n_s_tok); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 745, __pyx_L1_error)
19473 __Pyx_GOTREF(__pyx_tuple__101);
19474 __Pyx_GIVEREF(__pyx_tuple__101);
19475 __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_is_end_tag, 745, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 745, __pyx_L1_error)
19477 /* "lxml/html/diff.py":748
19478 * return tok.startswith('</')
19480 * def is_start_tag(tok): # <<<<<<<<<<<<<<
19481 * return tok.startswith('<') and not tok.startswith('</')
19484 __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_tok); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 748, __pyx_L1_error)
19485 __Pyx_GOTREF(__pyx_tuple__103);
19486 __Pyx_GIVEREF(__pyx_tuple__103);
19487 __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_is_start_tag, 748, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 748, __pyx_L1_error)
19489 /* "lxml/html/diff.py":751
19490 * return tok.startswith('<') and not tok.startswith('</')
19492 * def fixup_ins_del_tags(html): # <<<<<<<<<<<<<<
19493 * """ Given an html string, move any <ins> or <del> tags inside of any
19494 * block-level elements, e.g. transform <ins><p>word</p></ins> to
19496 __pyx_tuple__105 = PyTuple_Pack(2, __pyx_n_s_html, __pyx_n_s_doc); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 751, __pyx_L1_error)
19497 __Pyx_GOTREF(__pyx_tuple__105);
19498 __Pyx_GIVEREF(__pyx_tuple__105);
19499 __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_fixup_ins_del_tags, 751, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 751, __pyx_L1_error)
19501 /* "lxml/html/diff.py":760
19504 * def serialize_html_fragment(el, skip_outer=False): # <<<<<<<<<<<<<<
19505 * """ Serialize a single lxml element as HTML. The serialized form
19506 * includes the elements tail.
19508 __pyx_tuple__107 = PyTuple_Pack(3, __pyx_n_s_el, __pyx_n_s_skip_outer, __pyx_n_s_html); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 760, __pyx_L1_error)
19509 __Pyx_GOTREF(__pyx_tuple__107);
19510 __Pyx_GIVEREF(__pyx_tuple__107);
19511 __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_serialize_html_fragment, 760, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 760, __pyx_L1_error)
19512 __pyx_tuple__109 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 760, __pyx_L1_error)
19513 __Pyx_GOTREF(__pyx_tuple__109);
19514 __Pyx_GIVEREF(__pyx_tuple__109);
19516 /* "lxml/html/diff.py":778
19519 * def _fixup_ins_del_tags(doc): # <<<<<<<<<<<<<<
19520 * """fixup_ins_del_tags that works on an lxml document in-place
19523 __pyx_tuple__110 = PyTuple_Pack(3, __pyx_n_s_doc, __pyx_n_s_tag, __pyx_n_s_el); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 778, __pyx_L1_error)
19524 __Pyx_GOTREF(__pyx_tuple__110);
19525 __Pyx_GIVEREF(__pyx_tuple__110);
19526 __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_fixup_ins_del_tags_2, 778, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 778, __pyx_L1_error)
19528 /* "lxml/html/diff.py":789
19529 * #_merge_element_contents(el)
19531 * def _contains_block_level_tag(el): # <<<<<<<<<<<<<<
19532 * """True if the element contains any block-level elements, like <p>, <td>, etc.
19535 __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_el, __pyx_n_s_child); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 789, __pyx_L1_error)
19536 __Pyx_GOTREF(__pyx_tuple__112);
19537 __Pyx_GIVEREF(__pyx_tuple__112);
19538 __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_contains_block_level_tag, 789, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 789, __pyx_L1_error)
19540 /* "lxml/html/diff.py":799
19543 * def _move_el_inside_block(el, tag): # <<<<<<<<<<<<<<
19544 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
19545 * and moves them inside any block-level tags. """
19547 __pyx_tuple__114 = PyTuple_Pack(7, __pyx_n_s_el, __pyx_n_s_tag, __pyx_n_s_child, __pyx_n_s_children_tag, __pyx_n_s_tail_tag, __pyx_n_s_child_tag, __pyx_n_s_text_tag); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 799, __pyx_L1_error)
19548 __Pyx_GOTREF(__pyx_tuple__114);
19549 __Pyx_GIVEREF(__pyx_tuple__114);
19550 __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_move_el_inside_block, 799, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 799, __pyx_L1_error)
19552 /* "lxml/html/diff.py":831
19553 * el.insert(0, text_tag)
19555 * def _merge_element_contents(el): # <<<<<<<<<<<<<<
19557 * Removes an element, but merges its contents into its place, e.g.,
19559 __pyx_tuple__116 = PyTuple_Pack(5, __pyx_n_s_el, __pyx_n_s_parent, __pyx_n_s_text, __pyx_n_s_index, __pyx_n_s_previous); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 831, __pyx_L1_error)
19560 __Pyx_GOTREF(__pyx_tuple__116);
19561 __Pyx_GIVEREF(__pyx_tuple__116);
19562 __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_merge_element_contents, 831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 831, __pyx_L1_error)
19564 /* "lxml/html/diff.py":873
19567 * def get_matching_blocks(self): # <<<<<<<<<<<<<<
19568 * size = min(len(self.b), len(self.b))
19569 * threshold = min(self.threshold, size / 4)
19571 __pyx_tuple__118 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_size, __pyx_n_s_threshold, __pyx_n_s_actual, __pyx_n_s_item); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 873, __pyx_L1_error)
19572 __Pyx_GOTREF(__pyx_tuple__118);
19573 __Pyx_GIVEREF(__pyx_tuple__118);
19574 __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_lxml_html_diff_py, __pyx_n_s_get_matching_blocks, 873, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 873, __pyx_L1_error)
19575 __Pyx_RefNannyFinishContext();
19578 __Pyx_RefNannyFinishContext();
19582 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
19583 __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
19584 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19585 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
19586 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19587 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
19588 __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
19589 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19595 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
19596 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
19597 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
19598 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
19599 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
19600 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
19601 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
19603 static int __Pyx_modinit_global_init_code(void) {
19604 __Pyx_RefNannyDeclarations
19605 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
19606 /*--- Global init code ---*/
19607 __Pyx_RefNannyFinishContext();
19611 static int __Pyx_modinit_variable_export_code(void) {
19612 __Pyx_RefNannyDeclarations
19613 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
19614 /*--- Variable export code ---*/
19615 __Pyx_RefNannyFinishContext();
19619 static int __Pyx_modinit_function_export_code(void) {
19620 __Pyx_RefNannyDeclarations
19621 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
19622 /*--- Function export code ---*/
19623 __Pyx_RefNannyFinishContext();
19627 static int __Pyx_modinit_type_init_code(void) {
19628 __Pyx_RefNannyDeclarations
19629 int __pyx_lineno = 0;
19630 const char *__pyx_filename = NULL;
19631 int __pyx_clineno = 0;
19632 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
19633 /*--- Type init code ---*/
19634 if (PyType_Ready(&__pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
19635 #if PY_VERSION_HEX < 0x030800B1
19636 __pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens.tp_print = 0;
19638 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens.tp_dictoffset && __pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens.tp_getattro == PyObject_GenericGetAttr)) {
19639 __pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
19641 __pyx_ptype_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens = &__pyx_type_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens;
19642 if (PyType_Ready(&__pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
19643 #if PY_VERSION_HEX < 0x030800B1
19644 __pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens.tp_print = 0;
19646 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens.tp_dictoffset && __pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens.tp_getattro == PyObject_GenericGetAttr)) {
19647 __pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
19649 __pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens = &__pyx_type_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens;
19650 if (PyType_Ready(&__pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el) < 0) __PYX_ERR(0, 684, __pyx_L1_error)
19651 #if PY_VERSION_HEX < 0x030800B1
19652 __pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el.tp_print = 0;
19654 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el.tp_dictoffset && __pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el.tp_getattro == PyObject_GenericGetAttr)) {
19655 __pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
19657 __pyx_ptype_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el = &__pyx_type_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el;
19658 __Pyx_RefNannyFinishContext();
19661 __Pyx_RefNannyFinishContext();
19665 static int __Pyx_modinit_type_import_code(void) {
19666 __Pyx_RefNannyDeclarations
19667 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
19668 /*--- Type import code ---*/
19669 __Pyx_RefNannyFinishContext();
19673 static int __Pyx_modinit_variable_import_code(void) {
19674 __Pyx_RefNannyDeclarations
19675 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
19676 /*--- Variable import code ---*/
19677 __Pyx_RefNannyFinishContext();
19681 static int __Pyx_modinit_function_import_code(void) {
19682 __Pyx_RefNannyDeclarations
19683 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
19684 /*--- Function import code ---*/
19685 __Pyx_RefNannyFinishContext();
19690 #ifndef CYTHON_NO_PYINIT_EXPORT
19691 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
19692 #elif PY_MAJOR_VERSION < 3
19694 #define __Pyx_PyMODINIT_FUNC extern "C" void
19696 #define __Pyx_PyMODINIT_FUNC void
19700 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
19702 #define __Pyx_PyMODINIT_FUNC PyObject *
19707 #if PY_MAJOR_VERSION < 3
19708 __Pyx_PyMODINIT_FUNC initdiff(void) CYTHON_SMALL_CODE; /*proto*/
19709 __Pyx_PyMODINIT_FUNC initdiff(void)
19711 __Pyx_PyMODINIT_FUNC PyInit_diff(void) CYTHON_SMALL_CODE; /*proto*/
19712 __Pyx_PyMODINIT_FUNC PyInit_diff(void)
19713 #if CYTHON_PEP489_MULTI_PHASE_INIT
19715 return PyModuleDef_Init(&__pyx_moduledef);
19717 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
19718 #if PY_VERSION_HEX >= 0x030700A1
19719 static PY_INT64_T main_interpreter_id = -1;
19720 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
19721 if (main_interpreter_id == -1) {
19722 main_interpreter_id = current_id;
19723 return (unlikely(current_id == -1)) ? -1 : 0;
19724 } else if (unlikely(main_interpreter_id != current_id))
19726 static PyInterpreterState *main_interpreter = NULL;
19727 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
19728 if (!main_interpreter) {
19729 main_interpreter = current_interpreter;
19730 } else if (unlikely(main_interpreter != current_interpreter))
19735 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
19740 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
19741 PyObject *value = PyObject_GetAttrString(spec, from_name);
19743 if (likely(value)) {
19744 if (allow_none || value != Py_None) {
19745 result = PyDict_SetItemString(moddict, to_name, value);
19748 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
19755 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
19756 PyObject *module = NULL, *moddict, *modname;
19757 if (__Pyx_check_single_interpreter())
19760 return __Pyx_NewRef(__pyx_m);
19761 modname = PyObject_GetAttrString(spec, "name");
19762 if (unlikely(!modname)) goto bad;
19763 module = PyModule_NewObject(modname);
19764 Py_DECREF(modname);
19765 if (unlikely(!module)) goto bad;
19766 moddict = PyModule_GetDict(module);
19767 if (unlikely(!moddict)) goto bad;
19768 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
19769 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
19770 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
19771 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
19774 Py_XDECREF(module);
19779 static CYTHON_SMALL_CODE int __pyx_pymod_exec_diff(PyObject *__pyx_pyinit_module)
19783 PyObject *__pyx_t_1 = NULL;
19784 PyObject *__pyx_t_2 = NULL;
19785 PyObject *__pyx_t_3 = NULL;
19786 PyObject *__pyx_t_4 = NULL;
19787 PyObject *__pyx_t_5 = NULL;
19789 PyObject *__pyx_t_7 = NULL;
19790 PyObject *__pyx_t_8 = NULL;
19791 PyObject *__pyx_t_9 = NULL;
19793 int __pyx_lineno = 0;
19794 const char *__pyx_filename = NULL;
19795 int __pyx_clineno = 0;
19796 __Pyx_RefNannyDeclarations
19797 #if CYTHON_PEP489_MULTI_PHASE_INIT
19799 if (__pyx_m == __pyx_pyinit_module) return 0;
19800 PyErr_SetString(PyExc_RuntimeError, "Module 'diff' has already been imported. Re-initialisation is not supported.");
19803 #elif PY_MAJOR_VERSION >= 3
19804 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
19806 #if CYTHON_REFNANNY
19807 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
19808 if (!__Pyx_RefNanny) {
19810 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
19811 if (!__Pyx_RefNanny)
19812 Py_FatalError("failed to import 'refnanny' module");
19815 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_diff(void)", 0);
19816 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19817 #ifdef __Pxy_PyFrame_Initialize_Offsets
19818 __Pxy_PyFrame_Initialize_Offsets();
19820 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
19821 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
19822 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
19823 #ifdef __Pyx_CyFunction_USED
19824 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19826 #ifdef __Pyx_FusedFunction_USED
19827 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19829 #ifdef __Pyx_Coroutine_USED
19830 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19832 #ifdef __Pyx_Generator_USED
19833 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19835 #ifdef __Pyx_AsyncGen_USED
19836 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19838 #ifdef __Pyx_StopAsyncIteration_USED
19839 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19841 /*--- Library function declarations ---*/
19842 /*--- Threads initialization code ---*/
19843 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
19844 #ifdef WITH_THREAD /* Python build with threading support? */
19845 PyEval_InitThreads();
19848 /*--- Module creation code ---*/
19849 #if CYTHON_PEP489_MULTI_PHASE_INIT
19850 __pyx_m = __pyx_pyinit_module;
19851 Py_INCREF(__pyx_m);
19853 #if PY_MAJOR_VERSION < 3
19854 __pyx_m = Py_InitModule4("diff", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
19856 __pyx_m = PyModule_Create(&__pyx_moduledef);
19858 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
19860 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
19861 Py_INCREF(__pyx_d);
19862 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
19863 Py_INCREF(__pyx_b);
19864 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
19865 Py_INCREF(__pyx_cython_runtime);
19866 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19867 /*--- Initialize various global constants etc. ---*/
19868 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19869 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
19870 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19872 if (__pyx_module_is_main_lxml__html__diff) {
19873 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19875 #if PY_MAJOR_VERSION >= 3
19877 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
19878 if (!PyDict_GetItemString(modules, "lxml.html.diff")) {
19879 if (unlikely(PyDict_SetItemString(modules, "lxml.html.diff", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19883 /*--- Builtin init code ---*/
19884 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19885 /*--- Constants init code ---*/
19886 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19887 /*--- Global type/function init code ---*/
19888 (void)__Pyx_modinit_global_init_code();
19889 (void)__Pyx_modinit_variable_export_code();
19890 (void)__Pyx_modinit_function_export_code();
19891 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19892 (void)__Pyx_modinit_type_import_code();
19893 (void)__Pyx_modinit_variable_import_code();
19894 (void)__Pyx_modinit_function_import_code();
19895 /*--- Execution code ---*/
19896 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
19897 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19900 /* "lxml/html/diff.py":5
19901 * from __future__ import absolute_import
19903 * import difflib # <<<<<<<<<<<<<<
19904 * from lxml import etree
19905 * from lxml.html import fragment_fromstring
19907 __pyx_t_1 = __Pyx_Import(__pyx_n_s_difflib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
19908 __Pyx_GOTREF(__pyx_t_1);
19909 if (PyDict_SetItem(__pyx_d, __pyx_n_s_difflib, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
19910 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19912 /* "lxml/html/diff.py":6
19915 * from lxml import etree # <<<<<<<<<<<<<<
19916 * from lxml.html import fragment_fromstring
19919 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
19920 __Pyx_GOTREF(__pyx_t_1);
19921 __Pyx_INCREF(__pyx_n_s_etree);
19922 __Pyx_GIVEREF(__pyx_n_s_etree);
19923 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_etree);
19924 __pyx_t_2 = __Pyx_Import(__pyx_n_s_lxml, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
19925 __Pyx_GOTREF(__pyx_t_2);
19926 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19927 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_etree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
19928 __Pyx_GOTREF(__pyx_t_1);
19929 if (PyDict_SetItem(__pyx_d, __pyx_n_s_etree, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
19930 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19931 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19933 /* "lxml/html/diff.py":7
19935 * from lxml import etree
19936 * from lxml.html import fragment_fromstring # <<<<<<<<<<<<<<
19940 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
19941 __Pyx_GOTREF(__pyx_t_2);
19942 __Pyx_INCREF(__pyx_n_s_fragment_fromstring);
19943 __Pyx_GIVEREF(__pyx_n_s_fragment_fromstring);
19944 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_fragment_fromstring);
19945 __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml_html, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
19946 __Pyx_GOTREF(__pyx_t_1);
19947 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19948 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_fragment_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
19949 __Pyx_GOTREF(__pyx_t_2);
19950 if (PyDict_SetItem(__pyx_d, __pyx_n_s_fragment_fromstring, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
19951 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19952 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19954 /* "lxml/html/diff.py":8
19955 * from lxml import etree
19956 * from lxml.html import fragment_fromstring
19957 * import re # <<<<<<<<<<<<<<
19959 * __all__ = ['html_annotate', 'htmldiff']
19961 __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
19962 __Pyx_GOTREF(__pyx_t_1);
19963 if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
19964 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19966 /* "lxml/html/diff.py":10
19969 * __all__ = ['html_annotate', 'htmldiff'] # <<<<<<<<<<<<<<
19973 __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
19974 __Pyx_GOTREF(__pyx_t_1);
19975 __Pyx_INCREF(__pyx_n_u_html_annotate);
19976 __Pyx_GIVEREF(__pyx_n_u_html_annotate);
19977 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_html_annotate);
19978 __Pyx_INCREF(__pyx_n_u_htmldiff);
19979 __Pyx_GIVEREF(__pyx_n_u_htmldiff);
19980 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_htmldiff);
19981 if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
19982 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19984 /* "lxml/html/diff.py":12
19985 * __all__ = ['html_annotate', 'htmldiff']
19987 * try: # <<<<<<<<<<<<<<
19988 * from html import escape as html_escape
19989 * except ImportError:
19992 __Pyx_PyThreadState_declare
19993 __Pyx_PyThreadState_assign
19994 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
19995 __Pyx_XGOTREF(__pyx_t_3);
19996 __Pyx_XGOTREF(__pyx_t_4);
19997 __Pyx_XGOTREF(__pyx_t_5);
20000 /* "lxml/html/diff.py":13
20003 * from html import escape as html_escape # <<<<<<<<<<<<<<
20004 * except ImportError:
20005 * from cgi import escape as html_escape
20007 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L2_error)
20008 __Pyx_GOTREF(__pyx_t_1);
20009 __Pyx_INCREF(__pyx_n_s_escape);
20010 __Pyx_GIVEREF(__pyx_n_s_escape);
20011 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_escape);
20012 __pyx_t_2 = __Pyx_Import(__pyx_n_s_html, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L2_error)
20013 __Pyx_GOTREF(__pyx_t_2);
20014 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20015 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_escape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L2_error)
20016 __Pyx_GOTREF(__pyx_t_1);
20017 if (PyDict_SetItem(__pyx_d, __pyx_n_s_html_escape, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L2_error)
20018 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20019 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20021 /* "lxml/html/diff.py":12
20022 * __all__ = ['html_annotate', 'htmldiff']
20024 * try: # <<<<<<<<<<<<<<
20025 * from html import escape as html_escape
20026 * except ImportError:
20029 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
20030 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20031 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20032 goto __pyx_L7_try_end;
20034 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20035 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20037 /* "lxml/html/diff.py":14
20039 * from html import escape as html_escape
20040 * except ImportError: # <<<<<<<<<<<<<<
20041 * from cgi import escape as html_escape
20044 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
20046 __Pyx_AddTraceback("lxml.html.diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
20047 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 14, __pyx_L4_except_error)
20048 __Pyx_GOTREF(__pyx_t_2);
20049 __Pyx_GOTREF(__pyx_t_1);
20050 __Pyx_GOTREF(__pyx_t_7);
20052 /* "lxml/html/diff.py":15
20053 * from html import escape as html_escape
20054 * except ImportError:
20055 * from cgi import escape as html_escape # <<<<<<<<<<<<<<
20057 * _unicode = unicode
20059 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 15, __pyx_L4_except_error)
20060 __Pyx_GOTREF(__pyx_t_8);
20061 __Pyx_INCREF(__pyx_n_s_escape);
20062 __Pyx_GIVEREF(__pyx_n_s_escape);
20063 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_escape);
20064 __pyx_t_9 = __Pyx_Import(__pyx_n_s_cgi, __pyx_t_8, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 15, __pyx_L4_except_error)
20065 __Pyx_GOTREF(__pyx_t_9);
20066 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20067 __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_escape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 15, __pyx_L4_except_error)
20068 __Pyx_GOTREF(__pyx_t_8);
20069 if (PyDict_SetItem(__pyx_d, __pyx_n_s_html_escape, __pyx_t_8) < 0) __PYX_ERR(0, 15, __pyx_L4_except_error)
20070 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20071 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20072 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20073 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20074 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20075 goto __pyx_L3_exception_handled;
20077 goto __pyx_L4_except_error;
20078 __pyx_L4_except_error:;
20080 /* "lxml/html/diff.py":12
20081 * __all__ = ['html_annotate', 'htmldiff']
20083 * try: # <<<<<<<<<<<<<<
20084 * from html import escape as html_escape
20085 * except ImportError:
20087 __Pyx_XGIVEREF(__pyx_t_3);
20088 __Pyx_XGIVEREF(__pyx_t_4);
20089 __Pyx_XGIVEREF(__pyx_t_5);
20090 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20091 goto __pyx_L1_error;
20092 __pyx_L3_exception_handled:;
20093 __Pyx_XGIVEREF(__pyx_t_3);
20094 __Pyx_XGIVEREF(__pyx_t_4);
20095 __Pyx_XGIVEREF(__pyx_t_5);
20096 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20100 /* "lxml/html/diff.py":16
20101 * except ImportError:
20102 * from cgi import escape as html_escape
20103 * try: # <<<<<<<<<<<<<<
20104 * _unicode = unicode
20105 * except NameError:
20108 __Pyx_PyThreadState_declare
20109 __Pyx_PyThreadState_assign
20110 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
20111 __Pyx_XGOTREF(__pyx_t_5);
20112 __Pyx_XGOTREF(__pyx_t_4);
20113 __Pyx_XGOTREF(__pyx_t_3);
20116 /* "lxml/html/diff.py":17
20117 * from cgi import escape as html_escape
20119 * _unicode = unicode # <<<<<<<<<<<<<<
20120 * except NameError:
20123 if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 17, __pyx_L10_error)
20125 /* "lxml/html/diff.py":16
20126 * except ImportError:
20127 * from cgi import escape as html_escape
20128 * try: # <<<<<<<<<<<<<<
20129 * _unicode = unicode
20130 * except NameError:
20133 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20134 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20135 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
20136 goto __pyx_L15_try_end;
20138 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20139 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20140 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20141 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20142 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
20144 /* "lxml/html/diff.py":18
20146 * _unicode = unicode
20147 * except NameError: # <<<<<<<<<<<<<<
20151 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NameError);
20153 __Pyx_AddTraceback("lxml.html.diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
20154 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L12_except_error)
20155 __Pyx_GOTREF(__pyx_t_7);
20156 __Pyx_GOTREF(__pyx_t_1);
20157 __Pyx_GOTREF(__pyx_t_2);
20159 /* "lxml/html/diff.py":20
20160 * except NameError:
20162 * _unicode = str # <<<<<<<<<<<<<<
20166 if (PyDict_SetItem(__pyx_d, __pyx_n_s_unicode, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 20, __pyx_L12_except_error)
20167 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20168 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20169 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20170 goto __pyx_L11_exception_handled;
20172 goto __pyx_L12_except_error;
20173 __pyx_L12_except_error:;
20175 /* "lxml/html/diff.py":16
20176 * except ImportError:
20177 * from cgi import escape as html_escape
20178 * try: # <<<<<<<<<<<<<<
20179 * _unicode = unicode
20180 * except NameError:
20182 __Pyx_XGIVEREF(__pyx_t_5);
20183 __Pyx_XGIVEREF(__pyx_t_4);
20184 __Pyx_XGIVEREF(__pyx_t_3);
20185 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
20186 goto __pyx_L1_error;
20187 __pyx_L11_exception_handled:;
20188 __Pyx_XGIVEREF(__pyx_t_5);
20189 __Pyx_XGIVEREF(__pyx_t_4);
20190 __Pyx_XGIVEREF(__pyx_t_3);
20191 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
20192 __pyx_L15_try_end:;
20195 /* "lxml/html/diff.py":21
20198 * try: # <<<<<<<<<<<<<<
20200 * except NameError:
20203 __Pyx_PyThreadState_declare
20204 __Pyx_PyThreadState_assign
20205 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
20206 __Pyx_XGOTREF(__pyx_t_3);
20207 __Pyx_XGOTREF(__pyx_t_4);
20208 __Pyx_XGOTREF(__pyx_t_5);
20211 /* "lxml/html/diff.py":22
20214 * basestring # <<<<<<<<<<<<<<
20215 * except NameError:
20218 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_basestring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L18_error)
20219 __Pyx_GOTREF(__pyx_t_2);
20220 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20222 /* "lxml/html/diff.py":21
20225 * try: # <<<<<<<<<<<<<<
20227 * except NameError:
20230 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
20231 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20232 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20233 goto __pyx_L23_try_end;
20235 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20236 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20237 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20238 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20239 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
20241 /* "lxml/html/diff.py":23
20244 * except NameError: # <<<<<<<<<<<<<<
20248 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NameError);
20250 __Pyx_AddTraceback("lxml.html.diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
20251 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 23, __pyx_L20_except_error)
20252 __Pyx_GOTREF(__pyx_t_2);
20253 __Pyx_GOTREF(__pyx_t_1);
20254 __Pyx_GOTREF(__pyx_t_7);
20256 /* "lxml/html/diff.py":25
20257 * except NameError:
20259 * basestring = str # <<<<<<<<<<<<<<
20261 * ############################################################
20263 if (PyDict_SetItem(__pyx_d, __pyx_n_s_basestring, ((PyObject *)(&PyUnicode_Type))) < 0) __PYX_ERR(0, 25, __pyx_L20_except_error)
20264 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20265 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
20266 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20267 goto __pyx_L19_exception_handled;
20269 goto __pyx_L20_except_error;
20270 __pyx_L20_except_error:;
20272 /* "lxml/html/diff.py":21
20275 * try: # <<<<<<<<<<<<<<
20277 * except NameError:
20279 __Pyx_XGIVEREF(__pyx_t_3);
20280 __Pyx_XGIVEREF(__pyx_t_4);
20281 __Pyx_XGIVEREF(__pyx_t_5);
20282 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20283 goto __pyx_L1_error;
20284 __pyx_L19_exception_handled:;
20285 __Pyx_XGIVEREF(__pyx_t_3);
20286 __Pyx_XGIVEREF(__pyx_t_4);
20287 __Pyx_XGIVEREF(__pyx_t_5);
20288 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20289 __pyx_L23_try_end:;
20292 /* "lxml/html/diff.py":31
20293 * ############################################################
20295 * def default_markup(text, version): # <<<<<<<<<<<<<<
20296 * return '<span title="%s">%s</span>' % (
20297 * html_escape(_unicode(version), 1), text)
20299 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_1default_markup, 0, __pyx_n_s_default_markup, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
20300 __Pyx_GOTREF(__pyx_t_7);
20301 if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_markup, __pyx_t_7) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
20302 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20304 /* "lxml/html/diff.py":35
20305 * html_escape(_unicode(version), 1), text)
20307 * def html_annotate(doclist, markup=default_markup): # <<<<<<<<<<<<<<
20309 * doclist should be ordered from oldest to newest, like::
20311 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_3html_annotate, 0, __pyx_n_s_html_annotate, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error)
20312 __Pyx_GOTREF(__pyx_t_7);
20313 if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 35, __pyx_L1_error)
20314 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_default_markup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
20315 __Pyx_GOTREF(__pyx_t_1);
20316 __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_markup = __pyx_t_1;
20317 __Pyx_GIVEREF(__pyx_t_1);
20319 __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_4lxml_4html_4diff_75__defaults__);
20320 if (PyDict_SetItem(__pyx_d, __pyx_n_s_html_annotate, __pyx_t_7) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
20321 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20323 /* "lxml/html/diff.py":75
20324 * return ''.join(result).strip()
20326 * def tokenize_annotated(doc, annotation): # <<<<<<<<<<<<<<
20327 * """Tokenize a document and add an annotation attribute to each token
20330 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_5tokenize_annotated, 0, __pyx_n_s_tokenize_annotated, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error)
20331 __Pyx_GOTREF(__pyx_t_7);
20332 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tokenize_annotated, __pyx_t_7) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
20333 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20335 /* "lxml/html/diff.py":83
20338 * def html_annotate_merge_annotations(tokens_old, tokens_new): # <<<<<<<<<<<<<<
20339 * """Merge the annotations from tokens_old into tokens_new, when the
20340 * tokens in the new document already existed in the old document.
20342 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_7html_annotate_merge_annotations, 0, __pyx_n_s_html_annotate_merge_annotations, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error)
20343 __Pyx_GOTREF(__pyx_t_7);
20344 if (PyDict_SetItem(__pyx_d, __pyx_n_s_html_annotate_merge_annotations, __pyx_t_7) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
20345 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20347 /* "lxml/html/diff.py":96
20348 * copy_annotations(eq_old, eq_new)
20350 * def copy_annotations(src, dest): # <<<<<<<<<<<<<<
20352 * Copy annotations from the tokens listed in src to the tokens in dest
20354 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_9copy_annotations, 0, __pyx_n_s_copy_annotations, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
20355 __Pyx_GOTREF(__pyx_t_7);
20356 if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy_annotations, __pyx_t_7) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
20357 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20359 /* "lxml/html/diff.py":104
20360 * dest_tok.annotation = src_tok.annotation
20362 * def compress_tokens(tokens): # <<<<<<<<<<<<<<
20364 * Combine adjacent tokens when there is no HTML between the tokens,
20366 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_11compress_tokens, 0, __pyx_n_s_compress_tokens, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error)
20367 __Pyx_GOTREF(__pyx_t_7);
20368 if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress_tokens, __pyx_t_7) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
20369 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20371 /* "lxml/html/diff.py":119
20374 * def compress_merge_back(tokens, tok): # <<<<<<<<<<<<<<
20375 * """ Merge tok into the last element of tokens (modifying the list of
20376 * tokens in-place). """
20378 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_13compress_merge_back, 0, __pyx_n_s_compress_merge_back, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error)
20379 __Pyx_GOTREF(__pyx_t_7);
20380 if (PyDict_SetItem(__pyx_d, __pyx_n_s_compress_merge_back, __pyx_t_7) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
20381 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20383 /* "lxml/html/diff.py":137
20384 * tokens[-1] = merged
20386 * def markup_serialize_tokens(tokens, markup_func): # <<<<<<<<<<<<<<
20388 * Serialize the list of tokens into a list of text chunks, calling
20390 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_15markup_serialize_tokens, 0, __pyx_n_s_markup_serialize_tokens, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error)
20391 __Pyx_GOTREF(__pyx_t_7);
20392 if (PyDict_SetItem(__pyx_d, __pyx_n_s_markup_serialize_tokens, __pyx_t_7) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
20393 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20395 /* "lxml/html/diff.py":158
20396 * ############################################################
20398 * def htmldiff(old_html, new_html): # <<<<<<<<<<<<<<
20399 * ## FIXME: this should take parsed documents too, and use their body
20400 * ## or other content.
20402 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_18htmldiff, 0, __pyx_n_s_htmldiff, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error)
20403 __Pyx_GOTREF(__pyx_t_7);
20404 if (PyDict_SetItem(__pyx_d, __pyx_n_s_htmldiff, __pyx_t_7) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
20405 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20407 /* "lxml/html/diff.py":181
20408 * return fixup_ins_del_tags(result)
20410 * def htmldiff_tokens(html1_tokens, html2_tokens): # <<<<<<<<<<<<<<
20411 * """ Does a diff on the tokens themselves, returning a list of text
20412 * chunks (not tokens).
20414 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_20htmldiff_tokens, 0, __pyx_n_s_htmldiff_tokens, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error)
20415 __Pyx_GOTREF(__pyx_t_7);
20416 if (PyDict_SetItem(__pyx_d, __pyx_n_s_htmldiff_tokens, __pyx_t_7) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
20417 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20419 /* "lxml/html/diff.py":219
20422 * def expand_tokens(tokens, equal=False): # <<<<<<<<<<<<<<
20423 * """Given a list of tokens, return a generator of the chunks of
20424 * text for the data in the tokens.
20426 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_22expand_tokens, 0, __pyx_n_s_expand_tokens, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error)
20427 __Pyx_GOTREF(__pyx_t_7);
20428 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__43);
20429 if (PyDict_SetItem(__pyx_d, __pyx_n_s_expand_tokens, __pyx_t_7) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
20430 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20432 /* "lxml/html/diff.py":234
20435 * def merge_insert(ins_chunks, doc): # <<<<<<<<<<<<<<
20436 * """ doc is the already-handled document (as a list of text chunks);
20437 * here we add <ins>ins_chunks</ins> to the end of that. """
20439 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_25merge_insert, 0, __pyx_n_s_merge_insert, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
20440 __Pyx_GOTREF(__pyx_t_7);
20441 if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_insert, __pyx_t_7) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
20442 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20444 /* "lxml/html/diff.py":257
20445 * # segment, until we do the cleanup phase to turn them into proper
20447 * class DEL_START: # <<<<<<<<<<<<<<
20451 __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_DEL_START, __pyx_n_s_DEL_START, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error)
20452 __Pyx_GOTREF(__pyx_t_7);
20453 __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_DEL_START, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
20454 __Pyx_GOTREF(__pyx_t_1);
20455 if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEL_START, __pyx_t_1) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
20456 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20457 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20459 /* "lxml/html/diff.py":259
20462 * class DEL_END: # <<<<<<<<<<<<<<
20466 __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_DEL_END, __pyx_n_s_DEL_END, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
20467 __Pyx_GOTREF(__pyx_t_7);
20468 __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_DEL_END, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
20469 __Pyx_GOTREF(__pyx_t_1);
20470 if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEL_END, __pyx_t_1) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
20471 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20472 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20474 /* "lxml/html/diff.py":262
20477 * class NoDeletes(Exception): # <<<<<<<<<<<<<<
20478 * """ Raised when the document no longer contains any pending deletes
20479 * (DEL_START/DEL_END) """
20481 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __pyx_L1_error)
20482 __Pyx_GOTREF(__pyx_t_7);
20483 __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
20484 __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
20485 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
20486 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
20487 __Pyx_GOTREF(__pyx_t_1);
20488 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_NoDeletes, __pyx_n_s_NoDeletes, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, __pyx_kp_s_Raised_when_the_document_no_lon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
20489 __Pyx_GOTREF(__pyx_t_2);
20490 __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_NoDeletes, __pyx_t_7, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 262, __pyx_L1_error)
20491 __Pyx_GOTREF(__pyx_t_9);
20492 if (PyDict_SetItem(__pyx_d, __pyx_n_s_NoDeletes, __pyx_t_9) < 0) __PYX_ERR(0, 262, __pyx_L1_error)
20493 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20494 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20495 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20496 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20498 /* "lxml/html/diff.py":266
20499 * (DEL_START/DEL_END) """
20501 * def merge_delete(del_chunks, doc): # <<<<<<<<<<<<<<
20502 * """ Adds the text chunks in del_chunks to the document doc (another
20503 * list of text chunks) with marker to show it is a delete.
20505 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_27merge_delete, 0, __pyx_n_s_merge_delete, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 266, __pyx_L1_error)
20506 __Pyx_GOTREF(__pyx_t_7);
20507 if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_delete, __pyx_t_7) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
20508 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20510 /* "lxml/html/diff.py":274
20511 * doc.append(DEL_END)
20513 * def cleanup_delete(chunks): # <<<<<<<<<<<<<<
20514 * """ Cleans up any DEL_START/DEL_END markers in the document, replacing
20515 * them with <del></del>. To do this while keeping the document
20517 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_29cleanup_delete, 0, __pyx_n_s_cleanup_delete, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 274, __pyx_L1_error)
20518 __Pyx_GOTREF(__pyx_t_7);
20519 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_delete, __pyx_t_7) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
20520 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20522 /* "lxml/html/diff.py":313
20525 * def split_unbalanced(chunks): # <<<<<<<<<<<<<<
20526 * """Return (unbalanced_start, balanced, unbalanced_end), where each is
20527 * a list of text and tag chunks.
20529 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_31split_unbalanced, 0, __pyx_n_s_split_unbalanced, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error)
20530 __Pyx_GOTREF(__pyx_t_7);
20531 if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_unbalanced, __pyx_t_7) < 0) __PYX_ERR(0, 313, __pyx_L1_error)
20532 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20534 /* "lxml/html/diff.py":353
20535 * return start, balanced, end
20537 * def split_delete(chunks): # <<<<<<<<<<<<<<
20538 * """ Returns (stuff_before_DEL_START, stuff_inside_DEL_START_END,
20539 * stuff_after_DEL_END). Returns the first case found (there may be
20541 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_33split_delete, 0, __pyx_n_s_split_delete, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error)
20542 __Pyx_GOTREF(__pyx_t_7);
20543 if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_delete, __pyx_t_7) < 0) __PYX_ERR(0, 353, __pyx_L1_error)
20544 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20546 /* "lxml/html/diff.py":365
20547 * return chunks[:pos], chunks[pos+1:pos2], chunks[pos2+1:]
20549 * def locate_unbalanced_start(unbalanced_start, pre_delete, post_delete): # <<<<<<<<<<<<<<
20550 * """ pre_delete and post_delete implicitly point to a place in the
20551 * document (where the two were split). This moves that point (by
20553 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_35locate_unbalanced_start, 0, __pyx_n_s_locate_unbalanced_start, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 365, __pyx_L1_error)
20554 __Pyx_GOTREF(__pyx_t_7);
20555 if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate_unbalanced_start, __pyx_t_7) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
20556 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20558 /* "lxml/html/diff.py":415
20561 * def locate_unbalanced_end(unbalanced_end, pre_delete, post_delete): # <<<<<<<<<<<<<<
20562 * """ like locate_unbalanced_start, except handling end tags and
20563 * possibly moving the point earlier in the document. """
20565 __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_37locate_unbalanced_end, 0, __pyx_n_s_locate_unbalanced_end, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 415, __pyx_L1_error)
20566 __Pyx_GOTREF(__pyx_t_7);
20567 if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate_unbalanced_end, __pyx_t_7) < 0) __PYX_ERR(0, 415, __pyx_L1_error)
20568 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20570 /* "lxml/html/diff.py":441
20573 * class token(_unicode): # <<<<<<<<<<<<<<
20574 * """ Represents a diffable token, generally a word that is displayed to
20575 * the user. Opening tags are attached to this token when they are
20577 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
20578 __Pyx_GOTREF(__pyx_t_7);
20579 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
20580 __Pyx_GOTREF(__pyx_t_1);
20581 __Pyx_GIVEREF(__pyx_t_7);
20582 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
20584 __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
20585 __Pyx_GOTREF(__pyx_t_7);
20586 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_token, __pyx_n_s_token, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, __pyx_kp_s_Represents_a_diffable_token_gen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
20587 __Pyx_GOTREF(__pyx_t_2);
20589 /* "lxml/html/diff.py":456
20590 * # When this is true, the token will be eliminated from the
20591 * # displayed diff if no change has occurred:
20592 * hide_when_equal = False # <<<<<<<<<<<<<<
20594 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""):
20596 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_hide_when_equal, Py_False) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
20598 /* "lxml/html/diff.py":458
20599 * hide_when_equal = False
20601 * def __new__(cls, text, pre_tags=None, post_tags=None, trailing_whitespace=""): # <<<<<<<<<<<<<<
20602 * obj = _unicode.__new__(cls, text)
20605 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_5token_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_token___new, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 458, __pyx_L1_error)
20606 __Pyx_GOTREF(__pyx_t_9);
20607 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__60);
20608 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_new, __pyx_t_9) < 0) __PYX_ERR(0, 458, __pyx_L1_error)
20609 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20611 /* "lxml/html/diff.py":475
20614 * def __repr__(self): # <<<<<<<<<<<<<<
20615 * return 'token(%s, %r, %r, %r)' % (_unicode.__repr__(self), self.pre_tags,
20616 * self.post_tags, self.trailing_whitespace)
20618 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_5token_3__repr__, 0, __pyx_n_s_token___repr, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 475, __pyx_L1_error)
20619 __Pyx_GOTREF(__pyx_t_9);
20620 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_9) < 0) __PYX_ERR(0, 475, __pyx_L1_error)
20621 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20623 /* "lxml/html/diff.py":479
20624 * self.post_tags, self.trailing_whitespace)
20626 * def html(self): # <<<<<<<<<<<<<<
20627 * return _unicode(self)
20630 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_5token_5html, 0, __pyx_n_s_token_html, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 479, __pyx_L1_error)
20631 __Pyx_GOTREF(__pyx_t_9);
20632 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_html, __pyx_t_9) < 0) __PYX_ERR(0, 479, __pyx_L1_error)
20633 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20635 /* "lxml/html/diff.py":441
20638 * class token(_unicode): # <<<<<<<<<<<<<<
20639 * """ Represents a diffable token, generally a word that is displayed to
20640 * the user. Opening tags are attached to this token when they are
20642 __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_token, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 441, __pyx_L1_error)
20643 __Pyx_GOTREF(__pyx_t_9);
20644 if (PyDict_SetItem(__pyx_d, __pyx_n_s_token, __pyx_t_9) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
20645 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20646 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20647 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20648 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20650 /* "lxml/html/diff.py":482
20651 * return _unicode(self)
20653 * class tag_token(token): # <<<<<<<<<<<<<<
20655 * """ Represents a token that is actually a tag. Currently this is just
20657 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_token); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
20658 __Pyx_GOTREF(__pyx_t_1);
20659 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error)
20660 __Pyx_GOTREF(__pyx_t_7);
20661 __Pyx_GIVEREF(__pyx_t_1);
20662 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
20664 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
20665 __Pyx_GOTREF(__pyx_t_1);
20666 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_tag_token_2, __pyx_n_s_tag_token_2, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, __pyx_kp_s_Represents_a_token_that_is_actu); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
20667 __Pyx_GOTREF(__pyx_t_2);
20669 /* "lxml/html/diff.py":488
20670 * is only represented in a document by a tag. """
20672 * def __new__(cls, tag, data, html_repr, pre_tags=None, # <<<<<<<<<<<<<<
20673 * post_tags=None, trailing_whitespace=""):
20674 * obj = token.__new__(cls, "%s: %s" % (type, data),
20676 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_9tag_token_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_tag_token___new, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error)
20677 __Pyx_GOTREF(__pyx_t_9);
20678 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__67);
20679 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_new, __pyx_t_9) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
20680 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20682 /* "lxml/html/diff.py":499
20685 * def __repr__(self): # <<<<<<<<<<<<<<
20686 * return 'tag_token(%s, %s, html_repr=%s, post_tags=%r, pre_tags=%r, trailing_whitespace=%r)' % (
20689 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_9tag_token_3__repr__, 0, __pyx_n_s_tag_token___repr, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 499, __pyx_L1_error)
20690 __Pyx_GOTREF(__pyx_t_9);
20691 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_9) < 0) __PYX_ERR(0, 499, __pyx_L1_error)
20692 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20694 /* "lxml/html/diff.py":507
20696 * self.trailing_whitespace)
20697 * def html(self): # <<<<<<<<<<<<<<
20698 * return self.html_repr
20701 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_9tag_token_5html, 0, __pyx_n_s_tag_token_html, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L1_error)
20702 __Pyx_GOTREF(__pyx_t_9);
20703 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_html, __pyx_t_9) < 0) __PYX_ERR(0, 507, __pyx_L1_error)
20704 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20706 /* "lxml/html/diff.py":482
20707 * return _unicode(self)
20709 * class tag_token(token): # <<<<<<<<<<<<<<
20711 * """ Represents a token that is actually a tag. Currently this is just
20713 __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_tag_token_2, __pyx_t_7, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L1_error)
20714 __Pyx_GOTREF(__pyx_t_9);
20715 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tag_token_2, __pyx_t_9) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
20716 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20717 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20718 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20719 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20721 /* "lxml/html/diff.py":510
20722 * return self.html_repr
20724 * class href_token(token): # <<<<<<<<<<<<<<
20726 * """ Represents the href in an anchor tag. Unlike other words, we only
20728 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 510, __pyx_L1_error)
20729 __Pyx_GOTREF(__pyx_t_7);
20730 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error)
20731 __Pyx_GOTREF(__pyx_t_1);
20732 __Pyx_GIVEREF(__pyx_t_7);
20733 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
20735 __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 510, __pyx_L1_error)
20736 __Pyx_GOTREF(__pyx_t_7);
20737 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_href_token, __pyx_n_s_href_token, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, __pyx_kp_s_Represents_the_href_in_an_ancho); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error)
20738 __Pyx_GOTREF(__pyx_t_2);
20740 /* "lxml/html/diff.py":515
20741 * show the href when it changes. """
20743 * hide_when_equal = True # <<<<<<<<<<<<<<
20747 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_hide_when_equal, Py_True) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
20749 /* "lxml/html/diff.py":517
20750 * hide_when_equal = True
20752 * def html(self): # <<<<<<<<<<<<<<
20753 * return ' Link: %s' % self
20756 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_10href_token_1html, 0, __pyx_n_s_href_token_html, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error)
20757 __Pyx_GOTREF(__pyx_t_9);
20758 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_html, __pyx_t_9) < 0) __PYX_ERR(0, 517, __pyx_L1_error)
20759 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20761 /* "lxml/html/diff.py":510
20762 * return self.html_repr
20764 * class href_token(token): # <<<<<<<<<<<<<<
20766 * """ Represents the href in an anchor tag. Unlike other words, we only
20768 __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_href_token, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L1_error)
20769 __Pyx_GOTREF(__pyx_t_9);
20770 if (PyDict_SetItem(__pyx_d, __pyx_n_s_href_token, __pyx_t_9) < 0) __PYX_ERR(0, 510, __pyx_L1_error)
20771 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20772 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20773 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20774 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20776 /* "lxml/html/diff.py":520
20777 * return ' Link: %s' % self
20779 * def tokenize(html, include_hrefs=True): # <<<<<<<<<<<<<<
20781 * Parse the given HTML and returns token objects (words with attached tags).
20783 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_39tokenize, 0, __pyx_n_s_tokenize, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
20784 __Pyx_GOTREF(__pyx_t_1);
20785 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__76);
20786 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tokenize, __pyx_t_1) < 0) __PYX_ERR(0, 520, __pyx_L1_error)
20787 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20789 /* "lxml/html/diff.py":544
20790 * return fixup_chunks(chunks)
20792 * def parse_html(html, cleanup=True): # <<<<<<<<<<<<<<
20794 * Parses an HTML fragment, returning an lxml element. Note that the HTML will be
20796 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_41parse_html, 0, __pyx_n_s_parse_html, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error)
20797 __Pyx_GOTREF(__pyx_t_1);
20798 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__79);
20799 if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_html, __pyx_t_1) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
20800 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20802 /* "lxml/html/diff.py":557
20803 * return fragment_fromstring(html, create_parent=True)
20805 * _body_re = re.compile(r'<body.*?>', re.I|re.S) # <<<<<<<<<<<<<<
20806 * _end_body_re = re.compile(r'</body.*?>', re.I|re.S)
20807 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
20809 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
20810 __Pyx_GOTREF(__pyx_t_1);
20811 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 557, __pyx_L1_error)
20812 __Pyx_GOTREF(__pyx_t_7);
20813 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20814 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
20815 __Pyx_GOTREF(__pyx_t_1);
20816 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error)
20817 __Pyx_GOTREF(__pyx_t_2);
20818 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20819 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
20820 __Pyx_GOTREF(__pyx_t_1);
20821 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_S); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 557, __pyx_L1_error)
20822 __Pyx_GOTREF(__pyx_t_9);
20823 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20824 __pyx_t_1 = PyNumber_Or(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
20825 __Pyx_GOTREF(__pyx_t_1);
20826 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20827 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20828 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 557, __pyx_L1_error)
20829 __Pyx_GOTREF(__pyx_t_9);
20830 __Pyx_INCREF(__pyx_kp_u_body);
20831 __Pyx_GIVEREF(__pyx_kp_u_body);
20832 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_body);
20833 __Pyx_GIVEREF(__pyx_t_1);
20834 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
20836 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
20837 __Pyx_GOTREF(__pyx_t_1);
20838 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20839 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20840 if (PyDict_SetItem(__pyx_d, __pyx_n_s_body_re, __pyx_t_1) < 0) __PYX_ERR(0, 557, __pyx_L1_error)
20841 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20843 /* "lxml/html/diff.py":558
20845 * _body_re = re.compile(r'<body.*?>', re.I|re.S)
20846 * _end_body_re = re.compile(r'</body.*?>', re.I|re.S) # <<<<<<<<<<<<<<
20847 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
20850 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
20851 __Pyx_GOTREF(__pyx_t_1);
20852 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 558, __pyx_L1_error)
20853 __Pyx_GOTREF(__pyx_t_9);
20854 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20855 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
20856 __Pyx_GOTREF(__pyx_t_1);
20857 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_I); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L1_error)
20858 __Pyx_GOTREF(__pyx_t_7);
20859 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20860 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
20861 __Pyx_GOTREF(__pyx_t_1);
20862 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_S); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
20863 __Pyx_GOTREF(__pyx_t_2);
20864 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20865 __pyx_t_1 = PyNumber_Or(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
20866 __Pyx_GOTREF(__pyx_t_1);
20867 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20868 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20869 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
20870 __Pyx_GOTREF(__pyx_t_2);
20871 __Pyx_INCREF(__pyx_kp_u_body_2);
20872 __Pyx_GIVEREF(__pyx_kp_u_body_2);
20873 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_body_2);
20874 __Pyx_GIVEREF(__pyx_t_1);
20875 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
20877 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
20878 __Pyx_GOTREF(__pyx_t_1);
20879 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20880 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20881 if (PyDict_SetItem(__pyx_d, __pyx_n_s_end_body_re, __pyx_t_1) < 0) __PYX_ERR(0, 558, __pyx_L1_error)
20882 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20884 /* "lxml/html/diff.py":559
20885 * _body_re = re.compile(r'<body.*?>', re.I|re.S)
20886 * _end_body_re = re.compile(r'</body.*?>', re.I|re.S)
20887 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S) # <<<<<<<<<<<<<<
20889 * def cleanup_html(html):
20891 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
20892 __Pyx_GOTREF(__pyx_t_1);
20893 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error)
20894 __Pyx_GOTREF(__pyx_t_2);
20895 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20896 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
20897 __Pyx_GOTREF(__pyx_t_1);
20898 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_I); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 559, __pyx_L1_error)
20899 __Pyx_GOTREF(__pyx_t_9);
20900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20901 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
20902 __Pyx_GOTREF(__pyx_t_1);
20903 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_S); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 559, __pyx_L1_error)
20904 __Pyx_GOTREF(__pyx_t_7);
20905 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20906 __pyx_t_1 = PyNumber_Or(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
20907 __Pyx_GOTREF(__pyx_t_1);
20908 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
20909 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20910 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 559, __pyx_L1_error)
20911 __Pyx_GOTREF(__pyx_t_7);
20912 __Pyx_INCREF(__pyx_kp_u_ins_del);
20913 __Pyx_GIVEREF(__pyx_kp_u_ins_del);
20914 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_ins_del);
20915 __Pyx_GIVEREF(__pyx_t_1);
20916 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
20918 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
20919 __Pyx_GOTREF(__pyx_t_1);
20920 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20921 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20922 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ins_del_re, __pyx_t_1) < 0) __PYX_ERR(0, 559, __pyx_L1_error)
20923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20925 /* "lxml/html/diff.py":561
20926 * _ins_del_re = re.compile(r'</?(ins|del).*?>', re.I|re.S)
20928 * def cleanup_html(html): # <<<<<<<<<<<<<<
20929 * """ This 'cleans' the HTML, meaning that any page structure is removed
20930 * (only the contents of <body> are used, if there is any <body).
20932 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_43cleanup_html, 0, __pyx_n_s_cleanup_html, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
20933 __Pyx_GOTREF(__pyx_t_1);
20934 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_html, __pyx_t_1) < 0) __PYX_ERR(0, 561, __pyx_L1_error)
20935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20937 /* "lxml/html/diff.py":575
20940 * end_whitespace_re = re.compile(r'[ \t\n\r]$') # <<<<<<<<<<<<<<
20942 * def split_trailing_whitespace(word):
20944 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
20945 __Pyx_GOTREF(__pyx_t_1);
20946 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 575, __pyx_L1_error)
20947 __Pyx_GOTREF(__pyx_t_7);
20948 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20949 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
20950 __Pyx_GOTREF(__pyx_t_1);
20951 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20952 if (PyDict_SetItem(__pyx_d, __pyx_n_s_end_whitespace_re, __pyx_t_1) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
20953 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20955 /* "lxml/html/diff.py":577
20956 * end_whitespace_re = re.compile(r'[ \t\n\r]$')
20958 * def split_trailing_whitespace(word): # <<<<<<<<<<<<<<
20960 * This function takes a word, such as 'test\n\n' and returns ('test','\n\n')
20962 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_45split_trailing_whitespace, 0, __pyx_n_s_split_trailing_whitespace, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
20963 __Pyx_GOTREF(__pyx_t_1);
20964 if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_trailing_whitespace, __pyx_t_1) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
20965 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20967 /* "lxml/html/diff.py":585
20970 * def fixup_chunks(chunks): # <<<<<<<<<<<<<<
20972 * This function takes a list of chunks and produces a list of tokens.
20974 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_47fixup_chunks, 0, __pyx_n_s_fixup_chunks, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error)
20975 __Pyx_GOTREF(__pyx_t_1);
20976 if (PyDict_SetItem(__pyx_d, __pyx_n_s_fixup_chunks, __pyx_t_1) < 0) __PYX_ERR(0, 585, __pyx_L1_error)
20977 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20979 /* "lxml/html/diff.py":640
20980 * # All the tags in HTML that don't require end tags:
20982 * 'param', 'img', 'area', 'br', 'basefont', 'input', # <<<<<<<<<<<<<<
20983 * 'base', 'meta', 'link', 'col')
20986 if (PyDict_SetItem(__pyx_d, __pyx_n_s_empty_tags, __pyx_tuple__87) < 0) __PYX_ERR(0, 639, __pyx_L1_error)
20988 /* "lxml/html/diff.py":644
20990 * block_level_tags = (
20991 * 'address', # <<<<<<<<<<<<<<
20995 if (PyDict_SetItem(__pyx_d, __pyx_n_s_block_level_tags, __pyx_tuple__88) < 0) __PYX_ERR(0, 643, __pyx_L1_error)
20997 /* "lxml/html/diff.py":671
20999 * block_level_container_tags = (
21000 * 'dd', # <<<<<<<<<<<<<<
21004 if (PyDict_SetItem(__pyx_d, __pyx_n_s_block_level_container_tags, __pyx_tuple__89) < 0) __PYX_ERR(0, 670, __pyx_L1_error)
21006 /* "lxml/html/diff.py":684
21009 * def flatten_el(el, include_hrefs, skip_tag=False): # <<<<<<<<<<<<<<
21010 * """ Takes an lxml element el, and generates all the text chunks for
21011 * that tag. Each start tag is a chunk, each word is a chunk, and each
21013 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_49flatten_el, 0, __pyx_n_s_flatten_el, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error)
21014 __Pyx_GOTREF(__pyx_t_1);
21015 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__91);
21016 if (PyDict_SetItem(__pyx_d, __pyx_n_s_flatten_el, __pyx_t_1) < 0) __PYX_ERR(0, 684, __pyx_L1_error)
21017 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21019 /* "lxml/html/diff.py":712
21020 * yield html_escape(word)
21022 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U) # <<<<<<<<<<<<<<
21024 * def split_words(text):
21026 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
21027 __Pyx_GOTREF(__pyx_t_1);
21028 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_compile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 712, __pyx_L1_error)
21029 __Pyx_GOTREF(__pyx_t_7);
21030 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21031 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
21032 __Pyx_GOTREF(__pyx_t_1);
21033 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_U); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
21034 __Pyx_GOTREF(__pyx_t_2);
21035 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21036 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
21037 __Pyx_GOTREF(__pyx_t_1);
21038 __Pyx_INCREF(__pyx_kp_u_S_s);
21039 __Pyx_GIVEREF(__pyx_kp_u_S_s);
21040 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_S_s);
21041 __Pyx_GIVEREF(__pyx_t_2);
21042 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
21044 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
21045 __Pyx_GOTREF(__pyx_t_2);
21046 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21047 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21048 if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_words_re, __pyx_t_2) < 0) __PYX_ERR(0, 712, __pyx_L1_error)
21049 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21051 /* "lxml/html/diff.py":714
21052 * split_words_re = re.compile(r'\S+(?:\s+|$)', re.U)
21054 * def split_words(text): # <<<<<<<<<<<<<<
21055 * """ Splits some text into words. Includes trailing whitespace
21056 * on each word when appropriate. """
21058 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_52split_words, 0, __pyx_n_s_split_words, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
21059 __Pyx_GOTREF(__pyx_t_2);
21060 if (PyDict_SetItem(__pyx_d, __pyx_n_s_split_words, __pyx_t_2) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
21061 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21063 /* "lxml/html/diff.py":723
21066 * start_whitespace_re = re.compile(r'^[ \t\n\r]') # <<<<<<<<<<<<<<
21068 * def start_tag(el):
21070 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
21071 __Pyx_GOTREF(__pyx_t_2);
21072 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error)
21073 __Pyx_GOTREF(__pyx_t_1);
21074 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21075 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
21076 __Pyx_GOTREF(__pyx_t_2);
21077 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21078 if (PyDict_SetItem(__pyx_d, __pyx_n_s_start_whitespace_re, __pyx_t_2) < 0) __PYX_ERR(0, 723, __pyx_L1_error)
21079 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21081 /* "lxml/html/diff.py":725
21082 * start_whitespace_re = re.compile(r'^[ \t\n\r]')
21084 * def start_tag(el): # <<<<<<<<<<<<<<
21086 * The text representation of the start tag for a tag.
21088 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_54start_tag, 0, __pyx_n_s_start_tag, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
21089 __Pyx_GOTREF(__pyx_t_2);
21090 if (PyDict_SetItem(__pyx_d, __pyx_n_s_start_tag, __pyx_t_2) < 0) __PYX_ERR(0, 725, __pyx_L1_error)
21091 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21093 /* "lxml/html/diff.py":733
21094 * for name, value in el.attrib.items()]))
21096 * def end_tag(el): # <<<<<<<<<<<<<<
21097 * """ The text representation of an end tag for a tag. Includes
21098 * trailing whitespace when appropriate. """
21100 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_56end_tag, 0, __pyx_n_s_end_tag, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
21101 __Pyx_GOTREF(__pyx_t_2);
21102 if (PyDict_SetItem(__pyx_d, __pyx_n_s_end_tag, __pyx_t_2) < 0) __PYX_ERR(0, 733, __pyx_L1_error)
21103 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21105 /* "lxml/html/diff.py":742
21106 * return '</%s>%s' % (el.tag, extra)
21108 * def is_word(tok): # <<<<<<<<<<<<<<
21109 * return not tok.startswith('<')
21112 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_58is_word, 0, __pyx_n_s_is_word, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
21113 __Pyx_GOTREF(__pyx_t_2);
21114 if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_word, __pyx_t_2) < 0) __PYX_ERR(0, 742, __pyx_L1_error)
21115 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21117 /* "lxml/html/diff.py":745
21118 * return not tok.startswith('<')
21120 * def is_end_tag(tok): # <<<<<<<<<<<<<<
21121 * return tok.startswith('</')
21124 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_60is_end_tag, 0, __pyx_n_s_is_end_tag, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
21125 __Pyx_GOTREF(__pyx_t_2);
21126 if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_end_tag, __pyx_t_2) < 0) __PYX_ERR(0, 745, __pyx_L1_error)
21127 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21129 /* "lxml/html/diff.py":748
21130 * return tok.startswith('</')
21132 * def is_start_tag(tok): # <<<<<<<<<<<<<<
21133 * return tok.startswith('<') and not tok.startswith('</')
21136 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_62is_start_tag, 0, __pyx_n_s_is_start_tag, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
21137 __Pyx_GOTREF(__pyx_t_2);
21138 if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_start_tag, __pyx_t_2) < 0) __PYX_ERR(0, 748, __pyx_L1_error)
21139 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21141 /* "lxml/html/diff.py":751
21142 * return tok.startswith('<') and not tok.startswith('</')
21144 * def fixup_ins_del_tags(html): # <<<<<<<<<<<<<<
21145 * """ Given an html string, move any <ins> or <del> tags inside of any
21146 * block-level elements, e.g. transform <ins><p>word</p></ins> to
21148 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_64fixup_ins_del_tags, 0, __pyx_n_s_fixup_ins_del_tags, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__106)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error)
21149 __Pyx_GOTREF(__pyx_t_2);
21150 if (PyDict_SetItem(__pyx_d, __pyx_n_s_fixup_ins_del_tags, __pyx_t_2) < 0) __PYX_ERR(0, 751, __pyx_L1_error)
21151 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21153 /* "lxml/html/diff.py":760
21156 * def serialize_html_fragment(el, skip_outer=False): # <<<<<<<<<<<<<<
21157 * """ Serialize a single lxml element as HTML. The serialized form
21158 * includes the elements tail.
21160 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_66serialize_html_fragment, 0, __pyx_n_s_serialize_html_fragment, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
21161 __Pyx_GOTREF(__pyx_t_2);
21162 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__109);
21163 if (PyDict_SetItem(__pyx_d, __pyx_n_s_serialize_html_fragment, __pyx_t_2) < 0) __PYX_ERR(0, 760, __pyx_L1_error)
21164 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21166 /* "lxml/html/diff.py":778
21169 * def _fixup_ins_del_tags(doc): # <<<<<<<<<<<<<<
21170 * """fixup_ins_del_tags that works on an lxml document in-place
21173 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_68_fixup_ins_del_tags, 0, __pyx_n_s_fixup_ins_del_tags_2, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
21174 __Pyx_GOTREF(__pyx_t_2);
21175 if (PyDict_SetItem(__pyx_d, __pyx_n_s_fixup_ins_del_tags_2, __pyx_t_2) < 0) __PYX_ERR(0, 778, __pyx_L1_error)
21176 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21178 /* "lxml/html/diff.py":789
21179 * #_merge_element_contents(el)
21181 * def _contains_block_level_tag(el): # <<<<<<<<<<<<<<
21182 * """True if the element contains any block-level elements, like <p>, <td>, etc.
21185 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_70_contains_block_level_tag, 0, __pyx_n_s_contains_block_level_tag, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
21186 __Pyx_GOTREF(__pyx_t_2);
21187 if (PyDict_SetItem(__pyx_d, __pyx_n_s_contains_block_level_tag, __pyx_t_2) < 0) __PYX_ERR(0, 789, __pyx_L1_error)
21188 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21190 /* "lxml/html/diff.py":799
21193 * def _move_el_inside_block(el, tag): # <<<<<<<<<<<<<<
21194 * """ helper for _fixup_ins_del_tags; actually takes the <ins> etc tags
21195 * and moves them inside any block-level tags. """
21197 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_72_move_el_inside_block, 0, __pyx_n_s_move_el_inside_block, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
21198 __Pyx_GOTREF(__pyx_t_2);
21199 if (PyDict_SetItem(__pyx_d, __pyx_n_s_move_el_inside_block, __pyx_t_2) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
21200 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21202 /* "lxml/html/diff.py":831
21203 * el.insert(0, text_tag)
21205 * def _merge_element_contents(el): # <<<<<<<<<<<<<<
21207 * Removes an element, but merges its contents into its place, e.g.,
21209 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_74_merge_element_contents, 0, __pyx_n_s_merge_element_contents, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__117)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
21210 __Pyx_GOTREF(__pyx_t_2);
21211 if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_element_contents, __pyx_t_2) < 0) __PYX_ERR(0, 831, __pyx_L1_error)
21212 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21214 /* "lxml/html/diff.py":865
21215 * parent[index:index+1] = el.getchildren()
21217 * class InsensitiveSequenceMatcher(difflib.SequenceMatcher): # <<<<<<<<<<<<<<
21219 * Acts like SequenceMatcher, but tries not to find very small equal
21221 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_difflib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error)
21222 __Pyx_GOTREF(__pyx_t_2);
21223 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SequenceMatcher); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
21224 __Pyx_GOTREF(__pyx_t_1);
21225 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21226 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error)
21227 __Pyx_GOTREF(__pyx_t_2);
21228 __Pyx_GIVEREF(__pyx_t_1);
21229 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
21231 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
21232 __Pyx_GOTREF(__pyx_t_1);
21233 __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_InsensitiveSequenceMatcher, __pyx_n_s_InsensitiveSequenceMatcher, (PyObject *) NULL, __pyx_n_s_lxml_html_diff, __pyx_kp_s_Acts_like_SequenceMatcher_but_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 865, __pyx_L1_error)
21234 __Pyx_GOTREF(__pyx_t_7);
21236 /* "lxml/html/diff.py":871
21239 * threshold = 2 # <<<<<<<<<<<<<<
21241 * def get_matching_blocks(self):
21243 if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_threshold, __pyx_int_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
21245 /* "lxml/html/diff.py":873
21248 * def get_matching_blocks(self): # <<<<<<<<<<<<<<
21249 * size = min(len(self.b), len(self.b))
21250 * threshold = min(self.threshold, size / 4)
21252 __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_4lxml_4html_4diff_26InsensitiveSequenceMatcher_1get_matching_blocks, 0, __pyx_n_s_InsensitiveSequenceMatcher_get_m, NULL, __pyx_n_s_lxml_html_diff, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 873, __pyx_L1_error)
21253 __Pyx_GOTREF(__pyx_t_9);
21254 if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_matching_blocks, __pyx_t_9) < 0) __PYX_ERR(0, 873, __pyx_L1_error)
21255 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
21257 /* "lxml/html/diff.py":865
21258 * parent[index:index+1] = el.getchildren()
21260 * class InsensitiveSequenceMatcher(difflib.SequenceMatcher): # <<<<<<<<<<<<<<
21262 * Acts like SequenceMatcher, but tries not to find very small equal
21264 __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_InsensitiveSequenceMatcher, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 865, __pyx_L1_error)
21265 __Pyx_GOTREF(__pyx_t_9);
21266 if (PyDict_SetItem(__pyx_d, __pyx_n_s_InsensitiveSequenceMatcher, __pyx_t_9) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
21267 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
21268 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21269 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21270 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21272 /* "lxml/html/diff.py":881
21275 * if __name__ == '__main__': # <<<<<<<<<<<<<<
21276 * from lxml.html import _diffcommand
21277 * _diffcommand.main()
21279 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
21280 __Pyx_GOTREF(__pyx_t_2);
21281 __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_u_main, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 881, __pyx_L1_error)
21282 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21285 /* "lxml/html/diff.py":882
21287 * if __name__ == '__main__':
21288 * from lxml.html import _diffcommand # <<<<<<<<<<<<<<
21289 * _diffcommand.main()
21292 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
21293 __Pyx_GOTREF(__pyx_t_2);
21294 __Pyx_INCREF(__pyx_n_s_diffcommand);
21295 __Pyx_GIVEREF(__pyx_n_s_diffcommand);
21296 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_diffcommand);
21297 __pyx_t_1 = __Pyx_Import(__pyx_n_s_lxml_html, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
21298 __Pyx_GOTREF(__pyx_t_1);
21299 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21300 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_diffcommand); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
21301 __Pyx_GOTREF(__pyx_t_2);
21302 if (PyDict_SetItem(__pyx_d, __pyx_n_s_diffcommand, __pyx_t_2) < 0) __PYX_ERR(0, 882, __pyx_L1_error)
21303 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21304 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21306 /* "lxml/html/diff.py":883
21307 * if __name__ == '__main__':
21308 * from lxml.html import _diffcommand
21309 * _diffcommand.main() # <<<<<<<<<<<<<<
21312 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_diffcommand); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
21313 __Pyx_GOTREF(__pyx_t_1);
21314 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_main_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error)
21315 __Pyx_GOTREF(__pyx_t_2);
21316 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21317 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
21318 __Pyx_GOTREF(__pyx_t_1);
21319 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21320 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21322 /* "lxml/html/diff.py":881
21325 * if __name__ == '__main__': # <<<<<<<<<<<<<<
21326 * from lxml.html import _diffcommand
21327 * _diffcommand.main()
21331 /* "lxml/html/diff.py":1
21332 * # cython: language_level=3 # <<<<<<<<<<<<<<
21334 * from __future__ import absolute_import
21336 __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21337 __Pyx_GOTREF(__pyx_t_1);
21338 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_html_annotate_line_35, __pyx_kp_u_doclist_should_be_ordered_from) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21339 if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_locate_unbalanced_start_line_365, __pyx_kp_u_pre_delete_and_post_delete_impl) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21340 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21343 /*--- Wrapped vars code ---*/
21345 if (__Pyx_RegisterCleanup()) __PYX_ERR(0, 1, __pyx_L1_error);
21348 __Pyx_XDECREF(__pyx_t_1);
21349 __Pyx_XDECREF(__pyx_t_2);
21350 __Pyx_XDECREF(__pyx_t_7);
21351 __Pyx_XDECREF(__pyx_t_8);
21352 __Pyx_XDECREF(__pyx_t_9);
21355 __Pyx_AddTraceback("init lxml.html.diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
21358 } else if (!PyErr_Occurred()) {
21359 PyErr_SetString(PyExc_ImportError, "init lxml.html.diff");
21362 __Pyx_RefNannyFinishContext();
21363 #if CYTHON_PEP489_MULTI_PHASE_INIT
21364 return (__pyx_m != NULL) ? 0 : -1;
21365 #elif PY_MAJOR_VERSION >= 3
21372 static CYTHON_SMALL_CODE void __Pyx_CleanupGlobals(void) {
21373 Py_CLEAR(__pyx_slice__3);
21374 Py_CLEAR(__pyx_codeobj__4);
21375 Py_CLEAR(__pyx_codeobj__5);
21376 Py_CLEAR(__pyx_slice__7);
21377 Py_CLEAR(__pyx_tuple__16);
21378 Py_CLEAR(__pyx_codeobj__17);
21379 Py_CLEAR(__pyx_tuple__21);
21380 Py_CLEAR(__pyx_slice__22);
21381 Py_CLEAR(__pyx_tuple__23);
21382 Py_CLEAR(__pyx_codeobj__24);
21383 Py_CLEAR(__pyx_tuple__25);
21384 Py_CLEAR(__pyx_codeobj__26);
21385 Py_CLEAR(__pyx_tuple__27);
21386 Py_CLEAR(__pyx_codeobj__28);
21387 Py_CLEAR(__pyx_tuple__29);
21388 Py_CLEAR(__pyx_codeobj__30);
21389 Py_CLEAR(__pyx_tuple__31);
21390 Py_CLEAR(__pyx_codeobj__32);
21391 Py_CLEAR(__pyx_tuple__33);
21392 Py_CLEAR(__pyx_codeobj__34);
21393 Py_CLEAR(__pyx_tuple__35);
21394 Py_CLEAR(__pyx_codeobj__36);
21395 Py_CLEAR(__pyx_tuple__37);
21396 Py_CLEAR(__pyx_tuple__38);
21397 Py_CLEAR(__pyx_codeobj__39);
21398 Py_CLEAR(__pyx_tuple__40);
21399 Py_CLEAR(__pyx_codeobj__41);
21400 Py_CLEAR(__pyx_tuple__42);
21401 Py_CLEAR(__pyx_tuple__43);
21402 Py_CLEAR(__pyx_tuple__44);
21403 Py_CLEAR(__pyx_codeobj__45);
21404 Py_CLEAR(__pyx_tuple__46);
21405 Py_CLEAR(__pyx_codeobj__47);
21406 Py_CLEAR(__pyx_tuple__48);
21407 Py_CLEAR(__pyx_codeobj__49);
21408 Py_CLEAR(__pyx_tuple__50);
21409 Py_CLEAR(__pyx_codeobj__51);
21410 Py_CLEAR(__pyx_tuple__52);
21411 Py_CLEAR(__pyx_codeobj__53);
21412 Py_CLEAR(__pyx_tuple__54);
21413 Py_CLEAR(__pyx_codeobj__55);
21414 Py_CLEAR(__pyx_tuple__56);
21415 Py_CLEAR(__pyx_codeobj__57);
21416 Py_CLEAR(__pyx_tuple__58);
21417 Py_CLEAR(__pyx_codeobj__59);
21418 Py_CLEAR(__pyx_tuple__60);
21419 Py_CLEAR(__pyx_tuple__61);
21420 Py_CLEAR(__pyx_codeobj__62);
21421 Py_CLEAR(__pyx_tuple__63);
21422 Py_CLEAR(__pyx_codeobj__64);
21423 Py_CLEAR(__pyx_tuple__65);
21424 Py_CLEAR(__pyx_codeobj__66);
21425 Py_CLEAR(__pyx_tuple__67);
21426 Py_CLEAR(__pyx_tuple__68);
21427 Py_CLEAR(__pyx_codeobj__69);
21428 Py_CLEAR(__pyx_tuple__70);
21429 Py_CLEAR(__pyx_codeobj__71);
21430 Py_CLEAR(__pyx_tuple__72);
21431 Py_CLEAR(__pyx_codeobj__73);
21432 Py_CLEAR(__pyx_tuple__74);
21433 Py_CLEAR(__pyx_codeobj__75);
21434 Py_CLEAR(__pyx_tuple__76);
21435 Py_CLEAR(__pyx_tuple__77);
21436 Py_CLEAR(__pyx_codeobj__78);
21437 Py_CLEAR(__pyx_tuple__79);
21438 Py_CLEAR(__pyx_tuple__80);
21439 Py_CLEAR(__pyx_codeobj__81);
21440 Py_CLEAR(__pyx_tuple__82);
21441 Py_CLEAR(__pyx_tuple__83);
21442 Py_CLEAR(__pyx_codeobj__84);
21443 Py_CLEAR(__pyx_tuple__85);
21444 Py_CLEAR(__pyx_codeobj__86);
21445 Py_CLEAR(__pyx_tuple__87);
21446 Py_CLEAR(__pyx_tuple__88);
21447 Py_CLEAR(__pyx_tuple__89);
21448 Py_CLEAR(__pyx_tuple__90);
21449 Py_CLEAR(__pyx_tuple__91);
21450 Py_CLEAR(__pyx_tuple__92);
21451 Py_CLEAR(__pyx_codeobj__93);
21452 Py_CLEAR(__pyx_tuple__94);
21453 Py_CLEAR(__pyx_tuple__95);
21454 Py_CLEAR(__pyx_codeobj__96);
21455 Py_CLEAR(__pyx_tuple__97);
21456 Py_CLEAR(__pyx_codeobj__98);
21457 Py_CLEAR(__pyx_tuple__99);
21458 Py_CLEAR(__pyx_codeobj__100);
21459 Py_CLEAR(__pyx_tuple__101);
21460 Py_CLEAR(__pyx_codeobj__102);
21461 Py_CLEAR(__pyx_tuple__103);
21462 Py_CLEAR(__pyx_codeobj__104);
21463 Py_CLEAR(__pyx_tuple__105);
21464 Py_CLEAR(__pyx_codeobj__106);
21465 Py_CLEAR(__pyx_tuple__107);
21466 Py_CLEAR(__pyx_codeobj__108);
21467 Py_CLEAR(__pyx_tuple__109);
21468 Py_CLEAR(__pyx_tuple__110);
21469 Py_CLEAR(__pyx_codeobj__111);
21470 Py_CLEAR(__pyx_tuple__112);
21471 Py_CLEAR(__pyx_codeobj__113);
21472 Py_CLEAR(__pyx_tuple__114);
21473 Py_CLEAR(__pyx_codeobj__115);
21474 Py_CLEAR(__pyx_tuple__116);
21475 Py_CLEAR(__pyx_codeobj__117);
21476 Py_CLEAR(__pyx_tuple__118);
21477 Py_CLEAR(__pyx_codeobj__119);
21478 /* CodeObjectCache.cleanup */
21479 if (__pyx_code_cache.entries) {
21480 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
21481 int i, count = __pyx_code_cache.count;
21482 __pyx_code_cache.count = 0;
21483 __pyx_code_cache.max_count = 0;
21484 __pyx_code_cache.entries = NULL;
21485 for (i=0; i<count; i++) {
21486 Py_DECREF(entries[i].code_object);
21488 PyMem_Free(entries);
21491 Py_CLEAR(__pyx_umethod_PyList_Type_pop.method);
21493 static void __pyx_module_cleanup(CYTHON_UNUSED PyObject *self) {
21494 /*--- Global cleanup code ---*/
21495 __Pyx_CleanupGlobals();
21496 /*--- Type import cleanup code ---*/
21497 /*--- Builtin cleanup code ---*/
21498 Py_CLEAR(__pyx_builtin_ImportError);
21499 Py_CLEAR(__pyx_builtin_NameError);
21500 Py_CLEAR(__pyx_builtin_zip);
21501 Py_CLEAR(__pyx_builtin_ValueError);
21502 /*--- Intern cleanup code ---*/
21503 Py_CLEAR(__pyx_empty_tuple);
21504 while (__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens > 0) {
21505 PyObject* o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct__markup_serialize_tokens];
21506 (*Py_TYPE(o)->tp_free)(o);
21508 while (__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens > 0) {
21509 PyObject* o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_1_expand_tokens];
21510 (*Py_TYPE(o)->tp_free)(o);
21512 while (__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el > 0) {
21513 PyObject* o = (PyObject*)__pyx_freelist_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el[--__pyx_freecount_4lxml_4html_4diff___pyx_scope_struct_2_flatten_el];
21514 (*Py_TYPE(o)->tp_free)(o);
21517 Py_CLEAR(__pyx_cython_runtime);
21521 /* --- Runtime support code --- */
21523 #if CYTHON_REFNANNY
21524 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
21525 PyObject *m = NULL, *p = NULL;
21527 m = PyImport_ImportModule(modname);
21529 p = PyObject_GetAttrString(m, "RefNannyAPI");
21531 r = PyLong_AsVoidPtr(p);
21535 return (__Pyx_RefNannyAPIStruct *)r;
21539 /* PyObjectGetAttrStr */
21540 #if CYTHON_USE_TYPE_SLOTS
21541 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
21542 PyTypeObject* tp = Py_TYPE(obj);
21543 if (likely(tp->tp_getattro))
21544 return tp->tp_getattro(obj, attr_name);
21545 #if PY_MAJOR_VERSION < 3
21546 if (likely(tp->tp_getattr))
21547 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
21549 return PyObject_GetAttr(obj, attr_name);
21553 /* GetBuiltinName */
21554 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
21555 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
21556 if (unlikely(!result)) {
21557 PyErr_Format(PyExc_NameError,
21558 #if PY_MAJOR_VERSION >= 3
21559 "name '%U' is not defined", name);
21561 "name '%.200s' is not defined", PyString_AS_STRING(name));
21567 /* RaiseArgTupleInvalid */
21568 static void __Pyx_RaiseArgtupleInvalid(
21569 const char* func_name,
21571 Py_ssize_t num_min,
21572 Py_ssize_t num_max,
21573 Py_ssize_t num_found)
21575 Py_ssize_t num_expected;
21576 const char *more_or_less;
21577 if (num_found < num_min) {
21578 num_expected = num_min;
21579 more_or_less = "at least";
21581 num_expected = num_max;
21582 more_or_less = "at most";
21585 more_or_less = "exactly";
21587 PyErr_Format(PyExc_TypeError,
21588 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
21589 func_name, more_or_less, num_expected,
21590 (num_expected == 1) ? "" : "s", num_found);
21593 /* RaiseDoubleKeywords */
21594 static void __Pyx_RaiseDoubleKeywordsError(
21595 const char* func_name,
21598 PyErr_Format(PyExc_TypeError,
21599 #if PY_MAJOR_VERSION >= 3
21600 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
21602 "%s() got multiple values for keyword argument '%s'", func_name,
21603 PyString_AsString(kw_name));
21607 /* ParseKeywords */
21608 static int __Pyx_ParseOptionalKeywords(
21610 PyObject **argnames[],
21612 PyObject *values[],
21613 Py_ssize_t num_pos_args,
21614 const char* function_name)
21616 PyObject *key = 0, *value = 0;
21617 Py_ssize_t pos = 0;
21619 PyObject*** first_kw_arg = argnames + num_pos_args;
21620 while (PyDict_Next(kwds, &pos, &key, &value)) {
21621 name = first_kw_arg;
21622 while (*name && (**name != key)) name++;
21624 values[name-argnames] = value;
21627 name = first_kw_arg;
21628 #if PY_MAJOR_VERSION < 3
21629 if (likely(PyString_Check(key))) {
21631 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
21632 && _PyString_Eq(**name, key)) {
21633 values[name-argnames] = value;
21638 if (*name) continue;
21640 PyObject*** argname = argnames;
21641 while (argname != first_kw_arg) {
21642 if ((**argname == key) || (
21643 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
21644 && _PyString_Eq(**argname, key))) {
21645 goto arg_passed_twice;
21652 if (likely(PyUnicode_Check(key))) {
21654 int cmp = (**name == key) ? 0 :
21655 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21656 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21658 PyUnicode_Compare(**name, key);
21659 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21661 values[name-argnames] = value;
21666 if (*name) continue;
21668 PyObject*** argname = argnames;
21669 while (argname != first_kw_arg) {
21670 int cmp = (**argname == key) ? 0 :
21671 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21672 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21674 PyUnicode_Compare(**argname, key);
21675 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21676 if (cmp == 0) goto arg_passed_twice;
21681 goto invalid_keyword_type;
21683 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
21685 goto invalid_keyword;
21690 __Pyx_RaiseDoubleKeywordsError(function_name, key);
21692 invalid_keyword_type:
21693 PyErr_Format(PyExc_TypeError,
21694 "%.200s() keywords must be strings", function_name);
21697 PyErr_Format(PyExc_TypeError,
21698 #if PY_MAJOR_VERSION < 3
21699 "%.200s() got an unexpected keyword argument '%.200s'",
21700 function_name, PyString_AsString(key));
21702 "%s() got an unexpected keyword argument '%U'",
21703 function_name, key);
21709 /* PyDictVersioning */
21710 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
21711 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
21712 PyObject *dict = Py_TYPE(obj)->tp_dict;
21713 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
21715 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
21716 PyObject **dictptr = NULL;
21717 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
21719 #if CYTHON_COMPILING_IN_CPYTHON
21720 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
21722 dictptr = _PyObject_GetDictPtr(obj);
21725 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
21727 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
21728 PyObject *dict = Py_TYPE(obj)->tp_dict;
21729 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
21731 return obj_dict_version == __Pyx_get_object_dict_version(obj);
21735 /* GetModuleGlobalName */
21736 #if CYTHON_USE_DICT_VERSIONS
21737 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
21739 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
21743 #if !CYTHON_AVOID_BORROWED_REFS
21744 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
21745 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
21746 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21747 if (likely(result)) {
21748 return __Pyx_NewRef(result);
21749 } else if (unlikely(PyErr_Occurred())) {
21753 result = PyDict_GetItem(__pyx_d, name);
21754 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21755 if (likely(result)) {
21756 return __Pyx_NewRef(result);
21760 result = PyObject_GetItem(__pyx_d, name);
21761 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21762 if (likely(result)) {
21763 return __Pyx_NewRef(result);
21767 return __Pyx_GetBuiltinName(name);
21770 /* PyCFunctionFastCall */
21771 #if CYTHON_FAST_PYCCALL
21772 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
21773 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
21774 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
21775 PyObject *self = PyCFunction_GET_SELF(func);
21776 int flags = PyCFunction_GET_FLAGS(func);
21777 assert(PyCFunction_Check(func));
21778 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
21779 assert(nargs >= 0);
21780 assert(nargs == 0 || args != NULL);
21781 /* _PyCFunction_FastCallDict() must not be called with an exception set,
21782 because it may clear it (directly or indirectly) and so the
21783 caller loses its exception */
21784 assert(!PyErr_Occurred());
21785 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
21786 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
21788 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
21793 /* PyFunctionFastCall */
21794 #if CYTHON_FAST_PYCALL
21795 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
21796 PyObject *globals) {
21798 PyThreadState *tstate = __Pyx_PyThreadState_Current;
21799 PyObject **fastlocals;
21802 assert(globals != NULL);
21803 /* XXX Perhaps we should create a specialized
21804 PyFrame_New() that doesn't take locals, but does
21805 take builtins without sanity checking them.
21807 assert(tstate != NULL);
21808 f = PyFrame_New(tstate, co, globals, NULL);
21812 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
21813 for (i = 0; i < na; i++) {
21815 fastlocals[i] = *args++;
21817 result = PyEval_EvalFrameEx(f,0);
21818 ++tstate->recursion_depth;
21820 --tstate->recursion_depth;
21823 #if 1 || PY_VERSION_HEX < 0x030600B1
21824 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
21825 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
21826 PyObject *globals = PyFunction_GET_GLOBALS(func);
21827 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
21829 #if PY_MAJOR_VERSION >= 3
21832 PyObject *kwtuple, **k;
21837 assert(kwargs == NULL || PyDict_Check(kwargs));
21838 nk = kwargs ? PyDict_Size(kwargs) : 0;
21839 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
21843 #if PY_MAJOR_VERSION >= 3
21844 co->co_kwonlyargcount == 0 &&
21846 likely(kwargs == NULL || nk == 0) &&
21847 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
21848 if (argdefs == NULL && co->co_argcount == nargs) {
21849 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
21852 else if (nargs == 0 && argdefs != NULL
21853 && co->co_argcount == Py_SIZE(argdefs)) {
21854 /* function called with no arguments, but all parameters have
21855 a default value: use default values as arguments .*/
21856 args = &PyTuple_GET_ITEM(argdefs, 0);
21857 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
21861 if (kwargs != NULL) {
21863 kwtuple = PyTuple_New(2 * nk);
21864 if (kwtuple == NULL) {
21868 k = &PyTuple_GET_ITEM(kwtuple, 0);
21870 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
21881 closure = PyFunction_GET_CLOSURE(func);
21882 #if PY_MAJOR_VERSION >= 3
21883 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
21885 if (argdefs != NULL) {
21886 d = &PyTuple_GET_ITEM(argdefs, 0);
21887 nd = Py_SIZE(argdefs);
21893 #if PY_MAJOR_VERSION >= 3
21894 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
21897 d, (int)nd, kwdefs, closure);
21899 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
21902 d, (int)nd, closure);
21904 Py_XDECREF(kwtuple);
21906 Py_LeaveRecursiveCall();
21913 #if CYTHON_COMPILING_IN_CPYTHON
21914 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
21916 ternaryfunc call = func->ob_type->tp_call;
21917 if (unlikely(!call))
21918 return PyObject_Call(func, arg, kw);
21919 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21921 result = (*call)(func, arg, kw);
21922 Py_LeaveRecursiveCall();
21923 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21926 "NULL result without error in PyObject_Call");
21932 /* PyObjectCall2Args */
21933 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
21934 PyObject *args, *result = NULL;
21935 #if CYTHON_FAST_PYCALL
21936 if (PyFunction_Check(function)) {
21937 PyObject *args[2] = {arg1, arg2};
21938 return __Pyx_PyFunction_FastCall(function, args, 2);
21941 #if CYTHON_FAST_PYCCALL
21942 if (__Pyx_PyFastCFunction_Check(function)) {
21943 PyObject *args[2] = {arg1, arg2};
21944 return __Pyx_PyCFunction_FastCall(function, args, 2);
21947 args = PyTuple_New(2);
21948 if (unlikely(!args)) goto done;
21950 PyTuple_SET_ITEM(args, 0, arg1);
21952 PyTuple_SET_ITEM(args, 1, arg2);
21953 Py_INCREF(function);
21954 result = __Pyx_PyObject_Call(function, args, NULL);
21956 Py_DECREF(function);
21961 /* PyObjectCallMethO */
21962 #if CYTHON_COMPILING_IN_CPYTHON
21963 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
21964 PyObject *self, *result;
21966 cfunc = PyCFunction_GET_FUNCTION(func);
21967 self = PyCFunction_GET_SELF(func);
21968 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21970 result = cfunc(self, arg);
21971 Py_LeaveRecursiveCall();
21972 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21975 "NULL result without error in PyObject_Call");
21981 /* PyObjectCallOneArg */
21982 #if CYTHON_COMPILING_IN_CPYTHON
21983 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21985 PyObject *args = PyTuple_New(1);
21986 if (unlikely(!args)) return NULL;
21988 PyTuple_SET_ITEM(args, 0, arg);
21989 result = __Pyx_PyObject_Call(func, args, NULL);
21993 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21994 #if CYTHON_FAST_PYCALL
21995 if (PyFunction_Check(func)) {
21996 return __Pyx_PyFunction_FastCall(func, &arg, 1);
21999 if (likely(PyCFunction_Check(func))) {
22000 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22001 return __Pyx_PyObject_CallMethO(func, arg);
22002 #if CYTHON_FAST_PYCCALL
22003 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
22004 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22008 return __Pyx__PyObject_CallOneArg(func, arg);
22011 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22013 PyObject *args = PyTuple_Pack(1, arg);
22014 if (unlikely(!args)) return NULL;
22015 result = __Pyx_PyObject_Call(func, args, NULL);
22021 /* PyObjectFormatAndDecref */
22022 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
22023 if (unlikely(!s)) return NULL;
22024 if (likely(PyUnicode_CheckExact(s))) return s;
22025 #if PY_MAJOR_VERSION < 3
22026 if (likely(PyString_CheckExact(s))) {
22027 PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
22032 return __Pyx_PyObject_FormatAndDecref(s, f);
22034 static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
22035 PyObject *result = PyObject_Format(s, f);
22040 /* JoinPyUnicode */
22041 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
22042 CYTHON_UNUSED Py_UCS4 max_char) {
22043 #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22044 PyObject *result_uval;
22046 Py_ssize_t i, char_pos;
22047 void *result_udata;
22048 #if CYTHON_PEP393_ENABLED
22049 result_uval = PyUnicode_New(result_ulength, max_char);
22050 if (unlikely(!result_uval)) return NULL;
22051 result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
22052 result_udata = PyUnicode_DATA(result_uval);
22054 result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
22055 if (unlikely(!result_uval)) return NULL;
22056 result_ukind = sizeof(Py_UNICODE);
22057 result_udata = PyUnicode_AS_UNICODE(result_uval);
22060 for (i=0; i < value_count; i++) {
22062 Py_ssize_t ulength;
22064 PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
22065 if (unlikely(__Pyx_PyUnicode_READY(uval)))
22067 ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
22068 if (unlikely(!ulength))
22070 if (unlikely(char_pos + ulength < 0))
22072 ukind = __Pyx_PyUnicode_KIND(uval);
22073 udata = __Pyx_PyUnicode_DATA(uval);
22074 if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
22075 memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
22077 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
22078 _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
22081 for (j=0; j < ulength; j++) {
22082 Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
22083 __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
22087 char_pos += ulength;
22089 return result_uval;
22091 PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
22093 Py_DECREF(result_uval);
22098 return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
22102 /* RaiseTooManyValuesToUnpack */
22103 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
22104 PyErr_Format(PyExc_ValueError,
22105 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
22108 /* RaiseNeedMoreValuesToUnpack */
22109 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
22110 PyErr_Format(PyExc_ValueError,
22111 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
22112 index, (index == 1) ? "" : "s");
22116 static CYTHON_INLINE int __Pyx_IterFinish(void) {
22117 #if CYTHON_FAST_THREAD_STATE
22118 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22119 PyObject* exc_type = tstate->curexc_type;
22120 if (unlikely(exc_type)) {
22121 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
22122 PyObject *exc_value, *exc_tb;
22123 exc_value = tstate->curexc_value;
22124 exc_tb = tstate->curexc_traceback;
22125 tstate->curexc_type = 0;
22126 tstate->curexc_value = 0;
22127 tstate->curexc_traceback = 0;
22128 Py_DECREF(exc_type);
22129 Py_XDECREF(exc_value);
22130 Py_XDECREF(exc_tb);
22138 if (unlikely(PyErr_Occurred())) {
22139 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
22150 /* UnpackItemEndCheck */
22151 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
22152 if (unlikely(retval)) {
22154 __Pyx_RaiseTooManyValuesError(expected);
22157 return __Pyx_IterFinish();
22163 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
22165 if (!j) return NULL;
22166 r = PyObject_GetItem(o, j);
22170 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
22171 CYTHON_NCP_UNUSED int wraparound,
22172 CYTHON_NCP_UNUSED int boundscheck) {
22173 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22174 Py_ssize_t wrapped_i = i;
22175 if (wraparound & unlikely(i < 0)) {
22176 wrapped_i += PyList_GET_SIZE(o);
22178 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
22179 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
22183 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22185 return PySequence_GetItem(o, i);
22188 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
22189 CYTHON_NCP_UNUSED int wraparound,
22190 CYTHON_NCP_UNUSED int boundscheck) {
22191 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22192 Py_ssize_t wrapped_i = i;
22193 if (wraparound & unlikely(i < 0)) {
22194 wrapped_i += PyTuple_GET_SIZE(o);
22196 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
22197 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
22201 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22203 return PySequence_GetItem(o, i);
22206 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
22207 CYTHON_NCP_UNUSED int wraparound,
22208 CYTHON_NCP_UNUSED int boundscheck) {
22209 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22210 if (is_list || PyList_CheckExact(o)) {
22211 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
22212 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
22213 PyObject *r = PyList_GET_ITEM(o, n);
22218 else if (PyTuple_CheckExact(o)) {
22219 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
22220 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
22221 PyObject *r = PyTuple_GET_ITEM(o, n);
22226 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22227 if (likely(m && m->sq_item)) {
22228 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22229 Py_ssize_t l = m->sq_length(o);
22230 if (likely(l >= 0)) {
22233 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22238 return m->sq_item(o, i);
22242 if (is_list || PySequence_Check(o)) {
22243 return PySequence_GetItem(o, i);
22246 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22249 /* SliceTupleAndList */
22250 #if CYTHON_COMPILING_IN_CPYTHON
22251 static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
22252 Py_ssize_t start = *_start, stop = *_stop, length = *_length;
22260 else if (stop > length)
22262 *_length = stop - start;
22266 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
22269 for (i = 0; i < length; i++) {
22270 v = dest[i] = src[i];
22274 static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
22275 PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
22277 Py_ssize_t length = PyList_GET_SIZE(src);
22278 __Pyx_crop_slice(&start, &stop, &length);
22279 if (unlikely(length <= 0))
22280 return PyList_New(0);
22281 dest = PyList_New(length);
22282 if (unlikely(!dest))
22284 __Pyx_copy_object_array(
22285 ((PyListObject*)src)->ob_item + start,
22286 ((PyListObject*)dest)->ob_item,
22290 static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
22291 PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
22293 Py_ssize_t length = PyTuple_GET_SIZE(src);
22294 __Pyx_crop_slice(&start, &stop, &length);
22295 if (unlikely(length <= 0))
22296 return PyTuple_New(0);
22297 dest = PyTuple_New(length);
22298 if (unlikely(!dest))
22300 __Pyx_copy_object_array(
22301 ((PyTupleObject*)src)->ob_item + start,
22302 ((PyTupleObject*)dest)->ob_item,
22308 /* PyObjectCallNoArg */
22309 #if CYTHON_COMPILING_IN_CPYTHON
22310 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
22311 #if CYTHON_FAST_PYCALL
22312 if (PyFunction_Check(func)) {
22313 return __Pyx_PyFunction_FastCall(func, NULL, 0);
22316 #ifdef __Pyx_CyFunction_USED
22317 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
22319 if (likely(PyCFunction_Check(func)))
22322 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
22323 return __Pyx_PyObject_CallMethO(func, NULL);
22326 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
22330 /* PyObjectSetAttrStr */
22331 #if CYTHON_USE_TYPE_SLOTS
22332 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
22333 PyTypeObject* tp = Py_TYPE(obj);
22334 if (likely(tp->tp_setattro))
22335 return tp->tp_setattro(obj, attr_name, value);
22336 #if PY_MAJOR_VERSION < 3
22337 if (likely(tp->tp_setattr))
22338 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
22340 return PyObject_SetAttr(obj, attr_name, value);
22345 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
22346 #if CYTHON_COMPILING_IN_PYPY
22347 return PyObject_RichCompareBool(s1, s2, equals);
22350 return (equals == Py_EQ);
22351 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22352 const char *ps1, *ps2;
22353 Py_ssize_t length = PyBytes_GET_SIZE(s1);
22354 if (length != PyBytes_GET_SIZE(s2))
22355 return (equals == Py_NE);
22356 ps1 = PyBytes_AS_STRING(s1);
22357 ps2 = PyBytes_AS_STRING(s2);
22358 if (ps1[0] != ps2[0]) {
22359 return (equals == Py_NE);
22360 } else if (length == 1) {
22361 return (equals == Py_EQ);
22364 #if CYTHON_USE_UNICODE_INTERNALS
22365 Py_hash_t hash1, hash2;
22366 hash1 = ((PyBytesObject*)s1)->ob_shash;
22367 hash2 = ((PyBytesObject*)s2)->ob_shash;
22368 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22369 return (equals == Py_NE);
22372 result = memcmp(ps1, ps2, (size_t)length);
22373 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22375 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22376 return (equals == Py_NE);
22377 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22378 return (equals == Py_NE);
22381 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22384 result = __Pyx_PyObject_IsTrue(py_result);
22385 Py_DECREF(py_result);
22391 /* UnicodeEquals */
22392 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
22393 #if CYTHON_COMPILING_IN_PYPY
22394 return PyObject_RichCompareBool(s1, s2, equals);
22396 #if PY_MAJOR_VERSION < 3
22397 PyObject* owned_ref = NULL;
22399 int s1_is_unicode, s2_is_unicode;
22403 s1_is_unicode = PyUnicode_CheckExact(s1);
22404 s2_is_unicode = PyUnicode_CheckExact(s2);
22405 #if PY_MAJOR_VERSION < 3
22406 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
22407 owned_ref = PyUnicode_FromObject(s2);
22408 if (unlikely(!owned_ref))
22412 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
22413 owned_ref = PyUnicode_FromObject(s1);
22414 if (unlikely(!owned_ref))
22418 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
22419 return __Pyx_PyBytes_Equals(s1, s2, equals);
22422 if (s1_is_unicode & s2_is_unicode) {
22425 void *data1, *data2;
22426 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
22428 length = __Pyx_PyUnicode_GET_LENGTH(s1);
22429 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
22432 #if CYTHON_USE_UNICODE_INTERNALS
22434 Py_hash_t hash1, hash2;
22435 #if CYTHON_PEP393_ENABLED
22436 hash1 = ((PyASCIIObject*)s1)->hash;
22437 hash2 = ((PyASCIIObject*)s2)->hash;
22439 hash1 = ((PyUnicodeObject*)s1)->hash;
22440 hash2 = ((PyUnicodeObject*)s2)->hash;
22442 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22447 kind = __Pyx_PyUnicode_KIND(s1);
22448 if (kind != __Pyx_PyUnicode_KIND(s2)) {
22451 data1 = __Pyx_PyUnicode_DATA(s1);
22452 data2 = __Pyx_PyUnicode_DATA(s2);
22453 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
22455 } else if (length == 1) {
22458 int result = memcmp(data1, data2, (size_t)(length * kind));
22459 #if PY_MAJOR_VERSION < 3
22460 Py_XDECREF(owned_ref);
22462 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22464 } else if ((s1 == Py_None) & s2_is_unicode) {
22466 } else if ((s2 == Py_None) & s1_is_unicode) {
22470 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22471 #if PY_MAJOR_VERSION < 3
22472 Py_XDECREF(owned_ref);
22476 result = __Pyx_PyObject_IsTrue(py_result);
22477 Py_DECREF(py_result);
22481 #if PY_MAJOR_VERSION < 3
22482 Py_XDECREF(owned_ref);
22484 return (equals == Py_EQ);
22486 #if PY_MAJOR_VERSION < 3
22487 Py_XDECREF(owned_ref);
22489 return (equals == Py_NE);
22494 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
22495 Py_ssize_t cstart, Py_ssize_t cstop,
22496 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
22497 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
22498 #if CYTHON_USE_TYPE_SLOTS
22499 PyMappingMethods* mp;
22500 #if PY_MAJOR_VERSION < 3
22501 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
22502 if (likely(ms && ms->sq_slice)) {
22504 if (_py_start && (*_py_start != Py_None)) {
22505 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
22506 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
22511 if (_py_stop && (*_py_stop != Py_None)) {
22512 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
22513 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
22515 cstop = PY_SSIZE_T_MAX;
22517 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
22518 Py_ssize_t l = ms->sq_length(obj);
22519 if (likely(l >= 0)) {
22522 if (cstop < 0) cstop = 0;
22526 if (cstart < 0) cstart = 0;
22529 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22534 return ms->sq_slice(obj, cstart, cstop);
22537 mp = Py_TYPE(obj)->tp_as_mapping;
22538 if (likely(mp && mp->mp_subscript))
22542 PyObject *py_slice, *py_start, *py_stop;
22544 py_slice = *_py_slice;
22546 PyObject* owned_start = NULL;
22547 PyObject* owned_stop = NULL;
22549 py_start = *_py_start;
22552 owned_start = py_start = PyInt_FromSsize_t(cstart);
22553 if (unlikely(!py_start)) goto bad;
22555 py_start = Py_None;
22558 py_stop = *_py_stop;
22561 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
22562 if (unlikely(!py_stop)) {
22563 Py_XDECREF(owned_start);
22569 py_slice = PySlice_New(py_start, py_stop, Py_None);
22570 Py_XDECREF(owned_start);
22571 Py_XDECREF(owned_stop);
22572 if (unlikely(!py_slice)) goto bad;
22574 #if CYTHON_USE_TYPE_SLOTS
22575 result = mp->mp_subscript(obj, py_slice);
22577 result = PyObject_GetItem(obj, py_slice);
22580 Py_DECREF(py_slice);
22584 PyErr_Format(PyExc_TypeError,
22585 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
22590 /* PyObjectGetMethod */
22591 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
22593 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
22594 PyTypeObject *tp = Py_TYPE(obj);
22596 descrgetfunc f = NULL;
22597 PyObject **dictptr, *dict;
22598 int meth_found = 0;
22599 assert (*method == NULL);
22600 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
22601 attr = __Pyx_PyObject_GetAttrStr(obj, name);
22604 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
22607 descr = _PyType_Lookup(tp, name);
22608 if (likely(descr != NULL)) {
22610 #if PY_MAJOR_VERSION >= 3
22611 #ifdef __Pyx_CyFunction_USED
22612 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
22614 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
22617 #ifdef __Pyx_CyFunction_USED
22618 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
22620 if (likely(PyFunction_Check(descr)))
22626 f = Py_TYPE(descr)->tp_descr_get;
22627 if (f != NULL && PyDescr_IsData(descr)) {
22628 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22634 dictptr = _PyObject_GetDictPtr(obj);
22635 if (dictptr != NULL && (dict = *dictptr) != NULL) {
22637 attr = __Pyx_PyDict_GetItemStr(dict, name);
22638 if (attr != NULL) {
22651 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22655 if (descr != NULL) {
22659 PyErr_Format(PyExc_AttributeError,
22660 #if PY_MAJOR_VERSION >= 3
22661 "'%.50s' object has no attribute '%U'",
22662 tp->tp_name, name);
22664 "'%.50s' object has no attribute '%.400s'",
22665 tp->tp_name, PyString_AS_STRING(name));
22669 attr = __Pyx_PyObject_GetAttrStr(obj, name);
22673 #if CYTHON_UNPACK_METHODS
22674 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
22675 PyObject *function = PyMethod_GET_FUNCTION(attr);
22676 Py_INCREF(function);
22678 *method = function;
22686 /* PyObjectCallMethod1 */
22687 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
22688 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
22692 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
22693 PyObject *method = NULL, *result;
22694 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
22695 if (likely(is_method)) {
22696 result = __Pyx_PyObject_Call2Args(method, obj, arg);
22700 if (unlikely(!method)) return NULL;
22701 return __Pyx__PyObject_CallMethod1(method, arg);
22705 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
22706 if (likely(PyList_CheckExact(L))) {
22707 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
22709 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
22710 if (unlikely(!retval))
22718 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
22721 r = PyObject_SetItem(o, j, v);
22725 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
22726 CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
22727 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22728 if (is_list || PyList_CheckExact(o)) {
22729 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
22730 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
22731 PyObject* old = PyList_GET_ITEM(o, n);
22733 PyList_SET_ITEM(o, n, v);
22738 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22739 if (likely(m && m->sq_ass_item)) {
22740 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22741 Py_ssize_t l = m->sq_length(o);
22742 if (likely(l >= 0)) {
22745 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22750 return m->sq_ass_item(o, i, v);
22754 #if CYTHON_COMPILING_IN_PYPY
22755 if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
22757 if (is_list || PySequence_Check(o))
22760 return PySequence_SetItem(o, i, v);
22763 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
22766 /* GetTopmostException */
22767 #if CYTHON_USE_EXC_INFO_STACK
22768 static _PyErr_StackItem *
22769 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
22771 _PyErr_StackItem *exc_info = tstate->exc_info;
22772 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
22773 exc_info->previous_item != NULL)
22775 exc_info = exc_info->previous_item;
22781 /* SaveResetException */
22782 #if CYTHON_FAST_THREAD_STATE
22783 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22784 #if CYTHON_USE_EXC_INFO_STACK
22785 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
22786 *type = exc_info->exc_type;
22787 *value = exc_info->exc_value;
22788 *tb = exc_info->exc_traceback;
22790 *type = tstate->exc_type;
22791 *value = tstate->exc_value;
22792 *tb = tstate->exc_traceback;
22795 Py_XINCREF(*value);
22798 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22799 PyObject *tmp_type, *tmp_value, *tmp_tb;
22800 #if CYTHON_USE_EXC_INFO_STACK
22801 _PyErr_StackItem *exc_info = tstate->exc_info;
22802 tmp_type = exc_info->exc_type;
22803 tmp_value = exc_info->exc_value;
22804 tmp_tb = exc_info->exc_traceback;
22805 exc_info->exc_type = type;
22806 exc_info->exc_value = value;
22807 exc_info->exc_traceback = tb;
22809 tmp_type = tstate->exc_type;
22810 tmp_value = tstate->exc_value;
22811 tmp_tb = tstate->exc_traceback;
22812 tstate->exc_type = type;
22813 tstate->exc_value = value;
22814 tstate->exc_traceback = tb;
22816 Py_XDECREF(tmp_type);
22817 Py_XDECREF(tmp_value);
22818 Py_XDECREF(tmp_tb);
22822 /* PyErrFetchRestore */
22823 #if CYTHON_FAST_THREAD_STATE
22824 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22825 PyObject *tmp_type, *tmp_value, *tmp_tb;
22826 tmp_type = tstate->curexc_type;
22827 tmp_value = tstate->curexc_value;
22828 tmp_tb = tstate->curexc_traceback;
22829 tstate->curexc_type = type;
22830 tstate->curexc_value = value;
22831 tstate->curexc_traceback = tb;
22832 Py_XDECREF(tmp_type);
22833 Py_XDECREF(tmp_value);
22834 Py_XDECREF(tmp_tb);
22836 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22837 *type = tstate->curexc_type;
22838 *value = tstate->curexc_value;
22839 *tb = tstate->curexc_traceback;
22840 tstate->curexc_type = 0;
22841 tstate->curexc_value = 0;
22842 tstate->curexc_traceback = 0;
22846 /* FastTypeChecks */
22847 #if CYTHON_COMPILING_IN_CPYTHON
22848 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
22854 return b == &PyBaseObject_Type;
22856 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
22858 if (a == b) return 1;
22862 n = PyTuple_GET_SIZE(mro);
22863 for (i = 0; i < n; i++) {
22864 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
22869 return __Pyx_InBases(a, b);
22871 #if PY_MAJOR_VERSION == 2
22872 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
22873 PyObject *exception, *value, *tb;
22875 __Pyx_PyThreadState_declare
22876 __Pyx_PyThreadState_assign
22877 __Pyx_ErrFetch(&exception, &value, &tb);
22878 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
22879 if (unlikely(res == -1)) {
22880 PyErr_WriteUnraisable(err);
22884 res = PyObject_IsSubclass(err, exc_type2);
22885 if (unlikely(res == -1)) {
22886 PyErr_WriteUnraisable(err);
22890 __Pyx_ErrRestore(exception, value, tb);
22894 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
22895 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
22897 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
22902 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22904 assert(PyExceptionClass_Check(exc_type));
22905 n = PyTuple_GET_SIZE(tuple);
22906 #if PY_MAJOR_VERSION >= 3
22907 for (i=0; i<n; i++) {
22908 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22911 for (i=0; i<n; i++) {
22912 PyObject *t = PyTuple_GET_ITEM(tuple, i);
22913 #if PY_MAJOR_VERSION < 3
22914 if (likely(exc_type == t)) return 1;
22916 if (likely(PyExceptionClass_Check(t))) {
22917 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
22923 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
22924 if (likely(err == exc_type)) return 1;
22925 if (likely(PyExceptionClass_Check(err))) {
22926 if (likely(PyExceptionClass_Check(exc_type))) {
22927 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
22928 } else if (likely(PyTuple_Check(exc_type))) {
22929 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
22933 return PyErr_GivenExceptionMatches(err, exc_type);
22935 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
22936 assert(PyExceptionClass_Check(exc_type1));
22937 assert(PyExceptionClass_Check(exc_type2));
22938 if (likely(err == exc_type1 || err == exc_type2)) return 1;
22939 if (likely(PyExceptionClass_Check(err))) {
22940 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
22942 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
22947 #if CYTHON_FAST_THREAD_STATE
22948 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
22950 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
22953 PyObject *local_type, *local_value, *local_tb;
22954 #if CYTHON_FAST_THREAD_STATE
22955 PyObject *tmp_type, *tmp_value, *tmp_tb;
22956 local_type = tstate->curexc_type;
22957 local_value = tstate->curexc_value;
22958 local_tb = tstate->curexc_traceback;
22959 tstate->curexc_type = 0;
22960 tstate->curexc_value = 0;
22961 tstate->curexc_traceback = 0;
22963 PyErr_Fetch(&local_type, &local_value, &local_tb);
22965 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
22966 #if CYTHON_FAST_THREAD_STATE
22967 if (unlikely(tstate->curexc_type))
22969 if (unlikely(PyErr_Occurred()))
22972 #if PY_MAJOR_VERSION >= 3
22974 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
22978 Py_XINCREF(local_tb);
22979 Py_XINCREF(local_type);
22980 Py_XINCREF(local_value);
22981 *type = local_type;
22982 *value = local_value;
22984 #if CYTHON_FAST_THREAD_STATE
22985 #if CYTHON_USE_EXC_INFO_STACK
22987 _PyErr_StackItem *exc_info = tstate->exc_info;
22988 tmp_type = exc_info->exc_type;
22989 tmp_value = exc_info->exc_value;
22990 tmp_tb = exc_info->exc_traceback;
22991 exc_info->exc_type = local_type;
22992 exc_info->exc_value = local_value;
22993 exc_info->exc_traceback = local_tb;
22996 tmp_type = tstate->exc_type;
22997 tmp_value = tstate->exc_value;
22998 tmp_tb = tstate->exc_traceback;
22999 tstate->exc_type = local_type;
23000 tstate->exc_value = local_value;
23001 tstate->exc_traceback = local_tb;
23003 Py_XDECREF(tmp_type);
23004 Py_XDECREF(tmp_value);
23005 Py_XDECREF(tmp_tb);
23007 PyErr_SetExcInfo(local_type, local_value, local_tb);
23014 Py_XDECREF(local_type);
23015 Py_XDECREF(local_value);
23016 Py_XDECREF(local_tb);
23020 /* PyObjectCallMethod0 */
23021 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
23022 PyObject *method = NULL, *result = NULL;
23023 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
23024 if (likely(is_method)) {
23025 result = __Pyx_PyObject_CallOneArg(method, obj);
23029 if (unlikely(!method)) goto bad;
23030 result = __Pyx_PyObject_CallNoArg(method);
23036 /* UnpackUnboundCMethod */
23037 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
23039 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
23040 if (unlikely(!method))
23042 target->method = method;
23043 #if CYTHON_COMPILING_IN_CPYTHON
23044 #if PY_MAJOR_VERSION >= 3
23045 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
23048 PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
23049 target->func = descr->d_method->ml_meth;
23050 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
23056 /* CallUnboundCMethod0 */
23057 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
23058 PyObject *args, *result = NULL;
23059 if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
23060 #if CYTHON_ASSUME_SAFE_MACROS
23061 args = PyTuple_New(1);
23062 if (unlikely(!args)) goto bad;
23064 PyTuple_SET_ITEM(args, 0, self);
23066 args = PyTuple_Pack(1, self);
23067 if (unlikely(!args)) goto bad;
23069 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
23076 static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
23077 if (Py_TYPE(L) == &PySet_Type) {
23078 return PySet_Pop(L);
23080 return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
23082 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
23083 static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
23084 if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
23086 return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
23088 return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
23092 /* PyErrExceptionMatches */
23093 #if CYTHON_FAST_THREAD_STATE
23094 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23096 n = PyTuple_GET_SIZE(tuple);
23097 #if PY_MAJOR_VERSION >= 3
23098 for (i=0; i<n; i++) {
23099 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
23102 for (i=0; i<n; i++) {
23103 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
23107 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23108 PyObject *exc_type = tstate->curexc_type;
23109 if (exc_type == err) return 1;
23110 if (unlikely(!exc_type)) return 0;
23111 if (unlikely(PyTuple_Check(err)))
23112 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23113 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23117 /* RaiseException */
23118 #if PY_MAJOR_VERSION < 3
23119 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
23120 CYTHON_UNUSED PyObject *cause) {
23121 __Pyx_PyThreadState_declare
23123 if (!value || value == Py_None)
23127 if (!tb || tb == Py_None)
23131 if (!PyTraceBack_Check(tb)) {
23132 PyErr_SetString(PyExc_TypeError,
23133 "raise: arg 3 must be a traceback or None");
23137 if (PyType_Check(type)) {
23138 #if CYTHON_COMPILING_IN_PYPY
23140 Py_INCREF(Py_None);
23144 PyErr_NormalizeException(&type, &value, &tb);
23147 PyErr_SetString(PyExc_TypeError,
23148 "instance exception may not have a separate value");
23152 type = (PyObject*) Py_TYPE(type);
23154 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
23155 PyErr_SetString(PyExc_TypeError,
23156 "raise: exception class must be a subclass of BaseException");
23160 __Pyx_PyThreadState_assign
23161 __Pyx_ErrRestore(type, value, tb);
23170 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23171 PyObject* owned_instance = NULL;
23172 if (tb == Py_None) {
23174 } else if (tb && !PyTraceBack_Check(tb)) {
23175 PyErr_SetString(PyExc_TypeError,
23176 "raise: arg 3 must be a traceback or None");
23179 if (value == Py_None)
23181 if (PyExceptionInstance_Check(type)) {
23183 PyErr_SetString(PyExc_TypeError,
23184 "instance exception may not have a separate value");
23188 type = (PyObject*) Py_TYPE(value);
23189 } else if (PyExceptionClass_Check(type)) {
23190 PyObject *instance_class = NULL;
23191 if (value && PyExceptionInstance_Check(value)) {
23192 instance_class = (PyObject*) Py_TYPE(value);
23193 if (instance_class != type) {
23194 int is_subclass = PyObject_IsSubclass(instance_class, type);
23195 if (!is_subclass) {
23196 instance_class = NULL;
23197 } else if (unlikely(is_subclass == -1)) {
23200 type = instance_class;
23204 if (!instance_class) {
23207 args = PyTuple_New(0);
23208 else if (PyTuple_Check(value)) {
23212 args = PyTuple_Pack(1, value);
23215 owned_instance = PyObject_Call(type, args, NULL);
23217 if (!owned_instance)
23219 value = owned_instance;
23220 if (!PyExceptionInstance_Check(value)) {
23221 PyErr_Format(PyExc_TypeError,
23222 "calling %R should have returned an instance of "
23223 "BaseException, not %R",
23224 type, Py_TYPE(value));
23229 PyErr_SetString(PyExc_TypeError,
23230 "raise: exception class must be a subclass of BaseException");
23234 PyObject *fixed_cause;
23235 if (cause == Py_None) {
23236 fixed_cause = NULL;
23237 } else if (PyExceptionClass_Check(cause)) {
23238 fixed_cause = PyObject_CallObject(cause, NULL);
23239 if (fixed_cause == NULL)
23241 } else if (PyExceptionInstance_Check(cause)) {
23242 fixed_cause = cause;
23243 Py_INCREF(fixed_cause);
23245 PyErr_SetString(PyExc_TypeError,
23246 "exception causes must derive from "
23250 PyException_SetCause(value, fixed_cause);
23252 PyErr_SetObject(type, value);
23254 #if CYTHON_COMPILING_IN_PYPY
23255 PyObject *tmp_type, *tmp_value, *tmp_tb;
23256 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
23258 PyErr_Restore(tmp_type, tmp_value, tb);
23259 Py_XDECREF(tmp_tb);
23261 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23262 PyObject* tmp_tb = tstate->curexc_traceback;
23263 if (tb != tmp_tb) {
23265 tstate->curexc_traceback = tb;
23266 Py_XDECREF(tmp_tb);
23271 Py_XDECREF(owned_instance);
23277 #if !CYTHON_COMPILING_IN_PYPY
23278 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
23280 (void)zerodivision_check;
23281 #if PY_MAJOR_VERSION < 3
23282 if (likely(PyInt_CheckExact(op1))) {
23283 const long b = intval;
23285 long a = PyInt_AS_LONG(op1);
23286 x = (long)((unsigned long)a + b);
23287 if (likely((x^a) >= 0 || (x^b) >= 0))
23288 return PyInt_FromLong(x);
23289 return PyLong_Type.tp_as_number->nb_add(op1, op2);
23292 #if CYTHON_USE_PYLONG_INTERNALS
23293 if (likely(PyLong_CheckExact(op1))) {
23294 const long b = intval;
23296 #ifdef HAVE_LONG_LONG
23297 const PY_LONG_LONG llb = intval;
23298 PY_LONG_LONG lla, llx;
23300 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23301 const Py_ssize_t size = Py_SIZE(op1);
23302 if (likely(__Pyx_sst_abs(size) <= 1)) {
23303 a = likely(size) ? digits[0] : 0;
23304 if (size == -1) a = -a;
23308 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23309 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23311 #ifdef HAVE_LONG_LONG
23312 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23313 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23317 CYTHON_FALLTHROUGH;
23319 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23320 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23322 #ifdef HAVE_LONG_LONG
23323 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23324 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23328 CYTHON_FALLTHROUGH;
23330 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23331 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23333 #ifdef HAVE_LONG_LONG
23334 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23335 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]));
23339 CYTHON_FALLTHROUGH;
23341 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23342 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23344 #ifdef HAVE_LONG_LONG
23345 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23346 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]));
23350 CYTHON_FALLTHROUGH;
23352 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23353 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23355 #ifdef HAVE_LONG_LONG
23356 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23357 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]));
23361 CYTHON_FALLTHROUGH;
23363 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23364 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23366 #ifdef HAVE_LONG_LONG
23367 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23368 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]));
23372 CYTHON_FALLTHROUGH;
23373 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
23377 return PyLong_FromLong(x);
23378 #ifdef HAVE_LONG_LONG
23381 return PyLong_FromLongLong(llx);
23387 if (PyFloat_CheckExact(op1)) {
23388 const long b = intval;
23389 double a = PyFloat_AS_DOUBLE(op1);
23391 PyFPE_START_PROTECT("add", return NULL)
23392 result = ((double)a) + (double)b;
23393 PyFPE_END_PROTECT(result)
23394 return PyFloat_FromDouble(result);
23396 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
23401 static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix) {
23403 if (unlikely(!py_ix)) return NULL;
23404 r = __Pyx__PyObject_PopIndex(L, py_ix);
23408 static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) {
23409 return __Pyx_PyObject_CallMethod1(L, __pyx_n_s_pop, py_ix);
23411 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
23412 static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix) {
23413 Py_ssize_t size = PyList_GET_SIZE(L);
23414 if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
23415 Py_ssize_t cix = ix;
23419 if (likely(__Pyx_is_valid_index(cix, size))) {
23420 PyObject* v = PyList_GET_ITEM(L, cix);
23423 memmove(&PyList_GET_ITEM(L, cix), &PyList_GET_ITEM(L, cix+1), (size_t)(size-cix)*sizeof(PyObject*));
23427 if (py_ix == Py_None) {
23428 return __Pyx__PyObject_PopNewIndex(L, PyInt_FromSsize_t(ix));
23430 return __Pyx__PyObject_PopIndex(L, py_ix);
23435 /* RaiseNoneIterError */
23436 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
23437 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
23440 /* UnpackTupleError */
23441 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
23442 if (t == Py_None) {
23443 __Pyx_RaiseNoneNotIterableError();
23444 } else if (PyTuple_GET_SIZE(t) < index) {
23445 __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
23447 __Pyx_RaiseTooManyValuesError(index);
23452 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
23453 PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
23454 PyObject *value1 = NULL, *value2 = NULL;
23455 #if CYTHON_COMPILING_IN_PYPY
23456 value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad;
23457 value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad;
23459 value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1);
23460 value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2);
23462 if (decref_tuple) {
23468 #if CYTHON_COMPILING_IN_PYPY
23470 Py_XDECREF(value1);
23471 Py_XDECREF(value2);
23472 if (decref_tuple) { Py_XDECREF(tuple); }
23476 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
23477 int has_known_size, int decref_tuple) {
23479 PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
23480 iternextfunc iternext;
23481 iter = PyObject_GetIter(tuple);
23482 if (unlikely(!iter)) goto bad;
23483 if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
23484 iternext = Py_TYPE(iter)->tp_iternext;
23485 value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
23486 value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
23487 if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
23493 if (!has_known_size && __Pyx_IterFinish() == 0)
23494 __Pyx_RaiseNeedMoreValuesError(index);
23497 Py_XDECREF(value1);
23498 Py_XDECREF(value2);
23499 if (decref_tuple) { Py_XDECREF(tuple); }
23504 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
23505 Py_ssize_t* p_orig_length, int* p_source_is_dict) {
23506 is_dict = is_dict || likely(PyDict_CheckExact(iterable));
23507 *p_source_is_dict = is_dict;
23509 #if !CYTHON_COMPILING_IN_PYPY
23510 *p_orig_length = PyDict_Size(iterable);
23511 Py_INCREF(iterable);
23513 #elif PY_MAJOR_VERSION >= 3
23514 static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
23515 PyObject **pp = NULL;
23517 const char *name = PyUnicode_AsUTF8(method_name);
23518 if (strcmp(name, "iteritems") == 0) pp = &py_items;
23519 else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
23520 else if (strcmp(name, "itervalues") == 0) pp = &py_values;
23523 *pp = PyUnicode_FromString(name + 4);
23532 *p_orig_length = 0;
23535 iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
23538 #if !CYTHON_COMPILING_IN_PYPY
23539 if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
23542 iter = PyObject_GetIter(iterable);
23543 Py_DECREF(iterable);
23546 return PyObject_GetIter(iterable);
23548 static CYTHON_INLINE int __Pyx_dict_iter_next(
23549 PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
23550 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
23551 PyObject* next_item;
23552 #if !CYTHON_COMPILING_IN_PYPY
23553 if (source_is_dict) {
23554 PyObject *key, *value;
23555 if (unlikely(orig_length != PyDict_Size(iter_obj))) {
23556 PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
23559 if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
23563 PyObject* tuple = PyTuple_New(2);
23564 if (unlikely(!tuple)) {
23569 PyTuple_SET_ITEM(tuple, 0, key);
23570 PyTuple_SET_ITEM(tuple, 1, value);
23583 } else if (PyTuple_CheckExact(iter_obj)) {
23584 Py_ssize_t pos = *ppos;
23585 if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
23587 next_item = PyTuple_GET_ITEM(iter_obj, pos);
23588 Py_INCREF(next_item);
23589 } else if (PyList_CheckExact(iter_obj)) {
23590 Py_ssize_t pos = *ppos;
23591 if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
23593 next_item = PyList_GET_ITEM(iter_obj, pos);
23594 Py_INCREF(next_item);
23598 next_item = PyIter_Next(iter_obj);
23599 if (unlikely(!next_item)) {
23600 return __Pyx_IterFinish();
23604 *pitem = next_item;
23605 } else if (pkey && pvalue) {
23606 if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
23611 *pvalue = next_item;
23617 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
23618 Py_ssize_t cstart, Py_ssize_t cstop,
23619 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
23620 int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
23621 #if CYTHON_USE_TYPE_SLOTS
23622 PyMappingMethods* mp;
23623 #if PY_MAJOR_VERSION < 3
23624 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
23625 if (likely(ms && ms->sq_ass_slice)) {
23627 if (_py_start && (*_py_start != Py_None)) {
23628 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
23629 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23634 if (_py_stop && (*_py_stop != Py_None)) {
23635 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
23636 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23638 cstop = PY_SSIZE_T_MAX;
23640 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
23641 Py_ssize_t l = ms->sq_length(obj);
23642 if (likely(l >= 0)) {
23645 if (cstop < 0) cstop = 0;
23649 if (cstart < 0) cstart = 0;
23652 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23657 return ms->sq_ass_slice(obj, cstart, cstop, value);
23660 mp = Py_TYPE(obj)->tp_as_mapping;
23661 if (likely(mp && mp->mp_ass_subscript))
23665 PyObject *py_slice, *py_start, *py_stop;
23667 py_slice = *_py_slice;
23669 PyObject* owned_start = NULL;
23670 PyObject* owned_stop = NULL;
23672 py_start = *_py_start;
23675 owned_start = py_start = PyInt_FromSsize_t(cstart);
23676 if (unlikely(!py_start)) goto bad;
23678 py_start = Py_None;
23681 py_stop = *_py_stop;
23684 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
23685 if (unlikely(!py_stop)) {
23686 Py_XDECREF(owned_start);
23692 py_slice = PySlice_New(py_start, py_stop, Py_None);
23693 Py_XDECREF(owned_start);
23694 Py_XDECREF(owned_stop);
23695 if (unlikely(!py_slice)) goto bad;
23697 #if CYTHON_USE_TYPE_SLOTS
23698 result = mp->mp_ass_subscript(obj, py_slice, value);
23700 result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
23703 Py_DECREF(py_slice);
23707 PyErr_Format(PyExc_TypeError,
23708 "'%.200s' object does not support slice %.10s",
23709 Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
23715 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
23719 #if PY_MAJOR_VERSION < 3
23720 if (likely(PyInt_CheckExact(op1))) {
23721 const long b = intval;
23722 long a = PyInt_AS_LONG(op1);
23723 if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
23726 #if CYTHON_USE_PYLONG_INTERNALS
23727 if (likely(PyLong_CheckExact(op1))) {
23729 unsigned long uintval;
23730 Py_ssize_t size = Py_SIZE(op1);
23731 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23733 if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
23734 } else if (intval < 0) {
23743 uintval = (unsigned long) intval;
23744 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
23745 if (uintval >> (PyLong_SHIFT * 4)) {
23746 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
23747 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
23750 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
23751 if (uintval >> (PyLong_SHIFT * 3)) {
23752 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
23753 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
23756 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
23757 if (uintval >> (PyLong_SHIFT * 2)) {
23758 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
23759 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
23762 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
23763 if (uintval >> (PyLong_SHIFT * 1)) {
23764 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
23765 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
23768 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
23769 if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
23772 if (PyFloat_CheckExact(op1)) {
23773 const long b = intval;
23774 double a = PyFloat_AS_DOUBLE(op1);
23775 if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
23778 PyObject_RichCompare(op1, op2, Py_EQ));
23782 #if !CYTHON_COMPILING_IN_PYPY
23783 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
23785 (void)zerodivision_check;
23786 #if PY_MAJOR_VERSION < 3
23787 if (likely(PyInt_CheckExact(op1))) {
23788 const long b = intval;
23790 long a = PyInt_AS_LONG(op1);
23791 x = (long)((unsigned long)a - b);
23792 if (likely((x^a) >= 0 || (x^~b) >= 0))
23793 return PyInt_FromLong(x);
23794 return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
23797 #if CYTHON_USE_PYLONG_INTERNALS
23798 if (likely(PyLong_CheckExact(op1))) {
23799 const long b = intval;
23801 #ifdef HAVE_LONG_LONG
23802 const PY_LONG_LONG llb = intval;
23803 PY_LONG_LONG lla, llx;
23805 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23806 const Py_ssize_t size = Py_SIZE(op1);
23807 if (likely(__Pyx_sst_abs(size) <= 1)) {
23808 a = likely(size) ? digits[0] : 0;
23809 if (size == -1) a = -a;
23813 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23814 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23816 #ifdef HAVE_LONG_LONG
23817 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23818 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23822 CYTHON_FALLTHROUGH;
23824 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23825 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23827 #ifdef HAVE_LONG_LONG
23828 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23829 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23833 CYTHON_FALLTHROUGH;
23835 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23836 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23838 #ifdef HAVE_LONG_LONG
23839 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23840 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]));
23844 CYTHON_FALLTHROUGH;
23846 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23847 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23849 #ifdef HAVE_LONG_LONG
23850 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23851 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]));
23855 CYTHON_FALLTHROUGH;
23857 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23858 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23860 #ifdef HAVE_LONG_LONG
23861 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23862 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]));
23866 CYTHON_FALLTHROUGH;
23868 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23869 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23871 #ifdef HAVE_LONG_LONG
23872 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23873 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]));
23877 CYTHON_FALLTHROUGH;
23878 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
23882 return PyLong_FromLong(x);
23883 #ifdef HAVE_LONG_LONG
23886 return PyLong_FromLongLong(llx);
23892 if (PyFloat_CheckExact(op1)) {
23893 const long b = intval;
23894 double a = PyFloat_AS_DOUBLE(op1);
23896 PyFPE_START_PROTECT("subtract", return NULL)
23897 result = ((double)a) - (double)b;
23898 PyFPE_END_PROTECT(result)
23899 return PyFloat_FromDouble(result);
23901 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
23905 /* ObjectGetItem */
23906 #if CYTHON_USE_TYPE_SLOTS
23907 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23909 Py_ssize_t key_value;
23910 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23911 if (unlikely(!(m && m->sq_item))) {
23912 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23915 key_value = __Pyx_PyIndex_AsSsize_t(index);
23916 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23917 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23919 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23921 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23925 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23926 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23927 if (likely(m && m->mp_subscript)) {
23928 return m->mp_subscript(obj, key);
23930 return __Pyx_PyObject_GetIndex(obj, key);
23935 #if !CYTHON_COMPILING_IN_PYPY
23936 #if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
23937 #define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
23938 if (unlikely(zerodivision_check && ((operand) == 0))) {\
23939 PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
23943 static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
23945 (void)zerodivision_check;
23946 #if PY_MAJOR_VERSION < 3
23947 if (likely(PyInt_CheckExact(op1))) {
23948 const long b = intval;
23949 long a = PyInt_AS_LONG(op1);
23950 __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
23951 if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
23952 return PyFloat_FromDouble((double)a / (double)b);
23954 return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
23957 #if CYTHON_USE_PYLONG_INTERNALS
23958 if (likely(PyLong_CheckExact(op1))) {
23959 const long b = intval;
23961 const digit* digits = ((PyLongObject*)op1)->ob_digit;
23962 const Py_ssize_t size = Py_SIZE(op1);
23963 if (likely(__Pyx_sst_abs(size) <= 1)) {
23964 a = likely(size) ? digits[0] : 0;
23965 if (size == -1) a = -a;
23969 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
23970 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23973 CYTHON_FALLTHROUGH;
23975 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
23976 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23979 CYTHON_FALLTHROUGH;
23981 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
23982 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23985 CYTHON_FALLTHROUGH;
23987 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
23988 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23991 CYTHON_FALLTHROUGH;
23993 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
23994 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23997 CYTHON_FALLTHROUGH;
23999 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
24000 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24003 CYTHON_FALLTHROUGH;
24004 default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
24007 __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
24008 if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
24009 || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
24010 return PyFloat_FromDouble((double)a / (double)b);
24012 return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
24013 return PyLong_FromLong(x);
24017 if (PyFloat_CheckExact(op1)) {
24018 const long b = intval;
24019 double a = PyFloat_AS_DOUBLE(op1);
24021 if (unlikely(zerodivision_check && b == 0)) {
24022 PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
24025 PyFPE_START_PROTECT("divide", return NULL)
24026 result = ((double)a) / (double)b;
24027 PyFPE_END_PROTECT(result)
24028 return PyFloat_FromDouble(result);
24030 return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
24034 /* PyObject_GenericGetAttrNoDict */
24035 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24036 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24037 PyErr_Format(PyExc_AttributeError,
24038 #if PY_MAJOR_VERSION >= 3
24039 "'%.50s' object has no attribute '%U'",
24040 tp->tp_name, attr_name);
24042 "'%.50s' object has no attribute '%.400s'",
24043 tp->tp_name, PyString_AS_STRING(attr_name));
24047 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24049 PyTypeObject *tp = Py_TYPE(obj);
24050 if (unlikely(!PyString_Check(attr_name))) {
24051 return PyObject_GenericGetAttr(obj, attr_name);
24053 assert(!tp->tp_dictoffset);
24054 descr = _PyType_Lookup(tp, attr_name);
24055 if (unlikely(!descr)) {
24056 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24059 #if PY_MAJOR_VERSION < 3
24060 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24063 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24065 PyObject *res = f(descr, obj, (PyObject *)tp);
24075 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
24076 PyObject *empty_list = 0;
24077 PyObject *module = 0;
24078 PyObject *global_dict = 0;
24079 PyObject *empty_dict = 0;
24081 #if PY_MAJOR_VERSION < 3
24082 PyObject *py_import;
24083 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24090 empty_list = PyList_New(0);
24095 global_dict = PyModule_GetDict(__pyx_m);
24098 empty_dict = PyDict_New();
24102 #if PY_MAJOR_VERSION >= 3
24104 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
24105 module = PyImport_ImportModuleLevelObject(
24106 name, global_dict, empty_dict, list, 1);
24108 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24117 #if PY_MAJOR_VERSION < 3
24118 PyObject *py_level = PyInt_FromLong(level);
24121 module = PyObject_CallFunctionObjArgs(py_import,
24122 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24123 Py_DECREF(py_level);
24125 module = PyImport_ImportModuleLevelObject(
24126 name, global_dict, empty_dict, list, level);
24131 #if PY_MAJOR_VERSION < 3
24132 Py_XDECREF(py_import);
24134 Py_XDECREF(empty_list);
24135 Py_XDECREF(empty_dict);
24140 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24141 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24142 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24143 PyErr_Format(PyExc_ImportError,
24144 #if PY_MAJOR_VERSION < 3
24145 "cannot import name %.230s", PyString_AS_STRING(name));
24147 "cannot import name %S", name);
24153 /* FetchCommonType */
24154 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
24155 PyObject* fake_module;
24156 PyTypeObject* cached_type = NULL;
24157 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
24158 if (!fake_module) return NULL;
24159 Py_INCREF(fake_module);
24160 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
24162 if (!PyType_Check((PyObject*)cached_type)) {
24163 PyErr_Format(PyExc_TypeError,
24164 "Shared Cython type %.200s is not a type object",
24168 if (cached_type->tp_basicsize != type->tp_basicsize) {
24169 PyErr_Format(PyExc_TypeError,
24170 "Shared Cython type %.200s has the wrong size, try recompiling",
24175 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
24177 if (PyType_Ready(type) < 0) goto bad;
24178 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
24181 cached_type = type;
24184 Py_DECREF(fake_module);
24185 return cached_type;
24187 Py_XDECREF(cached_type);
24188 cached_type = NULL;
24192 /* CythonFunctionShared */
24193 #include <structmember.h>
24195 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
24197 if (unlikely(op->func_doc == NULL)) {
24198 if (op->func.m_ml->ml_doc) {
24199 #if PY_MAJOR_VERSION >= 3
24200 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
24202 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
24204 if (unlikely(op->func_doc == NULL))
24207 Py_INCREF(Py_None);
24211 Py_INCREF(op->func_doc);
24212 return op->func_doc;
24215 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
24217 PyObject *tmp = op->func_doc;
24218 if (value == NULL) {
24222 op->func_doc = value;
24227 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24229 if (unlikely(op->func_name == NULL)) {
24230 #if PY_MAJOR_VERSION >= 3
24231 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
24233 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
24235 if (unlikely(op->func_name == NULL))
24238 Py_INCREF(op->func_name);
24239 return op->func_name;
24242 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
24245 #if PY_MAJOR_VERSION >= 3
24246 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24248 if (unlikely(value == NULL || !PyString_Check(value)))
24251 PyErr_SetString(PyExc_TypeError,
24252 "__name__ must be set to a string object");
24255 tmp = op->func_name;
24257 op->func_name = value;
24262 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24264 Py_INCREF(op->func_qualname);
24265 return op->func_qualname;
24268 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
24271 #if PY_MAJOR_VERSION >= 3
24272 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24274 if (unlikely(value == NULL || !PyString_Check(value)))
24277 PyErr_SetString(PyExc_TypeError,
24278 "__qualname__ must be set to a string object");
24281 tmp = op->func_qualname;
24283 op->func_qualname = value;
24288 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
24291 self = m->func_closure;
24298 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24300 if (unlikely(op->func_dict == NULL)) {
24301 op->func_dict = PyDict_New();
24302 if (unlikely(op->func_dict == NULL))
24305 Py_INCREF(op->func_dict);
24306 return op->func_dict;
24309 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
24312 if (unlikely(value == NULL)) {
24313 PyErr_SetString(PyExc_TypeError,
24314 "function's dictionary may not be deleted");
24317 if (unlikely(!PyDict_Check(value))) {
24318 PyErr_SetString(PyExc_TypeError,
24319 "setting function's dictionary to a non-dict");
24322 tmp = op->func_dict;
24324 op->func_dict = value;
24329 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24331 Py_INCREF(op->func_globals);
24332 return op->func_globals;
24335 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24337 Py_INCREF(Py_None);
24341 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
24343 PyObject* result = (op->func_code) ? op->func_code : Py_None;
24348 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
24350 PyObject *res = op->defaults_getter((PyObject *) op);
24351 if (unlikely(!res))
24353 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24354 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
24355 Py_INCREF(op->defaults_tuple);
24356 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
24357 Py_INCREF(op->defaults_kwdict);
24359 op->defaults_tuple = PySequence_ITEM(res, 0);
24360 if (unlikely(!op->defaults_tuple)) result = -1;
24362 op->defaults_kwdict = PySequence_ITEM(res, 1);
24363 if (unlikely(!op->defaults_kwdict)) result = -1;
24370 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
24374 } else if (value != Py_None && !PyTuple_Check(value)) {
24375 PyErr_SetString(PyExc_TypeError,
24376 "__defaults__ must be set to a tuple object");
24380 tmp = op->defaults_tuple;
24381 op->defaults_tuple = value;
24386 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
24387 PyObject* result = op->defaults_tuple;
24388 if (unlikely(!result)) {
24389 if (op->defaults_getter) {
24390 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
24391 result = op->defaults_tuple;
24400 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
24404 } else if (value != Py_None && !PyDict_Check(value)) {
24405 PyErr_SetString(PyExc_TypeError,
24406 "__kwdefaults__ must be set to a dict object");
24410 tmp = op->defaults_kwdict;
24411 op->defaults_kwdict = value;
24416 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
24417 PyObject* result = op->defaults_kwdict;
24418 if (unlikely(!result)) {
24419 if (op->defaults_getter) {
24420 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
24421 result = op->defaults_kwdict;
24430 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
24432 if (!value || value == Py_None) {
24434 } else if (!PyDict_Check(value)) {
24435 PyErr_SetString(PyExc_TypeError,
24436 "__annotations__ must be set to a dict object");
24440 tmp = op->func_annotations;
24441 op->func_annotations = value;
24446 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
24447 PyObject* result = op->func_annotations;
24448 if (unlikely(!result)) {
24449 result = PyDict_New();
24450 if (unlikely(!result)) return NULL;
24451 op->func_annotations = result;
24456 static PyGetSetDef __pyx_CyFunction_getsets[] = {
24457 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24458 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24459 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24460 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24461 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
24462 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
24463 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24464 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24465 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24466 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24467 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24468 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24469 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24470 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24471 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24472 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24473 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
24474 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
24477 static PyMemberDef __pyx_CyFunction_members[] = {
24478 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
24482 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
24484 #if PY_MAJOR_VERSION >= 3
24485 return PyUnicode_FromString(m->func.m_ml->ml_name);
24487 return PyString_FromString(m->func.m_ml->ml_name);
24490 static PyMethodDef __pyx_CyFunction_methods[] = {
24491 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
24494 #if PY_VERSION_HEX < 0x030500A0
24495 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
24497 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
24499 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
24500 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24501 if (unlikely(op == NULL))
24504 __Pyx_CyFunction_weakreflist(op) = NULL;
24505 op->func.m_ml = ml;
24506 op->func.m_self = (PyObject *) op;
24507 Py_XINCREF(closure);
24508 op->func_closure = closure;
24509 Py_XINCREF(module);
24510 op->func.m_module = module;
24511 op->func_dict = NULL;
24512 op->func_name = NULL;
24513 Py_INCREF(qualname);
24514 op->func_qualname = qualname;
24515 op->func_doc = NULL;
24516 op->func_classobj = NULL;
24517 op->func_globals = globals;
24518 Py_INCREF(op->func_globals);
24520 op->func_code = code;
24521 op->defaults_pyobjects = 0;
24522 op->defaults_size = 0;
24523 op->defaults = NULL;
24524 op->defaults_tuple = NULL;
24525 op->defaults_kwdict = NULL;
24526 op->defaults_getter = NULL;
24527 op->func_annotations = NULL;
24528 return (PyObject *) op;
24531 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
24533 Py_CLEAR(m->func_closure);
24534 Py_CLEAR(m->func.m_module);
24535 Py_CLEAR(m->func_dict);
24536 Py_CLEAR(m->func_name);
24537 Py_CLEAR(m->func_qualname);
24538 Py_CLEAR(m->func_doc);
24539 Py_CLEAR(m->func_globals);
24540 Py_CLEAR(m->func_code);
24541 Py_CLEAR(m->func_classobj);
24542 Py_CLEAR(m->defaults_tuple);
24543 Py_CLEAR(m->defaults_kwdict);
24544 Py_CLEAR(m->func_annotations);
24546 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24548 for (i = 0; i < m->defaults_pyobjects; i++)
24549 Py_XDECREF(pydefaults[i]);
24550 PyObject_Free(m->defaults);
24551 m->defaults = NULL;
24555 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
24557 if (__Pyx_CyFunction_weakreflist(m) != NULL)
24558 PyObject_ClearWeakRefs((PyObject *) m);
24559 __Pyx_CyFunction_clear(m);
24560 PyObject_GC_Del(m);
24562 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
24564 PyObject_GC_UnTrack(m);
24565 __Pyx__CyFunction_dealloc(m);
24567 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
24569 Py_VISIT(m->func_closure);
24570 Py_VISIT(m->func.m_module);
24571 Py_VISIT(m->func_dict);
24572 Py_VISIT(m->func_name);
24573 Py_VISIT(m->func_qualname);
24574 Py_VISIT(m->func_doc);
24575 Py_VISIT(m->func_globals);
24576 Py_VISIT(m->func_code);
24577 Py_VISIT(m->func_classobj);
24578 Py_VISIT(m->defaults_tuple);
24579 Py_VISIT(m->defaults_kwdict);
24581 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24583 for (i = 0; i < m->defaults_pyobjects; i++)
24584 Py_VISIT(pydefaults[i]);
24588 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
24590 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24591 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
24595 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
24597 type = (PyObject *)(Py_TYPE(obj));
24598 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
24600 if (obj == Py_None)
24602 return __Pyx_PyMethod_New(func, obj, type);
24605 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
24607 #if PY_MAJOR_VERSION >= 3
24608 return PyUnicode_FromFormat("<cyfunction %U at %p>",
24609 op->func_qualname, (void *)op);
24611 return PyString_FromFormat("<cyfunction %s at %p>",
24612 PyString_AsString(op->func_qualname), (void *)op);
24615 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
24616 PyCFunctionObject* f = (PyCFunctionObject*)func;
24617 PyCFunction meth = f->m_ml->ml_meth;
24619 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
24621 if (likely(kw == NULL || PyDict_Size(kw) == 0))
24622 return (*meth)(self, arg);
24624 case METH_VARARGS | METH_KEYWORDS:
24625 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
24627 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
24628 size = PyTuple_GET_SIZE(arg);
24629 if (likely(size == 0))
24630 return (*meth)(self, NULL);
24631 PyErr_Format(PyExc_TypeError,
24632 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
24633 f->m_ml->ml_name, size);
24638 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
24639 size = PyTuple_GET_SIZE(arg);
24640 if (likely(size == 1)) {
24641 PyObject *result, *arg0;
24642 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24643 arg0 = PyTuple_GET_ITEM(arg, 0);
24645 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
24647 result = (*meth)(self, arg0);
24648 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
24653 PyErr_Format(PyExc_TypeError,
24654 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
24655 f->m_ml->ml_name, size);
24660 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
24661 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
24662 "longer supported!");
24665 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
24669 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24670 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
24672 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
24674 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
24675 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
24677 PyObject *new_args;
24679 argc = PyTuple_GET_SIZE(args);
24680 new_args = PyTuple_GetSlice(args, 1, argc);
24681 if (unlikely(!new_args))
24683 self = PyTuple_GetItem(args, 0);
24684 if (unlikely(!self)) {
24685 Py_DECREF(new_args);
24688 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
24689 Py_DECREF(new_args);
24691 result = __Pyx_CyFunction_Call(func, args, kw);
24695 static PyTypeObject __pyx_CyFunctionType_type = {
24696 PyVarObject_HEAD_INIT(0, 0)
24697 "cython_function_or_method",
24698 sizeof(__pyx_CyFunctionObject),
24700 (destructor) __Pyx_CyFunction_dealloc,
24704 #if PY_MAJOR_VERSION < 3
24709 (reprfunc) __Pyx_CyFunction_repr,
24714 __Pyx_CyFunction_CallAsMethod,
24719 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
24721 (traverseproc) __Pyx_CyFunction_traverse,
24722 (inquiry) __Pyx_CyFunction_clear,
24724 #if PY_VERSION_HEX < 0x030500A0
24725 offsetof(__pyx_CyFunctionObject, func_weakreflist),
24727 offsetof(PyCFunctionObject, m_weakreflist),
24731 __pyx_CyFunction_methods,
24732 __pyx_CyFunction_members,
24733 __pyx_CyFunction_getsets,
24736 __Pyx_CyFunction_descr_get,
24738 offsetof(__pyx_CyFunctionObject, func_dict),
24751 #if PY_VERSION_HEX >= 0x030400a1
24754 #if PY_VERSION_HEX >= 0x030800b1
24757 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24761 static int __pyx_CyFunction_init(void) {
24762 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
24763 if (unlikely(__pyx_CyFunctionType == NULL)) {
24768 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
24769 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24770 m->defaults = PyObject_Malloc(size);
24771 if (unlikely(!m->defaults))
24772 return PyErr_NoMemory();
24773 memset(m->defaults, 0, size);
24774 m->defaults_pyobjects = pyobjects;
24775 m->defaults_size = size;
24776 return m->defaults;
24778 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
24779 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24780 m->defaults_tuple = tuple;
24783 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
24784 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24785 m->defaults_kwdict = dict;
24788 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
24789 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24790 m->func_annotations = dict;
24794 /* CythonFunction */
24795 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
24796 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24797 PyObject *op = __Pyx_CyFunction_Init(
24798 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
24799 ml, flags, qualname, closure, module, globals, code
24802 PyObject_GC_Track(op);
24807 /* CalculateMetaclass */
24808 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
24809 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
24810 for (i=0; i < nbases; i++) {
24811 PyTypeObject *tmptype;
24812 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
24813 tmptype = Py_TYPE(tmp);
24814 #if PY_MAJOR_VERSION < 3
24815 if (tmptype == &PyClass_Type)
24819 metaclass = tmptype;
24822 if (PyType_IsSubtype(metaclass, tmptype))
24824 if (PyType_IsSubtype(tmptype, metaclass)) {
24825 metaclass = tmptype;
24828 PyErr_SetString(PyExc_TypeError,
24829 "metaclass conflict: "
24830 "the metaclass of a derived class "
24831 "must be a (non-strict) subclass "
24832 "of the metaclasses of all its bases");
24836 #if PY_MAJOR_VERSION < 3
24837 metaclass = &PyClass_Type;
24839 metaclass = &PyType_Type;
24842 Py_INCREF((PyObject*) metaclass);
24843 return (PyObject*) metaclass;
24846 /* Py3ClassCreate */
24847 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
24848 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
24851 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
24853 PyObject *pargs = PyTuple_Pack(2, name, bases);
24854 if (unlikely(!pargs)) {
24858 ns = PyObject_Call(prep, pargs, mkw);
24862 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
24872 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
24873 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
24874 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc_2, doc) < 0)) goto bad;
24880 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
24881 PyObject *dict, PyObject *mkw,
24882 int calculate_metaclass, int allow_py2_metaclass) {
24883 PyObject *result, *margs;
24884 PyObject *owned_metaclass = NULL;
24885 if (allow_py2_metaclass) {
24886 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
24887 if (owned_metaclass) {
24888 metaclass = owned_metaclass;
24889 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
24895 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
24896 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
24897 Py_XDECREF(owned_metaclass);
24898 if (unlikely(!metaclass))
24900 owned_metaclass = metaclass;
24902 margs = PyTuple_Pack(3, name, bases, dict);
24903 if (unlikely(!margs)) {
24906 result = PyObject_Call(metaclass, margs, mkw);
24909 Py_XDECREF(owned_metaclass);
24913 /* RegisterModuleCleanup */
24914 #if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY
24915 static PyObject* __pyx_module_cleanup_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) {
24916 __pyx_module_cleanup(module);
24917 Py_INCREF(Py_None); return Py_None;
24919 static int __Pyx_RegisterCleanup(void) {
24920 static PyMethodDef cleanup_def = {
24921 "__cleanup", (PyCFunction)__pyx_module_cleanup_atexit, METH_NOARGS, 0};
24922 PyObject *cleanup_func = 0;
24923 PyObject *atexit = 0;
24925 PyObject *args = 0;
24928 cleanup_func = PyCFunction_New(&cleanup_def, 0);
24931 atexit = PyImport_ImportModule("atexit");
24934 reg = PyObject_GetAttrString(atexit, "_exithandlers");
24935 if (reg && PyList_Check(reg)) {
24937 a = PyTuple_New(0);
24944 args = PyTuple_Pack(3, cleanup_func, a, kw);
24949 ret = PyList_Insert(reg, 0, args);
24954 reg = PyObject_GetAttrString(atexit, "register");
24957 args = PyTuple_Pack(1, cleanup_func);
24960 res = PyObject_CallObject(reg, args);
24966 Py_XDECREF(cleanup_func);
24967 Py_XDECREF(atexit);
24975 /* CLineInTraceback */
24976 #ifndef CYTHON_CLINE_IN_TRACEBACK
24977 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
24978 PyObject *use_cline;
24979 PyObject *ptype, *pvalue, *ptraceback;
24980 #if CYTHON_COMPILING_IN_CPYTHON
24981 PyObject **cython_runtime_dict;
24983 if (unlikely(!__pyx_cython_runtime)) {
24986 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
24987 #if CYTHON_COMPILING_IN_CPYTHON
24988 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
24989 if (likely(cython_runtime_dict)) {
24990 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
24991 use_cline, *cython_runtime_dict,
24992 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
24996 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
24997 if (use_cline_obj) {
24998 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
24999 Py_DECREF(use_cline_obj);
25007 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25009 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25012 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25017 /* CodeObjectCache */
25018 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25019 int start = 0, mid = 0, end = count - 1;
25020 if (end >= 0 && code_line > entries[end].code_line) {
25023 while (start < end) {
25024 mid = start + (end - start) / 2;
25025 if (code_line < entries[mid].code_line) {
25027 } else if (code_line > entries[mid].code_line) {
25033 if (code_line <= entries[mid].code_line) {
25039 static PyCodeObject *__pyx_find_code_object(int code_line) {
25040 PyCodeObject* code_object;
25042 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25045 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25046 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25049 code_object = __pyx_code_cache.entries[pos].code_object;
25050 Py_INCREF(code_object);
25051 return code_object;
25053 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25055 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25056 if (unlikely(!code_line)) {
25059 if (unlikely(!entries)) {
25060 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25061 if (likely(entries)) {
25062 __pyx_code_cache.entries = entries;
25063 __pyx_code_cache.max_count = 64;
25064 __pyx_code_cache.count = 1;
25065 entries[0].code_line = code_line;
25066 entries[0].code_object = code_object;
25067 Py_INCREF(code_object);
25071 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25072 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25073 PyCodeObject* tmp = entries[pos].code_object;
25074 entries[pos].code_object = code_object;
25078 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25079 int new_max = __pyx_code_cache.max_count + 64;
25080 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25081 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
25082 if (unlikely(!entries)) {
25085 __pyx_code_cache.entries = entries;
25086 __pyx_code_cache.max_count = new_max;
25088 for (i=__pyx_code_cache.count; i>pos; i--) {
25089 entries[i] = entries[i-1];
25091 entries[pos].code_line = code_line;
25092 entries[pos].code_object = code_object;
25093 __pyx_code_cache.count++;
25094 Py_INCREF(code_object);
25098 #include "compile.h"
25099 #include "frameobject.h"
25100 #include "traceback.h"
25101 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25102 const char *funcname, int c_line,
25103 int py_line, const char *filename) {
25104 PyCodeObject *py_code = 0;
25105 PyObject *py_srcfile = 0;
25106 PyObject *py_funcname = 0;
25107 #if PY_MAJOR_VERSION < 3
25108 py_srcfile = PyString_FromString(filename);
25110 py_srcfile = PyUnicode_FromString(filename);
25112 if (!py_srcfile) goto bad;
25114 #if PY_MAJOR_VERSION < 3
25115 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25117 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25121 #if PY_MAJOR_VERSION < 3
25122 py_funcname = PyString_FromString(funcname);
25124 py_funcname = PyUnicode_FromString(funcname);
25127 if (!py_funcname) goto bad;
25128 py_code = __Pyx_PyCode_New(
25134 __pyx_empty_bytes, /*PyObject *code,*/
25135 __pyx_empty_tuple, /*PyObject *consts,*/
25136 __pyx_empty_tuple, /*PyObject *names,*/
25137 __pyx_empty_tuple, /*PyObject *varnames,*/
25138 __pyx_empty_tuple, /*PyObject *freevars,*/
25139 __pyx_empty_tuple, /*PyObject *cellvars,*/
25140 py_srcfile, /*PyObject *filename,*/
25141 py_funcname, /*PyObject *name,*/
25143 __pyx_empty_bytes /*PyObject *lnotab*/
25145 Py_DECREF(py_srcfile);
25146 Py_DECREF(py_funcname);
25149 Py_XDECREF(py_srcfile);
25150 Py_XDECREF(py_funcname);
25153 static void __Pyx_AddTraceback(const char *funcname, int c_line,
25154 int py_line, const char *filename) {
25155 PyCodeObject *py_code = 0;
25156 PyFrameObject *py_frame = 0;
25157 PyThreadState *tstate = __Pyx_PyThreadState_Current;
25159 c_line = __Pyx_CLineForTraceback(tstate, c_line);
25161 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25163 py_code = __Pyx_CreateCodeObjectForTraceback(
25164 funcname, c_line, py_line, filename);
25165 if (!py_code) goto bad;
25166 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25168 py_frame = PyFrame_New(
25169 tstate, /*PyThreadState *tstate,*/
25170 py_code, /*PyCodeObject *code,*/
25171 __pyx_d, /*PyObject *globals,*/
25172 0 /*PyObject *locals*/
25174 if (!py_frame) goto bad;
25175 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25176 PyTraceBack_Here(py_frame);
25178 Py_XDECREF(py_code);
25179 Py_XDECREF(py_frame);
25183 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
25184 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
25185 const int is_unsigned = neg_one > const_zero;
25187 if (sizeof(long) < sizeof(long)) {
25188 return PyInt_FromLong((long) value);
25189 } else if (sizeof(long) <= sizeof(unsigned long)) {
25190 return PyLong_FromUnsignedLong((unsigned long) value);
25191 #ifdef HAVE_LONG_LONG
25192 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25193 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25197 if (sizeof(long) <= sizeof(long)) {
25198 return PyInt_FromLong((long) value);
25199 #ifdef HAVE_LONG_LONG
25200 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25201 return PyLong_FromLongLong((PY_LONG_LONG) value);
25206 int one = 1; int little = (int)*(unsigned char *)&one;
25207 unsigned char *bytes = (unsigned char *)&value;
25208 return _PyLong_FromByteArray(bytes, sizeof(long),
25209 little, !is_unsigned);
25213 /* CIntFromPyVerify */
25214 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25215 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25216 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25217 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25218 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25220 func_type value = func_value;\
25221 if (sizeof(target_type) < sizeof(func_type)) {\
25222 if (unlikely(value != (func_type) (target_type) value)) {\
25223 func_type zero = 0;\
25224 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25225 return (target_type) -1;\
25226 if (is_unsigned && unlikely(value < zero))\
25227 goto raise_neg_overflow;\
25229 goto raise_overflow;\
25232 return (target_type) value;\
25236 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25237 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
25238 const int is_unsigned = neg_one > const_zero;
25239 #if PY_MAJOR_VERSION < 3
25240 if (likely(PyInt_Check(x))) {
25241 if (sizeof(long) < sizeof(long)) {
25242 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25244 long val = PyInt_AS_LONG(x);
25245 if (is_unsigned && unlikely(val < 0)) {
25246 goto raise_neg_overflow;
25252 if (likely(PyLong_Check(x))) {
25254 #if CYTHON_USE_PYLONG_INTERNALS
25255 const digit* digits = ((PyLongObject*)x)->ob_digit;
25256 switch (Py_SIZE(x)) {
25257 case 0: return (long) 0;
25258 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25260 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25261 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25262 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25263 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25264 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25269 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25270 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25271 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25272 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25273 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25278 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25279 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25280 __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])))
25281 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25282 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25288 #if CYTHON_COMPILING_IN_CPYTHON
25289 if (unlikely(Py_SIZE(x) < 0)) {
25290 goto raise_neg_overflow;
25294 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25295 if (unlikely(result < 0))
25297 if (unlikely(result == 1))
25298 goto raise_neg_overflow;
25301 if (sizeof(long) <= sizeof(unsigned long)) {
25302 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25303 #ifdef HAVE_LONG_LONG
25304 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25305 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25309 #if CYTHON_USE_PYLONG_INTERNALS
25310 const digit* digits = ((PyLongObject*)x)->ob_digit;
25311 switch (Py_SIZE(x)) {
25312 case 0: return (long) 0;
25313 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
25314 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
25316 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
25317 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25318 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25319 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25320 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25325 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25326 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25327 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25328 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25329 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25334 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25335 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25336 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25337 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25338 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25343 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25344 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25345 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25346 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25347 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25352 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25353 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25354 __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])))
25355 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25356 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25361 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25362 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25363 __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])))
25364 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25365 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25371 if (sizeof(long) <= sizeof(long)) {
25372 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
25373 #ifdef HAVE_LONG_LONG
25374 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25375 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
25380 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25381 PyErr_SetString(PyExc_RuntimeError,
25382 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25385 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25386 #if PY_MAJOR_VERSION < 3
25387 if (likely(v) && !PyLong_Check(v)) {
25389 v = PyNumber_Long(tmp);
25394 int one = 1; int is_little = (int)*(unsigned char *)&one;
25395 unsigned char *bytes = (unsigned char *)&val;
25396 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25397 bytes, sizeof(val),
25398 is_little, !is_unsigned);
25408 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25409 if (!tmp) return (long) -1;
25410 val = __Pyx_PyInt_As_long(tmp);
25415 PyErr_SetString(PyExc_OverflowError,
25416 "value too large to convert to long");
25418 raise_neg_overflow:
25419 PyErr_SetString(PyExc_OverflowError,
25420 "can't convert negative value to long");
25425 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25426 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
25427 const int is_unsigned = neg_one > const_zero;
25428 #if PY_MAJOR_VERSION < 3
25429 if (likely(PyInt_Check(x))) {
25430 if (sizeof(int) < sizeof(long)) {
25431 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25433 long val = PyInt_AS_LONG(x);
25434 if (is_unsigned && unlikely(val < 0)) {
25435 goto raise_neg_overflow;
25441 if (likely(PyLong_Check(x))) {
25443 #if CYTHON_USE_PYLONG_INTERNALS
25444 const digit* digits = ((PyLongObject*)x)->ob_digit;
25445 switch (Py_SIZE(x)) {
25446 case 0: return (int) 0;
25447 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25449 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25450 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25451 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25452 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25453 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25458 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25459 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25460 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25461 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25462 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25467 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25468 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25469 __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])))
25470 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
25471 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25477 #if CYTHON_COMPILING_IN_CPYTHON
25478 if (unlikely(Py_SIZE(x) < 0)) {
25479 goto raise_neg_overflow;
25483 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25484 if (unlikely(result < 0))
25486 if (unlikely(result == 1))
25487 goto raise_neg_overflow;
25490 if (sizeof(int) <= sizeof(unsigned long)) {
25491 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
25492 #ifdef HAVE_LONG_LONG
25493 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
25494 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25498 #if CYTHON_USE_PYLONG_INTERNALS
25499 const digit* digits = ((PyLongObject*)x)->ob_digit;
25500 switch (Py_SIZE(x)) {
25501 case 0: return (int) 0;
25502 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
25503 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
25505 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
25506 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25507 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25508 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25509 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25514 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25515 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25516 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25517 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25518 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25523 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25524 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25525 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25526 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25527 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25532 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25533 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25534 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25535 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25536 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25541 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25542 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25543 __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])))
25544 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25545 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25550 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25551 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25552 __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])))
25553 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25554 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25560 if (sizeof(int) <= sizeof(long)) {
25561 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
25562 #ifdef HAVE_LONG_LONG
25563 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
25564 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
25569 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25570 PyErr_SetString(PyExc_RuntimeError,
25571 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25574 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25575 #if PY_MAJOR_VERSION < 3
25576 if (likely(v) && !PyLong_Check(v)) {
25578 v = PyNumber_Long(tmp);
25583 int one = 1; int is_little = (int)*(unsigned char *)&one;
25584 unsigned char *bytes = (unsigned char *)&val;
25585 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25586 bytes, sizeof(val),
25587 is_little, !is_unsigned);
25597 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25598 if (!tmp) return (int) -1;
25599 val = __Pyx_PyInt_As_int(tmp);
25604 PyErr_SetString(PyExc_OverflowError,
25605 "value too large to convert to int");
25607 raise_neg_overflow:
25608 PyErr_SetString(PyExc_OverflowError,
25609 "can't convert negative value to int");
25613 /* SwapException */
25614 #if CYTHON_FAST_THREAD_STATE
25615 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25616 PyObject *tmp_type, *tmp_value, *tmp_tb;
25617 #if CYTHON_USE_EXC_INFO_STACK
25618 _PyErr_StackItem *exc_info = tstate->exc_info;
25619 tmp_type = exc_info->exc_type;
25620 tmp_value = exc_info->exc_value;
25621 tmp_tb = exc_info->exc_traceback;
25622 exc_info->exc_type = *type;
25623 exc_info->exc_value = *value;
25624 exc_info->exc_traceback = *tb;
25626 tmp_type = tstate->exc_type;
25627 tmp_value = tstate->exc_value;
25628 tmp_tb = tstate->exc_traceback;
25629 tstate->exc_type = *type;
25630 tstate->exc_value = *value;
25631 tstate->exc_traceback = *tb;
25634 *value = tmp_value;
25638 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
25639 PyObject *tmp_type, *tmp_value, *tmp_tb;
25640 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
25641 PyErr_SetExcInfo(*type, *value, *tb);
25643 *value = tmp_value;
25648 /* CoroutineBase */
25649 #include <structmember.h>
25650 #include <frameobject.h>
25651 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
25652 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
25653 PyObject *et, *ev, *tb;
25654 PyObject *value = NULL;
25655 __Pyx_ErrFetch(&et, &ev, &tb);
25659 Py_INCREF(Py_None);
25663 if (likely(et == PyExc_StopIteration)) {
25665 Py_INCREF(Py_None);
25668 #if PY_VERSION_HEX >= 0x030300A0
25669 else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
25670 value = ((PyStopIterationObject *)ev)->value;
25675 else if (unlikely(PyTuple_Check(ev))) {
25676 if (PyTuple_GET_SIZE(ev) >= 1) {
25677 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25678 value = PyTuple_GET_ITEM(ev, 0);
25681 value = PySequence_ITEM(ev, 0);
25684 Py_INCREF(Py_None);
25689 else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
25692 if (likely(value)) {
25698 } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
25699 __Pyx_ErrRestore(et, ev, tb);
25702 PyErr_NormalizeException(&et, &ev, &tb);
25703 if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
25704 __Pyx_ErrRestore(et, ev, tb);
25709 #if PY_VERSION_HEX >= 0x030300A0
25710 value = ((PyStopIterationObject *)ev)->value;
25715 PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
25717 if (likely(args)) {
25718 value = PySequence_GetItem(args, 0);
25721 if (unlikely(!value)) {
25722 __Pyx_ErrRestore(NULL, NULL, NULL);
25723 Py_INCREF(Py_None);
25731 static CYTHON_INLINE
25732 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
25733 PyObject *t, *v, *tb;
25734 t = exc_state->exc_type;
25735 v = exc_state->exc_value;
25736 tb = exc_state->exc_traceback;
25737 exc_state->exc_type = NULL;
25738 exc_state->exc_value = NULL;
25739 exc_state->exc_traceback = NULL;
25744 #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
25745 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
25748 #ifdef __Pyx_Coroutine_USED
25749 } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
25750 msg = "coroutine already executing";
25752 #ifdef __Pyx_AsyncGen_USED
25753 } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
25754 msg = "async generator already executing";
25757 msg = "generator already executing";
25759 PyErr_SetString(PyExc_ValueError, msg);
25761 #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
25762 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
25765 #ifdef __Pyx_Coroutine_USED
25766 } else if (__Pyx_Coroutine_Check(gen)) {
25767 msg = "can't send non-None value to a just-started coroutine";
25769 #ifdef __Pyx_AsyncGen_USED
25770 } else if (__Pyx_AsyncGen_CheckExact(gen)) {
25771 msg = "can't send non-None value to a just-started async generator";
25774 msg = "can't send non-None value to a just-started generator";
25776 PyErr_SetString(PyExc_TypeError, msg);
25778 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
25779 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
25780 #ifdef __Pyx_Coroutine_USED
25781 if (!closing && __Pyx_Coroutine_Check(gen)) {
25782 PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
25786 #ifdef __Pyx_AsyncGen_USED
25787 if (__Pyx_AsyncGen_CheckExact(gen))
25788 PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
25791 PyErr_SetNone(PyExc_StopIteration);
25795 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
25796 __Pyx_PyThreadState_declare
25797 PyThreadState *tstate;
25798 __Pyx_ExcInfoStruct *exc_state;
25800 assert(!self->is_running);
25801 if (unlikely(self->resume_label == 0)) {
25802 if (unlikely(value && value != Py_None)) {
25803 return __Pyx_Coroutine_NotStartedError((PyObject*)self);
25806 if (unlikely(self->resume_label == -1)) {
25807 return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
25809 #if CYTHON_FAST_THREAD_STATE
25810 __Pyx_PyThreadState_assign
25811 tstate = __pyx_tstate;
25813 tstate = __Pyx_PyThreadState_Current;
25815 exc_state = &self->gi_exc_state;
25816 if (exc_state->exc_type) {
25817 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
25819 if (exc_state->exc_traceback) {
25820 PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
25821 PyFrameObject *f = tb->tb_frame;
25822 Py_XINCREF(tstate->frame);
25823 assert(f->f_back == NULL);
25824 f->f_back = tstate->frame;
25828 #if CYTHON_USE_EXC_INFO_STACK
25829 exc_state->previous_item = tstate->exc_info;
25830 tstate->exc_info = exc_state;
25832 if (exc_state->exc_type) {
25833 __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
25835 __Pyx_Coroutine_ExceptionClear(exc_state);
25836 __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
25839 self->is_running = 1;
25840 retval = self->body((PyObject *) self, tstate, value);
25841 self->is_running = 0;
25842 #if CYTHON_USE_EXC_INFO_STACK
25843 exc_state = &self->gi_exc_state;
25844 tstate->exc_info = exc_state->previous_item;
25845 exc_state->previous_item = NULL;
25846 __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
25850 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
25851 PyObject *exc_tb = exc_state->exc_traceback;
25852 if (likely(exc_tb)) {
25853 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
25855 PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
25856 PyFrameObject *f = tb->tb_frame;
25857 Py_CLEAR(f->f_back);
25861 static CYTHON_INLINE
25862 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
25863 if (unlikely(!retval)) {
25864 __Pyx_PyThreadState_declare
25865 __Pyx_PyThreadState_assign
25866 if (!__Pyx_PyErr_Occurred()) {
25867 PyObject *exc = PyExc_StopIteration;
25868 #ifdef __Pyx_AsyncGen_USED
25869 if (__Pyx_AsyncGen_CheckExact(gen))
25870 exc = __Pyx_PyExc_StopAsyncIteration;
25872 __Pyx_PyErr_SetNone(exc);
25877 static CYTHON_INLINE
25878 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
25880 PyObject *val = NULL;
25881 __Pyx_Coroutine_Undelegate(gen);
25882 __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
25883 ret = __Pyx_Coroutine_SendEx(gen, val, 0);
25887 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
25889 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
25890 PyObject *yf = gen->yieldfrom;
25891 if (unlikely(gen->is_running))
25892 return __Pyx_Coroutine_AlreadyRunningError(gen);
25895 gen->is_running = 1;
25896 #ifdef __Pyx_Generator_USED
25897 if (__Pyx_Generator_CheckExact(yf)) {
25898 ret = __Pyx_Coroutine_Send(yf, value);
25901 #ifdef __Pyx_Coroutine_USED
25902 if (__Pyx_Coroutine_Check(yf)) {
25903 ret = __Pyx_Coroutine_Send(yf, value);
25906 #ifdef __Pyx_AsyncGen_USED
25907 if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
25908 ret = __Pyx_async_gen_asend_send(yf, value);
25911 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
25912 if (PyGen_CheckExact(yf)) {
25913 ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
25916 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
25917 if (PyCoro_CheckExact(yf)) {
25918 ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
25922 if (value == Py_None)
25923 ret = Py_TYPE(yf)->tp_iternext(yf);
25925 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
25927 gen->is_running = 0;
25931 retval = __Pyx_Coroutine_FinishDelegation(gen);
25933 retval = __Pyx_Coroutine_SendEx(gen, value, 0);
25935 return __Pyx_Coroutine_MethodReturn(self, retval);
25937 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
25938 PyObject *retval = NULL;
25940 #ifdef __Pyx_Generator_USED
25941 if (__Pyx_Generator_CheckExact(yf)) {
25942 retval = __Pyx_Coroutine_Close(yf);
25947 #ifdef __Pyx_Coroutine_USED
25948 if (__Pyx_Coroutine_Check(yf)) {
25949 retval = __Pyx_Coroutine_Close(yf);
25953 if (__Pyx_CoroutineAwait_CheckExact(yf)) {
25954 retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
25959 #ifdef __Pyx_AsyncGen_USED
25960 if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
25961 retval = __Pyx_async_gen_asend_close(yf, NULL);
25963 if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
25964 retval = __Pyx_async_gen_athrow_close(yf, NULL);
25969 gen->is_running = 1;
25970 meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
25971 if (unlikely(!meth)) {
25972 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
25973 PyErr_WriteUnraisable(yf);
25977 retval = PyObject_CallFunction(meth, NULL);
25982 gen->is_running = 0;
25984 Py_XDECREF(retval);
25987 static PyObject *__Pyx_Generator_Next(PyObject *self) {
25988 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
25989 PyObject *yf = gen->yieldfrom;
25990 if (unlikely(gen->is_running))
25991 return __Pyx_Coroutine_AlreadyRunningError(gen);
25994 gen->is_running = 1;
25995 #ifdef __Pyx_Generator_USED
25996 if (__Pyx_Generator_CheckExact(yf)) {
25997 ret = __Pyx_Generator_Next(yf);
26000 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
26001 if (PyGen_CheckExact(yf)) {
26002 ret = _PyGen_Send((PyGenObject*)yf, NULL);
26005 #ifdef __Pyx_Coroutine_USED
26006 if (__Pyx_Coroutine_Check(yf)) {
26007 ret = __Pyx_Coroutine_Send(yf, Py_None);
26010 ret = Py_TYPE(yf)->tp_iternext(yf);
26011 gen->is_running = 0;
26015 return __Pyx_Coroutine_FinishDelegation(gen);
26017 return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
26019 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
26020 return __Pyx_Coroutine_Close(self);
26022 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
26023 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26024 PyObject *retval, *raised_exception;
26025 PyObject *yf = gen->yieldfrom;
26027 if (unlikely(gen->is_running))
26028 return __Pyx_Coroutine_AlreadyRunningError(gen);
26031 err = __Pyx_Coroutine_CloseIter(gen, yf);
26032 __Pyx_Coroutine_Undelegate(gen);
26036 PyErr_SetNone(PyExc_GeneratorExit);
26037 retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
26038 if (unlikely(retval)) {
26042 #ifdef __Pyx_Coroutine_USED
26043 } else if (__Pyx_Coroutine_Check(self)) {
26044 msg = "coroutine ignored GeneratorExit";
26046 #ifdef __Pyx_AsyncGen_USED
26047 } else if (__Pyx_AsyncGen_CheckExact(self)) {
26048 #if PY_VERSION_HEX < 0x03060000
26049 msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
26051 msg = "async generator ignored GeneratorExit";
26055 msg = "generator ignored GeneratorExit";
26057 PyErr_SetString(PyExc_RuntimeError, msg);
26060 raised_exception = PyErr_Occurred();
26061 if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
26062 if (raised_exception) PyErr_Clear();
26063 Py_INCREF(Py_None);
26068 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
26069 PyObject *args, int close_on_genexit) {
26070 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26071 PyObject *yf = gen->yieldfrom;
26072 if (unlikely(gen->is_running))
26073 return __Pyx_Coroutine_AlreadyRunningError(gen);
26077 if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
26078 int err = __Pyx_Coroutine_CloseIter(gen, yf);
26080 __Pyx_Coroutine_Undelegate(gen);
26082 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
26085 gen->is_running = 1;
26087 #ifdef __Pyx_Generator_USED
26088 || __Pyx_Generator_CheckExact(yf)
26090 #ifdef __Pyx_Coroutine_USED
26091 || __Pyx_Coroutine_Check(yf)
26094 ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
26095 #ifdef __Pyx_Coroutine_USED
26096 } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
26097 ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
26100 PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
26101 if (unlikely(!meth)) {
26103 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
26104 gen->is_running = 0;
26108 __Pyx_Coroutine_Undelegate(gen);
26109 gen->is_running = 0;
26112 if (likely(args)) {
26113 ret = PyObject_CallObject(meth, args);
26115 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
26119 gen->is_running = 0;
26122 ret = __Pyx_Coroutine_FinishDelegation(gen);
26124 return __Pyx_Coroutine_MethodReturn(self, ret);
26127 __Pyx_Raise(typ, val, tb, NULL);
26128 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
26130 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
26132 PyObject *val = NULL;
26133 PyObject *tb = NULL;
26134 if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
26136 return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
26138 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
26139 Py_VISIT(exc_state->exc_type);
26140 Py_VISIT(exc_state->exc_value);
26141 Py_VISIT(exc_state->exc_traceback);
26144 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
26145 Py_VISIT(gen->closure);
26146 Py_VISIT(gen->classobj);
26147 Py_VISIT(gen->yieldfrom);
26148 return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
26150 static int __Pyx_Coroutine_clear(PyObject *self) {
26151 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26152 Py_CLEAR(gen->closure);
26153 Py_CLEAR(gen->classobj);
26154 Py_CLEAR(gen->yieldfrom);
26155 __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
26156 #ifdef __Pyx_AsyncGen_USED
26157 if (__Pyx_AsyncGen_CheckExact(self)) {
26158 Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
26161 Py_CLEAR(gen->gi_code);
26162 Py_CLEAR(gen->gi_name);
26163 Py_CLEAR(gen->gi_qualname);
26164 Py_CLEAR(gen->gi_modulename);
26167 static void __Pyx_Coroutine_dealloc(PyObject *self) {
26168 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26169 PyObject_GC_UnTrack(gen);
26170 if (gen->gi_weakreflist != NULL)
26171 PyObject_ClearWeakRefs(self);
26172 if (gen->resume_label >= 0) {
26173 PyObject_GC_Track(self);
26174 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
26175 if (PyObject_CallFinalizerFromDealloc(self))
26177 Py_TYPE(gen)->tp_del(self);
26178 if (self->ob_refcnt > 0)
26183 PyObject_GC_UnTrack(self);
26185 #ifdef __Pyx_AsyncGen_USED
26186 if (__Pyx_AsyncGen_CheckExact(self)) {
26187 /* We have to handle this case for asynchronous generators
26188 right here, because this code has to be between UNTRACK
26190 Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
26193 __Pyx_Coroutine_clear(self);
26194 PyObject_GC_Del(gen);
26196 static void __Pyx_Coroutine_del(PyObject *self) {
26197 PyObject *error_type, *error_value, *error_traceback;
26198 __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26199 __Pyx_PyThreadState_declare
26200 if (gen->resume_label < 0) {
26203 #if !CYTHON_USE_TP_FINALIZE
26204 assert(self->ob_refcnt == 0);
26205 self->ob_refcnt = 1;
26207 __Pyx_PyThreadState_assign
26208 __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
26209 #ifdef __Pyx_AsyncGen_USED
26210 if (__Pyx_AsyncGen_CheckExact(self)) {
26211 __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
26212 PyObject *finalizer = agen->ag_finalizer;
26213 if (finalizer && !agen->ag_closed) {
26214 PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
26215 if (unlikely(!res)) {
26216 PyErr_WriteUnraisable(self);
26220 __Pyx_ErrRestore(error_type, error_value, error_traceback);
26225 if (unlikely(gen->resume_label == 0 && !error_value)) {
26226 #ifdef __Pyx_Coroutine_USED
26227 #ifdef __Pyx_Generator_USED
26228 if (!__Pyx_Generator_CheckExact(self))
26231 PyObject_GC_UnTrack(self);
26232 #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
26233 if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
26234 PyErr_WriteUnraisable(self);
26238 #if CYTHON_COMPILING_IN_PYPY
26240 cmsg = (char*) "coroutine was never awaited";
26243 PyObject *qualname;
26244 qualname = gen->gi_qualname;
26245 cname = PyString_AS_STRING(qualname);
26246 msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
26247 if (unlikely(!msg)) {
26249 cmsg = (char*) "coroutine was never awaited";
26251 cmsg = PyString_AS_STRING(msg);
26254 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
26255 PyErr_WriteUnraisable(self);
26258 PyObject_GC_Track(self);
26262 PyObject *res = __Pyx_Coroutine_Close(self);
26263 if (unlikely(!res)) {
26264 if (PyErr_Occurred())
26265 PyErr_WriteUnraisable(self);
26270 __Pyx_ErrRestore(error_type, error_value, error_traceback);
26271 #if !CYTHON_USE_TP_FINALIZE
26272 assert(self->ob_refcnt > 0);
26273 if (--self->ob_refcnt == 0) {
26277 Py_ssize_t refcnt = self->ob_refcnt;
26278 _Py_NewReference(self);
26279 self->ob_refcnt = refcnt;
26281 #if CYTHON_COMPILING_IN_CPYTHON
26282 assert(PyType_IS_GC(self->ob_type) &&
26283 _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
26286 #ifdef COUNT_ALLOCS
26287 --Py_TYPE(self)->tp_frees;
26288 --Py_TYPE(self)->tp_allocs;
26293 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
26295 PyObject *name = self->gi_name;
26296 if (unlikely(!name)) name = Py_None;
26301 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
26304 #if PY_MAJOR_VERSION >= 3
26305 if (unlikely(value == NULL || !PyUnicode_Check(value)))
26307 if (unlikely(value == NULL || !PyString_Check(value)))
26310 PyErr_SetString(PyExc_TypeError,
26311 "__name__ must be set to a string object");
26314 tmp = self->gi_name;
26316 self->gi_name = value;
26321 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
26323 PyObject *name = self->gi_qualname;
26324 if (unlikely(!name)) name = Py_None;
26329 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
26332 #if PY_MAJOR_VERSION >= 3
26333 if (unlikely(value == NULL || !PyUnicode_Check(value)))
26335 if (unlikely(value == NULL || !PyString_Check(value)))
26338 PyErr_SetString(PyExc_TypeError,
26339 "__qualname__ must be set to a string object");
26342 tmp = self->gi_qualname;
26344 self->gi_qualname = value;
26348 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
26349 PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
26350 PyObject *name, PyObject *qualname, PyObject *module_name) {
26351 __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
26352 if (unlikely(!gen))
26354 return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
26356 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
26357 __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
26358 PyObject *name, PyObject *qualname, PyObject *module_name) {
26360 gen->closure = closure;
26361 Py_XINCREF(closure);
26362 gen->is_running = 0;
26363 gen->resume_label = 0;
26364 gen->classobj = NULL;
26365 gen->yieldfrom = NULL;
26366 gen->gi_exc_state.exc_type = NULL;
26367 gen->gi_exc_state.exc_value = NULL;
26368 gen->gi_exc_state.exc_traceback = NULL;
26369 #if CYTHON_USE_EXC_INFO_STACK
26370 gen->gi_exc_state.previous_item = NULL;
26372 gen->gi_weakreflist = NULL;
26373 Py_XINCREF(qualname);
26374 gen->gi_qualname = qualname;
26376 gen->gi_name = name;
26377 Py_XINCREF(module_name);
26378 gen->gi_modulename = module_name;
26380 gen->gi_code = code;
26381 PyObject_GC_Track(gen);
26385 /* PatchModuleWithCoroutine */
26386 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
26387 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26389 PyObject *globals, *result_obj;
26390 globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
26391 result = PyDict_SetItemString(globals, "_cython_coroutine_type",
26392 #ifdef __Pyx_Coroutine_USED
26393 (PyObject*)__pyx_CoroutineType);
26397 if (unlikely(result < 0)) goto ignore;
26398 result = PyDict_SetItemString(globals, "_cython_generator_type",
26399 #ifdef __Pyx_Generator_USED
26400 (PyObject*)__pyx_GeneratorType);
26404 if (unlikely(result < 0)) goto ignore;
26405 if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
26406 if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
26407 result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
26408 if (unlikely(!result_obj)) goto ignore;
26409 Py_DECREF(result_obj);
26410 Py_DECREF(globals);
26413 Py_XDECREF(globals);
26414 PyErr_WriteUnraisable(module);
26415 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
26425 /* PatchGeneratorABC */
26426 #ifndef CYTHON_REGISTER_ABCS
26427 #define CYTHON_REGISTER_ABCS 1
26429 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26430 static PyObject* __Pyx_patch_abc_module(PyObject *module);
26431 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
26432 module = __Pyx_Coroutine_patch_module(
26434 "if _cython_generator_type is not None:\n"
26435 " try: Generator = _module.Generator\n"
26436 " except AttributeError: pass\n"
26437 " else: Generator.register(_cython_generator_type)\n"
26438 "if _cython_coroutine_type is not None:\n"
26439 " try: Coroutine = _module.Coroutine\n"
26440 " except AttributeError: pass\n"
26441 " else: Coroutine.register(_cython_coroutine_type)\n"
26446 static int __Pyx_patch_abc(void) {
26447 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26448 static int abc_patched = 0;
26449 if (CYTHON_REGISTER_ABCS && !abc_patched) {
26451 module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
26453 PyErr_WriteUnraisable(NULL);
26454 if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
26455 ((PY_MAJOR_VERSION >= 3) ?
26456 "Cython module failed to register with collections.abc module" :
26457 "Cython module failed to register with collections module"), 1) < 0)) {
26461 module = __Pyx_patch_abc_module(module);
26463 if (unlikely(!module))
26467 module = PyImport_ImportModule("backports_abc");
26469 module = __Pyx_patch_abc_module(module);
26470 Py_XDECREF(module);
26477 if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
26483 static PyMethodDef __pyx_Generator_methods[] = {
26484 {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
26485 (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
26486 {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
26487 (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
26488 {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
26489 (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
26492 static PyMemberDef __pyx_Generator_memberlist[] = {
26493 {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
26494 {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
26495 (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
26496 {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
26499 static PyGetSetDef __pyx_Generator_getsets[] = {
26500 {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
26501 (char*) PyDoc_STR("name of the generator"), 0},
26502 {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
26503 (char*) PyDoc_STR("qualified name of the generator"), 0},
26506 static PyTypeObject __pyx_GeneratorType_type = {
26507 PyVarObject_HEAD_INIT(0, 0)
26509 sizeof(__pyx_CoroutineObject),
26511 (destructor) __Pyx_Coroutine_dealloc,
26526 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
26528 (traverseproc) __Pyx_Coroutine_traverse,
26531 offsetof(__pyx_CoroutineObject, gi_weakreflist),
26533 (iternextfunc) __Pyx_Generator_Next,
26534 __pyx_Generator_methods,
26535 __pyx_Generator_memberlist,
26536 __pyx_Generator_getsets,
26552 #if CYTHON_USE_TP_FINALIZE
26555 __Pyx_Coroutine_del,
26558 #if CYTHON_USE_TP_FINALIZE
26559 __Pyx_Coroutine_del,
26560 #elif PY_VERSION_HEX >= 0x030400a1
26563 #if PY_VERSION_HEX >= 0x030800b1
26566 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
26570 static int __pyx_Generator_init(void) {
26571 __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
26572 __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
26573 __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
26574 if (unlikely(!__pyx_GeneratorType)) {
26580 /* CheckBinaryVersion */
26581 static int __Pyx_check_binary_version(void) {
26582 char ctversion[4], rtversion[4];
26583 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
26584 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
26585 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
26587 PyOS_snprintf(message, sizeof(message),
26588 "compiletime version %s of module '%.100s' "
26589 "does not match runtime version %s",
26590 ctversion, __Pyx_MODULE_NAME, rtversion);
26591 return PyErr_WarnEx(NULL, message, 1);
26597 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
26599 #if PY_MAJOR_VERSION < 3
26600 if (t->is_unicode) {
26601 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
26602 } else if (t->intern) {
26603 *t->p = PyString_InternFromString(t->s);
26605 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
26608 if (t->is_unicode | t->is_str) {
26610 *t->p = PyUnicode_InternFromString(t->s);
26611 } else if (t->encoding) {
26612 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
26614 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
26617 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
26622 if (PyObject_Hash(*t->p) == -1)
26629 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
26630 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
26632 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
26634 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
26636 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26637 #if !CYTHON_PEP393_ENABLED
26638 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26640 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
26641 if (!defenc) return NULL;
26642 defenc_c = PyBytes_AS_STRING(defenc);
26643 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26645 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
26647 for (c = defenc_c; c < end; c++) {
26648 if ((unsigned char) (*c) >= 128) {
26649 PyUnicode_AsASCIIString(o);
26655 *length = PyBytes_GET_SIZE(defenc);
26659 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26660 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
26661 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26662 if (likely(PyUnicode_IS_ASCII(o))) {
26663 *length = PyUnicode_GET_LENGTH(o);
26664 return PyUnicode_AsUTF8(o);
26666 PyUnicode_AsASCIIString(o);
26670 return PyUnicode_AsUTF8AndSize(o, length);
26675 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26676 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26678 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26679 __Pyx_sys_getdefaultencoding_not_ascii &&
26681 PyUnicode_Check(o)) {
26682 return __Pyx_PyUnicode_AsStringAndSize(o, length);
26685 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
26686 if (PyByteArray_Check(o)) {
26687 *length = PyByteArray_GET_SIZE(o);
26688 return PyByteArray_AS_STRING(o);
26693 int r = PyBytes_AsStringAndSize(o, &result, length);
26694 if (unlikely(r < 0)) {
26701 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26702 int is_true = x == Py_True;
26703 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26704 else return PyObject_IsTrue(x);
26706 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26708 if (unlikely(!x)) return -1;
26709 retval = __Pyx_PyObject_IsTrue(x);
26713 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26714 #if PY_MAJOR_VERSION >= 3
26715 if (PyLong_Check(result)) {
26716 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26717 "__int__ returned non-int (type %.200s). "
26718 "The ability to return an instance of a strict subclass of int "
26719 "is deprecated, and may be removed in a future version of Python.",
26720 Py_TYPE(result)->tp_name)) {
26727 PyErr_Format(PyExc_TypeError,
26728 "__%.4s__ returned non-%.4s (type %.200s)",
26729 type_name, type_name, Py_TYPE(result)->tp_name);
26733 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26734 #if CYTHON_USE_TYPE_SLOTS
26735 PyNumberMethods *m;
26737 const char *name = NULL;
26738 PyObject *res = NULL;
26739 #if PY_MAJOR_VERSION < 3
26740 if (likely(PyInt_Check(x) || PyLong_Check(x)))
26742 if (likely(PyLong_Check(x)))
26744 return __Pyx_NewRef(x);
26745 #if CYTHON_USE_TYPE_SLOTS
26746 m = Py_TYPE(x)->tp_as_number;
26747 #if PY_MAJOR_VERSION < 3
26748 if (m && m->nb_int) {
26750 res = m->nb_int(x);
26752 else if (m && m->nb_long) {
26754 res = m->nb_long(x);
26757 if (likely(m && m->nb_int)) {
26759 res = m->nb_int(x);
26763 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26764 res = PyNumber_Int(x);
26768 #if PY_MAJOR_VERSION < 3
26769 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26771 if (unlikely(!PyLong_CheckExact(res))) {
26773 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26776 else if (!PyErr_Occurred()) {
26777 PyErr_SetString(PyExc_TypeError,
26778 "an integer is required");
26782 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26785 #if PY_MAJOR_VERSION < 3
26786 if (likely(PyInt_CheckExact(b))) {
26787 if (sizeof(Py_ssize_t) >= sizeof(long))
26788 return PyInt_AS_LONG(b);
26790 return PyInt_AsSsize_t(b);
26793 if (likely(PyLong_CheckExact(b))) {
26794 #if CYTHON_USE_PYLONG_INTERNALS
26795 const digit* digits = ((PyLongObject*)b)->ob_digit;
26796 const Py_ssize_t size = Py_SIZE(b);
26797 if (likely(__Pyx_sst_abs(size) <= 1)) {
26798 ival = likely(size) ? digits[0] : 0;
26799 if (size == -1) ival = -ival;
26804 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26805 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26809 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26810 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26814 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26815 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26819 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26820 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26824 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26825 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]));
26829 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26830 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]));
26836 return PyLong_AsSsize_t(b);
26838 x = PyNumber_Index(b);
26840 ival = PyInt_AsSsize_t(x);
26844 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26845 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26847 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26848 return PyInt_FromSize_t(ival);
26852 #endif /* Py_PYTHON_H */